From 92c1b600fad9925a305e346b7de5fa5b6587008e Mon Sep 17 00:00:00 2001 From: Boris Zanin Date: Mon, 17 Jun 2019 09:49:36 +0200 Subject: [PATCH] Fix VK_KHR_imageless_framebuffer tests Formats are referred to by a pointer to a variable allocated on stack, which will become invalid before its usage. Use permanent variable and pointer to it. Update tests: * dEQP-VK.imageless_framebuffer.* Components: Vulkan VK-GL-CTS issue: 1477 Change-Id: Ic8ab76ec576168fd0bfc3aef9a08f6bab2392584 --- .../vktImagelessFramebufferTests.cpp | 41 ++++++++++++---------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/external/vulkancts/modules/vulkan/imageless_framebuffer/vktImagelessFramebufferTests.cpp b/external/vulkancts/modules/vulkan/imageless_framebuffer/vktImagelessFramebufferTests.cpp index 6207c6e..3fd0cf0 100644 --- a/external/vulkancts/modules/vulkan/imageless_framebuffer/vktImagelessFramebufferTests.cpp +++ b/external/vulkancts/modules/vulkan/imageless_framebuffer/vktImagelessFramebufferTests.cpp @@ -536,9 +536,9 @@ VkImageCreateInfo makeImageCreateInfo (const VkFormat format, const VkExtent2D s } std::vector makeFramebufferAttachmentImageInfos (const VkExtent2D& renderSize, - const VkFormat colorFormat, + const VkFormat* colorFormat, const VkImageUsageFlags colorUsage, - const VkFormat dsFormat, + const VkFormat* dsFormat, const VkImageUsageFlags dsUsage, const AspectFlags resolveAspects, const deUint32 inputAttachmentCount) @@ -547,7 +547,10 @@ std::vector makeFramebufferAttachmentImageI const bool depthStencilResolve = (resolveAspects & ASPECT_DEPTH_STENCIL) != 0; std::vector framebufferAttachmentImageInfos; - if (colorFormat != VK_FORMAT_UNDEFINED) + DE_ASSERT(colorFormat != DE_NULL); + DE_ASSERT(dsFormat != DE_NULL); + + if (*colorFormat != VK_FORMAT_UNDEFINED) { const VkFramebufferAttachmentImageInfoKHR framebufferAttachmentImageInfo = { @@ -559,13 +562,13 @@ std::vector makeFramebufferAttachmentImageI renderSize.height, // deUint32 height; 1u, // deUint32 layerCount; 1u, // deUint32 viewFormatCount; - &colorFormat // const VkFormat* pViewFormats; + colorFormat // const VkFormat* pViewFormats; }; framebufferAttachmentImageInfos.push_back(framebufferAttachmentImageInfo); } - if (dsFormat != VK_FORMAT_UNDEFINED) + if (*dsFormat != VK_FORMAT_UNDEFINED) { const VkFramebufferAttachmentImageInfoKHR framebufferAttachmentImageInfo = { @@ -577,7 +580,7 @@ std::vector makeFramebufferAttachmentImageI renderSize.height, // deUint32 height; 1u, // deUint32 layerCount; 1u, // deUint32 viewFormatCount; - &dsFormat // const VkFormat* pViewFormats; + dsFormat // const VkFormat* pViewFormats; }; framebufferAttachmentImageInfos.push_back(framebufferAttachmentImageInfo); @@ -595,10 +598,10 @@ std::vector makeFramebufferAttachmentImageI renderSize.height, // deUint32 height; 1u, // deUint32 layerCount; 1u, // deUint32 viewFormatCount; - &colorFormat // const VkFormat* pViewFormats; + colorFormat // const VkFormat* pViewFormats; }; - DE_ASSERT(colorFormat != VK_FORMAT_UNDEFINED); + DE_ASSERT(*colorFormat != VK_FORMAT_UNDEFINED); framebufferAttachmentImageInfos.push_back(framebufferAttachmentImageInfo); } @@ -615,10 +618,10 @@ std::vector makeFramebufferAttachmentImageI renderSize.height, // deUint32 height; 1u, // deUint32 layerCount; 1u, // deUint32 viewFormatCount; - &dsFormat // const VkFormat* pViewFormats; + dsFormat // const VkFormat* pViewFormats; }; - DE_ASSERT(dsFormat != VK_FORMAT_UNDEFINED); + DE_ASSERT(*dsFormat != VK_FORMAT_UNDEFINED); framebufferAttachmentImageInfos.push_back(framebufferAttachmentImageInfo); } @@ -635,7 +638,7 @@ std::vector makeFramebufferAttachmentImageI renderSize.height, // deUint32 height; 1u, // deUint32 layerCount; 1u, // deUint32 viewFormatCount; - &colorFormat // const VkFormat* pViewFormats; + colorFormat // const VkFormat* pViewFormats; }; framebufferAttachmentImageInfos.push_back(framebufferAttachmentImageInfo); @@ -648,9 +651,9 @@ Move makeFramebuffer (const DeviceInterface& vk, const VkDevice device, const VkRenderPass renderPass, const VkExtent2D& renderSize, - const VkFormat colorFormat, + const VkFormat* colorFormat, const VkImageUsageFlags colorUsage, - const VkFormat dsFormat = VK_FORMAT_UNDEFINED, + const VkFormat* dsFormat, const VkImageUsageFlags dsUsage = static_cast(0), const AspectFlags resolveAspects = ASPECT_NONE, const deUint32 inputAttachmentCount = 0) @@ -1248,7 +1251,7 @@ tcu::TestStatus ColorImagelessTestInstance::iterate (void) const Unique vertModule (createShaderModule (vk, device, m_context.getBinaryCollection().get("vert"), 0u)); const Unique fragModule (createShaderModule (vk, device, m_context.getBinaryCollection().get("frag"), 0u)); const Unique renderPass (makeRenderPass (vk, device, colorFormat, m_parameters.dsFormat)); - const Unique framebuffer (makeFramebuffer (vk, device, *renderPass, m_imageExtent2D, colorFormat, m_colorImageUsage, m_parameters.dsFormat)); + const Unique framebuffer (makeFramebuffer (vk, device, *renderPass, m_imageExtent2D, &colorFormat, m_colorImageUsage, &m_parameters.dsFormat)); const Unique pipelineLayout (makePipelineLayout (vk, device)); const Unique pipeline (makeGraphicsPipeline (vk, device, *pipelineLayout, *renderPass, *vertModule, *fragModule, m_imageExtent2D)); const Unique cmdPool (createCommandPool (vk, device, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, queueFamilyIndex)); @@ -1480,7 +1483,7 @@ tcu::TestStatus DepthImagelessTestInstance::iterate (void) const Unique vertModule (createShaderModule (vk, device, m_context.getBinaryCollection().get("vert"), 0u)); const Unique fragModule (createShaderModule (vk, device, m_context.getBinaryCollection().get("frag"), 0u)); const Unique renderPass (makeRenderPass (vk, device, colorFormat, dsFormat)); - const Unique framebuffer (makeFramebuffer (vk, device, *renderPass, m_imageExtent2D, colorFormat, m_colorImageUsage, dsFormat, m_dsImageUsage)); + const Unique framebuffer (makeFramebuffer (vk, device, *renderPass, m_imageExtent2D, &colorFormat, m_colorImageUsage, &dsFormat, m_dsImageUsage)); const Unique pipelineLayout (makePipelineLayout (vk, device)); const Unique pipeline (makeGraphicsPipeline (vk, device, *pipelineLayout, *renderPass, *vertModule, *fragModule, m_imageExtent2D, ASPECT_DEPTH_STENCIL)); const Unique cmdPool (createCommandPool (vk, device, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, queueFamilyIndex)); @@ -1679,7 +1682,7 @@ tcu::TestStatus ColorResolveImagelessTestInstance::iterate (void) const Unique vertModule (createShaderModule (vk, device, m_context.getBinaryCollection().get("vert"), 0u)); const Unique fragModule (createShaderModule (vk, device, m_context.getBinaryCollection().get("frag"), 0u)); const Unique renderPass (makeRenderPass (vk, device, colorFormat, m_parameters.dsFormat, sampleCount)); - const Unique framebuffer (makeFramebuffer (vk, device, *renderPass, m_imageExtent2D, colorFormat, m_colorImageUsage, m_parameters.dsFormat, 0u, ASPECT_COLOR)); + const Unique framebuffer (makeFramebuffer (vk, device, *renderPass, m_imageExtent2D, &colorFormat, m_colorImageUsage, &m_parameters.dsFormat, 0u, ASPECT_COLOR)); const Unique pipelineLayout (makePipelineLayout (vk, device)); const Unique pipeline (makeGraphicsPipeline (vk, device, *pipelineLayout, *renderPass, *vertModule, *fragModule, m_imageExtent2D, ASPECT_NONE, sampleCount)); const Unique cmdPool (createCommandPool (vk, device, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, queueFamilyIndex)); @@ -1975,7 +1978,7 @@ tcu::TestStatus DepthResolveImagelessTestInstance::iterate (void) const Unique vertModule (createShaderModule (vk, device, m_context.getBinaryCollection().get("vert"), 0u)); const Unique fragModule (createShaderModule (vk, device, m_context.getBinaryCollection().get("frag"), 0u)); const Unique renderPass (makeRenderPass (vk, device, colorFormat, m_parameters.dsFormat, sampleCountFlag, sampleCountFlag)); - const Unique framebuffer (makeFramebuffer (vk, device, *renderPass, m_imageExtent2D, colorFormat, m_colorImageUsage, m_parameters.dsFormat, m_dsImageUsage, ASPECT_COLOR|ASPECT_DEPTH_STENCIL)); + const Unique framebuffer (makeFramebuffer (vk, device, *renderPass, m_imageExtent2D, &colorFormat, m_colorImageUsage, &m_parameters.dsFormat, m_dsImageUsage, ASPECT_COLOR|ASPECT_DEPTH_STENCIL)); const Unique pipelineLayout (makePipelineLayout (vk, device)); const Unique pipeline (makeGraphicsPipeline (vk, device, *pipelineLayout, *renderPass, *vertModule, *fragModule, m_imageExtent2D, ASPECT_DEPTH_STENCIL, sampleCountFlag)); const Unique cmdPool (createCommandPool (vk, device, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, queueFamilyIndex)); @@ -2223,7 +2226,7 @@ tcu::TestStatus MultisubpassTestInstance::iterate (void) .update(vk, device); const Unique renderPass (makeRenderPass (vk, device, colorFormat, DE_NULL)); - const Unique framebuffer (makeFramebuffer (vk, device, *renderPass, m_imageExtent2D, colorFormat, m_colorImageUsage, VK_FORMAT_UNDEFINED, 0u, ASPECT_NONE, 1u)); + const Unique framebuffer (makeFramebuffer (vk, device, *renderPass, m_imageExtent2D, &colorFormat, m_colorImageUsage, &m_parameters.dsFormat, 0u, ASPECT_NONE, 1u)); const Unique cmdPool (createCommandPool (vk, device, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, queueFamilyIndex)); const Unique cmdBuffer (allocateCommandBuffer (vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY)); @@ -2637,7 +2640,7 @@ tcu::TestNode* imagelessMultisubpass (tcu::TestContext& testCtx) { TEST_TYPE_MULTISUBPASS, // TestType testType; VK_FORMAT_R8G8B8A8_UNORM, // VkFormat colorFormat; - VK_FORMAT_D24_UNORM_S8_UINT, // VkFormat dsFormat; + VK_FORMAT_UNDEFINED, // VkFormat dsFormat; }; return new BaseTestCase(testCtx, "multisubpass", "Multi-subpass test", parameters); -- 2.7.4