OLD | NEW |
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 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 SkASSERT(glCaps().shaderCaps()->pathRenderingSupport()); | 53 SkASSERT(glCaps().shaderCaps()->pathRenderingSupport()); |
54 return static_cast<GrGLPathRendering*>(pathRendering()); | 54 return static_cast<GrGLPathRendering*>(pathRendering()); |
55 } | 55 } |
56 | 56 |
57 void discard(GrRenderTarget*) override; | 57 void discard(GrRenderTarget*) override; |
58 | 58 |
59 // Used by GrGLProgram to configure OpenGL state. | 59 // Used by GrGLProgram to configure OpenGL state. |
60 void bindTexture(int unitIdx, const GrTextureParams& params, bool dstConfigA
llowsSRGB, | 60 void bindTexture(int unitIdx, const GrTextureParams& params, bool dstConfigA
llowsSRGB, |
61 GrGLTexture* texture); | 61 GrGLTexture* texture); |
62 | 62 |
| 63 void bindTexelBuffer(int unitIdx, intptr_t offsetInBytes, GrPixelConfig, GrG
LBuffer*); |
| 64 |
63 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh
t, size_t rowBytes, | 65 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh
t, size_t rowBytes, |
64 GrPixelConfig readConfig, DrawPreference*, | 66 GrPixelConfig readConfig, DrawPreference*, |
65 ReadPixelTempDrawInfo*) override; | 67 ReadPixelTempDrawInfo*) override; |
66 | 68 |
67 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, | 69 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, |
68 GrPixelConfig srcConfig, DrawPreference*, | 70 GrPixelConfig srcConfig, DrawPreference*, |
69 WritePixelTempDrawInfo*) override; | 71 WritePixelTempDrawInfo*) override; |
70 | 72 |
71 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const
override; | 73 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const
override; |
72 | 74 |
73 // These functions should be used to bind GL objects. They track the GL stat
e and skip redundant | 75 // These functions should be used to bind GL objects. They track the GL stat
e and skip redundant |
74 // bindings. Making the equivalent glBind calls directly will confuse the st
ate tracking. | 76 // bindings. Making the equivalent glBind calls directly will confuse the st
ate tracking. |
75 void bindVertexArray(GrGLuint id) { | 77 void bindVertexArray(GrGLuint id) { |
76 fHWVertexArrayState.setVertexArrayID(this, id); | 78 fHWVertexArrayState.setVertexArrayID(this, id); |
77 } | 79 } |
78 | 80 |
79 // These callbacks update state tracking when GL objects are deleted. They a
re called from | 81 // These callbacks update state tracking when GL objects are deleted. They a
re called from |
80 // GrGLResource onRelease functions. | 82 // GrGLResource onRelease functions. |
81 void notifyVertexArrayDelete(GrGLuint id) { | 83 void notifyVertexArrayDelete(GrGLuint id) { |
82 fHWVertexArrayState.notifyVertexArrayDelete(id); | 84 fHWVertexArrayState.notifyVertexArrayDelete(id); |
83 } | 85 } |
84 | 86 |
85 // Binds a buffer to the GL target corresponding to 'type', updates internal
state tracking, and | 87 // Binds a buffer to the GL target corresponding to 'type', updates internal
state tracking, and |
86 // returns the GL target the buffer was bound to. | 88 // returns the GL target the buffer was bound to. |
87 // When 'type' is kIndex_GrBufferType, this function will also implicitly bi
nd the default VAO. | 89 // When 'type' is kIndex_GrBufferType, this function will also implicitly bi
nd the default VAO. |
88 // If the caller wishes to bind an index buffer to a specific VAO, it can ca
ll glBind directly. | 90 // If the caller wishes to bind an index buffer to a specific VAO, it can ca
ll glBind directly. |
89 GrGLenum bindBuffer(GrBufferType type, const GrGLBuffer*); | 91 GrGLenum bindBuffer(GrBufferType type, const GrGLBuffer*); |
90 | 92 |
| 93 // Called by GrGLBuffer after its buffer object has been destroyed. |
| 94 void notifyBufferReleased(const GrGLBuffer*); |
| 95 |
91 const GrGLContext* glContextForTesting() const override { | 96 const GrGLContext* glContextForTesting() const override { |
92 return &this->glContext(); | 97 return &this->glContext(); |
93 } | 98 } |
94 | 99 |
95 void clearStencil(GrRenderTarget*) override; | 100 void clearStencil(GrRenderTarget*) override; |
96 | 101 |
97 void invalidateBoundRenderTarget() { | 102 void invalidateBoundRenderTarget() { |
98 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 103 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
99 } | 104 } |
100 | 105 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 const SkIPoint& dstPoint) override; | 204 const SkIPoint& dstPoint) override; |
200 | 205 |
201 void onGetMultisampleSpecs(GrRenderTarget*, | 206 void onGetMultisampleSpecs(GrRenderTarget*, |
202 const GrStencilSettings&, | 207 const GrStencilSettings&, |
203 int* effectiveSampleCnt, | 208 int* effectiveSampleCnt, |
204 SkAutoTDeleteArray<SkPoint>* sampleLocations) ove
rride; | 209 SkAutoTDeleteArray<SkPoint>* sampleLocations) ove
rride; |
205 | 210 |
206 // binds texture unit in GL | 211 // binds texture unit in GL |
207 void setTextureUnit(int unitIdx); | 212 void setTextureUnit(int unitIdx); |
208 | 213 |
| 214 void setTextureSwizzle(int unitIdx, GrGLenum target, const GrGLenum swizzle[
]); |
| 215 |
209 // Flushes state from GrPipeline to GL. Returns false if the state couldn't
be set. | 216 // Flushes state from GrPipeline to GL. Returns false if the state couldn't
be set. |
210 bool flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcessor& pr
imProc); | 217 bool flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcessor& pr
imProc); |
211 | 218 |
212 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset | 219 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset |
213 // an into the index buffer. It does not account for vertices.startIndex() b
ut rather the start | 220 // an into the index buffer. It does not account for vertices.startIndex() b
ut rather the start |
214 // index is relative to the returned offset. | 221 // index is relative to the returned offset. |
215 void setupGeometry(const GrPrimitiveProcessor&, | 222 void setupGeometry(const GrPrimitiveProcessor&, |
216 const GrNonInstancedMesh& mesh, | 223 const GrNonInstancedMesh& mesh, |
217 size_t* indexOffsetInBytes); | 224 size_t* indexOffsetInBytes); |
218 | 225 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 GrStencilSettings fHWStencilSettings; | 498 GrStencilSettings fHWStencilSettings; |
492 TriState fHWStencilTestEnabled; | 499 TriState fHWStencilTestEnabled; |
493 | 500 |
494 | 501 |
495 GrPipelineBuilder::DrawFace fHWDrawFace; | 502 GrPipelineBuilder::DrawFace fHWDrawFace; |
496 TriState fHWWriteToColor; | 503 TriState fHWWriteToColor; |
497 uint32_t fHWBoundRenderTargetUniqueID; | 504 uint32_t fHWBoundRenderTargetUniqueID; |
498 TriState fHWSRGBFramebuffer; | 505 TriState fHWSRGBFramebuffer; |
499 SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs; | 506 SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs; |
500 | 507 |
| 508 struct BufferTexture { |
| 509 BufferTexture() : fTextureID(0), fKnownBound(false), |
| 510 fAttachedBufferUniqueID(SK_InvalidUniqueID), |
| 511 fSwizzle(GrSwizzle::RGBA()) {} |
| 512 |
| 513 GrGLuint fTextureID; |
| 514 bool fKnownBound; |
| 515 intptr_t fOffsetInBytes; |
| 516 GrPixelConfig fTexelConfig; |
| 517 size_t fAttachedSizeInBytes; |
| 518 uint32_t fAttachedBufferUniqueID; |
| 519 GrSwizzle fSwizzle; |
| 520 }; |
| 521 |
| 522 SkTArray<BufferTexture, true> fHWBufferTextures; |
| 523 int fHWMaxUsedBufferTextureUnit; |
| 524 |
501 // EXT_raster_multisample. | 525 // EXT_raster_multisample. |
502 TriState fHWRasterMultisampleEnabled; | 526 TriState fHWRasterMultisampleEnabled; |
503 int fHWNumRasterSamples; | 527 int fHWNumRasterSamples; |
504 ///@} | 528 ///@} |
505 | 529 |
506 /** IDs for copy surface program. */ | 530 /** IDs for copy surface program. */ |
507 struct { | 531 struct { |
508 GrGLuint fProgram; | 532 GrGLuint fProgram; |
509 GrGLint fTextureUniform; | 533 GrGLint fTextureUniform; |
510 GrGLint fTexCoordXformUniform; | 534 GrGLint fTexCoordXformUniform; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 bool fHWPLSEnabled; | 566 bool fHWPLSEnabled; |
543 bool fPLSHasBeenUsed; | 567 bool fPLSHasBeenUsed; |
544 | 568 |
545 float fHWMinSampleShading; | 569 float fHWMinSampleShading; |
546 | 570 |
547 typedef GrGpu INHERITED; | 571 typedef GrGpu INHERITED; |
548 friend class GrGLPathRendering; // For accessing setTextureUnit. | 572 friend class GrGLPathRendering; // For accessing setTextureUnit. |
549 }; | 573 }; |
550 | 574 |
551 #endif | 575 #endif |
OLD | NEW |