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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 this->finalizeReservedVertices(); | 306 this->finalizeReservedVertices(); |
307 vertexOffsetInBytes += geoPoolState.fPoolStartVertex * this->getGeom
Src().fVertexSize; | 307 vertexOffsetInBytes += geoPoolState.fPoolStartVertex * this->getGeom
Src().fVertexSize; |
308 vbuf = (GrGLVertexBuffer*) geoPoolState.fPoolVertexBuffer; | 308 vbuf = (GrGLVertexBuffer*) geoPoolState.fPoolVertexBuffer; |
309 break; | 309 break; |
310 default: | 310 default: |
311 vbuf = NULL; // suppress warning | 311 vbuf = NULL; // suppress warning |
312 SkFAIL("Unknown geometry src type!"); | 312 SkFAIL("Unknown geometry src type!"); |
313 } | 313 } |
314 | 314 |
315 SkASSERT(NULL != vbuf); | 315 SkASSERT(NULL != vbuf); |
316 SkASSERT(!vbuf->isLocked()); | 316 SkASSERT(!vbuf->isMapped()); |
317 vertexOffsetInBytes += vbuf->baseOffset(); | 317 vertexOffsetInBytes += vbuf->baseOffset(); |
318 | 318 |
319 GrGLIndexBuffer* ibuf = NULL; | 319 GrGLIndexBuffer* ibuf = NULL; |
320 if (info.isIndexed()) { | 320 if (info.isIndexed()) { |
321 SkASSERT(NULL != indexOffsetInBytes); | 321 SkASSERT(NULL != indexOffsetInBytes); |
322 | 322 |
323 switch (this->getGeomSrc().fIndexSrc) { | 323 switch (this->getGeomSrc().fIndexSrc) { |
324 case kBuffer_GeometrySrcType: | 324 case kBuffer_GeometrySrcType: |
325 *indexOffsetInBytes = 0; | 325 *indexOffsetInBytes = 0; |
326 ibuf = (GrGLIndexBuffer*)this->getGeomSrc().fIndexBuffer; | 326 ibuf = (GrGLIndexBuffer*)this->getGeomSrc().fIndexBuffer; |
327 break; | 327 break; |
328 case kArray_GeometrySrcType: | 328 case kArray_GeometrySrcType: |
329 case kReserved_GeometrySrcType: | 329 case kReserved_GeometrySrcType: |
330 this->finalizeReservedIndices(); | 330 this->finalizeReservedIndices(); |
331 *indexOffsetInBytes = geoPoolState.fPoolStartIndex * sizeof(GrGLusho
rt); | 331 *indexOffsetInBytes = geoPoolState.fPoolStartIndex * sizeof(GrGLusho
rt); |
332 ibuf = (GrGLIndexBuffer*) geoPoolState.fPoolIndexBuffer; | 332 ibuf = (GrGLIndexBuffer*) geoPoolState.fPoolIndexBuffer; |
333 break; | 333 break; |
334 default: | 334 default: |
335 ibuf = NULL; // suppress warning | 335 ibuf = NULL; // suppress warning |
336 SkFAIL("Unknown geometry src type!"); | 336 SkFAIL("Unknown geometry src type!"); |
337 } | 337 } |
338 | 338 |
339 SkASSERT(NULL != ibuf); | 339 SkASSERT(NULL != ibuf); |
340 SkASSERT(!ibuf->isLocked()); | 340 SkASSERT(!ibuf->isMapped()); |
341 *indexOffsetInBytes += ibuf->baseOffset(); | 341 *indexOffsetInBytes += ibuf->baseOffset(); |
342 } | 342 } |
343 GrGLAttribArrayState* attribState = | 343 GrGLAttribArrayState* attribState = |
344 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf); | 344 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf); |
345 | 345 |
346 if (fCurrentProgram->hasVertexShader()) { | 346 if (fCurrentProgram->hasVertexShader()) { |
347 int vertexAttribCount = this->getDrawState().getVertexAttribCount(); | 347 int vertexAttribCount = this->getDrawState().getVertexAttribCount(); |
348 uint32_t usedAttribArraysMask = 0; | 348 uint32_t usedAttribArraysMask = 0; |
349 const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttri
bs(); | 349 const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttri
bs(); |
350 | 350 |
351 for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount; | 351 for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount; |
352 ++vertexAttribIndex, ++vertexAttrib) { | 352 ++vertexAttribIndex, ++vertexAttrib) { |
353 | 353 |
354 usedAttribArraysMask |= (1 << vertexAttribIndex); | 354 usedAttribArraysMask |= (1 << vertexAttribIndex); |
355 GrVertexAttribType attribType = vertexAttrib->fType; | 355 GrVertexAttribType attribType = vertexAttrib->fType; |
356 attribState->set(this, | 356 attribState->set(this, |
357 vertexAttribIndex, | 357 vertexAttribIndex, |
358 vbuf, | 358 vbuf, |
359 GrGLAttribTypeToLayout(attribType).fCount, | 359 GrGLAttribTypeToLayout(attribType).fCount, |
360 GrGLAttribTypeToLayout(attribType).fType, | 360 GrGLAttribTypeToLayout(attribType).fType, |
361 GrGLAttribTypeToLayout(attribType).fNormalized, | 361 GrGLAttribTypeToLayout(attribType).fNormalized, |
362 stride, | 362 stride, |
363 reinterpret_cast<GrGLvoid*>( | 363 reinterpret_cast<GrGLvoid*>( |
364 vertexOffsetInBytes + vertexAttrib->fOffset)); | 364 vertexOffsetInBytes + vertexAttrib->fOffset)); |
365 } | 365 } |
366 attribState->disableUnusedArrays(this, usedAttribArraysMask); | 366 attribState->disableUnusedArrays(this, usedAttribArraysMask); |
367 } | 367 } |
368 } | 368 } |
OLD | NEW |