SpiecsEngine
 
Loading...
Searching...
No Matches

◆ AddAttachment() [2/2]

uint32_t Spices::RendererPass::AddAttachment ( const std::string & attachmentName,
const VkAttachmentDescription & description,
uint32_t layers,
const VkClearValue & clearValue )

Add a attachment to this renderer pass.

Parameters
[in]attachmentNameThe name of attachment.
[in]descriptionThe description of attachment.
[in]layersThe layers of attachment.
[in]clearValueThe clear value of attachment.
Returns
Return the index of attachment.

Definition at line 47 of file RendererPass.cpp.

53 {
55
56 if (m_AttachmentDescriptions.has_key(attachmentName))
57 {
58 uint32_t index = 0;
59 m_AttachmentDescriptions.for_each([&](const auto& K, const auto& V) {
60 if (K == attachmentName)
61 {
62 return true;
63 }
64 else
65 {
66 index++;
67 return false;
68 }
69 });
70 return index;
71 }
72
73 if (attachmentName == "SwapChainImage")
74 {
76 }
77
78 m_MaxLayers = glm::max(m_MaxLayers, layers);
79 m_ClearValues.push_back(clearValue);
80 m_AttachmentDescriptions.push_back(attachmentName, description);
81
82 return static_cast<uint32_t>(m_AttachmentDescriptions.size() - 1);
83 }
#define SPICES_PROFILE_ZONE
uint32_t m_MaxLayers
Max Attachment layer.
scl::linked_unordered_map< std::string, VkAttachmentDescription > m_AttachmentDescriptions
VkAttachmentDescription this RenderPass handled.
std::vector< VkClearValue > m_ClearValues
VkClearValue this RenderPass handled.
bool m_IsSwapChainImageInUse
True if the RendererPass is using swapchain image.
void push_back(const K &key, const V &value)
Add a element to this container.
bool has_key(const K &key)
Determine whether the key is in the container.
size_t size()
The container's element size.
void for_each(F &fn)
Iter the container in order.

References m_IsSwapChainImageInUse.