sparkbun 0.1.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.
- package/bin/sparkbun.cjs +18 -0
- package/dist-linux-arm64/bsdiff +0 -0
- package/dist-linux-arm64/bspatch +0 -0
- package/dist-linux-arm64/libElectrobunCore.so +0 -0
- package/dist-linux-arm64/libNativeWrapper.so +0 -0
- package/dist-linux-arm64/libasar.so +0 -0
- package/dist-linux-x64/bsdiff +0 -0
- package/dist-linux-x64/bspatch +0 -0
- package/dist-linux-x64/libElectrobunCore.so +0 -0
- package/dist-linux-x64/libNativeWrapper.so +0 -0
- package/dist-linux-x64/libasar.so +0 -0
- package/dist-macos-arm64/bsdiff +0 -0
- package/dist-macos-arm64/bspatch +0 -0
- package/dist-macos-arm64/libElectrobunCore.dylib +0 -0
- package/dist-macos-arm64/libNativeWrapper.dylib +0 -0
- package/dist-macos-arm64/libasar.dylib +0 -0
- package/dist-macos-arm64/libwebgpu_dawn.dylib +0 -0
- package/dist-macos-arm64/preload-full.js +885 -0
- package/dist-macos-arm64/preload-sandboxed.js +111 -0
- package/dist-macos-arm64/process_helper +0 -0
- package/dist-win-x64/ElectrobunCore.dll +0 -0
- package/dist-win-x64/WebView2Loader.dll +0 -0
- package/dist-win-x64/bsdiff.exe +0 -0
- package/dist-win-x64/bspatch.exe +0 -0
- package/dist-win-x64/libNativeWrapper.dll +0 -0
- package/dist-win-x64/zig-asar/arm64/libasar.dll +0 -0
- package/dist-win-x64/zig-asar/x64/libasar.dll +0 -0
- package/package.json +47 -0
- package/scripts/build-and-upload-artifacts.js +207 -0
- package/scripts/gen-webgpu-ffi.mjs +162 -0
- package/scripts/install-windows-deps.ps1 +80 -0
- package/scripts/package-release.js +237 -0
- package/scripts/push-version.js +84 -0
- package/scripts/update-bun-version.ts +122 -0
- package/scripts/update-cef-version.ts +145 -0
- package/src/browser/builtinrpcSchema.ts +19 -0
- package/src/browser/global.d.ts +36 -0
- package/src/browser/index.ts +234 -0
- package/src/browser/webviewtag.ts +88 -0
- package/src/browser/wgputag.ts +48 -0
- package/src/bun/SparkBunConfig.ts +497 -0
- package/src/bun/__tests__/ffi-contract.test.ts +105 -0
- package/src/bun/core/ApplicationMenu.ts +70 -0
- package/src/bun/core/BrowserView.ts +416 -0
- package/src/bun/core/BrowserWindow.ts +396 -0
- package/src/bun/core/BuildConfig.ts +71 -0
- package/src/bun/core/ContextMenu.ts +75 -0
- package/src/bun/core/GpuWindow.ts +289 -0
- package/src/bun/core/Paths.ts +5 -0
- package/src/bun/core/Socket.ts +22 -0
- package/src/bun/core/Tray.ts +197 -0
- package/src/bun/core/Updater.ts +1131 -0
- package/src/bun/core/Utils.ts +487 -0
- package/src/bun/core/WGPUView.ts +167 -0
- package/src/bun/core/menuRoles.ts +181 -0
- package/src/bun/events/ApplicationEvents.ts +22 -0
- package/src/bun/events/event.ts +27 -0
- package/src/bun/events/eventEmitter.ts +45 -0
- package/src/bun/events/trayEvents.ts +11 -0
- package/src/bun/events/webviewEvents.ts +39 -0
- package/src/bun/events/windowEvents.ts +23 -0
- package/src/bun/index.ts +120 -0
- package/src/bun/preload/.generated/compiled.ts +2 -0
- package/src/bun/preload/build.ts +65 -0
- package/src/bun/preload/dragRegions.ts +41 -0
- package/src/bun/preload/encryption.ts +86 -0
- package/src/bun/preload/events.ts +171 -0
- package/src/bun/preload/globals.d.ts +45 -0
- package/src/bun/preload/index-sandboxed.ts +28 -0
- package/src/bun/preload/index.ts +77 -0
- package/src/bun/preload/internalRpc.ts +80 -0
- package/src/bun/preload/overlaySync.ts +107 -0
- package/src/bun/preload/webviewTag.ts +451 -0
- package/src/bun/preload/wgpuTag.ts +246 -0
- package/src/bun/proc/linux.md +43 -0
- package/src/bun/proc/native.ts +3253 -0
- package/src/bun/webGPU.ts +346 -0
- package/src/bun/webgpuAdapter.ts +3011 -0
- package/src/cli/bun.lockb +0 -0
- package/src/cli/index.ts +4653 -0
- package/src/cli/package-lock.json +81 -0
- package/src/cli/package.json +11 -0
- package/src/cli/templates/embedded.ts +2 -0
- package/src/core/build.zig +16 -0
- package/src/core/main.zig +3378 -0
- package/src/extractor/build.zig +22 -0
- package/src/installer/installer-template.ts +216 -0
- package/src/launcher/main.ts +221 -0
- package/src/native/build/libNativeWrapper.so +0 -0
- package/src/native/linux/build/nativeWrapper.o +0 -0
- package/src/native/linux/cef_loader.cpp +110 -0
- package/src/native/linux/cef_loader.h +28 -0
- package/src/native/linux/cef_process_helper_linux.cpp +160 -0
- package/src/native/linux/nativeWrapper.cpp +11768 -0
- package/src/native/macos/cef_process_helper_mac.cc +160 -0
- package/src/native/macos/nativeWrapper.mm +9172 -0
- package/src/native/shared/accelerator_parser.h +72 -0
- package/src/native/shared/app_paths.h +110 -0
- package/src/native/shared/asar.h +35 -0
- package/src/native/shared/cache_migration.h +244 -0
- package/src/native/shared/callbacks.h +57 -0
- package/src/native/shared/cef_response_filter.h +189 -0
- package/src/native/shared/chromium_flags.h +181 -0
- package/src/native/shared/config.h +66 -0
- package/src/native/shared/download_event.h +197 -0
- package/src/native/shared/ffi_helpers.h +139 -0
- package/src/native/shared/glob_match.h +59 -0
- package/src/native/shared/json_menu_parser.h +223 -0
- package/src/native/shared/mime_types.h +101 -0
- package/src/native/shared/navigation_rules.h +98 -0
- package/src/native/shared/partition_context.h +137 -0
- package/src/native/shared/pending_resize_queue.h +45 -0
- package/src/native/shared/permissions.h +118 -0
- package/src/native/shared/permissions_cef.h +74 -0
- package/src/native/shared/preload_script.h +71 -0
- package/src/native/shared/shutdown_guard.h +134 -0
- package/src/native/shared/thread_safe_map.h +138 -0
- package/src/native/shared/webview_storage.h +91 -0
- package/src/native/win/cef_process_helper_win.cpp +143 -0
- package/src/native/win/dcomp_compositor.h +352 -0
- package/src/native/win/nativeWrapper.cpp +12434 -0
- package/src/npmbin/index.js +34 -0
- package/src/shared/bun-version.ts +3 -0
- package/src/shared/cef-version.ts +5 -0
- package/src/shared/naming.test.ts +327 -0
- package/src/shared/naming.ts +188 -0
- package/src/shared/platform.ts +48 -0
- package/src/shared/rpc.ts +541 -0
- package/src/shared/sparkbun-version.ts +2 -0
- package/src/types/three.d.ts +1 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { existsSync } from "fs";
|
|
2
|
+
import { join, dirname } from "path";
|
|
3
|
+
import { dlopen, suffix, FFIType } from "bun:ffi";
|
|
4
|
+
|
|
5
|
+
// NOTE: WGPUStringView is passed by value in the C API. Bun FFI does not support
|
|
6
|
+
// by-value structs, so WGPUStringView parameters are exposed as pointers for now.
|
|
7
|
+
// If you need these calls, add a small C shim that accepts a pointer and
|
|
8
|
+
// forwards by value. WGPUFuture is a single u64 and is mapped to FFIType.u64.
|
|
9
|
+
const WGPU_SYMBOLS = {
|
|
10
|
+
wgpuCreateInstance: { args: [FFIType.ptr], returns: FFIType.ptr },
|
|
11
|
+
wgpuGetInstanceFeatures: { args: [FFIType.ptr], returns: FFIType.void },
|
|
12
|
+
wgpuGetInstanceLimits: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
13
|
+
wgpuHasInstanceFeature: { args: [FFIType.u32], returns: FFIType.u32 },
|
|
14
|
+
wgpuGetProcAddress: { args: [FFIType.ptr], returns: FFIType.ptr },
|
|
15
|
+
wgpuAdapterCreateDevice: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
16
|
+
wgpuAdapterGetFeatures: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
17
|
+
wgpuAdapterGetFormatCapabilities: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr], returns: FFIType.u32 },
|
|
18
|
+
wgpuAdapterGetInfo: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
19
|
+
wgpuAdapterGetInstance: { args: [FFIType.ptr], returns: FFIType.ptr },
|
|
20
|
+
wgpuAdapterGetLimits: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
21
|
+
wgpuAdapterHasFeature: { args: [FFIType.ptr, FFIType.u32], returns: FFIType.u32 },
|
|
22
|
+
wgpuAdapterRequestDevice: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.u64 },
|
|
23
|
+
wgpuAdapterAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
24
|
+
wgpuAdapterRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
25
|
+
wgpuAdapterInfoFreeMembers: { args: [FFIType.ptr], returns: FFIType.void },
|
|
26
|
+
wgpuAdapterPropertiesMemoryHeapsFreeMembers: { args: [FFIType.ptr], returns: FFIType.void },
|
|
27
|
+
wgpuAdapterPropertiesSubgroupMatrixConfigsFreeMembers: { args: [FFIType.ptr], returns: FFIType.void },
|
|
28
|
+
wgpuBindGroupSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
29
|
+
wgpuBindGroupAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
30
|
+
wgpuBindGroupRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
31
|
+
wgpuBindGroupLayoutSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
32
|
+
wgpuBindGroupLayoutAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
33
|
+
wgpuBindGroupLayoutRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
34
|
+
wgpuBufferCreateTexelView: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
35
|
+
wgpuBufferDestroy: { args: [FFIType.ptr], returns: FFIType.void },
|
|
36
|
+
wgpuBufferGetConstMappedRange: { args: [FFIType.ptr, FFIType.u64, FFIType.u64], returns: FFIType.ptr },
|
|
37
|
+
wgpuBufferGetMappedRange: { args: [FFIType.ptr, FFIType.u64, FFIType.u64], returns: FFIType.ptr },
|
|
38
|
+
wgpuBufferGetMapState: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
39
|
+
wgpuBufferGetSize: { args: [FFIType.ptr], returns: FFIType.u64 },
|
|
40
|
+
wgpuBufferGetUsage: { args: [FFIType.ptr], returns: FFIType.u64 },
|
|
41
|
+
wgpuBufferMapAsync: { args: [FFIType.ptr, FFIType.u64, FFIType.u64, FFIType.u64, FFIType.ptr], returns: FFIType.u64 },
|
|
42
|
+
wgpuBufferReadMappedRange: { args: [FFIType.ptr, FFIType.u64, FFIType.ptr, FFIType.u64], returns: FFIType.u32 },
|
|
43
|
+
wgpuBufferSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
44
|
+
wgpuBufferUnmap: { args: [FFIType.ptr], returns: FFIType.void },
|
|
45
|
+
wgpuBufferWriteMappedRange: { args: [FFIType.ptr, FFIType.u64, FFIType.ptr, FFIType.u64], returns: FFIType.u32 },
|
|
46
|
+
wgpuBufferAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
47
|
+
wgpuBufferRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
48
|
+
wgpuCommandBufferSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
49
|
+
wgpuCommandBufferAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
50
|
+
wgpuCommandBufferRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
51
|
+
wgpuCommandEncoderBeginComputePass: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
52
|
+
wgpuCommandEncoderBeginRenderPass: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
53
|
+
wgpuCommandEncoderClearBuffer: { args: [FFIType.ptr, FFIType.ptr, FFIType.u64, FFIType.u64], returns: FFIType.void },
|
|
54
|
+
wgpuCommandEncoderCopyBufferToBuffer: { args: [FFIType.ptr, FFIType.ptr, FFIType.u64, FFIType.ptr, FFIType.u64, FFIType.u64], returns: FFIType.void },
|
|
55
|
+
wgpuCommandEncoderCopyBufferToTexture: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
56
|
+
wgpuCommandEncoderCopyTextureToBuffer: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
57
|
+
wgpuCommandEncoderCopyTextureToTexture: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
58
|
+
wgpuCommandEncoderFinish: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
59
|
+
wgpuCommandEncoderInjectValidationError: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
60
|
+
wgpuCommandEncoderInsertDebugMarker: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
61
|
+
wgpuCommandEncoderPopDebugGroup: { args: [FFIType.ptr], returns: FFIType.void },
|
|
62
|
+
wgpuCommandEncoderPushDebugGroup: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
63
|
+
wgpuCommandEncoderResolveQuerySet: { args: [FFIType.ptr, FFIType.ptr, FFIType.u32, FFIType.u32, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
64
|
+
wgpuCommandEncoderSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
65
|
+
wgpuCommandEncoderWriteBuffer: { args: [FFIType.ptr, FFIType.ptr, FFIType.u64, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
66
|
+
wgpuCommandEncoderWriteTimestamp: { args: [FFIType.ptr, FFIType.ptr, FFIType.u32], returns: FFIType.void },
|
|
67
|
+
wgpuCommandEncoderAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
68
|
+
wgpuCommandEncoderRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
69
|
+
wgpuComputePassEncoderDispatchWorkgroups: { args: [FFIType.ptr, FFIType.u32, FFIType.u32, FFIType.u32], returns: FFIType.void },
|
|
70
|
+
wgpuComputePassEncoderDispatchWorkgroupsIndirect: { args: [FFIType.ptr, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
71
|
+
wgpuComputePassEncoderEnd: { args: [FFIType.ptr], returns: FFIType.void },
|
|
72
|
+
wgpuComputePassEncoderInsertDebugMarker: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
73
|
+
wgpuComputePassEncoderPopDebugGroup: { args: [FFIType.ptr], returns: FFIType.void },
|
|
74
|
+
wgpuComputePassEncoderPushDebugGroup: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
75
|
+
wgpuComputePassEncoderSetBindGroup: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr, FFIType.u64, FFIType.ptr], returns: FFIType.void },
|
|
76
|
+
wgpuComputePassEncoderSetImmediates: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
77
|
+
wgpuComputePassEncoderSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
78
|
+
wgpuComputePassEncoderSetPipeline: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
79
|
+
wgpuComputePassEncoderSetResourceTable: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
80
|
+
wgpuComputePassEncoderWriteTimestamp: { args: [FFIType.ptr, FFIType.ptr, FFIType.u32], returns: FFIType.void },
|
|
81
|
+
wgpuComputePassEncoderAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
82
|
+
wgpuComputePassEncoderRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
83
|
+
wgpuComputePipelineGetBindGroupLayout: { args: [FFIType.ptr, FFIType.u32], returns: FFIType.ptr },
|
|
84
|
+
wgpuComputePipelineSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
85
|
+
wgpuComputePipelineAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
86
|
+
wgpuComputePipelineRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
87
|
+
wgpuDawnDrmFormatCapabilitiesFreeMembers: { args: [FFIType.ptr], returns: FFIType.void },
|
|
88
|
+
wgpuDeviceCreateBindGroup: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
89
|
+
wgpuDeviceCreateBindGroupLayout: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
90
|
+
wgpuDeviceCreateBuffer: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
91
|
+
wgpuDeviceCreateCommandEncoder: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
92
|
+
wgpuDeviceCreateComputePipeline: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
93
|
+
wgpuDeviceCreateComputePipelineAsync: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.u64 },
|
|
94
|
+
wgpuDeviceCreateErrorBuffer: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
95
|
+
wgpuDeviceCreateErrorExternalTexture: { args: [FFIType.ptr], returns: FFIType.ptr },
|
|
96
|
+
wgpuDeviceCreateErrorShaderModule: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
97
|
+
wgpuDeviceCreateErrorTexture: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
98
|
+
wgpuDeviceCreateExternalTexture: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
99
|
+
wgpuDeviceCreatePipelineLayout: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
100
|
+
wgpuDeviceCreateQuerySet: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
101
|
+
wgpuDeviceCreateRenderBundleEncoder: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
102
|
+
wgpuDeviceCreateRenderPipeline: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
103
|
+
wgpuDeviceCreateRenderPipelineAsync: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.u64 },
|
|
104
|
+
wgpuDeviceCreateResourceTable: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
105
|
+
wgpuDeviceCreateSampler: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
106
|
+
wgpuDeviceCreateShaderModule: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
107
|
+
wgpuDeviceCreateTexture: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
108
|
+
wgpuDeviceDestroy: { args: [FFIType.ptr], returns: FFIType.void },
|
|
109
|
+
wgpuDeviceForceLoss: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr], returns: FFIType.void },
|
|
110
|
+
wgpuDeviceGetAdapter: { args: [FFIType.ptr], returns: FFIType.ptr },
|
|
111
|
+
wgpuDeviceGetAdapterInfo: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
112
|
+
wgpuDeviceGetAHardwareBufferProperties: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
113
|
+
wgpuDeviceGetFeatures: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
114
|
+
wgpuDeviceGetLimits: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
115
|
+
wgpuDeviceGetLostFuture: { args: [FFIType.ptr], returns: FFIType.u64 },
|
|
116
|
+
wgpuDeviceGetQueue: { args: [FFIType.ptr], returns: FFIType.ptr },
|
|
117
|
+
wgpuDeviceHasFeature: { args: [FFIType.ptr, FFIType.u32], returns: FFIType.u32 },
|
|
118
|
+
wgpuDeviceImportSharedBufferMemory: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
119
|
+
wgpuDeviceImportSharedFence: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
120
|
+
wgpuDeviceImportSharedTextureMemory: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
121
|
+
wgpuDeviceInjectError: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr], returns: FFIType.void },
|
|
122
|
+
wgpuDevicePopErrorScope: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.u64 },
|
|
123
|
+
wgpuDevicePushErrorScope: { args: [FFIType.ptr, FFIType.u32], returns: FFIType.void },
|
|
124
|
+
wgpuDeviceSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
125
|
+
wgpuDeviceSetLoggingCallback: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
126
|
+
wgpuDeviceTick: { args: [FFIType.ptr], returns: FFIType.void },
|
|
127
|
+
wgpuDeviceValidateTextureDescriptor: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
128
|
+
wgpuDeviceAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
129
|
+
wgpuDeviceRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
130
|
+
wgpuExternalTextureDestroy: { args: [FFIType.ptr], returns: FFIType.void },
|
|
131
|
+
wgpuExternalTextureExpire: { args: [FFIType.ptr], returns: FFIType.void },
|
|
132
|
+
wgpuExternalTextureRefresh: { args: [FFIType.ptr], returns: FFIType.void },
|
|
133
|
+
wgpuExternalTextureSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
134
|
+
wgpuExternalTextureAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
135
|
+
wgpuExternalTextureRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
136
|
+
wgpuInstanceCreateSurface: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
137
|
+
wgpuInstanceGetWGSLLanguageFeatures: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
138
|
+
wgpuInstanceHasWGSLLanguageFeature: { args: [FFIType.ptr, FFIType.u32], returns: FFIType.u32 },
|
|
139
|
+
wgpuInstanceProcessEvents: { args: [FFIType.ptr], returns: FFIType.void },
|
|
140
|
+
wgpuInstanceRequestAdapter: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.u64 },
|
|
141
|
+
wgpuInstanceWaitAny: { args: [FFIType.ptr, FFIType.u64, FFIType.ptr, FFIType.u64], returns: FFIType.u32 },
|
|
142
|
+
wgpuInstanceAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
143
|
+
wgpuInstanceRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
144
|
+
wgpuPipelineLayoutSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
145
|
+
wgpuPipelineLayoutAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
146
|
+
wgpuPipelineLayoutRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
147
|
+
wgpuQuerySetDestroy: { args: [FFIType.ptr], returns: FFIType.void },
|
|
148
|
+
wgpuQuerySetGetCount: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
149
|
+
wgpuQuerySetGetType: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
150
|
+
wgpuQuerySetSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
151
|
+
wgpuQuerySetAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
152
|
+
wgpuQuerySetRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
153
|
+
wgpuQueueCopyExternalTextureForBrowser: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
154
|
+
wgpuQueueCopyTextureForBrowser: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
155
|
+
wgpuQueueOnSubmittedWorkDone: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.u64 },
|
|
156
|
+
wgpuQueueSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
157
|
+
wgpuQueueSubmit: { args: [FFIType.ptr, FFIType.u64, FFIType.ptr], returns: FFIType.void },
|
|
158
|
+
wgpuQueueWriteBuffer: { args: [FFIType.ptr, FFIType.ptr, FFIType.u64, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
159
|
+
wgpuQueueWriteTexture: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr, FFIType.u64, FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
160
|
+
wgpuQueueAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
161
|
+
wgpuQueueRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
162
|
+
wgpuRenderBundleSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
163
|
+
wgpuRenderBundleAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
164
|
+
wgpuRenderBundleRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
165
|
+
wgpuRenderBundleEncoderDraw: { args: [FFIType.ptr, FFIType.u32, FFIType.u32, FFIType.u32, FFIType.u32], returns: FFIType.void },
|
|
166
|
+
wgpuRenderBundleEncoderDrawIndexed: { args: [FFIType.ptr, FFIType.u32, FFIType.u32, FFIType.u32, FFIType.i32, FFIType.u32], returns: FFIType.void },
|
|
167
|
+
wgpuRenderBundleEncoderDrawIndexedIndirect: { args: [FFIType.ptr, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
168
|
+
wgpuRenderBundleEncoderDrawIndirect: { args: [FFIType.ptr, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
169
|
+
wgpuRenderBundleEncoderFinish: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
170
|
+
wgpuRenderBundleEncoderInsertDebugMarker: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
171
|
+
wgpuRenderBundleEncoderPopDebugGroup: { args: [FFIType.ptr], returns: FFIType.void },
|
|
172
|
+
wgpuRenderBundleEncoderPushDebugGroup: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
173
|
+
wgpuRenderBundleEncoderSetBindGroup: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr, FFIType.u64, FFIType.ptr], returns: FFIType.void },
|
|
174
|
+
wgpuRenderBundleEncoderSetImmediates: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
175
|
+
wgpuRenderBundleEncoderSetIndexBuffer: { args: [FFIType.ptr, FFIType.ptr, FFIType.u32, FFIType.u64, FFIType.u64], returns: FFIType.void },
|
|
176
|
+
wgpuRenderBundleEncoderSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
177
|
+
wgpuRenderBundleEncoderSetPipeline: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
178
|
+
wgpuRenderBundleEncoderSetResourceTable: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
179
|
+
wgpuRenderBundleEncoderSetVertexBuffer: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr, FFIType.u64, FFIType.u64], returns: FFIType.void },
|
|
180
|
+
wgpuRenderBundleEncoderAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
181
|
+
wgpuRenderBundleEncoderRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
182
|
+
wgpuRenderPassEncoderBeginOcclusionQuery: { args: [FFIType.ptr, FFIType.u32], returns: FFIType.void },
|
|
183
|
+
wgpuRenderPassEncoderDraw: { args: [FFIType.ptr, FFIType.u32, FFIType.u32, FFIType.u32, FFIType.u32], returns: FFIType.void },
|
|
184
|
+
wgpuRenderPassEncoderDrawIndexed: { args: [FFIType.ptr, FFIType.u32, FFIType.u32, FFIType.u32, FFIType.i32, FFIType.u32], returns: FFIType.void },
|
|
185
|
+
wgpuRenderPassEncoderDrawIndexedIndirect: { args: [FFIType.ptr, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
186
|
+
wgpuRenderPassEncoderDrawIndirect: { args: [FFIType.ptr, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
187
|
+
wgpuRenderPassEncoderEnd: { args: [FFIType.ptr], returns: FFIType.void },
|
|
188
|
+
wgpuRenderPassEncoderEndOcclusionQuery: { args: [FFIType.ptr], returns: FFIType.void },
|
|
189
|
+
wgpuRenderPassEncoderExecuteBundles: { args: [FFIType.ptr, FFIType.u64, FFIType.ptr], returns: FFIType.void },
|
|
190
|
+
wgpuRenderPassEncoderInsertDebugMarker: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
191
|
+
wgpuRenderPassEncoderMultiDrawIndexedIndirect: { args: [FFIType.ptr, FFIType.ptr, FFIType.u64, FFIType.u32, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
192
|
+
wgpuRenderPassEncoderMultiDrawIndirect: { args: [FFIType.ptr, FFIType.ptr, FFIType.u64, FFIType.u32, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
193
|
+
wgpuRenderPassEncoderPixelLocalStorageBarrier: { args: [FFIType.ptr], returns: FFIType.void },
|
|
194
|
+
wgpuRenderPassEncoderPopDebugGroup: { args: [FFIType.ptr], returns: FFIType.void },
|
|
195
|
+
wgpuRenderPassEncoderPushDebugGroup: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
196
|
+
wgpuRenderPassEncoderSetBindGroup: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr, FFIType.u64, FFIType.ptr], returns: FFIType.void },
|
|
197
|
+
wgpuRenderPassEncoderSetBlendConstant: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
198
|
+
wgpuRenderPassEncoderSetImmediates: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
199
|
+
wgpuRenderPassEncoderSetIndexBuffer: { args: [FFIType.ptr, FFIType.ptr, FFIType.u32, FFIType.u64, FFIType.u64], returns: FFIType.void },
|
|
200
|
+
wgpuRenderPassEncoderSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
201
|
+
wgpuRenderPassEncoderSetPipeline: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
202
|
+
wgpuRenderPassEncoderSetResourceTable: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
203
|
+
wgpuRenderPassEncoderSetScissorRect: { args: [FFIType.ptr, FFIType.u32, FFIType.u32, FFIType.u32, FFIType.u32], returns: FFIType.void },
|
|
204
|
+
wgpuRenderPassEncoderSetStencilReference: { args: [FFIType.ptr, FFIType.u32], returns: FFIType.void },
|
|
205
|
+
wgpuRenderPassEncoderSetVertexBuffer: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr, FFIType.u64, FFIType.u64], returns: FFIType.void },
|
|
206
|
+
wgpuRenderPassEncoderSetViewport: { args: [FFIType.ptr, FFIType.f32, FFIType.f32, FFIType.f32, FFIType.f32, FFIType.f32, FFIType.f32], returns: FFIType.void },
|
|
207
|
+
wgpuRenderPassEncoderWriteTimestamp: { args: [FFIType.ptr, FFIType.ptr, FFIType.u32], returns: FFIType.void },
|
|
208
|
+
wgpuRenderPassEncoderAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
209
|
+
wgpuRenderPassEncoderRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
210
|
+
wgpuRenderPipelineGetBindGroupLayout: { args: [FFIType.ptr, FFIType.u32], returns: FFIType.ptr },
|
|
211
|
+
wgpuRenderPipelineSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
212
|
+
wgpuRenderPipelineAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
213
|
+
wgpuRenderPipelineRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
214
|
+
wgpuResourceTableDestroy: { args: [FFIType.ptr], returns: FFIType.void },
|
|
215
|
+
wgpuResourceTableGetSize: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
216
|
+
wgpuResourceTableInsertBinding: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
217
|
+
wgpuResourceTableRemoveBinding: { args: [FFIType.ptr, FFIType.u32], returns: FFIType.u32 },
|
|
218
|
+
wgpuResourceTableUpdate: { args: [FFIType.ptr, FFIType.u32, FFIType.ptr], returns: FFIType.u32 },
|
|
219
|
+
wgpuResourceTableAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
220
|
+
wgpuResourceTableRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
221
|
+
wgpuSamplerSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
222
|
+
wgpuSamplerAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
223
|
+
wgpuSamplerRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
224
|
+
wgpuShaderModuleGetCompilationInfo: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.u64 },
|
|
225
|
+
wgpuShaderModuleSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
226
|
+
wgpuShaderModuleAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
227
|
+
wgpuShaderModuleRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
228
|
+
wgpuSharedBufferMemoryBeginAccess: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
229
|
+
wgpuSharedBufferMemoryCreateBuffer: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
230
|
+
wgpuSharedBufferMemoryEndAccess: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
231
|
+
wgpuSharedBufferMemoryGetProperties: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
232
|
+
wgpuSharedBufferMemoryIsDeviceLost: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
233
|
+
wgpuSharedBufferMemorySetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
234
|
+
wgpuSharedBufferMemoryAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
235
|
+
wgpuSharedBufferMemoryRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
236
|
+
wgpuSharedBufferMemoryEndAccessStateFreeMembers: { args: [FFIType.ptr], returns: FFIType.void },
|
|
237
|
+
wgpuSharedFenceExportInfo: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
238
|
+
wgpuSharedFenceAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
239
|
+
wgpuSharedFenceRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
240
|
+
wgpuSharedTextureMemoryBeginAccess: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
241
|
+
wgpuSharedTextureMemoryCreateTexture: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
242
|
+
wgpuSharedTextureMemoryEndAccess: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
243
|
+
wgpuSharedTextureMemoryGetProperties: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
244
|
+
wgpuSharedTextureMemoryIsDeviceLost: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
245
|
+
wgpuSharedTextureMemorySetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
246
|
+
wgpuSharedTextureMemoryAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
247
|
+
wgpuSharedTextureMemoryRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
248
|
+
wgpuSharedTextureMemoryEndAccessStateFreeMembers: { args: [FFIType.ptr], returns: FFIType.void },
|
|
249
|
+
wgpuSupportedFeaturesFreeMembers: { args: [FFIType.ptr], returns: FFIType.void },
|
|
250
|
+
wgpuSupportedInstanceFeaturesFreeMembers: { args: [FFIType.ptr], returns: FFIType.void },
|
|
251
|
+
wgpuSupportedWGSLLanguageFeaturesFreeMembers: { args: [FFIType.ptr], returns: FFIType.void },
|
|
252
|
+
wgpuSurfaceConfigure: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
253
|
+
wgpuSurfaceGetCapabilities: { args: [FFIType.ptr, FFIType.ptr, FFIType.ptr], returns: FFIType.u32 },
|
|
254
|
+
wgpuSurfaceGetCurrentTexture: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
255
|
+
wgpuSurfacePresent: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
256
|
+
wgpuSurfaceSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
257
|
+
wgpuSurfaceUnconfigure: { args: [FFIType.ptr], returns: FFIType.void },
|
|
258
|
+
wgpuSurfaceAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
259
|
+
wgpuSurfaceRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
260
|
+
wgpuSurfaceCapabilitiesFreeMembers: { args: [FFIType.ptr], returns: FFIType.void },
|
|
261
|
+
wgpuTexelBufferViewSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
262
|
+
wgpuTexelBufferViewAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
263
|
+
wgpuTexelBufferViewRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
264
|
+
wgpuTextureCreateErrorView: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
265
|
+
wgpuTextureCreateView: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.ptr },
|
|
266
|
+
wgpuTextureDestroy: { args: [FFIType.ptr], returns: FFIType.void },
|
|
267
|
+
wgpuTextureGetDepthOrArrayLayers: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
268
|
+
wgpuTextureGetDimension: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
269
|
+
wgpuTextureGetFormat: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
270
|
+
wgpuTextureGetHeight: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
271
|
+
wgpuTextureGetMipLevelCount: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
272
|
+
wgpuTextureGetSampleCount: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
273
|
+
wgpuTextureGetTextureBindingViewDimension: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
274
|
+
wgpuTextureGetUsage: { args: [FFIType.ptr], returns: FFIType.u64 },
|
|
275
|
+
wgpuTextureGetWidth: { args: [FFIType.ptr], returns: FFIType.u32 },
|
|
276
|
+
wgpuTexturePin: { args: [FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
277
|
+
wgpuTextureSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
278
|
+
wgpuTextureSetOwnershipForMemoryDump: { args: [FFIType.ptr, FFIType.u64], returns: FFIType.void },
|
|
279
|
+
wgpuTextureUnpin: { args: [FFIType.ptr], returns: FFIType.void },
|
|
280
|
+
wgpuTextureAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
281
|
+
wgpuTextureRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
282
|
+
wgpuTextureViewSetLabel: { args: [FFIType.ptr, FFIType.ptr], returns: FFIType.void },
|
|
283
|
+
wgpuTextureViewAddRef: { args: [FFIType.ptr], returns: FFIType.void },
|
|
284
|
+
wgpuTextureViewRelease: { args: [FFIType.ptr], returns: FFIType.void },
|
|
285
|
+
} as const;
|
|
286
|
+
|
|
287
|
+
const WGPU_LIB_NAMES: Record<string, string[]> = {
|
|
288
|
+
darwin: ["libwebgpu_dawn.dylib"],
|
|
289
|
+
win32: ["webgpu_dawn.dll", "libwebgpu_dawn.dll"],
|
|
290
|
+
linux: ["libwebgpu_dawn.so"],
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
function findWgpuLibraryPath(): string | null {
|
|
294
|
+
const envPath = process.env['SPARKBUN_WGPU_PATH'];
|
|
295
|
+
if (envPath && existsSync(envPath)) return envPath;
|
|
296
|
+
|
|
297
|
+
const names = WGPU_LIB_NAMES[process.platform] ?? ["libwebgpu_dawn." + suffix];
|
|
298
|
+
for (const name of names) {
|
|
299
|
+
const cwdCandidate = join(process.cwd(), name);
|
|
300
|
+
if (existsSync(cwdCandidate)) return cwdCandidate;
|
|
301
|
+
const execDir = dirname(process.execPath);
|
|
302
|
+
const macCandidate = join(execDir, "..", "MacOS", name);
|
|
303
|
+
if (existsSync(macCandidate)) return macCandidate;
|
|
304
|
+
const resCandidate = join(execDir, "..", "Resources", name);
|
|
305
|
+
if (existsSync(resCandidate)) return resCandidate;
|
|
306
|
+
const execCandidate = join(execDir, name);
|
|
307
|
+
if (existsSync(execCandidate)) return execCandidate;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export const native = (() => {
|
|
314
|
+
const libPath = findWgpuLibraryPath();
|
|
315
|
+
if (!libPath) {
|
|
316
|
+
return {
|
|
317
|
+
available: false,
|
|
318
|
+
path: null as string | null,
|
|
319
|
+
symbols: {} as Record<string, never>,
|
|
320
|
+
close: () => {},
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
try {
|
|
325
|
+
const lib = dlopen(libPath, WGPU_SYMBOLS);
|
|
326
|
+
return {
|
|
327
|
+
available: true,
|
|
328
|
+
path: libPath,
|
|
329
|
+
symbols: lib.symbols,
|
|
330
|
+
close: lib.close,
|
|
331
|
+
};
|
|
332
|
+
} catch {
|
|
333
|
+
return {
|
|
334
|
+
available: false,
|
|
335
|
+
path: libPath,
|
|
336
|
+
symbols: {} as Record<string, never>,
|
|
337
|
+
close: () => {},
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
})();
|
|
341
|
+
|
|
342
|
+
const WGPU = {
|
|
343
|
+
native,
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
export default WGPU;
|