[Mesa-stable] [PATCH 03/13] glsl_to_tgsi: Assert that the _mesa_sysval_to_semantic mapping is correct
Ian Romanick
idr at freedesktop.org
Fri Jun 20 18:00:53 PDT 2014
From: Ian Romanick <ian.d.romanick at intel.com>
Future patches will rearrange the values in gl_system_value, and I want
to catch errors. Designated initializers would make all of this
unnecessary.
v2: Don't use STATIC_ASSERT. Not only does it not work, but GCC doesn't
tell you that it's not going to work. Thanks for nothing!
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: Marek Olšák <marek.olsak at amd.com>
Cc: Roland Scheidegger <sroland at vmware.com>
Cc: "10.2" <mesa-stable at lists.freedesktop.org>
---
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index fd8f270..fbfbea6 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4906,6 +4906,21 @@ st_translate_program(
assert(numInputs <= Elements(t->inputs));
assert(numOutputs <= Elements(t->outputs));
+ assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_FRONT_FACE] ==
+ TGSI_SEMANTIC_FACE);
+ assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_VERTEX_ID] ==
+ TGSI_SEMANTIC_VERTEXID);
+ assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_INSTANCE_ID] ==
+ TGSI_SEMANTIC_INSTANCEID);
+ assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_SAMPLE_ID] ==
+ TGSI_SEMANTIC_SAMPLEID);
+ assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_SAMPLE_POS] ==
+ TGSI_SEMANTIC_SAMPLEPOS);
+ assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_SAMPLE_MASK_IN] ==
+ TGSI_SEMANTIC_SAMPLEMASK);
+ assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_INVOCATION_ID] ==
+ TGSI_SEMANTIC_INVOCATIONID);
+
t = CALLOC_STRUCT(st_translate);
if (!t) {
ret = PIPE_ERROR_OUT_OF_MEMORY;
--
1.8.1.4
More information about the mesa-stable
mailing list