Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: src/gpu/vk/GrVkRenderPass.h

Issue 2035853002: Add support for finding/creating general GrVkRenderPass from the VkResourceProvider. (Closed) Base URL: https://skia.googlesource.com/skia.git@renderPass
Patch Set: nits Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/vk/GrVkRenderPass.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrVkRenderPass_DEFINED 8 #ifndef GrVkRenderPass_DEFINED
9 #define GrVkRenderPass_DEFINED 9 #define GrVkRenderPass_DEFINED
10 10
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 12
13 #include "GrVkResource.h" 13 #include "GrVkResource.h"
14 14
15 #include "vk/GrVkDefines.h" 15 #include "vk/GrVkDefines.h"
16 16
17 class GrProcessorKeyBuilder; 17 class GrProcessorKeyBuilder;
18 class GrVkGpu; 18 class GrVkGpu;
19 class GrVkRenderTarget; 19 class GrVkRenderTarget;
20 20
21 class GrVkRenderPass : public GrVkResource { 21 class GrVkRenderPass : public GrVkResource {
22 public: 22 public:
23 GrVkRenderPass() : INHERITED(), fRenderPass(VK_NULL_HANDLE) {} 23 GrVkRenderPass() : INHERITED(), fRenderPass(VK_NULL_HANDLE) {}
24
25 struct LoadStoreOps {
26 VkAttachmentLoadOp fLoadOp;
27 VkAttachmentStoreOp fStoreOp;
28
29 LoadStoreOps(VkAttachmentLoadOp loadOp, VkAttachmentStoreOp storeOp)
30 : fLoadOp(loadOp)
31 , fStoreOp(storeOp) {}
32
33 bool operator==(const LoadStoreOps& right) const {
34 return fLoadOp == right.fLoadOp && fStoreOp == right.fStoreOp;
35 }
36
37 bool operator!=(const LoadStoreOps& right) const {
38 return !(*this == right);
39 }
40 };
41
24 void initSimple(const GrVkGpu* gpu, const GrVkRenderTarget& target); 42 void initSimple(const GrVkGpu* gpu, const GrVkRenderTarget& target);
43 void init(const GrVkGpu* gpu,
44 const GrVkRenderTarget& target,
45 const LoadStoreOps& colorOp,
46 const LoadStoreOps& resolveOp,
47 const LoadStoreOps& stencilOp);
48
49 void init(const GrVkGpu* gpu,
50 const GrVkRenderPass& compatibleRenderPass,
51 const LoadStoreOps& colorOp,
52 const LoadStoreOps& resolveOp,
53 const LoadStoreOps& stencilOp);
25 54
26 struct AttachmentsDescriptor { 55 struct AttachmentsDescriptor {
27 struct AttachmentDesc { 56 struct AttachmentDesc {
28 VkFormat fFormat; 57 VkFormat fFormat;
29 int fSamples; 58 int fSamples;
30 VkAttachmentLoadOp fLoadOp; 59 LoadStoreOps fLoadStoreOps;
31 VkAttachmentStoreOp fStoreOp;
32 60
33 AttachmentDesc() 61 AttachmentDesc()
34 : fFormat(VK_FORMAT_UNDEFINED) 62 : fFormat(VK_FORMAT_UNDEFINED)
35 , fSamples(0) 63 , fSamples(0)
36 , fLoadOp(VK_ATTACHMENT_LOAD_OP_LOAD) 64 , fLoadStoreOps(VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_ OP_STORE) {}
37 , fStoreOp(VK_ATTACHMENT_STORE_OP_STORE) {}
38 bool operator==(const AttachmentDesc& right) const { 65 bool operator==(const AttachmentDesc& right) const {
39 return (fFormat == right.fFormat && 66 return (fFormat == right.fFormat &&
40 fSamples == right.fSamples && 67 fSamples == right.fSamples &&
41 fLoadOp == right.fLoadOp && 68 fLoadStoreOps == right.fLoadStoreOps);
42 fStoreOp == right.fStoreOp);
43 } 69 }
44 bool operator!=(const AttachmentDesc& right) const { 70 bool operator!=(const AttachmentDesc& right) const {
45 return !(*this == right); 71 return !(*this == right);
46 } 72 }
47 bool isCompatible(const AttachmentDesc& desc) const { 73 bool isCompatible(const AttachmentDesc& desc) const {
48 return (fFormat == desc.fFormat && fSamples == desc.fSamples); 74 return (fFormat == desc.fFormat && fSamples == desc.fSamples);
49 } 75 }
50 }; 76 };
51 AttachmentDesc fColor; 77 AttachmentDesc fColor;
52 AttachmentDesc fResolve; 78 AttachmentDesc fResolve;
(...skipping 24 matching lines...) Expand all
77 void getBeginInfo(const GrVkRenderTarget& target, 103 void getBeginInfo(const GrVkRenderTarget& target,
78 VkRenderPassBeginInfo* beginInfo, 104 VkRenderPassBeginInfo* beginInfo,
79 VkSubpassContents* contents) const; 105 VkSubpassContents* contents) const;
80 106
81 // Returns whether or not the structure of a RenderTarget matches that of th e VkRenderPass in 107 // Returns whether or not the structure of a RenderTarget matches that of th e VkRenderPass in
82 // this object. Specifically this compares that the number of attachments, f ormat of 108 // this object. Specifically this compares that the number of attachments, f ormat of
83 // attachments, and sample counts are all the same. This function is used in the creation of 109 // attachments, and sample counts are all the same. This function is used in the creation of
84 // basic RenderPasses that can be used when creating a VkFrameBuffer object. 110 // basic RenderPasses that can be used when creating a VkFrameBuffer object.
85 bool isCompatible(const GrVkRenderTarget& target) const; 111 bool isCompatible(const GrVkRenderTarget& target) const;
86 112
113 bool equalLoadStoreOps(const LoadStoreOps& colorOps,
114 const LoadStoreOps& resolveOps,
115 const LoadStoreOps& stencilOps) const;
116
87 VkRenderPass vkRenderPass() const { return fRenderPass; } 117 VkRenderPass vkRenderPass() const { return fRenderPass; }
88 118
89 void genKey(GrProcessorKeyBuilder* b) const; 119 void genKey(GrProcessorKeyBuilder* b) const;
90 120
91 private: 121 private:
92 GrVkRenderPass(const GrVkRenderPass&); 122 GrVkRenderPass(const GrVkRenderPass&);
93 123
124 void init(const GrVkGpu* gpu,
125 const LoadStoreOps& colorOps,
126 const LoadStoreOps& resolveOps,
127 const LoadStoreOps& stencilOps);
128
94 void freeGPUData(const GrVkGpu* gpu) const override; 129 void freeGPUData(const GrVkGpu* gpu) const override;
95 130
96 VkRenderPass fRenderPass; 131 VkRenderPass fRenderPass;
97 AttachmentFlags fAttachmentFlags; 132 AttachmentFlags fAttachmentFlags;
98 AttachmentsDescriptor fAttachmentsDescriptor; 133 AttachmentsDescriptor fAttachmentsDescriptor;
99 134
100 typedef GrVkResource INHERITED; 135 typedef GrVkResource INHERITED;
101 }; 136 };
102 137
103 GR_MAKE_BITFIELD_OPS(GrVkRenderPass::AttachmentFlags); 138 GR_MAKE_BITFIELD_OPS(GrVkRenderPass::AttachmentFlags);
104 139
105 #endif 140 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/vk/GrVkRenderPass.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698