This change removes errors reported by core validation layer.
Affects: dEQP-VK.protected_memory.*
Components: Vulkan
Change-Id: Id7223e5777747345778babe83b0d9c3605a4ce1f
}
};
- vk.cmdPipelineBarrier(targetCmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
- (vk::VkDependencyFlags)0,
- 0, (const vk::VkMemoryBarrier*)DE_NULL,
- 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
- 1, &startImgBarrier);
+ vk.cmdPipelineBarrier(targetCmdBuffer, // commandBuffer
+ vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // dstStageMask
+ (vk::VkDependencyFlags)0, // dependencyFlags
+ 0, (const vk::VkMemoryBarrier*)DE_NULL, // memoryBarrierCount, pMemoryBarriers
+ 0, (const vk::VkBufferMemoryBarrier*)DE_NULL, // bufferMemoryBarrierCount, pBufferMemoryBarriers
+ 1, &startImgBarrier); // imageMemoryBarrierCount, pImageMemoryBarriers
}
// Image clear
};
vk.cmdPipelineBarrier(targetCmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
};
vk.cmdPipelineBarrier(targetCmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
+ vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
vk.cmdBlitImage(targetCmdBuffer, **colorImageSrc, vk::VK_IMAGE_LAYOUT_GENERAL,
**colorImage, vk::VK_IMAGE_LAYOUT_GENERAL, 1u, &imageBlit, vk::VK_FILTER_NEAREST);
+ // Image barrier to change accessMask to shader read bit for destination image.
{
const vk::VkImageMemoryBarrier endImgBarrier =
{
}
};
vk.cmdPipelineBarrier(targetCmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
subresourceRange, // subresourceRange
};
- vk.cmdPipelineBarrier(targetCmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
- (vk::VkDependencyFlags)0,
- 0, (const vk::VkMemoryBarrier*)DE_NULL,
- 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
- 1, &initializeBarrier);
+ vk.cmdPipelineBarrier(targetCmdBuffer, // commandBuffer
+ vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // dstStageMask
+ (vk::VkDependencyFlags)0, // dependencyFlags
+ 0, (const vk::VkMemoryBarrier*)DE_NULL, // memoryBarrierCount, pMemoryBarriers
+ 0, (const vk::VkBufferMemoryBarrier*)DE_NULL, // bufferMemoryBarrierCount, pBufferMemoryBarriers
+ 1, &initializeBarrier); // imageMemoryBarrierCount, pImageMemoryBarriers
}
// Image clear
vk.cmdClearColorImage(targetCmdBuffer, **colorImage, vk::VK_IMAGE_LAYOUT_GENERAL, &m_clearColorValue, 1, &subresourceRange);
+ // Image barrier to change accessMask.
{
const vk::VkImageMemoryBarrier initializeBarrier =
{
subresourceRange // subresourceRange
};
vk.cmdPipelineBarrier(targetCmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
}
};
- vk.cmdPipelineBarrier(targetCmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
- (vk::VkDependencyFlags)0,
- 0, (const vk::VkMemoryBarrier*)DE_NULL,
- 0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
- 1, &startImgBarrier);
+ vk.cmdPipelineBarrier(targetCmdBuffer, // commandBuffer
+ vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // dstStageMask
+ (vk::VkDependencyFlags)0, // dependencyFlags
+ 0, (const vk::VkMemoryBarrier*)DE_NULL, // memoryBarrierCount, pMemoryBarriers
+ 0, (const vk::VkBufferMemoryBarrier*)DE_NULL, // bufferMemoryBarrierCount, pBufferMemoryBarriers
+ 1, &startImgBarrier); // imageMemoryBarrierCount, pImageMemoryBarriers
}
// Image clear
};
vk.cmdPipelineBarrier(targetCmdBuffer,
- vk::VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
};
vk.cmdPipelineBarrier(targetCmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
+ vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
imageExtent, // VkExtent3D extent;
};
- vk.cmdCopyImage(targetCmdBuffer, **colorImageSrc, vk::VK_IMAGE_LAYOUT_GENERAL,
- **colorImage, vk::VK_IMAGE_LAYOUT_GENERAL, 1u, ©ImageRegion);
+ vk.cmdCopyImage(targetCmdBuffer,
+ **colorImageSrc, vk::VK_IMAGE_LAYOUT_GENERAL, // srcImageLayout
+ **colorImage, vk::VK_IMAGE_LAYOUT_GENERAL, // dstImageLayout
+ 1u, ©ImageRegion);
+ // Image barrier to change accessMask for destination image.
{
const vk::VkImageMemoryBarrier endImgBarrier =
{
}
};
vk.cmdPipelineBarrier(targetCmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+ vk::VK_PIPELINE_STAGE_TRANSFER_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
};
vk.cmdPipelineBarrier(*cmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
+ vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
}
};
vk.cmdPipelineBarrier(*cmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
+ vk::VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
0u, // VkDeviceSize offset
VK_WHOLE_SIZE, // VkDeviceSize size
};
+
vk.cmdPipelineBarrier(cmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_TRANSFER_BIT,
+ vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
1, &dstWriteStartBarrier,
{
vk::VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, // VkStructureType sType
DE_NULL, // const void* pNext
- vk::VK_ACCESS_TRANSFER_WRITE_BIT, // VkAccessFlags srcAccessMask
+ vk::VK_ACCESS_SHADER_WRITE_BIT, // VkAccessFlags srcAccessMask
vk::VK_ACCESS_SHADER_READ_BIT, // VkAccessFlags dstAccessMask
queueFamilyIndex, // uint32_t srcQueueFamilyIndex
queueFamilyIndex, // uint32_t dstQueueFamilyIndex
VK_WHOLE_SIZE, // VkDeviceSize size
};
vk.cmdPipelineBarrier(cmdBuffer,
- vk::VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
+ vk::VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
1, &dstWriteEndBarrier,
};
vk.cmdPipelineBarrier(*cmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
+ vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
}
};
vk.cmdPipelineBarrier(*cmdBuffer,
- vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
+ vk::VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, // srcStageMask
+ vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, // dstStageMask
(vk::VkDependencyFlags)0,
0, (const vk::VkMemoryBarrier*)DE_NULL,
0, (const vk::VkBufferMemoryBarrier*)DE_NULL,
{}
};
+static vk::VkCompositeAlphaFlagBitsKHR firstSupportedCompositeAlpha(const vk::VkSurfaceCapabilitiesKHR& capabilities)
+{
+ deUint32 alphaMode = 1u;
+
+ for (;alphaMode < capabilities.supportedCompositeAlpha; alphaMode = alphaMode<<1u)
+ {
+ if ((alphaMode & capabilities.supportedCompositeAlpha) != 0)
+ {
+ break;
+ }
+ }
+
+ return (vk::VkCompositeAlphaFlagBitsKHR)alphaMode;
+}
+
std::vector<vk::VkSwapchainCreateInfoKHR> generateSwapchainParameterCases (vk::wsi::Type wsiType,
TestDimension dimension,
const ProtectedContext& context,
0u,
(const deUint32*)DE_NULL,
defaultTransform,
- vk::VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
+ firstSupportedCompositeAlpha(capabilities),
vk::VK_PRESENT_MODE_FIFO_KHR,
VK_FALSE, // clipped
(vk::VkSwapchainKHR)0 // oldSwapchain
0u,
(const deUint32*)DE_NULL,
transform,
- vk::VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
+ firstSupportedCompositeAlpha(capabilities),
vk::VK_PRESENT_MODE_FIFO_KHR,
VK_FALSE, // clipped
(vk::VkSwapchainKHR)0 // oldSwapchain
*swapchain,
std::numeric_limits<deUint64>::max(),
imageReadySemaphore,
- imageReadyFence,
+ 0,
&imageNdx);
if (acquireResult == vk::VK_SUBOPTIMAL_KHR)
};
renderer.recordFrame(commandBuffer, imageNdx, frameNdx);
- VK_CHECK(vkd.queueSubmit(context.getQueue(), 1u, &submitInfo, (vk::VkFence)0));
+ VK_CHECK(vkd.queueSubmit(context.getQueue(), 1u, &submitInfo, imageReadyFence));
VK_CHECK(vkd.queuePresentKHR(context.getQueue(), &presentInfo));
}
}
beginCommandBuffer(vk, *cmdBuffer);
+ for (deUint32 planeNdx = 0; planeNdx < imageData.getDescription().numPlanes; ++planeNdx)
{
+ const vk::VkImageAspectFlagBits aspect = formatDesc.numPlanes > 1
+ ? vk::getPlaneAspect(planeNdx)
+ : vk::VK_IMAGE_ASPECT_COLOR_BIT;
+
const vk::VkImageMemoryBarrier preCopyBarrier =
{
vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
queueFamilyIndex,
queueFamilyIndex,
image,
- { vk::VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u }
+ { aspect, 0u, 1u, 0u, 1u }
};
vk.cmdPipelineBarrier(*cmdBuffer,
vk.cmdCopyBufferToImage(*cmdBuffer, ***stagingBuffers[planeNdx], image, vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1u, ©);
}
+ for (deUint32 planeNdx = 0; planeNdx < imageData.getDescription().numPlanes; ++planeNdx)
{
+ const vk::VkImageAspectFlagBits aspect = formatDesc.numPlanes > 1
+ ? vk::getPlaneAspect(planeNdx)
+ : vk::VK_IMAGE_ASPECT_COLOR_BIT;
+
const vk::VkImageMemoryBarrier postCopyBarrier =
{
vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
VK_QUEUE_FAMILY_IGNORED,
VK_QUEUE_FAMILY_IGNORED,
image,
- { vk::VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u }
+ { aspect, 0u, 1u, 0u, 1u }
};
vk.cmdPipelineBarrier(*cmdBuffer,