diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-05-04 21:41:19 +0200 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-05-05 01:49:23 +0200 |
commit | 227278098a6b883e3a40faeb28ec8f130d898240 (patch) | |
tree | 02012403a62f080c9f5844526b80ca1d03551eb2 /src/video_core/renderer_vulkan/vk_sampler_cache.cpp | |
parent | externals: Update Vulkan-Headers (diff) | |
download | yuzu-227278098a6b883e3a40faeb28ec8f130d898240.tar yuzu-227278098a6b883e3a40faeb28ec8f130d898240.tar.gz yuzu-227278098a6b883e3a40faeb28ec8f130d898240.tar.bz2 yuzu-227278098a6b883e3a40faeb28ec8f130d898240.tar.lz yuzu-227278098a6b883e3a40faeb28ec8f130d898240.tar.xz yuzu-227278098a6b883e3a40faeb28ec8f130d898240.tar.zst yuzu-227278098a6b883e3a40faeb28ec8f130d898240.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_sampler_cache.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp index 2687d8d95..e6f2fa553 100644 --- a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp @@ -39,9 +39,18 @@ VKSamplerCache::VKSamplerCache(const VKDevice& device) : device{device} {} VKSamplerCache::~VKSamplerCache() = default; vk::Sampler VKSamplerCache::CreateSampler(const Tegra::Texture::TSCEntry& tsc) const { + const bool arbitrary_borders = device.IsExtCustomBorderColorSupported(); + const std::array color = tsc.GetBorderColor(); + + VkSamplerCustomBorderColorCreateInfoEXT border; + border.sType = VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT; + border.pNext = nullptr; + border.format = VK_FORMAT_UNDEFINED; + std::memcpy(&border.customBorderColor, color.data(), sizeof(color)); + VkSamplerCreateInfo ci; ci.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; - ci.pNext = nullptr; + ci.pNext = arbitrary_borders ? &border : nullptr; ci.flags = 0; ci.magFilter = MaxwellToVK::Sampler::Filter(tsc.mag_filter); ci.minFilter = MaxwellToVK::Sampler::Filter(tsc.min_filter); @@ -56,7 +65,7 @@ vk::Sampler VKSamplerCache::CreateSampler(const Tegra::Texture::TSCEntry& tsc) c ci.compareOp = MaxwellToVK::Sampler::DepthCompareFunction(tsc.depth_compare_func); ci.minLod = tsc.GetMinLod(); ci.maxLod = tsc.GetMaxLod(); - ci.borderColor = ConvertBorderColor(tsc.GetBorderColor()); + ci.borderColor = arbitrary_borders ? VK_BORDER_COLOR_INT_CUSTOM_EXT : ConvertBorderColor(color); ci.unnormalizedCoordinates = VK_FALSE; return device.GetLogical().CreateSampler(ci); } |