[PATCH vkd3d 2/3] vkd3d-shader: Introduce a compile option to use Unknown format for typed UAV reads.

Henri Verbeet hverbeet at gmail.com
Wed Jul 20 11:45:22 CDT 2022


On Mon, 11 Jul 2022 at 16:28, Conor McCarthy <cmccarthy at codeweavers.com> wrote:
> +enum vkd3d_shader_compile_option_typed_uav
> +{
> +    /** Use R32ui format for UAVs which are read from. This is the default value. */
> +    VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_R32UI   = 0x00000000,

That's not quite what the code does though, is it?
image_format_for_image_read() will use the declared resource type to
determine the SPIR-V type. For VKD3D_SHADER_COMPONENT_UINT that's
SpvImageFormatR32ui, but for e.g. VKD3D_SHADER_COMPONENT_FLOAT it
would be SpvImageFormatR32f.

Where this breaks down is component counts;
image_format_for_image_read() assumes single component formats, in
part because that's all that was originally required. These additional
multi-component formats are an optional feature, see also
"TypedUAVLoadAdditionalFormats" from D3D12_FEATURE_DATA_D3D12_OPTIONS.

So what this compile option then comes down to is using either the
declared UAV type, or SpvImageFormatUnknown. And when not using
SpvImageFormatUnknown, there's arguably still a bug of ignoring
component counts. We could opt to not fix that bug, or fail shader
compilation for those formats, but it doesn't seem terribly hard to
fix, and I don't think there are that many additional formats anyway.



More information about the wine-devel mailing list