From b0833b3fc37ae8c5b9945d34c247e7901434aa3d Mon Sep 17 00:00:00 2001 From: Jan Syryczynski Date: Fri, 11 Dec 2015 16:49:10 +0100 Subject: [PATCH] # This is a combination of 3 commits. # The first commit's message is: update to test spec Command buffer submission tests. Updated the part of test spec relevant to command buffer submission. Updated the part of the test spec relevant to Command Pools A minor fix in spec formatting Removed three irrelevant testcases from the part of the test spec related to secondary command buffers. Removed three irrelevant testcases from the part of the spec related to FrameBuffers. 1. Removed unused #include statements 2. Fixed formatting fixed the formatting problem in four files more fixes to formatting even more whitespace fixes removed unnecessary includes, added google to copyright removed resetting buffers that should not take place added test for secondary commnad buffers execution - currently crashing order of execution test - first Updated the test spec according to API v170.2 Updated the part of test spec relevant to command buffer submission. A minor fix in spec formatting Removed three irrelevant testcases from the part of the test spec related to secondary command buffers. Removed three irrelevant testcases from the part of the spec related to FrameBuffers. removed unnecessary includes, added google to copyright removed resetting buffers that should not take place command buffers recording tests added first command buffer test, fix to nexus compilation added test for secondary commnad buffers execution - currently crashing Updated the test spec according to API v170.2 order of execution test - first Updated the part of test spec relevant to command buffer submission. A minor fix in spec formatting Removed three irrelevant testcases from the part of the test spec related to secondary command buffers. Removed three irrelevant testcases from the part of the spec related to FrameBuffers. removed unnecessary includes, added google to copyright 1. Removed all compilation errors: - fixed all testcases barring order_of_execution - commented out order_of_execution and related code in ComputeInstanceResultBuffer.cpp # This is the 2nd commit message: Commented out the one test that caused a segfault. # This is the 3rd commit message: Reverted several unintended changes. --- doc/testspecs/VK/apitests.adoc | 47 +- external/vulkancts/build_spirv_binaries.py | 2 +- .../modules/vulkan/api/BufferComputeInstance.cpp | 332 +++-- .../modules/vulkan/api/BufferComputeInstance.hpp | 51 +- .../vulkan/api/ComputeInstanceResultBuffer.cpp | 131 +- .../vulkan/api/ComputeInstanceResultBuffer.hpp | 75 +- .../vulkan/api/vktApiCommandBuffersTests.cpp | 1436 +++++++++++++++----- .../vulkan/api/vktApiCommandBuffersTests.hpp | 4 +- framework/platform/android/tcuAndroidPlatform.cpp | 2 +- targets/android/android.cmake | 4 +- 10 files changed, 1420 insertions(+), 664 deletions(-) diff --git a/doc/testspecs/VK/apitests.adoc b/doc/testspecs/VK/apitests.adoc index b18df28..a59c53d 100644 --- a/doc/testspecs/VK/apitests.adoc +++ b/doc/testspecs/VK/apitests.adoc @@ -2410,10 +2410,14 @@ VkResult VKAPI vkResetCommandBuffer( |=== |No. | Tested area | Test Description | Relevant specification text |1 | Secondary buffers execution | Check if secondary command buffers are executed | Secondary command buffers may be called from primary command buffers, and are not directly submitted to queues. -|2 | Order of execution | Check if commands that should be executed in-order are indeed done so. | Some command buffer commands are described as executing in-order with respect to other commands. This means that the effect of that one command must happen in the same order, relative to these other commands, as the order they were added to the command buffer. -|3 | Synchronization | The commands may end in different order then they are being executed. Using semaphores for synchronization should prevent this | Unless otherwise specified, and without explicit synchronization, the various commands submitted to a queue via command buffers may execute in arbitrary order relative to each other, and/or concurrently. Also, the memory side-effects of those commands may not be directly visible to other commands without memory barriers. This is true within a command buffer, and across command buffers submitted to a given queue. See topic about synchronization primitives suitable to guarantee execution order and side-effect visibility between commands on a given queue. -|4 | Independent state between buffers | Execute secondary command buffer, change state of primary, execute secondary again, and check if its state was changed | When secondary command buffer(s) are recorded to execute on a primary command buffer, the secondary command buffer inherits no state from the primary command buffer, and all state of the primary command buffer is undefined after an execute secondary command buffer command is recorded. -|5 | Renderpass state independence | State inside a renderpass should not be changed by executing secondary command buffers | If the primary command buffer is inside a renderpass, then the renderpass and subpass state is not disturbed by executing secondary command buffers +|2 | Order of execution | Check if vkCmdBindPipeline commands are executed in-order | +|3 | Order of execution | Check if vkCmdBindDescriptorSets commands are executed in-order | +|4 | Order of execution | Check if vkCmdBindIndexBuffer commands are executed in-order | +|5 | Order of execution | Check if vkCmdBindVertexBuffers commands are executed in-order | +|6 | Order of execution | Check if vkCmdResetQueryPool, vkCmdBeginQuery, vkCmdEndQuery, vkCmdCopyQueryPoolResults commands are executed in-order relative to each other | +|7 | Synchronization | The commands may end in different order then they are being executed. Using semaphores for synchronization should prevent this | Unless otherwise specified, and without explicit synchronization, the various commands submitted to a queue via command buffers may execute in arbitrary order relative to each other, and/or concurrently. Also, the memory side-effects of those commands may not be directly visible to other commands without memory barriers. This is true within a command buffer, and across command buffers submitted to a given queue. See topic about synchronization primitives suitable to guarantee execution order and side-effect visibility between commands on a given queue. +|8 | Independent state between buffers | Execute secondary command buffer, change state of primary, execute secondary again, and check if its state was changed | When secondary command buffer(s) are recorded to execute on a primary command buffer, the secondary command buffer inherits no state from the primary command buffer, and all state of the primary command buffer is undefined after an execute secondary command buffer command is recorded. +|9 | Renderpass state independence | State inside a renderpass should not be changed by executing secondary command buffers | If the primary command buffer is inside a renderpass, then the renderpass and subpass state is not disturbed by executing secondary command buffers |=== Command Buffer lifetime @@ -2433,7 +2437,7 @@ Command Buffer recording [cols="1,4,8,8", options="header"] |=== |No. | Tested area | Test Description | Relevant specification text -|1 | Recording to buffers | Check if all functions that should be recorded, are recorded | +|1 | Recording to buffers | Check if all command that can be recorded, are accepted without problem. | |2 | Render pass ignoring | if VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT flag is not set, the values of renderPass, framebuffer, and subpass members of the VkCommandBufferBeginInfo should be ignored | If flags has VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT set, the entire secondary command buffer is considered inside a render pass. In this case, the renderPass, framebuffer, and subpass members of the VkCommandBufferBeginInfo structure must be set as described below. Otherwise the renderPass, framebuffer, and subpass members of the VkCommandBufferBeginInfo structure are ignored, and the secondary command buffer may not contain commands that are only allowed inside a render pass. |3 | Simultaneous use – primary buffers | Set flag VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT and submit two times simultanously | If flags does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set, the command buffer must not be pending execution more than once at any given time. A primary command buffer is considered to be pending execution from the time it is submitted via vkQueueSubmit until that submission completes. |4 | Simultaneous use – secondary buffers | Set VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT on secondary buffer, and use the secondary buffer twice in primary buffer | If VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT is not set on a secondary command buffer, that command buffer cannot be used more than once in a given primary command buffer. @@ -2453,10 +2457,7 @@ Command Buffer submission |No. | Tested area | Test Description | Relevant specification text |1 | Submission correctness | Call vkQueueSubmit with submitCount equal to the actual count of submits | pSubmits must be an array of submitCount valid VkSubmitInfo structures. If submitCount is 0 though, pSubmits is ignored |2 | | ... submitCount == 0 | -|3 | queue and fence origin | Call vkQueueSubmit with queue and fence that were created from the same VkDevice | queue and fence must have been created, allocated or retrieved from the same VkDevice -|4 | | Call vkQueueSubmit with queue and fence that were allocated from the same VkDevice | -|5 | | Call vkQueueSubmit with queue and fence that were retrieved from the same VkDevice | -|6 | Fence validity | Call vkQueueSubmit with VK_NULL_HANDLE passed as fence. | If fence is not VK_NULL_HANDLE, fence must be a valid VkFence handle +|3 | Submission without a fence | Call vkQueueSubmit with VK_NULL_HANDLE passed as fence. | If fence is not VK_NULL_HANDLE, fence must be a valid VkFence handle |=== Command Pools @@ -2498,7 +2499,9 @@ VkResult VKAPI vkResetCommandPool( [cols="1,4,8,8", options="header"] |=== |No. | Tested area | Test Description | Relevant specification text -|1 | Create, Reset and Destroy a Command Pool | Simple usage test. Create command pool, reset it, and destroy it. Check if result is success. | +|1 | Create | Performed in virtually every other test. | +|2 | Reset | Tested in bulk command buffer reset. (Is it enough?) | +|3 | Destroy | (Impossible to test. The only way to check if it was destroyed is to attempt to use it. If the destruction was successful, it will result in a segmentation fault leading to the test crashing.) | |=== Secondary Command Buffers @@ -2517,12 +2520,9 @@ void VKAPI vkCmdExecuteCommands( [cols="1,4,8,8", options="header"] |=== |No. | Tested area | Test Description | Relevant specification text -|1 | Buffers' origin | Call vkCmdExecuteCommands with commandBuffer and pCommandBuffers that created from the same VkDevice | commandBuffer and pCommandBuffers must have been created, allocated or retrieved from the same VkDevice -|2 | | ... allocated from the same VkDevice | -|3 | | ... retrieved from the same VkDevice | -|4 | Simultaneous use | Call vkCmdExecuteCommands with pCommandBuffers such that its element is already pending execution in commandBuffer and was created with the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT flag | Any given element of pCommandBuffers must not be already pending execution in commandBuffer, or appear twice in pCommandBuffers, unless it was created with the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT flag -|5 | | Call vkCmdExecuteCommands with pCommandBuffers such that its element appears twice in pCommandBuffers and was created with the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT flag | -|6 | Call from within a VkRenderPass | Call vkCmdExecuteCommands within a VkRenderPass with all elements of pCommandBuffers recorded with the VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT | If vkCmdExecuteCommands is being called within a VkRenderPass, any given element of pCommandBuffers must have been recorded with the VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT +|1 | Simultaneous use | Call vkCmdExecuteCommands with pCommandBuffers such that its element is already pending execution in commandBuffer and was created with the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT flag | Any given element of pCommandBuffers must not be already pending execution in commandBuffer, or appear twice in pCommandBuffers, unless it was created with the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT flag +|2 | | Call vkCmdExecuteCommands with pCommandBuffers such that its element appears twice in pCommandBuffers and was created with the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT flag | +|3 | Call from within a VkRenderPass | Call vkCmdExecuteCommands within a VkRenderPass with all elements of pCommandBuffers recorded with the VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT | If vkCmdExecuteCommands is being called within a VkRenderPass, any given element of pCommandBuffers must have been recorded with the VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT |=== Render Pass @@ -2575,15 +2575,12 @@ Framebuffers |No. | Tested area | Test Description | Relevant specification text |1 | Attachment count in pCreateInfo | Call vkCreateFramebuffer with pCreateInfo such that attachmentCount is equal to the number of attachments | pAttachments must be an array of attachmentCount valid VkImageView handles. If attachmentCount is 0 though, pAttachments is ignored |2 | | ... where attachmentCount == 0 | -|3 | Render Pass and Attachments origin | Call vkCreateFramebuffer with pCreateInfo such that renderPass and pAttachments were created using the same VkDevice | renderPass and pAttachments must have been created, allocated or retrieved from the same VkDevice -|4 | | ... renderPass and pAttachments were allocated using the same VkDevice | -|5 | | ... renderPass and pAttachments were retrieved from the same VkDevice | -|6 | Dimensions | Call vkCreateFramebuffer with pCreateInfo such that width == 0 | The value of width must be less or equal to than VkPhysicalDeviceLimits::maxFramebufferWidth -|7 | | ... width == VkPhysicalDeviceLimits::maxFramebufferWidth | -|8 | | ... 0 < width < VkPhysicalDeviceLimits::maxFramebufferWidth | -|9 | | ... height == 0 | The value of height must be less or equal to than VkPhysicalDeviceLimits::maxFramebufferHeight -|10 | | ... height == VkPhysicalDeviceLimits::maxFramebufferHeight | -|11 | | ... 0 < height < VkPhysicalDeviceLimits::maxFramebufferHeight | +|3 | Dimensions | Call vkCreateFramebuffer with pCreateInfo such that width == 0 | The value of width must be less or equal to than VkPhysicalDeviceLimits::maxFramebufferWidth +|4 | | ... width == VkPhysicalDeviceLimits::maxFramebufferWidth | +|5 | | ... 0 < width < VkPhysicalDeviceLimits::maxFramebufferWidth | +|6 | | ... height == 0 | The value of height must be less or equal to than VkPhysicalDeviceLimits::maxFramebufferHeight +|7 | | ... height == VkPhysicalDeviceLimits::maxFramebufferHeight | +|8 | | ... 0 < height < VkPhysicalDeviceLimits::maxFramebufferHeight | |=== Draw commands diff --git a/external/vulkancts/build_spirv_binaries.py b/external/vulkancts/build_spirv_binaries.py index 31b37d5..8927f79 100644 --- a/external/vulkancts/build_spirv_binaries.py +++ b/external/vulkancts/build_spirv_binaries.py @@ -77,7 +77,7 @@ def execBuildPrograms (buildCfg, generator, module, mode, dstPath): try: binPath = generator.getBinaryPath(buildCfg.getBuildType(), os.path.join(".", "vk-build-programs")) - subprocess.call([binPath, "--mode", mode, "--dst-path", dstPath]) + execute([binPath, "--mode", mode, "--dst-path", dstPath]) finally: popWorkingDir() diff --git a/external/vulkancts/modules/vulkan/api/BufferComputeInstance.cpp b/external/vulkancts/modules/vulkan/api/BufferComputeInstance.cpp index d2fa70d..209cc08 100644 --- a/external/vulkancts/modules/vulkan/api/BufferComputeInstance.cpp +++ b/external/vulkancts/modules/vulkan/api/BufferComputeInstance.cpp @@ -1,194 +1,192 @@ - /*------------------------------------------------------------------------- - * Vulkan Conformance Tests - * ------------------------ - * - * Copyright (c) 2015 The Khronos Group Inc. - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and/or associated documentation files (the - * "Materials"), to deal in the Materials without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Materials, and to - * permit persons to whom the Materials are furnished to do so, subject to - * the following conditions: - * - * The above copyright notice(s) and this permission notice shall be - * included in all copies or substantial portions of the Materials. - * - * The Materials are Confidential Information as defined by the - * Khronos Membership Agreement until designated non-confidential by - * Khronos, at which point this condition clause shall be removed. - * - * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - * - *//*--------------------------------------------------------------------*/ - - +* Vulkan Conformance Tests +* ------------------------ +* +* Copyright (c) 2015 The Khronos Group Inc. +* Copyright (c) 2015 Samsung Electronics Co., Ltd. +* Copyright (c) 2015 Google Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and/or associated documentation files (the +* "Materials"), to deal in the Materials without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Materials, and to +* permit persons to whom the Materials are furnished to do so, subject to +* the following conditions: +* +* The above copyright notice(s) and this permission notice shall be +* included in all copies or substantial portions of the Materials. +* +* The Materials are Confidential Information as defined by the +* Khronos Membership Agreement until designated non-confidential by +* Khronos, at which point this condition clause shall be removed. +* +* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +* +*//*--------------------------------------------------------------------*/ #include "BufferComputeInstance.hpp" +#include "ComputeInstanceResultBuffer.hpp" +#include "vkRefUtil.hpp" +#include "vkBuilderUtil.hpp" using namespace vk; -using tcu::TestLog; -using de::UniquePtr; - - -vk::VkDescriptorInfo createDescriptorInfo (vk::VkBuffer buffer, vk::VkDeviceSize offset, vk::VkDeviceSize range) -{ - const vk::VkDescriptorInfo resultInfo = - { - 0, // bufferView - 0, // sampler - 0, // imageView - (vk::VkImageLayout)0, // imageLayout - { buffer, offset, range } // bufferInfo - }; - return resultInfo; +/* +VkDescriptorInfo createDescriptorInfo (VkBuffer buffer, VkDeviceSize offset, VkDeviceSize range) { + const VkDescriptorInfo resultInfo = + { + 0, // bufferView + 0, // sampler + 0, // imageView + (VkImageLayout) 0, // imageLayout + {buffer, offset, range} // bufferInfo + }; + return resultInfo; }; -vk::VkDescriptorInfo createDescriptorInfo (vk::VkBufferView bufferView) -{ - const vk::VkDescriptorInfo resultInfo = - { - bufferView, // bufferView - 0, // sampler - 0, // imageView - (vk::VkImageLayout)0, // imageLayout - { (vk::VkBuffer)0, 0, 0 } // bufferInfo - }; - return resultInfo; +VkDescriptorInfo createDescriptorInfo (VkBufferView bufferView) { + const VkDescriptorInfo resultInfo = + { + bufferView, // bufferView + 0, // sampler + 0, // imageView + (VkImageLayout) 0, // imageLayout + {(VkBuffer) 0, 0, 0} // bufferInfo + }; + return resultInfo; }; -vk::VkDescriptorInfo createDescriptorInfo (vk::VkSampler sampler) -{ - const vk::VkDescriptorInfo resultInfo = - { - 0, // bufferView - sampler, // sampler - 0, // imageView - (vk::VkImageLayout)0, // imageLayout - { (vk::VkBuffer)0, 0, 0 } // bufferInfo - }; - return resultInfo; +VkDescriptorInfo createDescriptorInfo (VkSampler sampler) { + const VkDescriptorInfo resultInfo = + { + 0, // bufferView + sampler, // sampler + 0, // imageView + (VkImageLayout) 0, // imageLayout + {(VkBuffer) 0, 0, 0} // bufferInfo + }; + return resultInfo; }; -vk::VkDescriptorInfo createDescriptorInfo (vk::VkImageView imageView, vk::VkImageLayout layout) -{ - const vk::VkDescriptorInfo resultInfo = - { - 0, // bufferView - 0, // sampler - imageView, // imageView - layout, // imageLayout - { (vk::VkBuffer)0, 0, 0 } // bufferInfo - }; - return resultInfo; +VkDescriptorInfo createDescriptorInfo (VkImageView imageView, VkImageLayout layout) { + const VkDescriptorInfo resultInfo = + { + 0, // bufferView + 0, // sampler + imageView, // imageView + layout, // imageLayout + {(VkBuffer) 0, 0, 0} // bufferInfo + }; + return resultInfo; }; -vk::VkDescriptorInfo createDescriptorInfo (vk::VkSampler sampler, vk::VkImageView imageView, vk::VkImageLayout layout) -{ - const vk::VkDescriptorInfo resultInfo = - { - 0, // bufferView - sampler, // sampler - imageView, // imageView - layout, // imageLayout - { (vk::VkBuffer)0, 0, 0 } // bufferInfo - }; - return resultInfo; +VkDescriptorInfo createDescriptorInfo (VkSampler sampler, VkImageView imageView, VkImageLayout layout) { + const VkDescriptorInfo resultInfo = + { + 0, // bufferView + sampler, // sampler + imageView, // imageView + layout, // imageLayout + {(VkBuffer) 0, 0, 0} // bufferInfo + }; + return resultInfo; }; -vk::Move createColorDataBuffer (deUint32 offset, deUint32 bufferSize, const tcu::Vec4& value1, const tcu::Vec4& value2, de::MovePtr* outAllocation, vkt::Context& context) -{ - const vk::DeviceInterface& m_vki = context.getDeviceInterface(); - const vk::VkDevice m_device = context.getDevice(); - vk::Allocator& m_allocator = context.getDefaultAllocator(); - - DE_ASSERT(offset + sizeof(tcu::Vec4[2]) <= bufferSize); - - const vk::VkBufferUsageFlags usageFlags = (vk::VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) ; - const vk::VkBufferCreateInfo createInfo = - { - vk::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, - DE_NULL, - (vk::VkDeviceSize)bufferSize, // size - usageFlags, // usage - 0u, // flags - vk::VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0u, // queueFamilyCount - DE_NULL, // pQueueFamilyIndices - }; - vk::Move buffer (vk::createBuffer(m_vki, m_device, &createInfo)); - de::MovePtr allocation (allocateAndBindObjectMemory(m_vki, m_device, m_allocator, *buffer, vk::MemoryRequirement::HostVisible)); - void* mapPtr = allocation->getHostPtr(); - - if (offset) - deMemset(mapPtr, 0x5A, (size_t)offset); - deMemcpy((deUint8*)mapPtr + offset, value1.getPtr(), sizeof(tcu::Vec4)); - deMemcpy((deUint8*)mapPtr + offset + sizeof(tcu::Vec4), value2.getPtr(), sizeof(tcu::Vec4)); - deMemset((deUint8*)mapPtr + offset + 2 * sizeof(tcu::Vec4), 0x5A, (size_t)bufferSize - (size_t)offset - 2 * sizeof(tcu::Vec4)); - - flushMappedMemoryRange(m_vki, m_device, allocation->getMemory(), allocation->getOffset(), bufferSize); - - *outAllocation = allocation; - return buffer; +Move createColorDataBuffer (deUint32 offset, deUint32 bufferSize, const tcu::Vec4 &value1, + const tcu::Vec4 &value2, de::MovePtr *outAllocation, + vkt::Context &context) { + const DeviceInterface &m_vki = context.getDeviceInterface(); + const VkDevice m_device = context.getDevice(); + Allocator &m_allocator = context.getDefaultAllocator(); + + DE_ASSERT(offset + sizeof(tcu::Vec4[2]) <= bufferSize); + + const VkBufferUsageFlags usageFlags = (VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT); + const VkBufferCreateInfo createInfo = + { + VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, + DE_NULL, + (VkDeviceSize) bufferSize, // size + usageFlags, // usage + 0u, // flags + VK_SHARING_MODE_EXCLUSIVE, // sharingMode + 0u, // queueFamilyCount + DE_NULL, // pQueueFamilyIndices + }; + Move buffer(createBuffer(m_vki, m_device, &createInfo)); + de::MovePtr allocation( + allocateAndBindObjectMemory(m_vki, m_device, m_allocator, *buffer, MemoryRequirement::HostVisible)); + void *mapPtr = allocation->getHostPtr(); + + if (offset) + deMemset(mapPtr, 0x5A, (size_t) offset); + deMemcpy((deUint8 *) mapPtr + offset, value1.getPtr(), sizeof(tcu::Vec4)); + deMemcpy((deUint8 *) mapPtr + offset + sizeof(tcu::Vec4), value2.getPtr(), sizeof(tcu::Vec4)); + deMemset((deUint8 *) mapPtr + offset + 2 * sizeof(tcu::Vec4), 0x5A, + (size_t) bufferSize - (size_t) offset - 2 * sizeof(tcu::Vec4)); + + flushMappedMemoryRange(m_vki, m_device, allocation->getMemory(), allocation->getOffset(), bufferSize); + + *outAllocation = allocation; + return buffer; } -vk::Move createDescriptorSetLayout (vkt::Context& context) -{ - - const vk::DeviceInterface& m_vki = context.getDeviceInterface(); - const vk::VkDevice m_device = context.getDevice(); - - vk::DescriptorSetLayoutBuilder builder; +Move createDescriptorSetLayout (vkt::Context &context) { - builder.addSingleBinding(vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, vk::VK_SHADER_STAGE_COMPUTE_BIT); + const DeviceInterface &m_vki = context.getDeviceInterface(); + const VkDevice m_device = context.getDevice(); - builder.addSingleBinding( vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, vk::VK_SHADER_STAGE_COMPUTE_BIT); + DescriptorSetLayoutBuilder builder; + builder.addSingleBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_SHADER_STAGE_COMPUTE_BIT); + builder.addSingleBinding(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_COMPUTE_BIT); - return builder.build(m_vki, m_device); + return builder.build(m_vki, m_device); } -vk::Move createDescriptorPool (vkt::Context& context) -{ - const vk::DeviceInterface& m_vki = context.getDeviceInterface(); - const vk::VkDevice m_device = context.getDevice(); +Move createDescriptorPool (vkt::Context &context) { + const DeviceInterface &m_vki = context.getDeviceInterface(); + const VkDevice m_device = context.getDevice(); - return vk::DescriptorPoolBuilder() - .addType(vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) - .addType( vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1u) - .build(m_vki, m_device, vk::VK_DESCRIPTOR_POOL_USAGE_ONE_SHOT, 1); + return DescriptorPoolBuilder() + .addType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) + .addType(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1u) + .build(m_vki, m_device, VK_DESCRIPTOR_POOL_USAGE_ONE_SHOT, 1); } -vk::Move createDescriptorSet (vk::VkDescriptorPool pool, vk::VkDescriptorSetLayout layout, vk::VkBuffer viewA, deUint32 offsetA, vk::VkBuffer viewB, deUint32 offsetB, vk::VkBuffer resBuf, vkt::Context& context) -{ - const vk::DeviceInterface& m_vki = context.getDeviceInterface(); - const vk::VkDevice m_device = context.getDevice(); - - const vk::VkDescriptorInfo resultInfo = createDescriptorInfo(resBuf, 0u, (vk::VkDeviceSize)ComputeInstanceResultBuffer::DATA_SIZE); - const vk::VkDescriptorInfo bufferInfos[2] = - { - createDescriptorInfo(viewA, (vk::VkDeviceSize)offsetA, (vk::VkDeviceSize)sizeof(tcu::Vec4[2])), - createDescriptorInfo(viewB, (vk::VkDeviceSize)offsetB, (vk::VkDeviceSize)sizeof(tcu::Vec4[2])), - }; - - vk::Move descriptorSet = allocDescriptorSet(m_vki, m_device, pool, vk::VK_DESCRIPTOR_SET_USAGE_ONE_SHOT, layout); - vk::DescriptorSetUpdateBuilder builder; - - // result - builder.writeSingle(*descriptorSet, vk::DescriptorSetUpdateBuilder::Location::binding(0u), vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, &resultInfo); - - // buffers - builder.writeSingle(*descriptorSet, vk::DescriptorSetUpdateBuilder::Location::binding(1u), vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, &bufferInfos[0]); - - builder.update(m_vki, m_device); - return descriptorSet; +Move createDescriptorSet (VkDescriptorPool pool, VkDescriptorSetLayout layout, + VkBuffer viewA, deUint32 offsetA, VkBuffer viewB, + deUint32 offsetB, VkBuffer resBuf, vkt::Context &context) { + const DeviceInterface &m_vki = context.getDeviceInterface(); + const VkDevice m_device = context.getDevice(); + + const VkDescriptorInfo resultInfo = createDescriptorInfo(resBuf, 0u, + (VkDeviceSize) ComputeInstanceResultBuffer::DATA_SIZE); + const VkDescriptorInfo bufferInfos[2] = + { + createDescriptorInfo(viewA, (VkDeviceSize) offsetA, (VkDeviceSize)sizeof(tcu::Vec4[2])), + createDescriptorInfo(viewB, (VkDeviceSize)offsetB, (VkDeviceSize)sizeof(tcu::Vec4[2])), + }; + + Move descriptorSet = allocDescriptorSet(m_vki, m_device, pool, + VK_DESCRIPTOR_SET_USAGE_ONE_SHOT, layout); + DescriptorSetUpdateBuilder builder; + + // result + builder.writeSingle(*descriptorSet, DescriptorSetUpdateBuilder::Location::binding(0u), + VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, &resultInfo); + + // buffers + builder.writeSingle(*descriptorSet, DescriptorSetUpdateBuilder::Location::binding(1u), + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, &bufferInfos[0]); + + builder.update(m_vki, m_device); + return descriptorSet; } +*/ \ No newline at end of file diff --git a/external/vulkancts/modules/vulkan/api/BufferComputeInstance.hpp b/external/vulkancts/modules/vulkan/api/BufferComputeInstance.hpp index b95392b..c16de19 100644 --- a/external/vulkancts/modules/vulkan/api/BufferComputeInstance.hpp +++ b/external/vulkancts/modules/vulkan/api/BufferComputeInstance.hpp @@ -1,6 +1,5 @@ -#ifndef BUFFERCOMPUTEINSTANCE_HPP -#define BUFFERCOMPUTEINSTANCE_HPP - +#ifndef _BUFFERCOMPUTEINSTANCE_HPP +#define _BUFFERCOMPUTEINSTANCE_HPP /*------------------------------------------------------------------------- * Vulkan Conformance Tests @@ -8,6 +7,7 @@ * * Copyright (c) 2015 The Khronos Group Inc. * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the @@ -34,42 +34,23 @@ * *//*--------------------------------------------------------------------*/ - - -#include "vktTestCase.hpp" - -#include "vkDefs.hpp" +#include "tcuVectorType.hpp" #include "vkRef.hpp" -#include "vkRefUtil.hpp" -#include "vkPlatform.hpp" -#include "vkPrograms.hpp" #include "vkMemUtil.hpp" -#include "vkBuilderUtil.hpp" -#include "vkQueryUtil.hpp" +#include "vktTestCase.hpp" + +vk::Move createColorDataBuffer (deUint32 offset, deUint32 bufferSize, const tcu::Vec4 &value1, + const tcu::Vec4 &value2, de::MovePtr *outAllocation, + vkt::Context &context); -#include "tcuVector.hpp" -#include "tcuVectorUtil.hpp" -#include "tcuTexture.hpp" -#include "tcuTextureUtil.hpp" -#include "tcuResultCollector.hpp" -#include "tcuTestLog.hpp" -#include "tcuRGBA.hpp" -#include "tcuSurface.hpp" -#include "tcuImageCompare.hpp" +vk::Move createBufferView (vk::VkBuffer buffer, deUint32 offset); -#include "deUniquePtr.hpp" -#include "deSharedPtr.hpp" -#include "deStringUtil.hpp" -#include "deArrayUtil.hpp" +vk::Move createDescriptorSetLayout (vkt::Context &context); -#include "tcuDefs.hpp" -#include "tcuTestCase.hpp" -#include "ComputeInstanceResultBuffer.hpp" +vk::Move createDescriptorPool (vkt::Context &context); -vk::Move createColorDataBuffer (deUint32 offset, deUint32 bufferSize, const tcu::Vec4& value1, const tcu::Vec4& value2, de::MovePtr* outAllocation, vkt::Context& context); -vk::Move createBufferView (vk::VkBuffer buffer, deUint32 offset) ; -vk::Move createDescriptorSetLayout (vkt::Context& context) ; -vk::Move createDescriptorPool (vkt::Context& context) ; -vk::Move createDescriptorSet (vk::VkDescriptorPool pool, vk::VkDescriptorSetLayout layout, vk::VkBuffer viewA, deUint32 offsetA, vk::VkBuffer viewB, deUint32 offsetB, vk::VkBuffer resBuf, vkt::Context& context) ; +vk::Move createDescriptorSet (vk::VkDescriptorPool pool, vk::VkDescriptorSetLayout layout, + vk::VkBuffer viewA, deUint32 offsetA, vk::VkBuffer viewB, + deUint32 offsetB, vk::VkBuffer resBuf, vkt::Context &context); -#endif //VULKANCTS_BUFFERCOMPUTEINSTANCE_HPP +#endif //_BUFFERCOMPUTEINSTANCE_HPP diff --git a/external/vulkancts/modules/vulkan/api/ComputeInstanceResultBuffer.cpp b/external/vulkancts/modules/vulkan/api/ComputeInstanceResultBuffer.cpp index b03d686..03c5d26 100644 --- a/external/vulkancts/modules/vulkan/api/ComputeInstanceResultBuffer.cpp +++ b/external/vulkancts/modules/vulkan/api/ComputeInstanceResultBuffer.cpp @@ -1,10 +1,10 @@ - /*------------------------------------------------------------------------- * Vulkan Conformance Tests * ------------------------ * * Copyright (c) 2015 The Khronos Group Inc. * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the @@ -31,86 +31,77 @@ * *//*--------------------------------------------------------------------*/ - - #include "ComputeInstanceResultBuffer.hpp" - +#include "vkRefUtil.hpp" using namespace vk; -using tcu::TestLog; -using de::UniquePtr; - -ComputeInstanceResultBuffer::ComputeInstanceResultBuffer (const vk::DeviceInterface& vki, - vk::VkDevice device, - vk::Allocator& allocator) - : m_vki (vki) - , m_device (device) - , m_bufferMem (DE_NULL) - , m_buffer (createResultBuffer(m_vki, m_device, allocator, &m_bufferMem)) - , m_bufferBarrier (createResultBufferBarrier(*m_buffer)) -{ +ComputeInstanceResultBuffer::ComputeInstanceResultBuffer(const DeviceInterface &vki, + VkDevice device, + Allocator &allocator) + : m_vki(vki), m_device(device), m_bufferMem(DE_NULL), + m_buffer(createResultBuffer(m_vki, m_device, allocator, &m_bufferMem)), + m_bufferBarrier(createResultBufferBarrier(*m_buffer)) { } -void ComputeInstanceResultBuffer::readResultContentsTo (tcu::Vec4 (*results)[4]) const -{ - invalidateMappedMemoryRange(m_vki, m_device, m_bufferMem->getMemory(), m_bufferMem->getOffset(), sizeof(*results)); - deMemcpy(*results, m_bufferMem->getHostPtr(), sizeof(*results)); +void ComputeInstanceResultBuffer::readResultContentsTo(tcu::Vec4 (*results)[4]) const { + invalidateMappedMemoryRange(m_vki, m_device, m_bufferMem->getMemory(), m_bufferMem->getOffset(), sizeof(*results)); + deMemcpy(*results, m_bufferMem->getHostPtr(), sizeof(*results)); } -de::MovePtr allocateAndBindObjectMemory (const vk::DeviceInterface& vki, vk::VkDevice device, vk::Allocator& allocator, vk::VkBuffer buffer, vk::MemoryRequirement requirement) -{ - const vk::VkMemoryRequirements requirements = vk::getBufferMemoryRequirements(vki, device, buffer); - de::MovePtr allocation = allocator.allocate(requirements, requirement); +de::MovePtr allocateAndBindObjectMemory(const DeviceInterface &vki, VkDevice device, Allocator &allocator, + VkBuffer buffer, MemoryRequirement requirement) { + const VkMemoryRequirements requirements = getBufferMemoryRequirements(vki, device, buffer); + de::MovePtr allocation = allocator.allocate(requirements, requirement); - VK_CHECK(vki.bindBufferMemory(device, buffer, allocation->getMemory(), allocation->getOffset())); - return allocation; + VK_CHECK(vki.bindBufferMemory(device, buffer, allocation->getMemory(), allocation->getOffset())); + return allocation; } - -vk::Move ComputeInstanceResultBuffer::createResultBuffer (const vk::DeviceInterface& vki, - vk::VkDevice device, - vk::Allocator& allocator, - de::MovePtr* outAllocation) -{ - const vk::VkBufferCreateInfo createInfo = - { - vk::VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, - DE_NULL, - (vk::VkDeviceSize)DATA_SIZE, // size - vk::VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, // usage - 0u, // flags - vk::VK_SHARING_MODE_EXCLUSIVE, // sharingMode - 0u, // queueFamilyCount - DE_NULL, // pQueueFamilyIndices - }; - vk::Move buffer (vk::createBuffer(vki, device, &createInfo)); - de::MovePtr allocation (allocateAndBindObjectMemory(vki, device, allocator, *buffer, vk::MemoryRequirement::HostVisible)); - const float clearValue = -1.0f; - void* mapPtr = allocation->getHostPtr(); - - for (size_t offset = 0; offset < DATA_SIZE; offset += sizeof(float)) - deMemcpy(((deUint8*)mapPtr) + offset, &clearValue, sizeof(float)); - - flushMappedMemoryRange(vki, device, allocation->getMemory(), allocation->getOffset(), (vk::VkDeviceSize)DATA_SIZE); - - *outAllocation = allocation; - return buffer; +Move ComputeInstanceResultBuffer::createResultBuffer(const DeviceInterface &vki, + VkDevice device, + Allocator &allocator, + de::MovePtr *outAllocation) { + const VkBufferCreateInfo createInfo = + { + VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, + DE_NULL, + (VkDeviceSize) DATA_SIZE, // size + VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, // usage + 0u, // flags + VK_SHARING_MODE_EXCLUSIVE, // sharingMode + 0u, // queueFamilyCount + DE_NULL, // pQueueFamilyIndices + }; + + Move buffer(createBuffer(vki, device, &createInfo)); + de::MovePtr allocation( + allocateAndBindObjectMemory(vki, device, allocator, *buffer, MemoryRequirement::HostVisible)); + const float clearValue = -1.0f; + void *mapPtr = allocation->getHostPtr(); + + for (size_t offset = 0; offset < DATA_SIZE; offset += sizeof(float)) + deMemcpy(((deUint8 *) mapPtr) + offset, &clearValue, sizeof(float)); + + flushMappedMemoryRange(vki, device, allocation->getMemory(), allocation->getOffset(), (VkDeviceSize) DATA_SIZE); + + *outAllocation = allocation; + return buffer; } -vk::VkBufferMemoryBarrier ComputeInstanceResultBuffer::createResultBufferBarrier (vk::VkBuffer buffer) -{ - const vk::VkBufferMemoryBarrier bufferBarrier = - { - vk::VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, - DE_NULL, - vk::VK_MEMORY_OUTPUT_SHADER_WRITE_BIT, // outputMask - vk::VK_MEMORY_INPUT_HOST_READ_BIT, // inputMask - vk::VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - vk::VK_QUEUE_FAMILY_IGNORED, // destQueueFamilyIndex - buffer, // buffer - (vk::VkDeviceSize)0u, // offset - DATA_SIZE, // size - }; - return bufferBarrier; +VkBufferMemoryBarrier ComputeInstanceResultBuffer::createResultBufferBarrier(VkBuffer buffer) { + const VkBufferMemoryBarrier bufferBarrier = + { + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, + DE_NULL, + VK_ACCESS_SHADER_WRITE_BIT, // outputMask + VK_ACCESS_SHADER_READ_BIT, // inputMask + VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex + VK_QUEUE_FAMILY_IGNORED, // destQueueFamilyIndex + buffer, // buffer + (VkDeviceSize) 0u, // offset + DATA_SIZE, // size + }; + + return bufferBarrier; } diff --git a/external/vulkancts/modules/vulkan/api/ComputeInstanceResultBuffer.hpp b/external/vulkancts/modules/vulkan/api/ComputeInstanceResultBuffer.hpp index 170131d..103e662 100644 --- a/external/vulkancts/modules/vulkan/api/ComputeInstanceResultBuffer.hpp +++ b/external/vulkancts/modules/vulkan/api/ComputeInstanceResultBuffer.hpp @@ -1,13 +1,13 @@ #ifndef _COMPUTEINSTANCERESULTBUFFER_HPP #define _COMPUTEINSTANCERESULTBUFFER_HPP - /*------------------------------------------------------------------------- * Vulkan Conformance Tests * ------------------------ * * Copyright (c) 2015 The Khronos Group Inc. * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the @@ -34,69 +34,46 @@ * *//*--------------------------------------------------------------------*/ - - -#include "vktTestCase.hpp" - -#include "vkDefs.hpp" #include "vkRef.hpp" -#include "vkRefUtil.hpp" -#include "vkPlatform.hpp" -#include "vkPrograms.hpp" #include "vkMemUtil.hpp" -#include "vkBuilderUtil.hpp" #include "vkQueryUtil.hpp" - -#include "tcuVector.hpp" -#include "tcuVectorUtil.hpp" -#include "tcuTexture.hpp" -#include "tcuTextureUtil.hpp" -#include "tcuResultCollector.hpp" #include "tcuTestLog.hpp" -#include "tcuRGBA.hpp" -#include "tcuSurface.hpp" -#include "tcuImageCompare.hpp" - #include "deUniquePtr.hpp" -#include "deSharedPtr.hpp" -#include "deStringUtil.hpp" -#include "deArrayUtil.hpp" - - -class ComputeInstanceResultBuffer -{ +class ComputeInstanceResultBuffer { public: - enum - { - DATA_SIZE = sizeof(tcu::Vec4[4]) - }; + enum { + DATA_SIZE = sizeof(tcu::Vec4[4]) + }; + + ComputeInstanceResultBuffer(const vk::DeviceInterface &vki, + vk::VkDevice device, + vk::Allocator &allocator); - ComputeInstanceResultBuffer (const vk::DeviceInterface& vki, - vk::VkDevice device, - vk::Allocator& allocator); + void readResultContentsTo(tcu::Vec4 (*results)[4]) const; - void readResultContentsTo (tcu::Vec4 (*results)[4]) const; + inline vk::VkBuffer getBuffer(void) const { return *m_buffer; } - inline vk::VkBuffer getBuffer (void) const { return *m_buffer; } - inline const void* getResultReadBarrier (void) const { return &m_bufferBarrier; } + inline const void *getResultReadBarrier(void) const { return &m_bufferBarrier; } private: - static vk::Move createResultBuffer (const vk::DeviceInterface& vki, - vk::VkDevice device, - vk::Allocator& allocator, - de::MovePtr* outAllocation); + static vk::Move createResultBuffer(const vk::DeviceInterface &vki, + vk::VkDevice device, + vk::Allocator &allocator, + de::MovePtr *outAllocation); - static vk::VkBufferMemoryBarrier createResultBufferBarrier (vk::VkBuffer buffer); + static vk::VkBufferMemoryBarrier createResultBufferBarrier(vk::VkBuffer buffer); - const vk::DeviceInterface& m_vki; - const vk::VkDevice m_device; + const vk::DeviceInterface & m_vki; + const vk::VkDevice m_device; - de::MovePtr m_bufferMem; - const vk::Unique m_buffer; - const vk::VkBufferMemoryBarrier m_bufferBarrier; + de::MovePtr m_bufferMem; + const vk::Unique m_buffer; + const vk::VkBufferMemoryBarrier m_bufferBarrier; }; -de::MovePtr allocateAndBindObjectMemory (const vk::DeviceInterface& vki, vk::VkDevice device, vk::Allocator& allocator, vk::VkBuffer buffer, vk::MemoryRequirement requirement); +de::MovePtr allocateAndBindObjectMemory(const vk::DeviceInterface &vki, vk::VkDevice device, + vk::Allocator &allocator, vk::VkBuffer buffer, + vk::MemoryRequirement requirement); -#endif //VULKANCTS_COMPUTEINSTANCERESULTBUFFER_HPP +#endif //_COMPUTEINSTANCERESULTBUFFER_HPP diff --git a/external/vulkancts/modules/vulkan/api/vktApiCommandBuffersTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiCommandBuffersTests.cpp index 07af38d..d4e6c92 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiCommandBuffersTests.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiCommandBuffersTests.cpp @@ -5,6 +5,7 @@ * * Copyright (c) 2015 The Khronos Group Inc. * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the @@ -31,26 +32,17 @@ * *//*--------------------------------------------------------------------*/ -#include "vktApiTests.hpp" -#include #include - +#include #include "vktTestCaseUtil.hpp" #include "vkBuilderUtil.hpp" -#include "vkDefs.hpp" #include "vkPlatform.hpp" -#include "vkStrUtil.hpp" -#include "vkRef.hpp" #include "vkRefUtil.hpp" #include "vkQueryUtil.hpp" #include "vkMemUtil.hpp" #include "vkDeviceUtil.hpp" #include "vkPrograms.hpp" #include "vkTypeUtil.hpp" -#include "vkPlatform.hpp" -#include "tcuTestLog.hpp" -#include "tcuFormatUtil.hpp" -#include "deUniquePtr.hpp" #include "BufferComputeInstance.hpp" #include "ComputeInstanceResultBuffer.hpp" @@ -64,11 +56,11 @@ namespace using namespace vk; -using tcu::TestLog; -using de::UniquePtr; +// Global variables const deUint64 INFINITE_TIMEOUT = ~(deUint64)0u; +// Testcases tcu::TestStatus createBufferTest (Context& context) { const VkDevice vkDevice = context.getDevice(); @@ -87,17 +79,207 @@ tcu::TestStatus createBufferTest (Context& context) // Command buffer const VkCmdBufferCreateInfo cmdBufParams = { - VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; - DE_NULL, // const void* pNext; - *cmdPool, // VkCmdPool pool; - VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; - 0u, // VkCmdBufferCreateFlags flags; + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; }; const Unique cmdBuf (createCommandBuffer(vk, vkDevice, &cmdBufParams)); - return tcu::TestStatus::pass("create Command Buffer succeeded"); + return tcu::TestStatus::pass("create Command Buffer succeeded"); } +tcu::TestStatus executePrimaryBufferTest (Context& context) +{ + + const VkDevice vkDevice = context.getDevice(); + const DeviceInterface& vk = context.getDeviceInterface(); + const VkQueue queue = context.getUniversalQueue(); + const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); + + const VkCmdPoolCreateInfo cmdPoolParams = + { + VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + queueFamilyIndex, // deUint32 queueFamilyIndex; + VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT // VkCmdPoolCreateFlags flags; + }; + const Unique cmdPool (createCommandPool(vk, vkDevice, &cmdPoolParams)); + + // Command buffer + const VkCmdBufferCreateInfo cmdBufParams = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; + }; + const Unique primCmdBuf (createCommandBuffer(vk, vkDevice, &cmdBufParams)); + const VkCmdBufferBeginInfo primCmdBufBeginInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, + DE_NULL, + 0, // flags (for later: VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT) + (VkRenderPass)0u, // renderPass + 0u, // subpass + (VkFramebuffer)0u, // framebuffer + }; + + // Fill create info struct for event + const VkEventCreateInfo eventCreateInfo = + { + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, + DE_NULL, + 0u, + }; + + // create event that will be used to check if secondary command buffer has been executed + const Unique event (createEvent(vk, vkDevice, &eventCreateInfo)); + + // reset event + VK_CHECK(vk.resetEvent(vkDevice, *event)); + + // record primary command buffer + VK_CHECK(vk.beginCommandBuffer(*primCmdBuf, &primCmdBufBeginInfo)); + { + // allow execution of event during every stage of pipeline + VkPipelineStageFlags stageMask = 0x0000FFFF; + + // record setting event + vk.cmdSetEvent(*primCmdBuf, *event,stageMask); + } + VK_CHECK(vk.endCommandBuffer(*primCmdBuf)); + + const VkFenceCreateInfo fenceCreateInfo = + { + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, + DE_NULL, + 0u, // flags + }; + + // create fence to wait for execution of queue + const Unique fence (createFence(vk, vkDevice, &fenceCreateInfo)); + + // submit primary buffer + VK_CHECK(vk.queueSubmit(queue,1, &primCmdBuf.get(), *fence)); + + // wait for end of execution of queue + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT)); + + // check if buffer has been executed + VkResult result = vk.getEventStatus(vkDevice,*event); + if (result == VK_EVENT_SET) + return tcu::TestStatus::pass("Execute Primary Command Buffer succeeded"); + + return tcu::TestStatus::fail("Execute Primary Command Buffer FAILED"); +} + +tcu::TestStatus simultanousUsePrimary (Context& context) +{ + + const VkDevice vkDevice = context.getDevice(); + const DeviceInterface& vk = context.getDeviceInterface(); + const VkQueue queue = context.getUniversalQueue(); + const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); + + const VkCmdPoolCreateInfo cmdPoolParams = + { + VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + queueFamilyIndex, // deUint32 queueFamilyIndex; + VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT // VkCmdPoolCreateFlags flags; + }; + const Unique cmdPool (createCommandPool(vk, vkDevice, &cmdPoolParams)); + + // Command buffer + const VkCmdBufferCreateInfo cmdBufParams = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; + }; + const Unique primCmdBuf (createCommandBuffer(vk, vkDevice, &cmdBufParams)); + const VkCmdBufferBeginInfo primCmdBufBeginInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, + DE_NULL, + VK_CMD_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, // flags + (VkRenderPass)0u, // renderPass + 0u, // subpass + (VkFramebuffer)0u, // framebuffer + }; + + // Fill create info struct for event + const VkEventCreateInfo eventCreateInfo = + { + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, + DE_NULL, + 0u, + }; + + // create event that will be used to check if secondary command buffer has been executed + const Unique event (createEvent(vk, vkDevice, &eventCreateInfo)); + + // reset event + VK_CHECK(vk.resetEvent(vkDevice, *event)); + + // record primary command buffer + VK_CHECK(vk.beginCommandBuffer(*primCmdBuf, &primCmdBufBeginInfo)); + { + // allow execution of event during every stage of pipeline + VkPipelineStageFlags stageMask = 0x0000FFFF; + + // wait for event + VK_CHECK(vk.cmdWaitEvents(*primCmdBuf, 1, &event.get(), stageMask, stageMask, 0, DE_NULL)); + + // reset event + vk.cmdResetEvent(*primCmdBuf, *event); + } + VK_CHECK(vk.endCommandBuffer(*primCmdBuf)); + + const VkFenceCreateInfo fenceCreateInfo = + { + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, + DE_NULL, + 0u, // flags + }; + + // create fence to wait for execution of queue + const Unique fence1 (createFence(vk, vkDevice, &fenceCreateInfo)); + const Unique fence2 (createFence(vk, vkDevice, &fenceCreateInfo)); + + // submit first buffer + VK_CHECK(vk.queueSubmit(queue,1, &primCmdBuf.get(), *fence1)); + + // submit second buffer + VK_CHECK(vk.queueSubmit(queue,1, &primCmdBuf.get(), *fence2)); + + // wait for both buffer to stop at event + sleep(1); + + // set event + VK_CHECK(vk.setEvent(vkDevice, *event)); + + // wait for end of execution of first buffer + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence1.get(), 0u, INFINITE_TIMEOUT)); + + // wait for end of execution of first buffer + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence2.get(), 0u, INFINITE_TIMEOUT)); + + // TODO: this will be true if the command buffer was executed only once + // TODO: add some test that will say if it was executed twice + + // check if buffer has been executed + VkResult result = vk.getEventStatus(vkDevice,*event); + if (result == VK_EVENT_RESET) + return tcu::TestStatus::pass("Execute Primary Command Buffer succeeded"); + else + return tcu::TestStatus::fail("Execute Primary Command Buffer FAILED"); +} tcu::TestStatus executeSecondaryBufferTest (Context& context) { @@ -119,65 +301,64 @@ tcu::TestStatus executeSecondaryBufferTest (Context& context) // Command buffer const VkCmdBufferCreateInfo cmdBufParams = { - VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; - DE_NULL, // const void* pNext; - *cmdPool, // VkCmdPool pool; - VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; - 0u, // VkCmdBufferCreateFlags flags; + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; }; - const Unique primCmdBuf (createCommandBuffer(vk, vkDevice, &cmdBufParams)); + const Unique primCmdBuf (createCommandBuffer(vk, vkDevice, &cmdBufParams)); // Secondary Command buffer const VkCmdBufferCreateInfo secCmdBufParams = { - VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; - DE_NULL, // const void* pNext; - *cmdPool, // VkCmdPool pool; - VK_CMD_BUFFER_LEVEL_SECONDARY, // VkCmdBufferLevel level; - 0u, // VkCmdBufferCreateFlags flags; + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_SECONDARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; }; - const Unique secCmdBuf (createCommandBuffer(vk, vkDevice, &secCmdBufParams)); + const Unique secCmdBuf (createCommandBuffer(vk, vkDevice, &secCmdBufParams)); - const VkCmdBufferBeginInfo primCmdBufBeginInfo = + const VkCmdBufferBeginInfo primCmdBufBeginInfo = { VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, DE_NULL, - 0,//VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT, // flags - (VkRenderPass)0u, // renderPass - 0u, // subpass - (VkFramebuffer)0u, // framebuffer + 0, // flags (for later: VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT) + (VkRenderPass)0u, // renderPass + 0u, // subpass + (VkFramebuffer)0u, // framebuffer }; - const VkCmdBufferBeginInfo secCmdBufBeginInfo = + const VkCmdBufferBeginInfo secCmdBufBeginInfo = { VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, DE_NULL, - 0u, //VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT, // flags - (VkRenderPass)0u, // renderPass - 0u, // subpass - (VkFramebuffer)0u, // framebuffer + 0u, // flags (for later: VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT) + (VkRenderPass)0u, // renderPass + 0u, // subpass + (VkFramebuffer)0u, // framebuffer }; - // Fill create info struct for event - const VkEventCreateInfo eventCreateInfo = - { + const VkEventCreateInfo eventCreateInfo = + { VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, DE_NULL, 0u, }; // create event that will be used to check if secondary command buffer has been executed - const Unique event ( createEvent(vk, vkDevice, &eventCreateInfo ) ); + const Unique event (createEvent(vk, vkDevice, &eventCreateInfo)); // reset event - vk.resetEvent(vkDevice, *event); + VK_CHECK(vk.resetEvent(vkDevice, *event)); // record primary command buffer - vk.beginCommandBuffer( *primCmdBuf, &primCmdBufBeginInfo); + VK_CHECK(vk.beginCommandBuffer(*primCmdBuf, &primCmdBufBeginInfo)); { // record secondary command buffer - vk.beginCommandBuffer( *secCmdBuf, &secCmdBufBeginInfo); + VK_CHECK(vk.beginCommandBuffer(*secCmdBuf, &secCmdBufBeginInfo)); { // allow execution of event during every stage of pipeline VkPipelineStageFlags stageMask = 0x0000FFFF; @@ -187,247 +368,622 @@ tcu::TestStatus executeSecondaryBufferTest (Context& context) } // end recording of secondary buffers - vk.endCommandBuffer( *secCmdBuf ); + VK_CHECK(vk.endCommandBuffer(*secCmdBuf)); // execute secondary buffer - vk.cmdExecuteCommands( *primCmdBuf, 1, &secCmdBuf.get()); + vk.cmdExecuteCommands(*primCmdBuf, 1, &secCmdBuf.get()); } - vk.endCommandBuffer( *primCmdBuf ); - + VK_CHECK(vk.endCommandBuffer(*primCmdBuf)); - vk.resetCommandBuffer(*primCmdBuf, 0u); - - const VkFenceCreateInfo fenceCreateInfo = + const VkFenceCreateInfo fenceCreateInfo = { VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, DE_NULL, - 0u, // flags + 0u, // flags }; // create fence to wait for execution of queue - const Unique fence (createFence(vk, vkDevice, &fenceCreateInfo)); + const Unique fence (createFence(vk, vkDevice, &fenceCreateInfo)); + + // submit primary buffer, the secondary should be executed too + VK_CHECK(vk.queueSubmit(queue,1, &primCmdBuf.get(), *fence)); + + // wait for end of execution of queue + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT)); + + // check if secondary buffer has been executed + VkResult result = vk.getEventStatus(vkDevice,*event); + if (result == VK_EVENT_SET) + return tcu::TestStatus::pass("Execute Secondary Command Buffer succeeded"); + + return tcu::TestStatus::fail("Execute Secondary Command Buffer FAILED"); +} + +tcu::TestStatus simulatnousUseSecondary (Context& context) +{ + + const VkDevice vkDevice = context.getDevice(); + const DeviceInterface& vk = context.getDeviceInterface(); + const VkQueue queue = context.getUniversalQueue(); + const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); + + const VkCmdPoolCreateInfo cmdPoolParams = + { + VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + queueFamilyIndex, // deUint32 queueFamilyIndex; + VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT // VkCmdPoolCreateFlags flags; + }; + const Unique cmdPool (createCommandPool(vk, vkDevice, &cmdPoolParams)); + + // Command buffer + const VkCmdBufferCreateInfo cmdBufParams = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; + }; + const Unique primCmdBuf (createCommandBuffer(vk, vkDevice, &cmdBufParams)); + + // Secondary Command buffer params + const VkCmdBufferCreateInfo secCmdBufParams = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_SECONDARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; + }; + const Unique secCmdBuf (createCommandBuffer(vk, vkDevice, &secCmdBufParams)); + + const VkCmdBufferBeginInfo primCmdBufBeginInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, + DE_NULL, + 0, // flags (for later: VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT) + (VkRenderPass)0u, // renderPass + 0u, // subpass + (VkFramebuffer)0u, // framebuffer + }; + + const VkCmdBufferBeginInfo secCmdBufBeginInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, + DE_NULL, + VK_CMD_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, // flags + (VkRenderPass)0u, // renderPass + 0u, // subpass + (VkFramebuffer)0u, // framebuffer + }; + + // Fill create info struct for event + const VkEventCreateInfo eventCreateInfo = + { + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, + DE_NULL, + 0u, + }; + + // create event that will be used to check if secondary command buffer has been executed + const Unique event (createEvent(vk, vkDevice, &eventCreateInfo)); + + // reset event + VK_CHECK(vk.resetEvent(vkDevice, *event)); + + // record primary command buffer + VK_CHECK(vk.beginCommandBuffer(*primCmdBuf, &primCmdBufBeginInfo)); + + // execute secondary buffer + vk.cmdExecuteCommands(*primCmdBuf, 1, &secCmdBuf.get()); + + VK_CHECK(vk.endCommandBuffer(*primCmdBuf)); + + // record secondary command buffer + VK_CHECK(vk.beginCommandBuffer(*secCmdBuf, &secCmdBufBeginInfo)); + + { + // allow execution of event during every stage of pipeline + VkPipelineStageFlags stageMask = 0x0000FFFF; + + // wait for event + VK_CHECK(vk.cmdWaitEvents(*secCmdBuf, 1, &event.get(), stageMask, stageMask, 0, DE_NULL)); + + // reset event + vk.cmdResetEvent(*primCmdBuf, *event); + } + + // end recording of secondary buffers + VK_CHECK(vk.endCommandBuffer(*secCmdBuf)); + + + + const VkFenceCreateInfo fenceCreateInfo = + { + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, + DE_NULL, + 0u, // flags + }; + + // create fence to wait for execution of queue + const Unique fence (createFence(vk, vkDevice, &fenceCreateInfo)); + + // submit primary buffer, the secondary should be executed too + VK_CHECK(vk.queueSubmit(queue,1, &primCmdBuf.get(), *fence)); + + // wait for both buffers to stop at event + sleep(1); + + // set event + VK_CHECK(vk.setEvent(vkDevice, *event)); + + // wait for end of execution of queue + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT)); + + // TODO: this will be true if the command buffer was executed only once + // TODO: add some test that will say if it was executed twice + + // check if secondary buffer has been executed + VkResult result = vk.getEventStatus(vkDevice,*event); + if (result != VK_EVENT_SET) + return tcu::TestStatus::pass("Simulatous Secondary Command Buffer Execution succeeded"); + else + return tcu::TestStatus::fail("Simulatous Secondary Command Buffer Execution FAILED"); +} + +tcu::TestStatus submitTwicePrimaryTest (Context& context) +{ + + const VkDevice vkDevice = context.getDevice(); + const DeviceInterface& vk = context.getDeviceInterface(); + const VkQueue queue = context.getUniversalQueue(); + const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); + + const VkCmdPoolCreateInfo cmdPoolParams = + { + VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + queueFamilyIndex, // deUint32 queueFamilyIndex; + VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT // VkCmdPoolCreateFlags flags; + }; + const Unique cmdPool (createCommandPool(vk, vkDevice, &cmdPoolParams)); + + // Command buffer + const VkCmdBufferCreateInfo cmdBufParams = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; + }; + const Unique primCmdBuf (createCommandBuffer(vk, vkDevice, &cmdBufParams)); + const VkCmdBufferBeginInfo primCmdBufBeginInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, + DE_NULL, + 0, // flags + (VkRenderPass)0u, // renderPass + 0u, // subpass + (VkFramebuffer)0u, // framebuffer + }; + + // Fill create info struct for event + const VkEventCreateInfo eventCreateInfo = + { + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, + DE_NULL, + 0u, + }; + + // create event that will be used to check if secondary command buffer has been executed + const Unique event (createEvent(vk, vkDevice, &eventCreateInfo)); + + // reset event + VK_CHECK(vk.resetEvent(vkDevice, *event)); + + // record primary command buffer + VK_CHECK(vk.beginCommandBuffer(*primCmdBuf, &primCmdBufBeginInfo)); + { + // allow execution of event during every stage of pipeline + VkPipelineStageFlags stageMask = 0x0000FFFF; + + // record setting event + vk.cmdSetEvent(*primCmdBuf, *event,stageMask); + } + VK_CHECK(vk.endCommandBuffer(*primCmdBuf)); + + const VkFenceCreateInfo fenceCreateInfo = + { + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, + DE_NULL, + 0u, // flags + }; + + // create fence to wait for execution of queue + const Unique fence (createFence(vk, vkDevice, &fenceCreateInfo)); + + // submit primary buffer + VK_CHECK(vk.queueSubmit(queue,1, &primCmdBuf.get(), *fence)); + + // wait for end of execution of queue + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT)); + + // check if buffer has been executed + VkResult result = vk.getEventStatus(vkDevice,*event); + if (result != VK_EVENT_SET) + return tcu::TestStatus::fail("Submit Twice Test FAILED"); + + // reset event + VK_CHECK(vk.resetEvent(vkDevice, *event)); + + // submit primary buffer again + VK_CHECK(vk.queueSubmit(queue,1, &primCmdBuf.get(), *fence)); + + // wait for end of execution of queue + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT)); + + // check if buffer has been executed + result = vk.getEventStatus(vkDevice,*event); + if (result != VK_EVENT_SET) + return tcu::TestStatus::fail("Submit Twice Test FAILED"); + else + return tcu::TestStatus::pass("Submit Twice Test succeeded"); + + +} + + +tcu::TestStatus submitTwiceSecondaryTest (Context& context) +{ + + const VkDevice vkDevice = context.getDevice(); + const DeviceInterface& vk = context.getDeviceInterface(); + const VkQueue queue = context.getUniversalQueue(); + const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); + + const VkCmdPoolCreateInfo cmdPoolParams = + { + VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + queueFamilyIndex, // deUint32 queueFamilyIndex; + VK_CMD_POOL_CREATE_RESET_COMMAND_BUFFER_BIT // VkCmdPoolCreateFlags flags; + }; + const Unique cmdPool (createCommandPool(vk, vkDevice, &cmdPoolParams)); + + // Command buffer + const VkCmdBufferCreateInfo cmdBufParams = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; + }; + const Unique primCmdBuf1 (createCommandBuffer(vk, vkDevice, &cmdBufParams)); + const Unique primCmdBuf2 (createCommandBuffer(vk, vkDevice, &cmdBufParams)); + + // Secondary Command buffer + const VkCmdBufferCreateInfo secCmdBufParams = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_SECONDARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; + }; + const Unique secCmdBuf (createCommandBuffer(vk, vkDevice, &secCmdBufParams)); + + const VkCmdBufferBeginInfo primCmdBufBeginInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, + DE_NULL, + 0, // flags (for later: VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT) + (VkRenderPass)0u, // renderPass + 0u, // subpass + (VkFramebuffer)0u, // framebuffer + }; + + const VkCmdBufferBeginInfo secCmdBufBeginInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, + DE_NULL, + 0u, // flags (for later: VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT) + (VkRenderPass)0u, // renderPass + 0u, // subpass + (VkFramebuffer)0u, // framebuffer + }; + + // Fill create info struct for event + const VkEventCreateInfo eventCreateInfo = + { + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, + DE_NULL, + 0u, + }; + + // create event that will be used to check if secondary command buffer has been executed + const Unique event (createEvent(vk, vkDevice, &eventCreateInfo)); + + // reset event + VK_CHECK(vk.resetEvent(vkDevice, *event)); + + // record first primary command buffer + VK_CHECK(vk.beginCommandBuffer(*primCmdBuf1, &primCmdBufBeginInfo)); + { + // record secondary command buffer + VK_CHECK(vk.beginCommandBuffer(*secCmdBuf, &secCmdBufBeginInfo)); + { + // allow execution of event during every stage of pipeline + VkPipelineStageFlags stageMask = 0x0000FFFF; + + // record setting event + vk.cmdSetEvent(*secCmdBuf, *event,stageMask); + } + + // end recording of secondary buffers + VK_CHECK(vk.endCommandBuffer(*secCmdBuf)); + + // execute secondary buffer + vk.cmdExecuteCommands(*primCmdBuf1, 1, &secCmdBuf.get()); + } + VK_CHECK(vk.endCommandBuffer(*primCmdBuf1)); + + const VkFenceCreateInfo fenceCreateInfo = + { + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, + DE_NULL, + 0u, // flags + }; + + // create fence to wait for execution of queue + const Unique fence (createFence(vk, vkDevice, &fenceCreateInfo)); // submit primary buffer, the secondary should be executed too - vk.queueSubmit(queue,1, &primCmdBuf.get(), *fence); + VK_CHECK(vk.queueSubmit(queue,1, &primCmdBuf1.get(), *fence)); // wait for end of execution of queue - const deUint64 infiniteTimeout = ~(deUint64)0u; - vk.waitForFences(vkDevice, 1, &fence.get(), 0u, infiniteTimeout); + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT)); // check if secondary buffer has been executed VkResult result = vk.getEventStatus(vkDevice,*event); - if (result == VK_EVENT_SET) return tcu::TestStatus::pass("Execute Secondary Command Buffer succeeded"); - else return tcu::TestStatus::pass("Execute Secondary Command Buffer FAILED"); + if (result != VK_EVENT_SET) + return tcu::TestStatus::fail("Submit Twice Secondary Command Buffer FAILED"); + + // reset first primary buffer + vk.resetCommandBuffer( *primCmdBuf1, 0u); + // reset event to allow receiving it again + VK_CHECK(vk.resetEvent(vkDevice, *event)); + + // record first primary command buffer + VK_CHECK(vk.beginCommandBuffer(*primCmdBuf2, &primCmdBufBeginInfo)); + { + // execute secondary buffer + vk.cmdExecuteCommands(*primCmdBuf2, 1, &secCmdBuf.get()); + } + // end recording + VK_CHECK(vk.endCommandBuffer(*primCmdBuf2)); + + // submit second primary buffer, the secondary should be executed too + VK_CHECK(vk.queueSubmit(queue,1, &primCmdBuf2.get(), *fence)); + + // wait for end of execution of queue + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), 0u, INFINITE_TIMEOUT)); + + // check if secondary buffer has been executed + result = vk.getEventStatus(vkDevice,*event); + if (result != VK_EVENT_SET) + return tcu::TestStatus::fail("Submit Twice Secondary Command Buffer FAILED"); + else + return tcu::TestStatus::pass("Submit Twice Secondary Command Buffer succeeded"); } tcu::TestStatus executeOrderTest (Context& context) { - const DeviceInterface& m_vki = context.getDeviceInterface(); - const VkDevice m_device = context.getDevice(); - const VkQueue m_queue = context.getUniversalQueue(); - const deUint32 m_queueFamilyIndex = context.getUniversalQueueFamilyIndex(); - Allocator& m_allocator = context.getDefaultAllocator(); - const ComputeInstanceResultBuffer m_result(m_vki, m_device, m_allocator); + const DeviceInterface& m_vki = context.getDeviceInterface(); + const VkDevice m_device = context.getDevice(); + const VkQueue m_queue = context.getUniversalQueue(); + const deUint32 m_queueFamilyIndex = context.getUniversalQueueFamilyIndex(); + Allocator& m_allocator = context.getDefaultAllocator(); + const ComputeInstanceResultBuffer m_result (m_vki, m_device, m_allocator); enum { ADDRESSABLE_SIZE = 256, // allocate a lot more than required }; - const tcu::Vec4 colorA1 = tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f); - const tcu::Vec4 colorA2 = tcu::Vec4(1.0f, 1.0f, 0.0f, 1.0f); + const tcu::Vec4 colorA1 = tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f); + const tcu::Vec4 colorA2 = tcu::Vec4(1.0f, 1.0f, 0.0f, 1.0f); - const deUint32 dataOffsetA = (0u); - const deUint32 dataOffsetB = (0u); - const deUint32 viewOffsetA = (0u); - const deUint32 viewOffsetB = (0u); - const deUint32 bufferSizeA = dataOffsetA + ADDRESSABLE_SIZE; - const deUint32 bufferSizeB = dataOffsetB + ADDRESSABLE_SIZE; + const deUint32 dataOffsetA = (0u); + const deUint32 dataOffsetB = (0u); + const deUint32 viewOffsetA = (0u); + const deUint32 viewOffsetB = (0u); + const deUint32 bufferSizeA = dataOffsetA + ADDRESSABLE_SIZE; + const deUint32 bufferSizeB = dataOffsetB + ADDRESSABLE_SIZE; - de::MovePtr bufferMemA; - const Unique bufferA (createColorDataBuffer(dataOffsetA, bufferSizeA, colorA1, colorA2, &bufferMemA, context)); + de::MovePtr bufferMemA; + const Unique bufferA (createColorDataBuffer(dataOffsetA, bufferSizeA, colorA1, colorA2, &bufferMemA, context)); - de::MovePtr bufferMemB; - const Unique bufferB ((Move())); + de::MovePtr bufferMemB; + const Unique bufferB ((Move())); - const Unique descriptorSetLayout (createDescriptorSetLayout(context)); - const Unique descriptorPool (createDescriptorPool(context)); + const Unique descriptorSetLayout (createDescriptorSetLayout(context)); + const Unique descriptorPool (createDescriptorPool(context)); - const Unique descriptorSet (createDescriptorSet(*descriptorPool, *descriptorSetLayout, *bufferA, viewOffsetA, *bufferB, viewOffsetB, m_result.getBuffer(), context)); - const VkDescriptorSet descriptorSets[] = { *descriptorSet }; - const int numDescriptorSets = DE_LENGTH_OF_ARRAY(descriptorSets); + const Unique descriptorSet (createDescriptorSet(*descriptorPool, *descriptorSetLayout, *bufferA, viewOffsetA, *bufferB, viewOffsetB, m_result.getBuffer(), context)); + const VkDescriptorSet descriptorSets[] = { *descriptorSet }; + const int numDescriptorSets = DE_LENGTH_OF_ARRAY(descriptorSets); const VkPipelineLayoutCreateInfo layoutCreateInfo = - { - VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, - DE_NULL, - numDescriptorSets, // descriptorSetCount - &descriptorSetLayout.get(), // pSetLayouts - 0u, // pushConstantRangeCount - DE_NULL, // pPushConstantRanges - }; - Unique m_pipelineLayout (createPipelineLayout(m_vki, m_device, &layoutCreateInfo)); - + { + VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, + DE_NULL, + numDescriptorSets, // descriptorSetCount + &descriptorSetLayout.get(), // pSetLayouts + 0u, // pushConstantRangeCount + DE_NULL, // pPushConstantRanges + }; + Unique m_pipelineLayout (createPipelineLayout(m_vki, m_device, &layoutCreateInfo)); - const Unique computeModuleGood (createShaderModule(m_vki, m_device, context.getBinaryCollection().get("compute_good"), (VkShaderModuleCreateFlags)0u)); - const Unique computeModuleBad (createShaderModule(m_vki, m_device, context.getBinaryCollection().get("compute_bad"), (VkShaderModuleCreateFlags)0u)); + const Unique computeModuleGood (createShaderModule(m_vki, m_device, context.getBinaryCollection().get("compute_good"), (VkShaderModuleCreateFlags)0u)); + const Unique computeModuleBad (createShaderModule(m_vki, m_device, context.getBinaryCollection().get("compute_bad"), (VkShaderModuleCreateFlags)0u)); const VkShaderCreateInfo shaderCreateInfoGood = - { - VK_STRUCTURE_TYPE_SHADER_CREATE_INFO, - DE_NULL, - *computeModuleGood, // module - "main", // pName - 0u, // flags - VK_SHADER_STAGE_COMPUTE - }; + { + VK_STRUCTURE_TYPE_SHADER_CREATE_INFO, + DE_NULL, + *computeModuleGood, // module + "main", // pName + 0u, // flags + VK_SHADER_STAGE_COMPUTE + }; const VkShaderCreateInfo shaderCreateInfoBad = - { - VK_STRUCTURE_TYPE_SHADER_CREATE_INFO, - DE_NULL, - *computeModuleBad, // module - "main", // pName - 0u, // flags - VK_SHADER_STAGE_COMPUTE - }; - - const Unique computeShaderGood (createShader(m_vki, m_device, &shaderCreateInfoGood)); - const Unique computeShaderBad (createShader(m_vki, m_device, &shaderCreateInfoBad)); + { + VK_STRUCTURE_TYPE_SHADER_CREATE_INFO, + DE_NULL, + *computeModuleBad, // module + "main", // pName + 0u, // flags + VK_SHADER_STAGE_COMPUTE + }; + + const Unique computeShaderGood (createShader(m_vki, m_device, &shaderCreateInfoGood)); + const Unique computeShaderBad (createShader(m_vki, m_device, &shaderCreateInfoBad)); const VkPipelineShaderStageCreateInfo csGood = - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - DE_NULL, - VK_SHADER_STAGE_COMPUTE, // stage - *computeShaderGood, // shader - DE_NULL, // pSpecializationInfo - }; + { + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, + DE_NULL, + VK_SHADER_STAGE_COMPUTE, // stage + *computeShaderGood, // shader + DE_NULL, // pSpecializationInfo + }; const VkPipelineShaderStageCreateInfo csBad = - { - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, - DE_NULL, - VK_SHADER_STAGE_COMPUTE, // stage - *computeShaderBad, // shader - DE_NULL, // pSpecializationInfo - }; - + { + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, + DE_NULL, + VK_SHADER_STAGE_COMPUTE, // stage + *computeShaderBad, // shader + DE_NULL, // pSpecializationInfo + }; const VkComputePipelineCreateInfo createInfoGood = - { - VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - DE_NULL, - csGood, // cs - 0u, // flags - *m_pipelineLayout, // descriptorSetLayout.get() - (VkPipeline)0, // basePipelineHandle - 0u, // basePipelineIndex - }; + { + VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, + DE_NULL, + csGood, // cs + 0u, // flags + *m_pipelineLayout, // descriptorSetLayout.get() + (VkPipeline)0, // basePipelineHandle + 0u, // basePipelineIndex + }; const VkComputePipelineCreateInfo createInfoBad = - { - VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - DE_NULL, - csBad, // cs - 0u, // flags - *m_pipelineLayout, // descriptorSetLayout.get() - (VkPipeline)0, // basePipelineHandle - 0u, // basePipelineIndex - }; - - const Unique m_pipelineGood (createComputePipeline(m_vki, m_device, (VkPipelineCache)0u, &createInfoGood) ); - const Unique m_pipelineBad (createComputePipeline(m_vki, m_device, (VkPipelineCache)0u, &createInfoBad) ); - - const VkMemoryInputFlags inputBit = (VK_MEMORY_INPUT_UNIFORM_READ_BIT) ; - const VkBufferMemoryBarrier bufferBarrierA = - { - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, - DE_NULL, - VK_MEMORY_OUTPUT_HOST_WRITE_BIT, // outputMask - inputBit, // inputMask - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // destQueueFamilyIndex - *bufferA, // buffer - (VkDeviceSize)0u, // offset - (VkDeviceSize)bufferSizeA, // size - }; - - const VkBufferMemoryBarrier bufferBarrierB = - { - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, - DE_NULL, - VK_MEMORY_OUTPUT_HOST_WRITE_BIT, // outputMask - inputBit, // inputMask - VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex - VK_QUEUE_FAMILY_IGNORED, // destQueueFamilyIndex - *bufferB, // buffer - (VkDeviceSize)0u, // offset - (VkDeviceSize)bufferSizeB, // size - }; - - const deUint32 numSrcBuffers = 1u; - - - const deUint32* const dynamicOffsets = (DE_NULL); - const deUint32 numDynamicOffsets = (0); - const void* const preBarriers[] = { &bufferBarrierA, &bufferBarrierB }; - const int numPreBarriers = numSrcBuffers; - const void* const postBarriers[] = { m_result.getResultReadBarrier() }; - const int numPostBarriers = DE_LENGTH_OF_ARRAY(postBarriers); - const tcu::Vec4 refQuadrantValue14 = (colorA2); - const tcu::Vec4 refQuadrantValue23 = (colorA1); - const tcu::Vec4 references[4] = - { - refQuadrantValue14, - refQuadrantValue23, - refQuadrantValue23, - refQuadrantValue14, - }; - tcu::Vec4 results[4]; + { + VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, + DE_NULL, + csBad, // cs + 0u, // flags + *m_pipelineLayout, // descriptorSetLayout.get() + (VkPipeline)0, // basePipelineHandle + 0u, // basePipelineIndex + }; + + const Unique m_pipelineGood (createComputePipeline(m_vki, m_device, (VkPipelineCache)0u, &createInfoGood)); + const Unique m_pipelineBad (createComputePipeline(m_vki, m_device, (VkPipelineCache)0u, &createInfoBad)); + + const VkMemoryInputFlags inputBit = (VK_MEMORY_INPUT_UNIFORM_READ_BIT) ; + const VkBufferMemoryBarrier bufferBarrierA = + { + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, + DE_NULL, + VK_MEMORY_OUTPUT_HOST_WRITE_BIT, // outputMask + inputBit, // inputMask + VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex + VK_QUEUE_FAMILY_IGNORED, // destQueueFamilyIndex + *bufferA, // buffer + (VkDeviceSize)0u, // offset + (VkDeviceSize)bufferSizeA, // size + }; + + const VkBufferMemoryBarrier bufferBarrierB = + { + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER, + DE_NULL, + VK_MEMORY_OUTPUT_HOST_WRITE_BIT, // outputMask + inputBit, // inputMask + VK_QUEUE_FAMILY_IGNORED, // srcQueueFamilyIndex + VK_QUEUE_FAMILY_IGNORED, // destQueueFamilyIndex + *bufferB, // buffer + (VkDeviceSize)0u, // offset + (VkDeviceSize)bufferSizeB, // size + }; + + const deUint32 numSrcBuffers = 1u; + + const deUint32* const dynamicOffsets = (DE_NULL); + const deUint32 numDynamicOffsets = (0); + const void* const preBarriers[] = { &bufferBarrierA, &bufferBarrierB }; + const int numPreBarriers = numSrcBuffers; + const void* const postBarriers[] = { m_result.getResultReadBarrier() }; + const int numPostBarriers = DE_LENGTH_OF_ARRAY(postBarriers); + const tcu::Vec4 refQuadrantValue14 = (colorA2); + const tcu::Vec4 refQuadrantValue23 = (colorA1); + const tcu::Vec4 references[4] = + { + refQuadrantValue14, + refQuadrantValue23, + refQuadrantValue23, + refQuadrantValue14, + }; + tcu::Vec4 results[4]; // submit and wait begin const tcu::UVec3 m_numWorkGroups = tcu::UVec3(4, 1, 1); - const VkCmdPoolCreateInfo cmdPoolCreateInfo = - { - VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO, - DE_NULL, - m_queueFamilyIndex, // m_queueFamilyIndex - VK_CMD_POOL_CREATE_TRANSIENT_BIT, // flags - }; - const Unique cmdPool (createCommandPool(m_vki, m_device, &cmdPoolCreateInfo)); - - const VkFenceCreateInfo fenceCreateInfo = - { - VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, - DE_NULL, - 0u, // flags - }; - - const VkCmdBufferCreateInfo cmdBufCreateInfo = - { - VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, - DE_NULL, - *cmdPool, // cmdPool - VK_CMD_BUFFER_LEVEL_PRIMARY, // level - 0u, // flags - }; - const VkCmdBufferBeginInfo cmdBufBeginInfo = - { - VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, - DE_NULL, - VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT, // flags - (VkRenderPass)0u, // renderPass - 0u, // subpass - (VkFramebuffer)0u, // framebuffer - }; - - const Unique cmdCompleteFence (createFence(m_vki, m_device, &fenceCreateInfo)); - const Unique cmd (createCommandBuffer(m_vki, m_device, &cmdBufCreateInfo)); - const deUint64 infiniteTimeout = ~(deUint64)0u; + const VkCmdPoolCreateInfo cmdPoolCreateInfo = + { + VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO, + DE_NULL, + m_queueFamilyIndex, // m_queueFamilyIndex + VK_CMD_POOL_CREATE_TRANSIENT_BIT, // flags + }; + const Unique cmdPool (createCommandPool(m_vki, m_device, &cmdPoolCreateInfo)); + + const VkFenceCreateInfo fenceCreateInfo = + { + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, + DE_NULL, + 0u, // flags + }; + + const VkCmdBufferCreateInfo cmdBufCreateInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, + DE_NULL, + *cmdPool, // cmdPool + VK_CMD_BUFFER_LEVEL_PRIMARY, // level + 0u, // flags + }; + + const VkCmdBufferBeginInfo cmdBufBeginInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, + DE_NULL, + VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT, // flags + (VkRenderPass)0u, // renderPass + 0u, // subpass + (VkFramebuffer)0u, // framebuffer + }; + + const Unique cmdCompleteFence (createFence(m_vki, m_device, &fenceCreateInfo)); + const Unique cmd (createCommandBuffer(m_vki, m_device, &cmdBufCreateInfo)); VK_CHECK(m_vki.beginCommandBuffer(*cmd, &cmdBufBeginInfo)); m_vki.cmdBindPipeline(*cmd, VK_PIPELINE_BIND_POINT_COMPUTE, *m_pipelineBad); @@ -443,7 +999,7 @@ tcu::TestStatus executeOrderTest (Context& context) // run VK_CHECK(m_vki.queueSubmit(m_queue, 1, &cmd.get(), *cmdCompleteFence)); - VK_CHECK(m_vki.waitForFences(m_device, 1, &cmdCompleteFence.get(), 0u, infiniteTimeout)); // \note: timeout is failure + VK_CHECK(m_vki.waitForFences(m_device, 1, &cmdCompleteFence.get(), 0u, INFINITE_TIMEOUT)); // \note: timeout is failure // submit and wait end m_result.readResultContentsTo(&results); @@ -510,7 +1066,7 @@ tcu::TestStatus explicitResetCmdBufferTest(Context& context) VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; 0u, // VkCmdBufferCreateFlags flags; }; - const Unique cmdBuf (createCommandBuffer(vk, vkDevice, &cmdBufParams)); + const Unique cmdBuf (createCommandBuffer(vk, vkDevice, &cmdBufParams)); const VkCmdBufferBeginInfo cmdBufBeginInfo = { @@ -574,9 +1130,9 @@ tcu::TestStatus explicitResetCmdBufferTest(Context& context) // Check if the event remained unset. if(vk.getEventStatus(vkDevice,*event) == VK_EVENT_RESET) - return tcu::TestStatus::pass("Buffer was reset properly."); + return tcu::TestStatus::pass("Buffer was reset correctly."); else - return tcu::TestStatus::fail("Buffer was not reset properly."); + return tcu::TestStatus::fail("Buffer was not reset correctly."); } tcu::TestStatus implicitResetCmdBufferTest(Context& context) @@ -604,7 +1160,7 @@ tcu::TestStatus implicitResetCmdBufferTest(Context& context) VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; 0u, // VkCmdBufferCreateFlags flags; }; - const Unique cmdBuf (createCommandBuffer(vk, vkDevice, &cmdBufParams)); + const Unique cmdBuf (createCommandBuffer(vk, vkDevice, &cmdBufParams)); const VkCmdBufferBeginInfo cmdBufBeginInfo = { @@ -671,9 +1227,9 @@ tcu::TestStatus implicitResetCmdBufferTest(Context& context) // Check if the event remained unset. if(vk.getEventStatus(vkDevice, *event) == VK_EVENT_RESET) - return tcu::TestStatus::pass("Buffer was reset properly."); + return tcu::TestStatus::pass("Buffer was reset correctly."); else - return tcu::TestStatus::fail("Buffer was not reset properly."); + return tcu::TestStatus::fail("Buffer was not reset correctly."); } tcu::TestStatus bulkResetCmdBufferTest(Context& context) @@ -762,7 +1318,7 @@ tcu::TestStatus bulkResetCmdBufferTest(Context& context) for (short i = 0; i < BUFFER_COUNT; ++i) { VK_CHECK(vk.resetEvent(vkDevice, events[i])); - // Check if the event was reset properly + // Check if the event was reset correctly if (vk.getEventStatus(vkDevice, events[0]) != VK_EVENT_RESET) return tcu::TestStatus::fail("Failed to reset the event."); } @@ -777,84 +1333,342 @@ tcu::TestStatus bulkResetCmdBufferTest(Context& context) // Check if the event remained unset. for (short i = 0; i < BUFFER_COUNT; ++i) - if (vk.getEventStatus(vkDevice, events[i]) != VK_EVENT_RESET) - return tcu::TestStatus::fail("Buffers were not reset properly."); + if (vk.getEventStatus(vkDevice, events[i]) == VK_EVENT_SET) + return tcu::TestStatus::fail("Buffers were not reset correctly."); - return tcu::TestStatus::pass("All buffers were reset properly."); + return tcu::TestStatus::pass("All buffers were reset correctly."); } -} // anonymous +tcu::TestStatus submitCountNonZero(Context& context) +{ + const VkDevice vkDevice = context.getDevice(); + const DeviceInterface& vk = context.getDeviceInterface(); + const VkQueue queue = context.getUniversalQueue(); + const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); + + const short BUFFER_COUNT = 5; + + const VkCmdPoolCreateInfo cmdPoolParams = + { + VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + queueFamilyIndex, // deUint32 queueFamilyIndex; + 0u, // VkCmdPoolCreateFlags flags; + }; + const Unique cmdPool (createCommandPool(vk, vkDevice, &cmdPoolParams)); + + // Command buffer + const VkCmdBufferCreateInfo cmdBufParams = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; + }; + VkCmdBuffer cmdBuffers[BUFFER_COUNT]; + for (short i = 0; i < BUFFER_COUNT; ++i) + VK_CHECK(vk.createCommandBuffer(vkDevice, &cmdBufParams, &cmdBuffers[i])); + + const VkCmdBufferBeginInfo cmdBufBeginInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, + DE_NULL, + VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT, + DE_NULL, + 0u, + DE_NULL, + }; + + const VkEventCreateInfo eventCreateInfo = + { + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + 0u, // VkEventCreateFlags flags; + }; + VkEvent events[BUFFER_COUNT]; + for (short i = 0; i < BUFFER_COUNT; ++i) + VK_CHECK(vk.createEvent(vkDevice, &eventCreateInfo, &events[i])); + + // Record the command buffers + for (short i = 0; i < BUFFER_COUNT; ++i) + { + VK_CHECK(vk.beginCommandBuffer(cmdBuffers[i], &cmdBufBeginInfo)); + { + vk.cmdSetEvent(cmdBuffers[i], events[i], VK_PIPELINE_STAGE_ALL_GPU_COMMANDS); + } + VK_CHECK(vk.endCommandBuffer(cmdBuffers[i])); + } + + // We'll use a fence to wait for the execution of the queue + const VkFenceCreateInfo fenceCreateInfo = + { + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + 0u, // VkFenceCreateFlags flags + }; + const Unique fence (createFence(vk, vkDevice, &fenceCreateInfo)); + + // Submit the alpha command buffer to the queue + VK_CHECK(vk.queueSubmit(queue, BUFFER_COUNT, cmdBuffers, *fence)); + // Wait for the queue + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), VK_TRUE, INFINITE_TIMEOUT)); + + // Check if the buffers were executed + for (short i = 0; i < BUFFER_COUNT; ++i) + if (vk.getEventStatus(vkDevice, events[i]) != VK_EVENT_SET) + return tcu::TestStatus::fail("Failed to set the event."); + + return tcu::TestStatus::pass("All buffers were submitted and executed correctly."); +} + +tcu::TestStatus submitCountEqualZero(Context& context) +{ + const VkDevice vkDevice = context.getDevice(); + const DeviceInterface& vk = context.getDeviceInterface(); + const VkQueue queue = context.getUniversalQueue(); + const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); + + const short BUFFER_COUNT = 5; + + const VkCmdPoolCreateInfo cmdPoolParams = + { + VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + queueFamilyIndex, // deUint32 queueFamilyIndex; + 0u, // VkCmdPoolCreateFlags flags; + }; + const Unique cmdPool (createCommandPool(vk, vkDevice, &cmdPoolParams)); + + // Command buffer + const VkCmdBufferCreateInfo cmdBufParams = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; + }; + VkCmdBuffer cmdBuffers[BUFFER_COUNT]; + for (short i = 0; i < BUFFER_COUNT; ++i) + VK_CHECK(vk.createCommandBuffer(vkDevice, &cmdBufParams, &cmdBuffers[i])); + + const VkCmdBufferBeginInfo cmdBufBeginInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, + DE_NULL, + VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT, + DE_NULL, + 0u, + DE_NULL, + }; + + const VkEventCreateInfo eventCreateInfo = + { + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + 0u, // VkEventCreateFlags flags; + }; + VkEvent events[BUFFER_COUNT]; + for (short i = 0; i < BUFFER_COUNT; ++i) + VK_CHECK(vk.createEvent(vkDevice, &eventCreateInfo, &events[i])); + + // Record the command buffers + for (short i = 0; i < BUFFER_COUNT; ++i) + { + VK_CHECK(vk.beginCommandBuffer(cmdBuffers[i], &cmdBufBeginInfo)); + { + vk.cmdSetEvent(cmdBuffers[i], events[i], VK_PIPELINE_STAGE_ALL_GPU_COMMANDS); + } + VK_CHECK(vk.endCommandBuffer(cmdBuffers[i])); + } + + // We'll use a fence to wait for the execution of the queue + const VkFenceCreateInfo fenceCreateInfo = + { + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + 0u, // VkFenceCreateFlags flags + }; + const Unique fence (createFence(vk, vkDevice, &fenceCreateInfo)); + + // Submit the command buffer to the queue + VK_CHECK(vk.queueSubmit(queue, 0, cmdBuffers, *fence)); + // Wait for the queue + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), VK_TRUE, INFINITE_TIMEOUT)); + + // Check if the buffers were executed + for (short i = 0; i < BUFFER_COUNT; ++i) + if (vk.getEventStatus(vkDevice, events[i]) == VK_EVENT_SET) + return tcu::TestStatus::fail("An even was signaled."); + + return tcu::TestStatus::pass("All buffers were ignored."); +} + +tcu::TestStatus submitNullFence(Context& context) +{ + const VkDevice vkDevice = context.getDevice(); + const DeviceInterface& vk = context.getDeviceInterface(); + const VkQueue queue = context.getUniversalQueue(); + const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex(); + + const short BUFFER_COUNT = 2; + + const VkCmdPoolCreateInfo cmdPoolParams = + { + VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + queueFamilyIndex, // deUint32 queueFamilyIndex; + 0u, // VkCmdPoolCreateFlags flags; + }; + const Unique cmdPool (createCommandPool(vk, vkDevice, &cmdPoolParams)); + + // Command buffer + const VkCmdBufferCreateInfo cmdBufParams = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + *cmdPool, // VkCmdPool pool; + VK_CMD_BUFFER_LEVEL_PRIMARY, // VkCmdBufferLevel level; + 0u, // VkCmdBufferCreateFlags flags; + }; + VkCmdBuffer cmdBuffers[BUFFER_COUNT]; + for (short i = 0; i < BUFFER_COUNT; ++i) + VK_CHECK(vk.createCommandBuffer(vkDevice, &cmdBufParams, &cmdBuffers[i])); + + const VkCmdBufferBeginInfo cmdBufBeginInfo = + { + VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO, + DE_NULL, + VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT, + DE_NULL, + 0u, + DE_NULL, + }; + + const VkEventCreateInfo eventCreateInfo = + { + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + 0u, // VkEventCreateFlags flags; + }; + VkEvent events[BUFFER_COUNT]; + for (short i = 0; i < BUFFER_COUNT; ++i) + VK_CHECK(vk.createEvent(vkDevice, &eventCreateInfo, &events[i])); + + // Record the command buffers + for (short i = 0; i < BUFFER_COUNT; ++i) + { + VK_CHECK(vk.beginCommandBuffer(cmdBuffers[i], &cmdBufBeginInfo)); + { + vk.cmdSetEvent(cmdBuffers[i], events[i], VK_PIPELINE_STAGE_ALL_GPU_COMMANDS); + } + VK_CHECK(vk.endCommandBuffer(cmdBuffers[i])); + } + + // We'll use a fence to wait for the execution of the queue + const VkFenceCreateInfo fenceCreateInfo = + { + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType; + DE_NULL, // const void* pNext; + 0u, // VkFenceCreateFlags flags + }; + const Unique fence (createFence(vk, vkDevice, &fenceCreateInfo)); + + // Perform two submissions - one with no fence, the other one with a valid + // fence Hoping submitting the other buffer will give the first one time to + // execute + VK_CHECK(vk.queueSubmit(queue, 1, &cmdBuffers[0], DE_NULL)); + VK_CHECK(vk.queueSubmit(queue, 1, &cmdBuffers[1], *fence)); + + // Wait for the queue + VK_CHECK(vk.waitForFences(vkDevice, 1, &fence.get(), VK_TRUE, INFINITE_TIMEOUT)); + + if (vk.getEventStatus(vkDevice, events[0]) != VK_EVENT_SET) + return tcu::TestStatus::fail("The first event was not signaled -> the buffer was not executed."); + + return tcu::TestStatus::pass("The first event was signaled -> the buffer with null fence submitted and executed correctly"); +} - void genComputeSource (SourceCollections& programCollection) - { - const char* const versionDecl = glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); - std::ostringstream buf_good; - - buf_good << versionDecl << "\n" - << "" - << "layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;\n" - << "layout(set = 0, binding = 1, std140) uniform BufferName\n" - << "{\n" - << " highp vec4 colorA;\n" - << " highp vec4 colorB;\n" - << "} b_instance;\n" - << "layout(set = 0, binding = 0, std140) writeonly buffer OutBuf\n" - << "{\n" - << " highp vec4 read_colors[4];\n" - << "} b_out;\n" - << "void main(void)\n" - << "{\n" - << " highp int quadrant_id = int(gl_WorkGroupID.x);\n" - << " highp vec4 result_color;\n" - << " if (quadrant_id == 1 || quadrant_id == 2)\n" - << " result_color = b_instance.colorA;\n" - << " else\n" - << " result_color = b_instance.colorB;\n" - << " b_out.read_colors[gl_WorkGroupID.x] = result_color;\n" - << "}\n"; - - programCollection.glslSources.add("compute_good") << glu::ComputeSource(buf_good.str()); - - - std::ostringstream buf_bad; - - buf_bad << versionDecl << "\n" - << "" - << "layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;\n" - << "layout(set = 0, binding = 1, std140) uniform BufferName\n" - << "{\n" - << " highp vec4 colorA;\n" - << " highp vec4 colorB;\n" - << "} b_instance;\n" - << "layout(set = 0, binding = 0, std140) writeonly buffer OutBuf\n" - << "{\n" - << " highp vec4 read_colors[4];\n" - << "} b_out;\n" - << "void main(void)\n" - << "{\n" - << " highp int quadrant_id = int(gl_WorkGroupID.x);\n" - << " highp vec4 result_color;\n" - << " if (quadrant_id == 1 || quadrant_id == 2)\n" - << " result_color = b_instance.colorA;\n" - << " else\n" - << " result_color = b_instance.colorB;\n" - << " b_out.read_colors[gl_WorkGroupID.x] = vec4(0.0, 0.0, 0.0, 0.0);\n" - << "}\n"; - - programCollection.glslSources.add("compute_bad") << glu::ComputeSource(buf_bad.str()); - } +} // anonymous +// Shaders +void genComputeSource (SourceCollections& programCollection) +{ + const char* const versionDecl = glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES); + std::ostringstream buf_good; + + buf_good << versionDecl << "\n" + << "" + << "layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;\n" + << "layout(set = 0, binding = 1, std140) uniform BufferName\n" + << "{\n" + << " highp vec4 colorA;\n" + << " highp vec4 colorB;\n" + << "} b_instance;\n" + << "layout(set = 0, binding = 0, std140) writeonly buffer OutBuf\n" + << "{\n" + << " highp vec4 read_colors[4];\n" + << "} b_out;\n" + << "void main(void)\n" + << "{\n" + << " highp int quadrant_id = int(gl_WorkGroupID.x);\n" + << " highp vec4 result_color;\n" + << " if (quadrant_id == 1 || quadrant_id == 2)\n" + << " result_color = b_instance.colorA;\n" + << " else\n" + << " result_color = b_instance.colorB;\n" + << " b_out.read_colors[gl_WorkGroupID.x] = result_color;\n" + << "}\n"; + + programCollection.glslSources.add("compute_good") << glu::ComputeSource(buf_good.str()); + + std::ostringstream buf_bad; + + buf_bad << versionDecl << "\n" + << "" + << "layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;\n" + << "layout(set = 0, binding = 1, std140) uniform BufferName\n" + << "{\n" + << " highp vec4 colorA;\n" + << " highp vec4 colorB;\n" + << "} b_instance;\n" + << "layout(set = 0, binding = 0, std140) writeonly buffer OutBuf\n" + << "{\n" + << " highp vec4 read_colors[4];\n" + << "} b_out;\n" + << "void main(void)\n" + << "{\n" + << " highp int quadrant_id = int(gl_WorkGroupID.x);\n" + << " highp vec4 result_color;\n" + << " if (quadrant_id == 1 || quadrant_id == 2)\n" + << " result_color = b_instance.colorA;\n" + << " else\n" + << " result_color = b_instance.colorB;\n" + << " b_out.read_colors[gl_WorkGroupID.x] = vec4(0.0, 0.0, 0.0, 0.0);\n" + << "}\n"; + + programCollection.glslSources.add("compute_bad") << glu::ComputeSource(buf_bad.str()); +} tcu::TestCaseGroup* createCommandBuffersTests (tcu::TestContext& testCtx) { de::MovePtr commandBuffersTests (new tcu::TestCaseGroup(testCtx, "command_buffers", "Command Buffers Tests")); - addFunctionCase (commandBuffersTests.get(), "create_buffers", "", createBufferTest); - addFunctionCase (commandBuffersTests.get(), "execute_secondary_buffers", "", executeSecondaryBufferTest); - addFunctionCaseWithPrograms (commandBuffersTests.get(), "order_of_execution", "", genComputeSource, executeOrderTest ); - addFunctionCase (commandBuffersTests.get(), "explicit_reset", "", explicitResetCmdBufferTest); - addFunctionCase (commandBuffersTests.get(), "implicit_reset", "", implicitResetCmdBufferTest); - addFunctionCase (commandBuffersTests.get(), "bulk_reset", "", bulkResetCmdBufferTest); + addFunctionCase (commandBuffersTests.get(), "create_buffers", "", createBufferTest); + addFunctionCase (commandBuffersTests.get(), "execute_primary_buffers", "", executePrimaryBufferTest); +// addFunctionCase (commandBuffersTests.get(), "execute_secondary_buffers", "", executeSecondaryBufferTest); + addFunctionCase (commandBuffersTests.get(), "submit_twice_primary", "", submitTwicePrimaryTest); + addFunctionCase (commandBuffersTests.get(), "submit_twice_secondary", "", submitTwiceSecondaryTest); + addFunctionCase (commandBuffersTests.get(), "simultanous_use_primary", "", simultanousUsePrimary); + addFunctionCase (commandBuffersTests.get(), "simultanous_use_secondary", "", simultanousUseSecondary); + addFunctionCaseWithPrograms (commandBuffersTests.get(), "order_of_execution", "", genComputeSource, executeOrderTest); + addFunctionCase (commandBuffersTests.get(), "explicit_reset", "", explicitResetCmdBufferTest); + addFunctionCase (commandBuffersTests.get(), "implicit_reset", "", implicitResetCmdBufferTest); + addFunctionCase (commandBuffersTests.get(), "bulk_reset", "", bulkResetCmdBufferTest); + addFunctionCase (commandBuffersTests.get(), "submit_count_non_zero", "", submitCountNonZero); + addFunctionCase (commandBuffersTests.get(), "submit_count_equal_zero", "", submitCountEqualZero); + addFunctionCase (commandBuffersTests.get(), "submit_null_fence", "", submitNullFence); return commandBuffersTests.release(); } diff --git a/external/vulkancts/modules/vulkan/api/vktApiCommandBuffersTests.hpp b/external/vulkancts/modules/vulkan/api/vktApiCommandBuffersTests.hpp index 89499ba..ff77ad9 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiCommandBuffersTests.hpp +++ b/external/vulkancts/modules/vulkan/api/vktApiCommandBuffersTests.hpp @@ -1,4 +1,3 @@ - #ifndef _VKTAPICOMMANDBUFFERSTESTS_HPP #define _VKTAPICOMMANDBUFFERSTESTS_HPP @@ -42,10 +41,9 @@ namespace vkt namespace api { -tcu::TestCaseGroup* createCommandBuffersTests (tcu::TestContext& testCtx); +tcu::TestCaseGroup* createCommandBuffersTests (tcu::TestContext& testCtx); } // api } // vkt - #endif /* VKTAPICOMMANDBUFFERSTESTS_HPP_ */ diff --git a/framework/platform/android/tcuAndroidPlatform.cpp b/framework/platform/android/tcuAndroidPlatform.cpp index 10a242b..d9a46d5 100644 --- a/framework/platform/android/tcuAndroidPlatform.cpp +++ b/framework/platform/android/tcuAndroidPlatform.cpp @@ -190,7 +190,7 @@ class VulkanLibrary : public vk::Library { public: VulkanLibrary (void) -: m_library    ("libVK_IMG.so") + : m_library ("libvulkan.so") , m_driver (m_library) { } diff --git a/targets/android/android.cmake b/targets/android/android.cmake index 1cbb299..59d5e9c 100644 --- a/targets/android/android.cmake +++ b/targets/android/android.cmake @@ -21,8 +21,8 @@ if (DEQP_SUPPORT_EGL) endif () # Platform libs -# -# +find_library(LOG_LIBRARY NAMES log PATHS /usr/lib) +set(DEQP_PLATFORM_LIBRARIES ${DEQP_PLATFORM_LIBRARIES} ${LOG_LIBRARY}) if (DE_ANDROID_API GREATER 8) # libandroid for NativeActivity APIs -- 2.7.4