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 "GrProcessor.h" | 10 #include "GrProcessor.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 199 } |
200 ++fCurrLRUStamp; | 200 ++fCurrLRUStamp; |
201 return entry->fProgram; | 201 return entry->fProgram; |
202 } | 202 } |
203 | 203 |
204 //////////////////////////////////////////////////////////////////////////////// | 204 //////////////////////////////////////////////////////////////////////////////// |
205 | 205 |
206 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) | 206 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) |
207 | 207 |
208 bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
opy) { | 208 bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
opy) { |
209 SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState(*t
his->caps())); | 209 SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(this->getDrawSt
ate(), |
| 210 *this->caps(), |
| 211 type)); |
| 212 |
| 213 if (!optState) { |
| 214 return false; |
| 215 } |
210 | 216 |
211 // 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. |
212 SkASSERT(optState->getRenderTarget()); | 218 SkASSERT(optState->getRenderTarget()); |
213 | 219 |
214 if (kStencilPath_DrawType == type) { | 220 if (kStencilPath_DrawType == type) { |
215 const GrRenderTarget* rt = optState->getRenderTarget(); | 221 const GrRenderTarget* rt = optState->getRenderTarget(); |
216 SkISize size; | 222 SkISize size; |
217 size.set(rt->width(), rt->height()); | 223 size.set(rt->width(), rt->height()); |
218 this->glPathRendering()->setProjectionMatrix(optState->getViewMatrix(),
size, rt->origin()); | 224 this->glPathRendering()->setProjectionMatrix(optState->getViewMatrix(),
size, rt->origin()); |
219 } else { | 225 } else { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 devRect = &devClipBounds; | 293 devRect = &devClipBounds; |
288 } | 294 } |
289 // This must come after textures are flushed because a texture may need | 295 // This must come after textures are flushed because a texture may need |
290 // to be msaa-resolved (which will modify bound FBO state). | 296 // to be msaa-resolved (which will modify bound FBO state). |
291 this->flushRenderTarget(glRT, devRect); | 297 this->flushRenderTarget(glRT, devRect); |
292 | 298 |
293 return true; | 299 return true; |
294 } | 300 } |
295 | 301 |
296 void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) { | 302 void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) { |
297 SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState(*t
his->caps())); | 303 SkAutoTUnref<GrOptDrawState> optState( |
| 304 GrOptDrawState::Create(this->getDrawState(), *this->caps(), |
| 305 PrimTypeToDrawType(info.primitiveType()))); |
| 306 |
| 307 // If the optState would is NULL it should have been caught in flushGraphics
State before getting |
| 308 // here. |
| 309 SkASSERT(optState); |
298 | 310 |
299 GrGLsizei stride = static_cast<GrGLsizei>(optState->getVertexStride()); | 311 GrGLsizei stride = static_cast<GrGLsizei>(optState->getVertexStride()); |
300 | 312 |
301 size_t vertexOffsetInBytes = stride * info.startVertex(); | 313 size_t vertexOffsetInBytes = stride * info.startVertex(); |
302 | 314 |
303 const GeometryPoolState& geoPoolState = this->getGeomPoolState(); | 315 const GeometryPoolState& geoPoolState = this->getGeomPoolState(); |
304 | 316 |
305 GrGLVertexBuffer* vbuf; | 317 GrGLVertexBuffer* vbuf; |
306 switch (this->getGeomSrc().fVertexSrc) { | 318 switch (this->getGeomSrc().fVertexSrc) { |
307 case kBuffer_GeometrySrcType: | 319 case kBuffer_GeometrySrcType: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 GrGLAttribTypeToLayout(attribType).fCount, | 376 GrGLAttribTypeToLayout(attribType).fCount, |
365 GrGLAttribTypeToLayout(attribType).fType, | 377 GrGLAttribTypeToLayout(attribType).fType, |
366 GrGLAttribTypeToLayout(attribType).fNormalized, | 378 GrGLAttribTypeToLayout(attribType).fNormalized, |
367 stride, | 379 stride, |
368 reinterpret_cast<GrGLvoid*>( | 380 reinterpret_cast<GrGLvoid*>( |
369 vertexOffsetInBytes + vertexAttrib->fOffset)); | 381 vertexOffsetInBytes + vertexAttrib->fOffset)); |
370 } | 382 } |
371 attribState->disableUnusedArrays(this, usedAttribArraysMask); | 383 attribState->disableUnusedArrays(this, usedAttribArraysMask); |
372 } | 384 } |
373 } | 385 } |
OLD | NEW |