| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 void initFSAASupport(); | 247 void initFSAASupport(); |
| 248 | 248 |
| 249 // determines valid stencil formats | 249 // determines valid stencil formats |
| 250 void initStencilFormats(); | 250 void initStencilFormats(); |
| 251 | 251 |
| 252 // sets a texture unit to use for texture operations other than binding a te
xture to a program. | 252 // sets a texture unit to use for texture operations other than binding a te
xture to a program. |
| 253 // ensures that such operations don't negatively interact with tracking boun
d textures. | 253 // ensures that such operations don't negatively interact with tracking boun
d textures. |
| 254 void setScratchTextureUnit(); | 254 void setScratchTextureUnit(); |
| 255 | 255 |
| 256 // bounds is region that may be modified and therefore has to be resolved. | 256 // bounds is region that may be modified and therefore has to be resolved. |
| 257 // NULL means whole target. Can be an empty rect. | 257 // nullptr means whole target. Can be an empty rect. |
| 258 void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); | 258 void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); |
| 259 | 259 |
| 260 void flushStencil(const GrStencilSettings&); | 260 void flushStencil(const GrStencilSettings&); |
| 261 void flushHWAAState(GrRenderTarget* rt, bool useHWAA); | 261 void flushHWAAState(GrRenderTarget* rt, bool useHWAA); |
| 262 | 262 |
| 263 bool configToGLFormats(GrPixelConfig config, | 263 bool configToGLFormats(GrPixelConfig config, |
| 264 bool getSizedInternal, | 264 bool getSizedInternal, |
| 265 GrGLenum* internalFormat, | 265 GrGLenum* internalFormat, |
| 266 GrGLenum* externalFormat, | 266 GrGLenum* externalFormat, |
| 267 GrGLenum* externalType) const; | 267 GrGLenum* externalType) const; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } | 332 } |
| 333 } fHWScissorSettings; | 333 } fHWScissorSettings; |
| 334 | 334 |
| 335 GrGLIRect fHWViewport; | 335 GrGLIRect fHWViewport; |
| 336 | 336 |
| 337 /** | 337 /** |
| 338 * Tracks bound vertex and index buffers and vertex attrib array state. | 338 * Tracks bound vertex and index buffers and vertex attrib array state. |
| 339 */ | 339 */ |
| 340 class HWGeometryState { | 340 class HWGeometryState { |
| 341 public: | 341 public: |
| 342 HWGeometryState() { fVBOVertexArray = NULL; this->invalidate(); } | 342 HWGeometryState() { fVBOVertexArray = nullptr; this->invalidate(); } |
| 343 | 343 |
| 344 ~HWGeometryState() { delete fVBOVertexArray; } | 344 ~HWGeometryState() { delete fVBOVertexArray; } |
| 345 | 345 |
| 346 void invalidate() { | 346 void invalidate() { |
| 347 fBoundVertexArrayIDIsValid = false; | 347 fBoundVertexArrayIDIsValid = false; |
| 348 fBoundVertexBufferIDIsValid = false; | 348 fBoundVertexBufferIDIsValid = false; |
| 349 fDefaultVertexArrayBoundIndexBufferID = false; | 349 fDefaultVertexArrayBoundIndexBufferID = false; |
| 350 fDefaultVertexArrayBoundIndexBufferIDIsValid = false; | 350 fDefaultVertexArrayBoundIndexBufferIDIsValid = false; |
| 351 fDefaultVertexArrayAttribState.invalidate(); | 351 fDefaultVertexArrayAttribState.invalidate(); |
| 352 if (fVBOVertexArray) { | 352 if (fVBOVertexArray) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 id != fDefaultVertexArrayBoundIndexBufferID) { | 411 id != fDefaultVertexArrayBoundIndexBufferID) { |
| 412 GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BU
FFER, id)); | 412 GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BU
FFER, id)); |
| 413 fDefaultVertexArrayBoundIndexBufferIDIsValid = true; | 413 fDefaultVertexArrayBoundIndexBufferIDIsValid = true; |
| 414 fDefaultVertexArrayBoundIndexBufferID = id; | 414 fDefaultVertexArrayBoundIndexBufferID = id; |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 | 417 |
| 418 /** | 418 /** |
| 419 * Binds the vertex array object that should be used to render from the
vertex buffer. | 419 * Binds the vertex array object that should be used to render from the
vertex buffer. |
| 420 * The vertex array is bound and its attrib array state object is return
ed. The vertex | 420 * The vertex array is bound and its attrib array state object is return
ed. The vertex |
| 421 * buffer is bound. The index buffer (if non-NULL) is bound to the verte
x array. The | 421 * buffer is bound. The index buffer (if non-nullptr) is bound to the ve
rtex array. The |
| 422 * returned GrGLAttribArrayState should be used to set vertex attribute
arrays. | 422 * returned GrGLAttribArrayState should be used to set vertex attribute
arrays. |
| 423 */ | 423 */ |
| 424 GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu, | 424 GrGLAttribArrayState* bindArrayAndBuffersToDraw(GrGLGpu* gpu, |
| 425 const GrGLVertexBuffer*
vbuffer, | 425 const GrGLVertexBuffer*
vbuffer, |
| 426 const GrGLIndexBuffer* i
buffer); | 426 const GrGLIndexBuffer* i
buffer); |
| 427 | 427 |
| 428 /** Variants of the above that takes GL buffer IDs. Note that 0 does not
imply that a | 428 /** Variants of the above that takes GL buffer IDs. Note that 0 does not
imply that a |
| 429 buffer won't be bound. The "default buffer" will be bound, which is
used for client-side | 429 buffer won't be bound. The "default buffer" will be bound, which is
used for client-side |
| 430 array rendering. */ | 430 array rendering. */ |
| 431 GrGLAttribArrayState* bindArrayAndBufferToDraw(GrGLGpu* gpu, GrGLuint vb
ufferID); | 431 GrGLAttribArrayState* bindArrayAndBufferToDraw(GrGLGpu* gpu, GrGLuint vb
ufferID); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 495 |
| 496 // we record what stencil format worked last time to hopefully exit early | 496 // we record what stencil format worked last time to hopefully exit early |
| 497 // from our loop that tries stencil formats and calls check fb status. | 497 // from our loop that tries stencil formats and calls check fb status. |
| 498 int fLastSuccessfulStencilFmtIdx; | 498 int fLastSuccessfulStencilFmtIdx; |
| 499 | 499 |
| 500 typedef GrGpu INHERITED; | 500 typedef GrGpu INHERITED; |
| 501 friend class GrGLPathRendering; // For accessing setTextureUnit. | 501 friend class GrGLPathRendering; // For accessing setTextureUnit. |
| 502 }; | 502 }; |
| 503 | 503 |
| 504 #endif | 504 #endif |
| OLD | NEW |