From e408f1d9841b113794dcff38777264dd5a31d20e Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 6 Oct 2024 22:15:58 +0200 Subject: [PATCH] vkd3d-shader/glsl: Implement support for the VKD3DSPR_THREADID register. --- libs/vkd3d-shader/glsl.c | 6 +++++- tests/hlsl/numthreads.shader_test | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d-shader/glsl.c b/libs/vkd3d-shader/glsl.c index c80517d6..fbfe6def 100644 --- a/libs/vkd3d-shader/glsl.c +++ b/libs/vkd3d-shader/glsl.c @@ -274,6 +274,10 @@ static void shader_glsl_print_register_name(struct vkd3d_string_buffer *buffer, gen->prefix, reg->idx[0].offset, reg->idx[2].offset); break; + case VKD3DSPR_THREADID: + vkd3d_string_buffer_printf(buffer, "gl_GlobalInvocationID"); + break; + case VKD3DSPR_IDXTEMP: vkd3d_string_buffer_printf(buffer, "x%u", reg->idx[0].offset); shader_glsl_print_subscript(buffer, gen, reg->idx[1].rel_addr, reg->idx[1].offset); @@ -385,7 +389,7 @@ static void shader_glsl_print_src(struct vkd3d_string_buffer *buffer, struct vkd vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL, "Internal compiler error: Unhandled 'non-uniform' modifier."); - if (reg->type == VKD3DSPR_IMMCONST) + if (reg->type == VKD3DSPR_IMMCONST || reg->type == VKD3DSPR_THREADID) src_data_type = VKD3D_DATA_UINT; else src_data_type = VKD3D_DATA_FLOAT; diff --git a/tests/hlsl/numthreads.shader_test b/tests/hlsl/numthreads.shader_test index 3f1914d9..4ca117c3 100644 --- a/tests/hlsl/numthreads.shader_test +++ b/tests/hlsl/numthreads.shader_test @@ -189,7 +189,7 @@ void main(uint2 id : sv_dispatchthreadid) } [test] -todo(glsl) dispatch 1 1 1 +dispatch 1 1 1 probe uav 0 (0, 0) r (2.0) if(sm<6) probe uav 0 (0, 1) r (1.0) if(sm<6) probe uav 0 (1, 0) r (2.0)