From: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- tests/shader_runner.c | 13 +++++++++++-- tests/shader_runner.h | 4 +++- tests/shader_runner_d3d11.c | 8 +++++--- tests/shader_runner_d3d12.c | 10 +++++----- tests/shader_runner_d3d9.c | 8 +++++--- tests/shader_runner_vulkan.c | 8 +++++++- 6 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 54b667fc..2a661122 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -382,7 +382,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) if (!runner->vs_source) runner->vs_source = strdup(vs_source);
- runner->ops->draw(runner, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, 3); + runner->last_render_failed = !runner->ops->draw(runner, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, 3); } else if (match_string(line, "draw", &line)) { @@ -401,7 +401,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) if (line == rest) fatal_error("Malformed vertex count '%s'.\n", line);
- runner->ops->draw(runner, topology, vertex_count); + runner->last_render_failed = !runner->ops->draw(runner, topology, vertex_count); } else if (match_string(line, "probe all rgba", &line)) { @@ -410,6 +410,9 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) struct vec4 v; int ret;
+ if (runner->last_render_failed) + return; + ret = sscanf(line, "( %f , %f , %f , %f ) %u", &v.x, &v.y, &v.z, &v.w, &ulps); if (ret < 4) fatal_error("Malformed probe arguments '%s'.\n", line); @@ -425,6 +428,9 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) RECT rect; int ret;
+ if (runner->last_render_failed) + return; + ret = sscanf(line, "( %d , %d , %d , %d ) ( %f , %f , %f , %f ) %u", &left, &top, &right, &bottom, &v.x, &v.y, &v.z, &v.w, &ulps); if (ret < 8) @@ -445,6 +451,9 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) RECT rect; int ret;
+ if (runner->last_render_failed) + return; + ret = sscanf(line, "( %u , %u ) ( %f , %f , %f , %f ) %u", &x, &y, &v.x, &v.y, &v.z, &v.w, &ulps); if (ret < 6) fatal_error("Malformed probe arguments '%s'.\n", line); diff --git a/tests/shader_runner.h b/tests/shader_runner.h index 19218ab5..2af2259a 100644 --- a/tests/shader_runner.h +++ b/tests/shader_runner.h @@ -98,6 +98,8 @@ struct shader_runner char *ps_source; enum shader_model minimum_shader_model;
+ bool last_render_failed; + uint32_t *uniforms; size_t uniform_count, uniform_capacity;
@@ -118,7 +120,7 @@ struct shader_runner_ops bool (*check_requirements)(struct shader_runner *runner); struct resource *(*create_resource)(struct shader_runner *runner, const struct resource_params *params); void (*destroy_resource)(struct shader_runner *runner, struct resource *resource); - void (*draw)(struct shader_runner *runner, D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count); + bool (*draw)(struct shader_runner *runner, D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count); void (*probe_vec4)(struct shader_runner *runner, const RECT *rect, const struct vec4 *v, unsigned int ulps); };
diff --git a/tests/shader_runner_d3d11.c b/tests/shader_runner_d3d11.c index 93904a64..9d1ed09b 100644 --- a/tests/shader_runner_d3d11.c +++ b/tests/shader_runner_d3d11.c @@ -423,7 +423,7 @@ static void d3d11_runner_destroy_resource(struct shader_runner *r, struct resour free(resource); }
-static void d3d11_runner_draw(struct shader_runner *r, +static bool d3d11_runner_draw(struct shader_runner *r, D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count) { struct d3d11_shader_runner *runner = d3d11_shader_runner(r); @@ -437,12 +437,12 @@ static void d3d11_runner_draw(struct shader_runner *r, HRESULT hr;
if (!(vs_code = compile_shader(runner->r.vs_source, "vs", runner->r.minimum_shader_model))) - return; + return false;
if (!(ps_code = compile_shader(runner->r.ps_source, "ps", runner->r.minimum_shader_model))) { ID3D10Blob_Release(vs_code); - return; + return false; }
hr = ID3D11Device_CreateVertexShader(device, ID3D10Blob_GetBufferPointer(vs_code), @@ -536,6 +536,8 @@ static void d3d11_runner_draw(struct shader_runner *r, ID3D11VertexShader_Release(vs); if (cb) ID3D11Buffer_Release(cb); + + return true; }
struct resource_readback diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index c3eb5686..b94f5ee6 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c @@ -132,7 +132,7 @@ static void d3d12_runner_destroy_resource(struct shader_runner *r, struct resour free(resource); }
-static void d3d12_runner_draw(struct shader_runner *r, +static bool d3d12_runner_draw(struct shader_runner *r, D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count) { struct d3d12_shader_runner *runner = d3d12_shader_runner(r); @@ -155,12 +155,12 @@ static void d3d12_runner_draw(struct shader_runner *r, size_t i;
if (!(ps_code = compile_shader(runner->r.ps_source, "ps", runner->r.minimum_shader_model))) - return; + return false;
if (!(vs_code = compile_shader(runner->r.vs_source, "vs", runner->r.minimum_shader_model))) { ID3D10Blob_Release(ps_code); - return; + return false; }
root_signature_desc.NumParameters = 0; @@ -257,8 +257,6 @@ static void d3d12_runner_draw(struct shader_runner *r, ID3D10Blob_Release(vs_code); ID3D10Blob_Release(ps_code); free(input_element_descs); - if (!pso) - return; vkd3d_array_reserve((void **)&test_context->pso, &test_context->pso_capacity, test_context->pso_count + 1, sizeof(*test_context->pso)); test_context->pso[test_context->pso_count++] = pso; @@ -303,6 +301,8 @@ static void d3d12_runner_draw(struct shader_runner *r, exec_command_list(queue, command_list); wait_queue_idle(device, queue); reset_command_list(command_list, test_context->allocator); + + return true; }
static void d3d12_runner_probe_vec4(struct shader_runner *r, diff --git a/tests/shader_runner_d3d9.c b/tests/shader_runner_d3d9.c index a4e8938a..f2875d42 100644 --- a/tests/shader_runner_d3d9.c +++ b/tests/shader_runner_d3d9.c @@ -308,7 +308,7 @@ static D3DDECLUSAGE vertex_decl_usage_from_name(const char *name) fatal_error("Cannot translate usage "%s" to a d3d9 usage.\n", name); }
-static void d3d9_runner_draw(struct shader_runner *r, +static bool d3d9_runner_draw(struct shader_runner *r, D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count) { static const D3DVERTEXELEMENT9 decl_element_end = D3DDECL_END(); @@ -323,12 +323,12 @@ static void d3d9_runner_draw(struct shader_runner *r, HRESULT hr;
if (!(vs_code = compile_shader(runner->r.vs_source, "vs_2_0"))) - return; + return false;
if (!(ps_code = compile_shader(runner->r.ps_source, "ps_2_0"))) { ID3D10Blob_Release(vs_code); - return; + return false; }
if (runner->r.uniform_count) @@ -445,6 +445,8 @@ static void d3d9_runner_draw(struct shader_runner *r, IDirect3DVertexDeclaration9_Release(vertex_declaration); IDirect3DVertexShader9_Release(vs); IDirect3DPixelShader9_Release(ps); + + return true; }
struct resource_readback diff --git a/tests/shader_runner_vulkan.c b/tests/shader_runner_vulkan.c index 9728f192..b008c8e7 100644 --- a/tests/shader_runner_vulkan.c +++ b/tests/shader_runner_vulkan.c @@ -754,7 +754,7 @@ static void bind_resources(struct vulkan_shader_runner *runner, VkPipelineBindPo /* The descriptor set will be freed by resetting the descriptor pool. */ }
-static void vulkan_runner_draw(struct shader_runner *r, +static bool vulkan_runner_draw(struct shader_runner *r, D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count) { struct vulkan_shader_runner *runner = vulkan_shader_runner(r); @@ -768,6 +768,7 @@ static void vulkan_runner_draw(struct shader_runner *r, VkDevice device = runner->device; VkClearRect clear_rect; VkPipeline pipeline; + bool ret = true; unsigned int i;
/* Create this before compiling shaders, it will assign resource bindings. */ @@ -775,7 +776,10 @@ static void vulkan_runner_draw(struct shader_runner *r,
pipeline_layout = create_pipeline_layout(runner, set_layout); if (!(pipeline = create_pipeline(runner, pipeline_layout, primitive_topology))) + { + ret = false; goto out; + }
begin_command_buffer(runner);
@@ -813,6 +817,8 @@ out:
VK_CALL(vkDestroyPipelineLayout(device, pipeline_layout, NULL)); VK_CALL(vkDestroyDescriptorSetLayout(device, set_layout, NULL)); + + return ret; }
static const struct vec4 *get_readback_vec4(const uint8_t *data, unsigned int row_pitch, unsigned int x, unsigned int y)
From: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- tests/shader_runner.c | 5 +++++ tests/shader_runner.h | 2 ++ tests/shader_runner_d3d12.c | 20 ++++++++++++-------- tests/shader_runner_vulkan.c | 13 +++++++------ 4 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 2a661122..a97a8ee6 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -343,6 +343,11 @@ static void set_uniforms(struct shader_runner *runner, size_t offset, size_t cou
static void parse_test_directive(struct shader_runner *runner, const char *line) { + runner->is_todo = false; + + if (match_string(line, "todo", &line)) + runner->is_todo = true; + if (match_string(line, "draw quad", &line)) { struct resource_params params; diff --git a/tests/shader_runner.h b/tests/shader_runner.h index 2af2259a..9685eaa3 100644 --- a/tests/shader_runner.h +++ b/tests/shader_runner.h @@ -94,6 +94,8 @@ struct shader_runner { const struct shader_runner_ops *ops;
+ bool is_todo; + char *vs_source; char *ps_source; enum shader_model minimum_shader_model; diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index b94f5ee6..1fa2a461 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c @@ -52,7 +52,7 @@ static struct d3d12_shader_runner *d3d12_shader_runner(struct shader_runner *r) return CONTAINING_RECORD(r, struct d3d12_shader_runner, r); }
-static ID3D10Blob *compile_shader(const char *source, const char *type, enum shader_model shader_model) +static ID3D10Blob *compile_shader(const struct d3d12_shader_runner *runner, const char *source, const char *type) { ID3D10Blob *blob = NULL, *errors = NULL; char profile[7]; @@ -67,9 +67,9 @@ static ID3D10Blob *compile_shader(const char *source, const char *type, enum sha [SHADER_MODEL_5_1] = "5_1", };
- sprintf(profile, "%s_%s", type, shader_models[shader_model]); + sprintf(profile, "%s_%s", type, shader_models[runner->r.minimum_shader_model]); hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", profile, 0, 0, &blob, &errors); - ok(hr == S_OK, "Failed to compile shader, hr %#x.\n", hr); + ok(FAILED(hr) == !blob, "Got unexpected hr %#x, blob %p.\n", hr, blob); if (errors) { if (vkd3d_test_state.debug_level) @@ -154,12 +154,16 @@ static bool d3d12_runner_draw(struct shader_runner *r, HRESULT hr; size_t i;
- if (!(ps_code = compile_shader(runner->r.ps_source, "ps", runner->r.minimum_shader_model))) - return false; + ps_code = compile_shader(runner, runner->r.ps_source, "ps"); + vs_code = compile_shader(runner, runner->r.vs_source, "vs"); + todo_if (runner->r.is_todo) ok(ps_code && vs_code, "Failed to compile shaders.\n");
- if (!(vs_code = compile_shader(runner->r.vs_source, "vs", runner->r.minimum_shader_model))) + if (!ps_code || !vs_code) { - ID3D10Blob_Release(ps_code); + if (ps_code) + ID3D10Blob_Release(ps_code); + if (vs_code) + ID3D10Blob_Release(vs_code); return false; }
@@ -316,7 +320,7 @@ static void d3d12_runner_probe_vec4(struct shader_runner *r, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); get_texture_readback_with_command_list(test_context->render_target, 0, &rb, test_context->queue, test_context->list); - check_readback_data_vec4(&rb, rect, v, ulps); + todo_if (runner->r.is_todo) check_readback_data_vec4(&rb, rect, v, ulps); release_resource_readback(&rb); reset_command_list(test_context->list, test_context->allocator); transition_resource_state(test_context->list, test_context->render_target, diff --git a/tests/shader_runner_vulkan.c b/tests/shader_runner_vulkan.c index b008c8e7..4a30ea85 100644 --- a/tests/shader_runner_vulkan.c +++ b/tests/shader_runner_vulkan.c @@ -350,7 +350,6 @@ static bool compile_shader(const struct vulkan_shader_runner *runner, const char hlsl_info.profile = profile;
ret = vkd3d_shader_compile(&info, dxbc, &messages); - ok(!ret, "Failed to compile shader, error %d.\n", ret); if (messages && vkd3d_test_state.debug_level) trace("%s\n", messages); vkd3d_shader_free_messages(messages); @@ -413,7 +412,6 @@ static bool compile_shader(const struct vulkan_shader_runner *runner, const char interface_info.push_constant_buffers = &push_constants;
ret = vkd3d_shader_compile(&info, spirv, &messages); - ok(!ret, "Failed to compile shader, error %d.\n", ret); if (messages && vkd3d_test_state.debug_level) trace("%s\n", messages); vkd3d_shader_free_messages(messages); @@ -514,11 +512,14 @@ static VkPipeline create_pipeline(const struct vulkan_shader_runner *runner, unsigned int i, j; int ret;
- if (!create_shader_stage(runner, &stage_desc[0], "vs", VK_SHADER_STAGE_VERTEX_BIT, runner->r.vs_source, &vs_dxbc)) - return VK_NULL_HANDLE; - if (!create_shader_stage(runner, &stage_desc[1], "ps", VK_SHADER_STAGE_FRAGMENT_BIT, runner->r.ps_source, NULL)) + memset(stage_desc, 0, sizeof(stage_desc)); + ret = create_shader_stage(runner, &stage_desc[0], "vs", VK_SHADER_STAGE_VERTEX_BIT, runner->r.vs_source, &vs_dxbc) + && create_shader_stage(runner, &stage_desc[1], "ps", VK_SHADER_STAGE_FRAGMENT_BIT, runner->r.ps_source, NULL); + todo_if (runner->r.is_todo) ok(ret, "Failed to compile shaders.\n"); + if (!ret) { VK_CALL(vkDestroyShaderModule(device, stage_desc[0].module, NULL)); + VK_CALL(vkDestroyShaderModule(device, stage_desc[1].module, NULL)); return VK_NULL_HANDLE; }
@@ -886,7 +887,7 @@ static void vulkan_runner_probe_vec4(struct shader_runner *r, const RECT *rect, end_command_buffer(runner);
VK_CALL(vkMapMemory(device, memory, 0, VK_WHOLE_SIZE, 0, &data)); - check_readback_data_vec4(data, row_pitch, rect, v, ulps); + todo_if (runner->r.is_todo) check_readback_data_vec4(data, row_pitch, rect, v, ulps); VK_CALL(vkUnmapMemory(device, memory));
VK_CALL(vkFreeMemory(device, memory, NULL));
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- Makefile.am | 37 +---------------- tests/arithmetic-float.shader_test | 2 +- tests/arithmetic-int.shader_test | 4 +- tests/cast-to-float.shader_test | 2 +- tests/cast-to-half.shader_test | 2 +- tests/cast-to-int.shader_test | 2 +- tests/cast-to-uint.shader_test | 4 +- tests/hlsl-array-dimension.shader_test | 2 +- tests/hlsl-duplicate-modifiers.shader_test | 2 +- tests/hlsl-for.shader_test | 2 +- tests/hlsl-function-cast.shader_test | 8 ++-- tests/hlsl-function-overload.shader_test | 2 +- tests/hlsl-function.shader_test | 4 +- tests/hlsl-gather.shader_test | 2 +- tests/hlsl-initializer-flatten.shader_test | 10 ++--- ...-initializer-invalid-arg-count.shader_test | 4 +- .../hlsl-initializer-local-array.shader_test | 4 +- tests/hlsl-initializer-nested.shader_test | 6 +-- tests/hlsl-initializer-numeric.shader_test | 8 ++-- .../hlsl-initializer-static-array.shader_test | 4 +- tests/hlsl-initializer-struct.shader_test | 6 +-- tests/hlsl-intrinsic-override.shader_test | 4 +- tests/hlsl-majority-pragma.shader_test | 2 +- tests/hlsl-majority-typedef.shader_test | 2 +- tests/hlsl-mul.shader_test | 36 ++++++++--------- ...numeric-constructor-truncation.shader_test | 2 +- tests/hlsl-numeric-types.shader_test | 4 +- ...lsl-return-implicit-conversion.shader_test | 28 ++++++------- tests/hlsl-return-void.shader_test | 2 +- tests/hlsl-shape.shader_test | 40 +++++++++---------- tests/hlsl-static-initializer.shader_test | 2 +- tests/hlsl-storage-qualifiers.shader_test | 2 +- .../hlsl-vector-indexing-uniform.shader_test | 2 +- tests/hlsl-vector-indexing.shader_test | 2 +- tests/logic-operations.shader_test | 24 +++++------ tests/sampler-offset.shader_test | 6 +-- tests/trigonometry.shader_test | 2 +- 37 files changed, 121 insertions(+), 156 deletions(-)
diff --git a/Makefile.am b/Makefile.am index e2a35576..d57ea2b7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -317,43 +317,8 @@ tests_vkd3d_api_LDADD = libvkd3d.la @VULKAN_LIBS@ tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la SHADER_TEST_LOG_COMPILER = tests/shader_runner XFAIL_TESTS = \ - tests/arithmetic-float.shader_test \ - tests/arithmetic-int.shader_test \ - tests/cast-to-float.shader_test \ - tests/cast-to-half.shader_test \ - tests/cast-to-int.shader_test \ - tests/cast-to-uint.shader_test \ - tests/hlsl-array-dimension.shader_test \ - tests/hlsl-initializer-flatten.shader_test \ - tests/hlsl-initializer-invalid-arg-count.shader_test \ - tests/hlsl-initializer-local-array.shader_test \ - tests/hlsl-initializer-nested.shader_test \ - tests/hlsl-initializer-numeric.shader_test \ - tests/hlsl-initializer-static-array.shader_test \ - tests/hlsl-initializer-struct.shader_test \ - tests/hlsl-duplicate-modifiers.shader_test \ - tests/hlsl-for.shader_test \ tests/hlsl-function.shader_test \ - tests/hlsl-function-cast.shader_test \ - tests/hlsl-function-overload.shader_test \ - tests/hlsl-gather.shader_test \ - tests/hlsl-intrinsic-override.shader_test \ - tests/hlsl-majority-pragma.shader_test \ - tests/hlsl-majority-typedef.shader_test \ - tests/hlsl-mul.shader_test \ - tests/hlsl-numeric-constructor-truncation.shader_test \ - tests/hlsl-numeric-types.shader_test \ - tests/hlsl-return-implicit-conversion.shader_test \ - tests/hlsl-return-void.shader_test \ - tests/hlsl-shape.shader_test \ - tests/hlsl-static-initializer.shader_test \ - tests/hlsl-storage-qualifiers.shader_test \ - tests/hlsl-vector-indexing.shader_test \ - tests/hlsl-vector-indexing-uniform.shader_test \ - tests/logic-operations.shader_test \ - tests/max.shader_test \ - tests/sampler-offset.shader_test \ - tests/trigonometry.shader_test + tests/hlsl-return-implicit-conversion.shader_test endif
EXTRA_DIST += $(vkd3d_shader_tests) diff --git a/tests/arithmetic-float.shader_test b/tests/arithmetic-float.shader_test index dcda1bcf..d55dc9d4 100644 --- a/tests/arithmetic-float.shader_test +++ b/tests/arithmetic-float.shader_test @@ -21,5 +21,5 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (5.0, 5.0, -5.0, 3.0) diff --git a/tests/arithmetic-int.shader_test b/tests/arithmetic-int.shader_test index 959f9403..5d9cc029 100644 --- a/tests/arithmetic-int.shader_test +++ b/tests/arithmetic-int.shader_test @@ -8,7 +8,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (20.0, -10.0, 75.0, 0.0)
[pixel shader] @@ -21,5 +21,5 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (5.0, 5.0, -5.0, 3.0) diff --git a/tests/cast-to-float.shader_test b/tests/cast-to-float.shader_test index f0910020..1844b1f3 100644 --- a/tests/cast-to-float.shader_test +++ b/tests/cast-to-float.shader_test @@ -12,7 +12,7 @@ uniform 0 int -1 uniform 1 uint 3 uniform 2 int -2 uniform 3 float 0.5 -draw quad +todo draw quad probe all rgba (0.5, 0.5, 0.5, 0.5)
[pixel shader] diff --git a/tests/cast-to-half.shader_test b/tests/cast-to-half.shader_test index 81d6bc5d..ffae9556 100644 --- a/tests/cast-to-half.shader_test +++ b/tests/cast-to-half.shader_test @@ -13,7 +13,7 @@ uniform 0 int -1 uniform 1 uint 3 uniform 2 int -2 uniform 3 float 0.5 -draw quad +todo draw quad probe all rgba (0.5, 0.5, 0.5, 0.5)
[pixel shader] diff --git a/tests/cast-to-int.shader_test b/tests/cast-to-int.shader_test index fe8c79a3..ce42827b 100644 --- a/tests/cast-to-int.shader_test +++ b/tests/cast-to-int.shader_test @@ -19,7 +19,7 @@ uniform 0 float 2.6 uniform 1 int -2 uniform 2 int -2 uniform 3 float -3.6 -draw quad +todo draw quad probe all rgba (0.5, 0.5, 0.5, 0.5)
[pixel shader] diff --git a/tests/cast-to-uint.shader_test b/tests/cast-to-uint.shader_test index 93862a36..8b7964ff 100644 --- a/tests/cast-to-uint.shader_test +++ b/tests/cast-to-uint.shader_test @@ -19,7 +19,7 @@ uniform 0 float 2.6 uniform 1 int 2 uniform 2 int -2 uniform 3 float -3.6 -draw quad +todo draw quad probe all rgba (0.5, 0.5, 0.5, 0.5)
[pixel shader] @@ -41,4 +41,4 @@ float4 main() : sv_target
[test] draw quad -probe all rgba (0.5, 0.5, 0.5, 0.5) +todo probe all rgba (0.5, 0.5, 0.5, 0.5) diff --git a/tests/hlsl-array-dimension.shader_test b/tests/hlsl-array-dimension.shader_test index 469d36bf..89aae017 100644 --- a/tests/hlsl-array-dimension.shader_test +++ b/tests/hlsl-array-dimension.shader_test @@ -13,5 +13,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.1, 0.1, 0.2, 0.4) diff --git a/tests/hlsl-duplicate-modifiers.shader_test b/tests/hlsl-duplicate-modifiers.shader_test index 6491701a..fcae12da 100644 --- a/tests/hlsl-duplicate-modifiers.shader_test +++ b/tests/hlsl-duplicate-modifiers.shader_test @@ -7,5 +7,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.1, 0.2, 0.3, 0.4) diff --git a/tests/hlsl-for.shader_test b/tests/hlsl-for.shader_test index 4e91ce41..4e5048c3 100644 --- a/tests/hlsl-for.shader_test +++ b/tests/hlsl-for.shader_test @@ -22,7 +22,7 @@ float4 main(float tex : texcoord) : sv_target }
[test] -draw quad +todo draw quad probe rect rgba ( 0, 0, 159, 480) (10.0, 35.0, 0.0, 0.0) probe rect rgba (161, 0, 479, 480) (10.0, 38.0, 0.0, 0.0) probe rect rgba (481, 0, 640, 480) ( 5.0, 10.0, 0.0, 0.0) diff --git a/tests/hlsl-function-cast.shader_test b/tests/hlsl-function-cast.shader_test index 41c452e5..ae6d1499 100644 --- a/tests/hlsl-function-cast.shader_test +++ b/tests/hlsl-function-cast.shader_test @@ -18,7 +18,7 @@ float4 main() : sv_target
[test] uniform 0 float4 -1.9 -1.0 2.9 4.0 -draw quad +todo draw quad probe all rgba (-1.0, -1.0, 2.0, 4.0)
% As above, but cast "x" to float4 first. @@ -41,7 +41,7 @@ float4 main() : sv_target
[test] uniform 0 float4 -1.9 -1.0 2.9 4.0 -draw quad +todo draw quad probe all rgba (-1.0, -1.0, 2.0, 4.0)
% As above, but declare "x" as float4 and cast it to int4. @@ -64,7 +64,7 @@ float4 main() : sv_target
[test] uniform 0 float4 -1.9 -1.0 2.9 4.0 -draw quad +todo draw quad probe all rgba (-1.0, -1.0, 2.0, 4.0)
[require] @@ -86,5 +86,5 @@ float4 main(uniform int4 i) : sv_target
[test] uniform 0 int4 -2 0 1 -3000000 -draw quad +todo draw quad probe all rgba (-1.0, 0.0, 1.0, -3000000.0) diff --git a/tests/hlsl-function-overload.shader_test b/tests/hlsl-function-overload.shader_test index c6e0ccfe..2410cecc 100644 --- a/tests/hlsl-function-overload.shader_test +++ b/tests/hlsl-function-overload.shader_test @@ -36,5 +36,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.1, 0.2, 0.1, 0.2) diff --git a/tests/hlsl-function.shader_test b/tests/hlsl-function.shader_test index 8d17605b..586f1ab7 100644 --- a/tests/hlsl-function.shader_test +++ b/tests/hlsl-function.shader_test @@ -139,7 +139,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.5, 0.6, 0.7, 0)
[pixel shader] @@ -160,5 +160,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.6, 0.1, 0.5, 0) diff --git a/tests/hlsl-gather.shader_test b/tests/hlsl-gather.shader_test index 57af23d0..be717cd9 100644 --- a/tests/hlsl-gather.shader_test +++ b/tests/hlsl-gather.shader_test @@ -83,7 +83,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.1, 0.1, 0.0, 0.0)
diff --git a/tests/hlsl-initializer-flatten.shader_test b/tests/hlsl-initializer-flatten.shader_test index 6b35c6b7..439ead5e 100644 --- a/tests/hlsl-initializer-flatten.shader_test +++ b/tests/hlsl-initializer-flatten.shader_test @@ -6,7 +6,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (1, 2, 3, 4)
@@ -24,7 +24,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (4, 5, 6, 7)
@@ -37,7 +37,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (40, 10, 20, 30)
@@ -56,7 +56,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (1.0, 2.0, 3.0, 4.0)
@@ -69,5 +69,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) diff --git a/tests/hlsl-initializer-invalid-arg-count.shader_test b/tests/hlsl-initializer-invalid-arg-count.shader_test index 4332fbe8..acd449af 100644 --- a/tests/hlsl-initializer-invalid-arg-count.shader_test +++ b/tests/hlsl-initializer-invalid-arg-count.shader_test @@ -10,7 +10,7 @@ float4 main() : sv_target
[test] draw quad -probe all rgba (17, 18, 19, 20) +todo probe all rgba (17, 18, 19, 20)
[pixel shader fail] @@ -57,7 +57,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (22, 23, 24, 25)
diff --git a/tests/hlsl-initializer-local-array.shader_test b/tests/hlsl-initializer-local-array.shader_test index 0862d4c9..13670dc6 100644 --- a/tests/hlsl-initializer-local-array.shader_test +++ b/tests/hlsl-initializer-local-array.shader_test @@ -11,7 +11,7 @@ float4 main() : SV_TARGET
[test] draw quad -probe all rgba (21, 22, 23, 24) +todo probe all rgba (21, 22, 23, 24)
[pixel shader] @@ -32,4 +32,4 @@ float4 main() : SV_TARGET
[test] draw quad -probe all rgba (71, 72, 73, 74) +todo probe all rgba (71, 72, 73, 74) diff --git a/tests/hlsl-initializer-nested.shader_test b/tests/hlsl-initializer-nested.shader_test index b00259c9..0204afc9 100644 --- a/tests/hlsl-initializer-nested.shader_test +++ b/tests/hlsl-initializer-nested.shader_test @@ -6,7 +6,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (1, 2, 3, 4)
@@ -24,7 +24,7 @@ float4 main() : sv_target
[test] draw quad -probe all rgba (21, 22, 23, 24) +todo probe all rgba (21, 22, 23, 24)
[pixel shader] @@ -52,5 +52,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (21, 22, 23, 24) diff --git a/tests/hlsl-initializer-numeric.shader_test b/tests/hlsl-initializer-numeric.shader_test index 40576887..92117591 100644 --- a/tests/hlsl-initializer-numeric.shader_test +++ b/tests/hlsl-initializer-numeric.shader_test @@ -6,7 +6,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) 4
@@ -18,7 +18,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) 4
@@ -31,7 +31,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) 4
@@ -44,5 +44,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (10.1, 1.1, 1.2, 2.1) 4 diff --git a/tests/hlsl-initializer-static-array.shader_test b/tests/hlsl-initializer-static-array.shader_test index 57733502..f276c629 100644 --- a/tests/hlsl-initializer-static-array.shader_test +++ b/tests/hlsl-initializer-static-array.shader_test @@ -12,7 +12,7 @@ float4 main() : SV_TARGET
[test] draw quad -probe all rgba (21, 22, 23, 24) +todo probe all rgba (21, 22, 23, 24)
[pixel shader] @@ -34,4 +34,4 @@ float4 main() : SV_TARGET
[test] draw quad -probe all rgba (61, 62, 63, 64) +todo probe all rgba (61, 62, 63, 64) diff --git a/tests/hlsl-initializer-struct.shader_test b/tests/hlsl-initializer-struct.shader_test index f4028b5b..2a824e23 100644 --- a/tests/hlsl-initializer-struct.shader_test +++ b/tests/hlsl-initializer-struct.shader_test @@ -22,7 +22,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (41, 42, 43, 44)
@@ -52,7 +52,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (4311, 4312, 4313, 4314)
@@ -80,5 +80,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (21, 22, 23, 24) diff --git a/tests/hlsl-intrinsic-override.shader_test b/tests/hlsl-intrinsic-override.shader_test index 55a23f21..a47f8176 100644 --- a/tests/hlsl-intrinsic-override.shader_test +++ b/tests/hlsl-intrinsic-override.shader_test @@ -11,7 +11,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.3, 0.3, 0.4, 0.6)
[pixel shader] @@ -27,5 +27,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.3, 0.3, 0.3, 0.4) diff --git a/tests/hlsl-majority-pragma.shader_test b/tests/hlsl-majority-pragma.shader_test index e7fc75cd..a9f917ff 100644 --- a/tests/hlsl-majority-pragma.shader_test +++ b/tests/hlsl-majority-pragma.shader_test @@ -17,5 +17,5 @@ uniform 0 float4 0.1 0.2 0.0 0.0 uniform 4 float4 0.3 0.4 0.0 0.0 uniform 8 float4 0.1 0.3 0.0 0.0 uniform 12 float4 0.2 0.4 0.0 0.0 -draw quad +todo draw quad probe all rgba (0.17, 0.39, 0.17, 0.39) 1 diff --git a/tests/hlsl-majority-typedef.shader_test b/tests/hlsl-majority-typedef.shader_test index 1460e9a0..192c96db 100644 --- a/tests/hlsl-majority-typedef.shader_test +++ b/tests/hlsl-majority-typedef.shader_test @@ -18,5 +18,5 @@ uniform 0 float4 0.1 0.2 0.0 0.0 uniform 4 float4 0.3 0.4 0.0 0.0 uniform 8 float4 0.1 0.3 0.0 0.0 uniform 12 float4 0.2 0.4 0.0 0.0 -draw quad +todo draw quad probe all rgba (0.17, 0.39, 0.17, 0.39) 1 diff --git a/tests/hlsl-mul.shader_test b/tests/hlsl-mul.shader_test index 7b453187..1d137e69 100644 --- a/tests/hlsl-mul.shader_test +++ b/tests/hlsl-mul.shader_test @@ -12,7 +12,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (30.0, 70.0, 110.0, 150.0)
[pixel shader] @@ -28,7 +28,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (90.0, 100.0, 110.0, 120.0)
[pixel shader] @@ -44,7 +44,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (14.0, 38.0, 62.0, 86.0)
[pixel shader] @@ -60,7 +60,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (38.0, 44.0, 50.0, 56.0)
[pixel shader] @@ -75,7 +75,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (14.0, 32.0, 50.0, 0.0)
[pixel shader] @@ -90,7 +90,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (30.0, 36.0, 42.0, 0.0)
[pixel shader] @@ -106,7 +106,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (50.0, 60.0, 70.0, 80.0)
[pixel shader] @@ -122,7 +122,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (50.0, 60.0, 70.0, 80.0)
[pixel shader] @@ -138,7 +138,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (10.0, 20.0, 30.0, 40.0)
[pixel shader] @@ -154,7 +154,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (10.0, 50.0, 90.0, 130.0)
[pixel shader] @@ -170,7 +170,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (10.0, 20.0, 30.0, 40.0)
[pixel shader] @@ -186,7 +186,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (10.0, 50.0, 90.0, 130.0)
[pixel shader] @@ -202,7 +202,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (90.0, 100.0, 110.0, 120.0)
[pixel shader] @@ -218,7 +218,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (5.0, 10.0, 15.0, 20.0)
[pixel shader] @@ -234,7 +234,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 6.0, 8.0)
[pixel shader] @@ -250,7 +250,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (30.0, 70.0, 110.0, 150.0)
[pixel shader] @@ -268,7 +268,7 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (83.0, 98.0, 113.0, 128.0)
[pixel shader] @@ -286,5 +286,5 @@ float4 main(float4 pos : sv_position) : sv_target }
[test] -draw quad +todo draw quad probe all rgba (78.0, 96.0, 114.0, 0.0) diff --git a/tests/hlsl-numeric-constructor-truncation.shader_test b/tests/hlsl-numeric-constructor-truncation.shader_test index f18b34d6..27768dcc 100644 --- a/tests/hlsl-numeric-constructor-truncation.shader_test +++ b/tests/hlsl-numeric-constructor-truncation.shader_test @@ -29,5 +29,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (1.0, 2.0, 3.0, 5.0) diff --git a/tests/hlsl-numeric-types.shader_test b/tests/hlsl-numeric-types.shader_test index 7504f95a..58612191 100644 --- a/tests/hlsl-numeric-types.shader_test +++ b/tests/hlsl-numeric-types.shader_test @@ -56,7 +56,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (5.0, 6.0, 7.0, 8.0)
[pixel shader] @@ -68,7 +68,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (5.0, 6.0, 7.0, 0.0)
[pixel shader fail] diff --git a/tests/hlsl-return-implicit-conversion.shader_test b/tests/hlsl-return-implicit-conversion.shader_test index 654b51cf..4c07cf84 100644 --- a/tests/hlsl-return-implicit-conversion.shader_test +++ b/tests/hlsl-return-implicit-conversion.shader_test @@ -5,7 +5,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.1)
[pixel shader] @@ -15,7 +15,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.1)
[pixel shader] @@ -25,7 +25,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.1)
[pixel shader] @@ -35,7 +35,7 @@ float4x1 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.1)
[pixel shader] @@ -50,7 +50,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.0)
[pixel shader] @@ -65,7 +65,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.0)
[pixel shader] @@ -80,7 +80,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.0)
[pixel shader] @@ -95,7 +95,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.0)
[pixel shader fail] @@ -132,7 +132,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.0)
[pixel shader] @@ -147,7 +147,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.0)
[pixel shader] @@ -162,7 +162,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.0)
[pixel shader fail] @@ -188,7 +188,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.0)
[pixel shader fail] @@ -214,7 +214,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.0)
[pixel shader fail] @@ -240,5 +240,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.4, 0.3, 0.2, 0.0) diff --git a/tests/hlsl-return-void.shader_test b/tests/hlsl-return-void.shader_test index 1948ec51..d7231d6c 100644 --- a/tests/hlsl-return-void.shader_test +++ b/tests/hlsl-return-void.shader_test @@ -8,4 +8,4 @@ void main(out float4 ret : sv_target)
[test] draw quad -probe all rgba (0.1, 0.2, 0.3, 0.4) +todo probe all rgba (0.1, 0.2, 0.3, 0.4) diff --git a/tests/hlsl-shape.shader_test b/tests/hlsl-shape.shader_test index b96f0fd2..57d59534 100644 --- a/tests/hlsl-shape.shader_test +++ b/tests/hlsl-shape.shader_test @@ -93,7 +93,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 7.0, 9.0)
[pixel shader] @@ -107,7 +107,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 7.0, 9.0)
[pixel shader] @@ -122,7 +122,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 6.0, 8.0)
[pixel shader] @@ -137,7 +137,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 6.0, 8.0)
[pixel shader] @@ -152,7 +152,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 7.0, 12.0, 17.0)
[pixel shader] @@ -167,7 +167,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 7.0, 12.0, 17.0)
[pixel shader] @@ -183,7 +183,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 6.0, 0.0)
[pixel shader] @@ -199,7 +199,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (9.0, 11.0, 13.0, 0.0)
[pixel shader] @@ -211,7 +211,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 6.0, 8.0)
[pixel shader] @@ -223,7 +223,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 6.0, 8.0)
[pixel shader] @@ -235,7 +235,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 6.0, 8.0)
[pixel shader] @@ -247,7 +247,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 6.0, 8.0)
[pixel shader] @@ -260,7 +260,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 6.0, 8.0)
[pixel shader] @@ -273,7 +273,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 6.0, 8.0)
[pixel shader] @@ -285,7 +285,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 3.0, 4.0, 5.0)
[pixel shader] @@ -297,7 +297,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 3.0, 4.0, 5.0)
[pixel shader] @@ -309,7 +309,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 0.0, 0.0)
[pixel shader] @@ -321,7 +321,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 4.0, 0.0, 0.0)
[pixel shader] @@ -336,7 +336,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (2.0, 3.0, 4.0, 5.0)
[pixel shader] @@ -351,5 +351,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (6.0, 7.0, 8.0, 9.0) diff --git a/tests/hlsl-static-initializer.shader_test b/tests/hlsl-static-initializer.shader_test index 9c486512..d8b85385 100644 --- a/tests/hlsl-static-initializer.shader_test +++ b/tests/hlsl-static-initializer.shader_test @@ -12,5 +12,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.8, 0.0, 0.0, 0.0) diff --git a/tests/hlsl-storage-qualifiers.shader_test b/tests/hlsl-storage-qualifiers.shader_test index 00e7b836..4c590ceb 100644 --- a/tests/hlsl-storage-qualifiers.shader_test +++ b/tests/hlsl-storage-qualifiers.shader_test @@ -17,5 +17,5 @@ void main(in uniform float4 a, uniform float4 b, out float4 o : sv_target) [test] uniform 0 float4 0.1 0.0 0.0 0.0 uniform 4 float4 0.2 0.0 0.0 0.0 -draw quad +todo draw quad probe all rgba (0.1, 0.2, 0.3, 0.4) diff --git a/tests/hlsl-vector-indexing-uniform.shader_test b/tests/hlsl-vector-indexing-uniform.shader_test index e5ffbdd0..f6991040 100644 --- a/tests/hlsl-vector-indexing-uniform.shader_test +++ b/tests/hlsl-vector-indexing-uniform.shader_test @@ -12,5 +12,5 @@ float4 main() : SV_TARGET
[test] uniform 0 float 2 -draw quad +todo draw quad probe all rgba (0.5, 0.3, 0.8, 0.2) diff --git a/tests/hlsl-vector-indexing.shader_test b/tests/hlsl-vector-indexing.shader_test index b641d7f9..f46377cf 100644 --- a/tests/hlsl-vector-indexing.shader_test +++ b/tests/hlsl-vector-indexing.shader_test @@ -10,5 +10,5 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.02, 0.245, 0.351, 1.0) diff --git a/tests/logic-operations.shader_test b/tests/logic-operations.shader_test index 360ca03b..9a5cec3f 100644 --- a/tests/logic-operations.shader_test +++ b/tests/logic-operations.shader_test @@ -8,7 +8,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader] @@ -22,7 +22,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader] @@ -35,7 +35,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader] @@ -48,7 +48,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader] @@ -61,7 +61,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader] @@ -75,7 +75,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader] @@ -88,7 +88,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader] @@ -101,7 +101,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader] @@ -114,7 +114,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 1.0, 1.0, 1.0)
[pixel shader] @@ -128,7 +128,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader] @@ -141,7 +141,7 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 0.0, 0.0, 1.0)
[pixel shader] @@ -154,5 +154,5 @@ float4 main() : SV_TARGET }
[test] -draw quad +todo draw quad probe all rgba (0.0, 1.0, 1.0, 1.0) diff --git a/tests/sampler-offset.shader_test b/tests/sampler-offset.shader_test index 6f8357df..f47d5bff 100644 --- a/tests/sampler-offset.shader_test +++ b/tests/sampler-offset.shader_test @@ -22,7 +22,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.1, 0.2, 0.5, 0.0)
@@ -36,7 +36,7 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.2, 0.2, 0.0, 0.4)
@@ -50,5 +50,5 @@ float4 main() : sv_target }
[test] -draw quad +todo draw quad probe all rgba (0.0, 0.2, 0.0, 0.4) diff --git a/tests/trigonometry.shader_test b/tests/trigonometry.shader_test index cf53d7a1..e9ac3682 100644 --- a/tests/trigonometry.shader_test +++ b/tests/trigonometry.shader_test @@ -12,7 +12,7 @@ float4 main(float tex : texcoord) : sv_target }
[test] -draw quad +todo draw quad probe rgba ( 0, 0) ( 0.00000000, 1.00000000, 0.0, 0.0) probe rgba ( 1, 0) ( 0.84147098, 0.54030231, 0.0, 0.0) 1024 probe rgba ( 2, 0) ( 0.90929743, -0.41614684, 0.0, 0.0) 1024
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- tests/shader_runner.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/shader_runner.c b/tests/shader_runner.c index a97a8ee6..8633ee9a 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -651,12 +651,12 @@ void run_shader_tests(struct shader_runner *runner, int argc, char **argv, const ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); ok(!blob, "Expected no compiled shader blob.\n"); ok(!!errors, "Expected non-NULL error blob.\n"); - if (!errors) - return; - - if (vkd3d_test_state.debug_level) - trace("%s\n", (char *)ID3D10Blob_GetBufferPointer(errors)); - ID3D10Blob_Release(errors); + if (errors) + { + if (vkd3d_test_state.debug_level) + trace("%s\n", (char *)ID3D10Blob_GetBufferPointer(errors)); + ID3D10Blob_Release(errors); + }
shader_source_len = 0; break;
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- libs/vkd3d-shader/hlsl.y | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 1eb7d2ee..bdcdc780 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1447,7 +1447,7 @@ static bool add_increment(struct hlsl_ctx *ctx, struct list *instrs, bool decrem return true; }
-static void struct_var_initializer(struct hlsl_ctx *ctx, struct list *list, struct hlsl_ir_var *var, +static void struct_var_initializer(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, struct parse_initializer *initializer) { struct hlsl_type *type = var->data_type; @@ -1459,13 +1459,9 @@ static void struct_var_initializer(struct hlsl_ctx *ctx, struct list *list, stru hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT, "Expected %u components in initializer, but got %u.", hlsl_type_component_count(type), initializer_size(initializer)); - free_parse_initializer(initializer); return; }
- list_move_tail(list, initializer->instrs); - vkd3d_free(initializer->instrs); - LIST_FOR_EACH_ENTRY(field, type->e.elements, struct hlsl_struct_field, entry) { struct hlsl_ir_node *node = initializer->args[i]; @@ -1479,19 +1475,17 @@ static void struct_var_initializer(struct hlsl_ctx *ctx, struct list *list, stru { if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, &node->loc))) break; - list_add_tail(list, &c->node.entry); + list_add_tail(initializer->instrs, &c->node.entry);
if (!(store = hlsl_new_store(ctx, var, &c->node, node, 0, node->loc))) break; - list_add_tail(list, &store->node.entry); + list_add_tail(initializer->instrs, &store->node.entry); } else { hlsl_fixme(ctx, &node->loc, "Implicit cast in structure initializer."); } } - - vkd3d_free(initializer->args); }
static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_type, @@ -1649,7 +1643,10 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
if (type->type == HLSL_CLASS_STRUCT) { - struct_var_initializer(ctx, statements_list, var, &v->initializer); + struct_var_initializer(ctx, var, &v->initializer); + list_move_tail(statements_list, v->initializer.instrs); + + free_parse_initializer(&v->initializer); vkd3d_free(v); continue; }
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- libs/vkd3d-shader/hlsl.y | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index bdcdc780..f0a74826 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1644,11 +1644,6 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t if (type->type == HLSL_CLASS_STRUCT) { struct_var_initializer(ctx, var, &v->initializer); - list_move_tail(statements_list, v->initializer.instrs); - - free_parse_initializer(&v->initializer); - vkd3d_free(v); - continue; } else {
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Francisco Casas fcasas@codeweavers.com Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- libs/vkd3d-shader/hlsl.y | 47 ++++++++++++++++++++-- tests/hlsl-initializer-flatten.shader_test | 4 +- tests/hlsl-initializer-nested.shader_test | 2 +- tests/hlsl-initializer-numeric.shader_test | 8 ++-- 4 files changed, 50 insertions(+), 11 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index f0a74826..58d71ff6 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1447,6 +1447,39 @@ static bool add_increment(struct hlsl_ctx *ctx, struct list *instrs, bool decrem return true; }
+static void initialize_numeric_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, + struct parse_initializer *initializer, unsigned int reg_offset, struct hlsl_type *type, + unsigned int *initializer_offset) +{ + unsigned int i; + + if (type->type == HLSL_CLASS_MATRIX) + hlsl_fixme(ctx, &var->loc, "Matrix initializer."); + + for (i = 0; i < type->dimx; i++) + { + struct hlsl_ir_store *store; + struct hlsl_ir_constant *c; + struct hlsl_ir_node *node; + + node = initializer->args[*initializer_offset]; + *initializer_offset += 1; + + if (!(node = add_implicit_conversion(ctx, initializer->instrs, node, + hlsl_get_scalar_type(ctx, type->base_type), &node->loc))) + return; + + if (!(c = hlsl_new_uint_constant(ctx, reg_offset + i, &node->loc))) + return; + list_add_tail(initializer->instrs, &c->node.entry); + + if (!(store = hlsl_new_store(ctx, var, &c->node, node, 0, node->loc))) + return; + + list_add_tail(initializer->instrs, &store->node.entry); + } +} + static void struct_var_initializer(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, struct parse_initializer *initializer) { @@ -1612,6 +1645,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t if (v->initializer.braces) { unsigned int size = initializer_size(&v->initializer); + unsigned int initializer_offset = 0;
if (type->type <= HLSL_CLASS_LAST_NUMERIC && type->dimx * type->dimy != size) { @@ -1647,10 +1681,15 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t } else { - hlsl_fixme(ctx, &v->loc, "Complex initializer."); - free_parse_initializer(&v->initializer); - vkd3d_free(v); - continue; + if (v->initializer.args_count != size) + { + hlsl_fixme(ctx, &v->loc, "Flatten initializer."); + free_parse_initializer(&v->initializer); + vkd3d_free(v); + continue; + } + + initialize_numeric_var(ctx, var, &v->initializer, 0, type, &initializer_offset); } } else diff --git a/tests/hlsl-initializer-flatten.shader_test b/tests/hlsl-initializer-flatten.shader_test index 439ead5e..3a430e0d 100644 --- a/tests/hlsl-initializer-flatten.shader_test +++ b/tests/hlsl-initializer-flatten.shader_test @@ -37,8 +37,8 @@ float4 main() : sv_target }
[test] -todo draw quad -probe all rgba (40, 10, 20, 30) +draw quad +todo probe all rgba (40, 10, 20, 30)
[pixel shader] diff --git a/tests/hlsl-initializer-nested.shader_test b/tests/hlsl-initializer-nested.shader_test index 0204afc9..bcb37cf4 100644 --- a/tests/hlsl-initializer-nested.shader_test +++ b/tests/hlsl-initializer-nested.shader_test @@ -6,7 +6,7 @@ float4 main() : sv_target }
[test] -todo draw quad +draw quad probe all rgba (1, 2, 3, 4)
diff --git a/tests/hlsl-initializer-numeric.shader_test b/tests/hlsl-initializer-numeric.shader_test index 92117591..40576887 100644 --- a/tests/hlsl-initializer-numeric.shader_test +++ b/tests/hlsl-initializer-numeric.shader_test @@ -6,7 +6,7 @@ float4 main() : sv_target }
[test] -todo draw quad +draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) 4
@@ -18,7 +18,7 @@ float4 main() : sv_target }
[test] -todo draw quad +draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) 4
@@ -31,7 +31,7 @@ float4 main() : sv_target }
[test] -todo draw quad +draw quad probe all rgba (1.0, 2.0, 3.0, 4.0) 4
@@ -44,5 +44,5 @@ float4 main() : sv_target }
[test] -todo draw quad +draw quad probe all rgba (10.1, 1.1, 1.2, 2.1) 4
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
This commit includes work by Francisco Casas.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- libs/vkd3d-shader/hlsl_constant_ops.c | 67 ++++++++++++++++++++++++ libs/vkd3d-shader/vkd3d_shader_private.h | 2 + tests/arithmetic-float.shader_test | 16 ++++++ tests/arithmetic-int.shader_test | 11 +++- tests/arithmetic-uint.shader_test | 9 ++++ 5 files changed, 104 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d-shader/hlsl_constant_ops.c index 5cac4bde..9a8bc6b0 100644 --- a/libs/vkd3d-shader/hlsl_constant_ops.c +++ b/libs/vkd3d-shader/hlsl_constant_ops.c @@ -255,6 +255,69 @@ static bool fold_nequal(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, return true; }
+static bool fold_div(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, + struct hlsl_ir_constant *src1, struct hlsl_ir_constant *src2) +{ + enum hlsl_base_type type = dst->node.data_type->base_type; + unsigned int k; + + assert(type == src1->node.data_type->base_type); + assert(type == src2->node.data_type->base_type); + + for (k = 0; k < dst->node.data_type->dimx; ++k) + { + switch (type) + { + case HLSL_TYPE_FLOAT: + case HLSL_TYPE_HALF: + if (src2->value[k].f == 0) + { + hlsl_warning(ctx, &dst->node.loc, VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO, + "Floating point division by zero"); + } + dst->value[k].f = src1->value[k].f / src2->value[k].f; + break; + + case HLSL_TYPE_DOUBLE: + if (src2->value[k].d == 0) + { + hlsl_warning(ctx, &dst->node.loc, VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO, + "Floating point division by zero"); + } + dst->value[k].d = src1->value[k].d / src2->value[k].d; + break; + + case HLSL_TYPE_INT: + if (src2->value[k].i == 0) + { + hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO, + "Division by zero."); + return false; + } + if (src1->value[k].i == INT_MIN && src2->value[k].i == -1) + dst->value[k].i = INT_MIN; + else + dst->value[k].i = src1->value[k].i / src2->value[k].i; + break; + + case HLSL_TYPE_UINT: + if (src2->value[k].u == 0) + { + hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO, + "Division by zero."); + return false; + } + dst->value[k].u = src1->value[k].u / src2->value[k].u; + break; + + default: + FIXME("Fold division for type %s.\n", debug_hlsl_type(ctx, dst->node.data_type)); + return false; + } + } + return true; +} + bool hlsl_fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { struct hlsl_ir_constant *arg1, *arg2 = NULL, *res; @@ -308,6 +371,10 @@ bool hlsl_fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void success = fold_nequal(ctx, res, arg1, arg2); break;
+ case HLSL_OP2_DIV: + success = fold_div(ctx, res, arg1, arg2); + break; + default: FIXME("Fold "%s" expression.\n", debug_hlsl_expr_op(expr->op)); success = false; diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 21f23709..29e178cc 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -117,8 +117,10 @@ enum vkd3d_shader_error VKD3D_SHADER_ERROR_HLSL_INVALID_TEXEL_OFFSET = 5018, VKD3D_SHADER_ERROR_HLSL_OFFSET_OUT_OF_BOUNDS = 5019, VKD3D_SHADER_ERROR_HLSL_INCOMPATIBLE_PROFILE = 5020, + VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO = 5021,
VKD3D_SHADER_WARNING_HLSL_IMPLICIT_TRUNCATION = 5300, + VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO = 5301,
VKD3D_SHADER_ERROR_GLSL_INTERNAL = 6000,
diff --git a/tests/arithmetic-float.shader_test b/tests/arithmetic-float.shader_test index d55dc9d4..f99b9728 100644 --- a/tests/arithmetic-float.shader_test +++ b/tests/arithmetic-float.shader_test @@ -23,3 +23,19 @@ float4 main() : SV_TARGET [test] todo draw quad probe all rgba (5.0, 5.0, -5.0, 3.0) + +[require] +shader model >= 4.0 + +[pixel shader] +float4 main() : SV_TARGET +{ + float x = 1; + float y = 0; + + return x / y; +} + +[test] +draw quad +probe all rgba (1e99, 1e99, 1e99, 1e99) diff --git a/tests/arithmetic-int.shader_test b/tests/arithmetic-int.shader_test index 5d9cc029..c85b9a3a 100644 --- a/tests/arithmetic-int.shader_test +++ b/tests/arithmetic-int.shader_test @@ -8,7 +8,7 @@ float4 main() : SV_TARGET }
[test] -todo draw quad +draw quad probe all rgba (20.0, -10.0, 75.0, 0.0)
[pixel shader] @@ -23,3 +23,12 @@ float4 main() : SV_TARGET [test] todo draw quad probe all rgba (5.0, 5.0, -5.0, 3.0) + +[pixel shader fail] +float4 main() : SV_TARGET +{ + int x = 1; + int y = 0; + + return x / y; +} diff --git a/tests/arithmetic-uint.shader_test b/tests/arithmetic-uint.shader_test index b016dbb6..f37c881e 100644 --- a/tests/arithmetic-uint.shader_test +++ b/tests/arithmetic-uint.shader_test @@ -26,3 +26,12 @@ float4 main() : SV_TARGET [test] draw quad probe all rgba (5.0, 5.0, 4294967296.0, 3.0) + +[pixel shader fail] +float4 main() : SV_TARGET +{ + uint x = 1; + uint y = 0; + + return x / y; +}
Signed-off-by: Francisco Casas fcasas@codeweavers.com
April 14, 2022 6:53 AM, "Giovanni Mascellani" gmascellani@codeweavers.com wrote:
This commit includes work by Francisco Casas.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com
libs/vkd3d-shader/hlsl_constant_ops.c | 67 ++++++++++++++++++++++++ libs/vkd3d-shader/vkd3d_shader_private.h | 2 + tests/arithmetic-float.shader_test | 16 ++++++ tests/arithmetic-int.shader_test | 11 +++- tests/arithmetic-uint.shader_test | 9 ++++ 5 files changed, 104 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d-shader/hlsl_constant_ops.c index 5cac4bde..9a8bc6b0 100644 --- a/libs/vkd3d-shader/hlsl_constant_ops.c +++ b/libs/vkd3d-shader/hlsl_constant_ops.c @@ -255,6 +255,69 @@ static bool fold_nequal(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, return true; }
+static bool fold_div(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst,
- struct hlsl_ir_constant *src1, struct hlsl_ir_constant *src2)
+{
- enum hlsl_base_type type = dst->node.data_type->base_type;
- unsigned int k;
- assert(type == src1->node.data_type->base_type);
- assert(type == src2->node.data_type->base_type);
- for (k = 0; k < dst->node.data_type->dimx; ++k)
- {
- switch (type)
- {
- case HLSL_TYPE_FLOAT:
- case HLSL_TYPE_HALF:
- if (src2->value[k].f == 0)
- {
- hlsl_warning(ctx, &dst->node.loc, VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO,
- "Floating point division by zero");
- }
- dst->value[k].f = src1->value[k].f / src2->value[k].f;
- break;
- case HLSL_TYPE_DOUBLE:
- if (src2->value[k].d == 0)
- {
- hlsl_warning(ctx, &dst->node.loc, VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO,
- "Floating point division by zero");
- }
- dst->value[k].d = src1->value[k].d / src2->value[k].d;
- break;
- case HLSL_TYPE_INT:
- if (src2->value[k].i == 0)
- {
- hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO,
- "Division by zero.");
- return false;
- }
- if (src1->value[k].i == INT_MIN && src2->value[k].i == -1)
- dst->value[k].i = INT_MIN;
- else
- dst->value[k].i = src1->value[k].i / src2->value[k].i;
- break;
- case HLSL_TYPE_UINT:
- if (src2->value[k].u == 0)
- {
- hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO,
- "Division by zero.");
- return false;
- }
- dst->value[k].u = src1->value[k].u / src2->value[k].u;
- break;
- default:
- FIXME("Fold division for type %s.\n", debug_hlsl_type(ctx, dst->node.data_type));
- return false;
- }
- }
- return true;
+}
bool hlsl_fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { struct hlsl_ir_constant *arg1, *arg2 = NULL, *res; @@ -308,6 +371,10 @@ bool hlsl_fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void success = fold_nequal(ctx, res, arg1, arg2); break;
- case HLSL_OP2_DIV:
- success = fold_div(ctx, res, arg1, arg2);
- break;
default: FIXME("Fold "%s" expression.\n", debug_hlsl_expr_op(expr->op)); success = false; diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 21f23709..29e178cc 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -117,8 +117,10 @@ enum vkd3d_shader_error VKD3D_SHADER_ERROR_HLSL_INVALID_TEXEL_OFFSET = 5018, VKD3D_SHADER_ERROR_HLSL_OFFSET_OUT_OF_BOUNDS = 5019, VKD3D_SHADER_ERROR_HLSL_INCOMPATIBLE_PROFILE = 5020,
- VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO = 5021,
VKD3D_SHADER_WARNING_HLSL_IMPLICIT_TRUNCATION = 5300,
- VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO = 5301,
VKD3D_SHADER_ERROR_GLSL_INTERNAL = 6000,
diff --git a/tests/arithmetic-float.shader_test b/tests/arithmetic-float.shader_test index d55dc9d4..f99b9728 100644 --- a/tests/arithmetic-float.shader_test +++ b/tests/arithmetic-float.shader_test @@ -23,3 +23,19 @@ float4 main() : SV_TARGET [test] todo draw quad probe all rgba (5.0, 5.0, -5.0, 3.0)
+[require] +shader model >= 4.0
+[pixel shader] +float4 main() : SV_TARGET +{
- float x = 1;
- float y = 0;
- return x / y;
+}
+[test] +draw quad +probe all rgba (1e99, 1e99, 1e99, 1e99) diff --git a/tests/arithmetic-int.shader_test b/tests/arithmetic-int.shader_test index 5d9cc029..c85b9a3a 100644 --- a/tests/arithmetic-int.shader_test +++ b/tests/arithmetic-int.shader_test @@ -8,7 +8,7 @@ float4 main() : SV_TARGET }
[test] -todo draw quad +draw quad probe all rgba (20.0, -10.0, 75.0, 0.0)
[pixel shader] @@ -23,3 +23,12 @@ float4 main() : SV_TARGET [test] todo draw quad probe all rgba (5.0, 5.0, -5.0, 3.0)
+[pixel shader fail] +float4 main() : SV_TARGET +{
- int x = 1;
- int y = 0;
- return x / y;
+} diff --git a/tests/arithmetic-uint.shader_test b/tests/arithmetic-uint.shader_test index b016dbb6..f37c881e 100644 --- a/tests/arithmetic-uint.shader_test +++ b/tests/arithmetic-uint.shader_test @@ -26,3 +26,12 @@ float4 main() : SV_TARGET [test] draw quad probe all rgba (5.0, 5.0, 4294967296.0, 3.0)
+[pixel shader fail] +float4 main() : SV_TARGET +{
- uint x = 1;
- uint y = 0;
- return x / y;
+}
2.35.2
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
On Thu, Apr 14, 2022 at 12:53 PM Giovanni Mascellani gmascellani@codeweavers.com wrote:
This commit includes work by Francisco Casas.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com
libs/vkd3d-shader/hlsl_constant_ops.c | 67 ++++++++++++++++++++++++ libs/vkd3d-shader/vkd3d_shader_private.h | 2 + tests/arithmetic-float.shader_test | 16 ++++++ tests/arithmetic-int.shader_test | 11 +++- tests/arithmetic-uint.shader_test | 9 ++++ 5 files changed, 104 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d-shader/hlsl_constant_ops.c index 5cac4bde..9a8bc6b0 100644 --- a/libs/vkd3d-shader/hlsl_constant_ops.c +++ b/libs/vkd3d-shader/hlsl_constant_ops.c @@ -255,6 +255,69 @@ static bool fold_nequal(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, return true; }
+static bool fold_div(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst,
struct hlsl_ir_constant *src1, struct hlsl_ir_constant *src2)
+{
- enum hlsl_base_type type = dst->node.data_type->base_type;
- unsigned int k;
- assert(type == src1->node.data_type->base_type);
- assert(type == src2->node.data_type->base_type);
- for (k = 0; k < dst->node.data_type->dimx; ++k)
- {
switch (type)
{
case HLSL_TYPE_FLOAT:
case HLSL_TYPE_HALF:
if (src2->value[k].f == 0)
{
hlsl_warning(ctx, &dst->node.loc, VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO,
"Floating point division by zero");
}
dst->value[k].f = src1->value[k].f / src2->value[k].f;
break;
This is in fact an error in SM1 (and the reason for the [require] in the corresponding test, I guess). Do we have a patch for this lined up already? Or did we decide to diverge from native in this particular situation? In the latter case we probably want a comment though. A comment next to the [require] would also be nice either way.
case HLSL_TYPE_DOUBLE:
if (src2->value[k].d == 0)
{
hlsl_warning(ctx, &dst->node.loc, VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO,
"Floating point division by zero");
}
dst->value[k].d = src1->value[k].d / src2->value[k].d;
break;
case HLSL_TYPE_INT:
if (src2->value[k].i == 0)
{
hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO,
"Division by zero.");
return false;
}
if (src1->value[k].i == INT_MIN && src2->value[k].i == -1)
dst->value[k].i = INT_MIN;
else
dst->value[k].i = src1->value[k].i / src2->value[k].i;
break;
It would be nice to have a test for that INT_MIN / -1 special case.
This commit includes work by Francisco Casas.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- libs/vkd3d-shader/hlsl_constant_ops.c | 48 +++++++++++++++++++++++++++ tests/arithmetic-int.shader_test | 11 +++++- tests/arithmetic-uint.shader_test | 9 +++++ 3 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d-shader/hlsl_constant_ops.c index 9a8bc6b0..06b957ba 100644 --- a/libs/vkd3d-shader/hlsl_constant_ops.c +++ b/libs/vkd3d-shader/hlsl_constant_ops.c @@ -318,6 +318,50 @@ static bool fold_div(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, return true; }
+static bool fold_mod(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, + struct hlsl_ir_constant *src1, struct hlsl_ir_constant *src2) +{ + enum hlsl_base_type type = dst->node.data_type->base_type; + unsigned int k; + + assert(type == src1->node.data_type->base_type); + assert(type == src2->node.data_type->base_type); + + for (k = 0; k < dst->node.data_type->dimx; ++k) + { + switch (type) + { + case HLSL_TYPE_INT: + if (src2->value[k].i == 0) + { + hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO, + "Division by zero."); + return false; + } + if (src1->value[k].i == INT_MIN && src2->value[k].i == -1) + dst->value[k].i = 0; + else + dst->value[k].i = src1->value[k].i % src2->value[k].i; + break; + + case HLSL_TYPE_UINT: + if (src2->value[k].u == 0) + { + hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO, + "Division by zero."); + return false; + } + dst->value[k].u = src1->value[k].u % src2->value[k].u; + break; + + default: + FIXME("Fold modulus for type %s.\n", debug_hlsl_type(ctx, dst->node.data_type)); + return false; + } + } + return true; +} + bool hlsl_fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { struct hlsl_ir_constant *arg1, *arg2 = NULL, *res; @@ -375,6 +419,10 @@ bool hlsl_fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void success = fold_div(ctx, res, arg1, arg2); break;
+ case HLSL_OP2_MOD: + success = fold_mod(ctx, res, arg1, arg2); + break; + default: FIXME("Fold "%s" expression.\n", debug_hlsl_expr_op(expr->op)); success = false; diff --git a/tests/arithmetic-int.shader_test b/tests/arithmetic-int.shader_test index c85b9a3a..c2eee2ba 100644 --- a/tests/arithmetic-int.shader_test +++ b/tests/arithmetic-int.shader_test @@ -21,7 +21,7 @@ float4 main() : SV_TARGET }
[test] -todo draw quad +draw quad probe all rgba (5.0, 5.0, -5.0, 3.0)
[pixel shader fail] @@ -32,3 +32,12 @@ float4 main() : SV_TARGET
return x / y; } + +[pixel shader fail] +float4 main() : SV_TARGET +{ + int x = 1; + int y = 0; + + return x % y; +} diff --git a/tests/arithmetic-uint.shader_test b/tests/arithmetic-uint.shader_test index f37c881e..f1801b9c 100644 --- a/tests/arithmetic-uint.shader_test +++ b/tests/arithmetic-uint.shader_test @@ -35,3 +35,12 @@ float4 main() : SV_TARGET
return x / y; } + +[pixel shader fail] +float4 main() : SV_TARGET +{ + uint x = 1; + uint y = 0; + + return x % y; +}
Signed-off-by: Francisco Casas fcasas@codeweavers.com
April 14, 2022 6:53 AM, "Giovanni Mascellani" gmascellani@codeweavers.com wrote:
This commit includes work by Francisco Casas.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com
libs/vkd3d-shader/hlsl_constant_ops.c | 48 +++++++++++++++++++++++++++ tests/arithmetic-int.shader_test | 11 +++++- tests/arithmetic-uint.shader_test | 9 +++++ 3 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d-shader/hlsl_constant_ops.c index 9a8bc6b0..06b957ba 100644 --- a/libs/vkd3d-shader/hlsl_constant_ops.c +++ b/libs/vkd3d-shader/hlsl_constant_ops.c @@ -318,6 +318,50 @@ static bool fold_div(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, return true; }
+static bool fold_mod(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst,
- struct hlsl_ir_constant *src1, struct hlsl_ir_constant *src2)
+{
- enum hlsl_base_type type = dst->node.data_type->base_type;
- unsigned int k;
- assert(type == src1->node.data_type->base_type);
- assert(type == src2->node.data_type->base_type);
- for (k = 0; k < dst->node.data_type->dimx; ++k)
- {
- switch (type)
- {
- case HLSL_TYPE_INT:
- if (src2->value[k].i == 0)
- {
- hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO,
- "Division by zero.");
- return false;
- }
- if (src1->value[k].i == INT_MIN && src2->value[k].i == -1)
- dst->value[k].i = 0;
- else
- dst->value[k].i = src1->value[k].i % src2->value[k].i;
- break;
- case HLSL_TYPE_UINT:
- if (src2->value[k].u == 0)
- {
- hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO,
- "Division by zero.");
- return false;
- }
- dst->value[k].u = src1->value[k].u % src2->value[k].u;
- break;
- default:
- FIXME("Fold modulus for type %s.\n", debug_hlsl_type(ctx, dst->node.data_type));
- return false;
- }
- }
- return true;
+}
bool hlsl_fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context) { struct hlsl_ir_constant *arg1, *arg2 = NULL, *res; @@ -375,6 +419,10 @@ bool hlsl_fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void success = fold_div(ctx, res, arg1, arg2); break;
- case HLSL_OP2_MOD:
- success = fold_mod(ctx, res, arg1, arg2);
- break;
default: FIXME("Fold "%s" expression.\n", debug_hlsl_expr_op(expr->op)); success = false; diff --git a/tests/arithmetic-int.shader_test b/tests/arithmetic-int.shader_test index c85b9a3a..c2eee2ba 100644 --- a/tests/arithmetic-int.shader_test +++ b/tests/arithmetic-int.shader_test @@ -21,7 +21,7 @@ float4 main() : SV_TARGET }
[test] -todo draw quad +draw quad probe all rgba (5.0, 5.0, -5.0, 3.0)
[pixel shader fail] @@ -32,3 +32,12 @@ float4 main() : SV_TARGET
return x / y; }
+[pixel shader fail] +float4 main() : SV_TARGET +{
- int x = 1;
- int y = 0;
- return x % y;
+} diff --git a/tests/arithmetic-uint.shader_test b/tests/arithmetic-uint.shader_test index f37c881e..f1801b9c 100644 --- a/tests/arithmetic-uint.shader_test +++ b/tests/arithmetic-uint.shader_test @@ -35,3 +35,12 @@ float4 main() : SV_TARGET
return x / y; }
+[pixel shader fail] +float4 main() : SV_TARGET +{
- uint x = 1;
- uint y = 0;
- return x % y;
+}
2.35.2
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- Makefile.am | 1 + tests/hlsl-matrix-indexing.shader_test | 47 ++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 tests/hlsl-matrix-indexing.shader_test
diff --git a/Makefile.am b/Makefile.am index d57ea2b7..ed881ffa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -85,6 +85,7 @@ vkd3d_shader_tests = \ tests/hlsl-invalid.shader_test \ tests/hlsl-majority-pragma.shader_test \ tests/hlsl-majority-typedef.shader_test \ + tests/hlsl-matrix-indexing.shader_test \ tests/hlsl-mul.shader_test \ tests/hlsl-nested-arrays.shader_test \ tests/hlsl-numeric-constructor-truncation.shader_test \ diff --git a/tests/hlsl-matrix-indexing.shader_test b/tests/hlsl-matrix-indexing.shader_test new file mode 100644 index 00000000..1d444ffa --- /dev/null +++ b/tests/hlsl-matrix-indexing.shader_test @@ -0,0 +1,47 @@ +[pixel shader] +uniform float4x4 m; + +float4 main() : SV_TARGET +{ + return float4(m[0][0], m[1][0], m[1][2], m[2][3]); +} + +[test] +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 13.0 14.0 15.0 16.0 +todo draw quad +probe all rgba (1.0, 2.0, 10.0, 15.0) + +[pixel shader] +uniform column_major float4x4 m; + +float4 main() : SV_TARGET +{ + return float4(m[0][0], m[1][0], m[1][2], m[2][3]); +} + +[test] +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 13.0 14.0 15.0 16.0 +todo draw quad +probe all rgba (1.0, 2.0, 10.0, 15.0) + +[pixel shader] +uniform row_major float4x4 m; + +float4 main() : SV_TARGET +{ + return float4(m[0][0], m[1][0], m[1][2], m[2][3]); +} + +[test] +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 13.0 14.0 15.0 16.0 +todo draw quad +probe all rgba (1.0, 5.0, 7.0, 12.0)
Signed-off-by: Francisco Casas fcasas@codeweavers.com
April 14, 2022 6:53 AM, "Giovanni Mascellani" gmascellani@codeweavers.com wrote:
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com
Makefile.am | 1 + tests/hlsl-matrix-indexing.shader_test | 47 ++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 tests/hlsl-matrix-indexing.shader_test
diff --git a/Makefile.am b/Makefile.am index d57ea2b7..ed881ffa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -85,6 +85,7 @@ vkd3d_shader_tests = \ tests/hlsl-invalid.shader_test \ tests/hlsl-majority-pragma.shader_test \ tests/hlsl-majority-typedef.shader_test \
- tests/hlsl-matrix-indexing.shader_test \
tests/hlsl-mul.shader_test \ tests/hlsl-nested-arrays.shader_test \ tests/hlsl-numeric-constructor-truncation.shader_test \ diff --git a/tests/hlsl-matrix-indexing.shader_test b/tests/hlsl-matrix-indexing.shader_test new file mode 100644 index 00000000..1d444ffa --- /dev/null +++ b/tests/hlsl-matrix-indexing.shader_test @@ -0,0 +1,47 @@ +[pixel shader] +uniform float4x4 m;
+float4 main() : SV_TARGET +{
- return float4(m[0][0], m[1][0], m[1][2], m[2][3]);
+}
+[test] +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 13.0 14.0 15.0 16.0 +todo draw quad +probe all rgba (1.0, 2.0, 10.0, 15.0)
+[pixel shader] +uniform column_major float4x4 m;
+float4 main() : SV_TARGET +{
- return float4(m[0][0], m[1][0], m[1][2], m[2][3]);
+}
+[test] +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 13.0 14.0 15.0 16.0 +todo draw quad +probe all rgba (1.0, 2.0, 10.0, 15.0)
+[pixel shader] +uniform row_major float4x4 m;
+float4 main() : SV_TARGET +{
- return float4(m[0][0], m[1][0], m[1][2], m[2][3]);
+}
+[test] +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 13.0 14.0 15.0 16.0 +todo draw quad
+probe all rgba (1.0, 5.0, 7.0, 12.0)
2.35.2
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- tests/hlsl-vector-indexing.shader_test | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/tests/hlsl-vector-indexing.shader_test b/tests/hlsl-vector-indexing.shader_test index f46377cf..1c964147 100644 --- a/tests/hlsl-vector-indexing.shader_test +++ b/tests/hlsl-vector-indexing.shader_test @@ -12,3 +12,16 @@ float4 main() : SV_TARGET [test] todo draw quad probe all rgba (0.02, 0.245, 0.351, 1.0) + +[pixel shader] +uniform float4 m; + +float4 main() : SV_TARGET +{ + return float4(m[0], m[1], m[1], m[2]); +} + +[test] +uniform 0 float4 1.0 2.0 3.0 4.0 +todo draw quad +probe all rgba (1.0, 2.0, 2.0, 3.0)
Signed-off-by: Francisco Casas fcasas@codeweavers.com
April 14, 2022 6:53 AM, "Giovanni Mascellani" gmascellani@codeweavers.com wrote:
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com
tests/hlsl-vector-indexing.shader_test | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/tests/hlsl-vector-indexing.shader_test b/tests/hlsl-vector-indexing.shader_test index f46377cf..1c964147 100644 --- a/tests/hlsl-vector-indexing.shader_test +++ b/tests/hlsl-vector-indexing.shader_test @@ -12,3 +12,16 @@ float4 main() : SV_TARGET [test] todo draw quad probe all rgba (0.02, 0.245, 0.351, 1.0)
+[pixel shader] +uniform float4 m;
+float4 main() : SV_TARGET +{
- return float4(m[0], m[1], m[1], m[2]);
+}
+[test] +uniform 0 float4 1.0 2.0 3.0 4.0 +todo draw quad
+probe all rgba (1.0, 2.0, 2.0, 3.0)
2.35.2
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com