| 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 20 matching lines...) Expand all Loading... |
| 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 : 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 initGpuResources() override; |
| 42 |
| 41 void disconnect(DisconnectType) override; | 43 void disconnect(DisconnectType) override; |
| 42 | 44 |
| 43 const GrGLContext& glContext() const { return *fGLContext; } | 45 const GrGLContext& glContext() const { return *fGLContext; } |
| 44 | 46 |
| 45 const GrGLInterface* glInterface() const { return fGLContext->interface(); } | 47 const GrGLInterface* glInterface() const { return fGLContext->interface(); } |
| 46 const GrGLContextInfo& ctxInfo() const { return *fGLContext; } | 48 const GrGLContextInfo& ctxInfo() const { return *fGLContext; } |
| 47 GrGLStandard glStandard() const { return fGLContext->standard(); } | 49 GrGLStandard glStandard() const { return fGLContext->standard(); } |
| 48 GrGLVersion glVersion() const { return fGLContext->version(); } | 50 GrGLVersion glVersion() const { return fGLContext->version(); } |
| 49 GrGLSLGeneration glslGeneration() const { return fGLContext->glslGeneration(
); } | 51 GrGLSLGeneration glslGeneration() const { return fGLContext->glslGeneration(
); } |
| 50 const GrGLCaps& glCaps() const { return *fGLContext->caps(); } | 52 const GrGLCaps& glCaps() const { return *fGLContext->caps(); } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 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 fHWGeometryState.setVertexArrayID(this, id); | 78 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 } | 79 } |
| 84 | 80 |
| 85 // 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 |
| 86 // GrGLResource onRelease functions. | 82 // GrGLResource onRelease functions. |
| 87 void notifyVertexArrayDelete(GrGLuint id) { | 83 void notifyVertexArrayDelete(GrGLuint id) { |
| 88 fHWGeometryState.notifyVertexArrayDelete(id); | 84 fHWVertexArrayState.notifyVertexArrayDelete(id); |
| 89 } | |
| 90 void notifyVertexBufferDelete(GrGLuint id) { | |
| 91 fHWGeometryState.notifyVertexBufferDelete(id); | |
| 92 } | |
| 93 void notifyIndexBufferDelete(GrGLuint id) { | |
| 94 fHWGeometryState.notifyIndexBufferDelete(id); | |
| 95 } | 85 } |
| 96 | 86 |
| 97 // id and type (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, etc.) of buffer to
bind | 87 // Binds a buffer to the GL target corresponding to 'type', updates internal
state tracking, and |
| 98 void bindBuffer(GrGLuint id, GrGLenum type); | 88 // returns the GL target the buffer was bound to. |
| 99 | 89 // When 'type' is kIndex_GrBufferType, this function will also implicitly bi
nd the default VAO. |
| 100 void releaseBuffer(GrGLuint id, GrGLenum type); | 90 // If the caller wishes to bind an index buffer to a specific VAO, it can ca
ll glBind directly. |
| 91 GrGLenum bindBuffer(GrBufferType type, const GrGLBuffer*); |
| 101 | 92 |
| 102 const GrGLContext* glContextForTesting() const override { | 93 const GrGLContext* glContextForTesting() const override { |
| 103 return &this->glContext(); | 94 return &this->glContext(); |
| 104 } | 95 } |
| 105 | 96 |
| 106 void clearStencil(GrRenderTarget*) override; | 97 void clearStencil(GrRenderTarget*) override; |
| 107 | 98 |
| 108 void invalidateBoundRenderTarget() { | 99 void invalidateBoundRenderTarget() { |
| 109 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 100 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
| 110 } | 101 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 131 void onResetContext(uint32_t resetBits) override; | 122 void onResetContext(uint32_t resetBits) override; |
| 132 | 123 |
| 133 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; | 124 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override; |
| 134 | 125 |
| 135 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, | 126 GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCyc
le lifeCycle, |
| 136 const SkTArray<GrMipLevel>& texels) override; | 127 const SkTArray<GrMipLevel>& texels) override; |
| 137 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, | 128 GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, |
| 138 GrGpuResource::LifeCycle lifeCycle, | 129 GrGpuResource::LifeCycle lifeCycle, |
| 139 const SkTArray<GrMipLevel>& texels) ove
rride; | 130 const SkTArray<GrMipLevel>& texels) ove
rride; |
| 140 | 131 |
| 141 GrBuffer* onCreateBuffer(GrBufferType, size_t size, GrAccessPattern) overrid
e; | 132 GrBuffer* onCreateBuffer(size_t size, GrBufferType intendedType, GrAccessPat
tern) override; |
| 142 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; | 133 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership
) override; |
| 143 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, | 134 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, |
| 144 GrWrapOwnership) override; | 135 GrWrapOwnership) override; |
| 145 GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDes
c&) override; | 136 GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDes
c&) override; |
| 146 // Given a GrPixelConfig return the index into the stencil format array on G
rGLCaps to a | 137 // 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. | 138 // compatible stencil format, or negative if there is no compatible stencil
format. |
| 148 int getCompatibleStencilIndex(GrPixelConfig config); | 139 int getCompatibleStencilIndex(GrPixelConfig config); |
| 149 | 140 |
| 150 // If |desc.fTextureStorageAllocator| exists, use that to create the | 141 // If |desc.fTextureStorageAllocator| exists, use that to create the |
| 151 // texture. Otherwise, create the texture directly. | 142 // texture. Otherwise, create the texture directly. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 void copySurfaceAsCopyTexSubImage(GrSurface* dst, | 229 void copySurfaceAsCopyTexSubImage(GrSurface* dst, |
| 239 GrSurface* src, | 230 GrSurface* src, |
| 240 const SkIRect& srcRect, | 231 const SkIRect& srcRect, |
| 241 const SkIPoint& dstPoint); | 232 const SkIPoint& dstPoint); |
| 242 bool copySurfaceAsBlitFramebuffer(GrSurface* dst, | 233 bool copySurfaceAsBlitFramebuffer(GrSurface* dst, |
| 243 GrSurface* src, | 234 GrSurface* src, |
| 244 const SkIRect& srcRect, | 235 const SkIRect& srcRect, |
| 245 const SkIPoint& dstPoint); | 236 const SkIPoint& dstPoint); |
| 246 | 237 |
| 247 void stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGLint p
osXformUniform, | 238 void stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGLint p
osXformUniform, |
| 248 GrGLuint arrayBuffer); | 239 const GrGLBuffer* arrayBuffer); |
| 249 | 240 |
| 250 void setupPixelLocalStorage(const GrPipeline&, const GrPrimitiveProcessor&); | 241 void setupPixelLocalStorage(const GrPipeline&, const GrPrimitiveProcessor&); |
| 251 | 242 |
| 252 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 243 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
| 253 | 244 |
| 254 class ProgramCache : public ::SkNoncopyable { | 245 class ProgramCache : public ::SkNoncopyable { |
| 255 public: | 246 public: |
| 256 ProgramCache(GrGLGpu* gpu); | 247 ProgramCache(GrGLGpu* gpu); |
| 257 ~ProgramCache(); | 248 ~ProgramCache(); |
| 258 | 249 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 GrGLIRect fRect; | 396 GrGLIRect fRect; |
| 406 void invalidate() { | 397 void invalidate() { |
| 407 fEnabled = kUnknown_TriState; | 398 fEnabled = kUnknown_TriState; |
| 408 fRect.invalidate(); | 399 fRect.invalidate(); |
| 409 } | 400 } |
| 410 } fHWScissorSettings; | 401 } fHWScissorSettings; |
| 411 | 402 |
| 412 GrGLIRect fHWViewport; | 403 GrGLIRect fHWViewport; |
| 413 | 404 |
| 414 /** | 405 /** |
| 415 * Tracks bound vertex and index buffers and vertex attrib array state. | 406 * Tracks vertex attrib array state. |
| 416 */ | 407 */ |
| 417 class HWGeometryState { | 408 class HWVertexArrayState { |
| 418 public: | 409 public: |
| 419 HWGeometryState() { fVBOVertexArray = nullptr; this->invalidate(); } | 410 HWVertexArrayState() : fCoreProfileVertexArray(nullptr) { this->invalida
te(); } |
| 420 | 411 |
| 421 ~HWGeometryState() { delete fVBOVertexArray; } | 412 ~HWVertexArrayState() { delete fCoreProfileVertexArray; } |
| 422 | 413 |
| 423 void invalidate() { | 414 void invalidate() { |
| 424 fBoundVertexArrayIDIsValid = false; | 415 fBoundVertexArrayIDIsValid = false; |
| 425 fBoundVertexBufferIDIsValid = false; | |
| 426 fDefaultVertexArrayBoundIndexBufferID = false; | |
| 427 fDefaultVertexArrayBoundIndexBufferIDIsValid = false; | |
| 428 fDefaultVertexArrayAttribState.invalidate(); | 416 fDefaultVertexArrayAttribState.invalidate(); |
| 429 if (fVBOVertexArray) { | 417 if (fCoreProfileVertexArray) { |
| 430 fVBOVertexArray->invalidateCachedState(); | 418 fCoreProfileVertexArray->invalidateCachedState(); |
| 431 } | 419 } |
| 432 } | 420 } |
| 433 | 421 |
| 434 void notifyVertexArrayDelete(GrGLuint id) { | 422 void notifyVertexArrayDelete(GrGLuint id) { |
| 435 if (fBoundVertexArrayIDIsValid && fBoundVertexArrayID == id) { | 423 if (fBoundVertexArrayIDIsValid && fBoundVertexArrayID == id) { |
| 436 // Does implicit bind to 0 | 424 // Does implicit bind to 0 |
| 437 fBoundVertexArrayID = 0; | 425 fBoundVertexArrayID = 0; |
| 438 } | 426 } |
| 439 } | 427 } |
| 440 | 428 |
| 441 void setVertexArrayID(GrGLGpu* gpu, GrGLuint arrayID) { | 429 void setVertexArrayID(GrGLGpu* gpu, GrGLuint arrayID) { |
| 442 if (!gpu->glCaps().vertexArrayObjectSupport()) { | 430 if (!gpu->glCaps().vertexArrayObjectSupport()) { |
| 443 SkASSERT(0 == arrayID); | 431 SkASSERT(0 == arrayID); |
| 444 return; | 432 return; |
| 445 } | 433 } |
| 446 if (!fBoundVertexArrayIDIsValid || arrayID != fBoundVertexArrayID) { | 434 if (!fBoundVertexArrayIDIsValid || arrayID != fBoundVertexArrayID) { |
| 447 GR_GL_CALL(gpu->glInterface(), BindVertexArray(arrayID)); | 435 GR_GL_CALL(gpu->glInterface(), BindVertexArray(arrayID)); |
| 448 fBoundVertexArrayIDIsValid = true; | 436 fBoundVertexArrayIDIsValid = true; |
| 449 fBoundVertexArrayID = arrayID; | 437 fBoundVertexArrayID = arrayID; |
| 450 } | 438 } |
| 451 } | 439 } |
| 452 | 440 |
| 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 /** | 441 /** |
| 482 * Binds the default vertex array and binds the index buffer. This is us
ed when binding | 442 * 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. | 443 * state. This binds the default VAO (ID=zero) unless we are on a core p
rofile, in which |
| 444 * case we use a dummy array instead. |
| 445 * |
| 446 * If an index buffer is privided, it will be bound to the vertex array.
Otherwise the |
| 447 * index buffer binding will be left unchanged. |
| 448 * |
| 449 * The returned GrGLAttribArrayState should be used to set vertex attrib
ute arrays. |
| 484 */ | 450 */ |
| 485 void setIndexBufferIDOnDefaultVertexArray(GrGLGpu* gpu, GrGLuint id) { | 451 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 | 452 |
| 513 private: | 453 private: |
| 514 GrGLAttribArrayState* internalBind(GrGLGpu* gpu, GrGLuint vbufferID, GrG
Luint* ibufferID); | 454 GrGLuint fBoundVertexArrayID; |
| 455 bool fBoundVertexArrayIDIsValid; |
| 515 | 456 |
| 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 | 457 // 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 | 458 // is bound. However, this class is internal to GrGLGpu and this object
never leaks out of |
| 525 // GrGLGpu. | 459 // GrGLGpu. |
| 526 GrGLAttribArrayState fDefaultVertexArrayAttribState; | 460 GrGLAttribArrayState fDefaultVertexArrayAttribState; |
| 527 | 461 |
| 528 // This is used when we're using a core profile and the vertices are in
a VBO. | 462 // This is used when we're using a core profile. |
| 529 GrGLVertexArray* fVBOVertexArray; | 463 GrGLVertexArray* fCoreProfileVertexArray; |
| 530 } fHWGeometryState; | 464 } fHWVertexArrayState; |
| 531 | 465 |
| 532 GrGLuint fHWBoundTextureBufferID; | 466 struct { |
| 533 GrGLuint fHWBoundDrawIndirectBufferID; | 467 GrGLenum fGLTarget; |
| 534 bool fHWBoundTextureBufferIDIsValid; | 468 uint32_t fBoundBufferUniqueID; |
| 535 bool fHWBoundDrawIndirectBufferIDIsValid; | 469 bool fBufferZeroKnownBound; |
| 470 |
| 471 void invalidate() { |
| 472 fBoundBufferUniqueID = SK_InvalidUniqueID; |
| 473 fBufferZeroKnownBound = false; |
| 474 } |
| 475 } fHWBufferState[kGrBufferTypeCount]; |
| 536 | 476 |
| 537 struct { | 477 struct { |
| 538 GrBlendEquation fEquation; | 478 GrBlendEquation fEquation; |
| 539 GrBlendCoeff fSrcCoeff; | 479 GrBlendCoeff fSrcCoeff; |
| 540 GrBlendCoeff fDstCoeff; | 480 GrBlendCoeff fDstCoeff; |
| 541 GrColor fConstColor; | 481 GrColor fConstColor; |
| 542 bool fConstColorValid; | 482 bool fConstColorValid; |
| 543 TriState fEnabled; | 483 TriState fEnabled; |
| 544 | 484 |
| 545 void invalidate() { | 485 void invalidate() { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 568 int fHWNumRasterSamples; | 508 int fHWNumRasterSamples; |
| 569 ///@} | 509 ///@} |
| 570 | 510 |
| 571 /** IDs for copy surface program. */ | 511 /** IDs for copy surface program. */ |
| 572 struct { | 512 struct { |
| 573 GrGLuint fProgram; | 513 GrGLuint fProgram; |
| 574 GrGLint fTextureUniform; | 514 GrGLint fTextureUniform; |
| 575 GrGLint fTexCoordXformUniform; | 515 GrGLint fTexCoordXformUniform; |
| 576 GrGLint fPosXformUniform; | 516 GrGLint fPosXformUniform; |
| 577 } fCopyPrograms[3]; | 517 } fCopyPrograms[3]; |
| 578 GrGLuint fCopyProgramArrayBuffer; | 518 SkAutoTUnref<GrGLBuffer> fCopyProgramArrayBuffer; |
| 579 | 519 |
| 580 struct { | 520 struct { |
| 581 GrGLuint fProgram; | 521 GrGLuint fProgram; |
| 582 GrGLint fColorUniform; | 522 GrGLint fColorUniform; |
| 583 GrGLint fRectUniform; | 523 GrGLint fRectUniform; |
| 584 } fWireRectProgram; | 524 } fWireRectProgram; |
| 585 GrGLuint fWireRectArrayBuffer; | 525 SkAutoTUnref<GrGLBuffer> fWireRectArrayBuffer; |
| 586 | 526 |
| 587 static int TextureTargetToCopyProgramIdx(GrGLenum target) { | 527 static int TextureTargetToCopyProgramIdx(GrGLenum target) { |
| 588 switch (target) { | 528 switch (target) { |
| 589 case GR_GL_TEXTURE_2D: | 529 case GR_GL_TEXTURE_2D: |
| 590 return 0; | 530 return 0; |
| 591 case GR_GL_TEXTURE_EXTERNAL: | 531 case GR_GL_TEXTURE_EXTERNAL: |
| 592 return 1; | 532 return 1; |
| 593 case GR_GL_TEXTURE_RECTANGLE: | 533 case GR_GL_TEXTURE_RECTANGLE: |
| 594 return 2; | 534 return 2; |
| 595 default: | 535 default: |
| 596 SkFAIL("Unexpected texture target type."); | 536 SkFAIL("Unexpected texture target type."); |
| 597 return 0; | 537 return 0; |
| 598 } | 538 } |
| 599 } | 539 } |
| 600 | 540 |
| 601 struct { | 541 struct { |
| 602 GrGLuint fProgram; | 542 GrGLuint fProgram; |
| 603 GrGLint fPosXformUniform; | 543 GrGLint fPosXformUniform; |
| 604 GrGLuint fArrayBuffer; | 544 SkAutoTUnref<GrGLBuffer> fArrayBuffer; |
| 605 } fPLSSetupProgram; | 545 } fPLSSetupProgram; |
| 606 | 546 |
| 607 bool fHWPLSEnabled; | 547 bool fHWPLSEnabled; |
| 608 bool fPLSHasBeenUsed; | 548 bool fPLSHasBeenUsed; |
| 609 | 549 |
| 610 float fHWMinSampleShading; | 550 float fHWMinSampleShading; |
| 611 | 551 |
| 612 typedef GrGpu INHERITED; | 552 typedef GrGpu INHERITED; |
| 613 friend class GrGLPathRendering; // For accessing setTextureUnit. | 553 friend class GrGLPathRendering; // For accessing setTextureUnit. |
| 614 }; | 554 }; |
| 615 | 555 |
| 616 #endif | 556 #endif |
| OLD | NEW |