Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
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
82
84 ResourceKey::Builder& builder,
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
#define VK_NULL_HANDLE
Definition vulkan_core.h:46
VkAttachmentLoadOp
@ VK_ATTACHMENT_LOAD_OP_CLEAR
@ VK_ATTACHMENT_LOAD_OP_LOAD
@ VK_ATTACHMENT_LOAD_OP_DONT_CARE
VkAttachmentStoreOp
@ VK_ATTACHMENT_STORE_OP_DONT_CARE
@ VK_ATTACHMENT_STORE_OP_STORE