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

Unified Diff: src/gpu/gl/builders/GrGLShaderStringBuilder.cpp

Issue 2142223003: Fix GL shader sources getting truncated by ADB log (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/builders/GrGLShaderStringBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp b/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp
index 52915b6f89926b0d97639c1bd1df2e55a9fbc062..b4ce2824e2eda76034ea8268626b32720ca0e126 100644
--- a/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp
@@ -17,6 +17,8 @@
SK_CONF_DECLARE(bool, c_PrintShaders, "gpu.printShaders", false,
"Print the source code for all shaders generated.");
+static void print_shader_source(const char** strings, int* lengths, int count);
+
GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx,
GrGLuint programId,
GrGLenum type,
@@ -71,8 +73,7 @@ GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx,
// buffer param validation.
GrGLsizei length = GR_GL_INIT_ZERO;
GR_GL_CALL(gli, GetShaderInfoLog(shaderId, infoLen+1, &length, (char*)log.get()));
- SkDebugf("%s", GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths, count, true).c_str());
- SkDebugf("\n%s", log.get());
+ print_shader_source(strings, lengths, count);
}
SkDEBUGFAIL("Shader compilation failed!");
GR_GL_CALL(gli, DeleteShader(shaderId));
@@ -81,8 +82,7 @@ GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx,
}
if (c_PrintShaders) {
- SkDebugf("%s", GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths, count, true).c_str());
- SkDebugf("\n");
+ print_shader_source(strings, lengths, count);
}
// Attach the shader, but defer deletion until after we have linked the program.
@@ -93,3 +93,13 @@ GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx,
return shaderId;
}
+
+static void print_shader_source(const char** strings, int* lengths, int count) {
+ const SkString& pretty = GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths, count, true);
+ SkTArray<SkString> lines;
+ SkStrSplit(pretty.c_str(), "\n", &lines);
+ for (const SkString& line : lines) {
+ // Print the shader one line at the time so it doesn't get truncated by the adb log.
+ SkDebugf("%s\n", line.c_str());
+ }
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698