aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-02-12 14:48:42 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-12 14:48:42 -0800
commitdd2198701b0ec9da61ecf73418cad03642d715e7 (patch)
treed16f763f6e5fbdd546180b60cfa21400aafe313c /src/gpu/gl
parent8072caa80384292858d31ae34b7e19768875866b (diff)
fix for uniform view matrix being uploaded but not used
As discussed, I'll follow this up by removing localmatrix/uniform view matrix from the base classe BUG=skia: Review URL: https://codereview.chromium.org/920933002
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLGeometryProcessor.cpp12
-rw-r--r--src/gpu/gl/GrGLGeometryProcessor.h11
-rw-r--r--src/gpu/gl/GrGLPrimitiveProcessor.cpp2
-rw-r--r--src/gpu/gl/GrGLProgramDataManager.cpp3
-rw-r--r--src/gpu/gl/builders/GrGLShaderStringBuilder.cpp2
5 files changed, 15 insertions, 15 deletions
diff --git a/src/gpu/gl/GrGLGeometryProcessor.cpp b/src/gpu/gl/GrGLGeometryProcessor.cpp
index a8d020a166..79bcb4c084 100644
--- a/src/gpu/gl/GrGLGeometryProcessor.cpp
+++ b/src/gpu/gl/GrGLGeometryProcessor.cpp
@@ -106,24 +106,26 @@ GrGLGeometryProcessor::setTransformData(const GrPrimitiveProcessor& primProc,
}
}
-void GrGLGeometryProcessor::SetupPosition(GrGLVertexBuilder* vsBuilder,
+void GrGLGeometryProcessor::setupPosition(GrGLGPBuilder* pb,
GrGPArgs* gpArgs,
const char* posName,
- const SkMatrix& mat,
- const char* matName) {
+ const SkMatrix& mat) {
+ GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
if (mat.isIdentity()) {
gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), posName);
} else if (!mat.hasPerspective()) {
+ this->addUniformViewMatrix(pb);
gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
vsBuilder->codeAppendf("vec2 %s = vec2(%s * vec3(%s, 1));",
- gpArgs->fPositionVar.c_str(), matName, posName);
+ gpArgs->fPositionVar.c_str(), this->uViewM(), posName);
} else {
+ this->addUniformViewMatrix(pb);
gpArgs->fPositionVar.set(kVec3f_GrSLType, "pos3");
vsBuilder->codeAppendf("vec3 %s = %s * vec3(%s, 1);",
- gpArgs->fPositionVar.c_str(), matName, posName);
+ gpArgs->fPositionVar.c_str(), this->uViewM(), posName);
}
}
diff --git a/src/gpu/gl/GrGLGeometryProcessor.h b/src/gpu/gl/GrGLGeometryProcessor.h
index e8b16afe33..2630bde075 100644
--- a/src/gpu/gl/GrGLGeometryProcessor.h
+++ b/src/gpu/gl/GrGLGeometryProcessor.h
@@ -10,7 +10,7 @@
#include "GrGLPrimitiveProcessor.h"
-class GrGLVertexBuilder;
+class GrGLGPBuilder;
/**
* If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, then it must inherit
@@ -51,11 +51,10 @@ protected:
};
// Create the correct type of position variable given the CTM
- static void SetupPosition(GrGLVertexBuilder* vsBuilder,
- GrGPArgs* gpArgs,
- const char* posName,
- const SkMatrix& mat,
- const char* matName);
+ void setupPosition(GrGLGPBuilder* pb,
+ GrGPArgs* gpArgs,
+ const char* posName,
+ const SkMatrix& mat);
static uint32_t ComputePosKey(const SkMatrix& mat) {
if (mat.isIdentity()) {
diff --git a/src/gpu/gl/GrGLPrimitiveProcessor.cpp b/src/gpu/gl/GrGLPrimitiveProcessor.cpp
index 335dc4fe5f..2bb595af01 100644
--- a/src/gpu/gl/GrGLPrimitiveProcessor.cpp
+++ b/src/gpu/gl/GrGLPrimitiveProcessor.cpp
@@ -64,7 +64,7 @@ void GrGLPrimitiveProcessor::addUniformViewMatrix(GrGLGPBuilder* pb) {
void GrGLPrimitiveProcessor::setUniformViewMatrix(const GrGLProgramDataManager& pdman,
const SkMatrix& viewMatrix) {
- if (!fViewMatrix.cheapEqualTo(viewMatrix)) {
+ if (!viewMatrix.isIdentity() && !fViewMatrix.cheapEqualTo(viewMatrix)) {
SkASSERT(fViewMatrixUniform.isValid());
fViewMatrix = viewMatrix;
diff --git a/src/gpu/gl/GrGLProgramDataManager.cpp b/src/gpu/gl/GrGLProgramDataManager.cpp
index 67b70417be..9cd8d57f18 100644
--- a/src/gpu/gl/GrGLProgramDataManager.cpp
+++ b/src/gpu/gl/GrGLProgramDataManager.cpp
@@ -185,8 +185,7 @@ void GrGLProgramDataManager::setMatrix3f(UniformHandle u, const GrGLfloat matrix
const Uniform& uni = fUniforms[u.toProgramDataIndex()];
SkASSERT(uni.fType == kMat33f_GrSLType);
SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
- // TODO: Re-enable this assert once texture matrices aren't forced on all effects
- // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fFSLocation, 1, false, matrix));
}
diff --git a/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp b/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp
index 5265d203a5..1e750489ff 100644
--- a/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp
@@ -6,7 +6,7 @@
*/
#include "GrGLShaderStringBuilder.h"
-#include "../GrGLGpu.h"
+#include "gl/GrGLGpu.h"
#include "gl/GrGLSLPrettyPrint.h"
#include "SkRTConf.h"
#include "SkTraceEvent.h"