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

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

Issue 2287003002: Add support for glDrawRangeElements (Closed)
Patch Set: Add to test interface 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 | « src/gpu/gl/GrGLCaps.cpp ('k') | src/gpu/gl/GrGLInterface.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 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 "GrGLGpu.h" 8 #include "GrGLGpu.h"
9 #include "GrGLBuffer.h" 9 #include "GrGLBuffer.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 2744 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 this->flushStencil(stencil); 2755 this->flushStencil(stencil);
2756 } 2756 }
2757 2757
2758 for (int i = 0; i < meshCount; ++i) { 2758 for (int i = 0; i < meshCount; ++i) {
2759 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*this->caps ())) { 2759 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*this->caps ())) {
2760 this->xferBarrier(pipeline.getRenderTarget(), barrierType); 2760 this->xferBarrier(pipeline.getRenderTarget(), barrierType);
2761 } 2761 }
2762 2762
2763 const GrMesh& mesh = meshes[i]; 2763 const GrMesh& mesh = meshes[i];
2764 GrMesh::Iterator iter; 2764 GrMesh::Iterator iter;
2765 const GrNonInstancedMesh* nonIdxMesh = iter.init(mesh); 2765 const GrNonInstancedMesh* nonInstMesh = iter.init(mesh);
2766 do { 2766 do {
2767 size_t indexOffsetInBytes = 0; 2767 size_t indexOffsetInBytes = 0;
2768 this->setupGeometry(primProc, *nonIdxMesh, &indexOffsetInBytes); 2768 this->setupGeometry(primProc, *nonInstMesh, &indexOffsetInBytes);
2769 if (nonIdxMesh->isIndexed()) { 2769 if (nonInstMesh->isIndexed()) {
2770 GrGLvoid* indices = 2770 GrGLvoid* indices =
2771 reinterpret_cast<GrGLvoid*>(indexOffsetInBytes + sizeof(uint 16_t) * 2771 reinterpret_cast<GrGLvoid*>(indexOffsetInBytes +
2772 nonIdxMesh->startIndex()); 2772 sizeof(uint16_t) * nonInstMesh-> startIndex());
2773 // info.startVertex() was accounted for by setupGeometry. 2773 // info.startVertex() was accounted for by setupGeometry.
2774 GL_CALL(DrawElements(gPrimitiveType2GLMode[nonIdxMesh->primitive Type()], 2774 if (this->glCaps().drawRangeElementsSupport()) {
2775 nonIdxMesh->indexCount(), 2775 // We assume here that the batch that generated the mesh use d the full
2776 GR_GL_UNSIGNED_SHORT, 2776 // 0..vertexCount()-1 range.
2777 indices)); 2777 int start = 0;
2778 int end = nonInstMesh->vertexCount() - 1;
2779 GL_CALL(DrawRangeElements(gPrimitiveType2GLMode[nonInstMesh- >primitiveType()],
2780 start, end,
2781 nonInstMesh->indexCount(),
2782 GR_GL_UNSIGNED_SHORT,
2783 indices));
2784 } else {
2785 GL_CALL(DrawElements(gPrimitiveType2GLMode[nonInstMesh->prim itiveType()],
2786 nonInstMesh->indexCount(),
2787 GR_GL_UNSIGNED_SHORT,
2788 indices));
2789 }
2778 } else { 2790 } else {
2779 // Pass 0 for parameter first. We have to adjust glVertexAttribP ointer() to account 2791 // Pass 0 for parameter first. We have to adjust glVertexAttribP ointer() to account
2780 // for startVertex in the DrawElements case. So we always rely o n setupGeometry to 2792 // for startVertex in the DrawElements case. So we always rely o n setupGeometry to
2781 // have accounted for startVertex. 2793 // have accounted for startVertex.
2782 GL_CALL(DrawArrays(gPrimitiveType2GLMode[nonIdxMesh->primitiveTy pe()], 0, 2794 GL_CALL(DrawArrays(gPrimitiveType2GLMode[nonInstMesh->primitiveT ype()], 0,
2783 nonIdxMesh->vertexCount())); 2795 nonInstMesh->vertexCount()));
2784 } 2796 }
2785 fStats.incNumDraws(); 2797 fStats.incNumDraws();
2786 } while ((nonIdxMesh = iter.next())); 2798 } while ((nonInstMesh = iter.next()));
2787 } 2799 }
2788 2800
2789 if (fHWPLSEnabled && plsState == GrPixelLocalStorageState::kFinish_GrPixelLo calStorageState) { 2801 if (fHWPLSEnabled && plsState == GrPixelLocalStorageState::kFinish_GrPixelLo calStorageState) {
2790 // PLS draws always involve multiple draws, finishing up with a non-PLS 2802 // PLS draws always involve multiple draws, finishing up with a non-PLS
2791 // draw that writes to the color buffer. That draw ends up here; we wait 2803 // draw that writes to the color buffer. That draw ends up here; we wait
2792 // until after it is complete to actually disable PLS. 2804 // until after it is complete to actually disable PLS.
2793 GL_CALL(Disable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE)); 2805 GL_CALL(Disable(GR_GL_SHADER_PIXEL_LOCAL_STORAGE));
2794 fHWPLSEnabled = false; 2806 fHWPLSEnabled = false;
2795 this->disableScissor(); 2807 this->disableScissor();
2796 this->disableWindowRectangles(); 2808 this->disableWindowRectangles();
(...skipping 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after
4661 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4673 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4662 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4674 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4663 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4675 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4664 copyParams->fWidth = texture->width(); 4676 copyParams->fWidth = texture->width();
4665 copyParams->fHeight = texture->height(); 4677 copyParams->fHeight = texture->height();
4666 return true; 4678 return true;
4667 } 4679 }
4668 } 4680 }
4669 return false; 4681 return false;
4670 } 4682 }
OLDNEW
« 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