@luma.gl/core 9.0.11 → 9.1.0-alpha.2
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/LICENSE +34 -0
- package/dist/adapter/canvas-context.d.ts +5 -0
- package/dist/adapter/canvas-context.d.ts.map +1 -1
- package/dist/adapter/device.d.ts +10 -8
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +20 -18
- package/dist/{lib → adapter}/luma.d.ts +2 -2
- package/dist/adapter/luma.d.ts.map +1 -0
- package/dist/{lib → adapter}/luma.js +7 -7
- package/dist/adapter/resources/buffer.js +5 -5
- package/dist/adapter/resources/compute-pipeline.d.ts +2 -0
- package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pipeline.js +3 -0
- package/dist/adapter/resources/external-texture.d.ts +1 -1
- package/dist/adapter/resources/external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/external-texture.js +1 -1
- package/dist/adapter/resources/framebuffer.d.ts +3 -3
- package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/framebuffer.js +2 -83
- package/dist/adapter/resources/render-pass.d.ts +2 -2
- package/dist/adapter/resources/render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.d.ts +2 -5
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/resource.d.ts +3 -3
- package/dist/adapter/resources/resource.d.ts.map +1 -1
- package/dist/adapter/resources/resource.js +1 -1
- package/dist/adapter/resources/shader.d.ts +5 -2
- package/dist/adapter/resources/shader.d.ts.map +1 -1
- package/dist/adapter/resources/shader.js +15 -9
- package/dist/adapter/resources/texture-view.d.ts +1 -1
- package/dist/adapter/resources/texture-view.d.ts.map +1 -1
- package/dist/adapter/resources/texture.d.ts +111 -49
- package/dist/adapter/resources/texture.d.ts.map +1 -1
- package/dist/adapter/resources/texture.js +96 -12
- package/dist/adapter/resources/transform-feedback.d.ts +1 -1
- package/dist/adapter/resources/transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.d.ts +1 -1
- package/dist/adapter/resources/vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/vertex-array.js +6 -2
- package/dist/adapter/types/{types.d.ts → attachments.d.ts} +5 -16
- package/dist/adapter/types/attachments.d.ts.map +1 -0
- 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/compiler-message.d.ts.map +1 -0
- package/dist/adapter/types/parameters.d.ts +2 -6
- package/dist/adapter/types/parameters.d.ts.map +1 -1
- package/dist/adapter/types/shader-layout.d.ts +23 -3
- package/dist/adapter/types/shader-layout.d.ts.map +1 -1
- package/dist/adapter/types/uniforms.d.ts +4 -0
- package/dist/adapter/types/uniforms.d.ts.map +1 -0
- package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.d.ts +1 -1
- package/dist/adapter-utils/format-compiler-log.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.d.ts +4 -11
- package/dist/adapter-utils/get-attribute-from-layouts.d.ts.map +1 -0
- package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.js +10 -30
- package/dist/adapter-utils/is-uniform-value.d.ts +3 -0
- package/dist/adapter-utils/is-uniform-value.d.ts.map +1 -0
- package/dist/adapter-utils/is-uniform-value.js +7 -0
- package/dist/dist.dev.js +266 -588
- package/dist/dist.min.js +4 -4
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.d.ts +3 -3
- package/dist/gpu-type-utils/decode-attribute-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.d.ts +1 -1
- package/dist/gpu-type-utils/decode-data-type.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.d.ts +1 -1
- package/dist/gpu-type-utils/decode-shader-types.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.js +0 -2
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-texture-format.d.ts +2 -2
- package/dist/gpu-type-utils/decode-texture-format.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.d.ts +1 -1
- package/dist/gpu-type-utils/decode-vertex-format.d.ts.map +1 -0
- package/dist/gpu-type-utils/shader-types.d.ts.map +1 -0
- package/dist/{adapter/types → gpu-type-utils}/texture-formats.d.ts +1 -1
- package/dist/gpu-type-utils/texture-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.d.ts +2 -2
- package/dist/gpu-type-utils/vertex-format-from-attribute.d.ts.map +1 -0
- package/dist/gpu-type-utils/vertex-formats.d.ts.map +1 -0
- package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.d.ts +1 -1
- package/dist/gpu-type-utils/wgsl-utils.d.ts.map +1 -0
- package/dist/index.cjs +190 -411
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +28 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -36
- package/dist/init.js +1 -1
- package/dist/{lib/uniforms → portable}/uniform-block.d.ts +3 -3
- package/dist/portable/uniform-block.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-block.js +2 -2
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.d.ts +2 -2
- package/dist/portable/uniform-buffer-layout.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-buffer-layout.js +6 -7
- package/dist/{lib/uniforms → portable}/uniform-store.d.ts +4 -4
- package/dist/portable/uniform-store.d.ts.map +1 -0
- package/dist/{lib/uniforms → portable}/uniform-store.js +11 -9
- package/dist/types.d.ts +0 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/array-equal.d.ts.map +1 -1
- package/dist/utils/array-equal.js +6 -7
- package/dist/utils/array-utils-flat.d.ts +1 -7
- package/dist/utils/array-utils-flat.d.ts.map +1 -1
- package/dist/utils/array-utils-flat.js +0 -23
- package/dist/utils/is-array.d.ts +3 -3
- package/dist/utils/is-array.d.ts.map +1 -1
- package/dist/utils/is-array.js +2 -2
- package/dist/utils/uid.d.ts +7 -0
- package/dist/utils/uid.d.ts.map +1 -0
- package/dist/utils/{utils.js → uid.js} +0 -11
- package/package.json +5 -5
- package/src/adapter/canvas-context.ts +6 -0
- package/src/adapter/device.ts +34 -31
- package/src/{lib → adapter}/luma.ts +9 -9
- package/src/adapter/resources/buffer.ts +5 -5
- package/src/adapter/resources/command-encoder.ts +1 -1
- package/src/adapter/resources/compute-pass.ts +3 -3
- package/src/adapter/resources/compute-pipeline.ts +6 -3
- package/src/adapter/resources/external-texture.ts +2 -2
- package/src/adapter/resources/framebuffer.ts +5 -92
- package/src/adapter/resources/query-set.ts +2 -2
- package/src/adapter/resources/render-pass.ts +11 -7
- package/src/adapter/resources/render-pipeline.ts +3 -6
- package/src/adapter/resources/resource.ts +7 -7
- package/src/adapter/resources/shader.ts +18 -11
- package/src/adapter/resources/texture-view.ts +5 -5
- package/src/adapter/resources/texture.ts +226 -77
- package/src/adapter/resources/transform-feedback.ts +1 -1
- package/src/adapter/resources/vertex-array.ts +7 -3
- package/src/adapter/types/{types.ts → attachments.ts} +8 -17
- package/src/adapter/types/buffer-layout.ts +1 -1
- package/src/adapter/types/parameters.ts +10 -14
- package/src/adapter/types/shader-layout.ts +31 -29
- package/src/adapter/types/uniforms.ts +10 -0
- package/src/{lib/compiler-log → adapter-utils}/format-compiler-log.ts +1 -1
- package/src/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.ts +18 -42
- package/src/adapter-utils/is-uniform-value.ts +10 -0
- package/src/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.ts +3 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-data-type.ts +1 -1
- package/src/{adapter/type-utils → gpu-type-utils}/decode-shader-types.ts +1 -3
- package/src/{adapter/type-utils → gpu-type-utils}/decode-texture-format.ts +2 -2
- package/src/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.ts +1 -1
- package/src/{adapter/types → gpu-type-utils}/texture-formats.ts +1 -1
- package/src/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.ts +2 -2
- package/src/{adapter/type-utils → gpu-type-utils}/wgsl-utils.ts +1 -1
- package/src/index.ts +69 -84
- package/src/{lib/uniforms → portable}/uniform-block.ts +5 -5
- package/src/{lib/uniforms → portable}/uniform-buffer-layout.ts +9 -9
- package/src/{lib/uniforms → portable}/uniform-store.ts +14 -12
- package/src/types.ts +0 -12
- package/src/utils/array-equal.ts +6 -7
- package/src/utils/array-utils-flat.ts +1 -31
- package/src/utils/is-array.ts +5 -5
- package/src/utils/{utils.ts → uid.ts} +0 -12
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-attribute-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-data-type.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-shader-types.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-texture-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/decode-vertex-format.d.ts.map +0 -1
- package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts.map +0 -1
- package/dist/adapter/type-utils/wgsl-utils.d.ts.map +0 -1
- package/dist/adapter/types/accessor.d.ts +0 -23
- package/dist/adapter/types/accessor.d.ts.map +0 -1
- package/dist/adapter/types/shader-types.d.ts.map +0 -1
- package/dist/adapter/types/texture-formats.d.ts.map +0 -1
- package/dist/adapter/types/types.d.ts.map +0 -1
- package/dist/adapter/types/vertex-formats.d.ts.map +0 -1
- package/dist/lib/compiler-log/compiler-message.d.ts.map +0 -1
- package/dist/lib/compiler-log/format-compiler-log.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.d.ts +0 -9
- package/dist/lib/compiler-log/get-shader-info.d.ts.map +0 -1
- package/dist/lib/compiler-log/get-shader-info.js +0 -29
- package/dist/lib/luma.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-block.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-buffer-layout.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform-store.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.d.ts +0 -10
- package/dist/lib/uniforms/uniform.d.ts.map +0 -1
- package/dist/lib/uniforms/uniform.js +0 -20
- package/dist/utils/assert.d.ts +0 -2
- package/dist/utils/assert.d.ts.map +0 -1
- package/dist/utils/assert.js +0 -10
- package/dist/utils/cast.d.ts +0 -3
- package/dist/utils/cast.d.ts.map +0 -1
- package/dist/utils/cast.js +0 -7
- package/dist/utils/check-props.d.ts +0 -7
- package/dist/utils/check-props.d.ts.map +0 -1
- package/dist/utils/check-props.js +0 -36
- package/dist/utils/deep-equal.d.ts +0 -9
- package/dist/utils/deep-equal.d.ts.map +0 -1
- package/dist/utils/deep-equal.js +0 -50
- package/dist/utils/format-value.d.ts +0 -7
- package/dist/utils/format-value.d.ts.map +0 -1
- package/dist/utils/format-value.js +0 -39
- package/dist/utils/load-file.d.ts +0 -35
- package/dist/utils/load-file.d.ts.map +0 -1
- package/dist/utils/load-file.js +0 -74
- package/dist/utils/random.d.ts +0 -5
- package/dist/utils/random.d.ts.map +0 -1
- package/dist/utils/random.js +0 -18
- package/dist/utils/request-animation-frame.d.ts +0 -3
- package/dist/utils/request-animation-frame.d.ts.map +0 -1
- package/dist/utils/request-animation-frame.js +0 -16
- package/dist/utils/stub-methods.d.ts +0 -2
- package/dist/utils/stub-methods.d.ts.map +0 -1
- package/dist/utils/stub-methods.js +0 -19
- package/dist/utils/utils.d.ts +0 -9
- package/dist/utils/utils.d.ts.map +0 -1
- package/src/adapter/types/accessor.ts +0 -37
- package/src/lib/compiler-log/get-shader-info.ts +0 -42
- package/src/lib/uniforms/uniform.ts +0 -31
- package/src/utils/assert.ts +0 -11
- package/src/utils/cast.ts +0 -8
- package/src/utils/check-props.ts +0 -82
- package/src/utils/deep-equal.ts +0 -51
- package/src/utils/format-value.ts +0 -47
- package/src/utils/load-file.ts +0 -91
- package/src/utils/random.ts +0 -21
- package/src/utils/request-animation-frame.ts +0 -19
- package/src/utils/stub-methods.ts +0 -29
- /package/dist/adapter/types/{accessor.js → attachments.js} +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.d.ts +0 -0
- /package/dist/{lib/compiler-log → adapter/types}/compiler-message.js +0 -0
- /package/dist/adapter/types/{shader-types.js → uniforms.js} +0 -0
- /package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-texture-format.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/shader-types.d.ts +0 -0
- /package/dist/{adapter/types/texture-formats.js → gpu-type-utils/shader-types.js} +0 -0
- /package/dist/{adapter/types/types.js → gpu-type-utils/texture-formats.js} +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.js +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.d.ts +0 -0
- /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.js +0 -0
- /package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.js +0 -0
- /package/src/{lib/compiler-log → adapter/types}/compiler-message.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/shader-types.ts +0 -0
- /package/src/{adapter/types → gpu-type-utils}/vertex-formats.ts +0 -0
|
@@ -48,15 +48,15 @@ export declare abstract class Resource<Props extends ResourceProps> {
|
|
|
48
48
|
* Attaches a resource. Attached resources are auto destroyed when this resource is destroyed
|
|
49
49
|
* Called automatically when sub resources are auto created but can be called by application
|
|
50
50
|
*/
|
|
51
|
-
attachResource(resource: Resource<
|
|
51
|
+
attachResource(resource: Resource<ResourceProps>): void;
|
|
52
52
|
/**
|
|
53
53
|
* Detach an attached resource. The resource will no longer be auto-destroyed when this resource is destroyed.
|
|
54
54
|
*/
|
|
55
|
-
detachResource(resource: Resource<
|
|
55
|
+
detachResource(resource: Resource<ResourceProps>): void;
|
|
56
56
|
/**
|
|
57
57
|
* Destroys a resource (only if owned), and removes from the owned (auto-destroy) list for this resource.
|
|
58
58
|
*/
|
|
59
|
-
destroyAttachedResource(resource: Resource<
|
|
59
|
+
destroyAttachedResource(resource: Resource<ResourceProps>): void;
|
|
60
60
|
/** Destroy all owned resources. Make sure the resources are no longer needed before calling. */
|
|
61
61
|
destroyAttachedResources(): void;
|
|
62
62
|
/** Perform all destroy steps. Can be called by derived resources when overriding destroy() */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AAGtC,MAAM,MAAM,aAAa,GAAG;IAC1B,sGAAsG;IACtG,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,kDAAkD;IAClD,QAAQ,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;CACjC,CAAC;AAEF;;GAEG;AACH,8BAAsB,QAAQ,CAAC,KAAK,SAAS,aAAa;IACxD,sCAAsC;IACtC,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,aAAa,CAAC,CAI1C;IAEF,QAAQ,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC;IAE5C,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,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AC,kBAAkB,CAAsC;IAEhE;;OAEG;gBACS,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC;IAgBvE;;OAEG;IACH,OAAO,IAAI,IAAI;IAIf,gCAAgC;IAChC,MAAM,IAAI,IAAI;IAKd,QAAQ,IAAI,MAAM;IAIlB;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAMlB;;;OAGG;IACH,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,aAAa,CAAC,GAAG,IAAI;IAIvD;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,aAAa,CAAC,GAAG,IAAI;IAIvD;;OAEG;IACH,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,aAAa,CAAC,GAAG,IAAI;IAMhE,gGAAgG;IAChG,wBAAwB,IAAI,IAAI;IAUhC,8FAA8F;IAC9F,SAAS,CAAC,eAAe,IAAI,IAAI;IAMjC,mGAAmG;IACnG,SAAS,CAAC,WAAW,IAAI,IAAI;IAM7B,qDAAqD;IACrD,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,SAA2B,GAAG,IAAI;IAOpF,uDAAuD;IACvD,SAAS,CAAC,sBAAsB,CAAC,IAAI,SAA2B,GAAG,IAAI;IAOvE,8DAA8D;IAC9D,OAAO,CAAC,QAAQ;CAOjB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Device } from "../device.js";
|
|
2
2
|
import { Resource, ResourceProps } from "./resource.js";
|
|
3
|
-
import { CompilerMessage } from "
|
|
3
|
+
import { CompilerMessage } from "../types/compiler-message.js";
|
|
4
4
|
/**
|
|
5
5
|
* Properties for a Shader
|
|
6
6
|
*/
|
|
@@ -41,7 +41,10 @@ export declare abstract class Shader extends Resource<ShaderProps> {
|
|
|
41
41
|
getTranslatedSource(): string | null;
|
|
42
42
|
/** In browser logging of errors */
|
|
43
43
|
debugShader(trigger?: "never" | "always" | "errors" | "warnings"): Promise<void>;
|
|
44
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* In-browser UI logging of errors
|
|
46
|
+
* TODO - this HTML formatting code should not be in Device, should be pluggable
|
|
47
|
+
*/
|
|
45
48
|
protected _displayShaderLog(messages: readonly CompilerMessage[]): void;
|
|
46
49
|
}
|
|
47
50
|
//# sourceMappingURL=shader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/shader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAGnD,OAAO,EAAC,eAAe,EAAC,
|
|
1
|
+
{"version":3,"file":"shader.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/shader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAGnD,OAAO,EAAC,eAAe,EAAC,qCAAkC;AAG1D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG;IACxC,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACpC,yEAAyE;IACzE,KAAK,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IAC1C,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;CACpD,CAAC;AAEF;;;GAGG;AACH,8BAAsB,MAAO,SAAQ,QAAQ,CAAC,WAAW,CAAC;IACxD,OAAgB,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,CAQjD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IAClD,qCAAqC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wGAAwG;IACxG,iBAAiB,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAa;IAE/D,mCAAmC;gBACvB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAM9C,sCAAsC;IACtC,QAAQ,CAAC,kBAAkB,IAAI,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC;IAElE,kDAAkD;IAClD,sBAAsB,IAAI,SAAS,eAAe,EAAE,GAAG,IAAI;IAI3D,mHAAmH;IACnH,mBAAmB,IAAI,MAAM,GAAG,IAAI;IAMpC,mCAAmC;IAC7B,WAAW,CAAC,OAAO,6CAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB5D;;;OAGG;IACH,SAAS,CAAC,iBAAiB,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,IAAI;CAyCxE"}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { Resource } from "./resource.js";
|
|
5
5
|
// import { log } from '../../utils/log';
|
|
6
|
-
import { uid } from "../../utils/
|
|
7
|
-
import { formatCompilerLog } from "../../
|
|
8
|
-
import { getShaderInfo } from "../../lib/compiler-log/get-shader-info.js";
|
|
6
|
+
import { uid } from "../../utils/uid.js";
|
|
7
|
+
import { formatCompilerLog } from "../../adapter-utils/format-compiler-log.js";
|
|
9
8
|
/**
|
|
10
9
|
* Immutable Shader object
|
|
11
10
|
* In WebGPU the handle can be copied between threads
|
|
@@ -66,13 +65,16 @@ export class Shader extends Resource {
|
|
|
66
65
|
this._displayShaderLog(messages);
|
|
67
66
|
}
|
|
68
67
|
// PRIVATE
|
|
69
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* In-browser UI logging of errors
|
|
70
|
+
* TODO - this HTML formatting code should not be in Device, should be pluggable
|
|
71
|
+
*/
|
|
70
72
|
_displayShaderLog(messages) {
|
|
71
73
|
// Return if under Node.js / incomplete `document` polyfills
|
|
72
74
|
if (typeof document === 'undefined' || !document?.createElement) {
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
75
|
-
const shaderName =
|
|
77
|
+
const shaderName = getShaderName(this.source);
|
|
76
78
|
const shaderTitle = `${this.stage} ${shaderName}`;
|
|
77
79
|
let htmlLog = formatCompilerLog(messages, this.source, { showSourceCode: 'all', html: true });
|
|
78
80
|
// Show translated source if available
|
|
@@ -95,9 +97,7 @@ ${htmlLog}
|
|
|
95
97
|
button.style.textAlign = 'left';
|
|
96
98
|
document.body.appendChild(button);
|
|
97
99
|
const errors = document.getElementsByClassName('luma-compiler-log-error');
|
|
98
|
-
|
|
99
|
-
errors[0].scrollIntoView();
|
|
100
|
-
}
|
|
100
|
+
errors[0]?.scrollIntoView();
|
|
101
101
|
// TODO - add a small embedded copy button (instead of main button)
|
|
102
102
|
button.onclick = () => {
|
|
103
103
|
// const source = this.source.replaceAll('\n', '<br />');
|
|
@@ -110,5 +110,11 @@ ${htmlLog}
|
|
|
110
110
|
// HELPERS
|
|
111
111
|
/** Deduce an id, from shader source, or supplied id, or shader type */
|
|
112
112
|
function getShaderIdFromProps(props) {
|
|
113
|
-
return
|
|
113
|
+
return getShaderName(props.source) || props.id || uid(`unnamed ${props.stage}-shader`);
|
|
114
|
+
}
|
|
115
|
+
/** Extracts GLSLIFY style naming of shaders: `#define SHADER_NAME ...` */
|
|
116
|
+
function getShaderName(shader, defaultName = 'unnamed') {
|
|
117
|
+
const SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/;
|
|
118
|
+
const match = SHADER_NAME_REGEXP.exec(shader);
|
|
119
|
+
return match ? match[1] : defaultName;
|
|
114
120
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Device } from "../device.js";
|
|
2
2
|
import type { Texture } from "./texture.js";
|
|
3
|
-
import type { TextureFormat } from "
|
|
3
|
+
import type { TextureFormat } from "../../gpu-type-utils/texture-formats.js";
|
|
4
4
|
import { Resource, ResourceProps } from "./resource.js";
|
|
5
5
|
/** Properties for initializing a texture view */
|
|
6
6
|
export type TextureViewProps = ResourceProps & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture-view.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/texture-view.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,OAAO,EAAC,qBAAkB;AACvC,OAAO,KAAK,EAAC,aAAa,EAAC,
|
|
1
|
+
{"version":3,"file":"texture-view.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/texture-view.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,OAAO,EAAC,qBAAkB;AACvC,OAAO,KAAK,EAAC,aAAa,EAAC,gDAA6C;AACxE,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAEnD,iDAAiD;AACjD,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,wIAAwI;IACxI,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;IACpE,sFAAsF;IACtF,MAAM,CAAC,EAAE,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;IAC/C,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,aAAa,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+FAA+F;IAC/F,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,mCAAmC;AACnC,8BAAsB,WAAY,SAAQ,QAAQ,CAAC,gBAAgB,CAAC;IAClE,OAAgB,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAStD;IAEF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,0EAA0E;gBAC9D,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG;QAAC,OAAO,EAAE,OAAO,CAAA;KAAC;CAGzE"}
|
|
@@ -1,70 +1,109 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { Device } from "../device.js";
|
|
3
2
|
import type { TypedArray } from "../../types.js";
|
|
4
|
-
import type { TextureFormat } from "
|
|
3
|
+
import type { TextureFormat } from "../../gpu-type-utils/texture-formats.js";
|
|
4
|
+
import type { TextureView, TextureViewProps } from "./texture-view.js";
|
|
5
5
|
import { Resource, ResourceProps } from "./resource.js";
|
|
6
6
|
import { Sampler, SamplerProps } from "./sampler.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export type
|
|
12
|
-
/**
|
|
13
|
-
export type
|
|
7
|
+
/**
|
|
8
|
+
* These represent the main compressed texture formats
|
|
9
|
+
* Each format typically has a number of more specific subformats
|
|
10
|
+
*/
|
|
11
|
+
export type TextureCompressionFormat = 'dxt' | 'dxt-srgb' | 'etc1' | 'etc2' | 'pvrtc' | 'atc' | 'astc' | 'rgtc';
|
|
12
|
+
/** Names of cube texture faces */
|
|
13
|
+
export type TextureCubeFace = '+X' | '-X' | '+Y' | '-Y' | '+Z' | '-Z';
|
|
14
|
+
/**
|
|
15
|
+
* One mip level
|
|
16
|
+
* Basic data structure is similar to `ImageData`
|
|
17
|
+
* additional optional fields can describe compressed texture data.
|
|
18
|
+
*/
|
|
19
|
+
export type TextureLevelData = {
|
|
20
|
+
/** WebGPU style format string. Defaults to 'rgba8unorm' */
|
|
21
|
+
format?: TextureFormat;
|
|
22
|
+
data: TypedArray;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
compressed?: boolean;
|
|
26
|
+
byteLength?: number;
|
|
27
|
+
hasAlpha?: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Built-in data types that can be used to initialize textures
|
|
31
|
+
* @note WebGL supports OffscreenCanvas but seems WebGPU does not?
|
|
32
|
+
*/
|
|
33
|
+
export type ExternalImage = ImageData | ImageBitmap | HTMLImageElement | HTMLVideoElement | HTMLCanvasElement;
|
|
34
|
+
export type TextureLevelSource = TextureLevelData | ExternalImage;
|
|
35
|
+
/** Texture data can be one or more mip levels */
|
|
36
|
+
export type TextureData = TextureLevelData | ExternalImage | (TextureLevelData | ExternalImage)[];
|
|
37
|
+
/** @todo - define what data type is supported for 1D textures */
|
|
38
|
+
export type Texture1DData = TypedArray | TextureLevelData;
|
|
39
|
+
/** Texture data can be one or more mip levels */
|
|
40
|
+
export type Texture2DData = TypedArray | TextureLevelData | ExternalImage | (TextureLevelData | ExternalImage)[];
|
|
41
|
+
/** Array of textures */
|
|
42
|
+
export type Texture3DData = TypedArray | TextureData[];
|
|
43
|
+
/** 6 face textures */
|
|
44
|
+
export type TextureCubeData = Record<TextureCubeFace, Texture2DData>;
|
|
45
|
+
/** Array of textures */
|
|
46
|
+
export type TextureArrayData = TextureData[];
|
|
47
|
+
/** Array of 6 face textures */
|
|
48
|
+
export type TextureCubeArrayData = Record<TextureCubeFace, TextureData>[];
|
|
49
|
+
type TextureDataProps = Texture1DProps | Texture2DProps | Texture3DProps | TextureArrayProps | TextureCubeProps | TextureCubeArrayProps;
|
|
50
|
+
type Texture1DProps = {
|
|
51
|
+
dimension: '1d';
|
|
52
|
+
data?: Texture1DData | null;
|
|
53
|
+
};
|
|
54
|
+
type Texture2DProps = {
|
|
55
|
+
dimension?: '2d';
|
|
56
|
+
data?: Texture2DData | null;
|
|
57
|
+
};
|
|
58
|
+
type Texture3DProps = {
|
|
59
|
+
dimension: '3d';
|
|
60
|
+
data?: Texture3DData | null;
|
|
61
|
+
};
|
|
62
|
+
type TextureArrayProps = {
|
|
63
|
+
dimension: '2d-array';
|
|
64
|
+
data?: TextureArrayData | null;
|
|
65
|
+
};
|
|
66
|
+
type TextureCubeProps = {
|
|
67
|
+
dimension: 'cube';
|
|
68
|
+
data?: TextureCubeData | null;
|
|
69
|
+
};
|
|
70
|
+
type TextureCubeArrayProps = {
|
|
71
|
+
dimension: 'cube-array';
|
|
72
|
+
data: TextureCubeArrayData | null;
|
|
73
|
+
};
|
|
74
|
+
/** Texture properties */
|
|
75
|
+
export type TextureProps = ResourceProps & TextureDataProps & {
|
|
14
76
|
format?: TextureFormat;
|
|
15
|
-
dimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';
|
|
16
77
|
width?: number | undefined;
|
|
17
78
|
height?: number | undefined;
|
|
18
79
|
depth?: number;
|
|
19
80
|
usage?: number;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
81
|
+
/** How many mip levels */
|
|
82
|
+
mipLevels?: number | 'pyramid';
|
|
83
|
+
/** Multi sampling */
|
|
23
84
|
samples?: number;
|
|
24
|
-
|
|
25
|
-
|
|
85
|
+
/** Specifying mipmaps will default mipLevels to 'pyramid' and attempt to generate mipmaps */
|
|
86
|
+
mipmaps?: boolean;
|
|
87
|
+
/** Sampler (or SamplerProps) for the default sampler for this texture. Used if no sampler provided. Note that other samplers can still be used. */
|
|
26
88
|
sampler?: Sampler | SamplerProps;
|
|
89
|
+
/** Props for the default TextureView for this texture. Note that other views can still be created and used. */
|
|
27
90
|
view?: TextureViewProps;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
depth?: number;
|
|
33
|
-
mipLevels?: number;
|
|
34
|
-
format?: string;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated
|
|
38
|
-
* @todo remove, are these even used anymore?
|
|
39
|
-
*/
|
|
40
|
-
export type DeprecatedWebGLTextureProps = {
|
|
41
|
-
/** @deprecated use props.sampler */
|
|
42
|
-
parameters?: Record<number, number>;
|
|
43
|
-
/** @deprecated use props.data */
|
|
44
|
-
pixels?: any;
|
|
45
|
-
/** @deprecated use props.format */
|
|
46
|
-
dataFormat?: number | null;
|
|
47
|
-
/** @deprecated rarely supported */
|
|
48
|
-
border?: number;
|
|
49
|
-
/** @deprecated WebGL only. */
|
|
50
|
-
pixelStore?: object;
|
|
51
|
-
/** @deprecated WebGL only. */
|
|
52
|
-
textureUnit?: number;
|
|
53
|
-
/** @deprecated WebGL only. Use dimension. */
|
|
54
|
-
target?: number;
|
|
91
|
+
/** @deprecated - this is implicit from format */
|
|
92
|
+
compressed?: boolean;
|
|
55
93
|
};
|
|
56
94
|
/**
|
|
57
95
|
* Abstract Texture interface
|
|
58
96
|
* Texture Object
|
|
59
97
|
* https://gpuweb.github.io/gpuweb/#gputexture
|
|
60
98
|
*/
|
|
61
|
-
export declare abstract class Texture
|
|
62
|
-
static defaultProps: Required<TextureProps>;
|
|
99
|
+
export declare abstract class Texture extends Resource<TextureProps> {
|
|
63
100
|
static COPY_SRC: number;
|
|
64
101
|
static COPY_DST: number;
|
|
65
|
-
static
|
|
66
|
-
static
|
|
102
|
+
static TEXTURE: number;
|
|
103
|
+
static STORAGE: number;
|
|
67
104
|
static RENDER_ATTACHMENT: number;
|
|
105
|
+
static CubeFaces: TextureCubeFace[];
|
|
106
|
+
static defaultProps: Required<TextureProps>;
|
|
68
107
|
get [Symbol.toStringTag](): string;
|
|
69
108
|
/** dimension of this texture */
|
|
70
109
|
readonly dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';
|
|
@@ -75,16 +114,39 @@ export declare abstract class Texture<Props extends TextureProps = TextureProps>
|
|
|
75
114
|
/** height in pixels of this texture */
|
|
76
115
|
height: number;
|
|
77
116
|
/** depth of this texture */
|
|
78
|
-
|
|
117
|
+
depth: number;
|
|
118
|
+
/** mip levels in this texture */
|
|
119
|
+
mipLevels: number;
|
|
79
120
|
/** Default sampler for this texture */
|
|
80
121
|
abstract sampler: Sampler;
|
|
81
122
|
/** Default view for this texture */
|
|
82
123
|
abstract view: TextureView;
|
|
83
124
|
/** "Time" of last update. Monotonically increasing timestamp */
|
|
84
125
|
updateTimestamp: number;
|
|
126
|
+
/** Check if data is an external image */
|
|
127
|
+
static isExternalImage(data: unknown): data is ExternalImage;
|
|
128
|
+
/** Determine size (width and height) of provided image data */
|
|
129
|
+
static getExternalImageSize(data: ExternalImage): {
|
|
130
|
+
width: number;
|
|
131
|
+
height: number;
|
|
132
|
+
} | null;
|
|
133
|
+
/** Check if texture data is a typed array */
|
|
134
|
+
isTextureLevelData(data: TextureData): data is TextureLevelData;
|
|
135
|
+
/** Get the size of the texture described by the provided TextureData */
|
|
136
|
+
getTextureDataSize(data: TextureData | TextureCubeData | TextureArrayData | TextureCubeArrayData | TypedArray): {
|
|
137
|
+
width: number;
|
|
138
|
+
height: number;
|
|
139
|
+
} | null;
|
|
140
|
+
/** Calculate the number of mip levels for a texture of width and height */
|
|
141
|
+
getMipLevelCount(width: number, height: number): number;
|
|
142
|
+
/** Convert luma.gl cubemap face constants to depth index */
|
|
143
|
+
getCubeFaceDepth(face: TextureCubeFace): number;
|
|
85
144
|
/** Do not use directly. Create with device.createTexture() */
|
|
86
|
-
constructor(device: Device, props:
|
|
145
|
+
constructor(device: Device, props: TextureProps);
|
|
87
146
|
/** Create a texture view for this texture */
|
|
88
|
-
abstract createView(props
|
|
147
|
+
abstract createView(props: TextureViewProps): TextureView;
|
|
148
|
+
/** Set sampler props associated with this texture */
|
|
149
|
+
abstract setSampler(sampler?: Sampler | SamplerProps): void;
|
|
89
150
|
}
|
|
151
|
+
export {};
|
|
90
152
|
//# sourceMappingURL=texture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/texture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/texture.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,UAAU,EAAC,uBAAoB;AAC5C,OAAO,KAAK,EAAC,aAAa,EAAC,gDAA6C;AACxE,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,0BAAuB;AAClE,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AACnD,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,qBAAkB;AAEhD;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAChC,KAAK,GACL,UAAU,GACV,MAAM,GACN,MAAM,GACN,OAAO,GACP,KAAK,GACL,MAAM,GACN,MAAM,CAAC;AAEX,kCAAkC;AAClC,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtE;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,2DAA2D;IAC3D,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,WAAW,GACX,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,CAAC;AA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AAE,eAAe,GAAG,MAAM;IAa/C,8DAA8D;gBAClD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;IAoC/C,6CAA6C;IAC7C,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,WAAW;IAEzD,qDAAqD;IACrD,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;CAC5D"}
|
|
@@ -8,6 +8,12 @@ import { Resource } from "./resource.js";
|
|
|
8
8
|
* https://gpuweb.github.io/gpuweb/#gputexture
|
|
9
9
|
*/
|
|
10
10
|
export class Texture extends Resource {
|
|
11
|
+
static COPY_SRC = 0x01;
|
|
12
|
+
static COPY_DST = 0x02;
|
|
13
|
+
static TEXTURE = 0x04;
|
|
14
|
+
static STORAGE = 0x08;
|
|
15
|
+
static RENDER_ATTACHMENT = 0x10;
|
|
16
|
+
static CubeFaces = ['+X', '-X', '+Y', '-Y', '+Z', '-Z'];
|
|
11
17
|
static defaultProps = {
|
|
12
18
|
...Resource.defaultProps,
|
|
13
19
|
data: null,
|
|
@@ -16,23 +22,14 @@ export class Texture extends Resource {
|
|
|
16
22
|
width: undefined,
|
|
17
23
|
height: undefined,
|
|
18
24
|
depth: 1,
|
|
19
|
-
mipmaps:
|
|
20
|
-
// type: undefined,
|
|
25
|
+
mipmaps: false,
|
|
21
26
|
compressed: false,
|
|
22
|
-
// mipLevels: 1,
|
|
23
27
|
usage: 0,
|
|
24
|
-
// usage: GPUTextureUsage.COPY_DST
|
|
25
28
|
mipLevels: undefined,
|
|
26
29
|
samples: undefined,
|
|
27
|
-
type: undefined,
|
|
28
30
|
sampler: {},
|
|
29
31
|
view: undefined
|
|
30
32
|
};
|
|
31
|
-
static COPY_SRC = 0x01;
|
|
32
|
-
static COPY_DST = 0x02;
|
|
33
|
-
static TEXTURE_BINDING = 0x04;
|
|
34
|
-
static STORAGE_BINDING = 0x08;
|
|
35
|
-
static RENDER_ATTACHMENT = 0x10;
|
|
36
33
|
get [Symbol.toStringTag]() {
|
|
37
34
|
return 'Texture';
|
|
38
35
|
}
|
|
@@ -46,16 +43,103 @@ export class Texture extends Resource {
|
|
|
46
43
|
height;
|
|
47
44
|
/** depth of this texture */
|
|
48
45
|
depth;
|
|
46
|
+
/** mip levels in this texture */
|
|
47
|
+
mipLevels;
|
|
49
48
|
/** "Time" of last update. Monotonically increasing timestamp */
|
|
50
49
|
updateTimestamp;
|
|
50
|
+
/** Check if data is an external image */
|
|
51
|
+
static isExternalImage(data) {
|
|
52
|
+
return ((typeof ImageData !== 'undefined' && data instanceof ImageData) ||
|
|
53
|
+
(typeof ImageBitmap !== 'undefined' && data instanceof ImageBitmap) ||
|
|
54
|
+
(typeof HTMLImageElement !== 'undefined' && data instanceof HTMLImageElement) ||
|
|
55
|
+
(typeof HTMLCanvasElement !== 'undefined' && data instanceof HTMLCanvasElement) ||
|
|
56
|
+
(typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement));
|
|
57
|
+
}
|
|
58
|
+
/** Determine size (width and height) of provided image data */
|
|
59
|
+
static getExternalImageSize(data) {
|
|
60
|
+
if ((typeof ImageData !== 'undefined' && data instanceof ImageData) ||
|
|
61
|
+
(typeof ImageBitmap !== 'undefined' && data instanceof ImageBitmap) ||
|
|
62
|
+
(typeof HTMLCanvasElement !== 'undefined' && data instanceof HTMLCanvasElement)) {
|
|
63
|
+
return { width: data.width, height: data.height };
|
|
64
|
+
}
|
|
65
|
+
if (typeof HTMLImageElement !== 'undefined' && data instanceof HTMLImageElement) {
|
|
66
|
+
return { width: data.naturalWidth, height: data.naturalHeight };
|
|
67
|
+
}
|
|
68
|
+
if (typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement) {
|
|
69
|
+
return { width: data.videoWidth, height: data.videoHeight };
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
/** Check if texture data is a typed array */
|
|
74
|
+
isTextureLevelData(data) {
|
|
75
|
+
const typedArray = data?.data;
|
|
76
|
+
return ArrayBuffer.isView(typedArray);
|
|
77
|
+
}
|
|
78
|
+
/** Get the size of the texture described by the provided TextureData */
|
|
79
|
+
getTextureDataSize(data) {
|
|
80
|
+
if (!data) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
if (ArrayBuffer.isView(data)) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
// Recurse into arrays (array of miplevels)
|
|
87
|
+
if (Array.isArray(data)) {
|
|
88
|
+
return this.getTextureDataSize(data[0]);
|
|
89
|
+
}
|
|
90
|
+
if (Texture.isExternalImage(data)) {
|
|
91
|
+
return Texture.getExternalImageSize(data);
|
|
92
|
+
}
|
|
93
|
+
if (data && typeof data === 'object' && data.constructor === Object) {
|
|
94
|
+
const untypedData = data;
|
|
95
|
+
return { width: untypedData.width, height: untypedData.height };
|
|
96
|
+
}
|
|
97
|
+
throw new Error('texture size deduction failed');
|
|
98
|
+
}
|
|
99
|
+
/** Calculate the number of mip levels for a texture of width and height */
|
|
100
|
+
getMipLevelCount(width, height) {
|
|
101
|
+
return Math.floor(Math.log2(Math.max(width, height))) + 1;
|
|
102
|
+
}
|
|
103
|
+
/** Convert luma.gl cubemap face constants to depth index */
|
|
104
|
+
getCubeFaceDepth(face) {
|
|
105
|
+
// prettier-ignore
|
|
106
|
+
switch (face) {
|
|
107
|
+
case '+X': return 0;
|
|
108
|
+
case '-X': return 1;
|
|
109
|
+
case '+Y': return 2;
|
|
110
|
+
case '-Y': return 3;
|
|
111
|
+
case '+Z': return 4;
|
|
112
|
+
case '-Z': return 5;
|
|
113
|
+
default: throw new Error(face);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
51
116
|
/** Do not use directly. Create with device.createTexture() */
|
|
52
|
-
constructor(device, props
|
|
53
|
-
super(device, props, defaultProps);
|
|
117
|
+
constructor(device, props) {
|
|
118
|
+
super(device, props, Texture.defaultProps);
|
|
54
119
|
this.dimension = this.props.dimension;
|
|
55
120
|
this.format = this.props.format;
|
|
121
|
+
// Size
|
|
56
122
|
this.width = this.props.width;
|
|
57
123
|
this.height = this.props.height;
|
|
58
124
|
this.depth = this.props.depth;
|
|
125
|
+
// Calculate size, if not provided
|
|
126
|
+
if (this.props.width === undefined || this.props.height === undefined) {
|
|
127
|
+
// @ts-ignore
|
|
128
|
+
const size = this.getTextureDataSize(this.props.data);
|
|
129
|
+
this.width = size?.width || 1;
|
|
130
|
+
this.height = size?.height || 1;
|
|
131
|
+
}
|
|
132
|
+
// mipLevels
|
|
133
|
+
// If mipmap generation is requested and mipLevels is not provided, initialize a full pyramid
|
|
134
|
+
if (this.props.mipmaps && this.props.mipLevels === undefined) {
|
|
135
|
+
this.props.mipLevels = 'pyramid';
|
|
136
|
+
}
|
|
137
|
+
// Auto-calculate the number of mip levels as a convenience
|
|
138
|
+
// TODO - Should we clamp to 1-getMipLevelCount?
|
|
139
|
+
this.mipLevels =
|
|
140
|
+
this.props.mipLevels === 'pyramid'
|
|
141
|
+
? this.getMipLevelCount(this.width, this.height)
|
|
142
|
+
: this.props.mipLevels || 1;
|
|
59
143
|
// TODO - perhaps this should be set on async write completion?
|
|
60
144
|
this.updateTimestamp = device.incrementTimestamp();
|
|
61
145
|
}
|
|
@@ -20,7 +20,7 @@ export type TransformFeedbackProps = ResourceProps & {
|
|
|
20
20
|
export declare abstract class TransformFeedback extends Resource<TransformFeedbackProps> {
|
|
21
21
|
static defaultProps: Required<TransformFeedbackProps>;
|
|
22
22
|
get [Symbol.toStringTag](): string;
|
|
23
|
-
constructor(device: Device, props
|
|
23
|
+
constructor(device: Device, props: TransformFeedbackProps);
|
|
24
24
|
abstract begin(topology?: PrimitiveTopology): void;
|
|
25
25
|
abstract end(): void;
|
|
26
26
|
abstract setBuffers(buffers: Record<string, Buffer | BufferRange>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-feedback.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/transform-feedback.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,iBAAiB,EAAC,+BAA4B;AACtD,OAAO,EAAC,YAAY,EAAC,kCAA+B;AACpD,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AACrC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAEnD,oBAAoB;AACpB,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG;IACnD,sCAAsC;IACtC,MAAM,EAAE,YAAY,CAAC;IACrB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC;CAC/C,CAAC;AAEF,8DAA8D;AAC9D,8BAAsB,iBAAkB,SAAQ,QAAQ,CAAC,sBAAsB,CAAC;IAC9E,OAAgB,YAAY,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAI5D;IAEF,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;gBAEW,MAAM,EAAE,MAAM,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"transform-feedback.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/transform-feedback.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,EAAC,iBAAiB,EAAC,+BAA4B;AACtD,OAAO,EAAC,YAAY,EAAC,kCAA+B;AACpD,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AACrC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAEnD,oBAAoB;AACpB,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG;IACnD,sCAAsC;IACtC,MAAM,EAAE,YAAY,CAAC;IACrB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC;CAC/C,CAAC;AAEF,8DAA8D;AAC9D,8BAAsB,iBAAkB,SAAQ,QAAQ,CAAC,sBAAsB,CAAC;IAC9E,OAAgB,YAAY,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAI5D;IAEF,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;gBAEW,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB;IAIzD,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,iBAAiB,GAAG,IAAI;IAClD,QAAQ,CAAC,GAAG,IAAI,IAAI;IAEpB,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG,IAAI;IACxE,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAC9F,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,IAAI;CACjF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TypedArray } from "../../types.js";
|
|
2
|
-
import { AttributeInfo } from "
|
|
2
|
+
import { AttributeInfo } from "../../adapter-utils/get-attribute-from-layouts.js";
|
|
3
3
|
import type { Device } from "../device.js";
|
|
4
4
|
import type { Buffer } from "./buffer.js";
|
|
5
5
|
import type { RenderPass } from "./render-pass.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/vertex-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,uBAAoB;AAC5C,OAAO,EACL,aAAa,EAEd,
|
|
1
|
+
{"version":3,"file":"vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/vertex-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,uBAAoB;AAC5C,OAAO,EACL,aAAa,EAEd,0DAAuD;AACxD,OAAO,KAAK,EAAC,MAAM,EAAC,qBAAkB;AACtC,OAAO,KAAK,EAAC,MAAM,EAAC,oBAAiB;AACrC,OAAO,KAAK,EAAC,UAAU,EAAC,yBAAsB;AAC9C,OAAO,KAAK,EAAC,cAAc,EAAC,6BAA0B;AACtD,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,sBAAmB;AAEnD,gDAAgD;AAChD,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF;;;;;;GAMG;AACH,8BAAsB,WAAY,SAAQ,QAAQ,CAAC,gBAAgB,CAAC;IAClE,OAAgB,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAGtD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,sCAAsC;IACtC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,8EAA8E;IAC9E,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,aAAa,EAAE,CAAC;IAEnD,mBAAmB;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IAClC,wCAAwC;IACxC,UAAU,EAAE,CAAC,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC;gBAE/B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB;IAenD,mEAAmE;IACnE,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IACrD,mEAAmE;IACnE,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAEnE,QAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IACvD,QAAQ,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAIxD,uDAAuD;IACvD,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI;CAGnE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { getAttributeInfosByLocation } from "
|
|
4
|
+
import { getAttributeInfosByLocation } from "../../adapter-utils/get-attribute-from-layouts.js";
|
|
5
5
|
import { Resource } from "./resource.js";
|
|
6
6
|
/**
|
|
7
7
|
* Stores attribute bindings.
|
|
@@ -30,7 +30,11 @@ export class VertexArray extends Resource {
|
|
|
30
30
|
super(device, props, VertexArray.defaultProps);
|
|
31
31
|
this.maxVertexAttributes = device.limits.maxVertexAttributes;
|
|
32
32
|
this.attributes = new Array(this.maxVertexAttributes).fill(null);
|
|
33
|
-
|
|
33
|
+
const { shaderLayout, bufferLayout } = props.renderPipeline || {};
|
|
34
|
+
if (!shaderLayout || !bufferLayout) {
|
|
35
|
+
throw new Error('VertexArray');
|
|
36
|
+
}
|
|
37
|
+
this.attributeInfos = getAttributeInfosByLocation(shaderLayout, bufferLayout, this.maxVertexAttributes);
|
|
34
38
|
}
|
|
35
39
|
// DEPRECATED METHODS
|
|
36
40
|
/** @deprecated Set constant attributes (WebGL only) */
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { NumberArray } from "../../types.js";
|
|
2
|
-
import type { ColorTextureFormat, DepthStencilTextureFormat, TextureFormat } from "
|
|
3
|
-
import type { Buffer } from "../resources/buffer.js";
|
|
2
|
+
import type { ColorTextureFormat, DepthStencilTextureFormat, TextureFormat } from "../../gpu-type-utils/texture-formats.js";
|
|
4
3
|
import type { Texture } from "../resources/texture.js";
|
|
4
|
+
import type { TextureView } from "../resources/texture-view.js";
|
|
5
5
|
/** Valid values for uniforms. @note boolean values get converted to 0 or 1 before setting */
|
|
6
6
|
export type UniformValue = number | boolean | Readonly<NumberArray>;
|
|
7
|
-
/** Buffer bindings */
|
|
8
|
-
export type Binding = Texture | Buffer | {
|
|
9
|
-
buffer: Buffer;
|
|
10
|
-
offset?: number;
|
|
11
|
-
size?: number;
|
|
12
|
-
};
|
|
13
7
|
/** Describes a buffer binding layout */
|
|
14
8
|
type BufferBindingLayout = {
|
|
15
9
|
/** The index of the binding point in the compiled and linked shader */
|
|
@@ -39,18 +33,13 @@ type StorageTextureBindingLayout = {
|
|
|
39
33
|
viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';
|
|
40
34
|
};
|
|
41
35
|
export type BindingDeclaration = BufferBindingLayout | TextureBindingLayout | StorageTextureBindingLayout;
|
|
42
|
-
export type TextureView = {
|
|
43
|
-
texture: WebGLTexture;
|
|
44
|
-
layer?: number;
|
|
45
|
-
level?: number;
|
|
46
|
-
};
|
|
47
36
|
/**
|
|
48
37
|
* Framebuffer attachments lets the user specify the textures that will be used for a RenderPass,
|
|
49
38
|
* together with some additional options for how to clear.
|
|
50
39
|
*/
|
|
51
40
|
export type ColorAttachment = {
|
|
52
41
|
/** Describes the texture subresource that will be output to for this color attachment. */
|
|
53
|
-
texture?: Texture;
|
|
42
|
+
texture?: TextureView | Texture;
|
|
54
43
|
/** Format of the texture resource. Used to auto create texture if not supplied */
|
|
55
44
|
format?: ColorTextureFormat;
|
|
56
45
|
/** Value to clear to prior to executing the render pass. Default: [0, 0, 0, 0]. Ignored if loadOp is not "clear". */
|
|
@@ -66,7 +55,7 @@ export type ColorAttachment = {
|
|
|
66
55
|
*/
|
|
67
56
|
export type DepthStencilAttachment = {
|
|
68
57
|
/** Describes the texture subresource that will be output to and read from for this depth/stencil attachment. */
|
|
69
|
-
texture?: Texture;
|
|
58
|
+
texture?: TextureView | Texture;
|
|
70
59
|
/** Format of the texture resource. Used to auto create texture if not supplied */
|
|
71
60
|
format?: DepthStencilTextureFormat;
|
|
72
61
|
/** Value to clear depth component to prior to executing the render pass, if depthLoadOp is "clear". 0.0-1.0. */
|
|
@@ -87,4 +76,4 @@ export type DepthStencilAttachment = {
|
|
|
87
76
|
stencilReadOnly?: boolean;
|
|
88
77
|
};
|
|
89
78
|
export {};
|
|
90
|
-
//# sourceMappingURL=
|
|
79
|
+
//# sourceMappingURL=attachments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/attachments.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,WAAW,EAAC,uBAAoB;AACxC,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACd,gDAA6C;AAC9C,OAAO,KAAK,EAAC,OAAO,EAAC,gCAA6B;AAClD,OAAO,KAAK,EAAC,WAAW,EAAC,qCAAkC;AAI3D,6FAA6F;AAC7F,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;AAIpE,wCAAwC;AACxC,KAAK,mBAAmB,GAAG;IACzB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,mBAAmB,CAAC;IAClD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,kCAAkC;AAClC,KAAK,oBAAoB,GAAG;IAC1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