vkd3d-shader/msl: Implement VKD3DSIH_IADD.

This commit is contained in:
Henri Verbeet
2025-05-23 11:24:54 +02:00
parent cc33439f19
commit 3673b65485
Notes: Henri Verbeet 2025-06-09 16:31:45 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1547
10 changed files with 36 additions and 29 deletions

View File

@@ -929,6 +929,7 @@ static void msl_handle_instruction(struct msl_generator *gen, const struct vkd3d
switch (ins->opcode)
{
case VKD3DSIH_ADD:
case VKD3DSIH_IADD:
msl_binop(gen, ins, "+");
break;
case VKD3DSIH_AND:

View File

@@ -300,13 +300,13 @@ if(sm>=6) uniform 4 uint 0x4200
% i is allocated differently between SM4-5 and SM6
uniform 5 uint 2
uniform 8 uint 2
todo(msl | sm>=6) draw quad
todo(sm>=6) draw quad
probe (0, 0) rgba(10.25, 3.5, 0.0, 0.0)
uniform 0 uint 0
uniform 4 uint 0
uniform 5 uint 0
uniform 8 uint 0
todo(msl | sm>=6) draw quad
todo(sm>=6) draw quad
probe (0, 0) rgba(1.0, 2.0, 0, 0)
[pixel shader]

View File

@@ -271,7 +271,7 @@ uniform 0 uint 0
uniform 4 uint 0
uniform 8 uint 0xffd
uniform 12 uint 1
todo(msl) draw quad
draw quad
probe (0, 0) rgbai(1, -0xfff, 0xffe, -0xffe)
[pixel shader]
@@ -290,14 +290,14 @@ uniform 4 uint 0xffe
% i is allocated differently between SM4-5 and SM6
uniform 5 uint 2
uniform 8 uint 2
todo(msl) draw quad
draw quad
% In D3D12 with SM5 all reads to the array return 0
if(sm>=6 | !d3d12) probe (0, 0) rgbaui(0xfffff803, 0x1ffd, 0, 0)
uniform 0 uint 0
uniform 4 uint 0
uniform 5 uint 0
uniform 8 uint 0
todo(msl) draw quad
draw quad
if(sm>=6 | !d3d12) probe (0, 0) rgbaui(1, 2, 0, 0)
[pixel shader]

View File

@@ -124,11 +124,11 @@ uint4 main() : sv_target
[test]
uniform 0 uint 0
uniform 4 uint 0
todo(msl) draw quad
draw quad
probe (0, 0) rgbaui(0xfff, 0x7ff, 0, 0)
uniform 0 uint 1
uniform 4 uint 0xfff
todo(msl) draw quad
draw quad
probe (0, 0) rgbaui(0x1000, 0x17fe, 0, 0)
[pixel shader]
@@ -147,14 +147,14 @@ uniform 4 uint 0xffe
% i is allocated differently between SM4-5 and SM6
uniform 5 uint 2
uniform 8 uint 2
todo(msl) draw quad
draw quad
% In D3D12 with SM5 all reads to the array return 0
if(sm>=6 | !d3d12) probe (0, 0) rgbaui(0x801, 0x1ffd, 0, 0)
uniform 0 uint 0
uniform 4 uint 0
uniform 5 uint 0
uniform 8 uint 0
todo(msl) draw quad
draw quad
if(sm>=6 | !d3d12) probe (0, 0) rgbaui(1, 2, 0, 0)
[pixel shader]

View File

@@ -49,5 +49,5 @@ float4 main(struct input i) : sv_target
}
[test]
todo(msl) draw triangle strip 4
draw triangle strip 4
probe (0, 0, 640, 480) rgba (0.0, 2.0, 2.0, 2.0)

View File

@@ -40,11 +40,11 @@ float4 main(float4 pos : SV_Position, uint sample_idx : SV_SampleIndex) : SV_Tar
[test]
clear rtv 0 1.0 1.0 1.0 1.0
todo(msl) draw triangle list 3
todo probe ( 0, 0) rgba(0.25, 0.25, 0.25, 0.25)
todo probe (639, 0) rgba(0.0, 0.0, 0.0, 0.0)
todo probe ( 0, 479) rgba(0.25, 0.25, 0.25, 0.25)
todo probe (639, 479) rgba(0.0, 0.0, 0.0, 0.0)
draw triangle list 3
todo(vulkan | opengl | d3d12) probe ( 0, 0) rgba(0.25, 0.25, 0.25, 0.25)
todo(vulkan | opengl | d3d12) probe (639, 0) rgba(0.0, 0.0, 0.0, 0.0)
todo(vulkan | opengl | d3d12) probe ( 0, 479) rgba(0.25, 0.25, 0.25, 0.25)
todo(vulkan | opengl | d3d12) probe (639, 479) rgba(0.0, 0.0, 0.0, 0.0)
% Centroid interpolation, which means the pixel center if all samples are
% covered and the first covered sample if a least a sample is not covered (in
@@ -72,11 +72,11 @@ float4 main(centroid float4 pos : SV_Position, uint sample_idx : SV_SampleIndex)
[test]
clear rtv 0 1.0 1.0 1.0 1.0
todo(glsl | msl) draw triangle list 3
todo(glsl) draw triangle list 3
todo probe ( 0, 0) rgba(0.25, 0.25, 0.25, 0.25)
todo probe (638, 0) rgba(0.0, 0.0, 0.0, 0.0)
todo(vulkan | opengl | d3d12) probe (638, 0) rgba(0.0, 0.0, 0.0, 0.0)
todo probe ( 0, 478) rgba(0.25, 0.25, 0.25, 0.25)
todo probe (639, 479) rgba(0.0, 0.0, 0.0, 0.0)
todo(vulkan | opengl | d3d12) probe (639, 479) rgba(0.0, 0.0, 0.0, 0.0)
% Sample interpolation.
@@ -117,7 +117,7 @@ float4 main(float4 pos : SV_Position, float2 attr : ATTR, uint sample_idx : SV_S
[test]
clear rtv 0 1.0 1.0 1.0 1.0
todo(msl) draw triangle list 3
draw triangle list 3
probe ( 0, 0) rgba(0.25, 0.25, 0.25, 0.25)
probe (639, 0) rgba(0.0, 0.0, 0.0, 0.0)
probe ( 0, 479) rgba(0.25, 0.25, 0.25, 0.25)

View File

@@ -151,11 +151,11 @@ uniform 8 float 3.0
uniform 12 float 4.0
if(sm<4) uniform 16 float4 0 1 0 0
if(sm>=4) uniform 16 uint4 0 1 0 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba(3.0, 3.0, 3.0, 3.0)
if(sm<4) uniform 16 float4 1 1 0 0
if(sm>=4) uniform 16 uint4 1 1 0 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba(4.0, 4.0, 4.0, 4.0)
% Copy-prop is currently unable to propagate the following,

View File

@@ -383,31 +383,31 @@ uniform 4 float4 5.0 6.0 7.0 8.0
uniform 8 float4 9.0 10.0 11.0 12.0
if(sm<4) uniform 12 float4 0 0 0 0
if(sm>=4) uniform 12 int4 0 0 0 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba(1.0, 2.0, 3.0, 4.0)
if(sm<4) uniform 12 float4 1 0 0 0
if(sm>=4) uniform 12 int4 1 0 0 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba(5.0, 6.0, 7.0, 8.0)
if(sm<4) uniform 12 float4 0 1 0 0
if(sm>=4) uniform 12 int4 0 1 0 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba(5.0, 6.0, 7.0, 8.0)
if(sm<4) uniform 12 float4 1 1 0 0
if(sm>=4) uniform 12 int4 1 1 0 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba(9.0, 10.0, 11.0, 12.0)
if(sm<4) uniform 12 float4 0.5 0 0 0
if(sm>=4) uniform 12 int4 0 0 0 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba(1.0, 2.0, 3.0, 4.0)
if(sm<4) uniform 12 float4 0 1.4 0 0
if(sm>=4) uniform 12 int4 0 1 0 0 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba(5.0, 6.0, 7.0, 8.0)
if(sm<4) uniform 12 float4 1.5 0 0 0
if(sm>=4) uniform 12 int4 2 0 0 0
todo(msl) draw quad
draw quad
probe (0, 0) rgba(9.0, 10.0, 11.0, 12.0)
[require]

View File

@@ -52,7 +52,7 @@ void main(float4 position : SV_Position, float2 t0 : TEXCOORD0,
}
[test]
todo(msl) draw triangle strip 4
draw triangle strip 4
probe (0, 0) rgba (10.0, 8.0, 7.0, 3.0)
[input layout]

View File

@@ -92,10 +92,16 @@ static MTLVertexFormat get_metal_attribute_format(DXGI_FORMAT format)
{
case DXGI_FORMAT_R32G32B32A32_FLOAT:
return MTLVertexFormatFloat4;
case DXGI_FORMAT_R32G32B32A32_UINT:
return MTLVertexFormatUInt4;
case DXGI_FORMAT_R32G32_FLOAT:
return MTLVertexFormatFloat2;
case DXGI_FORMAT_R32G32_SINT:
return MTLVertexFormatInt2;
case DXGI_FORMAT_R32_FLOAT:
return MTLVertexFormatFloat;
case DXGI_FORMAT_R32_UINT:
return MTLVertexFormatUInt;
default:
return MTLVertexFormatInvalid;
}