vkd3d-shader/glsl: Implement support for the VKD3DSPR_THREADID register.

This commit is contained in:
Henri Verbeet 2024-10-06 22:15:58 +02:00
parent f76dd80cba
commit e408f1d984
Notes: Henri Verbeet 2024-10-22 20:55:33 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1206
2 changed files with 6 additions and 2 deletions

View File

@ -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); gen->prefix, reg->idx[0].offset, reg->idx[2].offset);
break; break;
case VKD3DSPR_THREADID:
vkd3d_string_buffer_printf(buffer, "gl_GlobalInvocationID");
break;
case VKD3DSPR_IDXTEMP: case VKD3DSPR_IDXTEMP:
vkd3d_string_buffer_printf(buffer, "x%u", reg->idx[0].offset); 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); 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, vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
"Internal compiler error: Unhandled 'non-uniform' modifier."); "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; src_data_type = VKD3D_DATA_UINT;
else else
src_data_type = VKD3D_DATA_FLOAT; src_data_type = VKD3D_DATA_FLOAT;

View File

@ -189,7 +189,7 @@ void main(uint2 id : sv_dispatchthreadid)
} }
[test] [test]
todo(glsl) dispatch 1 1 1 dispatch 1 1 1
probe uav 0 (0, 0) r (2.0) 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 (0, 1) r (1.0)
if(sm<6) probe uav 0 (1, 0) r (2.0) if(sm<6) probe uav 0 (1, 0) r (2.0)