1e5c31af7Sopenharmony_ci#ifndef _VKCMDUTIL_HPP 2e5c31af7Sopenharmony_ci#define _VKCMDUTIL_HPP 3e5c31af7Sopenharmony_ci/*------------------------------------------------------------------------- 4e5c31af7Sopenharmony_ci * Vulkan CTS Framework 5e5c31af7Sopenharmony_ci * -------------------- 6e5c31af7Sopenharmony_ci * 7e5c31af7Sopenharmony_ci * Copyright (c) 2018 Google Inc. 8e5c31af7Sopenharmony_ci * 9e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 10e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License. 11e5c31af7Sopenharmony_ci * You may obtain a copy of the License at 12e5c31af7Sopenharmony_ci * 13e5c31af7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 14e5c31af7Sopenharmony_ci * 15e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 16e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 17e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and 19e5c31af7Sopenharmony_ci * limitations under the License. 20e5c31af7Sopenharmony_ci * 21e5c31af7Sopenharmony_ci *//*! 22e5c31af7Sopenharmony_ci * \file 23e5c31af7Sopenharmony_ci * \brief Utilities for commonly used command tasks 24e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/ 25e5c31af7Sopenharmony_ci 26e5c31af7Sopenharmony_ci#include "vkDefs.hpp" 27e5c31af7Sopenharmony_ci#include "vkRef.hpp" 28e5c31af7Sopenharmony_ci#include "tcuVector.hpp" 29e5c31af7Sopenharmony_ci 30e5c31af7Sopenharmony_cinamespace vk 31e5c31af7Sopenharmony_ci{ 32e5c31af7Sopenharmony_ci 33e5c31af7Sopenharmony_civoid beginCommandBuffer (const DeviceInterface& vk, 34e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 35e5c31af7Sopenharmony_ci VkCommandBufferUsageFlags flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT); 36e5c31af7Sopenharmony_ci 37e5c31af7Sopenharmony_ci// Begins a secondary command buffer. 38e5c31af7Sopenharmony_ci// Note if renderPass is not DE_NULL, VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT will be added to the flags. 39e5c31af7Sopenharmony_civoid beginSecondaryCommandBuffer (const DeviceInterface& vk, 40e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 41e5c31af7Sopenharmony_ci const VkRenderPass renderPass = DE_NULL, 42e5c31af7Sopenharmony_ci const VkFramebuffer framebuffer = DE_NULL, 43e5c31af7Sopenharmony_ci const VkCommandBufferUsageFlags flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT); 44e5c31af7Sopenharmony_ci 45e5c31af7Sopenharmony_civoid endCommandBuffer (const DeviceInterface& vk, 46e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer); 47e5c31af7Sopenharmony_ci 48e5c31af7Sopenharmony_civoid beginRenderPass (const DeviceInterface& vk, 49e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 50e5c31af7Sopenharmony_ci const VkRenderPass renderPass, 51e5c31af7Sopenharmony_ci const VkFramebuffer framebuffer, 52e5c31af7Sopenharmony_ci const VkRect2D& renderArea, 53e5c31af7Sopenharmony_ci const deUint32 clearValueCount, 54e5c31af7Sopenharmony_ci const VkClearValue* clearValues, 55e5c31af7Sopenharmony_ci const VkSubpassContents contents = VK_SUBPASS_CONTENTS_INLINE, 56e5c31af7Sopenharmony_ci const void* pNext = DE_NULL); 57e5c31af7Sopenharmony_ci 58e5c31af7Sopenharmony_civoid beginRenderPass (const DeviceInterface& vk, 59e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 60e5c31af7Sopenharmony_ci const VkRenderPass renderPass, 61e5c31af7Sopenharmony_ci const VkFramebuffer framebuffer, 62e5c31af7Sopenharmony_ci const VkRect2D& renderArea, 63e5c31af7Sopenharmony_ci const VkClearValue& clearValue, 64e5c31af7Sopenharmony_ci const VkSubpassContents contents = VK_SUBPASS_CONTENTS_INLINE); 65e5c31af7Sopenharmony_ci 66e5c31af7Sopenharmony_civoid beginRenderPass (const DeviceInterface& vk, 67e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 68e5c31af7Sopenharmony_ci const VkRenderPass renderPass, 69e5c31af7Sopenharmony_ci const VkFramebuffer framebuffer, 70e5c31af7Sopenharmony_ci const VkRect2D& renderArea, 71e5c31af7Sopenharmony_ci const VkSubpassContents contents = VK_SUBPASS_CONTENTS_INLINE); 72e5c31af7Sopenharmony_ci 73e5c31af7Sopenharmony_civoid beginRenderPass (const DeviceInterface& vk, 74e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 75e5c31af7Sopenharmony_ci const VkRenderPass renderPass, 76e5c31af7Sopenharmony_ci const VkFramebuffer framebuffer, 77e5c31af7Sopenharmony_ci const VkRect2D& renderArea, 78e5c31af7Sopenharmony_ci const tcu::Vec4& clearColor, 79e5c31af7Sopenharmony_ci const VkSubpassContents contents = VK_SUBPASS_CONTENTS_INLINE); 80e5c31af7Sopenharmony_ci 81e5c31af7Sopenharmony_civoid beginRenderPass (const DeviceInterface& vk, 82e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 83e5c31af7Sopenharmony_ci const VkRenderPass renderPass, 84e5c31af7Sopenharmony_ci const VkFramebuffer framebuffer, 85e5c31af7Sopenharmony_ci const VkRect2D& renderArea, 86e5c31af7Sopenharmony_ci const tcu::Vec4& clearColor, 87e5c31af7Sopenharmony_ci const void* pNext, 88e5c31af7Sopenharmony_ci const VkSubpassContents contents = VK_SUBPASS_CONTENTS_INLINE); 89e5c31af7Sopenharmony_ci 90e5c31af7Sopenharmony_civoid beginRenderPass (const DeviceInterface& vk, 91e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 92e5c31af7Sopenharmony_ci const VkRenderPass renderPass, 93e5c31af7Sopenharmony_ci const VkFramebuffer framebuffer, 94e5c31af7Sopenharmony_ci const VkRect2D& renderArea, 95e5c31af7Sopenharmony_ci const tcu::Vec4& clearColor, 96e5c31af7Sopenharmony_ci const float clearDepth, 97e5c31af7Sopenharmony_ci const deUint32 clearStencil, 98e5c31af7Sopenharmony_ci const void* pNext, 99e5c31af7Sopenharmony_ci const VkSubpassContents contents = VK_SUBPASS_CONTENTS_INLINE); 100e5c31af7Sopenharmony_ci 101e5c31af7Sopenharmony_civoid beginRenderPass (const DeviceInterface& vk, 102e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 103e5c31af7Sopenharmony_ci const VkRenderPass renderPass, 104e5c31af7Sopenharmony_ci const VkFramebuffer framebuffer, 105e5c31af7Sopenharmony_ci const VkRect2D& renderArea, 106e5c31af7Sopenharmony_ci const tcu::UVec4& clearColor, 107e5c31af7Sopenharmony_ci const VkSubpassContents contents = VK_SUBPASS_CONTENTS_INLINE); 108e5c31af7Sopenharmony_ci 109e5c31af7Sopenharmony_civoid beginRenderPass (const DeviceInterface& vk, 110e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 111e5c31af7Sopenharmony_ci const VkRenderPass renderPass, 112e5c31af7Sopenharmony_ci const VkFramebuffer framebuffer, 113e5c31af7Sopenharmony_ci const VkRect2D& renderArea, 114e5c31af7Sopenharmony_ci const tcu::Vec4& clearColor, 115e5c31af7Sopenharmony_ci const float clearDepth, 116e5c31af7Sopenharmony_ci const deUint32 clearStencil, 117e5c31af7Sopenharmony_ci const VkSubpassContents contents = VK_SUBPASS_CONTENTS_INLINE); 118e5c31af7Sopenharmony_ci 119e5c31af7Sopenharmony_civoid endRenderPass (const DeviceInterface& vk, 120e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer); 121e5c31af7Sopenharmony_ci 122e5c31af7Sopenharmony_ci#ifndef CTS_USES_VULKANSC 123e5c31af7Sopenharmony_civoid beginRendering (const DeviceInterface& vk, 124e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 125e5c31af7Sopenharmony_ci const VkImageView colorImageView, 126e5c31af7Sopenharmony_ci const VkRect2D& renderArea, 127e5c31af7Sopenharmony_ci const VkClearValue& clearValue, 128e5c31af7Sopenharmony_ci const VkImageLayout imageLayout = VK_IMAGE_LAYOUT_GENERAL, 129e5c31af7Sopenharmony_ci const VkAttachmentLoadOp loadOperation = VK_ATTACHMENT_LOAD_OP_LOAD, 130e5c31af7Sopenharmony_ci VkRenderingFlagsKHR renderingFlags = 0, 131e5c31af7Sopenharmony_ci const deUint32 layerCount = 1u, 132e5c31af7Sopenharmony_ci const deUint32 viewMask = 0u); 133e5c31af7Sopenharmony_ci 134e5c31af7Sopenharmony_civoid beginRendering (const DeviceInterface& vk, 135e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 136e5c31af7Sopenharmony_ci const VkImageView colorImageView, 137e5c31af7Sopenharmony_ci const VkImageView depthStencilImageView, 138e5c31af7Sopenharmony_ci const bool useStencilAttachment, 139e5c31af7Sopenharmony_ci const VkRect2D& renderArea, 140e5c31af7Sopenharmony_ci const VkClearValue& clearColorValue, 141e5c31af7Sopenharmony_ci const VkClearValue& clearDepthValue, 142e5c31af7Sopenharmony_ci const VkImageLayout colorImageLayout = VK_IMAGE_LAYOUT_GENERAL, 143e5c31af7Sopenharmony_ci const VkImageLayout depthImageLayout = VK_IMAGE_LAYOUT_GENERAL, 144e5c31af7Sopenharmony_ci const VkAttachmentLoadOp loadOperation = VK_ATTACHMENT_LOAD_OP_LOAD, 145e5c31af7Sopenharmony_ci VkRenderingFlagsKHR renderingFlags = 0, 146e5c31af7Sopenharmony_ci const deUint32 layerCount = 1u, 147e5c31af7Sopenharmony_ci const deUint32 viewMask = 0u); 148e5c31af7Sopenharmony_ci 149e5c31af7Sopenharmony_civoid endRendering (const DeviceInterface& vk, 150e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer); 151e5c31af7Sopenharmony_ci#endif // CTS_USES_VULKANSC 152e5c31af7Sopenharmony_ci 153e5c31af7Sopenharmony_civoid submitCommandsAndWait (const DeviceInterface& vk, 154e5c31af7Sopenharmony_ci const VkDevice device, 155e5c31af7Sopenharmony_ci const VkQueue queue, 156e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 157e5c31af7Sopenharmony_ci const bool useDeviceGroups = false, 158e5c31af7Sopenharmony_ci const deUint32 deviceMask = 1u, 159e5c31af7Sopenharmony_ci const deUint32 waitSemaphoreCount = 0u, 160e5c31af7Sopenharmony_ci const VkSemaphore* waitSemaphores = nullptr, 161e5c31af7Sopenharmony_ci const VkPipelineStageFlags* waitStages = nullptr); 162e5c31af7Sopenharmony_ci 163e5c31af7Sopenharmony_civk::Move<VkFence> submitCommands (const DeviceInterface& vk, 164e5c31af7Sopenharmony_ci const VkDevice device, 165e5c31af7Sopenharmony_ci const VkQueue queue, 166e5c31af7Sopenharmony_ci const VkCommandBuffer commandBuffer, 167e5c31af7Sopenharmony_ci const bool useDeviceGroups = false, 168e5c31af7Sopenharmony_ci const deUint32 deviceMask = 1u, 169e5c31af7Sopenharmony_ci const deUint32 waitSemaphoreCount = 0u, 170e5c31af7Sopenharmony_ci const VkSemaphore* waitSemaphores = nullptr, 171e5c31af7Sopenharmony_ci const VkPipelineStageFlags* waitStages = nullptr); 172e5c31af7Sopenharmony_ci 173e5c31af7Sopenharmony_civoid waitForFence (const DeviceInterface& vk, const VkDevice device, const VkFence fence, uint64_t timeoutNanos = (~0ull)); 174e5c31af7Sopenharmony_ci 175e5c31af7Sopenharmony_ci} // vk 176e5c31af7Sopenharmony_ci 177e5c31af7Sopenharmony_ci#endif // _VKCMDUTIL_HPP 178