summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan/present/window_adapt_pass.h
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2024-01-14 07:46:19 +0100
committerLiam <byteslice@airmail.cc>2024-01-31 17:27:20 +0100
commit0c2e5b64c9fb985a40e5afec898d1f370cbad23e (patch)
tree682dc3489bf4ae13dfd533d04245749538cd9505 /src/video_core/renderer_vulkan/present/window_adapt_pass.h
parentrenderer_vulkan: isolate FXAA from blit screen (diff)
downloadyuzu-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/window_adapt_pass.h')
-rw-r--r--src/video_core/renderer_vulkan/present/window_adapt_pass.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/present/window_adapt_pass.h b/src/video_core/renderer_vulkan/present/window_adapt_pass.h
new file mode 100644
index 000000000..5309233a2
--- /dev/null
+++ b/src/video_core/renderer_vulkan/present/window_adapt_pass.h
@@ -0,0 +1,71 @@
+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "common/math_util.h"
+#include "video_core/vulkan_common/vulkan_wrapper.h"
+
+namespace Layout {
+struct FramebufferLayout;
+}
+
+namespace Tegra {
+struct FramebufferConfig;
+}
+
+namespace Vulkan {
+
+class Device;
+struct Frame;
+class MemoryAllocator;
+class Scheduler;
+
+class WindowAdaptPass final {
+public:
+ explicit WindowAdaptPass(const Device& device, const MemoryAllocator& memory_allocator,
+ size_t num_images, VkFormat frame_format, vk::Sampler&& sampler,
+ vk::ShaderModule&& fragment_shader);
+ ~WindowAdaptPass();
+
+ void Draw(Scheduler& scheduler, size_t image_index, VkImageView src_image_view,
+ VkExtent2D src_image_extent, const Common::Rectangle<f32>& crop_rect,
+ const Layout::FramebufferLayout& layout, Frame* dst);
+
+ VkRenderPass GetRenderPass();
+
+private:
+ struct BufferData;
+
+ void SetUniformData(BufferData& data, const Layout::FramebufferLayout& layout) const;
+ void SetVertexData(BufferData& data, const Layout::FramebufferLayout& layout,
+ const Common::Rectangle<f32>& crop_rect) const;
+ void UpdateDescriptorSet(size_t image_index, VkImageView image_view);
+ void ConfigureLayout(size_t image_index, VkImageView image_view,
+ const Layout::FramebufferLayout& layout,
+ const Common::Rectangle<f32>& crop_rect);
+
+ void CreateDescriptorPool(size_t num_images);
+ void CreateDescriptorSetLayout();
+ void CreateDescriptorSets(size_t num_images);
+ void CreatePipelineLayout();
+ void CreateVertexShader();
+ void CreateRenderPass(VkFormat frame_format);
+ void CreatePipeline();
+ void CreateBuffer(const MemoryAllocator& memory_allocator);
+
+private:
+ const Device& device;
+ vk::DescriptorPool descriptor_pool;
+ vk::DescriptorSetLayout descriptor_set_layout;
+ vk::DescriptorSets descriptor_sets;
+ vk::PipelineLayout pipeline_layout;
+ vk::Sampler sampler;
+ vk::ShaderModule vertex_shader;
+ vk::ShaderModule fragment_shader;
+ vk::RenderPass render_pass;
+ vk::Pipeline pipeline;
+ vk::Buffer buffer;
+};
+
+} // namespace Vulkan