[Mesa-dev] shader compile

Alejandro Piñeiro apinheiro at igalia.com
Thu Dec 21 10:48:45 UTC 2017


On 21/12/17 08:21, 吴畏 wrote:
> Hello,every
> I want to know why vertex shader and fragment shader are compiled to
> many shader binarys.

So many binaries? Do you mean the intermediate representations? AST, IR,
NIR, TGSI ...?

> When and where these bianrys are linked

flex/bison creates a AST representation, that it is a raw representation
of the shader. It is converted to IR. Take a look to
src/compiler/glsl/ast_to_hir.cpp

For GLSL and for most backends, the linking is done using IR. Take a
look to src/compiler/linker.cpp

Although IR is a real intermediate representation, these days most of
the backends doesn't use it to generate the final assembly.

i965 intel backed converts it to NIR. Take a look to
src/compiler/glsl/glsl_to_nir.cpp for the conversion, and
src/compiler/nir/nir.h for nir in general.

Some time ago I wrote a blog post about those intermediate
representations. If you are curious:
https://blogs.igalia.com/apinheiro/2016/06/02/introducing-mesa-intermediate-representations-on-intel-drivers-with-a-practical-example/


> and uploaded?

What do you mean for uploaded?

BR



More information about the mesa-dev mailing list