diff options
author | Jose Maria Casanova Crespo <[email protected]> | 2019-08-19 15:05:25 +0200 |
---|---|---|
committer | José Casanova Crespo <[email protected]> | 2019-08-20 10:30:21 +0000 |
commit | 7c56a68c8bd45208ef7c7e6e61bfeb6147ded4b6 (patch) | |
tree | ec0f7bc16a2eb2fc672f20a6f5a75e8e555ff89e | |
parent | 83a63a5b12323b733cf4ebf5b9892cd7c8718578 (diff) |
tgsi_to_nir: only update TGSI properties of the current shader stage
The implementation introduced in "tgsi_to_nir: be careful about not
losing any TGSI properties silently (v2)" updates all the TGSI properties,
but it didn't take into account that the shader_info structure uses a union
to store the different attributes for each shader stage.
Now we only update the attributes if they affect current shader stage,
avoiding to overwrite members of the union that should be overwritten.
This has created hundreds of regressions in v3d.
For example the TGSI_PROPERTY_VS_BLIT_SGPRS_AMD was overwritting the
same position used by TGSI_PROPERY_CS_FIXED_BLOCK_DEPTH.
Fixes: e3003651978 ("tgsi_to_nir: be careful about not losing any TGSI properties silently (v2)")
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/gallium/auxiliary/nir/tgsi_to_nir.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index 1fc886991f2..79d04fae9d9 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -2464,34 +2464,43 @@ ttn_compile_init(const void *tgsi_tokens, case TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS: break; /* handled in ttn_emit_declaration */ case TGSI_PROPERTY_FS_COORD_ORIGIN: - s->info.fs.origin_upper_left = value == TGSI_FS_COORD_ORIGIN_UPPER_LEFT; + if (s->info.stage == MESA_SHADER_FRAGMENT) + s->info.fs.origin_upper_left = value == TGSI_FS_COORD_ORIGIN_UPPER_LEFT; break; case TGSI_PROPERTY_FS_COORD_PIXEL_CENTER: - s->info.fs.pixel_center_integer = value == TGSI_FS_COORD_PIXEL_CENTER_INTEGER; + if (s->info.stage == MESA_SHADER_FRAGMENT) + s->info.fs.pixel_center_integer = value == TGSI_FS_COORD_PIXEL_CENTER_INTEGER; break; case TGSI_PROPERTY_FS_DEPTH_LAYOUT: - s->info.fs.depth_layout = ttn_get_depth_layout(value); + if (s->info.stage == MESA_SHADER_FRAGMENT) + s->info.fs.depth_layout = ttn_get_depth_layout(value); break; case TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION: - s->info.vs.window_space_position = value; + if (s->info.stage == MESA_SHADER_VERTEX) + s->info.vs.window_space_position = value; break; case TGSI_PROPERTY_NEXT_SHADER: s->info.next_stage = tgsi_processor_to_shader_stage(value); break; case TGSI_PROPERTY_VS_BLIT_SGPRS_AMD: - s->info.vs.blit_sgprs_amd = value; + if (s->info.stage == MESA_SHADER_VERTEX) + s->info.vs.blit_sgprs_amd = value; break; case TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH: - s->info.cs.local_size[0] = value; + if (s->info.stage == MESA_SHADER_COMPUTE) + s->info.cs.local_size[0] = value; break; case TGSI_PROPERTY_CS_FIXED_BLOCK_HEIGHT: - s->info.cs.local_size[1] = value; + if (s->info.stage == MESA_SHADER_COMPUTE) + s->info.cs.local_size[1] = value; break; case TGSI_PROPERTY_CS_FIXED_BLOCK_DEPTH: - s->info.cs.local_size[2] = value; + if (s->info.stage == MESA_SHADER_COMPUTE) + s->info.cs.local_size[2] = value; break; case TGSI_PROPERTY_CS_USER_DATA_COMPONENTS_AMD: - s->info.cs.user_data_components_amd = value; + if (s->info.stage == MESA_SHADER_COMPUTE) + s->info.cs.user_data_components_amd = value; break; default: if (value) { |