diff options
author | Liam <byteslice@airmail.cc> | 2024-01-14 07:46:19 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-01-31 17:27:20 +0100 |
commit | 0c2e5b64c9fb985a40e5afec898d1f370cbad23e (patch) | |
tree | 682dc3489bf4ae13dfd533d04245749538cd9505 /src/video_core/renderer_vulkan/present/util.cpp | |
parent | renderer_vulkan: isolate FXAA from blit screen (diff) | |
download | yuzu-0c2e5b64c9fb985a40e5afec898d1f370cbad23e.tar yuzu-0c2e5b64c9fb985a40e5afec898d1f370cbad23e.tar.gz yuzu-0c2e5b64c9fb985a40e5afec898d1f370cbad23e.tar.bz2 yuzu-0c2e5b64c9fb985a40e5afec898d1f370cbad23e.tar.lz yuzu-0c2e5b64c9fb985a40e5afec898d1f370cbad23e.tar.xz yuzu-0c2e5b64c9fb985a40e5afec898d1f370cbad23e.tar.zst yuzu-0c2e5b64c9fb985a40e5afec898d1f370cbad23e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/present/util.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/present/util.cpp b/src/video_core/renderer_vulkan/present/util.cpp index a445b213e..cd6061101 100644 --- a/src/video_core/renderer_vulkan/present/util.cpp +++ b/src/video_core/renderer_vulkan/present/util.cpp @@ -441,6 +441,56 @@ VkWriteDescriptorSet CreateWriteDescriptorSet(std::vector<VkDescriptorImageInfo> }; } +vk::Sampler CreateBilinearSampler(const Device& device) { + const VkSamplerCreateInfo ci{ + .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, + .pNext = nullptr, + .flags = 0, + .magFilter = VK_FILTER_LINEAR, + .minFilter = VK_FILTER_LINEAR, + .mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST, + .addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, + .addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, + .addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, + .mipLodBias = 0.0f, + .anisotropyEnable = VK_FALSE, + .maxAnisotropy = 0.0f, + .compareEnable = VK_FALSE, + .compareOp = VK_COMPARE_OP_NEVER, + .minLod = 0.0f, + .maxLod = 0.0f, + .borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK, + .unnormalizedCoordinates = VK_FALSE, + }; + + return device.GetLogical().CreateSampler(ci); +} + +vk::Sampler CreateNearestNeighborSampler(const Device& device) { + const VkSamplerCreateInfo ci_nn{ + .sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, + .pNext = nullptr, + .flags = 0, + .magFilter = VK_FILTER_NEAREST, + .minFilter = VK_FILTER_NEAREST, + .mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST, + .addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, + .addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, + .addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, + .mipLodBias = 0.0f, + .anisotropyEnable = VK_FALSE, + .maxAnisotropy = 0.0f, + .compareEnable = VK_FALSE, + .compareOp = VK_COMPARE_OP_NEVER, + .minLod = 0.0f, + .maxLod = 0.0f, + .borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK, + .unnormalizedCoordinates = VK_FALSE, + }; + + return device.GetLogical().CreateSampler(ci_nn); +} + void ClearColorImage(vk::CommandBuffer& cmdbuf, VkImage image) { static constexpr std::array<VkImageSubresourceRange, 1> subresources{{{ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, |