Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions gapis/api/vulkan/api/renderpass_framebuffer.api
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ sub ref!RenderPassObject createRenderPassObjectFromInfo2(
attachments := info.pAttachments[0:info.attachmentCount]
for i in (0 .. info.attachmentCount) {
attachment := attachments[i]
renderPass.AttachmentDescriptions[i] = AttachmentDescription(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am having hard time to see how changing this solves the problem

Copy link
Contributor Author

@mikes-lunarg mikes-lunarg Apr 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @AWoloszyn gave a pretty thorough answer, but the short version is:

I need to might need to modify this struct inside the pNext loop so I assign it to a local variable. Then, once I have the final version of the struct, I can put it in the map. Modifying it in-place in the map (the original code) won't work because the map access or will give me a copy of the data instead of a reference.

attachmentDescription := AttachmentDescription(
Flags: attachment.flags,
Format: attachment.format,
Samples: attachment.samples,
Expand All @@ -386,14 +386,15 @@ sub ref!RenderPassObject createRenderPassObjectFromInfo2(
switch sType {
case VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT: {
ext := as!VkAttachmentDescriptionStencilLayout*(next.Ptr)[0]
renderPass.AttachmentDescriptions[j].StencilLayout = new!AttachmentDescriptionStencilLayout(
attachmentDescription.StencilLayout = new!AttachmentDescriptionStencilLayout(
StencilInitialLayout: ext.stencilInitialLayout,
StencilFinalLayout: ext.stencilFinalLayout,
)
}
}
}
}
renderPass.AttachmentDescriptions[i] = attachmentDescription
}

subpasses := info.pSubpasses[0:info.subpassCount]
Expand Down