@shopify/react-native-skia 2.6.1 → 2.6.3-next.1

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.
Files changed (29) hide show
  1. package/cpp/dawn/include/dawn/dawn_proc.h +50 -0
  2. package/cpp/dawn/include/dawn/dawn_proc_table.h +326 -0
  3. package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +47 -0
  4. package/cpp/dawn/include/dawn/native/D3D11Backend.h +65 -0
  5. package/cpp/dawn/include/dawn/native/D3D12Backend.h +102 -0
  6. package/cpp/dawn/include/dawn/native/D3DBackend.h +56 -0
  7. package/cpp/dawn/include/dawn/native/DawnNative.h +369 -0
  8. package/cpp/dawn/include/dawn/native/MetalBackend.h +56 -0
  9. package/cpp/dawn/include/dawn/native/NullBackend.h +39 -0
  10. package/cpp/dawn/include/dawn/native/OpenGLBackend.h +89 -0
  11. package/cpp/dawn/include/dawn/native/VulkanBackend.h +183 -0
  12. package/cpp/dawn/include/dawn/native/WebGPUBackend.h +49 -0
  13. package/cpp/dawn/include/dawn/native/dawn_native_export.h +49 -0
  14. package/cpp/dawn/include/dawn/platform/DawnPlatform.h +203 -0
  15. package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +49 -0
  16. package/cpp/dawn/include/dawn/replay/Replay.h +75 -0
  17. package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +49 -0
  18. package/cpp/dawn/include/dawn/webgpu_cpp_print.h +2752 -0
  19. package/cpp/dawn/include/tint/tint.h +90 -0
  20. package/cpp/dawn/include/webgpu/webgpu.h +4902 -0
  21. package/cpp/dawn/include/webgpu/webgpu_cpp.h +10261 -0
  22. package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +57 -0
  23. package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +161 -0
  24. package/cpp/dawn/include/webgpu/webgpu_glfw.h +88 -0
  25. package/cpp/skia/src/gpu/graphite/ContextOptionsPriv.h +45 -0
  26. package/cpp/skia/src/gpu/graphite/ResourceTypes.h +360 -0
  27. package/cpp/skia/src/gpu/graphite/TextureProxyView.h +105 -0
  28. package/package.json +7 -6
  29. package/scripts/install-libs.js +44 -4
@@ -0,0 +1,360 @@
1
+ /*
2
+ * Copyright 2021 Google LLC
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
+ #ifndef skgpu_graphite_ResourceTypes_DEFINED
9
+ #define skgpu_graphite_ResourceTypes_DEFINED
10
+
11
+ #include "include/core/SkSamplingOptions.h"
12
+ #include "include/core/SkSpan.h"
13
+ #include "include/core/SkTileMode.h"
14
+ #include "include/gpu/graphite/GraphiteTypes.h"
15
+ #include "include/private/base/SkTo.h"
16
+ #include "src/base/SkEnumBitMask.h"
17
+ #include "src/base/SkMathPriv.h"
18
+
19
+ namespace skgpu::graphite {
20
+
21
+ class Buffer;
22
+
23
+ // This declaration of the DepthStencilFlags' SkEnumBitMask ops is here bc, internally, we use
24
+ // DepthStencilFlags as bit fields but, externally (i.e., from the GraphiteTypes view), we want
25
+ // it to appear as just an enum class.
26
+ SK_MAKE_BITMASK_OPS(DepthStencilFlags)
27
+ // The same goes for SampleCount
28
+ SK_MAKE_BITMASK_OPS(SampleCount)
29
+
30
+ /**
31
+ * There are only a few possible valid sample counts (1, 2, 4, 8, 16). So we can key on those 5
32
+ * options instead of the actual sample value. The resulting key value only requires 3 bits of space
33
+ */
34
+ static constexpr uint32_t SamplesToKey(SampleCount numSamples) {
35
+ switch (numSamples) {
36
+ case SampleCount::k1:
37
+ return 0;
38
+ case SampleCount::k2:
39
+ return 1;
40
+ case SampleCount::k4:
41
+ return 2;
42
+ case SampleCount::k8:
43
+ return 3;
44
+ case SampleCount::k16:
45
+ return 4;
46
+ }
47
+ SkUNREACHABLE;
48
+ }
49
+ static constexpr SampleCount KeyToSamples(uint32_t keyBits) {
50
+ SkASSERT(keyBits <= 4);
51
+ return static_cast<SampleCount>(1 << keyBits);
52
+ }
53
+ static constexpr int kNumSampleKeyBits = 3;
54
+
55
+ /**
56
+ * The strategy that a renderpass and/or pipeline use to access the current dst pixel when blending.
57
+ */
58
+ enum class DstReadStrategy : uint8_t {
59
+ kNoneRequired,
60
+ kTextureCopy,
61
+ kTextureSample, // TODO(b/238756862): To be used once direct texture sampling is implemented
62
+ kReadFromInput,
63
+ kFramebufferFetch,
64
+
65
+ kLast = kFramebufferFetch
66
+ };
67
+ inline static constexpr int kDstReadStrategyCount = (int)(DstReadStrategy::kLast) + 1;
68
+
69
+ /**
70
+ * This enum is used to specify the load operation to be used when a RenderPass begins execution.
71
+ */
72
+ enum class LoadOp : uint8_t {
73
+ kLoad,
74
+ kClear,
75
+ kDiscard,
76
+
77
+ kLast = kDiscard
78
+ };
79
+ inline static constexpr int kLoadOpCount = (int)(LoadOp::kLast) + 1;
80
+
81
+ /**
82
+ * This enum is used to specify the store operation to be used when a RenderPass ends execution.
83
+ */
84
+ enum class StoreOp : uint8_t {
85
+ kStore,
86
+ kDiscard,
87
+
88
+ kLast = kDiscard
89
+ };
90
+ inline static constexpr int kStoreOpCount = (int)(StoreOp::kLast) + 1;
91
+
92
+ /**
93
+ * What a GPU buffer will be used for
94
+ */
95
+ enum class BufferType : int {
96
+ kVertex,
97
+ kIndex,
98
+ kXferCpuToGpu,
99
+ kXferGpuToCpu,
100
+ kUniform,
101
+ kStorage,
102
+ kQuery,
103
+
104
+ // GPU-only buffer types
105
+ kIndirect,
106
+ kVertexStorage,
107
+ kIndexStorage,
108
+
109
+ kLast = kIndexStorage,
110
+ };
111
+ static const int kBufferTypeCount = static_cast<int>(BufferType::kLast) + 1;
112
+
113
+ /**
114
+ * Data layout requirements on host-shareable buffer contents.
115
+ */
116
+ enum class Layout : uint8_t {
117
+ kInvalid = 0,
118
+ kStd140,
119
+ kStd140_F16,
120
+ kStd430,
121
+ kStd430_F16,
122
+ kMetal,
123
+ };
124
+
125
+ static constexpr const char* LayoutString(Layout layout) {
126
+ switch(layout) {
127
+ case Layout::kStd140: return "std140";
128
+ case Layout::kStd140_F16: return "std140-f16";
129
+ case Layout::kStd430: return "std430";
130
+ case Layout::kStd430_F16: return "std430-f16";
131
+ case Layout::kMetal: return "metal";
132
+ case Layout::kInvalid: return "invalid";
133
+ }
134
+ SkUNREACHABLE;
135
+ }
136
+
137
+ /**
138
+ * Indicates the intended access pattern over resource memory. This is used to select the most
139
+ * efficient memory type during resource creation based on the capabilities of the platform.
140
+ *
141
+ * This is only a hint and the actual memory type will be determined based on the resource type and
142
+ * backend capabilities.
143
+ */
144
+ enum class AccessPattern : uint8_t {
145
+ // GPU-only memory does not need to support reads/writes from the CPU. GPU-private memory will
146
+ // be preferred if the backend supports an efficient private memory type.
147
+ kGpuOnly,
148
+
149
+ // The resource needs to be CPU visible, e.g. for read-back or as a copy/upload source.
150
+ kHostVisible,
151
+
152
+ // Use to debug GPU only buffers.
153
+ kGpuOnlyCopySrc,
154
+ };
155
+
156
+ /**
157
+ * Determines whether the contents of a GPU buffer sub-allocation gets cleared to 0 before being
158
+ * used in a GPU command submission.
159
+ */
160
+ enum class ClearBuffer : bool {
161
+ kNo = false,
162
+ kYes = true,
163
+ };
164
+
165
+ /**
166
+ * Must the contents of the Resource be preserved af a render pass or can a more efficient
167
+ * representation be chosen when supported by hardware.
168
+ */
169
+ enum class Discardable : bool {
170
+ kNo = false,
171
+ kYes = true
172
+ };
173
+
174
+ enum class Ownership : uint8_t {
175
+ kOwned,
176
+ kWrapped,
177
+ };
178
+
179
+ /** Uniquely identifies the type of resource that is cached with a GraphiteResourceKey. */
180
+ using ResourceType = uint32_t;
181
+
182
+ /**
183
+ * Can the resource be held by multiple users at the same time?
184
+ * For example, stencil buffers, pipelines, etc.
185
+ */
186
+ enum class Shareable : uint8_t {
187
+ kNo, // The resource is visible in the ResourceCache once all its usage refs are dropped
188
+ kScratch, // The resource is visible to other Recorders, but acts like kNo within a Recording
189
+ kYes, // The resource is always visible in the ResourceCache
190
+ };
191
+
192
+ /*
193
+ * Struct that can be passed into bind buffer calls on the CommandBuffer. The ownership of the
194
+ * buffer and its usage in command submission must be tracked by the caller (e.g. as with
195
+ * buffers created by DrawBufferManager).
196
+ */
197
+ struct BindBufferInfo {
198
+ const Buffer* fBuffer = nullptr;
199
+ uint32_t fOffset = 0;
200
+ uint32_t fSize = 0;
201
+
202
+ explicit operator bool() const { return SkToBool(fBuffer); }
203
+
204
+ bool operator==(const BindBufferInfo& o) const {
205
+ return fBuffer == o.fBuffer && (!fBuffer || (fOffset == o.fOffset && fSize == o.fSize));
206
+ }
207
+ bool operator!=(const BindBufferInfo& o) const { return !(*this == o); }
208
+ };
209
+
210
+ // How texture memory is arranged on the GPU, which can impact what operations are supported.
211
+ enum class Tiling : uint8_t {
212
+ kOptimal,
213
+ kLinear
214
+ };
215
+
216
+ // Coarse ways in which a specific texture can be used, or the theoretic set of usages a texture
217
+ // format supports.
218
+ enum class TextureUsage : uint8_t {
219
+ kRender = 0x01, // Can be used as a rendering attachment
220
+ kMSRTSS = 0x02, // Can be rendered with MSAA-render-to-single-sampled functionality
221
+ kSample = 0x04, // Can be sampled within a shader
222
+ kCopySrc = 0x08, // Can be copied into another texture or buffer
223
+ kCopyDst = 0x10, // Can be the copy target of another texture or buffer
224
+ kStorage = 0x20, // Can be read and written to in a compute pipeline
225
+ kHostCopy = 0x40, // Can be written to directly from host memory
226
+ };
227
+ SK_MAKE_BITMASK_OPS(TextureUsage)
228
+
229
+ struct ImmutableSamplerInfo {
230
+ // If the sampler requires YCbCr conversion, backends can place that information here.
231
+ // In order to fit within SamplerDesc's uint32 desc field, backends can only utilize up to
232
+ // kMaxNumConversionInfoBits bits.
233
+ uint32_t fNonFormatYcbcrConversionInfo = 0;
234
+ // fFormat represents known OR external format numerical representation.
235
+ uint64_t fFormat = 0;
236
+ };
237
+
238
+ /**
239
+ * Struct used to describe how a Texture/TextureProxy/TextureProxyView is sampled.
240
+ */
241
+ struct SamplerDesc {
242
+ static_assert(kSkTileModeCount <= 4 && kSkFilterModeCount <= 2 && kSkMipmapModeCount <= 4);
243
+
244
+ constexpr SamplerDesc(const SkSamplingOptions& samplingOptions, SkTileMode tileMode)
245
+ : SamplerDesc(samplingOptions, {tileMode, tileMode}) {}
246
+
247
+ constexpr SamplerDesc(const SkSamplingOptions& samplingOptions,
248
+ const std::pair<SkTileMode, SkTileMode> tileModes,
249
+ const ImmutableSamplerInfo info = {})
250
+ : fDesc((static_cast<int>(tileModes.first) << kTileModeXShift ) |
251
+ (static_cast<int>(tileModes.second) << kTileModeYShift ) |
252
+ (static_cast<int>(samplingOptions.filter) << kFilterModeShift ) |
253
+ (static_cast<int>(samplingOptions.mipmap) << kMipmapModeShift ) |
254
+ (info.fNonFormatYcbcrConversionInfo << kImmutableSamplerInfoShift) )
255
+ , fFormat(info.fFormat)
256
+ , fExternalFormatMostSignificantBits(info.fFormat >> 32) {
257
+
258
+ // Cubic sampling is handled in a shader, with the actual texture sampled by with NN,
259
+ // but that is what a cubic SkSamplingOptions is set to if you ignore 'cubic', which let's
260
+ // us simplify how we construct SamplerDec's from the options passed to high-level draws.
261
+ SkASSERT(!samplingOptions.useCubic || (samplingOptions.filter == SkFilterMode::kNearest &&
262
+ samplingOptions.mipmap == SkMipmapMode::kNone));
263
+
264
+ // TODO: Add aniso value when used.
265
+
266
+ // Assert that fYcbcrConversionInfo does not exceed kMaxNumConversionInfoBits such that
267
+ // the conversion information can fit within an uint32.
268
+ SkASSERT(info.fNonFormatYcbcrConversionInfo >> kMaxNumConversionInfoBits == 0);
269
+ }
270
+ constexpr SamplerDesc() = default;
271
+ constexpr SamplerDesc(const SamplerDesc&) = default;
272
+ constexpr SamplerDesc& operator=(const SamplerDesc&) = default;
273
+
274
+ constexpr SamplerDesc(uint32_t desc, uint32_t format, uint32_t extFormatMSB)
275
+ : fDesc(desc)
276
+ , fFormat(format)
277
+ , fExternalFormatMostSignificantBits(extFormatMSB) {}
278
+
279
+ bool operator==(const SamplerDesc& o) const {
280
+ return o.fDesc == fDesc && o.fFormat == fFormat &&
281
+ o.fExternalFormatMostSignificantBits == fExternalFormatMostSignificantBits;
282
+ }
283
+
284
+ bool operator!=(const SamplerDesc& o) const { return !(*this == o); }
285
+
286
+ SkTileMode tileModeX() const {
287
+ return static_cast<SkTileMode>((fDesc >> kTileModeXShift) & 0b11);
288
+ }
289
+ SkTileMode tileModeY() const {
290
+ return static_cast<SkTileMode>((fDesc >> kTileModeYShift) & 0b11);
291
+ }
292
+ SkFilterMode filterMode() const {
293
+ return static_cast<SkFilterMode>((fDesc >> kFilterModeShift) & 0b01);
294
+ }
295
+ SkMipmapMode mipmap() const {
296
+ return static_cast<SkMipmapMode>((fDesc >> kMipmapModeShift) & 0b11);
297
+ }
298
+ uint32_t desc() const { return fDesc; }
299
+ uint32_t format() const { return fFormat; }
300
+ uint32_t externalFormatMSBs() const { return fExternalFormatMostSignificantBits; }
301
+ bool isImmutable() const { return (fDesc >> kImmutableSamplerInfoShift) != 0; }
302
+ bool usesExternalFormat() const { return (fDesc >> kImmutableSamplerInfoShift) & 0b1; }
303
+
304
+ // NOTE: returns the HW sampling options to use, so a bicubic SkSamplingOptions will become
305
+ // nearest-neighbor sampling in HW.
306
+ SkSamplingOptions samplingOptions() const {
307
+ // TODO: Add support for anisotropic filtering
308
+ SkFilterMode filter = static_cast<SkFilterMode>((fDesc >> kFilterModeShift) & 0b01);
309
+ SkMipmapMode mipmap = static_cast<SkMipmapMode>((fDesc >> kMipmapModeShift) & 0b11);
310
+ return SkSamplingOptions(filter, mipmap);
311
+ }
312
+
313
+ ImmutableSamplerInfo immutableSamplerInfo() const {
314
+ return {this->desc() >> kImmutableSamplerInfoShift,
315
+ ((uint64_t) this->externalFormatMSBs() << 32) | (uint64_t) this->format()};
316
+ }
317
+
318
+ SkSpan<const uint32_t> asSpan() const {
319
+ // Span length depends upon whether the sampler is immutable and if it uses a known format
320
+ return {&fDesc, 1u + this->isImmutable() + this->usesExternalFormat()};
321
+ }
322
+
323
+ // These are public such that backends can bitshift data in order to determine whatever
324
+ // sampler qualities they need from fDesc.
325
+ static constexpr int kNumTileModeBits = SkNextLog2(int(SkTileMode::kLastTileMode)+1);
326
+ static constexpr int kNumFilterModeBits = SkNextLog2(int(SkFilterMode::kLast)+1);
327
+ static constexpr int kNumMipmapModeBits = SkNextLog2(int(SkMipmapMode::kLast)+1);
328
+ static constexpr int kMaxNumConversionInfoBits =
329
+ 32 - kNumFilterModeBits - kNumMipmapModeBits - kNumTileModeBits;
330
+
331
+ static constexpr int kTileModeXShift = 0;
332
+ static constexpr int kTileModeYShift = kTileModeXShift + kNumTileModeBits;
333
+ static constexpr int kFilterModeShift = kTileModeYShift + kNumTileModeBits;
334
+ static constexpr int kMipmapModeShift = kFilterModeShift + kNumFilterModeBits;
335
+ static constexpr int kImmutableSamplerInfoShift = kMipmapModeShift + kNumMipmapModeBits;
336
+
337
+ // Only relevant when using immutable samplers. Otherwise, can be ignored. The number of uint32s
338
+ // required to represent all relevant sampler desc information depends upon whether we are using
339
+ // a known or external format.
340
+ static constexpr int kInt32sNeededKnownFormat = 2;
341
+ static constexpr int kInt32sNeededExternalFormat = 3;
342
+
343
+ private:
344
+ // Note: The order of these member attributes matters to keep unique object representation
345
+ // such that SkGoodHash can be used to hash SamplerDesc objects.
346
+ uint32_t fDesc = 0;
347
+
348
+ // Data fields populated by backend Caps which store texture format information (needed for
349
+ // YCbCr sampling). Only relevant when using immutable samplers. Otherwise, can be ignored.
350
+ // Known formats only require a uint32, but external formats can be up to a uint64. We store
351
+ // this as two separate uint32s such that has_unique_object_representation can be true, allowing
352
+ // this structure to be easily hashed using SkGoodHash. So, external formats can be represented
353
+ // with (fExternalFormatMostSignificantBits << 32) | fFormat.
354
+ uint32_t fFormat = 0;
355
+ uint32_t fExternalFormatMostSignificantBits = 0;
356
+ };
357
+
358
+ } // namespace skgpu::graphite
359
+
360
+ #endif // skgpu_graphite_ResourceTypes_DEFINED
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Copyright 2022 Google LLC
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
+ #ifndef skgpu_graphite_TextureProxyView_DEFINED
9
+ #define skgpu_graphite_TextureProxyView_DEFINED
10
+
11
+ #include "include/core/SkRect.h"
12
+ #include "include/core/SkRefCnt.h"
13
+ #include "include/gpu/graphite/GraphiteTypes.h"
14
+ #include "src/gpu/Swizzle.h"
15
+ #include "src/gpu/graphite/TextureProxy.h"
16
+
17
+ enum class SkBackingFit;
18
+
19
+ namespace skgpu::graphite {
20
+
21
+ class Recorder;
22
+
23
+ class TextureProxyView {
24
+ public:
25
+ TextureProxyView() = default;
26
+
27
+ TextureProxyView(sk_sp<TextureProxy> proxy, Swizzle swizzle)
28
+ : fProxy(std::move(proxy)), fSwizzle(swizzle) {}
29
+
30
+ TextureProxyView(sk_sp<TextureProxy> proxy, Swizzle swizzle, Origin origin)
31
+ : fProxy(std::move(proxy)), fSwizzle(swizzle), fOrigin(origin) {}
32
+
33
+ // This entry point is used when we don't care about the swizzle and assume TopLeft origin.
34
+ explicit TextureProxyView(sk_sp<TextureProxy> proxy)
35
+ : fProxy(std::move(proxy)) {}
36
+
37
+ TextureProxyView(TextureProxyView&& view) = default;
38
+ TextureProxyView(const TextureProxyView&) = default;
39
+
40
+ explicit operator bool() const { return SkToBool(fProxy.get()); }
41
+
42
+ TextureProxyView& operator=(const TextureProxyView&) = default;
43
+ TextureProxyView& operator=(TextureProxyView&& view) = default;
44
+
45
+ bool operator==(const TextureProxyView& view) const {
46
+ return fProxy == view.fProxy &&
47
+ fSwizzle == view.fSwizzle &&
48
+ fOrigin == view.fOrigin;
49
+ }
50
+ bool operator!=(const TextureProxyView& other) const { return !(*this == other); }
51
+
52
+ int width() const { return this->proxy()->dimensions().width(); }
53
+ int height() const { return this->proxy()->dimensions().height(); }
54
+ SkISize dimensions() const { return this->proxy()->dimensions(); }
55
+
56
+ skgpu::Mipmapped mipmapped() const {
57
+ if (const TextureProxy* proxy = this->proxy()) {
58
+ return proxy->mipmapped();
59
+ }
60
+ return skgpu::Mipmapped::kNo;
61
+ }
62
+
63
+ TextureProxy* proxy() const { return fProxy.get(); }
64
+ sk_sp<TextureProxy> refProxy() const { return fProxy; }
65
+
66
+ Swizzle swizzle() const { return fSwizzle; }
67
+ Origin origin() const { return fOrigin; }
68
+
69
+ void concatSwizzle(Swizzle swizzle) {
70
+ fSwizzle = skgpu::Swizzle::Concat(fSwizzle, swizzle);
71
+ }
72
+
73
+ // makeSwizzle returns a new view with 'swizzle' composed on to this view's existing swizzle
74
+ TextureProxyView makeSwizzle(Swizzle swizzle) const & {
75
+ return {fProxy, Swizzle::Concat(fSwizzle, swizzle), fOrigin};
76
+ }
77
+
78
+ TextureProxyView makeSwizzle(Swizzle swizzle) && {
79
+ return {std::move(fProxy), Swizzle::Concat(fSwizzle, swizzle), fOrigin};
80
+ }
81
+
82
+ // resetSwizzle returns a new view that uses 'swizzle' and disregards this view's prior swizzle.
83
+ TextureProxyView replaceSwizzle(Swizzle swizzle) const {
84
+ return {fProxy, swizzle, fOrigin};
85
+ }
86
+
87
+ void reset() {
88
+ *this = {};
89
+ }
90
+
91
+ // This does not reset the swizzle, so the View can still be used to access those
92
+ // properties associated with the detached proxy.
93
+ sk_sp<TextureProxy> detachProxy() {
94
+ return std::move(fProxy);
95
+ }
96
+
97
+ private:
98
+ sk_sp<TextureProxy> fProxy;
99
+ Swizzle fSwizzle;
100
+ Origin fOrigin = Origin::kTopLeft;
101
+ };
102
+
103
+ } // namespace skgpu::graphite
104
+
105
+ #endif // skgpu_graphite_TextureProxyView_DEFINED
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "setup-skia-web": "scripts/setup-canvaskit.js"
10
10
  },
11
11
  "title": "React Native Skia",
12
- "version": "2.6.1",
12
+ "version": "2.6.3-next.1",
13
13
  "description": "High-performance React Native Graphics using Skia",
14
14
  "main": "lib/module/index.js",
15
15
  "react-native": "src/index.ts",
@@ -129,10 +129,10 @@
129
129
  },
130
130
  "dependencies": {
131
131
  "canvaskit-wasm": "0.41.0",
132
- "react-native-skia-android": "147.0.0",
133
- "react-native-skia-apple-ios": "147.0.0",
134
- "react-native-skia-apple-macos": "147.0.0",
135
- "react-native-skia-apple-tvos": "147.0.0",
132
+ "react-native-skia-graphite-android": "147.1.1",
133
+ "react-native-skia-graphite-apple-ios": "147.1.1",
134
+ "react-native-skia-graphite-apple-macos": "147.1.1",
135
+ "react-native-skia-graphite-headers": "147.1.1",
136
136
  "react-reconciler": "0.31.0"
137
137
  },
138
138
  "eslintIgnore": [
@@ -171,5 +171,6 @@
171
171
  }
172
172
  ]
173
173
  ]
174
- }
174
+ },
175
+ "stableVersion": "0.0.0"
175
176
  }
@@ -4,11 +4,10 @@
4
4
  const path = require("path");
5
5
  const fs = require("fs");
6
6
 
7
- const useGraphite =
8
- process.env.SK_GRAPHITE === "1" ||
9
- (process.env.SK_GRAPHITE || "").toLowerCase() === "true";
10
- const prefix = useGraphite ? "react-native-skia-graphite" : "react-native-skia";
7
+ const useGraphite = true;
8
+ const prefix = "react-native-skia-graphite";
11
9
  const libsDir = path.join(__dirname, "..", "libs");
10
+ const packageRoot = path.join(__dirname, "..");
12
11
 
13
12
  function copySync(src, dest, options) {
14
13
  if (!src.includes("*")) {
@@ -131,3 +130,44 @@ fs.rmSync(androidDest, { recursive: true, force: true });
131
130
  copySync(androidSrcLibs, androidDest, { recursive: true });
132
131
 
133
132
  console.log("-- Copied Android libs to libs/android/");
133
+
134
+ // --- Graphite: headers and marker file ---
135
+
136
+ if (useGraphite) {
137
+ // Copy Dawn/WebGPU headers from the headers package
138
+ let headersPackage;
139
+ try {
140
+ headersPackage = path.dirname(
141
+ require.resolve("react-native-skia-graphite-headers/package.json")
142
+ );
143
+ } catch (e) {
144
+ console.error("ERROR: Could not find react-native-skia-graphite-headers");
145
+ console.error("Make sure you have run yarn install or npm install");
146
+ process.exit(1);
147
+ }
148
+
149
+ console.log("-- Skia Graphite headers package: " + headersPackage);
150
+
151
+ const headersSrcBase = path.join(headersPackage, "libs/skia/cpp");
152
+
153
+ // Copy Dawn/WebGPU headers
154
+ const dawnSrc = path.join(headersSrcBase, "dawn");
155
+ const dawnDest = path.join(packageRoot, "cpp/dawn");
156
+ fs.rmSync(dawnDest, { recursive: true, force: true });
157
+ fs.cpSync(dawnSrc, dawnDest, { recursive: true });
158
+ console.log("-- Copied Dawn/WebGPU headers to cpp/dawn/");
159
+
160
+ // Copy Graphite source headers
161
+ const graphiteSrc = path.join(headersSrcBase, "skia/src/gpu/graphite");
162
+ const graphiteDest = path.join(packageRoot, "cpp/skia/src/gpu/graphite");
163
+ fs.rmSync(graphiteDest, { recursive: true, force: true });
164
+ fs.mkdirSync(graphiteDest, { recursive: true });
165
+ fs.cpSync(graphiteSrc, graphiteDest, { recursive: true });
166
+ console.log("-- Copied Graphite source headers to cpp/skia/src/gpu/graphite/");
167
+
168
+ // Write .graphite marker file
169
+ const markerFile = path.join(libsDir, ".graphite");
170
+ const version = "m147a";
171
+ fs.writeFileSync(markerFile, version, "utf-8");
172
+ console.log("-- Wrote Graphite marker file: " + markerFile);
173
+ }