@luma.gl/core 9.0.0-beta.4 → 9.0.0-beta.6
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/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts +4 -4
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +1 -1
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.js +138 -106
- package/dist/adapter/canvas-context.d.ts +2 -2
- package/dist/adapter/canvas-context.d.ts.map +1 -1
- package/dist/adapter/canvas-context.js +306 -232
- package/dist/adapter/device.d.ts +112 -69
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +145 -94
- package/dist/adapter/resources/buffer.d.ts +3 -3
- package/dist/adapter/resources/buffer.d.ts.map +1 -1
- package/dist/adapter/resources/buffer.js +70 -56
- package/dist/adapter/resources/command-buffer.d.ts +2 -2
- package/dist/adapter/resources/command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/command-buffer.js +15 -12
- package/dist/adapter/resources/command-encoder.d.ts +22 -7
- package/dist/adapter/resources/command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/command-encoder.js +16 -16
- package/dist/adapter/resources/compute-pass.d.ts +16 -5
- package/dist/adapter/resources/compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pass.js +15 -12
- package/dist/adapter/resources/compute-pipeline.d.ts +4 -4
- package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pipeline.js +20 -17
- package/dist/adapter/resources/external-texture.d.ts +2 -2
- package/dist/adapter/resources/external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/external-texture.js +14 -14
- package/dist/adapter/resources/framebuffer.d.ts +9 -8
- package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/framebuffer.js +191 -91
- package/dist/adapter/resources/query-set.d.ts +26 -0
- package/dist/adapter/resources/query-set.d.ts.map +1 -0
- package/dist/adapter/resources/query-set.js +18 -0
- package/dist/adapter/resources/render-pass.d.ts +22 -9
- package/dist/adapter/resources/render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/render-pass.js +34 -20
- package/dist/adapter/resources/render-pipeline.d.ts +22 -18
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.js +50 -33
- package/dist/adapter/resources/resource.d.ts +1 -1
- package/dist/adapter/resources/resource.d.ts.map +1 -1
- package/dist/adapter/resources/resource.js +133 -92
- package/dist/adapter/resources/sampler.d.ts +3 -3
- package/dist/adapter/resources/sampler.d.ts.map +1 -1
- package/dist/adapter/resources/sampler.js +24 -23
- package/dist/adapter/resources/shader.d.ts +8 -6
- package/dist/adapter/resources/shader.d.ts.map +1 -1
- package/dist/adapter/resources/shader.js +98 -74
- package/dist/adapter/resources/texture-view.d.ts +32 -0
- package/dist/adapter/resources/texture-view.d.ts.map +1 -0
- package/dist/adapter/resources/texture-view.js +24 -0
- package/dist/adapter/resources/texture.d.ts +10 -15
- package/dist/adapter/resources/texture.d.ts.map +1 -1
- package/dist/adapter/resources/texture.js +54 -42
- package/dist/adapter/resources/transform-feedback.d.ts +7 -7
- package/dist/adapter/resources/transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/transform-feedback.js +15 -14
- package/dist/adapter/resources/vertex-array.d.ts +9 -9
- package/dist/adapter/resources/vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.js +36 -20
- package/dist/adapter/type-utils/decode-attribute-type.d.ts +2 -2
- package/dist/adapter/type-utils/decode-attribute-type.d.ts.map +1 -1
- package/dist/adapter/type-utils/decode-attribute-type.js +59 -52
- package/dist/adapter/type-utils/decode-data-type.d.ts +1 -1
- package/dist/adapter/type-utils/decode-data-type.d.ts.map +1 -1
- package/dist/adapter/type-utils/decode-data-type.js +39 -35
- package/dist/adapter/type-utils/decode-shader-types.d.ts +1 -1
- package/dist/adapter/type-utils/decode-shader-types.d.ts.map +1 -1
- package/dist/adapter/type-utils/decode-shader-types.js +36 -96
- package/dist/adapter/type-utils/decode-texture-format.d.ts +6 -2
- package/dist/adapter/type-utils/decode-texture-format.d.ts.map +1 -1
- package/dist/adapter/type-utils/decode-texture-format.js +172 -92
- package/dist/adapter/type-utils/decode-vertex-format.d.ts +1 -1
- package/dist/adapter/type-utils/decode-vertex-format.d.ts.map +1 -1
- package/dist/adapter/type-utils/decode-vertex-format.js +30 -22
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts +2 -2
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts.map +1 -1
- package/dist/adapter/type-utils/vertex-format-from-attribute.js +72 -65
- package/dist/adapter/type-utils/wgsl-utils.d.ts +1 -1
- package/dist/adapter/type-utils/wgsl-utils.d.ts.map +1 -1
- package/dist/adapter/type-utils/wgsl-utils.js +17 -13
- package/dist/adapter/types/accessor.d.ts +1 -1
- package/dist/adapter/types/accessor.d.ts.map +1 -1
- package/dist/adapter/types/accessor.js +3 -1
- package/dist/adapter/types/buffer-layout.d.ts +1 -1
- package/dist/adapter/types/buffer-layout.d.ts.map +1 -1
- package/dist/adapter/types/buffer-layout.js +3 -1
- package/dist/adapter/types/parameters.d.ts +28 -6
- package/dist/adapter/types/parameters.d.ts.map +1 -1
- package/dist/adapter/types/parameters.js +46 -26
- package/dist/adapter/types/shader-layout.d.ts +8 -7
- package/dist/adapter/types/shader-layout.d.ts.map +1 -1
- package/dist/adapter/types/shader-layout.js +3 -1
- package/dist/adapter/types/shader-types.d.ts.map +1 -1
- package/dist/adapter/types/shader-types.js +3 -1
- package/dist/adapter/types/texture-formats.d.ts +2 -2
- package/dist/adapter/types/texture-formats.d.ts.map +1 -1
- package/dist/adapter/types/texture-formats.js +3 -1
- package/dist/adapter/types/types.d.ts +4 -4
- package/dist/adapter/types/types.d.ts.map +1 -1
- package/dist/adapter/types/types.js +3 -1
- package/dist/adapter/types/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/types/vertex-formats.js +3 -1
- package/dist/dist.dev.js +614 -406
- package/dist/index.cjs +344 -369
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +80 -76
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -5
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +30 -17
- package/dist/lib/compiler-log/compiler-message.d.ts.map +1 -1
- package/dist/lib/compiler-log/compiler-message.js +3 -1
- package/dist/lib/compiler-log/format-compiler-log.d.ts +1 -1
- package/dist/lib/compiler-log/format-compiler-log.d.ts.map +1 -1
- package/dist/lib/compiler-log/format-compiler-log.js +69 -48
- package/dist/lib/compiler-log/get-shader-info.d.ts.map +1 -1
- package/dist/lib/compiler-log/get-shader-info.js +23 -19
- package/dist/lib/luma.d.ts +3 -3
- package/dist/lib/luma.d.ts.map +1 -1
- package/dist/lib/luma.js +60 -51
- package/dist/lib/uniforms/uniform-block.d.ts +3 -4
- package/dist/lib/uniforms/uniform-block.d.ts.map +1 -1
- package/dist/lib/uniforms/uniform-block.js +52 -42
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts +2 -2
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts.map +1 -1
- package/dist/lib/uniforms/uniform-buffer-layout.js +86 -66
- package/dist/lib/uniforms/uniform-store.d.ts +6 -6
- package/dist/lib/uniforms/uniform-store.d.ts.map +1 -1
- package/dist/lib/uniforms/uniform-store.js +111 -75
- package/dist/lib/uniforms/uniform.d.ts +2 -2
- package/dist/lib/uniforms/uniform.d.ts.map +1 -1
- package/dist/lib/uniforms/uniform.js +15 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -3
- package/dist/utils/array-equal.d.ts.map +1 -1
- package/dist/utils/array-equal.js +25 -22
- package/dist/utils/array-utils-flat.d.ts +1 -1
- package/dist/utils/array-utils-flat.d.ts.map +1 -1
- package/dist/utils/array-utils-flat.js +29 -28
- package/dist/utils/assert.d.ts.map +1 -1
- package/dist/utils/assert.js +8 -4
- package/dist/utils/cast.d.ts.map +1 -1
- package/dist/utils/cast.js +5 -2
- package/dist/utils/check-props.d.ts.map +1 -1
- package/dist/utils/check-props.js +30 -26
- package/dist/utils/deep-equal.d.ts.map +1 -1
- package/dist/utils/deep-equal.js +42 -32
- package/dist/utils/format-value.d.ts +1 -1
- package/dist/utils/format-value.d.ts.map +1 -1
- package/dist/utils/format-value.js +36 -39
- package/dist/utils/is-array.d.ts +1 -1
- package/dist/utils/is-array.d.ts.map +1 -1
- package/dist/utils/is-array.js +20 -6
- package/dist/utils/load-file.d.ts.map +1 -1
- package/dist/utils/load-file.js +63 -37
- package/dist/utils/log.d.ts.map +1 -1
- package/dist/utils/log.js +5 -4
- package/dist/utils/random.d.ts.map +1 -1
- package/dist/utils/random.js +13 -9
- package/dist/utils/request-animation-frame.d.ts.map +1 -1
- package/dist/utils/request-animation-frame.js +12 -3
- package/dist/utils/stats-manager.d.ts.map +1 -1
- package/dist/utils/stats-manager.js +16 -14
- package/dist/utils/stub-methods.d.ts.map +1 -1
- package/dist/utils/stub-methods.js +15 -12
- package/dist/utils/utils.d.ts +0 -6
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +21 -15
- package/dist.min.js +8 -23
- package/package.json +6 -6
- package/src/adapter/attribute-utils/get-attribute-from-layouts.ts +6 -5
- package/src/adapter/canvas-context.ts +8 -5
- package/src/adapter/device.ts +181 -127
- package/src/adapter/resources/buffer.ts +19 -6
- package/src/adapter/resources/command-buffer.ts +7 -5
- package/src/adapter/resources/command-encoder.ts +40 -29
- package/src/adapter/resources/compute-pass.ts +23 -9
- package/src/adapter/resources/compute-pipeline.ts +5 -2
- package/src/adapter/resources/external-texture.ts +8 -2
- package/src/adapter/resources/framebuffer.ts +115 -102
- package/src/adapter/resources/query-set.ts +41 -0
- package/src/adapter/resources/render-pass.ts +48 -54
- package/src/adapter/resources/render-pipeline.ts +22 -9
- package/src/adapter/resources/resource.ts +13 -10
- package/src/adapter/resources/sampler.ts +4 -3
- package/src/adapter/resources/shader.ts +19 -7
- package/src/adapter/resources/texture-view.ts +51 -0
- package/src/adapter/resources/texture.ts +28 -26
- package/src/adapter/resources/transform-feedback.ts +6 -3
- package/src/adapter/resources/vertex-array.ts +11 -3
- package/src/adapter/type-utils/decode-attribute-type.ts +24 -10
- package/src/adapter/type-utils/decode-data-type.ts +5 -1
- package/src/adapter/type-utils/decode-shader-types.ts +12 -9
- package/src/adapter/type-utils/decode-texture-format.ts +28 -12
- package/src/adapter/type-utils/decode-vertex-format.ts +4 -0
- package/src/adapter/type-utils/vertex-format-from-attribute.ts +4 -1
- package/src/adapter/type-utils/wgsl-utils.ts +6 -2
- package/src/adapter/types/accessor.ts +5 -2
- package/src/adapter/types/buffer-layout.ts +11 -8
- package/src/adapter/types/parameters.ts +98 -93
- package/src/adapter/types/shader-layout.ts +11 -2
- package/src/adapter/types/shader-types.ts +2 -1
- package/src/adapter/types/texture-formats.ts +130 -129
- package/src/adapter/types/types.ts +12 -6
- package/src/adapter/types/vertex-formats.ts +4 -5
- package/src/index.ts +30 -15
- package/src/init.ts +10 -4
- package/src/lib/compiler-log/compiler-message.ts +3 -2
- package/src/lib/compiler-log/format-compiler-log.ts +8 -3
- package/src/lib/compiler-log/get-shader-info.ts +2 -1
- package/src/lib/luma.ts +13 -8
- package/src/lib/uniforms/uniform-block.ts +7 -3
- package/src/lib/uniforms/uniform-buffer-layout.ts +16 -10
- package/src/lib/uniforms/uniform-store.ts +4 -1
- package/src/lib/uniforms/uniform.ts +12 -6
- package/src/types.ts +7 -3
- package/src/utils/array-equal.ts +2 -1
- package/src/utils/array-utils-flat.ts +9 -3
- package/src/utils/assert.ts +4 -0
- package/src/utils/cast.ts +4 -0
- package/src/utils/check-props.ts +9 -1
- package/src/utils/deep-equal.ts +4 -0
- package/src/utils/format-value.ts +9 -2
- package/src/utils/is-array.ts +4 -0
- package/src/utils/load-file.ts +5 -3
- package/src/utils/log.ts +4 -0
- package/src/utils/random.ts +4 -0
- package/src/utils/request-animation-frame.ts +4 -0
- package/src/utils/stats-manager.ts +6 -2
- package/src/utils/stub-methods.ts +10 -1
- package/src/utils/utils.ts +2 -10
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.js.map +0 -1
- package/dist/adapter/canvas-context.js.map +0 -1
- package/dist/adapter/device.js.map +0 -1
- package/dist/adapter/resources/buffer.js.map +0 -1
- package/dist/adapter/resources/command-buffer.js.map +0 -1
- package/dist/adapter/resources/command-encoder.js.map +0 -1
- package/dist/adapter/resources/compute-pass.js.map +0 -1
- package/dist/adapter/resources/compute-pipeline.js.map +0 -1
- package/dist/adapter/resources/external-texture.js.map +0 -1
- package/dist/adapter/resources/framebuffer.js.map +0 -1
- package/dist/adapter/resources/render-pass.js.map +0 -1
- package/dist/adapter/resources/render-pipeline.js.map +0 -1
- package/dist/adapter/resources/resource.js.map +0 -1
- package/dist/adapter/resources/sampler.js.map +0 -1
- package/dist/adapter/resources/shader.js.map +0 -1
- package/dist/adapter/resources/texture.js.map +0 -1
- package/dist/adapter/resources/transform-feedback.js.map +0 -1
- package/dist/adapter/resources/vertex-array.js.map +0 -1
- package/dist/adapter/type-utils/decode-attribute-type.js.map +0 -1
- package/dist/adapter/type-utils/decode-data-type.js.map +0 -1
- package/dist/adapter/type-utils/decode-shader-types.js.map +0 -1
- package/dist/adapter/type-utils/decode-texture-format.js.map +0 -1
- package/dist/adapter/type-utils/decode-vertex-format.js.map +0 -1
- package/dist/adapter/type-utils/vertex-format-from-attribute.js.map +0 -1
- package/dist/adapter/type-utils/wgsl-utils.js.map +0 -1
- package/dist/adapter/types/accessor.js.map +0 -1
- package/dist/adapter/types/buffer-layout.js.map +0 -1
- package/dist/adapter/types/parameters.js.map +0 -1
- package/dist/adapter/types/shader-layout.js.map +0 -1
- package/dist/adapter/types/shader-types.js.map +0 -1
- package/dist/adapter/types/texture-formats.js.map +0 -1
- package/dist/adapter/types/types.js.map +0 -1
- package/dist/adapter/types/vertex-formats.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/init.js.map +0 -1
- package/dist/lib/compiler-log/compiler-message.js.map +0 -1
- package/dist/lib/compiler-log/format-compiler-log.js.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.js.map +0 -1
- package/dist/lib/luma.js.map +0 -1
- package/dist/lib/uniforms/uniform-block.js.map +0 -1
- package/dist/lib/uniforms/uniform-buffer-layout.js.map +0 -1
- package/dist/lib/uniforms/uniform-store.js.map +0 -1
- package/dist/lib/uniforms/uniform.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/array-equal.js.map +0 -1
- package/dist/utils/array-utils-flat.js.map +0 -1
- package/dist/utils/assert.js.map +0 -1
- package/dist/utils/cast.js.map +0 -1
- package/dist/utils/check-props.js.map +0 -1
- package/dist/utils/deep-equal.js.map +0 -1
- package/dist/utils/format-value.js.map +0 -1
- package/dist/utils/is-array.js.map +0 -1
- package/dist/utils/load-file.js.map +0 -1
- package/dist/utils/log.js.map +0 -1
- package/dist/utils/random.js.map +0 -1
- package/dist/utils/request-animation-frame.js.map +0 -1
- package/dist/utils/stats-manager.js.map +0 -1
- package/dist/utils/stub-methods.js.map +0 -1
- package/dist/utils/utils.js.map +0 -1
package/dist/adapter/device.d.ts
CHANGED
|
@@ -1,35 +1,21 @@
|
|
|
1
|
-
import { StatsManager } from
|
|
2
|
-
import type { TextureFormat } from
|
|
3
|
-
import type { CanvasContext, CanvasContextProps } from
|
|
4
|
-
import type { BufferProps } from
|
|
5
|
-
import { Buffer } from
|
|
6
|
-
import type { RenderPipeline, RenderPipelineProps } from
|
|
7
|
-
import type { ComputePipeline, ComputePipelineProps } from
|
|
8
|
-
import type { Sampler, SamplerProps } from
|
|
9
|
-
import type { Shader, ShaderProps } from
|
|
10
|
-
import type { Texture, TextureProps, TextureData } from
|
|
11
|
-
import type { ExternalTexture, ExternalTextureProps } from
|
|
12
|
-
import type { Framebuffer, FramebufferProps } from
|
|
13
|
-
import type { RenderPass, RenderPassProps } from
|
|
14
|
-
import type { ComputePass, ComputePassProps } from
|
|
15
|
-
import type { CommandEncoder, CommandEncoderProps } from
|
|
16
|
-
import type { VertexArray, VertexArrayProps } from
|
|
17
|
-
import type { TransformFeedback, TransformFeedbackProps } from
|
|
18
|
-
|
|
19
|
-
export type DeviceProps = {
|
|
20
|
-
id?: string;
|
|
21
|
-
type?: 'webgl' | 'webgl1' | 'webgl2' | 'webgpu' | 'best-available';
|
|
22
|
-
canvas?: HTMLCanvasElement | OffscreenCanvas | string | null;
|
|
23
|
-
container?: HTMLElement | string | null;
|
|
24
|
-
width?: number /** width is only used when creating a new canvas */;
|
|
25
|
-
height?: number /** height is only used when creating a new canvas */;
|
|
26
|
-
webgl2?: boolean;
|
|
27
|
-
webgl1?: boolean;
|
|
28
|
-
debug?: boolean;
|
|
29
|
-
manageState?: boolean;
|
|
30
|
-
break?: string[];
|
|
31
|
-
gl?: WebGLRenderingContext | WebGL2RenderingContext | null;
|
|
32
|
-
};
|
|
1
|
+
import { StatsManager } from "../utils/stats-manager.js";
|
|
2
|
+
import type { TextureFormat } from "./types/texture-formats.js";
|
|
3
|
+
import type { CanvasContext, CanvasContextProps } from "./canvas-context.js";
|
|
4
|
+
import type { BufferProps } from "./resources/buffer.js";
|
|
5
|
+
import { Buffer } from "./resources/buffer.js";
|
|
6
|
+
import type { RenderPipeline, RenderPipelineProps } from "./resources/render-pipeline.js";
|
|
7
|
+
import type { ComputePipeline, ComputePipelineProps } from "./resources/compute-pipeline.js";
|
|
8
|
+
import type { Sampler, SamplerProps } from "./resources/sampler.js";
|
|
9
|
+
import type { Shader, ShaderProps } from "./resources/shader.js";
|
|
10
|
+
import type { Texture, TextureProps, TextureData } from "./resources/texture.js";
|
|
11
|
+
import type { ExternalTexture, ExternalTextureProps } from "./resources/external-texture.js";
|
|
12
|
+
import type { Framebuffer, FramebufferProps } from "./resources/framebuffer.js";
|
|
13
|
+
import type { RenderPass, RenderPassProps } from "./resources/render-pass.js";
|
|
14
|
+
import type { ComputePass, ComputePassProps } from "./resources/compute-pass.js";
|
|
15
|
+
import type { CommandEncoder, CommandEncoderProps } from "./resources/command-encoder.js";
|
|
16
|
+
import type { VertexArray, VertexArrayProps } from "./resources/vertex-array.js";
|
|
17
|
+
import type { TransformFeedback, TransformFeedbackProps } from "./resources/transform-feedback.js";
|
|
18
|
+
import type { QuerySet, QuerySetProps } from "./resources/query-set.js";
|
|
33
19
|
/**
|
|
34
20
|
* Identifies the GPU vendor and driver.
|
|
35
21
|
* @note Chrome WebGPU does not provide much information, though more can be enabled with
|
|
@@ -38,7 +24,7 @@ export type DeviceProps = {
|
|
|
38
24
|
*/
|
|
39
25
|
export type DeviceInfo = {
|
|
40
26
|
/** Type of device */
|
|
41
|
-
type: 'webgl' | '
|
|
27
|
+
type: 'webgl' | 'webgpu';
|
|
42
28
|
/** Vendor (name of GPU vendor, Apple, nVidia etc */
|
|
43
29
|
vendor: string;
|
|
44
30
|
/** Renderer (usually driver name) */
|
|
@@ -57,43 +43,95 @@ export type DeviceInfo = {
|
|
|
57
43
|
fallback?: boolean;
|
|
58
44
|
/** Shader language supported by device.createShader() */
|
|
59
45
|
shadingLanguage: 'wgsl' | 'glsl';
|
|
60
|
-
/** Highest supported shader language version
|
|
46
|
+
/** Highest supported shader language version: GLSL 3.00 = 300, WGSL 1.00 = 100 */
|
|
61
47
|
shadingLanguageVersion: number;
|
|
62
48
|
};
|
|
63
|
-
/** Limits for a device */
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
/**
|
|
49
|
+
/** Limits for a device (max supported sizes of resources, max number of bindings etc) */
|
|
50
|
+
export declare abstract class DeviceLimits {
|
|
51
|
+
/** max number of TextureDimension1D */
|
|
52
|
+
abstract maxTextureDimension1D: number;
|
|
53
|
+
/** max number of TextureDimension2D */
|
|
54
|
+
abstract maxTextureDimension2D: number;
|
|
55
|
+
/** max number of TextureDimension3D */
|
|
56
|
+
abstract maxTextureDimension3D: number;
|
|
57
|
+
/** max number of TextureArrayLayers */
|
|
58
|
+
abstract maxTextureArrayLayers: number;
|
|
59
|
+
/** max number of BindGroups */
|
|
60
|
+
abstract maxBindGroups: number;
|
|
61
|
+
/** max number of DynamicUniformBuffers per PipelineLayout */
|
|
62
|
+
abstract maxDynamicUniformBuffersPerPipelineLayout: number;
|
|
63
|
+
/** max number of DynamicStorageBuffers per PipelineLayout */
|
|
64
|
+
abstract maxDynamicStorageBuffersPerPipelineLayout: number;
|
|
65
|
+
/** max number of SampledTextures per ShaderStage */
|
|
66
|
+
abstract maxSampledTexturesPerShaderStage: number;
|
|
67
|
+
/** max number of Samplers per ShaderStage */
|
|
68
|
+
abstract maxSamplersPerShaderStage: number;
|
|
69
|
+
/** max number of StorageBuffers per ShaderStage */
|
|
70
|
+
abstract maxStorageBuffersPerShaderStage: number;
|
|
71
|
+
/** max number of StorageTextures per ShaderStage */
|
|
72
|
+
abstract maxStorageTexturesPerShaderStage: number;
|
|
73
|
+
/** max number of UniformBuffers per ShaderStage */
|
|
74
|
+
abstract maxUniformBuffersPerShaderStage: number;
|
|
75
|
+
/** max number of UniformBufferBindingSize */
|
|
76
|
+
abstract maxUniformBufferBindingSize: number;
|
|
77
|
+
/** max number of StorageBufferBindingSize */
|
|
78
|
+
abstract maxStorageBufferBindingSize: number;
|
|
79
|
+
/** min UniformBufferOffsetAlignment */
|
|
80
|
+
abstract minUniformBufferOffsetAlignment: number;
|
|
81
|
+
/** min StorageBufferOffsetAlignment */
|
|
82
|
+
abstract minStorageBufferOffsetAlignment: number;
|
|
83
|
+
/** max number of VertexBuffers */
|
|
84
|
+
abstract maxVertexBuffers: number;
|
|
85
|
+
/** max number of VertexAttributes */
|
|
86
|
+
abstract maxVertexAttributes: number;
|
|
87
|
+
/** max number of VertexBufferArrayStride */
|
|
88
|
+
abstract maxVertexBufferArrayStride: number;
|
|
89
|
+
/** max number of InterStageShaderComponents */
|
|
90
|
+
abstract maxInterStageShaderComponents: number;
|
|
91
|
+
/** max number of ComputeWorkgroupStorageSize */
|
|
92
|
+
abstract maxComputeWorkgroupStorageSize: number;
|
|
93
|
+
/** max number of ComputeInvocations per Workgroup */
|
|
94
|
+
abstract maxComputeInvocationsPerWorkgroup: number;
|
|
95
|
+
/** max ComputeWorkgroupSizeX */
|
|
96
|
+
abstract maxComputeWorkgroupSizeX: number;
|
|
97
|
+
/** max ComputeWorkgroupSizeY */
|
|
98
|
+
abstract maxComputeWorkgroupSizeY: number;
|
|
99
|
+
/** max ComputeWorkgroupSizeZ */
|
|
100
|
+
abstract maxComputeWorkgroupSizeZ: number;
|
|
101
|
+
/** max ComputeWorkgroupsPerDimension */
|
|
102
|
+
abstract maxComputeWorkgroupsPerDimension: number;
|
|
103
|
+
}
|
|
104
|
+
/** Set-like class for features (lets apps check for WebGL / WebGPU extensions) */
|
|
105
|
+
export declare class DeviceFeatures {
|
|
106
|
+
protected features: Set<DeviceFeature>;
|
|
107
|
+
constructor(features?: DeviceFeature[]);
|
|
108
|
+
[Symbol.iterator](): IterableIterator<DeviceFeature>;
|
|
109
|
+
has(feature: DeviceFeature): boolean;
|
|
110
|
+
}
|
|
111
|
+
/** Device feature names */
|
|
96
112
|
export type DeviceFeature = WebGPUDeviceFeature | WebGLDeviceFeature | WebGLCompressedTextureFeatures;
|
|
113
|
+
export type WebGPUDeviceFeature = 'depth-clip-control' | 'indirect-first-instance' | 'timestamp-query' | 'shader-f16' | 'depth24unorm-stencil8' | 'depth32float-stencil8' | 'rg11b10ufloat-renderable' | 'float32-filterable' | 'bgra8unorm-storage' | 'texture-compression-bc' | 'texture-compression-etc2' | 'texture-compression-astc';
|
|
114
|
+
export type WebGLDeviceFeature = 'timer-query-webgl' | 'compilation-status-async-webgl' | 'provoking-vertex-webgl' | 'polygon-mode-webgl' | 'shader-noperspective-interpolation-webgl' | 'shader-conservative-depth-webgl' | 'shader-clip-cull-distance-webgl' | 'float32-renderable-webgl' | 'float16-renderable-webgl' | 'rgb9e5ufloat_renderable-webgl' | 'snorm8-renderable-webgl' | 'norm16-renderable-webgl' | 'snorm16-renderable-webgl' | 'float16-filterable-webgl' | 'texture-filterable-anisotropic-webgl' | 'bgra8unorm-storage' | 'texture-blend-float-webgl';
|
|
115
|
+
type WebGLCompressedTextureFeatures = 'texture-compression-bc5-webgl' | 'texture-compression-bc7-webgl' | 'texture-compression-etc1-webgl' | 'texture-compression-pvrtc-webgl' | 'texture-compression-atc-webgl';
|
|
116
|
+
/** Device properties */
|
|
117
|
+
export type DeviceProps = {
|
|
118
|
+
id?: string;
|
|
119
|
+
type?: 'webgl' | 'webgpu' | 'best-available';
|
|
120
|
+
canvas?: HTMLCanvasElement | OffscreenCanvas | string | null;
|
|
121
|
+
container?: HTMLElement | string | null;
|
|
122
|
+
width?: number /** width is only used when creating a new canvas */;
|
|
123
|
+
height?: number /** height is only used when creating a new canvas */;
|
|
124
|
+
/** Request a Device with the highest limits supported by platform. */
|
|
125
|
+
requestMaximalLimits?: boolean;
|
|
126
|
+
onError?: (error: Error) => unknown;
|
|
127
|
+
/** Instrument context (at the expense of performance) */
|
|
128
|
+
debug?: boolean;
|
|
129
|
+
/** Initialize the SpectorJS WebGL debugger */
|
|
130
|
+
spector?: boolean;
|
|
131
|
+
manageState?: boolean;
|
|
132
|
+
break?: string[];
|
|
133
|
+
gl?: WebGL2RenderingContext | null;
|
|
134
|
+
};
|
|
97
135
|
/**
|
|
98
136
|
* WebGPU Device/WebGL context abstraction
|
|
99
137
|
*/
|
|
@@ -120,7 +158,7 @@ export declare abstract class Device {
|
|
|
120
158
|
/** Information about the device (vendor, versions etc) */
|
|
121
159
|
abstract info: DeviceInfo;
|
|
122
160
|
/** Optional capability discovery */
|
|
123
|
-
abstract
|
|
161
|
+
abstract features: DeviceFeatures;
|
|
124
162
|
/** WebGPU style device limits */
|
|
125
163
|
abstract get limits(): DeviceLimits;
|
|
126
164
|
/** Check if device supports a specific texture format (creation and `nearest` sampling) */
|
|
@@ -129,6 +167,8 @@ export declare abstract class Device {
|
|
|
129
167
|
abstract isTextureFormatFilterable(format: TextureFormat): boolean;
|
|
130
168
|
/** Check if device supports rendering to a specific texture format */
|
|
131
169
|
abstract isTextureFormatRenderable(format: TextureFormat): boolean;
|
|
170
|
+
/** Check if a specific texture format is GPU compressed */
|
|
171
|
+
isTextureFormatCompressed(format: TextureFormat): boolean;
|
|
132
172
|
/** `true` if device is already lost */
|
|
133
173
|
abstract get isLost(): boolean;
|
|
134
174
|
/** Promise that resolves when device is lost */
|
|
@@ -177,8 +217,9 @@ export declare abstract class Device {
|
|
|
177
217
|
abstract beginComputePass(props?: ComputePassProps): ComputePass;
|
|
178
218
|
/** Get a renderpass that is set up to render to the primary CanvasContext */
|
|
179
219
|
abstract getDefaultRenderPass(): RenderPass;
|
|
180
|
-
/** Create a transform feedback (immutable set of output buffer bindings). WebGL
|
|
220
|
+
/** Create a transform feedback (immutable set of output buffer bindings). WebGL only. */
|
|
181
221
|
abstract createTransformFeedback(props: TransformFeedbackProps): TransformFeedback;
|
|
222
|
+
abstract createQuerySet(props: QuerySetProps): QuerySet;
|
|
182
223
|
createCommandEncoder(props?: CommandEncoderProps): CommandEncoder;
|
|
183
224
|
/** @deprecated - will be removed - should use command encoder */
|
|
184
225
|
readPixelsToArrayWebGL(source: Framebuffer | Texture, options?: {
|
|
@@ -215,6 +256,8 @@ export declare abstract class Device {
|
|
|
215
256
|
depth?: any;
|
|
216
257
|
stencil?: any;
|
|
217
258
|
}): void;
|
|
259
|
+
/** Report unhandled device errors */
|
|
260
|
+
onError(error: Error): void;
|
|
218
261
|
protected _getBufferProps(props: BufferProps | ArrayBuffer | ArrayBufferView): BufferProps;
|
|
219
262
|
}
|
|
220
263
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/adapter/device.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/adapter/device.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,YAAY,EAAY,kCAA+B;AAG/D,OAAO,KAAK,EAAC,aAAa,EAAC,mCAAgC;AAC3D,OAAO,KAAK,EAAC,aAAa,EAAE,kBAAkB,EAAC,4BAAyB;AACxE,OAAO,KAAK,EAAC,WAAW,EAAC,8BAA2B;AACpD,OAAO,EAAC,MAAM,EAAC,8BAA2B;AAC1C,OAAO,KAAK,EAAC,cAAc,EAAE,mBAAmB,EAAC,uCAAoC;AACrF,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAC,wCAAqC;AACxF,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAC,+BAA4B;AAC/D,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAC,8BAA2B;AAC5D,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAC,+BAA4B;AAC5E,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAC,wCAAqC;AACxF,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,mCAAgC;AAC3E,OAAO,KAAK,EAAC,UAAU,EAAE,eAAe,EAAC,mCAAgC;AACzE,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,oCAAiC;AAC5E,OAAO,KAAK,EAAC,cAAc,EAAE,mBAAmB,EAAC,uCAAoC;AACrF,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,oCAAiC;AAC5E,OAAO,KAAK,EAAC,iBAAiB,EAAE,sBAAsB,EAAC,0CAAuC;AAC9F,OAAO,KAAK,EAAC,QAAQ,EAA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
3
|
+
// Copyright (c) vis.gl contributors
|
|
2
4
|
import { VERSION } from "../init.js";
|
|
3
5
|
import { lumaStats } from "../utils/stats-manager.js";
|
|
4
6
|
import { log } from "../utils/log.js";
|
|
5
7
|
import { uid } from "../utils/utils.js";
|
|
6
8
|
import { Buffer } from "./resources/buffer.js";
|
|
7
|
-
|
|
9
|
+
import { isTextureFormatCompressed } from "./type-utils/decode-texture-format.js";
|
|
10
|
+
/** Limits for a device (max supported sizes of resources, max number of bindings etc) */
|
|
11
|
+
export class DeviceLimits {
|
|
12
|
+
}
|
|
13
|
+
/** Set-like class for features (lets apps check for WebGL / WebGPU extensions) */
|
|
14
|
+
export class DeviceFeatures {
|
|
15
|
+
features;
|
|
16
|
+
constructor(features = []) {
|
|
17
|
+
this.features = new Set(features);
|
|
18
|
+
}
|
|
19
|
+
*[Symbol.iterator]() {
|
|
20
|
+
yield* this.features;
|
|
21
|
+
}
|
|
22
|
+
has(feature) {
|
|
23
|
+
return this.features.has(feature);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* WebGPU Device/WebGL context abstraction
|
|
28
|
+
*/
|
|
8
29
|
export class Device {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (!this.canvasContext) {
|
|
32
|
-
throw new Error('Device has no CanvasContext');
|
|
33
|
-
}
|
|
34
|
-
return this.canvasContext;
|
|
35
|
-
}
|
|
36
|
-
createTexture(props) {
|
|
37
|
-
if (props instanceof Promise || typeof props === 'string') {
|
|
38
|
-
props = {
|
|
39
|
-
data: props
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
return this._createTexture(props);
|
|
43
|
-
}
|
|
44
|
-
createCommandEncoder() {
|
|
45
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
46
|
-
throw new Error('not implemented');
|
|
47
|
-
}
|
|
48
|
-
readPixelsToArrayWebGL(source, options) {
|
|
49
|
-
throw new Error('not implemented');
|
|
50
|
-
}
|
|
51
|
-
readPixelsToBufferWebGL(source, options) {
|
|
52
|
-
throw new Error('not implemented');
|
|
53
|
-
}
|
|
54
|
-
setParametersWebGL(parameters) {
|
|
55
|
-
throw new Error('not implemented');
|
|
56
|
-
}
|
|
57
|
-
getParametersWebGL(parameters) {
|
|
58
|
-
throw new Error('not implemented');
|
|
59
|
-
}
|
|
60
|
-
withParametersWebGL(parameters, func) {
|
|
61
|
-
throw new Error('not implemented');
|
|
62
|
-
}
|
|
63
|
-
clearWebGL(options) {
|
|
64
|
-
throw new Error('not implemented');
|
|
65
|
-
}
|
|
66
|
-
_getBufferProps(props) {
|
|
67
|
-
if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {
|
|
68
|
-
props = {
|
|
69
|
-
data: props
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
const newProps = {
|
|
73
|
-
...props
|
|
30
|
+
static defaultProps = {
|
|
31
|
+
id: null,
|
|
32
|
+
type: 'best-available',
|
|
33
|
+
canvas: null,
|
|
34
|
+
container: null,
|
|
35
|
+
manageState: true,
|
|
36
|
+
width: 800, // width are height are only used by headless gl
|
|
37
|
+
height: 600,
|
|
38
|
+
requestMaximalLimits: true,
|
|
39
|
+
debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance)
|
|
40
|
+
spector: Boolean(log.get('spector')), // Initialize the SpectorJS WebGL debugger
|
|
41
|
+
break: [],
|
|
42
|
+
// alpha: undefined,
|
|
43
|
+
// depth: undefined,
|
|
44
|
+
// stencil: undefined,
|
|
45
|
+
// antialias: undefined,
|
|
46
|
+
// premultipliedAlpha: undefined,
|
|
47
|
+
// preserveDrawingBuffer: undefined,
|
|
48
|
+
// failIfMajorPerformanceCaveat: undefined
|
|
49
|
+
gl: null,
|
|
50
|
+
// Callbacks
|
|
51
|
+
onError: (error) => log.error(error.message)
|
|
74
52
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
53
|
+
get [Symbol.toStringTag]() {
|
|
54
|
+
return 'Device';
|
|
55
|
+
}
|
|
56
|
+
static VERSION = VERSION;
|
|
57
|
+
constructor(props) {
|
|
58
|
+
this.props = { ...Device.defaultProps, ...props };
|
|
59
|
+
this.id = this.props.id || uid(this[Symbol.toStringTag].toLowerCase());
|
|
60
|
+
}
|
|
61
|
+
/** id of this device, primarily for debugging */
|
|
62
|
+
id;
|
|
63
|
+
/** stats */
|
|
64
|
+
statsManager = lumaStats;
|
|
65
|
+
/** A copy of the device props */
|
|
66
|
+
props;
|
|
67
|
+
/** Available for the application to store data on the device */
|
|
68
|
+
userData = {};
|
|
69
|
+
/** Used by other luma.gl modules to store data on the device */
|
|
70
|
+
_lumaData = {};
|
|
71
|
+
/** Check if a specific texture format is GPU compressed */
|
|
72
|
+
isTextureFormatCompressed(format) {
|
|
73
|
+
return isTextureFormatCompressed(format);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Trigger device loss.
|
|
77
|
+
* @returns `true` if context loss could actually be triggered.
|
|
78
|
+
* @note primarily intended for testing how application reacts to device loss
|
|
79
|
+
*/
|
|
80
|
+
loseDevice() {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
/** Returns the default / primary canvas context. Throws an error if no canvas context is available (a WebGPU compute device) */
|
|
84
|
+
getCanvasContext() {
|
|
85
|
+
if (!this.canvasContext) {
|
|
86
|
+
throw new Error('Device has no CanvasContext');
|
|
87
|
+
}
|
|
88
|
+
return this.canvasContext;
|
|
89
|
+
}
|
|
90
|
+
createTexture(props) {
|
|
91
|
+
// Signature: new Texture2D(gl, url | Promise)
|
|
92
|
+
if (props instanceof Promise || typeof props === 'string') {
|
|
93
|
+
props = { data: props };
|
|
94
|
+
}
|
|
95
|
+
return this._createTexture(props);
|
|
96
|
+
}
|
|
97
|
+
createCommandEncoder(props = {}) {
|
|
98
|
+
throw new Error('not implemented');
|
|
99
|
+
}
|
|
100
|
+
// WebGL specific HACKS - enables app to remove webgl import
|
|
101
|
+
// Use until we have a better way to handle these
|
|
102
|
+
/** @deprecated - will be removed - should use command encoder */
|
|
103
|
+
readPixelsToArrayWebGL(source, options) {
|
|
104
|
+
throw new Error('not implemented');
|
|
105
|
+
}
|
|
106
|
+
/** @deprecated - will be removed - should use command encoder */
|
|
107
|
+
readPixelsToBufferWebGL(source, options) {
|
|
108
|
+
throw new Error('not implemented');
|
|
109
|
+
}
|
|
110
|
+
/** @deprecated - will be removed - should use WebGPU parameters (pipeline) */
|
|
111
|
+
setParametersWebGL(parameters) {
|
|
112
|
+
throw new Error('not implemented');
|
|
113
|
+
}
|
|
114
|
+
/** @deprecated - will be removed - should use WebGPU parameters (pipeline) */
|
|
115
|
+
getParametersWebGL(parameters) {
|
|
116
|
+
throw new Error('not implemented');
|
|
117
|
+
}
|
|
118
|
+
/** @deprecated - will be removed - should use WebGPU parameters (pipeline) */
|
|
119
|
+
withParametersWebGL(parameters, func) {
|
|
120
|
+
throw new Error('not implemented');
|
|
121
|
+
}
|
|
122
|
+
/** @deprecated - will be removed - should use clear arguments in RenderPass */
|
|
123
|
+
clearWebGL(options) {
|
|
124
|
+
throw new Error('not implemented');
|
|
125
|
+
}
|
|
126
|
+
// IMPLEMENTATION
|
|
127
|
+
// Error Handling
|
|
128
|
+
/** Report unhandled device errors */
|
|
129
|
+
onError(error) {
|
|
130
|
+
this.props.onError(error);
|
|
131
|
+
}
|
|
132
|
+
_getBufferProps(props) {
|
|
133
|
+
if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {
|
|
134
|
+
props = { data: props };
|
|
135
|
+
}
|
|
136
|
+
// TODO - fragile, as this is done before we merge with default options
|
|
137
|
+
// inside the Buffer constructor
|
|
138
|
+
const newProps = { ...props };
|
|
139
|
+
// Deduce indexType
|
|
140
|
+
if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {
|
|
141
|
+
if (props.data instanceof Uint32Array) {
|
|
142
|
+
newProps.indexType = 'uint32';
|
|
143
|
+
}
|
|
144
|
+
else if (props.data instanceof Uint16Array) {
|
|
145
|
+
newProps.indexType = 'uint16';
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
log.warn('indices buffer content must be of integer type')();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return newProps;
|
|
152
|
+
}
|
|
86
153
|
}
|
|
87
|
-
Device.defaultProps = {
|
|
88
|
-
id: null,
|
|
89
|
-
type: 'best-available',
|
|
90
|
-
canvas: null,
|
|
91
|
-
container: null,
|
|
92
|
-
webgl2: true,
|
|
93
|
-
webgl1: true,
|
|
94
|
-
manageState: true,
|
|
95
|
-
width: 800,
|
|
96
|
-
height: 600,
|
|
97
|
-
debug: Boolean(log.get('debug')),
|
|
98
|
-
break: [],
|
|
99
|
-
gl: null
|
|
100
|
-
};
|
|
101
|
-
Device.VERSION = VERSION;
|
|
102
|
-
//# sourceMappingURL=device.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Device } from
|
|
2
|
-
import { Resource, ResourceProps } from
|
|
1
|
+
import type { Device } from "../device.js";
|
|
2
|
+
import { Resource, ResourceProps } from "./resource.js";
|
|
3
3
|
export type BufferProps = ResourceProps & {
|
|
4
4
|
/** Supply a handle to connect to an existing device-specific buffer */
|
|
5
5
|
handle?: WebGLBuffer;
|
|
@@ -45,7 +45,7 @@ export declare abstract class Buffer extends Resource<BufferProps> {
|
|
|
45
45
|
/** Read data asynchronoursly */
|
|
46
46
|
abstract readAsync(byteOffset?: number, byteLength?: number): Promise<Uint8Array>;
|
|
47
47
|
/** Read data synchronously. @note WebGL2 only */
|
|
48
|
-
|
|
48
|
+
readSyncWebGL(byteOffset?: number, byteLength?: number): Uint8Array;
|
|
49
49
|
/** Max amount of debug data saved. Two vec4's */
|
|
50
50
|
static DEBUG_DATA_MAX_LENGTH: number;
|
|
51
51
|
/** A partial CPU-side copy of the data in this buffer, for debugging purposes */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/buffer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/buffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAEnD,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG;IACxC,uEAAuE;IACvE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+GAA+G;IAC/G,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,WAAW,GAAG,eAAe,GAAG,IAAI,CAAC;IAC5C,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAGhC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,0BAA0B;AAC1B,8BAAsB,MAAO,SAAQ,QAAQ,CAAC,WAAW,CAAC;IACxD,OAAgB,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,CAQjD;IAGF,MAAM,CAAC,QAAQ,SAAQ;IACvB,MAAM,CAAC,SAAS,SAAQ;IACxB,MAAM,CAAC,QAAQ,SAAU;IACzB,MAAM,CAAC,QAAQ,SAAU;IACzB,mBA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