summaryrefslogtreecommitdiff
path: root/chromium/third_party/skia/include/effects/SkRuntimeEffect.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-09-29 16:16:15 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-11-09 10:04:06 +0000
commita95a7417ad456115a1ef2da4bb8320531c0821f1 (patch)
treeedcd59279e486d2fd4a8f88a7ed025bcf925c6e6 /chromium/third_party/skia/include/effects/SkRuntimeEffect.h
parent33fc33aa94d4add0878ec30dc818e34e1dd3cc2a (diff)
downloadqtwebengine-chromium-a95a7417ad456115a1ef2da4bb8320531c0821f1.tar.gz
BASELINE: Update Chromium to 106.0.5249.126
Change-Id: Ib0bb21c437a7d1686e21c33f2d329f2ac425b7ab Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/438936 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/skia/include/effects/SkRuntimeEffect.h')
-rw-r--r--chromium/third_party/skia/include/effects/SkRuntimeEffect.h58
1 files changed, 31 insertions, 27 deletions
diff --git a/chromium/third_party/skia/include/effects/SkRuntimeEffect.h b/chromium/third_party/skia/include/effects/SkRuntimeEffect.h
index 2f9b98928e3..24a2fc37256 100644
--- a/chromium/third_party/skia/include/effects/SkRuntimeEffect.h
+++ b/chromium/third_party/skia/include/effects/SkRuntimeEffect.h
@@ -25,6 +25,8 @@
#ifdef SK_ENABLE_SKSL
+#include "include/sksl/SkSLVersion.h"
+
class GrRecordingContext;
class SkFilterColorProgram;
class SkImage;
@@ -83,13 +85,17 @@ public:
// When used with SkMeshSpecification, indicates that the uniform is present in the
// fragment shader. Not used with SkRuntimeEffect.
kFragment_Flag = 0x8,
+
+ // This flag indicates that the SkSL uniform uses a medium-precision type
+ // (i.e., `half` instead of `float`).
+ kHalfPrecision_Flag = 0x10,
};
- SkString name;
- size_t offset;
- Type type;
- int count;
- uint32_t flags;
+ std::string_view name;
+ size_t offset;
+ Type type;
+ int count;
+ uint32_t flags;
bool isArray() const { return SkToBool(this->flags & kArray_Flag); }
bool isColor() const { return SkToBool(this->flags & kColor_Flag); }
@@ -104,9 +110,9 @@ public:
};
struct Child {
- SkString name;
- ChildType type;
- int index;
+ std::string_view name;
+ ChildType type;
+ int index;
};
class Options {
@@ -120,17 +126,16 @@ public:
friend class SkRuntimeEffect;
friend class SkRuntimeEffectPriv;
+ // Public SkSL does not allow access to sk_FragCoord. The semantics of that variable are
+ // confusing, and expose clients to implementation details of saveLayer and image filters.
+ bool usePrivateRTShaderModule = false;
+
// TODO(skia:11209) - Replace this with a promised SkCapabilities?
// This flag lifts the ES2 restrictions on Runtime Effects that are gated by the
// `strictES2Mode` check. Be aware that the software renderer and pipeline-stage effect are
// still largely ES3-unaware and can still fail or crash if post-ES2 features are used.
// This is only intended for use by tests and certain internally created effects.
- bool enforceES2Restrictions = true;
-
- // Similarly: Public SkSL does not allow access to sk_FragCoord. The semantics of that
- // variable are confusing, and expose clients to implementation details of saveLayer and
- // image filters.
- bool usePrivateRTShaderModule = false;
+ SkSL::Version maxVersionAllowed = SkSL::Version::k100;
};
// If the effect is compiled successfully, `effect` will be non-null.
@@ -245,14 +250,19 @@ public:
// provide an SkData of this size, containing values for all of those variables.
size_t uniformSize() const;
- SkSpan<const Uniform> uniforms() const { return SkMakeSpan(fUniforms); }
- SkSpan<const Child> children() const { return SkMakeSpan(fChildren); }
+ SkSpan<const Uniform> uniforms() const { return SkSpan(fUniforms); }
+ SkSpan<const Child> children() const { return SkSpan(fChildren); }
// Returns pointer to the named uniform variable's description, or nullptr if not found
- const Uniform* findUniform(const char* name) const;
+ const Uniform* findUniform(std::string_view name) const;
// Returns pointer to the named child's description, or nullptr if not found
- const Child* findChild(const char* name) const;
+ const Child* findChild(std::string_view name) const;
+
+ // Allows the runtime effect type to be identified.
+ bool allowShader() const { return (fFlags & kAllowShader_Flag); }
+ bool allowColorFilter() const { return (fFlags & kAllowColorFilter_Flag); }
+ bool allowBlender() const { return (fFlags & kAllowBlender_Flag); }
static void RegisterFlattenables();
~SkRuntimeEffect() override;
@@ -288,14 +298,11 @@ private:
uint32_t hash() const { return fHash; }
bool usesSampleCoords() const { return (fFlags & kUsesSampleCoords_Flag); }
- bool allowShader() const { return (fFlags & kAllowShader_Flag); }
- bool allowColorFilter() const { return (fFlags & kAllowColorFilter_Flag); }
- bool allowBlender() const { return (fFlags & kAllowBlender_Flag); }
bool samplesOutsideMain() const { return (fFlags & kSamplesOutsideMain_Flag); }
bool usesColorTransform() const { return (fFlags & kUsesColorTransform_Flag); }
bool alwaysOpaque() const { return (fFlags & kAlwaysOpaque_Flag); }
- const SkFilterColorProgram* getFilterColorProgram();
+ const SkFilterColorProgram* getFilterColorProgram() const;
#if SK_SUPPORT_GPU
friend class GrSkSLFP; // fBaseProgram, fSampleUsages
@@ -405,11 +412,8 @@ public:
const SkRuntimeEffect* effect() const { return fEffect.get(); }
- BuilderUniform uniform(const char* name) { return { this, fEffect->findUniform(name) }; }
- BuilderChild child(const char* name) {
- const SkRuntimeEffect::Child* child = fEffect->findChild(name);
- return { this, child };
- }
+ BuilderUniform uniform(std::string_view name) { return { this, fEffect->findUniform(name) }; }
+ BuilderChild child(std::string_view name) { return { this, fEffect->findChild(name) }; }
protected:
SkRuntimeEffectBuilder() = delete;