From 622311da8e87c60110329044e29b88dd524e28e7 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 9 Aug 2023 18:59:51 -0500 Subject: [PATCH] vkd3d-shader: Add a flag marking raw buffers to struct vkd3d_shader_descriptor_info. --- include/vkd3d_shader.h | 2 ++ libs/vkd3d-shader/vkd3d_shader_main.c | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index e98aad4f..cfe54dbf 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -1339,6 +1339,8 @@ enum vkd3d_shader_descriptor_info_flag /** The descriptor is a UAV resource, on which the shader performs * atomic ops. \since 1.6 */ VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_ATOMICS = 0x00000008, + /** The descriptor is a raw (byte-addressed) buffer. \since 1.9 */ + VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_RAW_BUFFER = 0x00000010, VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_DESCRIPTOR_INFO_FLAG), }; diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index 10a51ab9..38f90966 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -819,7 +819,7 @@ static void vkd3d_shader_scan_sampler_declaration(struct vkd3d_shader_scan_conte 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) + unsigned int sample_count, unsigned int structure_stride, bool raw) { struct vkd3d_shader_descriptor_info1 *d; enum vkd3d_shader_descriptor_type type; @@ -836,6 +836,8 @@ static void vkd3d_shader_scan_resource_declaration(struct vkd3d_shader_scan_cont return; d->sample_count = sample_count; d->structure_stride = structure_stride; + if (raw) + d->flags |= VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_RAW_BUFFER; } static void vkd3d_shader_scan_typed_resource_declaration(struct vkd3d_shader_scan_context *context, @@ -894,7 +896,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); + semantic->resource_type, resource_data_type, semantic->sample_count, 0, false); } static void vkd3d_shader_scan_error(struct vkd3d_shader_scan_context *context, @@ -928,13 +930,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); + VKD3D_SHADER_RESOURCE_BUFFER, VKD3D_SHADER_RESOURCE_DATA_UINT, 0, 0, true); 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); + instruction->declaration.structured_resource.byte_stride, false); break; case VKD3DSIH_IF: cf_info = vkd3d_shader_scan_push_cf_info(context);