vkd3d-shader/glsl: Handle SV_IS_FRONT_FACE inputs.

This commit is contained in:
Henri Verbeet 2024-05-03 14:48:01 +02:00
parent 0cc0b68fb4
commit 700eba0b01
Notes: Henri Verbeet 2024-09-30 21:06:22 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1124
2 changed files with 12 additions and 2 deletions

View File

@ -602,6 +602,15 @@ static void shader_glsl_print_sysval_name(struct vkd3d_string_buffer *buffer, st
}
break;
case VKD3D_SHADER_SV_IS_FRONT_FACE:
if (version->type != VKD3D_SHADER_TYPE_PIXEL)
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
"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_TARGET:
if (version->type != VKD3D_SHADER_TYPE_PIXEL)
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
@ -731,6 +740,7 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *gen,
break;
case VKD3DSIH_DCL_INPUT:
case VKD3DSIH_DCL_INPUT_PS:
case VKD3DSIH_DCL_INPUT_PS_SIV:
case VKD3DSIH_DCL_OUTPUT:
case VKD3DSIH_DCL_OUTPUT_SIV:
case VKD3DSIH_NOP:

View File

@ -22,7 +22,7 @@ float4 main(bool face : sv_isfrontface) : sv_target
}
[test]
todo(glsl) draw triangle strip 4
draw triangle strip 4
probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
[vb 0]
@ -32,5 +32,5 @@ probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
2.0 2.0
[test]
todo(glsl) draw triangle strip 4
draw triangle strip 4
probe (0, 0, 640, 480) rgba (1.0, 2.0, 1.0, 2.0)