@shopify/react-native-skia 2.8.0 → 2.9.1-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 (77) hide show
  1. package/android/build.gradle +10 -4
  2. package/android/cpp/rnskia-android/OpenGLContext.h +29 -3
  3. package/android/cpp/rnskia-android/OpenGLWindowContext.cpp +9 -2
  4. package/android/cpp/rnskia-android/gl/Context.h +3 -0
  5. package/android/cpp/rnskia-android/gl/Surface.h +1 -1
  6. package/cpp/api/JsiSkiaContext.h +4 -0
  7. package/cpp/dawn/include/dawn/dawn_proc.h +53 -0
  8. package/cpp/dawn/include/dawn/dawn_proc_table.h +330 -0
  9. package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +47 -0
  10. package/cpp/dawn/include/dawn/dawn_version.h +41 -0
  11. package/cpp/dawn/include/dawn/native/D3D11Backend.h +65 -0
  12. package/cpp/dawn/include/dawn/native/D3D12Backend.h +86 -0
  13. package/cpp/dawn/include/dawn/native/D3DBackend.h +56 -0
  14. package/cpp/dawn/include/dawn/native/DawnNative.h +369 -0
  15. package/cpp/dawn/include/dawn/native/MetalBackend.h +56 -0
  16. package/cpp/dawn/include/dawn/native/NullBackend.h +39 -0
  17. package/cpp/dawn/include/dawn/native/OpenGLBackend.h +89 -0
  18. package/cpp/dawn/include/dawn/native/VulkanBackend.h +183 -0
  19. package/cpp/dawn/include/dawn/native/WebGPUBackend.h +49 -0
  20. package/cpp/dawn/include/dawn/native/dawn_native_export.h +49 -0
  21. package/cpp/dawn/include/dawn/platform/DawnPlatform.h +210 -0
  22. package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +49 -0
  23. package/cpp/dawn/include/dawn/replay/Replay.h +99 -0
  24. package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +49 -0
  25. package/cpp/dawn/include/dawn/webgpu_cpp_print.h +2844 -0
  26. package/cpp/dawn/include/tint/tint.h +90 -0
  27. package/cpp/dawn/include/webgpu/webgpu.h +4987 -0
  28. package/cpp/dawn/include/webgpu/webgpu_cpp.h +10080 -0
  29. package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +57 -0
  30. package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +161 -0
  31. package/cpp/dawn/include/webgpu/webgpu_glfw.h +88 -0
  32. package/cpp/rnskia/RNSkView.h +6 -0
  33. package/cpp/skia/src/gpu/graphite/ContextOptionsPriv.h +45 -0
  34. package/cpp/skia/src/gpu/graphite/ResourceTypes.h +360 -0
  35. package/cpp/skia/src/gpu/graphite/TextureProxyView.h +105 -0
  36. package/lib/commonjs/Platform/Platform.js +5 -2
  37. package/lib/commonjs/Platform/Platform.js.map +1 -1
  38. package/lib/commonjs/Platform/Platform.web.js +8 -7
  39. package/lib/commonjs/Platform/Platform.web.js.map +1 -1
  40. package/lib/commonjs/skia/core/Font.d.ts +21 -6
  41. package/lib/commonjs/skia/core/Font.js +24 -4
  42. package/lib/commonjs/skia/core/Font.js.map +1 -1
  43. package/lib/commonjs/skia/types/Data/Data.d.ts +5 -4
  44. package/lib/commonjs/skia/types/Data/Data.js +7 -1
  45. package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
  46. package/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -1
  47. package/lib/commonjs/skia/web/JsiSkFont.js +43 -2
  48. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  49. package/lib/module/Platform/Platform.js +6 -3
  50. package/lib/module/Platform/Platform.js.map +1 -1
  51. package/lib/module/Platform/Platform.web.js +9 -8
  52. package/lib/module/Platform/Platform.web.js.map +1 -1
  53. package/lib/module/skia/core/Font.d.ts +21 -6
  54. package/lib/module/skia/core/Font.js +26 -5
  55. package/lib/module/skia/core/Font.js.map +1 -1
  56. package/lib/module/skia/types/Data/Data.d.ts +5 -4
  57. package/lib/module/skia/types/Data/Data.js +5 -0
  58. package/lib/module/skia/types/Data/Data.js.map +1 -1
  59. package/lib/module/skia/web/JsiSkFont.d.ts +1 -1
  60. package/lib/module/skia/web/JsiSkFont.js +44 -3
  61. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  62. package/lib/typescript/lib/commonjs/skia/types/Data/Data.d.ts +1 -0
  63. package/lib/typescript/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -1
  64. package/lib/typescript/lib/module/mock/index.d.ts +1 -0
  65. package/lib/typescript/lib/module/skia/types/Data/Data.d.ts +1 -0
  66. package/lib/typescript/lib/module/skia/web/JsiSkFont.d.ts +1 -1
  67. package/lib/typescript/src/skia/core/Font.d.ts +21 -6
  68. package/lib/typescript/src/skia/types/Data/Data.d.ts +5 -4
  69. package/lib/typescript/src/skia/web/JsiSkFont.d.ts +1 -1
  70. package/libs/.graphite +1 -0
  71. package/package.json +13 -7
  72. package/react-native-skia.podspec +18 -10
  73. package/src/Platform/Platform.ts +6 -7
  74. package/src/Platform/Platform.web.tsx +9 -8
  75. package/src/skia/core/Font.ts +34 -13
  76. package/src/skia/types/Data/Data.ts +14 -4
  77. package/src/skia/web/JsiSkFont.ts +48 -4
@@ -74,12 +74,18 @@ static def resolveNodePackage(packageName, baseDir) {
74
74
  return proc.text.trim()
75
75
  }
76
76
 
77
- // Graphite is detected via a marker file created by install-skia-graphite, which
78
- // downloads its binaries directly into libs/. For the default (Ganesh) build the
79
- // binaries live in the react-native-skia-android npm package and are read in place.
77
+ // Graphite is detected via a marker file (created by install-skia-graphite for
78
+ // in-repo development, or shipped in the npm tarball for next-channel releases).
79
+ // The prebuilt binaries live in the react-native-skia-android npm package for the
80
+ // default (Ganesh) build and in react-native-skia-graphite-android for Graphite.
81
+ // In-repo Graphite development downloads them directly into libs/android instead,
82
+ // which takes precedence over the npm package when present.
80
83
  def useGraphite = file("${projectDir}/../libs/.graphite").exists()
84
+ def localGraphiteLibs = file("${projectDir}/../libs/android")
81
85
  def skiaLibsPath = useGraphite
82
- ? "${projectDir}/../libs/android"
86
+ ? (localGraphiteLibs.exists()
87
+ ? "${projectDir}/../libs/android"
88
+ : "${resolveNodePackage('react-native-skia-graphite-android', projectDir)}/libs")
83
89
  : "${resolveNodePackage('react-native-skia-android', projectDir)}/libs"
84
90
 
85
91
  logger.warn("react-native-skia: SK_GRAPHITE: ${useGraphite}")
@@ -42,6 +42,11 @@ private:
42
42
  _glConfig = _glDisplay->chooseConfig();
43
43
  _glContext = _glDisplay->makeContext(_glConfig, nullptr);
44
44
  _glSurface = _glDisplay->makePixelBufferSurface(_glConfig, 1, 1);
45
+ if (_glContext == nullptr || _glSurface == nullptr) {
46
+ RNSkLogger::logToConsole(
47
+ "Couldn't create the shared OpenGL context or surface");
48
+ return;
49
+ }
45
50
  _glContext->makeCurrent(_glSurface.get());
46
51
  }
47
52
  };
@@ -60,6 +65,10 @@ public:
60
65
 
61
66
  sk_sp<SkSurface> MakeOffscreen(int width, int height,
62
67
  bool useP3ColorSpace = false) {
68
+ if (_directContext == nullptr) {
69
+ return nullptr;
70
+ }
71
+
63
72
  auto colorType = kRGBA_8888_SkColorType;
64
73
 
65
74
  SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
@@ -110,6 +119,9 @@ public:
110
119
  sk_sp<SkImage> MakeImageFromBuffer(void *buffer,
111
120
  bool requireKnownFormat = false) {
112
121
  #if __ANDROID_API__ >= 26
122
+ if (_directContext == nullptr) {
123
+ return nullptr;
124
+ }
113
125
  const AHardwareBuffer *hardwareBuffer =
114
126
  static_cast<AHardwareBuffer *>(buffer);
115
127
  DeleteImageProc deleteImageProc = nullptr;
@@ -181,6 +193,11 @@ public:
181
193
  // TODO: remove width, height
182
194
  std::unique_ptr<WindowContext> MakeWindow(ANativeWindow *window,
183
195
  bool highBitDepth = false) {
196
+ if (_directContext == nullptr) {
197
+ RNSkLogger::logToConsole(
198
+ "The OpenGL context is invalid, the surface will not be rendered");
199
+ return nullptr;
200
+ }
184
201
  auto display = OpenGLSharedContext::getInstance().getDisplay();
185
202
  if (highBitDepth) {
186
203
  // A 10-bit window surface would require the shared EGL context to be
@@ -196,7 +213,11 @@ public:
196
213
  }
197
214
 
198
215
  GrDirectContext *getDirectContext() { return _directContext.get(); }
199
- void makeCurrent() { _glContext->makeCurrent(_glSurface.get()); }
216
+ void makeCurrent() {
217
+ if (_glContext != nullptr) {
218
+ _glContext->makeCurrent(_glSurface.get());
219
+ }
220
+ }
200
221
 
201
222
  private:
202
223
  std::unique_ptr<gl::Context> _glContext;
@@ -209,12 +230,17 @@ private:
209
230
  auto glConfig = OpenGLSharedContext::getInstance().getConfig();
210
231
  _glContext = display->makeContext(glConfig, sharedContext);
211
232
  _glSurface = display->makePixelBufferSurface(glConfig, 1, 1);
212
- _glContext->makeCurrent(_glSurface.get());
233
+ if (_glContext == nullptr || _glSurface == nullptr ||
234
+ !_glContext->makeCurrent(_glSurface.get())) {
235
+ RNSkLogger::logToConsole(
236
+ "Couldn't create the OpenGL context, Skia rendering is disabled");
237
+ return;
238
+ }
213
239
  auto backendInterface = GrGLMakeNativeInterface();
214
240
  _directContext = GrDirectContexts::MakeGL(backendInterface);
215
241
 
216
242
  if (_directContext == nullptr) {
217
- throw std::runtime_error("GrDirectContexts::MakeGL failed");
243
+ RNSkLogger::logToConsole("GrDirectContexts::MakeGL failed");
218
244
  }
219
245
  }
220
246
  };
@@ -16,7 +16,12 @@ namespace RNSkia {
16
16
 
17
17
  sk_sp<SkSurface> OpenGLWindowContext::getSurface() {
18
18
  if (_skSurface == nullptr) {
19
- _glContext->makeCurrent(_glSurface.get());
19
+ if (_glSurface == nullptr || !_glContext->makeCurrent(_glSurface.get())) {
20
+ RNSkLogger::logToConsole(
21
+ "Couldn't create the EGL window surface, the surface will not be "
22
+ "rendered");
23
+ return nullptr;
24
+ }
20
25
  GLint stencil;
21
26
  glGetIntegerv(GL_STENCIL_BITS, &stencil);
22
27
 
@@ -52,7 +57,9 @@ sk_sp<SkSurface> OpenGLWindowContext::getSurface() {
52
57
  }
53
58
 
54
59
  void OpenGLWindowContext::present() {
55
- _glContext->makeCurrent(_glSurface.get());
60
+ if (_glSurface == nullptr || !_glContext->makeCurrent(_glSurface.get())) {
61
+ return;
62
+ }
56
63
  _directContext->flushAndSubmit();
57
64
  _glSurface->present();
58
65
  }
@@ -26,6 +26,9 @@ public:
26
26
  if (_context == EGL_NO_CONTEXT) {
27
27
  return false;
28
28
  }
29
+ if (surface == nullptr || !surface->isValid()) {
30
+ return false;
31
+ }
29
32
  const auto result =
30
33
  eglMakeCurrentIfNecessary(_display, surface->getHandle(),
31
34
  surface->getHandle(), _context) == EGL_TRUE;
@@ -17,7 +17,7 @@ public:
17
17
  }
18
18
  }
19
19
 
20
- bool isValid() { return _surface != EGL_NO_SURFACE; }
20
+ bool isValid() const { return _surface != EGL_NO_SURFACE; }
21
21
 
22
22
  const EGLSurface &getHandle() const { return _surface; }
23
23
 
@@ -79,6 +79,10 @@ public:
79
79
  }
80
80
  auto result =
81
81
  context->makeContextFromNativeSurface(surface, width, height);
82
+ if (result == nullptr) {
83
+ throw std::runtime_error(
84
+ "Couldn't create a Skia context from the native surface");
85
+ }
82
86
  // Return the newly constructed object
83
87
  auto hostObjectInstance =
84
88
  std::make_shared<JsiSkiaContext>(context, std::move(result));
@@ -0,0 +1,53 @@
1
+ // Copyright 2019 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_DAWN_DAWN_PROC_H_
29
+ #define INCLUDE_DAWN_DAWN_PROC_H_
30
+
31
+ #include <webgpu/webgpu.h>
32
+
33
+ #include "dawn/dawn_proc_table.h"
34
+
35
+ #ifdef __cplusplus
36
+ extern "C" {
37
+ #endif
38
+
39
+ // Sets the static proctable used by libdawn_proc to implement the Dawn entrypoints. Passing NULL
40
+ // for `procs` sets up the null proctable that contains only null function pointers. It is the
41
+ // default value of the proctable. Setting the proctable back to null is good practice when you
42
+ // are done using libdawn_proc since further usage will cause a segfault instead of calling an
43
+ // unexpected function.
44
+ WGPU_EXPORT void dawnProcSetProcs(const DawnProcTable* procs);
45
+
46
+ // Returns the static array of uint8_t of size 20 representing the Dawn version.
47
+ WGPU_EXPORT const uint8_t* dawnProcGetVersion();
48
+
49
+ #ifdef __cplusplus
50
+ } // extern "C"
51
+ #endif
52
+
53
+ #endif // INCLUDE_DAWN_DAWN_PROC_H_
@@ -0,0 +1,330 @@
1
+
2
+ #ifndef DAWN_DAWN_PROC_TABLE_H_
3
+ #define DAWN_DAWN_PROC_TABLE_H_
4
+
5
+ #include "webgpu/webgpu.h"
6
+
7
+ // Note: Often allocated as a static global. Do not add a complex constructor.
8
+ typedef struct DawnProcTable {
9
+ uint8_t version[20];
10
+
11
+ WGPUProcCreateInstance createInstance;
12
+ WGPUProcGetInstanceFeatures getInstanceFeatures;
13
+ WGPUProcGetInstanceLimits getInstanceLimits;
14
+ WGPUProcHasInstanceFeature hasInstanceFeature;
15
+ WGPUProcGetProcAddress getProcAddress;
16
+
17
+ WGPUProcAdapterCreateDevice adapterCreateDevice;
18
+ WGPUProcAdapterGetFeatures adapterGetFeatures;
19
+ WGPUProcAdapterGetFormatCapabilities adapterGetFormatCapabilities;
20
+ WGPUProcAdapterGetInfo adapterGetInfo;
21
+ WGPUProcAdapterGetInstance adapterGetInstance;
22
+ WGPUProcAdapterGetLimits adapterGetLimits;
23
+ WGPUProcAdapterHasFeature adapterHasFeature;
24
+ WGPUProcAdapterRequestDevice adapterRequestDevice;
25
+ WGPUProcAdapterAddRef adapterAddRef;
26
+ WGPUProcAdapterRelease adapterRelease;
27
+
28
+ WGPUProcAdapterInfoFreeMembers adapterInfoFreeMembers;
29
+
30
+ WGPUProcAdapterPropertiesMemoryHeapsFreeMembers adapterPropertiesMemoryHeapsFreeMembers;
31
+
32
+ WGPUProcAdapterPropertiesSubgroupMatrixConfigsFreeMembers adapterPropertiesSubgroupMatrixConfigsFreeMembers;
33
+
34
+ WGPUProcBindGroupSetLabel bindGroupSetLabel;
35
+ WGPUProcBindGroupAddRef bindGroupAddRef;
36
+ WGPUProcBindGroupRelease bindGroupRelease;
37
+
38
+ WGPUProcBindGroupLayoutSetLabel bindGroupLayoutSetLabel;
39
+ WGPUProcBindGroupLayoutAddRef bindGroupLayoutAddRef;
40
+ WGPUProcBindGroupLayoutRelease bindGroupLayoutRelease;
41
+
42
+ WGPUProcBufferCreateTexelView bufferCreateTexelView;
43
+ WGPUProcBufferDestroy bufferDestroy;
44
+ WGPUProcBufferGetConstMappedRange bufferGetConstMappedRange;
45
+ WGPUProcBufferGetMappedRange bufferGetMappedRange;
46
+ WGPUProcBufferGetMapState bufferGetMapState;
47
+ WGPUProcBufferGetSize bufferGetSize;
48
+ WGPUProcBufferGetUsage bufferGetUsage;
49
+ WGPUProcBufferMapAsync bufferMapAsync;
50
+ WGPUProcBufferReadMappedRange bufferReadMappedRange;
51
+ WGPUProcBufferSetLabel bufferSetLabel;
52
+ WGPUProcBufferUnmap bufferUnmap;
53
+ WGPUProcBufferWriteMappedRange bufferWriteMappedRange;
54
+ WGPUProcBufferAddRef bufferAddRef;
55
+ WGPUProcBufferRelease bufferRelease;
56
+
57
+ WGPUProcCommandBufferSetLabel commandBufferSetLabel;
58
+ WGPUProcCommandBufferAddRef commandBufferAddRef;
59
+ WGPUProcCommandBufferRelease commandBufferRelease;
60
+
61
+ WGPUProcCommandEncoderBeginComputePass commandEncoderBeginComputePass;
62
+ WGPUProcCommandEncoderBeginRenderPass commandEncoderBeginRenderPass;
63
+ WGPUProcCommandEncoderClearBuffer commandEncoderClearBuffer;
64
+ WGPUProcCommandEncoderCopyBufferToBuffer commandEncoderCopyBufferToBuffer;
65
+ WGPUProcCommandEncoderCopyBufferToTexture commandEncoderCopyBufferToTexture;
66
+ WGPUProcCommandEncoderCopyTextureToBuffer commandEncoderCopyTextureToBuffer;
67
+ WGPUProcCommandEncoderCopyTextureToTexture commandEncoderCopyTextureToTexture;
68
+ WGPUProcCommandEncoderFinish commandEncoderFinish;
69
+ WGPUProcCommandEncoderInjectValidationError commandEncoderInjectValidationError;
70
+ WGPUProcCommandEncoderInsertDebugMarker commandEncoderInsertDebugMarker;
71
+ WGPUProcCommandEncoderPopDebugGroup commandEncoderPopDebugGroup;
72
+ WGPUProcCommandEncoderPushDebugGroup commandEncoderPushDebugGroup;
73
+ WGPUProcCommandEncoderResolveQuerySet commandEncoderResolveQuerySet;
74
+ WGPUProcCommandEncoderSetLabel commandEncoderSetLabel;
75
+ WGPUProcCommandEncoderWriteBuffer commandEncoderWriteBuffer;
76
+ WGPUProcCommandEncoderWriteTimestamp commandEncoderWriteTimestamp;
77
+ WGPUProcCommandEncoderAddRef commandEncoderAddRef;
78
+ WGPUProcCommandEncoderRelease commandEncoderRelease;
79
+
80
+ WGPUProcComputePassEncoderDispatchWorkgroups computePassEncoderDispatchWorkgroups;
81
+ WGPUProcComputePassEncoderDispatchWorkgroupsIndirect computePassEncoderDispatchWorkgroupsIndirect;
82
+ WGPUProcComputePassEncoderEnd computePassEncoderEnd;
83
+ WGPUProcComputePassEncoderInsertDebugMarker computePassEncoderInsertDebugMarker;
84
+ WGPUProcComputePassEncoderPopDebugGroup computePassEncoderPopDebugGroup;
85
+ WGPUProcComputePassEncoderPushDebugGroup computePassEncoderPushDebugGroup;
86
+ WGPUProcComputePassEncoderSetBindGroup computePassEncoderSetBindGroup;
87
+ WGPUProcComputePassEncoderSetImmediates computePassEncoderSetImmediates;
88
+ WGPUProcComputePassEncoderSetLabel computePassEncoderSetLabel;
89
+ WGPUProcComputePassEncoderSetPipeline computePassEncoderSetPipeline;
90
+ WGPUProcComputePassEncoderSetResourceTable computePassEncoderSetResourceTable;
91
+ WGPUProcComputePassEncoderWriteTimestamp computePassEncoderWriteTimestamp;
92
+ WGPUProcComputePassEncoderAddRef computePassEncoderAddRef;
93
+ WGPUProcComputePassEncoderRelease computePassEncoderRelease;
94
+
95
+ WGPUProcComputePipelineGetBindGroupLayout computePipelineGetBindGroupLayout;
96
+ WGPUProcComputePipelineSetLabel computePipelineSetLabel;
97
+ WGPUProcComputePipelineAddRef computePipelineAddRef;
98
+ WGPUProcComputePipelineRelease computePipelineRelease;
99
+
100
+ WGPUProcDawnDrmFormatCapabilitiesFreeMembers dawnDrmFormatCapabilitiesFreeMembers;
101
+
102
+ WGPUProcDeviceCreateBindGroup deviceCreateBindGroup;
103
+ WGPUProcDeviceCreateBindGroupLayout deviceCreateBindGroupLayout;
104
+ WGPUProcDeviceCreateBuffer deviceCreateBuffer;
105
+ WGPUProcDeviceCreateCommandEncoder deviceCreateCommandEncoder;
106
+ WGPUProcDeviceCreateComputePipeline deviceCreateComputePipeline;
107
+ WGPUProcDeviceCreateComputePipelineAsync deviceCreateComputePipelineAsync;
108
+ WGPUProcDeviceCreateErrorBuffer deviceCreateErrorBuffer;
109
+ WGPUProcDeviceCreateErrorExternalTexture deviceCreateErrorExternalTexture;
110
+ WGPUProcDeviceCreateErrorShaderModule deviceCreateErrorShaderModule;
111
+ WGPUProcDeviceCreateErrorTexture deviceCreateErrorTexture;
112
+ WGPUProcDeviceCreateExternalTexture deviceCreateExternalTexture;
113
+ WGPUProcDeviceCreatePipelineLayout deviceCreatePipelineLayout;
114
+ WGPUProcDeviceCreateQuerySet deviceCreateQuerySet;
115
+ WGPUProcDeviceCreateRenderBundleEncoder deviceCreateRenderBundleEncoder;
116
+ WGPUProcDeviceCreateRenderPipeline deviceCreateRenderPipeline;
117
+ WGPUProcDeviceCreateRenderPipelineAsync deviceCreateRenderPipelineAsync;
118
+ WGPUProcDeviceCreateResourceTable deviceCreateResourceTable;
119
+ WGPUProcDeviceCreateSampler deviceCreateSampler;
120
+ WGPUProcDeviceCreateShaderModule deviceCreateShaderModule;
121
+ WGPUProcDeviceCreateTexture deviceCreateTexture;
122
+ WGPUProcDeviceDestroy deviceDestroy;
123
+ WGPUProcDeviceForceLoss deviceForceLoss;
124
+ WGPUProcDeviceGetAdapter deviceGetAdapter;
125
+ WGPUProcDeviceGetAdapterInfo deviceGetAdapterInfo;
126
+ WGPUProcDeviceGetAHardwareBufferProperties deviceGetAHardwareBufferProperties;
127
+ WGPUProcDeviceGetFeatures deviceGetFeatures;
128
+ WGPUProcDeviceGetLimits deviceGetLimits;
129
+ WGPUProcDeviceGetLostFuture deviceGetLostFuture;
130
+ WGPUProcDeviceGetQueue deviceGetQueue;
131
+ WGPUProcDeviceHasFeature deviceHasFeature;
132
+ WGPUProcDeviceImportSharedBufferMemory deviceImportSharedBufferMemory;
133
+ WGPUProcDeviceImportSharedFence deviceImportSharedFence;
134
+ WGPUProcDeviceImportSharedTextureMemory deviceImportSharedTextureMemory;
135
+ WGPUProcDeviceInjectError deviceInjectError;
136
+ WGPUProcDevicePopErrorScope devicePopErrorScope;
137
+ WGPUProcDevicePushErrorScope devicePushErrorScope;
138
+ WGPUProcDeviceSetLabel deviceSetLabel;
139
+ WGPUProcDeviceSetLoggingCallback deviceSetLoggingCallback;
140
+ WGPUProcDeviceTick deviceTick;
141
+ WGPUProcDeviceValidateTextureDescriptor deviceValidateTextureDescriptor;
142
+ WGPUProcDeviceAddRef deviceAddRef;
143
+ WGPUProcDeviceRelease deviceRelease;
144
+
145
+ WGPUProcExternalTextureDestroy externalTextureDestroy;
146
+ WGPUProcExternalTextureExpire externalTextureExpire;
147
+ WGPUProcExternalTextureRefresh externalTextureRefresh;
148
+ WGPUProcExternalTextureSetLabel externalTextureSetLabel;
149
+ WGPUProcExternalTextureAddRef externalTextureAddRef;
150
+ WGPUProcExternalTextureRelease externalTextureRelease;
151
+
152
+ WGPUProcInstanceCreateSurface instanceCreateSurface;
153
+ WGPUProcInstanceGetWGSLLanguageFeatures instanceGetWGSLLanguageFeatures;
154
+ WGPUProcInstanceHasWGSLLanguageFeature instanceHasWGSLLanguageFeature;
155
+ WGPUProcInstanceProcessEvents instanceProcessEvents;
156
+ WGPUProcInstanceRequestAdapter instanceRequestAdapter;
157
+ WGPUProcInstanceWaitAny instanceWaitAny;
158
+ WGPUProcInstanceAddRef instanceAddRef;
159
+ WGPUProcInstanceRelease instanceRelease;
160
+
161
+ WGPUProcPipelineLayoutSetLabel pipelineLayoutSetLabel;
162
+ WGPUProcPipelineLayoutAddRef pipelineLayoutAddRef;
163
+ WGPUProcPipelineLayoutRelease pipelineLayoutRelease;
164
+
165
+ WGPUProcQuerySetDestroy querySetDestroy;
166
+ WGPUProcQuerySetGetCount querySetGetCount;
167
+ WGPUProcQuerySetGetType querySetGetType;
168
+ WGPUProcQuerySetSetLabel querySetSetLabel;
169
+ WGPUProcQuerySetAddRef querySetAddRef;
170
+ WGPUProcQuerySetRelease querySetRelease;
171
+
172
+ WGPUProcQueueCopyExternalTextureForBrowser queueCopyExternalTextureForBrowser;
173
+ WGPUProcQueueCopyTextureForBrowser queueCopyTextureForBrowser;
174
+ WGPUProcQueueOnSubmittedWorkDone queueOnSubmittedWorkDone;
175
+ WGPUProcQueueSetLabel queueSetLabel;
176
+ WGPUProcQueueSubmit queueSubmit;
177
+ WGPUProcQueueWriteBuffer queueWriteBuffer;
178
+ WGPUProcQueueWriteTexture queueWriteTexture;
179
+ WGPUProcQueueAddRef queueAddRef;
180
+ WGPUProcQueueRelease queueRelease;
181
+
182
+ WGPUProcRenderBundleSetLabel renderBundleSetLabel;
183
+ WGPUProcRenderBundleAddRef renderBundleAddRef;
184
+ WGPUProcRenderBundleRelease renderBundleRelease;
185
+
186
+ WGPUProcRenderBundleEncoderDraw renderBundleEncoderDraw;
187
+ WGPUProcRenderBundleEncoderDrawIndexed renderBundleEncoderDrawIndexed;
188
+ WGPUProcRenderBundleEncoderDrawIndexedIndirect renderBundleEncoderDrawIndexedIndirect;
189
+ WGPUProcRenderBundleEncoderDrawIndirect renderBundleEncoderDrawIndirect;
190
+ WGPUProcRenderBundleEncoderFinish renderBundleEncoderFinish;
191
+ WGPUProcRenderBundleEncoderInsertDebugMarker renderBundleEncoderInsertDebugMarker;
192
+ WGPUProcRenderBundleEncoderPopDebugGroup renderBundleEncoderPopDebugGroup;
193
+ WGPUProcRenderBundleEncoderPushDebugGroup renderBundleEncoderPushDebugGroup;
194
+ WGPUProcRenderBundleEncoderSetBindGroup renderBundleEncoderSetBindGroup;
195
+ WGPUProcRenderBundleEncoderSetImmediates renderBundleEncoderSetImmediates;
196
+ WGPUProcRenderBundleEncoderSetIndexBuffer renderBundleEncoderSetIndexBuffer;
197
+ WGPUProcRenderBundleEncoderSetLabel renderBundleEncoderSetLabel;
198
+ WGPUProcRenderBundleEncoderSetPipeline renderBundleEncoderSetPipeline;
199
+ WGPUProcRenderBundleEncoderSetResourceTable renderBundleEncoderSetResourceTable;
200
+ WGPUProcRenderBundleEncoderSetVertexBuffer renderBundleEncoderSetVertexBuffer;
201
+ WGPUProcRenderBundleEncoderAddRef renderBundleEncoderAddRef;
202
+ WGPUProcRenderBundleEncoderRelease renderBundleEncoderRelease;
203
+
204
+ WGPUProcRenderPassEncoderBeginOcclusionQuery renderPassEncoderBeginOcclusionQuery;
205
+ WGPUProcRenderPassEncoderDraw renderPassEncoderDraw;
206
+ WGPUProcRenderPassEncoderDrawIndexed renderPassEncoderDrawIndexed;
207
+ WGPUProcRenderPassEncoderDrawIndexedIndirect renderPassEncoderDrawIndexedIndirect;
208
+ WGPUProcRenderPassEncoderDrawIndirect renderPassEncoderDrawIndirect;
209
+ WGPUProcRenderPassEncoderEnd renderPassEncoderEnd;
210
+ WGPUProcRenderPassEncoderEndOcclusionQuery renderPassEncoderEndOcclusionQuery;
211
+ WGPUProcRenderPassEncoderExecuteBundles renderPassEncoderExecuteBundles;
212
+ WGPUProcRenderPassEncoderInsertDebugMarker renderPassEncoderInsertDebugMarker;
213
+ WGPUProcRenderPassEncoderMultiDrawIndexedIndirect renderPassEncoderMultiDrawIndexedIndirect;
214
+ WGPUProcRenderPassEncoderMultiDrawIndirect renderPassEncoderMultiDrawIndirect;
215
+ WGPUProcRenderPassEncoderPixelLocalStorageBarrier renderPassEncoderPixelLocalStorageBarrier;
216
+ WGPUProcRenderPassEncoderPopDebugGroup renderPassEncoderPopDebugGroup;
217
+ WGPUProcRenderPassEncoderPushDebugGroup renderPassEncoderPushDebugGroup;
218
+ WGPUProcRenderPassEncoderSetBindGroup renderPassEncoderSetBindGroup;
219
+ WGPUProcRenderPassEncoderSetBlendConstant renderPassEncoderSetBlendConstant;
220
+ WGPUProcRenderPassEncoderSetImmediates renderPassEncoderSetImmediates;
221
+ WGPUProcRenderPassEncoderSetIndexBuffer renderPassEncoderSetIndexBuffer;
222
+ WGPUProcRenderPassEncoderSetLabel renderPassEncoderSetLabel;
223
+ WGPUProcRenderPassEncoderSetPipeline renderPassEncoderSetPipeline;
224
+ WGPUProcRenderPassEncoderSetResourceTable renderPassEncoderSetResourceTable;
225
+ WGPUProcRenderPassEncoderSetScissorRect renderPassEncoderSetScissorRect;
226
+ WGPUProcRenderPassEncoderSetStencilReference renderPassEncoderSetStencilReference;
227
+ WGPUProcRenderPassEncoderSetVertexBuffer renderPassEncoderSetVertexBuffer;
228
+ WGPUProcRenderPassEncoderSetViewport renderPassEncoderSetViewport;
229
+ WGPUProcRenderPassEncoderWriteTimestamp renderPassEncoderWriteTimestamp;
230
+ WGPUProcRenderPassEncoderAddRef renderPassEncoderAddRef;
231
+ WGPUProcRenderPassEncoderRelease renderPassEncoderRelease;
232
+
233
+ WGPUProcRenderPipelineGetBindGroupLayout renderPipelineGetBindGroupLayout;
234
+ WGPUProcRenderPipelineSetLabel renderPipelineSetLabel;
235
+ WGPUProcRenderPipelineAddRef renderPipelineAddRef;
236
+ WGPUProcRenderPipelineRelease renderPipelineRelease;
237
+
238
+ WGPUProcResourceTableDestroy resourceTableDestroy;
239
+ WGPUProcResourceTableGetSize resourceTableGetSize;
240
+ WGPUProcResourceTableInsertBinding resourceTableInsertBinding;
241
+ WGPUProcResourceTableRemoveBinding resourceTableRemoveBinding;
242
+ WGPUProcResourceTableSetLabel resourceTableSetLabel;
243
+ WGPUProcResourceTableUpdate resourceTableUpdate;
244
+ WGPUProcResourceTableAddRef resourceTableAddRef;
245
+ WGPUProcResourceTableRelease resourceTableRelease;
246
+
247
+ WGPUProcSamplerSetLabel samplerSetLabel;
248
+ WGPUProcSamplerAddRef samplerAddRef;
249
+ WGPUProcSamplerRelease samplerRelease;
250
+
251
+ WGPUProcShaderModuleGetCompilationInfo shaderModuleGetCompilationInfo;
252
+ WGPUProcShaderModuleSetLabel shaderModuleSetLabel;
253
+ WGPUProcShaderModuleAddRef shaderModuleAddRef;
254
+ WGPUProcShaderModuleRelease shaderModuleRelease;
255
+
256
+ WGPUProcSharedBufferMemoryBeginAccess sharedBufferMemoryBeginAccess;
257
+ WGPUProcSharedBufferMemoryCreateBuffer sharedBufferMemoryCreateBuffer;
258
+ WGPUProcSharedBufferMemoryEndAccess sharedBufferMemoryEndAccess;
259
+ WGPUProcSharedBufferMemoryGetProperties sharedBufferMemoryGetProperties;
260
+ WGPUProcSharedBufferMemoryIsDeviceLost sharedBufferMemoryIsDeviceLost;
261
+ WGPUProcSharedBufferMemorySetLabel sharedBufferMemorySetLabel;
262
+ WGPUProcSharedBufferMemoryAddRef sharedBufferMemoryAddRef;
263
+ WGPUProcSharedBufferMemoryRelease sharedBufferMemoryRelease;
264
+
265
+ WGPUProcSharedBufferMemoryEndAccessStateFreeMembers sharedBufferMemoryEndAccessStateFreeMembers;
266
+
267
+ WGPUProcSharedFenceExportInfo sharedFenceExportInfo;
268
+ WGPUProcSharedFenceSetLabel sharedFenceSetLabel;
269
+ WGPUProcSharedFenceAddRef sharedFenceAddRef;
270
+ WGPUProcSharedFenceRelease sharedFenceRelease;
271
+
272
+ WGPUProcSharedTextureMemoryBeginAccess sharedTextureMemoryBeginAccess;
273
+ WGPUProcSharedTextureMemoryCreateTexture sharedTextureMemoryCreateTexture;
274
+ WGPUProcSharedTextureMemoryEndAccess sharedTextureMemoryEndAccess;
275
+ WGPUProcSharedTextureMemoryGetProperties sharedTextureMemoryGetProperties;
276
+ WGPUProcSharedTextureMemoryIsDeviceLost sharedTextureMemoryIsDeviceLost;
277
+ WGPUProcSharedTextureMemorySetLabel sharedTextureMemorySetLabel;
278
+ WGPUProcSharedTextureMemoryAddRef sharedTextureMemoryAddRef;
279
+ WGPUProcSharedTextureMemoryRelease sharedTextureMemoryRelease;
280
+
281
+ WGPUProcSharedTextureMemoryEndAccessStateFreeMembers sharedTextureMemoryEndAccessStateFreeMembers;
282
+
283
+ WGPUProcSupportedFeaturesFreeMembers supportedFeaturesFreeMembers;
284
+
285
+ WGPUProcSupportedInstanceFeaturesFreeMembers supportedInstanceFeaturesFreeMembers;
286
+
287
+ WGPUProcSupportedWGSLLanguageFeaturesFreeMembers supportedWGSLLanguageFeaturesFreeMembers;
288
+
289
+ WGPUProcSurfaceConfigure surfaceConfigure;
290
+ WGPUProcSurfaceGetCapabilities surfaceGetCapabilities;
291
+ WGPUProcSurfaceGetCurrentTexture surfaceGetCurrentTexture;
292
+ WGPUProcSurfacePresent surfacePresent;
293
+ WGPUProcSurfaceSetLabel surfaceSetLabel;
294
+ WGPUProcSurfaceUnconfigure surfaceUnconfigure;
295
+ WGPUProcSurfaceAddRef surfaceAddRef;
296
+ WGPUProcSurfaceRelease surfaceRelease;
297
+
298
+ WGPUProcSurfaceCapabilitiesFreeMembers surfaceCapabilitiesFreeMembers;
299
+
300
+ WGPUProcTexelBufferViewSetLabel texelBufferViewSetLabel;
301
+ WGPUProcTexelBufferViewAddRef texelBufferViewAddRef;
302
+ WGPUProcTexelBufferViewRelease texelBufferViewRelease;
303
+
304
+ WGPUProcTextureCreateErrorView textureCreateErrorView;
305
+ WGPUProcTextureCreateView textureCreateView;
306
+ WGPUProcTextureDestroy textureDestroy;
307
+ WGPUProcTextureGetDepthOrArrayLayers textureGetDepthOrArrayLayers;
308
+ WGPUProcTextureGetDimension textureGetDimension;
309
+ WGPUProcTextureGetFormat textureGetFormat;
310
+ WGPUProcTextureGetHeight textureGetHeight;
311
+ WGPUProcTextureGetMipLevelCount textureGetMipLevelCount;
312
+ WGPUProcTextureGetSampleCount textureGetSampleCount;
313
+ WGPUProcTextureGetTextureBindingViewDimension textureGetTextureBindingViewDimension;
314
+ WGPUProcTextureGetUsage textureGetUsage;
315
+ WGPUProcTextureGetWidth textureGetWidth;
316
+ WGPUProcTexturePin texturePin;
317
+ WGPUProcTextureSetLabel textureSetLabel;
318
+ WGPUProcTextureSetOwnershipForMemoryDump textureSetOwnershipForMemoryDump;
319
+ WGPUProcTextureUnpin textureUnpin;
320
+ WGPUProcTextureAddRef textureAddRef;
321
+ WGPUProcTextureRelease textureRelease;
322
+
323
+ WGPUProcTextureViewSetLabel textureViewSetLabel;
324
+ WGPUProcTextureViewAddRef textureViewAddRef;
325
+ WGPUProcTextureViewRelease textureViewRelease;
326
+
327
+
328
+ } DawnProcTable;
329
+
330
+ #endif // DAWN_DAWN_PROC_TABLE_H_
@@ -0,0 +1,47 @@
1
+ // Copyright 2020 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_DAWN_DAWN_THREAD_DISPATCH_PROC_H_
29
+ #define INCLUDE_DAWN_DAWN_THREAD_DISPATCH_PROC_H_
30
+
31
+ #include "dawn/dawn_proc.h"
32
+
33
+ #ifdef __cplusplus
34
+ extern "C" {
35
+ #endif
36
+
37
+ // Call dawnProcSetProcs(&dawnThreadDispatchProcTable) and then use dawnProcSetPerThreadProcs
38
+ // to set per-thread procs.
39
+ WGPU_EXPORT extern DawnProcTable dawnThreadDispatchProcTable;
40
+ WGPU_EXPORT void dawnProcSetDefaultThreadProcs(const DawnProcTable* procs);
41
+ WGPU_EXPORT void dawnProcSetPerThreadProcs(const DawnProcTable* procs);
42
+
43
+ #ifdef __cplusplus
44
+ } // extern "C"
45
+ #endif
46
+
47
+ #endif // INCLUDE_DAWN_DAWN_THREAD_DISPATCH_PROC_H_
@@ -0,0 +1,41 @@
1
+ // Copyright 2026 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_DAWN_DAWN_VERSION_H_
29
+ #define INCLUDE_DAWN_DAWN_VERSION_H_
30
+
31
+ #include <array>
32
+ #include <cstdint>
33
+
34
+ namespace dawn {
35
+
36
+ // The version is a 20-byte SHA1 hash. If the hash is not available, it is all zeros.
37
+ static constexpr std::array<uint8_t, 20> kDawnVersion = { 0x63, 0xf2, 0x5f, 0xee, 0xc5, 0x1e, 0x93, 0x51, 0xfb, 0x25, 0x22, 0x2b, 0x6d, 0x5d, 0xe1, 0xaf, 0x79, 0x1d, 0x7c, 0x4f };
38
+
39
+ } // namespace dawn
40
+
41
+ #endif // INCLUDE_DAWN_DAWN_VERSION_H_