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

Side by Side Diff: src/gpu/GrGpu.h

Issue 1854283004: Track GL buffer state based on unique resource ID (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 GrGpu_DEFINED 8 #ifndef GrGpu_DEFINED
9 #define GrGpu_DEFINED 9 #define GrGpu_DEFINED
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 GrContext* getContext() { return fContext; } 54 GrContext* getContext() { return fContext; }
55 const GrContext* getContext() const { return fContext; } 55 const GrContext* getContext() const { return fContext; }
56 56
57 /** 57 /**
58 * Gets the capabilities of the draw target. 58 * Gets the capabilities of the draw target.
59 */ 59 */
60 const GrCaps* caps() const { return fCaps.get(); } 60 const GrCaps* caps() const { return fCaps.get(); }
61 61
62 GrPathRendering* pathRendering() { return fPathRendering.get(); } 62 GrPathRendering* pathRendering() { return fPathRendering.get(); }
63 63
64 /**
65 * Called by GrContext once the resource cache has been initialized. Any GrG puResource objects
66 * owned by the sublcass need to be initialized here instead of in the const ructor.
67 */
68 virtual void initGpuResources();
69
64 enum class DisconnectType { 70 enum class DisconnectType {
65 // No cleanup should be attempted, immediately cease making backend API calls 71 // No cleanup should be attempted, immediately cease making backend API calls
66 kAbandon, 72 kAbandon,
67 // Free allocated resources (not known by GrResourceCache) before return ing and 73 // Free allocated resources (not known by GrResourceCache) before return ing and
68 // ensure no backend backend 3D API calls will be made after disconnect( ) returns. 74 // ensure no backend backend 3D API calls will be made after disconnect( ) returns.
69 kCleanup, 75 kCleanup,
70 }; 76 };
71 77
72 // Called by GrContext when the underlying backend context is already or wil l be destroyed 78 // Called by GrContext when the underlying backend context is already or wil l be destroyed
73 // before GrContext. 79 // before GrContext.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&, Gr WrapOwnership); 134 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&, Gr WrapOwnership);
129 135
130 /** 136 /**
131 * Implements GrTextureProvider::wrapBackendTextureAsRenderTarget 137 * Implements GrTextureProvider::wrapBackendTextureAsRenderTarget
132 */ 138 */
133 GrRenderTarget* wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& ); 139 GrRenderTarget* wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& );
134 140
135 /** 141 /**
136 * Creates a buffer. 142 * Creates a buffer.
137 * 143 *
144 * @param size size of buffer to create.
145 * @param intendedType hint to the graphics subsystem about what the buff er will be used for.
146 * @param accessPattern hint to the graphics subsystem about how the data will be accessed.
147 *
138 * @return the buffer if successful, otherwise nullptr. 148 * @return the buffer if successful, otherwise nullptr.
139 */ 149 */
140 GrBuffer* createBuffer(GrBufferType, size_t size, GrAccessPattern); 150 GrBuffer* createBuffer(size_t size, GrBufferType intendedType, GrAccessPatte rn accessPattern);
141 151
142 /** 152 /**
143 * Resolves MSAA. 153 * Resolves MSAA.
144 */ 154 */
145 void resolveRenderTarget(GrRenderTarget* target); 155 void resolveRenderTarget(GrRenderTarget* target);
146 156
147 /** Info struct returned by getReadPixelsInfo about performing intermediate draws before 157 /** Info struct returned by getReadPixelsInfo about performing intermediate draws before
148 reading pixels for performance or correctness. */ 158 reading pixels for performance or correctness. */
149 struct ReadPixelTempDrawInfo { 159 struct ReadPixelTempDrawInfo {
150 /** If the GrGpu is requesting that the caller do a draw to an intermedi ate surface then 160 /** If the GrGpu is requesting that the caller do a draw to an intermedi ate surface then
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 GrGpuResource::LifeCycle lifeCycle, 536 GrGpuResource::LifeCycle lifeCycle,
527 const SkTArray<GrMipLevel>& texels) = 0; 537 const SkTArray<GrMipLevel>& texels) = 0;
528 virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, 538 virtual GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc,
529 GrGpuResource::LifeCycle lifeCy cle, 539 GrGpuResource::LifeCycle lifeCy cle,
530 const SkTArray<GrMipLevel>& tex els) = 0; 540 const SkTArray<GrMipLevel>& tex els) = 0;
531 541
532 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapO wnership) = 0; 542 virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapO wnership) = 0;
533 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge tDesc&, 543 virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTarge tDesc&,
534 GrWrapOwnership) = 0; 544 GrWrapOwnership) = 0;
535 virtual GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTe xtureDesc&) = 0; 545 virtual GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTe xtureDesc&) = 0;
536 virtual GrBuffer* onCreateBuffer(GrBufferType, size_t size, GrAccessPattern) = 0; 546 virtual GrBuffer* onCreateBuffer(size_t size, GrBufferType intendedType, GrA ccessPattern) = 0;
537 547
538 // overridden by backend-specific derived class to perform the clear. 548 // overridden by backend-specific derived class to perform the clear.
539 virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) = 0; 549 virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) = 0;
540 550
541 // Overridden by backend specific classes to perform a clear of the stencil clip bits. This is 551 // Overridden by backend specific classes to perform a clear of the stencil clip bits. This is
542 // ONLY used by the the clip target 552 // ONLY used by the the clip target
543 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i nsideClip) = 0; 553 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i nsideClip) = 0;
544 554
545 // overridden by backend-specific derived class to perform the draw call. 555 // overridden by backend-specific derived class to perform the draw call.
546 virtual void onDraw(const GrPipeline&, 556 virtual void onDraw(const GrPipeline&,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 SkTArray<const MultisampleSpecs*, true> fMultisa mpleSpecsMap; 614 SkTArray<const MultisampleSpecs*, true> fMultisa mpleSpecsMap;
605 GrTAllocator<MultisampleSpecs> fMultisa mpleSpecsAllocator; 615 GrTAllocator<MultisampleSpecs> fMultisa mpleSpecsAllocator;
606 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. 616 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu.
607 GrContext* fContext ; 617 GrContext* fContext ;
608 618
609 friend class GrPathRendering; 619 friend class GrPathRendering;
610 typedef SkRefCnt INHERITED; 620 typedef SkRefCnt INHERITED;
611 }; 621 };
612 622
613 #endif 623 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrGpu.cpp » ('j') | src/gpu/gl/GrGLGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698