1 #ifndef _VKTMULTIVIEWRENDERPASSUTIL_HPP 2 #define _VKTMULTIVIEWRENDERPASSUTIL_HPP 3 /*------------------------------------------------------------------------ 4 * Vulkan Conformance Tests 5 * ------------------------ 6 * 7 * Copyright (c) 2018 The Khronos Group 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 RenderPass utils 24 *//*--------------------------------------------------------------------*/ 25 26 #include "tcuDefs.hpp" 27 #include "vkRef.hpp" 28 #include "vkDefs.hpp" 29 #include "vkTypeUtil.hpp" 30 31 namespace vkt 32 { 33 namespace MultiView 34 { 35 using namespace vk; 36 37 class AttachmentDescription1 : public vk::VkAttachmentDescription 38 { 39 public: 40 AttachmentDescription1 (const void* pNext, 41 VkAttachmentDescriptionFlags flags, 42 VkFormat format, 43 VkSampleCountFlagBits samples, 44 VkAttachmentLoadOp loadOp, 45 VkAttachmentStoreOp storeOp, 46 VkAttachmentLoadOp stencilLoadOp, 47 VkAttachmentStoreOp stencilStoreOp, 48 VkImageLayout initialLayout, 49 VkImageLayout finalLayout); 50 }; 51 52 class AttachmentDescription2 : public vk::VkAttachmentDescription2 53 { 54 public: 55 AttachmentDescription2 (const void* pNext, 56 VkAttachmentDescriptionFlags flags, 57 VkFormat format, 58 VkSampleCountFlagBits samples, 59 VkAttachmentLoadOp loadOp, 60 VkAttachmentStoreOp storeOp, 61 VkAttachmentLoadOp stencilLoadOp, 62 VkAttachmentStoreOp stencilStoreOp, 63 VkImageLayout initialLayout, 64 VkImageLayout finalLayout); 65 }; 66 67 class AttachmentReference1 : public vk::VkAttachmentReference 68 { 69 public: 70 AttachmentReference1 (const void* pNext, 71 deUint32 attachment, 72 VkImageLayout layout, 73 VkImageAspectFlags aspectMask); 74 }; 75 76 class AttachmentReference2 : public vk::VkAttachmentReference2 77 { 78 public: 79 AttachmentReference2 (const void* pNext, 80 deUint32 attachment, 81 VkImageLayout layout, 82 VkImageAspectFlags aspectMask); 83 }; 84 85 class SubpassDescription1 : public vk::VkSubpassDescription 86 { 87 public: 88 SubpassDescription1 (const void* pNext, 89 VkSubpassDescriptionFlags flags, 90 VkPipelineBindPoint pipelineBindPoint, 91 deUint32 viewMask, 92 deUint32 inputAttachmentCount, 93 const VkAttachmentReference* pInputAttachments, 94 deUint32 colorAttachmentCount, 95 const VkAttachmentReference* pColorAttachments, 96 const VkAttachmentReference* pResolveAttachments, 97 const VkAttachmentReference* pDepthStencilAttachment, 98 deUint32 preserveAttachmentCount, 99 const deUint32* pPreserveAttachments); 100 }; 101 102 class SubpassDescription2 : public vk::VkSubpassDescription2 103 { 104 public: 105 SubpassDescription2 (const void* pNext, 106 VkSubpassDescriptionFlags flags, 107 VkPipelineBindPoint pipelineBindPoint, 108 deUint32 viewMask, 109 deUint32 inputAttachmentCount, 110 const VkAttachmentReference2* pInputAttachments, 111 deUint32 colorAttachmentCount, 112 const VkAttachmentReference2* pColorAttachments, 113 const VkAttachmentReference2* pResolveAttachments, 114 const VkAttachmentReference2* pDepthStencilAttachment, 115 deUint32 preserveAttachmentCount, 116 const deUint32* pPreserveAttachments); 117 }; 118 119 class SubpassDependency1 : public vk::VkSubpassDependency 120 { 121 public: 122 SubpassDependency1 (const void* pNext, 123 deUint32 srcSubpass, 124 deUint32 dstSubpass, 125 VkPipelineStageFlags srcStageMask, 126 VkPipelineStageFlags dstStageMask, 127 VkAccessFlags srcAccessMask, 128 VkAccessFlags dstAccessMask, 129 VkDependencyFlags dependencyFlags, 130 deInt32 viewOffset); 131 }; 132 133 class SubpassDependency2 : public vk::VkSubpassDependency2 134 { 135 public: 136 SubpassDependency2 (const void* pNext, 137 deUint32 srcSubpass, 138 deUint32 dstSubpass, 139 VkPipelineStageFlags srcStageMask, 140 VkPipelineStageFlags dstStageMask, 141 VkAccessFlags srcAccessMask, 142 VkAccessFlags dstAccessMask, 143 VkDependencyFlags dependencyFlags, 144 deInt32 viewOffset); 145 }; 146 147 class RenderPassCreateInfo1 : public VkRenderPassCreateInfo 148 { 149 public: 150 RenderPassCreateInfo1 (const void* pNext, 151 VkRenderPassCreateFlags flags, 152 deUint32 attachmentCount, 153 const VkAttachmentDescription* pAttachments, 154 deUint32 subpassCount, 155 const VkSubpassDescription* pSubpasses, 156 deUint32 dependencyCount, 157 const VkSubpassDependency* pDependencies, 158 deUint32 correlatedViewMaskCount, 159 const deUint32* pCorrelatedViewMasks); 160 161 Move<VkRenderPass> createRenderPass (const DeviceInterface& vk, 162 VkDevice device) const; 163 }; 164 165 class RenderPassCreateInfo2 : public VkRenderPassCreateInfo2 166 { 167 public: 168 RenderPassCreateInfo2 (const void* pNext, 169 VkRenderPassCreateFlags flags, 170 deUint32 attachmentCount, 171 const VkAttachmentDescription2* pAttachments, 172 deUint32 subpassCount, 173 const VkSubpassDescription2* pSubpasses, 174 deUint32 dependencyCount, 175 const VkSubpassDependency2* pDependencies, 176 deUint32 correlatedViewMaskCount, 177 const deUint32* pCorrelatedViewMasks); 178 179 Move<VkRenderPass> createRenderPass (const DeviceInterface& vk, 180 VkDevice device) const; 181 }; 182 183 class SubpassBeginInfo1 184 { 185 public: 186 SubpassBeginInfo1 (const void* pNext, 187 VkSubpassContents contents); 188 189 VkSubpassContents contents; 190 }; 191 192 class SubpassBeginInfo2 : public VkSubpassBeginInfo 193 { 194 public: 195 SubpassBeginInfo2 (const void* pNext, 196 VkSubpassContents contents); 197 }; 198 199 class SubpassEndInfo1 200 { 201 public: 202 SubpassEndInfo1 (const void* pNext); 203 }; 204 205 class SubpassEndInfo2 : public VkSubpassEndInfo 206 { 207 public: 208 SubpassEndInfo2 (const void* pNext); 209 }; 210 211 class RenderpassSubpass1 212 { 213 public: 214 typedef SubpassBeginInfo1 SubpassBeginInfo; 215 typedef SubpassEndInfo1 SubpassEndInfo; 216 217 static void cmdBeginRenderPass (const DeviceInterface& vk, 218 VkCommandBuffer cmdBuffer, 219 const VkRenderPassBeginInfo* pRenderPassBegin, 220 const SubpassBeginInfo* pSubpassBeginInfo); 221 222 static void cmdNextSubpass (const DeviceInterface& vk, 223 VkCommandBuffer cmdBuffer, 224 const SubpassBeginInfo* pSubpassBeginInfo, 225 const SubpassEndInfo* pSubpassEndInfo); 226 227 static void cmdEndRenderPass (const DeviceInterface& vk, 228 VkCommandBuffer cmdBuffer, 229 const SubpassEndInfo* pSubpassEndInfo); 230 }; 231 232 class RenderpassSubpass2 233 { 234 public: 235 typedef SubpassBeginInfo2 SubpassBeginInfo; 236 typedef SubpassEndInfo2 SubpassEndInfo; 237 238 static void cmdBeginRenderPass (const DeviceInterface& vk, 239 VkCommandBuffer cmdBuffer, 240 const VkRenderPassBeginInfo* pRenderPassBegin, 241 const SubpassBeginInfo* pSubpassBeginInfo); 242 243 static void cmdNextSubpass (const DeviceInterface& vk, 244 VkCommandBuffer cmdBuffer, 245 const SubpassBeginInfo* pSubpassBeginInfo, 246 const SubpassEndInfo* pSubpassEndInfo); 247 248 static void cmdEndRenderPass (const DeviceInterface& vk, 249 VkCommandBuffer cmdBuffer, 250 const SubpassEndInfo* pSubpassEndInfo); 251 }; 252 253 } // renderpass 254 255 } // vkt 256 257 #endif // _VKTMULTIVIEWRENDERPASSUTIL_HPP 258