vkd3d-shader/msl: Handle the VKD3DSIM_LINEAR interpolation modifier on inputs.

This commit is contained in:
Feifan He 2024-11-22 15:45:54 +08:00 committed by Henri Verbeet
parent 8ae6a04561
commit 67dd1d2b0c
Notes: Henri Verbeet 2024-12-03 14:57:01 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1291
7 changed files with 33 additions and 24 deletions

View File

@ -768,13 +768,6 @@ static void msl_generate_input_struct_declarations(struct msl_generator *gen)
continue;
}
if (e->interpolation_mode != VKD3DSIM_NONE)
{
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
"Internal compiler error: Unhandled interpolation mode %#x.", e->interpolation_mode);
continue;
}
if(e->register_count > 1)
{
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
@ -818,6 +811,18 @@ static void msl_generate_input_struct_declarations(struct msl_generator *gen)
break;
}
switch (e->interpolation_mode)
{
/* The default interpolation attribute. */
case VKD3DSIM_LINEAR:
case VKD3DSIM_NONE:
break;
default:
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
"Internal compiler error: Unhandled interpolation mode %#x.", e->interpolation_mode);
break;
}
vkd3d_string_buffer_printf(buffer, ";\n");
}

View File

@ -36,7 +36,7 @@ float4 main(float tex : texcoord) : sv_target
}
[test]
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.2, 0.2, 0.2, 0.2)
[pixel shader fail(sm>=6)]
@ -46,7 +46,7 @@ float4 main(float tex : texcoord) : semantic : sv_target
}
[test]
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.2, 0.2, 0.2, 0.2)
[pixel shader]
@ -59,7 +59,7 @@ float4 main(float tex : texcoord) : sv_target
float4 main(float tex : bogus) : bogus;
[test]
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.2, 0.2, 0.2, 0.2)
@ -95,7 +95,7 @@ float4 main(in apple a) : sv_target
}
[test]
todo(msl) draw quad
draw quad
probe (0, 0) rgba (10.0, 20.0, 30.0, 40.0)
@ -112,7 +112,7 @@ float4 main(in apple a) : sv_target
}
[test]
todo(msl) draw quad
draw quad
probe (0, 0) rgba (10.0, 11.0, 30.0, 31.0)
@ -136,7 +136,7 @@ float4 main(in apple aps[2][2]) : sv_target
}
[test]
todo(msl) draw quad
draw quad
probe (0, 0) rgba (10.0, 10.0, 20.0, 20.0)
@ -158,7 +158,7 @@ float4 main(in banana bans[2]) : sv_target
}
[test]
todo(msl) draw quad
draw quad
todo(sm>=6) probe (0, 0) rgba (10.0, 11.0, 20.0, 21.0)
@ -222,7 +222,7 @@ float4 main(in float4 tex0 : TEXCOORD0, in float4 tex1 : TEXCOORD1) : sv_target
}
[test]
todo(msl) draw quad
draw quad
probe (0, 0) rgba (1.0, 2.0, 10.0, 20.0)
@ -285,7 +285,7 @@ float4 main(in float4 t1 : TEXCOORD0, in float4 t2 : TEXCOORD0) : sv_target
}
[test]
todo(msl) draw quad
draw quad
todo(sm>=6) probe (0, 0) rgba (99.0, 99.0, 10.0, 11.0)
@ -297,7 +297,7 @@ float4 main(in float4 a : TEXCOORD0, in float3 b : TEXCOORD1) : sv_target
}
[test]
todo(msl) draw quad
draw quad
probe (0, 0) rgba (10.0, 11.0, 20.0, 21.0)

View File

@ -25,7 +25,7 @@ float4 main(float2 fog : fog) : sv_target
}
[test]
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.1, 0.2, 0, 1)

View File

@ -14,7 +14,7 @@ float4 main(float2 color_xy : COLOR0, float2 color_zw : COLOR1) : SV_TARGET
}
[test]
todo(msl) draw quad
draw quad
probe(320, 240) rgba(0.25, 0.5, 0.75, 1.0)
% Test handling of arrays in interface blocks

View File

@ -59,5 +59,5 @@ struct output main(struct input i)
}
[test]
todo(msl) draw triangle strip 4
draw triangle strip 4
probe (0, 0) rgba (0.0, 1.0, 0.0, 1.0)

View File

@ -75,12 +75,12 @@ void main(out float4 res : COLOR1, in float4 pos : position, out float4 out_pos
if(sm<4) uniform 0 float 0
if(sm<4) uniform 4 float 2
if(sm>=4) uniform 0 int4 0 2 0 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.0, 1.0, 0.0, 1.0)
if(sm<4) uniform 0 float -2
if(sm<4) uniform 4 float 8
if(sm>=4) uniform 0 int4 -2 8 0 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0)
@ -103,11 +103,11 @@ if(sm<4) uniform 0 float 0
if(sm<4) uniform 4 float 100
if(sm<4) uniform 8 float 200
if(sm>=4) uniform 0 int4 0 100 200 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.2, 0.2, 0.2, 0.2)
if(sm<4) uniform 0 float -4
if(sm<4) uniform 4 float 100
if(sm<4) uniform 8 float 200
if(sm>=4) uniform 0 int4 -4 100 200 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.1, 0.1, 0.1, 0.1)

View File

@ -81,6 +81,8 @@ static MTLVertexFormat get_metal_attribute_format(DXGI_FORMAT format)
{
switch (format)
{
case DXGI_FORMAT_R32G32B32A32_FLOAT:
return MTLVertexFormatFloat4;
case DXGI_FORMAT_R32G32_FLOAT:
return MTLVertexFormatFloat2;
default:
@ -94,6 +96,8 @@ static MTLPrimitiveType get_metal_primitive_type(D3D_PRIMITIVE_TOPOLOGY topology
{
case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST:
return MTLPrimitiveTypeTriangle;
case D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP:
return MTLPrimitiveTypeTriangleStrip;
default:
fatal_error("Unhandled topology %#x.\n", topology);