mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
tests/hlsl: Check the result for attribute evaluation tests more sharply.
Those tests are meant to check that each single sample computes the right value during a multi-sampled rendering operation. Checking whether the result is correct after multi-sample resolution isn't enough, because errors at different samples belonging to the same pixel might have cancelled out. Instead, for each shader invocation we compute the expected result and return the absolute value of the difference between the expected and computed value. This way errors at different samples cannot cancel out, but add up.
This commit is contained in:
committed by
Henri Verbeet
parent
085ba17c4c
commit
a6c6ba6eda
Notes:
Henri Verbeet
2025-10-16 15:22:00 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1755
@@ -292,32 +292,23 @@ 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)
|
if(sm<6) todo(llvmpipe) probe (639, 479) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
|
|
||||||
[pixel shader]
|
[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,
|
float4 main(float4 pos : SV_Position, float2 attr : ATTR, float2 attr2 : ATTR_centroid0,
|
||||||
uint sample_idx : SV_SampleIndex) : SV_Target
|
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 ref = floor(pos.xy) + float2(0.5f, 0.5f);
|
||||||
float2 diff = attr.xy - ref;
|
float4 diff = float4(attr.xy - ref, attr2);
|
||||||
float2 expected = first_col ? positions[0] : 0.0f;
|
float4 expected = float4(0.0f, 0.0f, 1.0f, 2.0f);
|
||||||
float2 err = abs(diff - expected) * (sample_idx + 1);
|
float4 err = abs(diff - expected) * (sample_idx + 1);
|
||||||
return floor(1000.0f * float4(err, attr2.x, attr2.y));
|
return floor(1000.0f * err);
|
||||||
}
|
}
|
||||||
|
|
||||||
[test]
|
[test]
|
||||||
clear rtv 0 1.0 1.0 1.0 1.0
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
todo(msl & sm>=6) draw triangle list 3
|
todo(msl & sm>=6) draw triangle list 3
|
||||||
todo probe (0, 0) f32(219.0, 656.5, 750.25, 1500.25)
|
probe (0, 0) f32(0.25, 0.25, 0.25, 0.25)
|
||||||
probe (638, 0) f32(0.0, 0.0, 1000.0, 2000.0)
|
probe (638, 0) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
todo probe (0, 478) f32(219.0, 656.5, 750.25, 1500.25)
|
probe (0, 478) f32(0.25, 0.25, 0.25, 0.25)
|
||||||
probe (639, 479) f32(0.0, 0.0, 1000.0, 2000.0)
|
probe (639, 479) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
|
|
||||||
[pixel shader]
|
[pixel shader]
|
||||||
float4 main(float4 pos : SV_Position, float2 attr : ATTR, float2 attr2 : ATTR_centroid_centroid,
|
float4 main(float4 pos : SV_Position, float2 attr : ATTR, float2 attr2 : ATTR_centroid_centroid,
|
||||||
@@ -439,29 +430,20 @@ shader model >= 6.0
|
|||||||
% That is not going to work for <SM6, so it's tested separately.
|
% That is not going to work for <SM6, so it's tested separately.
|
||||||
|
|
||||||
[pixel shader]
|
[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,
|
float4 main(float4 pos : SV_Position, float2 attr : ATTR,
|
||||||
float2 attr2 : ATTR_centroid, uint sample_idx : SV_SampleIndex) : SV_Target
|
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 ref = floor(pos.xy) + float2(0.5f, 0.5f);
|
||||||
float2 diff = attr.xy - ref;
|
float4 diff = float4(attr.xy - ref, attr2);
|
||||||
float2 expected = first_col ? positions[0] : 0.0f;
|
float4 expected = float4(0.0f, 0.0f, 1.0f, 2.0f);
|
||||||
float2 err = abs(diff - expected) * (sample_idx + 1);
|
float4 err = abs(diff - expected) * (sample_idx + 1);
|
||||||
return floor(1000.0f * float4(err, attr2.x, attr2.y));
|
return floor(1000.0f * err);
|
||||||
}
|
}
|
||||||
|
|
||||||
[test]
|
[test]
|
||||||
clear rtv 0 1.0 1.0 1.0 1.0
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
todo(glsl | msl) draw triangle list 3
|
todo(glsl | msl) draw triangle list 3
|
||||||
todo probe (0, 0) f32(219.0, 656.5, 750.25, 1500.25)
|
probe (0, 0) f32(0.25, 0.25, 0.25, 0.25)
|
||||||
probe (638, 0) f32(0.0, 0.0, 1000.0, 2000.0)
|
probe (638, 0) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
todo probe (0, 478) f32(219.0, 656.5, 750.25, 1500.25)
|
probe (0, 478) f32(0.25, 0.25, 0.25, 0.25)
|
||||||
probe (639, 479) f32(0.0, 0.0, 1000.0, 2000.0)
|
probe (639, 479) f32(0.0, 0.0, 0.0, 0.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user