jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | #include "GrGLSLCaps.h" |
| 10 | |
egdaniel | b7e7d57 | 2015-11-04 04:23:53 -0800 | [diff] [blame] | 11 | #include "GrContextOptions.h" |
| 12 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 13 | //////////////////////////////////////////////////////////////////////////////////////////// |
| 14 | |
| 15 | GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) { |
jvanverth | 98a83a9 | 2015-06-24 11:07:07 -0700 | [diff] [blame] | 16 | fGLSLGeneration = k330_GrGLSLGeneration; |
| 17 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 18 | fDropsTileOnZeroDivide = false; |
| 19 | fFBFetchSupport = false; |
| 20 | fFBFetchNeedsCustomOutput = false; |
| 21 | fBindlessTextureSupport = false; |
egdaniel | f529439 | 2015-10-21 07:14:17 -0700 | [diff] [blame] | 22 | fUsesPrecisionModifiers = false; |
egdaniel | 472d44e | 2015-10-22 08:20:00 -0700 | [diff] [blame] | 23 | fCanUseAnyFunctionInShader = true; |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 24 | fCanUseMinAndAbsTogether = true; |
| 25 | fMustForceNegatedAtanParamToFloat = false; |
egdaniel | 472d44e | 2015-10-22 08:20:00 -0700 | [diff] [blame] | 26 | fVersionDeclString = nullptr; |
egdaniel | 574a4c1 | 2015-11-02 06:22:44 -0800 | [diff] [blame] | 27 | fShaderDerivativeExtensionString = nullptr; |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 28 | fFragCoordConventionsExtensionString = nullptr; |
| 29 | fSecondaryOutputExtensionString = nullptr; |
bsalomon | 7ea33f5 | 2015-11-22 14:51:00 -0800 | [diff] [blame] | 30 | fExternalTextureExtensionString = nullptr; |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 31 | fFBFetchColorName = nullptr; |
| 32 | fFBFetchExtensionString = nullptr; |
jvanverth | 98a83a9 | 2015-06-24 11:07:07 -0700 | [diff] [blame] | 33 | fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction; |
egdaniel | b7e7d57 | 2015-11-04 04:23:53 -0800 | [diff] [blame] | 34 | |
| 35 | fMustSwizzleInShader = false; |
| 36 | memset(fConfigSwizzle, 0, sizeof(fConfigSwizzle)); |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | SkString GrGLSLCaps::dump() const { |
| 40 | SkString r = INHERITED::dump(); |
| 41 | |
| 42 | static const char* kAdvBlendEqInteractionStr[] = { |
| 43 | "Not Supported", |
| 44 | "Automatic", |
| 45 | "General Enable", |
| 46 | "Specific Enables", |
| 47 | }; |
| 48 | GR_STATIC_ASSERT(0 == kNotSupported_AdvBlendEqInteraction); |
| 49 | GR_STATIC_ASSERT(1 == kAutomatic_AdvBlendEqInteraction); |
| 50 | GR_STATIC_ASSERT(2 == kGeneralEnable_AdvBlendEqInteraction); |
| 51 | GR_STATIC_ASSERT(3 == kSpecificEnables_AdvBlendEqInteraction); |
| 52 | GR_STATIC_ASSERT(SK_ARRAY_COUNT(kAdvBlendEqInteractionStr) == kLast_AdvBlendEqInteraction + 1); |
| 53 | |
| 54 | r.appendf("--- GLSL-Specific ---\n"); |
| 55 | |
| 56 | r.appendf("FB Fetch Support: %s\n", (fFBFetchSupport ? "YES" : "NO")); |
| 57 | r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); |
| 58 | r.appendf("Bindless texture support: %s\n", (fBindlessTextureSupport ? "YES" : "NO")); |
egdaniel | f529439 | 2015-10-21 07:14:17 -0700 | [diff] [blame] | 59 | r.appendf("Uses precision modifiers: %s\n", (fUsesPrecisionModifiers ? "YES" : "NO")); |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 60 | r.appendf("Can use any() function: %s\n", (fCanUseAnyFunctionInShader ? "YES" : "NO")); |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 61 | r.appendf("Can use min() and abs() together: %s\n", (fCanUseMinAndAbsTogether ? "YES" : "NO")); |
| 62 | r.appendf("Must force negated atan param to float: %s\n", (fMustForceNegatedAtanParamToFloat ? |
| 63 | "YES" : "NO")); |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 64 | r.appendf("Advanced blend equation interaction: %s\n", |
| 65 | kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]); |
| 66 | return r; |
| 67 | } |
| 68 | |
egdaniel | b7e7d57 | 2015-11-04 04:23:53 -0800 | [diff] [blame] | 69 | void GrGLSLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { |
| 70 | if (options.fUseShaderSwizzling) { |
| 71 | fMustSwizzleInShader = true; |
| 72 | } |
| 73 | } |
| 74 | |