aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2015-08-25 14:53:51 -0700
committerBrian Paul <[email protected]>2016-08-26 06:19:51 -0600
commit479199180871432030d3eebc2822bd7cb3dc6fd6 (patch)
tree5f285cce880b63614d6ffe119012d6d5ac5ef02d /src/gallium/drivers/svga/svga_tgsi_vgpu10.c
parentd221a6545cc0778716f1abf45fd096d6cd5a1b8e (diff)
svga: fix indirect non-indexable temp access
If the shader has indirect access to non-indexable temporaries, convert these non-indexable temporaries to indexable temporary array. This works around a bug in the GLSL->TGSI translator. Fixes glsl-1.20/execution/fs-const-array-of-struct-of-array.shader_test on DX11Renderer. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_tgsi_vgpu10.c')
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_vgpu10.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index dcd8f2cc3b8..3b44730df52 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -2631,6 +2631,28 @@ emit_temporaries_declaration(struct svga_shader_emitter_v10 *emit)
total_temps = emit->num_shader_temps;
+ /* If there is indirect access to non-indexable temps in the shader,
+ * convert those temps to indexable temps. This works around a bug
+ * in the GLSL->TGSI translator exposed in piglit test
+ * glsl-1.20/execution/fs-const-array-of-struct-of-array.shader_test.
+ * Internal temps added by the driver remain as non-indexable temps.
+ */
+ if ((emit->info.indirect_files & (1 << TGSI_FILE_TEMPORARY)) &&
+ emit->num_temp_arrays == 0) {
+ unsigned arrayID;
+
+ arrayID = 1;
+ emit->num_temp_arrays = arrayID + 1;
+ emit->temp_arrays[arrayID].start = 0;
+ emit->temp_arrays[arrayID].size = total_temps;
+
+ /* Fill in the temp_map entries for this temp array */
+ for (i = 0; i < total_temps; i++) {
+ emit->temp_map[i].arrayId = arrayID;
+ emit->temp_map[i].index = i;
+ }
+ }
+
/* Allocate extra temps for specially-implemented instructions,
* such as LIT.
*/
@@ -2740,16 +2762,17 @@ emit_temporaries_declaration(struct svga_shader_emitter_v10 *emit)
emit->temp_map[i].index = reg++;
}
}
- total_temps = reg;
if (0) {
debug_printf("total_temps %u\n", total_temps);
- for (i = 0; i < 30; i++) {
+ for (i = 0; i < total_temps; i++) {
debug_printf("temp %u -> array %u index %u\n",
i, emit->temp_map[i].arrayId, emit->temp_map[i].index);
}
}
+ total_temps = reg;
+
/* Emit declaration of ordinary temp registers */
if (total_temps > 0) {
VGPU10OpcodeToken0 opcode0;