| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrGLShaderStringBuilder.h" | 8 #include "GrGLShaderStringBuilder.h" |
| 9 #include "gl/GrGLGpu.h" | 9 #include "gl/GrGLGpu.h" |
| 10 #include "gl/GrGLSLPrettyPrint.h" | 10 #include "gl/GrGLSLPrettyPrint.h" |
| 11 #include "SkRTConf.h" |
| 11 #include "SkTraceEvent.h" | 12 #include "SkTraceEvent.h" |
| 12 | 13 |
| 13 #define GL_CALL(X) GR_GL_CALL(gpu->glInterface(), X) | 14 #define GL_CALL(X) GR_GL_CALL(gpu->glInterface(), X) |
| 14 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(gpu->glInterface(), R, X) | 15 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(gpu->glInterface(), R, X) |
| 15 | 16 |
| 16 // Print the source code for all shaders generated. | 17 SK_CONF_DECLARE(bool, c_PrintShaders, "gpu.printShaders", false, |
| 17 static const bool c_PrintShaders{false}; | 18 "Print the source code for all shaders generated."); |
| 18 | 19 |
| 19 static void print_shader_source(const char** strings, int* lengths, int count); | 20 static void print_shader_source(const char** strings, int* lengths, int count); |
| 20 | 21 |
| 21 GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx, | 22 GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx, |
| 22 GrGLuint programId, | 23 GrGLuint programId, |
| 23 GrGLenum type, | 24 GrGLenum type, |
| 24 const char** strings, | 25 const char** strings, |
| 25 int* lengths, | 26 int* lengths, |
| 26 int count, | 27 int count, |
| 27 GrGpu::Stats* stats) { | 28 GrGpu::Stats* stats) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 96 |
| 96 static void print_shader_source(const char** strings, int* lengths, int count) { | 97 static void print_shader_source(const char** strings, int* lengths, int count) { |
| 97 const SkString& pretty = GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths
, count, true); | 98 const SkString& pretty = GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths
, count, true); |
| 98 SkTArray<SkString> lines; | 99 SkTArray<SkString> lines; |
| 99 SkStrSplit(pretty.c_str(), "\n", &lines); | 100 SkStrSplit(pretty.c_str(), "\n", &lines); |
| 100 for (const SkString& line : lines) { | 101 for (const SkString& line : lines) { |
| 101 // Print the shader one line at the time so it doesn't get truncated by
the adb log. | 102 // Print the shader one line at the time so it doesn't get truncated by
the adb log. |
| 102 SkDebugf("%s\n", line.c_str()); | 103 SkDebugf("%s\n", line.c_str()); |
| 103 } | 104 } |
| 104 } | 105 } |
| OLD | NEW |