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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 class GrGLBuffer; | 26 class GrGLBuffer; |
27 class GrPipeline; | 27 class GrPipeline; |
28 class GrNonInstancedMesh; | 28 class GrNonInstancedMesh; |
29 class GrSwizzle; | 29 class GrSwizzle; |
30 | 30 |
31 #ifdef SK_DEVELOPER | 31 #ifdef SK_DEVELOPER |
32 #define PROGRAM_CACHE_STATS | 32 #define PROGRAM_CACHE_STATS |
33 #endif | 33 #endif |
34 | 34 |
35 class GrGLGpu : public GrGpu { | 35 class GrGLGpu final : public GrGpu { |
36 public: | 36 public: |
37 static GrGpu* Create(GrBackendContext backendContext, const GrContextOptions
& options, | 37 static GrGpu* Create(GrBackendContext backendContext, const GrContextOptions
& options, |
38 GrContext* context); | 38 GrContext* context); |
39 ~GrGLGpu() override; | 39 ~GrGLGpu() override; |
40 | 40 |
41 void disconnect(DisconnectType) override; | 41 void disconnect(DisconnectType) override; |
42 | 42 |
43 const GrGLContext& glContext() const { return *fGLContext; } | 43 const GrGLContext& glContext() const { return *fGLContext; } |
44 | 44 |
45 const GrGLInterface* glInterface() const { return fGLContext->interface(); } | 45 const GrGLInterface* glInterface() const { return fGLContext->interface(); } |
(...skipping 20 matching lines...) Expand all Loading... |
66 | 66 |
67 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, | 67 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, |
68 GrPixelConfig srcConfig, DrawPreference*, | 68 GrPixelConfig srcConfig, DrawPreference*, |
69 WritePixelTempDrawInfo*) override; | 69 WritePixelTempDrawInfo*) override; |
70 | 70 |
71 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const
override; | 71 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const
override; |
72 | 72 |
73 // These functions should be used to bind GL objects. They track the GL stat
e and skip redundant | 73 // 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. | 74 // bindings. Making the equivalent glBind calls directly will confuse the st
ate tracking. |
75 void bindVertexArray(GrGLuint id) { | 75 void bindVertexArray(GrGLuint id) { |
76 fHWGeometryState.setVertexArrayID(this, id); | 76 fHWVertexArrayState.setVertexArrayID(this, id); |
77 } | |
78 void bindIndexBufferAndDefaultVertexArray(GrGLuint id) { | |
79 fHWGeometryState.setIndexBufferIDOnDefaultVertexArray(this, id); | |
80 } | |
81 void bindVertexBuffer(GrGLuint id) { | |
82 fHWGeometryState.setVertexBufferID(this, id); | |
83 } | 77 } |
84 | 78 |
85 // These callbacks update state tracking when GL objects are deleted. They a
re called from | 79 // These callbacks update state tracking when GL objects are deleted. They a
re called from |
86 // GrGLResource onRelease functions. | 80 // GrGLResource onRelease functions. |
87 void notifyVertexArrayDelete(GrGLuint id) { | 81 void notifyVertexArrayDelete(GrGLuint id) { |
88 fHWGeometryState.notifyVertexArrayDelete(id); | 82 fHWVertexArrayState.notifyVertexArrayDelete(id); |
89 } | |
90 void notifyVertexBufferDelete(GrGLuint id) { | |
91 fHWGeometryState.notifyVertexBufferDelete(id); | |
92 } | |
93 void notifyIndexBufferDelete(GrGLuint id) { | |
94 fHWGeometryState.notifyIndexBufferDelete(id); | |
95 } | 83 } |
96 | 84 |
97 // id and type (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, etc.) of buffer to
bind | 85 // Binds a buffer to the GL target corresponding to 'type', updates internal
state tracking, and |
98 void bindBuffer(GrGLuint id, GrGLenum type); | 86 // returns the GL target the buffer was bound to. |
99 | 87 // When 'type' is kIndex_GrBufferType, this function will also implicitly bi
nd the default VAO. |
100 void releaseBuffer(GrGLuint id, GrGLenum type); | 88 // 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*); |
101 | 90 |
102 const GrGLContext* glContextForTesting() const override { | 91 const GrGLContext* glContextForTesting() const override { |
103 return &this->glContext(); | 92 return &this->glContext(); |
104 } | 93 } |
105 | 94 |
106 void clearStencil(GrRenderTarget*) override; | 95 void clearStencil(GrRenderTarget*) override; |
107 | 96 |
108 void invalidateBoundRenderTarget() { | 97 void invalidateBoundRenderTarget() { |
109 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 98 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
110 } | 99 } |
(...skipping 20 matching lines...) Expand all Loading... |
131 void onResetContext(uint32_t resetBits) override; | 120 void onResetContext(uint32_t resetBits) override; |
132 | 121 |
133 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; | 122 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; |
134 | 123 |
135 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, | 124 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, |
136 const SkTArray<GrMipLevel>& texels) override; | 125 const SkTArray<GrMipLevel>& texels) override; |
137 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, | 126 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, |
138 GrGpuResource::LifeCycle lifeCycle, | 127 GrGpuResource::LifeCycle lifeCycle, |
139 const SkTArray<GrMipLevel>& texels) ove
rride; | 128 const SkTArray<GrMipLevel>& texels) ove
rride; |
140 | 129 |
141 GrBuffer* onCreateBuffer(GrBufferType, size_t size, GrAccessPattern) overrid
e; | 130 GrBuffer* onCreateBuffer(size_t size, GrBufferType intendedType, GrAccessPat
tern) override; |
142 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; | 131 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; |
143 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, | 132 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, |
144 GrWrapOwnership) override; | 133 GrWrapOwnership) override; |
145 GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDes
c&) override; | 134 GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDes
c&) override; |
146 // Given a GrPixelConfig return the index into the stencil format array on G
rGLCaps to a | 135 // Given a GrPixelConfig return the index into the stencil format array on G
rGLCaps to a |
147 // compatible stencil format, or negative if there is no compatible stencil
format. | 136 // compatible stencil format, or negative if there is no compatible stencil
format. |
148 int getCompatibleStencilIndex(GrPixelConfig config); | 137 int getCompatibleStencilIndex(GrPixelConfig config); |
149 | 138 |
150 // If |desc.fTextureStorageAllocator| exists, use that to create the | 139 // If |desc.fTextureStorageAllocator| exists, use that to create the |
151 // texture. Otherwise, create the texture directly. | 140 // texture. Otherwise, create the texture directly. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 // an into the index buffer. It does not account for vertices.startIndex() b
ut rather the start | 213 // an into the index buffer. It does not account for vertices.startIndex() b
ut rather the start |
225 // index is relative to the returned offset. | 214 // index is relative to the returned offset. |
226 void setupGeometry(const GrPrimitiveProcessor&, | 215 void setupGeometry(const GrPrimitiveProcessor&, |
227 const GrNonInstancedMesh& mesh, | 216 const GrNonInstancedMesh& mesh, |
228 size_t* indexOffsetInBytes); | 217 size_t* indexOffsetInBytes); |
229 | 218 |
230 void flushBlend(const GrXferProcessor::BlendInfo& blendInfo, const GrSwizzle
&); | 219 void flushBlend(const GrXferProcessor::BlendInfo& blendInfo, const GrSwizzle
&); |
231 | 220 |
232 bool hasExtension(const char* ext) const { return fGLContext->hasExtension(e
xt); } | 221 bool hasExtension(const char* ext) const { return fGLContext->hasExtension(e
xt); } |
233 | 222 |
234 void copySurfaceAsDraw(GrSurface* dst, | 223 bool copySurfaceAsDraw(GrSurface* dst, |
235 GrSurface* src, | 224 GrSurface* src, |
236 const SkIRect& srcRect, | 225 const SkIRect& srcRect, |
237 const SkIPoint& dstPoint); | 226 const SkIPoint& dstPoint); |
238 void copySurfaceAsCopyTexSubImage(GrSurface* dst, | 227 void copySurfaceAsCopyTexSubImage(GrSurface* dst, |
239 GrSurface* src, | 228 GrSurface* src, |
240 const SkIRect& srcRect, | 229 const SkIRect& srcRect, |
241 const SkIPoint& dstPoint); | 230 const SkIPoint& dstPoint); |
242 bool copySurfaceAsBlitFramebuffer(GrSurface* dst, | 231 bool copySurfaceAsBlitFramebuffer(GrSurface* dst, |
243 GrSurface* src, | 232 GrSurface* src, |
244 const SkIRect& srcRect, | 233 const SkIRect& srcRect, |
245 const SkIPoint& dstPoint); | 234 const SkIPoint& dstPoint); |
246 | 235 |
247 void stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGLint p
osXformUniform, | 236 void stampPLSSetupRect(const SkRect& bounds); |
248 GrGLuint arrayBuffer); | |
249 | 237 |
250 void setupPixelLocalStorage(const GrPipeline&, const GrPrimitiveProcessor&); | 238 void setupPixelLocalStorage(const GrPipeline&, const GrPrimitiveProcessor&); |
251 | 239 |
252 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 240 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
253 | 241 |
254 class ProgramCache : public ::SkNoncopyable { | 242 class ProgramCache : public ::SkNoncopyable { |
255 public: | 243 public: |
256 ProgramCache(GrGLGpu* gpu); | 244 ProgramCache(GrGLGpu* gpu); |
257 ~ProgramCache(); | 245 ~ProgramCache(); |
258 | 246 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // that ID is bound. If not the surface is temporarily bound to a FBO and th
at FBO is bound. | 354 // that ID is bound. If not the surface is temporarily bound to a FBO and th
at FBO is bound. |
367 // This must be paired with a call to unbindSurfaceFBOForCopy(). | 355 // This must be paired with a call to unbindSurfaceFBOForCopy(). |
368 void bindSurfaceFBOForCopy(GrSurface* surface, GrGLenum fboTarget, GrGLIRect
* viewport, | 356 void bindSurfaceFBOForCopy(GrSurface* surface, GrGLenum fboTarget, GrGLIRect
* viewport, |
369 TempFBOTarget tempFBOTarget); | 357 TempFBOTarget tempFBOTarget); |
370 | 358 |
371 // Must be called if bindSurfaceFBOForCopy was used to bind a surface for co
pying. | 359 // Must be called if bindSurfaceFBOForCopy was used to bind a surface for co
pying. |
372 void unbindTextureFBOForCopy(GrGLenum fboTarget, GrSurface* surface); | 360 void unbindTextureFBOForCopy(GrGLenum fboTarget, GrSurface* surface); |
373 | 361 |
374 SkAutoTUnref<GrGLContext> fGLContext; | 362 SkAutoTUnref<GrGLContext> fGLContext; |
375 | 363 |
376 void createCopyPrograms(); | 364 bool createCopyProgram(int progIdx); |
377 void createWireRectProgram(); | 365 bool createWireRectProgram(); |
378 void createUnitRectBuffer(); | 366 bool createPLSSetupProgram(); |
379 | |
380 void createPLSSetupProgram(); | |
381 | 367 |
382 // GL program-related state | 368 // GL program-related state |
383 ProgramCache* fProgramCache; | 369 ProgramCache* fProgramCache; |
384 | 370 |
385 /////////////////////////////////////////////////////////////////////////// | 371 /////////////////////////////////////////////////////////////////////////// |
386 ///@name Caching of GL State | 372 ///@name Caching of GL State |
387 ///@{ | 373 ///@{ |
388 int fHWActiveTextureUnitIdx; | 374 int fHWActiveTextureUnitIdx; |
389 GrGLuint fHWProgramID; | 375 GrGLuint fHWProgramID; |
390 | 376 |
(...skipping 14 matching lines...) Expand all Loading... |
405 GrGLIRect fRect; | 391 GrGLIRect fRect; |
406 void invalidate() { | 392 void invalidate() { |
407 fEnabled = kUnknown_TriState; | 393 fEnabled = kUnknown_TriState; |
408 fRect.invalidate(); | 394 fRect.invalidate(); |
409 } | 395 } |
410 } fHWScissorSettings; | 396 } fHWScissorSettings; |
411 | 397 |
412 GrGLIRect fHWViewport; | 398 GrGLIRect fHWViewport; |
413 | 399 |
414 /** | 400 /** |
415 * Tracks bound vertex and index buffers and vertex attrib array state. | 401 * Tracks vertex attrib array state. |
416 */ | 402 */ |
417 class HWGeometryState { | 403 class HWVertexArrayState { |
418 public: | 404 public: |
419 HWGeometryState() { fVBOVertexArray = nullptr; this->invalidate(); } | 405 HWVertexArrayState() : fCoreProfileVertexArray(nullptr) { this->invalida
te(); } |
420 | 406 |
421 ~HWGeometryState() { delete fVBOVertexArray; } | 407 ~HWVertexArrayState() { delete fCoreProfileVertexArray; } |
422 | 408 |
423 void invalidate() { | 409 void invalidate() { |
424 fBoundVertexArrayIDIsValid = false; | 410 fBoundVertexArrayIDIsValid = false; |
425 fBoundVertexBufferIDIsValid = false; | |
426 fDefaultVertexArrayBoundIndexBufferID = false; | |
427 fDefaultVertexArrayBoundIndexBufferIDIsValid = false; | |
428 fDefaultVertexArrayAttribState.invalidate(); | 411 fDefaultVertexArrayAttribState.invalidate(); |
429 if (fVBOVertexArray) { | 412 if (fCoreProfileVertexArray) { |
430 fVBOVertexArray->invalidateCachedState(); | 413 fCoreProfileVertexArray->invalidateCachedState(); |
431 } | 414 } |
432 } | 415 } |
433 | 416 |
434 void notifyVertexArrayDelete(GrGLuint id) { | 417 void notifyVertexArrayDelete(GrGLuint id) { |
435 if (fBoundVertexArrayIDIsValid && fBoundVertexArrayID == id) { | 418 if (fBoundVertexArrayIDIsValid && fBoundVertexArrayID == id) { |
436 // Does implicit bind to 0 | 419 // Does implicit bind to 0 |
437 fBoundVertexArrayID = 0; | 420 fBoundVertexArrayID = 0; |
438 } | 421 } |
439 } | 422 } |
440 | 423 |
441 void setVertexArrayID(GrGLGpu* gpu, GrGLuint arrayID) { | 424 void setVertexArrayID(GrGLGpu* gpu, GrGLuint arrayID) { |
442 if (!gpu->glCaps().vertexArrayObjectSupport()) { | 425 if (!gpu->glCaps().vertexArrayObjectSupport()) { |
443 SkASSERT(0 == arrayID); | 426 SkASSERT(0 == arrayID); |
444 return; | 427 return; |
445 } | 428 } |
446 if (!fBoundVertexArrayIDIsValid || arrayID != fBoundVertexArrayID) { | 429 if (!fBoundVertexArrayIDIsValid || arrayID != fBoundVertexArrayID) { |
447 GR_GL_CALL(gpu->glInterface(), BindVertexArray(arrayID)); | 430 GR_GL_CALL(gpu->glInterface(), BindVertexArray(arrayID)); |
448 fBoundVertexArrayIDIsValid = true; | 431 fBoundVertexArrayIDIsValid = true; |
449 fBoundVertexArrayID = arrayID; | 432 fBoundVertexArrayID = arrayID; |
450 } | 433 } |
451 } | 434 } |
452 | 435 |
453 void notifyVertexBufferDelete(GrGLuint id) { | |
454 if (fBoundVertexBufferIDIsValid && id == fBoundVertexBufferID) { | |
455 fBoundVertexBufferID = 0; | |
456 } | |
457 if (fVBOVertexArray) { | |
458 fVBOVertexArray->notifyVertexBufferDelete(id); | |
459 } | |
460 fDefaultVertexArrayAttribState.notifyVertexBufferDelete(id); | |
461 } | |
462 | |
463 void notifyIndexBufferDelete(GrGLuint id) { | |
464 if (fDefaultVertexArrayBoundIndexBufferIDIsValid && | |
465 id == fDefaultVertexArrayBoundIndexBufferID) { | |
466 fDefaultVertexArrayBoundIndexBufferID = 0; | |
467 } | |
468 if (fVBOVertexArray) { | |
469 fVBOVertexArray->notifyIndexBufferDelete(id); | |
470 } | |
471 } | |
472 | |
473 void setVertexBufferID(GrGLGpu* gpu, GrGLuint id) { | |
474 if (!fBoundVertexBufferIDIsValid || id != fBoundVertexBufferID) { | |
475 GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ARRAY_BUFFER, id
)); | |
476 fBoundVertexBufferIDIsValid = true; | |
477 fBoundVertexBufferID = id; | |
478 } | |
479 } | |
480 | |
481 /** | 436 /** |
482 * Binds the default vertex array and binds the index buffer. This is us
ed when binding | 437 * Binds the vertex array that should be used for internal draws, and re
turns its attrib |
483 * an index buffer in order to update it. | 438 * state. This binds the default VAO (ID=zero) unless we are on a core p
rofile, in which |
| 439 * case we use a dummy array instead. |
| 440 * |
| 441 * If an index buffer is privided, it will be bound to the vertex array.
Otherwise the |
| 442 * index buffer binding will be left unchanged. |
| 443 * |
| 444 * The returned GrGLAttribArrayState should be used to set vertex attrib
ute arrays. |
484 */ | 445 */ |
485 void setIndexBufferIDOnDefaultVertexArray(GrGLGpu* gpu, GrGLuint id) { | 446 GrGLAttribArrayState* bindInternalVertexArray(GrGLGpu*, const GrGLBuffer
* ibuff = nullptr); |
486 this->setVertexArrayID(gpu, 0); | |
487 if (!fDefaultVertexArrayBoundIndexBufferIDIsValid || | |
488 id != fDefaultVertexArrayBoundIndexBufferID) { | |
489 GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BU
FFER, id)); | |
490 fDefaultVertexArrayBoundIndexBufferIDIsValid = true; | |
491 fDefaultVertexArrayBoundIndexBufferID = id; | |
492 } | |
493 } | |
494 | |
495 /** | |
496 * Binds the vertex array object that should be used to render from the
vertex buffer. | |
497 * The vertex array is bound and its attrib array state object is return
ed. The vertex | |
498 * buffer is bound. The index buffer (if non-nullptr) is bound to the ve
rtex array. The | |
499 * returned GrGLAttribArrayState should be used to set vertex attribute
arrays. | |
500 */ | |
501 GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu, | |
502 const GrGLBuffer* vbuffe
r, | |
503 const GrGLBuffer* ibuffe
r); | |
504 | |
505 /** Variants of the above that takes GL buffer IDs. Note that 0 does not
imply that a | |
506 buffer won't be bound. The "default buffer" will be bound, which is
used for client-side | |
507 array rendering. */ | |
508 GrGLAttribArrayState* bindArrayAndBufferToDraw(GrGLGpu* gpu, GrGLuint vb
ufferID); | |
509 GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu, | |
510 GrGLuint vbufferID, | |
511 GrGLuint ibufferID); | |
512 | 447 |
513 private: | 448 private: |
514 GrGLAttribArrayState* internalBind(GrGLGpu* gpu, GrGLuint vbufferID, GrG
Luint* ibufferID); | 449 GrGLuint fBoundVertexArrayID; |
| 450 bool fBoundVertexArrayIDIsValid; |
515 | 451 |
516 GrGLuint fBoundVertexArrayID; | |
517 GrGLuint fBoundVertexBufferID; | |
518 bool fBoundVertexArrayIDIsValid; | |
519 bool fBoundVertexBufferIDIsValid; | |
520 | |
521 GrGLuint fDefaultVertexArrayBoundIndexBufferID; | |
522 bool fDefaultVertexArrayBoundIndexBufferIDIsValid; | |
523 // We return a non-const pointer to this from bindArrayAndBuffersToDraw
when vertex array 0 | 452 // We return a non-const pointer to this from bindArrayAndBuffersToDraw
when vertex array 0 |
524 // is bound. However, this class is internal to GrGLGpu and this object
never leaks out of | 453 // is bound. However, this class is internal to GrGLGpu and this object
never leaks out of |
525 // GrGLGpu. | 454 // GrGLGpu. |
526 GrGLAttribArrayState fDefaultVertexArrayAttribState; | 455 GrGLAttribArrayState fDefaultVertexArrayAttribState; |
527 | 456 |
528 // This is used when we're using a core profile and the vertices are in
a VBO. | 457 // This is used when we're using a core profile. |
529 GrGLVertexArray* fVBOVertexArray; | 458 GrGLVertexArray* fCoreProfileVertexArray; |
530 } fHWGeometryState; | 459 } fHWVertexArrayState; |
531 | 460 |
532 GrGLuint fHWBoundTextureBufferID; | 461 struct { |
533 GrGLuint fHWBoundDrawIndirectBufferID; | 462 GrGLenum fGLTarget; |
534 bool fHWBoundTextureBufferIDIsValid; | 463 uint32_t fBoundBufferUniqueID; |
535 bool fHWBoundDrawIndirectBufferIDIsValid; | 464 bool fBufferZeroKnownBound; |
| 465 |
| 466 void invalidate() { |
| 467 fBoundBufferUniqueID = SK_InvalidUniqueID; |
| 468 fBufferZeroKnownBound = false; |
| 469 } |
| 470 } fHWBufferState[kGrBufferTypeCount]; |
536 | 471 |
537 struct { | 472 struct { |
538 GrBlendEquation fEquation; | 473 GrBlendEquation fEquation; |
539 GrBlendCoeff fSrcCoeff; | 474 GrBlendCoeff fSrcCoeff; |
540 GrBlendCoeff fDstCoeff; | 475 GrBlendCoeff fDstCoeff; |
541 GrColor fConstColor; | 476 GrColor fConstColor; |
542 bool fConstColorValid; | 477 bool fConstColorValid; |
543 TriState fEnabled; | 478 TriState fEnabled; |
544 | 479 |
545 void invalidate() { | 480 void invalidate() { |
(...skipping 22 matching lines...) Expand all Loading... |
568 int fHWNumRasterSamples; | 503 int fHWNumRasterSamples; |
569 ///@} | 504 ///@} |
570 | 505 |
571 /** IDs for copy surface program. */ | 506 /** IDs for copy surface program. */ |
572 struct { | 507 struct { |
573 GrGLuint fProgram; | 508 GrGLuint fProgram; |
574 GrGLint fTextureUniform; | 509 GrGLint fTextureUniform; |
575 GrGLint fTexCoordXformUniform; | 510 GrGLint fTexCoordXformUniform; |
576 GrGLint fPosXformUniform; | 511 GrGLint fPosXformUniform; |
577 } fCopyPrograms[3]; | 512 } fCopyPrograms[3]; |
578 GrGLuint fCopyProgramArrayBuffer; | 513 SkAutoTUnref<GrGLBuffer> fCopyProgramArrayBuffer; |
579 | 514 |
580 struct { | 515 struct { |
581 GrGLuint fProgram; | 516 GrGLuint fProgram; |
582 GrGLint fColorUniform; | 517 GrGLint fColorUniform; |
583 GrGLint fRectUniform; | 518 GrGLint fRectUniform; |
584 } fWireRectProgram; | 519 } fWireRectProgram; |
585 GrGLuint fWireRectArrayBuffer; | 520 SkAutoTUnref<GrGLBuffer> fWireRectArrayBuffer; |
586 | 521 |
587 static int TextureTargetToCopyProgramIdx(GrGLenum target) { | 522 static int TextureTargetToCopyProgramIdx(GrGLenum target) { |
588 switch (target) { | 523 switch (target) { |
589 case GR_GL_TEXTURE_2D: | 524 case GR_GL_TEXTURE_2D: |
590 return 0; | 525 return 0; |
591 case GR_GL_TEXTURE_EXTERNAL: | 526 case GR_GL_TEXTURE_EXTERNAL: |
592 return 1; | 527 return 1; |
593 case GR_GL_TEXTURE_RECTANGLE: | 528 case GR_GL_TEXTURE_RECTANGLE: |
594 return 2; | 529 return 2; |
595 default: | 530 default: |
596 SkFAIL("Unexpected texture target type."); | 531 SkFAIL("Unexpected texture target type."); |
597 return 0; | 532 return 0; |
598 } | 533 } |
599 } | 534 } |
600 | 535 |
601 struct { | 536 struct { |
602 GrGLuint fProgram; | 537 GrGLuint fProgram; |
603 GrGLint fPosXformUniform; | 538 GrGLint fPosXformUniform; |
604 GrGLuint fArrayBuffer; | 539 SkAutoTUnref<GrGLBuffer> fArrayBuffer; |
605 } fPLSSetupProgram; | 540 } fPLSSetupProgram; |
606 | 541 |
607 bool fHWPLSEnabled; | 542 bool fHWPLSEnabled; |
608 bool fPLSHasBeenUsed; | 543 bool fPLSHasBeenUsed; |
609 | 544 |
610 float fHWMinSampleShading; | 545 float fHWMinSampleShading; |
611 | 546 |
612 typedef GrGpu INHERITED; | 547 typedef GrGpu INHERITED; |
613 friend class GrGLPathRendering; // For accessing setTextureUnit. | 548 friend class GrGLPathRendering; // For accessing setTextureUnit. |
614 }; | 549 }; |
615 | 550 |
616 #endif | 551 #endif |
OLD | NEW |