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/filters.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 'src/video_core/renderer_vulkan/present/filters.cpp')
-rw-r--r-- | src/video_core/renderer_vulkan/present/filters.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/present/filters.cpp b/src/video_core/renderer_vulkan/present/filters.cpp new file mode 100644 index 000000000..ee6239cc4 --- /dev/null +++ b/src/video_core/renderer_vulkan/present/filters.cpp @@ -0,0 +1,70 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/common_types.h" + +#include "video_core/host_shaders/present_bicubic_frag_spv.h" +#include "video_core/host_shaders/present_gaussian_frag_spv.h" +#include "video_core/host_shaders/vulkan_present_frag_spv.h" +#include "video_core/host_shaders/vulkan_present_scaleforce_fp16_frag_spv.h" +#include "video_core/host_shaders/vulkan_present_scaleforce_fp32_frag_spv.h" +#include "video_core/renderer_vulkan/present/filters.h" +#include "video_core/renderer_vulkan/present/util.h" +#include "video_core/renderer_vulkan/vk_shader_util.h" +#include "video_core/vulkan_common/vulkan_device.h" + +namespace Vulkan { + +namespace { + +vk::ShaderModule SelectScaleForceShader(const Device& device) { + if (device.IsFloat16Supported()) { + return BuildShader(device, VULKAN_PRESENT_SCALEFORCE_FP16_FRAG_SPV); + } else { + return BuildShader(device, VULKAN_PRESENT_SCALEFORCE_FP32_FRAG_SPV); + } +} + +} // Anonymous namespace + +std::unique_ptr<WindowAdaptPass> MakeNearestNeighbor(const Device& device, + const MemoryAllocator& memory_allocator, + size_t image_count, VkFormat frame_format) { + return std::make_unique<WindowAdaptPass>(device, memory_allocator, image_count, frame_format, + CreateNearestNeighborSampler(device), + BuildShader(device, VULKAN_PRESENT_FRAG_SPV)); +} + +std::unique_ptr<WindowAdaptPass> MakeBilinear(const Device& device, + const MemoryAllocator& memory_allocator, + size_t image_count, VkFormat frame_format) { + return std::make_unique<WindowAdaptPass>(device, memory_allocator, image_count, frame_format, + CreateBilinearSampler(device), + BuildShader(device, VULKAN_PRESENT_FRAG_SPV)); +} + +std::unique_ptr<WindowAdaptPass> MakeBicubic(const Device& device, + const MemoryAllocator& memory_allocator, + size_t image_count, VkFormat frame_format) { + return std::make_unique<WindowAdaptPass>(device, memory_allocator, image_count, frame_format, + CreateBilinearSampler(device), + BuildShader(device, PRESENT_BICUBIC_FRAG_SPV)); +} + +std::unique_ptr<WindowAdaptPass> MakeGaussian(const Device& device, + const MemoryAllocator& memory_allocator, + size_t image_count, VkFormat frame_format) { + return std::make_unique<WindowAdaptPass>(device, memory_allocator, image_count, frame_format, + CreateBilinearSampler(device), + BuildShader(device, PRESENT_GAUSSIAN_FRAG_SPV)); +} + +std::unique_ptr<WindowAdaptPass> MakeScaleForce(const Device& device, + const MemoryAllocator& memory_allocator, + size_t image_count, VkFormat frame_format) { + return std::make_unique<WindowAdaptPass>(device, memory_allocator, image_count, frame_format, + CreateBilinearSampler(device), + SelectScaleForceShader(device)); +} + +} // namespace Vulkan |