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)