[Mesa-dev] [PATCH v3 15/19] st/mesa: add mappings for compute shader sysvals

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Feb 10 18:10:44 UTC 2016


LOCAL_INVOCATION_ID, WORK_GROUP_ID and NUM_WORK_GROUPS are respectively
mapped to THREAD_ID, BLOCK_ID and GRID_SIZE.

Changes from v2:
 - add assertions in st_translate_program()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu> (v1)
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 8924363..ff55b3a 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4975,6 +4975,12 @@ const unsigned _mesa_sysval_to_semantic[SYSTEM_VALUE_MAX] = {
    TGSI_SEMANTIC_PRIMID,
    TGSI_SEMANTIC_TESSOUTER,
    TGSI_SEMANTIC_TESSINNER,
+
+   /* Compute shaders
+    */
+   TGSI_SEMANTIC_THREAD_ID,
+   TGSI_SEMANTIC_BLOCK_ID,
+   TGSI_SEMANTIC_GRID_SIZE,
 };
 
 /**
@@ -5745,6 +5751,12 @@ st_translate_program(
           TGSI_SEMANTIC_TESSCOORD);
    assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_HELPER_INVOCATION] ==
           TGSI_SEMANTIC_HELPER_INVOCATION);
+   assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_LOCAL_INVOCATION_ID] ==
+          TGSI_SEMANTIC_THREAD_ID);
+   assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_WORK_GROUP_ID] ==
+          TGSI_SEMANTIC_BLOCK_ID);
+   assert(_mesa_sysval_to_semantic[SYSTEM_VALUE_NUM_WORK_GROUPS] ==
+          TGSI_SEMANTIC_GRID_SIZE);
 
    t = CALLOC_STRUCT(st_translate);
    if (!t) {
-- 
2.6.4



More information about the mesa-dev mailing list