@shopify/react-native-skia 2.9.1-next.1 → 2.10.0

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 (273) hide show
  1. package/android/CMakeLists.txt +1 -5
  2. package/android/cpp/jni/JniWebGPUView.cpp +52 -7
  3. package/android/src/main/java/com/shopify/reactnative/skia/WebGPUSurfaceView.java +3 -1
  4. package/android/src/main/java/com/shopify/reactnative/skia/WebGPUTextureView.java +11 -5
  5. package/android/src/main/java/com/shopify/reactnative/skia/WebGPUView.java +10 -7
  6. package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewAPI.java +7 -2
  7. package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewManager.java +1 -1
  8. package/apple/WebGPUMetalView.mm +49 -6
  9. package/cpp/api/JsiNativeBuffer.h +15 -10
  10. package/cpp/api/JsiSkAnimatedImage.h +21 -19
  11. package/cpp/api/JsiSkAnimatedImageFactory.h +13 -14
  12. package/cpp/api/JsiSkApi.h +246 -92
  13. package/cpp/api/JsiSkCanvas.h +76 -58
  14. package/cpp/api/JsiSkColor.h +7 -5
  15. package/cpp/api/JsiSkColorFilter.h +15 -8
  16. package/cpp/api/JsiSkColorFilterFactory.h +45 -45
  17. package/cpp/api/JsiSkContourMeasure.h +24 -21
  18. package/cpp/api/JsiSkContourMeasureIter.h +18 -21
  19. package/cpp/api/JsiSkData.h +13 -7
  20. package/cpp/api/JsiSkDataFactory.h +22 -21
  21. package/cpp/api/JsiSkFont.h +56 -44
  22. package/cpp/api/JsiSkFontMgr.h +22 -13
  23. package/cpp/api/JsiSkFontMgrFactory.h +12 -10
  24. package/cpp/api/JsiSkFontStyle.h +14 -12
  25. package/cpp/api/JsiSkImage.h +45 -34
  26. package/cpp/api/JsiSkImageFactory.h +47 -52
  27. package/cpp/api/JsiSkImageFilter.h +21 -11
  28. package/cpp/api/JsiSkImageFilterFactory.h +96 -96
  29. package/cpp/api/JsiSkImageInfo.h +22 -19
  30. package/cpp/api/JsiSkMaskFilter.h +21 -11
  31. package/cpp/api/JsiSkMaskFilterFactory.h +16 -13
  32. package/cpp/api/JsiSkMatrix.h +31 -31
  33. package/cpp/api/JsiSkNativeObjects.h +419 -0
  34. package/cpp/api/JsiSkPaint.h +59 -39
  35. package/cpp/api/JsiSkParagraph.h +39 -32
  36. package/cpp/api/JsiSkParagraphBuilder.h +24 -21
  37. package/cpp/api/JsiSkParagraphBuilderFactory.h +13 -12
  38. package/cpp/api/JsiSkParagraphStyle.h +20 -10
  39. package/cpp/api/JsiSkPath.h +95 -70
  40. package/cpp/api/JsiSkPathBuilder.h +83 -67
  41. package/cpp/api/JsiSkPathBuilderFactory.h +16 -17
  42. package/cpp/api/JsiSkPathEffect.h +21 -11
  43. package/cpp/api/JsiSkPathEffectFactory.h +33 -32
  44. package/cpp/api/JsiSkPathFactory.h +79 -103
  45. package/cpp/api/JsiSkPicture.h +24 -13
  46. package/cpp/api/JsiSkPictureFactory.h +21 -26
  47. package/cpp/api/JsiSkPictureRecorder.h +21 -22
  48. package/cpp/api/JsiSkPoint.h +19 -22
  49. package/cpp/api/JsiSkRRect.h +22 -29
  50. package/cpp/api/JsiSkRSXform.h +26 -30
  51. package/cpp/api/JsiSkRect.h +28 -30
  52. package/cpp/api/JsiSkRuntimeEffect.h +39 -30
  53. package/cpp/api/JsiSkRuntimeEffectFactory.h +12 -12
  54. package/cpp/api/JsiSkRuntimeShaderBuilder.h +25 -18
  55. package/cpp/api/JsiSkSVG.h +13 -13
  56. package/cpp/api/JsiSkSVGFactory.h +17 -20
  57. package/cpp/api/JsiSkShader.h +15 -8
  58. package/cpp/api/JsiSkShaderFactory.h +41 -48
  59. package/cpp/api/JsiSkSkottie.h +49 -39
  60. package/cpp/api/JsiSkStrutStyle.h +18 -8
  61. package/cpp/api/JsiSkSurface.h +24 -24
  62. package/cpp/api/JsiSkSurfaceFactory.h +15 -16
  63. package/cpp/api/JsiSkTextBlob.h +15 -8
  64. package/cpp/api/JsiSkTextBlobFactory.h +25 -28
  65. package/cpp/api/JsiSkTextStyle.h +34 -24
  66. package/cpp/api/JsiSkTypeface.h +19 -12
  67. package/cpp/api/JsiSkTypefaceFactory.h +12 -12
  68. package/cpp/api/JsiSkTypefaceFontProvider.h +30 -25
  69. package/cpp/api/JsiSkTypefaceFontProviderFactory.h +14 -12
  70. package/cpp/api/JsiSkVertices.h +21 -18
  71. package/cpp/api/JsiSkiaContext.h +17 -17
  72. package/cpp/api/JsiSkottieFactory.h +16 -17
  73. package/cpp/api/JsiVideo.h +27 -25
  74. package/cpp/api/recorder/Convertor.h +31 -61
  75. package/cpp/api/recorder/DataTypes.h +8 -16
  76. package/cpp/api/recorder/JsiRecorder.h +83 -55
  77. package/cpp/api/recorder/RNRecorder.h +1 -1
  78. package/cpp/jsi/BoxedNativeObject.h +146 -0
  79. package/cpp/{jsi2 → jsi}/EnumMapper.h +4 -1
  80. package/cpp/{jsi2 → jsi}/NativeObject.h +120 -146
  81. package/cpp/jsi/RuntimeAwareCache.cpp +1 -1
  82. package/cpp/jsi/RuntimeAwareCache.h +26 -8
  83. package/cpp/jsi/ViewProperty.h +5 -11
  84. package/cpp/rnskia/RNSkJsiViewApi.h +20 -11
  85. package/cpp/rnskia/RNSkManager.cpp +29 -25
  86. package/cpp/rnskia/RNSkPictureView.h +1 -1
  87. package/cpp/rnwgpu/ArrayBuffer.h +5 -6
  88. package/cpp/rnwgpu/Canvas.h +4 -2
  89. package/cpp/rnwgpu/SurfaceRegistry.h +469 -131
  90. package/cpp/rnwgpu/api/GPU.cpp +4 -4
  91. package/cpp/rnwgpu/api/GPU.h +1 -1
  92. package/cpp/rnwgpu/api/GPUAdapter.cpp +12 -6
  93. package/cpp/rnwgpu/api/GPUAdapter.h +5 -4
  94. package/cpp/rnwgpu/api/GPUAdapterInfo.h +1 -1
  95. package/cpp/rnwgpu/api/GPUBindGroup.h +1 -1
  96. package/cpp/rnwgpu/api/GPUBindGroupLayout.h +1 -1
  97. package/cpp/rnwgpu/api/GPUBuffer.cpp +12 -2
  98. package/cpp/rnwgpu/api/GPUBuffer.h +4 -3
  99. package/cpp/rnwgpu/api/GPUCanvasContext.cpp +33 -19
  100. package/cpp/rnwgpu/api/GPUCanvasContext.h +4 -2
  101. package/cpp/rnwgpu/api/GPUCommandBuffer.h +1 -1
  102. package/cpp/rnwgpu/api/GPUCommandEncoder.h +1 -1
  103. package/cpp/rnwgpu/api/GPUCompilationInfo.h +1 -1
  104. package/cpp/rnwgpu/api/GPUCompilationMessage.h +1 -1
  105. package/cpp/rnwgpu/api/GPUComputePassEncoder.h +1 -1
  106. package/cpp/rnwgpu/api/GPUComputePipeline.h +1 -1
  107. package/cpp/rnwgpu/api/GPUDevice.cpp +38 -24
  108. package/cpp/rnwgpu/api/GPUDevice.h +12 -10
  109. package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +1 -1
  110. package/cpp/rnwgpu/api/GPUError.h +1 -1
  111. package/cpp/rnwgpu/api/GPUExtent3D.h +1 -1
  112. package/cpp/rnwgpu/api/GPUExternalTexture.h +1 -1
  113. package/cpp/rnwgpu/api/GPUInternalError.h +1 -1
  114. package/cpp/rnwgpu/api/GPUOrigin2D.h +1 -1
  115. package/cpp/rnwgpu/api/GPUOrigin3D.h +1 -1
  116. package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +1 -1
  117. package/cpp/rnwgpu/api/GPUPipelineLayout.h +1 -1
  118. package/cpp/rnwgpu/api/GPUQuerySet.h +1 -1
  119. package/cpp/rnwgpu/api/GPUQueue.cpp +6 -2
  120. package/cpp/rnwgpu/api/GPUQueue.h +4 -4
  121. package/cpp/rnwgpu/api/GPURenderBundle.h +1 -1
  122. package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +1 -1
  123. package/cpp/rnwgpu/api/GPURenderPassEncoder.h +1 -1
  124. package/cpp/rnwgpu/api/GPURenderPipeline.h +1 -1
  125. package/cpp/rnwgpu/api/GPUSampler.h +1 -1
  126. package/cpp/rnwgpu/api/GPUShaderModule.cpp +8 -3
  127. package/cpp/rnwgpu/api/GPUShaderModule.h +4 -4
  128. package/cpp/rnwgpu/api/GPUSharedFence.h +1 -1
  129. package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +1 -1
  130. package/cpp/rnwgpu/api/GPUSupportedLimits.h +1 -1
  131. package/cpp/rnwgpu/api/GPUTexture.h +1 -1
  132. package/cpp/rnwgpu/api/GPUTextureView.h +1 -1
  133. package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +1 -1
  134. package/cpp/rnwgpu/api/GPUValidationError.h +1 -1
  135. package/cpp/rnwgpu/api/ImageBitmap.h +1 -1
  136. package/cpp/rnwgpu/api/RNWebGPU.h +21 -1
  137. package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +1 -1
  138. package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +1 -1
  139. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +1 -1
  140. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +1 -1
  141. package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +1 -1
  142. package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +1 -1
  143. package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +1 -1
  144. package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +1 -1
  145. package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +1 -1
  146. package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +1 -1
  147. package/cpp/rnwgpu/api/descriptors/GPUColor.h +1 -1
  148. package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +1 -1
  149. package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +1 -1
  150. package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +1 -1
  151. package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +1 -1
  152. package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +1 -1
  153. package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +1 -1
  154. package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +1 -1
  155. package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +1 -1
  156. package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +1 -1
  157. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +1 -1
  158. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +1 -1
  159. package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +1 -1
  160. package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +1 -1
  161. package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +1 -1
  162. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +1 -1
  163. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +1 -1
  164. package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +1 -1
  165. package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +1 -1
  166. package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +1 -1
  167. package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +1 -1
  168. package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +1 -1
  169. package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +1 -1
  170. package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +1 -1
  171. package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +1 -1
  172. package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +1 -1
  173. package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +1 -1
  174. package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +1 -1
  175. package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +1 -1
  176. package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +1 -1
  177. package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +1 -1
  178. package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +1 -1
  179. package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +1 -1
  180. package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +1 -1
  181. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +1 -1
  182. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +1 -1
  183. package/cpp/rnwgpu/api/descriptors/GPUSharedFenceDescriptor.h +1 -1
  184. package/cpp/rnwgpu/api/descriptors/GPUSharedFenceState.h +1 -1
  185. package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +1 -1
  186. package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +1 -1
  187. package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +1 -1
  188. package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +1 -1
  189. package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +1 -1
  190. package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +1 -1
  191. package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +1 -1
  192. package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +1 -1
  193. package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +1 -1
  194. package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +1 -1
  195. package/cpp/rnwgpu/api/descriptors/Unions.h +1 -1
  196. package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +20 -21
  197. package/cpp/rnwgpu/async/RuntimeContext.cpp +5 -0
  198. package/cpp/rnwgpu/async/RuntimeContext.h +15 -2
  199. package/lib/commonjs/external/reanimated/renderHelpers.d.ts +15 -0
  200. package/lib/commonjs/external/reanimated/renderHelpers.js +30 -1
  201. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  202. package/lib/commonjs/skia/NativeSetup.js +4 -0
  203. package/lib/commonjs/skia/NativeSetup.js.map +1 -1
  204. package/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +1 -0
  205. package/lib/commonjs/skia/SkiaWorkletSerialization.js +66 -0
  206. package/lib/commonjs/skia/SkiaWorkletSerialization.js.map +1 -0
  207. package/lib/commonjs/sksg/Container.native.js +20 -1
  208. package/lib/commonjs/sksg/Container.native.js.map +1 -1
  209. package/lib/commonjs/views/WebGPUCanvas.d.ts +1 -0
  210. package/lib/commonjs/views/WebGPUCanvas.js +13 -0
  211. package/lib/commonjs/views/WebGPUCanvas.js.map +1 -1
  212. package/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
  213. package/lib/module/external/reanimated/renderHelpers.js +29 -0
  214. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  215. package/lib/module/skia/NativeSetup.js +4 -0
  216. package/lib/module/skia/NativeSetup.js.map +1 -1
  217. package/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
  218. package/lib/module/skia/SkiaWorkletSerialization.js +59 -0
  219. package/lib/module/skia/SkiaWorkletSerialization.js.map +1 -0
  220. package/lib/module/sksg/Container.native.js +21 -2
  221. package/lib/module/sksg/Container.native.js.map +1 -1
  222. package/lib/module/views/WebGPUCanvas.d.ts +1 -0
  223. package/lib/module/views/WebGPUCanvas.js +14 -1
  224. package/lib/module/views/WebGPUCanvas.js.map +1 -1
  225. package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
  226. package/lib/typescript/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +2 -0
  227. package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
  228. package/lib/typescript/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
  229. package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +15 -0
  230. package/lib/typescript/src/skia/SkiaWorkletSerialization.d.ts +1 -0
  231. package/lib/typescript/src/views/WebGPUCanvas.d.ts +1 -0
  232. package/package.json +12 -8
  233. package/react-native-skia.podspec +1 -2
  234. package/src/external/reanimated/renderHelpers.ts +30 -0
  235. package/src/skia/NativeSetup.ts +5 -0
  236. package/src/skia/SkiaWorkletSerialization.ts +67 -0
  237. package/src/sksg/Container.native.ts +40 -2
  238. package/src/views/WebGPUCanvas.tsx +17 -1
  239. package/cpp/api/JsiSkHostObjects.h +0 -257
  240. package/cpp/dawn/include/dawn/dawn_proc.h +0 -53
  241. package/cpp/dawn/include/dawn/dawn_proc_table.h +0 -330
  242. package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +0 -47
  243. package/cpp/dawn/include/dawn/dawn_version.h +0 -41
  244. package/cpp/dawn/include/dawn/native/D3D11Backend.h +0 -65
  245. package/cpp/dawn/include/dawn/native/D3D12Backend.h +0 -86
  246. package/cpp/dawn/include/dawn/native/D3DBackend.h +0 -56
  247. package/cpp/dawn/include/dawn/native/DawnNative.h +0 -369
  248. package/cpp/dawn/include/dawn/native/MetalBackend.h +0 -56
  249. package/cpp/dawn/include/dawn/native/NullBackend.h +0 -39
  250. package/cpp/dawn/include/dawn/native/OpenGLBackend.h +0 -89
  251. package/cpp/dawn/include/dawn/native/VulkanBackend.h +0 -183
  252. package/cpp/dawn/include/dawn/native/WebGPUBackend.h +0 -49
  253. package/cpp/dawn/include/dawn/native/dawn_native_export.h +0 -49
  254. package/cpp/dawn/include/dawn/platform/DawnPlatform.h +0 -210
  255. package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +0 -49
  256. package/cpp/dawn/include/dawn/replay/Replay.h +0 -99
  257. package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +0 -49
  258. package/cpp/dawn/include/dawn/webgpu_cpp_print.h +0 -2844
  259. package/cpp/dawn/include/tint/tint.h +0 -90
  260. package/cpp/dawn/include/webgpu/webgpu.h +0 -4987
  261. package/cpp/dawn/include/webgpu/webgpu_cpp.h +0 -10080
  262. package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +0 -57
  263. package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +0 -161
  264. package/cpp/dawn/include/webgpu/webgpu_glfw.h +0 -88
  265. package/cpp/jsi/JsiHostObject.cpp +0 -137
  266. package/cpp/jsi/JsiHostObject.h +0 -385
  267. package/cpp/skia/src/gpu/graphite/ContextOptionsPriv.h +0 -45
  268. package/cpp/skia/src/gpu/graphite/ResourceTypes.h +0 -360
  269. package/cpp/skia/src/gpu/graphite/TextureProxyView.h +0 -105
  270. package/libs/.graphite +0 -1
  271. /package/cpp/{jsi2 → jsi}/JSIConverter.h +0 -0
  272. /package/cpp/{jsi2 → jsi}/Promise.cpp +0 -0
  273. /package/cpp/{jsi2 → jsi}/Promise.h +0 -0
@@ -1,57 +0,0 @@
1
- // Copyright 2023 The Dawn & Tint Authors
2
- //
3
- // Redistribution and use in source and binary forms, with or without
4
- // modification, are permitted provided that the following conditions are met:
5
- //
6
- // 1. Redistributions of source code must retain the above copyright notice, this
7
- // list of conditions and the following disclaimer.
8
- //
9
- // 2. Redistributions in binary form must reproduce the above copyright notice,
10
- // this list of conditions and the following disclaimer in the documentation
11
- // and/or other materials provided with the distribution.
12
- //
13
- // 3. Neither the name of the copyright holder nor the names of its
14
- // contributors may be used to endorse or promote products derived from
15
- // this software without specific prior written permission.
16
- //
17
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
- // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
- // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
- // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
- // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
- // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
- // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
- // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-
28
- #ifdef __EMSCRIPTEN__
29
- #error "Do not include this header. Emscripten already provides headers needed for WebGPU."
30
- #endif
31
-
32
- #ifndef WEBGPU_CPP_CHAINED_STRUCT_H_
33
- #define WEBGPU_CPP_CHAINED_STRUCT_H_
34
-
35
- #include <cstddef>
36
- #include <cstdint>
37
-
38
- // This header file declares the ChainedStruct structures separately from the WebGPU
39
- // headers so that dependencies can directly extend structures without including the larger header
40
- // which exposes capabilities that may require correctly set proc tables.
41
- namespace wgpu {
42
-
43
- enum class SType : uint32_t;
44
-
45
- struct ChainedStruct {
46
- ChainedStruct const * nextInChain = nullptr;
47
- SType sType = SType(0u);
48
- };
49
-
50
- struct ChainedStructOut {
51
- ChainedStructOut * nextInChain = nullptr;
52
- SType sType = SType(0u);
53
- };
54
-
55
- } // namespace wgpu}
56
-
57
- #endif // WEBGPU_CPP_CHAINED_STRUCT_H_
@@ -1,161 +0,0 @@
1
- // Copyright 2017 The Dawn & Tint Authors
2
- //
3
- // Redistribution and use in source and binary forms, with or without
4
- // modification, are permitted provided that the following conditions are met:
5
- //
6
- // 1. Redistributions of source code must retain the above copyright notice, this
7
- // list of conditions and the following disclaimer.
8
- //
9
- // 2. Redistributions in binary form must reproduce the above copyright notice,
10
- // this list of conditions and the following disclaimer in the documentation
11
- // and/or other materials provided with the distribution.
12
- //
13
- // 3. Neither the name of the copyright holder nor the names of its
14
- // contributors may be used to endorse or promote products derived from
15
- // this software without specific prior written permission.
16
- //
17
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
- // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
- // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
- // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
- // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
- // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
- // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
- // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-
28
- #ifndef WEBGPU_ENUM_CLASS_BITMASKS_H_
29
- #define WEBGPU_ENUM_CLASS_BITMASKS_H_
30
-
31
- #include <type_traits>
32
-
33
- // The operators in wgpu:: namespace need be introduced into other namespaces with
34
- // using-declarations for C++ Argument Dependent Lookup to work.
35
- #define WGPU_IMPORT_BITMASK_OPERATORS \
36
- using wgpu::operator|; \
37
- using wgpu::operator&; \
38
- using wgpu::operator^; \
39
- using wgpu::operator~; \
40
- using wgpu::operator&=; \
41
- using wgpu::operator|=; \
42
- using wgpu::operator^=; \
43
- using wgpu::HasZeroOrOneBits;
44
-
45
- namespace wgpu {
46
-
47
- template <typename T>
48
- struct IsWGPUBitmask {
49
- static constexpr bool enable = false;
50
- };
51
-
52
- template <typename T, typename Enable = void>
53
- struct LowerBitmask {
54
- static constexpr bool enable = false;
55
- };
56
-
57
- template <typename T>
58
- struct LowerBitmask<T, typename std::enable_if<IsWGPUBitmask<T>::enable>::type> {
59
- static constexpr bool enable = true;
60
- using type = T;
61
- constexpr static T Lower(T t) { return t; }
62
- };
63
-
64
- template <typename T>
65
- struct BoolConvertible {
66
- using Integral = typename std::underlying_type<T>::type;
67
-
68
- // NOLINTNEXTLINE(runtime/explicit)
69
- explicit constexpr BoolConvertible(Integral value) : value(value) {}
70
- constexpr operator bool() const { return value != 0; }
71
- constexpr operator T() const { return static_cast<T>(value); }
72
-
73
- Integral value;
74
- };
75
-
76
- template <typename T>
77
- struct LowerBitmask<BoolConvertible<T>> {
78
- static constexpr bool enable = true;
79
- using type = T;
80
- static constexpr type Lower(BoolConvertible<T> t) { return t; }
81
- };
82
-
83
- template <
84
- typename T1,
85
- typename T2,
86
- typename = typename std::enable_if<LowerBitmask<T1>::enable && LowerBitmask<T2>::enable>::type>
87
- constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator|(T1 left, T2 right) {
88
- using T = typename LowerBitmask<T1>::type;
89
- using Integral = typename std::underlying_type<T>::type;
90
- return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) |
91
- static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
92
- }
93
-
94
- template <
95
- typename T1,
96
- typename T2,
97
- typename = typename std::enable_if<LowerBitmask<T1>::enable && LowerBitmask<T2>::enable>::type>
98
- constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator&(T1 left, T2 right) {
99
- using T = typename LowerBitmask<T1>::type;
100
- using Integral = typename std::underlying_type<T>::type;
101
- return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) &
102
- static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
103
- }
104
-
105
- template <
106
- typename T1,
107
- typename T2,
108
- typename = typename std::enable_if<LowerBitmask<T1>::enable && LowerBitmask<T2>::enable>::type>
109
- constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator^(T1 left, T2 right) {
110
- using T = typename LowerBitmask<T1>::type;
111
- using Integral = typename std::underlying_type<T>::type;
112
- return BoolConvertible<T>(static_cast<Integral>(LowerBitmask<T1>::Lower(left)) ^
113
- static_cast<Integral>(LowerBitmask<T2>::Lower(right)));
114
- }
115
-
116
- template <typename T1>
117
- constexpr BoolConvertible<typename LowerBitmask<T1>::type> operator~(T1 t) {
118
- using T = typename LowerBitmask<T1>::type;
119
- using Integral = typename std::underlying_type<T>::type;
120
- return BoolConvertible<T>(~static_cast<Integral>(LowerBitmask<T1>::Lower(t)));
121
- }
122
-
123
- template <
124
- typename T,
125
- typename T2,
126
- typename = typename std::enable_if<IsWGPUBitmask<T>::enable && LowerBitmask<T2>::enable>::type>
127
- constexpr T& operator&=(T& l, T2 right) {
128
- T r = LowerBitmask<T2>::Lower(right);
129
- l = l & r;
130
- return l;
131
- }
132
-
133
- template <
134
- typename T,
135
- typename T2,
136
- typename = typename std::enable_if<IsWGPUBitmask<T>::enable && LowerBitmask<T2>::enable>::type>
137
- constexpr T& operator|=(T& l, T2 right) {
138
- T r = LowerBitmask<T2>::Lower(right);
139
- l = l | r;
140
- return l;
141
- }
142
-
143
- template <
144
- typename T,
145
- typename T2,
146
- typename = typename std::enable_if<IsWGPUBitmask<T>::enable && LowerBitmask<T2>::enable>::type>
147
- constexpr T& operator^=(T& l, T2 right) {
148
- T r = LowerBitmask<T2>::Lower(right);
149
- l = l ^ r;
150
- return l;
151
- }
152
-
153
- template <typename T>
154
- constexpr bool HasZeroOrOneBits(T value) {
155
- using Integral = typename std::underlying_type<T>::type;
156
- return (static_cast<Integral>(value) & (static_cast<Integral>(value) - 1)) == 0;
157
- }
158
-
159
- } // namespace wgpu
160
-
161
- #endif // WEBGPU_ENUM_CLASS_BITMASKS_H_
@@ -1,88 +0,0 @@
1
- // Copyright 2022 The Dawn & Tint Authors
2
- //
3
- // Redistribution and use in source and binary forms, with or without
4
- // modification, are permitted provided that the following conditions are met:
5
- //
6
- // 1. Redistributions of source code must retain the above copyright notice, this
7
- // list of conditions and the following disclaimer.
8
- //
9
- // 2. Redistributions in binary form must reproduce the above copyright notice,
10
- // this list of conditions and the following disclaimer in the documentation
11
- // and/or other materials provided with the distribution.
12
- //
13
- // 3. Neither the name of the copyright holder nor the names of its
14
- // contributors may be used to endorse or promote products derived from
15
- // this software without specific prior written permission.
16
- //
17
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
- // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
- // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
- // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
- // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
- // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
- // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
- // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
-
28
- #ifndef INCLUDE_WEBGPU_WEBGPU_GLFW_H_
29
- #define INCLUDE_WEBGPU_WEBGPU_GLFW_H_
30
-
31
- #ifdef __cplusplus
32
- #include <memory>
33
-
34
- #include "webgpu/webgpu_cpp.h"
35
- #else
36
- #include "webgpu/webgpu.h"
37
- #endif
38
-
39
- #if defined(WGPU_GLFW_SHARED_LIBRARY)
40
- #if defined(_WIN32)
41
- #if defined(WGPU_GLFW_IMPLEMENTATION)
42
- #define WGPU_GLFW_EXPORT __declspec(dllexport)
43
- #else
44
- #define WGPU_GLFW_EXPORT __declspec(dllimport)
45
- #endif
46
- #else // defined(_WIN32)
47
- #if defined(WGPU_GLFW_IMPLEMENTATION)
48
- #define WGPU_GLFW_EXPORT __attribute__((visibility("default")))
49
- #else
50
- #define WGPU_GLFW_EXPORT
51
- #endif
52
- #endif // defined(_WIN32)
53
- #else // defined(WGPU_GLFW_SHARED_LIBRARY)
54
- #define WGPU_GLFW_EXPORT
55
- #endif // defined(WGPU_GLFW_SHARED_LIBRARY)
56
-
57
- struct GLFWwindow;
58
-
59
- #ifdef __cplusplus
60
- extern "C" {
61
- #endif
62
-
63
- WGPU_GLFW_EXPORT WGPUSurface wgpuGlfwCreateSurfaceForWindow(const WGPUInstance instance,
64
- struct GLFWwindow* window);
65
-
66
- #ifdef __cplusplus
67
- }
68
-
69
- namespace wgpu::glfw {
70
-
71
- // Does the necessary setup on the GLFWwindow to allow creating a wgpu::Surface with it and
72
- // calls `instance.CreateSurface` with the correct descriptor for this window.
73
- // Returns a null wgpu::Surface on failure.
74
- WGPU_GLFW_EXPORT wgpu::Surface CreateSurfaceForWindow(const wgpu::Instance& instance,
75
- GLFWwindow* window);
76
-
77
- // Use for testing only. Does everything that CreateSurfaceForWindow does except the call to
78
- // CreateSurface. Useful to be able to modify the descriptor for testing, or when trying to
79
- // avoid using the global proc table.
80
- // NOLINTNEXTLINE(build/include_what_you_use)
81
- WGPU_GLFW_EXPORT std::unique_ptr<wgpu::ChainedStruct, void (*)(wgpu::ChainedStruct*)>
82
- SetupWindowAndGetSurfaceDescriptor(GLFWwindow* window);
83
-
84
- } // namespace wgpu::glfw
85
-
86
- #endif
87
-
88
- #endif // INCLUDE_WEBGPU_WEBGPU_GLFW_H_
@@ -1,137 +0,0 @@
1
- #include "JsiHostObject.h"
2
- #include <functional>
3
- #include <vector>
4
-
5
- namespace RNJsi {
6
-
7
- void JsiHostObject::set(jsi::Runtime &rt, const jsi::PropNameID &name,
8
- const jsi::Value &value) {
9
-
10
- auto nameStr = name.utf8(rt);
11
-
12
- /** Check the static setters map */
13
- const JsiPropertySettersMap &setters = getExportedPropertySettersMap();
14
- auto setter = setters.find(nameStr);
15
- if (setter != setters.end()) {
16
- auto dispatcher = std::bind(setter->second, this, std::placeholders::_1,
17
- std::placeholders::_2);
18
- return dispatcher(rt, value);
19
- }
20
-
21
- if (_propMap.count(nameStr) > 0) {
22
- auto prop = _propMap.at(nameStr);
23
- (prop.set)(rt, value);
24
- }
25
- }
26
-
27
- jsi::Value JsiHostObject::get(jsi::Runtime &runtime,
28
- const jsi::PropNameID &name) {
29
- auto nameStr = name.utf8(runtime);
30
-
31
- // Happy path - cached host functions are cheapest to look up
32
- const JsiFunctionMap &funcs = getExportedFunctionMap();
33
- auto func = funcs.find(nameStr);
34
-
35
- // Check function cache
36
- if (func != funcs.end()) {
37
- std::map<std::string, jsi::Function> &runtimeCache =
38
- _hostFunctionCache.get(runtime);
39
- auto cachedFunc = runtimeCache.find(nameStr);
40
- if (cachedFunc != runtimeCache.end()) {
41
- return cachedFunc->second.asFunction(runtime);
42
- }
43
- }
44
-
45
- // Check the static getters map
46
- const JsiPropertyGettersMap &getters = getExportedPropertyGettersMap();
47
- auto getter = getters.find(nameStr);
48
- if (getter != getters.end()) {
49
- auto dispatcher = std::bind(getter->second, this, std::placeholders::_1);
50
- return dispatcher(runtime);
51
- }
52
-
53
- // Check the static function map
54
- if (func != funcs.end()) {
55
-
56
- // Create dispatcher
57
- auto dispatcher =
58
- std::bind(func->second, reinterpret_cast<JsiHostObject *>(this),
59
- std::placeholders::_1, std::placeholders::_2,
60
- std::placeholders::_3, std::placeholders::_4);
61
-
62
- // Add to cache - it is important to cache the results from the
63
- // createFromHostFunction function which takes some time.
64
- return _hostFunctionCache.get(runtime)
65
- .emplace(nameStr, jsi::Function::createFromHostFunction(runtime, name,
66
- 0, dispatcher))
67
- .first->second.asFunction(runtime);
68
- }
69
-
70
- if (_funcMap.count(nameStr) > 0) {
71
- return jsi::Function::createFromHostFunction(runtime, name, 0,
72
- _funcMap.at(nameStr));
73
- }
74
-
75
- if (_propMap.count(nameStr) > 0) {
76
- auto prop = _propMap.at(nameStr);
77
- return (prop.get)(runtime);
78
- }
79
-
80
- // Check for dispose symbol as last resort
81
- static const auto disposeSymbol = jsi::PropNameID::forSymbol(
82
- runtime,
83
- runtime.global()
84
- .getPropertyAsObject(runtime, "Symbol")
85
- .getPropertyAsFunction(runtime, "for")
86
- .call(runtime, "Symbol.dispose")
87
- .getSymbol(runtime));
88
- if (jsi::PropNameID::compare(runtime, disposeSymbol, name)) {
89
- // Recursively call get with "dispose" string
90
- auto disposeName = jsi::PropNameID::forAscii(runtime, "dispose");
91
- return get(runtime, disposeName);
92
- }
93
-
94
- return jsi::Value::undefined();
95
- }
96
-
97
- std::vector<jsi::PropNameID>
98
- JsiHostObject::getPropertyNames(jsi::Runtime &runtime) {
99
- // statically exported functions
100
- const auto &funcs = getExportedFunctionMap();
101
-
102
- // Statically exported property getters
103
- const auto &getters = getExportedPropertyGettersMap();
104
-
105
- // Statically exported property setters
106
- const auto &setters = getExportedPropertySettersMap();
107
-
108
- std::vector<jsi::PropNameID> propNames;
109
- propNames.reserve(funcs.size() + getters.size() + setters.size() +
110
- _funcMap.size() + _propMap.size());
111
-
112
- for (auto it = funcs.cbegin(); it != funcs.cend(); ++it) {
113
- propNames.push_back(jsi::PropNameID::forAscii(runtime, it->first));
114
- }
115
-
116
- for (auto it = getters.cbegin(); it != getters.cend(); ++it) {
117
- propNames.push_back(jsi::PropNameID::forUtf8(runtime, it->first));
118
- }
119
-
120
- for (auto it = getters.cbegin(); it != getters.cend(); ++it) {
121
- if (getters.count(it->first) == 0) {
122
- propNames.push_back(jsi::PropNameID::forUtf8(runtime, it->first));
123
- }
124
- }
125
-
126
- // functions
127
- for (auto it = _funcMap.cbegin(); it != _funcMap.cend(); ++it) {
128
- propNames.push_back(jsi::PropNameID::forAscii(runtime, it->first));
129
- }
130
- // props
131
- for (auto it = _propMap.cbegin(); it != _propMap.cend(); ++it) {
132
- propNames.push_back(jsi::PropNameID::forAscii(runtime, it->first));
133
- }
134
- return propNames;
135
- }
136
-
137
- } // namespace RNJsi