mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-26 00:07:07 +02:00
[vulkan] Establishin pColorAttachments pass thorugh DynamicRendering commands
This commit is contained in:
parent
87d81ab554
commit
c295c9c30c
2 changed files with 74 additions and 2 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <boost/container/small_vector.hpp>
|
#include <boost/container/small_vector.hpp>
|
||||||
#include <bit>
|
#include <bit>
|
||||||
|
|
@ -2377,6 +2378,65 @@ Framebuffer::Framebuffer(TextureCacheRuntime& runtime, ImageView* color_buffer,
|
||||||
|
|
||||||
Framebuffer::~Framebuffer() = default;
|
Framebuffer::~Framebuffer() = default;
|
||||||
|
|
||||||
|
Framebuffer::Framebuffer(Framebuffer&& other) noexcept
|
||||||
|
: framebuffer{std::move(other.framebuffer)},
|
||||||
|
renderpass{std::exchange(other.renderpass, VkRenderPass{})},
|
||||||
|
render_area{other.render_area},
|
||||||
|
samples{other.samples},
|
||||||
|
num_color_buffers{other.num_color_buffers},
|
||||||
|
num_images{other.num_images},
|
||||||
|
images{other.images},
|
||||||
|
image_ranges{other.image_ranges},
|
||||||
|
rt_map{other.rt_map},
|
||||||
|
has_depth{other.has_depth},
|
||||||
|
has_stencil{other.has_stencil},
|
||||||
|
is_rescaled{other.is_rescaled},
|
||||||
|
color_attachment_infos{other.color_attachment_infos},
|
||||||
|
depth_attachment_info{other.depth_attachment_info},
|
||||||
|
rendering_info{other.rendering_info} {
|
||||||
|
other.num_color_buffers = 0;
|
||||||
|
other.num_images = 0;
|
||||||
|
other.has_depth = false;
|
||||||
|
other.has_stencil = false;
|
||||||
|
other.rendering_info.pColorAttachments = nullptr;
|
||||||
|
other.rendering_info.pDepthAttachment = nullptr;
|
||||||
|
other.rendering_info.pStencilAttachment = nullptr;
|
||||||
|
FixupRenderingInfoPointers();
|
||||||
|
}
|
||||||
|
|
||||||
|
Framebuffer& Framebuffer::operator=(Framebuffer&& other) noexcept {
|
||||||
|
if (this == &other) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
framebuffer = std::move(other.framebuffer);
|
||||||
|
renderpass = std::exchange(other.renderpass, VkRenderPass{});
|
||||||
|
render_area = other.render_area;
|
||||||
|
samples = other.samples;
|
||||||
|
num_color_buffers = other.num_color_buffers;
|
||||||
|
num_images = other.num_images;
|
||||||
|
images = other.images;
|
||||||
|
image_ranges = other.image_ranges;
|
||||||
|
rt_map = other.rt_map;
|
||||||
|
has_depth = other.has_depth;
|
||||||
|
has_stencil = other.has_stencil;
|
||||||
|
is_rescaled = other.is_rescaled;
|
||||||
|
color_attachment_infos = other.color_attachment_infos;
|
||||||
|
depth_attachment_info = other.depth_attachment_info;
|
||||||
|
rendering_info = other.rendering_info;
|
||||||
|
|
||||||
|
other.num_color_buffers = 0;
|
||||||
|
other.num_images = 0;
|
||||||
|
other.has_depth = false;
|
||||||
|
other.has_stencil = false;
|
||||||
|
other.rendering_info.pColorAttachments = nullptr;
|
||||||
|
other.rendering_info.pDepthAttachment = nullptr;
|
||||||
|
other.rendering_info.pStencilAttachment = nullptr;
|
||||||
|
|
||||||
|
FixupRenderingInfoPointers();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void Framebuffer::CreateFramebuffer(TextureCacheRuntime& runtime,
|
void Framebuffer::CreateFramebuffer(TextureCacheRuntime& runtime,
|
||||||
std::span<ImageView*, NUM_RT> color_buffers,
|
std::span<ImageView*, NUM_RT> color_buffers,
|
||||||
ImageView* depth_buffer, bool is_rescaled_) {
|
ImageView* depth_buffer, bool is_rescaled_) {
|
||||||
|
|
@ -2490,6 +2550,16 @@ void Framebuffer::CreateFramebuffer(TextureCacheRuntime& runtime,
|
||||||
.height = render_area.height,
|
.height = render_area.height,
|
||||||
.layers = static_cast<u32>((std::max)(num_layers, 1)),
|
.layers = static_cast<u32>((std::max)(num_layers, 1)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
FixupRenderingInfoPointers();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Framebuffer::FixupRenderingInfoPointers() noexcept {
|
||||||
|
rendering_info.pColorAttachments = rendering_info.colorAttachmentCount > 0
|
||||||
|
? color_attachment_infos.data()
|
||||||
|
: nullptr;
|
||||||
|
rendering_info.pDepthAttachment = has_depth ? &depth_attachment_info : nullptr;
|
||||||
|
rendering_info.pStencilAttachment = has_stencil ? &depth_attachment_info : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureCacheRuntime::AccelerateImageUpload(
|
void TextureCacheRuntime::AccelerateImageUpload(
|
||||||
|
|
|
||||||
|
|
@ -154,8 +154,8 @@ public:
|
||||||
Framebuffer(const Framebuffer&) = delete;
|
Framebuffer(const Framebuffer&) = delete;
|
||||||
Framebuffer& operator=(const Framebuffer&) = delete;
|
Framebuffer& operator=(const Framebuffer&) = delete;
|
||||||
|
|
||||||
Framebuffer(Framebuffer&&) = default;
|
Framebuffer(Framebuffer&&) noexcept;
|
||||||
Framebuffer& operator=(Framebuffer&&) = default;
|
Framebuffer& operator=(Framebuffer&&) noexcept;
|
||||||
|
|
||||||
void CreateFramebuffer(TextureCacheRuntime& runtime,
|
void CreateFramebuffer(TextureCacheRuntime& runtime,
|
||||||
std::span<ImageView*, NUM_RT> color_buffers, ImageView* depth_buffer,
|
std::span<ImageView*, NUM_RT> color_buffers, ImageView* depth_buffer,
|
||||||
|
|
@ -231,6 +231,8 @@ private:
|
||||||
std::array<VkRenderingAttachmentInfo, NUM_RT> color_attachment_infos{};
|
std::array<VkRenderingAttachmentInfo, NUM_RT> color_attachment_infos{};
|
||||||
VkRenderingAttachmentInfo depth_attachment_info{};
|
VkRenderingAttachmentInfo depth_attachment_info{};
|
||||||
VkRenderingInfo rendering_info{};
|
VkRenderingInfo rendering_info{};
|
||||||
|
|
||||||
|
void FixupRenderingInfoPointers() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Image : public VideoCommon::ImageBase {
|
class Image : public VideoCommon::ImageBase {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue