react-native-webgpu 0.5.11 → 0.5.14

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 (66) hide show
  1. package/README.md +89 -5
  2. package/android/CMakeLists.txt +3 -1
  3. package/android/build.gradle +1 -1
  4. package/android/cpp/AndroidPlatformContext.h +121 -0
  5. package/android/src/main/java/com/webgpu/WebGPUModule.java +1 -1
  6. package/apple/ApplePlatformContext.h +13 -0
  7. package/apple/ApplePlatformContext.mm +145 -0
  8. package/apple/AppleVideoPlayer.h +31 -0
  9. package/apple/AppleVideoPlayer.mm +314 -0
  10. package/apple/WebGPUModule.mm +2 -2
  11. package/cpp/rnwgpu/ArrayBuffer.h +51 -7
  12. package/cpp/rnwgpu/PlatformContext.h +81 -0
  13. package/cpp/rnwgpu/RNWebGPUManager.cpp +12 -0
  14. package/cpp/rnwgpu/api/Convertors.h +33 -11
  15. package/cpp/rnwgpu/api/GPU.cpp +27 -0
  16. package/cpp/rnwgpu/api/GPUAdapter.cpp +109 -33
  17. package/cpp/rnwgpu/api/GPUDevice.cpp +58 -5
  18. package/cpp/rnwgpu/api/GPUDevice.h +6 -0
  19. package/cpp/rnwgpu/api/GPUExternalTexture.cpp +335 -0
  20. package/cpp/rnwgpu/api/GPUExternalTexture.h +47 -2
  21. package/cpp/rnwgpu/api/GPUFeatures.h +4 -1
  22. package/cpp/rnwgpu/api/GPUShaderModule.cpp +2 -3
  23. package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +80 -0
  24. package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +71 -0
  25. package/cpp/rnwgpu/api/ImageBitmap.h +8 -0
  26. package/cpp/rnwgpu/api/RNWebGPU.h +63 -21
  27. package/cpp/rnwgpu/api/RnFeatures.h +53 -0
  28. package/cpp/rnwgpu/api/VideoFrame.h +76 -0
  29. package/cpp/rnwgpu/api/VideoPlayer.h +69 -0
  30. package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +4 -1
  31. package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +57 -0
  32. package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +24 -3
  33. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +35 -33
  34. package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +62 -0
  35. package/cpp/rnwgpu/api/descriptors/Unions.h +10 -0
  36. package/cpp/webgpu/webgpu.h +78 -17
  37. package/cpp/webgpu/webgpu_cpp.h +1014 -1249
  38. package/cpp/webgpu/webgpu_cpp_print.h +99 -10
  39. package/lib/commonjs/Canvas.js.map +1 -1
  40. package/lib/commonjs/index.js.map +1 -1
  41. package/lib/commonjs/main/index.js +1 -1
  42. package/lib/commonjs/main/index.js.map +1 -1
  43. package/lib/module/Canvas.js.map +1 -1
  44. package/lib/module/index.js.map +1 -1
  45. package/lib/module/main/index.js +1 -1
  46. package/lib/module/main/index.js.map +1 -1
  47. package/lib/typescript/src/Canvas.d.ts +0 -10
  48. package/lib/typescript/src/Canvas.d.ts.map +1 -1
  49. package/lib/typescript/src/index.d.ts +20 -1
  50. package/lib/typescript/src/index.d.ts.map +1 -1
  51. package/lib/typescript/src/types.d.ts +32 -1
  52. package/lib/typescript/src/types.d.ts.map +1 -1
  53. package/libs/android/arm64-v8a/libwebgpu_dawn.so +0 -0
  54. package/libs/android/armeabi-v7a/libwebgpu_dawn.so +0 -0
  55. package/libs/android/x86/libwebgpu_dawn.so +0 -0
  56. package/libs/android/x86_64/libwebgpu_dawn.so +0 -0
  57. package/libs/apple/libwebgpu_dawn.xcframework/Info.plist +6 -6
  58. package/libs/apple/libwebgpu_dawn.xcframework/ios-arm64/libwebgpu_dawn.a +0 -0
  59. package/libs/apple/libwebgpu_dawn.xcframework/ios-arm64_x86_64-simulator/libwebgpu_dawn.a +0 -0
  60. package/libs/apple/libwebgpu_dawn.xcframework/macos-arm64_x86_64/libwebgpu_dawn.a +0 -0
  61. package/package.json +3 -3
  62. package/{react-native-wgpu.podspec → react-native-webgpu.podspec} +5 -1
  63. package/src/Canvas.tsx +0 -15
  64. package/src/index.tsx +62 -2
  65. package/src/main/index.tsx +1 -1
  66. package/src/types.ts +83 -1
@@ -0,0 +1,57 @@
1
+ #pragma once
2
+
3
+ #include <memory>
4
+ #include <string>
5
+ #include <vector>
6
+
7
+ #include "webgpu/webgpu_cpp.h"
8
+
9
+ #include "JSIConverter.h"
10
+ #include "WGPULogger.h"
11
+
12
+ namespace jsi = facebook::jsi;
13
+
14
+ namespace rnwgpu {
15
+
16
+ // Non-standard, Dawn-only. Mirrors wgpu::DawnTogglesDescriptor field-for-field
17
+ // so the mapping to the native chained struct is 1:1. Chained onto the
18
+ // wgpu::DeviceDescriptor in GPUAdapter::requestDevice.
19
+ struct GPUDawnTogglesDescriptor {
20
+ std::optional<std::vector<std::string>> enabledToggles; // Iterable<string>
21
+ std::optional<std::vector<std::string>> disabledToggles; // Iterable<string>
22
+ };
23
+
24
+ } // namespace rnwgpu
25
+
26
+ namespace rnwgpu {
27
+
28
+ template <>
29
+ struct JSIConverter<std::shared_ptr<rnwgpu::GPUDawnTogglesDescriptor>> {
30
+ static std::shared_ptr<rnwgpu::GPUDawnTogglesDescriptor>
31
+ fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
32
+ auto result = std::make_unique<rnwgpu::GPUDawnTogglesDescriptor>();
33
+ if (!outOfBounds && arg.isObject()) {
34
+ auto value = arg.getObject(runtime);
35
+ if (value.hasProperty(runtime, "enabledToggles")) {
36
+ auto prop = value.getProperty(runtime, "enabledToggles");
37
+ result->enabledToggles =
38
+ JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(
39
+ runtime, prop, false);
40
+ }
41
+ if (value.hasProperty(runtime, "disabledToggles")) {
42
+ auto prop = value.getProperty(runtime, "disabledToggles");
43
+ result->disabledToggles =
44
+ JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(
45
+ runtime, prop, false);
46
+ }
47
+ }
48
+ return result;
49
+ }
50
+ static jsi::Value
51
+ toJSI(jsi::Runtime &runtime,
52
+ std::shared_ptr<rnwgpu::GPUDawnTogglesDescriptor> arg) {
53
+ throw std::runtime_error("Invalid GPUDawnTogglesDescriptor::toJSI()");
54
+ }
55
+ };
56
+
57
+ } // namespace rnwgpu
@@ -8,8 +8,10 @@
8
8
  #include "webgpu/webgpu_cpp.h"
9
9
 
10
10
  #include "JSIConverter.h"
11
+ #include "RnFeatures.h"
11
12
  #include "WGPULogger.h"
12
13
 
14
+ #include "GPUDawnTogglesDescriptor.h"
13
15
  #include "GPUQueueDescriptor.h"
14
16
 
15
17
  namespace jsi = facebook::jsi;
@@ -24,6 +26,9 @@ struct GPUDeviceDescriptor {
24
26
  std::optional<std::shared_ptr<GPUQueueDescriptor>>
25
27
  defaultQueue; // GPUQueueDescriptor
26
28
  std::optional<std::string> label; // string
29
+ // Non-standard Dawn-only device toggles, chained onto the wgpu::Device
30
+ // descriptor in GPUAdapter::requestDevice.
31
+ std::optional<std::shared_ptr<GPUDawnTogglesDescriptor>> dawnToggles;
27
32
  };
28
33
 
29
34
  } // namespace rnwgpu
@@ -43,10 +48,20 @@ template <> struct JSIConverter<std::vector<wgpu::FeatureName>> {
43
48
  vector.reserve(length);
44
49
  for (size_t i = 0; i < length; ++i) {
45
50
  jsi::Value elementValue = array.getValueAtIndex(runtime, i);
46
- if (elementValue.isString()) {
47
- vector.emplace_back(JSIConverter<wgpu::FeatureName>::fromJSI(
48
- runtime, elementValue, outOfBounds));
51
+ if (!elementValue.isString()) {
52
+ continue;
49
53
  }
54
+ auto str = elementValue.asString(runtime).utf8(runtime);
55
+ // Expand react-native-wgpu's umbrella feature into the platform's
56
+ // backing Dawn features before they reach RequestDevice.
57
+ if (str == kRnNativeTextureFeature) {
58
+ for (auto f : rnNativeTextureBackingFeatures()) {
59
+ vector.emplace_back(f);
60
+ }
61
+ continue;
62
+ }
63
+ vector.emplace_back(JSIConverter<wgpu::FeatureName>::fromJSI(
64
+ runtime, elementValue, outOfBounds));
50
65
  }
51
66
  return vector;
52
67
  }
@@ -87,6 +102,12 @@ template <> struct JSIConverter<std::shared_ptr<rnwgpu::GPUDeviceDescriptor>> {
87
102
  result->label = JSIConverter<std::optional<std::string>>::fromJSI(
88
103
  runtime, prop, false);
89
104
  }
105
+ if (value.hasProperty(runtime, "dawnToggles")) {
106
+ auto prop = value.getProperty(runtime, "dawnToggles");
107
+ result->dawnToggles = JSIConverter<
108
+ std::optional<std::shared_ptr<GPUDawnTogglesDescriptor>>>::fromJSI(
109
+ runtime, prop, false);
110
+ }
90
111
  }
91
112
 
92
113
  return result;
@@ -3,35 +3,34 @@
3
3
  #include <memory>
4
4
  #include <optional>
5
5
  #include <string>
6
- #include <variant>
7
6
 
8
7
  #include "webgpu/webgpu_cpp.h"
9
8
 
10
- #include "Convertors.h"
11
-
12
9
  #include "JSIConverter.h"
13
- #include "WGPULogger.h"
10
+ #include "VideoFrame.h"
14
11
 
15
12
  namespace jsi = facebook::jsi;
16
13
 
17
14
  namespace rnwgpu {
18
15
 
16
+ // Mirror of GPUExternalTextureDescriptor from the WebGPU spec, but with our
17
+ // VideoFrame as the (only) supported source. We don't expose colorSpace yet;
18
+ // the C++ side picks dst-sRGB and identity gamut, which is the right default
19
+ // for "render this video frame to a regular sRGB framebuffer".
20
+ //
21
+ // `rotation` / `mirrored` are a non-spec extension: camera frames (e.g. from
22
+ // VisionCamera) arrive in the sensor's native orientation, which differs
23
+ // between iOS (CVPixelBuffer) and Android (AHardwareBuffer). Dawn's
24
+ // ExternalTextureDescriptor can bake a rotation + horizontal mirror into the
25
+ // sampling transform, so the shader sees an upright frame without any extra
26
+ // passes. `rotation` is in degrees and must be one of 0 / 90 / 180 / 270.
19
27
  struct GPUExternalTextureDescriptor {
20
- // std::variant<std::shared_ptr<HTMLVideoElement>,
21
- // std::shared_ptr<VideoFrame>>
22
- // source; // | HTMLVideoElement | VideoFrame
23
- // std::optional<wgpu::DefinedColorSpace> colorSpace; // PredefinedColorSpace
24
- std::optional<std::string> label; // string
28
+ std::shared_ptr<VideoFrame> source;
29
+ std::optional<std::string> label;
30
+ std::optional<double> rotation;
31
+ std::optional<bool> mirrored;
25
32
  };
26
33
 
27
- static bool conv(wgpu::ExternalTextureDescriptor &out,
28
- const std::shared_ptr<GPUExternalTextureDescriptor> &in) {
29
- // TODO: implement
30
- // return conv(out.source, in->source) && conv(out.colorSpace, in->colorSpace)
31
- // &&
32
- // return conv(out.label, in->label);
33
- return false;
34
- }
35
34
  } // namespace rnwgpu
36
35
 
37
36
  namespace rnwgpu {
@@ -40,23 +39,15 @@ template <>
40
39
  struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor>> {
41
40
  static std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor>
42
41
  fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
43
- auto result = std::make_unique<rnwgpu::GPUExternalTextureDescriptor>();
42
+ auto result = std::make_shared<rnwgpu::GPUExternalTextureDescriptor>();
44
43
  if (!outOfBounds && arg.isObject()) {
45
44
  auto value = arg.getObject(runtime);
46
45
  if (value.hasProperty(runtime, "source")) {
47
46
  auto prop = value.getProperty(runtime, "source");
48
- // result->source = JSIConverter<
49
- // std::variant<std::shared_ptr<HTMLVideoElement>,
50
- // std::shared_ptr<VideoFrame>>>::fromJSI(runtime,
51
- // prop,
52
- // false);
53
- }
54
- if (value.hasProperty(runtime, "colorSpace")) {
55
- auto prop = value.getProperty(runtime, "colorSpace");
56
- if (!prop.isUndefined()) {
57
- // result->colorSpace =
58
- // JSIConverter<std::optional<wgpu::definedColorSpace>>::fromJSI(
59
- // runtime, prop, false);
47
+ if (!prop.isUndefined() && !prop.isNull()) {
48
+ result->source =
49
+ JSIConverter<std::shared_ptr<rnwgpu::VideoFrame>>::fromJSI(
50
+ runtime, prop, false);
60
51
  }
61
52
  }
62
53
  if (value.hasProperty(runtime, "label")) {
@@ -66,13 +57,24 @@ struct JSIConverter<std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor>> {
66
57
  runtime, prop, false);
67
58
  }
68
59
  }
60
+ if (value.hasProperty(runtime, "rotation")) {
61
+ auto prop = value.getProperty(runtime, "rotation");
62
+ if (prop.isNumber()) {
63
+ result->rotation = prop.asNumber();
64
+ }
65
+ }
66
+ if (value.hasProperty(runtime, "mirrored")) {
67
+ auto prop = value.getProperty(runtime, "mirrored");
68
+ if (prop.isBool()) {
69
+ result->mirrored = prop.getBool();
70
+ }
71
+ }
69
72
  }
70
-
71
73
  return result;
72
74
  }
73
75
  static jsi::Value
74
- toJSI(jsi::Runtime &runtime,
75
- std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor> arg) {
76
+ toJSI(jsi::Runtime & /*runtime*/,
77
+ std::shared_ptr<rnwgpu::GPUExternalTextureDescriptor> /*arg*/) {
76
78
  throw std::runtime_error("Invalid GPUExternalTextureDescriptor::toJSI()");
77
79
  }
78
80
  };
@@ -0,0 +1,62 @@
1
+ #pragma once
2
+
3
+ #include <memory>
4
+ #include <optional>
5
+ #include <string>
6
+
7
+ #include "webgpu/webgpu_cpp.h"
8
+
9
+ #include "JSIConverter.h"
10
+
11
+ namespace jsi = facebook::jsi;
12
+
13
+ namespace rnwgpu {
14
+
15
+ // Descriptor for GPUDevice.importSharedTextureMemory.
16
+ //
17
+ // `handle` is the raw native handle as a uintptr_t (passed as BigInt from JS):
18
+ // - Apple platforms: IOSurfaceRef
19
+ // - Android: AHardwareBuffer*
20
+ //
21
+ // Lifetime: the caller is responsible for keeping the underlying object alive
22
+ // for as long as this shared memory is in use. The VideoFrame helper handles
23
+ // this automatically when the handle came from PlatformContext.loadVideoFrame.
24
+ struct GPUSharedTextureMemoryDescriptor {
25
+ void *handle = nullptr;
26
+ std::optional<std::string> label;
27
+ };
28
+
29
+ } // namespace rnwgpu
30
+
31
+ namespace rnwgpu {
32
+
33
+ template <>
34
+ struct JSIConverter<std::shared_ptr<rnwgpu::GPUSharedTextureMemoryDescriptor>> {
35
+ static std::shared_ptr<rnwgpu::GPUSharedTextureMemoryDescriptor>
36
+ fromJSI(jsi::Runtime &runtime, const jsi::Value &arg, bool outOfBounds) {
37
+ auto result =
38
+ std::make_shared<rnwgpu::GPUSharedTextureMemoryDescriptor>();
39
+ if (!outOfBounds && arg.isObject()) {
40
+ auto value = arg.getObject(runtime);
41
+ if (value.hasProperty(runtime, "handle")) {
42
+ auto prop = value.getProperty(runtime, "handle");
43
+ result->handle =
44
+ JSIConverter<void *>::fromJSI(runtime, prop, false);
45
+ }
46
+ if (value.hasProperty(runtime, "label")) {
47
+ auto prop = value.getProperty(runtime, "label");
48
+ result->label = JSIConverter<std::optional<std::string>>::fromJSI(
49
+ runtime, prop, false);
50
+ }
51
+ }
52
+ return result;
53
+ }
54
+ static jsi::Value
55
+ toJSI(jsi::Runtime & /*runtime*/,
56
+ std::shared_ptr<rnwgpu::GPUSharedTextureMemoryDescriptor> /*arg*/) {
57
+ throw std::runtime_error(
58
+ "Invalid GPUSharedTextureMemoryDescriptor::toJSI()");
59
+ }
60
+ };
61
+
62
+ } // namespace rnwgpu
@@ -513,6 +513,8 @@ inline void convertJSUnionToEnum(const std::string &inUnion,
513
513
  *outEnum = wgpu::FeatureName::SharedTextureMemoryEGLImage;
514
514
  } else if (inUnion == "shared-fence-vk-semaphore-opaque-fd") {
515
515
  *outEnum = wgpu::FeatureName::SharedFenceVkSemaphoreOpaqueFD;
516
+ } else if (inUnion == "shared-fence-sync-fd") {
517
+ *outEnum = wgpu::FeatureName::SharedFenceSyncFD;
516
518
  } else if (inUnion == "shared-fence-vk-semaphore-zircon-handle") {
517
519
  *outEnum = wgpu::FeatureName::SharedFenceVkSemaphoreZirconHandle;
518
520
  } else if (inUnion == "shared-fence-dxgi-shared-handle") {
@@ -525,6 +527,8 @@ inline void convertJSUnionToEnum(const std::string &inUnion,
525
527
  *outEnum = wgpu::FeatureName::StaticSamplers;
526
528
  } else if (inUnion == "ycbcr-vulkan-samplers") {
527
529
  *outEnum = wgpu::FeatureName::YCbCrVulkanSamplers;
530
+ } else if (inUnion == "opaque-ycbcr-android-for-external-texture") {
531
+ *outEnum = wgpu::FeatureName::OpaqueYCbCrAndroidForExternalTexture;
528
532
  } else if (inUnion == "shader-module-compilation-options") {
529
533
  *outEnum = wgpu::FeatureName::ShaderModuleCompilationOptions;
530
534
  } else if (inUnion == "dawn-load-resolve-texture") {
@@ -695,6 +699,9 @@ inline void convertEnumToJSUnion(wgpu::FeatureName inEnum,
695
699
  case wgpu::FeatureName::SharedFenceVkSemaphoreOpaqueFD:
696
700
  *outUnion = "shared-fence-vk-semaphore-opaque-fd";
697
701
  break;
702
+ case wgpu::FeatureName::SharedFenceSyncFD:
703
+ *outUnion = "shared-fence-sync-fd";
704
+ break;
698
705
  case wgpu::FeatureName::SharedFenceVkSemaphoreZirconHandle:
699
706
  *outUnion = "shared-fence-vk-semaphore-zircon-handle";
700
707
  break;
@@ -713,6 +720,9 @@ inline void convertEnumToJSUnion(wgpu::FeatureName inEnum,
713
720
  case wgpu::FeatureName::YCbCrVulkanSamplers:
714
721
  *outUnion = "ycbcr-vulkan-samplers";
715
722
  break;
723
+ case wgpu::FeatureName::OpaqueYCbCrAndroidForExternalTexture:
724
+ *outUnion = "opaque-ycbcr-android-for-external-texture";
725
+ break;
716
726
  case wgpu::FeatureName::ShaderModuleCompilationOptions:
717
727
  *outUnion = "shader-module-compilation-options";
718
728
  break;
@@ -150,7 +150,7 @@ typedef struct WGPUTextureViewImpl* WGPUTextureView WGPU_OBJECT_ATTRIBUTE;
150
150
 
151
151
  // Structure forward declarations
152
152
  struct WGPUAdapterPropertiesD3D;
153
- struct WGPUAdapterPropertiesExplicitComputeSubgroupSizeConfigs;
153
+ struct WGPUAdapterPropertiesDrm;
154
154
  struct WGPUAdapterPropertiesVk;
155
155
  struct WGPUAdapterPropertiesWGPU;
156
156
  struct WGPUBindingResource;
@@ -158,6 +158,7 @@ struct WGPUBlendComponent;
158
158
  struct WGPUBufferBindingLayout;
159
159
  struct WGPUBufferHostMappedPointer;
160
160
  struct WGPUColor;
161
+ struct WGPUColorSpaceDawn;
161
162
  struct WGPUColorTargetStateExpandResolveTextureDawn;
162
163
  struct WGPUCommandBufferDescriptor;
163
164
  struct WGPUCompatibilityModeLimits;
@@ -430,6 +431,40 @@ typedef enum WGPUCallbackMode {
430
431
  WGPUCallbackMode_Force32 = 0x7FFFFFFF
431
432
  } WGPUCallbackMode WGPU_ENUM_ATTRIBUTE;
432
433
 
434
+ typedef enum WGPUColorSpacePrimariesDawn {
435
+ WGPUColorSpacePrimariesDawn_SRGB = 0x00000001,
436
+ WGPUColorSpacePrimariesDawn_Rec709 = 0x00000001,
437
+ WGPUColorSpacePrimariesDawn_Rec601 = 0x00000002,
438
+ WGPUColorSpacePrimariesDawn_Rec2020 = 0x00000003,
439
+ WGPUColorSpacePrimariesDawn_DisplayP3 = 0x00000004,
440
+ WGPUColorSpacePrimariesDawn_Force32 = 0x7FFFFFFF
441
+ } WGPUColorSpacePrimariesDawn WGPU_ENUM_ATTRIBUTE;
442
+
443
+ typedef enum WGPUColorSpaceTransferDawn {
444
+ WGPUColorSpaceTransferDawn_Identity = 0x00000001,
445
+ WGPUColorSpaceTransferDawn_SRGB = 0x00000002,
446
+ WGPUColorSpaceTransferDawn_DisplayP3 = 0x00000003,
447
+ WGPUColorSpaceTransferDawn_SMPTE_170M = 0x00000004,
448
+ WGPUColorSpaceTransferDawn_HLG = 0x00000005,
449
+ WGPUColorSpaceTransferDawn_PQ = 0x00000006,
450
+ WGPUColorSpaceTransferDawn_Force32 = 0x7FFFFFFF
451
+ } WGPUColorSpaceTransferDawn WGPU_ENUM_ATTRIBUTE;
452
+
453
+ typedef enum WGPUColorSpaceYCbCrMatrixDawn {
454
+ WGPUColorSpaceYCbCrMatrixDawn_Identity = 0x00000001,
455
+ WGPUColorSpaceYCbCrMatrixDawn_Rec601 = 0x00000002,
456
+ WGPUColorSpaceYCbCrMatrixDawn_Rec709 = 0x00000003,
457
+ WGPUColorSpaceYCbCrMatrixDawn_Rec2020 = 0x00000004,
458
+ WGPUColorSpaceYCbCrMatrixDawn_Force32 = 0x7FFFFFFF
459
+ } WGPUColorSpaceYCbCrMatrixDawn WGPU_ENUM_ATTRIBUTE;
460
+
461
+ typedef enum WGPUColorSpaceYCbCrRangeDawn {
462
+ WGPUColorSpaceYCbCrRangeDawn_Identity = 0x00000001,
463
+ WGPUColorSpaceYCbCrRangeDawn_Narrow = 0x00000002,
464
+ WGPUColorSpaceYCbCrRangeDawn_Full = 0x00000003,
465
+ WGPUColorSpaceYCbCrRangeDawn_Force32 = 0x7FFFFFFF
466
+ } WGPUColorSpaceYCbCrRangeDawn WGPU_ENUM_ATTRIBUTE;
467
+
433
468
  typedef enum WGPUCompareFunction {
434
469
  WGPUCompareFunction_Undefined = 0x00000000,
435
470
  WGPUCompareFunction_Never = 0x00000001,
@@ -612,12 +647,13 @@ typedef enum WGPUFeatureName {
612
647
  WGPUFeatureName_SharedBufferMemoryD3D12SharedMemoryFileMappingHandle = 0x00050038,
613
648
  WGPUFeatureName_SharedTextureMemoryD3D12Resource = 0x00050039,
614
649
  WGPUFeatureName_ChromiumExperimentalSamplingResourceTable = 0x0005003A,
615
- WGPUFeatureName_ChromiumExperimentalSubgroupSizeControl = 0x0005003B,
650
+ WGPUFeatureName_SubgroupSizeControl = 0x0005003B,
616
651
  WGPUFeatureName_AtomicVec2uMinMax = 0x0005003C,
617
652
  WGPUFeatureName_Unorm16FormatsForExternalTexture = 0x0005003D,
618
653
  WGPUFeatureName_OpaqueYCbCrAndroidForExternalTexture = 0x0005003E,
619
654
  WGPUFeatureName_Unorm16Filterable = 0x0005003F,
620
655
  WGPUFeatureName_RenderPassRenderArea = 0x00050040,
656
+ WGPUFeatureName_AdapterPropertiesDrm = 0x00050041,
621
657
  WGPUFeatureName_Force32 = 0x7FFFFFFF
622
658
  } WGPUFeatureName WGPU_ENUM_ATTRIBUTE;
623
659
 
@@ -704,6 +740,8 @@ typedef enum WGPUPowerPreference {
704
740
  typedef enum WGPUPredefinedColorSpace {
705
741
  WGPUPredefinedColorSpace_SRGB = 0x00000001,
706
742
  WGPUPredefinedColorSpace_DisplayP3 = 0x00000002,
743
+ WGPUPredefinedColorSpace_SRGBLinear = 0x00050003,
744
+ WGPUPredefinedColorSpace_DisplayP3Linear = 0x00050004,
707
745
  WGPUPredefinedColorSpace_Force32 = 0x7FFFFFFF
708
746
  } WGPUPredefinedColorSpace WGPU_ENUM_ATTRIBUTE;
709
747
 
@@ -904,7 +942,7 @@ typedef enum WGPUSType {
904
942
  WGPUSType_SharedTextureMemoryD3D12ResourceDescriptor = 0x0005004E,
905
943
  WGPUSType_RequestAdapterOptionsAngleVirtualizationGroup = 0x0005004F,
906
944
  WGPUSType_PipelineLayoutResourceTable = 0x00050050,
907
- WGPUSType_AdapterPropertiesExplicitComputeSubgroupSizeConfigs = 0x00050051,
945
+ WGPUSType_AdapterPropertiesDrm = 0x00050051,
908
946
  WGPUSType_Force32 = 0x7FFFFFFF
909
947
  } WGPUSType WGPU_ENUM_ATTRIBUTE;
910
948
 
@@ -1165,6 +1203,7 @@ typedef enum WGPUWGSLLanguageFeatureName {
1165
1203
  WGPUWGSLLanguageFeatureName_TextureAndSamplerLet = 0x00000007,
1166
1204
  WGPUWGSLLanguageFeatureName_SubgroupUniformity = 0x00000008,
1167
1205
  WGPUWGSLLanguageFeatureName_TextureFormatsTier1 = 0x00000009,
1206
+ WGPUWGSLLanguageFeatureName_LinearIndexing = 0x0000000A,
1168
1207
  WGPUWGSLLanguageFeatureName_ChromiumTestingUnimplemented = 0x00050000,
1169
1208
  WGPUWGSLLanguageFeatureName_ChromiumTestingUnsafeExperimental = 0x00050001,
1170
1209
  WGPUWGSLLanguageFeatureName_ChromiumTestingExperimental = 0x00050002,
@@ -1176,9 +1215,7 @@ typedef enum WGPUWGSLLanguageFeatureName {
1176
1215
  WGPUWGSLLanguageFeatureName_FragmentDepth = 0x00050008,
1177
1216
  WGPUWGSLLanguageFeatureName_ImmediateAddressSpace = 0x00050009,
1178
1217
  WGPUWGSLLanguageFeatureName_BufferView = 0x0005000B,
1179
- WGPUWGSLLanguageFeatureName_FilteringParameters = 0x0005000C,
1180
- WGPUWGSLLanguageFeatureName_SwizzleAssignment = 0x0005000D,
1181
- WGPUWGSLLanguageFeatureName_LinearIndexing = 0x0005000E,
1218
+ WGPUWGSLLanguageFeatureName_SwizzleAssignment = 0x0005000C,
1182
1219
  WGPUWGSLLanguageFeatureName_Force32 = 0x7FFFFFFF
1183
1220
  } WGPUWGSLLanguageFeatureName WGPU_ENUM_ATTRIBUTE;
1184
1221
 
@@ -1453,21 +1490,27 @@ typedef struct WGPUAdapterPropertiesD3D {
1453
1490
  })
1454
1491
 
1455
1492
  // Can be chained in WGPUAdapterInfo
1456
- typedef struct WGPUAdapterPropertiesExplicitComputeSubgroupSizeConfigs {
1493
+ typedef struct WGPUAdapterPropertiesDrm {
1457
1494
  WGPUChainedStruct chain;
1458
- uint32_t minExplicitComputeSubgroupSize;
1459
- uint32_t maxExplicitComputeSubgroupSize;
1460
- uint32_t maxComputeWorkgroupSubgroups;
1461
- } WGPUAdapterPropertiesExplicitComputeSubgroupSizeConfigs WGPU_STRUCTURE_ATTRIBUTE;
1462
-
1463
- #define WGPU_ADAPTER_PROPERTIES_EXPLICIT_COMPUTE_SUBGROUP_SIZE_CONFIGS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterPropertiesExplicitComputeSubgroupSizeConfigs, { \
1495
+ WGPUBool hasPrimary;
1496
+ WGPUBool hasRender;
1497
+ uint64_t primaryMajor;
1498
+ uint64_t primaryMinor;
1499
+ uint64_t renderMajor;
1500
+ uint64_t renderMinor;
1501
+ } WGPUAdapterPropertiesDrm WGPU_STRUCTURE_ATTRIBUTE;
1502
+
1503
+ #define WGPU_ADAPTER_PROPERTIES_DRM_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterPropertiesDrm, { \
1464
1504
  /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
1465
1505
  /*.next=*/NULL _wgpu_COMMA \
1466
- /*.sType=*/WGPUSType_AdapterPropertiesExplicitComputeSubgroupSizeConfigs _wgpu_COMMA \
1506
+ /*.sType=*/WGPUSType_AdapterPropertiesDrm _wgpu_COMMA \
1467
1507
  }) _wgpu_COMMA \
1468
- /*.minExplicitComputeSubgroupSize=*/0 _wgpu_COMMA \
1469
- /*.maxExplicitComputeSubgroupSize=*/0 _wgpu_COMMA \
1470
- /*.maxComputeWorkgroupSubgroups=*/0 _wgpu_COMMA \
1508
+ /*.hasPrimary=*/WGPU_FALSE _wgpu_COMMA \
1509
+ /*.hasRender=*/WGPU_FALSE _wgpu_COMMA \
1510
+ /*.primaryMajor=*/0 _wgpu_COMMA \
1511
+ /*.primaryMinor=*/0 _wgpu_COMMA \
1512
+ /*.renderMajor=*/0 _wgpu_COMMA \
1513
+ /*.renderMinor=*/0 _wgpu_COMMA \
1471
1514
  })
1472
1515
 
1473
1516
  // Can be chained in WGPUAdapterInfo
@@ -1574,6 +1617,22 @@ typedef struct WGPUColor {
1574
1617
  /*.a=*/0. _wgpu_COMMA \
1575
1618
  })
1576
1619
 
1620
+ typedef struct WGPUColorSpaceDawn {
1621
+ WGPUChainedStruct * nextInChain;
1622
+ WGPUColorSpacePrimariesDawn primaries;
1623
+ WGPUColorSpaceTransferDawn transfer;
1624
+ WGPUColorSpaceYCbCrRangeDawn yCbCrRange;
1625
+ WGPUColorSpaceYCbCrMatrixDawn yCbCrMatrix;
1626
+ } WGPUColorSpaceDawn WGPU_STRUCTURE_ATTRIBUTE;
1627
+
1628
+ #define WGPU_COLOR_SPACE_DAWN_INIT _wgpu_MAKE_INIT_STRUCT(WGPUColorSpaceDawn, { \
1629
+ /*.nextInChain=*/NULL _wgpu_COMMA \
1630
+ /*.primaries=*/_wgpu_ENUM_ZERO_INIT(WGPUColorSpacePrimariesDawn) _wgpu_COMMA \
1631
+ /*.transfer=*/WGPUColorSpaceTransferDawn_Identity _wgpu_COMMA \
1632
+ /*.yCbCrRange=*/WGPUColorSpaceYCbCrRangeDawn_Identity _wgpu_COMMA \
1633
+ /*.yCbCrMatrix=*/WGPUColorSpaceYCbCrMatrixDawn_Identity _wgpu_COMMA \
1634
+ })
1635
+
1577
1636
  // Can be chained in WGPUColorTargetState
1578
1637
  typedef struct WGPUColorTargetStateExpandResolveTextureDawn {
1579
1638
  WGPUChainedStruct chain;
@@ -4454,6 +4513,7 @@ typedef void (*WGPUProcResourceTableDestroy)(WGPUResourceTable resourceTable) WG
4454
4513
  typedef uint32_t (*WGPUProcResourceTableGetSize)(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE;
4455
4514
  typedef uint32_t (*WGPUProcResourceTableInsertBinding)(WGPUResourceTable resourceTable, WGPUBindingResource const * resource) WGPU_FUNCTION_ATTRIBUTE;
4456
4515
  typedef WGPUStatus (*WGPUProcResourceTableRemoveBinding)(WGPUResourceTable resourceTable, uint32_t slot) WGPU_FUNCTION_ATTRIBUTE;
4516
+ typedef void (*WGPUProcResourceTableSetLabel)(WGPUResourceTable resourceTable, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
4457
4517
  typedef WGPUStatus (*WGPUProcResourceTableUpdate)(WGPUResourceTable resourceTable, uint32_t slot, WGPUBindingResource const * resource) WGPU_FUNCTION_ATTRIBUTE;
4458
4518
  typedef void (*WGPUProcResourceTableAddRef)(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE;
4459
4519
  typedef void (*WGPUProcResourceTableRelease)(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE;
@@ -4810,6 +4870,7 @@ WGPU_EXPORT void wgpuResourceTableDestroy(WGPUResourceTable resourceTable) WGPU_
4810
4870
  WGPU_EXPORT uint32_t wgpuResourceTableGetSize(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE;
4811
4871
  WGPU_EXPORT uint32_t wgpuResourceTableInsertBinding(WGPUResourceTable resourceTable, WGPUBindingResource const * resource) WGPU_FUNCTION_ATTRIBUTE;
4812
4872
  WGPU_EXPORT WGPUStatus wgpuResourceTableRemoveBinding(WGPUResourceTable resourceTable, uint32_t slot) WGPU_FUNCTION_ATTRIBUTE;
4873
+ WGPU_EXPORT void wgpuResourceTableSetLabel(WGPUResourceTable resourceTable, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
4813
4874
  WGPU_EXPORT WGPUStatus wgpuResourceTableUpdate(WGPUResourceTable resourceTable, uint32_t slot, WGPUBindingResource const * resource) WGPU_FUNCTION_ATTRIBUTE;
4814
4875
  WGPU_EXPORT void wgpuResourceTableAddRef(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE;
4815
4876
  WGPU_EXPORT void wgpuResourceTableRelease(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE;