Recap:
My previous proposals to extend the shader_runner to SM1 were focusing on separating compilation tests ([shader] directives) from execution tests ([test] directives), and let the generic shader_runner.c:compile_shader() in charge of the former.
However, Henri was more inclined to aim for making the parser agnostic to the language of the tests so we can potentially extend the shader_runner tests to other languages such as d3d-asm. This means, removing the burden of compilation from the parser altogether, and moving it to the runners, probably through a runner->compile function pointer (even if most of them end up doing the same thing, compiling with vkd3d-shader or the native compiler, depending on availability).
Agreeing with going in this general direction, this MR contains patches to do SM1 compilation calling run_shader_tests() for SM1 profiles from the Vulkan runner (skipping execution for now), and some improvements to the qualifiers syntax.
Despite this, there are parallel discussions on: - Whether to name the shader models individually in the [require] directives or expressing the range of shader models where the test should pass. In the latter case, whether to run for all shader models, only the lowest one in the SM1, SM4, and SM6 groups, or to allow the runner to select a shader model within the range (I feel strongly against this now, I think the runner should just retrieve a boolean in runner->check_requirements). - Where to do the iteration across different shader models, if in run_shader_tests() or expect each runner to call run_shader_tests() several times as we do now. But there is no need to settle on something for these yet.
---
Now, what may be the most noisy part of this MR is that even though we are calling run_shader_tests() through the Vulkan runner, this will result in calling shader_runner.c:compile_shader() instead of shader_runner_vulkan.c:compile_shader(), but if we follow the "making the parser agnostic" plan, we eventually should get rid of shader_runner.c:compile_shader() and introduce the runner->compile pointer instead.
-- v11: tests: Use the vulkan runner to run SM1 compilation tests. vkd3d-shader/ir: Lower texkill instructions to discard_nz.
From: Giovanni Mascellani gmascellani@codeweavers.com
They were originally made const because no optimization/normalization pass existed. Now having to cast away const all the time is becoming more and more burdening. --- libs/vkd3d-shader/ir.c | 8 ++++---- libs/vkd3d-shader/tpf.c | 11 ++++------- libs/vkd3d-shader/vkd3d_shader_private.h | 4 ++-- 3 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index bac426919..9fd60fa76 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -492,7 +492,7 @@ static enum vkd3d_result instruction_array_normalise_hull_shader_control_point_i if (shader_instruction_is_dcl(ins)) break; for (j = 0; j < ins->dst_count; ++j) - shader_dst_param_normalise_outpointid((struct vkd3d_shader_dst_param *)&ins->dst[j], &normaliser); + shader_dst_param_normalise_outpointid(&ins->dst[j], &normaliser); break; } } @@ -1116,9 +1116,9 @@ static void shader_instruction_normalise_io_params(struct vkd3d_shader_instructi if (shader_instruction_is_dcl(ins)) break; for (i = 0; i < ins->dst_count; ++i) - shader_dst_param_io_normalise((struct vkd3d_shader_dst_param *)&ins->dst[i], false, normaliser); + shader_dst_param_io_normalise(&ins->dst[i], false, normaliser); for (i = 0; i < ins->src_count; ++i) - shader_src_param_io_normalise((struct vkd3d_shader_src_param *)&ins->src[i], normaliser); + shader_src_param_io_normalise(&ins->src[i], normaliser); break; } } @@ -1310,7 +1310,7 @@ static enum vkd3d_result instruction_array_normalise_flat_constants(struct vkd3d else { for (j = 0; j < ins->src_count; ++j) - shader_register_normalise_flat_constants((struct vkd3d_shader_src_param *)&ins->src[j], &normaliser); + shader_register_normalise_flat_constants(&ins->src[j], &normaliser); } }
diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index 2cc56663e..43b3525bb 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -742,8 +742,7 @@ static bool shader_sm4_read_register_space(struct vkd3d_shader_sm4_parser *priv, static void shader_sm4_read_conditional_op(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { - shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_UINT, - (struct vkd3d_shader_src_param *)&ins->src[0]); + shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_UINT, &ins->src[0]); ins->flags = (opcode_token & VKD3D_SM4_CONDITIONAL_NZ) ? VKD3D_SHADER_CONDITIONAL_OP_NZ : VKD3D_SHADER_CONDITIONAL_OP_Z; } @@ -751,8 +750,7 @@ static void shader_sm4_read_conditional_op(struct vkd3d_shader_instruction *ins, static void shader_sm4_read_case_condition(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { - shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_UINT, - (struct vkd3d_shader_src_param *)&ins->src[0]); + shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_UINT, &ins->src[0]); if (ins->src[0].reg.type != VKD3DSPR_IMMCONST) { FIXME("Switch case value is not a 32-bit constant.\n"); @@ -1130,9 +1128,8 @@ static void shader_sm4_read_dcl_global_flags(struct vkd3d_shader_instruction *in static void shader_sm5_read_fcall(struct vkd3d_shader_instruction *ins, uint32_t opcode, uint32_t opcode_token, const uint32_t *tokens, unsigned int token_count, struct vkd3d_shader_sm4_parser *priv) { - struct vkd3d_shader_src_param *src_params = (struct vkd3d_shader_src_param *)ins->src; - src_params[0].reg.u.fp_body_idx = *tokens++; - shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_OPAQUE, &src_params[0]); + ins->src[0].reg.u.fp_body_idx = *tokens++; + shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], VKD3D_DATA_OPAQUE, &ins->src[0]); }
static void shader_sm5_read_dcl_function_body(struct vkd3d_shader_instruction *ins, uint32_t opcode, diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 199a47a76..b4de44e63 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -1126,8 +1126,8 @@ struct vkd3d_shader_instruction uint32_t flags; unsigned int dst_count; unsigned int src_count; - const struct vkd3d_shader_dst_param *dst; - const struct vkd3d_shader_src_param *src; + struct vkd3d_shader_dst_param *dst; + struct vkd3d_shader_src_param *src; struct vkd3d_shader_texel_offset texel_offset; enum vkd3d_shader_resource_type resource_type; unsigned int resource_stride;
From: Francisco Casas fcasas@codeweavers.com
We can now pass (sm<4) and (sm>=4) to "fail" and "todo" qualifiers, and we can use multiple of these qualifier arguments using "&" for AND and "|" for OR.
examples: todo(sm>=4 & sm<6) todo(sm<4 | sm>6)
parenthesis are not supported.
Adding additional model ranges for the tests, if we need them, should be easier now, since they only have to be added to the "valid_args" array. --- tests/shader_runner.c | 184 +++++++++++++++++++++++++++++++----------- 1 file changed, 139 insertions(+), 45 deletions(-)
diff --git a/tests/shader_runner.c b/tests/shader_runner.c index bac3a8f26..0bf5e09f5 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -94,40 +94,139 @@ enum parse_state STATE_TEST, };
-static bool match_string(const char *line, const char *token, const char **const rest) +static bool check_qualifier_args_conjunction(const char *line, + const char **const rest, enum shader_model sm) { - size_t len = strlen(token); + bool holds = true; + unsigned int i;
- while (isspace(*line)) - ++line; + static const struct + { + const char *text; + enum shader_model sm_min, sm_max; + } + valid_args[] = + { + {"sm>=4", SHADER_MODEL_4_0, SHADER_MODEL_6_0}, + {"sm>=6", SHADER_MODEL_6_0, SHADER_MODEL_6_0}, + {"sm<4", SHADER_MODEL_2_0, SHADER_MODEL_4_0 - 1}, + {"sm<6", SHADER_MODEL_2_0, SHADER_MODEL_6_0 - 1}, + };
- if (strncmp(line, token, len) || !isspace(line[len])) - return false; + while (*line != ')' && *line != '|') + { + bool match = false; + + while (isspace(*line)) + ++line; + + for (i = 0; i < ARRAY_SIZE(valid_args); ++i) + { + const char *option_text = valid_args[i].text; + + if (!strncmp(line, option_text, strlen(option_text))) + { + line += strlen(option_text); + if (sm < valid_args[i].sm_min) + holds = false; + if (sm > valid_args[i].sm_max) + holds = false; + + match = true; + break; + } + } + + while (isspace(*line)) + ++line; + + if (match && *line == '&') + { + ++line; + } + else if (*line != ')' && *line != '|') + { + fatal_error("Invalid qualifier argument '%s'.\n", line); + } + } + + assert(*line == ')' || *line == '|'); if (rest) + *rest = line; + + return holds; +} + +static bool check_qualifier_args(const char *line, const char **const rest, enum shader_model sm) +{ + bool first = true; + bool holds = false; + + assert(*line == '('); + ++line; + + while (*line != ')') { - *rest = line + len; - while (isspace(**rest)) - ++*rest; + if (!first && *line == '|') + ++line; + first = false; + + holds = check_qualifier_args_conjunction(line, &line, sm) || holds; } - return true; + + assert(*line == ')'); + if (rest) + *rest = line + 1; + + return holds; }
-static bool match_directive_substring(const char *line, const char *token, const char **const rest) +static bool match_string_generic(const char *line, const char *token, const char **const rest, + bool exclude_bracket, bool allow_qualifier_args, enum shader_model sm) { size_t len = strlen(token); + bool holds = true;
- while (isspace(*line) || *line == ']') + while (isspace(*line) || (exclude_bracket && *line == ']')) ++line;
- if (strncmp(line, token, len) || !(isspace(line[len]) || line[len] == ']')) + if (strncmp(line, token, len) || !(isspace(line[len]) || line[len] == '(' + || (exclude_bracket && line[len] == ']'))) return false; + line += len; + + if (allow_qualifier_args && *line == '(') + holds = check_qualifier_args(line, &line, sm); + if (rest) { - *rest = line + len; + *rest = line; while (isspace(**rest)) ++*rest; } - return true; + return holds; +} + +static bool match_string_with_args(const char *line, const char *token, const char **const rest, + enum shader_model sm) +{ + return match_string_generic(line, token, rest, false, true, sm); +} + +static bool match_string(const char *line, const char *token, const char **const rest) +{ + return match_string_generic(line, token, rest, false, false, 0); +} + +static bool match_directive_substring_with_args(const char *line, const char *token, + const char **const rest, enum shader_model sm) +{ + return match_string_generic(line, token, rest, true, true, sm); +} + +static bool match_directive_substring(const char *line, const char *token, const char **const rest) +{ + return match_string_generic(line, token, rest, true, false, 0); }
static void parse_require_directive(struct shader_runner *runner, const char *line) @@ -548,12 +647,10 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
runner->is_todo = false;
- if (match_string(line, "todo", &line)) + if (match_string_with_args(line, "todo", &line, runner->minimum_shader_model)) + { runner->is_todo = true; - 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, "todo(sm>=6)", &line)) - runner->is_todo = runner->minimum_shader_model >= SHADER_MODEL_6_0; + }
if (match_string(line, "dispatch", &line)) { @@ -1068,45 +1165,42 @@ static void compile_shader(struct shader_runner *runner, IDxcCompiler3 *dxc_comp } }
+static enum parse_state get_parse_state_todo(enum parse_state state) +{ + if (state == STATE_SHADER_COMPUTE) + return STATE_SHADER_COMPUTE_TODO; + else if (state == STATE_SHADER_PIXEL) + return STATE_SHADER_PIXEL_TODO; + else if (state == STATE_SHADER_VERTEX) + return STATE_SHADER_VERTEX_TODO; + else + return STATE_SHADER_EFFECT_TODO; +} + static enum parse_state read_shader_directive(struct shader_runner *runner, enum parse_state state, const char *line, const char *src, HRESULT *expect_hr) { while (*src && *src != ']') { - /* 'todo' is not meaningful when dxcompiler is in use, so it has no '(sm<6) qualifier. */ - if (match_directive_substring(src, "todo", &src)) + const char *src_start = src; + + if (match_directive_substring_with_args(src, "todo", &src, runner->minimum_shader_model)) { + /* 'todo' is not meaningful when dxcompiler is in use. */ if (runner->minimum_shader_model >= SHADER_MODEL_6_0) continue; - if (state == STATE_SHADER_COMPUTE) - state = STATE_SHADER_COMPUTE_TODO; - else if (state == STATE_SHADER_PIXEL) - state = STATE_SHADER_PIXEL_TODO; - else if (state == STATE_SHADER_VERTEX) - state = STATE_SHADER_VERTEX_TODO; - else - state = STATE_SHADER_EFFECT_TODO; + state = get_parse_state_todo(state); } - else if (match_directive_substring(src, "fail", &src)) + else if (match_directive_substring_with_args(src, "fail", &src, runner->minimum_shader_model)) { *expect_hr = E_FAIL; } - else if (match_directive_substring(src, "fail(sm<6)", &src)) - { - if (runner->minimum_shader_model < SHADER_MODEL_6_0) - *expect_hr = E_FAIL; - } - else if (match_directive_substring(src, "fail(sm>=6)", &src)) - { - if (runner->minimum_shader_model >= SHADER_MODEL_6_0) - *expect_hr = E_FAIL; - } - else if (match_directive_substring(src, "notimpl(sm<6)", &src)) + else if (match_directive_substring_with_args(src, "notimpl", &src, runner->minimum_shader_model)) { - if (runner->minimum_shader_model < SHADER_MODEL_6_0) - *expect_hr = E_NOTIMPL; + *expect_hr = E_NOTIMPL; } - else + + if (src == src_start) { fatal_error("Malformed line '%s'.\n", line); }
From: Francisco Casas fcasas@codeweavers.com
If the runners require multiple calls to run_shader_tests() for different shader model ranges, these are moved inside the sole runner call.
For the same reason, the trace() messages are also moved inside the runner calls. --- tests/shader_runner.c | 31 ++++++++++--------------------- tests/shader_runner.h | 3 +-- tests/shader_runner_d3d11.c | 8 ++++++++ tests/shader_runner_d3d12.c | 22 ++++++++++++++++++---- tests/shader_runner_d3d9.c | 8 ++++++++ tests/shader_runner_gl.c | 2 ++ tests/shader_runner_vulkan.c | 1 + 7 files changed, 48 insertions(+), 27 deletions(-)
diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 0bf5e09f5..80d5dfe77 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1711,61 +1711,50 @@ START_TEST(shader_runner) #if defined(VKD3D_CROSSTEST) trace("Running tests from a Windows cross build\n");
- trace("Compiling shaders with d3dcompiler_47.dll and executing with d3d9.dll\n"); run_shader_tests_d3d9();
- trace("Compiling shaders with d3dcompiler_47.dll and executing with d3d11.dll\n"); run_shader_tests_d3d11();
- trace("Compiling shaders with d3dcompiler_47.dll and executing with d3d12.dll\n"); - run_shader_tests_d3d12(NULL, SHADER_MODEL_4_0, SHADER_MODEL_5_1); + run_shader_tests_d3d12(NULL);
print_dll_version("d3dcompiler_47.dll"); print_dll_version("dxgi.dll"); print_dll_version("d3d9.dll"); print_dll_version("d3d11.dll"); print_dll_version("d3d12.dll"); + #elif defined(_WIN32) trace("Running tests from a Windows non-cross build\n");
- trace("Compiling shaders with vkd3d-shader and executing with d3d9.dll\n"); run_shader_tests_d3d9();
- trace("Compiling shaders with vkd3d-shader and executing with d3d11.dll\n"); run_shader_tests_d3d11();
- trace("Compiling shaders with vkd3d-shader and executing with vkd3d\n"); - run_shader_tests_d3d12(NULL, SHADER_MODEL_4_0, SHADER_MODEL_5_1); + dxc_compiler = dxcompiler_create(); + run_shader_tests_d3d12(dxc_compiler);
- if ((dxc_compiler = dxcompiler_create())) + if (dxc_compiler) { - trace("Compiling shaders with dxcompiler and executing with vkd3d\n"); - run_shader_tests_d3d12(dxc_compiler, SHADER_MODEL_6_0, SHADER_MODEL_6_0); IDxcCompiler3_Release(dxc_compiler); print_dll_version(SONAME_LIBDXCOMPILER); } - print_dll_version("d3d9.dll"); print_dll_version("d3d11.dll"); + #else trace("Running tests from a Unix build\n");
# ifdef HAVE_OPENGL - trace("Compiling shaders with vkd3d-shader and executing with OpenGL\n"); run_shader_tests_gl(); # endif
- trace("Compiling shaders with vkd3d-shader and executing with Vulkan\n"); run_shader_tests_vulkan();
- trace("Compiling shaders with vkd3d-shader and executing with vkd3d\n"); - run_shader_tests_d3d12(NULL, SHADER_MODEL_4_0, SHADER_MODEL_5_1); + dxc_compiler = dxcompiler_create(); + run_shader_tests_d3d12(dxc_compiler);
- if ((dxc_compiler = dxcompiler_create())) - { - trace("Compiling shaders with dxcompiler and executing with vkd3d\n"); - run_shader_tests_d3d12(dxc_compiler, SHADER_MODEL_6_0, SHADER_MODEL_6_0); + if (dxc_compiler) IDxcCompiler3_Release(dxc_compiler); - } + #endif } diff --git a/tests/shader_runner.h b/tests/shader_runner.h index 163439477..a17fa485b 100644 --- a/tests/shader_runner.h +++ b/tests/shader_runner.h @@ -179,5 +179,4 @@ void run_shader_tests_d3d11(void); void run_shader_tests_gl(void); void run_shader_tests_vulkan(void); #endif -void run_shader_tests_d3d12(void *dxc_compiler, enum shader_model minimum_shader_model, - enum shader_model maximum_shader_model); +void run_shader_tests_d3d12(void *dxc_compiler); diff --git a/tests/shader_runner_d3d11.c b/tests/shader_runner_d3d11.c index 1a62b20cd..1ab92d98b 100644 --- a/tests/shader_runner_d3d11.c +++ b/tests/shader_runner_d3d11.c @@ -32,6 +32,12 @@ #include "shader_runner.h" #include "vkd3d_test.h"
+#ifdef VKD3D_CROSSTEST +static const char *HLSL_COMPILER = "d3dcompiler47.dll"; +#else +static const char *HLSL_COMPILER = "vkd3d-shader"; +#endif + static HRESULT (WINAPI *pCreateDXGIFactory1)(REFIID iid, void **factory);
static HRESULT (WINAPI *pD3D11CreateDevice)(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, @@ -757,6 +763,8 @@ void run_shader_tests_d3d11(void) struct d3d11_shader_runner runner; HMODULE dxgi_module, d3d11_module;
+ trace("Compiling SM4-SM5 shaders with %s and executing with d3d11.dll\n", HLSL_COMPILER); + d3d11_module = LoadLibraryA("d3d11.dll"); dxgi_module = LoadLibraryA("dxgi.dll"); if (d3d11_module && dxgi_module) diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index d6b80d9ea..e76268e00 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c @@ -25,6 +25,14 @@ #include "shader_runner.h" #include "dxcompiler.h"
+#ifdef VKD3D_CROSSTEST +static const char *HLSL_COMPILER = "d3dcompiler47.dll"; +static const char *SHADER_RUNNER = "d3d12.dll"; +#else +static const char *HLSL_COMPILER = "vkd3d-shader"; +static const char *SHADER_RUNNER = "vkd3d"; +#endif + struct d3d12_resource { struct resource r; @@ -586,8 +594,7 @@ static const struct shader_runner_ops d3d12_runner_ops = .release_readback = d3d12_runner_release_readback, };
-void run_shader_tests_d3d12(void *dxc_compiler, enum shader_model minimum_shader_model, - enum shader_model maximum_shader_model) +void run_shader_tests_d3d12(void *dxc_compiler) { static const struct test_context_desc desc = { @@ -627,10 +634,17 @@ void run_shader_tests_d3d12(void *dxc_compiler, enum shader_model minimum_shader hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_D3D12_OPTIONS1, &runner.options1, sizeof(runner.options1)); ok(hr == S_OK, "Failed to check feature options1 support, hr %#x.\n", hr); - if (maximum_shader_model >= SHADER_MODEL_6_0) + + trace("Compiling SM4-SM5 shaders with %s and executing with %s\n", HLSL_COMPILER, SHADER_RUNNER); + run_shader_tests(&runner.r, &d3d12_runner_ops, dxc_compiler, SHADER_MODEL_4_0, SHADER_MODEL_5_1); + + if (dxc_compiler) + { trace("Int64ShaderOps: %u.\n", runner.options1.Int64ShaderOps);
- run_shader_tests(&runner.r, &d3d12_runner_ops, dxc_compiler, minimum_shader_model, maximum_shader_model); + trace("Compiling SM6 shaders with dxcompiler and executing with %s\n", SHADER_RUNNER); + run_shader_tests(&runner.r, &d3d12_runner_ops, dxc_compiler, SHADER_MODEL_6_0, SHADER_MODEL_6_0); + }
ID3D12GraphicsCommandList_Release(runner.compute_list); ID3D12CommandAllocator_Release(runner.compute_allocator); diff --git a/tests/shader_runner_d3d9.c b/tests/shader_runner_d3d9.c index 0b33c1c53..16d8198ec 100644 --- a/tests/shader_runner_d3d9.c +++ b/tests/shader_runner_d3d9.c @@ -27,6 +27,12 @@ #include "shader_runner.h" #include "vkd3d_test.h"
+#ifdef VKD3D_CROSSTEST +static const char *HLSL_COMPILER = "d3dcompiler47.dll"; +#else +static const char *HLSL_COMPILER = "vkd3d-shader"; +#endif + struct d3d9_resource { struct resource r; @@ -534,6 +540,8 @@ void run_shader_tests_d3d9(void) struct d3d9_shader_runner runner; HMODULE d3d9_module;
+ trace("Compiling SM2-SM3 shaders with %s and executing with d3d9.dll\n", HLSL_COMPILER); + d3d9_module = LoadLibraryA("d3d9.dll"); if (d3d9_module) { diff --git a/tests/shader_runner_gl.c b/tests/shader_runner_gl.c index 9a3dd7104..a898d021b 100644 --- a/tests/shader_runner_gl.c +++ b/tests/shader_runner_gl.c @@ -996,6 +996,8 @@ void run_shader_tests_gl(void) vkd3d_test_name = "shader_runner_gl"; if (!gl_runner_init(&runner)) goto done; + + trace("Compiling SM4-SM5 shaders with vkd3d-shader and executing with OpenGL\n"); run_shader_tests(&runner.r, &gl_runner_ops, NULL, SHADER_MODEL_4_0, SHADER_MODEL_5_1); gl_runner_cleanup(&runner); done: diff --git a/tests/shader_runner_vulkan.c b/tests/shader_runner_vulkan.c index bb6b3a30a..d435a5d3d 100644 --- a/tests/shader_runner_vulkan.c +++ b/tests/shader_runner_vulkan.c @@ -1420,6 +1420,7 @@ void run_shader_tests_vulkan(void) if (!init_vulkan_runner(&runner)) return;
+ trace("Compiling SM2-SM5 shaders with vkd3d-shader and executing with Vulkan\n"); run_shader_tests(&runner.r, &vulkan_runner_ops, NULL, SHADER_MODEL_2_0, SHADER_MODEL_5_1);
cleanup_vulkan_runner(&runner);
From: Francisco Casas fcasas@codeweavers.com
Currently, HLSL_RESOURCE_SAMPLE_LOD is not implemented for d3dbc, but we are incorrectly writting a texld instruction to handle it. This causes SM1 tests with the vulkan backend (in following patches) to fail if VKD3D_SHADER_CONFIG="force_validation" is enabled.
For now a fixme is emited in these cases. --- libs/vkd3d-shader/d3dbc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index 8fec1e637..cdb85b9da 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -2340,8 +2340,6 @@ static void write_sm1_resource_load(struct hlsl_ctx *ctx, struct vkd3d_bytecode_
sm1_instr = (struct sm1_instruction) { - .opcode = D3DSIO_TEX, - .dst.type = D3DSPR_TEMP, .dst.reg = instr->reg.id, .dst.writemask = instr->reg.writemask, @@ -2357,8 +2355,22 @@ static void write_sm1_resource_load(struct hlsl_ctx *ctx, struct vkd3d_bytecode_
.src_count = 2, }; - if (load->load_type == HLSL_RESOURCE_SAMPLE_PROJ) - sm1_instr.opcode |= VKD3DSI_TEXLD_PROJECT << VKD3D_SM1_INSTRUCTION_FLAGS_SHIFT; + + switch (load->load_type) + { + case HLSL_RESOURCE_SAMPLE: + sm1_instr.opcode = D3DSIO_TEX; + break; + + case HLSL_RESOURCE_SAMPLE_PROJ: + sm1_instr.opcode = D3DSIO_TEX; + sm1_instr.opcode |= VKD3DSI_TEXLD_PROJECT << VKD3D_SM1_INSTRUCTION_FLAGS_SHIFT; + break; + + default: + hlsl_fixme(ctx, &instr->loc, "Resource load type %u\n", load->load_type); + return; + }
assert(instr->reg.allocated);
From: Francisco Casas fcasas@codeweavers.com
--- libs/vkd3d-shader/ir.c | 115 +++++++++++++++++++++++ libs/vkd3d-shader/spirv.c | 12 +-- libs/vkd3d-shader/vkd3d_shader_main.c | 17 ++++ libs/vkd3d-shader/vkd3d_shader_private.h | 2 + 4 files changed, 139 insertions(+), 7 deletions(-)
diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 9fd60fa76..ea195f4c0 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -36,6 +36,118 @@ static void vkd3d_shader_instruction_make_nop(struct vkd3d_shader_instruction *i vsir_instruction_init(ins, &location, VKD3DSIH_NOP); }
+static bool vsir_instruction_init_with_params(struct vkd3d_shader_parser *parser, + struct vkd3d_shader_instruction *ins, const struct vkd3d_shader_location *location, + enum vkd3d_shader_opcode handler_idx, unsigned int dst_count, unsigned int src_count) +{ + vsir_instruction_init(ins, location, handler_idx); + ins->dst_count = dst_count; + ins->src_count = src_count; + + if (!(ins->dst = shader_parser_get_dst_params(parser, ins->dst_count))) + { + ERR("Failed to allocate %u destination parameters.\n", dst_count); + return false; + } + + if (!(ins->src = shader_parser_get_src_params(parser, ins->src_count))) + { + ERR("Failed to allocate %u source parameters.\n", src_count); + return false; + } + + memset(ins->dst, 0, sizeof(*ins->dst) * ins->dst_count); + memset(ins->src, 0, sizeof(*ins->src) * ins->src_count); + return true; +} + +static enum vkd3d_result instruction_array_lower_texkills(struct vkd3d_shader_parser *parser) +{ + struct vkd3d_shader_instruction_array *instructions = &parser->instructions; + struct vkd3d_shader_instruction *texkill_ins, *ins; + unsigned int componets_read = 3 + (parser->shader_version.major >= 2); + unsigned int tmp_idx = ~0u; + unsigned int i, k; + + for (i = 0; i < instructions->count; ++i) + { + texkill_ins = &instructions->elements[i]; + + if (texkill_ins->handler_idx != VKD3DSIH_TEXKILL) + continue; + + assert(texkill_ins->dst_count == 1); + assert(texkill_ins->src_count == 0); + + if (!shader_instruction_array_insert_at(instructions, i + 1, 5)) + return VKD3D_ERROR_OUT_OF_MEMORY; + + if (tmp_idx == ~0u) + tmp_idx = parser->shader_desc.temp_count++; + + /* tmp = ins->dst[0] < 0 */ + + ins = texkill_ins + 1; + if (!vsir_instruction_init_with_params(parser, ins, &texkill_ins->location, VKD3DSIH_LTO, 1, 2)) + return VKD3D_ERROR_OUT_OF_MEMORY; + + vsir_register_init(&ins->dst[0].reg, VKD3DSPR_TEMP, VKD3D_DATA_INT, 1); + ins->dst[0].reg.dimension = VSIR_DIMENSION_VEC4; + ins->dst[0].reg.idx[0].offset = tmp_idx; + ins->dst[0].write_mask = VKD3DSP_WRITEMASK_ALL; + + ins->src[0].reg = texkill_ins->dst[0].reg; + vsir_register_init(&ins->src[1].reg, VKD3DSPR_IMMCONST, VKD3D_DATA_FLOAT, 0); + ins->src[1].reg.dimension = VSIR_DIMENSION_VEC4; + ins->src[1].reg.u.immconst_f32[0] = 0.0f; + ins->src[1].reg.u.immconst_f32[1] = 0.0f; + ins->src[1].reg.u.immconst_f32[2] = 0.0f; + ins->src[1].reg.u.immconst_f32[3] = 0.0f; + + /* tmp.x = tmp.x || tmp.y */ + /* tmp.x = tmp.x || tmp.z */ + /* tmp.x = tmp.x || tmp.w, if sm >= 2.0 */ + + for (k = 1; k < componets_read; ++k) + { + ins = texkill_ins + 1 + k; + if (!(vsir_instruction_init_with_params(parser, ins, &texkill_ins->location, VKD3DSIH_OR, 1, 2))) + return VKD3D_ERROR_OUT_OF_MEMORY; + + vsir_register_init(&ins->dst[0].reg, VKD3DSPR_TEMP, VKD3D_DATA_INT, 1); + ins->dst[0].reg.dimension = VSIR_DIMENSION_VEC4; + ins->dst[0].reg.idx[0].offset = tmp_idx; + ins->dst[0].write_mask = VKD3DSP_WRITEMASK_0; + + vsir_register_init(&ins->src[0].reg, VKD3DSPR_TEMP, VKD3D_DATA_INT, 1); + ins->src[0].reg.dimension = VSIR_DIMENSION_VEC4; + ins->src[0].reg.idx[0].offset = tmp_idx; + ins->src[0].swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); + vsir_register_init(&ins->src[1].reg, VKD3DSPR_TEMP, VKD3D_DATA_INT, 1); + ins->src[1].reg.dimension = VSIR_DIMENSION_VEC4; + ins->src[1].reg.idx[0].offset = tmp_idx; + ins->src[1].swizzle = vkd3d_shader_create_swizzle(k, k, k, k); + } + + /* discard_nz tmp.x */ + + ins = texkill_ins + 5; + if (!(vsir_instruction_init_with_params(parser, ins, &texkill_ins->location, VKD3DSIH_DISCARD, 0, 1))) + return VKD3D_ERROR_OUT_OF_MEMORY; + ins->flags = VKD3D_SHADER_CONDITIONAL_OP_NZ; + + vsir_register_init(&ins->src[0].reg, VKD3DSPR_TEMP, VKD3D_DATA_INT, 1); + ins->src[0].reg.dimension = VSIR_DIMENSION_VEC4; + ins->src[0].reg.idx[0].offset = tmp_idx; + ins->src[0].swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); + + /* Make the original instruction no-op */ + vkd3d_shader_instruction_make_nop(texkill_ins); + } + + return VKD3D_OK; +} + static void shader_register_eliminate_phase_addressing(struct vkd3d_shader_register *reg, unsigned int instance_id) { @@ -1485,6 +1597,9 @@ enum vkd3d_result vkd3d_shader_normalise(struct vkd3d_shader_parser *parser, if (parser->shader_desc.is_dxil) return result;
+ if (result >= 0) + result = instruction_array_lower_texkills(parser); + if (parser->shader_version.type != VKD3D_SHADER_TYPE_PIXEL && (result = remap_output_signature(parser, compile_info)) < 0) return result; diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index aa8ceaa67..d48c8b617 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -7957,7 +7957,6 @@ static int spirv_compiler_emit_control_flow_instruction(struct spirv_compiler *c break;
case VKD3DSIH_DISCARD: - case VKD3DSIH_TEXKILL: spirv_compiler_emit_kill(compiler, instruction); break;
@@ -9729,7 +9728,6 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler, case VKD3DSIH_RET: case VKD3DSIH_RETP: case VKD3DSIH_SWITCH: - case VKD3DSIH_TEXKILL: ret = spirv_compiler_emit_control_flow_instruction(compiler, instruction); break; case VKD3DSIH_DSX: @@ -9939,11 +9937,6 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, enum vkd3d_result result = VKD3D_OK; unsigned int i;
- if (parser->shader_desc.temp_count) - spirv_compiler_emit_temps(compiler, parser->shader_desc.temp_count); - if (parser->shader_desc.ssa_count) - spirv_compiler_allocate_ssa_register_ids(compiler, parser->shader_desc.ssa_count); - spirv_compiler_emit_descriptor_declarations(compiler);
compiler->location.column = 0; @@ -9952,6 +9945,11 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, if ((result = vkd3d_shader_normalise(parser, compile_info)) < 0) return result;
+ if (parser->shader_desc.temp_count) + spirv_compiler_emit_temps(compiler, parser->shader_desc.temp_count); + if (parser->shader_desc.ssa_count) + spirv_compiler_allocate_ssa_register_ids(compiler, parser->shader_desc.ssa_count); + instructions = parser->instructions; memset(&parser->instructions, 0, sizeof(parser->instructions));
diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index f12b11adb..248a55a10 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -2057,6 +2057,23 @@ bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *ins return true; }
+bool shader_instruction_array_insert_at(struct vkd3d_shader_instruction_array *instructions, + unsigned int idx, unsigned int count) +{ + assert(idx <= instructions->count); + + if (!shader_instruction_array_reserve(instructions, instructions->count + count)) + return false; + + memmove(&instructions->elements[idx + count], &instructions->elements[idx], + (instructions->count - idx) * sizeof(*instructions->elements)); + memset(&instructions->elements[idx], 0, count * sizeof(*instructions->elements)); + + instructions->count += count; + + return true; +} + bool shader_instruction_array_add_icb(struct vkd3d_shader_instruction_array *instructions, struct vkd3d_shader_immediate_constant_buffer *icb) { diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index b4de44e63..94c2f62bc 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -1230,6 +1230,8 @@ struct vkd3d_shader_instruction_array
bool shader_instruction_array_init(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve); bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve); +bool shader_instruction_array_insert_at(struct vkd3d_shader_instruction_array *instructions, + unsigned int idx, unsigned int count); bool shader_instruction_array_add_icb(struct vkd3d_shader_instruction_array *instructions, struct vkd3d_shader_immediate_constant_buffer *icb); bool shader_instruction_array_clone_instruction(struct vkd3d_shader_instruction_array *instructions,
From: Francisco Casas fcasas@codeweavers.com
At the current moment this is a little odd because for SM1 [test] directives are skipped, and the [shader] directives are not executed by the shader_runner_vulkan.c:compile_shader() but by the general shader_runner.c:compile_shader(). So in principle it is a little weird that we go through the vulkan runner.
But fret not, because in the future we plan to make the parser agnostic to the language of the tests, so we will get rid of the general shader_runner.c:compile_shader() function and instead call a runner->compile_shader() function, defined for each runner. Granted, most of these may call a generic implementation that uses native compiler in Windows, and vkd3d-shader on Linux, but it would be more conceptually correct. --- tests/hlsl/abs.shader_test | 4 +- tests/hlsl/any.shader_test | 24 +++--- .../hlsl/arithmetic-float-uniform.shader_test | 16 ++-- tests/hlsl/arithmetic-int-uniform.shader_test | 32 ++++---- tests/hlsl/arithmetic-int.shader_test | 2 + tests/hlsl/ceil.shader_test | 4 +- tests/hlsl/combined-samplers.shader_test | 4 +- tests/hlsl/conditional.shader_test | 16 ++-- tests/hlsl/ddxddy.shader_test | 16 ++-- tests/hlsl/discard.shader_test | 6 +- tests/hlsl/distance.shader_test | 2 +- tests/hlsl/dot.shader_test | 4 +- tests/hlsl/entry-point-semantics.shader_test | 6 +- tests/hlsl/expr-indexing.shader_test | 14 ++-- tests/hlsl/float-comparison.shader_test | 4 +- tests/hlsl/floor.shader_test | 4 +- tests/hlsl/fmod.shader_test | 12 +-- tests/hlsl/for.shader_test | 8 +- tests/hlsl/function-return.shader_test | 50 ++++++------ tests/hlsl/fwidth.shader_test | 2 +- tests/hlsl/half.shader_test | 4 +- tests/hlsl/hard-copy-prop.shader_test | 19 ++--- .../initializer-implicit-array.shader_test | 2 +- tests/hlsl/length.shader_test | 2 +- tests/hlsl/lit.shader_test | 12 +-- tests/hlsl/loop.shader_test | 28 +++---- tests/hlsl/matrix-indexing.shader_test | 8 +- tests/hlsl/non-const-indexing.shader_test | 52 ++++++------ tests/hlsl/normalize.shader_test | 2 +- tests/hlsl/reflect.shader_test | 4 +- tests/hlsl/return.shader_test | 79 +++++++++---------- tests/hlsl/round.shader_test | 8 +- tests/hlsl/sample-bias.shader_test | 8 +- tests/hlsl/sample-level.shader_test | 16 ++-- tests/hlsl/sampler.shader_test | 8 +- tests/hlsl/saturate.shader_test | 4 +- tests/hlsl/sign.shader_test | 22 +++--- tests/hlsl/smoothstep.shader_test | 4 +- tests/hlsl/static-initializer.shader_test | 9 ++- tests/hlsl/step.shader_test | 4 +- tests/hlsl/ternary.shader_test | 10 +-- tests/hlsl/trigonometry.shader_test | 16 ++-- tests/hlsl/trunc.shader_test | 10 +-- .../hlsl/vector-indexing-uniform.shader_test | 4 +- tests/shader_runner.c | 13 ++- tests/shader_runner_vulkan.c | 22 ++++-- 46 files changed, 303 insertions(+), 297 deletions(-)
diff --git a/tests/hlsl/abs.shader_test b/tests/hlsl/abs.shader_test index 738e69312..4d1d1e33e 100644 --- a/tests/hlsl/abs.shader_test +++ b/tests/hlsl/abs.shader_test @@ -8,8 +8,8 @@ float4 main() : sv_target
[test] uniform 0 float4 0.1 0.7 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.1, 0.7, 0.4, 0.4) uniform 0 float4 -0.7 0.1 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.7, 0.1, 1.2, 0.4) diff --git a/tests/hlsl/any.shader_test b/tests/hlsl/any.shader_test index f2298d3a3..afaf81fac 100644 --- a/tests/hlsl/any.shader_test +++ b/tests/hlsl/any.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] uniform float4 f;
float4 main() : sv_target @@ -8,28 +8,28 @@ float4 main() : sv_target
[test] uniform 0 float4 1.0 1.0 1.0 1.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0) uniform 0 float4 1.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0) uniform 0 float4 0.0 1.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0) uniform 0 float4 0.0 0.0 1.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0) uniform 0 float4 0.0 0.0 0.0 1.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0) uniform 0 float4 0.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.0, 0.0, 0.0, 0.0) uniform 0 float4 -1.0 -1.0 -1.0 -1.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float f;
float4 main() : sv_target @@ -39,13 +39,13 @@ float4 main() : sv_target
[test] uniform 0 float4 1.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0) uniform 0 float4 0.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.0, 0.0, 0.0, 0.0) uniform 0 float4 -1.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0)
[require] diff --git a/tests/hlsl/arithmetic-float-uniform.shader_test b/tests/hlsl/arithmetic-float-uniform.shader_test index 75684cc60..38e37b3fa 100644 --- a/tests/hlsl/arithmetic-float-uniform.shader_test +++ b/tests/hlsl/arithmetic-float-uniform.shader_test @@ -13,7 +13,7 @@ uniform 0 float4 5.0 15.0 0.0 0.0 draw quad probe all rgba (20.0, -10.0, 75.0, 0.33333333) 1
-[pixel shader] +[pixel shader todo(sm<4)] uniform float2 a;
float4 main() : SV_TARGET @@ -25,10 +25,10 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 5.0 15.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (5.0, 5.0, -5.0, 3.0) 1
-[pixel shader] +[pixel shader todo(sm<4)] uniform float2 a;
float4 main() : SV_TARGET @@ -40,10 +40,10 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 42.0 5.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (2.0, -2.0, 2.0, -2.0) 16
-[pixel shader] +[pixel shader todo(sm<4)] uniform float2 a;
float4 main() : SV_TARGET @@ -55,10 +55,10 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 45.0 5.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.0, 0.0, 0.0, 0.0)
-[pixel shader] +[pixel shader todo(sm<4)] float4 x, y;
float4 main() : sv_target @@ -69,7 +69,7 @@ float4 main() : sv_target [test] uniform 0 float4 5.0 -42.1 4.0 45.0 uniform 4 float4 15.0 -5.0 4.1 5.0 -draw quad +todo(sm<4) draw quad probe all rgba (5.0, -2.1, 4.0, 0.0) 6
[require] diff --git a/tests/hlsl/arithmetic-int-uniform.shader_test b/tests/hlsl/arithmetic-int-uniform.shader_test index bb83eb76e..0c5ab37d1 100644 --- a/tests/hlsl/arithmetic-int-uniform.shader_test +++ b/tests/hlsl/arithmetic-int-uniform.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] uniform float2 a;
float4 main() : SV_TARGET @@ -10,10 +10,10 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 5.0 16.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (21.0, -11.0, 80.0, 0.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float2 a;
float4 main() : SV_TARGET @@ -25,10 +25,10 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 5.0 16.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (5.0, 5.0, -5.0, 3.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float2 a;
float4 main() : SV_TARGET @@ -40,10 +40,10 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 42.0 5.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (8.0, -8.0, -8.0, 8.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float2 a;
float4 main() : SV_TARGET @@ -55,10 +55,10 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 42.0 5.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (2.0, -2.0, 2.0, -2.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float2 a;
float4 main() : SV_TARGET @@ -70,10 +70,10 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 45.0 5.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (9.0, -9.0, -9.0, 9.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float2 a;
float4 main() : SV_TARGET @@ -85,10 +85,10 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 45.0 5.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.0, 0.0, 0.0, 0.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 a;
float4 main() : SV_TARGET @@ -98,10 +98,10 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 5.0 -7.0 0.0 -10.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (5.0, 7.0, 0.0, 10.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 a; uniform float4 b;
@@ -117,7 +117,7 @@ float4 main() : sv_target [test] uniform 0 float4 45.0 5.0 50.0 10.0 uniform 4 float4 3.0 8.0 2.0 5.0 -draw quad +todo(sm<4) draw quad probe all rgba (9.0, 5.0, 1.0, 3.0)
[require] diff --git a/tests/hlsl/arithmetic-int.shader_test b/tests/hlsl/arithmetic-int.shader_test index f2044c42c..46b641811 100644 --- a/tests/hlsl/arithmetic-int.shader_test +++ b/tests/hlsl/arithmetic-int.shader_test @@ -77,6 +77,7 @@ draw quad probe all rgba (0.0, 0.0, 0.0, 0.0)
[pixel shader fail(sm<6)] +// On SM1 this gives hr 0x88760b59. float4 main() : SV_TARGET { int x = 1; @@ -90,6 +91,7 @@ draw quad probe all rgba (0.0, 0.0, 0.0, 0.0)
[pixel shader fail(sm<6)] +// On SM1 this gives hr 0x88760b59. float4 main() : SV_TARGET { int x = 1; diff --git a/tests/hlsl/ceil.shader_test b/tests/hlsl/ceil.shader_test index ef26cc8ef..46414a92b 100644 --- a/tests/hlsl/ceil.shader_test +++ b/tests/hlsl/ceil.shader_test @@ -21,7 +21,7 @@ uniform 0 float4 -0.5 6.5 7.5 3.4 draw quad probe all rgba (0.0, 7.0, 8.0, 4.0) 4
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -34,7 +34,7 @@ float4 main() : sv_target
[test] uniform 0 float4 -0.5 6.5 7.5 3.4 -draw quad +todo(sm<4) draw quad probe all rgba (7.0, 8.0, 0.0, 4.0) 4
[require] diff --git a/tests/hlsl/combined-samplers.shader_test b/tests/hlsl/combined-samplers.shader_test index 235537594..4d743aecf 100644 --- a/tests/hlsl/combined-samplers.shader_test +++ b/tests/hlsl/combined-samplers.shader_test @@ -64,7 +64,7 @@ draw quad probe all rgba (10, 10, 10, 11)
-[pixel shader] +[pixel shader todo(sm<4)] Texture2D tex; sampler sam[2];
@@ -111,7 +111,7 @@ probe all rgba (104, 104, 104, 111)
% Sampler arrays with components that have different usage dimensions are only forbidden in SM4 upwards. % However, tex2D and tex1D are considered the same dimension for these purposes. -[pixel shader fail] +[pixel shader fail(sm>=4)] sampler sam[2];
float4 main() : sv_target diff --git a/tests/hlsl/conditional.shader_test b/tests/hlsl/conditional.shader_test index 0a927a8fa..5b3038c37 100644 --- a/tests/hlsl/conditional.shader_test +++ b/tests/hlsl/conditional.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -11,13 +11,13 @@ float4 main() : sv_target
[test] uniform 0 float4 0.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.9, 0.8, 0.7, 0.6) uniform 0 float4 0.1 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.1, 0.2, 0.3, 0.4)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -29,7 +29,7 @@ float4 main() : sv_target return float4(0.9, 0.8, 0.7, 0.6); }
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -43,7 +43,7 @@ float4 main() : sv_target
[test] uniform 0 float4 0.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.9, 0.8, 0.7, 0.6)
[pixel shader fail(sm<6)] @@ -74,7 +74,7 @@ float main() : sv_target [require] shader model >= 3.0
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -88,7 +88,7 @@ float4 main() : sv_target
[test] uniform 0 float4 0.0 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.9, 0.8, 0.7, 0.6)
[pixel shader] diff --git a/tests/hlsl/ddxddy.shader_test b/tests/hlsl/ddxddy.shader_test index 4986c233f..72925b975 100644 --- a/tests/hlsl/ddxddy.shader_test +++ b/tests/hlsl/ddxddy.shader_test @@ -9,7 +9,7 @@ float4 main(float4 pos : sv_position) : sv_target
[test] draw quad -probe all rgba (1.0, 1.0, 0.0, 0.0) +todo(sm<4) probe all rgba (1.0, 1.0, 0.0, 0.0)
[pixel shader] @@ -30,13 +30,13 @@ float4 main(float4 pos : sv_position) : sv_target
[test] draw quad -probe (10, 10) rgba (-16.0, -5.0, 3.0, 0.0) -probe (11, 10) rgba (-21.0, -5.0, 3.0, 0.0) -probe (10, 11) rgba (-13.0, -5.0, 3.0, 0.0) -probe (11, 11) rgba (-17.0, -5.0, 3.0, 0.0) -probe (12, 10) rgba (-26.0, -6.0, 4.0, 0.0) -probe (16, 16) rgba (-25.0, -7.0, 5.0, 0.0) -probe (150, 150) rgba (-226.0, -47.0, 45.0, 0.0) +todo(sm<4) probe (10, 10) rgba (-16.0, -5.0, 3.0, 0.0) +todo(sm<4) probe (11, 10) rgba (-21.0, -5.0, 3.0, 0.0) +todo(sm<4) probe (10, 11) rgba (-13.0, -5.0, 3.0, 0.0) +todo(sm<4) probe (11, 11) rgba (-17.0, -5.0, 3.0, 0.0) +todo(sm<4) probe (12, 10) rgba (-26.0, -6.0, 4.0, 0.0) +todo(sm<4) probe (16, 16) rgba (-25.0, -7.0, 5.0, 0.0) +todo(sm<4) probe (150, 150) rgba (-226.0, -47.0, 45.0, 0.0)
[require] diff --git a/tests/hlsl/discard.shader_test b/tests/hlsl/discard.shader_test index cecb8c1fd..a5cdde475 100644 --- a/tests/hlsl/discard.shader_test +++ b/tests/hlsl/discard.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] uniform float4 x;
float4 main() : sv_target @@ -9,8 +9,8 @@ float4 main() : sv_target
[test] uniform 0 float4 1 2 3 4 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (1, 2, 3, 4) uniform 0 float4 9 8 7 6 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (1, 2, 3, 4) diff --git a/tests/hlsl/distance.shader_test b/tests/hlsl/distance.shader_test index 3f5446451..bf2423c7a 100644 --- a/tests/hlsl/distance.shader_test +++ b/tests/hlsl/distance.shader_test @@ -13,7 +13,7 @@ uniform 4 float4 2.0 -1.0 4.0 5.0 draw quad probe all rgba (7.483983, 7.483983, 7.483983, 7.483983) 1
-[pixel shader] +[pixel shader todo(sm<4)] uniform int4 x; uniform int4 y;
diff --git a/tests/hlsl/dot.shader_test b/tests/hlsl/dot.shader_test index c620e5fac..c6a96cc1e 100644 --- a/tests/hlsl/dot.shader_test +++ b/tests/hlsl/dot.shader_test @@ -25,7 +25,7 @@ float4 main() : SV_TARGET [test] uniform 0 float4 2.0 3.0 0.0 0.0 uniform 4 float4 10.0 11.0 12.0 13.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (53.0, 53.0, 53.0, 53.0)
[pixel shader] @@ -56,7 +56,7 @@ float4 main() : SV_TARGET uniform 0 float4 10.0 11.0 12.0 13.0 uniform 4 float4 2.0 0.0 0.0 0.0 todo(sm>=6) draw quad -probe all rgba (92.0, 92.0, 92.0, 92.0) + probe all rgba (92.0, 92.0, 92.0, 92.0)
[pixel shader] uniform float x; diff --git a/tests/hlsl/entry-point-semantics.shader_test b/tests/hlsl/entry-point-semantics.shader_test index b87dca4d9..403fd66cc 100644 --- a/tests/hlsl/entry-point-semantics.shader_test +++ b/tests/hlsl/entry-point-semantics.shader_test @@ -127,7 +127,7 @@ 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) +probe (0, 0) rgba (10.0, 10.0, 20.0, 20.0)
[pixel shader] @@ -275,8 +275,8 @@ float4 main(in float4 t1 : TEXCOORD0, in float4 t2 : TEXCOORD0) : sv_target }
[test] -todo(sm>=6) draw quad -probe (0, 0) rgba (99.0, 99.0, 10.0, 11.0) +draw quad +todo(sm>=6) probe (0, 0) rgba (99.0, 99.0, 10.0, 11.0)
% Different indexes of the same semantic can have different types. diff --git a/tests/hlsl/expr-indexing.shader_test b/tests/hlsl/expr-indexing.shader_test index 3dcc5727e..2aa99b40d 100644 --- a/tests/hlsl/expr-indexing.shader_test +++ b/tests/hlsl/expr-indexing.shader_test @@ -13,7 +13,7 @@ draw quad probe all rgba (8.0, 8.0, 8.0, 8.0)
-[pixel shader] +[pixel shader todo(sm<4)] float4 a, b; float i;
@@ -26,7 +26,7 @@ float4 main() : sv_target uniform 0 float4 1.0 2.0 3.0 4.0 uniform 4 float4 5.0 6.0 7.0 8.0 uniform 8 float 2 -draw quad +todo(sm<4) draw quad probe all rgba (10.0, 10.0, 10.0, 10.0)
@@ -44,7 +44,7 @@ draw quad probe all rgba (3.0, 3.0, 3.0, 3.0)
-[pixel shader] +[pixel shader todo(sm<4)] float4 a; float i;
@@ -56,10 +56,10 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 uniform 4 float 0 -draw quad +todo(sm<4) draw quad probe all rgba (4.0, 4.0, 4.0, 4.0) uniform 4 float 2 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0)
@@ -82,7 +82,7 @@ draw quad probe all rgba (4.0, 4.0, 4.0, 4.0)
-[pixel shader] +[pixel shader todo(sm<4)] float4 a; float i;
@@ -99,5 +99,5 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 3.0 4.0 uniform 4 float 1 -draw quad +todo(sm<4) draw quad probe all rgba (2.0, 2.0, 2.0, 2.0) diff --git a/tests/hlsl/float-comparison.shader_test b/tests/hlsl/float-comparison.shader_test index ee4b5eb7c..7109f9af0 100644 --- a/tests/hlsl/float-comparison.shader_test +++ b/tests/hlsl/float-comparison.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] uniform float4 f;
float4 main() : sv_target @@ -44,7 +44,7 @@ shader model < 4.0
[test] uniform 0 float4 0.0 1.5 1.5 0.0 -draw quad +todo(sm<4) draw quad todo probe all rgba (1010101.0, 11001100.0, 1101001.0, 0.0)
% SM4-5 optimises away the 'not' by inverting the condition, even though this is invalid for NaN. diff --git a/tests/hlsl/floor.shader_test b/tests/hlsl/floor.shader_test index 19f9437a9..89e1f12ef 100644 --- a/tests/hlsl/floor.shader_test +++ b/tests/hlsl/floor.shader_test @@ -21,7 +21,7 @@ uniform 0 float4 -0.5 6.5 7.5 3.4 draw quad probe all rgba (-1.0, 6.0, 7.0, 3.0) 4
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -34,7 +34,7 @@ float4 main() : sv_target
[test] uniform 0 float4 -0.5 6.5 7.5 3.4 -draw quad +todo(sm<4) draw quad probe all rgba (6.0, 7.0, -1.0, 3.0) 4
[require] diff --git a/tests/hlsl/fmod.shader_test b/tests/hlsl/fmod.shader_test index 05518c7cd..d21301fee 100644 --- a/tests/hlsl/fmod.shader_test +++ b/tests/hlsl/fmod.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -8,13 +8,13 @@ float4 main() : sv_target
[test] uniform 0 float4 -0.5 6.5 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (-0.5, 0.0, 0.0, 0.0) 4 uniform 0 float4 1.1 0.3 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.2, 0.0, 0.0, 0.0) 4
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -24,8 +24,8 @@ float4 main() : sv_target
[test] uniform 0 float4 -0.5 6.5 2.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (-0.5, 0.5, 0.0, 0.0) 4 uniform 0 float4 1.1 0.3 3.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (1.1, 0.3, 0.0, 0.0) 4 diff --git a/tests/hlsl/for.shader_test b/tests/hlsl/for.shader_test index 9407c81bc..b7fa51eec 100644 --- a/tests/hlsl/for.shader_test +++ b/tests/hlsl/for.shader_test @@ -5,7 +5,7 @@ void main(float4 pos : position, out float tex : texcoord, out float4 out_pos : out_pos = pos; }
-[pixel shader] +[pixel shader todo(sm<4)] float4 main(float tex : texcoord) : sv_target { int i; @@ -23,12 +23,12 @@ float4 main(float tex : texcoord) : sv_target }
[test] -draw quad +todo(sm<4) draw quad probe ( 0, 0, 159, 480) rgba (10.0, 35.0, 0.0, 0.0) probe (161, 0, 479, 480) rgba (10.0, 38.0, 0.0, 0.0) probe (481, 0, 640, 480) rgba ( 5.0, 10.0, 0.0, 0.0)
-[pixel shader] +[pixel shader todo(sm<4)] float4 main(float tex : texcoord) : sv_target { int i; @@ -41,7 +41,7 @@ float4 main(float tex : texcoord) : sv_target }
[test] -draw quad +todo(sm<4) draw quad probe all rgba (10.0, 45.0, 0.0, 0.0)
[pixel shader fail(sm<6)] diff --git a/tests/hlsl/function-return.shader_test b/tests/hlsl/function-return.shader_test index be997d0c3..a316baee3 100644 --- a/tests/hlsl/function-return.shader_test +++ b/tests/hlsl/function-return.shader_test @@ -32,8 +32,7 @@ float4 main() : sv_target draw quad probe all rgba (0.2, 0.1, 0.8, 0.5);
-[pixel shader] - +[pixel shader todo(sm<4)] uniform float f;
float func(out float o) @@ -80,20 +79,19 @@ float4 main() : sv_target
[test] uniform 0 float 0.1 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.3, 0.2, 0.6, 0.3) 1 uniform 0 float 0.4 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.6, 0.5, 0.6, 0.3) 1 uniform 0 float 0.6 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.6, 0.5, 0.4, 0.5) 1 uniform 0 float 0.8 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.8, 0.7, 0.4, 0.5) 1
-[pixel shader] - +[pixel shader todo(sm<4)] uniform float f;
float func(out float o) @@ -136,17 +134,16 @@ float4 main() : sv_target
[test] uniform 0 float 0.1 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.2, 0.1, 0.2, 0.1) 1 uniform 0 float 0.5 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.5, 0.4, 1.0, 0.9) 1 uniform 0 float 0.9 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (1.0, 0.9, 1.0, 0.6) 1
-[pixel shader] - +[pixel shader todo(sm<4)] float func(out float o) { o = 0.1; @@ -184,11 +181,10 @@ float4 main() : sv_target }
[test] -draw quad +todo(sm<4) draw quad probe all rgba (0.4, 0.3, 0.3, 0.9) 1
-[pixel shader] - +[pixel shader todo(sm<4)] uniform float f;
float func(out float o) @@ -239,26 +235,26 @@ float4 main() : sv_target
[test] uniform 0 float 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.3, 0.2, 0.3, 0.3) 1
uniform 0 float 0.1 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.3, 0.3, 0.3, 0.3) 1
uniform 0 float 0.3 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.3, 0.5, 0.3, 0.3) 1
uniform 0 float 0.7 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.3, 0.9, 0.7, 0.6) 1
uniform 0 float 0.9 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.4, 0.1, 0.7, 0.6) 1
-[pixel shader] +[pixel shader todo(sm<4)]
uniform float4 f[3];
@@ -295,21 +291,21 @@ float4 main() : sv_target uniform 0 float4 0.3 0.0 0.0 0.0 uniform 4 float4 0.0 0.0 0.0 0.0 uniform 8 float4 0.1 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad todo(sm>=6) probe all rgba (0.3, 0.2, 0.6, 0.6) 1
uniform 4 float4 0.35 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad todo(sm>=6) probe all rgba (0.3, 0.3, 0.6, 0.6) 1
uniform 8 float4 0.5 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad todo(sm>=6) probe all rgba (0.3, 0.5, 0.6, 0.6) 1
uniform 0 float4 1.0 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad todo(sm>=6) probe all rgba (0.3, 0.5, 0.6, 0.6) 1
uniform 4 float4 2.0 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad todo(sm>=6) probe all rgba (0.4, 0.1, 0.6, 0.6) 1 diff --git a/tests/hlsl/fwidth.shader_test b/tests/hlsl/fwidth.shader_test index d4c20f4e0..10ed712d2 100644 --- a/tests/hlsl/fwidth.shader_test +++ b/tests/hlsl/fwidth.shader_test @@ -18,7 +18,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe (10, 10) rgba (8.0, 8.0, 8.0, 8.0) probe (11, 10) rgba (8.0, 8.0, 8.0, 8.0) probe (12, 10) rgba (10.0, 10.0, 10.0, 10.0) diff --git a/tests/hlsl/half.shader_test b/tests/hlsl/half.shader_test index fe7074e45..8cf7a756f 100644 --- a/tests/hlsl/half.shader_test +++ b/tests/hlsl/half.shader_test @@ -9,7 +9,7 @@ float4 main() : sv_target [require] options: backcompat
-[pixel shader] +[pixel shader todo(sm<4)] uniform half h;
float4 main() : sv_target @@ -19,5 +19,5 @@ float4 main() : sv_target
[test] uniform 0 float 10.0 -draw quad +todo(sm<4) draw quad probe all rgba (10.0, 10.0, 10.0, 10.0) diff --git a/tests/hlsl/hard-copy-prop.shader_test b/tests/hlsl/hard-copy-prop.shader_test index 8d20425f1..fa4867488 100644 --- a/tests/hlsl/hard-copy-prop.shader_test +++ b/tests/hlsl/hard-copy-prop.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] float cond;
float4 main() : sv_target @@ -17,14 +17,14 @@ float4 main() : sv_target
[test] uniform 0 float 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (2.0, 2.0, 2.0, 2.0) uniform 0 float 1.0 -draw quad +todo(sm<4) draw quad probe all rgba (-2.0, -2.0, -2.0, -2.0)
-[pixel shader] +[pixel shader todo(sm<4)] float cond;
float4 main() : sv_target @@ -43,14 +43,14 @@ float4 main() : sv_target
[test] uniform 0 float 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (2.0, 2.0, 2.0, 2.0) uniform 0 float 1.0 -draw quad +todo(sm<4) draw quad probe all rgba (20.0, 20.0, 20.0, 20.0)
-[pixel shader] +[pixel shader todo(sm<4)] float cond;
float4 main() : sv_target @@ -66,10 +66,11 @@ float4 main() : sv_target
return float4(r, 0, 0); } + [test] uniform 0 float 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 4.0, 0.0, 0.0) uniform 0 float 1.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 40.0, 0.0, 0.0) diff --git a/tests/hlsl/initializer-implicit-array.shader_test b/tests/hlsl/initializer-implicit-array.shader_test index fff2b8fdf..25cd15644 100644 --- a/tests/hlsl/initializer-implicit-array.shader_test +++ b/tests/hlsl/initializer-implicit-array.shader_test @@ -26,7 +26,7 @@ float4 main() : sv_target
[test] draw quad -todo(sm>=6) probe all rgba (5.0, 6.0, 7.0, 8.0) +probe all rgba (5.0, 6.0, 7.0, 8.0)
[require] % reset requirements diff --git a/tests/hlsl/length.shader_test b/tests/hlsl/length.shader_test index 44b4e5254..ec48300f6 100644 --- a/tests/hlsl/length.shader_test +++ b/tests/hlsl/length.shader_test @@ -34,7 +34,7 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 2.0 3.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (3.60555124, 3.60555124, 3.60555124, 3.60555124) 1
[pixel shader] diff --git a/tests/hlsl/lit.shader_test b/tests/hlsl/lit.shader_test index fcf37d78b..273d52678 100644 --- a/tests/hlsl/lit.shader_test +++ b/tests/hlsl/lit.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -8,20 +8,20 @@ float4 main() : sv_target
[test] uniform 0 float4 -0.1 10.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 0.0, 0.0, 1.0)
[test] uniform 0 float4 1.2 -0.1 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.2, 0.0, 1.0)
[test] uniform 0 float4 1.2 2.0 3.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.2, 8.0, 1.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -31,7 +31,7 @@ float4 main() : sv_target
[test] uniform 0 float4 1.2 2.0 3.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (2.0, 2.4, 16.0, 2.0)
[pixel shader fail] diff --git a/tests/hlsl/loop.shader_test b/tests/hlsl/loop.shader_test index 35a303595..a9431085a 100644 --- a/tests/hlsl/loop.shader_test +++ b/tests/hlsl/loop.shader_test @@ -1,6 +1,6 @@ % TODO: dxcompiler emits no loops for any of these test shaders.
-[pixel shader] +[pixel shader todo(sm<4)] float a;
float4 main() : sv_target @@ -18,11 +18,11 @@ float4 main() : sv_target
[test] uniform 0 float 5.0 -draw quad +todo(sm<4) draw quad probe all rgba (50.0, 50.0, 50.0, 50.0)
-[pixel shader] +[pixel shader todo(sm<4)] float a;
float4 main() : sv_target @@ -41,10 +41,10 @@ float4 main() : sv_target
[test] uniform 0 float 4.0 -draw quad +todo(sm<4) draw quad probe all rgba (20.0, 20.0, 20.0, 20.0)
-[pixel shader] +[pixel shader todo(sm<4)] float a;
float4 main() : sv_target @@ -70,10 +70,10 @@ float4 main() : sv_target
[test] uniform 0 float 4.0 -draw quad +todo(sm<4) draw quad probe all rgba (409.1, 409.1, 409.1, 409.1)
-[pixel shader] +[pixel shader todo(sm<4)] float a;
float4 main() : sv_target @@ -100,11 +100,11 @@ float4 main() : sv_target
[test] uniform 0 float 4.0 -draw quad +todo(sm<4) draw quad probe all rgba (410.1, 410.1, 410.1, 410.1)
% loop attribute by itself -[pixel shader] +[pixel shader todo(sm<4)] float4 main() : sv_target { float ret = 0.0; @@ -118,10 +118,10 @@ float4 main() : sv_target }
[test] -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (10.0, 10.0, 10.0, 10.0)
-[pixel shader] +[pixel shader todo(sm<4)] float4 main() : sv_target { float ret = 0.0; @@ -137,10 +137,10 @@ float4 main() : sv_target }
[test] -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (10.0, 10.0, 10.0, 10.0)
-[pixel shader] +[pixel shader todo(sm<4)] float4 main() : sv_target { float ret = 0.0; @@ -156,7 +156,7 @@ float4 main() : sv_target }
[test] -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (10.0, 10.0, 10.0, 10.0)
% unroll can't be used with fastopt or loop diff --git a/tests/hlsl/matrix-indexing.shader_test b/tests/hlsl/matrix-indexing.shader_test index f44ba63ef..6e2f01b7a 100644 --- a/tests/hlsl/matrix-indexing.shader_test +++ b/tests/hlsl/matrix-indexing.shader_test @@ -108,7 +108,7 @@ draw quad probe all rgba (3.0, 4.0, 50.0, 60.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float i;
float4 main() : sv_target @@ -120,11 +120,11 @@ float4 main() : sv_target
[test] uniform 0 float 2 -draw quad +todo(sm<4) draw quad probe all rgba (8, 9, 10, 11)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float i;
float4 main() : sv_target @@ -136,5 +136,5 @@ float4 main() : sv_target
[test] uniform 0 float 3 -draw quad +todo(sm<4) draw quad probe all rgba (12, 13, 14, 15) diff --git a/tests/hlsl/non-const-indexing.shader_test b/tests/hlsl/non-const-indexing.shader_test index 82a6e321e..b0452148e 100644 --- a/tests/hlsl/non-const-indexing.shader_test +++ b/tests/hlsl/non-const-indexing.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] uniform float4 f[3]; uniform float2 i;
@@ -12,20 +12,20 @@ uniform 0 float4 1.0 2.0 3.0 4.0 uniform 4 float4 5.0 6.0 7.0 8.0 uniform 8 float4 9.0 10.0 11.0 12.0 uniform 12 float4 0 0 0 0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) uniform 12 float4 1 0 0 0 -draw quad +todo(sm<4) draw quad probe all rgba (5.0, 6.0, 7.0, 8.0) uniform 12 float4 0 1 0 0 -draw quad +todo(sm<4) draw quad probe all rgba (5.0, 6.0, 7.0, 8.0) uniform 12 float4 1 1 0 0 -draw quad +todo(sm<4) draw quad probe all rgba (9.0, 10.0, 11.0, 12.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float i;
float4 main() : SV_TARGET @@ -36,20 +36,20 @@ float4 main() : SV_TARGET
[test] uniform 0 float 0 -draw quad +todo(sm<4) draw quad probe all rgba (11.0, 11.0, 11.0, 11.0) uniform 0 float 1 -draw quad +todo(sm<4) draw quad probe all rgba (12.0, 12.0, 12.0, 12.0) uniform 0 float 2 -draw quad +todo(sm<4) draw quad probe all rgba (13.0, 13.0, 13.0, 13.0) uniform 0 float 3 -draw quad +todo(sm<4) draw quad probe all rgba (14.0, 14.0, 14.0, 14.0)
-[pixel shader] +[pixel shader todo(sm<4)] float i;
float4 main() : sv_target @@ -61,11 +61,11 @@ float4 main() : sv_target
[test] uniform 0 float 2.3 -draw quad +todo(sm<4) draw quad probe all rgba (3, 3, 3, 3)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float i;
float4 main() : SV_TARGET @@ -77,20 +77,20 @@ float4 main() : SV_TARGET
[test] uniform 0 float 0 -draw quad +todo(sm<4) draw quad probe all rgba (21.0, 1.0, 24.0, 0.0) uniform 0 float 1 -draw quad +todo(sm<4) draw quad probe all rgba (22.0, 0.0, 23.0, 1.0) uniform 0 float 2 -draw quad +todo(sm<4) draw quad probe all rgba (23.0, 1.0, 22.0, 0.0) uniform 0 float 3 -draw quad +todo(sm<4) draw quad probe all rgba (24.0, 0.0, 21.0, 1.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float2 i;
float4 main() : sv_target @@ -102,20 +102,20 @@ float4 main() : sv_target
[test] uniform 0 float4 0 0 0 0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) uniform 0 float4 1 0 0 0 -draw quad +todo(sm<4) draw quad probe all rgba (5.0, 6.0, 7.0, 8.0) uniform 0 float4 0 1 0 0 -draw quad +todo(sm<4) draw quad probe all rgba (5.0, 6.0, 7.0, 8.0) uniform 0 float4 1 1 0 0 -draw quad +todo(sm<4) draw quad probe all rgba (9.0, 10.0, 11.0, 12.0)
-[pixel shader] +[pixel shader todo(sm<4)] float4 a;
float4 main() : sv_target @@ -130,7 +130,7 @@ float4 main() : sv_target
[test] uniform 0 float4 0 0 2.4 0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 120.0, 90.0, 4.0)
@@ -242,8 +242,8 @@ uniform 8 float 3.0 uniform 12 float 4.0 uniform 16 uint4 3 1 0 2 uniform 20 uint4 0 3 1 2 -draw quad -todo probe all rgba (1.0, 1.0, 1.0, 1.0) +todo draw quad +todo(sm<4) probe all rgba (1.0, 1.0, 1.0, 1.0)
[require] shader model >= 4.0 diff --git a/tests/hlsl/normalize.shader_test b/tests/hlsl/normalize.shader_test index 8b181dfa5..9f350a7ee 100644 --- a/tests/hlsl/normalize.shader_test +++ b/tests/hlsl/normalize.shader_test @@ -34,7 +34,7 @@ float4 main() : SV_TARGET
[test] uniform 0 float4 2.0 3.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.554700196, 0.832050323, 0.0, 0.0) 1
[pixel shader] diff --git a/tests/hlsl/reflect.shader_test b/tests/hlsl/reflect.shader_test index 25890086b..03772dfa9 100644 --- a/tests/hlsl/reflect.shader_test +++ b/tests/hlsl/reflect.shader_test @@ -79,7 +79,7 @@ float4 main() : sv_target [test] uniform 0 float4 0.5 -0.1 0.0 0.0 uniform 4 float4 0.6 0.4 -0.3 1.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.188, -0.308, 0.0, 0.0) 4
[pixel shader] @@ -97,5 +97,5 @@ float4 main() : sv_target [test] uniform 0 float4 0.5 -0.1 0.2 0.0 uniform 4 float4 0.6 0.4 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.188, -0.308, 0.0, 0.0) 4 diff --git a/tests/hlsl/return.shader_test b/tests/hlsl/return.shader_test index fbea07926..e1c32bf87 100644 --- a/tests/hlsl/return.shader_test +++ b/tests/hlsl/return.shader_test @@ -25,8 +25,7 @@ void main(out float4 ret : sv_target) draw quad probe all rgba (0.1, 0.2, 0.3, 0.4)
-[pixel shader] - +[pixel shader todo(sm<4)] uniform float f;
float4 main() : sv_target @@ -38,14 +37,13 @@ float4 main() : sv_target
[test] uniform 0 float 0.2 -draw quad +todo(sm<4) draw quad probe all rgba (0.1, 0.2, 0.3, 0.4) uniform 0 float 0.8 -draw quad +todo(sm<4) draw quad probe all rgba (0.5, 0.6, 0.7, 0.8)
-[pixel shader] - +[pixel shader todo(sm<4)] uniform float f;
void main(out float4 ret : sv_target) @@ -65,14 +63,13 @@ void main(out float4 ret : sv_target)
[test] uniform 0 float 0.2 -draw quad +todo(sm<4) draw quad probe all rgba (0.3, 0.4, 0.5, 0.6) uniform 0 float 0.8 -draw quad +todo(sm<4) draw quad probe all rgba (0.1, 0.2, 0.3, 0.4)
-[pixel shader] - +[pixel shader todo(sm<4)] uniform float f;
void main(out float4 ret : sv_target) @@ -92,17 +89,16 @@ void main(out float4 ret : sv_target)
[test] uniform 0 float 0.1 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.1, 0.2, 0.3, 0.4) 1 uniform 0 float 0.5 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.2, 0.3, 0.4, 0.5) 1 uniform 0 float 0.9 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.5, 0.6, 0.7, 0.8) 1
-[pixel shader] - +[pixel shader todo(sm<4)] uniform float f;
void main(out float4 ret : sv_target) @@ -119,17 +115,16 @@ void main(out float4 ret : sv_target)
[test] uniform 0 float 0.1 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.1, 0.2, 0.3, 0.4) 1 uniform 0 float 0.5 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.5, 0.6, 0.7, 0.8) 1 uniform 0 float 0.9 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.4, 0.5, 0.6, 0.7) 1
-[pixel shader] - +[pixel shader todo(sm<4)] void main(out float4 ret : sv_target) { ret = float4(0.1, 0.2, 0.3, 0.4); @@ -143,11 +138,10 @@ void main(out float4 ret : sv_target) }
[test] -draw quad +todo(sm<4) draw quad probe all rgba (0.2, 0.4, 0.6, 0.8)
-[pixel shader] - +[pixel shader todo(sm<4)] uniform float f;
void main(out float4 ret : sv_target) @@ -166,27 +160,26 @@ void main(out float4 ret : sv_target)
[test] uniform 0 float 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.1, 0.1, 0.1, 0.1) 1
uniform 0 float 0.1 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.2, 0.2, 0.2, 0.2) 1
uniform 0 float 0.3 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.4, 0.4, 0.4, 0.4) 1
uniform 0 float 0.7 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.8, 0.8, 0.8, 0.8) 1
uniform 0 float 0.9 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.9, 0.9, 0.9, 0.9) 1
-[pixel shader] - +[pixel shader todo(sm<4)] uniform float f;
void main(out float4 ret : sv_target) @@ -211,13 +204,13 @@ void main(out float4 ret : sv_target)
[test] uniform 0 float 0.2 -draw quad +todo(sm<4) draw quad probe all rgba (0.2, 0.2, 0.2, 0.2) uniform 0 float 0.8 -draw quad +todo(sm<4) draw quad probe all rgba (0.5, 0.5, 0.5, 0.5)
-[pixel shader] +[pixel shader todo(sm<4)]
uniform float4 f[3];
@@ -243,21 +236,21 @@ void main(out float4 ret : sv_target) uniform 0 float4 0.3 0.0 0.0 0.0 uniform 4 float4 0.0 0.0 0.0 0.0 uniform 8 float4 0.1 0.0 0.0 0.0 -todo(sm>=6) draw quad -todo(sm>=6) probe all rgba (0.1, 0.1, 0.1, 0.1) 1 +todo(sm<4 | sm>=6) draw quad +probe all rgba (0.1, 0.1, 0.1, 0.1) 1
uniform 4 float4 0.35 0.0 0.0 0.0 -todo(sm>=6) draw quad -todo(sm>=6) probe all rgba (0.2, 0.2, 0.2, 0.2) 1 +todo(sm<4 | sm>=6) draw quad +probe all rgba (0.2, 0.2, 0.2, 0.2) 1
uniform 8 float4 0.5 0.0 0.0 0.0 -todo(sm>=6) draw quad -todo(sm>=6) probe all rgba (0.4, 0.4, 0.4, 0.4) 1 +todo(sm<4 | sm>=6) draw quad +probe all rgba (0.4, 0.4, 0.4, 0.4) 1
uniform 0 float4 1.0 0.0 0.0 0.0 -todo(sm>=6) draw quad -todo(sm>=6) probe all rgba (0.4, 0.4, 0.4, 0.4) 1 +todo(sm<4 | sm>=6) draw quad +probe all rgba (0.4, 0.4, 0.4, 0.4) 1
uniform 4 float4 2.0 0.0 0.0 0.0 -todo(sm>=6) draw quad -todo(sm>=6) probe all rgba (0.9, 0.9, 0.9, 0.9) 1 +todo(sm<4 | sm>=6) draw quad +probe all rgba (0.9, 0.9, 0.9, 0.9) 1 diff --git a/tests/hlsl/round.shader_test b/tests/hlsl/round.shader_test index b9234b010..7b4c68cb7 100644 --- a/tests/hlsl/round.shader_test +++ b/tests/hlsl/round.shader_test @@ -13,7 +13,7 @@ probe all rgba (0.0, -7.0, 8.0, 3.0) 4
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -26,12 +26,12 @@ float4 main() : sv_target
[test] uniform 0 float4 -0.4 -6.6 7.6 3.4 -draw quad +todo(sm<4) draw quad probe all rgba (-7.0, 8.0, 0.0, 3.0) 4
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -42,5 +42,5 @@ float4 main() : sv_target
[test] uniform 0 float4 -1 0 2 10 -draw quad +todo(sm<4) draw quad probe all rgba (-1.0, 0.0, 2.0, 10.0) 4 diff --git a/tests/hlsl/sample-bias.shader_test b/tests/hlsl/sample-bias.shader_test index 5b7067b52..4750947ef 100644 --- a/tests/hlsl/sample-bias.shader_test +++ b/tests/hlsl/sample-bias.shader_test @@ -18,7 +18,7 @@ void main(float4 pos : position, out float2 tex : texcoord, out float4 out_pos : out_pos = pos; }
-[pixel shader] +[pixel shader todo(sm<4)] sampler s; Texture2D t; uniform float bias; @@ -32,13 +32,13 @@ float4 main(float2 coord : texcoord) : sv_target
[test] uniform 0 float4 6.5 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (10.0, 0.0, 10.0, 0.0)
uniform 0 float4 7.5 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (4.0, 0.0, 10.0, 0.0)
uniform 0 float4 8.5 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.0, 0.0, 10.0, 0.0) diff --git a/tests/hlsl/sample-level.shader_test b/tests/hlsl/sample-level.shader_test index 8b2890ff7..6ea919df6 100644 --- a/tests/hlsl/sample-level.shader_test +++ b/tests/hlsl/sample-level.shader_test @@ -14,7 +14,7 @@ levels 2
0.0 0.0 1.0 0.0
-[pixel shader] +[pixel shader todo(sm<4)] sampler s; Texture2D t; uniform float level; @@ -26,20 +26,20 @@ float4 main() : sv_target
[test] uniform 0 float4 0.0 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (1.0, 0.0, 1.0, 0.0) uniform 0 float4 0.5 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.5, 0.0, 1.0, 0.0) uniform 0 float4 1.0 0.0 0.0 0.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.0, 0.0, 1.0, 0.0)
[require] shader model >= 3.0 options: backcompat
-[pixel shader fail(sm>=6)] +[pixel shader todo(sm<4) fail(sm>=6)] sampler s; float level;
@@ -50,11 +50,11 @@ float4 main() : sv_target
[test] uniform 0 float4 0.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 0.0, 1.0, 0.0) uniform 0 float4 0.5 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.5, 0.0, 1.0, 0.0) uniform 0 float4 1.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.0, 0.0, 1.0, 0.0) diff --git a/tests/hlsl/sampler.shader_test b/tests/hlsl/sampler.shader_test index caff7b2fa..9a5fa6df4 100644 --- a/tests/hlsl/sampler.shader_test +++ b/tests/hlsl/sampler.shader_test @@ -7,7 +7,7 @@ size (2, 2) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0
-[pixel shader] +[pixel shader todo(sm<4)] sampler s; Texture2D t;
@@ -17,10 +17,10 @@ float4 main() : sv_target }
[test] -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.25, 0, 0.25, 0)
-[pixel shader] +[pixel shader todo(sm<4)] SamplerState s; Texture2D t;
@@ -30,7 +30,7 @@ float4 main() : sv_target }
[test] -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.25, 0, 0.25, 0)
[pixel shader fail] diff --git a/tests/hlsl/saturate.shader_test b/tests/hlsl/saturate.shader_test index 2ed83cf66..6852015b2 100644 --- a/tests/hlsl/saturate.shader_test +++ b/tests/hlsl/saturate.shader_test @@ -11,7 +11,7 @@ uniform 0 float4 0.7 -0.1 0.0 0.0 todo(sm>=6) draw quad probe all rgba (0.7, 0.0, 1.0, 0.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -22,5 +22,5 @@ float4 main() : sv_target
[test] uniform 0 float4 -2 0 2 -1 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.0, 0.0, 1.0, 0.0) diff --git a/tests/hlsl/sign.shader_test b/tests/hlsl/sign.shader_test index 5d8b43168..6ec5a571d 100644 --- a/tests/hlsl/sign.shader_test +++ b/tests/hlsl/sign.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] uniform float f;
float4 main() : sv_target @@ -8,16 +8,16 @@ float4 main() : sv_target
[test] uniform 0 float4 1.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0) uniform 0 float4 -1.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (-1.0, -1.0, -1.0, -1.0) uniform 0 float4 0.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.0, 0.0, 0.0, 0.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 f;
float4 main() : sv_target @@ -27,10 +27,10 @@ float4 main() : sv_target
[test] uniform 0 float4 1.0 2.0 3.0 4.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float2x2 f;
float4 main() : sv_target @@ -41,14 +41,14 @@ float4 main() : sv_target [test] uniform 0 float4 1.0 2.0 0.0 0.0 uniform 4 float4 3.0 4.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0)
[require] % SM1-3 doesn't support integral types shader model >= 4.0
-[pixel shader] +[pixel shader todo(sm<4)] uniform int f;
float4 main() : sv_target @@ -67,7 +67,7 @@ uniform 0 int4 0 0 0 0 draw quad probe all rgba (0, 0, 0, 0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform int4 f;
float4 main() : sv_target @@ -80,7 +80,7 @@ uniform 0 int4 1 2 3 4 draw quad probe all rgba (1, 1, 1, 1)
-[pixel shader] +[pixel shader todo(sm<4)] uniform int2x2 f;
float4 main() : sv_target diff --git a/tests/hlsl/smoothstep.shader_test b/tests/hlsl/smoothstep.shader_test index 971f6d5d8..e5ef0f194 100644 --- a/tests/hlsl/smoothstep.shader_test +++ b/tests/hlsl/smoothstep.shader_test @@ -1,5 +1,3 @@ - - [pixel shader] float4 main() : sv_target { @@ -109,7 +107,7 @@ draw quad probe all rgba (0.028, 0.104, 0.216, 0.352) 6
-[pixel shader] +[pixel shader todo(sm<4)] // 4 division by zero warnings. // Only test compilation because result is implementation-dependent. float4 main() : sv_target diff --git a/tests/hlsl/static-initializer.shader_test b/tests/hlsl/static-initializer.shader_test index 217444308..0c51bac76 100644 --- a/tests/hlsl/static-initializer.shader_test +++ b/tests/hlsl/static-initializer.shader_test @@ -17,6 +17,7 @@ probe all rgba (0.8, 0.0, 0.0, 0.0)
[pixel shader fail(sm<6)] +// On SM1 this gives hr 0x88760b59. static uint i;
float4 main() : sv_target @@ -135,7 +136,7 @@ float4 main(Texture2D tex2) : sv_target }
-[pixel shader] +[pixel shader todo(sm<4)] Texture2D real_tex; static Texture2D tex = real_tex; sampler sam; @@ -146,11 +147,11 @@ float4 main() : sv_target }
[test] -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (1, 2, 3, 4)
-[pixel shader] +[pixel shader todo(sm<4)] Texture2D real_tex; static Texture2D tex; sampler sam; @@ -162,7 +163,7 @@ float4 main() : sv_target }
[test] -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (1, 2, 3, 4)
diff --git a/tests/hlsl/step.shader_test b/tests/hlsl/step.shader_test index e201e15f9..b965f33e1 100644 --- a/tests/hlsl/step.shader_test +++ b/tests/hlsl/step.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] uniform float4 f, p;
float4 main() : sv_target @@ -9,7 +9,7 @@ float4 main() : sv_target [test] uniform 0 float4 5.0 -2.6 3.0 2.0 uniform 4 float4 1.0 -4.3 3.0 4.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.0, 0.0, 1.0, 1.0)
diff --git a/tests/hlsl/ternary.shader_test b/tests/hlsl/ternary.shader_test index 7b4c71f7b..b24c62067 100644 --- a/tests/hlsl/ternary.shader_test +++ b/tests/hlsl/ternary.shader_test @@ -8,10 +8,10 @@ float4 main() : sv_target
[test] uniform 0 float4 2.0 3.0 4.0 5.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (2.0, 3.0, 4.0, 5.0) uniform 0 float4 0.0 10.0 11.0 12.0 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (-1.0, 9.0, 10.0, 11.0)
[pixel shader] @@ -29,7 +29,7 @@ float4 main() : sv_target
[test] uniform 0 float4 1.1 3.0 4.0 5.0 -draw quad +todo(sm<4) draw quad probe all rgba (1.1, 2.0, 0.0, 0.0)
[pixel shader] @@ -47,7 +47,7 @@ shader model < 6.0
[test] uniform 0 float4 1.0 0.0 0.0 0.0 -draw quad +todo(sm<4) draw quad probe all rgba (0.5, 0.6, 0.7, 0.0)
[require] @@ -74,5 +74,5 @@ float4 main() : sv_target uniform 0 float4 0.0 1.0 0.0 -3.0 uniform 4 float4 1.0 2.0 3.0 4.0 uniform 8 float4 5.0 6.0 7.0 8.0 -draw quad +todo(sm<4) draw quad probe all rgba (5.0, 2.0, 7.0, 4.0) diff --git a/tests/hlsl/trigonometry.shader_test b/tests/hlsl/trigonometry.shader_test index 859881199..5d230d7c3 100644 --- a/tests/hlsl/trigonometry.shader_test +++ b/tests/hlsl/trigonometry.shader_test @@ -5,7 +5,7 @@ void main(float4 pos : position, out float tex : texcoord, out float4 out_pos : out_pos = pos; }
-[pixel shader] +[pixel shader todo(sm<4)] float4 main(float tex : texcoord) : sv_target { tex = floor(tex + 0.25); @@ -13,7 +13,7 @@ float4 main(float tex : texcoord) : sv_target }
[test] -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe ( 0, 0) rgba ( 0.00000000, 1.00000000, 0.00000000, 0.0) probe ( 1, 0) rgba ( 0.84147098, 0.54030231, 1.55740772, 0.0) 1024 probe ( 2, 0) rgba ( 0.90929743, -0.41614684, -2.18503986, 0.0) 1024 @@ -32,7 +32,7 @@ probe (14, 0) rgba ( 0.99060736, 0.13673722, 7.24460662, 0.0) 1024 probe (15, 0) rgba ( 0.65028784, -0.75968791, -0.85599340, 0.0) 1024
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 a;
float4 main() : sv_target @@ -42,11 +42,11 @@ float4 main() : sv_target
[test] uniform 0 float4 0.0 0.52359877 2.61799387 3.14159265 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0.0, 500.0, 500.0, 0.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 a;
float4 main() : sv_target @@ -56,11 +56,11 @@ float4 main() : sv_target
[test] uniform 0 float4 0.0 0.78539816 1.57079632 2.35619449 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (1000.0, 707.0, -0.0, -707.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 a;
float4 main() : sv_target @@ -72,5 +72,5 @@ float4 main() : sv_target % tan(pi/2) is an asymtote and therefore undefined % so check 0, pi/4, 3pi/4, pi uniform 0 float4 0.0 0.78539816 2.35619449 3.14159265 -todo(sm>=6) draw quad +todo(sm<4 | sm>=6) draw quad probe all rgba (0, 1000, -1000.0, 0) diff --git a/tests/hlsl/trunc.shader_test b/tests/hlsl/trunc.shader_test index 76ffdbbad..f1d23bf82 100644 --- a/tests/hlsl/trunc.shader_test +++ b/tests/hlsl/trunc.shader_test @@ -1,4 +1,4 @@ -[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -8,13 +8,13 @@ float4 main() : sv_target
[test] uniform 0 float4 -0.5 6.5 7.5 3.4 -draw quad +todo(sm<4) draw quad probe all rgba (0.0, 6.0, 7.0, 3.0) uniform 0 float4 -1.5 6.5 7.5 3.4 -draw quad +todo(sm<4) draw quad probe all rgba (-1.0, 6.0, 7.0, 3.0)
-[pixel shader] +[pixel shader todo(sm<4)] uniform float4 u;
float4 main() : sv_target @@ -27,7 +27,7 @@ float4 main() : sv_target
[test] uniform 0 float4 -0.5 6.5 7.5 3.4 -draw quad +todo(sm<4) draw quad probe all rgba (6.0, 7.0, 0.0, 3.0)
[require] diff --git a/tests/hlsl/vector-indexing-uniform.shader_test b/tests/hlsl/vector-indexing-uniform.shader_test index e5ffbdd02..cd77462ec 100644 --- a/tests/hlsl/vector-indexing-uniform.shader_test +++ b/tests/hlsl/vector-indexing-uniform.shader_test @@ -1,6 +1,6 @@ % Use a uniform to prevent the compiler from optimizing.
-[pixel shader] +[pixel shader todo(sm<4)] uniform float i; float4 main() : SV_TARGET { @@ -12,5 +12,5 @@ float4 main() : SV_TARGET
[test] uniform 0 float 2 -draw quad +todo(sm<4) draw quad probe all rgba (0.5, 0.3, 0.8, 0.2) diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 80d5dfe77..250aaa5a8 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -968,8 +968,13 @@ unsigned int get_vb_stride(const struct shader_runner *runner, unsigned int slot return stride; }
-static HRESULT map_unidentified_hrs(HRESULT hr) +static HRESULT map_special_hrs(HRESULT hr) { + if (hr == 0x88760b59) + { + trace("Mapping hr %#x (D3DXERR_INVALIDDATA) as %#x.\n", hr, E_FAIL); + return E_FAIL; + } if (hr == 0x80010064) { trace("Mapping unidentified hr %#x as %#x.\n", hr, E_FAIL); @@ -1116,8 +1121,8 @@ static void compile_shader(struct shader_runner *runner, IDxcCompiler3 *dxc_comp
static const char *const shader_models[] = { - [SHADER_MODEL_2_0] = "4_0", - [SHADER_MODEL_3_0] = "4_0", + [SHADER_MODEL_2_0] = "2_0", + [SHADER_MODEL_3_0] = "3_0", [SHADER_MODEL_4_0] = "4_0", [SHADER_MODEL_4_1] = "4_1", [SHADER_MODEL_5_0] = "5_0", @@ -1146,7 +1151,7 @@ static void compile_shader(struct shader_runner *runner, IDxcCompiler3 *dxc_comp sprintf(profile, "%s_%s", shader_type_string(type), shader_models[runner->minimum_shader_model]); hr = D3DCompile(source, len, NULL, NULL, NULL, "main", profile, runner->compile_options, 0, &blob, &errors); } - hr = map_unidentified_hrs(hr); + hr = map_special_hrs(hr); ok(hr == expect, "Got unexpected hr %#x.\n", hr); if (hr == S_OK) { diff --git a/tests/shader_runner_vulkan.c b/tests/shader_runner_vulkan.c index d435a5d3d..e1271e756 100644 --- a/tests/shader_runner_vulkan.c +++ b/tests/shader_runner_vulkan.c @@ -412,8 +412,8 @@ static bool compile_shader(struct vulkan_shader_runner *runner, const char *sour
static const char *const shader_models[] = { - [SHADER_MODEL_2_0] = "4_0", - [SHADER_MODEL_3_0] = "4_0", + [SHADER_MODEL_2_0] = "2_0", + [SHADER_MODEL_3_0] = "3_0", [SHADER_MODEL_4_0] = "4_0", [SHADER_MODEL_4_1] = "4_1", [SHADER_MODEL_5_0] = "5_0", @@ -424,7 +424,11 @@ static bool compile_shader(struct vulkan_shader_runner *runner, const char *sour info.source.code = source; info.source.size = strlen(source); info.source_type = VKD3D_SHADER_SOURCE_HLSL; - info.target_type = VKD3D_SHADER_TARGET_DXBC_TPF; + if (runner->r.minimum_shader_model < SHADER_MODEL_4_0) + info.target_type = VKD3D_SHADER_TARGET_D3D_BYTECODE; + else + info.target_type = VKD3D_SHADER_TARGET_DXBC_TPF; + info.log_level = VKD3D_SHADER_LOG_WARNING;
info.options = options; @@ -468,7 +472,10 @@ static bool compile_shader(struct vulkan_shader_runner *runner, const char *sour
info.next = &spirv_info; info.source = *dxbc; - info.source_type = VKD3D_SHADER_SOURCE_DXBC_TPF; + if (runner->r.minimum_shader_model < SHADER_MODEL_4_0) + info.source_type = VKD3D_SHADER_SOURCE_D3D_BYTECODE; + else + info.source_type = VKD3D_SHADER_SOURCE_DXBC_TPF; info.target_type = VKD3D_SHADER_TARGET_SPIRV_BINARY;
spirv_info.next = &interface_info; @@ -1420,8 +1427,11 @@ void run_shader_tests_vulkan(void) if (!init_vulkan_runner(&runner)) return;
- trace("Compiling SM2-SM5 shaders with vkd3d-shader and executing with Vulkan\n"); - run_shader_tests(&runner.r, &vulkan_runner_ops, NULL, SHADER_MODEL_2_0, SHADER_MODEL_5_1); + trace("Compiling SM2-SM3 shaders with vkd3d-shader and executing with Vulkan\n"); + run_shader_tests(&runner.r, &vulkan_runner_ops, NULL, SHADER_MODEL_2_0, SHADER_MODEL_3_0); + + trace("Compiling SM4-SM5 shaders with vkd3d-shader and executing with Vulkan\n"); + run_shader_tests(&runner.r, &vulkan_runner_ops, NULL, SHADER_MODEL_4_0, SHADER_MODEL_5_1);
cleanup_vulkan_runner(&runner); }
The HLSL compiler may not support outputting shader model 1 bytecode, but we certainly want to support it as input for e.g. d3dbc->spirv compilation.
Okay, I changed it so that it only reads the first 3 components in SM1.
What allows us to make those assertions?
We always initialize texkill with src_count = 0 and dst_count = 1, when parsing d3dbc and a VKD3DSIH_TEXKILL cannot come from anywhere else (unless I am missing something). But you mentioned that this check is more appropriate for the validation layer, so I removed them.
That's better, but note that the comment still references "src[0]".
oops, I changed it.
Ugh, I did some silly things. I forgot to change the instruction count for SM1. And I misspelled "componets_read", let me fix that.