vkd3d-shader/msl: Implement VKD3DSIH_LD2DMS.

This commit is contained in:
Henri Verbeet
2025-05-26 22:15:36 +02:00
parent 2d90f51d57
commit 9c2643b9f7
Notes: Henri Verbeet 2025-06-11 20:37:50 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1560
2 changed files with 18 additions and 13 deletions

View File

@@ -861,10 +861,11 @@ static void msl_ld(struct msl_generator *gen, const struct vkd3d_shader_instruct
data_type = VKD3D_DATA_FLOAT; data_type = VKD3D_DATA_FLOAT;
} }
if (resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_2DMS if (resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_CUBE
|| resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_CUBE || resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY
|| resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY || (ins->opcode != VKD3DSIH_LD2DMS
|| resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY) && (resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_2DMS
|| resource_type == VKD3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY)))
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_UNSUPPORTED, msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_UNSUPPORTED,
"Texel fetches from resource type %#x are not supported.", resource_type); "Texel fetches from resource type %#x are not supported.", resource_type);
@@ -903,7 +904,10 @@ static void msl_ld(struct msl_generator *gen, const struct vkd3d_shader_instruct
if (resource_type != VKD3D_SHADER_RESOURCE_BUFFER) if (resource_type != VKD3D_SHADER_RESOURCE_BUFFER)
{ {
vkd3d_string_buffer_printf(read, ", "); vkd3d_string_buffer_printf(read, ", ");
if (ins->opcode != VKD3DSIH_LD2DMS)
msl_print_src_with_type(read, gen, &ins->src[0], VKD3DSP_WRITEMASK_3, VKD3D_DATA_UINT); msl_print_src_with_type(read, gen, &ins->src[0], VKD3DSP_WRITEMASK_3, VKD3D_DATA_UINT);
else
msl_print_src_with_type(read, gen, &ins->src[2], VKD3DSP_WRITEMASK_0, VKD3D_DATA_UINT);
} }
vkd3d_string_buffer_printf(read, "))"); vkd3d_string_buffer_printf(read, "))");
msl_print_swizzle(read, ins->src[1].swizzle, ins->dst[0].write_mask); msl_print_swizzle(read, ins->src[1].swizzle, ins->dst[0].write_mask);
@@ -1123,6 +1127,7 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
msl_cast(gen, ins, "float"); msl_cast(gen, ins, "float");
break; break;
case VKD3DSIH_LD: case VKD3DSIH_LD:
case VKD3DSIH_LD2DMS:
msl_ld(gen, ins); msl_ld(gen, ins);
break; break;
case VKD3DSIH_LOG: case VKD3DSIH_LOG:

View File

@@ -47,7 +47,7 @@ float4 main(float4 pos : sv_position) : sv_target
} }
[test] [test]
todo(msl) draw quad draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1) probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1)
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8) probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
@@ -71,7 +71,7 @@ float4 main(float4 pos : sv_position) : sv_target
} }
[test] [test]
todo(msl) draw quad draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1) probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1)
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8) probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
@@ -88,7 +88,7 @@ float4 main(float4 pos : sv_position) : sv_target
} }
[test] [test]
todo(msl) draw quad draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1) probe (1, 0) rgba (0.6, 0.5, 0.2, 0.1)
probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8) probe (0, 1) rgba (0.5, 0.7, 0.6, 0.8)
@@ -140,7 +140,7 @@ float4 main(float4 pos : sv_position) : sv_target
} }
[test] [test]
todo(msl) draw quad draw quad
probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4) probe (0, 0) rgba (0.1, 0.2, 0.3, 0.4)
probe (1, 0) rgba (0.5, 0.7, 0.6, 0.8) probe (1, 0) rgba (0.5, 0.7, 0.6, 0.8)
probe (0, 1) rgba (0.6, 0.5, 0.2, 0.1) probe (0, 1) rgba (0.6, 0.5, 0.2, 0.1)
@@ -187,14 +187,14 @@ float4 main(float4 position : sv_position) : sv_target
[test] [test]
uniform 0 uint 0 uniform 0 uint 0
todo(msl) draw quad draw quad
probe (32, 32) rgba(1.0, 0.25, 0.5, 1.0) probe (32, 32) rgba(1.0, 0.25, 0.5, 1.0)
uniform 0 uint 1 uniform 0 uint 1
todo(msl) draw quad draw quad
probe (32, 32) rgba(2.0, 0.25, 0.5, 1.0) probe (32, 32) rgba(2.0, 0.25, 0.5, 1.0)
uniform 0 uint 2 uniform 0 uint 2
todo(msl) draw quad draw quad
probe (32, 32) rgba(4.0, 0.25, 0.5, 1.0) probe (32, 32) rgba(4.0, 0.25, 0.5, 1.0)
uniform 0 uint 3 uniform 0 uint 3
todo(msl) draw quad draw quad
probe (32, 32) rgba(8.0, 0.25, 0.5, 1.0) probe (32, 32) rgba(8.0, 0.25, 0.5, 1.0)