Flutter Engine
The Flutter Engine
GrShaderCaps.cpp
Go to the documentation of this file.
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
10
12
13////////////////////////////////////////////////////////////////////////////////////////////
14
15#ifdef SK_ENABLE_DUMP_GPU
17
18void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const {
19 writer->beginObject();
20
21 writer->appendBool("Shader Derivative Support", fShaderDerivativeSupport);
22 writer->appendBool("Dst Read In Shader Support", fDstReadInShaderSupport);
23 writer->appendBool("Dual Source Blending Support", fDualSourceBlendingSupport);
24 writer->appendBool("Integer Support", fIntegerSupport);
25 writer->appendBool("Nonsquare Matrix Support", fNonsquareMatrixSupport);
26 writer->appendBool("Inverse Hyperbolic Support", fInverseHyperbolicSupport);
27
28 static const char* kAdvBlendEqInteractionStr[] = {
29 "Not Supported",
30 "Automatic",
31 "General Enable",
32 };
33 static_assert(0 == kNotSupported_AdvBlendEqInteraction);
34 static_assert(1 == kAutomatic_AdvBlendEqInteraction);
35 static_assert(2 == kGeneralEnable_AdvBlendEqInteraction);
36 static_assert(std::size(kAdvBlendEqInteractionStr) == kLast_AdvBlendEqInteraction + 1);
37
38 writer->appendBool("FB Fetch Support", fFBFetchSupport);
39 writer->appendBool("Uses precision modifiers", fUsesPrecisionModifiers);
40 writer->appendBool("Can use void-typed expressions in a sequence expression",
42 writer->appendBool("Can use min() and abs() together", fCanUseMinAndAbsTogether);
43 writer->appendBool("Can use fract() for negative values", fCanUseFractForNegativeValues);
44 writer->appendBool("Must force negated atan param to float", fMustForceNegatedAtanParamToFloat);
45 writer->appendBool("Must force negated ldexp param to multiply",
47 writer->appendBool("Must do op between floor and abs", fMustDoOpBetweenFloorAndAbs);
48 writer->appendBool("Must use local out color for FBFetch", fRequiresLocalOutputColorForFBFetch);
49 writer->appendBool("Must obfuscate uniform color", fMustObfuscateUniformColor);
50 writer->appendBool("Must guard division even after explicit zero check",
52 writer->appendBool("Can use gl_FragCoord", fCanUseFragCoord);
53 writer->appendBool("Add and true to loops workaround", fAddAndTrueToLoopCondition);
54 writer->appendBool("Unfold short circuit as ternary", fUnfoldShortCircuitAsTernary);
55 writer->appendBool("Emulate abs(int) function", fEmulateAbsIntFunction);
56 writer->appendBool("Rewrite do while loops", fRewriteDoWhileLoops);
57 writer->appendBool("Rewrite switch statements", fRewriteSwitchStatements);
58 writer->appendBool("Rewrite pow with constant exponent", fRemovePowWithConstantExponent);
59 writer->appendBool("Must write to sk_FragColor [workaround]", fMustWriteToFragColor);
60 writer->appendBool("Don't add default precision statement for samplerExternalOES",
62 writer->appendBool("Rewrite matrix-vector multiply", fRewriteMatrixVectorMultiply);
63 writer->appendBool("Rewrite matrix equality comparisons", fRewriteMatrixComparisons);
64 writer->appendBool("Rounding fix required for Perlin noise", fPerlinNoiseRoundingFix);
65 writer->appendBool("Must declare fragment front-facing", fMustDeclareFragmentFrontFacing);
66 writer->appendBool("Flat interpolation support", fFlatInterpolationSupport);
67 writer->appendBool("Prefer flat interpolation", fPreferFlatInterpolation);
68 writer->appendBool("No perspective interpolation support", fNoPerspectiveInterpolationSupport);
69 writer->appendBool("Sample mask support", fSampleMaskSupport);
70 writer->appendBool("External texture support", fExternalTextureSupport);
71 writer->appendBool("sk_VertexID support", fVertexIDSupport);
72 writer->appendBool("Infinity support", fInfinitySupport);
73 writer->appendBool("Non-constant array index support", fNonconstantArrayIndexSupport);
74 writer->appendBool("Bit manipulation support", fBitManipulationSupport);
75 writer->appendBool("float == fp32", fFloatIs32Bits);
76 writer->appendBool("half == fp32", fHalfIs32Bits);
77 writer->appendBool("Has poor fragment precision", fHasLowFragmentPrecision);
78 writer->appendBool("Builtin fma() support", fBuiltinFMASupport);
79 writer->appendBool("Builtin determinant() support", fBuiltinDeterminantSupport);
80
81 writer->appendS32("Max FS Samplers", fMaxFragmentSamplers);
82 writer->appendCString("Advanced blend equation interaction",
83 kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]);
84
85 writer->endObject();
86}
87#else
88void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const { }
89#endif
90
92 if (options.fDisableDriverCorrectnessWorkarounds) {
116 }
117 if (options.fReducedShaderVariations) {
118 fReducedShaderMode = true;
119 }
120#if defined(GR_TEST_UTILS)
121 if (options.fSuppressDualSourceBlending) {
123 }
124 if (options.fSuppressFramebufferFetch) {
125 fFBFetchSupport = false;
126 }
127#endif
128}
const char * options
#define SkASSERT(cond)
Definition: SkAssert.h:116
void appendS32(int32_t value)
Definition: SkJSONWriter.h:237
void beginObject(const char *name=nullptr, bool multiline=true)
Definition: SkJSONWriter.h:114
void endObject()
Definition: SkJSONWriter.h:126
void appendBool(bool value)
Definition: SkJSONWriter.h:229
void appendCString(const char *value)
Definition: SkJSONWriter.h:224
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
bool fDstReadInShaderSupport
Definition: GrShaderCaps.h:34
void applyOptionsOverrides(const GrContextOptions &options)
bool fHalfIs32Bits
Definition: GrShaderCaps.h:42
bool fBitManipulationSupport
Definition: GrShaderCaps.h:41
int fMaxFragmentSamplers
Definition: GrShaderCaps.h:71
bool fMustObfuscateUniformColor
Definition: GrShaderCaps.h:51
bool fPreferFlatInterpolation
Definition: GrShaderCaps.h:35
bool fVertexIDSupport
Definition: GrShaderCaps.h:36
bool fRequiresLocalOutputColorForFBFetch
Definition: GrShaderCaps.h:49
bool fMustWriteToFragColor
Definition: GrShaderCaps.h:54
void dumpJSON(SkJSONWriter *) const
bool fReducedShaderMode
Definition: GrShaderCaps.h:46
bool fHasLowFragmentPrecision
Definition: GrShaderCaps.h:43
bool fNonconstantArrayIndexSupport
Definition: GrShaderCaps.h:39
bool fMustGuardDivisionEvenAfterExplicitZeroCheck
Definition: SkSLUtil.h:123
bool fSampleMaskSupport
Definition: SkSLUtil.h:98
bool fRewriteMatrixComparisons
Definition: SkSLUtil.h:142
bool fExternalTextureSupport
Definition: SkSLUtil.h:99
bool fMustForceNegatedAtanParamToFloat
Definition: SkSLUtil.h:113
bool fPerlinNoiseRoundingFix
Definition: SkSLUtil.h:147
bool fFBFetchSupport
Definition: SkSLUtil.h:93
bool fDualSourceBlendingSupport
Definition: SkSLUtil.h:84
bool fEmulateAbsIntFunction
Definition: SkSLUtil.h:131
bool fMustDeclareFragmentFrontFacing
Definition: SkSLUtil.h:151
bool fInfinitySupport
Definition: SkSLUtil.h:103
bool fCanUseVoidInSequenceExpressions
Definition: SkSLUtil.h:110
@ kNotSupported_AdvBlendEqInteraction
Definition: SkSLUtil.h:32
@ kAutomatic_AdvBlendEqInteraction
Definition: SkSLUtil.h:33
@ kLast_AdvBlendEqInteraction
Definition: SkSLUtil.h:36
@ kGeneralEnable_AdvBlendEqInteraction
Definition: SkSLUtil.h:34
bool fUnfoldShortCircuitAsTernary
Definition: SkSLUtil.h:130
bool fShaderDerivativeSupport
Definition: SkSLUtil.h:85
bool fRemovePowWithConstantExponent
Definition: SkSLUtil.h:134
bool fFlatInterpolationSupport
Definition: SkSLUtil.h:96
bool fIntegerSupport
Definition: SkSLUtil.h:89
bool fBuiltinFMASupport
Definition: SkSLUtil.h:106
bool fRewriteMatrixVectorMultiply
Definition: SkSLUtil.h:140
bool fRewriteDoWhileLoops
Definition: SkSLUtil.h:132
bool fRewriteSwitchStatements
Definition: SkSLUtil.h:133
bool fInverseHyperbolicSupport
Definition: SkSLUtil.h:92
AdvBlendEqInteraction fAdvBlendEqInteraction
Definition: SkSLUtil.h:162
bool fBuiltinDeterminantSupport
Definition: SkSLUtil.h:107
bool fNoPerspectiveInterpolationSupport
Definition: SkSLUtil.h:97
bool fAddAndTrueToLoopCondition
Definition: SkSLUtil.h:127
bool fNonsquareMatrixSupport
Definition: SkSLUtil.h:90
bool fMustDoOpBetweenFloorAndAbs
Definition: SkSLUtil.h:120
bool fFloatIs32Bits
Definition: SkSLUtil.h:100
bool fMustForceNegatedLdexpParamToMultiply
Definition: SkSLUtil.h:114
bool fCanUseFractForNegativeValues
Definition: SkSLUtil.h:112
bool fCanUseFragCoord
Definition: SkSLUtil.h:125
bool fNoDefaultPrecisionForExternalSamplers
Definition: SkSLUtil.h:137
bool fAtan2ImplementedAsAtanYOverX
Definition: SkSLUtil.h:116
bool fUsesPrecisionModifiers
Definition: SkSLUtil.h:95
bool fCanUseMinAndAbsTogether
Definition: SkSLUtil.h:111