tests: Test float4 UAV buffer load/store.
This currently fails if the shader loads from the UAV, because it causes vkd3d-shader to specify the R32f format instead of Unknown.
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com
Merge request reports
Activity
Zebediah Figura (she/her) replied on the mailing list:
On 8/1/22 08:31, Conor McCarthy wrote: > diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h > index ebddbba7..fc42fef4 100644 > --- a/include/vkd3d_shader.h > +++ b/include/vkd3d_shader.h > @@ -99,6 +99,22 @@ enum vkd3d_shader_compile_option_buffer_uav > VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV), > }; > > +/** > + * Determines how typed UAVs are declared. > + */ > +enum vkd3d_shader_compile_option_typed_uav > +{ > + /** Use R32(u)i/R32f format for UAVs which are read from. This is the default value. */ > + VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_R32 = 0x00000000, > + /** > + * Use Unknown format for UAVs which are read from. This should only be set if > + * shaderStorageImageReadWithoutFormat is enabled in the target environment. > + */ > + VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_UNKNOWN = 0x00000001, > + > + VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV), > +}; Would it make sense for this to be part of enum vkd3d_shader_spirv_extension instead? It's technically not an extension, but inasmuch as extensions specify features I think it fits. _______________________________________________ wine-gitlab mailing list -- wine-gitlab@winehq.org To unsubscribe send an email to wine-gitlab-leave@winehq.org
Would it make sense for this to be part of enum vkd3d_shader_spirv_extension instead? It's technically not an extension, but inasmuch as extensions specify features I think it fits.
Yes, I think that would work. I'm not sure there's a reason to prefer one approach over the other for this specific feature though. I guess extensions might be slightly easier to enable for users of the API, although this may also be slightly less discoverable as an extension.
From patch 3/4:
@@ -1391,6 +1391,45 @@ static void vkd3d_device_vk_heaps_descriptor_limits_init(struct vkd3d_device_des limits->sampler_max_descriptors = min(limits->sampler_max_descriptors, VKD3D_MAX_DESCRIPTOR_SET_SAMPLERS); } +static bool d3d12_device_supports_typed_uav_load_additional_formats(const struct d3d12_device *device) +{ + const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs; + const struct vkd3d_format *format; + VkFormatProperties properties; + unsigned int i; + + static const DXGI_FORMAT additional_formats[] = + { + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R32G32B32A32_UINT, + DXGI_FORMAT_R32G32B32A32_SINT, + DXGI_FORMAT_R16G16B16A16_FLOAT, + DXGI_FORMAT_R16G16B16A16_UINT, + DXGI_FORMAT_R16G16B16A16_SINT, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UINT, + DXGI_FORMAT_R8G8B8A8_SINT, + DXGI_FORMAT_R16_FLOAT, + DXGI_FORMAT_R16_UINT, + DXGI_FORMAT_R16_SINT, + DXGI_FORMAT_R8_UNORM, + DXGI_FORMAT_R8_UINT, + DXGI_FORMAT_R8_SINT, + }; + + for (i = 0; i < ARRAY_SIZE(additional_formats); ++i) + { + format = vkd3d_get_format(device, additional_formats[i], false); + assert(format); + + VK_CALL(vkGetPhysicalDeviceFormatProperties(device->vk_physical_device, format->vk_format, &properties)); + if (!((properties.linearTilingFeatures | properties.optimalTilingFeatures) & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)) + return false; + } + + return true; +} + static HRESULT vkd3d_init_device_caps(struct d3d12_device *device, const struct vkd3d_device_create_info *create_info, struct vkd3d_physical_device_info *physical_device_info, @@ -1455,7 +1494,7 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device, else device->feature_options.ResourceBindingTier = D3D12_RESOURCE_BINDING_TIER_3; - device->feature_options.TypedUAVLoadAdditionalFormats = features->shaderStorageImageExtendedFormats; + device->feature_options.TypedUAVLoadAdditionalFormats = d3d12_device_supports_typed_uav_load_additional_formats(device); /* GL_INTEL_fragment_shader_ordering, no Vulkan equivalent. */ device->feature_options.ROVsSupported = FALSE; /* GL_INTEL_conservative_rasterization, no Vulkan equivalent. */
I think we should also require
shaderStorageImageReadWithoutFormat
here; vkd3d-shader will be unable to properly use those additional formats unless that capability is available.From patch 4/4:
@@ -1310,6 +1310,7 @@ static void vkd3d_init_feature_level(struct vkd3d_vulkan_info *vk_info, CHECK_FEATURE(shaderClipDistance); CHECK_FEATURE(shaderCullDistance); CHECK_FEATURE(shaderImageGatherExtended); + CHECK_FEATURE(shaderStorageImageReadWithoutFormat); CHECK_FEATURE(shaderStorageImageWriteWithoutFormat); CHECK_FEATURE(tessellationShader);
I'm not quite sure where we left this discussion last time, but to be clear, I think this change shouldn't be included. Based on [1], I'd say
shaderStorageImageReadWithoutFormat
should only be a requirement for feature level 12_0 and up. We already include a check forTypedUAVLoadAdditionalFormats
for feature level 12_0 and up, which should cover this.I'm not quite sure where we left this discussion last time, but to be clear, I think this change shouldn't be included. Based on [1] (https://docs.microsoft.com/en-us/windows/win32/direct3d12/hardware-feature-levels), I'd say shaderStorageImageReadWithoutFormat should only be a requirement for feature level 12_0 and up. We already include a check for TypedUAVLoadAdditionalFormats for feature level 12_0 and up, which should cover this. Oops, I forgot to delete that.
added 4 commits
- 75f4f8d0 - tests: Test float4 UAV buffer load/store.
- d5e9963c - vkd3d-shader: Introduce a compile option to use Unknown format for typed UAV loads.
- 049bb68c - vkd3d: Check specific formats for typed UAV load feature support.
- 9ea7892c - vkd3d: Send typed UAV unknown format read support info to vkd3d-shader.
Toggle commit listadded 6 commits
-
9ea7892c...5168929e - 2 commits from branch
wine:master
- d7554acc - tests: Test float4 UAV buffer load/store.
- 3dbd2cec - vkd3d-shader: Introduce a compile option to use Unknown format for typed UAV loads.
- 971ab01a - vkd3d: Check specific formats for typed UAV load feature support.
- 4afe69d0 - vkd3d: Send typed UAV unknown format read support info to vkd3d-shader.
Toggle commit list-
9ea7892c...5168929e - 2 commits from branch