From ee71044d4b7aa1703cd9c04d5322f5d2df1e7c25 Mon Sep 17 00:00:00 2001 From: joshualitt Date: Tue, 12 May 2015 08:33:36 -0700 Subject: [PATCH] Revert of add option to supress prints on context (patchset #5 id:80001 of https://codereview.chromium.org/1128903008/) Reason for revert: breaks windows rollbots Original issue's description: > add option to supress prints on context > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/55661337667a8305ebb100e36af23d34c2fb83ba TBR=bsalomon@google.com,robertphillips@google.com,joshualitt@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1125193006 --- include/gpu/GrContext.h | 4 +--- include/gpu/GrTypesPriv.h | 10 ---------- src/gpu/GrDrawTarget.cpp | 3 +-- src/gpu/gl/GrGLProgramDataManager.cpp | 24 ++++++++++++------------ src/gpu/gl/GrGLProgramDataManager.h | 6 +++++- 5 files changed, 19 insertions(+), 28 deletions(-) diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index a6fdf75..77aef60 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -47,13 +47,12 @@ public: SK_DECLARE_INST_COUNT(GrContext) struct Options { - Options() : fDrawPathToCompressedTexture(false), fSuppressPrints(false) { } + Options() : fDrawPathToCompressedTexture(false) { } // EXPERIMENTAL // May be removed in the future, or may become standard depending // on the outcomes of a variety of internal tests. bool fDrawPathToCompressedTexture; - bool fSuppressPrints; }; /** @@ -530,7 +529,6 @@ public: GrResourceProvider* resourceProvider() { return fResourceProvider; } const GrResourceProvider* resourceProvider() const { return fResourceProvider; } GrResourceCache* getResourceCache() { return fResourceCache; } - bool suppressPrints() const { return fOptions.fSuppressPrints; } // Called by tests that draw directly to the context via GrDrawTarget void getTestTarget(GrTestTarget*); diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h index 83d6a66..412de89 100644 --- a/include/gpu/GrTypesPriv.h +++ b/include/gpu/GrTypesPriv.h @@ -264,14 +264,4 @@ private: SkIRect fRect; }; -#ifdef SK_DEBUG -// Takes a pointer to a GrContext, and will suppress prints if required -#define GrContextDebugf(context, format, ...) \ - if (!context->suppressPrints()) { \ - SkDebugf(format, ##__VA_ARGS__); \ - } -#else -#define GrContextDebugf(context, format, ...) -#endif - #endif diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index 549ab37..a1489c6 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -68,8 +68,7 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil drawBounds->roundOut(&drawIBounds); if (!copyRect.intersect(drawIBounds)) { #ifdef SK_DEBUG - GrContextDebugf(fContext, "Missed an early reject. " - "Bailing on draw from setupDstReadIfNecessary.\n"); + SkDebugf("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 ef2f59e..8be0437 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); - SkDEBUGCODE(this->printUnused(uni);) + 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); - SkDEBUGCODE(this->printUnused(uni);) + 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); - SkDEBUGCODE(this->printUnused(uni);) + 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); - SkDEBUGCODE(this->printUnused(uni);) + 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); - SkDEBUGCODE(this->printUnused(uni);) + 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); - SkDEBUGCODE(this->printUnused(uni);) + 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); - SkDEBUGCODE(this->printUnused(uni);) + 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); - SkDEBUGCODE(this->printUnused(uni);) + 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); - SkDEBUGCODE(this->printUnused(uni);) + 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); - SkDEBUGCODE(this->printUnused(uni);) + 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); - SkDEBUGCODE(this->printUnused(uni);) + 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) { - GrContextDebugf(fGpu->getContext(), "Unused uniform in shader\n"); + SkDebugf("Unused uniform in shader\n"); } } #endif diff --git a/src/gpu/gl/GrGLProgramDataManager.h b/src/gpu/gl/GrGLProgramDataManager.h index f154313..5ee1a85 100644 --- a/src/gpu/gl/GrGLProgramDataManager.h +++ b/src/gpu/gl/GrGLProgramDataManager.h @@ -106,7 +106,11 @@ private: ); }; - SkDEBUGCODE(void printUnused(const Uniform&) const;) +#ifdef SK_DEBUG + void printUnused(const Uniform&) const; +#else + void printUnused(const Uniform&) const {} +#endif SkTArray fUniforms; GrGLGpu* fGpu; -- 2.7.4