tests: Skip probe directives if the last render failed.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-04-14 12:52:32 +02:00 committed by Alexandre Julliard
parent e3f78706ec
commit 26b89cc338
6 changed files with 36 additions and 15 deletions

View File

@ -382,7 +382,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
if (!runner->vs_source) if (!runner->vs_source)
runner->vs_source = strdup(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)) 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) if (line == rest)
fatal_error("Malformed vertex count '%s'.\n", line); 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)) 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; struct vec4 v;
int ret; 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); ret = sscanf(line, "( %f , %f , %f , %f ) %u", &v.x, &v.y, &v.z, &v.w, &ulps);
if (ret < 4) if (ret < 4)
fatal_error("Malformed probe arguments '%s'.\n", line); 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; RECT rect;
int ret; int ret;
if (runner->last_render_failed)
return;
ret = sscanf(line, "( %d , %d , %d , %d ) ( %f , %f , %f , %f ) %u", 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); &left, &top, &right, &bottom, &v.x, &v.y, &v.z, &v.w, &ulps);
if (ret < 8) if (ret < 8)
@ -445,6 +451,9 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
RECT rect; RECT rect;
int ret; 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); ret = sscanf(line, "( %u , %u ) ( %f , %f , %f , %f ) %u", &x, &y, &v.x, &v.y, &v.z, &v.w, &ulps);
if (ret < 6) if (ret < 6)
fatal_error("Malformed probe arguments '%s'.\n", line); fatal_error("Malformed probe arguments '%s'.\n", line);

View File

@ -98,6 +98,8 @@ struct shader_runner
char *ps_source; char *ps_source;
enum shader_model minimum_shader_model; enum shader_model minimum_shader_model;
bool last_render_failed;
uint32_t *uniforms; uint32_t *uniforms;
size_t uniform_count, uniform_capacity; size_t uniform_count, uniform_capacity;
@ -118,7 +120,7 @@ struct shader_runner_ops
bool (*check_requirements)(struct shader_runner *runner); bool (*check_requirements)(struct shader_runner *runner);
struct resource *(*create_resource)(struct shader_runner *runner, const struct resource_params *params); struct resource *(*create_resource)(struct shader_runner *runner, const struct resource_params *params);
void (*destroy_resource)(struct shader_runner *runner, struct resource *resource); 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); void (*probe_vec4)(struct shader_runner *runner, const RECT *rect, const struct vec4 *v, unsigned int ulps);
}; };

View File

@ -423,7 +423,7 @@ static void d3d11_runner_destroy_resource(struct shader_runner *r, struct resour
free(resource); 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) D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count)
{ {
struct d3d11_shader_runner *runner = d3d11_shader_runner(r); struct d3d11_shader_runner *runner = d3d11_shader_runner(r);
@ -437,12 +437,12 @@ static void d3d11_runner_draw(struct shader_runner *r,
HRESULT hr; HRESULT hr;
if (!(vs_code = compile_shader(runner->r.vs_source, "vs", runner->r.minimum_shader_model))) 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))) if (!(ps_code = compile_shader(runner->r.ps_source, "ps", runner->r.minimum_shader_model)))
{ {
ID3D10Blob_Release(vs_code); ID3D10Blob_Release(vs_code);
return; return false;
} }
hr = ID3D11Device_CreateVertexShader(device, ID3D10Blob_GetBufferPointer(vs_code), hr = ID3D11Device_CreateVertexShader(device, ID3D10Blob_GetBufferPointer(vs_code),
@ -536,6 +536,8 @@ static void d3d11_runner_draw(struct shader_runner *r,
ID3D11VertexShader_Release(vs); ID3D11VertexShader_Release(vs);
if (cb) if (cb)
ID3D11Buffer_Release(cb); ID3D11Buffer_Release(cb);
return true;
} }
struct resource_readback struct resource_readback

View File

@ -132,7 +132,7 @@ static void d3d12_runner_destroy_resource(struct shader_runner *r, struct resour
free(resource); 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) D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count)
{ {
struct d3d12_shader_runner *runner = d3d12_shader_runner(r); 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; size_t i;
if (!(ps_code = compile_shader(runner->r.ps_source, "ps", runner->r.minimum_shader_model))) 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))) if (!(vs_code = compile_shader(runner->r.vs_source, "vs", runner->r.minimum_shader_model)))
{ {
ID3D10Blob_Release(ps_code); ID3D10Blob_Release(ps_code);
return; return false;
} }
root_signature_desc.NumParameters = 0; root_signature_desc.NumParameters = 0;
@ -257,8 +257,6 @@ static void d3d12_runner_draw(struct shader_runner *r,
ID3D10Blob_Release(vs_code); ID3D10Blob_Release(vs_code);
ID3D10Blob_Release(ps_code); ID3D10Blob_Release(ps_code);
free(input_element_descs); free(input_element_descs);
if (!pso)
return;
vkd3d_array_reserve((void **)&test_context->pso, &test_context->pso_capacity, vkd3d_array_reserve((void **)&test_context->pso, &test_context->pso_capacity,
test_context->pso_count + 1, sizeof(*test_context->pso)); test_context->pso_count + 1, sizeof(*test_context->pso));
test_context->pso[test_context->pso_count++] = 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); exec_command_list(queue, command_list);
wait_queue_idle(device, queue); wait_queue_idle(device, queue);
reset_command_list(command_list, test_context->allocator); reset_command_list(command_list, test_context->allocator);
return true;
} }
static void d3d12_runner_probe_vec4(struct shader_runner *r, static void d3d12_runner_probe_vec4(struct shader_runner *r,

View File

@ -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); 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) D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count)
{ {
static const D3DVERTEXELEMENT9 decl_element_end = D3DDECL_END(); static const D3DVERTEXELEMENT9 decl_element_end = D3DDECL_END();
@ -323,12 +323,12 @@ static void d3d9_runner_draw(struct shader_runner *r,
HRESULT hr; HRESULT hr;
if (!(vs_code = compile_shader(runner->r.vs_source, "vs_2_0"))) 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"))) if (!(ps_code = compile_shader(runner->r.ps_source, "ps_2_0")))
{ {
ID3D10Blob_Release(vs_code); ID3D10Blob_Release(vs_code);
return; return false;
} }
if (runner->r.uniform_count) if (runner->r.uniform_count)
@ -445,6 +445,8 @@ static void d3d9_runner_draw(struct shader_runner *r,
IDirect3DVertexDeclaration9_Release(vertex_declaration); IDirect3DVertexDeclaration9_Release(vertex_declaration);
IDirect3DVertexShader9_Release(vs); IDirect3DVertexShader9_Release(vs);
IDirect3DPixelShader9_Release(ps); IDirect3DPixelShader9_Release(ps);
return true;
} }
struct resource_readback struct resource_readback

View File

@ -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. */ /* 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) D3D_PRIMITIVE_TOPOLOGY primitive_topology, unsigned int vertex_count)
{ {
struct vulkan_shader_runner *runner = vulkan_shader_runner(r); 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; VkDevice device = runner->device;
VkClearRect clear_rect; VkClearRect clear_rect;
VkPipeline pipeline; VkPipeline pipeline;
bool ret = true;
unsigned int i; unsigned int i;
/* Create this before compiling shaders, it will assign resource bindings. */ /* 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); pipeline_layout = create_pipeline_layout(runner, set_layout);
if (!(pipeline = create_pipeline(runner, pipeline_layout, primitive_topology))) if (!(pipeline = create_pipeline(runner, pipeline_layout, primitive_topology)))
{
ret = false;
goto out; goto out;
}
begin_command_buffer(runner); begin_command_buffer(runner);
@ -813,6 +817,8 @@ out:
VK_CALL(vkDestroyPipelineLayout(device, pipeline_layout, NULL)); VK_CALL(vkDestroyPipelineLayout(device, pipeline_layout, NULL));
VK_CALL(vkDestroyDescriptorSetLayout(device, set_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) static const struct vec4 *get_readback_vec4(const uint8_t *data, unsigned int row_pitch, unsigned int x, unsigned int y)