xref: /aosp_15_r20/external/deqp/external/vulkancts/modules/vulkan/multiview/vktMultiViewRenderUtil.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 #ifndef _VKTMULTIVIEWRENDERUTIL_HPP
2 #define _VKTMULTIVIEWRENDERUTIL_HPP
3 /*------------------------------------------------------------------------
4  * Vulkan Conformance Tests
5  * ------------------------
6  *
7  * Copyright (c) 2017 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 Vulkan Multi View Render Util
24  *//*--------------------------------------------------------------------*/
25 
26 #include "tcuDefs.hpp"
27 #include "vkObjUtil.hpp"
28 #include "vkRefUtil.hpp"
29 #include "tcuTexture.hpp"
30 
31 namespace vkt
32 {
33 namespace MultiView
34 {
35 
36 vk::VkImageAspectFlags getAspectFlags(tcu::TextureFormat format);
37 vk::VkFormat getStencilBufferFormat(const vk::VkFormat depthStencilImageFormat);
38 vk::VkFormat getDepthBufferFormat(const vk::VkFormat depthStencilImageFormat);
39 vk::VkImageCreateInfo makeImageCreateInfo(const vk::VkImageType imageType, const vk::VkExtent3D &extent,
40                                           const vk::VkFormat format, const vk::VkImageUsageFlags usage,
41                                           const vk::VkSampleCountFlagBits samples);
42 vk::Move<vk::VkDescriptorSetLayout> makeDescriptorSetLayout(const vk::DeviceInterface &vk, const vk::VkDevice device);
43 
44 template <typename AttachmentDesc, typename AttachmentRef, typename SubpassDesc, typename SubpassDep,
45           typename RenderPassCreateInfo>
46 vk::Move<vk::VkRenderPass> makeRenderPass(const vk::DeviceInterface &vk, const vk::VkDevice device,
47                                           const vk::VkFormat colorFormat, const std::vector<uint32_t> &viewMasks,
48                                           const vk::VkSampleCountFlagBits samples,
49                                           const vk::VkAttachmentLoadOp colorLoadOp, const vk::VkFormat dsFormat);
50 
51 template <typename AttachmentDesc, typename AttachmentRef, typename SubpassDesc, typename SubpassDep,
52           typename RenderPassCreateInfo>
53 vk::Move<vk::VkRenderPass> makeRenderPassWithAttachments(const vk::DeviceInterface &vk, const vk::VkDevice device,
54                                                          const vk::VkFormat colorFormat,
55                                                          const std::vector<uint32_t> &viewMasks, bool useAspects);
56 
57 template <typename AttachmentDesc, typename AttachmentRef, typename SubpassDesc, typename SubpassDep,
58           typename RenderPassCreateInfo>
59 vk::Move<vk::VkRenderPass> makeRenderPassWithDepth(const vk::DeviceInterface &vk, const vk::VkDevice device,
60                                                    const vk::VkFormat colorFormat,
61                                                    const std::vector<uint32_t> &viewMasks, const vk::VkFormat dsFormat);
62 
63 void beginSecondaryCommandBuffer(const vk::DeviceInterface &vk, const vk::VkCommandBuffer commandBuffer,
64                                  const vk::VkRenderPass renderPass, const uint32_t subpass,
65                                  const vk::VkFramebuffer framebuffer);
66 void imageBarrier(const vk::DeviceInterface &vk, const vk::VkCommandBuffer cmdBuffer, const vk::VkImage image,
67                   const vk::VkImageSubresourceRange subresourceRange, const vk::VkImageLayout oldLayout,
68                   const vk::VkImageLayout newLayout, const vk::VkAccessFlags srcAccessMask,
69                   const vk::VkAccessFlags dstAccessMask,
70                   const vk::VkPipelineStageFlags srcStageMask = vk::VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
71                   const vk::VkPipelineStageFlags dstStageMask = vk::VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
72 
73 } // namespace MultiView
74 } // namespace vkt
75 
76 #endif // _VKTMULTIVIEWRENDERUTIL_HPP
77