vulkan: use subpass dependencies for layout transitions when switching canvases.

This commit is contained in:
Sasha Szpakowski
2024-09-30 23:04:58 -03:00
parent 3a6833ffb5
commit eeec2429e2
4 changed files with 69 additions and 61 deletions
+5 -2
View File
@@ -49,12 +49,14 @@ namespace vulkan
struct ColorAttachment
{
VkFormat format = VK_FORMAT_UNDEFINED;
VkImageLayout layout = VK_IMAGE_LAYOUT_UNDEFINED;
VkAttachmentLoadOp loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
VkSampleCountFlagBits msaaSamples = VK_SAMPLE_COUNT_1_BIT;
bool operator==(const ColorAttachment &attachment) const
{
return format == attachment.format &&
return format == attachment.format &&
layout == attachment.layout &&
loadOp == attachment.loadOp &&
msaaSamples == attachment.msaaSamples;
}
@@ -63,6 +65,7 @@ struct ColorAttachment
struct DepthStencilAttachment
{
VkFormat format = VK_FORMAT_UNDEFINED;
VkImageLayout layout = VK_IMAGE_LAYOUT_UNDEFINED;
VkAttachmentLoadOp depthLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
VkAttachmentLoadOp stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
VkSampleCountFlagBits msaaSamples = VK_SAMPLE_COUNT_1_BIT;
@@ -70,6 +73,7 @@ struct DepthStencilAttachment
bool operator==(const DepthStencilAttachment &attachment) const
{
return format == attachment.format &&
layout == attachment.layout &&
depthLoadOp == attachment.depthLoadOp &&
stencilLoadOp == attachment.stencilLoadOp &&
msaaSamples == attachment.msaaSamples;
@@ -196,7 +200,6 @@ struct RenderpassState
RenderPassConfiguration renderPassConfiguration{};
FramebufferConfiguration framebufferConfiguration{};
VkPipeline pipeline = VK_NULL_HANDLE;
std::vector<std::tuple<VkImage, PixelFormat, bool, VkImageLayout, VkImageLayout, int, int>> transitionImages;
uint32_t numColorAttachments = 0;
uint64 packedColorAttachmentFormats = 0;
float width = 0.0f;