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

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

Issue 1977403002: Refactor creation of GrVkRenderPasses to make them move general (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: review 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 void initSimple(const GrVkGpu* gpu, const GrVkRenderTarget& target); 24 void initSimple(const GrVkGpu* gpu, const GrVkRenderTarget& target);
25 25
26 struct AttachmentsDescriptor { 26 struct AttachmentsDescriptor {
27 struct AttachmentDesc { 27 struct AttachmentDesc {
28 VkFormat fFormat; 28 VkFormat fFormat;
29 int fSamples; 29 int fSamples;
30 AttachmentDesc() : fFormat(VK_FORMAT_UNDEFINED), fSamples(0) {} 30 VkAttachmentLoadOp fLoadOp;
31 VkAttachmentStoreOp fStoreOp;
32
33 AttachmentDesc()
34 : fFormat(VK_FORMAT_UNDEFINED)
35 , fSamples(0)
36 , fLoadOp(VK_ATTACHMENT_LOAD_OP_LOAD)
37 , fStoreOp(VK_ATTACHMENT_STORE_OP_STORE) {}
31 bool operator==(const AttachmentDesc& right) const { 38 bool operator==(const AttachmentDesc& right) const {
32 return (fFormat == right.fFormat && fSamples == right.fSamples); 39 return (fFormat == right.fFormat &&
40 fSamples == right.fSamples &&
41 fLoadOp == right.fLoadOp &&
42 fStoreOp == right.fStoreOp);
33 } 43 }
34 bool operator!=(const AttachmentDesc& right) const { 44 bool operator!=(const AttachmentDesc& right) const {
35 return !(*this == right); 45 return !(*this == right);
36 } 46 }
47 bool isCompatible(const AttachmentDesc& desc) const {
48 return (fFormat == desc.fFormat && fSamples == desc.fSamples);
49 }
37 }; 50 };
38 AttachmentDesc fColor; 51 AttachmentDesc fColor;
39 AttachmentDesc fResolve; 52 AttachmentDesc fResolve;
40 AttachmentDesc fStencil; 53 AttachmentDesc fStencil;
41 uint32_t fAttachmentCount; 54 uint32_t fAttachmentCount;
42 }; 55 };
43 56
44 enum AttachmentFlags { 57 enum AttachmentFlags {
45 kColor_AttachmentFlag = 0x1, 58 kColor_AttachmentFlag = 0x1,
46 kResolve_AttachmentFlag = 0x2, 59 kResolve_AttachmentFlag = 0x2,
(...skipping 23 matching lines...) Expand all
70 // attachments, and sample counts are all the same. This function is used in the creation of 83 // attachments, and sample counts are all the same. This function is used in the creation of
71 // basic RenderPasses that can be used when creating a VkFrameBuffer object. 84 // basic RenderPasses that can be used when creating a VkFrameBuffer object.
72 bool isCompatible(const GrVkRenderTarget& target) const; 85 bool isCompatible(const GrVkRenderTarget& target) const;
73 86
74 VkRenderPass vkRenderPass() const { return fRenderPass; } 87 VkRenderPass vkRenderPass() const { return fRenderPass; }
75 88
76 void genKey(GrProcessorKeyBuilder* b) const; 89 void genKey(GrProcessorKeyBuilder* b) const;
77 90
78 private: 91 private:
79 GrVkRenderPass(const GrVkRenderPass&); 92 GrVkRenderPass(const GrVkRenderPass&);
80 GrVkRenderPass& operator=(const GrVkRenderPass&);
81 93
82 void freeGPUData(const GrVkGpu* gpu) const override; 94 void freeGPUData(const GrVkGpu* gpu) const override;
83 95
84 VkRenderPass fRenderPass; 96 VkRenderPass fRenderPass;
85 AttachmentFlags fAttachmentFlags; 97 AttachmentFlags fAttachmentFlags;
86 AttachmentsDescriptor fAttachmentsDescriptor; 98 AttachmentsDescriptor fAttachmentsDescriptor;
87 99
88 typedef GrVkResource INHERITED; 100 typedef GrVkResource INHERITED;
89 }; 101 };
90 102
91 GR_MAKE_BITFIELD_OPS(GrVkRenderPass::AttachmentFlags); 103 GR_MAKE_BITFIELD_OPS(GrVkRenderPass::AttachmentFlags);
92 104
93 #endif 105 #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