From fa570ee1f377c5a7d2fcbf383f8d549075117081 Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Mon, 17 Jun 2024 15:39:38 -0500 Subject: [PATCH] tests/shader_runner: Use resource->width instead of resource->size for buffer width. --- tests/shader_runner.c | 5 ++++- tests/shader_runner.h | 1 - tests/shader_runner_d3d12.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 91714ab1..cfa0e2a2 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -622,7 +622,6 @@ void init_resource(struct resource *resource, const struct resource_params *para resource->dimension = params->dimension; resource->slot = params->slot; resource->format = params->format; - resource->size = params->data_size; resource->texel_size = params->texel_size; resource->width = params->width; resource->height = params->height; @@ -934,6 +933,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) params.slot = 0; params.type = RESOURCE_TYPE_VERTEX_BUFFER; params.dimension = RESOURCE_DIMENSION_BUFFER; + params.width = sizeof(quad); params.data = malloc(sizeof(quad)); memcpy(params.data, quad, sizeof(quad)); params.data_size = sizeof(quad); @@ -1671,6 +1671,9 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c break; case STATE_RESOURCE: + if (current_resource.type == RESOURCE_TYPE_VERTEX_BUFFER) + current_resource.width = current_resource.data_size; + /* Not every backend supports every resource type * (specifically, D3D9 doesn't support UAVs and * textures with data type other than float). */ diff --git a/tests/shader_runner.h b/tests/shader_runner.h index 91a499ed..a059dacc 100644 --- a/tests/shader_runner.h +++ b/tests/shader_runner.h @@ -111,7 +111,6 @@ struct resource enum resource_dimension dimension; DXGI_FORMAT format; - unsigned int size; unsigned int texel_size; unsigned int width, height; unsigned int sample_count; diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index 126db6d7..0ec5e855 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c @@ -701,7 +701,7 @@ static bool d3d12_runner_draw(struct shader_runner *r, case RESOURCE_TYPE_VERTEX_BUFFER: vbv.BufferLocation = ID3D12Resource_GetGPUVirtualAddress(resource->resource); vbv.StrideInBytes = get_vb_stride(&runner->r, resource->r.slot); - vbv.SizeInBytes = resource->r.size; + vbv.SizeInBytes = resource->r.width; ID3D12GraphicsCommandList_IASetVertexBuffers(command_list, resource->r.slot, 1, &vbv); break;