From 9d91cd459ed9cf302e4e4ce2a43485d3b9b2733a Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Thu, 18 Oct 2018 13:55:15 -1000 Subject: [PATCH] Ensure VulkanTextureR layouts are predictably initialized --- lib/graphicsdev/Vulkan.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/graphicsdev/Vulkan.cpp b/lib/graphicsdev/Vulkan.cpp index 6e46c3a..1e484d7 100644 --- a/lib/graphicsdev/Vulkan.cpp +++ b/lib/graphicsdev/Vulkan.cpp @@ -2049,6 +2049,23 @@ public: m_height = height; Setup(ctx); } + + void initializeBindLayouts(VulkanContext* ctx) + { + for (size_t i=0 ; im_loadCmdBuf, m_colorBindTex[i].m_image, VK_IMAGE_ASPECT_COLOR_BIT, + VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 1, 1); + m_colorBindLayout[i] = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + } + + for (size_t i=0 ; im_loadCmdBuf, m_depthBindTex[i].m_image, VK_IMAGE_ASPECT_DEPTH_BIT, + VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 1, 1); + m_depthBindLayout[i] = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + } + } }; static const size_t SEMANTIC_SIZE_TABLE[] = @@ -3769,6 +3786,11 @@ void VulkanDataFactoryImpl::commitTransaction static_cast(tex).placeForGPU(m_ctx, poolBuf.m_buffer, mappedData); } + /* initialize bind texture layout */ + if (data->m_RTexs) + for (ITextureR& tex : *data->m_RTexs) + static_cast(tex).initializeBindLayouts(m_ctx); + /* Execute static uploads */ ThrowIfFailed(vk::EndCommandBuffer(m_ctx->m_loadCmdBuf)); VkSubmitInfo submitInfo = {};