aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-05-12 12:03:50 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-12 12:03:50 -0700
commit7d022d6cc80b85c6c6fc0688c0904915fec61910 (patch)
tree99cfac727c01d7ef2f96239a20684e5a26dcf7f7 /src
parentcc25297364433ad66450faf391e599274ed4bc7d (diff)
add option to supress prints on context
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrDrawTarget.cpp3
-rw-r--r--src/gpu/gl/GrGLProgramDataManager.cpp24
-rw-r--r--src/gpu/gl/GrGLProgramDataManager.h6
3 files changed, 15 insertions, 18 deletions
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index a1489c6a42..549ab374c8 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -68,7 +68,8 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
drawBounds->roundOut(&drawIBounds);
if (!copyRect.intersect(drawIBounds)) {
#ifdef SK_DEBUG
- SkDebugf("Missed an early reject. Bailing on draw from setupDstReadIfNecessary.\n");
+ GrContextDebugf(fContext, "Missed an early reject. "
+ "Bailing on draw from setupDstReadIfNecessary.\n");
#endif
return false;
}
diff --git a/src/gpu/gl/GrGLProgramDataManager.cpp b/src/gpu/gl/GrGLProgramDataManager.cpp
index 8be0437ee8..ef2f59e664 100644
--- a/src/gpu/gl/GrGLProgramDataManager.cpp
+++ b/src/gpu/gl/GrGLProgramDataManager.cpp
@@ -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);
- this->printUnused(uni);
+ SkDEBUGCODE(this->printUnused(uni);)
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0));
}
@@ -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);
- this->printUnused(uni);
+ SkDEBUGCODE(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);
- this->printUnused(uni);
+ SkDEBUGCODE(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);
- this->printUnused(uni);
+ SkDEBUGCODE(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);
- this->printUnused(uni);
+ SkDEBUGCODE(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);
- this->printUnused(uni);
+ SkDEBUGCODE(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);
- this->printUnused(uni);
+ SkDEBUGCODE(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);
- this->printUnused(uni);
+ SkDEBUGCODE(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);
- this->printUnused(uni);
+ SkDEBUGCODE(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);
- this->printUnused(uni);
+ SkDEBUGCODE(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);
- this->printUnused(uni);
+ SkDEBUGCODE(this->printUnused(uni);)
if (kUnusedUniform != uni.fFSLocation) {
GR_GL_CALL(fGpu->glInterface(),
UniformMatrix4fv(uni.fFSLocation, arrayCount, false, matrices));
@@ -261,7 +261,7 @@ void GrGLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix
#ifdef SK_DEBUG
void GrGLProgramDataManager::printUnused(const Uniform& uni) const {
if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation) {
- SkDebugf("Unused uniform in shader\n");
+ GrContextDebugf(fGpu->getContext(), "Unused uniform in shader\n");
}
}
#endif
diff --git a/src/gpu/gl/GrGLProgramDataManager.h b/src/gpu/gl/GrGLProgramDataManager.h
index 5ee1a85557..f154313516 100644
--- a/src/gpu/gl/GrGLProgramDataManager.h
+++ b/src/gpu/gl/GrGLProgramDataManager.h
@@ -106,11 +106,7 @@ private:
);
};
-#ifdef SK_DEBUG
- void printUnused(const Uniform&) const;
-#else
- void printUnused(const Uniform&) const {}
-#endif
+ SkDEBUGCODE(void printUnused(const Uniform&) const;)
SkTArray<Uniform, true> fUniforms;
GrGLGpu* fGpu;