diff options
author | Eric Anholt <[email protected]> | 2020-01-13 15:30:07 -0800 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-02-05 22:25:59 +0000 |
commit | e25967d6b81b9ac9dccfe92cc92dc8d977eab592 (patch) | |
tree | 70ba409782b1eda7e1b4de0bf8b789b3dccc7aee /src/mesa/state_tracker | |
parent | 9891062642a3f35dc326b305fca2407f9041915c (diff) |
mesa/st: Move the SYSTEM_VALUE -> TGSI_SEMANTIC map to tgsi_from_mesa.
This will let us reuse the table from nir-to-tgsi.
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Kristian H. Kristensen <[email protected]>
Reviewed-by: Karol Herbst <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3506>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 93 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.c | 3 |
2 files changed, 3 insertions, 93 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 7d63aac716b..ae20092c498 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5797,97 +5797,6 @@ struct st_translate { bool tg4_component_in_swizzle; }; -/** Map Mesa's SYSTEM_VALUE_x to TGSI_SEMANTIC_x */ -enum tgsi_semantic -_mesa_sysval_to_semantic(unsigned sysval) -{ - switch (sysval) { - /* Vertex shader */ - case SYSTEM_VALUE_VERTEX_ID: - return TGSI_SEMANTIC_VERTEXID; - case SYSTEM_VALUE_INSTANCE_ID: - return TGSI_SEMANTIC_INSTANCEID; - case SYSTEM_VALUE_VERTEX_ID_ZERO_BASE: - return TGSI_SEMANTIC_VERTEXID_NOBASE; - case SYSTEM_VALUE_BASE_VERTEX: - return TGSI_SEMANTIC_BASEVERTEX; - case SYSTEM_VALUE_BASE_INSTANCE: - return TGSI_SEMANTIC_BASEINSTANCE; - case SYSTEM_VALUE_DRAW_ID: - return TGSI_SEMANTIC_DRAWID; - - /* Geometry shader */ - case SYSTEM_VALUE_INVOCATION_ID: - return TGSI_SEMANTIC_INVOCATIONID; - - /* Fragment shader */ - case SYSTEM_VALUE_FRAG_COORD: - return TGSI_SEMANTIC_POSITION; - case SYSTEM_VALUE_POINT_COORD: - return TGSI_SEMANTIC_PCOORD; - case SYSTEM_VALUE_FRONT_FACE: - return TGSI_SEMANTIC_FACE; - case SYSTEM_VALUE_SAMPLE_ID: - return TGSI_SEMANTIC_SAMPLEID; - case SYSTEM_VALUE_SAMPLE_POS: - return TGSI_SEMANTIC_SAMPLEPOS; - case SYSTEM_VALUE_SAMPLE_MASK_IN: - return TGSI_SEMANTIC_SAMPLEMASK; - case SYSTEM_VALUE_HELPER_INVOCATION: - return TGSI_SEMANTIC_HELPER_INVOCATION; - - /* Tessellation shader */ - case SYSTEM_VALUE_TESS_COORD: - return TGSI_SEMANTIC_TESSCOORD; - case SYSTEM_VALUE_VERTICES_IN: - return TGSI_SEMANTIC_VERTICESIN; - case SYSTEM_VALUE_PRIMITIVE_ID: - return TGSI_SEMANTIC_PRIMID; - case SYSTEM_VALUE_TESS_LEVEL_OUTER: - return TGSI_SEMANTIC_TESSOUTER; - case SYSTEM_VALUE_TESS_LEVEL_INNER: - return TGSI_SEMANTIC_TESSINNER; - - /* Compute shader */ - case SYSTEM_VALUE_LOCAL_INVOCATION_ID: - return TGSI_SEMANTIC_THREAD_ID; - case SYSTEM_VALUE_WORK_GROUP_ID: - return TGSI_SEMANTIC_BLOCK_ID; - case SYSTEM_VALUE_NUM_WORK_GROUPS: - return TGSI_SEMANTIC_GRID_SIZE; - case SYSTEM_VALUE_LOCAL_GROUP_SIZE: - return TGSI_SEMANTIC_BLOCK_SIZE; - - /* ARB_shader_ballot */ - case SYSTEM_VALUE_SUBGROUP_SIZE: - return TGSI_SEMANTIC_SUBGROUP_SIZE; - case SYSTEM_VALUE_SUBGROUP_INVOCATION: - return TGSI_SEMANTIC_SUBGROUP_INVOCATION; - case SYSTEM_VALUE_SUBGROUP_EQ_MASK: - return TGSI_SEMANTIC_SUBGROUP_EQ_MASK; - case SYSTEM_VALUE_SUBGROUP_GE_MASK: - return TGSI_SEMANTIC_SUBGROUP_GE_MASK; - case SYSTEM_VALUE_SUBGROUP_GT_MASK: - return TGSI_SEMANTIC_SUBGROUP_GT_MASK; - case SYSTEM_VALUE_SUBGROUP_LE_MASK: - return TGSI_SEMANTIC_SUBGROUP_LE_MASK; - case SYSTEM_VALUE_SUBGROUP_LT_MASK: - return TGSI_SEMANTIC_SUBGROUP_LT_MASK; - - /* Unhandled */ - case SYSTEM_VALUE_LOCAL_INVOCATION_INDEX: - case SYSTEM_VALUE_GLOBAL_INVOCATION_ID: - case SYSTEM_VALUE_VERTEX_CNT: - case SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL: - case SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE: - case SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID: - case SYSTEM_VALUE_BARYCENTRIC_PERSP_SIZE: - default: - assert(!"Unexpected SYSTEM_VALUE_ enum"); - return TGSI_SEMANTIC_COUNT; - } -} - /** * Map a glsl_to_tgsi constant/immediate to a TGSI immediate. */ @@ -6923,7 +6832,7 @@ st_translate_program( for (i = 0; sysInputs; i++) { if (sysInputs & (1ull << i)) { - enum tgsi_semantic semName = _mesa_sysval_to_semantic(i); + enum tgsi_semantic semName = tgsi_get_sysval_semantic(i); t->systemValues[i] = ureg_DECL_system_value(ureg, semName, 0); diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 03a2dee6778..1f5a3cd077e 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -37,6 +37,7 @@ #include "pipe/p_shader_tokens.h" #include "pipe/p_state.h" #include "tgsi/tgsi_ureg.h" +#include "tgsi/tgsi_from_mesa.h" #include "st_mesa_to_tgsi.h" #include "st_context.h" #include "program/prog_instruction.h" @@ -954,7 +955,7 @@ st_translate_mesa_program(struct gl_context *ctx, GLbitfield64 sysInputs = program->info.system_values_read; for (i = 0; sysInputs; i++) { if (sysInputs & (1ull << i)) { - unsigned semName = _mesa_sysval_to_semantic(i); + unsigned semName = tgsi_get_sysval_semantic(i); t->systemValues[i] = ureg_DECL_system_value(ureg, semName, 0); |