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; |