[PATCH vkd3d 3/5] vkd3d-shader/spirv: Send descriptor offsets via a shader parameter.

Henri Verbeet hverbeet at gmail.com
Wed Nov 24 12:36:43 CST 2021


On Tue, 23 Nov 2021 at 15:42, Conor McCarthy <cmccarthy at codeweavers.com> wrote:
> @@ -249,6 +249,8 @@ enum vkd3d_shader_parameter_name
>  {
>      VKD3D_SHADER_PARAMETER_NAME_UNKNOWN,
>      VKD3D_SHADER_PARAMETER_NAME_RASTERIZER_SAMPLE_COUNT,
> +    VKD3D_SHADER_PARAMETER_NAME_DESCRIPTOR_OFFSETS,
> +    VKD3D_SHADER_PARAMETER_NAME_UAV_COUNTER_OFFSETS,
>
>      VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_PARAMETER_NAME),
>  };
"VKD3D_SHADER_PARAMETER_NAME_UAV_COUNTER_DESCRIPTOR_OFFSETS", right?

> +struct vkd3d_shader_parameter_descriptor_offsets
> +{
[...]
> +    const unsigned int *offsets;
> +};
> +
>  struct vkd3d_shader_parameter
>  {
>      enum vkd3d_shader_parameter_name name;
> @@ -275,6 +322,7 @@ struct vkd3d_shader_parameter
>      {
>          struct vkd3d_shader_parameter_immediate_constant immediate_constant;
>          struct vkd3d_shader_parameter_specialization_constant specialization_constant;
> +        struct vkd3d_shader_parameter_descriptor_offsets descriptor_offsets;
>      } u;
>  };
>
That's not quite how shader parameters are supposed to work. Which of
these is valid depends on the "type" field, not on the "name" field.
The idea is that shaders could be parametrised using compile-time
immediate constants, specialisation constants, or a mix of the two. We
could in principle add push constants as a third option.

In the case of descriptor offsets, what's missing is support for
specifying arrays. That may simply be a matter of adding something
like "const uint32_t *u32_array;" to the union in the
vkd3d_shader_parameter_immediate_constant structure. The
specialisation constant path should work fine as-is in terms of API,
but probably needs some work in terms of SPIR-V generation.



More information about the wine-devel mailing list