Hi,

This is a start of reworking how st/mesa translates and creates shaders. The 
result of this patch series is this:

In LinkShader or ProgramStringNotify, the shader is translated to TGSI as-is. 
There are no shader code modifications for shader variants. The glsl-to-tgsi 
visitor is released.

We can't release the GLSL IR at this point yet, because core Mesa needs it for 
program resource queries at least.

That's the only place st/mesa interacts with Mesa IR and GLSL IR. After that, 
it only works with the TGSI representation.

When we get to a draw call, tgsi_transform_shader is used to modify shaders to 
produce shader variants. It does:
- feature emulation (color clamping, per-sample shading, edgeflags)
- adding glDrawPixels shader code
- adding glBitmap shader code

All the shader transformations are rewritten completely. There is no patching 
with Mesa IR or glsl-to-tgsi anymore.

It shouldn't be so difficult to add support for some new IR or phase out Mesa 
IR and GLSL IR support at some point.

The main motivations for this series are:
- translate to TGSI as soon as possible
- possibility to create gallium shaders after that if drivers don't need many 
variants
- if variants are needed, the path to get them is much simpler

There will be part 2 when it's ready.

Please review. Thanks.

 src/gallium/auxiliary/Makefile.sources           |   2 +
 src/gallium/auxiliary/tgsi/tgsi_emulate.c        | 168 
+++++++++++++++++++++++++++++
 src/gallium/auxiliary/tgsi/tgsi_emulate.h        |  38 +++++++
 src/gallium/auxiliary/tgsi/tgsi_scan.c           |   2 +
 src/gallium/auxiliary/tgsi/tgsi_scan.h           |   1 +
 src/mesa/Makefile.sources                        |   2 +
 src/mesa/main/ffvertex_prog.c                    |   3 +-
 src/mesa/state_tracker/st_atom_pixeltransfer.c   | 225 
++-------------------------------------
 src/mesa/state_tracker/st_cb_bitmap.c            | 145 
-------------------------
 src/mesa/state_tracker/st_cb_bitmap.h            |  11 +-
 src/mesa/state_tracker/st_cb_bitmap_shader.c     | 174 
++++++++++++++++++++++++++++++
 src/mesa/state_tracker/st_cb_drawpixels.c        | 349 
+++++++++++++++++++-----------------------------------------
 src/mesa/state_tracker/st_cb_drawpixels.h        |  17 ++-
 src/mesa/state_tracker/st_cb_drawpixels_shader.c | 278 
++++++++++++++++++++++++++++++++++++++++++++++++
 src/mesa/state_tracker/st_cb_program.c           |  12 ++-
 src/mesa/state_tracker/st_context.c              |   6 +-
 src/mesa/state_tracker/st_context.h              |   9 +-
 src/mesa/state_tracker/st_debug.c                |   2 +-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp       | 258 
+-------------------------------------------
 src/mesa/state_tracker/st_glsl_to_tgsi.h         |  10 +-
 src/mesa/state_tracker/st_mesa_to_tgsi.c         |  50 +--------
 src/mesa/state_tracker/st_mesa_to_tgsi.h         |   4 +-
 src/mesa/state_tracker/st_program.c              | 566 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------
 src/mesa/state_tracker/st_program.h              |  47 ++++----
 24 files changed, 1178 insertions(+), 1201 deletions(-)

Marek
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to