From 186b99aef98802c8f00674fcbc77db15c1e00d0d Mon Sep 17 00:00:00 2001 From: scygan Date: Thu, 24 Mar 2016 18:30:48 +0100 Subject: [PATCH] Fix device memory use after free in pipeline cache test --- .../vulkan/pipeline/vktPipelineCacheTests.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp index f73bb56d0..512354aee 100644 --- a/external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp +++ b/external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp @@ -714,10 +714,11 @@ protected: Move m_depthImage; de::MovePtr m_depthImageAlloc; - de::MovePtr m_colorImageAlloc; + de::MovePtr m_colorImageAlloc[PIPELINE_CACHE_NDX_COUNT]; Move m_depthAttachmentView; Move m_vertexBuffer; + de::MovePtr m_vertexBufferMemory; std::vector m_vertices; SimpleGraphicsPipelineBuilder m_pipelineBuilder; @@ -843,13 +844,12 @@ GraphicsCacheTestInstance::GraphicsCacheTestInstance (Context& cont // Create vertex buffer { - de::MovePtr bufferAlloc; - m_vertexBuffer = createBufferAndBindMemory(m_context, 1024u, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, &bufferAlloc); + m_vertexBuffer = createBufferAndBindMemory(m_context, 1024u, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, &m_vertexBufferMemory); m_vertices = createOverlappingQuads(); // Load vertices into vertex buffer - deMemcpy(bufferAlloc->getHostPtr(), m_vertices.data(), m_vertices.size() * sizeof(Vertex4RGBA)); - flushMappedMemoryRange(vk, vkDevice, bufferAlloc->getMemory(), bufferAlloc->getOffset(), 1024u); + deMemcpy(m_vertexBufferMemory->getHostPtr(), m_vertices.data(), m_vertices.size() * sizeof(Vertex4RGBA)); + flushMappedMemoryRange(vk, vkDevice, m_vertexBufferMemory->getMemory(), m_vertexBufferMemory->getOffset(), 1024u); } // Create render pass @@ -937,14 +937,14 @@ GraphicsCacheTestInstance::GraphicsCacheTestInstance (Context& cont m_renderSize.y(), VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT, VK_SAMPLE_COUNT_1_BIT, - &m_colorImageAlloc); + &m_colorImageAlloc[PIPELINE_CACHE_NDX_NO_CACHE]); m_colorImage[PIPELINE_CACHE_NDX_CACHED] = createImage2DAndBindMemory(m_context, m_colorFormat, m_renderSize.x(), m_renderSize.y(), VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT, VK_SAMPLE_COUNT_1_BIT, - &m_colorImageAlloc); + &m_colorImageAlloc[PIPELINE_CACHE_NDX_CACHED]); } // Create depth image -- 2.34.1