diff options
author | Brian Paul <[email protected]> | 2011-11-03 17:40:56 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-11-03 17:41:08 -0600 |
commit | 58ea42b7db72586563914dea6fed9656caaf7678 (patch) | |
tree | 3e04b2337d23bba8ad120e0d99cef0e2a1893901 /src/gallium/drivers/svga/svga_tgsi.h | |
parent | e814d577253d3b618cc40e36f9d50b42fe61d6ed (diff) |
svga: implement generic variable index remapping
The state tracker may generate shaders that use generic vs outputs /
fs inputs like:
DCL IN[0], GENERIC[0]
DCL IN[1], GENERIC[10]
DCL IN[2], GENERIC[11]
This patch remaps 0, 10, 11 to small integers like 1, 2, 3 so that we
stay inside the SVGA3D limit (8).
The remapping is done to both the vertex shader outputs and the
fragment shader inputs. The same mapping must be used for a vs/fs
pair.
Note that 'union svga_compile_key' is now 'struct svga_compile_key'
because we needed to add the register remapping table. The change in
size isn't really significant though (it's not a search key).
Also, add assertions when building up SVGA3D src/dst registers to we
don't try to store too large of value for the bitfield size.
Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_tgsi.h')
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi.h b/src/gallium/drivers/svga/svga_tgsi.h index 214e113aaaa..01367e971da 100644 --- a/src/gallium/drivers/svga/svga_tgsi.h +++ b/src/gallium/drivers/svga/svga_tgsi.h @@ -30,6 +30,13 @@ #include "svga_hw_reg.h" + +/** + * We use a 32-bit mask to keep track of the generic indexes. + */ +#define MAX_GENERIC_VARYING 32 + + struct svga_fragment_shader; struct svga_vertex_shader; struct svga_shader; @@ -39,6 +46,7 @@ struct tgsi_token; struct svga_vs_compile_key { + unsigned fs_generic_inputs; unsigned zero_stride_vertex_elements; unsigned need_prescale:1; unsigned allow_psiz:1; @@ -67,9 +75,10 @@ struct svga_fs_compile_key } tex[PIPE_MAX_SAMPLERS]; }; -union svga_compile_key { +struct svga_compile_key { struct svga_vs_compile_key vkey; struct svga_fs_compile_key fkey; + int8_t generic_remap_table[MAX_GENERIC_VARYING]; }; struct svga_shader_result @@ -78,7 +87,7 @@ struct svga_shader_result /* Parameters used to generate this compilation result: */ - union svga_compile_key key; + struct svga_compile_key key; /* Compiled shader tokens: */ @@ -140,4 +149,18 @@ svga_translate_vertex_program( const struct svga_vertex_shader *fs, void svga_destroy_shader_result( struct svga_shader_result *result ); +unsigned +svga_get_generic_inputs_mask(const struct tgsi_shader_info *info); + +unsigned +svga_get_generic_outputs_mask(const struct tgsi_shader_info *info); + +void +svga_remap_generics(unsigned generics_mask, + int8_t remap_table[MAX_GENERIC_VARYING]); + +int +svga_remap_generic_index(const int8_t remap_table[MAX_GENERIC_VARYING], + int generic_index); + #endif |