Flutter Engine
The Flutter Engine
VulkanRenderPass.h
Go to the documentation of this file.
1/*
2* Copyright 2023 Google LLC
3*
4* Use of this source code is governed by a BSD-style license that can be
5* found in the LICENSE file.
6*/
7
8#ifndef skgpu_graphite_VulkanRenderPass_DEFINED
9#define skgpu_graphite_VulkanRenderPass_DEFINED
10
12
15
16namespace skgpu::graphite {
17
18struct AttachmentDesc;
19struct RenderPassDesc;
20class VulkanCommandBuffer;
21class VulkanSharedContext;
22
26};
31};
32
33/**
34 * Wrapper around VkRenderPass.
35*/
36class VulkanRenderPass : public Resource {
37public:
38 // Statically assign attachment indices until such information can be fetched from
39 // graphite-level structures (likely RenderPassDesc)
40 static constexpr int kColorAttachmentIdx = 0;
41 static constexpr int kColorResolveAttachmentIdx = 1;
42 static constexpr int kDepthStencilAttachmentIdx = 2;
43
45
46 // Methods to create compatible (needed when creating a framebuffer and graphics pipeline) or
47 // full (needed when beginning a render pass from the command buffer) render passes and keys.
48 static GraphiteResourceKey MakeRenderPassKey(const RenderPassDesc&, bool compatibleOnly);
49
51 const RenderPassDesc&,
52 bool compatibleOnly);
53
54 VkRenderPass renderPass() const {
55 SkASSERT(fRenderPass != VK_NULL_HANDLE);
56 return fRenderPass;
57 }
58
59 VkExtent2D granularity() { return fGranularity; }
60
61 const char* getResourceType() const override { return "Vulkan RenderPass"; }
62
63 // Struct to store Vulkan information surrounding a RenderPassDesc
65 VulkanRenderPassMetaData(const RenderPassDesc& renderPassDesc);
66
71
78
79 // Accumulate attachments into a container to mimic future structure in RenderPassDesc
81 };
82
85 int& builderIdx,
86 bool compatibleOnly);
87
88private:
89 void freeGpuData() override;
90
92
93 const VulkanSharedContext* fSharedContext;
94 VkRenderPass fRenderPass;
95 VkExtent2D fGranularity;
96};
97} // namespace skgpu::graphite
98
99#endif // skgpu_graphite_VulkanRenderPass_DEFINED
#define SkASSERT(cond)
Definition: SkAssert.h:116
const char * getResourceType() const override
static constexpr int kColorAttachmentIdx
static void AddRenderPassInfoToKey(VulkanRenderPassMetaData &rpMetaData, ResourceKey::Builder &builder, int &builderIdx, bool compatibleOnly)
static constexpr int kMaxExpectedAttachmentCount
static sk_sp< VulkanRenderPass > MakeRenderPass(const VulkanSharedContext *, const RenderPassDesc &, bool compatibleOnly)
static constexpr int kColorResolveAttachmentIdx
static constexpr int kDepthStencilAttachmentIdx
static GraphiteResourceKey MakeRenderPassKey(const RenderPassDesc &, bool compatibleOnly)
static const VkAttachmentLoadOp vkLoadOp[]
static const VkAttachmentStoreOp vkStoreOp[]
skia_private::TArray< const AttachmentDesc * > fAttachments
VulkanRenderPassMetaData(const RenderPassDesc &renderPassDesc)
#define VK_NULL_HANDLE
Definition: vulkan_core.h:46
VkAttachmentLoadOp
Definition: vulkan_core.h:2147
@ VK_ATTACHMENT_LOAD_OP_CLEAR
Definition: vulkan_core.h:2149
@ VK_ATTACHMENT_LOAD_OP_LOAD
Definition: vulkan_core.h:2148
@ VK_ATTACHMENT_LOAD_OP_DONT_CARE
Definition: vulkan_core.h:2150
VkAttachmentStoreOp
Definition: vulkan_core.h:2155
@ VK_ATTACHMENT_STORE_OP_DONT_CARE
Definition: vulkan_core.h:2157
@ VK_ATTACHMENT_STORE_OP_STORE
Definition: vulkan_core.h:2156