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

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

Issue 23537028: Enable vertexless shading when path rendering is supported (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/GrGLProgram.cpp
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index ebc57827c5d69393fd745563c56304283b5b2271..0020a3c9d685967f846ebf639b053f504d022ccc 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -53,7 +53,9 @@ GrGLProgram::GrGLProgram(GrGpuGL* gpu,
const GrEffectStage* colorStages[],
const GrEffectStage* coverageStages[])
: fGpu(gpu)
-, fUniformManager(gpu) {
+, fUniformManager(gpu)
+, fHasVertexShader(false)
+, fNumTexGenUnits(0) {
fDesc = desc;
fVShaderID = 0;
fGShaderID = 0;
@@ -686,6 +688,8 @@ bool GrGLProgram::genProgram(const GrEffectStage* colorStages[],
}
builder.finished(fProgramID);
+ fHasVertexShader = (NULL != builder.getVertexBuilder());
+ fNumTexGenUnits = builder.getNumTexGenUnits();
fUniformHandles.fRTHeightUni = builder.getRTHeightUniform();
fUniformHandles.fDstCopyTopLeftUni = builder.getDstCopyTopLeftUniform();
fUniformHandles.fDstCopyScaleUni = builder.getDstCopyScaleUniform();
@@ -914,6 +918,8 @@ void GrGLProgram::setData(GrDrawState::BlendOptFlags blendOpts,
this->setEffectData(*coverageStages[e], fCoverageEffects[e]);
}
}
+
+ fGpu->disableUnusedTexGenUnits(fNumTexGenUnits);
}
void GrGLProgram::setColor(const GrDrawState& drawState,
@@ -1006,9 +1012,11 @@ void GrGLProgram::setMatrixAndRenderTargetHeight(const GrDrawState& drawState) {
fUniformManager.set1f(fUniformHandles.fRTHeightUni, SkIntToScalar(size.fHeight));
}
- if (fMatrixState.fRenderTargetOrigin != rt->origin() ||
- !fMatrixState.fViewMatrix.cheapEqualTo(drawState.getViewMatrix()) ||
- fMatrixState.fRenderTargetSize != size) {
+ if (!fHasVertexShader) {
+ fGpu->setProjectionMatrix(drawState.getViewMatrix(), size, rt->origin());
+ } else if (fMatrixState.fRenderTargetOrigin != rt->origin() ||
+ !fMatrixState.fViewMatrix.cheapEqualTo(drawState.getViewMatrix()) ||
+ fMatrixState.fRenderTargetSize != size) {
fMatrixState.fViewMatrix = drawState.getViewMatrix();
fMatrixState.fRenderTargetSize = size;

Powered by Google App Engine
This is Rietveld 408576698