From 9acb3d602489c7389134f043d4a1e9c12b6e3ff5 Mon Sep 17 00:00:00 2001 From: Qining Date: Thu, 8 Nov 2018 09:58:31 -0500 Subject: [PATCH] Vulkan: Fix some image layout errors reported by validation layers (#2353) --- gapis/api/vulkan/image_primer.go | 7 ++----- gapis/api/vulkan/state_rebuilder.go | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/gapis/api/vulkan/image_primer.go b/gapis/api/vulkan/image_primer.go index 245f260aa3..210d82ec08 100644 --- a/gapis/api/vulkan/image_primer.go +++ b/gapis/api/vulkan/image_primer.go @@ -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, @@ -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) diff --git a/gapis/api/vulkan/state_rebuilder.go b/gapis/api/vulkan/state_rebuilder.go index 60886585d1..01388cc0e0 100644 --- a/gapis/api/vulkan/state_rebuilder.go +++ b/gapis/api/vulkan/state_rebuilder.go @@ -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, @@ -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,