glre 0.22.0 → 0.24.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.
Files changed (50) hide show
  1. package/README.md +19 -28
  2. package/dist/index.d.ts +49 -222
  3. package/dist/index.js +43 -37
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +43 -37
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/native.d.ts +49 -5
  8. package/dist/native.js +43 -37
  9. package/dist/native.js.map +1 -1
  10. package/dist/native.mjs +43 -37
  11. package/dist/native.mjs.map +1 -1
  12. package/dist/react.d.ts +1 -2
  13. package/dist/react.js +43 -37
  14. package/dist/react.js.map +1 -1
  15. package/dist/react.mjs +43 -37
  16. package/dist/react.mjs.map +1 -1
  17. package/dist/solid.d.ts +1 -2
  18. package/dist/solid.js +43 -37
  19. package/dist/solid.js.map +1 -1
  20. package/dist/solid.mjs +43 -37
  21. package/dist/solid.mjs.map +1 -1
  22. package/package.json +5 -1
  23. package/src/code/glsl.ts +7 -45
  24. package/src/code/wgsl.ts +10 -46
  25. package/src/index.ts +34 -35
  26. package/src/native.ts +9 -4
  27. package/src/node/cache.ts +3 -10
  28. package/src/node/const.ts +2 -19
  29. package/src/node/conv.ts +6 -17
  30. package/src/node/index.ts +5 -8
  31. package/src/node/node.ts +8 -22
  32. package/src/node/uniform.ts +6 -13
  33. package/src/react.ts +0 -1
  34. package/src/solid.ts +0 -1
  35. package/src/types.ts +21 -21
  36. package/src/{utils.ts → utils/helpers.ts} +0 -9
  37. package/src/utils/pipeline.ts +124 -0
  38. package/src/utils/program.ts +94 -0
  39. package/src/webgl.ts +77 -0
  40. package/src/webgpu.ts +102 -0
  41. package/src/webgl/buffer.ts +0 -78
  42. package/src/webgl/index.ts +0 -79
  43. package/src/webgl/program.ts +0 -61
  44. package/src/webgl/shader.ts +0 -60
  45. package/src/webgl/texture.ts +0 -93
  46. package/src/webgpu/buffer.ts +0 -96
  47. package/src/webgpu/device.ts +0 -91
  48. package/src/webgpu/index.ts +0 -40
  49. package/src/webgpu/pipeline.ts +0 -94
  50. package/src/webgpu/texture.ts +0 -139
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  [![ docs available ](https://img.shields.io/badge/docs-available-000.svg?style=flat&colorA=000)](https://glre.tsei.jp/>)
12
12
  [![ bundle size ](https://img.shields.io/bundlephobia/minzip/glre?style=flat&colorA=000&colorB=000)](https://bundlephobia.com/package/glre@latest)
13
13
 
14
- glre is a simple glsl Reactive Engine on the web and native via TypeScript, React, Solid and more.
14
+ glre is a simple glsl and wgsl Reactive Engine on the web and native via TypeScript, React, Solid and more.
15
15
 
16
16
  </p>
17
17
  <p align="center" valign="top">
@@ -101,7 +101,7 @@ npm install glre
101
101
  <tbody>
102
102
  <tr>
103
103
  <td width="7500px" align="center" valign="center">
104
- glre simplifies glsl programming via TypeScript, React, Solid and more (<a href="https://codesandbox.io/s/glre-basic-demo-ppzo3d">live demo</a>).
104
+ glre simplifies WebGl2 / WebGPU programming via TypeScript, React, Solid and more (<a href="https://codesandbox.io/s/glre-basic-demo-ppzo3d">live demo</a>).
105
105
  </td>
106
106
  <td width="2500px" valign="top">
107
107
  <a href="https://codesandbox.io/s/glre-basic-demo-ppzo3d">
@@ -114,11 +114,11 @@ npm install glre
114
114
 
115
115
  ```ts
116
116
  import { createRoot } from 'react-dom/client'
117
- import { useGL, vec4, fract, gl_FragCoord, iResolution } from 'glre/react'
118
- const fragment = vec4(fract(gl_FragCoord.xy / iResolution), 0, 1)
117
+ import { useGL, vec4, fract, fragCoord, iResolution } from 'glre/react'
118
+ const frag = vec4(fract(fragCoord.xy / iResolution), 0, 1)
119
119
 
120
120
  const App = () => {
121
- const gl = useGL({ fragment })
121
+ const gl = useGL({ frag })
122
122
  return <canvas ref={gl.ref} />
123
123
  }
124
124
 
@@ -136,16 +136,10 @@ react-native supported ([codesandbox demo](https://codesandbox.io/p/sandbox/glre
136
136
  import { GLView } from 'expo-gl'
137
137
  import { registerRootComponent } from 'expo'
138
138
  import { useGL, vec4, fract, fragCoord, iResolution } from 'glre/native'
139
- const fragment = vec4(fract(fragCoord.xy / iResolution), 0, 1)
139
+ const frag = vec4(fract(fragCoord.xy / iResolution), 0, 1)
140
140
 
141
141
  const App = () => {
142
- const { gl, ref } = useGL({
143
- fragment,
144
- render() {
145
- gl.flush()
146
- gl.endFrameEXP()
147
- },
148
- })
142
+ const { gl, ref } = useGL({ frag })
149
143
  return <GLView style={{ flex: 1 }} onContextCreate={ref} />
150
144
  }
151
145
 
@@ -163,10 +157,10 @@ solid js supported ([codesandbox demo](https://codesandbox.io/p/sandbox/glre-sol
163
157
  ```ts
164
158
  import { render } from 'solid-js/web'
165
159
  import { onGL, vec4, fract, fragCoord, iResolution } from 'glre/solid'
166
- const fragment = vec4(fract(fragCoord.xy / iResolution), 0, 1)
160
+ const frag = vec4(fract(fragCoord.xy / iResolution), 0, 1)
167
161
 
168
162
  const App = () => {
169
- const gl = onGL({ fragment })
163
+ const gl = onGL({ frag })
170
164
  return <canvas ref={gl.ref} />
171
165
  }
172
166
 
@@ -177,21 +171,18 @@ render(() => <App />, document.getElementById('root'))
177
171
  <details>
178
172
  <summary>
179
173
 
180
- pure js supported ([codesandbox demo](https://codesandbox.io/s/glre-basic-demo3-3bhr3y))
174
+ esm supported ([codesandbox demo](https://codesandbox.io/s/glre-basic-demo3-3bhr3y))
181
175
 
182
176
  </summary>
183
177
 
184
178
  ```html
185
- <canvas id="id" style="top: 0; left: 0; position: fixed" />
186
179
  <script type="module">
187
- import createGL from 'https://cdn.skypack.dev/glre@latest'
188
- import { vec4, fract, fragCoord, iResolution } from 'glre'
189
- const fragment = vec4(fract(fragCoord.xy / iResolution), 0, 1)
190
-
180
+ import { createGL, vec4, fract, fragCoord, iResolution } from 'https://esm.sh/glre'
181
+ const frag = vec4(fract(fragCoord.xy / iResolution), 0, 1)
191
182
  function App() {
192
- const el = document.getElementById('id')
193
- const gl = el.getContext('webgl2')
194
- createGL({ el, gl, fragment }).mount()
183
+ const el = document.createElement('canvas')
184
+ createGL({ el, frag }).mount()
185
+ document.body.append(el)
195
186
  }
196
187
  document.addEventListener('DOMContentLoaded', App)
197
188
  </script>
@@ -203,7 +194,7 @@ pure js supported ([codesandbox demo](https://codesandbox.io/s/glre-basic-demo3-
203
194
 
204
195
  ## Node System
205
196
 
206
- glre now features a powerful node-based shader system inspired by Three.js Shading Language (TSL). This system allows you to write shaders using TypeScript-like syntax and automatically handles the conversion to both WebGL and WebGPU shaders.
197
+ glre now features a powerful node-based shader system inspired by Three.js Shading Language (TSL). This system allows you to write shaders using TypeScript-like syntax and automatically handles the conversion to both WebGL2 and WebGPU shaders.
207
198
 
208
199
  The node system provides a declarative approach to shader creation, making your code more readable, maintainable, and portable across different rendering backends.
209
200
 
@@ -216,7 +207,7 @@ The node system provides various types and functions that mirror GLSL functional
216
207
  import { float, int, vec2, vec3, vec4, mat3, mat4 } from 'glre'
217
208
 
218
209
  // Built-in variables
219
- import { gl_FragCoord, gl_Position, iResolution, iTime } from 'glre'
210
+ import { fragCoord, gl_Position, iResolution, iTime } from 'glre'
220
211
 
221
212
  // Math functions
222
213
  import { sin, cos, abs, pow, mix, clamp, normalize } from 'glre'
@@ -307,9 +298,9 @@ const App = () => {
307
298
  createRoot(document.getElementById('root')).render(<App />)
308
299
  ```
309
300
 
310
- ### WebGPU Support
301
+ ### WebGL2 and WebGPU Support
311
302
 
312
- The node system is designed to work with both WebGL and WebGPU, providing a seamless transition path as browsers adopt the new standard. Your shader code written with the node system will automatically compile to the appropriate shading language based on the available renderer.
303
+ The node system is designed to work with both WebGL2 and WebGPU, providing a seamless transition path as browsers adopt the new standard. Your shader code written with the node system will automatically compile to the appropriate shading language (GLSL ES 3.0 for WebGL2, WGSL for WebGPU) based on the available renderer.
313
304
 
314
305
  ## PRs
315
306
 
package/dist/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
- import * as reev from 'reev';
2
- import { EventState, Nested } from 'reev';
3
1
  import * as refr from 'refr';
4
2
  import { Queue, Frame } from 'refr';
5
3
  export { Frame, Fun, Queue } from 'refr';
6
- import * as refr_dist_types_687121c7 from 'refr/dist/types-687121c7';
4
+ import { EventState } from 'reev';
7
5
 
8
6
  declare const TYPES: readonly ["float", "int", "uint", "bool", "color", "vec2", "vec3", "vec4", "mat2", "mat3", "mat4", "ivec2", "ivec3", "ivec4", "uvec2", "uvec3", "uvec4", "bvec2", "bvec3", "bvec4"];
9
7
  type NodeType = (typeof TYPES)[number];
@@ -126,8 +124,8 @@ declare const updateUniforms: (context: UpdateContext) => void;
126
124
 
127
125
  declare const Fn: (jsFunc: Function) => FunctionNode;
128
126
  declare const If: (condition: X, callback: () => void) => ConditionalNode;
129
- declare const gl_FragCoord: X;
130
- declare const gl_Position: X;
127
+ declare const fragCoord: X;
128
+ declare const position: X;
131
129
  declare const iTime: UniformNode;
132
130
  declare const iResolution: UniformNode;
133
131
  declare const iMouse: UniformNode;
@@ -142,14 +140,28 @@ declare const fract: (x: X) => X;
142
140
  declare const normalize: (x: X) => X;
143
141
  declare const length: (x: X) => X;
144
142
 
143
+ type GPUContext = any;
144
+ type GPUDevice = any;
145
+ type GPUBuffer = any;
146
+ type GPUPipeline = any;
147
+ type GPUBindGroup = any;
145
148
  type Uniform = number | number[];
146
149
  type Attribute = number[];
147
150
  type Attributes = Record<string, Attribute>;
148
151
  type Uniforms = Record<string, Uniform>;
149
152
  type PrecisionMode = 'highp' | 'mediump' | 'lowp';
150
153
  type GLClearMode = 'COLOR_BUFFER_BIT' | 'DEPTH_BUFFER_BIT' | 'STENCIL_BUFFER_BIT';
151
- type GLDrawMode = 'POINTS' | 'LINE_STRIP' | 'LINE_LOOP' | 'LINES' | 'TRIANGLE_STRIP' | 'TRIANGLE_FAN' | 'TRIANGLES';
152
154
  type GLDrawType = 'UNSIGNED_BYTE' | 'UNSIGNED_SHORT' | 'UNSIGNED_INT';
155
+ type GLDrawMode = 'POINTS' | 'LINE_STRIP' | 'LINE_LOOP' | 'LINES' | 'TRIANGLE_STRIP' | 'TRIANGLE_FAN' | 'TRIANGLES';
156
+ interface WebGLState {
157
+ context: WebGLRenderingContext;
158
+ program: WebGLProgram;
159
+ }
160
+ interface WebGPUState {
161
+ device: GPUDevice;
162
+ context: GPUContext;
163
+ pipeline: GPUPipeline;
164
+ }
153
165
  type GL = EventState<{
154
166
  /**
155
167
  * initial value
@@ -163,32 +175,20 @@ type GL = EventState<{
163
175
  size: [number, number];
164
176
  mouse: [number, number];
165
177
  count: number;
178
+ el: HTMLCanvasElement;
166
179
  vs: string | X;
167
180
  fs: string | X;
168
181
  vert: string | X;
169
182
  frag: string | X;
170
183
  vertex: string | X;
171
184
  fragment: string | X;
172
- /**
173
- * for webgl
174
- */
175
- int: PrecisionMode;
176
- float: PrecisionMode;
177
- sampler2D: PrecisionMode;
178
- samplerCube: PrecisionMode;
179
- lastActiveUnit: number;
180
185
  /**
181
186
  * core state
182
187
  */
183
- gl: any;
184
- pg: any;
185
- el: any;
188
+ webgpu: WebGPUState;
189
+ webgl: WebGLState;
186
190
  queue: Queue;
187
191
  frame: Frame;
188
- stride: Nested<number>;
189
- location: Nested<any>;
190
- activeUnit: Nested<number>;
191
- default: any;
192
192
  /**
193
193
  * events
194
194
  */
@@ -254,8 +254,6 @@ declare const is: {
254
254
  obj: (a: unknown) => a is object;
255
255
  nan: (a: unknown) => a is number;
256
256
  };
257
- declare const isServer: () => boolean;
258
- declare const isWebGPUSupported: () => boolean;
259
257
  /**
260
258
  * each
261
259
  */
@@ -274,200 +272,38 @@ declare const fig: (x?: number) => number;
274
272
  declare const dig: (x?: number) => number;
275
273
  declare const sig: (value?: number, digit?: number) => number;
276
274
 
277
- declare const createVbo: (c: WebGLRenderingContext, data: number[]) => WebGLBuffer;
278
- declare const createIbo: (c: WebGLRenderingContext, data: number[]) => WebGLBuffer;
279
- declare const createAttribute: (c: WebGLRenderingContext, stride: number, location: number, vbo: WebGLBuffer, ibo?: WebGLBuffer) => void;
280
- declare const deleteBuffer: (c: WebGLRenderingContext, buffer: WebGLBuffer) => void;
281
- declare const vertexStride: (count: number, value: number[], iboValue?: number[]) => number;
282
- declare const updateVbo: (c: WebGLRenderingContext, buffer: WebGLBuffer, data: number[], usage?: 35044) => void;
283
- declare const updateIbo: (c: WebGLRenderingContext, buffer: WebGLBuffer, data: number[], usage?: 35044) => void;
284
-
285
- declare const createProgram: (c: WebGLRenderingContext, vs: WebGLShader, fs: WebGLShader) => WebGLProgram;
286
- declare const deleteProgram: (c: WebGLRenderingContext, pg: WebGLProgram) => void;
287
- declare const getProgramInfo: (c: WebGLRenderingContext, pg: WebGLProgram) => {
288
- linked: any;
289
- log: string | null;
290
- activeAttributes: any;
291
- activeUniforms: any;
292
- };
293
- declare const getUniformType: (value: number | number[], isMatrix?: boolean) => string;
294
- declare const getUniformLocation: (c: WebGLRenderingContext, pg: WebGLProgram, name: string) => WebGLUniformLocation | null;
295
- declare const getAttribLocation: (c: WebGLRenderingContext, pg: WebGLProgram, name: string) => number;
296
-
297
- declare const deleteShader: (c: WebGLRenderingContext, shader: WebGLShader) => void;
298
- declare const createVertexShader: (c: WebGLRenderingContext, source?: string) => WebGLShader;
299
- declare const createFragmentShader: (c: WebGLRenderingContext, source?: string) => WebGLShader;
300
- declare const getShaderInfo: (c: WebGLRenderingContext, shader: WebGLShader) => {
301
- compiled: any;
302
- log: string | null;
303
- source: string | null;
275
+ declare const createPipeline: (device: GPUDevice, format: string, vs: string | undefined, fs: string | undefined, buffers: any[]) => GPUPipeline;
276
+ declare const createDescriptor: (c: GPUContext) => {
277
+ colorAttachments: {
278
+ view: any;
279
+ clearValue: {
280
+ r: number;
281
+ g: number;
282
+ b: number;
283
+ a: number;
284
+ };
285
+ loadOp: string;
286
+ storeOp: string;
287
+ }[];
304
288
  };
305
289
 
290
+ declare const defaultVertexGLSL = "\n#version 300 es\nvoid main() {\n float x = float(gl_VertexID % 2) * 4.0 - 1.0;\n float y = float(gl_VertexID / 2) * 4.0 - 1.0;\n gl_Position = vec4(x, y, 0.0, 1.0);\n}\n";
291
+ declare const defaultFragmentGLSL = "\n#version 300 es\nprecision mediump float;\nuniform vec2 iResolution;\nout vec4 fragColor;\nvoid main() {\n fragColor = vec4(fract(gl_FragCoord.xy / iResolution), 0, 1);\n}\n";
292
+ declare const createShader: (c: WebGLRenderingContext, source: string, type: number) => WebGLShader;
293
+ declare const createProgram: (c: WebGLRenderingContext, vs?: string, fs?: string) => WebGLProgram;
294
+ declare const createVbo: (c: WebGLRenderingContext, data: number[]) => WebGLBuffer;
295
+ declare const createIbo: (c: WebGLRenderingContext, data: number[]) => WebGLBuffer;
296
+ declare const createAttrib: (c: WebGLRenderingContext, stride: number, location: any, vbo: WebGLBuffer, ibo?: WebGLBuffer) => void;
306
297
  declare const createTexture: (c: WebGLRenderingContext, img: HTMLImageElement) => WebGLTexture;
307
298
  declare const activeTexture: (c: WebGLRenderingContext, location: WebGLUniformLocation | null, unit: number, texture: WebGLTexture) => void;
308
- declare const deleteTexture: (c: WebGLRenderingContext, texture: WebGLTexture) => void;
309
- declare const createEmptyTexture: (c: WebGLRenderingContext, w?: number, h?: number, format?: 6408, type?: 5121) => WebGLTexture;
310
- declare const createCubeTexture: (c: WebGLRenderingContext, imgs: HTMLImageElement[]) => WebGLTexture;
311
299
 
312
- declare const webgl: (gl: GL) => GL;
300
+ declare const webgl: (gl: GL) => Promise<GL>;
313
301
 
314
- declare const createBuffer: (device: any, data: Float32Array | Uint32Array | number[], usage: number) => any;
315
- declare const createVertexBuffer: (device: any, data: number[]) => any;
316
- declare const createIndexBuffer: (device: any, data: number[]) => any;
317
- declare const createUniformBuffer: (device: any, size: number) => any;
318
- declare const createStorageBuffer: (device: any, size: number) => any;
319
- declare const updateBuffer: (device: any, buffer: any, data: Float32Array | Uint32Array | number[], offset?: number) => void;
320
- declare const destroyBuffer: (buffer: any) => any;
321
- declare const calculateBufferSize: (data: number[]) => number;
322
- declare const alignBufferSize: (size: number, alignment?: number) => number;
323
- declare const createBuffers: (device: any, bufferConfigs: Array<{
324
- data: number[];
325
- usage: number;
326
- }>) => any[];
327
- declare const BufferUsage: {
328
- readonly VERTEX: 32;
329
- readonly INDEX: 64;
330
- readonly UNIFORM: 64;
331
- readonly STORAGE: 128;
332
- readonly COPY_SRC: 4;
333
- readonly COPY_DST: 8;
334
- readonly MAP_READ: 1;
335
- readonly MAP_WRITE: 2;
336
- };
337
-
338
- declare const requestWebGPUDevice: () => Promise<{
339
- adapter: any;
340
- device: any;
341
- }>;
342
- declare const checkWebGPUSupport: () => boolean;
343
- declare const getDeviceLimits: (device: any) => {
344
- maxTextureDimension1D: any;
345
- maxTextureDimension2D: any;
346
- maxTextureDimension3D: any;
347
- maxTextureArrayLayers: any;
348
- maxBindGroups: any;
349
- maxDynamicUniformBuffersPerPipelineLayout: any;
350
- maxDynamicStorageBuffersPerPipelineLayout: any;
351
- maxSampledTexturesPerShaderStage: any;
352
- maxSamplersPerShaderStage: any;
353
- maxStorageBuffersPerShaderStage: any;
354
- maxStorageTexturesPerShaderStage: any;
355
- maxUniformBuffersPerShaderStage: any;
356
- maxUniformBufferBindingSize: any;
357
- maxStorageBufferBindingSize: any;
358
- maxVertexBuffers: any;
359
- maxVertexAttributes: any;
360
- maxVertexBufferArrayStride: any;
361
- maxComputeWorkgroupStorageSize: any;
362
- maxComputeInvocationsPerWorkgroup: any;
363
- maxComputeWorkgroupSizeX: any;
364
- maxComputeWorkgroupSizeY: any;
365
- maxComputeWorkgroupSizeZ: any;
366
- maxComputeWorkgroupsPerDimension: any;
367
- };
368
- declare const setupDeviceErrorHandling: (device: any) => void;
369
- declare const configureCanvasContext: (canvas: HTMLCanvasElement, device: any, format?: any) => RenderingContext;
370
-
371
- declare const createRenderPipeline: (device: any, vertexShader?: string, fragmentShader?: string, format?: string) => any;
372
- declare const createComputePipeline: (device: any, computeShader: string) => any;
373
- declare const createShaderModule: (device: any, code: string) => any;
374
- declare const createBindGroupLayout: (device: any, entries: any[]) => any;
375
- declare const createBindGroup: (device: any, layout: any, entries: any[]) => any;
376
- declare const createRenderPass: (encoder: any, colorAttachment: any, depthStencilAttachment?: any) => any;
377
- declare const createCommandEncoder: (device: any) => any;
378
-
379
- declare const createTextureFromImage: (device: any, image: HTMLImageElement | ImageBitmap, format?: string) => any;
380
- declare const createDepthTexture: (device: any, w?: number, h?: number, format?: string) => any;
381
- declare const createSampler: (device: any, options?: {
382
- magFilter?: string;
383
- minFilter?: string;
384
- addressModeU?: string;
385
- addressModeV?: string;
386
- addressModeW?: string;
387
- }) => any;
388
- declare const createTextureView: (texture: any, options?: {
389
- format?: string;
390
- dimension?: string;
391
- aspect?: string;
392
- baseMipLevel?: number;
393
- mipLevelCount?: number;
394
- baseArrayLayer?: number;
395
- arrayLayerCount?: number;
396
- }) => any;
397
- declare const updateTexture: (device: any, texture: any, data: Uint8Array | Uint8ClampedArray, w?: number, h?: number) => void;
398
- declare const destroyTexture: (texture: any) => any;
399
- declare const TextureUsage: {
400
- readonly COPY_SRC: 1;
401
- readonly COPY_DST: 2;
402
- readonly TEXTURE_BINDING: 4;
403
- readonly STORAGE_BINDING: 8;
404
- readonly RENDER_ATTACHMENT: 16;
405
- };
406
- declare const TextureFormat: {
407
- readonly RGBA8_UNORM: "rgba8unorm";
408
- readonly RGBA8_SRGB: "rgba8unorm-srgb";
409
- readonly BGRA8_UNORM: "bgra8unorm";
410
- readonly BGRA8_SRGB: "bgra8unorm-srgb";
411
- readonly DEPTH24_PLUS: "depth24plus";
412
- readonly DEPTH32_FLOAT: "depth32float";
413
- };
414
-
415
- declare const webgpu: (gl: GL) => reev.EventState<{
416
- isNative: boolean;
417
- isWebGL: boolean;
418
- isLoop: boolean;
419
- isGL: true;
420
- width: number;
421
- height: number;
422
- size: [number, number];
423
- mouse: [number, number];
424
- count: number;
425
- vs: string | X;
426
- fs: string | X;
427
- vert: string | X;
428
- frag: string | X;
429
- vertex: string | X;
430
- fragment: string | X;
431
- int: PrecisionMode;
432
- float: PrecisionMode;
433
- sampler2D: PrecisionMode;
434
- samplerCube: PrecisionMode;
435
- lastActiveUnit: number;
436
- gl: any;
437
- pg: any;
438
- el: any;
439
- queue: refr_dist_types_687121c7.Q;
440
- frame: refr_dist_types_687121c7.a;
441
- stride: reev.Nested<number>;
442
- location: reev.Nested<any>;
443
- activeUnit: reev.Nested<number>;
444
- default: any;
445
- ref?: any;
446
- init(): void;
447
- loop(): void;
448
- mount(): void;
449
- clean(): void;
450
- render(): void;
451
- resize(e?: Event): void;
452
- mousemove(e: Event): void;
453
- _uniform?(key: string, value: Uniform, isMatrix?: boolean): GL;
454
- uniform(key: string, value: Uniform, isMatrix?: boolean): GL;
455
- uniform(target: {
456
- [key: string]: Uniform;
457
- }): GL;
458
- _texture?(key: string, value: string): GL;
459
- texture(key: string, value: string): GL;
460
- texture(target: {
461
- [key: string]: string;
462
- }): GL;
463
- _attribute?(key: string, value: Attribute, iboValue?: Attribute): GL;
464
- attribute(key: string, value: Attribute, iboValue?: Attribute): GL;
465
- attribute(target: {
466
- [key: string]: Attribute;
467
- }): GL;
468
- }, any[] | unknown[]>;
302
+ declare const webgpu: (gl: GL) => Promise<GL>;
469
303
 
470
304
  declare const isGL: (a: unknown) => a is EventState<GL>;
305
+ declare const isServer: () => boolean;
306
+ declare const isWebGPUSupported: () => boolean;
471
307
  declare const createGL: (props?: Partial<GL>) => EventState<{
472
308
  isNative: boolean;
473
309
  isWebGL: boolean;
@@ -478,26 +314,17 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
478
314
  size: [number, number];
479
315
  mouse: [number, number];
480
316
  count: number;
317
+ el: HTMLCanvasElement;
481
318
  vs: string | X;
482
319
  fs: string | X;
483
320
  vert: string | X;
484
321
  frag: string | X;
485
322
  vertex: string | X;
486
323
  fragment: string | X;
487
- int: PrecisionMode;
488
- float: PrecisionMode;
489
- sampler2D: PrecisionMode;
490
- samplerCube: PrecisionMode;
491
- lastActiveUnit: number;
492
- gl: any;
493
- pg: any;
494
- el: any;
324
+ webgpu: WebGPUState;
325
+ webgl: WebGLState;
495
326
  queue: refr.Queue;
496
327
  frame: refr.Frame;
497
- stride: reev.Nested<number>;
498
- location: reev.Nested<any>;
499
- activeUnit: reev.Nested<number>;
500
- default: any;
501
328
  ref?: any;
502
329
  init(): void;
503
330
  loop(): void;
@@ -523,4 +350,4 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
523
350
  }): GL;
524
351
  }, any[] | unknown[]>;
525
352
 
526
- export { Attribute, Attributes, BufferUsage, CACHE_BOOLS, CACHE_FLOATS, CACHE_INTS, ConditionalNode, ConversionContext, FUNCTIONS, Fn, FunctionNode, GL, GLClearMode, GLDrawMode, GLDrawType, If, MathFunction, MathMethods, Node, NodeCreator, NodeType, OPERATORS, Operator, OperatorMethods, PrecisionMode, ProxyCallback, SWIZZLES, Swillzes, SwizzleProperties, TYPES, TextureFormat, TextureUsage, Uniform, UniformNode, Uniforms, X, abs, activeTexture, alignBufferSize, bool, calculateBufferSize, ceil, checkWebGPUSupport, color, configureCanvasContext, convertToNode, cos, createAttribute, createBindGroup, createBindGroupLayout, createBuffer, createBuffers, createCommandEncoder, createComputePipeline, createCubeTexture, createDepthTexture, createEmptyTexture, createFragmentShader, createGL, createIbo, createIndexBuffer, createNode, createProgram, createRenderPass, createRenderPipeline, createSampler, createShaderModule, createStorageBuffer, createTexture, createTextureFromImage, createTextureView, createUniformBuffer, createVbo, createVertexBuffer, createVertexShader, createGL as default, deleteBuffer, deleteProgram, deleteShader, deleteTexture, destroyBuffer, destroyTexture, dig, each, ext, fig, findDuplicateNodes, float, floor, flush, fract, getAttribLocation, getCachedBool, getCachedFloat, getCachedInt, getDeviceLimits, getProgramInfo, getShaderInfo, getUniformLocation, getUniformType, gl_FragCoord, gl_Position, glsl, iDeltaTime, iMouse, iPrevTime, iResolution, iTime, int, is, isGL, isServer, isWebGPUSupported, length, node, nodeToGLSL, nodeToWGSL, normalize, replace, requestWebGPUDevice, setupDeviceErrorHandling, sig, sin, sqrt, tan, uniform, updateBuffer, updateIbo, updateTexture, updateUniforms, updateVbo, vec2, vec3, vec4, vertexStride, webgl, webgpu, wgsl };
353
+ export { Attribute, Attributes, CACHE_BOOLS, CACHE_FLOATS, CACHE_INTS, ConditionalNode, ConversionContext, FUNCTIONS, Fn, FunctionNode, GL, GLClearMode, GLDrawMode, GLDrawType, GPUBindGroup, GPUBuffer, GPUContext, GPUDevice, GPUPipeline, If, MathFunction, MathMethods, Node, NodeCreator, NodeType, OPERATORS, Operator, OperatorMethods, PrecisionMode, ProxyCallback, SWIZZLES, Swillzes, SwizzleProperties, TYPES, Uniform, UniformNode, Uniforms, WebGLState, WebGPUState, X, abs, activeTexture, bool, ceil, color, convertToNode, cos, createAttrib, createDescriptor, createGL, createIbo, createNode, createPipeline, createProgram, createShader, createTexture, createVbo, createGL as default, defaultFragmentGLSL, defaultVertexGLSL, dig, each, ext, fig, findDuplicateNodes, float, floor, flush, fract, fragCoord, getCachedBool, getCachedFloat, getCachedInt, glsl, iDeltaTime, iMouse, iPrevTime, iResolution, iTime, int, is, isGL, isServer, isWebGPUSupported, length, node, nodeToGLSL, nodeToWGSL, normalize, position, replace, sig, sin, sqrt, tan, uniform, updateUniforms, vec2, vec3, vec4, webgl, webgpu, wgsl };