1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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
|