vkd3d-shader/spirv: Handle globally coherent UAVs.

This commit is contained in:
Conor McCarthy 2023-08-16 00:09:11 +10:00 committed by Alexandre Julliard
parent 766f5f039b
commit adfbecef3c
Notes: Alexandre Julliard 2024-01-25 23:07:09 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/599
3 changed files with 10 additions and 4 deletions

View File

@ -6237,6 +6237,9 @@ static void spirv_compiler_emit_resource_declaration(struct spirv_compiler *comp
if (!(d->flags & VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_READ))
vkd3d_spirv_build_op_decorate(builder, var_id, SpvDecorationNonReadable, NULL, 0);
if (d->uav_flags & VKD3DSUF_GLOBALLY_COHERENT)
vkd3d_spirv_build_op_decorate(builder, var_id, SpvDecorationCoherent, NULL, 0);
if (d->flags & VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_COUNTER)
{
assert(structure_stride); /* counters are valid only for structured buffers */

View File

@ -1016,7 +1016,7 @@ static void vkd3d_shader_scan_combined_sampler_usage(struct vkd3d_shader_scan_co
static void vkd3d_shader_scan_resource_declaration(struct vkd3d_shader_scan_context *context,
const struct vkd3d_shader_resource *resource, enum vkd3d_shader_resource_type resource_type,
enum vkd3d_shader_resource_data_type resource_data_type,
unsigned int sample_count, unsigned int structure_stride, bool raw)
unsigned int sample_count, unsigned int structure_stride, bool raw, uint32_t flags)
{
struct vkd3d_shader_descriptor_info1 *d;
enum vkd3d_shader_descriptor_type type;
@ -1032,6 +1032,8 @@ static void vkd3d_shader_scan_resource_declaration(struct vkd3d_shader_scan_cont
d->structure_stride = structure_stride;
if (raw)
d->flags |= VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_RAW_BUFFER;
if (type == VKD3D_SHADER_DESCRIPTOR_TYPE_UAV)
d->uav_flags = flags;
}
static void vkd3d_shader_scan_typed_resource_declaration(struct vkd3d_shader_scan_context *context,
@ -1090,7 +1092,7 @@ static void vkd3d_shader_scan_typed_resource_declaration(struct vkd3d_shader_sca
}
vkd3d_shader_scan_resource_declaration(context, &semantic->resource,
semantic->resource_type, resource_data_type, semantic->sample_count, 0, false);
semantic->resource_type, resource_data_type, semantic->sample_count, 0, false, instruction->flags);
}
static int vkd3d_shader_scan_instruction(struct vkd3d_shader_scan_context *context,
@ -1126,13 +1128,13 @@ static int vkd3d_shader_scan_instruction(struct vkd3d_shader_scan_context *conte
case VKD3DSIH_DCL_RESOURCE_RAW:
case VKD3DSIH_DCL_UAV_RAW:
vkd3d_shader_scan_resource_declaration(context, &instruction->declaration.raw_resource.resource,
VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_SHADER_RESOURCE_DATA_UINT, 0, 0, true);
VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_SHADER_RESOURCE_DATA_UINT, 0, 0, true, instruction->flags);
break;
case VKD3DSIH_DCL_RESOURCE_STRUCTURED:
case VKD3DSIH_DCL_UAV_STRUCTURED:
vkd3d_shader_scan_resource_declaration(context, &instruction->declaration.structured_resource.resource,
VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_SHADER_RESOURCE_DATA_UINT, 0,
instruction->declaration.structured_resource.byte_stride, false);
instruction->declaration.structured_resource.byte_stride, false, instruction->flags);
break;
case VKD3DSIH_IF:
cf_info = vkd3d_shader_scan_push_cf_info(context);

View File

@ -1339,6 +1339,7 @@ struct vkd3d_shader_descriptor_info1
unsigned int buffer_size;
unsigned int structure_stride;
unsigned int count;
uint32_t uav_flags;
};
struct vkd3d_shader_scan_descriptor_info1