| 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");
|
| }
|
|
|
|
|