vkd3d-shader/spirv: Support passing shader parameters through uniform buffers.

This commit is contained in:
Elizabeth Figura
2024-06-10 12:36:58 -05:00
committed by Henri Verbeet
parent 3dff608bf8
commit e8bdac8147
Notes: Henri Verbeet 2024-07-11 17:16:48 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/870
2 changed files with 77 additions and 0 deletions

View File

@ -472,6 +472,13 @@ enum vkd3d_shader_parameter_type
* constant. This value is only supported for the SPIR-V target type.
*/
VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT,
/**
* The parameter value is provided to the shader as part of a uniform
* buffer.
*
* \since 1.13
*/
VKD3D_SHADER_PARAMETER_TYPE_BUFFER,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_PARAMETER_TYPE),
};
@ -536,6 +543,23 @@ struct vkd3d_shader_parameter_specialization_constant
uint32_t id;
};
/**
* The linkage of a parameter specified through a uniform buffer, used in
* struct vkd3d_shader_parameter1.
*/
struct vkd3d_shader_parameter_buffer
{
/**
* The set of the uniform buffer descriptor. If the target environment does
* not support descriptor sets, this value must be set to 0.
*/
unsigned int set;
/** The binding index of the uniform buffer descriptor. */
unsigned int binding;
/** The byte offset of the parameter within the buffer. */
uint32_t offset;
};
/**
* An individual shader parameter.
*
@ -600,6 +624,11 @@ struct vkd3d_shader_parameter1
* VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT.
*/
struct vkd3d_shader_parameter_specialization_constant specialization_constant;
/**
* Additional information if \a type is
* VKD3D_SHADER_PARAMETER_TYPE_BUFFER.
*/
struct vkd3d_shader_parameter_buffer buffer;
void *_pointer_pad;
uint32_t _pad[4];
} u;