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

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: removing unused variable Created 6 years, 4 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/GrGLSLPrettyPrint.cpp ('k') | tests/GrGLSLPrettyPrintTest.cpp » ('j') | 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 fe9a66ae42ff328871c5de08ad38ca92c3e0bb4b..9fffd26145d9fd299ffa0e4785b4bbe0af8cdaae 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -7,6 +7,7 @@
#include "gl/GrGLShaderBuilder.h"
#include "gl/GrGLProgram.h"
+#include "gl/GrGLSLPrettyPrint.h"
#include "gl/GrGLUniformHandle.h"
#include "GrCoordTransform.h"
#include "GrDrawEffect.h"
@@ -671,8 +672,14 @@ static GrGLuint attach_shader(const GrGLContext& glCtx,
return 0;
}
- const GrGLchar* sourceStr = shaderSrc.c_str();
+#ifdef SK_DEBUG
+ SkString prettySource = GrGLSLPrettyPrint::PrettyPrintGLSL(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));
@@ -695,7 +702,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(GrGLSLPrettyPrint::PrettyPrintGLSL(shaderSrc, true).c_str());
GrPrintf("\n%s", log.get());
}
SkDEBUGFAIL("Shader compilation failed!");
@@ -707,7 +714,7 @@ 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(GrGLSLPrettyPrint::PrettyPrintGLSL(shaderSrc, true).c_str());
GrPrintf("\n");
}
« no previous file with comments | « src/gpu/gl/GrGLSLPrettyPrint.cpp ('k') | tests/GrGLSLPrettyPrintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698