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

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

Issue 1862043002: Refactor to separate backend object lifecycle and GpuResource budget decision (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix unrelated GrBuffer::onGpuMemorySize() lack of override keyword compile error Created 4 years, 8 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/GrVkIndexBuffer.cpp ('k') | src/gpu/vk/GrVkRenderTarget.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 8
9 #ifndef GrVkRenderTarget_DEFINED 9 #ifndef GrVkRenderTarget_DEFINED
10 #define GrVkRenderTarget_DEFINED 10 #define GrVkRenderTarget_DEFINED
(...skipping 12 matching lines...) Expand all
23 struct GrVkTextureInfo; 23 struct GrVkTextureInfo;
24 24
25 #ifdef SK_BUILD_FOR_WIN 25 #ifdef SK_BUILD_FOR_WIN
26 // Windows gives bogus warnings about inheriting asTexture/asRenderTarget via do minance. 26 // Windows gives bogus warnings about inheriting asTexture/asRenderTarget via do minance.
27 #pragma warning(push) 27 #pragma warning(push)
28 #pragma warning(disable: 4250) 28 #pragma warning(disable: 4250)
29 #endif 29 #endif
30 30
31 class GrVkRenderTarget: public GrRenderTarget, public virtual GrVkImage { 31 class GrVkRenderTarget: public GrRenderTarget, public virtual GrVkImage {
32 public: 32 public:
33 static GrVkRenderTarget* CreateNewRenderTarget(GrVkGpu*, const GrSurfaceDesc &, 33 static GrVkRenderTarget* CreateNewRenderTarget(GrVkGpu*, SkBudgeted, const G rSurfaceDesc&,
34 GrGpuResource::LifeCycle,
35 const GrVkImage::ImageDesc&); 34 const GrVkImage::ImageDesc&);
36 35
37 static GrVkRenderTarget* CreateWrappedRenderTarget(GrVkGpu*, const GrSurface Desc&, 36 static GrVkRenderTarget* CreateWrappedRenderTarget(GrVkGpu*, const GrSurface Desc&,
38 GrGpuResource::LifeCycle, 37 GrWrapOwnership,
39 const GrVkTextureInfo*); 38 const GrVkTextureInfo*);
40 39
41 ~GrVkRenderTarget() override; 40 ~GrVkRenderTarget() override;
42 41
43 const GrVkFramebuffer* framebuffer() const { return fFramebuffer; } 42 const GrVkFramebuffer* framebuffer() const { return fFramebuffer; }
44 const GrVkImageView* colorAttachmentView() const { return fColorAttachmentVi ew; } 43 const GrVkImageView* colorAttachmentView() const { return fColorAttachmentVi ew; }
45 const GrVkImage::Resource* msaaImageResource() const { return fMSAAImageReso urce; } 44 const GrVkImage::Resource* msaaImageResource() const { return fMSAAImageReso urce; }
46 const GrVkImageView* resolveAttachmentView() const { return fResolveAttachme ntView; } 45 const GrVkImageView* resolveAttachmentView() const { return fResolveAttachme ntView; }
47 const GrVkImage::Resource* stencilImageResource() const; 46 const GrVkImage::Resource* stencilImageResource() const;
48 const GrVkImageView* stencilAttachmentView() const; 47 const GrVkImageView* stencilAttachmentView() const;
(...skipping 11 matching lines...) Expand all
60 59
61 GrBackendObject getRenderTargetHandle() const override; 60 GrBackendObject getRenderTargetHandle() const override;
62 61
63 // Returns the total number of attachments 62 // Returns the total number of attachments
64 void getAttachmentsDescriptor(GrVkRenderPass::AttachmentsDescriptor* desc, 63 void getAttachmentsDescriptor(GrVkRenderPass::AttachmentsDescriptor* desc,
65 GrVkRenderPass::AttachmentFlags* flags) const; 64 GrVkRenderPass::AttachmentFlags* flags) const;
66 65
67 void addResources(GrVkCommandBuffer& commandBuffer) const; 66 void addResources(GrVkCommandBuffer& commandBuffer) const;
68 67
69 protected: 68 protected:
70 enum Derived { kDerived };
71
72 GrVkRenderTarget(GrVkGpu* gpu, 69 GrVkRenderTarget(GrVkGpu* gpu,
70 SkBudgeted,
73 const GrSurfaceDesc& desc, 71 const GrSurfaceDesc& desc,
74 GrGpuResource::LifeCycle,
75 const GrVkImage::Resource* imageResource, 72 const GrVkImage::Resource* imageResource,
76 const GrVkImage::Resource* msaaImageResource, 73 const GrVkImage::Resource* msaaImageResource,
77 const GrVkImageView* colorAttachmentView, 74 const GrVkImageView* colorAttachmentView,
78 const GrVkImageView* resolveAttachmentView); 75 const GrVkImageView* resolveAttachmentView);
79 76
80 GrVkRenderTarget(GrVkGpu* gpu, 77 GrVkRenderTarget(GrVkGpu* gpu,
81 const GrSurfaceDesc& desc, 78 const GrSurfaceDesc& desc,
82 GrGpuResource::LifeCycle,
83 const GrVkImage::Resource* imageResource, 79 const GrVkImage::Resource* imageResource,
84 const GrVkImage::Resource* msaaImageResource, 80 const GrVkImage::Resource* msaaImageResource,
85 const GrVkImageView* colorAttachmentView, 81 const GrVkImageView* colorAttachmentView,
86 const GrVkImageView* resolveAttachmentView, 82 const GrVkImageView* resolveAttachmentView);
87 Derived);
88 83
89 GrVkRenderTarget(GrVkGpu* gpu, 84 GrVkRenderTarget(GrVkGpu* gpu,
85 SkBudgeted,
90 const GrSurfaceDesc& desc, 86 const GrSurfaceDesc& desc,
91 GrGpuResource::LifeCycle,
92 const GrVkImage::Resource* imageResource, 87 const GrVkImage::Resource* imageResource,
93 const GrVkImageView* colorAttachmentView); 88 const GrVkImageView* colorAttachmentView);
94 89
95 GrVkRenderTarget(GrVkGpu* gpu, 90 GrVkRenderTarget(GrVkGpu* gpu,
96 const GrSurfaceDesc& desc, 91 const GrSurfaceDesc& desc,
97 GrGpuResource::LifeCycle,
98 const GrVkImage::Resource* imageResource, 92 const GrVkImage::Resource* imageResource,
99 const GrVkImageView* colorAttachmentView, 93 const GrVkImageView* colorAttachmentView);
100 Derived);
101 94
102 static GrVkRenderTarget* Create(GrVkGpu*, const GrSurfaceDesc&, 95 static GrVkRenderTarget* Create(GrVkGpu*, SkBudgeted, const GrSurfaceDesc&,
103 GrGpuResource::LifeCycle,
104 const GrVkImage::Resource* imageResource); 96 const GrVkImage::Resource* imageResource);
105 97
106 GrVkGpu* getVkGpu() const; 98 GrVkGpu* getVkGpu() const;
107 99
108 void onAbandon() override; 100 void onAbandon() override;
109 void onRelease() override; 101 void onRelease() override;
110 102
111 // This accounts for the texture's memory and any MSAA renderbuffer's memory . 103 // This accounts for the texture's memory and any MSAA renderbuffer's memory .
112 size_t onGpuMemorySize() const override { 104 size_t onGpuMemorySize() const override {
113 SkASSERT(kUnknown_GrPixelConfig != fDesc.fConfig); 105 SkASSERT(kUnknown_GrPixelConfig != fDesc.fConfig);
(...skipping 16 matching lines...) Expand all
130 const GrVkImage::Resource* fMSAAImageResource; 122 const GrVkImage::Resource* fMSAAImageResource;
131 const GrVkImageView* fResolveAttachmentView; 123 const GrVkImageView* fResolveAttachmentView;
132 int fColorValuesPerPixel; 124 int fColorValuesPerPixel;
133 125
134 // This is a cached pointer to a simple render pass. The render target shoul d unref it 126 // This is a cached pointer to a simple render pass. The render target shoul d unref it
135 // once it is done with it. 127 // once it is done with it.
136 const GrVkRenderPass* fCachedSimpleRenderPass; 128 const GrVkRenderPass* fCachedSimpleRenderPass;
137 }; 129 };
138 130
139 #endif 131 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkIndexBuffer.cpp ('k') | src/gpu/vk/GrVkRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698