glre 0.22.0 → 0.23.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 +11 -18
  2. package/dist/index.d.ts +60 -220
  3. package/dist/index.js +35 -37
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +35 -37
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/native.d.ts +49 -5
  8. package/dist/native.js +35 -37
  9. package/dist/native.js.map +1 -1
  10. package/dist/native.mjs +35 -37
  11. package/dist/native.mjs.map +1 -1
  12. package/dist/react.d.ts +1 -2
  13. package/dist/react.js +35 -37
  14. package/dist/react.js.map +1 -1
  15. package/dist/react.mjs +35 -37
  16. package/dist/react.mjs.map +1 -1
  17. package/dist/solid.d.ts +1 -2
  18. package/dist/solid.js +35 -37
  19. package/dist/solid.js.map +1 -1
  20. package/dist/solid.mjs +35 -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 +31 -29
  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 +3 -6
  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 +20 -21
  36. package/src/{utils.ts → utils/helpers.ts} +0 -9
  37. package/src/utils/pipeline.ts +128 -0
  38. package/src/utils/program.ts +94 -0
  39. package/src/webgl.ts +78 -0
  40. package/src/webgpu.ts +70 -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">
@@ -139,13 +139,7 @@ import { useGL, vec4, fract, fragCoord, iResolution } from 'glre/native'
139
139
  const fragment = 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({ fragment })
149
143
  return <GLView style={{ flex: 1 }} onContextCreate={ref} />
150
144
  }
151
145
 
@@ -177,21 +171,20 @@ 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'
180
+ import createGL from 'https://esm.sh/glre'
181
+ import { vec4, fract, fragCoord, iResolution } from 'https://esm.sh/glre'
189
182
  const fragment = vec4(fract(fragCoord.xy / iResolution), 0, 1)
190
-
191
183
  function App() {
192
- const el = document.getElementById('id')
184
+ const el = document.createElement('canvas')
193
185
  const gl = el.getContext('webgl2')
194
186
  createGL({ el, gl, fragment }).mount()
187
+ document.body.append(el)
195
188
  }
196
189
  document.addEventListener('DOMContentLoaded', App)
197
190
  </script>
@@ -203,7 +196,7 @@ pure js supported ([codesandbox demo](https://codesandbox.io/s/glre-basic-demo3-
203
196
 
204
197
  ## Node System
205
198
 
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.
199
+ 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
200
 
208
201
  The node system provides a declarative approach to shader creation, making your code more readable, maintainable, and portable across different rendering backends.
209
202
 
@@ -307,9 +300,9 @@ const App = () => {
307
300
  createRoot(document.getElementById('root')).render(<App />)
308
301
  ```
309
302
 
310
- ### WebGPU Support
303
+ ### WebGL2 and WebGPU Support
311
304
 
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.
305
+ 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
306
 
314
307
  ## PRs
315
308
 
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];
@@ -142,14 +140,27 @@ 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;
145
147
  type Uniform = number | number[];
146
148
  type Attribute = number[];
147
149
  type Attributes = Record<string, Attribute>;
148
150
  type Uniforms = Record<string, Uniform>;
149
151
  type PrecisionMode = 'highp' | 'mediump' | 'lowp';
150
152
  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
153
  type GLDrawType = 'UNSIGNED_BYTE' | 'UNSIGNED_SHORT' | 'UNSIGNED_INT';
154
+ type GLDrawMode = 'POINTS' | 'LINE_STRIP' | 'LINE_LOOP' | 'LINES' | 'TRIANGLE_STRIP' | 'TRIANGLE_FAN' | 'TRIANGLES';
155
+ interface WebGLState {
156
+ context: WebGLRenderingContext;
157
+ program: WebGLProgram;
158
+ }
159
+ interface WebGPUState {
160
+ device: GPUDevice;
161
+ context: GPUContext;
162
+ pipeline: GPUPipeline;
163
+ }
153
164
  type GL = EventState<{
154
165
  /**
155
166
  * initial value
@@ -163,32 +174,20 @@ type GL = EventState<{
163
174
  size: [number, number];
164
175
  mouse: [number, number];
165
176
  count: number;
177
+ el: HTMLCanvasElement;
166
178
  vs: string | X;
167
179
  fs: string | X;
168
180
  vert: string | X;
169
181
  frag: string | X;
170
182
  vertex: string | X;
171
183
  fragment: string | X;
172
- /**
173
- * for webgl
174
- */
175
- int: PrecisionMode;
176
- float: PrecisionMode;
177
- sampler2D: PrecisionMode;
178
- samplerCube: PrecisionMode;
179
- lastActiveUnit: number;
180
184
  /**
181
185
  * core state
182
186
  */
183
- gl: any;
184
- pg: any;
185
- el: any;
187
+ webgpu: WebGPUState;
188
+ webgl: WebGLState;
186
189
  queue: Queue;
187
190
  frame: Frame;
188
- stride: Nested<number>;
189
- location: Nested<any>;
190
- activeUnit: Nested<number>;
191
- default: any;
192
191
  /**
193
192
  * events
194
193
  */
@@ -254,8 +253,6 @@ declare const is: {
254
253
  obj: (a: unknown) => a is object;
255
254
  nan: (a: unknown) => a is number;
256
255
  };
257
- declare const isServer: () => boolean;
258
- declare const isWebGPUSupported: () => boolean;
259
256
  /**
260
257
  * each
261
258
  */
@@ -274,200 +271,52 @@ declare const fig: (x?: number) => number;
274
271
  declare const dig: (x?: number) => number;
275
272
  declare const sig: (value?: number, digit?: number) => number;
276
273
 
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;
274
+ declare const initWebGPUDevice: (el: HTMLCanvasElement) => Promise<{
275
+ device: any;
276
+ context: any;
277
+ format: any;
278
+ } | null>;
279
+ declare const createRenderPipeline: (device: GPUDevice, format: string, vs: string | undefined, fs: string | undefined, buffers: any[]) => GPUPipeline;
280
+ declare const createDescriptor: (c: GPUContext) => {
281
+ colorAttachments: {
282
+ view: any;
283
+ clearValue: {
284
+ r: number;
285
+ g: number;
286
+ b: number;
287
+ a: number;
288
+ };
289
+ loadOp: string;
290
+ storeOp: string;
291
+ }[];
304
292
  };
293
+ declare const alignTo256: (size: number) => number;
294
+ declare const createUniformBuffer: (device: GPUDevice, size: number) => Buffer;
295
+ declare const createVertexBuffer: (device: GPUDevice, value: number[]) => Buffer;
296
+ declare const createBindGroup: (device: GPUDevice, pipeline: GPUPipeline, entries: any[]) => any;
297
+ declare const updateBindGroup: (device: GPUDevice, pipeline: GPUPipeline, uniformBuffer: Buffer, textures?: any, sampler?: any) => any;
298
+ declare const createUniform: (device: GPUDevice, buffer: any, data: Float32Array, offset?: number) => void;
299
+ declare const createDeviceTexture: (device: GPUDevice, image: HTMLImageElement) => any;
300
+ declare const createSampler: (device: GPUDevice) => any;
301
+ declare const getDefaultVertices: () => Float32Array<ArrayBuffer>;
305
302
 
303
+ 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";
304
+ 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";
305
+ declare const createShader: (c: WebGLRenderingContext, source: string, type: number) => WebGLShader;
306
+ declare const createProgram: (c: WebGLRenderingContext, vs?: string, fs?: string) => WebGLProgram;
307
+ declare const createVbo: (c: WebGLRenderingContext, data: number[]) => WebGLBuffer;
308
+ declare const createIbo: (c: WebGLRenderingContext, data: number[]) => WebGLBuffer;
309
+ declare const createAttrib: (c: WebGLRenderingContext, stride: number, location: any, vbo: WebGLBuffer, ibo?: WebGLBuffer) => void;
306
310
  declare const createTexture: (c: WebGLRenderingContext, img: HTMLImageElement) => WebGLTexture;
307
311
  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
-
312
- declare const webgl: (gl: GL) => GL;
313
312
 
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;
313
+ declare const webgl: (gl: GL) => Promise<GL>;
370
314
 
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[]>;
315
+ declare const webgpu: (gl: GL) => Promise<GL>;
469
316
 
470
317
  declare const isGL: (a: unknown) => a is EventState<GL>;
318
+ declare const isServer: () => boolean;
319
+ declare const isWebGPUSupported: () => boolean;
471
320
  declare const createGL: (props?: Partial<GL>) => EventState<{
472
321
  isNative: boolean;
473
322
  isWebGL: boolean;
@@ -478,26 +327,17 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
478
327
  size: [number, number];
479
328
  mouse: [number, number];
480
329
  count: number;
330
+ el: HTMLCanvasElement;
481
331
  vs: string | X;
482
332
  fs: string | X;
483
333
  vert: string | X;
484
334
  frag: string | X;
485
335
  vertex: string | X;
486
336
  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;
337
+ webgpu: WebGPUState;
338
+ webgl: WebGLState;
495
339
  queue: refr.Queue;
496
340
  frame: refr.Frame;
497
- stride: reev.Nested<number>;
498
- location: reev.Nested<any>;
499
- activeUnit: reev.Nested<number>;
500
- default: any;
501
341
  ref?: any;
502
342
  init(): void;
503
343
  loop(): void;
@@ -523,4 +363,4 @@ declare const createGL: (props?: Partial<GL>) => EventState<{
523
363
  }): GL;
524
364
  }, any[] | unknown[]>;
525
365
 
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 };
366
+ export { Attribute, Attributes, CACHE_BOOLS, CACHE_FLOATS, CACHE_INTS, ConditionalNode, ConversionContext, FUNCTIONS, Fn, FunctionNode, GL, GLClearMode, GLDrawMode, GLDrawType, 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, alignTo256, bool, ceil, color, convertToNode, cos, createAttrib, createBindGroup, createDescriptor, createDeviceTexture, createGL, createIbo, createNode, createProgram, createRenderPipeline, createSampler, createShader, createTexture, createUniform, createUniformBuffer, createVbo, createVertexBuffer, createGL as default, defaultFragmentGLSL, defaultVertexGLSL, dig, each, ext, fig, findDuplicateNodes, float, floor, flush, fract, getCachedBool, getCachedFloat, getCachedInt, getDefaultVertices, gl_FragCoord, gl_Position, glsl, iDeltaTime, iMouse, iPrevTime, iResolution, iTime, initWebGPUDevice, int, is, isGL, isServer, isWebGPUSupported, length, node, nodeToGLSL, nodeToWGSL, normalize, replace, sig, sin, sqrt, tan, uniform, updateBindGroup, updateUniforms, vec2, vec3, vec4, webgl, webgpu, wgsl };