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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 337 |
338 SkASSERT(NULL != ibuf); | 338 SkASSERT(NULL != ibuf); |
339 SkASSERT(!ibuf->isLocked()); | 339 SkASSERT(!ibuf->isLocked()); |
340 *indexOffsetInBytes += ibuf->baseOffset(); | 340 *indexOffsetInBytes += ibuf->baseOffset(); |
341 } | 341 } |
342 GrGLAttribArrayState* attribState = | 342 GrGLAttribArrayState* attribState = |
343 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf); | 343 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf); |
344 | 344 |
345 if (!fCurrentProgram->hasVertexShader()) { | 345 if (!fCurrentProgram->hasVertexShader()) { |
346 int posIdx = this->getDrawState().positionAttributeIndex(); | 346 int posIdx = this->getDrawState().positionAttributeIndex(); |
347 const GrVertexAttrib* vertexArray = this->getDrawState().getVertexAttrib
s() + posIdx; | 347 const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttri
bs() + posIdx; |
348 GrVertexAttribType vertexArrayType = vertexArray->fType; | 348 GrVertexAttribType attribType = vertexAttrib->fType; |
349 SkASSERT(!GrGLAttribTypeToLayout(vertexArrayType).fNormalized); | 349 SkASSERT(!GrGLAttribTypeToLayout(attribType).fNormalized); |
350 SkASSERT(GrGLAttribTypeToLayout(vertexArrayType).fCount == 2); | 350 SkASSERT(GrGLAttribTypeToLayout(attribType).fCount == 2); |
351 attribState->setFixedFunctionVertexArray(this, | 351 |
352 vbuf, | 352 // Attrib at location 0 is defined to be bound to vertex in fixed-functi
on pipe. Asserts |
353 2, | 353 // above should make sure position attribute goes to location 0 when bel
ow code is executed. |
354 GrGLAttribTypeToLayout(vertexAr
rayType).fType, | 354 |
355 stride, | 355 attribState->set(this, |
356 reinterpret_cast<GrGLvoid*>( | 356 0, |
357 vertexOffsetInBytes + vertexArr
ay->fOffset)); | 357 vbuf, |
358 attribState->disableUnusedArrays(this, 0, true); | 358 GrGLAttribTypeToLayout(attribType).fCount, |
| 359 GrGLAttribTypeToLayout(attribType).fType, |
| 360 GrGLAttribTypeToLayout(attribType).fNormalized, |
| 361 stride, |
| 362 reinterpret_cast<GrGLvoid*>( |
| 363 vertexOffsetInBytes + vertexAttrib->fOffset)); |
| 364 attribState->disableUnusedArrays(this, 1); |
359 } else { | 365 } else { |
| 366 int vertexAttribCount = this->getDrawState().getVertexAttribCount(); |
360 uint32_t usedAttribArraysMask = 0; | 367 uint32_t usedAttribArraysMask = 0; |
361 const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttri
bs(); | 368 const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttri
bs(); |
362 int vertexAttribCount = this->getDrawState().getVertexAttribCount(); | 369 |
363 for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount; | 370 for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount; |
364 ++vertexAttribIndex, ++vertexAttrib) { | 371 ++vertexAttribIndex, ++vertexAttrib) { |
365 | 372 |
366 usedAttribArraysMask |= (1 << vertexAttribIndex); | 373 usedAttribArraysMask |= (1 << vertexAttribIndex); |
367 GrVertexAttribType attribType = vertexAttrib->fType; | 374 GrVertexAttribType attribType = vertexAttrib->fType; |
368 attribState->set(this, | 375 attribState->set(this, |
369 vertexAttribIndex, | 376 vertexAttribIndex, |
370 vbuf, | 377 vbuf, |
371 GrGLAttribTypeToLayout(attribType).fCount, | 378 GrGLAttribTypeToLayout(attribType).fCount, |
372 GrGLAttribTypeToLayout(attribType).fType, | 379 GrGLAttribTypeToLayout(attribType).fType, |
373 GrGLAttribTypeToLayout(attribType).fNormalized, | 380 GrGLAttribTypeToLayout(attribType).fNormalized, |
374 stride, | 381 stride, |
375 reinterpret_cast<GrGLvoid*>( | 382 reinterpret_cast<GrGLvoid*>( |
376 vertexOffsetInBytes + vertexAttrib->fOffset)); | 383 vertexOffsetInBytes + vertexAttrib->fOffset)); |
377 } | 384 } |
378 | 385 attribState->disableUnusedArrays(this, usedAttribArraysMask); |
379 attribState->disableUnusedArrays(this, usedAttribArraysMask, false); | |
380 } | 386 } |
381 } | 387 } |
OLD | NEW |