| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 void notifyIndexBufferDelete(GrGLuint id) { | 95 void notifyIndexBufferDelete(GrGLuint id) { |
| 96 fHWGeometryState.notifyIndexBufferDelete(id); | 96 fHWGeometryState.notifyIndexBufferDelete(id); |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool copySurface(GrSurface* dst, | 99 bool copySurface(GrSurface* dst, |
| 100 GrSurface* src, | 100 GrSurface* src, |
| 101 const SkIRect& srcRect, | 101 const SkIRect& srcRect, |
| 102 const SkIPoint& dstPoint) override; | 102 const SkIPoint& dstPoint) override; |
| 103 | 103 |
| 104 bool canCopySurface(const GrSurface* dst, | |
| 105 const GrSurface* src, | |
| 106 const SkIRect& srcRect, | |
| 107 const SkIPoint& dstPoint) override; | |
| 108 | |
| 109 void xferBarrier(GrXferBarrierType) override; | 104 void xferBarrier(GrXferBarrierType) override; |
| 110 | 105 |
| 111 void buildProgramDesc(GrProgramDesc*, | 106 void buildProgramDesc(GrProgramDesc*, |
| 112 const GrPrimitiveProcessor&, | 107 const GrPrimitiveProcessor&, |
| 113 const GrPipeline&, | 108 const GrPipeline&, |
| 114 const GrBatchTracker&) const override; | 109 const GrBatchTracker&) const override; |
| 115 | 110 |
| 116 private: | 111 private: |
| 117 // GrGpu overrides | 112 // GrGpu overrides |
| 118 void onResetContext(uint32_t resetBits) override; | 113 void onResetContext(uint32_t resetBits) override; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset | 171 // Sets up vertex attribute pointers and strides. On return indexOffsetInByt
es gives the offset |
| 177 // an into the index buffer. It does not account for vertices.startIndex() b
ut rather the start | 172 // an into the index buffer. It does not account for vertices.startIndex() b
ut rather the start |
| 178 // index is relative to the returned offset. | 173 // index is relative to the returned offset. |
| 179 void setupGeometry(const GrPrimitiveProcessor&, | 174 void setupGeometry(const GrPrimitiveProcessor&, |
| 180 const GrNonInstancedVertices& vertices, | 175 const GrNonInstancedVertices& vertices, |
| 181 size_t* indexOffsetInBytes); | 176 size_t* indexOffsetInBytes); |
| 182 | 177 |
| 183 // Subclasses should call this to flush the blend state. | 178 // Subclasses should call this to flush the blend state. |
| 184 void flushBlend(const GrXferProcessor::BlendInfo& blendInfo); | 179 void flushBlend(const GrXferProcessor::BlendInfo& blendInfo); |
| 185 | 180 |
| 181 void copySurfaceAsDraw(GrSurface* dst, |
| 182 GrSurface* src, |
| 183 const SkIRect& srcRect, |
| 184 const SkIPoint& dstPoint); |
| 185 void copySurfaceAsCopyTexSubImage(GrSurface* dst, |
| 186 GrSurface* src, |
| 187 const SkIRect& srcRect, |
| 188 const SkIPoint& dstPoint); |
| 189 bool copySurfaceAsBlitFramebuffer(GrSurface* dst, |
| 190 GrSurface* src, |
| 191 const SkIRect& srcRect, |
| 192 const SkIPoint& dstPoint); |
| 193 |
| 186 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } | 194 bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ex
t); } |
| 187 | 195 |
| 188 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); | 196 static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff); |
| 189 | 197 |
| 190 class ProgramCache : public ::SkNoncopyable { | 198 class ProgramCache : public ::SkNoncopyable { |
| 191 public: | 199 public: |
| 192 ProgramCache(GrGLGpu* gpu); | 200 ProgramCache(GrGLGpu* gpu); |
| 193 ~ProgramCache(); | 201 ~ProgramCache(); |
| 194 | 202 |
| 195 void abandon(); | 203 void abandon(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 enum TempFBOTarget { | 295 enum TempFBOTarget { |
| 288 kSrc_TempFBOTarget, | 296 kSrc_TempFBOTarget, |
| 289 kDst_TempFBOTarget | 297 kDst_TempFBOTarget |
| 290 }; | 298 }; |
| 291 | 299 |
| 292 GrGLuint bindSurfaceAsFBO(GrSurface* surface, GrGLenum fboTarget, GrGLIRect*
viewport, | 300 GrGLuint bindSurfaceAsFBO(GrSurface* surface, GrGLenum fboTarget, GrGLIRect*
viewport, |
| 293 TempFBOTarget tempFBOTarget); | 301 TempFBOTarget tempFBOTarget); |
| 294 | 302 |
| 295 void unbindTextureFromFBO(GrGLenum fboTarget); | 303 void unbindTextureFromFBO(GrGLenum fboTarget); |
| 296 | 304 |
| 305 void createCopyProgram(); |
| 306 |
| 297 GrGLContext fGLContext; | 307 GrGLContext fGLContext; |
| 298 | 308 |
| 299 // GL program-related state | 309 // GL program-related state |
| 300 ProgramCache* fProgramCache; | 310 ProgramCache* fProgramCache; |
| 301 SkAutoTUnref<GrGLProgram> fCurrentProgram; | 311 SkAutoTUnref<GrGLProgram> fCurrentProgram; |
| 302 | 312 |
| 303 /////////////////////////////////////////////////////////////////////////// | 313 /////////////////////////////////////////////////////////////////////////// |
| 304 ///@name Caching of GL State | 314 ///@name Caching of GL State |
| 305 ///@{ | 315 ///@{ |
| 306 int fHWActiveTextureUnitIdx; | 316 int fHWActiveTextureUnitIdx; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 /** | 423 /** |
| 414 * Binds the vertex array object that should be used to render from the
vertex buffer. | 424 * Binds the vertex array object that should be used to render from the
vertex buffer. |
| 415 * The vertex array is bound and its attrib array state object is return
ed. The vertex | 425 * The vertex array is bound and its attrib array state object is return
ed. The vertex |
| 416 * buffer is bound. The index buffer (if non-NULL) is bound to the verte
x array. The | 426 * buffer is bound. The index buffer (if non-NULL) is bound to the verte
x array. The |
| 417 * returned GrGLAttribArrayState should be used to set vertex attribute
arrays. | 427 * returned GrGLAttribArrayState should be used to set vertex attribute
arrays. |
| 418 */ | 428 */ |
| 419 GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu, | 429 GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu, |
| 420 const GrGLVertexBuffer*
vbuffer, | 430 const GrGLVertexBuffer*
vbuffer, |
| 421 const GrGLIndexBuffer* i
buffer); | 431 const GrGLIndexBuffer* i
buffer); |
| 422 | 432 |
| 433 /** Variants of the above that takes GL buffer IDs. Note that 0 does not
imply that a |
| 434 buffer won't be bound. The "default buffer" will be bound, which is
used for client-side |
| 435 array rendering. */ |
| 436 GrGLAttribArrayState* bindArrayAndBufferToDraw(GrGLGpu* gpu, GrGLuint vb
ufferID); |
| 437 GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu, |
| 438 GrGLuint vbufferID, |
| 439 GrGLuint ibufferID); |
| 440 |
| 423 private: | 441 private: |
| 442 GrGLAttribArrayState* internalBind(GrGLGpu* gpu, GrGLuint vbufferID, GrG
Luint* ibufferID); |
| 443 |
| 424 GrGLuint fBoundVertexArrayID; | 444 GrGLuint fBoundVertexArrayID; |
| 425 GrGLuint fBoundVertexBufferID; | 445 GrGLuint fBoundVertexBufferID; |
| 426 bool fBoundVertexArrayIDIsValid; | 446 bool fBoundVertexArrayIDIsValid; |
| 427 bool fBoundVertexBufferIDIsValid; | 447 bool fBoundVertexBufferIDIsValid; |
| 428 | 448 |
| 429 GrGLuint fDefaultVertexArrayBoundIndexBufferID; | 449 GrGLuint fDefaultVertexArrayBoundIndexBufferID; |
| 430 bool fDefaultVertexArrayBoundIndexBufferIDIsValid; | 450 bool fDefaultVertexArrayBoundIndexBufferIDIsValid; |
| 431 // We return a non-const pointer to this from bindArrayAndBuffersToDraw
when vertex array 0 | 451 // We return a non-const pointer to this from bindArrayAndBuffersToDraw
when vertex array 0 |
| 432 // is bound. However, this class is internal to GrGLGpu and this object
never leaks out of | 452 // is bound. However, this class is internal to GrGLGpu and this object
never leaks out of |
| 433 // GrGLGpu. | 453 // GrGLGpu. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 447 | 467 |
| 448 void invalidate() { | 468 void invalidate() { |
| 449 fEquation = static_cast<GrBlendEquation>(-1); | 469 fEquation = static_cast<GrBlendEquation>(-1); |
| 450 fSrcCoeff = static_cast<GrBlendCoeff>(-1); | 470 fSrcCoeff = static_cast<GrBlendCoeff>(-1); |
| 451 fDstCoeff = static_cast<GrBlendCoeff>(-1); | 471 fDstCoeff = static_cast<GrBlendCoeff>(-1); |
| 452 fConstColorValid = false; | 472 fConstColorValid = false; |
| 453 fEnabled = kUnknown_TriState; | 473 fEnabled = kUnknown_TriState; |
| 454 } | 474 } |
| 455 } fHWBlendState; | 475 } fHWBlendState; |
| 456 | 476 |
| 477 /** IDs for copy surface program. */ |
| 478 struct { |
| 479 GrGLuint fProgram; |
| 480 GrGLint fTextureUniform; |
| 481 GrGLint fTexCoordXformUniform; |
| 482 GrGLint fPosXformUniform; |
| 483 GrGLuint fArrayBuffer; |
| 484 } fCopyProgram; |
| 485 |
| 457 TriState fMSAAEnabled; | 486 TriState fMSAAEnabled; |
| 458 | 487 |
| 459 GrStencilSettings fHWStencilSettings; | 488 GrStencilSettings fHWStencilSettings; |
| 460 TriState fHWStencilTestEnabled; | 489 TriState fHWStencilTestEnabled; |
| 461 | 490 |
| 462 | 491 |
| 463 GrPipelineBuilder::DrawFace fHWDrawFace; | 492 GrPipelineBuilder::DrawFace fHWDrawFace; |
| 464 TriState fHWWriteToColor; | 493 TriState fHWWriteToColor; |
| 465 TriState fHWDitherEnabled; | 494 TriState fHWDitherEnabled; |
| 466 uint32_t fHWBoundRenderTargetUniqueID; | 495 uint32_t fHWBoundRenderTargetUniqueID; |
| 467 SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs; | 496 SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs; |
| 468 | 497 |
| 469 ///@} | 498 ///@} |
| 470 | 499 |
| 471 // we record what stencil format worked last time to hopefully exit early | 500 // we record what stencil format worked last time to hopefully exit early |
| 472 // from our loop that tries stencil formats and calls check fb status. | 501 // from our loop that tries stencil formats and calls check fb status. |
| 473 int fLastSuccessfulStencilFmtIdx; | 502 int fLastSuccessfulStencilFmtIdx; |
| 474 | 503 |
| 475 typedef GrGpu INHERITED; | 504 typedef GrGpu INHERITED; |
| 476 friend class GrGLPathRendering; // For accessing setTextureUnit. | 505 friend class GrGLPathRendering; // For accessing setTextureUnit. |
| 477 }; | 506 }; |
| 478 | 507 |
| 479 #endif | 508 #endif |
| OLD | NEW |