summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-02-23 00:37:39 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2016-02-29 10:16:13 +0000
commit2eaca4a4d87b704010417b7eb753b664b1f3a698 (patch)
treeb4270bd102e6643dce868540cc51a48478131f5c
parent96babdd7f3f0e57023ba8d0fcc85bd51a3451af8 (diff)
tgsi/scan: handle holes between VS inputs, assert-fail in other cases
"st/mesa: overhaul vertex setup for clearing, glDrawPixels, glBitmap" added a vertex shader declaring IN[0] and IN[2], but not IN[1]. Drivers relying on tgsi_shader_info can't handle holes in declarations, because tgsi_shader_info doesn't track that. This is just a quick workaround meant for stable that will work for vertex shaders. This fixes radeonsi DrawPixels and CopyPixels crashes. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Brian Paul <brianp@vmware.com> (cherry picked from commit 190a291b03f799471110f95ae8a4d519d309696d)
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 489423d7f12..4f85d2fda67 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -247,7 +247,14 @@ scan_declaration(struct tgsi_shader_info *info,
info->input_interpolate[reg] = (ubyte)fulldecl->Interp.Interpolate;
info->input_interpolate_loc[reg] = (ubyte)fulldecl->Interp.Location;
info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Interp.CylindricalWrap;
- info->num_inputs++;
+
+ /* Vertex shaders can have inputs with holes between them. */
+ if (info->processor == TGSI_PROCESSOR_VERTEX)
+ info->num_inputs = MAX2(info->num_inputs, reg + 1);
+ else {
+ info->num_inputs++;
+ assert(reg < info->num_inputs);
+ }
/* Only interpolated varyings. Don't include POSITION.
* Don't include integer varyings, because they are not
@@ -341,6 +348,7 @@ scan_declaration(struct tgsi_shader_info *info,
info->output_semantic_name[reg] = (ubyte) semName;
info->output_semantic_index[reg] = (ubyte) semIndex;
info->num_outputs++;
+ assert(reg < info->num_outputs);
if (semName == TGSI_SEMANTIC_COLOR)
info->colors_written |= 1 << semIndex;