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 | |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 8 | #ifndef GrShaderCaps_DEFINED |
| 9 | #define GrShaderCaps_DEFINED |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/core/SkRefCnt.h" |
| 12 | #include "include/private/GrTypesPriv.h" |
Brian Salomon | 3ec1f54 | 2019-06-17 17:54:57 +0000 | [diff] [blame] | 13 | #include "src/gpu/GrSwizzle.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 14 | #include "src/gpu/glsl/GrGLSL.h" |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 15 | |
Ethan Nicholas | 7ef4b74 | 2016-11-11 15:16:46 -0500 | [diff] [blame] | 16 | namespace SkSL { |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 17 | class ShaderCapsFactory; |
Ethan Nicholas | 7ef4b74 | 2016-11-11 15:16:46 -0500 | [diff] [blame] | 18 | } |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 19 | |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 20 | struct GrContextOptions; |
Brian Osman | 71a1889 | 2017-08-10 10:23:25 -0400 | [diff] [blame] | 21 | class SkJSONWriter; |
Ethan Nicholas | 7ef4b74 | 2016-11-11 15:16:46 -0500 | [diff] [blame] | 22 | |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 23 | class GrShaderCaps : public SkRefCnt { |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 24 | public: |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 25 | /** |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 26 | * Indicates how GLSL must interact with advanced blend equations. The KHR extension requires |
| 27 | * special layout qualifiers in the fragment shader. |
| 28 | */ |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 29 | enum AdvBlendEqInteraction { |
| 30 | kNotSupported_AdvBlendEqInteraction, //<! No _blend_equation_advanced extension |
| 31 | kAutomatic_AdvBlendEqInteraction, //<! No interaction required |
| 32 | kGeneralEnable_AdvBlendEqInteraction, //<! layout(blend_support_all_equations) out |
| 33 | kSpecificEnables_AdvBlendEqInteraction, //<! Specific layout qualifiers per equation |
| 34 | |
| 35 | kLast_AdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction |
| 36 | }; |
| 37 | |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 38 | GrShaderCaps(const GrContextOptions&); |
| 39 | |
Brian Osman | 71a1889 | 2017-08-10 10:23:25 -0400 | [diff] [blame] | 40 | void dumpJSON(SkJSONWriter*) const; |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 41 | |
Khushal | 3e7548c | 2018-05-23 15:45:01 -0700 | [diff] [blame] | 42 | bool supportsDistanceFieldText() const { return fShaderDerivativeSupport; } |
| 43 | |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 44 | bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } |
| 45 | bool geometryShaderSupport() const { return fGeometryShaderSupport; } |
Chris Dalton | f1b47bb | 2017-10-06 11:57:51 -0600 | [diff] [blame] | 46 | bool gsInvocationsSupport() const { return fGSInvocationsSupport; } |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 47 | bool pathRenderingSupport() const { return fPathRenderingSupport; } |
| 48 | bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } |
| 49 | bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } |
| 50 | bool integerSupport() const { return fIntegerSupport; } |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 51 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 52 | /** |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 53 | * Some helper functions for encapsulating various extensions to read FB Buffer on openglES |
| 54 | * |
| 55 | * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar to this effect |
| 56 | */ |
| 57 | bool fbFetchSupport() const { return fFBFetchSupport; } |
| 58 | |
| 59 | bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; } |
| 60 | |
egdaniel | 472d44e | 2015-10-22 08:20:00 -0700 | [diff] [blame] | 61 | const char* versionDeclString() const { return fVersionDeclString; } |
| 62 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 63 | const char* fbFetchColorName() const { return fFBFetchColorName; } |
| 64 | |
| 65 | const char* fbFetchExtensionString() const { return fFBFetchExtensionString; } |
| 66 | |
cdalton | c08f196 | 2016-02-12 12:14:06 -0800 | [diff] [blame] | 67 | bool flatInterpolationSupport() const { return fFlatInterpolationSupport; } |
| 68 | |
Brian Salomon | 4127456 | 2017-09-15 09:40:03 -0700 | [diff] [blame] | 69 | bool preferFlatInterpolation() const { return fPreferFlatInterpolation; } |
| 70 | |
cdalton | c08f196 | 2016-02-12 12:14:06 -0800 | [diff] [blame] | 71 | bool noperspectiveInterpolationSupport() const { return fNoPerspectiveInterpolationSupport; } |
| 72 | |
Chris Dalton | 69258ff | 2019-05-13 17:59:54 -0600 | [diff] [blame] | 73 | // Can we use sample variables everywhere? |
Chris Dalton | d31b5e7 | 2019-02-26 18:02:16 -0700 | [diff] [blame] | 74 | bool sampleVariablesSupport() const { return fSampleVariablesSupport; } |
| 75 | |
Chris Dalton | 69258ff | 2019-05-13 17:59:54 -0600 | [diff] [blame] | 76 | // Can we use sample variables when rendering to stencil? (This is a workaround for platforms |
| 77 | // where sample variables are broken in general, but seem to work when rendering to stencil.) |
| 78 | bool sampleVariablesStencilSupport() const { return fSampleVariablesStencilSupport; } |
| 79 | |
cdalton | 9c3f143 | 2016-03-11 10:07:37 -0800 | [diff] [blame] | 80 | bool externalTextureSupport() const { return fExternalTextureSupport; } |
| 81 | |
Chris Dalton | 1d61635 | 2017-05-31 12:51:23 -0600 | [diff] [blame] | 82 | bool vertexIDSupport() const { return fVertexIDSupport; } |
| 83 | |
Chris Dalton | 7c7ff03 | 2018-03-28 20:09:58 -0600 | [diff] [blame] | 84 | // frexp, ldexp, etc. |
| 85 | bool fpManipulationSupport() const { return fFPManipulationSupport; } |
| 86 | |
Chris Dalton | 47c8ed3 | 2017-11-15 18:27:09 -0700 | [diff] [blame] | 87 | bool floatIs32Bits() const { return fFloatIs32Bits; } |
| 88 | |
| 89 | bool halfIs32Bits() const { return fHalfIs32Bits; } |
| 90 | |
Jim Van Verth | 20ae25c | 2019-03-29 08:50:41 -0400 | [diff] [blame] | 91 | bool hasLowFragmentPrecision() const { return fHasLowFragmentPrecision; } |
| 92 | |
Chris Dalton | a708618 | 2018-11-16 09:33:43 -0500 | [diff] [blame] | 93 | // SkSL only. |
| 94 | bool builtinFMASupport() const { return fBuiltinFMASupport; } |
| 95 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 96 | AdvBlendEqInteraction advBlendEqInteraction() const { return fAdvBlendEqInteraction; } |
| 97 | |
| 98 | bool mustEnableAdvBlendEqs() const { |
| 99 | return fAdvBlendEqInteraction >= kGeneralEnable_AdvBlendEqInteraction; |
| 100 | } |
| 101 | |
| 102 | bool mustEnableSpecificAdvBlendEqs() const { |
| 103 | return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction; |
| 104 | } |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 105 | |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 106 | bool mustDeclareFragmentShaderOutput() const { return fGLSLGeneration > k110_GrGLSLGeneration; } |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 107 | |
egdaniel | f529439 | 2015-10-21 07:14:17 -0700 | [diff] [blame] | 108 | bool usesPrecisionModifiers() const { return fUsesPrecisionModifiers; } |
| 109 | |
Greg Daniel | 80a08dd | 2017-01-20 10:45:49 -0500 | [diff] [blame] | 110 | // Returns whether we can use the glsl function any() in our shader code. |
egdaniel | 472d44e | 2015-10-22 08:20:00 -0700 | [diff] [blame] | 111 | bool canUseAnyFunctionInShader() const { return fCanUseAnyFunctionInShader; } |
| 112 | |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 113 | bool canUseMinAndAbsTogether() const { return fCanUseMinAndAbsTogether; } |
| 114 | |
Florin Malita | 8a0044f | 2017-08-07 14:38:22 -0400 | [diff] [blame] | 115 | bool canUseFractForNegativeValues() const { return fCanUseFractForNegativeValues; } |
| 116 | |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 117 | bool mustForceNegatedAtanParamToFloat() const { return fMustForceNegatedAtanParamToFloat; } |
| 118 | |
Greg Daniel | 80a08dd | 2017-01-20 10:45:49 -0500 | [diff] [blame] | 119 | // Returns whether a device incorrectly implements atan(y,x) as atan(y/x) |
| 120 | bool atan2ImplementedAsAtanYOverX() const { return fAtan2ImplementedAsAtanYOverX; } |
| 121 | |
Greg Daniel | 10ed243 | 2017-12-01 16:19:43 -0500 | [diff] [blame] | 122 | // If this returns true some operation (could be a no op) must be called between floor and abs |
| 123 | // to make sure the driver compiler doesn't inline them together which can cause a driver bug in |
| 124 | // the shader. |
| 125 | bool mustDoOpBetweenFloorAndAbs() const { return fMustDoOpBetweenFloorAndAbs; } |
| 126 | |
Brian Osman | cd3261a | 2018-01-16 13:52:29 +0000 | [diff] [blame] | 127 | // If false, SkSL uses a workaround so that sk_FragCoord doesn't actually query gl_FragCoord |
| 128 | bool canUseFragCoord() const { return fCanUseFragCoord; } |
| 129 | |
Chris Dalton | c2d0dd6 | 2018-03-07 07:46:10 -0700 | [diff] [blame] | 130 | // If true, short ints can't represent every integer in the 16-bit two's complement range as |
| 131 | // required by the spec. SKSL will always emit full ints. |
| 132 | bool incompleteShortIntPrecision() const { return fIncompleteShortIntPrecision; } |
| 133 | |
Adrienne Walker | c02165f | 2018-08-21 11:08:11 -0700 | [diff] [blame] | 134 | // If true, then conditions in for loops need "&& true" to work around driver bugs. |
Adrienne Walker | ee8295c | 2018-08-21 10:56:30 -0700 | [diff] [blame] | 135 | bool addAndTrueToLoopCondition() const { return fAddAndTrueToLoopCondition; } |
| 136 | |
Adrienne Walker | c02165f | 2018-08-21 11:08:11 -0700 | [diff] [blame] | 137 | // If true, then expressions such as "x && y" or "x || y" are rewritten as |
| 138 | // ternary to work around driver bugs. |
| 139 | bool unfoldShortCircuitAsTernary() const { return fUnfoldShortCircuitAsTernary; } |
| 140 | |
Adrienne Walker | 92b161f | 2018-08-22 10:41:52 -0700 | [diff] [blame] | 141 | bool emulateAbsIntFunction() const { return fEmulateAbsIntFunction; } |
| 142 | |
Adrienne Walker | 8b23ca6 | 2018-08-22 10:45:41 -0700 | [diff] [blame] | 143 | bool rewriteDoWhileLoops() const { return fRewriteDoWhileLoops; } |
| 144 | |
Adrienne Walker | 2f4c09b | 2018-08-22 16:04:57 -0700 | [diff] [blame] | 145 | bool removePowWithConstantExponent() const { return fRemovePowWithConstantExponent; } |
| 146 | |
egdaniel | 138c263 | 2016-08-17 10:59:00 -0700 | [diff] [blame] | 147 | bool requiresLocalOutputColorForFBFetch() const { return fRequiresLocalOutputColorForFBFetch; } |
| 148 | |
Brian Osman | ac1e496 | 2017-05-25 11:34:38 -0400 | [diff] [blame] | 149 | bool mustObfuscateUniformColor() const { return fMustObfuscateUniformColor; } |
| 150 | |
Brian Osman | dff5d43 | 2017-08-01 14:46:18 -0400 | [diff] [blame] | 151 | // The D3D shader compiler, when targeting PS 3.0 (ie within ANGLE) fails to compile certain |
| 152 | // constructs. See detailed comments in GrGLCaps.cpp. |
| 153 | bool mustGuardDivisionEvenAfterExplicitZeroCheck() const { |
| 154 | return fMustGuardDivisionEvenAfterExplicitZeroCheck; |
| 155 | } |
| 156 | |
Chris Dalton | 8e30ad4 | 2019-04-08 10:51:14 -0600 | [diff] [blame] | 157 | // On Nexus 6, the GL context can get lost if a shader does not write a value to gl_FragColor. |
| 158 | // https://bugs.chromium.org/p/chromium/issues/detail?id=445377 |
| 159 | bool mustWriteToFragColor() const { return fMustWriteToFragColor; } |
| 160 | |
Brian Salomon | 5a5f3e8 | 2019-08-16 15:05:40 -0400 | [diff] [blame] | 161 | // The Android emulator claims samplerExternalOES is an unknown type if a default precision |
| 162 | // statement is made for the type. |
| 163 | bool noDefaultPrecisionForExternalSamplers() const { |
| 164 | return fNoDefaultPrecisionForExternalSamplers; |
| 165 | } |
| 166 | |
egdaniel | 574a4c1 | 2015-11-02 06:22:44 -0800 | [diff] [blame] | 167 | // Returns the string of an extension that must be enabled in the shader to support |
| 168 | // derivatives. If nullptr is returned then no extension needs to be enabled. Before calling |
| 169 | // this function, the caller should check that shaderDerivativeSupport exists. |
| 170 | const char* shaderDerivativeExtensionString() const { |
| 171 | SkASSERT(this->shaderDerivativeSupport()); |
| 172 | return fShaderDerivativeExtensionString; |
| 173 | } |
cdalton | 33ad701 | 2016-02-22 07:55:44 -0800 | [diff] [blame] | 174 | |
Chris Dalton | 8fd7955 | 2018-01-11 00:46:14 -0500 | [diff] [blame] | 175 | // Returns the string of an extension that must be enabled in the shader to support geometry |
| 176 | // shaders. If nullptr is returned then no extension needs to be enabled. Before calling this |
| 177 | // function, the caller must verify that geometryShaderSupport exists. |
| 178 | const char* geometryShaderExtensionString() const { |
| 179 | SkASSERT(this->geometryShaderSupport()); |
| 180 | return fGeometryShaderExtensionString; |
| 181 | } |
| 182 | |
Chris Dalton | f1b47bb | 2017-10-06 11:57:51 -0600 | [diff] [blame] | 183 | // Returns the string of an extension that must be enabled in the shader to support |
| 184 | // geometry shader invocations. If nullptr is returned then no extension needs to be enabled. |
| 185 | // Before calling this function, the caller must verify that gsInvocationsSupport exists. |
| 186 | const char* gsInvocationsExtensionString() const { |
| 187 | SkASSERT(this->gsInvocationsSupport()); |
| 188 | return fGSInvocationsExtensionString; |
| 189 | } |
| 190 | |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 191 | // Returns the string of an extension that will do all necessary coord transfomations needed |
| 192 | // when reading the fragment position. If such an extension does not exisits, this function |
| 193 | // returns a nullptr, and all transforms of the frag position must be done manually in the |
| 194 | // shader. |
| 195 | const char* fragCoordConventionsExtensionString() const { |
| 196 | return fFragCoordConventionsExtensionString; |
| 197 | } |
| 198 | |
| 199 | // This returns the name of an extension that must be enabled in the shader, if such a thing is |
| 200 | // required in order to use a secondary output in the shader. This returns a nullptr if no such |
| 201 | // extension is required. However, the return value of this function does not say whether dual |
| 202 | // source blending is supported. |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 203 | const char* secondaryOutputExtensionString() const { return fSecondaryOutputExtensionString; } |
egdaniel | 574a4c1 | 2015-11-02 06:22:44 -0800 | [diff] [blame] | 204 | |
Brian Osman | 061020e | 2018-04-17 14:22:15 -0400 | [diff] [blame] | 205 | // This returns the name of an extension that must be enabled in the shader to support external |
| 206 | // textures. In some cases, two extensions must be enabled - the second extension is returned |
| 207 | // by secondExternalTextureExtensionString(). If that function returns nullptr, then only one |
| 208 | // extension is required. |
bsalomon | 7ea33f5 | 2015-11-22 14:51:00 -0800 | [diff] [blame] | 209 | const char* externalTextureExtensionString() const { |
cdalton | 9c3f143 | 2016-03-11 10:07:37 -0800 | [diff] [blame] | 210 | SkASSERT(this->externalTextureSupport()); |
bsalomon | 7ea33f5 | 2015-11-22 14:51:00 -0800 | [diff] [blame] | 211 | return fExternalTextureExtensionString; |
| 212 | } |
| 213 | |
Brian Osman | 061020e | 2018-04-17 14:22:15 -0400 | [diff] [blame] | 214 | const char* secondExternalTextureExtensionString() const { |
| 215 | SkASSERT(this->externalTextureSupport()); |
| 216 | return fSecondExternalTextureExtensionString; |
| 217 | } |
| 218 | |
cdalton | c08f196 | 2016-02-12 12:14:06 -0800 | [diff] [blame] | 219 | const char* noperspectiveInterpolationExtensionString() const { |
| 220 | SkASSERT(this->noperspectiveInterpolationSupport()); |
| 221 | return fNoPerspectiveInterpolationExtensionString; |
| 222 | } |
| 223 | |
Chris Dalton | d31b5e7 | 2019-02-26 18:02:16 -0700 | [diff] [blame] | 224 | const char* sampleVariablesExtensionString() const { |
Chris Dalton | a7ad120 | 2019-07-19 15:31:59 -0600 | [diff] [blame] | 225 | SkASSERT(this->sampleVariablesSupport() || this->sampleVariablesStencilSupport()); |
Chris Dalton | d31b5e7 | 2019-02-26 18:02:16 -0700 | [diff] [blame] | 226 | return fSampleVariablesExtensionString; |
| 227 | } |
| 228 | |
cdalton | 9c3f143 | 2016-03-11 10:07:37 -0800 | [diff] [blame] | 229 | int maxFragmentSamplers() const { return fMaxFragmentSamplers; } |
| 230 | |
Brian Salomon | 68ba117 | 2019-06-05 11:15:08 -0400 | [diff] [blame] | 231 | bool textureSwizzleAppliedInShader() const { return fTextureSwizzleAppliedInShader; } |
| 232 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 233 | GrGLSLGeneration generation() const { return fGLSLGeneration; } |
| 234 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 235 | private: |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 236 | void applyOptionsOverrides(const GrContextOptions& options); |
egdaniel | b7e7d57 | 2015-11-04 04:23:53 -0800 | [diff] [blame] | 237 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 238 | GrGLSLGeneration fGLSLGeneration; |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 239 | |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 240 | bool fShaderDerivativeSupport : 1; |
| 241 | bool fGeometryShaderSupport : 1; |
| 242 | bool fGSInvocationsSupport : 1; |
| 243 | bool fPathRenderingSupport : 1; |
| 244 | bool fDstReadInShaderSupport : 1; |
| 245 | bool fDualSourceBlendingSupport : 1; |
| 246 | bool fIntegerSupport : 1; |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 247 | bool fFBFetchSupport : 1; |
| 248 | bool fFBFetchNeedsCustomOutput : 1; |
| 249 | bool fUsesPrecisionModifiers : 1; |
| 250 | bool fFlatInterpolationSupport : 1; |
| 251 | bool fPreferFlatInterpolation : 1; |
cdalton | c08f196 | 2016-02-12 12:14:06 -0800 | [diff] [blame] | 252 | bool fNoPerspectiveInterpolationSupport : 1; |
Chris Dalton | d31b5e7 | 2019-02-26 18:02:16 -0700 | [diff] [blame] | 253 | bool fSampleVariablesSupport : 1; |
Chris Dalton | 69258ff | 2019-05-13 17:59:54 -0600 | [diff] [blame] | 254 | bool fSampleVariablesStencilSupport : 1; |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 255 | bool fExternalTextureSupport : 1; |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 256 | bool fVertexIDSupport : 1; |
| 257 | bool fFPManipulationSupport : 1; |
| 258 | bool fFloatIs32Bits : 1; |
| 259 | bool fHalfIs32Bits : 1; |
Jim Van Verth | 20ae25c | 2019-03-29 08:50:41 -0400 | [diff] [blame] | 260 | bool fHasLowFragmentPrecision : 1; |
Brian Salomon | 68ba117 | 2019-06-05 11:15:08 -0400 | [diff] [blame] | 261 | bool fTextureSwizzleAppliedInShader : 1; |
egdaniel | f529439 | 2015-10-21 07:14:17 -0700 | [diff] [blame] | 262 | |
Chris Dalton | a708618 | 2018-11-16 09:33:43 -0500 | [diff] [blame] | 263 | // Used by SkSL to know when to generate polyfills. |
| 264 | bool fBuiltinFMASupport : 1; |
| 265 | |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 266 | // Used for specific driver bug work arounds |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 267 | bool fCanUseAnyFunctionInShader : 1; |
| 268 | bool fCanUseMinAndAbsTogether : 1; |
| 269 | bool fCanUseFractForNegativeValues : 1; |
| 270 | bool fMustForceNegatedAtanParamToFloat : 1; |
| 271 | bool fAtan2ImplementedAsAtanYOverX : 1; |
| 272 | bool fMustDoOpBetweenFloorAndAbs : 1; |
| 273 | bool fRequiresLocalOutputColorForFBFetch : 1; |
| 274 | bool fMustObfuscateUniformColor : 1; |
Brian Osman | dff5d43 | 2017-08-01 14:46:18 -0400 | [diff] [blame] | 275 | bool fMustGuardDivisionEvenAfterExplicitZeroCheck : 1; |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 276 | bool fCanUseFragCoord : 1; |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame] | 277 | bool fIncompleteShortIntPrecision : 1; |
Adrienne Walker | ee8295c | 2018-08-21 10:56:30 -0700 | [diff] [blame] | 278 | bool fAddAndTrueToLoopCondition : 1; |
Adrienne Walker | c02165f | 2018-08-21 11:08:11 -0700 | [diff] [blame] | 279 | bool fUnfoldShortCircuitAsTernary : 1; |
Adrienne Walker | 92b161f | 2018-08-22 10:41:52 -0700 | [diff] [blame] | 280 | bool fEmulateAbsIntFunction : 1; |
Adrienne Walker | 8b23ca6 | 2018-08-22 10:45:41 -0700 | [diff] [blame] | 281 | bool fRewriteDoWhileLoops : 1; |
Adrienne Walker | 2f4c09b | 2018-08-22 16:04:57 -0700 | [diff] [blame] | 282 | bool fRemovePowWithConstantExponent : 1; |
Chris Dalton | 8e30ad4 | 2019-04-08 10:51:14 -0600 | [diff] [blame] | 283 | bool fMustWriteToFragColor : 1; |
Brian Salomon | 5a5f3e8 | 2019-08-16 15:05:40 -0400 | [diff] [blame] | 284 | bool fNoDefaultPrecisionForExternalSamplers : 1; |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 285 | |
egdaniel | 472d44e | 2015-10-22 08:20:00 -0700 | [diff] [blame] | 286 | const char* fVersionDeclString; |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 287 | |
egdaniel | 574a4c1 | 2015-11-02 06:22:44 -0800 | [diff] [blame] | 288 | const char* fShaderDerivativeExtensionString; |
Chris Dalton | 8fd7955 | 2018-01-11 00:46:14 -0500 | [diff] [blame] | 289 | const char* fGeometryShaderExtensionString; |
Chris Dalton | f1b47bb | 2017-10-06 11:57:51 -0600 | [diff] [blame] | 290 | const char* fGSInvocationsExtensionString; |
egdaniel | 8dcdedc | 2015-11-11 06:27:20 -0800 | [diff] [blame] | 291 | const char* fFragCoordConventionsExtensionString; |
| 292 | const char* fSecondaryOutputExtensionString; |
bsalomon | 7ea33f5 | 2015-11-22 14:51:00 -0800 | [diff] [blame] | 293 | const char* fExternalTextureExtensionString; |
Brian Osman | 061020e | 2018-04-17 14:22:15 -0400 | [diff] [blame] | 294 | const char* fSecondExternalTextureExtensionString; |
cdalton | c08f196 | 2016-02-12 12:14:06 -0800 | [diff] [blame] | 295 | const char* fNoPerspectiveInterpolationExtensionString; |
Chris Dalton | d31b5e7 | 2019-02-26 18:02:16 -0700 | [diff] [blame] | 296 | const char* fSampleVariablesExtensionString; |
egdaniel | 574a4c1 | 2015-11-02 06:22:44 -0800 | [diff] [blame] | 297 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 298 | const char* fFBFetchColorName; |
| 299 | const char* fFBFetchExtensionString; |
| 300 | |
jvanverth | e78d487 | 2016-09-27 03:33:05 -0700 | [diff] [blame] | 301 | int fMaxFragmentSamplers; |
cdalton | 9c3f143 | 2016-03-11 10:07:37 -0800 | [diff] [blame] | 302 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 303 | AdvBlendEqInteraction fAdvBlendEqInteraction; |
| 304 | |
Chris Dalton | 040238b | 2017-12-18 14:22:34 -0700 | [diff] [blame] | 305 | friend class GrCaps; // For initialization. |
Stephen White | 79b81c9 | 2019-07-31 15:56:26 -0400 | [diff] [blame] | 306 | friend class GrDawnCaps; |
Chris Dalton | 040238b | 2017-12-18 14:22:34 -0700 | [diff] [blame] | 307 | friend class GrGLCaps; |
Chris Dalton | fddb6c0 | 2017-11-04 15:22:22 -0600 | [diff] [blame] | 308 | friend class GrMockCaps; |
Greg Daniel | cebcb84 | 2017-07-31 10:45:52 -0400 | [diff] [blame] | 309 | friend class GrMtlCaps; |
egdaniel | fa89632 | 2016-01-13 12:19:30 -0800 | [diff] [blame] | 310 | friend class GrVkCaps; |
Brian Salomon | f1dd677 | 2016-11-29 15:27:52 -0500 | [diff] [blame] | 311 | friend class SkSL::ShaderCapsFactory; |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 312 | }; |
| 313 | |
jvanverth | cba99b8 | 2015-06-24 06:59:57 -0700 | [diff] [blame] | 314 | #endif |