Skip to content

Commit

Permalink
Vulkan: Fix some image layout errors reported by validation layers (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Qining authored Nov 8, 2018
1 parent feb3e1e commit 9acb3d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions gapis/api/vulkan/image_primer.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ func (p *imagePrimer) primeByRendering(img ImageObjectʳ, opaqueBoundRanges []Vk
inputImageObjects := copyJob.srcAspectsToDsts[aspect].dstImgs
inputImages := make([]ipRenderImage, len(inputImageObjects))
for i, iimg := range inputImageObjects {
layout := iimg.Aspects().Get(
VkImageAspectFlagBits_VK_IMAGE_ASPECT_COLOR_BIT).Layers().Get(
layer).Levels().Get(
level).Layout()
layout := copyJob.finalLayout.layoutOf(VkImageAspectFlagBits_VK_IMAGE_ASPECT_COLOR_BIT, layer, level)
inputImages[i] = ipRenderImage{
image: iimg,
aspect: VkImageAspectFlagBits_VK_IMAGE_ASPECT_COLOR_BIT,
Expand Down Expand Up @@ -211,7 +208,7 @@ func (p *imagePrimer) primeByImageStore(img ImageObjectʳ, opaqueBoundRanges []V
oldQueue: queue.VulkanHandle(),
newQueue: queue.VulkanHandle(),
})
oldLayouts = append(oldLayouts, l.Layout())
oldLayouts = append(oldLayouts, img.Aspects().Get(aspect).Layers().Get(layer).Levels().Get(level).Layout())
})
p.sb.changeImageSubRangeLayoutAndOwnership(img.VulkanHandle(), transitionInfo)

Expand Down
4 changes: 2 additions & 2 deletions gapis/api/vulkan/state_rebuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,7 @@ func (sb *stateBuilder) createImage(img ImageObjectʳ, imgPrimer *imagePrimer) {
oldQueue = sparseQueue.VulkanHandle()
}
transitionInfo = append(transitionInfo, imageSubRangeInfo{
aspectMask: VkImageAspectFlags(aspect),
aspectMask: ipImageBarrierAspectFlags(aspect, img.Info().Fmt()),
baseMipLevel: level,
levelCount: 1,
baseArrayLayer: layer,
Expand All @@ -1729,7 +1729,7 @@ func (sb *stateBuilder) createImage(img ImageObjectʳ, imgPrimer *imagePrimer) {
})
if q.Family() != imgLevel.LastBoundQueue().Family() {
ownerTransferInfo = append(ownerTransferInfo, imageSubRangeInfo{
aspectMask: VkImageAspectFlags(aspect),
aspectMask: ipImageBarrierAspectFlags(aspect, img.Info().Fmt()),
baseMipLevel: level,
levelCount: 1,
baseArrayLayer: layer,
Expand Down

0 comments on commit 9acb3d6

Please sign in to comment.