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 "GrEffect.h" | 10 #include "GrEffect.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } | 198 } |
199 ++fCurrLRUStamp; | 199 ++fCurrLRUStamp; |
200 return entry->fProgram; | 200 return entry->fProgram; |
201 } | 201 } |
202 | 202 |
203 //////////////////////////////////////////////////////////////////////////////// | 203 //////////////////////////////////////////////////////////////////////////////// |
204 | 204 |
205 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) | 205 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) |
206 | 206 |
207 bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
opy) { | 207 bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
opy) { |
208 SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState())
; | 208 SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState(*t
his->caps())); |
209 | 209 |
210 // GrGpu::setupClipAndFlushState should have already checked this and bailed
if not true. | 210 // GrGpu::setupClipAndFlushState should have already checked this and bailed
if not true. |
211 SkASSERT(optState->getRenderTarget()); | 211 SkASSERT(optState->getRenderTarget()); |
212 | 212 |
213 if (kStencilPath_DrawType == type) { | 213 if (kStencilPath_DrawType == type) { |
214 const GrRenderTarget* rt = optState->getRenderTarget(); | 214 const GrRenderTarget* rt = optState->getRenderTarget(); |
215 SkISize size; | 215 SkISize size; |
216 size.set(rt->width(), rt->height()); | 216 size.set(rt->width(), rt->height()); |
217 this->glPathRendering()->setProjectionMatrix(optState->getViewMatrix(),
size, rt->origin()); | 217 this->glPathRendering()->setProjectionMatrix(optState->getViewMatrix(),
size, rt->origin()); |
218 } else { | 218 } else { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 255 } |
256 | 256 |
257 fCurrentProgram.get()->ref(); | 257 fCurrentProgram.get()->ref(); |
258 | 258 |
259 GrGLuint programID = fCurrentProgram->programID(); | 259 GrGLuint programID = fCurrentProgram->programID(); |
260 if (fHWProgramID != programID) { | 260 if (fHWProgramID != programID) { |
261 GL_CALL(UseProgram(programID)); | 261 GL_CALL(UseProgram(programID)); |
262 fHWProgramID = programID; | 262 fHWProgramID = programID; |
263 } | 263 } |
264 | 264 |
265 fCurrentProgram->overrideBlend(&srcCoeff, &dstCoeff); | |
266 this->flushBlend(kDrawLines_DrawType == type, srcCoeff, dstCoeff); | 265 this->flushBlend(kDrawLines_DrawType == type, srcCoeff, dstCoeff); |
267 | 266 |
268 fCurrentProgram->setData(*optState.get(), | 267 fCurrentProgram->setData(*optState.get(), |
269 type, | 268 type, |
270 geometryProcessor, | 269 geometryProcessor, |
271 colorStages.begin(), | 270 colorStages.begin(), |
272 coverageStages.begin(), | 271 coverageStages.begin(), |
273 dstCopy, | 272 dstCopy, |
274 &fSharedGLProgramState); | 273 &fSharedGLProgramState); |
275 } | 274 } |
(...skipping 10 matching lines...) Expand all Loading... |
286 devRect = &devClipBounds; | 285 devRect = &devClipBounds; |
287 } | 286 } |
288 // This must come after textures are flushed because a texture may need | 287 // This must come after textures are flushed because a texture may need |
289 // to be msaa-resolved (which will modify bound FBO state). | 288 // to be msaa-resolved (which will modify bound FBO state). |
290 this->flushRenderTarget(glRT, devRect); | 289 this->flushRenderTarget(glRT, devRect); |
291 | 290 |
292 return true; | 291 return true; |
293 } | 292 } |
294 | 293 |
295 void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) { | 294 void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) { |
296 SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState())
; | 295 SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState(*t
his->caps())); |
297 | 296 |
298 GrGLsizei stride = static_cast<GrGLsizei>(optState->getVertexStride()); | 297 GrGLsizei stride = static_cast<GrGLsizei>(optState->getVertexStride()); |
299 | 298 |
300 size_t vertexOffsetInBytes = stride * info.startVertex(); | 299 size_t vertexOffsetInBytes = stride * info.startVertex(); |
301 | 300 |
302 const GeometryPoolState& geoPoolState = this->getGeomPoolState(); | 301 const GeometryPoolState& geoPoolState = this->getGeomPoolState(); |
303 | 302 |
304 GrGLVertexBuffer* vbuf; | 303 GrGLVertexBuffer* vbuf; |
305 switch (this->getGeomSrc().fVertexSrc) { | 304 switch (this->getGeomSrc().fVertexSrc) { |
306 case kBuffer_GeometrySrcType: | 305 case kBuffer_GeometrySrcType: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 GrGLAttribTypeToLayout(attribType).fCount, | 362 GrGLAttribTypeToLayout(attribType).fCount, |
364 GrGLAttribTypeToLayout(attribType).fType, | 363 GrGLAttribTypeToLayout(attribType).fType, |
365 GrGLAttribTypeToLayout(attribType).fNormalized, | 364 GrGLAttribTypeToLayout(attribType).fNormalized, |
366 stride, | 365 stride, |
367 reinterpret_cast<GrGLvoid*>( | 366 reinterpret_cast<GrGLvoid*>( |
368 vertexOffsetInBytes + vertexAttrib->fOffset)); | 367 vertexOffsetInBytes + vertexAttrib->fOffset)); |
369 } | 368 } |
370 attribState->disableUnusedArrays(this, usedAttribArraysMask); | 369 attribState->disableUnusedArrays(this, usedAttribArraysMask); |
371 } | 370 } |
372 } | 371 } |
OLD | NEW |