vkd3d-shader/msl: Implement support for VKD3DSPR_IMMCONST registers.

This commit is contained in:
Feifan He 2024-11-22 15:45:54 +08:00 committed by Henri Verbeet
parent 05b9331d0d
commit 5bb7dcaba3
Notes: Henri Verbeet 2024-11-24 00:11:21 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1274
9 changed files with 49 additions and 18 deletions

View File

@ -153,6 +153,37 @@ static void msl_print_register_name(struct vkd3d_string_buffer *buffer,
msl_print_register_datatype(buffer, gen, reg->data_type);
break;
case VKD3DSPR_IMMCONST:
switch (reg->dimension)
{
case VSIR_DIMENSION_SCALAR:
switch (reg->data_type)
{
case VKD3D_DATA_INT:
vkd3d_string_buffer_printf(buffer, "as_type<int>(%#xu)", reg->u.immconst_u32[0]);
break;
case VKD3D_DATA_UINT:
vkd3d_string_buffer_printf(buffer, "%#xu", reg->u.immconst_u32[0]);
break;
case VKD3D_DATA_FLOAT:
vkd3d_string_buffer_printf(buffer, "as_type<float>(%#xu)", reg->u.immconst_u32[0]);
break;
default:
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
"Internal compiler error: Unhandled immconst datatype %#x.", reg->data_type);
vkd3d_string_buffer_printf(buffer, "<unrecognised immconst datatype %#x>", reg->data_type);
break;
}
break;
default:
vkd3d_string_buffer_printf(buffer, "<unhandled_dimension %#x>", reg->dimension);
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
"Internal compiler error: Unhandled dimension %#x.", reg->dimension);
break;
}
break;
case VKD3DSPR_CONSTBUFFER:
if (reg->idx_count != 3)
{

View File

@ -36,7 +36,7 @@ float4 main() : sv_target
uniform 0 float4 11 12 0 0
uniform 4 float4 13 14 0 0
uniform 8 float4 20 21 22 23
todo(msl) draw quad
draw quad
probe (320,240) rgba (13.0, 21.0, 0.0, 0.0)
[pixel shader fail]

View File

@ -70,7 +70,7 @@ float4 main() : sv_target
[test]
uniform 0 float 4.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (409.1, 409.1, 409.1, 409.1)
[pixel shader]
@ -100,7 +100,7 @@ float4 main() : sv_target
[test]
uniform 0 float 4.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (410.1, 410.1, 410.1, 410.1)
% loop attribute by itself

View File

@ -44,7 +44,7 @@ row_major float4x1 main() : sv_target
}
[test]
todo(sm>=6 | msl) draw quad
todo(sm>=6) draw quad
probe rtv 0 (0,0) r (1.0)
probe rtv 1 (0,0) r (2.0)
probe rtv 2 (0,0) r (3.0)
@ -57,7 +57,7 @@ float1x4 main() : sv_target
}
[test]
todo(sm>=6 | msl) draw quad
todo(sm>=6) draw quad
probe rtv 0 (0,0) r (1.0)
probe rtv 1 (0,0) r (2.0)
probe rtv 2 (0,0) r (3.0)
@ -78,7 +78,7 @@ void main(out float1x2 x : sv_target0, out float1x2 y : sv_target2)
}
[test]
todo(sm>=6 | msl) draw quad
todo(sm>=6) draw quad
probe rtv 0 (0,0) r (1.0)
probe rtv 1 (0,0) r (2.0)
probe rtv 2 (0,0) r (5.0)

View File

@ -19,7 +19,7 @@ float4 main() : sv_target
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
uniform 4 float4 5.0 6.0 7.0 8.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (1.0, 2.0, 3.0, 0.0)
@ -45,7 +45,7 @@ float4 main() : sv_target
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
uniform 4 float4 5.0 6.0 7.0 8.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (1.0, 2.0, 5.0, 0.0)
@ -66,5 +66,5 @@ float4 main() : sv_target
[test]
uniform 0 float4 1.0 2.0 3.0 4.0
uniform 4 float4 5.0 6.0 7.0 8.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (1.0, 2.0, 5.0, 0.0)

View File

@ -117,7 +117,7 @@ uniform 0 float4 0.1 0.2 0.3 0.4
uniform 4 float4 1.1 1.2 1.3 1.4
uniform 8 float4 2.1 2.2 2.3 2.4
uniform 12 float4 3.1 3.2 3.3 3.4
todo(msl) draw quad
draw quad
probe (0, 0) rgba (2.1, 2.2, 0.0, 0.0)
@ -188,7 +188,7 @@ uniform 0 float4 0.1 0.2 0.3 0.4
uniform 4 float4 1.1 1.2 1.3 1.4
uniform 8 float4 2.1 2.2 2.3 2.4
uniform 12 float4 3.1 3.2 3.3 3.4
todo(msl) draw quad
draw quad
probe (0, 0) rgba (2.1, 2.2, 2.3, 0.0)
@ -241,7 +241,7 @@ float4 main() : sv_target
uniform 0 float 200
uniform 4 float 201
uniform 8 float 202
todo(msl) draw quad
draw quad
probe (0,0) rgba (201.0, 202.0, 0.0, 0.0)
[pixel shader]
@ -259,7 +259,7 @@ float4 main() : sv_target
uniform 0 float 201
uniform 4 float 202
uniform 8 float 203
todo(msl) draw quad
draw quad
probe (0,0) rgba (203.0, 0.0, 0.0, 0.0)
[pixel shader fail(sm<4)]

View File

@ -17,7 +17,7 @@ void main(in uniform float4 a, uniform float4 b, out float4 o : sv_target)
[test]
uniform 0 float4 0.1 0.0 0.0 0.0
uniform 4 float4 0.2 0.0 0.0 0.0
todo(sm>=6 | msl) draw quad
todo(sm>=6) draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
[pixel shader]
@ -42,5 +42,5 @@ void main(out float4 o : sv_target)
[test]
uniform 0 float4 0.1 0.0 0.0 0.0
uniform 4 float4 0.2 0.0 0.0 0.0
todo(msl) draw quad
draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)

View File

@ -169,7 +169,7 @@ float4 main() : sv_target
[test]
uniform 0 float4 20 30 40 -1
todo(msl) draw quad
draw quad
probe (0,0) rgba (10.0, 20.0, 30.0, 40.0)
@ -187,7 +187,7 @@ float4 main() : sv_target
[test]
uniform 0 float4 20 30 80 -1
todo(msl) draw quad
draw quad
probe (0,0) rgba (80.0, 30.0, 20.0, 10.0)

View File

@ -31,5 +31,5 @@ float4 main(uniform float2x2 m, uniform float4 v) : sv_target
uniform 0 float4 11 12 0 0
uniform 4 float4 13 14 0 0
uniform 8 float4 20 21 22 23
todo(msl) draw quad
draw quad
probe (320,240) rgba (13.0, 21.0, 0.0, 0.0)