xref: /aosp_15_r20/external/deqp/external/vulkancts/modules/vulkan/multiview/vktMultiViewRenderPassUtil.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
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, VkAttachmentDescriptionFlags flags, VkFormat format,
41                            VkSampleCountFlagBits samples, VkAttachmentLoadOp loadOp, VkAttachmentStoreOp storeOp,
42                            VkAttachmentLoadOp stencilLoadOp, VkAttachmentStoreOp stencilStoreOp,
43                            VkImageLayout initialLayout, VkImageLayout finalLayout);
44 };
45 
46 class AttachmentDescription2 : public vk::VkAttachmentDescription2
47 {
48 public:
49     AttachmentDescription2(const void *pNext, VkAttachmentDescriptionFlags flags, VkFormat format,
50                            VkSampleCountFlagBits samples, VkAttachmentLoadOp loadOp, VkAttachmentStoreOp storeOp,
51                            VkAttachmentLoadOp stencilLoadOp, VkAttachmentStoreOp stencilStoreOp,
52                            VkImageLayout initialLayout, VkImageLayout finalLayout);
53 };
54 
55 class AttachmentReference1 : public vk::VkAttachmentReference
56 {
57 public:
58     AttachmentReference1(const void *pNext, uint32_t attachment, VkImageLayout layout, VkImageAspectFlags aspectMask);
59 };
60 
61 class AttachmentReference2 : public vk::VkAttachmentReference2
62 {
63 public:
64     AttachmentReference2(const void *pNext, uint32_t attachment, VkImageLayout layout, VkImageAspectFlags aspectMask);
65 };
66 
67 class SubpassDescription1 : public vk::VkSubpassDescription
68 {
69 public:
70     SubpassDescription1(const void *pNext, VkSubpassDescriptionFlags flags, VkPipelineBindPoint pipelineBindPoint,
71                         uint32_t viewMask, uint32_t inputAttachmentCount,
72                         const VkAttachmentReference *pInputAttachments, uint32_t colorAttachmentCount,
73                         const VkAttachmentReference *pColorAttachments,
74                         const VkAttachmentReference *pResolveAttachments,
75                         const VkAttachmentReference *pDepthStencilAttachment, uint32_t preserveAttachmentCount,
76                         const uint32_t *pPreserveAttachments);
77 };
78 
79 class SubpassDescription2 : public vk::VkSubpassDescription2
80 {
81 public:
82     SubpassDescription2(const void *pNext, VkSubpassDescriptionFlags flags, VkPipelineBindPoint pipelineBindPoint,
83                         uint32_t viewMask, uint32_t inputAttachmentCount,
84                         const VkAttachmentReference2 *pInputAttachments, uint32_t colorAttachmentCount,
85                         const VkAttachmentReference2 *pColorAttachments,
86                         const VkAttachmentReference2 *pResolveAttachments,
87                         const VkAttachmentReference2 *pDepthStencilAttachment, uint32_t preserveAttachmentCount,
88                         const uint32_t *pPreserveAttachments);
89 };
90 
91 class SubpassDependency1 : public vk::VkSubpassDependency
92 {
93 public:
94     SubpassDependency1(const void *pNext, uint32_t srcSubpass, uint32_t dstSubpass, VkPipelineStageFlags srcStageMask,
95                        VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask,
96                        VkDependencyFlags dependencyFlags, int32_t viewOffset);
97 };
98 
99 class SubpassDependency2 : public vk::VkSubpassDependency2
100 {
101 public:
102     SubpassDependency2(const void *pNext, uint32_t srcSubpass, uint32_t dstSubpass, VkPipelineStageFlags srcStageMask,
103                        VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask,
104                        VkDependencyFlags dependencyFlags, int32_t viewOffset);
105 };
106 
107 class RenderPassCreateInfo1 : public VkRenderPassCreateInfo
108 {
109 public:
110     RenderPassCreateInfo1(const void *pNext, VkRenderPassCreateFlags flags, uint32_t attachmentCount,
111                           const VkAttachmentDescription *pAttachments, uint32_t subpassCount,
112                           const VkSubpassDescription *pSubpasses, uint32_t dependencyCount,
113                           const VkSubpassDependency *pDependencies, uint32_t correlatedViewMaskCount,
114                           const uint32_t *pCorrelatedViewMasks);
115 
116     Move<VkRenderPass> createRenderPass(const DeviceInterface &vk, VkDevice device) const;
117 };
118 
119 class RenderPassCreateInfo2 : public VkRenderPassCreateInfo2
120 {
121 public:
122     RenderPassCreateInfo2(const void *pNext, VkRenderPassCreateFlags flags, uint32_t attachmentCount,
123                           const VkAttachmentDescription2 *pAttachments, uint32_t subpassCount,
124                           const VkSubpassDescription2 *pSubpasses, uint32_t dependencyCount,
125                           const VkSubpassDependency2 *pDependencies, uint32_t correlatedViewMaskCount,
126                           const uint32_t *pCorrelatedViewMasks);
127 
128     Move<VkRenderPass> createRenderPass(const DeviceInterface &vk, VkDevice device) const;
129 };
130 
131 class SubpassBeginInfo1
132 {
133 public:
134     SubpassBeginInfo1(const void *pNext, VkSubpassContents contents);
135 
136     VkSubpassContents contents;
137 };
138 
139 class SubpassBeginInfo2 : public VkSubpassBeginInfo
140 {
141 public:
142     SubpassBeginInfo2(const void *pNext, VkSubpassContents contents);
143 };
144 
145 class SubpassEndInfo1
146 {
147 public:
148     SubpassEndInfo1(const void *pNext);
149 };
150 
151 class SubpassEndInfo2 : public VkSubpassEndInfo
152 {
153 public:
154     SubpassEndInfo2(const void *pNext);
155 };
156 
157 class RenderpassSubpass1
158 {
159 public:
160     typedef SubpassBeginInfo1 SubpassBeginInfo;
161     typedef SubpassEndInfo1 SubpassEndInfo;
162 
163     static void cmdBeginRenderPass(const DeviceInterface &vk, VkCommandBuffer cmdBuffer,
164                                    const VkRenderPassBeginInfo *pRenderPassBegin,
165                                    const SubpassBeginInfo *pSubpassBeginInfo);
166 
167     static void cmdNextSubpass(const DeviceInterface &vk, VkCommandBuffer cmdBuffer,
168                                const SubpassBeginInfo *pSubpassBeginInfo, const SubpassEndInfo *pSubpassEndInfo);
169 
170     static void cmdEndRenderPass(const DeviceInterface &vk, VkCommandBuffer cmdBuffer,
171                                  const SubpassEndInfo *pSubpassEndInfo);
172 };
173 
174 class RenderpassSubpass2
175 {
176 public:
177     typedef SubpassBeginInfo2 SubpassBeginInfo;
178     typedef SubpassEndInfo2 SubpassEndInfo;
179 
180     static void cmdBeginRenderPass(const DeviceInterface &vk, VkCommandBuffer cmdBuffer,
181                                    const VkRenderPassBeginInfo *pRenderPassBegin,
182                                    const SubpassBeginInfo *pSubpassBeginInfo);
183 
184     static void cmdNextSubpass(const DeviceInterface &vk, VkCommandBuffer cmdBuffer,
185                                const SubpassBeginInfo *pSubpassBeginInfo, const SubpassEndInfo *pSubpassEndInfo);
186 
187     static void cmdEndRenderPass(const DeviceInterface &vk, VkCommandBuffer cmdBuffer,
188                                  const SubpassEndInfo *pSubpassEndInfo);
189 };
190 
191 } // namespace MultiView
192 
193 } // namespace vkt
194 
195 #endif // _VKTMULTIVIEWRENDERPASSUTIL_HPP
196