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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 283 |
284 size_t vertexOffsetInBytes = stride * info.startVertex(); | 284 size_t vertexOffsetInBytes = stride * info.startVertex(); |
285 | 285 |
286 const GeometryPoolState& geoPoolState = this->getGeomPoolState(); | 286 const GeometryPoolState& geoPoolState = this->getGeomPoolState(); |
287 | 287 |
288 GrGLVertexBuffer* vbuf; | 288 GrGLVertexBuffer* vbuf; |
289 switch (this->getGeomSrc().fVertexSrc) { | 289 switch (this->getGeomSrc().fVertexSrc) { |
290 case kBuffer_GeometrySrcType: | 290 case kBuffer_GeometrySrcType: |
291 vbuf = (GrGLVertexBuffer*) this->getGeomSrc().fVertexBuffer; | 291 vbuf = (GrGLVertexBuffer*) this->getGeomSrc().fVertexBuffer; |
292 break; | 292 break; |
293 case kArray_GeometrySrcType: | |
294 case kReserved_GeometrySrcType: | 293 case kReserved_GeometrySrcType: |
295 this->finalizeReservedVertices(); | 294 this->finalizeReservedVertices(); |
296 vertexOffsetInBytes += geoPoolState.fPoolStartVertex * this->getGeom
Src().fVertexSize; | 295 vertexOffsetInBytes += geoPoolState.fPoolStartVertex * this->getGeom
Src().fVertexSize; |
297 vbuf = (GrGLVertexBuffer*) geoPoolState.fPoolVertexBuffer; | 296 vbuf = (GrGLVertexBuffer*) geoPoolState.fPoolVertexBuffer; |
298 break; | 297 break; |
299 default: | 298 default: |
300 vbuf = NULL; // suppress warning | 299 vbuf = NULL; // suppress warning |
301 SkFAIL("Unknown geometry src type!"); | 300 SkFAIL("Unknown geometry src type!"); |
302 } | 301 } |
303 | 302 |
304 SkASSERT(vbuf); | 303 SkASSERT(vbuf); |
305 SkASSERT(!vbuf->isMapped()); | 304 SkASSERT(!vbuf->isMapped()); |
306 vertexOffsetInBytes += vbuf->baseOffset(); | 305 vertexOffsetInBytes += vbuf->baseOffset(); |
307 | 306 |
308 GrGLIndexBuffer* ibuf = NULL; | 307 GrGLIndexBuffer* ibuf = NULL; |
309 if (info.isIndexed()) { | 308 if (info.isIndexed()) { |
310 SkASSERT(indexOffsetInBytes); | 309 SkASSERT(indexOffsetInBytes); |
311 | 310 |
312 switch (this->getGeomSrc().fIndexSrc) { | 311 switch (this->getGeomSrc().fIndexSrc) { |
313 case kBuffer_GeometrySrcType: | 312 case kBuffer_GeometrySrcType: |
314 *indexOffsetInBytes = 0; | 313 *indexOffsetInBytes = 0; |
315 ibuf = (GrGLIndexBuffer*)this->getGeomSrc().fIndexBuffer; | 314 ibuf = (GrGLIndexBuffer*)this->getGeomSrc().fIndexBuffer; |
316 break; | 315 break; |
317 case kArray_GeometrySrcType: | |
318 case kReserved_GeometrySrcType: | 316 case kReserved_GeometrySrcType: |
319 this->finalizeReservedIndices(); | 317 this->finalizeReservedIndices(); |
320 *indexOffsetInBytes = geoPoolState.fPoolStartIndex * sizeof(GrGLusho
rt); | 318 *indexOffsetInBytes = geoPoolState.fPoolStartIndex * sizeof(GrGLusho
rt); |
321 ibuf = (GrGLIndexBuffer*) geoPoolState.fPoolIndexBuffer; | 319 ibuf = (GrGLIndexBuffer*) geoPoolState.fPoolIndexBuffer; |
322 break; | 320 break; |
323 default: | 321 default: |
324 ibuf = NULL; // suppress warning | 322 ibuf = NULL; // suppress warning |
325 SkFAIL("Unknown geometry src type!"); | 323 SkFAIL("Unknown geometry src type!"); |
326 } | 324 } |
327 | 325 |
(...skipping 29 matching lines...) Expand all Loading... |
357 | 355 |
358 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState, | 356 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState, |
359 const GrProgramDesc::DescInfo& descInfo, | 357 const GrProgramDesc::DescInfo& descInfo, |
360 GrGpu::DrawType drawType, | 358 GrGpu::DrawType drawType, |
361 const GrDeviceCoordTexture* dstCopy, | 359 const GrDeviceCoordTexture* dstCopy, |
362 GrProgramDesc* desc) { | 360 GrProgramDesc* desc) { |
363 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, dstCo
py, desc)) { | 361 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, dstCo
py, desc)) { |
364 SkDEBUGFAIL("Failed to generate GL program descriptor"); | 362 SkDEBUGFAIL("Failed to generate GL program descriptor"); |
365 } | 363 } |
366 } | 364 } |
OLD | NEW |