From c0562e2a1e9f05d7fe7e23884f8bd241062acd65 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 14 Apr 2022 12:52:33 +0200 Subject: [PATCH] tests: Introduce support for marking individual test directives as todo. Signed-off-by: Giovanni Mascellani Signed-off-by: Henri Verbeet Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- 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));