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" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 break; | 79 break; |
80 case k320es_GrGLSLGeneration: | 80 case k320es_GrGLSLGeneration: |
81 SkASSERT(kGLES_GrGLStandard == standard); | 81 SkASSERT(kGLES_GrGLStandard == standard); |
82 result.fVersion = 320; | 82 result.fVersion = 320; |
83 break; | 83 break; |
84 } | 84 } |
85 result.fIsCoreProfile = caps->isCoreProfile(); | 85 result.fIsCoreProfile = caps->isCoreProfile(); |
86 result.fUsesPrecisionModifiers = glslCaps->usesPrecisionModifiers(); | 86 result.fUsesPrecisionModifiers = glslCaps->usesPrecisionModifiers(); |
87 result.fMustDeclareFragmentShaderOutput = glslCaps->mustDeclareFragmentShade
rOutput(); | 87 result.fMustDeclareFragmentShaderOutput = glslCaps->mustDeclareFragmentShade
rOutput(); |
88 result.fCanUseMinAndAbsTogether = glslCaps->canUseMinAndAbsTogether(); | 88 result.fCanUseMinAndAbsTogether = glslCaps->canUseMinAndAbsTogether(); |
| 89 result.fMustForceNegatedAtanParamToFloat = glslCaps->mustForceNegatedAtanPar
amToFloat(); |
89 return result; | 90 return result; |
90 } | 91 } |
91 | 92 |
92 static void dump_string(std::string s) { | 93 static void dump_string(std::string s) { |
93 // on Android, SkDebugf only displays the first 1K characters of output, whi
ch results in | 94 // on Android, SkDebugf only displays the first 1K characters of output, whi
ch results in |
94 // incomplete shader source code. Print each line individually to avoid this
problem. | 95 // incomplete shader source code. Print each line individually to avoid this
problem. |
95 size_t index = 0; | 96 size_t index = 0; |
96 for (;;) { | 97 for (;;) { |
97 size_t next = s.find("\n", index); | 98 size_t next = s.find("\n", index); |
98 if (next == std::string::npos) { | 99 if (next == std::string::npos) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 213 |
213 static void print_shader_source(const char** strings, int* lengths, int count) { | 214 static void print_shader_source(const char** strings, int* lengths, int count) { |
214 const SkString& pretty = GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths
, count, true); | 215 const SkString& pretty = GrGLSLPrettyPrint::PrettyPrintGLSL(strings, lengths
, count, true); |
215 SkTArray<SkString> lines; | 216 SkTArray<SkString> lines; |
216 SkStrSplit(pretty.c_str(), "\n", &lines); | 217 SkStrSplit(pretty.c_str(), "\n", &lines); |
217 for (const SkString& line : lines) { | 218 for (const SkString& line : lines) { |
218 // Print the shader one line at the time so it doesn't get truncated by
the adb log. | 219 // Print the shader one line at the time so it doesn't get truncated by
the adb log. |
219 SkDebugf("%s\n", line.c_str()); | 220 SkDebugf("%s\n", line.c_str()); |
220 } | 221 } |
221 } | 222 } |
OLD | NEW |