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

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

Issue 25846002: Use vertexless shaders when NVpr is available (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix mac build Created 7 years, 2 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/GrGpuGL.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL_program.cpp
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 8a3444e508f364333c29094aa281d2fa45ca3a28..92eed8d9bb85751e6736408d3ec881e69a21f114 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -210,28 +210,6 @@ void GrGpuGL::abandonResources(){
#define GL_CALL(X) GR_GL_CALL(this->glInterface(), X)
-void GrGpuGL::flushPathStencilMatrix() {
- const SkMatrix& viewMatrix = this->getDrawState().getViewMatrix();
- const GrRenderTarget* rt = this->getDrawState().getRenderTarget();
- SkISize size;
- size.set(rt->width(), rt->height());
- const SkMatrix& vm = this->getDrawState().getViewMatrix();
-
- if (fHWProjectionMatrixState.fRenderTargetOrigin != rt->origin() ||
- !fHWProjectionMatrixState.fViewMatrix.cheapEqualTo(viewMatrix) ||
- fHWProjectionMatrixState.fRenderTargetSize!= size) {
-
- fHWProjectionMatrixState.fViewMatrix = vm;
- fHWProjectionMatrixState.fRenderTargetSize = size;
- fHWProjectionMatrixState.fRenderTargetOrigin = rt->origin();
-
- GrGLfloat projectionMatrix[4 * 4];
- fHWProjectionMatrixState.getGLMatrix<4>(projectionMatrix);
- GL_CALL(MatrixMode(GR_GL_PROJECTION));
- GL_CALL(LoadMatrixf(projectionMatrix));
- }
-}
-
bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstCopy) {
const GrDrawState& drawState = this->getDrawState();
@@ -239,7 +217,10 @@ bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
SkASSERT(NULL != drawState.getRenderTarget());
if (kStencilPath_DrawType == type) {
- this->flushPathStencilMatrix();
+ const GrRenderTarget* rt = this->getDrawState().getRenderTarget();
+ SkISize size;
+ size.set(rt->width(), rt->height());
+ this->setProjectionMatrix(drawState.getViewMatrix(), size, rt->origin());
} else {
this->flushMiscFixedFunctionState();
@@ -360,24 +341,40 @@ void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) {
GrGLAttribArrayState* attribState =
fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf);
- uint32_t usedAttribArraysMask = 0;
- const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttribs();
- int vertexAttribCount = this->getDrawState().getVertexAttribCount();
- for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount;
- ++vertexAttribIndex, ++vertexAttrib) {
-
- usedAttribArraysMask |= (1 << vertexAttribIndex);
- GrVertexAttribType attribType = vertexAttrib->fType;
- attribState->set(this,
- vertexAttribIndex,
- vbuf,
- GrGLAttribTypeToLayout(attribType).fCount,
- GrGLAttribTypeToLayout(attribType).fType,
- GrGLAttribTypeToLayout(attribType).fNormalized,
- stride,
- reinterpret_cast<GrGLvoid*>(
- vertexOffsetInBytes + vertexAttrib->fOffset));
- }
+ if (!fCurrentProgram->hasVertexShader()) {
+ int posIdx = this->getDrawState().positionAttributeIndex();
+ const GrVertexAttrib* vertexArray = this->getDrawState().getVertexAttribs() + posIdx;
+ GrVertexAttribType vertexArrayType = vertexArray->fType;
+ SkASSERT(!GrGLAttribTypeToLayout(vertexArrayType).fNormalized);
+ SkASSERT(GrGLAttribTypeToLayout(vertexArrayType).fCount == 2);
+ attribState->setFixedFunctionVertexArray(this,
+ vbuf,
+ 2,
+ GrGLAttribTypeToLayout(vertexArrayType).fType,
+ stride,
+ reinterpret_cast<GrGLvoid*>(
+ vertexOffsetInBytes + vertexArray->fOffset));
+ attribState->disableUnusedArrays(this, 0, true);
+ } else {
+ uint32_t usedAttribArraysMask = 0;
+ const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttribs();
+ int vertexAttribCount = this->getDrawState().getVertexAttribCount();
+ for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount;
+ ++vertexAttribIndex, ++vertexAttrib) {
+
+ usedAttribArraysMask |= (1 << vertexAttribIndex);
+ GrVertexAttribType attribType = vertexAttrib->fType;
+ attribState->set(this,
+ vertexAttribIndex,
+ vbuf,
+ GrGLAttribTypeToLayout(attribType).fCount,
+ GrGLAttribTypeToLayout(attribType).fType,
+ GrGLAttribTypeToLayout(attribType).fNormalized,
+ stride,
+ reinterpret_cast<GrGLvoid*>(
+ vertexOffsetInBytes + vertexAttrib->fOffset));
+ }
- attribState->disableUnusedArrays(this, usedAttribArraysMask, false);
+ attribState->disableUnusedArrays(this, usedAttribArraysMask, false);
+ }
}
« no previous file with comments | « src/gpu/gl/GrGpuGL.cpp ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698