vkd3d-shader/msl: Handle SV_IS_FRONT_FACE inputs.

This commit is contained in:
Feifan He 2024-12-03 00:31:48 +08:00 committed by Henri Verbeet
parent 568296c88f
commit b1e6dbe83f
Notes: Henri Verbeet 2024-12-04 14:44:01 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1294
2 changed files with 16 additions and 2 deletions

View File

@ -802,6 +802,16 @@ static void msl_generate_input_struct_declarations(struct msl_generator *gen)
if (e->sysval_semantic)
{
if (e->sysval_semantic == VKD3D_SHADER_SV_IS_FRONT_FACE)
{
if (type != VKD3D_SHADER_TYPE_PIXEL)
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
"Internal compiler error: Unhandled SV_IS_FRONT_FACE in shader type #%x.", type);
msl_print_indent(gen->buffer, 1);
vkd3d_string_buffer_printf(buffer, "bool is_front_face [[front_facing]];\n");
continue;
}
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
"Internal compiler error: Unhandled system value %#x.", e->sysval_semantic);
continue;
@ -1016,6 +1026,10 @@ static void msl_generate_entrypoint_prologue(struct msl_generator *gen)
vkd3d_string_buffer_printf(buffer, " = input.shader_in_%u", i);
msl_print_write_mask(buffer, e->mask);
}
else if (e->sysval_semantic == VKD3D_SHADER_SV_IS_FRONT_FACE)
{
vkd3d_string_buffer_printf(buffer, ".u = uint4(input.is_front_face ? 0xffffffffu : 0u, 0, 0, 0)");
}
else
{
vkd3d_string_buffer_printf(buffer, " = <unhandled sysval %#x>", e->sysval_semantic);

View File

@ -22,7 +22,7 @@ float4 main(bool face : sv_isfrontface) : sv_target
}
[test]
todo(msl) 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(msl) draw triangle strip 4
draw triangle strip 4
probe (0, 0, 640, 480) rgba (1.0, 2.0, 1.0, 2.0)