Skip to content

Commit

Permalink
Vulkan: Fix framebuffer and querypool creation for initial state (#2351)
Browse files Browse the repository at this point in the history
1. Framebuffer creation should depend on the image views in the new
state not the old state
2. ScratchTask should allow tasks with no new memory allocation, this
bug prevents the querypool state to be recovered correctly.
  • Loading branch information
Qining authored Nov 5, 2018
1 parent 00ab025 commit d8c1898
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions gapis/api/vulkan/scratch_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package vulkan

import (
"github.com/google/gapid/core/data/id"
"github.com/google/gapid/core/log"
"github.com/google/gapid/gapis/database"
"github.com/google/gapid/gapis/memory"
)
Expand Down Expand Up @@ -221,6 +220,9 @@ func (qr *queueFamilyScratchResources) bindAndFillBuffers(totalAllocationSize ui
deviceMemory = qr.getDeviceMemory()
allocated = qr.allocated
usingTempMem = false
if totalAllocationSize == uint64(0) || len(buffers) == 0 {
return deviceMemory, usingTempMem
}
}
atData := sb.MustReserve(totalAllocationSize)
ptrAtData := sb.newState.AllocDataOrPanic(sb.ctx, NewVoidᵖ(atData.Ptr()))
Expand Down Expand Up @@ -380,9 +382,6 @@ func (sb *stateBuilder) newScratchTaskOnQueue(queue VkQueue) *scratchTask {
// callbacks to the after-execution callback queue.
func (t *scratchTask) commit() error {
sb := t.sb
if t.totalAllocationSize == uint64(0) {
return log.Err(sb.ctx, nil, "Nil or empty scratch buffer session")
}
res := sb.getQueueFamilyScratchResources(t.queue)
if mem, isTemp := res.bindAndFillBuffers(t.totalAllocationSize, t.buffers); isTemp {
// The fixed size scratch buffer is not large enough for the allocation,
Expand Down
2 changes: 1 addition & 1 deletion gapis/api/vulkan/state_rebuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2584,7 +2584,7 @@ func (sb *stateBuilder) createDescriptorPoolAndAllocateDescriptorSets(dp Descrip
func (sb *stateBuilder) createFramebuffer(fb FramebufferObjectʳ) {
var temporaryRenderPass RenderPassObjectʳ
for _, v := range fb.ImageAttachments().All() {
if !GetState(sb.oldState).ImageViews().Contains(v.VulkanHandle()) {
if !GetState(sb.newState).ImageViews().Contains(v.VulkanHandle()) {
log.W(sb.ctx, "Image View %v is invalid, framebuffer %v will not be created", v.VulkanHandle(), fb.VulkanHandle())
return
}
Expand Down

0 comments on commit d8c1898

Please sign in to comment.