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 "builders/GrGLProgramBuilder.h" | 10 #include "builders/GrGLProgramBuilder.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 257 } |
258 | 258 |
259 void GrGpuGL::setupGeometry(const GrOptDrawState& optState, | 259 void GrGpuGL::setupGeometry(const GrOptDrawState& optState, |
260 const GrDrawTarget::DrawInfo& info, | 260 const GrDrawTarget::DrawInfo& info, |
261 size_t* indexOffsetInBytes) { | 261 size_t* indexOffsetInBytes) { |
262 GrGLsizei stride = static_cast<GrGLsizei>(optState.getVertexStride()); | 262 GrGLsizei stride = static_cast<GrGLsizei>(optState.getVertexStride()); |
263 | 263 |
264 size_t vertexOffsetInBytes = stride * info.startVertex(); | 264 size_t vertexOffsetInBytes = stride * info.startVertex(); |
265 | 265 |
266 GrGLVertexBuffer* vbuf; | 266 GrGLVertexBuffer* vbuf; |
267 vbuf = (GrGLVertexBuffer*) this->getGeomSrc().fVertexBuffer; | 267 vbuf = (GrGLVertexBuffer*) info.vertexBuffer(); |
268 | 268 |
269 SkASSERT(vbuf); | 269 SkASSERT(vbuf); |
270 SkASSERT(!vbuf->isMapped()); | 270 SkASSERT(!vbuf->isMapped()); |
271 vertexOffsetInBytes += vbuf->baseOffset(); | 271 vertexOffsetInBytes += vbuf->baseOffset(); |
272 | 272 |
273 GrGLIndexBuffer* ibuf = NULL; | 273 GrGLIndexBuffer* ibuf = NULL; |
274 if (info.isIndexed()) { | 274 if (info.isIndexed()) { |
275 SkASSERT(indexOffsetInBytes); | 275 SkASSERT(indexOffsetInBytes); |
276 | 276 |
277 *indexOffsetInBytes = 0; | 277 *indexOffsetInBytes = 0; |
278 ibuf = (GrGLIndexBuffer*)this->getGeomSrc().fIndexBuffer; | 278 ibuf = (GrGLIndexBuffer*)info.indexBuffer(); |
279 | 279 |
280 SkASSERT(ibuf); | 280 SkASSERT(ibuf); |
281 SkASSERT(!ibuf->isMapped()); | 281 SkASSERT(!ibuf->isMapped()); |
282 *indexOffsetInBytes += ibuf->baseOffset(); | 282 *indexOffsetInBytes += ibuf->baseOffset(); |
283 } | 283 } |
284 GrGLAttribArrayState* attribState = | 284 GrGLAttribArrayState* attribState = |
285 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf); | 285 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf); |
286 | 286 |
287 if (fCurrentProgram->hasVertexShader()) { | 287 if (fCurrentProgram->hasVertexShader()) { |
288 int vertexAttribCount = optState.getVertexAttribCount(); | 288 int vertexAttribCount = optState.getVertexAttribCount(); |
(...skipping 20 matching lines...) Expand all Loading... |
309 | 309 |
310 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState, | 310 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState, |
311 const GrProgramDesc::DescInfo& descInfo, | 311 const GrProgramDesc::DescInfo& descInfo, |
312 GrGpu::DrawType drawType, | 312 GrGpu::DrawType drawType, |
313 const GrDeviceCoordTexture* dstCopy, | 313 const GrDeviceCoordTexture* dstCopy, |
314 GrProgramDesc* desc) { | 314 GrProgramDesc* desc) { |
315 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, dstCo
py, desc)) { | 315 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, dstCo
py, desc)) { |
316 SkDEBUGFAIL("Failed to generate GL program descriptor"); | 316 SkDEBUGFAIL("Failed to generate GL program descriptor"); |
317 } | 317 } |
318 } | 318 } |
OLD | NEW |