| 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" | |
| 12 #include "SkTraceEvent.h" | 11 #include "SkTraceEvent.h" |
| 13 | 12 |
| 14 #define GL_CALL(X) GR_GL_CALL(gpu->glInterface(), X) | 13 #define GL_CALL(X) GR_GL_CALL(gpu->glInterface(), X) |
| 15 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(gpu->glInterface(), R, X) | 14 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(gpu->glInterface(), R, X) |
| 16 | 15 |
| 17 SK_CONF_DECLARE(bool, c_PrintShaders, "gpu.printShaders", false, | 16 // Print the source code for all shaders generated. |
| 18 "Print the source code for all shaders generated."); | 17 static const bool c_PrintShaders{false}; |
| 19 | 18 |
| 20 static void print_shader_source(const char** strings, int* lengths, int count); | 19 static void print_shader_source(const char** strings, int* lengths, int count); |
| 21 | 20 |
| 22 GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx, | 21 GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx, |
| 23 GrGLuint programId, | 22 GrGLuint programId, |
| 24 GrGLenum type, | 23 GrGLenum type, |
| 25 const char** strings, | 24 const char** strings, |
| 26 int* lengths, | 25 int* lengths, |
| 27 int count, | 26 int count, |
| 28 GrGpu::Stats* stats) { | 27 GrGpu::Stats* stats) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 95 |
| 97 static void print_shader_source(const char** strings, int* lengths, int count) { | 96 static void print_shader_source(const char** strings, int* lengths, int count) { |
| 98 const SkString& pretty = GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths
, count, true); | 97 const SkString& pretty = GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths
, count, true); |
| 99 SkTArray<SkString> lines; | 98 SkTArray<SkString> lines; |
| 100 SkStrSplit(pretty.c_str(), "\n", &lines); | 99 SkStrSplit(pretty.c_str(), "\n", &lines); |
| 101 for (const SkString& line : lines) { | 100 for (const SkString& line : lines) { |
| 102 // Print the shader one line at the time so it doesn't get truncated by
the adb log. | 101 // Print the shader one line at the time so it doesn't get truncated by
the adb log. |
| 103 SkDebugf("%s\n", line.c_str()); | 102 SkDebugf("%s\n", line.c_str()); |
| 104 } | 103 } |
| 105 } | 104 } |
| OLD | NEW |