diff --git a/tests/hlsl/cbuffer.shader_test b/tests/hlsl/cbuffer.shader_test index c1b86c99..e2769c8e 100644 --- a/tests/hlsl/cbuffer.shader_test +++ b/tests/hlsl/cbuffer.shader_test @@ -797,7 +797,7 @@ float4 main() : sv_target return 0; } -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] cbuffer buffer { float4 foo : packoffset(c0); diff --git a/tests/hlsl/object-parameters.shader_test b/tests/hlsl/object-parameters.shader_test index 9efecf15..01162fe4 100644 --- a/tests/hlsl/object-parameters.shader_test +++ b/tests/hlsl/object-parameters.shader_test @@ -123,7 +123,10 @@ todo draw quad todo probe (0,0) rgba (416.0, 416.0, 416.0, 111.0) -[pixel shader todo fail(sm>=6)] +% Fails in sm6 because it uses a uniform parameter. +% Fails in sm5.1 apparently because of a compiler bug: +% error X4609: Overflow of resource binding range +[pixel shader fail(sm>=5.1) todo] Texture2D tex; struct apple @@ -167,7 +170,11 @@ filter point point point address clamp clamp clamp -[pixel shader todo fail(sm>=6)] +% Fails in sm6 because it uses a uniform parameter. +% Fails in sm5.1 apparently because of a compiler bug (different from the above!): +% error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Sampler s3 already declared. Opcode #5 (count is 1-based). +% error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Can't continue validation - aborting. +[pixel shader fail(sm>=5.1) todo] Texture2D tex; sampler sam0; // must reserve s3 diff --git a/tests/hlsl/object-references.shader_test b/tests/hlsl/object-references.shader_test index a3219fc6..79355c7d 100644 --- a/tests/hlsl/object-references.shader_test +++ b/tests/hlsl/object-references.shader_test @@ -138,7 +138,7 @@ todo(msl) draw quad probe (0, 0) rgba (2132, 2132, 2132, 1111) -[pixel shader fail(sm<6)] +[pixel shader fail(sm<6) todo(sm>=5.1)] Texture2D tex[3]; uniform int n; @@ -158,8 +158,7 @@ float4 main() : sv_target } -[pixel shader fail(sm<6)] -// Note: Only valid in shader model 5.1 +[pixel shader fail(sm<5.1) todo(sm>=5.1)] Texture2D tex[3]; uniform int n; @@ -169,8 +168,7 @@ float4 main() : sv_target } -[pixel shader fail(sm<6)] -// Note: Only valid in shader model 5.1 +[pixel shader fail(sm<5.1) todo(sm>=5.1)] RWTexture2D tex[3]; uniform int n; diff --git a/tests/hlsl/register-reservations-profile.shader_test b/tests/hlsl/register-reservations-profile.shader_test index 8b052231..6276c1d0 100644 --- a/tests/hlsl/register-reservations-profile.shader_test +++ b/tests/hlsl/register-reservations-profile.shader_test @@ -154,7 +154,7 @@ probe (0, 0) rgba (2, 2, 2, 99) % reservation is given, but if two different reservations are given it instead % just picks the last one, without regard to version. -[pixel shader todo] +[pixel shader fail(sm>=5.0 & sm<5.1) todo] Texture2D tex1 : register(ps, t1) : register(ps_5_0, t2); float4 main() : sv_target @@ -168,7 +168,7 @@ if(sm>=6) probe (0,0) rgba (2, 2, 2, 99) if(sm<6) probe (0,0) rgba (1, 1, 1, 99) -[pixel shader fail(sm<6) todo] +[pixel shader fail(sm<4.1) todo] Texture2D tex1 : register(ps, t1) : register(ps_4_0, t2); float4 main() : sv_target @@ -181,7 +181,7 @@ draw quad probe (0, 0) rgba (2, 2, 2, 99) -[pixel shader fail(sm<6) todo] +[pixel shader fail(sm<4.1) todo] Texture2D tex1 : register(ps_4_0, t1) : register(ps, t2); float4 main() : sv_target @@ -207,7 +207,7 @@ draw quad probe (0, 0) rgba (2, 2, 2, 99) -[pixel shader fail todo] +[pixel shader fail(sm<4.1 | sm>=6) todo] Texture2D tex1 : register(ps_4_0, t1) : register(t2); float4 main() : sv_target diff --git a/tests/hlsl/register-reservations-resources.shader_test b/tests/hlsl/register-reservations-resources.shader_test index a1313499..fa4968d2 100644 --- a/tests/hlsl/register-reservations-resources.shader_test +++ b/tests/hlsl/register-reservations-resources.shader_test @@ -99,7 +99,7 @@ shader model >= 4.0 % Register reservation with incorrect register type. -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] sampler2D unused : register(t0); Texture2D tex; diff --git a/tests/hlsl/sample-bias.shader_test b/tests/hlsl/sample-bias.shader_test index ec30d139..6de183b6 100644 --- a/tests/hlsl/sample-bias.shader_test +++ b/tests/hlsl/sample-bias.shader_test @@ -47,7 +47,7 @@ todo(sm<4) probe (0, 0) rgba(0.0, 0.0, 10.0, 0.0) shader model >= 3.0 options: backcompat -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] sampler s; float bias; diff --git a/tests/hlsl/sample-grad.shader_test b/tests/hlsl/sample-grad.shader_test index a5872fd7..62026fa7 100644 --- a/tests/hlsl/sample-grad.shader_test +++ b/tests/hlsl/sample-grad.shader_test @@ -15,7 +15,7 @@ levels 2 0.0 0.0 1.0 0.0 -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] sampler s; float4 grad; @@ -35,7 +35,7 @@ uniform 0 float4 2.0 2.0 2.0 2.0 todo(msl) draw quad probe (0,0) rgba (0.0, 0.0, 1.0, 0.0) -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] sampler s; float4 grad; diff --git a/tests/hlsl/sample-level.shader_test b/tests/hlsl/sample-level.shader_test index 090dac42..37cf07b8 100644 --- a/tests/hlsl/sample-level.shader_test +++ b/tests/hlsl/sample-level.shader_test @@ -39,7 +39,7 @@ probe (0, 0) rgba (0.0, 0.0, 1.0, 0.0) shader model >= 3.0 options: backcompat -[pixel shader todo(sm<4) fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm<4 | sm>=5.1)] sampler s; float level; diff --git a/tests/hlsl/sampler-state.shader_test b/tests/hlsl/sampler-state.shader_test index 595f617f..3aa5df44 100644 --- a/tests/hlsl/sampler-state.shader_test +++ b/tests/hlsl/sampler-state.shader_test @@ -2,7 +2,7 @@ options: backcompat -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] sampler2D sam = sampler_state { texture = NULL; @@ -54,7 +54,7 @@ float4 main(): sv_target } -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] sampler sam[2] = { sampler_state @@ -106,7 +106,7 @@ float4 main(): sv_target } -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] sampler sam = sampler_state { texture = NULL; @@ -121,7 +121,7 @@ float4 main(): sv_target } -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] sampler sam = sampler_state { foo = BAR; @@ -135,7 +135,7 @@ float4 main(): sv_target } -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] // default value initializers make it more permissive but if types don't match // then the whole initializer is discarded. float4 f = { @@ -208,7 +208,7 @@ float4 main(): sv_target shader model >= 5.0 options: backcompat -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] // Default values and sample_state work. // Requires sm5. diff --git a/tests/hlsl/sampler.shader_test b/tests/hlsl/sampler.shader_test index fbca650b..949944f4 100644 --- a/tests/hlsl/sampler.shader_test +++ b/tests/hlsl/sampler.shader_test @@ -53,7 +53,7 @@ float4 main() : sv_target [require] options: backcompat -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] samplerCUBE s; float4 main() : sv_target @@ -61,7 +61,7 @@ float4 main() : sv_target return texCUBE(s, float3(0.0, 0.0, 0.0)); } -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] sampler1D s; float4 main() : sv_target @@ -119,7 +119,7 @@ size (2d, 1, 1) 5.0 5.0 5.0 1.0 -[pixel shader fail(sm>=6)] +[pixel shader fail(sm>=5.1) todo(sm>=5.1)] sampler samA; sampler samB[2]; sampler samC[3]; diff --git a/tests/hlsl/state-block-syntax.shader_test b/tests/hlsl/state-block-syntax.shader_test index 8d409a8a..81ea74bf 100644 --- a/tests/hlsl/state-block-syntax.shader_test +++ b/tests/hlsl/state-block-syntax.shader_test @@ -237,7 +237,7 @@ float4 main() : sv_target { return 0; } % The number of state blocks in the state block list must match the number of components. -[pixel shader fail(sm<6)] +[pixel shader fail(sm<5.1) todo(sm>=5.1)] sampler sams[2] { { @@ -246,7 +246,7 @@ sampler sams[2] float4 main() : sv_target { return 0; } -[pixel shader fail(sm<6)] +[pixel shader fail(sm<6) todo(sm>=5.1)] sampler sams[2][2] { { diff --git a/tests/shader_runner.c b/tests/shader_runner.c index a99b9e4a..8b182f61 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1679,6 +1679,13 @@ static void compile_shader(struct shader_runner *runner, const char *source, [SHADER_MODEL_5_0] = "5_0", }; + /* We can let this go through D3DCompile() with the invalid shader model + * string, but it returns a unique error code. Just skip it. */ + if (model < SHADER_MODEL_4_0 && type != SHADER_TYPE_VS && type != SHADER_TYPE_PS && type != SHADER_TYPE_FX) + return; + if (model < SHADER_MODEL_5_0 && (type == SHADER_TYPE_HS || type == SHADER_TYPE_DS)) + return; + if (use_dxcompiler) { assert(runner->dxc_compiler); @@ -2011,17 +2018,34 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c * formats, often with different HLSL semantics, so * where possible try to test one version from each set. */ + static const uint32_t sm1_mask = (1u << SHADER_MODEL_4_0) - 1; + static const uint32_t sm4_mask = ((1u << SHADER_MODEL_6_0) - 1) & ~sm1_mask; + uint32_t model_mask = 0; - if (runner->minimum_shader_model <= SHADER_MODEL_3_0) + if (runner->hlsl_hrs[runner->minimum_shader_model] == S_OK) bitmap_set(&model_mask, runner->minimum_shader_model); - if (runner->minimum_shader_model <= SHADER_MODEL_5_1 + for (unsigned int j = SHADER_MODEL_MIN + 1; j <= SHADER_MODEL_MAX; ++j) + { + if (runner->hlsl_hrs[j - 1] != runner->hlsl_hrs[j]) + { + /* Behaviour changes here; test both versions. */ + bitmap_set(&model_mask, j - 1); + bitmap_set(&model_mask, j); + } + } + + if (!(model_mask & sm1_mask) && runner->minimum_shader_model <= SHADER_MODEL_3_0) + bitmap_set(&model_mask, runner->minimum_shader_model); + if (!(model_mask & sm4_mask) + && runner->minimum_shader_model <= SHADER_MODEL_5_1 && runner->maximum_shader_model >= SHADER_MODEL_4_0) bitmap_set(&model_mask, max(runner->minimum_shader_model, SHADER_MODEL_4_0)); if (runner->maximum_shader_model >= SHADER_MODEL_6_0) bitmap_set(&model_mask, max(runner->minimum_shader_model, SHADER_MODEL_6_0)); - for (enum shader_model model = SHADER_MODEL_MIN; model <= SHADER_MODEL_MAX; ++model) + for (enum shader_model model = runner->minimum_shader_model; + model <= runner->maximum_shader_model; ++model) { if (!bitmap_is_set(&model_mask, model)) continue;