From: Conor McCarthy cmccarthy@codeweavers.com
Where SM >= 6.0 returns different results than earlier models it is convenient to use conditional 'probe' lines containing different expected values. --- tests/hlsl/arithmetic-int.shader_test | 9 +++------ tests/hlsl/duplicate-modifiers.shader_test | 7 ++----- tests/hlsl/entry-point-semantics.shader_test | 17 ++++++----------- tests/hlsl/side-effects.shader_test | 9 +++------ tests/shader_runner.c | 4 ++++ 5 files changed, 18 insertions(+), 28 deletions(-)
diff --git a/tests/hlsl/arithmetic-int.shader_test b/tests/hlsl/arithmetic-int.shader_test index f2044c42c..1128a004f 100644 --- a/tests/hlsl/arithmetic-int.shader_test +++ b/tests/hlsl/arithmetic-int.shader_test @@ -104,8 +104,6 @@ probe all rgba (0.0, 0.0, 0.0, 0.0)
[require] shader model >= 4.0 -% dxcompiler performs this calculation on unsigned values and emits zero. -shader model < 6.0
[pixel shader] float4 main() : SV_TARGET @@ -118,10 +116,9 @@ float4 main() : SV_TARGET
[test] draw quad -probe all rgba (-2147483648.0, -2147483648.0, -2147483648.0, -2147483648.0) - -[require] -shader model >= 4.0 +if(sm<6) probe all rgba (-2147483648.0, -2147483648.0, -2147483648.0, -2147483648.0) +% dxcompiler performs this calculation on unsigned values and emits zero. +if(sm>=6) probe all rgba (0.0, 0.0, 0.0, 0.0)
[pixel shader] float4 main() : sv_target diff --git a/tests/hlsl/duplicate-modifiers.shader_test b/tests/hlsl/duplicate-modifiers.shader_test index bf1d9c1b8..8a3838ffe 100644 --- a/tests/hlsl/duplicate-modifiers.shader_test +++ b/tests/hlsl/duplicate-modifiers.shader_test @@ -1,7 +1,3 @@ -% Returns (0.1, 0.3, 0.2, 0.4) with dxcompiler -[require] -shader model < 6.0 - [pixel shader] typedef const precise row_major float2x2 mat_t; float4 main() : sv_target @@ -12,4 +8,5 @@ float4 main() : sv_target
[test] draw quad -probe all rgba (0.1, 0.2, 0.3, 0.4) +if(sm<6) probe all rgba (0.1, 0.2, 0.3, 0.4) +if(sm>=6) probe all rgba (0.1, 0.3, 0.2, 0.4) diff --git a/tests/hlsl/entry-point-semantics.shader_test b/tests/hlsl/entry-point-semantics.shader_test index d177b0376..e4854a294 100644 --- a/tests/hlsl/entry-point-semantics.shader_test +++ b/tests/hlsl/entry-point-semantics.shader_test @@ -104,11 +104,6 @@ draw quad probe (0, 0) rgba (10.0, 11.0, 30.0, 31.0)
-% dxcompiler emits correct array addressing. -[require] -shader model < 6.0 - - % Arrays (even multi-dimensional) of struct elements are allowed. The fields in the different struct % elements get the same indexes. [pixel shader] @@ -125,7 +120,9 @@ float4 main(in apple aps[2][2]) : sv_target
[test] draw quad -todo(sm>=6) probe (0, 0) rgba (10.0, 10.0, 20.0, 20.0) +if(sm<6) probe (0, 0) rgba (10.0, 10.0, 20.0, 20.0) +% dxcompiler emits correct array addressing. +if(sm>=6) probe (0, 0) rgba (10.0, 40.0, 10.0, 10.0)
[pixel shader] @@ -147,11 +144,9 @@ float4 main(in banana bans[2]) : sv_target
[test] draw quad -todo(sm>=6) probe (0, 0) rgba (10.0, 11.0, 20.0, 21.0) - - -[require] -% reset requirements +if(sm<6) probe (0, 0) rgba (10.0, 11.0, 20.0, 21.0) +% dxcompiler emits correct array addressing. +if(sm>=6) probe (0, 0) rgba (10.0, 11.0, 40.0, 41.0)
[pixel shader fail] diff --git a/tests/hlsl/side-effects.shader_test b/tests/hlsl/side-effects.shader_test index f41e98510..c49a907ba 100644 --- a/tests/hlsl/side-effects.shader_test +++ b/tests/hlsl/side-effects.shader_test @@ -27,11 +27,6 @@ draw quad probe all rgba (11.0, 11.0, 11.0, 11.0)
-% dxcompiler performs the first call to func() before the array index call. -[require] -shader model < 6.0 - - [pixel shader] float4 func(void) { @@ -49,4 +44,6 @@ float4 main() : sv_target
[test] draw quad -probe all rgba (2.2, 2.2, 2.2, 2.2) +if(sm<6) probe all rgba (2.2, 2.2, 2.2, 2.2) +% dxcompiler performs the first call to func() before the array index call. +if(sm>=6) probe all rgba (1.3, 1.3, 1.3, 1.3) diff --git a/tests/shader_runner.c b/tests/shader_runner.c index beb251cf3..e237c7755 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -546,6 +546,10 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) runner->is_todo = runner->minimum_shader_model < SHADER_MODEL_6_0; else if (match_string(line, "todo(sm>=6)", &line)) runner->is_todo = runner->minimum_shader_model >= SHADER_MODEL_6_0; + else if (match_string(line, "if(sm<6)", &line) && runner->minimum_shader_model >= SHADER_MODEL_6_0) + return; + else if (match_string(line, "if(sm>=6)", &line) && runner->minimum_shader_model < SHADER_MODEL_6_0) + return;
if (match_string(line, "dispatch", &line)) {