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

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

Issue 1136803002: print on unused uniforms in debug builds (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak Created 5 years, 7 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/GrGLProgramDataManager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLProgramDataManager.cpp
diff --git a/src/gpu/gl/GrGLProgramDataManager.cpp b/src/gpu/gl/GrGLProgramDataManager.cpp
index 9cd8d57f1826c399c5a8fea3f10f004156d46944..8be0437ee8b377af0c1f988a6bc4c883494caa91 100644
--- a/src/gpu/gl/GrGLProgramDataManager.cpp
+++ b/src/gpu/gl/GrGLProgramDataManager.cpp
@@ -49,7 +49,7 @@ void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const
// FIXME: We still insert a single sampler uniform for every stage. If the shader does not
// reference the sampler then the compiler may have optimized it out. Uncomment this assert
// once stages insert their own samplers.
- // SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ // this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit));
}
@@ -62,7 +62,7 @@ void GrGLProgramDataManager::set1f(UniformHandle u, GrGLfloat v0) const {
const Uniform& uni = fUniforms[u.toProgramDataIndex()];
SkASSERT(uni.fType == kFloat_GrSLType);
SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
- SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0));
}
@@ -81,7 +81,7 @@ void GrGLProgramDataManager::set1fv(UniformHandle u,
// This assert fires in some instances of the two-pt gradient for its VSParams.
// Once the uniform manager is responsible for inserting the duplicate uniform
// arrays in VS and FS driver bug workaround, this can be enabled.
- //SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ // this->printUni(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), Uniform1fv(uni.fFSLocation, arrayCount, v));
}
@@ -94,7 +94,7 @@ void GrGLProgramDataManager::set2f(UniformHandle u, GrGLfloat v0, GrGLfloat v1)
const Uniform& uni = fUniforms[u.toProgramDataIndex()];
SkASSERT(uni.fType == kVec2f_GrSLType);
SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
- SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fFSLocation, v0, v1));
}
@@ -110,7 +110,7 @@ void GrGLProgramDataManager::set2fv(UniformHandle u,
SkASSERT(uni.fType == kVec2f_GrSLType);
SkASSERT(arrayCount > 0);
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
- SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), Uniform2fv(uni.fFSLocation, arrayCount, v));
}
@@ -123,7 +123,7 @@ void GrGLProgramDataManager::set3f(UniformHandle u, GrGLfloat v0, GrGLfloat v1,
const Uniform& uni = fUniforms[u.toProgramDataIndex()];
SkASSERT(uni.fType == kVec3f_GrSLType);
SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
- SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fFSLocation, v0, v1, v2));
}
@@ -139,7 +139,7 @@ void GrGLProgramDataManager::set3fv(UniformHandle u,
SkASSERT(uni.fType == kVec3f_GrSLType);
SkASSERT(arrayCount > 0);
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
- SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), Uniform3fv(uni.fFSLocation, arrayCount, v));
}
@@ -156,7 +156,7 @@ void GrGLProgramDataManager::set4f(UniformHandle u,
const Uniform& uni = fUniforms[u.toProgramDataIndex()];
SkASSERT(uni.fType == kVec4f_GrSLType);
SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
- SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fFSLocation, v0, v1, v2, v3));
}
@@ -172,7 +172,7 @@ void GrGLProgramDataManager::set4fv(UniformHandle u,
SkASSERT(uni.fType == kVec4f_GrSLType);
SkASSERT(arrayCount > 0);
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
- SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), Uniform4fv(uni.fFSLocation, arrayCount, v));
}
@@ -185,7 +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);
- SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), UniformMatrix3fv(uni.fFSLocation, 1, false, matrix));
}
@@ -198,7 +198,7 @@ void GrGLProgramDataManager::setMatrix4f(UniformHandle u, const GrGLfloat matrix
const Uniform& uni = fUniforms[u.toProgramDataIndex()];
SkASSERT(uni.fType == kMat44f_GrSLType);
SkASSERT(GrGLShaderVar::kNonArray == uni.fArrayCount);
- SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), UniformMatrix4fv(uni.fFSLocation, 1, false, matrix));
}
@@ -214,7 +214,7 @@ void GrGLProgramDataManager::setMatrix3fv(UniformHandle u,
SkASSERT(uni.fType == kMat33f_GrSLType);
SkASSERT(arrayCount > 0);
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
- SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(),
UniformMatrix3fv(uni.fFSLocation, arrayCount, false, matrices));
@@ -232,7 +232,7 @@ void GrGLProgramDataManager::setMatrix4fv(UniformHandle u,
SkASSERT(uni.fType == kMat44f_GrSLType);
SkASSERT(arrayCount > 0);
ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount);
- SkASSERT(kUnusedUniform != uni.fFSLocation || kUnusedUniform != uni.fVSLocation);
+ this->printUnused(uni);
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(),
UniformMatrix4fv(uni.fFSLocation, arrayCount, false, matrices));
@@ -257,3 +257,11 @@ void GrGLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix
};
this->setMatrix3f(u, mt);
}
+
+#ifdef SK_DEBUG
+void GrGLProgramDataManager::printUnused(const Uniform& uni) const {
+ if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation) {
+ SkDebugf("Unused uniform in shader\n");
+ }
+}
+#endif
« no previous file with comments | « src/gpu/gl/GrGLProgramDataManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698