vkd3d-shader: Use an extended version of vkd3d_shader_immediate_constant in vkd3d_shader_parameter1.

This is a proposed API change in 946, which won't make it into this release.

The intent is to allow slightly larger constants to be specified in the updated
vkd3d_shader_parameter1 structure. In particular, this is large enough to pass
4-dimensional integer or float vectors inline, which the proposed clip plane
implementation will use, as well as other Direct3D FFP parameters.

We could also simply add vkd3d_shader_immediate_constant1 as a separate union
member in vkd3d_shader_parameter1, but this API is a bit cleaner and simpler.
This commit is contained in:
Elizabeth Figura 2024-08-27 12:09:53 -05:00 committed by Henri Verbeet
parent f318e565f2
commit eb71a1722a
Notes: Henri Verbeet 2024-08-28 12:14:29 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1022
2 changed files with 28 additions and 3 deletions

View File

@ -583,7 +583,7 @@ enum vkd3d_shader_parameter_name
/** /**
* The value of an immediate constant parameter, used in * The value of an immediate constant parameter, used in
* struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1. * struct vkd3d_shader_parameter.
*/ */
struct vkd3d_shader_parameter_immediate_constant struct vkd3d_shader_parameter_immediate_constant
{ {
@ -604,6 +604,31 @@ struct vkd3d_shader_parameter_immediate_constant
} u; } u;
}; };
/**
* The value of an immediate constant parameter, used in
* struct vkd3d_shader_parameter1.
*
* \since 1.13
*/
struct vkd3d_shader_parameter_immediate_constant1
{
union
{
/**
* The value if the parameter's data type is
* VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.
*/
uint32_t u32;
/**
* The value if the parameter's data type is
* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.
*/
float f32;
void *_pointer_pad;
uint32_t _pad[4];
} u;
};
/** /**
* The linkage of a specialization constant parameter, used in * The linkage of a specialization constant parameter, used in
* struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1. * struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1.
@ -689,7 +714,7 @@ struct vkd3d_shader_parameter1
* Additional information if \a type is * Additional information if \a type is
* VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT. * VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT.
*/ */
struct vkd3d_shader_parameter_immediate_constant immediate_constant; struct vkd3d_shader_parameter_immediate_constant1 immediate_constant;
/** /**
* Additional information if \a type is * Additional information if \a type is
* VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT. * VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT.

View File

@ -45,7 +45,7 @@ static int convert_parameter_info(const struct vkd3d_shader_compile_info *compil
if (src->type == VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT) if (src->type == VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT)
{ {
dst->u.immediate_constant = src->u.immediate_constant; dst->u.immediate_constant.u.u32 = src->u.immediate_constant.u.u32;
} }
else if (src->type == VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT) else if (src->type == VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT)
{ {