[Mesa-dev] [v3 1/4] glsl: add ir_cache class for IR serialization (WIP)

Eric Anholt eric at anholt.net
Tue Oct 8 13:03:00 PDT 2013

Tapani Pälli <tapani.palli at intel.com> writes:

> Patch introduces ir_cache class that can serialize a gl_shader
> to memory with help of memory_writer class and also unserialize
> it back with help of memory_map class.
> This can be used by the shader compiler to cache individual shaders
> and skip lexing, parsing, type checking, AST->IR generation and
> optimization rounds that happen during compilation.
> v2: fix builtin function handling in read_ir_function(), now
> generated IR is identical with original
> v3: piglit crash fixes, dump more data
> Known issues / bugs / missing implementation:
> - constant structures not supported
> - interfaces not supported
> - no support for geometry shader emit_vertex, emit_primitive
> - write/read file i/o likely not portable to some architectures

We don't use templates in our C++ code -- it was one of the agreements
for letting C++ into the project.

I think the use of templates for the write() function looks convenient
but is a bad idea in general.  You want to be clear about the types
being written to files.  For example you've got some "long"s being
written which means that they'll read back incorrectly when mixing
32-bit and 64-bit programs on the same system.  I'd rather see a set of
explicit sized overloads so that the developer have a harder time making
this mistake or similar ones like write(ir_variable *var).

We'll also need to make sure that the driver in use gets put in the
cache key along with the mesa sha, and probably the driconf
configuration as well.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131008/8571c269/attachment.pgp>

More information about the mesa-dev mailing list