Used by Cyberpunk 2077.
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d/device.c | 1 + libs/vkd3d/resource.c | 14 +++++++++----- libs/vkd3d/vkd3d_private.h | 1 + 3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index afe2c6c3..6e850a6d 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -128,6 +128,7 @@ static const struct vkd3d_optional_extension_info optional_device_extensions[] = VK_EXTENSION(KHR_IMAGE_FORMAT_LIST, KHR_image_format_list), VK_EXTENSION(KHR_MAINTENANCE3, KHR_maintenance3), VK_EXTENSION(KHR_PUSH_DESCRIPTOR, KHR_push_descriptor), + VK_EXTENSION(KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE, KHR_sampler_mirror_clamp_to_edge), /* EXT extensions */ VK_EXTENSION(EXT_CONDITIONAL_RENDERING, EXT_conditional_rendering), VK_EXTENSION(EXT_DEBUG_MARKER, EXT_debug_marker), diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 6cc9c565..fe1f7fc4 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -3143,7 +3143,8 @@ static VkSamplerMipmapMode vk_mipmap_mode_from_d3d12(D3D12_FILTER_TYPE type) } }
-static VkSamplerAddressMode vk_address_mode_from_d3d12(D3D12_TEXTURE_ADDRESS_MODE mode) +static VkSamplerAddressMode vk_address_mode_from_d3d12(const struct d3d12_device *device, + D3D12_TEXTURE_ADDRESS_MODE mode) { switch (mode) { @@ -3155,7 +3156,10 @@ static VkSamplerAddressMode vk_address_mode_from_d3d12(D3D12_TEXTURE_ADDRESS_MOD return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; case D3D12_TEXTURE_ADDRESS_MODE_BORDER: return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER; - /* D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE requires VK_KHR_mirror_clamp_to_edge. */ + case D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE: + if (device->vk_info.KHR_sampler_mirror_clamp_to_edge) + return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; + /* Fall through */ default: FIXME("Unhandled address mode %#x.\n", mode); return VK_SAMPLER_ADDRESS_MODE_REPEAT; @@ -3184,9 +3188,9 @@ static VkResult d3d12_create_sampler(struct d3d12_device *device, D3D12_FILTER f sampler_desc.magFilter = vk_filter_from_d3d12(D3D12_DECODE_MAG_FILTER(filter)); sampler_desc.minFilter = vk_filter_from_d3d12(D3D12_DECODE_MIN_FILTER(filter)); sampler_desc.mipmapMode = vk_mipmap_mode_from_d3d12(D3D12_DECODE_MIP_FILTER(filter)); - sampler_desc.addressModeU = vk_address_mode_from_d3d12(address_u); - sampler_desc.addressModeV = vk_address_mode_from_d3d12(address_v); - sampler_desc.addressModeW = vk_address_mode_from_d3d12(address_w); + sampler_desc.addressModeU = vk_address_mode_from_d3d12(device, address_u); + sampler_desc.addressModeV = vk_address_mode_from_d3d12(device, address_v); + sampler_desc.addressModeW = vk_address_mode_from_d3d12(device, address_w); sampler_desc.mipLodBias = mip_lod_bias; sampler_desc.anisotropyEnable = D3D12_DECODE_IS_ANISOTROPIC_FILTER(filter); sampler_desc.maxAnisotropy = max_anisotropy; diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index a3289878..d448eaa0 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -118,6 +118,7 @@ struct vkd3d_vulkan_info bool KHR_image_format_list; bool KHR_maintenance3; bool KHR_push_descriptor; + bool KHR_sampler_mirror_clamp_to_edge; /* EXT device extensions */ bool EXT_conditional_rendering; bool EXT_debug_marker;