mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
tests/hlsl: Add some tests for special semantic name suffixes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
committed by
Henri Verbeet
parent
cc53965ea9
commit
de2653e3d3
Notes:
Henri Verbeet
2025-10-06 19:48:17 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1721
@@ -1,6 +1,14 @@
|
|||||||
[require]
|
[require]
|
||||||
shader model >= 5.0
|
shader model >= 5.0
|
||||||
|
|
||||||
|
[input layout]
|
||||||
|
0 r32g32-float attr_centroid
|
||||||
|
|
||||||
|
[vb 0]
|
||||||
|
1.0 2.0
|
||||||
|
1.0 2.0
|
||||||
|
1.0 2.0
|
||||||
|
|
||||||
[rtv 0]
|
[rtv 0]
|
||||||
format r32g32b32a32-float
|
format r32g32b32a32-float
|
||||||
size (2dms, 4, 640, 480)
|
size (2dms, 4, 640, 480)
|
||||||
@@ -14,7 +22,9 @@ static const float2 vertices[3] =
|
|||||||
{ 3.0f, 1.0f},
|
{ 3.0f, 1.0f},
|
||||||
{-1.0f + epsilon, -3.0f},
|
{-1.0f + epsilon, -3.0f},
|
||||||
};
|
};
|
||||||
void main(uint id : SV_VertexID, out float4 position : SV_Position, out float2 attr : ATTR)
|
|
||||||
|
void main(uint id : SV_VertexID, out float4 position : SV_Position, out float2 attr : ATTR,
|
||||||
|
inout float2 attr2 : ATTR_centroid0)
|
||||||
{
|
{
|
||||||
position = float4(vertices[id], 0.0f, 1.0f);
|
position = float4(vertices[id], 0.0f, 1.0f);
|
||||||
attr = float2(position.x * 320.0f + 320.0f, -position.y * 240.0f + 240.0f);
|
attr = float2(position.x * 320.0f + 320.0f, -position.y * 240.0f + 240.0f);
|
||||||
@@ -52,6 +62,25 @@ todo(vulkan | opengl & llvmpipe | d3d12) probe (639, 479) f32(0.0, 0.0, 0.0, 0.0
|
|||||||
% The WARP driver seems to have problems with some corner pixels, which we
|
% The WARP driver seems to have problems with some corner pixels, which we
|
||||||
% avoid.
|
% avoid.
|
||||||
|
|
||||||
|
[pixel shader fail]
|
||||||
|
static const float2 positions[4] =
|
||||||
|
{
|
||||||
|
{-0.125f, -0.375f},
|
||||||
|
{ 0.375f, -0.125f},
|
||||||
|
{-0.375f, 0.125f},
|
||||||
|
{ 0.125f, 0.375f},
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main(float4 pos : SV_Position_centroid, uint sample_idx : SV_SampleIndex) : SV_Target
|
||||||
|
{
|
||||||
|
bool first_col = floor(pos.x) == 0.0f;
|
||||||
|
float2 ref = floor(pos.xy) + float2(0.5f, 0.5f);
|
||||||
|
float2 diff = pos.xy - ref;
|
||||||
|
float2 expected = first_col ? positions[0] : 0.0f;
|
||||||
|
float2 err = abs(diff - expected) * (sample_idx + 1);
|
||||||
|
return floor(1000.0f * float4(err, 0.0f, 0.0f));
|
||||||
|
}
|
||||||
|
|
||||||
[pixel shader]
|
[pixel shader]
|
||||||
static const float2 positions[4] =
|
static const float2 positions[4] =
|
||||||
{
|
{
|
||||||
@@ -141,6 +170,7 @@ static const float2 positions[4] =
|
|||||||
{-0.375f, 0.125f},
|
{-0.375f, 0.125f},
|
||||||
{ 0.125f, 0.375f},
|
{ 0.125f, 0.375f},
|
||||||
};
|
};
|
||||||
|
|
||||||
float4 main(float4 pos : SV_Position, centroid float2 attr : ATTR,
|
float4 main(float4 pos : SV_Position, centroid float2 attr : ATTR,
|
||||||
uint sample_idx : SV_SampleIndex) : SV_Target
|
uint sample_idx : SV_SampleIndex) : SV_Target
|
||||||
{
|
{
|
||||||
@@ -160,6 +190,149 @@ probe (638, 0) rgba(0.0, 0.0, 0.0, 0.0)
|
|||||||
probe (0, 478) rgba(0.25, 0.25, 0.25, 0.25)
|
probe (0, 478) rgba(0.25, 0.25, 0.25, 0.25)
|
||||||
todo(llvmpipe) probe (639, 479) rgba(0.0, 0.0, 0.0, 0.0)
|
todo(llvmpipe) probe (639, 479) rgba(0.0, 0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
[pixel shader]
|
||||||
|
static const float2 positions[4] =
|
||||||
|
{
|
||||||
|
{-0.125f, -0.375f},
|
||||||
|
{ 0.375f, -0.125f},
|
||||||
|
{-0.375f, 0.125f},
|
||||||
|
{ 0.125f, 0.375f},
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main(float4 pos : SV_Position, float2 attr : ATTR_centRoid,
|
||||||
|
uint sample_idx : SV_SampleIndex) : SV_Target
|
||||||
|
{
|
||||||
|
bool first_col = floor(pos.x) == 0.0f;
|
||||||
|
float2 ref = floor(pos.xy) + float2(0.5f, 0.5f);
|
||||||
|
float2 diff = attr.xy - ref;
|
||||||
|
float2 expected = first_col ? positions[0] : 0.0f;
|
||||||
|
float2 err = abs(diff - expected) * (sample_idx + 1);
|
||||||
|
return floor(1000.0f * float4(err, 0.0f, 0.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
% Tests are skipped for sm6, since it doesn't consider semantic suffixes
|
||||||
|
% leaving names unchanged.
|
||||||
|
|
||||||
|
[test]
|
||||||
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
|
if(sm<6) draw triangle list 3
|
||||||
|
if(sm<6) todo probe (0, 0) f32(0.25, 0.25, 0.25, 0.25)
|
||||||
|
if(sm<6) probe (638, 0) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
|
if(sm<6) todo probe (0, 478) f32(0.25, 0.25, 0.25, 0.25)
|
||||||
|
if(sm<6) probe (639, 479) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
% The "_centroid" semantic modifier can be specified together with the "centroid" prefix attribute.
|
||||||
|
|
||||||
|
[pixel shader]
|
||||||
|
static const float2 positions[4] =
|
||||||
|
{
|
||||||
|
{-0.125f, -0.375f},
|
||||||
|
{ 0.375f, -0.125f},
|
||||||
|
{-0.375f, 0.125f},
|
||||||
|
{ 0.125f, 0.375f},
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main(float4 pos : SV_Position, centroid float2 attr : ATTR_centRoid,
|
||||||
|
uint sample_idx : SV_SampleIndex) : SV_Target
|
||||||
|
{
|
||||||
|
bool first_col = floor(pos.x) == 0.0f;
|
||||||
|
float2 ref = floor(pos.xy) + float2(0.5f, 0.5f);
|
||||||
|
float2 diff = attr.xy - ref;
|
||||||
|
float2 expected = first_col ? positions[0] : 0.0f;
|
||||||
|
float2 err = abs(diff - expected) * (sample_idx + 1);
|
||||||
|
return floor(1000.0f * float4(err, 0.0f, 0.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
% Tests are skipped for sm6, since it doesn't consider semantic suffixes
|
||||||
|
% leaving names unchanged.
|
||||||
|
|
||||||
|
[test]
|
||||||
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
|
if(sm<6) todo(msl | glsl) draw triangle list 3
|
||||||
|
if(sm<6) todo(llvmpipe) probe (0, 0) f32(0.25, 0.25, 0.25, 0.25)
|
||||||
|
if(sm<6) probe (638, 0) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
|
if(sm<6) probe (0, 478) f32(0.25, 0.25, 0.25, 0.25)
|
||||||
|
if(sm<6) todo(llvmpipe) probe (639, 479) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
[pixel shader]
|
||||||
|
static const float2 positions[4] =
|
||||||
|
{
|
||||||
|
{-0.125f, -0.375f},
|
||||||
|
{ 0.375f, -0.125f},
|
||||||
|
{-0.375f, 0.125f},
|
||||||
|
{ 0.125f, 0.375f},
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ps_in
|
||||||
|
{
|
||||||
|
float4 pos : SV_Position;
|
||||||
|
float2 attr : ATTR_centRoid;
|
||||||
|
uint sample_idx : SV_SampleIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main(ps_in data) : SV_Target
|
||||||
|
{
|
||||||
|
bool first_col = floor(data.pos.x) == 0.0f;
|
||||||
|
float2 ref = floor(data.pos.xy) + float2(0.5f, 0.5f);
|
||||||
|
float2 diff = data.attr.xy - ref;
|
||||||
|
float2 expected = first_col ? positions[0] : 0.0f;
|
||||||
|
float2 err = abs(diff - expected) * (data.sample_idx + 1);
|
||||||
|
return floor(1000.0f * float4(err, 0.0f, 0.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
% Tests are skipped for sm6, since it doesn't consider semantic suffixes
|
||||||
|
% leaving names unchanged.
|
||||||
|
|
||||||
|
[test]
|
||||||
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
|
if(sm<6) draw triangle list 3
|
||||||
|
if(sm<6) todo probe (0, 0) f32(0.25, 0.25, 0.25, 0.25)
|
||||||
|
if(sm<6) probe (638, 0) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
|
if(sm<6) todo probe (0, 478) f32(0.25, 0.25, 0.25, 0.25)
|
||||||
|
if(sm<6) probe (639, 479) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
[pixel shader]
|
||||||
|
static const float2 positions[4] =
|
||||||
|
{
|
||||||
|
{-0.125f, -0.375f},
|
||||||
|
{ 0.375f, -0.125f},
|
||||||
|
{-0.375f, 0.125f},
|
||||||
|
{ 0.125f, 0.375f},
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main(float4 pos : SV_Position, float2 attr : ATTR, float2 attr2 : ATTR_centroid0,
|
||||||
|
uint sample_idx : SV_SampleIndex) : SV_Target
|
||||||
|
{
|
||||||
|
bool first_col = floor(pos.x) == 0.0f;
|
||||||
|
float2 ref = floor(pos.xy) + float2(0.5f, 0.5f);
|
||||||
|
float2 diff = attr.xy - ref;
|
||||||
|
float2 expected = first_col ? positions[0] : 0.0f;
|
||||||
|
float2 err = abs(diff - expected) * (sample_idx + 1);
|
||||||
|
return floor(1000.0f * float4(err, attr2.x, attr2.y));
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
|
todo(msl & sm>=6) draw triangle list 3
|
||||||
|
todo probe (0, 0) f32(219.0, 656.5, 750.25, 1500.25)
|
||||||
|
probe (638, 0) f32(0.0, 0.0, 1000.0, 2000.0)
|
||||||
|
todo probe (0, 478) f32(219.0, 656.5, 750.25, 1500.25)
|
||||||
|
probe (639, 479) f32(0.0, 0.0, 1000.0, 2000.0)
|
||||||
|
|
||||||
|
[pixel shader]
|
||||||
|
float4 main(float4 pos : SV_Position, float2 attr : ATTR, float2 attr2 : ATTR_centroid_centroid,
|
||||||
|
uint sample_idx : SV_SampleIndex) : SV_Target
|
||||||
|
{
|
||||||
|
return float4(attr2, 0.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
|
% This test causes the GPU to hang with MVK.
|
||||||
|
if(sm<6 & !mvk) draw triangle list 3
|
||||||
|
if(sm<6 & !mvk) probe (0, 0) f32(1.0, 1.75, 0.25, 0.25)
|
||||||
|
if(sm<6 & !mvk) probe (638, 0) f32(1.0, 2.0, 0.0, 0.0)
|
||||||
|
|
||||||
% Sample interpolation.
|
% Sample interpolation.
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader todo]
|
||||||
@@ -257,3 +430,38 @@ 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 (639, 0) rgba(0.0, 0.0, 0.0, 0.0)
|
||||||
probe ( 0, 479) rgba(0.25, 0.25, 0.25, 0.25)
|
probe ( 0, 479) rgba(0.25, 0.25, 0.25, 0.25)
|
||||||
probe (639, 479) rgba(0.0, 0.0, 0.0, 0.0)
|
probe (639, 479) rgba(0.0, 0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
[require]
|
||||||
|
shader model >= 6.0
|
||||||
|
|
||||||
|
% SM6 appears to require all vertex outputs to be declared in
|
||||||
|
% pixel shader, meaning that both ATTR and ATTR_centroid must be present.
|
||||||
|
% That is not going to work for <SM6, so it's tested separately.
|
||||||
|
|
||||||
|
[pixel shader]
|
||||||
|
static const float2 positions[4] =
|
||||||
|
{
|
||||||
|
{-0.125f, -0.375f},
|
||||||
|
{ 0.375f, -0.125f},
|
||||||
|
{-0.375f, 0.125f},
|
||||||
|
{ 0.125f, 0.375f},
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main(float4 pos : SV_Position, float2 attr : ATTR,
|
||||||
|
float2 attr2 : ATTR_centroid, uint sample_idx : SV_SampleIndex) : SV_Target
|
||||||
|
{
|
||||||
|
bool first_col = floor(pos.x) == 0.0f;
|
||||||
|
float2 ref = floor(pos.xy) + float2(0.5f, 0.5f);
|
||||||
|
float2 diff = attr.xy - ref;
|
||||||
|
float2 expected = first_col ? positions[0] : 0.0f;
|
||||||
|
float2 err = abs(diff - expected) * (sample_idx + 1);
|
||||||
|
return floor(1000.0f * float4(err, attr2.x, attr2.y));
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
|
todo(glsl | msl) draw triangle list 3
|
||||||
|
todo probe (0, 0) f32(219.0, 656.5, 750.25, 1500.25)
|
||||||
|
probe (638, 0) f32(0.0, 0.0, 1000.0, 2000.0)
|
||||||
|
todo probe (0, 478) f32(219.0, 656.5, 750.25, 1500.25)
|
||||||
|
probe (639, 479) f32(0.0, 0.0, 1000.0, 2000.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user