@symbiote-native/gl 0.0.0 → 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/README.md +193 -12
- package/build/core/gl-view.js +11 -3
- package/build/core/index.d.ts +1 -1
- package/build/core/index.js +1 -1
- package/build/core/worklet-context-manager.js +1 -0
- package/build-ngc/angular/gl-view/index.js.map +1 -1
- package/build-ngc/core/gl-context.js.map +1 -1
- package/build-ngc/core/gl-utils.js.map +1 -1
- package/build-ngc/core/gl-view.js +11 -3
- package/build-ngc/core/gl-view.js.map +1 -1
- package/build-ngc/core/index.d.ts +1 -1
- package/build-ngc/core/index.js +1 -1
- package/build-ngc/core/index.js.map +1 -1
- package/build-ngc/core/native-module.js.map +1 -1
- package/build-ngc/core/worklet-context-manager.js +1 -0
- package/build-ngc/core/worklet-context-manager.js.map +1 -1
- package/package.json +15 -15
- package/src/angular/gl-view/index.ts +3 -2
- package/src/core/gl-context.ts +8 -3
- package/src/core/gl-utils.ts +15 -6
- package/src/core/gl-view.ts +25 -8
- package/src/core/index.ts +6 -1
- package/src/core/native-module.ts +6 -2
- package/src/core/types.ts +11 -11
- package/src/core/worklet-context-manager.ts +14 -4
- package/src/react/gl-view.ts +4 -1
- package/src/solid/gl-view.ts +3 -1
package/README.md
CHANGED
|
@@ -4,17 +4,74 @@
|
|
|
4
4
|
[SymbioteNative](../../README.md) adapter: React, Vue, Svelte, Solid and Angular. A `GLView` that
|
|
5
5
|
gives a WebGL2 context to draw into, headless contexts and snapshots.
|
|
6
6
|
|
|
7
|
+
Built the same way as [`@symbiote-native/clipboard`](../clipboard)'s `ClipboardPasteButton`, an
|
|
8
|
+
`expo-modules-core` native view reached through `requireNativeViewManager` (see the
|
|
9
|
+
`symbiote-expo-native-module` project skill: why `expo-modules-core` is depended on directly and never
|
|
10
|
+
the `expo` meta-package, why the upstream JS is hand-ported into `core/`, and how autolinking finds the
|
|
11
|
+
native module). One render function in `core/` returns a descriptor and every adapter only turns it into
|
|
12
|
+
its own element.
|
|
13
|
+
|
|
7
14
|
## Install
|
|
8
15
|
|
|
16
|
+
**New app:**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx @symbiote-native/cli new my-app --gl
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Existing SymbioteNative app:**
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx @symbiote-native/cli add --gl
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Either way: installs `@symbiote-native/gl` and wires the native autolinking automatically,
|
|
29
|
+
see [`@symbiote-native/cli`](../cli).
|
|
30
|
+
|
|
31
|
+
<details>
|
|
32
|
+
<summary>Manual install (no CLI - installing and wiring native autolinking by hand)</summary>
|
|
33
|
+
|
|
9
34
|
```bash
|
|
10
|
-
|
|
11
|
-
npx @symbiote-native/cli add --gl # existing app
|
|
35
|
+
npm install @symbiote-native/gl
|
|
12
36
|
```
|
|
13
37
|
|
|
14
|
-
|
|
15
|
-
|
|
38
|
+
Depends on `expo-gl` and `expo-modules-core` directly (regular dependencies, pinned to exact
|
|
39
|
+
versions, since this package's `core/` is hand-ported against one specific native API shape).
|
|
40
|
+
Never install `expo-gl` yourself, and never add the `expo` package to this project: it bundles
|
|
41
|
+
its own Metro/Babel pipeline that conflicts with this project's own.
|
|
42
|
+
|
|
43
|
+
### Required one-time step: native autolinking wiring
|
|
16
44
|
|
|
17
|
-
|
|
45
|
+
`expo-gl`'s native code is discovered by `expo-modules-autolinking`, not by RN's own
|
|
46
|
+
`react-native.config.cjs` mechanism. Wire it into the native host app **once**, it covers this package
|
|
47
|
+
and every other `expo-modules-core` package with zero further changes. The steps and the
|
|
48
|
+
mechanics behind them are in the `symbiote-expo-native-module` skill and in
|
|
49
|
+
[`@symbiote-native/network`](../network)'s README; the reference app is `examples/expo-react`.
|
|
50
|
+
|
|
51
|
+
</details>
|
|
52
|
+
|
|
53
|
+
## Shape
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
src/core/ gl-view.ts - the view and its handle. gl-context.ts - createContextAsync,
|
|
57
|
+
destroyContextAsync, takeSnapshotAsync, getWorkletContext, forgetting a context.
|
|
58
|
+
worklet-context-manager.ts - the optional Reanimated side, in its own file so an
|
|
59
|
+
import of Reanimated inside a try survives Metro's inline requires. gl-utils.ts,
|
|
60
|
+
gl-errors.ts, types.ts.
|
|
61
|
+
src/react/ @symbiote-native/gl/react - GLView
|
|
62
|
+
src/vue/ @symbiote-native/gl/vue - GLView
|
|
63
|
+
src/svelte/ @symbiote-native/gl/svelte - GLView (.svelte)
|
|
64
|
+
src/solid/ @symbiote-native/gl/solid - GLView
|
|
65
|
+
src/angular/ @symbiote-native/gl/angular - GLView
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
A controller may define `dispose`, which every adapter runs on unmount (a React effect cleanup, Vue
|
|
69
|
+
`onUnmounted`, Solid `onCleanup`, a Svelte `$effect` teardown, Angular's `disposeView`). `GLView` uses it to
|
|
70
|
+
forget its context. The package tsconfig adds the DOM lib for the WebGL types.
|
|
71
|
+
|
|
72
|
+
## Use it
|
|
73
|
+
|
|
74
|
+
### React
|
|
18
75
|
|
|
19
76
|
```tsx
|
|
20
77
|
import { GLView, type IExpoWebGLRenderingContext } from '@symbiote-native/gl/react';
|
|
@@ -28,12 +85,136 @@ function onContextCreate(gl: IExpoWebGLRenderingContext) {
|
|
|
28
85
|
<GLView style={{ flex: 1 }} onContextCreate={onContextCreate} />;
|
|
29
86
|
```
|
|
30
87
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
88
|
+
### Vue
|
|
89
|
+
|
|
90
|
+
```vue
|
|
91
|
+
<script setup lang="ts">
|
|
92
|
+
import { GLView, type IExpoWebGLRenderingContext } from '@symbiote-native/gl/vue';
|
|
93
|
+
|
|
94
|
+
function onContextCreate(gl: IExpoWebGLRenderingContext) {
|
|
95
|
+
gl.clearColor(0, 1, 1, 1);
|
|
96
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
97
|
+
gl.endFrameEXP();
|
|
98
|
+
}
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<template>
|
|
102
|
+
<GLView :style="{ flex: 1 }" @contextCreate="onContextCreate" />
|
|
103
|
+
</template>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Angular
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import { Component } from '@angular/core';
|
|
110
|
+
import { GLView, type IExpoWebGLRenderingContext } from '@symbiote-native/gl/angular';
|
|
111
|
+
|
|
112
|
+
@Component({
|
|
113
|
+
standalone: true,
|
|
114
|
+
imports: [GLView],
|
|
115
|
+
template: `<GLView [style]="{ flex: 1 }" [onContextCreate]="onContextCreate" />`,
|
|
116
|
+
})
|
|
117
|
+
export class Surface {
|
|
118
|
+
readonly onContextCreate = (gl: IExpoWebGLRenderingContext): void => {
|
|
119
|
+
gl.clearColor(0, 1, 1, 1);
|
|
120
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
121
|
+
gl.endFrameEXP();
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Svelte
|
|
127
|
+
|
|
128
|
+
```svelte
|
|
129
|
+
<script lang="ts">
|
|
130
|
+
import { GLView, type IExpoWebGLRenderingContext } from '@symbiote-native/gl/svelte';
|
|
131
|
+
|
|
132
|
+
function onContextCreate(gl: IExpoWebGLRenderingContext) {
|
|
133
|
+
gl.clearColor(0, 1, 1, 1);
|
|
134
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
135
|
+
gl.endFrameEXP();
|
|
136
|
+
}
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
<GLView style={{ flex: 1 }} {onContextCreate} />
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Solid
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
import { GLView, type IExpoWebGLRenderingContext } from '@symbiote-native/gl/solid';
|
|
146
|
+
|
|
147
|
+
function onContextCreate(gl: IExpoWebGLRenderingContext) {
|
|
148
|
+
gl.clearColor(0, 1, 1, 1);
|
|
149
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
150
|
+
gl.endFrameEXP();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
<GLView style={{ flex: 1 }} onContextCreate={onContextCreate} />;
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## API
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
<GLView onContextCreate={(gl: IExpoWebGLRenderingContext) => void} msaaSamples? enableExperimentalWorkletSupport? style? />
|
|
160
|
+
// gl is a WebGL2 context, call gl.endFrameEXP() at the end of every frame
|
|
161
|
+
// handle: exglCtxId, createCameraTextureAsync(camera), destroyObjectAsync(texture), takeSnapshotAsync(options?)
|
|
162
|
+
|
|
163
|
+
createContextAsync(): Promise<IExpoWebGLRenderingContext> // headless
|
|
164
|
+
destroyContextAsync(exgl?: IExpoWebGLRenderingContext | number): Promise<boolean>
|
|
165
|
+
takeSnapshotAsync(exgl?: IExpoWebGLRenderingContext | number, options?): Promise<IGLSnapshot>
|
|
166
|
+
getWorkletContext(contextId: number): IExpoWebGLRenderingContext | undefined // inside a worklet
|
|
167
|
+
GLLoggingOption gl.__expoSetLogging(option) // prints the GL calls with console.warn
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Ported from upstream's `GLView.tsx` and `GLView.types.ts`.
|
|
171
|
+
|
|
172
|
+
## Notes
|
|
173
|
+
|
|
174
|
+
- **Nothing reaches the screen until `endFrameEXP()`.** Call it at the end of every frame, including
|
|
175
|
+
the first. The drawing buffer is presented only then.
|
|
176
|
+
- **`onContextCreate` runs once per surface.** Start your loop in it and stop it when the view
|
|
177
|
+
unmounts. The package forgets the context of the view when it unmounts.
|
|
178
|
+
- **Texture images must be files on disk.** `gl.texImage2D` reads a file path, so load a bundled image
|
|
179
|
+
with [`@symbiote-native/asset`](/docs/packages/asset/) and pass its `localUri` after
|
|
180
|
+
`downloadAsync()` resolves.
|
|
181
|
+
- **Reanimated stays optional.** `getWorkletContext` and `enableExperimentalWorkletSupport` need
|
|
182
|
+
`react-native-reanimated` in your app, the package does not depend on it.
|
|
183
|
+
- **Logging is printed with `console.warn`.** `gl.__expoSetLogging(option)` prints every GL call, which
|
|
184
|
+
is slow, so switch it off once you have the answer.
|
|
185
|
+
- **Not ported.** The web build, the `nativeRef_EXPERIMENTAL` prop (hidden upstream) and upstream's one test, which is skipped there.
|
|
186
|
+
- **Not ported.** The web build, the hidden `nativeRef_EXPERIMENTAL` prop and upstream's one test (skipped there).
|
|
187
|
+
|
|
188
|
+
## Common questions
|
|
189
|
+
|
|
190
|
+
- **Black view.** Call `gl.endFrameEXP()` after drawing, then check
|
|
191
|
+
`gl.getShaderInfoLog(shader)` and `gl.getProgramInfoLog(program)`: a failed program draws nothing
|
|
192
|
+
without throwing.
|
|
193
|
+
- **Stutter.** One animated scene at a time (they share a GL thread), judge on a device (the iOS
|
|
194
|
+
Simulator renders in software), `msaaSamples={0}` and 30 fps for a full-screen shader, and
|
|
195
|
+
`precision highp float` in animated fragment shaders.
|
|
196
|
+
- **Crash in the background on iOS.** GL calls are forbidden once the app is inactive. Stop the loop
|
|
197
|
+
when `AppState` leaves `active`.
|
|
198
|
+
- **Blank texture in a release build.** Pass the asset's `localUri` after `await asset.downloadAsync()`
|
|
199
|
+
(`@symbiote-native/asset`), a not yet downloaded asset reports a name instead of a path.
|
|
200
|
+
- **Reanimated worklets.** Experimental: `enableExperimentalWorkletSupport` and
|
|
201
|
+
`getWorkletContext(gl.contextId)`, needs `react-native-reanimated` in the app.
|
|
202
|
+
- **Camera texture memory.** Call `destroyObjectAsync(texture)` when done.
|
|
203
|
+
|
|
204
|
+
Sources: [Expo docs: GLView](https://docs.expo.dev/versions/latest/sdk/gl-view/),
|
|
205
|
+
[expo/expo#7367](https://github.com/expo/expo/issues/7367),
|
|
206
|
+
[expo/expo#18483](https://github.com/expo/expo/issues/18483),
|
|
207
|
+
[expo/expo#2693](https://github.com/expo/expo/issues/2693),
|
|
208
|
+
[expo/expo#11267](https://github.com/expo/expo/issues/11267),
|
|
209
|
+
[expo/expo#12468](https://github.com/expo/expo/issues/12468).
|
|
36
210
|
|
|
37
|
-
##
|
|
211
|
+
## Test it
|
|
38
212
|
|
|
39
|
-
|
|
213
|
+
No device is needed for the logic. The core tests (`src/core/*.test.ts`) replace `expo-modules-core`
|
|
214
|
+
(`requireNativeViewManager`, `Platform`) and assert the view and the context bookkeeping. The
|
|
215
|
+
adapter tests (`src/{react,vue,solid,angular}/**/*.test.*`, `vitest`) render the real component over the
|
|
216
|
+
recording Fabric with an injected view config and assert the committed payload, and Svelte's
|
|
217
|
+
`*.smoke.test.ts` compile the `.svelte` files and mount them. Painting itself is verified on a device in
|
|
218
|
+
the six `examples/expo-*` canary apps (`examples/expo-react`, `examples/expo-vue-sfc`,
|
|
219
|
+
`examples/expo-vue-tsx`, `examples/expo-svelte`, `examples/expo-solid`, `examples/expo-angular`), see the
|
|
220
|
+
parent [README](../../README.md).
|
package/build/core/gl-view.js
CHANGED
|
@@ -20,7 +20,9 @@ function toViewProps(props) {
|
|
|
20
20
|
const onContextCreate = Reflect.get(props, 'onContextCreate');
|
|
21
21
|
return {
|
|
22
22
|
...props,
|
|
23
|
-
onContextCreate: isContextCallback(onContextCreate)
|
|
23
|
+
onContextCreate: isContextCallback(onContextCreate)
|
|
24
|
+
? onContextCreate
|
|
25
|
+
: () => undefined,
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
28
|
function nativeTagOf(camera) {
|
|
@@ -87,11 +89,17 @@ export function createGLView(_getNode) {
|
|
|
87
89
|
el(glViewName(), {
|
|
88
90
|
style: {
|
|
89
91
|
flex: 1,
|
|
90
|
-
...Platform.select({
|
|
92
|
+
...Platform.select({
|
|
93
|
+
ios: { backgroundColor: 'transparent' },
|
|
94
|
+
default: {},
|
|
95
|
+
}),
|
|
91
96
|
},
|
|
92
97
|
onSurfaceCreate,
|
|
93
98
|
enableExperimentalWorkletSupport,
|
|
94
|
-
msaaSamples: Platform.select({
|
|
99
|
+
msaaSamples: Platform.select({
|
|
100
|
+
ios: msaaSamples,
|
|
101
|
+
default: undefined,
|
|
102
|
+
}),
|
|
95
103
|
}),
|
|
96
104
|
]);
|
|
97
105
|
},
|
package/build/core/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { GL_MODULE_NAME } from './constants';
|
|
2
2
|
export { createContextAsync, destroyContextAsync, getGl, getWorkletContext, takeSnapshotAsync, } from './gl-context';
|
|
3
3
|
export { configureLogging } from './gl-utils';
|
|
4
|
-
export { createGLView, ensureGLViewRegistered, glViewName, type IGLView } from './gl-view';
|
|
4
|
+
export { createGLView, ensureGLViewRegistered, glViewName, type IGLView, } from './gl-view';
|
|
5
5
|
export { GLLoggingOption } from './types';
|
|
6
6
|
export type { IExpoWebGLRenderingContext, IGLNodeOrTag, IGLObject, IGLSnapshot, IGLSnapshotOptions, IGLSurfaceCreateEvent, IGLViewHandle, IGLViewProps, } from './types';
|
package/build/core/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { GL_MODULE_NAME } from './constants.js';
|
|
2
2
|
export { createContextAsync, destroyContextAsync, getGl, getWorkletContext, takeSnapshotAsync, } from './gl-context.js';
|
|
3
3
|
export { configureLogging } from './gl-utils.js';
|
|
4
|
-
export { createGLView, ensureGLViewRegistered, glViewName } from './gl-view.js';
|
|
4
|
+
export { createGLView, ensureGLViewRegistered, glViewName, } from './gl-view.js';
|
|
5
5
|
export { GLLoggingOption } from './types.js';
|
|
@@ -7,6 +7,7 @@ function isRunOnUI(value) {
|
|
|
7
7
|
export function createWorkletContextManager() {
|
|
8
8
|
try {
|
|
9
9
|
// Reanimated has to load before any workletized code is created
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- optional dependency, see above
|
|
10
11
|
const reanimated = require('react-native-reanimated');
|
|
11
12
|
const runOnUI = Reflect.get(Object(reanimated), 'runOnUI');
|
|
12
13
|
if (!isRunOnUI(runOnUI))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/angular/gl-view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;;AAG1C,oFAAoF;AACpF,MAAM,cAAc,GAAG;IACrB,iBAAiB;IACjB,aAAa;IACb,kCAAkC;CAC1B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/angular/gl-view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;;AAG1C,oFAAoF;AACpF,MAAM,cAAc,GAAG;IACrB,iBAAiB;IACjB,aAAa;IACb,kCAAkC;CAC1B,CAAC;AAOX,2CAA2C;AAW3C,MAAM,OAAO,MAAO,SAAQ,cAAc;IACvB,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE5D,sFAAsF;IAC7E,wBAAwB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC;IACrE,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;IACzD,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC;IAEhE,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IACpC,CAAC;IAE2B,SAAS,GAAG,cAAc,CAAC;IAEpC,UAAU,CAAC,KAAa;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAEkB,WAAW;QAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;uGApBU,MAAM;2FAAN,MAAM,2OAJP;;IAER,4DALQ,gBAAgB;;2FAOf,MAAM;kBAVlB,SAAS;mBAAC;oBACT,QAAQ,EAAE,QAAQ;oBAClB,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,MAAM,EAAE,CAAC,GAAG,cAAc,CAAC;oBAC3B,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,QAAQ,EAAE;;IAER;iBACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gl-context.js","sourceRoot":"","sources":["../../src/core/gl-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAExE,MAAM,qBAAqB,GAAG,2BAA2B,EAAE,CAAC;AAE5D,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,iBAAiB,
|
|
1
|
+
{"version":3,"file":"gl-context.js","sourceRoot":"","sources":["../../src/core/gl-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,C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AI,aAAa,GAAW,eAAe,CAAC,QAAQ,CAAC;IAErD,EAAE,CAAC,gBAAgB,GAAG,CAAC,MAAuB,EAAQ,EAAE;QACtD,2EAA2E;QAC3E,IAAI,CAAC,aAAa,KAAK,CAAC,MAAM,EAAE,CAAC;YAC/B,IAAI,MAAM;gBAAE,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC;;gBAC5C,aAAa,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC;QACD,aAAa,GAAG,MAAM,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -20,7 +20,9 @@ function toViewProps(props) {
|
|
|
20
20
|
const onContextCreate = Reflect.get(props, 'onContextCreate');
|
|
21
21
|
return {
|
|
22
22
|
...props,
|
|
23
|
-
onContextCreate: isContextCallback(onContextCreate)
|
|
23
|
+
onContextCreate: isContextCallback(onContextCreate)
|
|
24
|
+
? onContextCreate
|
|
25
|
+
: () => undefined,
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
28
|
function nativeTagOf(camera) {
|
|
@@ -87,11 +89,17 @@ export function createGLView(_getNode) {
|
|
|
87
89
|
el(glViewName(), {
|
|
88
90
|
style: {
|
|
89
91
|
flex: 1,
|
|
90
|
-
...Platform.select({
|
|
92
|
+
...Platform.select({
|
|
93
|
+
ios: { backgroundColor: 'transparent' },
|
|
94
|
+
default: {},
|
|
95
|
+
}),
|
|
91
96
|
},
|
|
92
97
|
onSurfaceCreate,
|
|
93
98
|
enableExperimentalWorkletSupport,
|
|
94
|
-
msaaSamples: Platform.select({
|
|
99
|
+
msaaSamples: Platform.select({
|
|
100
|
+
ios: msaaSamples,
|
|
101
|
+
default: undefined,
|
|
102
|
+
}),
|
|
95
103
|
}),
|
|
96
104
|
]);
|
|
97
105
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gl-view.js","sourceRoot":"","sources":["../../src/core/gl-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAC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,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,iBAAiB,EAAE,CAAC,OAA4B,EAAE,EAAE,CAClD,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC;KACxC,CAAC;IAEF,OAAO;QACL,MAAM;QACN,OAAO,EAAE,GAAG,EAAE;YACZ,IAAI,SAAS;gBAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAChD,CAAC;QACD,MAAM,EAAE,KAAK,CAAC,EAAE;YACd,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC;gBAC9B,IAAI,UAAU,EAAE;oBAAE,OAAO,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;gBAC7D,OAAO,IAAI,CAAC;YACd,CAAC;YACD,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;YACjC,MAAM,EACJ,eAAe,EACf,WAAW,GAAG,oBAAoB,EAClC,gCAAgC,GAAG,KAAK,EACxC,GAAG,SAAS,EACb,GAAG,WAAW,CAAC;YAChB,mBAAmB,CAAC,gCAAgC,CAAC,CAAC;YACtD,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE;gBAC3B,EAAE,CAAC,UAAU,EAAE,EAAE;oBACf,KAAK,EAAE;wBACL,IAAI,EAAE,CAAC;wBACP,GAAG,QAAQ,CAAC,MAAM,CAAC;4BACjB,GAAG,EAAE,EAAE,eAAe,EAAE,aAAa,EAAE;4BACvC,OAAO,EAAE,EAAE;yBACZ,CAAC;qBACH;oBACD,eAAe;oBACf,gCAAgC;oBAChC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC;wBAC3B,GAAG,EAAE,WAAW;wBAChB,OAAO,EAAE,SAAS;qBACnB,CAAC;iBACH,CAAC;aACH,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { GL_MODULE_NAME } from './constants';
|
|
2
2
|
export { createContextAsync, destroyContextAsync, getGl, getWorkletContext, takeSnapshotAsync, } from './gl-context';
|
|
3
3
|
export { configureLogging } from './gl-utils';
|
|
4
|
-
export { createGLView, ensureGLViewRegistered, glViewName, type IGLView } from './gl-view';
|
|
4
|
+
export { createGLView, ensureGLViewRegistered, glViewName, type IGLView, } from './gl-view';
|
|
5
5
|
export { GLLoggingOption } from './types';
|
|
6
6
|
export type { IExpoWebGLRenderingContext, IGLNodeOrTag, IGLObject, IGLSnapshot, IGLSnapshotOptions, IGLSurfaceCreateEvent, IGLViewHandle, IGLViewProps, } from './types';
|
package/build-ngc/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { GL_MODULE_NAME } from './constants';
|
|
2
2
|
export { createContextAsync, destroyContextAsync, getGl, getWorkletContext, takeSnapshotAsync, } from './gl-context';
|
|
3
3
|
export { configureLogging } from './gl-utils';
|
|
4
|
-
export { createGLView, ensureGLViewRegistered, glViewName } from './gl-view';
|
|
4
|
+
export { createGLView, ensureGLViewRegistered, glViewName, } from './gl-view';
|
|
5
5
|
export { GLLoggingOption } from './types';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,UAAU,GAEX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAmB7C,MAAM,CAAC,MAAM,cAAc,GACzB,mBAAmB,CAAkB,cAAc,CAAC,CAAC"}
|
|
@@ -7,6 +7,7 @@ function isRunOnUI(value) {
|
|
|
7
7
|
export function createWorkletContextManager() {
|
|
8
8
|
try {
|
|
9
9
|
// Reanimated has to load before any workletized code is created
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- optional dependency, see above
|
|
10
11
|
const reanimated = require('react-native-reanimated');
|
|
11
12
|
const runOnUI = Reflect.get(Object(reanimated), 'runOnUI');
|
|
12
13
|
if (!isRunOnUI(runOnUI))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worklet-context-manager.js","sourceRoot":"","sources":["../../src/core/worklet-context-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"worklet-context-manager.js","sourceRoot":"","sources":["../../src/core/worklet-context-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAYjD,SAAS,SAA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"0.1.0",
|
|
4
4
|
"description": "expo-gl wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. A GLView that gives a WebGL context to draw into, headless contexts and snapshots.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"expo-gl": "57.0.2",
|
|
70
70
|
"expo-modules-core": "57.0.20",
|
|
71
|
-
"@symbiote-native/components": "3.
|
|
71
|
+
"@symbiote-native/components": "3.2.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@angular/core": ">=20",
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
"solid-js": ">=1.9.0",
|
|
79
79
|
"svelte": ">=5.56.0",
|
|
80
80
|
"vue": ">=3.5.0",
|
|
81
|
-
"@symbiote-native/
|
|
82
|
-
"@symbiote-native/
|
|
83
|
-
"@symbiote-native/react": "^3.
|
|
84
|
-
"@symbiote-native/solid": "^3.
|
|
85
|
-
"@symbiote-native/svelte": "^3.
|
|
86
|
-
"@symbiote-native/vue": "^3.
|
|
81
|
+
"@symbiote-native/angular": "^3.3.0",
|
|
82
|
+
"@symbiote-native/engine": "^1.6.0",
|
|
83
|
+
"@symbiote-native/react": "^3.3.0",
|
|
84
|
+
"@symbiote-native/solid": "^3.2.0",
|
|
85
|
+
"@symbiote-native/svelte": "^3.2.0",
|
|
86
|
+
"@symbiote-native/vue": "^3.3.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@symbiote-native/angular": {
|
|
@@ -131,13 +131,13 @@
|
|
|
131
131
|
"solid-js": "^1.9.14",
|
|
132
132
|
"svelte": "^5.56.0",
|
|
133
133
|
"typescript": "~6.0.0",
|
|
134
|
-
"@symbiote-native/angular": "3.
|
|
135
|
-
"@symbiote-native/engine": "1.
|
|
136
|
-
"@symbiote-native/react": "3.
|
|
137
|
-
"@symbiote-native/
|
|
138
|
-
"@symbiote-native/svelte": "3.
|
|
139
|
-
"@symbiote-native/
|
|
140
|
-
"@symbiote-native/
|
|
134
|
+
"@symbiote-native/angular": "3.3.0",
|
|
135
|
+
"@symbiote-native/engine": "1.6.0",
|
|
136
|
+
"@symbiote-native/react": "3.3.0",
|
|
137
|
+
"@symbiote-native/solid": "3.2.0",
|
|
138
|
+
"@symbiote-native/svelte": "3.2.0",
|
|
139
|
+
"@symbiote-native/test-utils": "0.4.7",
|
|
140
|
+
"@symbiote-native/vue": "3.3.0"
|
|
141
141
|
},
|
|
142
142
|
"scripts": {
|
|
143
143
|
"typecheck": "tsc --build",
|
|
@@ -12,8 +12,9 @@ const GL_VIEW_INPUTS = [
|
|
|
12
12
|
] as const;
|
|
13
13
|
|
|
14
14
|
// Types the inputs for the template, the decorators that would do it are replaced by `inputs`
|
|
15
|
-
export interface GLView
|
|
16
|
-
|
|
15
|
+
export interface GLView extends Partial<
|
|
16
|
+
Pick<IGLViewProps, (typeof GL_VIEW_INPUTS)[number]>
|
|
17
|
+
> {}
|
|
17
18
|
|
|
18
19
|
/** Angular twin of `expo-gl`'s `GLView` */
|
|
19
20
|
@Component({
|
package/src/core/gl-context.ts
CHANGED
|
@@ -16,7 +16,9 @@ function isContext(value: unknown): value is IExpoWebGLRenderingContext {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/** The context of a worklet, `exgl` has to be created with worklet support */
|
|
19
|
-
export function getWorkletContext(
|
|
19
|
+
export function getWorkletContext(
|
|
20
|
+
contextId: number,
|
|
21
|
+
): IExpoWebGLRenderingContext | undefined {
|
|
20
22
|
'worklet';
|
|
21
23
|
return workletContextManager.getContext(contextId);
|
|
22
24
|
}
|
|
@@ -37,12 +39,15 @@ export function getGl(exglCtxId: number): IExpoWebGLRenderingContext {
|
|
|
37
39
|
);
|
|
38
40
|
}
|
|
39
41
|
const gl: unknown = Reflect.get(Object(contexts), String(exglCtxId));
|
|
40
|
-
if (!isContext(gl))
|
|
42
|
+
if (!isContext(gl))
|
|
43
|
+
throw new Error(`There is no EXGLContext with id ${exglCtxId}`);
|
|
41
44
|
configureLogging(gl);
|
|
42
45
|
return gl;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
export function getContextId(
|
|
48
|
+
export function getContextId(
|
|
49
|
+
exgl?: IExpoWebGLRenderingContext | number,
|
|
50
|
+
): number {
|
|
46
51
|
const exglCtxId = exgl && typeof exgl === 'object' ? exgl.contextId : exgl;
|
|
47
52
|
if (!exglCtxId || typeof exglCtxId !== 'number') {
|
|
48
53
|
throw new Error(`Invalid EXGLContext id: ${String(exglCtxId)}`);
|
package/src/core/gl-utils.ts
CHANGED
|
@@ -40,10 +40,14 @@ function describeArg(gl: object, option: number, arg: unknown): string {
|
|
|
40
40
|
|
|
41
41
|
// The original `getError`, a wrapped one would log itself
|
|
42
42
|
function reportError(gl: object): void {
|
|
43
|
-
const getError: unknown = Reflect.get(
|
|
43
|
+
const getError: unknown = Reflect.get(
|
|
44
|
+
Reflect.getPrototypeOf(gl) ?? {},
|
|
45
|
+
'getError',
|
|
46
|
+
);
|
|
44
47
|
if (!isGLFunction(getError)) return;
|
|
45
48
|
const error = getError.call(gl);
|
|
46
|
-
if (typeof error !== 'number' || error === Reflect.get(gl, 'NO_ERROR'))
|
|
49
|
+
if (typeof error !== 'number' || error === Reflect.get(gl, 'NO_ERROR'))
|
|
50
|
+
return;
|
|
47
51
|
console.warn(`\x1b[31mExpoGL: Error ${GL_ERRORS[error]}\x1b[0m`);
|
|
48
52
|
}
|
|
49
53
|
|
|
@@ -60,8 +64,10 @@ function wrapMethod(
|
|
|
60
64
|
console.warn(`ExpoGL: ${key}(${params.join(', ')})`);
|
|
61
65
|
}
|
|
62
66
|
const result = original.apply(gl, args);
|
|
63
|
-
if (option & GLLoggingOption.METHOD_CALLS)
|
|
64
|
-
|
|
67
|
+
if (option & GLLoggingOption.METHOD_CALLS)
|
|
68
|
+
console.warn(`ExpoGL: = ${String(result)}`);
|
|
69
|
+
if (option & GLLoggingOption.GET_ERRORS && key !== 'getError')
|
|
70
|
+
reportError(gl);
|
|
65
71
|
return result;
|
|
66
72
|
};
|
|
67
73
|
wrappers.add(wrapper);
|
|
@@ -69,7 +75,9 @@ function wrapMethod(
|
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
function wrapMethods(gl: object, getOption: () => number): void {
|
|
72
|
-
for (const [key, original] of Object.entries(
|
|
78
|
+
for (const [key, original] of Object.entries(
|
|
79
|
+
Reflect.getPrototypeOf(gl) ?? {},
|
|
80
|
+
)) {
|
|
73
81
|
if (isGLFunction(original) && key !== SET_LOGGING_KEY) {
|
|
74
82
|
wrapMethod(gl, key, original, getOption);
|
|
75
83
|
}
|
|
@@ -78,7 +86,8 @@ function wrapMethods(gl: object, getOption: () => number): void {
|
|
|
78
86
|
|
|
79
87
|
function unwrapMethods(gl: object): void {
|
|
80
88
|
for (const [key, value] of Object.entries(gl)) {
|
|
81
|
-
if (isGLFunction(value) && wrappers.has(value))
|
|
89
|
+
if (isGLFunction(value) && wrappers.has(value))
|
|
90
|
+
Reflect.deleteProperty(gl, key);
|
|
82
91
|
}
|
|
83
92
|
}
|
|
84
93
|
|
package/src/core/gl-view.ts
CHANGED
|
@@ -46,7 +46,9 @@ function isSurfaceCreated(value: unknown): value is { exglCtxId: number } {
|
|
|
46
46
|
return typeof Reflect.get(Object(value), 'exglCtxId') === 'number';
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
function isContextCallback(
|
|
49
|
+
function isContextCallback(
|
|
50
|
+
value: unknown,
|
|
51
|
+
): value is IGLViewProps['onContextCreate'] {
|
|
50
52
|
return typeof value === 'function';
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -55,13 +57,16 @@ function toViewProps(props: object): IGLViewProps {
|
|
|
55
57
|
const onContextCreate: unknown = Reflect.get(props, 'onContextCreate');
|
|
56
58
|
return {
|
|
57
59
|
...props,
|
|
58
|
-
onContextCreate: isContextCallback(onContextCreate)
|
|
60
|
+
onContextCreate: isContextCallback(onContextCreate)
|
|
61
|
+
? onContextCreate
|
|
62
|
+
: () => undefined,
|
|
59
63
|
};
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
function nativeTagOf(camera: IGLNodeOrTag): number {
|
|
63
67
|
const tag = isSymbioteNode(camera) ? getNativeTag(camera) : camera;
|
|
64
|
-
if (typeof tag !== 'number')
|
|
68
|
+
if (typeof tag !== 'number')
|
|
69
|
+
throw new Error('The camera view has no native tag yet');
|
|
65
70
|
return tag;
|
|
66
71
|
}
|
|
67
72
|
|
|
@@ -79,7 +84,9 @@ export function createGLView(_getNode: IGetNode): IGLView {
|
|
|
79
84
|
|
|
80
85
|
function warnOnWorkletChange(enabled: boolean): void {
|
|
81
86
|
if (hasWorkletSupport !== undefined && hasWorkletSupport !== enabled) {
|
|
82
|
-
console.warn(
|
|
87
|
+
console.warn(
|
|
88
|
+
'Updating prop enableExperimentalWorkletSupport is not supported',
|
|
89
|
+
);
|
|
83
90
|
}
|
|
84
91
|
hasWorkletSupport = enabled;
|
|
85
92
|
}
|
|
@@ -90,7 +97,10 @@ export function createGLView(_getNode: IGetNode): IGLView {
|
|
|
90
97
|
},
|
|
91
98
|
async createCameraTextureAsync(camera) {
|
|
92
99
|
if (!glNativeModule.createCameraTextureAsync) {
|
|
93
|
-
throw new UnavailabilityError(
|
|
100
|
+
throw new UnavailabilityError(
|
|
101
|
+
GL_PACKAGE_NAME,
|
|
102
|
+
'createCameraTextureAsync',
|
|
103
|
+
);
|
|
94
104
|
}
|
|
95
105
|
if (!exglCtxId) throw new Error("GLView's surface is not created yet!");
|
|
96
106
|
const { exglObjId } = await glNativeModule.createCameraTextureAsync(
|
|
@@ -106,7 +116,8 @@ export function createGLView(_getNode: IGetNode): IGLView {
|
|
|
106
116
|
}
|
|
107
117
|
return glNativeModule.destroyObjectAsync(glObject.id);
|
|
108
118
|
},
|
|
109
|
-
takeSnapshotAsync: (options?: IGLSnapshotOptions) =>
|
|
119
|
+
takeSnapshotAsync: (options?: IGLSnapshotOptions) =>
|
|
120
|
+
takeSnapshotAsync(exglCtxId, options),
|
|
110
121
|
};
|
|
111
122
|
|
|
112
123
|
return {
|
|
@@ -131,11 +142,17 @@ export function createGLView(_getNode: IGetNode): IGLView {
|
|
|
131
142
|
el(glViewName(), {
|
|
132
143
|
style: {
|
|
133
144
|
flex: 1,
|
|
134
|
-
...Platform.select({
|
|
145
|
+
...Platform.select({
|
|
146
|
+
ios: { backgroundColor: 'transparent' },
|
|
147
|
+
default: {},
|
|
148
|
+
}),
|
|
135
149
|
},
|
|
136
150
|
onSurfaceCreate,
|
|
137
151
|
enableExperimentalWorkletSupport,
|
|
138
|
-
msaaSamples: Platform.select({
|
|
152
|
+
msaaSamples: Platform.select({
|
|
153
|
+
ios: msaaSamples,
|
|
154
|
+
default: undefined,
|
|
155
|
+
}),
|
|
139
156
|
}),
|
|
140
157
|
]);
|
|
141
158
|
},
|
package/src/core/index.ts
CHANGED
|
@@ -7,7 +7,12 @@ export {
|
|
|
7
7
|
takeSnapshotAsync,
|
|
8
8
|
} from './gl-context';
|
|
9
9
|
export { configureLogging } from './gl-utils';
|
|
10
|
-
export {
|
|
10
|
+
export {
|
|
11
|
+
createGLView,
|
|
12
|
+
ensureGLViewRegistered,
|
|
13
|
+
glViewName,
|
|
14
|
+
type IGLView,
|
|
15
|
+
} from './gl-view';
|
|
11
16
|
export { GLLoggingOption } from './types';
|
|
12
17
|
export type {
|
|
13
18
|
IExpoWebGLRenderingContext,
|
|
@@ -5,7 +5,10 @@ import type { IGLSnapshot, IGLSnapshotOptions } from './types';
|
|
|
5
5
|
export type INativeGLModule = {
|
|
6
6
|
createContextAsync(): Promise<{ exglCtxId: number }>;
|
|
7
7
|
destroyContextAsync(exglCtxId: number): Promise<boolean>;
|
|
8
|
-
takeSnapshotAsync(
|
|
8
|
+
takeSnapshotAsync(
|
|
9
|
+
exglCtxId: number,
|
|
10
|
+
options: IGLSnapshotOptions,
|
|
11
|
+
): Promise<IGLSnapshot>;
|
|
9
12
|
/** Absent where there is no camera texture support */
|
|
10
13
|
createCameraTextureAsync?(
|
|
11
14
|
exglCtxId: number,
|
|
@@ -15,4 +18,5 @@ export type INativeGLModule = {
|
|
|
15
18
|
destroyObjectAsync?(exglObjId: number): Promise<boolean>;
|
|
16
19
|
};
|
|
17
20
|
|
|
18
|
-
export const glNativeModule =
|
|
21
|
+
export const glNativeModule =
|
|
22
|
+
requireNativeModule<INativeGLModule>(GL_MODULE_NAME);
|
package/src/core/types.ts
CHANGED
|
@@ -59,17 +59,17 @@ export type IGLNodeOrTag = number | ISymbioteNode | null;
|
|
|
59
59
|
export type IGLViewProps = IAccessibilityProps &
|
|
60
60
|
IAriaProps &
|
|
61
61
|
IResponderProps & {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
62
|
+
style?: IStyleProp<IViewStyle>;
|
|
63
|
+
testID?: string;
|
|
64
|
+
nativeID?: string;
|
|
65
|
+
onLayout?: (event: ISymbioteEvent) => void;
|
|
66
|
+
/** Called with the context once the surface exists */
|
|
67
|
+
onContextCreate(gl: IExpoWebGLRenderingContext): void;
|
|
68
|
+
/** Multisampling, `0` turns it off. @default 4 @platform ios */
|
|
69
|
+
msaaSamples?: number;
|
|
70
|
+
/** Lets the Reanimated worklet thread use the `gl` object. @default false */
|
|
71
|
+
enableExperimentalWorkletSupport?: boolean;
|
|
72
|
+
};
|
|
73
73
|
|
|
74
74
|
export enum GLLoggingOption {
|
|
75
75
|
DISABLED = 0,
|
|
@@ -6,7 +6,9 @@ export type IWorkletContextManager = {
|
|
|
6
6
|
unregister?(contextId: number): void;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
type IRunOnUI = (
|
|
9
|
+
type IRunOnUI = (
|
|
10
|
+
worklet: (contextId: number) => void,
|
|
11
|
+
) => (contextId: number) => void;
|
|
10
12
|
|
|
11
13
|
function isRunOnUI(value: unknown): value is IRunOnUI {
|
|
12
14
|
return typeof value === 'function';
|
|
@@ -17,18 +19,26 @@ function isRunOnUI(value: unknown): value is IRunOnUI {
|
|
|
17
19
|
export function createWorkletContextManager(): IWorkletContextManager {
|
|
18
20
|
try {
|
|
19
21
|
// Reanimated has to load before any workletized code is created
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- optional dependency, see above
|
|
20
23
|
const reanimated: unknown = require('react-native-reanimated');
|
|
21
24
|
const runOnUI = Reflect.get(Object(reanimated), 'runOnUI');
|
|
22
|
-
if (!isRunOnUI(runOnUI))
|
|
25
|
+
if (!isRunOnUI(runOnUI))
|
|
26
|
+
throw new Error('react-native-reanimated has no runOnUI');
|
|
23
27
|
return {
|
|
24
28
|
getContext: contextId => {
|
|
25
29
|
'worklet';
|
|
26
|
-
return Reflect.get(
|
|
30
|
+
return Reflect.get(
|
|
31
|
+
Object(Reflect.get(globalThis, GL_CONTEXTS_GLOBAL)),
|
|
32
|
+
String(contextId),
|
|
33
|
+
);
|
|
27
34
|
},
|
|
28
35
|
unregister: contextId => {
|
|
29
36
|
runOnUI(id => {
|
|
30
37
|
'worklet';
|
|
31
|
-
Reflect.deleteProperty(
|
|
38
|
+
Reflect.deleteProperty(
|
|
39
|
+
Object(Reflect.get(globalThis, GL_CONTEXTS_GLOBAL)),
|
|
40
|
+
String(id),
|
|
41
|
+
);
|
|
32
42
|
})(contextId);
|
|
33
43
|
},
|
|
34
44
|
};
|
package/src/react/gl-view.ts
CHANGED
|
@@ -9,6 +9,9 @@ export type IGLViewReactProps = IGLViewProps & {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
/** React twin of `expo-gl`'s `GLView` */
|
|
12
|
-
export function GLView({
|
|
12
|
+
export function GLView({
|
|
13
|
+
ref,
|
|
14
|
+
...props
|
|
15
|
+
}: IGLViewReactProps): ReactElement | null {
|
|
13
16
|
return useNativeViewController(ref, createGLView, props);
|
|
14
17
|
}
|
package/src/solid/gl-view.ts
CHANGED
|
@@ -3,4 +3,6 @@ import { createGLView } from '../core';
|
|
|
3
3
|
import type { IGLViewHandle, IGLViewProps } from '../core';
|
|
4
4
|
|
|
5
5
|
/** Solid twin of `expo-gl`'s `GLView`, `ref` gets the handle of the view */
|
|
6
|
-
export const GLView = defineNativeViewComponent<IGLViewHandle, IGLViewProps>(
|
|
6
|
+
export const GLView = defineNativeViewComponent<IGLViewHandle, IGLViewProps>(
|
|
7
|
+
createGLView,
|
|
8
|
+
);
|