vkd3d-shader/spriv: Only lookup resource symbols for UAVs in the ld_raw/ld_structured handler.

We don't need them for SRVs. Worse, if we're using a combined
resource/sampler pair for the SRV, a separate resource symbol may not
even exist.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2024-11-05 18:10:32 +01:00 committed by Henri Verbeet
parent 76fd1388d8
commit 8438aacc3b
Notes: Henri Verbeet 2024-11-06 23:01:27 +01:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1245

View File

@ -8904,15 +8904,20 @@ static void spirv_compiler_emit_ld_raw_structured_srv_uav(struct spirv_compiler
uint32_t base_coordinate_id, component_idx; uint32_t base_coordinate_id, component_idx;
uint32_t constituents[VKD3D_VEC4_SIZE]; uint32_t constituents[VKD3D_VEC4_SIZE];
struct vkd3d_shader_image image; struct vkd3d_shader_image image;
bool storage_buffer_uav = false;
uint32_t indices[2]; uint32_t indices[2];
unsigned int i, j; unsigned int i, j;
SpvOp op; SpvOp op;
resource = &src[instruction->src_count - 1]; resource = &src[instruction->src_count - 1];
resource_symbol = spirv_compiler_find_resource(compiler, &resource->reg);
if (resource->reg.type == VKD3DSPR_UAV if (resource->reg.type == VKD3DSPR_UAV)
&& spirv_compiler_use_storage_buffer(compiler, &resource_symbol->info.resource)) {
resource_symbol = spirv_compiler_find_resource(compiler, &resource->reg);
storage_buffer_uav = spirv_compiler_use_storage_buffer(compiler, &resource_symbol->info.resource);
}
if (storage_buffer_uav)
{ {
texel_type_id = vkd3d_spirv_get_type_id(builder, resource_symbol->info.resource.sampled_type, 1); texel_type_id = vkd3d_spirv_get_type_id(builder, resource_symbol->info.resource.sampled_type, 1);
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassUniform, texel_type_id); ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassUniform, texel_type_id);