summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2021-04-13 16:44:49 -0700
committerGravatar GitHub2021-04-13 16:44:49 -0700
commit62b560e8e34aac79d9ed310b45fa71375aa99435 (patch)
tree2fc9343f97a63a4f1fc8289a94c3fbae3fed52d1 /src
parentMerge pull request #6187 from lioncash/sign-conv (diff)
parentvk_texture_cache: Make use of Common::BitCast where applicable (diff)
downloadyuzu-62b560e8e34aac79d9ed310b45fa71375aa99435.tar.gz
yuzu-62b560e8e34aac79d9ed310b45fa71375aa99435.tar.xz
yuzu-62b560e8e34aac79d9ed310b45fa71375aa99435.zip
Merge pull request #6188 from lioncash/bits
vk_texture_cache: Make use of bit_cast where applicable
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
index 18155e449..bc2a53841 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
@@ -7,6 +7,8 @@
7#include <span> 7#include <span>
8#include <vector> 8#include <vector>
9 9
10#include "common/bit_cast.h"
11
10#include "video_core/engines/fermi_2d.h" 12#include "video_core/engines/fermi_2d.h"
11#include "video_core/renderer_vulkan/blit_image.h" 13#include "video_core/renderer_vulkan/blit_image.h"
12#include "video_core/renderer_vulkan/maxwell_to_vk.h" 14#include "video_core/renderer_vulkan/maxwell_to_vk.h"
@@ -1062,14 +1064,13 @@ vk::ImageView ImageView::MakeDepthStencilView(VkImageAspectFlags aspect_mask) {
1062Sampler::Sampler(TextureCacheRuntime& runtime, const Tegra::Texture::TSCEntry& tsc) { 1064Sampler::Sampler(TextureCacheRuntime& runtime, const Tegra::Texture::TSCEntry& tsc) {
1063 const auto& device = runtime.device; 1065 const auto& device = runtime.device;
1064 const bool arbitrary_borders = runtime.device.IsExtCustomBorderColorSupported(); 1066 const bool arbitrary_borders = runtime.device.IsExtCustomBorderColorSupported();
1065 const std::array<float, 4> color = tsc.BorderColor(); 1067 const auto color = tsc.BorderColor();
1066 // C++20 bit_cast 1068
1067 VkClearColorValue border_color;
1068 std::memcpy(&border_color, &color, sizeof(color));
1069 const VkSamplerCustomBorderColorCreateInfoEXT border_ci{ 1069 const VkSamplerCustomBorderColorCreateInfoEXT border_ci{
1070 .sType = VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT, 1070 .sType = VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT,
1071 .pNext = nullptr, 1071 .pNext = nullptr,
1072 .customBorderColor = border_color, 1072 // TODO: Make use of std::bit_cast once libc++ supports it.
1073 .customBorderColor = Common::BitCast<VkClearColorValue>(color),
1073 .format = VK_FORMAT_UNDEFINED, 1074 .format = VK_FORMAT_UNDEFINED,
1074 }; 1075 };
1075 const void* pnext = nullptr; 1076 const void* pnext = nullptr;