react-native-wgpu 0.3.1 → 0.4.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/README.md +7 -5
- package/apple/MetalView.mm +1 -1
- package/cpp/rnwgpu/api/GPU.h +0 -1
- package/cpp/rnwgpu/api/GPUAdapter.cpp +7 -7
- package/cpp/webgpu/webgpu.h +4827 -5
- package/cpp/webgpu/webgpu_cpp.h +10140 -5
- package/cpp/webgpu/webgpu_cpp_print.h +2687 -5
- package/lib/commonjs/Canvas.js +10 -3
- package/lib/commonjs/Canvas.js.map +1 -1
- package/lib/commonjs/WebGPUViewNativeComponent.web.js +99 -0
- package/lib/commonjs/WebGPUViewNativeComponent.web.js.map +1 -0
- package/lib/commonjs/WebPolyfillGPUModule.js +40 -0
- package/lib/commonjs/WebPolyfillGPUModule.js.map +1 -0
- package/lib/commonjs/index.js +4 -208
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/main/index.js +227 -0
- package/lib/commonjs/main/index.js.map +1 -0
- package/lib/commonjs/main/index.web.js +51 -0
- package/lib/commonjs/main/index.web.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils.js +11 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/Canvas.js +11 -4
- package/lib/module/Canvas.js.map +1 -1
- package/lib/module/WebGPUViewNativeComponent.web.js +93 -0
- package/lib/module/WebGPUViewNativeComponent.web.js.map +1 -0
- package/lib/module/WebPolyfillGPUModule.js +38 -0
- package/lib/module/WebPolyfillGPUModule.js.map +1 -0
- package/lib/module/index.js +3 -160
- package/lib/module/index.js.map +1 -1
- package/lib/module/main/index.js +168 -0
- package/lib/module/main/index.js.map +1 -0
- package/lib/module/main/index.web.js +8 -0
- package/lib/module/main/index.web.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +5 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.web.d.ts +5 -0
- package/lib/typescript/lib/commonjs/WebGPUViewNativeComponent.web.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/WebPolyfillGPUModule.d.ts +2 -0
- package/lib/typescript/lib/commonjs/WebPolyfillGPUModule.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +0 -1
- package/lib/typescript/lib/commonjs/main/index.d.ts +3 -0
- package/lib/typescript/lib/commonjs/main/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/main/index.web.d.ts +2 -0
- package/lib/typescript/lib/commonjs/main/index.web.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/types.d.ts +1 -0
- package/lib/typescript/lib/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/utils.d.ts +3 -0
- package/lib/typescript/lib/commonjs/utils.d.ts.map +1 -0
- package/lib/typescript/lib/module/Canvas.d.ts.map +1 -1
- package/lib/typescript/lib/module/WebGPUViewNativeComponent.web.d.ts +2 -0
- package/lib/typescript/lib/module/WebGPUViewNativeComponent.web.d.ts.map +1 -0
- package/lib/typescript/lib/module/WebPolyfillGPUModule.d.ts +2 -0
- package/lib/typescript/lib/module/WebPolyfillGPUModule.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +1 -5
- package/lib/typescript/lib/module/main/index.d.ts +6 -0
- package/lib/typescript/lib/module/main/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/main/index.web.d.ts +5 -0
- package/lib/typescript/lib/module/main/index.web.d.ts.map +1 -0
- package/lib/typescript/lib/module/types.d.ts +1 -0
- package/lib/typescript/lib/module/types.d.ts.map +1 -0
- package/lib/typescript/lib/module/utils.d.ts +2 -0
- package/lib/typescript/lib/module/utils.d.ts.map +1 -0
- package/lib/typescript/src/Canvas.d.ts.map +1 -1
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/WebGPUViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/WebGPUViewNativeComponent.web.d.ts +118 -0
- package/lib/typescript/src/WebGPUViewNativeComponent.web.d.ts.map +1 -0
- package/lib/typescript/src/WebPolyfillGPUModule.d.ts +2 -0
- package/lib/typescript/src/WebPolyfillGPUModule.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +16 -5
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/main/index.d.ts +6 -0
- package/lib/typescript/src/main/index.d.ts.map +1 -0
- package/lib/typescript/src/main/index.web.d.ts +6 -0
- package/lib/typescript/src/main/index.web.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +19 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +2 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/package.json +2 -1
- package/src/Canvas.tsx +12 -4
- package/src/WebGPUViewNativeComponent.ts +1 -1
- package/src/WebGPUViewNativeComponent.web.ts +108 -0
- package/src/WebPolyfillGPUModule.ts +53 -0
- package/src/index.tsx +25 -196
- package/src/main/index.tsx +204 -0
- package/src/main/index.web.tsx +8 -0
- package/src/types.ts +20 -0
- package/src/utils.ts +4 -0
- package/cpp/dawn/dawn_proc_table.h +0 -313
- package/cpp/dawn/native/DawnNative.h +0 -361
- package/cpp/dawn/native/NullBackend.h +0 -39
- package/cpp/dawn/native/OpenGLBackend.h +0 -82
- package/cpp/dawn/native/VulkanBackend.h +0 -183
- package/cpp/dawn/native/dawn_native_export.h +0 -49
- package/cpp/dawn/webgpu.h +0 -4855
- package/cpp/dawn/webgpu_cpp.h +0 -10168
- package/cpp/dawn/webgpu_cpp_print.h +0 -2715
- package/cpp/dawn/wire/client/webgpu.h +0 -354
- package/cpp/dawn/wire/client/webgpu_cpp.h +0 -10343
- package/cpp/dawn/wire/client/webgpu_cpp_print.h +0 -2715
- package/lib/commonjs/WebGPUView.js +0 -2
- package/lib/commonjs/WebGPUView.js.map +0 -1
- package/lib/module/WebGPUView.js +0 -2
- package/lib/module/WebGPUView.js.map +0 -1
- package/lib/typescript/lib/commonjs/WebGPUView.d.ts +0 -1
- package/lib/typescript/lib/commonjs/WebGPUView.d.ts.map +0 -1
- package/lib/typescript/lib/module/WebGPUView.d.ts +0 -1
- package/lib/typescript/lib/module/WebGPUView.d.ts.map +0 -1
- package/lib/typescript/src/WebGPUView.d.ts +0 -1
- package/lib/typescript/src/WebGPUView.d.ts.map +0 -1
- package/src/WebGPUView.tsx +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WebGPUModule","default","GPU","Symbol","hasInstance","instance","__brand","GPUAdapter","GPUAdapterInfo","GPUBindGroup","GPUBindGroupLayout","GPUBuffer","GPUCanvasContext","GPUCommandBuffer","GPUCommandEncoder","GPUCompilationInfo","GPUCompilationMessage","GPUComputePassEncoder","GPUComputePipeline","GPUDevice","GPUDeviceLostInfo","GPUError","GPUExternalTexture","GPUPipelineLayout","GPUQuerySet","GPUQueue","GPURenderBundle","GPURenderBundleEncoder","GPURenderPassEncoder","GPURenderPipeline","GPUSampler","GPUShaderModule","GPUTexture","GPUTextureView","global","install","navigator","gpu","RNWebGPU","userAgent","createImageBitmap","params","Promise","resolve"],"sourceRoot":"../../../src","sources":["main/index.tsx"],"mappings":"AAAA;AACA,OAAOA,YAAY,MAAM,uBAAuB;AAEhD,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,8BAA8B;AAC5C,cAAc,UAAU;AAExB,SAASC,OAAO,IAAID,YAAY,QAAQ,uBAAuB;AAE/D,MAAME,GAAQ,GAAG,CAAC,CAAC;AACnBA,GAAG,CAACC,MAAM,CAACC,WAAW,CAAC,GAAG,UAAUC,QAAgB,EAAE;EACpD,OAAO,SAAS,IAAIA,QAAQ,IAAIA,QAAQ,CAACC,OAAO,KAAK,KAAK;AAC5D,CAAC;AAED,MAAMC,UAAe,GAAG,CAAC,CAAC;AAC1BA,UAAU,CAACJ,MAAM,CAACC,WAAW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ACP,sBAAsB,GAAGA,sBAAsB;AACtDO,MAAM,CAACN,oBAAoB,GAAGA,oBAAoB;AAClDM,MAAM,CAACL,iBAAiB,GAAGA,iBAAiB;AAC5CK,MAAM,CAACJ,UAAU,GAAGA,UAAU;AAC9BI,MAAM,CAACH,eAAe,GAAGA,eAAe;AACxCG,MAAM,CAACF,UAAU,GAAGA,UAAU;AAC9BE,MAAM,CAACD,cAAc,GAAGA,cAAc;AAEtCjC,YAAY,CAACmC,OAAO,CAAC,CAAC;AAEtB,IAAI,CAACC,SAAS,EAAE;EACd;EACAA,SAAS,GAAG;IACVC,GAAG,EAAEC,QAAQ,CAACD,GAAG;IACjBE,SAAS,EAAE;EACb,CAAC;AACH,CAAC,MAAM;EACLH,SAAS,CAACC,GAAG,GAAGC,QAAQ,CAACD,GAAG;EAC5B,IAAI,OAAOD,SAAS,CAACG,SAAS,KAAK,QAAQ,EAAE;IAC3C,IAAI;MACF;MACA;MACAH,SAAS,CAACG,SAAS,GAAG,cAAc;IACtC,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ;AACF;AAEAL,MAAM,CAACM,iBAAiB,GACtBN,MAAM,CAACM,iBAAiB,KACvB,CAAC,GAAGC,MAA4C,KAC/C,IAAIC,OAAO,CAAEC,OAAO,IAAKA,OAAO,CAACL,QAAQ,CAACE,iBAAiB,CAAC,GAAGC,MAAM,CAAC,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../WebPolyfillGPUModule";
|
|
2
|
+
export * from "../Canvas";
|
|
3
|
+
export * from "../Offscreen";
|
|
4
|
+
export * from "../WebGPUViewNativeComponent";
|
|
5
|
+
export * from "../hooks";
|
|
6
|
+
|
|
7
|
+
// We don't need to set all global properties on web, webgpu is already available globally
|
|
8
|
+
//# sourceMappingURL=index.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["main/index.web.tsx"],"mappings":"AAAA,OAAO,yBAAyB;AAEhC,cAAc,WAAW;AACzB,cAAc,cAAc;AAC5B,cAAc,8BAA8B;AAC5C,cAAc,UAAU;;AAExB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["contextIdToId","contextId"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":"AAAA;AACA,OAAO,SAASA,aAAaA,CAACC,SAAiB,EAAE;EAC/C,OAAO,gBAAgB,GAAGA,SAAS;AACrC","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
2
|
+
export default WebGPUViewNativeComponent;
|
|
3
|
+
declare function WebGPUViewNativeComponent(props: any): _react.DetailedReactHTMLElement<any, HTMLElement>;
|
|
4
|
+
import _react = require("react");
|
|
5
|
+
//# sourceMappingURL=WebGPUViewNativeComponent.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGPUViewNativeComponent.web.d.ts","sourceRoot":"","sources":["../../../commonjs/WebGPUViewNativeComponent.web.js"],"names":[],"mappings":";;AA4CA,0GA8BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebPolyfillGPUModule.d.ts","sourceRoot":"","sources":["../../../commonjs/WebPolyfillGPUModule.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../commonjs/main/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../commonjs/main/index.web.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../commonjs/types.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../commonjs/utils.js"],"names":[],"mappings":";AAOA,sDAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../module/Canvas.js"],"names":[],"mappings":"AAQA,
|
|
1
|
+
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../module/Canvas.js"],"names":[],"mappings":"AAQA,mGA0CG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGPUViewNativeComponent.web.d.ts","sourceRoot":"","sources":["../../../module/WebGPUViewNativeComponent.web.js"],"names":[],"mappings":"AAsCA,0HA8BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebPolyfillGPUModule.d.ts","sourceRoot":"","sources":["../../../module/WebPolyfillGPUModule.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../module/main/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../module/main/index.web.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../module/types.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../module/utils.js"],"names":[],"mappings":"AACA,sDAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../src/Canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAW9C,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,QAAQ,EAAE;QACZ,GAAG,EAAE,GAAG,CAAC;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,YAAY,CAAC;QACtD,uBAAuB,EAAE,CACvB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,KACX,eAAe,CAAC;QACrB,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,GAAG,WAAW,KAAK,MAAM,CAAC;QACvE,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;KAC7C,CAAC;CACH;AAED,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,UAAU,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI,CAAC;IAC1D,gBAAgB,EAAE,MAAM,YAAY,CAAC;CACtC;AAED,eAAO,MAAM,MAAM;kBAEW,OAAO;
|
|
1
|
+
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../src/Canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAW9C,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,QAAQ,EAAE;QACZ,GAAG,EAAE,GAAG,CAAC;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,YAAY,CAAC;QACtD,uBAAuB,EAAE,CACvB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,KACX,eAAe,CAAC;QACrB,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,GAAG,WAAW,KAAK,MAAM,CAAC;QACvE,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;KAC7C,CAAC;CACH;AAED,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,UAAU,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI,CAAC;IAC1D,gBAAgB,EAAE,MAAM,YAAY,CAAC;CACtC;AAED,eAAO,MAAM,MAAM;kBAEW,OAAO;6CA2CnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGPUViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,
|
|
1
|
+
{"version":3,"file":"WebGPUViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,SAAS,EAAE,KAAK,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB;;AAGD,wBAAiE"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Int32 } from "react-native/Libraries/Types/CodegenTypes";
|
|
2
|
+
import type { ViewProps } from "react-native";
|
|
3
|
+
export interface NativeProps extends ViewProps {
|
|
4
|
+
contextId: Int32;
|
|
5
|
+
transparent: boolean;
|
|
6
|
+
}
|
|
7
|
+
export default function WebGPUViewNativeComponent(props: NativeProps): import("react").ReactElement<{
|
|
8
|
+
style: (import("react-native").StyleProp<import("react-native").ViewStyle> | {
|
|
9
|
+
flex: number;
|
|
10
|
+
} | {
|
|
11
|
+
alignItems: "stretch";
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
border: string;
|
|
14
|
+
boxSizing: "border-box";
|
|
15
|
+
display: "flex";
|
|
16
|
+
flexBasis: "auto";
|
|
17
|
+
flexDirection: "column";
|
|
18
|
+
flexShrink: number;
|
|
19
|
+
listStyle: string;
|
|
20
|
+
margin: number;
|
|
21
|
+
minHeight: number;
|
|
22
|
+
minWidth: number;
|
|
23
|
+
padding: number;
|
|
24
|
+
position: "relative";
|
|
25
|
+
zIndex: number;
|
|
26
|
+
})[];
|
|
27
|
+
id: string;
|
|
28
|
+
ref: (ref: HTMLCanvasElement) => void;
|
|
29
|
+
children?: React.ReactNode | undefined;
|
|
30
|
+
hitSlop?: null | import("react-native").Insets | number | undefined;
|
|
31
|
+
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
32
|
+
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
33
|
+
pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined;
|
|
34
|
+
removeClippedSubviews?: boolean | undefined;
|
|
35
|
+
testID?: string | undefined;
|
|
36
|
+
nativeID?: string | undefined;
|
|
37
|
+
collapsable?: boolean | undefined;
|
|
38
|
+
collapsableChildren?: boolean | undefined;
|
|
39
|
+
onBlur?: ((e: import("react-native").BlurEvent) => void) | null | undefined;
|
|
40
|
+
onFocus?: ((e: import("react-native").FocusEvent) => void) | null | undefined;
|
|
41
|
+
renderToHardwareTextureAndroid?: boolean | undefined;
|
|
42
|
+
focusable?: boolean | undefined;
|
|
43
|
+
tabIndex?: 0 | -1 | undefined;
|
|
44
|
+
shouldRasterizeIOS?: boolean | undefined;
|
|
45
|
+
isTVSelectable?: boolean | undefined;
|
|
46
|
+
hasTVPreferredFocus?: boolean | undefined;
|
|
47
|
+
tvParallaxShiftDistanceX?: number | undefined;
|
|
48
|
+
tvParallaxShiftDistanceY?: number | undefined;
|
|
49
|
+
tvParallaxTiltAngle?: number | undefined;
|
|
50
|
+
tvParallaxMagnification?: number | undefined;
|
|
51
|
+
onStartShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
52
|
+
onMoveShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
53
|
+
onResponderEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
54
|
+
onResponderGrant?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
55
|
+
onResponderReject?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
56
|
+
onResponderMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
57
|
+
onResponderRelease?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
58
|
+
onResponderStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
59
|
+
onResponderTerminationRequest?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
60
|
+
onResponderTerminate?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
61
|
+
onStartShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
62
|
+
onMoveShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
|
|
63
|
+
onTouchStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
64
|
+
onTouchMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
65
|
+
onTouchEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
66
|
+
onTouchCancel?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
67
|
+
onTouchEndCapture?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
68
|
+
onPointerEnter?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
69
|
+
onPointerEnterCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
70
|
+
onPointerLeave?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
71
|
+
onPointerLeaveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
72
|
+
onPointerMove?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
73
|
+
onPointerMoveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
74
|
+
onPointerCancel?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
75
|
+
onPointerCancelCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
76
|
+
onPointerDown?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
77
|
+
onPointerDownCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
78
|
+
onPointerUp?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
79
|
+
onPointerUpCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
80
|
+
accessible?: boolean | undefined;
|
|
81
|
+
accessibilityActions?: ReadonlyArray<import("react-native").AccessibilityActionInfo> | undefined;
|
|
82
|
+
accessibilityLabel?: string | undefined;
|
|
83
|
+
'aria-label'?: string | undefined;
|
|
84
|
+
accessibilityRole?: import("react-native").AccessibilityRole | undefined;
|
|
85
|
+
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
86
|
+
'aria-busy'?: boolean | undefined;
|
|
87
|
+
'aria-checked'?: boolean | "mixed" | undefined;
|
|
88
|
+
'aria-disabled'?: boolean | undefined;
|
|
89
|
+
'aria-expanded'?: boolean | undefined;
|
|
90
|
+
'aria-selected'?: boolean | undefined;
|
|
91
|
+
accessibilityHint?: string | undefined;
|
|
92
|
+
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
93
|
+
'aria-valuemax'?: import("react-native").AccessibilityValue["max"] | undefined;
|
|
94
|
+
'aria-valuemin'?: import("react-native").AccessibilityValue["min"] | undefined;
|
|
95
|
+
'aria-valuenow'?: import("react-native").AccessibilityValue["now"] | undefined;
|
|
96
|
+
'aria-valuetext'?: import("react-native").AccessibilityValue["text"] | undefined;
|
|
97
|
+
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
98
|
+
importantForAccessibility?: ("auto" | "yes" | "no" | "no-hide-descendants") | undefined;
|
|
99
|
+
'aria-hidden'?: boolean | undefined;
|
|
100
|
+
'aria-modal'?: boolean | undefined;
|
|
101
|
+
role?: import("react-native").Role | undefined;
|
|
102
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
103
|
+
'aria-labelledby'?: string | undefined;
|
|
104
|
+
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
105
|
+
'aria-live'?: ("polite" | "assertive" | "off") | undefined;
|
|
106
|
+
screenReaderFocusable?: boolean | undefined;
|
|
107
|
+
accessibilityElementsHidden?: boolean | undefined;
|
|
108
|
+
accessibilityViewIsModal?: boolean | undefined;
|
|
109
|
+
onAccessibilityEscape?: (() => void) | undefined;
|
|
110
|
+
onAccessibilityTap?: (() => void) | undefined;
|
|
111
|
+
onMagicTap?: (() => void) | undefined;
|
|
112
|
+
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
113
|
+
accessibilityLanguage?: string | undefined;
|
|
114
|
+
accessibilityShowsLargeContentViewer?: boolean | undefined;
|
|
115
|
+
accessibilityLargeContentTitle?: string | undefined;
|
|
116
|
+
accessibilityRespondsToUserInteraction?: boolean | undefined;
|
|
117
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
118
|
+
//# sourceMappingURL=WebGPUViewNativeComponent.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebGPUViewNativeComponent.web.d.ts","sourceRoot":"","sources":["../../../src/WebGPUViewNativeComponent.web.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,SAAS,EAAE,KAAK,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB;AA2CD,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,KAAK,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;eAsBrD,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wDAO/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebPolyfillGPUModule.d.ts","sourceRoot":"","sources":["../../../src/WebPolyfillGPUModule.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "./
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { NativeCanvas, RNCanvasContext } from "./types";
|
|
2
|
+
export * from "./main";
|
|
3
|
+
declare global {
|
|
4
|
+
interface Navigator {
|
|
5
|
+
gpu: GPU;
|
|
6
|
+
}
|
|
7
|
+
var navigator: Navigator;
|
|
8
|
+
var RNWebGPU: {
|
|
9
|
+
gpu: GPU;
|
|
10
|
+
fabric: boolean;
|
|
11
|
+
getNativeSurface: (contextId: number) => NativeCanvas;
|
|
12
|
+
MakeWebGPUCanvasContext: (contextId: number, width: number, height: number) => RNCanvasContext;
|
|
13
|
+
DecodeToUTF8: (buffer: NodeJS.ArrayBufferView | ArrayBuffer) => string;
|
|
14
|
+
createImageBitmap: typeof createImageBitmap;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
6
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE7D,cAAc,QAAQ,CAAC;AAEvB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,SAAS;QACjB,GAAG,EAAE,GAAG,CAAC;KACV;IAED,IAAI,SAAS,EAAE,SAAS,CAAC;IAEzB,IAAI,QAAQ,EAAE;QACZ,GAAG,EAAE,GAAG,CAAC;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,YAAY,CAAC;QACtD,uBAAuB,EAAE,CACvB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,KACX,eAAe,CAAC;QACrB,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,GAAG,WAAW,KAAK,MAAM,CAAC;QACvE,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;KAC7C,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/main/index.tsx"],"names":[],"mappings":"AAGA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/main/index.web.tsx"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type SurfacePointer = bigint;
|
|
2
|
+
export interface NativeCanvas {
|
|
3
|
+
surface: SurfacePointer;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
clientWidth: number;
|
|
7
|
+
clientHeight: number;
|
|
8
|
+
}
|
|
9
|
+
export type RNCanvasContext = GPUCanvasContext & {
|
|
10
|
+
present: () => void;
|
|
11
|
+
};
|
|
12
|
+
export interface CanvasRef {
|
|
13
|
+
getContextId: () => number;
|
|
14
|
+
getContext(contextName: "webgpu"): RNCanvasContext | null;
|
|
15
|
+
getNativeSurface: () => NativeCanvas;
|
|
16
|
+
whenReady: (callback: () => void) => void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,UAAU,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI,CAAC;IAC1D,gBAAgB,EAAE,MAAM,YAAY,CAAC;IACrC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AACA,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,UAE9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-wgpu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "React Native WebGPU",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"react": "19.1.0",
|
|
82
82
|
"react-native": "0.81.4",
|
|
83
83
|
"react-native-builder-bob": "^0.23.2",
|
|
84
|
+
"react-native-web": "^0.21.2",
|
|
84
85
|
"rimraf": "^5.0.7",
|
|
85
86
|
"seedrandom": "^3.0.5",
|
|
86
87
|
"teapot": "^1.0.0",
|
package/src/Canvas.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ViewProps } from "react-native";
|
|
2
|
-
import { View } from "react-native";
|
|
2
|
+
import { Platform, View } from "react-native";
|
|
3
3
|
import { forwardRef, useImperativeHandle, useRef, useState } from "react";
|
|
4
4
|
|
|
5
5
|
import WebGPUNativeView from "./WebGPUViewNativeComponent";
|
|
@@ -62,9 +62,16 @@ export const Canvas = forwardRef<
|
|
|
62
62
|
if (!viewRef.current) {
|
|
63
63
|
throw new Error("[WebGPU] Cannot get context before mount");
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
let size;
|
|
66
|
+
if (Platform.OS === "web") {
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
68
|
+
// @ts-expect-error
|
|
69
|
+
size = viewRef.current.getBoundingClientRect();
|
|
70
|
+
} else {
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
72
|
+
// @ts-expect-error
|
|
73
|
+
size = viewRef.current.unstable_getBoundingClientRect();
|
|
74
|
+
}
|
|
68
75
|
return RNWebGPU.MakeWebGPUCanvasContext(
|
|
69
76
|
contextId,
|
|
70
77
|
size.width,
|
|
@@ -72,6 +79,7 @@ export const Canvas = forwardRef<
|
|
|
72
79
|
);
|
|
73
80
|
},
|
|
74
81
|
}));
|
|
82
|
+
|
|
75
83
|
return (
|
|
76
84
|
<View collapsable={false} ref={viewRef} {...props}>
|
|
77
85
|
<WebGPUNativeView
|
|
@@ -2,7 +2,7 @@ import { codegenNativeComponent } from "react-native";
|
|
|
2
2
|
import type { Int32 } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
3
|
import type { ViewProps } from "react-native";
|
|
4
4
|
|
|
5
|
-
interface NativeProps extends ViewProps {
|
|
5
|
+
export interface NativeProps extends ViewProps {
|
|
6
6
|
contextId: Int32;
|
|
7
7
|
transparent: boolean;
|
|
8
8
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import { unstable_createElement as unstableCreateElement } from "react-native-web";
|
|
4
|
+
import type { Int32 } from "react-native/Libraries/Types/CodegenTypes";
|
|
5
|
+
import type { ViewProps } from "react-native";
|
|
6
|
+
|
|
7
|
+
import { contextIdToId } from "./utils";
|
|
8
|
+
|
|
9
|
+
export interface NativeProps extends ViewProps {
|
|
10
|
+
contextId: Int32;
|
|
11
|
+
transparent: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
function debounce<T extends (...args: any[]) => void>(
|
|
16
|
+
func: T,
|
|
17
|
+
wait: number,
|
|
18
|
+
immediate = false,
|
|
19
|
+
) {
|
|
20
|
+
let timeout: ReturnType<typeof setTimeout> | undefined;
|
|
21
|
+
return function debounced(
|
|
22
|
+
this: ThisParameterType<T>,
|
|
23
|
+
...args: Parameters<T>
|
|
24
|
+
) {
|
|
25
|
+
const context = this;
|
|
26
|
+
const callNow = immediate && !timeout;
|
|
27
|
+
if (timeout) {
|
|
28
|
+
clearTimeout(timeout);
|
|
29
|
+
}
|
|
30
|
+
timeout = setTimeout(() => {
|
|
31
|
+
timeout = undefined;
|
|
32
|
+
if (!immediate) {
|
|
33
|
+
func.apply(context, args);
|
|
34
|
+
}
|
|
35
|
+
}, wait);
|
|
36
|
+
if (callNow) {
|
|
37
|
+
func.apply(context, args);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function resizeCanvas(canvas?: HTMLCanvasElement) {
|
|
43
|
+
if (!canvas) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const dpr = window.devicePixelRatio || 1;
|
|
48
|
+
|
|
49
|
+
const { height, width } = canvas.getBoundingClientRect();
|
|
50
|
+
canvas.setAttribute("height", (height * dpr).toString());
|
|
51
|
+
canvas.setAttribute("width", (width * dpr).toString());
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// eslint-disable-next-line import/no-default-export
|
|
55
|
+
export default function WebGPUViewNativeComponent(props: NativeProps) {
|
|
56
|
+
const { contextId, style, transparent, ...rest } = props;
|
|
57
|
+
|
|
58
|
+
const canvasElm = useRef<HTMLCanvasElement>();
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const onResize = debounce(() => resizeCanvas(canvasElm.current), 100);
|
|
62
|
+
window.addEventListener("resize", onResize);
|
|
63
|
+
return () => {
|
|
64
|
+
window.removeEventListener("resize", onResize);
|
|
65
|
+
};
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
return unstableCreateElement("canvas", {
|
|
69
|
+
...rest,
|
|
70
|
+
style: [
|
|
71
|
+
styles.view,
|
|
72
|
+
styles.flex1,
|
|
73
|
+
transparent === false && { backgroundColor: "white" }, // Canvas elements are transparent by default on the web
|
|
74
|
+
style,
|
|
75
|
+
],
|
|
76
|
+
id: contextIdToId(contextId),
|
|
77
|
+
ref: (ref: HTMLCanvasElement) => {
|
|
78
|
+
canvasElm.current = ref;
|
|
79
|
+
if (ref) {
|
|
80
|
+
resizeCanvas(ref);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const styles = StyleSheet.create({
|
|
87
|
+
flex1: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
},
|
|
90
|
+
view: {
|
|
91
|
+
alignItems: "stretch",
|
|
92
|
+
backgroundColor: "transparent",
|
|
93
|
+
// @ts-expect-error - not a valid RN style, but it's valid for web
|
|
94
|
+
border: "0 solid black",
|
|
95
|
+
boxSizing: "border-box",
|
|
96
|
+
display: "flex",
|
|
97
|
+
flexBasis: "auto",
|
|
98
|
+
flexDirection: "column",
|
|
99
|
+
flexShrink: 0,
|
|
100
|
+
listStyle: "none",
|
|
101
|
+
margin: 0,
|
|
102
|
+
minHeight: 0,
|
|
103
|
+
minWidth: 0,
|
|
104
|
+
padding: 0,
|
|
105
|
+
position: "relative",
|
|
106
|
+
zIndex: 0,
|
|
107
|
+
},
|
|
108
|
+
});
|