| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrCaps.h" | 8 #include "GrCaps.h" |
| 9 #include "GrContextOptions.h" | 9 #include "GrContextOptions.h" |
| 10 | 10 |
| 11 GrShaderCaps::GrShaderCaps() { | 11 GrShaderCaps::GrShaderCaps() { |
| 12 fShaderDerivativeSupport = false; | 12 fShaderDerivativeSupport = false; |
| 13 fGeometryShaderSupport = false; | 13 fGeometryShaderSupport = false; |
| 14 fPathRenderingSupport = false; | 14 fPathRenderingSupport = false; |
| 15 fDstReadInShaderSupport = false; | 15 fDstReadInShaderSupport = false; |
| 16 fDualSourceBlendingSupport = false; | 16 fDualSourceBlendingSupport = false; |
| 17 fIntegerSupport = false; | 17 fIntegerSupport = false; |
| 18 fTexelBufferSupport = false; |
| 18 fShaderPrecisionVaries = false; | 19 fShaderPrecisionVaries = false; |
| 19 } | 20 } |
| 20 | 21 |
| 21 static const char* shader_type_to_string(GrShaderType type) { | 22 static const char* shader_type_to_string(GrShaderType type) { |
| 22 switch (type) { | 23 switch (type) { |
| 23 case kVertex_GrShaderType: | 24 case kVertex_GrShaderType: |
| 24 return "vertex"; | 25 return "vertex"; |
| 25 case kGeometry_GrShaderType: | 26 case kGeometry_GrShaderType: |
| 26 return "geometry"; | 27 return "geometry"; |
| 27 case kFragment_GrShaderType: | 28 case kFragment_GrShaderType: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 44 | 45 |
| 45 SkString GrShaderCaps::dump() const { | 46 SkString GrShaderCaps::dump() const { |
| 46 SkString r; | 47 SkString r; |
| 47 static const char* gNY[] = { "NO", "YES" }; | 48 static const char* gNY[] = { "NO", "YES" }; |
| 48 r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivative
Support]); | 49 r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivative
Support]); |
| 49 r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSu
pport]); | 50 r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSu
pport]); |
| 50 r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSup
port]); | 51 r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSup
port]); |
| 51 r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderS
upport]); | 52 r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderS
upport]); |
| 52 r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendi
ngSupport]); | 53 r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendi
ngSupport]); |
| 53 r.appendf("Integer Support : %s\n", gNY[fIntegerSupport])
; | 54 r.appendf("Integer Support : %s\n", gNY[fIntegerSupport])
; |
| 55 r.appendf("Texel Buffer Support : %s\n", gNY[fTexelBufferSuppo
rt]); |
| 54 | 56 |
| 55 r.appendf("Shader Float Precisions (varies: %s):\n", gNY[fShaderPrecisionVar
ies]); | 57 r.appendf("Shader Float Precisions (varies: %s):\n", gNY[fShaderPrecisionVar
ies]); |
| 56 | 58 |
| 57 for (int s = 0; s < kGrShaderTypeCount; ++s) { | 59 for (int s = 0; s < kGrShaderTypeCount; ++s) { |
| 58 GrShaderType shaderType = static_cast<GrShaderType>(s); | 60 GrShaderType shaderType = static_cast<GrShaderType>(s); |
| 59 r.appendf("\t%s:\n", shader_type_to_string(shaderType)); | 61 r.appendf("\t%s:\n", shader_type_to_string(shaderType)); |
| 60 for (int p = 0; p < kGrSLPrecisionCount; ++p) { | 62 for (int p = 0; p < kGrSLPrecisionCount; ++p) { |
| 61 if (fFloatPrecisions[s][p].supported()) { | 63 if (fFloatPrecisions[s][p].supported()) { |
| 62 GrSLPrecision precision = static_cast<GrSLPrecision>(p); | 64 GrSLPrecision precision = static_cast<GrSLPrecision>(p); |
| 63 r.appendf("\t\t%s: log_low: %d log_high: %d bits: %d\n", | 65 r.appendf("\t\t%s: log_low: %d log_high: %d bits: %d\n", |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 258 |
| 257 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 259 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
| 258 GrPixelConfig config = static_cast<GrPixelConfig>(i); | 260 GrPixelConfig config = static_cast<GrPixelConfig>(i); |
| 259 r.appendf("%s is uploadable to a texture: %s\n", | 261 r.appendf("%s is uploadable to a texture: %s\n", |
| 260 kConfigNames[i], | 262 kConfigNames[i], |
| 261 gNY[this->isConfigTexturable(config)]); | 263 gNY[this->isConfigTexturable(config)]); |
| 262 } | 264 } |
| 263 | 265 |
| 264 return r; | 266 return r; |
| 265 } | 267 } |
| OLD | NEW |