From ba84f0988fcec59bb3a68a0e7dc952538972aa28 Mon Sep 17 00:00:00 2001 From: Nguyen Dac Nam Date: Tue, 18 Feb 2020 16:52:54 +0700 Subject: [PATCH 1/3] renderer_vulkan: Add the rest of case for TryConvertBorderColor --- src/video_core/renderer_vulkan/vk_sampler_cache.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp index 0a8ec8398..839cfc1c3 100644 --- a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp @@ -23,7 +23,16 @@ static std::optional TryConvertBorderColor(std::array } else if (color == std::array{1, 1, 1, 1}) { return vk::BorderColor::eFloatOpaqueWhite; } else { - return {}; + if (color[0] + color[1] + color[2] > 1.35f) { + // If color elements are brighter than roughly 0.5 average, use white border + return vk::BorderColor::eFloatOpaqueWhite; + } else { + if (color[3] > 0.5f) { + return vk::BorderColor::eFloatOpaqueBlack; + } else { + return vk::BorderColor::eFloatTransparentBlack; + } + } } } @@ -37,8 +46,6 @@ UniqueSampler VKSamplerCache::CreateSampler(const Tegra::Texture::TSCEntry& tsc) const auto border_color{tsc.GetBorderColor()}; const auto vk_border_color{TryConvertBorderColor(border_color)}; - UNIMPLEMENTED_IF_MSG(!vk_border_color, "Unimplemented border color {} {} {} {}", - border_color[0], border_color[1], border_color[2], border_color[3]); constexpr bool unnormalized_coords{false}; From eaf60ca5d859ddd8a18fd4783e8e660987c27f2a Mon Sep 17 00:00:00 2001 From: Nguyen Dac Nam Date: Wed, 19 Feb 2020 01:23:08 +0700 Subject: [PATCH 2/3] Update code structure Co-Authored-By: Mat M. --- src/video_core/renderer_vulkan/vk_sampler_cache.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp index 839cfc1c3..cbad25015 100644 --- a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp @@ -26,6 +26,13 @@ static std::optional TryConvertBorderColor(std::array if (color[0] + color[1] + color[2] > 1.35f) { // If color elements are brighter than roughly 0.5 average, use white border return vk::BorderColor::eFloatOpaqueWhite; + } + if (color[3] > 0.5f) { + return vk::BorderColor::eFloatOpaqueBlack; + } + return vk::BorderColor::eFloatTransparentBlack; + // If color elements are brighter than roughly 0.5 average, use white border + return vk::BorderColor::eFloatOpaqueWhite; } else { if (color[3] > 0.5f) { return vk::BorderColor::eFloatOpaqueBlack; From ec206f7f953d9437bfd5e391286e1507c4eccb1f Mon Sep 17 00:00:00 2001 From: Nguyen Dac Nam Date: Wed, 19 Feb 2020 01:24:32 +0700 Subject: [PATCH 3/3] fixups mistake auto commit. --- src/video_core/renderer_vulkan/vk_sampler_cache.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp index cbad25015..204b7c39c 100644 --- a/src/video_core/renderer_vulkan/vk_sampler_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_sampler_cache.cpp @@ -31,15 +31,6 @@ static std::optional TryConvertBorderColor(std::array return vk::BorderColor::eFloatOpaqueBlack; } return vk::BorderColor::eFloatTransparentBlack; - // If color elements are brighter than roughly 0.5 average, use white border - return vk::BorderColor::eFloatOpaqueWhite; - } else { - if (color[3] > 0.5f) { - return vk::BorderColor::eFloatOpaqueBlack; - } else { - return vk::BorderColor::eFloatTransparentBlack; - } - } } }