vkd3d-shader/glsl: Handle SV_VERTEX_ID inputs.

This commit is contained in:
Henri Verbeet 2024-09-30 00:35:41 +02:00
parent 79455041f0
commit 7b47528e4b
Notes: Henri Verbeet 2024-10-07 17:53:05 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1145
2 changed files with 19 additions and 18 deletions

View File

@ -918,6 +918,13 @@ static void shader_glsl_print_sysval_name(struct vkd3d_string_buffer *buffer, st
}
break;
case VKD3D_SHADER_SV_VERTEX_ID:
if (version->type != VKD3D_SHADER_TYPE_VERTEX)
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
"Internal compiler error: Unhandled SV_VERTEX_ID in shader type #%x.", version->type);
vkd3d_string_buffer_printf(buffer, "intBitsToFloat(ivec4(gl_VertexID, 0, 0, 0))");
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,
@ -1057,6 +1064,7 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *gen,
case VKD3DSIH_DCL_INPUT:
case VKD3DSIH_DCL_INPUT_PS:
case VKD3DSIH_DCL_INPUT_PS_SIV:
case VKD3DSIH_DCL_INPUT_SGV:
case VKD3DSIH_DCL_OUTPUT:
case VKD3DSIH_DCL_OUTPUT_SIV:
case VKD3DSIH_NOP:
@ -1512,16 +1520,9 @@ static void shader_glsl_generate_input_declarations(struct vkd3d_glsl_generator
{
e = &signature->elements[i];
if (e->target_location == SIGNATURE_TARGET_LOCATION_UNUSED)
if (e->target_location == SIGNATURE_TARGET_LOCATION_UNUSED || e->sysval_semantic)
continue;
if (e->sysval_semantic)
{
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
"Internal compiler error: Unhandled system value %#x.", e->sysval_semantic);
continue;
}
if (e->component_type != VKD3D_SHADER_COMPONENT_FLOAT)
{
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,

View File

@ -23,8 +23,8 @@ float4 main(nointerpolation float4 t : texcoord) : sv_target
}
[test]
todo(glsl) draw triangle list 3
probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
draw triangle list 3
todo(glsl) probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
[vertex shader]
struct ps_input
@ -50,8 +50,8 @@ float4 main(ps_input input) : sv_target
}
[test]
todo(glsl) draw triangle list 3
probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
draw triangle list 3
todo(glsl) probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
[vertex shader]
struct ps_input
@ -77,8 +77,8 @@ float4 main(nointerpolation ps_input input) : sv_target
}
[test]
todo(glsl) draw triangle list 3
probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
draw triangle list 3
todo(glsl) probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
[vertex shader]
struct ps_input
@ -104,8 +104,8 @@ float4 main(centroid ps_input input) : sv_target
}
[test]
todo(glsl) draw triangle list 3
probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
draw triangle list 3
todo(glsl) probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
[vertex shader]
struct ps_input
@ -135,8 +135,8 @@ shader model >= 4.0
shader model < 6.0
[test]
todo(glsl) draw triangle list 3
probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
draw triangle list 3
todo(glsl) probe (0, 0, 640, 480) rgba (0.0, 1.0, 0.0, 1.0)
% Centroid for SM 6.
[require]