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

Side by Side Diff: src/gpu/instanced/GLInstancedRendering.cpp

Issue 2342063002: simple fix? (Closed)
Patch Set: alt Created 4 years, 3 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 | « no previous file | 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 2016 Google Inc. 2 * Copyright 2016 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 "GLInstancedRendering.h" 8 #include "GLInstancedRendering.h"
9 9
10 #include "GrResourceProvider.h" 10 #include "GrResourceProvider.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 this->flushInstanceAttribs(batch->fEmulatedBaseInstance); 235 this->flushInstanceAttribs(batch->fEmulatedBaseInstance);
236 GL_CALL(MultiDrawElementsIndirect(GR_GL_TRIANGLES, GR_GL_UNSIGNED_BYTE, 236 GL_CALL(MultiDrawElementsIndirect(GR_GL_TRIANGLES, GR_GL_UNSIGNED_BYTE,
237 (GrGLDrawElementsIndirectCommand*) nul lptr + glCmdsIdx, 237 (GrGLDrawElementsIndirectCommand*) nul lptr + glCmdsIdx,
238 numCommands, 0)); 238 numCommands, 0));
239 return; 239 return;
240 } 240 }
241 241
242 int emulatedBaseInstance = batch->fEmulatedBaseInstance; 242 int emulatedBaseInstance = batch->fEmulatedBaseInstance;
243 for (int i = 0; i < numCommands; ++i) { 243 for (int i = 0; i < numCommands; ++i) {
244 int glCmdIdx = batch->fGLDrawCmdsIdx + i; 244 int glCmdIdx = batch->fGLDrawCmdsIdx + i;
245 const GLDrawCmdInfo& cmdInfo = fGLDrawCmdsInfo[glCmdIdx];
246 this->flushInstanceAttribs(emulatedBaseInstance); 245 this->flushInstanceAttribs(emulatedBaseInstance);
247 if (fDrawIndirectBuffer) { 246 if (fDrawIndirectBuffer) {
248 GL_CALL(DrawElementsIndirect(GR_GL_TRIANGLES, GR_GL_UNSIGNED_BYTE, 247 GL_CALL(DrawElementsIndirect(GR_GL_TRIANGLES, GR_GL_UNSIGNED_BYTE,
249 (GrGLDrawElementsIndirectCommand*) null ptr + glCmdIdx)); 248 (GrGLDrawElementsIndirectCommand*) null ptr + glCmdIdx));
250 } else { 249 } else {
250 const GLDrawCmdInfo& cmdInfo = fGLDrawCmdsInfo[glCmdIdx];
251 GL_CALL(DrawElementsInstanced(GR_GL_TRIANGLES, cmdInfo.fGeometry.fCo unt, 251 GL_CALL(DrawElementsInstanced(GR_GL_TRIANGLES, cmdInfo.fGeometry.fCo unt,
252 GR_GL_UNSIGNED_BYTE, 252 GR_GL_UNSIGNED_BYTE,
253 (GrGLubyte*) nullptr + cmdInfo.fGeomet ry.fStart, 253 (GrGLubyte*) nullptr + cmdInfo.fGeomet ry.fStart,
254 cmdInfo.fInstanceCount)); 254 cmdInfo.fInstanceCount));
255 } 255 }
256 if (!glCaps.baseInstanceSupport()) { 256 if (!glCaps.baseInstanceSupport()) {
257 const GLDrawCmdInfo& cmdInfo = fGLDrawCmdsInfo[glCmdIdx];
257 emulatedBaseInstance += cmdInfo.fInstanceCount; 258 emulatedBaseInstance += cmdInfo.fInstanceCount;
258 } 259 }
259 } 260 }
260 } 261 }
261 262
262 void GLInstancedRendering::flushInstanceAttribs(int baseInstance) { 263 void GLInstancedRendering::flushInstanceAttribs(int baseInstance) {
263 SkASSERT(fVertexArrayID); 264 SkASSERT(fVertexArrayID);
264 this->glGpu()->bindVertexArray(fVertexArrayID); 265 this->glGpu()->bindVertexArray(fVertexArrayID);
265 266
266 SkASSERT(fInstanceBuffer); 267 SkASSERT(fInstanceBuffer);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 GL_CALL(DeleteVertexArrays(1, &fVertexArrayID)); 315 GL_CALL(DeleteVertexArrays(1, &fVertexArrayID));
315 this->glGpu()->notifyVertexArrayDelete(fVertexArrayID); 316 this->glGpu()->notifyVertexArrayDelete(fVertexArrayID);
316 } 317 }
317 fVertexArrayID = 0; 318 fVertexArrayID = 0;
318 fInstanceBuffer.reset(); 319 fInstanceBuffer.reset();
319 fDrawIndirectBuffer.reset(); 320 fDrawIndirectBuffer.reset();
320 fInstanceAttribsBufferUniqueId = SK_InvalidUniqueID; 321 fInstanceAttribsBufferUniqueId = SK_InvalidUniqueID;
321 } 322 }
322 323
323 } 324 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698