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

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

Issue 1718693002: Add vulkan files into skia repo. (Closed) Base URL: https://skia.googlesource.com/skia.git@merge
Patch Set: fix path Created 4 years, 10 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 | « src/gpu/vk/GrVkProgramDesc.cpp ('k') | 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
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
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 GrVkRenderPass_DEFINED
9 #define GrVkRenderPass_DEFINED
10
11 #include "GrTypes.h"
12
13 #include "GrVkResource.h"
14
15 #include "vulkan/vulkan.h"
16
17 class GrVkGpu;
18 class GrVkRenderTarget;
19
20 class GrVkRenderPass : public GrVkResource {
21 public:
22 GrVkRenderPass() : INHERITED(), fRenderPass(nullptr) {}
23 void initSimple(const GrVkGpu* gpu, const GrVkRenderTarget& target);
24
25 struct AttachmentsDescriptor {
26 struct AttachmentDesc {
27 VkFormat fFormat;
28 int fSamples;
29 AttachmentDesc() : fFormat(VK_FORMAT_UNDEFINED), fSamples(0) {}
30 bool operator==(const AttachmentDesc& right) const {
31 return (fFormat == right.fFormat && fSamples == right.fSamples);
32 }
33 bool operator!=(const AttachmentDesc& right) const {
34 return !(*this == right);
35 }
36 };
37 AttachmentDesc fColor;
38 AttachmentDesc fResolve;
39 AttachmentDesc fStencil;
40 uint32_t fAttachmentCount;
41 };
42
43 enum AttachmentFlags {
44 kColor_AttachmentFlag = 0x1,
45 kResolve_AttachmentFlag = 0x2,
46 kStencil_AttachmentFlag = 0x4,
47 };
48 GR_DECL_BITFIELD_OPS_FRIENDS(AttachmentFlags);
49
50 // The following return the index of the render pass attachment array for th e given attachment.
51 // If the render pass does not have the given attachment it will return fals e and not set the
52 // index value.
53 bool colorAttachmentIndex(uint32_t* index) const;
54 bool resolveAttachmentIndex(uint32_t* index) const;
55 bool stencilAttachmentIndex(uint32_t* index) const;
56
57 // Sets the VkRenderPassBeginInfo and VkRenderPassContents need to begin a r ender pass.
58 // TODO: In the future I expect this function will also take an optional ren der area instead of
59 // defaulting to the entire render target.
60 // TODO: Figure out if load clear values should be passed into this function or should be stored
61 // on the GrVkRenderPass at create time since we'll know at that point if we want to do a load
62 // clear.
63 void getBeginInfo(const GrVkRenderTarget& target,
64 VkRenderPassBeginInfo* beginInfo,
65 VkSubpassContents* contents) const;
66
67 // Returns whether or not the structure of a RenderTarget matches that of th e VkRenderPass in
68 // this object. Specifically this compares that the number of attachments, f ormat of
69 // attachments, and sample counts are all the same. This function is used in the creation of
70 // basic RenderPasses that can be used when creating a VkFrameBuffer object.
71 bool isCompatible(const GrVkRenderTarget& target) const;
72
73 VkRenderPass vkRenderPass() const { return fRenderPass; }
74
75 private:
76 GrVkRenderPass(const GrVkRenderPass&);
77 GrVkRenderPass& operator=(const GrVkRenderPass&);
78
79 void freeGPUData(const GrVkGpu* gpu) const override;
80
81 VkRenderPass fRenderPass;
82 AttachmentFlags fAttachmentFlags;
83 AttachmentsDescriptor fAttachmentsDescriptor;
84
85 typedef GrVkResource INHERITED;
86 };
87
88 GR_MAKE_BITFIELD_OPS(GrVkRenderPass::AttachmentFlags);
89
90 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkProgramDesc.cpp ('k') | src/gpu/vk/GrVkRenderPass.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698