vkd3d-shader/glsl: Handle SV_POSITION inputs in fragment shaders.

This commit is contained in:
Henri Verbeet 2024-10-03 15:02:31 +02:00
parent fcb09be6e3
commit 95a46fb0f0
Notes: Henri Verbeet 2024-10-08 22:11:09 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1155
3 changed files with 11 additions and 10 deletions

View File

@ -931,19 +931,20 @@ static void shader_glsl_print_sysval_name(struct vkd3d_string_buffer *buffer, st
switch (sysval)
{
case VKD3D_SHADER_SV_POSITION:
if (version->type == VKD3D_SHADER_TYPE_PIXEL || version->type == VKD3D_SHADER_TYPE_COMPUTE)
if (version->type == VKD3D_SHADER_TYPE_COMPUTE)
{
vkd3d_string_buffer_printf(buffer, "<unhandled sysval %#x>", sysval);
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
"Internal compiler error: Unhandled system value %#x.", sysval);
"Internal compiler error: Unhandled SV_POSITION in shader type #%x.", version->type);
break;
}
if (idx)
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
"Internal compiler error: Unhandled SV_POSITION index %u.", idx);
if (version->type == VKD3D_SHADER_TYPE_PIXEL)
vkd3d_string_buffer_printf(buffer, "gl_FragCoord");
else
{
vkd3d_string_buffer_printf(buffer, "gl_Position");
if (idx)
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
"Internal compiler error: Unhandled SV_POSITION index %u.", idx);
}
break;
case VKD3D_SHADER_SV_VERTEX_ID:

View File

@ -73,7 +73,7 @@ float4 main(float4 pos : sv_position) : sv_target
}
[test]
todo(glsl) draw quad
draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe (1, 0) rgba (0.5, 0.7, 0.6, 0.8)
probe (0, 1) rgba (0.6, 0.5, 0.2, 0.1)

View File

@ -15,7 +15,7 @@ float4 main(float4 pos : sv_position) : sv_target
}
[test]
todo(glsl) draw quad
draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe (1, 0) rgba (0.5, 0.7, 0.6, 0.8)
probe (0, 1) rgba (0.6, 0.5, 0.2, 0.1)
@ -30,7 +30,7 @@ float4 main(float4 pos : sv_position) : sv_target
}
[test]
todo(glsl) draw quad
draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1)
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)