From ca42adbf6b84bf770c1164c3834bd471082b270d Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 25 Oct 2024 14:42:58 +0200 Subject: [PATCH] vkd3d-shader/glsl: Handle SV_SAMPLE_INDEX inputs. --- libs/vkd3d-shader/glsl.c | 6 ++++++ tests/hlsl/texture-load.shader_test | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/glsl.c b/libs/vkd3d-shader/glsl.c index 9448d630..b9556963 100644 --- a/libs/vkd3d-shader/glsl.c +++ b/libs/vkd3d-shader/glsl.c @@ -1306,7 +1306,13 @@ static void shader_glsl_print_sysval_name(struct vkd3d_string_buffer *buffer, st "Internal compiler error: Unhandled SV_IS_FRONT_FACE in shader type #%x.", version->type); vkd3d_string_buffer_printf(buffer, "uintBitsToFloat(uvec4(gl_FrontFacing ? 0xffffffffu : 0u, 0u, 0u, 0u))"); + break; + case VKD3D_SHADER_SV_SAMPLE_INDEX: + if (version->type != VKD3D_SHADER_TYPE_PIXEL) + vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL, + "Internal compiler error: Unhandled SV_SAMPLE_INDEX in shader type #%x.", version->type); + vkd3d_string_buffer_printf(buffer, "intBitsToFloat(ivec4(gl_SampleID, 0, 0, 0))"); break; case VKD3D_SHADER_SV_TARGET: diff --git a/tests/hlsl/texture-load.shader_test b/tests/hlsl/texture-load.shader_test index 9d57a0d0..b3d2ca57 100644 --- a/tests/hlsl/texture-load.shader_test +++ b/tests/hlsl/texture-load.shader_test @@ -167,7 +167,7 @@ float4 main(uint id : sv_sampleindex) : sv_target [test] clear rtv 0 0.0 0.0 0.0 0.0 -todo(glsl | sm>=6 | msl) draw quad +todo(sm>=6 | msl) draw quad probe (32, 32) rgba(3.75, 0.25, 0.5, 1.0) todo(msl) copy rtv 0 srv 0