@shopify/react-native-skia 0.1.129 → 0.1.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +1 -0
- package/cpp/api/JsiSkRuntimeEffect.h +7 -9
- package/cpp/api/JsiSkVertices.h +0 -2
- package/cpp/rnskia/values/RNSkValue.h +1 -1
- package/cpp/skia/include/codec/SkCodec.h +7 -1
- package/cpp/skia/include/core/SkAlphaType.h +45 -0
- package/cpp/skia/include/core/SkBitmap.h +4 -2
- package/cpp/skia/include/core/SkCanvas.h +31 -20
- package/cpp/skia/include/core/SkColor.h +1 -1
- package/cpp/skia/include/core/SkColorFilter.h +1 -0
- package/cpp/skia/include/core/SkColorType.h +66 -0
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +1 -1
- package/cpp/skia/include/core/SkDrawable.h +7 -0
- package/cpp/skia/include/core/SkEncodedImageFormat.h +1 -0
- package/cpp/skia/include/core/SkFont.h +4 -3
- package/cpp/skia/include/core/SkFontArguments.h +33 -1
- package/cpp/skia/include/core/SkGraphics.h +13 -0
- package/cpp/skia/include/core/SkImage.h +67 -22
- package/cpp/skia/include/core/SkImageEncoder.h +0 -3
- package/cpp/skia/include/core/SkImageGenerator.h +4 -3
- package/cpp/skia/include/core/SkImageInfo.h +35 -142
- package/cpp/skia/include/core/SkMesh.h +303 -0
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOpenTypeSVGDecoder.h +30 -0
- package/cpp/skia/include/core/SkPaint.h +4 -19
- package/cpp/skia/include/core/SkPath.h +20 -33
- package/cpp/skia/include/core/SkPathBuilder.h +1 -6
- package/cpp/skia/include/core/SkPixelRef.h +1 -1
- package/cpp/skia/include/core/SkPixmap.h +3 -2
- package/cpp/skia/include/core/SkRSXform.h +1 -1
- package/cpp/skia/include/core/SkSamplingOptions.h +16 -5
- package/cpp/skia/include/core/SkSpan.h +5 -5
- package/cpp/skia/include/core/SkString.h +5 -8
- package/cpp/skia/include/core/SkSurface.h +21 -0
- package/cpp/skia/include/core/SkTypeface.h +20 -4
- package/cpp/skia/include/core/SkTypes.h +9 -5
- package/cpp/skia/include/effects/SkGradientShader.h +9 -18
- package/cpp/skia/include/effects/SkRuntimeEffect.h +16 -12
- package/cpp/skia/include/gpu/GpuTypes.h +32 -0
- package/cpp/skia/include/gpu/GrBackendSemaphore.h +1 -1
- package/cpp/skia/include/gpu/GrBackendSurface.h +6 -5
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +1 -1
- package/cpp/skia/include/gpu/GrContextOptions.h +11 -20
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +7 -0
- package/cpp/skia/include/gpu/GrDirectContext.h +16 -11
- package/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h +0 -2
- package/cpp/skia/include/gpu/GrRecordingContext.h +14 -7
- package/cpp/skia/include/gpu/GrSurfaceInfo.h +6 -6
- package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +1 -1
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +3 -1
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +64 -0
- package/cpp/skia/include/gpu/graphite/Context.h +124 -0
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +71 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +104 -0
- package/cpp/skia/include/gpu/graphite/Recording.h +39 -0
- package/cpp/skia/include/gpu/graphite/SkStuff.h +47 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +91 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +24 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlTypes.h +68 -0
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +1 -2
- package/cpp/skia/include/ports/SkCFObject.h +0 -4
- package/cpp/skia/include/ports/SkTypeface_win.h +2 -2
- package/cpp/skia/include/private/{GrSingleOwner.h → SingleOwner.h} +17 -10
- package/cpp/skia/include/private/SkChecksum.h +11 -0
- package/cpp/skia/include/private/SkEncodedInfo.h +22 -5
- package/cpp/skia/include/private/SkFloatingPoint.h +0 -53
- package/cpp/skia/include/private/SkImageInfoPriv.h +8 -2
- package/cpp/skia/include/private/SkMacros.h +13 -18
- package/cpp/skia/include/private/SkMutex.h +8 -0
- package/cpp/skia/include/private/SkPathRef.h +2 -16
- package/cpp/skia/include/private/SkSLDefines.h +9 -1
- package/cpp/skia/include/private/SkSLIRNode.h +6 -5
- package/cpp/skia/include/private/SkSLLayout.h +11 -10
- package/cpp/skia/include/private/SkSLModifiers.h +4 -3
- package/cpp/skia/include/private/SkSLProgramElement.h +2 -2
- package/cpp/skia/include/private/SkSLProgramKind.h +8 -5
- package/cpp/skia/include/private/SkSLStatement.h +2 -3
- package/cpp/skia/include/private/SkSLString.h +17 -56
- package/cpp/skia/include/private/SkSLSymbol.h +4 -4
- package/cpp/skia/include/private/SkShadowFlags.h +3 -1
- package/cpp/skia/include/private/SkStringView.h +47 -0
- package/cpp/skia/include/private/SkTArray.h +4 -3
- package/cpp/skia/include/private/SkTHash.h +66 -24
- package/cpp/skia/include/private/SkTLogic.h +2 -32
- package/cpp/skia/include/private/SkTemplates.h +2 -2
- package/cpp/skia/include/private/SkThreadAnnotations.h +4 -4
- package/cpp/skia/include/private/SkVx.h +28 -28
- package/cpp/skia/include/private/chromium/GrSlug.h +40 -3
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +12 -6
- package/cpp/skia/include/private/{GrContext_Base.h → gpu/ganesh/GrContext_Base.h} +7 -0
- package/cpp/skia/include/private/{GrD3DTypesMinimal.h → gpu/ganesh/GrD3DTypesMinimal.h} +0 -0
- package/cpp/skia/include/private/{GrDawnTypesPriv.h → gpu/ganesh/GrDawnTypesPriv.h} +0 -0
- package/cpp/skia/include/private/{GrGLTypesPriv.h → gpu/ganesh/GrGLTypesPriv.h} +1 -0
- package/cpp/skia/include/private/{GrImageContext.h → gpu/ganesh/GrImageContext.h} +4 -4
- package/cpp/skia/include/private/{GrMockTypesPriv.h → gpu/ganesh/GrMockTypesPriv.h} +0 -0
- package/cpp/skia/include/private/{GrMtlTypesPriv.h → gpu/ganesh/GrMtlTypesPriv.h} +0 -0
- package/cpp/skia/include/private/{GrTypesPriv.h → gpu/ganesh/GrTypesPriv.h} +25 -367
- package/cpp/skia/include/private/{GrVkTypesPriv.h → gpu/ganesh/GrVkTypesPriv.h} +0 -0
- package/cpp/skia/include/private/gpu/graphite/MtlTypesPriv.h +74 -0
- package/cpp/skia/include/sksl/DSL.h +4 -0
- package/cpp/skia/include/sksl/DSLBlock.h +8 -3
- package/cpp/skia/include/sksl/DSLCase.h +6 -6
- package/cpp/skia/include/sksl/DSLCore.h +89 -78
- package/cpp/skia/include/sksl/DSLExpression.h +78 -45
- package/cpp/skia/include/sksl/DSLFunction.h +23 -18
- package/cpp/skia/include/sksl/DSLLayout.h +14 -16
- package/cpp/skia/include/sksl/DSLModifiers.h +7 -5
- package/cpp/skia/include/sksl/DSLRuntimeEffects.h +1 -1
- package/cpp/skia/include/sksl/DSLStatement.h +16 -10
- package/cpp/skia/include/sksl/DSLSymbols.h +7 -7
- package/cpp/skia/include/sksl/DSLType.h +27 -23
- package/cpp/skia/include/sksl/DSLVar.h +72 -61
- package/cpp/skia/include/sksl/SkSLErrorReporter.h +12 -49
- package/cpp/skia/include/sksl/SkSLOperator.h +151 -0
- package/cpp/skia/include/sksl/SkSLPosition.h +102 -0
- package/cpp/skia/include/svg/SkSVGCanvas.h +5 -1
- package/cpp/skia/include/utils/SkAnimCodecPlayer.h +7 -0
- package/cpp/skia/include/utils/SkCamera.h +2 -0
- package/cpp/skia/include/utils/SkCanvasStateUtils.h +4 -1
- package/cpp/skia/include/utils/SkCustomTypeface.h +6 -4
- package/cpp/skia/include/utils/SkNWayCanvas.h +34 -0
- package/cpp/skia/include/utils/SkNullCanvas.h +5 -1
- package/cpp/skia/include/utils/SkOrderedFontMgr.h +12 -0
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +30 -1
- package/cpp/skia/include/utils/SkParse.h +2 -0
- package/cpp/skia/include/utils/SkShadowUtils.h +3 -2
- package/cpp/skia/include/utils/SkTextUtils.h +8 -4
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +27 -1
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +4 -0
- package/cpp/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h +32 -0
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
- package/cpp/skia/modules/svg/include/SkSVGSVG.h +2 -0
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +48 -9
- package/ios/RNSkia-iOS/PlatformContext.h +1 -1
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +1 -0
- package/ios/RNSkia-iOS/SkiaDrawView.mm +1 -1
- package/lib/commonjs/renderer/components/shaders/Shader.js +1 -2
- package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/module/renderer/components/shaders/Shader.js +1 -2
- package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +0 -1
- package/lib/typescript/src/skia/types/RuntimeEffect/RuntimeEffect.d.ts +2 -4
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +2 -2
- package/src/renderer/components/shaders/Shader.tsx +1 -3
- package/src/skia/types/RuntimeEffect/RuntimeEffect.ts +1 -8
- package/cpp/skia/include/core/SkCustomMesh.h +0 -202
- package/cpp/skia/include/core/SkStringView.h +0 -185
- package/cpp/skia/include/private/SkPaintParamsKey.h +0 -110
- package/cpp/skia/include/private/SkShaderCodeDictionary.h +0 -63
- package/cpp/skia/include/private/SkTOptional.h +0 -362
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
#ifndef SKSL_DSL_EXPRESSION
|
|
9
9
|
#define SKSL_DSL_EXPRESSION
|
|
10
10
|
|
|
11
|
-
#include "include/core/SkStringView.h"
|
|
12
|
-
#include "include/core/SkTypes.h"
|
|
13
11
|
#include "include/private/SkTArray.h"
|
|
14
|
-
#include "include/sksl/
|
|
15
|
-
#include "include/sksl/
|
|
12
|
+
#include "include/sksl/SkSLOperator.h"
|
|
13
|
+
#include "include/sksl/SkSLPosition.h"
|
|
16
14
|
|
|
17
15
|
#include <cstdint>
|
|
18
16
|
#include <memory>
|
|
17
|
+
#include <string>
|
|
18
|
+
#include <string_view>
|
|
19
19
|
|
|
20
20
|
#if defined(__has_cpp_attribute) && __has_cpp_attribute(clang::reinitializes)
|
|
21
21
|
#define SK_CLANG_REINITIALIZES [[clang::reinitializes]]
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
namespace SkSL {
|
|
27
27
|
|
|
28
28
|
class Expression;
|
|
29
|
-
class
|
|
29
|
+
class ExpressionArray;
|
|
30
30
|
|
|
31
31
|
namespace dsl {
|
|
32
32
|
|
|
33
33
|
class DSLPossibleExpression;
|
|
34
|
-
class DSLStatement;
|
|
35
34
|
class DSLType;
|
|
36
35
|
class DSLVarBase;
|
|
36
|
+
template <typename T> class DSLWrapper;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Represents an expression such as 'cos(x)' or 'a + b'.
|
|
@@ -49,76 +49,85 @@ public:
|
|
|
49
49
|
/**
|
|
50
50
|
* Creates an expression representing a literal float.
|
|
51
51
|
*/
|
|
52
|
-
DSLExpression(float value,
|
|
52
|
+
DSLExpression(float value, Position pos = {});
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Creates an expression representing a literal float.
|
|
56
56
|
*/
|
|
57
|
-
DSLExpression(double value,
|
|
57
|
+
DSLExpression(double value, Position pos = {})
|
|
58
58
|
: DSLExpression((float) value) {}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Creates an expression representing a literal int.
|
|
62
62
|
*/
|
|
63
|
-
DSLExpression(int value,
|
|
63
|
+
DSLExpression(int value, Position pos = {});
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Creates an expression representing a literal int.
|
|
67
67
|
*/
|
|
68
|
-
DSLExpression(int64_t value,
|
|
68
|
+
DSLExpression(int64_t value, Position pos = {});
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* Creates an expression representing a literal uint.
|
|
72
72
|
*/
|
|
73
|
-
DSLExpression(unsigned int value,
|
|
73
|
+
DSLExpression(unsigned int value, Position pos = {});
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Creates an expression representing a literal bool.
|
|
77
77
|
*/
|
|
78
|
-
DSLExpression(bool value,
|
|
78
|
+
DSLExpression(bool value, Position pos = {});
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Creates an expression representing a variable reference.
|
|
82
82
|
*/
|
|
83
|
-
DSLExpression(DSLVarBase& var,
|
|
83
|
+
DSLExpression(DSLVarBase& var, Position pos = {});
|
|
84
84
|
|
|
85
|
-
DSLExpression(DSLVarBase&& var,
|
|
85
|
+
DSLExpression(DSLVarBase&& var, Position pos = {});
|
|
86
86
|
|
|
87
|
-
DSLExpression(DSLPossibleExpression expr,
|
|
87
|
+
DSLExpression(DSLPossibleExpression expr, Position pos = {});
|
|
88
88
|
|
|
89
89
|
explicit DSLExpression(std::unique_ptr<SkSL::Expression> expression);
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
// If expression is null, returns Poison(pos)
|
|
92
|
+
DSLExpression(std::unique_ptr<SkSL::Expression> expression, Position pos);
|
|
93
|
+
|
|
94
|
+
static DSLExpression Poison(Position pos = {});
|
|
92
95
|
|
|
93
96
|
~DSLExpression();
|
|
94
97
|
|
|
95
|
-
DSLType type();
|
|
98
|
+
DSLType type() const;
|
|
99
|
+
|
|
100
|
+
std::string description() const;
|
|
101
|
+
|
|
102
|
+
Position position() const;
|
|
103
|
+
|
|
104
|
+
void setPosition(Position pos);
|
|
96
105
|
|
|
97
106
|
/**
|
|
98
107
|
* Overloads the '=' operator to create an SkSL assignment statement.
|
|
99
108
|
*/
|
|
100
109
|
DSLPossibleExpression operator=(DSLExpression other);
|
|
101
110
|
|
|
102
|
-
DSLExpression x(
|
|
111
|
+
DSLExpression x(Position pos = {});
|
|
103
112
|
|
|
104
|
-
DSLExpression y(
|
|
113
|
+
DSLExpression y(Position pos = {});
|
|
105
114
|
|
|
106
|
-
DSLExpression z(
|
|
115
|
+
DSLExpression z(Position pos = {});
|
|
107
116
|
|
|
108
|
-
DSLExpression w(
|
|
117
|
+
DSLExpression w(Position pos = {});
|
|
109
118
|
|
|
110
|
-
DSLExpression r(
|
|
119
|
+
DSLExpression r(Position pos = {});
|
|
111
120
|
|
|
112
|
-
DSLExpression g(
|
|
121
|
+
DSLExpression g(Position pos = {});
|
|
113
122
|
|
|
114
|
-
DSLExpression b(
|
|
123
|
+
DSLExpression b(Position pos = {});
|
|
115
124
|
|
|
116
|
-
DSLExpression a(
|
|
125
|
+
DSLExpression a(Position pos = {});
|
|
117
126
|
|
|
118
127
|
/**
|
|
119
128
|
* Creates an SkSL struct field access expression.
|
|
120
129
|
*/
|
|
121
|
-
DSLExpression field(
|
|
130
|
+
DSLExpression field(std::string_view name, Position pos = {});
|
|
122
131
|
|
|
123
132
|
/**
|
|
124
133
|
* Creates an SkSL array index expression.
|
|
@@ -126,10 +135,30 @@ public:
|
|
|
126
135
|
DSLPossibleExpression operator[](DSLExpression index);
|
|
127
136
|
|
|
128
137
|
DSLPossibleExpression operator()(SkTArray<DSLWrapper<DSLExpression>> args,
|
|
129
|
-
|
|
138
|
+
Position pos = {});
|
|
130
139
|
|
|
131
140
|
DSLPossibleExpression operator()(ExpressionArray args,
|
|
132
|
-
|
|
141
|
+
Position pos = {});
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Invokes a prefix operator.
|
|
145
|
+
*/
|
|
146
|
+
DSLExpression prefix(Operator::Kind op, Position pos);
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Invokes a postfix operator.
|
|
150
|
+
*/
|
|
151
|
+
DSLExpression postfix(Operator::Kind op, Position pos);
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Invokes a binary operator.
|
|
155
|
+
*/
|
|
156
|
+
DSLExpression binary(Operator::Kind op, DSLExpression right, Position pos);
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Equivalent to operator[].
|
|
160
|
+
*/
|
|
161
|
+
DSLExpression index(DSLExpression index, Position pos);
|
|
133
162
|
|
|
134
163
|
/**
|
|
135
164
|
* Returns true if this object contains an expression. DSLExpressions which were created with
|
|
@@ -216,12 +245,12 @@ DSLPossibleExpression operator--(DSLExpression expr, int);
|
|
|
216
245
|
|
|
217
246
|
/**
|
|
218
247
|
* Represents an Expression which may have failed and/or have pending errors to report. Converting a
|
|
219
|
-
* PossibleExpression into an Expression requires
|
|
248
|
+
* PossibleExpression into an Expression requires a Position so that any pending errors can be
|
|
220
249
|
* reported at the correct position.
|
|
221
250
|
*
|
|
222
251
|
* PossibleExpression is used instead of Expression in situations where it is not possible to
|
|
223
|
-
* capture the
|
|
224
|
-
*
|
|
252
|
+
* capture the Position at the time of Expression construction (notably in operator overloads, where
|
|
253
|
+
* we cannot add default parameters).
|
|
225
254
|
*/
|
|
226
255
|
class DSLPossibleExpression {
|
|
227
256
|
public:
|
|
@@ -238,27 +267,31 @@ public:
|
|
|
238
267
|
/**
|
|
239
268
|
* Reports any pending errors at the specified position.
|
|
240
269
|
*/
|
|
241
|
-
void reportErrors(
|
|
270
|
+
void reportErrors(Position pos);
|
|
271
|
+
|
|
272
|
+
DSLType type() const;
|
|
273
|
+
|
|
274
|
+
std::string description() const;
|
|
242
275
|
|
|
243
|
-
|
|
276
|
+
Position position() const;
|
|
244
277
|
|
|
245
|
-
DSLExpression x(
|
|
278
|
+
DSLExpression x(Position pos = {});
|
|
246
279
|
|
|
247
|
-
DSLExpression y(
|
|
280
|
+
DSLExpression y(Position pos = {});
|
|
248
281
|
|
|
249
|
-
DSLExpression z(
|
|
282
|
+
DSLExpression z(Position pos = {});
|
|
250
283
|
|
|
251
|
-
DSLExpression w(
|
|
284
|
+
DSLExpression w(Position pos = {});
|
|
252
285
|
|
|
253
|
-
DSLExpression r(
|
|
286
|
+
DSLExpression r(Position pos = {});
|
|
254
287
|
|
|
255
|
-
DSLExpression g(
|
|
288
|
+
DSLExpression g(Position pos = {});
|
|
256
289
|
|
|
257
|
-
DSLExpression b(
|
|
290
|
+
DSLExpression b(Position pos = {});
|
|
258
291
|
|
|
259
|
-
DSLExpression a(
|
|
292
|
+
DSLExpression a(Position pos = {});
|
|
260
293
|
|
|
261
|
-
DSLExpression field(
|
|
294
|
+
DSLExpression field(std::string_view name, Position pos = {});
|
|
262
295
|
|
|
263
296
|
DSLPossibleExpression operator=(DSLExpression expr);
|
|
264
297
|
|
|
@@ -271,10 +304,10 @@ public:
|
|
|
271
304
|
DSLPossibleExpression operator[](DSLExpression index);
|
|
272
305
|
|
|
273
306
|
DSLPossibleExpression operator()(SkTArray<DSLWrapper<DSLExpression>> args,
|
|
274
|
-
|
|
307
|
+
Position pos = {});
|
|
275
308
|
|
|
276
309
|
DSLPossibleExpression operator()(ExpressionArray args,
|
|
277
|
-
|
|
310
|
+
Position pos = {});
|
|
278
311
|
|
|
279
312
|
DSLPossibleExpression operator++();
|
|
280
313
|
|
|
@@ -284,7 +317,7 @@ public:
|
|
|
284
317
|
|
|
285
318
|
DSLPossibleExpression operator--(int);
|
|
286
319
|
|
|
287
|
-
std::unique_ptr<SkSL::Expression> release(
|
|
320
|
+
std::unique_ptr<SkSL::Expression> release(Position pos = {});
|
|
288
321
|
|
|
289
322
|
private:
|
|
290
323
|
std::unique_ptr<SkSL::Expression> fExpression;
|
|
@@ -8,30 +8,35 @@
|
|
|
8
8
|
#ifndef SKSL_DSL_FUNCTION
|
|
9
9
|
#define SKSL_DSL_FUNCTION
|
|
10
10
|
|
|
11
|
+
#include "include/private/SkSLDefines.h"
|
|
12
|
+
#include "include/private/SkTArray.h"
|
|
11
13
|
#include "include/sksl/DSLBlock.h"
|
|
12
14
|
#include "include/sksl/DSLExpression.h"
|
|
13
|
-
#include "include/sksl/
|
|
15
|
+
#include "include/sksl/DSLModifiers.h"
|
|
16
|
+
#include "include/sksl/DSLStatement.h"
|
|
14
17
|
#include "include/sksl/DSLVar.h"
|
|
15
|
-
#include "include/sksl/
|
|
18
|
+
#include "include/sksl/SkSLPosition.h"
|
|
19
|
+
|
|
20
|
+
#include <string_view>
|
|
21
|
+
#include <utility>
|
|
16
22
|
|
|
17
23
|
namespace SkSL {
|
|
18
24
|
|
|
19
|
-
class Block;
|
|
20
25
|
class FunctionDeclaration;
|
|
21
|
-
class Variable;
|
|
22
26
|
|
|
23
27
|
namespace dsl {
|
|
24
28
|
|
|
25
29
|
class DSLType;
|
|
30
|
+
template <typename T> class DSLWrapper;
|
|
26
31
|
|
|
27
32
|
class DSLFunction {
|
|
28
33
|
public:
|
|
29
34
|
template<class... Parameters>
|
|
30
|
-
DSLFunction(const DSLType& returnType,
|
|
35
|
+
DSLFunction(const DSLType& returnType, std::string_view name, Parameters&... parameters)
|
|
31
36
|
: DSLFunction(DSLModifiers(), returnType, name, parameters...) {}
|
|
32
37
|
|
|
33
38
|
template<class... Parameters>
|
|
34
|
-
DSLFunction(const DSLModifiers& modifiers, const DSLType& returnType,
|
|
39
|
+
DSLFunction(const DSLModifiers& modifiers, const DSLType& returnType, std::string_view name,
|
|
35
40
|
Parameters&... parameters) {
|
|
36
41
|
SkTArray<DSLParameter*> parameterArray;
|
|
37
42
|
parameterArray.reserve_back(sizeof...(parameters));
|
|
@@ -41,17 +46,17 @@ public:
|
|
|
41
46
|
int unused[] = {0, (static_cast<void>(parameterArray.push_back(¶meters)), 0)...};
|
|
42
47
|
static_cast<void>(unused);
|
|
43
48
|
// We can't have a default parameter and a template parameter pack at the same time, so
|
|
44
|
-
// unfortunately we can't capture position
|
|
45
|
-
this->init(modifiers, returnType, name, std::move(parameterArray),
|
|
49
|
+
// unfortunately we can't capture position from this overload.
|
|
50
|
+
this->init(modifiers, returnType, name, std::move(parameterArray), Position());
|
|
46
51
|
}
|
|
47
52
|
|
|
48
|
-
DSLFunction(const DSLType& returnType,
|
|
49
|
-
SkTArray<DSLParameter*> parameters,
|
|
53
|
+
DSLFunction(const DSLType& returnType, std::string_view name,
|
|
54
|
+
SkTArray<DSLParameter*> parameters, Position pos = {}) {
|
|
50
55
|
this->init(DSLModifiers(), returnType, name, std::move(parameters), pos);
|
|
51
56
|
}
|
|
52
57
|
|
|
53
|
-
DSLFunction(const DSLModifiers& modifiers, const DSLType& returnType,
|
|
54
|
-
SkTArray<DSLParameter*> parameters,
|
|
58
|
+
DSLFunction(const DSLModifiers& modifiers, const DSLType& returnType, std::string_view name,
|
|
59
|
+
SkTArray<DSLParameter*> parameters, Position pos = {}) {
|
|
55
60
|
this->init(modifiers, returnType, name, std::move(parameters), pos);
|
|
56
61
|
}
|
|
57
62
|
|
|
@@ -66,7 +71,7 @@ public:
|
|
|
66
71
|
this->define(std::move(block));
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
void define(DSLBlock block,
|
|
74
|
+
void define(DSLBlock block, Position pos = {});
|
|
70
75
|
|
|
71
76
|
/**
|
|
72
77
|
* Invokes the function with the given arguments.
|
|
@@ -83,9 +88,9 @@ public:
|
|
|
83
88
|
* Invokes the function with the given arguments.
|
|
84
89
|
*/
|
|
85
90
|
DSLExpression call(SkTArray<DSLWrapper<DSLExpression>> args,
|
|
86
|
-
|
|
91
|
+
Position pos = {});
|
|
87
92
|
|
|
88
|
-
DSLExpression call(ExpressionArray args,
|
|
93
|
+
DSLExpression call(ExpressionArray args, Position pos = {});
|
|
89
94
|
|
|
90
95
|
private:
|
|
91
96
|
void collectArgs(ExpressionArray& args) {}
|
|
@@ -102,11 +107,11 @@ private:
|
|
|
102
107
|
collectArgs(args, std::forward<RemainingArgs>(remaining)...);
|
|
103
108
|
}
|
|
104
109
|
|
|
105
|
-
void init(DSLModifiers modifiers, const DSLType& returnType,
|
|
106
|
-
SkTArray<DSLParameter*> params,
|
|
110
|
+
void init(DSLModifiers modifiers, const DSLType& returnType, std::string_view name,
|
|
111
|
+
SkTArray<DSLParameter*> params, Position pos);
|
|
107
112
|
|
|
108
113
|
const SkSL::FunctionDeclaration* fDecl = nullptr;
|
|
109
|
-
SkSL::
|
|
114
|
+
SkSL::Position fPosition;
|
|
110
115
|
};
|
|
111
116
|
|
|
112
117
|
} // namespace dsl
|
|
@@ -8,10 +8,8 @@
|
|
|
8
8
|
#ifndef SKSL_DSL_LAYOUT
|
|
9
9
|
#define SKSL_DSL_LAYOUT
|
|
10
10
|
|
|
11
|
-
#include "include/sksl/DSLLayout.h"
|
|
12
|
-
|
|
13
11
|
#include "include/private/SkSLLayout.h"
|
|
14
|
-
#include "include/sksl/
|
|
12
|
+
#include "include/sksl/SkSLPosition.h"
|
|
15
13
|
|
|
16
14
|
namespace SkSL {
|
|
17
15
|
|
|
@@ -21,53 +19,53 @@ class DSLLayout {
|
|
|
21
19
|
public:
|
|
22
20
|
DSLLayout() {}
|
|
23
21
|
|
|
24
|
-
DSLLayout& originUpperLeft(
|
|
22
|
+
DSLLayout& originUpperLeft(Position pos = {}) {
|
|
25
23
|
return this->flag(SkSL::Layout::kOriginUpperLeft_Flag, "origin_upper_left", pos);
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
DSLLayout& pushConstant(
|
|
26
|
+
DSLLayout& pushConstant(Position pos = {}) {
|
|
29
27
|
return this->flag(SkSL::Layout::kPushConstant_Flag, "push_constant", pos);
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
DSLLayout& blendSupportAllEquations(
|
|
30
|
+
DSLLayout& blendSupportAllEquations(Position pos = {}) {
|
|
33
31
|
return this->flag(SkSL::Layout::kBlendSupportAllEquations_Flag,
|
|
34
32
|
"blend_support_all_equations", pos);
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
DSLLayout& color(
|
|
35
|
+
DSLLayout& color(Position pos = {}) {
|
|
38
36
|
return this->flag(SkSL::Layout::kColor_Flag, "color", pos);
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
DSLLayout& location(int location,
|
|
39
|
+
DSLLayout& location(int location, Position pos = {}) {
|
|
42
40
|
return this->intValue(&fSkSLLayout.fLocation, location, SkSL::Layout::kLocation_Flag,
|
|
43
41
|
"location", pos);
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
DSLLayout& offset(int offset,
|
|
44
|
+
DSLLayout& offset(int offset, Position pos = {}) {
|
|
47
45
|
return this->intValue(&fSkSLLayout.fOffset, offset, SkSL::Layout::kOffset_Flag, "offset",
|
|
48
46
|
pos);
|
|
49
47
|
}
|
|
50
48
|
|
|
51
|
-
DSLLayout& binding(int binding,
|
|
49
|
+
DSLLayout& binding(int binding, Position pos = {}) {
|
|
52
50
|
return this->intValue(&fSkSLLayout.fBinding, binding, SkSL::Layout::kBinding_Flag,
|
|
53
51
|
"binding", pos);
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
DSLLayout& index(int index,
|
|
54
|
+
DSLLayout& index(int index, Position pos = {}) {
|
|
57
55
|
return this->intValue(&fSkSLLayout.fIndex, index, SkSL::Layout::kIndex_Flag, "index", pos);
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
DSLLayout& set(int set,
|
|
58
|
+
DSLLayout& set(int set, Position pos = {}) {
|
|
61
59
|
return this->intValue(&fSkSLLayout.fSet, set, SkSL::Layout::kSet_Flag, "set", pos);
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
DSLLayout& builtin(int builtin,
|
|
62
|
+
DSLLayout& builtin(int builtin, Position pos = {}) {
|
|
65
63
|
return this->intValue(&fSkSLLayout.fBuiltin, builtin, SkSL::Layout::kBuiltin_Flag,
|
|
66
64
|
"builtin", pos);
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
DSLLayout& inputAttachmentIndex(int inputAttachmentIndex,
|
|
70
|
-
|
|
68
|
+
Position pos = {}) {
|
|
71
69
|
return this->intValue(&fSkSLLayout.fInputAttachmentIndex, inputAttachmentIndex,
|
|
72
70
|
SkSL::Layout::kInputAttachmentIndex_Flag, "input_attachment_index",
|
|
73
71
|
pos);
|
|
@@ -77,10 +75,10 @@ private:
|
|
|
77
75
|
explicit DSLLayout(SkSL::Layout skslLayout)
|
|
78
76
|
: fSkSLLayout(skslLayout) {}
|
|
79
77
|
|
|
80
|
-
DSLLayout& flag(SkSL::Layout::Flag mask, const char* name,
|
|
78
|
+
DSLLayout& flag(SkSL::Layout::Flag mask, const char* name, Position pos);
|
|
81
79
|
|
|
82
80
|
DSLLayout& intValue(int* target, int value, SkSL::Layout::Flag flag, const char* name,
|
|
83
|
-
|
|
81
|
+
Position pos);
|
|
84
82
|
|
|
85
83
|
SkSL::Layout fSkSLLayout;
|
|
86
84
|
|
|
@@ -32,11 +32,12 @@ enum Modifier {
|
|
|
32
32
|
|
|
33
33
|
class DSLModifiers {
|
|
34
34
|
public:
|
|
35
|
-
DSLModifiers(int flags = 0)
|
|
36
|
-
: DSLModifiers(DSLLayout(), flags) {}
|
|
35
|
+
DSLModifiers(int flags = 0, Position pos = {})
|
|
36
|
+
: DSLModifiers(DSLLayout(), flags, pos) {}
|
|
37
37
|
|
|
38
|
-
DSLModifiers(DSLLayout layout, int flags = 0)
|
|
39
|
-
: fModifiers(layout.fSkSLLayout, flags)
|
|
38
|
+
DSLModifiers(DSLLayout layout, int flags = 0, Position pos = {})
|
|
39
|
+
: fModifiers(layout.fSkSLLayout, flags)
|
|
40
|
+
, fPosition(pos) {}
|
|
40
41
|
|
|
41
42
|
int flags() const {
|
|
42
43
|
return fModifiers.fFlags;
|
|
@@ -48,8 +49,9 @@ public:
|
|
|
48
49
|
|
|
49
50
|
private:
|
|
50
51
|
SkSL::Modifiers fModifiers;
|
|
52
|
+
Position fPosition;
|
|
51
53
|
|
|
52
|
-
friend DSLType Struct(
|
|
54
|
+
friend DSLType Struct(std::string_view name, SkSpan<DSLField> fields, Position pos);
|
|
53
55
|
friend class DSLCore;
|
|
54
56
|
friend class DSLFunction;
|
|
55
57
|
friend class DSLType;
|
|
@@ -8,19 +8,16 @@
|
|
|
8
8
|
#ifndef SKSL_DSL_STATEMENT
|
|
9
9
|
#define SKSL_DSL_STATEMENT
|
|
10
10
|
|
|
11
|
-
#include "include/core/SkString.h"
|
|
12
11
|
#include "include/core/SkTypes.h"
|
|
13
12
|
#include "include/private/SkSLStatement.h"
|
|
14
|
-
#include "include/sksl/
|
|
13
|
+
#include "include/sksl/SkSLPosition.h"
|
|
15
14
|
|
|
16
15
|
#include <memory>
|
|
17
|
-
|
|
18
|
-
class GrGLSLShaderBuilder;
|
|
16
|
+
#include <utility>
|
|
19
17
|
|
|
20
18
|
namespace SkSL {
|
|
21
19
|
|
|
22
20
|
class Expression;
|
|
23
|
-
class Statement;
|
|
24
21
|
|
|
25
22
|
namespace dsl {
|
|
26
23
|
|
|
@@ -28,7 +25,6 @@ class DSLBlock;
|
|
|
28
25
|
class DSLExpression;
|
|
29
26
|
class DSLPossibleExpression;
|
|
30
27
|
class DSLPossibleStatement;
|
|
31
|
-
class DSLVar;
|
|
32
28
|
|
|
33
29
|
class DSLStatement {
|
|
34
30
|
public:
|
|
@@ -36,9 +32,9 @@ public:
|
|
|
36
32
|
|
|
37
33
|
DSLStatement(DSLExpression expr);
|
|
38
34
|
|
|
39
|
-
DSLStatement(DSLPossibleExpression expr,
|
|
35
|
+
DSLStatement(DSLPossibleExpression expr, Position pos = {});
|
|
40
36
|
|
|
41
|
-
DSLStatement(DSLPossibleStatement stmt,
|
|
37
|
+
DSLStatement(DSLPossibleStatement stmt, Position pos = {});
|
|
42
38
|
|
|
43
39
|
DSLStatement(DSLBlock block);
|
|
44
40
|
|
|
@@ -52,6 +48,16 @@ public:
|
|
|
52
48
|
|
|
53
49
|
DSLStatement& operator=(DSLStatement&& other) = default;
|
|
54
50
|
|
|
51
|
+
Position position() {
|
|
52
|
+
SkASSERT(this->hasValue());
|
|
53
|
+
return fStatement->fPosition;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
void setPosition(Position pos) {
|
|
57
|
+
SkASSERT(this->hasValue());
|
|
58
|
+
fStatement->fPosition = pos;
|
|
59
|
+
}
|
|
60
|
+
|
|
55
61
|
bool hasValue() { return fStatement != nullptr; }
|
|
56
62
|
|
|
57
63
|
std::unique_ptr<SkSL::Statement> release() {
|
|
@@ -76,11 +82,11 @@ private:
|
|
|
76
82
|
|
|
77
83
|
/**
|
|
78
84
|
* Represents a Statement which may have failed and/or have pending errors to report. Converting a
|
|
79
|
-
* PossibleStatement into a Statement requires
|
|
85
|
+
* PossibleStatement into a Statement requires a Position so that any pending errors can be
|
|
80
86
|
* reported at the correct position.
|
|
81
87
|
*
|
|
82
88
|
* PossibleStatement is used instead of Statement in situations where it is not possible to capture
|
|
83
|
-
* the
|
|
89
|
+
* the Position at the time of Statement construction.
|
|
84
90
|
*/
|
|
85
91
|
class DSLPossibleStatement {
|
|
86
92
|
public:
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
#ifndef SKSL_DSL_SYMBOLS
|
|
9
9
|
#define SKSL_DSL_SYMBOLS
|
|
10
10
|
|
|
11
|
-
#include "include/core/SkStringView.h"
|
|
12
|
-
#include "include/private/SkSLString.h"
|
|
13
11
|
#include "include/sksl/DSLExpression.h"
|
|
14
12
|
|
|
15
13
|
#include <memory>
|
|
14
|
+
#include <string_view>
|
|
16
15
|
|
|
17
16
|
namespace SkSL {
|
|
18
17
|
|
|
18
|
+
class Position;
|
|
19
19
|
class SymbolTable;
|
|
20
20
|
|
|
21
21
|
namespace dsl {
|
|
22
22
|
|
|
23
|
-
class
|
|
23
|
+
class DSLVarBase;
|
|
24
24
|
|
|
25
25
|
// This header provides methods for manually managing symbol tables in DSL code. They should not be
|
|
26
26
|
// used by normal hand-written DSL code, where we rely on C++ to manage symbols, but are instead
|
|
@@ -47,22 +47,22 @@ std::shared_ptr<SymbolTable> CurrentSymbolTable();
|
|
|
47
47
|
/**
|
|
48
48
|
* Returns an expression referring to the named symbol.
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
DSLExpression Symbol(std::string_view name, Position pos = {});
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Returns true if the name refers to a type (user or built-in) in the current symbol table.
|
|
54
54
|
*/
|
|
55
|
-
bool IsType(
|
|
55
|
+
bool IsType(std::string_view name);
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Returns true if the name refers to a builtin type.
|
|
59
59
|
*/
|
|
60
|
-
bool IsBuiltinType(
|
|
60
|
+
bool IsBuiltinType(std::string_view name);
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Adds a variable to the current symbol table.
|
|
64
64
|
*/
|
|
65
|
-
void AddToSymbolTable(DSLVarBase& var,
|
|
65
|
+
void AddToSymbolTable(DSLVarBase& var, Position pos = {});
|
|
66
66
|
|
|
67
67
|
} // namespace dsl
|
|
68
68
|
|