summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_vulkan/vk_sampler_cache.cpp51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp
index 616eacc36..2d5460776 100644
--- a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp
@@ -44,32 +44,35 @@ vk::Sampler VKSamplerCache::CreateSampler(const Tegra::Texture::TSCEntry& tsc) c
44 const bool arbitrary_borders = device.IsExtCustomBorderColorSupported(); 44 const bool arbitrary_borders = device.IsExtCustomBorderColorSupported();
45 const std::array color = tsc.GetBorderColor(); 45 const std::array color = tsc.GetBorderColor();
46 46
47 VkSamplerCustomBorderColorCreateInfoEXT border; 47 VkSamplerCustomBorderColorCreateInfoEXT border{
48 border.sType = VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT; 48 .sType = VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT,
49 border.pNext = nullptr; 49 .pNext = nullptr,
50 border.format = VK_FORMAT_UNDEFINED; 50 .format = VK_FORMAT_UNDEFINED,
51 };
51 std::memcpy(&border.customBorderColor, color.data(), sizeof(color)); 52 std::memcpy(&border.customBorderColor, color.data(), sizeof(color));
52 53
53 VkSamplerCreateInfo ci; 54 return device.GetLogical().CreateSampler({
54 ci.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; 55 .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
55 ci.pNext = arbitrary_borders ? &border : nullptr; 56 .pNext = arbitrary_borders ? &border : nullptr,
56 ci.flags = 0; 57 .flags = 0,
57 ci.magFilter = MaxwellToVK::Sampler::Filter(tsc.mag_filter); 58 .magFilter = MaxwellToVK::Sampler::Filter(tsc.mag_filter),
58 ci.minFilter = MaxwellToVK::Sampler::Filter(tsc.min_filter); 59 .minFilter = MaxwellToVK::Sampler::Filter(tsc.min_filter),
59 ci.mipmapMode = MaxwellToVK::Sampler::MipmapMode(tsc.mipmap_filter); 60 .mipmapMode = MaxwellToVK::Sampler::MipmapMode(tsc.mipmap_filter),
60 ci.addressModeU = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_u, tsc.mag_filter); 61 .addressModeU = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_u, tsc.mag_filter),
61 ci.addressModeV = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_v, tsc.mag_filter); 62 .addressModeV = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_v, tsc.mag_filter),
62 ci.addressModeW = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_p, tsc.mag_filter); 63 .addressModeW = MaxwellToVK::Sampler::WrapMode(device, tsc.wrap_p, tsc.mag_filter),
63 ci.mipLodBias = tsc.GetLodBias(); 64 .mipLodBias = tsc.GetLodBias(),
64 ci.anisotropyEnable = tsc.GetMaxAnisotropy() > 1.0f ? VK_TRUE : VK_FALSE; 65 .anisotropyEnable =
65 ci.maxAnisotropy = tsc.GetMaxAnisotropy(); 66 static_cast<VkBool32>(tsc.GetMaxAnisotropy() > 1.0f ? VK_TRUE : VK_FALSE),
66 ci.compareEnable = tsc.depth_compare_enabled; 67 .maxAnisotropy = tsc.GetMaxAnisotropy(),
67 ci.compareOp = MaxwellToVK::Sampler::DepthCompareFunction(tsc.depth_compare_func); 68 .compareEnable = tsc.depth_compare_enabled,
68 ci.minLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.0f : tsc.GetMinLod(); 69 .compareOp = MaxwellToVK::Sampler::DepthCompareFunction(tsc.depth_compare_func),
69 ci.maxLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.25f : tsc.GetMaxLod(); 70 .minLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.0f : tsc.GetMinLod(),
70 ci.borderColor = arbitrary_borders ? VK_BORDER_COLOR_INT_CUSTOM_EXT : ConvertBorderColor(color); 71 .maxLod = tsc.mipmap_filter == TextureMipmapFilter::None ? 0.25f : tsc.GetMaxLod(),
71 ci.unnormalizedCoordinates = VK_FALSE; 72 .borderColor =
72 return device.GetLogical().CreateSampler(ci); 73 arbitrary_borders ? VK_BORDER_COLOR_INT_CUSTOM_EXT : ConvertBorderColor(color),
74 .unnormalizedCoordinates = VK_FALSE,
75 });
73} 76}
74 77
75VkSampler VKSamplerCache::ToSamplerType(const vk::Sampler& sampler) const { 78VkSampler VKSamplerCache::ToSamplerType(const vk::Sampler& sampler) const {