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

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

Issue 437593004: Pretty print of shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleaned up comment Created 6 years, 5 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
« src/gpu/gl/GrGLPrettyPrintSL.cpp ('K') | « src/gpu/gl/GrGLPrettyPrintSL.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLShaderBuilder.cpp
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index 561acd5ce6121dcf5dcee4847d3c23aee3d36e89..4892cf1d8906c257b7524fc732494065a3d51052 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -9,6 +9,7 @@
#include "gl/GrGLProgram.h"
#include "gl/GrGLUniformHandle.h"
#include "GrCoordTransform.h"
+#include "GrGLPrettyPrintSL.h"
#include "GrDrawEffect.h"
#include "GrGpuGL.h"
#include "GrTexture.h"
@@ -733,8 +734,14 @@ static GrGLuint attach_shader(const GrGLContext& glCtx,
return 0;
}
- const GrGLchar* sourceStr = shaderSrc.c_str();
+#ifdef SK_DEBUG
+ SkString prettySource = GrGLPrettyPrintSL::pretty_print_sl(shaderSrc, false);
+ const GrGLchar* sourceStr = prettySource.c_str();
+ GrGLint sourceLength = static_cast<GrGLint>(prettySource.size());
+#else
GrGLint sourceLength = static_cast<GrGLint>(shaderSrc.size());
+ const GrGLchar* sourceStr = shaderSrc.c_str();
+#endif
GR_GL_CALL(gli, ShaderSource(shaderId, 1, &sourceStr, &sourceLength));
GR_GL_CALL(gli, CompileShader(shaderId));
@@ -757,7 +764,7 @@ static GrGLuint attach_shader(const GrGLContext& glCtx,
GrGLsizei length = GR_GL_INIT_ZERO;
GR_GL_CALL(gli, GetShaderInfoLog(shaderId, infoLen+1,
&length, (char*)log.get()));
- GrPrintf(shaderSrc.c_str());
+ GrPrintf(GrGLPrettyPrintSL::pretty_print_sl(shaderSrc, true).c_str());
GrPrintf("\n%s", log.get());
}
SkDEBUGFAIL("Shader compilation failed!");
@@ -768,8 +775,9 @@ static GrGLuint attach_shader(const GrGLContext& glCtx,
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "skia_gpu::GLShader",
TRACE_EVENT_SCOPE_THREAD, "shader", TRACE_STR_COPY(shaderSrc.c_str()));
+
if (c_PrintShaders) {
- GrPrintf(shaderSrc.c_str());
+ GrPrintf(GrGLPrettyPrintSL::pretty_print_sl(shaderSrc, true).c_str());
GrPrintf("\n");
}
« src/gpu/gl/GrGLPrettyPrintSL.cpp ('K') | « src/gpu/gl/GrGLPrettyPrintSL.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698