From: Conor McCarthy Subject: [PATCH vkd3d 2/4] vkd3d-shader: Add a descriptor binding offset for merged resource arrays. Message-Id: <20210526080619.19302-2-cmccarthy@codeweavers.com> Date: Wed, 26 May 2021 18:06:17 +1000 In-Reply-To: <20210526080619.19302-1-cmccarthy@codeweavers.com> References: <20210526080619.19302-1-cmccarthy@codeweavers.com> Signed-off-by: Conor McCarthy --- include/vkd3d_shader.h | 12 ++++++++++-- libs/vkd3d-shader/spirv.c | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index 03225d37..b320de8d 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -194,6 +194,8 @@ enum vkd3d_shader_descriptor_type VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_DESCRIPTOR_TYPE), }; +#define VKD3D_SHADER_SINGLE_BINDING 0x7FFFFFFF + /** * A common structure describing the bind point of a descriptor or descriptor * array in the target environment. @@ -208,10 +210,16 @@ struct vkd3d_shader_descriptor_binding /** The binding index of the descriptor. */ unsigned int binding; /** - * The size of this descriptor array. Descriptor arrays are not supported in - * this version of vkd3d-shader, and therefore this value must be 1. + * The size of this descriptor array. If descriptor indexing is not + * supported by the Vulkan device, this value must be 1. */ unsigned int count; + /** + * The offset of the first descriptor in the binding relative to the + * register index used to map it. Valid if this binding is contained within + * a larger merged array, otherwise VKD3D_SHADER_SINGLE_BINDING. + */ + int offset; }; enum vkd3d_shader_binding_flag diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 0e75b0ae..d477b384 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2569,6 +2569,7 @@ static struct vkd3d_shader_descriptor_binding vkd3d_dxbc_compiler_get_descriptor done: binding.set = 0; binding.count = 1; + binding.offset = 0; binding.binding = compiler->binding_idx++; return binding; } -- 2.31.1