Skip to content

Commit

Permalink
Fix overdraw case where clear values weren't set properly
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-purcell authored and AWoloszyn committed Jul 27, 2018
1 parent 26cf689 commit 6583f9b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions gapis/api/vulkan/overdraw.go
Original file line number Diff line number Diff line change
Expand Up @@ -1729,19 +1729,27 @@ func (s *stencilOverdraw) createCommandBuffer(ctx context.Context,
newArgs.SetRenderPass(renderInfo.renderPass)
newArgs.SetFramebuffer(renderInfo.framebuffer)

clearCount := uint32(newArgs.ClearValues().Len())
rpInfo := st.RenderPasses().Get(renderInfo.renderPass)
attachmentIdx := uint32(rpInfo.AttachmentDescriptions().Len()) - 1
newClear := NewU32ː4ᵃ(a)

if renderInfo.depthIdx != ^uint32(0) {
if renderInfo.depthIdx != ^uint32(0) &&
rpInfo.AttachmentDescriptions().Get(renderInfo.depthIdx).LoadOp() ==
VkAttachmentLoadOp_VK_ATTACHMENT_LOAD_OP_CLEAR {
newClear.Set(0, newArgs.
ClearValues().
Get(renderInfo.depthIdx).
Color().
Uint32().
Get(0))
}
for j := uint32(0); j < attachmentIdx; j++ {
if !newArgs.ClearValues().Contains(j) {
newArgs.ClearValues().Add(j, NilVkClearValue)
}
}
// 0 initialize the stencil buffer
newArgs.ClearValues().Add(clearCount,
newArgs.ClearValues().Add(attachmentIdx,
// Use VkClearColorValue instead of
// VkClearDepthValue because it doesn't
// seem like the union is set up in the
Expand Down

0 comments on commit 6583f9b

Please sign in to comment.