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