[PATCH 0/1] MR774: tests: Check that side effects do not happen after discard.
From: Giovanni Mascellani <gmascellani(a)codeweavers.com> --- tests/hlsl/discard.shader_test | 50 +++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/tests/hlsl/discard.shader_test b/tests/hlsl/discard.shader_test index a5c210f03..cf53bf482 100644 --- a/tests/hlsl/discard.shader_test +++ b/tests/hlsl/discard.shader_test @@ -3,7 +3,8 @@ uniform float4 x; float4 main() : sv_target { - if (x.x == 9.0f) discard; + if (x.x == 9.0f) + discard; return x; } @@ -14,3 +15,50 @@ probe all rgba (1, 2, 3, 4) uniform 0 float4 9 8 7 6 todo(sm<4 | glsl) draw quad probe all rgba (1, 2, 3, 4) + +[require] +shader model >= 5.0 + +[uav 0] +format r32 float +size (2d, 2, 1) + +0.0 0.0 + +[uav 1] +format r32 float +size (2d, 2, 1) + +0.0 0.0 + +% Check that side effects stop happening after discard +[pixel shader] +uniform float4 x; +RWTexture2D<float> y; + +float4 main(float4 pos : sv_position) : sv_target +{ + if (pos.x == 0.5 && pos.y == 0.5) + y[uint2(0, 0)] += 1; + if (x.x == 9.0f) + discard; + if (pos.x == 0.5 && pos.y == 0.5) + y[uint2(1, 0)] += 1; + return x; +} + +[test] +uniform 0 float4 1 2 3 4 +todo(glsl) draw quad +probe all rgba (1, 2, 3, 4) +if(sm<6) probe uav 1 (0, 0) r (1.0) +if(sm<6) probe uav 1 (1, 0) r (1.0) +if(sm>=6) probe uav 0 (0, 0) r (1.0) +if(sm>=6) probe uav 0 (1, 0) r (1.0) +uniform 0 float4 9 8 7 6 +todo(glsl) draw quad +probe all rgba (1, 2, 3, 4) +if(sm<6) probe uav 1 (0, 0) r (2.0) +if(sm<6) probe uav 1 (1, 0) r (1.0) +if(sm>=6) probe uav 0 (0, 0) r (2.0) +if(sm>=6) probe uav 0 (1, 0) r (1.0) -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/774
This merge request was approved by Giovanni Mascellani. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/774
Note that it may be worth adding a test for derivative computation after discard as well; that's the issue that SPV_EXT_demote_to_helper_invocation addresses. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/774#note_67489
This merge request was approved by Henri Verbeet. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/774
Conor McCarthy (@cmccarthy) commented about tests/hlsl/discard.shader_test:
+ y[uint2(0, 0)] += 1; + if (x.x == 9.0f) + discard; + if (pos.x == 0.5 && pos.y == 0.5) + y[uint2(1, 0)] += 1; + return x; +} + +[test] +uniform 0 float4 1 2 3 4 +todo(glsl) draw quad +probe all rgba (1, 2, 3, 4) +if(sm<6) probe uav 1 (0, 0) r (1.0) +if(sm<6) probe uav 1 (1, 0) r (1.0) +if(sm>=6) probe uav 0 (0, 0) r (1.0) +if(sm>=6) probe uav 0 (1, 0) r (1.0) Why use two UAVs and separate probes for sm<6 and sm>=6? Would `RWTexture2D<float> y : register(u1)` take care of it more simply?
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/774#note_67505
participants (4)
-
Conor McCarthy (@cmccarthy) -
Giovanni Mascellani -
Giovanni Mascellani (@giomasce) -
Henri Verbeet (@hverbeet)