From: Pyry Haulos Date: Thu, 9 Mar 2017 23:41:19 +0000 (-0800) Subject: Merge vk-gl-cts/vulkan-cts-1.0.2 into vk-gl-cts/master X-Git-Tag: upstream/0.1.0~481 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8e88bf0360fc67241c8beaefd9299e56eece9f7a;p=platform%2Fupstream%2FVK-GL-CTS.git Merge vk-gl-cts/vulkan-cts-1.0.2 into vk-gl-cts/master Change-Id: Ic82729c2a686a720ac8c2775b8a2dc92a25989b1 --- 8e88bf0360fc67241c8beaefd9299e56eece9f7a diff --cc external/vulkancts/modules/vulkan/shaderexecutor/vktOpaqueTypeIndexingTests.cpp index d3771e9,bf0f17a..05ecfd1 --- a/external/vulkancts/modules/vulkan/shaderexecutor/vktOpaqueTypeIndexingTests.cpp +++ b/external/vulkancts/modules/vulkan/shaderexecutor/vktOpaqueTypeIndexingTests.cpp @@@ -407,6 -463,246 +463,225 @@@ static vk::VkImageViewType getVkImageVi } } + //! Test image with 1-pixel dimensions and no mipmaps + class TestImage + { + public: + TestImage (Context& context, TextureType texType, tcu::TextureFormat format, const void* colorValue); + + VkImageView getImageView (void) const { return *m_imageView; } + + private: + const Unique m_image; + const UniquePtr m_allocation; + const Unique m_imageView; + }; + + Move createTestImage (const DeviceInterface& vkd, VkDevice device, TextureType texType, tcu::TextureFormat format) + { + const VkImageCreateInfo createInfo = + { + VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, + DE_NULL, + (texType == TEXTURE_TYPE_CUBE ? (VkImageCreateFlags)VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT : (VkImageCreateFlags)0), + getVkImageType(texType), + mapTextureFormat(format), + makeExtent3D(1, 1, 1), + 1u, + (texType == TEXTURE_TYPE_CUBE) ? 6u : 1u, + VK_SAMPLE_COUNT_1_BIT, + VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT, + VK_SHARING_MODE_EXCLUSIVE, + 0u, + DE_NULL, + VK_IMAGE_LAYOUT_UNDEFINED + }; + + return createImage(vkd, device, &createInfo); + } + + de::MovePtr allocateAndBindMemory (const DeviceInterface& vkd, VkDevice device, Allocator& allocator, VkImage image) + { + de::MovePtr alloc = allocator.allocate(getImageMemoryRequirements(vkd, device, image), MemoryRequirement::Any); + + VK_CHECK(vkd.bindImageMemory(device, image, alloc->getMemory(), alloc->getOffset())); + + return alloc; + } + + Move createTestImageView (const DeviceInterface& vkd, VkDevice device, VkImage image, TextureType texType, tcu::TextureFormat format) + { + const bool isDepthImage = format.order == tcu::TextureFormat::D; + const VkImageViewCreateInfo createInfo = + { + VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, + DE_NULL, + (VkImageViewCreateFlags)0, + image, + getVkImageViewType(texType), + mapTextureFormat(format), + { + VK_COMPONENT_SWIZZLE_IDENTITY, + VK_COMPONENT_SWIZZLE_IDENTITY, + VK_COMPONENT_SWIZZLE_IDENTITY, + VK_COMPONENT_SWIZZLE_IDENTITY, + }, + { + (VkImageAspectFlags)(isDepthImage ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT), + 0u, + 1u, + 0u, + (texType == TEXTURE_TYPE_CUBE ? 6u : 1u) + } + }; + + return createImageView(vkd, device, &createInfo); + } + + TestImage::TestImage (Context& context, TextureType texType, tcu::TextureFormat format, const void* colorValue) + : m_image (createTestImage (context.getDeviceInterface(), context.getDevice(), texType, format)) + , m_allocation (allocateAndBindMemory (context.getDeviceInterface(), context.getDevice(), context.getDefaultAllocator(), *m_image)) + , m_imageView (createTestImageView (context.getDeviceInterface(), context.getDevice(), *m_image, texType, format)) + { + const DeviceInterface& vkd = context.getDeviceInterface(); + const VkDevice device = context.getDevice(); + + const size_t pixelSize = (size_t)format.getPixelSize(); + const deUint32 numLayers = (texType == TEXTURE_TYPE_CUBE) ? 6u : 1u; + const size_t numReplicas = (size_t)numLayers; + const size_t stagingBufferSize = pixelSize*numReplicas; + + const VkBufferCreateInfo stagingBufferInfo = + { + VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, + DE_NULL, + (VkBufferCreateFlags)0u, + (VkDeviceSize)stagingBufferSize, + (VkBufferCreateFlags)VK_BUFFER_USAGE_TRANSFER_SRC_BIT, + VK_SHARING_MODE_EXCLUSIVE, + 0u, + DE_NULL, + }; + const Unique stagingBuffer (createBuffer(vkd, device, &stagingBufferInfo)); + const UniquePtr alloc (context.getDefaultAllocator().allocate(getBufferMemoryRequirements(vkd, device, *stagingBuffer), MemoryRequirement::HostVisible)); + + VK_CHECK(vkd.bindBufferMemory(device, *stagingBuffer, alloc->getMemory(), alloc->getOffset())); + + for (size_t ndx = 0; ndx < numReplicas; ++ndx) + deMemcpy((deUint8*)alloc->getHostPtr() + ndx*pixelSize, colorValue, pixelSize); + + { - const VkCommandPoolCreateInfo cmdPoolInfo = - { - VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, - DE_NULL, - (VkCommandPoolCreateFlags)VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, - context.getUniversalQueueFamilyIndex(), - }; - const Unique cmdPool (createCommandPool(vkd, device, &cmdPoolInfo)); - const VkCommandBufferAllocateInfo allocInfo = - { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, - DE_NULL, - *cmdPool, - VK_COMMAND_BUFFER_LEVEL_PRIMARY, - 1u, - }; - const Unique cmdBuf (allocateCommandBuffer(vkd, device, &allocInfo)); - const VkCommandBufferBeginInfo beginInfo = ++ const Unique cmdPool (createCommandPool(vkd, device, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, context.getUniversalQueueFamilyIndex())); ++ const Unique cmdBuf (allocateCommandBuffer(vkd, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY)); ++ const VkCommandBufferBeginInfo beginInfo = + { + VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, + DE_NULL, + (VkCommandBufferUsageFlags)VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, + (const VkCommandBufferInheritanceInfo*)DE_NULL, + }; - const VkImageAspectFlags imageAspect = (VkImageAspectFlags)(format.order == tcu::TextureFormat::D ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT); - const VkBufferImageCopy copyInfo = ++ const VkImageAspectFlags imageAspect = (VkImageAspectFlags)(format.order == tcu::TextureFormat::D ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT); ++ const VkBufferImageCopy copyInfo = + { + 0u, + 1u, + 1u, + { + imageAspect, + 0u, + 0u, + numLayers + }, + { 0u, 0u, 0u }, + { 1u, 1u, 1u } + }; - const VkImageMemoryBarrier preCopyBarrier = ++ const VkImageMemoryBarrier preCopyBarrier = + { + VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, + DE_NULL, + (VkAccessFlags)0u, + (VkAccessFlags)VK_ACCESS_TRANSFER_WRITE_BIT, + VK_IMAGE_LAYOUT_UNDEFINED, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + VK_QUEUE_FAMILY_IGNORED, + VK_QUEUE_FAMILY_IGNORED, + *m_image, + { + imageAspect, + 0u, + 1u, + 0u, + numLayers + } + }; - const VkImageMemoryBarrier postCopyBarrier = ++ const VkImageMemoryBarrier postCopyBarrier = + { + VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, + DE_NULL, + (VkAccessFlags)VK_ACCESS_TRANSFER_WRITE_BIT, + (VkAccessFlags)VK_ACCESS_SHADER_READ_BIT, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, + VK_QUEUE_FAMILY_IGNORED, + VK_QUEUE_FAMILY_IGNORED, + *m_image, + { + imageAspect, + 0u, + 1u, + 0u, + numLayers + } + }; + + VK_CHECK(vkd.beginCommandBuffer(*cmdBuf, &beginInfo)); + vkd.cmdPipelineBarrier(*cmdBuf, + (VkPipelineStageFlags)VK_PIPELINE_STAGE_HOST_BIT, + (VkPipelineStageFlags)VK_PIPELINE_STAGE_TRANSFER_BIT, + (VkDependencyFlags)0u, + 0u, + (const VkMemoryBarrier*)DE_NULL, + 0u, + (const VkBufferMemoryBarrier*)DE_NULL, + 1u, + &preCopyBarrier); + vkd.cmdCopyBufferToImage(*cmdBuf, *stagingBuffer, *m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1u, ©Info); + vkd.cmdPipelineBarrier(*cmdBuf, + (VkPipelineStageFlags)VK_PIPELINE_STAGE_TRANSFER_BIT, + (VkPipelineStageFlags)VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, + (VkDependencyFlags)0u, + 0u, + (const VkMemoryBarrier*)DE_NULL, + 0u, + (const VkBufferMemoryBarrier*)DE_NULL, + 1u, + &postCopyBarrier); + VK_CHECK(vkd.endCommandBuffer(*cmdBuf)); + + { - const VkFenceCreateInfo fenceInfo = - { - VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, - DE_NULL, - (VkFenceCreateFlags)0, - }; - const Unique fence (createFence(vkd, device, &fenceInfo)); - const VkSubmitInfo submitInfo = ++ const Unique fence (createFence(vkd, device)); ++ const VkSubmitInfo submitInfo = + { + VK_STRUCTURE_TYPE_SUBMIT_INFO, + DE_NULL, + 0u, + (const VkSemaphore*)DE_NULL, + (const VkPipelineStageFlags*)DE_NULL, + 1u, + &cmdBuf.get(), + 0u, + (const VkSemaphore*)DE_NULL, + }; + + VK_CHECK(vkd.queueSubmit(context.getUniversalQueue(), 1u, &submitInfo, *fence)); + VK_CHECK(vkd.waitForFences(device, 1u, &fence.get(), VK_TRUE, ~0ull)); + } + } + } + + typedef SharedPtr TestImageSp; + // SamplerIndexingCaseInstance class SamplerIndexingCaseInstance : public OpaqueTypeIndexingTestInstance diff --cc external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp index c945bc7,1419032..5a4cbef --- a/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp +++ b/external/vulkancts/modules/vulkan/shaderexecutor/vktShaderExecutor.cpp @@@ -1908,17 -1963,39 +1917,20 @@@ void ComputeShaderExecutor::execute (in Move descriptorPool; Move descriptorSetLayout; Move descriptorSet; + const deUint32 numDescriptorSets = (m_extraResourcesLayout != 0) ? 2u : 1u; Move fence; - initBuffers(ctx, numValues); + DE_ASSERT((m_extraResourcesLayout != 0) == (extraResources != 0)); + + initBuffers(numValues); // Setup input buffer & copy data - uploadInputBuffer(ctx, inputs, numValues); + uploadInputBuffer(inputs, numValues); // Create command pool - { - const VkCommandPoolCreateInfo cmdPoolParams = - { - VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // VkStructureType sType; - DE_NULL, // const void* pNext; - VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, // VkCmdPoolCreateFlags flags; - queueFamilyIndex // deUint32 queueFamilyIndex; - }; - - cmdPool = createCommandPool(vk, vkDevice, &cmdPoolParams); - } + cmdPool = createCommandPool(vk, vkDevice, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, queueFamilyIndex); // Create command buffer - const VkCommandBufferAllocateInfo cmdBufferParams = - { - VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType; - DE_NULL, // const void* pNext; - *cmdPool, // VkCmdPool cmdPool; - VK_COMMAND_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; - 1u // deUint32 bufferCount; - }; - const VkCommandBufferBeginInfo cmdBufferBeginInfo = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // VkStructureType sType; @@@ -1999,12 -2079,20 +2014,12 @@@ } // Create fence - { - const VkFenceCreateInfo fenceParams = - { - VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType; - DE_NULL, // const void* pNext; - 0u // VkFenceCreateFlags flags; - }; - fence = createFence(vk, vkDevice, &fenceParams); - } + fence = createFence(vk, vkDevice); - const int maxValuesPerInvocation = ctx.getDeviceProperties().limits.maxComputeWorkGroupSize[0]; - int curOffset = 0; - const deUint32 inputStride = getInputStride(); - const deUint32 outputStride = getOutputStride(); + const int maxValuesPerInvocation = m_context.getDeviceProperties().limits.maxComputeWorkGroupSize[0]; + int curOffset = 0; + const deUint32 inputStride = getInputStride(); + const deUint32 outputStride = getOutputStride(); while (curOffset < numValues) {