| 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 #include "GrGpuGL.h" | 8 #include "GrGpuGL.h" |
| 9 | 9 |
| 10 #include "builders/GrGLProgramBuilder.h" | 10 #include "builders/GrGLProgramBuilder.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 ++fCurrLRUStamp; | 198 ++fCurrLRUStamp; |
| 199 return entry->fProgram; | 199 return entry->fProgram; |
| 200 } | 200 } |
| 201 | 201 |
| 202 //////////////////////////////////////////////////////////////////////////////// | 202 //////////////////////////////////////////////////////////////////////////////// |
| 203 | 203 |
| 204 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) | 204 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) |
| 205 | 205 |
| 206 bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
opy) { | 206 bool GrGpuGL::flushGraphicsState(DrawType type, |
| 207 const ScissorState& scissorState, |
| 208 const GrDeviceCoordTexture* dstCopy) { |
| 207 SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(this->getDrawSt
ate(), | 209 SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(this->getDrawSt
ate(), |
| 208 *this->caps(), | 210 *this->caps(), |
| 209 type)); | 211 type)); |
| 210 | 212 |
| 211 if (!optState) { | 213 if (!optState) { |
| 212 return false; | 214 return false; |
| 213 } | 215 } |
| 214 | 216 |
| 215 // GrGpu::setupClipAndFlushState should have already checked this and bailed
if not true. | 217 // GrGpu::setupClipAndFlushState should have already checked this and bailed
if not true. |
| 216 SkASSERT(optState->getRenderTarget()); | 218 SkASSERT(optState->getRenderTarget()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 fHWProgramID = programID; | 254 fHWProgramID = programID; |
| 253 } | 255 } |
| 254 | 256 |
| 255 this->flushBlend(*optState.get(), kDrawLines_DrawType == type, srcCoeff,
dstCoeff); | 257 this->flushBlend(*optState.get(), kDrawLines_DrawType == type, srcCoeff,
dstCoeff); |
| 256 | 258 |
| 257 fCurrentProgram->setData(*optState.get(), type, dstCopy, &fSharedGLProgr
amState); | 259 fCurrentProgram->setData(*optState.get(), type, dstCopy, &fSharedGLProgr
amState); |
| 258 } | 260 } |
| 259 | 261 |
| 260 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState->getRenderT
arget()); | 262 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState->getRenderT
arget()); |
| 261 this->flushStencil(optState->getStencil(), type); | 263 this->flushStencil(optState->getStencil(), type); |
| 262 this->flushScissor(glRT->getViewport(), glRT->origin()); | 264 this->flushScissor(scissorState, glRT->getViewport(), glRT->origin()); |
| 263 this->flushAAState(*optState.get(), type); | 265 this->flushAAState(*optState.get(), type); |
| 264 | 266 |
| 265 SkIRect* devRect = NULL; | 267 SkIRect* devRect = NULL; |
| 266 SkIRect devClipBounds; | 268 SkIRect devClipBounds; |
| 267 if (optState->isClipState()) { | 269 if (optState->isClipState()) { |
| 268 this->getClip()->getConservativeBounds(optState->getRenderTarget(), &dev
ClipBounds); | 270 this->getClip()->getConservativeBounds(optState->getRenderTarget(), &dev
ClipBounds); |
| 269 devRect = &devClipBounds; | 271 devRect = &devClipBounds; |
| 270 } | 272 } |
| 271 // This must come after textures are flushed because a texture may need | 273 // This must come after textures are flushed because a texture may need |
| 272 // to be msaa-resolved (which will modify bound FBO state). | 274 // to be msaa-resolved (which will modify bound FBO state). |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 GrGLAttribTypeToLayout(attribType).fCount, | 354 GrGLAttribTypeToLayout(attribType).fCount, |
| 353 GrGLAttribTypeToLayout(attribType).fType, | 355 GrGLAttribTypeToLayout(attribType).fType, |
| 354 GrGLAttribTypeToLayout(attribType).fNormalized, | 356 GrGLAttribTypeToLayout(attribType).fNormalized, |
| 355 stride, | 357 stride, |
| 356 reinterpret_cast<GrGLvoid*>( | 358 reinterpret_cast<GrGLvoid*>( |
| 357 vertexOffsetInBytes + vertexAttrib->fOffset)); | 359 vertexOffsetInBytes + vertexAttrib->fOffset)); |
| 358 } | 360 } |
| 359 attribState->disableUnusedArrays(this, usedAttribArraysMask); | 361 attribState->disableUnusedArrays(this, usedAttribArraysMask); |
| 360 } | 362 } |
| 361 } | 363 } |
| OLD | NEW |