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

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 2287003002: Add support for glDrawRangeElements (Closed)
Patch Set: Add to test interface Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLCaps.cpp ('k') | src/gpu/gl/GrGLInterface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 83d2df29bfdb81a4c21540604a4c4d9dc1e55c58..9981b66075427de65e4af3a28258095bad4b81e2 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2762,28 +2762,40 @@ void GrGLGpu::draw(const GrPipeline& pipeline,
const GrMesh& mesh = meshes[i];
GrMesh::Iterator iter;
- const GrNonInstancedMesh* nonIdxMesh = iter.init(mesh);
+ const GrNonInstancedMesh* nonInstMesh = iter.init(mesh);
do {
size_t indexOffsetInBytes = 0;
- this->setupGeometry(primProc, *nonIdxMesh, &indexOffsetInBytes);
- if (nonIdxMesh->isIndexed()) {
+ this->setupGeometry(primProc, *nonInstMesh, &indexOffsetInBytes);
+ if (nonInstMesh->isIndexed()) {
GrGLvoid* indices =
- reinterpret_cast<GrGLvoid*>(indexOffsetInBytes + sizeof(uint16_t) *
- nonIdxMesh->startIndex());
+ reinterpret_cast<GrGLvoid*>(indexOffsetInBytes +
+ sizeof(uint16_t) * nonInstMesh->startIndex());
// info.startVertex() was accounted for by setupGeometry.
- GL_CALL(DrawElements(gPrimitiveType2GLMode[nonIdxMesh->primitiveType()],
- nonIdxMesh->indexCount(),
- GR_GL_UNSIGNED_SHORT,
- indices));
+ if (this->glCaps().drawRangeElementsSupport()) {
+ // We assume here that the batch that generated the mesh used the full
+ // 0..vertexCount()-1 range.
+ int start = 0;
+ int end = nonInstMesh->vertexCount() - 1;
+ GL_CALL(DrawRangeElements(gPrimitiveType2GLMode[nonInstMesh->primitiveType()],
+ start, end,
+ nonInstMesh->indexCount(),
+ GR_GL_UNSIGNED_SHORT,
+ indices));
+ } else {
+ GL_CALL(DrawElements(gPrimitiveType2GLMode[nonInstMesh->primitiveType()],
+ nonInstMesh->indexCount(),
+ GR_GL_UNSIGNED_SHORT,
+ indices));
+ }
} else {
// Pass 0 for parameter first. We have to adjust glVertexAttribPointer() to account
// for startVertex in the DrawElements case. So we always rely on setupGeometry to
// have accounted for startVertex.
- GL_CALL(DrawArrays(gPrimitiveType2GLMode[nonIdxMesh->primitiveType()], 0,
- nonIdxMesh->vertexCount()));
+ GL_CALL(DrawArrays(gPrimitiveType2GLMode[nonInstMesh->primitiveType()], 0,
+ nonInstMesh->vertexCount()));
}
fStats.incNumDraws();
- } while ((nonIdxMesh = iter.next()));
+ } while ((nonInstMesh = iter.next()));
}
if (fHWPLSEnabled && plsState == GrPixelLocalStorageState::kFinish_GrPixelLocalStorageState) {
« no previous file with comments | « src/gpu/gl/GrGLCaps.cpp ('k') | src/gpu/gl/GrGLInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698