diff options
| author | Chris Forbes <chrisforbes@google.com> | 2016-05-13 13:01:02 +1200 |
|---|---|---|
| committer | Chris Forbes <chrisforbes@google.com> | 2016-05-16 09:54:39 +1200 |
| commit | 70d2d1e8447ffd7e8372d26c3a281678081499c2 (patch) | |
| tree | 14cc4ff2cacb5cb001004a38793f9ba77c8c476c /layers/core_validation.h | |
| parent | e35f626e59505d2c7421459f3bac311e512bc579 (diff) | |
| download | usermoji-70d2d1e8447ffd7e8372d26c3a281678081499c2.tar.xz | |
layers: Add RENDER_PASS_NODE* to PIPELINE_NODE*
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.h')
| -rw-r--r-- | layers/core_validation.h | 121 |
1 files changed, 61 insertions, 60 deletions
diff --git a/layers/core_validation.h b/layers/core_validation.h index 94a0e2fe..d87364ad 100644 --- a/layers/core_validation.h +++ b/layers/core_validation.h @@ -135,6 +135,65 @@ typedef struct _GENERIC_HEADER { const void *pNext; } GENERIC_HEADER; +typedef struct _IMAGE_LAYOUT_NODE { + VkImageLayout layout; + VkFormat format; +} IMAGE_LAYOUT_NODE; + +class IMAGE_CMD_BUF_LAYOUT_NODE { + public: + IMAGE_CMD_BUF_LAYOUT_NODE() {} + IMAGE_CMD_BUF_LAYOUT_NODE(VkImageLayout initialLayoutInput, VkImageLayout layoutInput) + : initialLayout(initialLayoutInput), layout(layoutInput) {} + + VkImageLayout initialLayout; + VkImageLayout layout; +}; + +// Store the DAG. +struct DAGNode { + uint32_t pass; + std::vector<uint32_t> prev; + std::vector<uint32_t> next; +}; + +struct RENDER_PASS_NODE { + VkRenderPass renderPass; + VkRenderPassCreateInfo const *pCreateInfo; + VkFramebuffer fb; + std::vector<bool> hasSelfDependency; + std::vector<DAGNode> subpassToNode; + std::vector<std::vector<VkFormat>> subpassColorFormats; + std::vector<MT_PASS_ATTACHMENT_INFO> attachments; + std::unordered_map<uint32_t, bool> attachment_first_read; + std::unordered_map<uint32_t, VkImageLayout> attachment_first_layout; + + RENDER_PASS_NODE(VkRenderPassCreateInfo const *pCreateInfo) : pCreateInfo(pCreateInfo), fb(VK_NULL_HANDLE) { + uint32_t i; + + subpassColorFormats.reserve(pCreateInfo->subpassCount); + for (i = 0; i < pCreateInfo->subpassCount; i++) { + const VkSubpassDescription *subpass = &pCreateInfo->pSubpasses[i]; + std::vector<VkFormat> color_formats; + uint32_t j; + + color_formats.reserve(subpass->colorAttachmentCount); + for (j = 0; j < subpass->colorAttachmentCount; j++) { + const uint32_t att = subpass->pColorAttachments[j].attachment; + + if (att != VK_ATTACHMENT_UNUSED) { + color_formats.push_back(pCreateInfo->pAttachments[att].format); + } + else { + color_formats.push_back(VK_FORMAT_UNDEFINED); + } + } + + subpassColorFormats.push_back(color_formats); + } + } +}; + class PIPELINE_NODE { public: VkPipeline pipeline; @@ -150,10 +209,11 @@ class PIPELINE_NODE { std::vector<VkVertexInputAttributeDescription> vertexAttributeDescriptions; std::vector<VkPipelineColorBlendAttachmentState> attachments; bool blendConstantsEnabled; // Blend constants enabled for any attachments + RENDER_PASS_NODE *renderPass; // Default constructor PIPELINE_NODE() : pipeline{}, graphicsPipelineCI{}, computePipelineCI{}, active_shaders(0), duplicate_shaders(0), active_slots(), vertexBindingDescriptions(), - vertexAttributeDescriptions(), attachments(), blendConstantsEnabled(false) {} + vertexAttributeDescriptions(), attachments(), blendConstantsEnabled(false), renderPass(nullptr) {} void initGraphicsPipeline(const VkGraphicsPipelineCreateInfo *pCreateInfo) { graphicsPipelineCI.initialize(pCreateInfo); @@ -201,65 +261,6 @@ class PIPELINE_NODE { } }; -typedef struct _IMAGE_LAYOUT_NODE { - VkImageLayout layout; - VkFormat format; -} IMAGE_LAYOUT_NODE; - -class IMAGE_CMD_BUF_LAYOUT_NODE { - public: - IMAGE_CMD_BUF_LAYOUT_NODE() {} - IMAGE_CMD_BUF_LAYOUT_NODE(VkImageLayout initialLayoutInput, VkImageLayout layoutInput) - : initialLayout(initialLayoutInput), layout(layoutInput) {} - - VkImageLayout initialLayout; - VkImageLayout layout; -}; - -// Store the DAG. -struct DAGNode { - uint32_t pass; - std::vector<uint32_t> prev; - std::vector<uint32_t> next; -}; - -struct RENDER_PASS_NODE { - VkRenderPass renderPass; - VkRenderPassCreateInfo const *pCreateInfo; - VkFramebuffer fb; - std::vector<bool> hasSelfDependency; - std::vector<DAGNode> subpassToNode; - std::vector<std::vector<VkFormat>> subpassColorFormats; - std::vector<MT_PASS_ATTACHMENT_INFO> attachments; - std::unordered_map<uint32_t, bool> attachment_first_read; - std::unordered_map<uint32_t, VkImageLayout> attachment_first_layout; - - RENDER_PASS_NODE(VkRenderPassCreateInfo const *pCreateInfo) : pCreateInfo(pCreateInfo), fb(VK_NULL_HANDLE) { - uint32_t i; - - subpassColorFormats.reserve(pCreateInfo->subpassCount); - for (i = 0; i < pCreateInfo->subpassCount; i++) { - const VkSubpassDescription *subpass = &pCreateInfo->pSubpasses[i]; - std::vector<VkFormat> color_formats; - uint32_t j; - - color_formats.reserve(subpass->colorAttachmentCount); - for (j = 0; j < subpass->colorAttachmentCount; j++) { - const uint32_t att = subpass->pColorAttachments[j].attachment; - - if (att != VK_ATTACHMENT_UNUSED) { - color_formats.push_back(pCreateInfo->pAttachments[att].format); - } - else { - color_formats.push_back(VK_FORMAT_UNDEFINED); - } - } - - subpassColorFormats.push_back(color_formats); - } - } -}; - class PHYS_DEV_PROPERTIES_NODE { public: VkPhysicalDeviceProperties properties; |
