aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_shader.h
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2018-02-19 05:48:40 +0000
committerDave Airlie <[email protected]>2018-03-16 05:22:19 +0000
commit2012dae19a1ef73224c4e54eab4cd731f1d59ddf (patch)
tree7b0ee97d2948677ff1a424358c5a9f1ab10d7ae5 /src/amd/vulkan/radv_shader.h
parentf02f1ad13fa4123986d17a5d04b0e2831c3a7091 (diff)
radv: migrate unique index info shader info (v2)
This just moves this function to an inline so the shader_info pass can use it. v2: use inline (Samuel) Reviewed-by: Samuel Pitoiset <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_shader.h')
-rw-r--r--src/amd/vulkan/radv_shader.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
index 5c3f0ff6c44..47cb23df0d3 100644
--- a/src/amd/vulkan/radv_shader.h
+++ b/src/amd/vulkan/radv_shader.h
@@ -338,4 +338,25 @@ radv_can_dump_shader_stats(struct radv_device *device,
module && !module->nir;
}
+static inline unsigned shader_io_get_unique_index(gl_varying_slot slot)
+{
+ /* handle patch indices separate */
+ if (slot == VARYING_SLOT_TESS_LEVEL_OUTER)
+ return 0;
+ if (slot == VARYING_SLOT_TESS_LEVEL_INNER)
+ return 1;
+ if (slot >= VARYING_SLOT_PATCH0 && slot <= VARYING_SLOT_TESS_MAX)
+ return 2 + (slot - VARYING_SLOT_PATCH0);
+ if (slot == VARYING_SLOT_POS)
+ return 0;
+ if (slot == VARYING_SLOT_PSIZ)
+ return 1;
+ if (slot == VARYING_SLOT_CLIP_DIST0)
+ return 2;
+ /* 3 is reserved for clip dist as well */
+ if (slot >= VARYING_SLOT_VAR0 && slot <= VARYING_SLOT_VAR31)
+ return 4 + (slot - VARYING_SLOT_VAR0);
+ unreachable("illegal slot in get unique index\n");
+}
+
#endif