vktSynchronizationUtil.hpp
vktSynchronizationSmokeTests.cpp
vktSynchronizationSmokeTests.hpp
+ vktSynchronizationBasicFenceTests.cpp
+ vktSynchronizationBasicFenceTests.hpp
+ vktSynchronizationBasicSemaphoreTests.cpp
+ vktSynchronizationBasicSemaphoreTests.hpp
+ vktSynchronizationBasicEventTests.cpp
+ vktSynchronizationBasicEventTests.hpp
)
set(DEQP_VK_SYNCHRONIZATION_LIBS
--- /dev/null
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2016 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Synchronization event basic tests
+ *//*--------------------------------------------------------------------*/
+
+#include "vktSynchronizationBasicEventTests.hpp"
+#include "vktTestCaseUtil.hpp"
+#include "vktSynchronizationUtil.hpp"
+
+#include "vkDefs.hpp"
+#include "vkPlatform.hpp"
+
+#include "vkRef.hpp"
+
+namespace vkt
+{
+namespace synchronization
+{
+namespace
+{
+
+using namespace vk;
+#define SHORT_FENCE_WAIT 1000ull
+#define LONG_FENCE_WAIT ~0ull
+
+tcu::TestStatus hostResetSetEventCase (Context& context)
+{
+ const DeviceInterface& vk = context.getDeviceInterface();
+ const VkDevice device = context.getDevice();
+ const VkEventCreateInfo eventInfo =
+ {
+ VK_STRUCTURE_TYPE_EVENT_CREATE_INFO,
+ DE_NULL,
+ 0
+ };
+ VkEvent event;
+ Move<VkEvent> ptrEvent;
+
+ if (VK_SUCCESS != vk.createEvent(device, &eventInfo, DE_NULL, &event))
+ return tcu::TestStatus::fail("Couldn't create event");
+
+ ptrEvent = Move<VkEvent>(check<VkEvent>(event), Deleter<VkEvent>(vk, device, DE_NULL));
+
+ if (VK_EVENT_RESET != vk.getEventStatus(device, event))
+ return tcu::TestStatus::fail("Created event should be in unsignaled state");
+
+ if (VK_SUCCESS != vk.setEvent(device, event))
+ return tcu::TestStatus::fail("Couldn't set event");
+
+ if (VK_EVENT_SET != vk.getEventStatus(device, event))
+ return tcu::TestStatus::fail("Event should be in signaled state after set");
+
+ if (VK_SUCCESS != vk.resetEvent(device, event))
+ return tcu::TestStatus::fail("Couldn't reset event");
+
+ if (VK_EVENT_RESET != vk.getEventStatus(device, event))
+ return tcu::TestStatus::fail("Event should be in unsignaled state after reset");
+
+ return tcu::TestStatus::pass("Tests set and reset event on host pass");
+}
+
+tcu::TestStatus deviceResetSetEventCase (Context& context)
+{
+ const DeviceInterface& vk = context.getDeviceInterface();
+ const VkDevice device = context.getDevice();
+ const VkQueue queue = context.getUniversalQueue();
+ const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
+ const Unique<VkCommandPool> cmdPool (makeCommandPool(vk, device, queueFamilyIndex));
+ const Unique<VkCommandBuffer> cmdBuffer (makeCommandBuffer(vk, device, *cmdPool));
+ const VkSubmitInfo submitInfo =
+ {
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ DE_NULL, // const VkPipelineStageFlags* pWaitDstStageMask;
+ 1u, // deUint32 commandBufferCount;
+ &cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0u, // deUint32 signalSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pSignalSemaphores;
+ };
+ const VkEventCreateInfo eventInfo =
+ {
+ VK_STRUCTURE_TYPE_EVENT_CREATE_INFO,
+ DE_NULL,
+ 0
+ };
+ const Unique<VkEvent> event (createEvent(vk, device, &eventInfo, DE_NULL));
+
+ beginCommandBuffer(vk, *cmdBuffer);
+ vk.cmdSetEvent(*cmdBuffer, *event, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
+ endCommandBuffer(vk, *cmdBuffer);
+
+ VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, DE_NULL));
+ VK_CHECK(vk.queueWaitIdle(queue));
+
+ if (VK_EVENT_SET != vk.getEventStatus(device, *event))
+ return tcu::TestStatus::fail("Event should be in signaled state after set");
+
+ beginCommandBuffer(vk, *cmdBuffer);
+ vk.cmdResetEvent(*cmdBuffer, *event, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
+ endCommandBuffer(vk, *cmdBuffer);
+
+ VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, DE_NULL));
+ VK_CHECK(vk.queueWaitIdle(queue));
+
+ if (VK_EVENT_RESET != vk.getEventStatus(device, *event))
+ return tcu::TestStatus::fail("Event should be in unsignaled state after set");
+
+ return tcu::TestStatus::pass("Device set and reset event tests pass");
+}
+
+tcu::TestStatus deviceWaitForEventCase (Context& context)
+{
+ const DeviceInterface& vk = context.getDeviceInterface();
+ const VkDevice device = context.getDevice();
+ const VkQueue queue = context.getUniversalQueue();
+ const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
+ const VkFenceCreateInfo fenceInfo =
+ {
+ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkFenceCreateFlags flags;
+ };
+ const Unique<VkFence> fence (createFence(vk, device, &fenceInfo));
+ const Unique<VkCommandPool> cmdPool (makeCommandPool(vk, device, queueFamilyIndex));
+ const Unique<VkCommandBuffer> cmdBuffer (makeCommandBuffer(vk, device, *cmdPool));
+ const VkSubmitInfo submitInfo =
+ {
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ DE_NULL, // const VkPipelineStageFlags* pWaitDstStageMask;
+ 1u, // deUint32 commandBufferCount;
+ &cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0u, // deUint32 signalSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pSignalSemaphores;
+ };
+ const VkEventCreateInfo eventInfo =
+ {
+ VK_STRUCTURE_TYPE_EVENT_CREATE_INFO,
+ DE_NULL,
+ 0
+ };
+ const Unique<VkEvent> event (createEvent(vk, device, &eventInfo, DE_NULL));
+
+ beginCommandBuffer(vk, *cmdBuffer);
+ vk.cmdWaitEvents(*cmdBuffer, 1u, &event.get(), VK_PIPELINE_STAGE_HOST_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0u, DE_NULL, 0u, DE_NULL, 0u, DE_NULL);
+ endCommandBuffer(vk, *cmdBuffer);
+
+ VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
+ if (VK_TIMEOUT != vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, SHORT_FENCE_WAIT))
+ return tcu::TestStatus::fail("Queue should not end execution");
+
+ if (VK_SUCCESS != vk.setEvent(device, *event))
+ return tcu::TestStatus::fail("Couldn't set event");
+
+ if (VK_SUCCESS != vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, LONG_FENCE_WAIT))
+ return tcu::TestStatus::fail("Queue should end execution");
+
+ return tcu::TestStatus::pass("Device wait for event tests pass");
+}
+
+tcu::TestStatus singleSubmissionCase (Context& context)
+{
+ enum {SET=0, WAIT, COUNT};
+ const DeviceInterface& vk = context.getDeviceInterface();
+ const VkDevice device = context.getDevice();
+ const VkQueue queue = context.getUniversalQueue();
+ const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
+ const VkFenceCreateInfo fenceInfo =
+ {
+ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkFenceCreateFlags flags;
+ };
+ const Unique<VkFence> fence (createFence(vk, device, &fenceInfo));
+ const Unique<VkCommandPool> cmdPool (makeCommandPool(vk, device, queueFamilyIndex));
+ const Move<VkCommandBuffer> ptrCmdBuffer[COUNT] = {makeCommandBuffer(vk, device, *cmdPool), makeCommandBuffer(vk, device, *cmdPool)};
+ VkCommandBuffer cmdBuffers[COUNT] = {*ptrCmdBuffer[SET], *ptrCmdBuffer[WAIT]};
+ const VkSubmitInfo submitInfo =
+ {
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ DE_NULL, // const VkPipelineStageFlags* pWaitDstStageMask;
+ 2u, // deUint32 commandBufferCount;
+ cmdBuffers, // const VkCommandBuffer* pCommandBuffers;
+ 0u, // deUint32 signalSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pSignalSemaphores;
+ };
+ const VkEventCreateInfo eventInfo =
+ {
+ VK_STRUCTURE_TYPE_EVENT_CREATE_INFO,
+ DE_NULL,
+ 0
+ };
+ const Unique<VkEvent> event (createEvent(vk, device, &eventInfo, DE_NULL));
+
+ beginCommandBuffer(vk, cmdBuffers[SET]);
+ vk.cmdSetEvent(cmdBuffers[SET], *event, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
+ endCommandBuffer(vk, cmdBuffers[SET]);
+
+ beginCommandBuffer(vk, cmdBuffers[WAIT]);
+ vk.cmdWaitEvents(cmdBuffers[WAIT], 1u, &event.get(),VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0u, DE_NULL, 0u, DE_NULL, 0u, DE_NULL);
+ endCommandBuffer(vk, cmdBuffers[WAIT]);
+
+ VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
+ if (VK_SUCCESS != vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, LONG_FENCE_WAIT))
+ return tcu::TestStatus::fail("Queue should end execution");
+
+ return tcu::TestStatus::pass("Wait and set even on device single submission tests pass");
+}
+
+tcu::TestStatus multiSubmissionCase (Context& context)
+{
+ enum {SET=0, WAIT, COUNT};
+ const DeviceInterface& vk = context.getDeviceInterface();
+ const VkDevice device = context.getDevice();
+ const VkQueue queue = context.getUniversalQueue();
+ const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
+ const VkFenceCreateInfo fenceInfo =
+ {
+ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkFenceCreateFlags flags;
+ };
+ const Move<VkFence> ptrFence[COUNT] = {createFence(vk, device, &fenceInfo), createFence(vk, device, &fenceInfo)};
+ VkFence fence[COUNT] = {*ptrFence[SET], *ptrFence[WAIT]};
+ const Unique<VkCommandPool> cmdPool (makeCommandPool(vk, device, queueFamilyIndex));
+ const Move<VkCommandBuffer> ptrCmdBuffer[COUNT] = {makeCommandBuffer(vk, device, *cmdPool), makeCommandBuffer(vk, device, *cmdPool)};
+ VkCommandBuffer cmdBuffers[COUNT] = {*ptrCmdBuffer[SET], *ptrCmdBuffer[WAIT]};
+ const VkSubmitInfo submitInfo[COUNT] =
+ {
+ {
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ DE_NULL, // const VkPipelineStageFlags* pWaitDstStageMask;
+ 1u, // deUint32 commandBufferCount;
+ &cmdBuffers[SET], // const VkCommandBuffer* pCommandBuffers;
+ 0u, // deUint32 signalSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pSignalSemaphores;
+ },
+ {
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ DE_NULL, // const VkPipelineStageFlags* pWaitDstStageMask;
+ 1u, // deUint32 commandBufferCount;
+ &cmdBuffers[WAIT], // const VkCommandBuffer* pCommandBuffers;
+ 0u, // deUint32 signalSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pSignalSemaphores;
+ }
+ };
+ const VkEventCreateInfo eventInfo =
+ {
+ VK_STRUCTURE_TYPE_EVENT_CREATE_INFO,
+ DE_NULL,
+ 0
+ };
+ const Unique<VkEvent> event (createEvent(vk, device, &eventInfo, DE_NULL));
+
+ beginCommandBuffer(vk, cmdBuffers[SET]);
+ vk.cmdSetEvent(cmdBuffers[SET], *event, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
+ endCommandBuffer(vk, cmdBuffers[SET]);
+
+ beginCommandBuffer(vk, cmdBuffers[WAIT]);
+ vk.cmdWaitEvents(cmdBuffers[WAIT], 1u, &event.get(), VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0u, DE_NULL, 0u, DE_NULL, 0u, DE_NULL);
+ endCommandBuffer(vk, cmdBuffers[WAIT]);
+
+ VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo[SET], fence[SET]));
+ VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo[WAIT], fence[WAIT]));
+
+ if (VK_SUCCESS != vk.waitForFences(device, 2u, fence, DE_TRUE, LONG_FENCE_WAIT))
+ return tcu::TestStatus::fail("Queue should end execution");
+
+ return tcu::TestStatus::pass("Wait and set even on device multi submission tests pass");
+}
+
+tcu::TestStatus secondaryCommandBufferCase (Context& context)
+{
+ enum {SET=0, WAIT, COUNT};
+ const DeviceInterface& vk = context.getDeviceInterface();
+ const VkDevice device = context.getDevice();
+ const VkQueue queue = context.getUniversalQueue();
+ const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
+ const VkFenceCreateInfo fenceInfo =
+ {
+ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkFenceCreateFlags flags;
+ };
+ const Unique<VkFence> fence (createFence(vk, device, &fenceInfo));
+ const Unique<VkCommandPool> cmdPool (makeCommandPool(vk, device, queueFamilyIndex));
+ const Move<VkCommandBuffer> primaryCmdBuffer (makeCommandBuffer(vk, device, *cmdPool));
+ const VkCommandBufferAllocateInfo cmdBufferInfo =
+ {
+ VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ *cmdPool, // VkCommandPool commandPool;
+ VK_COMMAND_BUFFER_LEVEL_SECONDARY, // VkCommandBufferLevel level;
+ 1u, // deUint32 commandBufferCount;
+ };
+ const Move<VkCommandBuffer> prtCmdBuffers[COUNT] = {allocateCommandBuffer (vk, device, &cmdBufferInfo), allocateCommandBuffer (vk, device, &cmdBufferInfo)};
+ VkCommandBuffer secondaryCmdBuffers[] = {*prtCmdBuffers[SET], *prtCmdBuffers[WAIT]};
+ const VkSubmitInfo submitInfo =
+ {
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ DE_NULL, // const VkPipelineStageFlags* pWaitDstStageMask;
+ 1u, // deUint32 commandBufferCount;
+ &primaryCmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0u, // deUint32 signalSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pSignalSemaphores;
+ };
+ const VkEventCreateInfo eventInfo =
+ {
+ VK_STRUCTURE_TYPE_EVENT_CREATE_INFO,
+ DE_NULL,
+ 0
+ };
+ const Unique<VkEvent> event (createEvent(vk, device, &eventInfo, DE_NULL));
+
+ const VkCommandBufferInheritanceInfo secCmdBufInheritInfo =
+ {
+ VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, //VkStructureType sType;
+ DE_NULL, //const void* pNext;
+ DE_NULL, //VkRenderPass renderPass;
+ 0u, //deUint32 subpass;
+ DE_NULL, //VkFramebuffer framebuffer;
+ VK_FALSE, //VkBool32 occlusionQueryEnable;
+ (VkQueryControlFlags)0u, //VkQueryControlFlags queryFlags;
+ (VkQueryPipelineStatisticFlags)0u, //VkQueryPipelineStatisticFlags pipelineStatistics;
+ };
+ const VkCommandBufferBeginInfo cmdBufferBeginInfo =
+ {
+ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, // VkCommandBufferUsageFlags flags;
+ &secCmdBufInheritInfo, // const VkCommandBufferInheritanceInfo* pInheritanceInfo;
+ };
+
+ VK_CHECK(vk.beginCommandBuffer(secondaryCmdBuffers[SET], &cmdBufferBeginInfo));
+ vk.cmdSetEvent(secondaryCmdBuffers[SET], *event, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
+ endCommandBuffer(vk, secondaryCmdBuffers[SET]);
+
+ VK_CHECK(vk.beginCommandBuffer(secondaryCmdBuffers[WAIT], &cmdBufferBeginInfo));
+ vk.cmdWaitEvents(secondaryCmdBuffers[WAIT], 1u, &event.get(),VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0u, DE_NULL, 0u, DE_NULL, 0u, DE_NULL);
+ endCommandBuffer(vk, secondaryCmdBuffers[WAIT]);
+
+ beginCommandBuffer(vk, *primaryCmdBuffer);
+ vk.cmdExecuteCommands(*primaryCmdBuffer, 2u, secondaryCmdBuffers);
+ endCommandBuffer(vk, *primaryCmdBuffer);
+
+ VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
+ if (VK_SUCCESS != vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, LONG_FENCE_WAIT))
+ return tcu::TestStatus::fail("Queue should end execution");
+
+ return tcu::TestStatus::pass("Wait and set even on device using secondary command buffers tests pass");
+}
+
+} // anonymous
+
+tcu::TestCaseGroup* createBasicEventTests (tcu::TestContext& testCtx)
+{
+ de::MovePtr<tcu::TestCaseGroup> basicTests(new tcu::TestCaseGroup(testCtx, "event", "Basic event tests"));
+ addFunctionCase(basicTests.get(), "host_set_reset", "Basic event tests set and reset on host", hostResetSetEventCase);
+ addFunctionCase(basicTests.get(), "device_set_reset", "Basic event tests set and reset on device", deviceResetSetEventCase);
+ addFunctionCase(basicTests.get(), "host_set_device_wait", "Wait for event on device test", deviceWaitForEventCase);
+ addFunctionCase(basicTests.get(), "single_submit_multi_command_buffer", "Wait and set event single submission on device", singleSubmissionCase);
+ addFunctionCase(basicTests.get(), "multi_submit_multi_command_buffer", "Wait and set event mutli submission on device", multiSubmissionCase);
+ addFunctionCase(basicTests.get(), "multi_secondary_command_buffer", "Event used on secondary command buffer ", secondaryCommandBufferCase);
+
+ return basicTests.release();
+}
+
+} // synchronization
+} // vkt
--- /dev/null
+#ifndef _VKTSYNCHRONIZATIONBASICEVENTTESTS_HPP
+#define _VKTSYNCHRONIZATIONBASICEVENTTESTS_HPP
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2016 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Synchronization event basic tests
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace vkt
+{
+namespace synchronization
+{
+
+tcu::TestCaseGroup* createBasicEventTests (tcu::TestContext& testCtx);
+
+} //synchronization
+} // vkt
+
+
+#endif // _VKTSYNCHRONIZATIONBASICEVENTTESTS_HPP
--- /dev/null
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2016 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Synchronization fence basic tests
+ *//*--------------------------------------------------------------------*/
+
+#include "vktSynchronizationBasicFenceTests.hpp"
+#include "vktTestCaseUtil.hpp"
+#include "vktSynchronizationUtil.hpp"
+
+#include "vkDefs.hpp"
+#include "vkPlatform.hpp"
+
+#include "vkRef.hpp"
+
+namespace vkt
+{
+namespace synchronization
+{
+namespace
+{
+
+using namespace vk;
+
+#define SHORT_FENCE_WAIT 1000ull
+#define LONG_FENCE_WAIT ~0ull
+
+tcu::TestStatus basicOneFenceCase (Context& context)
+{
+ const DeviceInterface& vk = context.getDeviceInterface();
+ const VkDevice device = context.getDevice();
+ const VkQueue queue = context.getUniversalQueue();
+ const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
+ const Unique<VkCommandPool> cmdPool (makeCommandPool(vk, device, queueFamilyIndex));
+ const Unique<VkCommandBuffer> cmdBuffer (makeCommandBuffer(vk, device, *cmdPool));
+ const VkFenceCreateInfo fenceInfo =
+ {
+ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkFenceCreateFlags flags;
+ };
+ const Unique<VkFence> fence (createFence(vk, device, &fenceInfo));
+ const VkSubmitInfo submitInfo =
+ {
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ (const VkPipelineStageFlags*)DE_NULL,
+ 1u, // deUint32 commandBufferCount;
+ &cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0u, // deUint32 signalSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pSignalSemaphores;
+ };
+
+ if (VK_NOT_READY != vk.getFenceStatus(device, *fence))
+ return tcu::TestStatus::fail("Created fence should be in unsignaled state");
+
+ if (VK_TIMEOUT != vk.waitForFences(device, 1u, &fence.get(), VK_TRUE, SHORT_FENCE_WAIT))
+ return tcu::TestStatus::fail("vkWaitForFences should return VK_TIMEOUT");
+
+ if (VK_NOT_READY != vk.getFenceStatus(device, *fence))
+ return tcu::TestStatus::fail("Created fence should be in unsignaled state");
+
+ beginCommandBuffer(vk, *cmdBuffer);
+ endCommandBuffer(vk, *cmdBuffer);
+
+ VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
+
+ if (VK_SUCCESS != vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, LONG_FENCE_WAIT))
+ return tcu::TestStatus::fail("vkWaitForFences should return VK_SUCCESS");
+
+ if (VK_SUCCESS != vk.getFenceStatus(device, *fence))
+ return tcu::TestStatus::fail("Fence should be in signaled state");
+
+ if (VK_SUCCESS != vk.resetFences(device, 1u, &fence.get()))
+ return tcu::TestStatus::fail("Couldn't reset the fence");
+
+ if (VK_NOT_READY != vk.getFenceStatus(device, *fence))
+ return tcu::TestStatus::fail("Fence after reset should be in unsignaled state");
+
+ return tcu::TestStatus::pass("Basic one fence tests passed");
+}
+
+tcu::TestStatus basicMultiFenceCase (Context& context)
+{
+ enum{FISRT_FENCE=0,SECOND_FENCE};
+ const DeviceInterface& vk = context.getDeviceInterface();
+ const VkDevice device = context.getDevice();
+ const VkQueue queue = context.getUniversalQueue();
+ const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
+ const Unique<VkCommandPool> cmdPool (makeCommandPool(vk, device, queueFamilyIndex));
+ const Unique<VkCommandBuffer> cmdBuffer (makeCommandBuffer(vk, device, *cmdPool));
+ const VkFenceCreateInfo fenceInfo =
+ {
+ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkFenceCreateFlags flags;
+ };
+ const Move<VkFence> ptrFence[2] = {createFence(vk, device, &fenceInfo),createFence(vk, device, &fenceInfo)};
+ const VkFence fence[2] = {*ptrFence[FISRT_FENCE],*ptrFence[SECOND_FENCE]};
+ const VkCommandBufferBeginInfo info =
+ {
+ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, // VkCommandBufferUsageFlags flags;
+ DE_NULL, // const VkCommandBufferInheritanceInfo* pInheritanceInfo;
+ };
+ const VkSubmitInfo submitInfo =
+ {
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ (const VkPipelineStageFlags*)DE_NULL,
+ 1u, // deUint32 commandBufferCount;
+ &cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0u, // deUint32 signalSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pSignalSemaphores;
+ };
+
+
+ VK_CHECK(vk.beginCommandBuffer(*cmdBuffer, &info));
+ endCommandBuffer(vk, *cmdBuffer);
+
+ VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, fence[FISRT_FENCE]));
+
+ if (VK_SUCCESS != vk.waitForFences(device, 1u, &fence[FISRT_FENCE], DE_FALSE, LONG_FENCE_WAIT))
+ return tcu::TestStatus::fail("vkWaitForFences should return VK_SUCCESS");
+
+ if (VK_SUCCESS != vk.resetFences(device, 1u, &fence[FISRT_FENCE]))
+ return tcu::TestStatus::fail("Couldn't reset the fence");
+
+ VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, fence[FISRT_FENCE]));
+
+ if (VK_TIMEOUT != vk.waitForFences(device, 2u, &fence[FISRT_FENCE], DE_TRUE, SHORT_FENCE_WAIT))
+ return tcu::TestStatus::fail("vkWaitForFences should return VK_TIMEOUT");
+
+ VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, fence[SECOND_FENCE]));
+
+ if (VK_SUCCESS != vk.waitForFences(device, 2u, &fence[FISRT_FENCE], DE_TRUE, LONG_FENCE_WAIT))
+ return tcu::TestStatus::fail("vkWaitForFences should return VK_SUCCESS");
+
+ return tcu::TestStatus::pass("Basic multi fence tests passed");
+}
+
+} // anonymous
+
+tcu::TestCaseGroup* createBasicFenceTests (tcu::TestContext& testCtx)
+{
+ de::MovePtr<tcu::TestCaseGroup> basicFenceTests(new tcu::TestCaseGroup(testCtx, "fence", "Basic fence tests"));
+ addFunctionCase(basicFenceTests.get(), "one", "Basic one fence tests", basicOneFenceCase);
+ addFunctionCase(basicFenceTests.get(), "multi", "Basic multi fence tests", basicMultiFenceCase);
+
+ return basicFenceTests.release();
+}
+
+} // synchronization
+} // vkt
--- /dev/null
+#ifndef _VKTSYNCHRONIZATIONBASICFENCETESTS_HPP
+#define _VKTSYNCHRONIZATIONBASICFENCETESTS_HPP
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2016 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Synchronization fence basic tests
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace vkt
+{
+namespace synchronization
+{
+
+tcu::TestCaseGroup* createBasicFenceTests (tcu::TestContext& testCtx);
+
+} //synchronization
+} // vkt
+
+
+#endif // _VKTSYNCHRONIZATIONBASICFENCETESTS_HPP
--- /dev/null
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2016 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Synchronization semaphore basic tests
+ *//*--------------------------------------------------------------------*/
+
+#include "vktSynchronizationBasicSemaphoreTests.hpp"
+#include "vktTestCaseUtil.hpp"
+#include "vktSynchronizationUtil.hpp"
+
+#include "vkDefs.hpp"
+#include "vkPlatform.hpp"
+#include "vkQueryUtil.hpp"
+
+
+#include "vkRef.hpp"
+
+namespace vkt
+{
+namespace synchronization
+{
+namespace
+{
+
+using namespace vk;
+
+#define FENCE_WAIT ~0ull
+
+tcu::TestStatus basicOneQueueCase (Context& context)
+{
+ const DeviceInterface& vk = context.getDeviceInterface();
+ const VkDevice device = context.getDevice();
+ const VkQueue queue = context.getUniversalQueue();
+ const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
+ const VkSemaphoreCreateInfo semaphoreInfo =
+ {
+ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, //VkStructureType sType;
+ DE_NULL, //const void* pNext;
+ 0u //VkSemaphoreCreateFlags flags;
+ };
+ const Unique<VkSemaphore> semaphore (createSemaphore (vk, device, &semaphoreInfo, DE_NULL));
+ const Unique<VkCommandPool> cmdPool (makeCommandPool(vk, device, queueFamilyIndex));
+ const Unique<VkCommandBuffer> cmdBuffer (makeCommandBuffer(vk, device, *cmdPool));
+ const VkCommandBufferBeginInfo info =
+ {
+ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, // VkCommandBufferUsageFlags flags;
+ DE_NULL, // const VkCommandBufferInheritanceInfo* pInheritanceInfo;
+ };
+ const VkPipelineStageFlags stageBits[] = { VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT };
+ const VkSubmitInfo submitInfo[2] =
+ {
+ {
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ (const VkPipelineStageFlags*)DE_NULL,
+ 1u, // deUint32 commandBufferCount;
+ &cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 1u, // deUint32 signalSemaphoreCount;
+ &semaphore.get(), // const VkSemaphore* pSignalSemaphores;
+ },
+ {
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 1u, // deUint32 waitSemaphoreCount;
+ &semaphore.get(), // const VkSemaphore* pWaitSemaphores;
+ stageBits, // const VkPipelineStageFlags* pWaitDstStageMask;
+ 1u, // deUint32 commandBufferCount;
+ &cmdBuffer.get(), // const VkCommandBuffer* pCommandBuffers;
+ 0u, // deUint32 signalSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pSignalSemaphores;
+ }
+ };
+ const VkFenceCreateInfo fenceInfo =
+ {
+ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkFenceCreateFlags flags;
+ };
+ const Unique<VkFence> fence (createFence(vk, device, &fenceInfo));
+
+ VK_CHECK(vk.beginCommandBuffer(*cmdBuffer, &info));
+ endCommandBuffer(vk, *cmdBuffer);
+ VK_CHECK(vk.queueSubmit(queue, 2u, submitInfo, *fence));
+
+ if (VK_SUCCESS != vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, FENCE_WAIT))
+ return tcu::TestStatus::fail("Basic semaphore tests with one queue failed");
+
+ return tcu::TestStatus::pass("Basic semaphore tests with one queue passed");
+}
+
+tcu::TestStatus basicMultiQueueCase (Context& context)
+{
+ enum {NO_MATCH_FOUND = ~((deUint32)0)};
+ enum QueuesIndexes {FIRST = 0, SECOND, COUNT};
+
+ struct Queues
+ {
+ VkQueue queue;
+ deUint32 queueFamilyIndex;
+ };
+
+
+ const DeviceInterface& vk = context.getDeviceInterface();
+ const InstanceInterface& instance = context.getInstanceInterface();
+ const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
+ vk::Move<vk::VkDevice> logicalDevice;
+ std::vector<VkQueueFamilyProperties> queueFamilyProperties;
+ VkDeviceCreateInfo deviceInfo;
+ VkPhysicalDeviceFeatures deviceFeatures;
+ const float queuePriorities[COUNT] = {1.0f, 1.0f};
+ VkDeviceQueueCreateInfo queueInfos[COUNT];
+ Queues queues[COUNT] =
+ {
+ {DE_NULL, NO_MATCH_FOUND},
+ {DE_NULL, NO_MATCH_FOUND}
+ };
+ const VkCommandBufferBeginInfo info =
+ {
+ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, // VkCommandBufferUsageFlags flags;
+ DE_NULL, // const VkCommandBufferInheritanceInfo* pInheritanceInfo;
+ };
+ const VkSemaphoreCreateInfo semaphoreInfo =
+ {
+ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, //VkStructureType sType;
+ DE_NULL, //const void* pNext;
+ 0u //VkSemaphoreCreateFlags flags;
+ };
+ Move<VkSemaphore> semaphore;
+ Move<VkCommandPool> cmdPool[COUNT];
+ Move<VkCommandBuffer> cmdBuffer[COUNT];
+ const VkPipelineStageFlags stageBits[] = { VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT };
+ VkSubmitInfo submitInfo[COUNT];
+ const VkFenceCreateInfo fenceInfo =
+ {
+ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // VkFenceCreateFlags flags;
+ };
+ Move<VkFence> fence[COUNT];
+
+ queueFamilyProperties = getPhysicalDeviceQueueFamilyProperties(instance, physicalDevice);
+
+ for (deUint32 queueNdx = 0; queueNdx < queueFamilyProperties.size(); ++queueNdx)
+ {
+ if (NO_MATCH_FOUND == queues[FIRST].queueFamilyIndex)
+ queues[FIRST].queueFamilyIndex = queueNdx;
+
+ if (queues[FIRST].queueFamilyIndex != queueNdx || queueFamilyProperties[queueNdx].queueCount > 1u)
+ {
+ queues[SECOND].queueFamilyIndex = queueNdx;
+ break;
+ }
+ }
+
+ if (queues[FIRST].queueFamilyIndex == NO_MATCH_FOUND || queues[SECOND].queueFamilyIndex == NO_MATCH_FOUND)
+ TCU_THROW(NotSupportedError, "Queues couldn't be created");
+
+ for (int queueNdx = 0; queueNdx < COUNT; ++queueNdx)
+ {
+ VkDeviceQueueCreateInfo queueInfo;
+ deMemset(&queueInfo, 0, sizeof(queueInfo));
+
+ queueInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
+ queueInfo.pNext = DE_NULL;
+ queueInfo.flags = (VkDeviceQueueCreateFlags)0u;
+ queueInfo.queueFamilyIndex = queues[queueNdx].queueFamilyIndex;
+ queueInfo.queueCount = (queues[FIRST].queueFamilyIndex == queues[SECOND].queueFamilyIndex) ? 2 : 1;
+ queueInfo.pQueuePriorities = queuePriorities;
+
+ queueInfos[queueNdx] = queueInfo;
+
+ if (queues[FIRST].queueFamilyIndex == queues[SECOND].queueFamilyIndex)
+ break;
+ }
+
+ deMemset(&deviceInfo, 0, sizeof(deviceInfo));
+ instance.getPhysicalDeviceFeatures(physicalDevice, &deviceFeatures);
+
+ deviceInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
+ deviceInfo.pNext = DE_NULL;
+ deviceInfo.enabledExtensionCount = 0u;
+ deviceInfo.ppEnabledExtensionNames = DE_NULL;
+ deviceInfo.enabledLayerCount = 0u;
+ deviceInfo.ppEnabledLayerNames = DE_NULL;
+ deviceInfo.pEnabledFeatures = &deviceFeatures;
+ deviceInfo.queueCreateInfoCount = (queues[FIRST].queueFamilyIndex == queues[SECOND].queueFamilyIndex) ? 1 : COUNT;
+ deviceInfo.pQueueCreateInfos = queueInfos;
+
+ logicalDevice = vk::createDevice(instance, physicalDevice, &deviceInfo);
+
+ for (deUint32 queueReqNdx = 0; queueReqNdx < COUNT; ++queueReqNdx)
+ {
+ if (queues[FIRST].queueFamilyIndex == queues[SECOND].queueFamilyIndex)
+ vk.getDeviceQueue(*logicalDevice, queues[queueReqNdx].queueFamilyIndex, queueReqNdx, &queues[queueReqNdx].queue);
+ else
+ vk.getDeviceQueue(*logicalDevice, queues[queueReqNdx].queueFamilyIndex, 0u, &queues[queueReqNdx].queue);
+ }
+
+ semaphore = (createSemaphore (vk,*logicalDevice, &semaphoreInfo, DE_NULL));
+ cmdPool[FIRST] = (makeCommandPool(vk, *logicalDevice, queues[FIRST].queueFamilyIndex));
+ cmdPool[SECOND] = (makeCommandPool(vk, *logicalDevice, queues[SECOND].queueFamilyIndex));
+ cmdBuffer[FIRST] = (makeCommandBuffer(vk, *logicalDevice, *cmdPool[FIRST]));
+ cmdBuffer[SECOND] = (makeCommandBuffer(vk, *logicalDevice, *cmdPool[SECOND]));
+
+ submitInfo[FIRST].sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+ submitInfo[FIRST].pNext = DE_NULL;
+ submitInfo[FIRST].waitSemaphoreCount = 0u;
+ submitInfo[FIRST].pWaitSemaphores = DE_NULL;
+ submitInfo[FIRST].pWaitDstStageMask = (const VkPipelineStageFlags*)DE_NULL;
+ submitInfo[FIRST].commandBufferCount = 1u;
+ submitInfo[FIRST].pCommandBuffers = &cmdBuffer[FIRST].get();
+ submitInfo[FIRST].signalSemaphoreCount = 1u;
+ submitInfo[FIRST].pSignalSemaphores = &semaphore.get();
+
+ submitInfo[SECOND].sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+ submitInfo[SECOND].pNext = DE_NULL;
+ submitInfo[SECOND].waitSemaphoreCount = 1u;
+ submitInfo[SECOND].pWaitSemaphores = &semaphore.get();
+ submitInfo[SECOND].pWaitDstStageMask = stageBits;
+ submitInfo[SECOND].commandBufferCount = 1u;
+ submitInfo[SECOND].pCommandBuffers = &cmdBuffer[SECOND].get();
+ submitInfo[SECOND].signalSemaphoreCount = 0u;
+ submitInfo[SECOND].pSignalSemaphores = DE_NULL;
+
+ VK_CHECK(vk.beginCommandBuffer(*cmdBuffer[FIRST], &info));
+ endCommandBuffer(vk, *cmdBuffer[FIRST]);
+ VK_CHECK(vk.beginCommandBuffer(*cmdBuffer[SECOND], &info));
+ endCommandBuffer(vk, *cmdBuffer[SECOND]);
+
+ fence[FIRST] = (createFence(vk, *logicalDevice, &fenceInfo));
+ fence[SECOND] = (createFence(vk, *logicalDevice, &fenceInfo));
+
+ VK_CHECK(vk.queueSubmit(queues[FIRST].queue, 1u, &submitInfo[FIRST], *fence[FIRST]));
+ VK_CHECK(vk.queueSubmit(queues[SECOND].queue, 1u, &submitInfo[SECOND], *fence[SECOND]));
+
+ if (VK_SUCCESS != vk.waitForFences(*logicalDevice, 1u, &fence[FIRST].get(), DE_TRUE, FENCE_WAIT))
+ return tcu::TestStatus::fail("Basic semaphore tests with multi queue failed");
+
+ if (VK_SUCCESS != vk.waitForFences(*logicalDevice, 1u, &fence[SECOND].get(), DE_TRUE, FENCE_WAIT))
+ return tcu::TestStatus::fail("Basic semaphore tests with multi queue failed");
+
+ {
+ VkSubmitInfo swapInfo = submitInfo[SECOND];
+ submitInfo[SECOND] = submitInfo[FIRST];
+ submitInfo[FIRST] = swapInfo;
+ submitInfo[SECOND].pCommandBuffers = &cmdBuffer[SECOND].get();
+ submitInfo[FIRST].pCommandBuffers = &cmdBuffer[FIRST].get();
+ }
+
+ VK_CHECK(vk.resetFences(*logicalDevice, 1u, &fence[FIRST].get()));
+ VK_CHECK(vk.resetFences(*logicalDevice, 1u, &fence[SECOND].get()));
+
+ VK_CHECK(vk.queueSubmit(queues[SECOND].queue, 1u, &submitInfo[SECOND], *fence[SECOND]));
+ VK_CHECK(vk.queueSubmit(queues[FIRST].queue, 1u, &submitInfo[FIRST], *fence[FIRST]));
+
+ if (VK_SUCCESS != vk.waitForFences(*logicalDevice, 1u, &fence[FIRST].get(), DE_TRUE, FENCE_WAIT))
+ return tcu::TestStatus::fail("Basic semaphore tests with multi queue failed");
+
+ if (VK_SUCCESS != vk.waitForFences(*logicalDevice, 1u, &fence[SECOND].get(), DE_TRUE, FENCE_WAIT))
+ return tcu::TestStatus::fail("Basic semaphore tests with multi queue failed");
+
+ return tcu::TestStatus::pass("Basic semaphore tests with multi queue passed");
+}
+
+} // anonymous
+
+tcu::TestCaseGroup* createBasicSemaphoreTests (tcu::TestContext& testCtx)
+{
+ de::MovePtr<tcu::TestCaseGroup> basicTests(new tcu::TestCaseGroup(testCtx, "semaphore", "Basic semaphore tests"));
+ addFunctionCase(basicTests.get(), "one_queue", "Basic semaphore tests with one queue", basicOneQueueCase);
+ addFunctionCase(basicTests.get(), "multi_queue", "Basic semaphore tests with multi queue", basicMultiQueueCase);
+
+ return basicTests.release();
+}
+
+} // synchronization
+} // vkt
--- /dev/null
+#ifndef _VKTSYNCHRONIZATIONBASICSEMAPHORETESTS_HPP
+#define _VKTSYNCHRONIZATIONBASICSEMAPHORETESTS_HPP
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2016 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Synchronization semaphore basic tests
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace vkt
+{
+namespace synchronization
+{
+
+tcu::TestCaseGroup* createBasicSemaphoreTests (tcu::TestContext& testCtx);
+
+} //synchronization
+} // vkt
+
+
+#endif // _VKTSYNCHRONIZATIONBASICSEMAPHORETESTS_HPP
#include "vktTestGroupUtil.hpp"
#include "vktSynchronizationTests.hpp"
#include "vktSynchronizationSmokeTests.hpp"
+#include "vktSynchronizationBasicFenceTests.hpp"
+#include "vktSynchronizationBasicSemaphoreTests.hpp"
+#include "vktSynchronizationBasicEventTests.hpp"
+
+#include "deUniquePtr.hpp"
namespace vkt
{
void createChildren (tcu::TestCaseGroup* group)
{
- tcu::TestContext& testCtx = group->getTestContext();
+ tcu::TestContext& testCtx = group->getTestContext();
+ de::MovePtr<tcu::TestCaseGroup> basicTests (new tcu::TestCaseGroup(testCtx, "basic", "Basic synchronization tests"));
+ basicTests->addChild(createBasicFenceTests(testCtx));
+ basicTests->addChild(createBasicSemaphoreTests(testCtx));
+ basicTests->addChild(createBasicEventTests(testCtx));
+
group->addChild(createSmokeTests(testCtx));
+ group->addChild(basicTests.release());
}
} // anonymous