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