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

Side by Side Diff: src/gpu/batches/GrDrawVerticesBatch.cpp

Issue 1825393002: Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: asserts Created 4 years, 8 months 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/batches/GrDefaultPathRenderer.cpp ('k') | src/gpu/batches/GrNinePatch.cpp » ('j') | 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 2015 Google Inc. 2 * Copyright 2015 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 "GrDrawVerticesBatch.h" 8 #include "GrDrawVerticesBatch.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 fCoverageIgnored)); 99 fCoverageIgnored));
100 target->initDraw(gp); 100 target->initDraw(gp);
101 101
102 size_t vertexStride = gp->getVertexStride(); 102 size_t vertexStride = gp->getVertexStride();
103 103
104 SkASSERT(vertexStride == sizeof(SkPoint) + (hasLocalCoords ? sizeof(SkPoint) : 0) 104 SkASSERT(vertexStride == sizeof(SkPoint) + (hasLocalCoords ? sizeof(SkPoint) : 0)
105 + sizeof(GrColor)); 105 + sizeof(GrColor));
106 106
107 int instanceCount = fGeoData.count(); 107 int instanceCount = fGeoData.count();
108 108
109 const GrVertexBuffer* vertexBuffer; 109 const GrBuffer* vertexBuffer;
110 int firstVertex; 110 int firstVertex;
111 111
112 void* verts = target->makeVertexSpace(vertexStride, fVertexCount, &vertexBuf fer, &firstVertex); 112 void* verts = target->makeVertexSpace(vertexStride, fVertexCount, &vertexBuf fer, &firstVertex);
113 113
114 if (!verts) { 114 if (!verts) {
115 SkDebugf("Could not allocate vertices\n"); 115 SkDebugf("Could not allocate vertices\n");
116 return; 116 return;
117 } 117 }
118 118
119 const GrIndexBuffer* indexBuffer = nullptr; 119 const GrBuffer* indexBuffer = nullptr;
120 int firstIndex = 0; 120 int firstIndex = 0;
121 121
122 uint16_t* indices = nullptr; 122 uint16_t* indices = nullptr;
123 if (!fGeoData[0].fIndices.isEmpty()) { 123 if (!fGeoData[0].fIndices.isEmpty()) {
124 indices = target->makeIndexSpace(fIndexCount, &indexBuffer, &firstIndex) ; 124 indices = target->makeIndexSpace(fIndexCount, &indexBuffer, &firstIndex) ;
125 125
126 if (!indices) { 126 if (!indices) {
127 SkDebugf("Could not allocate indices\n"); 127 SkDebugf("Could not allocate indices\n");
128 return; 128 return;
129 } 129 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 geometry.fColor = GrRandomColor(random); 317 geometry.fColor = GrRandomColor(random);
318 return GrDrawVerticesBatch::Create(geometry, type, viewMatrix, 318 return GrDrawVerticesBatch::Create(geometry, type, viewMatrix,
319 positions.begin(), vertexCount, 319 positions.begin(), vertexCount,
320 indices.begin(), hasIndices ? vertexCount : 0, 320 indices.begin(), hasIndices ? vertexCount : 0,
321 colors.begin(), 321 colors.begin(),
322 texCoords.begin(), 322 texCoords.begin(),
323 bounds); 323 bounds);
324 } 324 }
325 325
326 #endif 326 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrDefaultPathRenderer.cpp ('k') | src/gpu/batches/GrNinePatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698