| 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 | 8 |
| 9 #include "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
| 10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
| (...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 *indexOffsetInBytes = 0; | 1401 *indexOffsetInBytes = 0; |
| 1402 ibuf = (GrGLIndexBuffer*)info.indexBuffer(); | 1402 ibuf = (GrGLIndexBuffer*)info.indexBuffer(); |
| 1403 | 1403 |
| 1404 SkASSERT(ibuf); | 1404 SkASSERT(ibuf); |
| 1405 SkASSERT(!ibuf->isMapped()); | 1405 SkASSERT(!ibuf->isMapped()); |
| 1406 *indexOffsetInBytes += ibuf->baseOffset(); | 1406 *indexOffsetInBytes += ibuf->baseOffset(); |
| 1407 } | 1407 } |
| 1408 GrGLAttribArrayState* attribState = | 1408 GrGLAttribArrayState* attribState = |
| 1409 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf); | 1409 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf); |
| 1410 | 1410 |
| 1411 if (fCurrentProgram->hasVertexShader()) { | 1411 const GrPrimitiveProcessor* primProc = optState.getPrimitiveProcessor(); |
| 1412 const GrGeometryProcessor* gp = optState.getGeometryProcessor(); | 1412 if (primProc->getAttribs().count() > 0) { |
| 1413 | 1413 |
| 1414 GrGLsizei stride = static_cast<GrGLsizei>(gp->getVertexStride()); | 1414 GrGLsizei stride = static_cast<GrGLsizei>(primProc->getVertexStride()); |
| 1415 | 1415 |
| 1416 size_t vertexOffsetInBytes = stride * info.startVertex(); | 1416 size_t vertexOffsetInBytes = stride * info.startVertex(); |
| 1417 | 1417 |
| 1418 vertexOffsetInBytes += vbuf->baseOffset(); | 1418 vertexOffsetInBytes += vbuf->baseOffset(); |
| 1419 | 1419 |
| 1420 const SkTArray<GrGeometryProcessor::GrAttribute, true>& attribs = gp->ge
tAttribs(); | 1420 const SkTArray<GrGeometryProcessor::GrAttribute, true>& attribs = primPr
oc->getAttribs(); |
| 1421 int vaCount = attribs.count(); | 1421 int vaCount = attribs.count(); |
| 1422 uint32_t usedAttribArraysMask = 0; | 1422 uint32_t usedAttribArraysMask = 0; |
| 1423 size_t offset = 0; | 1423 size_t offset = 0; |
| 1424 | 1424 |
| 1425 for (int attribIndex = 0; attribIndex < vaCount; attribIndex++) { | 1425 for (int attribIndex = 0; attribIndex < vaCount; attribIndex++) { |
| 1426 usedAttribArraysMask |= (1 << attribIndex); | 1426 usedAttribArraysMask |= (1 << attribIndex); |
| 1427 GrVertexAttribType attribType = attribs[attribIndex].fType; | 1427 GrVertexAttribType attribType = attribs[attribIndex].fType; |
| 1428 attribState->set(this, | 1428 attribState->set(this, |
| 1429 attribIndex, | 1429 attribIndex, |
| 1430 vbuf, | 1430 vbuf, |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2750 this->setVertexArrayID(gpu, 0); | 2750 this->setVertexArrayID(gpu, 0); |
| 2751 } | 2751 } |
| 2752 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2752 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2753 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2753 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2754 fDefaultVertexArrayAttribState.resize(attrCount); | 2754 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2755 } | 2755 } |
| 2756 attribState = &fDefaultVertexArrayAttribState; | 2756 attribState = &fDefaultVertexArrayAttribState; |
| 2757 } | 2757 } |
| 2758 return attribState; | 2758 return attribState; |
| 2759 } | 2759 } |
| OLD | NEW |