vkd3d: Handle D3D12_TEXTURE_ADDRESS_MODE_MIRROR_ONCE using a Vulkan extension.

Used by Cyberpunk 2077.

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Conor McCarthy 2022-01-10 16:08:27 +10:00 committed by Alexandre Julliard
parent eb1ae29de0
commit 5d2b604b5c
3 changed files with 11 additions and 5 deletions

View File

@ -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),

View File

@ -3044,7 +3044,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)
{
@ -3056,7 +3057,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;
@ -3085,9 +3089,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;

View File

@ -106,6 +106,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;