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

Side by Side Diff: src/gpu/gl/GrGLGpu.h

Issue 1825393002: Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: asserts Created 4 years, 9 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/gl/GrGLDefines.h ('k') | src/gpu/gl/GrGLGpu.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 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 GrGLGpu_DEFINED 8 #ifndef GrGLGpu_DEFINED
9 #define GrGLGpu_DEFINED 9 #define GrGLGpu_DEFINED
10 10
11 #include "GrGLContext.h" 11 #include "GrGLContext.h"
12 #include "GrGLIRect.h" 12 #include "GrGLIRect.h"
13 #include "GrGLIndexBuffer.h"
14 #include "GrGLPathRendering.h" 13 #include "GrGLPathRendering.h"
15 #include "GrGLProgram.h" 14 #include "GrGLProgram.h"
16 #include "GrGLRenderTarget.h" 15 #include "GrGLRenderTarget.h"
17 #include "GrGLStencilAttachment.h" 16 #include "GrGLStencilAttachment.h"
18 #include "GrGLTexture.h" 17 #include "GrGLTexture.h"
19 #include "GrGLTransferBuffer.h"
20 #include "GrGLVertexArray.h" 18 #include "GrGLVertexArray.h"
21 #include "GrGLVertexBuffer.h"
22 #include "GrGpu.h" 19 #include "GrGpu.h"
23 #include "GrPipelineBuilder.h" 20 #include "GrPipelineBuilder.h"
24 #include "GrTypes.h" 21 #include "GrTypes.h"
25 #include "GrXferProcessor.h" 22 #include "GrXferProcessor.h"
26 #include "SkTArray.h" 23 #include "SkTArray.h"
27 #include "SkTypes.h" 24 #include "SkTypes.h"
28 25
26 class GrGLBuffer;
29 class GrPipeline; 27 class GrPipeline;
30 class GrNonInstancedMesh; 28 class GrNonInstancedMesh;
31 class GrSwizzle; 29 class GrSwizzle;
32 30
33 #ifdef SK_DEVELOPER 31 #ifdef SK_DEVELOPER
34 #define PROGRAM_CACHE_STATS 32 #define PROGRAM_CACHE_STATS
35 #endif 33 #endif
36 34
37 class GrGLGpu : public GrGpu { 35 class GrGLGpu : public GrGpu {
38 public: 36 public:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 92 }
95 void notifyIndexBufferDelete(GrGLuint id) { 93 void notifyIndexBufferDelete(GrGLuint id) {
96 fHWGeometryState.notifyIndexBufferDelete(id); 94 fHWGeometryState.notifyIndexBufferDelete(id);
97 } 95 }
98 96
99 // id and type (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, etc.) of buffer to bind 97 // id and type (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, etc.) of buffer to bind
100 void bindBuffer(GrGLuint id, GrGLenum type); 98 void bindBuffer(GrGLuint id, GrGLenum type);
101 99
102 void releaseBuffer(GrGLuint id, GrGLenum type); 100 void releaseBuffer(GrGLuint id, GrGLenum type);
103 101
104 // sizes are in bytes
105 void* mapBuffer(GrGLuint id, GrGLenum type, GrGLBufferImpl::Usage usage, siz e_t currentSize,
106 size_t requestedSize);
107
108 void unmapBuffer(GrGLuint id, GrGLenum type, void* mapPtr);
109
110 void bufferData(GrGLuint id, GrGLenum type, GrGLBufferImpl::Usage usage, siz e_t currentSize,
111 const void* src, size_t srcSizeInBytes);
112
113 const GrGLContext* glContextForTesting() const override { 102 const GrGLContext* glContextForTesting() const override {
114 return &this->glContext(); 103 return &this->glContext();
115 } 104 }
116 105
117 void clearStencil(GrRenderTarget*) override; 106 void clearStencil(GrRenderTarget*) override;
118 107
119 void invalidateBoundRenderTarget() { 108 void invalidateBoundRenderTarget() {
120 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; 109 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
121 } 110 }
122 111
(...skipping 19 matching lines...) Expand all
142 void onResetContext(uint32_t resetBits) override; 131 void onResetContext(uint32_t resetBits) override;
143 132
144 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; 133 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override;
145 134
146 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc le lifeCycle, 135 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc le lifeCycle,
147 const SkTArray<GrMipLevel>& texels) override; 136 const SkTArray<GrMipLevel>& texels) override;
148 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, 137 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc,
149 GrGpuResource::LifeCycle lifeCycle, 138 GrGpuResource::LifeCycle lifeCycle,
150 const SkTArray<GrMipLevel>& texels) ove rride; 139 const SkTArray<GrMipLevel>& texels) ove rride;
151 140
152 GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) override; 141 GrBuffer* onCreateBuffer(GrBufferType, size_t size, GrAccessPattern) overrid e;
153 GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override;
154 GrTransferBuffer* onCreateTransferBuffer(size_t size, TransferType type) ove rride;
155 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership ) override; 142 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership ) override;
156 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, 143 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
157 GrWrapOwnership) override; 144 GrWrapOwnership) override;
158 GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDes c&, 145 GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDes c&,
159 GrWrapOwnership) override ; 146 GrWrapOwnership) override ;
160 // Given a GrPixelConfig return the index into the stencil format array on G rGLCaps to a 147 // Given a GrPixelConfig return the index into the stencil format array on G rGLCaps to a
161 // compatible stencil format, or negative if there is no compatible stencil format. 148 // compatible stencil format, or negative if there is no compatible stencil format.
162 int getCompatibleStencilIndex(GrPixelConfig config); 149 int getCompatibleStencilIndex(GrPixelConfig config);
163 150
164 // If |desc.fTextureStorageAllocator| exists, use that to create the 151 // If |desc.fTextureStorageAllocator| exists, use that to create the
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 void* buffer, 188 void* buffer,
202 size_t rowBytes) override; 189 size_t rowBytes) override;
203 190
204 bool onWritePixels(GrSurface*, 191 bool onWritePixels(GrSurface*,
205 int left, int top, int width, int height, 192 int left, int top, int width, int height,
206 GrPixelConfig config, 193 GrPixelConfig config,
207 const SkTArray<GrMipLevel>& texels) override; 194 const SkTArray<GrMipLevel>& texels) override;
208 195
209 bool onTransferPixels(GrSurface*, 196 bool onTransferPixels(GrSurface*,
210 int left, int top, int width, int height, 197 int left, int top, int width, int height,
211 GrPixelConfig config, GrTransferBuffer* buffer, 198 GrPixelConfig config, GrBuffer* transferBuffer,
212 size_t offset, size_t rowBytes) override; 199 size_t offset, size_t rowBytes) override;
213 200
214 void onResolveRenderTarget(GrRenderTarget* target) override; 201 void onResolveRenderTarget(GrRenderTarget* target) override;
215 202
216 void onDraw(const GrPipeline&, 203 void onDraw(const GrPipeline&,
217 const GrPrimitiveProcessor&, 204 const GrPrimitiveProcessor&,
218 const GrMesh*, 205 const GrMesh*,
219 int meshCount) override; 206 int meshCount) override;
220 207
221 bool onCopySurface(GrSurface* dst, 208 bool onCopySurface(GrSurface* dst,
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 } 491 }
505 } 492 }
506 493
507 /** 494 /**
508 * Binds the vertex array object that should be used to render from the vertex buffer. 495 * Binds the vertex array object that should be used to render from the vertex buffer.
509 * The vertex array is bound and its attrib array state object is return ed. The vertex 496 * The vertex array is bound and its attrib array state object is return ed. The vertex
510 * buffer is bound. The index buffer (if non-nullptr) is bound to the ve rtex array. The 497 * buffer is bound. The index buffer (if non-nullptr) is bound to the ve rtex array. The
511 * returned GrGLAttribArrayState should be used to set vertex attribute arrays. 498 * returned GrGLAttribArrayState should be used to set vertex attribute arrays.
512 */ 499 */
513 GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu, 500 GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu,
514 const GrGLVertexBuffer* vbuffer, 501 const GrGLBuffer* vbuffe r,
515 const GrGLIndexBuffer* i buffer); 502 const GrGLBuffer* ibuffe r);
516 503
517 /** Variants of the above that takes GL buffer IDs. Note that 0 does not imply that a 504 /** Variants of the above that takes GL buffer IDs. Note that 0 does not imply that a
518 buffer won't be bound. The "default buffer" will be bound, which is used for client-side 505 buffer won't be bound. The "default buffer" will be bound, which is used for client-side
519 array rendering. */ 506 array rendering. */
520 GrGLAttribArrayState* bindArrayAndBufferToDraw(GrGLGpu* gpu, GrGLuint vb ufferID); 507 GrGLAttribArrayState* bindArrayAndBufferToDraw(GrGLGpu* gpu, GrGLuint vb ufferID);
521 GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu, 508 GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu,
522 GrGLuint vbufferID, 509 GrGLuint vbufferID,
523 GrGLuint ibufferID); 510 GrGLuint ibufferID);
524 511
525 private: 512 private:
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 } fPLSSetupProgram; 604 } fPLSSetupProgram;
618 605
619 bool fHWPLSEnabled; 606 bool fHWPLSEnabled;
620 bool fPLSHasBeenUsed; 607 bool fPLSHasBeenUsed;
621 608
622 typedef GrGpu INHERITED; 609 typedef GrGpu INHERITED;
623 friend class GrGLPathRendering; // For accessing setTextureUnit. 610 friend class GrGLPathRendering; // For accessing setTextureUnit.
624 }; 611 };
625 612
626 #endif 613 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLDefines.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698