Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: src/gpu/gl/GrGpuGL_program.cpp

Issue 707953004: cleaning up geometry handling in gpu (Closed) Base URL: https://skia.googlesource.com/skia.git@solo_gpu
Patch Set: rebase try 2 Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 PrimTypeToDrawType(info.primitiveType()))); 270 PrimTypeToDrawType(info.primitiveType())));
271 271
272 // If the optState would is NULL it should have been caught in flushGraphics State before getting 272 // If the optState would is NULL it should have been caught in flushGraphics State before getting
273 // here. 273 // here.
274 SkASSERT(optState); 274 SkASSERT(optState);
275 275
276 GrGLsizei stride = static_cast<GrGLsizei>(optState->getVertexStride()); 276 GrGLsizei stride = static_cast<GrGLsizei>(optState->getVertexStride());
277 277
278 size_t vertexOffsetInBytes = stride * info.startVertex(); 278 size_t vertexOffsetInBytes = stride * info.startVertex();
279 279
280 const GeometryPoolState& geoPoolState = this->getGeomPoolState();
281
282 GrGLVertexBuffer* vbuf; 280 GrGLVertexBuffer* vbuf;
283 switch (this->getGeomSrc().fVertexSrc) { 281 vbuf = (GrGLVertexBuffer*) this->getGeomSrc().fVertexBuffer;
284 case GrDrawTarget::kBuffer_GeometrySrcType:
285 vbuf = (GrGLVertexBuffer*) this->getGeomSrc().fVertexBuffer;
286 break;
287 case GrDrawTarget::kReserved_GeometrySrcType:
288 this->finalizeReservedVertices();
289 vertexOffsetInBytes += geoPoolState.fPoolStartVertex * this->getGeom Src().fVertexSize;
290 vbuf = (GrGLVertexBuffer*) geoPoolState.fPoolVertexBuffer;
291 break;
292 default:
293 vbuf = NULL; // suppress warning
294 SkFAIL("Unknown geometry src type!");
295 }
296 282
297 SkASSERT(vbuf); 283 SkASSERT(vbuf);
298 SkASSERT(!vbuf->isMapped()); 284 SkASSERT(!vbuf->isMapped());
299 vertexOffsetInBytes += vbuf->baseOffset(); 285 vertexOffsetInBytes += vbuf->baseOffset();
300 286
301 GrGLIndexBuffer* ibuf = NULL; 287 GrGLIndexBuffer* ibuf = NULL;
302 if (info.isIndexed()) { 288 if (info.isIndexed()) {
303 SkASSERT(indexOffsetInBytes); 289 SkASSERT(indexOffsetInBytes);
304 290
305 switch (this->getGeomSrc().fIndexSrc) { 291 *indexOffsetInBytes = 0;
306 case GrDrawTarget::kBuffer_GeometrySrcType: 292 ibuf = (GrGLIndexBuffer*)this->getGeomSrc().fIndexBuffer;
307 *indexOffsetInBytes = 0;
308 ibuf = (GrGLIndexBuffer*)this->getGeomSrc().fIndexBuffer;
309 break;
310 case GrDrawTarget::kReserved_GeometrySrcType:
311 this->finalizeReservedIndices();
312 *indexOffsetInBytes = geoPoolState.fPoolStartIndex * sizeof(GrGLusho rt);
313 ibuf = (GrGLIndexBuffer*) geoPoolState.fPoolIndexBuffer;
314 break;
315 default:
316 ibuf = NULL; // suppress warning
317 SkFAIL("Unknown geometry src type!");
318 }
319 293
320 SkASSERT(ibuf); 294 SkASSERT(ibuf);
321 SkASSERT(!ibuf->isMapped()); 295 SkASSERT(!ibuf->isMapped());
322 *indexOffsetInBytes += ibuf->baseOffset(); 296 *indexOffsetInBytes += ibuf->baseOffset();
323 } 297 }
324 GrGLAttribArrayState* attribState = 298 GrGLAttribArrayState* attribState =
325 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf); 299 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf);
326 300
327 if (fCurrentProgram->hasVertexShader()) { 301 if (fCurrentProgram->hasVertexShader()) {
328 int vertexAttribCount = optState->getVertexAttribCount(); 302 int vertexAttribCount = optState->getVertexAttribCount();
(...skipping 20 matching lines...) Expand all
349 323
350 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState, 324 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState,
351 const GrProgramDesc::DescInfo& descInfo, 325 const GrProgramDesc::DescInfo& descInfo,
352 GrGpu::DrawType drawType, 326 GrGpu::DrawType drawType,
353 const GrDeviceCoordTexture* dstCopy, 327 const GrDeviceCoordTexture* dstCopy,
354 GrProgramDesc* desc) { 328 GrProgramDesc* desc) {
355 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, dstCo py, desc)) { 329 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, dstCo py, desc)) {
356 SkDEBUGFAIL("Failed to generate GL program descriptor"); 330 SkDEBUGFAIL("Failed to generate GL program descriptor");
357 } 331 }
358 } 332 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGpuGL.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698