@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wgsl-utils.js","names":["WGSL_TYPE_ALIAS_MAP","vec2i","vec3i","vec4i","vec2u","vec3u","vec4u","vec2f","vec3f","vec4f","vec2h","vec3h","vec4h"],"sources":["../../../src/adapter/type-utils/wgsl-utils.ts"],"sourcesContent":["import { ShaderAttributeType } from '../types/shader-types';\n\n/** Predeclared aliases @see https://www.w3.org/TR/WGSL/#vector-types */\nexport const WGSL_TYPE_ALIAS_MAP: Record<string, ShaderAttributeType> = {\n vec2i: 'vec2<i32>',\n vec3i: 'vec3<i32>',\n vec4i: 'vec4<i32>',\n vec2u: 'vec2<u32>',\n vec3u: 'vec3<u32>',\n vec4u: 'vec4<u32>',\n vec2f: 'vec2<f32>',\n vec3f: 'vec3<f32>',\n vec4f: 'vec4<f32>',\n // Requires the f16 extension.\n vec2h: 'vec2<f16>',\n vec3h: 'vec3<f16>',\n vec4h: 'vec4<f16>',\n};\n"],"mappings":"AAGA,OAAO,MAAMA,mBAAwD,GAAG;EACtEC,KAAK,EAAE,WAAW;EAClBC,KAAK,EAAE,WAAW;EAClBC,KAAK,EAAE,WAAW;EAClBC,KAAK,EAAE,WAAW;EAClBC,KAAK,EAAE,WAAW;EAClBC,KAAK,EAAE,WAAW;EAClBC,KAAK,EAAE,WAAW;EAClBC,KAAK,EAAE,WAAW;EAClBC,KAAK,EAAE,WAAW;EAElBC,KAAK,EAAE,WAAW;EAClBC,KAAK,EAAE,WAAW;EAClBC,KAAK,EAAE;AACT,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accessor.js","names":[],"sources":["../../../src/adapter/types/accessor.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Buffer} from '../resources/buffer';\n// import type {VertexFormat} from './data-formats';\n\n// ACCESSORS\n\n/**\n * Attribute descriptor object\n * @deprecated Use ShaderLayout\n */\nexport interface AccessorObject {\n buffer?: Buffer;\n // format: VertexFormat;\n offset?: number;\n // can now be described with single WebGPU-style `format` string\n\n // \n stride?: number;\n\n /** @deprecated - Use accessor.stepMode */\n divisor?: number;\n\n /** @deprecated - Infer from format */\n type?: number;\n /** @deprecated - Infer from format */\n size?: number;\n /** @deprecated - Infer from format */\n normalized?: boolean;\n /** @deprecated - Infer from format */\n integer?: boolean;\n\n /** @deprecated */\n index?: number;\n}\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-layout.js","names":[],"sources":["../../../src/adapter/types/buffer-layout.ts"],"sourcesContent":["import type {VertexFormat} from './vertex-formats';\n\n/** \n * Provides specific details about the memory layout of the actual buffers \n * that will be provided to a `RenderPipeline`.\n * \n * BufferLayout lets the application describe whether\n * - A single buffer can be used for multiple attributes (using interleaving or offsets), \n * - The data format of the memory being supplied to a specific shader attribute.\n * \n * `BufferLayout` complements the \"static\" attribute declarations in a ShaderLayout \n * with information about the \"dynamic\" memory layout of each buffer that will be bound \n * to the render pipeline.\n */\n\n/** \n * Specify memory layout for one buffer, describing how it is used by one or more attribute\n * @note Specifies format, stride, offset and step mode\n * @note The buffer can be set using the buffer name:`.setAttributes({[bufferName]: buffer})`.\n * @note Needs to match type/components of the ShaderLayout ('f32', 'i32', 's32')\n *\n * A buffer layout is used to specify \"non-standard\" buffer layouts (buffers with offsets, interleaved buffers etc)\n *\n * @example\n * ```\n device.createRenderPipeline({\n ...\n shaderLayout,\n bufferLayout: [\n {name: 'positions', stepMode: 'vertex', format: 'float32x3'},\n // interleaved bindings, auto offset\n {name: 'particles', stepMode: 'instance', byteStride: 32, attributes: [\n {name: 'instancePositions', format: 'float32x4', byteOffset: 0},\n {name: 'instanceVelocities', format: 'float32x4', byteOffset: 16}\n ]},\n ]\n ];\n ```\n */\nexport type BufferLayout = {\n /** Name of buffer */\n name: string;\n /** Is the attribute is instanced. Default: auto-deduced from shader name. */\n stepMode?: 'vertex' | 'instance';\n /** bytes between successive elements. If omitted, stride is set to reflect a \"packed\" buffer */\n byteStride?: number;\n /** Option 1: interleaved attributes that read from this buffer */\n attributes?: BufferAttributeLayout[];\n /** Option 2: Single attribute with same name as buffer. */\n format?: VertexFormat;\n};\n\n/** Specifies how the GPU should read one specific attribute from a buffer. */\nexport type BufferAttributeLayout = {\n /** Name of attribute that maps to a \"view\" of this buffer */\n attribute: string;\n /** Data format of the memory in the buffer that is mapped to this attribute */\n format: VertexFormat;\n /** Sum up any the \"global\" offset (or 0) and the offset each stride (for interleaved data). */\n byteOffset: number;\n};\n\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parameters.js","names":["DEFAULT_PARAMETERS","cullMode","frontFace","depthWriteEnabled","depthCompare","depthFormat","depthClamp","depthBias","depthBiasSlopeScale","depthBiasClamp","stencilReadMask","stencilWriteMask","stencilCompare","stencilPassOperation","stencilFailOperation","stencilDepthFailOperation","sampleCount","sampleMask","sampleAlphaToCoverageEnabled","blendColorOperation","blendColorSrcFactor","blendColorDstFactor","blendAlphaOperation","blendAlphaSrcFactor","blendAlphaDstFactor","colorMask"],"sources":["../../../src/adapter/types/parameters.ts"],"sourcesContent":["import {DepthStencilTextureFormat} from './texture-formats';\n\nexport type CompareFunction =\n 'never' |\n 'less' |\n 'equal' |\n 'less-equal' |\n 'greater' |\n 'not-equal' |\n 'greater-equal' |\n 'always';\n\n// Primitive state\n\nexport type PrimitiveTopology =\n 'point-list' |\n 'line-list' |\n 'line-strip' |\n /** @deprecated */\n 'line-loop-webgl' |\n 'triangle-list' |\n 'triangle-strip' |\n /** @deprecated */\n 'triangle-fan-webgl';\n\nexport type IndexFormat = 'uint16' | 'uint32';\n\nexport type CullMode = 'none' | 'front' | 'back';\nexport type FrontFace = 'ccw' | 'cw';\n\n// Rasterization Parameters\n\ntype _RenderParameters = {\n /** Defines which polygon orientation will be culled, if any. Only applies to triangle topologies/ */\n cullMode?: CullMode;\n /** Defines which polygons are considered front-facing. Only applies to triangle topologies. Default to \"ccw\" */\n frontFace?: FrontFace;\n /** TBD */\n depthClamp?: boolean;\n /** Constant depth bias (polygon offset) added to each fragment. */\n depthBias?: number;\n /** Depth bias (polygon offset) that scales with the fragment’s slope. */\n depthBiasSlopeScale?: number;\n /** Maximum depth bias of a fragment. */\n depthBiasClamp?: number;\n}\n\nexport type RasterizationParameters = _RenderParameters & {\n /** The type of primitive to be constructed from the vertex inputs. Defaults to \"triangle-list\". */\n topology?: PrimitiveTopology;\n /** For pipelines with strip topologies (\"line-strip\" or \"triangle-strip\"), this determines the index buffer format and primitive restart value (\"uint16\"/0xFFFF or \"uint32\"/0xFFFFFFFF). It is not allowed on pipelines with non-strip topologies. */\n stripIndexFormat?: IndexFormat; // WebGPU only\n}\n\n// Depth Stencil Parameters\n\n/** Types of operations that can be performed on stencil buffers when various tests pass */\nexport type StencilOperation =\n 'keep' |\n 'zero' |\n 'replace' |\n 'invert' |\n 'increment-clamp' |\n 'decrement-clamp' |\n 'increment-wrap' |\n 'decrement-wrap';\n\nexport type DepthStencilParameters = {\n /** Whether this GPURenderPipeline can modify depthStencilAttachment depth values. */\n depthWriteEnabled?: boolean;\n /** The comparison operation used to test fragment depths against existing depthStencilAttachment depth values. */\n depthCompare?: CompareFunction;\n /** The format of depthStencilAttachment this GPURenderPipeline will be compatible with. */\n depthFormat?: DepthStencilTextureFormat;\n\n /** Bitmask controlling which depthStencilAttachment stencil value bits are read when performing stencil comparison tests. */\n stencilReadMask?: number;\n /** Bitmask controlling which depthStencilAttachment stencil value bits are written to when performing stencil operations. */\n stencilWriteMask?: number;\n\n /** The CompareFunction used when testing fragments against depthStencilAttachment stencil values. */\n stencilCompare?: CompareFunction;\n /** The StencilOperation performed if the fragment stencil comparison test described by compare fails. */\n stencilPassOperation?: StencilOperation;\n /** The GPUStencilOperation performed if the fragment depth comparison described by depthCompare fails. */\n stencilFailOperation?: StencilOperation;\n /** The GPUStencilOperation performed if the fragment stencil comparison test described by compare passes. */\n stencilDepthFailOperation?: StencilOperation;\n}\n\n// Color Parameters\n\n/** BlendFactor defines how either a source or destination blend factors is calculated */\nexport type BlendFactor =\n 'zero' |\n 'one' |\n 'src-color' |\n 'one-minus-src-color' |\n 'src-alpha' |\n 'one-minus-src-alpha' |\n 'dst-color' |\n 'one-minus-dst-color' |\n 'dst-alpha' |\n 'one-minus-dst-alpha' |\n 'src-alpha-saturated' |\n 'blend-color' |\n 'one-minus-blend-color';\n\n/** BlendOperation defines the algorithm used to combine source and destination blend factors: */\nexport type BlendOperation =\n 'add' |\n 'subtract' |\n 'reverse-subtract' |\n 'min' |\n 'max';\n\n/*\nexport const ColorWrite = {\n RED: 0x1,\n GREEN: 0x2,\n BLUE: 0x4,\n ALPHA: 0x8,\n ALL: 0xF\n};\n\nblend: {\n color: {operation, srcFactor, dstFactor}\n alpha: {operation, srcFactor, dstFactor}\n}\ncolorWriteMask\n\nrgba\nrgb\nrga\nrba\ngba\nrg\nrb\nra\ngb\nga\nba\nr\ng\nb\na\nnone\n*/\n\n/* Color parameters are set on the RenderPipeline */\nexport type ColorParameters = {\n /** Defines the operation used to calculate the values written to the target attachment components. */\n blendColorOperation?: BlendOperation;\n /** Defines the operation to be performed on values from the fragment shader. */\n blendColorSrcFactor?: BlendFactor;\n /** Defines the operation to be performed on values from the target attachment. */\n blendColorDstFactor?: BlendFactor;\n\n /** Defines the operation used to calculate the values written to the target attachment components. */\n blendAlphaOperation?: BlendOperation;\n /** Defines the operation to be performed on values from the fragment shader. */\n blendAlphaSrcFactor?: BlendFactor;\n /** Defines the operation to be performed on values from the target attachment. */\n blendAlphaDstFactor?: BlendFactor;\n\n /** Bitmask controlling which channels are are written to when drawing to this color target. defaulting to 0xF */\n colorMask?: number;\n}\n\n/** Multisample */\nexport type MultisampleParameters = {\n /** Number of samples per pixel. RenderPipeline will be compatible only with attachment textures with matching sampleCounts. */\n sampleCount?: number; // = 1;\n /** Mask determining which samples are written to. defaulting to 0xFFFFFFFF */\n sampleMask?: number; \n /** When true indicates that a fragment’s alpha channel should be used to generate a sample coverage mask. */\n sampleAlphaToCoverageEnabled?: boolean; // = false;\n};\n\n/** These parameters are set on the render pass and are thus easy to change frequently */\nexport type RenderPassParameters = {\n /** Linear map from normalized device coordinates to viewport coordinates [x, y, width, height, minDepth, maxDepth] */\n viewport?: number[]; \n /** Sets scissor rectangle used during rasterization. Discards fragments outside viewport coords [x, y, width, height]. */\n scissorRect?: number[]; // ;\n /** Sets constant blend color and alpha values used with \"constant\" and \"one-minus-constant\" blend factors. */\n blendConstant?: number[]; // GPUColor\n /** Stencil operation \"replace\" sets the value to stencilReference */\n stencilReference?: number; // GPUStencilValue\n};\n\nexport type RenderPipelineParameters =\n RasterizationParameters &\n DepthStencilParameters &\n ColorParameters &\n MultisampleParameters;\n\nexport type Parameters =\n _RenderParameters &\n DepthStencilParameters &\n ColorParameters &\n MultisampleParameters;\n\n// export const DEFAULT_PARAMETERS: Parameters;\n\nexport const DEFAULT_PARAMETERS: Required<Parameters> = {\n\n // Rasterization Parameters\n\n cullMode: 'none',\n frontFace: 'ccw',\n\n // Depth Parameters\n\n depthWriteEnabled: false,\n depthCompare: 'always',\n depthFormat: 'depth24plus',\n\n depthClamp: false,\n depthBias: 0,\n depthBiasSlopeScale: 0,\n depthBiasClamp: 0,\n\n // Stencil parameters\n\n stencilReadMask: 0xFFFFFFFF,\n stencilWriteMask: 0xFFFFFFFF,\n\n stencilCompare: 'always',\n stencilPassOperation: 'keep',\n stencilFailOperation: 'keep',\n stencilDepthFailOperation: 'keep',\n\n // Multisample parameters\n sampleCount: 0,\n sampleMask: 0xFFFFFFFF,\n sampleAlphaToCoverageEnabled: false,\n\n // Color and blend parameters\n\n blendColorOperation: 'add',\n blendColorSrcFactor: 'one',\n blendColorDstFactor: 'zero',\n\n blendAlphaOperation: 'add',\n blendAlphaSrcFactor: 'one',\n blendAlphaDstFactor: 'zero',\n\n colorMask: 0xF\n};\n"],"mappings":"AA6MA,OAAO,MAAMA,kBAAwC,GAAG;EAItDC,QAAQ,EAAE,MAAM;EAChBC,SAAS,EAAE,KAAK;EAIhBC,iBAAiB,EAAE,KAAK;EACxBC,YAAY,EAAE,QAAQ;EACtBC,WAAW,EAAE,aAAa;EAE1BC,UAAU,EAAE,KAAK;EACjBC,SAAS,EAAE,CAAC;EACZC,mBAAmB,EAAE,CAAC;EACtBC,cAAc,EAAE,CAAC;EAIjBC,eAAe,EAAE,UAAU;EAC3BC,gBAAgB,EAAE,UAAU;EAE5BC,cAAc,EAAE,QAAQ;EACxBC,oBAAoB,EAAE,MAAM;EAC5BC,oBAAoB,EAAE,MAAM;EAC5BC,yBAAyB,EAAE,MAAM;EAGjCC,WAAW,EAAE,CAAC;EACdC,UAAU,EAAE,UAAU;EACtBC,4BAA4B,EAAE,KAAK;EAInCC,mBAAmB,EAAE,KAAK;EAC1BC,mBAAmB,EAAE,KAAK;EAC1BC,mBAAmB,EAAE,MAAM;EAE3BC,mBAAmB,EAAE,KAAK;EAC1BC,mBAAmB,EAAE,KAAK;EAC1BC,mBAAmB,EAAE,MAAM;EAE3BC,SAAS,EAAE;AACb,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shader-layout.js","names":[],"sources":["../../../src/adapter/types/shader-layout.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {TextureFormat} from '../types/texture-formats';\nimport type {ShaderUniformType, ShaderAttributeType} from './shader-types';\nimport {AccessorObject} from '../types/accessor';\nimport type {Buffer} from '../resources/buffer';\nimport type {Sampler} from '../resources/sampler';\nimport type {Texture} from '../resources/texture';\n\n/**\n * Describes all shader binding points for a `RenderPipeline` or `ComputePipeline`\n * A ShaderLayout describes the static structure of a shader pipeline.\n * It also allows the numeric locations in the shader to accessed with the same variable names\n * used in the shader.\n * @note A ShaderLayout needs to be complemented by a BufferLayout that describes \n * the actual memory layout of the buffers that will be used with the pipeline.\n * \n * @example\n * ```\n device.createRenderPipeline({\n shaderLayout: [\n attributes: [\n {name: 'instancePositions', location: 0, format: 'vec3<f32>', stepMode: 'instance'},\n {name: 'instanceVelocities', location: 1, format: 'vec3<f32>', stepMode: 'instance'},\n {name: 'vertexPositions', location: 2, format: 'vec3<f32>', stepMode: 'vertex'}\n ],\n bindings: [...]\n ]\n })\n * ```\n */\nexport type ShaderLayout = {\n /** All attributes, their locations, and basic type information. Also an auto-deduced step mode */\n attributes: AttributeDeclaration[];\n /** All bidning points (textures, samplers, uniform buffers) with their locations and type */\n bindings: BindingDeclaration[];\n /** WebGL only (WebGPU use bindings and uniform buffers) */\n uniforms?: any[];\n /** WebGL2 only (WebGPU use compute shaders) */\n varyings?: VaryingBinding[];\n};\n\n/**\n * Declares one for attributes\n */\nexport type AttributeDeclaration = {\n /** The name of this attribute in the shader */\n name: string;\n /** The index into the GPU's vertex array buffer bank (usually between 0-15) */\n location: number;\n /** WebGPU-style shader type. The declared format of the attribute in the shader code. Buffer's vertex format needs to map to this. */\n type: ShaderAttributeType;\n /** Inferred from attribute name. @note Technically not part of static structure of shader */\n stepMode?: 'vertex' | 'instance';\n};\n\n// BINDING LAYOUTS\n\n/*\ntype Binding = {\n binding: number;\n visibility: number;\n\n buffer?: {\n type?: 'uniform' | 'storage' | 'read-only-storage';\n hasDynamicOffset?: false;\n minBindingSize?: number;\n };\n\n // type = sampler\n samplerType?: 'filtering' | 'non-filtering' | 'comparison';\n\n // type = texture\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n sampleType?: 'float' | 'unfilterable-float' | 'depth' | 'sint' | 'uint';\n multisampled?: boolean;\n\n // type = storage\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n access: 'read-only' | 'write-only';\n format: string;\n};\n*/\n\n/** ShaderLayout for bindings */\nexport type BindingDeclaration =\n | UniformBufferBindingLayout\n | BufferBindingLayout\n | TextureBindingLayout\n | SamplerBindingLayout\n | StorageTextureBindingLayout;\n\nexport type UniformBufferBindingLayout = {\n type: 'uniform';\n name: string;\n location: number;\n visibility?: number;\n hasDynamicOffset?: boolean;\n minBindingSize?: number;\n uniforms?: UniformInfo[];\n};\n\nexport type UniformInfo = {\n name: string;\n format: ShaderUniformType;\n type?: string;\n arrayLength: number;\n byteOffset: number;\n byteStride: number;\n};\n\nexport type BufferBindingLayout = {\n type: 'uniform' | 'storage' | 'read-only-storage';\n name: string;\n location: number;\n visibility?: number;\n hasDynamicOffset?: boolean;\n minBindingSize?: number;\n};\n\ntype TextureBindingLayout = {\n type: 'texture';\n name: string;\n location: number;\n visibility?: number;\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d'; // default: '2d'\n sampleType?: 'float' | 'unfilterable-float' | 'depth' | 'sint' | 'uint'; // default: 'float'\n multisampled?: boolean;\n};\n\ntype SamplerBindingLayout = {\n type: 'sampler';\n name: string;\n location: number;\n visibility?: number;\n samplerType?: 'filtering' | 'non-filtering' | 'comparison'; // default: filtering\n};\n\ntype StorageTextureBindingLayout = {\n type: 'storage';\n name: string;\n location: number;\n visibility?: number;\n access?: 'write-only';\n format: TextureFormat;\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n};\n\n// BINDINGS\n\n/** Binding value */\nexport type Binding = Texture | Sampler | Buffer | {buffer: Buffer; offset?: number; size?: number};\n\n// SHADER LAYOUTS\n\n/**\n * Describes a varying binding for a program\n * @deprecated Varyings are WebGL-only\n */\nexport type VaryingBinding = {\n location: number;\n name: string;\n accessor: AccessorObject;\n};\n\n// Uniform bindings\n\n/** Describes a uniform block binding for a program */\nexport type UniformBlockBinding = {\n location: number;\n name: string;\n byteLength: number;\n vertex: boolean;\n fragment: boolean;\n uniformCount: number;\n uniformIndices?: number[];\n uniforms: UniformInfo[];\n};\n\n/** Describes a uniform (sampler etc) binding for a program */\nexport type UniformBinding = {\n location: number;\n name: string;\n size: number;\n type: number;\n isArray: boolean;\n};\n\n/** @deprecated */\nexport type AttributeBinding = {\n name: string;\n location: number;\n accessor: AccessorObject;\n};\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shader-types.js","names":[],"sources":["../../../src/adapter/types/shader-types.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n/**\n * Primitive data types understood by shaders\n * @note These types describe the type used in shader calculations, but for attribute inputs these can be populated from a different in-memory type.\n * @note bindings (like textures, samplers, and uniform buffers) are considered \"bindings\", not types\n * @note `f16` requires the `f16` extension\n */\nexport type ShaderDataType = 'u32' | 'i32' | 'f32' | 'f16';\n\n/**\n * Describes the type of an attribute as defined in the shader source code.\n * @note Buffers with various `VertexFormat`s can be supplied for each type, and the GPU will convert them at runtime,\n * but there are limitations, see documentation for details.\n */\nexport type ShaderAttributeType =\n | 'f32'\n | 'vec2<f32>'\n | 'vec3<f32>'\n | 'vec4<f32>'\n | 'i32'\n | 'vec2<i32>'\n | 'vec3<i32>'\n | 'vec4<i32>'\n | 'u32'\n | 'vec2<u32>'\n | 'vec3<u32>'\n | 'vec4<u32>'\n // requires `f16` extension\n | 'f16'\n | 'vec2<f16>'\n | 'vec3<f16>'\n | 'vec4<f16>';\n\n/**\n * Describes the type of a uniform as described in the shader source code.\n * Uniforms can be of a wider range of types than attributes.\n */\nexport type ShaderUniformType =\n | 'f32'\n | 'i32'\n | 'u32'\n | 'vec2<f32>'\n | 'vec3<f32>'\n | 'vec4<f32>'\n | 'vec2<i32>'\n | 'vec3<i32>'\n | 'vec4<i32>'\n | 'vec2<u32>'\n | 'vec3<u32>'\n | 'vec4<u32>'\n | 'mat2x2<f32>'\n | 'mat2x3<f32>'\n | 'mat2x4<f32>'\n | 'mat3x2<f32>'\n | 'mat3x3<f32>'\n | 'mat3x4<f32>'\n | 'mat4x2<f32>'\n | 'mat4x3<f32>'\n | 'mat4x4<f32>';\n\n/** Shorthand type aliases recognized by WGSL */\nexport type ShaderTypeAlias =\n | 'vec2i'\n | 'vec3i'\n | 'vec4i'\n | 'vec2u'\n | 'vec3u'\n | 'vec4u'\n | 'vec2f'\n | 'vec3f'\n | 'vec4f'\n // Requires the f16 extension.\n | 'vec2h'\n | 'vec3h'\n | 'vec4h';\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"texture-formats.js","names":[],"sources":["../../../src/adapter/types/texture-formats.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n/** Texture formats */\nexport type TextureFormat = ColorTextureFormat | DepthStencilTextureFormat;\n\n/** Depth and stencil texture formats */\nexport type DepthStencilTextureFormat =\n 'stencil8' |\n 'depth16unorm' |\n 'depth24plus' |\n 'depth24plus-stencil8' |\n 'depth32float' |\n // device.features.has('depth24unorm-stencil8')\n 'depth24unorm-stencil8' |\n // device.features.has('depth32float-stencil8')\n 'depth32float-stencil8';\n\n/** Texture formats for color attachments */\nexport type ColorTextureFormat = WebGPUColorTextureFormat | WebGL2ColorTextureFormat | UnsizedColorTextureFormat;\n\nexport type WebGPUColorTextureFormat =\n // 8-bit formats\n 'r8unorm' |\n 'r8snorm' |\n 'r8uint' |\n 'r8sint' |\n\n // 16-bit formats\n 'r16uint' |\n 'r16sint' |\n 'r16float' |\n 'rg8unorm' |\n 'rg8snorm' |\n 'rg8uint' |\n 'rg8sint' |\n\n // 32-bit formats\n 'r32uint' |\n 'r32sint' |\n 'r32float' |\n 'rg16uint' |\n 'rg16sint' |\n 'rg16float' |\n 'rgba8unorm' |\n 'rgba8unorm-srgb' |\n 'rgba8snorm' |\n 'rgba8uint' |\n 'rgba8sint' |\n 'bgra8unorm' |\n 'bgra8unorm-srgb' |\n // Packed 32-bit formats\n 'rgb9e5ufloat' |\n 'rgb10a2unorm' |\n 'rg11b10ufloat' |\n\n // 64-bit formats\n 'rg32uint' |\n 'rg32sint' |\n 'rg32float' |\n 'rgba16uint' |\n 'rgba16sint' |\n 'rgba16float' |\n\n // 128-bit formats\n 'rgba32uint' |\n 'rgba32sint' |\n 'rgba32float' |\n\n // BC compressed formats usable if 'texture-compression-bc' is both\n // supported by the device/user agent and enabled in requestDevice.\n 'bc1-rgba-unorm' |\n 'bc1-rgba-unorm-srgb' |\n 'bc2-rgba-unorm' |\n 'bc2-rgba-unorm-srgb' |\n 'bc3-rgba-unorm' |\n 'bc3-rgba-unorm-srgb' |\n 'bc4-r-unorm' |\n 'bc4-r-snorm' |\n 'bc5-rg-unorm' |\n 'bc5-rg-snorm' |\n 'bc6h-rgb-ufloat' |\n 'bc6h-rgb-float' |\n 'bc7-rgba-unorm' |\n 'bc7-rgba-unorm-srgb' |\n\n // ETC2 compressed formats usable if \"texture-compression-etc2\" is both\n // supported by the device/user agent and enabled in requestDevice.\n 'etc2-rgb8unorm' |\n 'etc2-rgb8unorm-srgb' |\n 'etc2-rgb8a1unorm' |\n 'etc2-rgb8a1unorm-srgb' |\n 'etc2-rgba8unorm' |\n 'etc2-rgba8unorm-srgb' |\n 'eac-r11unorm' |\n 'eac-r11snorm' |\n 'eac-rg11unorm' |\n 'eac-rg11snorm' |\n\n // ASTC compressed formats usable if \"texture-compression-astc\" is both\n // supported by the device/user agent and enabled in requestDevice.\n 'astc-4x4-unorm' |\n 'astc-4x4-unorm-srgb' |\n 'astc-5x4-unorm' |\n 'astc-5x4-unorm-srgb' |\n 'astc-5x5-unorm' |\n 'astc-5x5-unorm-srgb' |\n 'astc-6x5-unorm' |\n 'astc-6x5-unorm-srgb' |\n 'astc-6x6-unorm' |\n 'astc-6x6-unorm-srgb' |\n 'astc-8x5-unorm' |\n 'astc-8x5-unorm-srgb' |\n 'astc-8x6-unorm' |\n 'astc-8x6-unorm-srgb' |\n 'astc-8x8-unorm' |\n 'astc-8x8-unorm-srgb' |\n 'astc-10x5-unorm' |\n 'astc-10x5-unorm-srgb' |\n 'astc-10x6-unorm' |\n 'astc-10x6-unorm-srgb' |\n 'astc-10x8-unorm' |\n 'astc-10x8-unorm-srgb' |\n 'astc-10x10-unorm' |\n 'astc-10x10-unorm-srgb' |\n 'astc-12x10-unorm' |\n 'astc-12x10-unorm-srgb' |\n 'astc-12x12-unorm' |\n 'astc-12x12-unorm-srgb'\n ;\n\n/** Unsized texture formats (the only formats supported by WebGL1) */\nexport type UnsizedColorTextureFormat =\n // 'r8unorm-unsized' |\n // 'ra8unorm-unsized' |\n 'rgb8unorm-unsized' |\n 'rgba8unorm-unsized'\n // 'rgb8unorm-srgb-unsized' |\n // 'rgba8unorm-srgb-unsized'\n ;\n\n/** Sized formats unique to WebGL 2. Will perhaps be added to WebGPU? */\nexport type WebGL2ColorTextureFormat =\n 'r16unorm-webgl' |\n 'r16snorm-webgl' |\n 'rgba4unorm-webgl' |\n 'rgb565unorm-webgl' |\n 'rgb5a1unorm-webgl' |\n 'rgb8unorm-webgl' |\n 'rgb8snorm-webgl' |\n 'rg16unorm-webgl' |\n 'rg16snorm-webgl' |\n 'rgb10a2unorm-webgl' |\n 'rgb16unorm-webgl' |\n 'rgb16snorm-webgl' |\n 'rgba16unorm-webgl' |\n 'rgba16snorm-webgl' |\n 'rgb32float-webgl' |\n 'bc1-rgb-unorm-webgl' |\n 'bc1-rgb-unorm-srgb-webgl' |\n 'pvrtc-rgb4unorm-webgl' |\n 'pvrtc-rgba4unorm-webgl' |\n 'pvrtc-rbg2unorm-webgl' |\n 'pvrtc-rgba2unorm-webgl' |\n 'etc1-rbg-unorm-webgl' |\n 'atc-rgb-unorm-webgl' |\n 'atc-rgba-unorm-webgl' |\n 'atc-rgbai-unorm-webgl';\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/adapter/types/types.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {NumberArray} from '../../types';\nimport type {ColorTextureFormat, DepthStencilTextureFormat, TextureFormat} from './texture-formats';\nimport type {Buffer} from '../resources/buffer';\nimport type {Texture} from '../resources/texture'; // TextureView...\n\n// UNIFORMS\n\n/** Valid values for uniforms. @note boolean values get converted to 0 or 1 before setting */\nexport type UniformValue = number | boolean | Readonly<NumberArray>; // Float32Array> | Readonly<Int32Array> | Readonly<Uint32Array> | Readonly<number[]>;\n\n// BINDINGS\n\n/** Buffer bindings */\nexport type Binding = Texture | Buffer | {buffer: Buffer, offset?: number, size?: number};\n\n// BINDING LAYOUTS\n\n/** Describes a buffer binding layout */\ntype BufferBindingLayout = {\n /** The index of the binding point in the compiled and linked shader */\n location?: number;\n visibility: number;\n /** type of buffer */\n type: 'uniform' | 'storage' | 'read-only-storage';\n hasDynamicOffset?: boolean;\n minBindingSize?: number;\n}\n\n/** Describes a texture binding */\ntype TextureBindingLayout = {\n /** The index of the binding point in the compiled and linked shader */\n location?: number;\n visibility: number;\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n sampleType?: 'float' | 'unfilterable-float' | 'depth' | 'sint' | 'uint';\n multisampled?: boolean;\n};\n\n/** Describes a storage texture binding */\ntype StorageTextureBindingLayout = {\n /** The index of the binding point in the compiled and linked shader */\n location?: number;\n visibility: number;\n access?: 'write-only';\n format: TextureFormat;\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n};\n\nexport type BindingDeclaration = BufferBindingLayout | TextureBindingLayout | StorageTextureBindingLayout;\n\n// TEXTURE VIEWS\n\nexport type TextureView = {\n texture: WebGLTexture;\n layer?: number; // = 0\n level?: number; // = 0\n};\n\n// ATTACHMENTS (See Framebuffer)\n\n/**\n * Framebuffer attachments lets the user specify the textures that will be used for a RenderPass, \n * together with some additional options for how to clear.\n */\nexport type ColorAttachment = {\n /** Describes the texture subresource that will be output to for this color attachment. */\n texture?: Texture;\n /** Format of the texture resource. Used to auto create texture if not supplied */\n format?: ColorTextureFormat;\n /* Describes the texture subresource that will receive resolved output for this color attachment if multisampled. */\n // resolveTarget?: GPUTextureView;\n\n /** Value to clear to prior to executing the render pass. Default: [0, 0, 0, 0]. Ignored if loadOp is not \"clear\". */\n clearValue?: number[];\n /** load operation to perform on texture prior to executing the render pass. Default: 'clear'. */\n loadOp?: 'load' | 'clear';\n /** The store operation to perform on texture after executing the render pass. Default: 'store'. */\n storeOp?: 'store' | 'discard';\n};\n\n/**\n * Framebuffer attachments lets the user specify the depth stencil texture that will be used for a RenderPass, \n * together with some additional options for how to clear.\n */\nexport type DepthStencilAttachment = {\n /** Describes the texture subresource that will be output to and read from for this depth/stencil attachment. */\n texture?: Texture;\n /** Format of the texture resource. Used to auto create texture if not supplied */\n format?: DepthStencilTextureFormat;\n\n /** Value to clear depth component to prior to executing the render pass, if depthLoadOp is \"clear\". 0.0-1.0. */\n depthClearValue?: number;\n /** Indicates load operation to perform on depth component prior to executing the render pass. Default 'clear'. */\n depthLoadOp?: 'load' | 'clear';\n /** Store operation to perform on depth component after executing the render pass. Default: 'store'. */\n depthStoreOp?: 'store' | 'discard';\n /** Indicates that the depth component is read only. */\n depthReadOnly?: boolean;\n\n /** Indicates value to clear stencil component to prior to executing the render pass, if stencilLoadOp is \"clear\". */\n stencilClearValue?: number;\n /** Indicates load operation to perform on stencil component prior to executing the render pass. Prefer clearing. */\n stencilLoadOp?: 'load' | 'clear';\n /** Store operation to perform on stencil component after executing the render pass. */\n stencilStoreOp?: 'store' | 'discard';\n /** Indicates that the stencil component is read only. */\n stencilReadOnly?: boolean;\n};\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vertex-formats.js","names":[],"sources":["../../../src/adapter/types/vertex-formats.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n/** Basic data types signed and unsigned integers, and floats, of varying sizes */\nexport type DataType =\n | 'uint8'\n | 'sint8'\n | 'uint16'\n | 'sint16'\n | 'uint32'\n | 'sint32'\n | 'float16'\n | 'float32';\n\n/** Vertex and Pixel data types. Include normalized integers */\nexport type NormalizedDataType =\n | 'uint8'\n | 'sint8'\n | 'unorm8'\n | 'snorm8'\n | 'uint16'\n | 'sint16'\n | 'unorm16'\n | 'snorm16'\n | 'uint32'\n | 'sint32'\n // WebGPU does not support normalized 32 bit integer attributes...\n // | 'unorm32'\n // | 'snorm32'\n | 'float32'\n | 'float16'\n ;\n\n/** Describes the type (without number of components) of a vertex format */\nexport type VertexType = NormalizedDataType;\n\n/**\n * Describes the memory format of a buffer that will be supplied to vertex attributes\n * @note Must be compatible with the ShaderAttributeType of the shaders, see documentation.\n * @note This is a superset of WebGPU vertex formats to allow foe some flexibility for WebGL only applications\n * @todo Add device.isTextureFormatSupported() method?\n */\nexport type VertexFormat =\n // 8 bit integers, note that only 16 bit aligned formats are supported in WebGPU (x2 and x4)\n | 'uint8x2'\n | 'uint8x4'\n | 'sint8x2'\n | 'sint8x4'\n | 'unorm8-webgl'\n | 'unorm8x2'\n | 'unorm8x3-webgl'\n | 'unorm8x4'\n | 'snorm8-webgl'\n | 'snorm8x2'\n | 'snorm8x3-webgl'\n | 'snorm8x4'\n // 16 bit integers, note that only 32 bit aligned formats are supported in WebGPU (x2 and x4)\n | 'uint16x2'\n | 'uint16x4'\n | 'sint16x2'\n | 'sint16x4'\n | 'unorm16x2'\n | 'unorm16x4'\n | 'snorm16x2'\n | 'snorm16x4'\n // 32 bit integers\n | 'uint32'\n | 'uint32x2'\n | 'uint32x3'\n | 'uint32x4'\n | 'sint32'\n | 'sint32x2'\n | 'sint32x3'\n | 'sint32x4'\n // No normalized 32 bit integers in WebGPU...\n // | 'unorm32'\n // | 'unorm32x2'\n // | 'unorm32x3'\n // | 'unorm32x4'\n // | 'snorm32'\n // | 'snorm32x2'\n // | 'snorm32x3'\n // | 'snorm32x4'\n // floats\n | 'float16x2'\n | 'float16x4'\n | 'float32'\n | 'float32x2'\n | 'float32x3'\n | 'float32x4'\n ;\n"],"mappings":""}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["VERSION","isTypedArray","isNumberArray","luma","Device","CanvasContext","Resource","Buffer","Texture","ExternalTexture","Shader","Sampler","Framebuffer","RenderPipeline","ComputePipeline","RenderPass","ComputePass","CommandEncoder","CommandBuffer","VertexArray","TransformFeedback","UniformBufferLayout","UniformBlock","UniformStore","decodeVertexFormat","decodeTextureFormat","getDataTypeFromTypedArray","getTypedArrayFromDataType","getVertexFormatFromAttribute","decodeShaderUniformType","decodeShaderAttributeType","formatCompilerLog","getAttributeInfosFromLayouts","mergeShaderLayout","StatsManager","assert","cast","log","uid","isPowerOfTwo","isObjectEmpty","isUniformValue","splitUniformsAndBindings","formatValue","stubRemovedMethods","checkProps","setPathPrefix","loadFile","loadImage","loadImageBitmap","loadScript","getScratchArrayBuffer","getScratchArray","fillArray","makeRandomNumberGenerator","random","deepEqual","requestAnimationFrame","cancelAnimationFrame","glsl","x"],"sources":["../src/index.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nexport {VERSION} from './init';\n\n// GENERAL TYPES\nexport type {ConstructorOf, PartialBy} from './types';\n\n// NUMERIC TYPES - TODO: could be imported from @math.gl/types\nexport type {TypedArray, TypedArrayConstructor, NumberArray, BigIntOrNumberArray} from './types';\n\nexport {isTypedArray, isNumberArray} from './utils/is-array';\n\n// MAIN API ACCESS POINTS\nexport {luma} from './lib/luma';\n\nexport type {DeviceProps, DeviceLimits, DeviceInfo, DeviceFeature} from './adapter/device';\nexport {Device} from './adapter/device';\nexport type {CanvasContextProps} from './adapter/canvas-context';\nexport {CanvasContext} from './adapter/canvas-context';\n\n// GPU RESOURCES\nexport type {ResourceProps} from './adapter/resources/resource';\nexport {Resource} from './adapter/resources/resource';\nexport type {BufferProps} from './adapter/resources/buffer';\nexport {Buffer} from './adapter/resources/buffer';\nexport type {TextureProps, TextureData} from './adapter/resources/texture';\nexport {Texture} from './adapter/resources/texture';\nexport type {ExternalTextureProps} from './adapter/resources/external-texture';\nexport {ExternalTexture} from './adapter/resources/external-texture';\nexport type {ShaderProps} from './adapter/resources/shader';\nexport {Shader} from './adapter/resources/shader';\nexport type {SamplerProps, SamplerParameters} from './adapter/resources/sampler';\nexport {Sampler} from './adapter/resources/sampler';\nexport type {FramebufferProps} from './adapter/resources/framebuffer';\nexport {Framebuffer} from './adapter/resources/framebuffer';\n\nexport type {RenderPipelineProps} from './adapter/resources/render-pipeline';\nexport {RenderPipeline} from './adapter/resources/render-pipeline';\n\nexport type {ComputePipelineProps} from './adapter/resources/compute-pipeline';\nexport {ComputePipeline} from './adapter/resources/compute-pipeline';\nexport type {RenderPassProps} from './adapter/resources/render-pass';\nexport {RenderPass} from './adapter/resources/render-pass';\nexport type {ComputePassProps} from './adapter/resources/compute-pass';\nexport {ComputePass} from './adapter/resources/compute-pass';\nexport type {CommandEncoderProps} from './adapter/resources/command-encoder';\nexport {CommandEncoder} from './adapter/resources/command-encoder';\nexport type {CommandBufferProps} from './adapter/resources/command-buffer';\nexport {CommandBuffer} from './adapter/resources/command-buffer';\n\nexport type {VertexArrayProps} from './adapter/resources/vertex-array';\nexport {VertexArray} from './adapter/resources/vertex-array';\n\nexport type {BufferRange, TransformFeedbackProps} from './adapter/resources/transform-feedback';\nexport {TransformFeedback} from './adapter/resources/transform-feedback';\n\n// API TYPES\nexport type {AccessorObject} from './adapter/types/accessor';\nexport type {\n Parameters,\n PrimitiveTopology,\n IndexFormat,\n CullMode,\n FrontFace,\n RasterizationParameters,\n CompareFunction,\n StencilOperation,\n DepthStencilParameters,\n BlendFactor,\n BlendOperation,\n ColorParameters,\n MultisampleParameters,\n RenderPassParameters,\n RenderPipelineParameters\n} from './adapter/types/parameters';\n\n// MEMORY LAYOUT TYPES\nexport type {VertexFormat, VertexType} from './adapter/types/vertex-formats';\nexport type {\n TextureFormat,\n ColorTextureFormat,\n DepthStencilTextureFormat\n} from './adapter/types/texture-formats';\nexport type {\n ShaderDataType,\n ShaderAttributeType,\n ShaderUniformType\n} from './adapter/types/shader-types';\n\nexport type {ColorAttachment, DepthStencilAttachment} from './adapter/types/types';\n\nexport type {\n ShaderLayout,\n AttributeDeclaration,\n BindingDeclaration,\n Binding\n} from './adapter/types/shader-layout';\nexport type {BufferLayout, BufferAttributeLayout} from './adapter/types/buffer-layout';\nexport type {\n // Deprecated, todo\n AttributeBinding,\n UniformBinding,\n UniformBlockBinding,\n VaryingBinding\n} from './adapter/types/shader-layout';\n\nexport type {UniformValue} from './adapter/types/types';\nexport {UniformBufferLayout} from './lib/uniforms/uniform-buffer-layout';\nexport {UniformBlock} from './lib/uniforms/uniform-block';\nexport {UniformStore} from './lib/uniforms/uniform-store';\n\n// TYPE UTILS\nexport {decodeVertexFormat} from './adapter/type-utils/decode-vertex-format';\nexport {decodeTextureFormat} from './adapter/type-utils/decode-texture-format';\nexport {getDataTypeFromTypedArray, getTypedArrayFromDataType, getVertexFormatFromAttribute} from './adapter/type-utils/vertex-format-from-attribute';\n\n// SHADER TYPE UTILS\nexport {decodeShaderUniformType} from './adapter/type-utils/decode-shader-types';\nexport {decodeShaderAttributeType} from './adapter/type-utils/decode-attribute-type';\n\n// COMPILER LOG\nexport type {CompilerMessage} from './lib/compiler-log/compiler-message';\nexport {formatCompilerLog} from './lib/compiler-log/format-compiler-log';\n\n//\nexport type {AttributeInfo} from './adapter/attribute-utils/get-attribute-from-layouts';\nexport {\n getAttributeInfosFromLayouts,\n mergeShaderLayout\n} from './adapter/attribute-utils/get-attribute-from-layouts';\n\n// GENERAL UTILS\n\nexport {StatsManager} from './utils/stats-manager';\nexport {assert} from './utils/assert';\nexport {cast} from './utils/cast';\nexport {log} from './utils/log';\nexport {uid, isPowerOfTwo, isObjectEmpty} from './utils/utils';\nexport {isUniformValue, splitUniformsAndBindings} from './lib/uniforms/uniform';\nexport {formatValue} from './utils/format-value';\nexport {stubRemovedMethods} from './utils/stub-methods';\nexport {checkProps} from './utils/check-props';\nexport {\n setPathPrefix,\n loadFile,\n loadImage,\n loadImageBitmap,\n loadScript\n} from './utils/load-file';\nexport {getScratchArrayBuffer, getScratchArray, fillArray} from './utils/array-utils-flat';\nexport {makeRandomNumberGenerator, random} from './utils/random';\nexport {deepEqual} from './utils/deep-equal';\n\n// ENGINE - TODO/move to @luma.gl/engine once that module is webgl-independent?\nexport {requestAnimationFrame, cancelAnimationFrame} from './utils/request-animation-frame';\n\n// SHADER HELPERS\n\n/**\n * Marks GLSL shaders for syntax highlighting: glsl`...`\n * Install https://marketplace.visualstudio.com/items?itemName=boyswan.glsl-literal\n */\nexport const glsl = (x: TemplateStringsArray) => `${x}`;\n\n// INTERNAL\n\nexport type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from './adapter/resources/command-encoder';\n"],"mappings":"SAGQA,OAAO;AAAA,SAQPC,YAAY,EAAEC,aAAa;AAAA,SAG3BC,IAAI;AAAA,SAGJC,MAAM;AAAA,SAENC,aAAa;AAAA,SAIbC,QAAQ;AAAA,SAERC,MAAM;AAAA,SAENC,OAAO;AAAA,SAEPC,eAAe;AAAA,SAEfC,MAAM;AAAA,SAENC,OAAO;AAAA,SAEPC,WAAW;AAAA,SAGXC,cAAc;AAAA,SAGdC,eAAe;AAAA,SAEfC,UAAU;AAAA,SAEVC,WAAW;AAAA,SAEXC,cAAc;AAAA,SAEdC,aAAa;AAAA,SAGbC,WAAW;AAAA,SAGXC,iBAAiB;AAAA,SAqDjBC,mBAAmB;AAAA,SACnBC,YAAY;AAAA,SACZC,YAAY;AAAA,SAGZC,kBAAkB;AAAA,SAClBC,mBAAmB;AAAA,SACnBC,yBAAyB,EAAEC,yBAAyB,EAAEC,4BAA4B;AAAA,SAGlFC,uBAAuB;AAAA,SACvBC,yBAAyB;AAAA,SAIzBC,iBAAiB;AAAA,SAKvBC,4BAA4B,EAC5BC,iBAAiB;AAAA,SAKXC,YAAY;AAAA,SACZC,MAAM;AAAA,SACNC,IAAI;AAAA,SACJC,GAAG;AAAA,SACHC,GAAG,EAAEC,YAAY,EAAEC,aAAa;AAAA,SAChCC,cAAc,EAAEC,wBAAwB;AAAA,SACxCC,WAAW;AAAA,SACXC,kBAAkB;AAAA,SAClBC,UAAU;AAAA,SAEhBC,aAAa,EACbC,QAAQ,EACRC,SAAS,EACTC,eAAe,EACfC,UAAU;AAAA,SAEJC,qBAAqB,EAAEC,eAAe,EAAEC,SAAS;AAAA,SACjDC,yBAAyB,EAAEC,MAAM;AAAA,SACjCC,SAAS;AAAA,SAGTC,qBAAqB,EAAEC,oBAAoB;AAQnD,OAAO,MAAMC,IAAI,GAAIC,CAAuB,IAAM,GAAEA,CAAE,EAAC"}
|
package/dist/init.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","names":["isBrowser","log","lumaStats","initializeLuma","VERSION","__VERSION__","STARTUP_MESSAGE","globalThis","luma","Error","version","stats"],"sources":["../src/init.ts"],"sourcesContent":["import {isBrowser} from '@probe.gl/env';\nimport {log} from './utils/log';\nimport {lumaStats} from './utils/stats-manager';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var luma: any\n}\n\n/** \n * By adding the result of init() to Device.VERSION we guarantee it will be called\n * @returns version\n */\nfunction initializeLuma(): string {\n // Version detection using babel plugin\n // @ts-expect-error\n const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'running from source';\n\n const STARTUP_MESSAGE = 'set luma.log.level=1 (or higher) to trace rendering';\n // Assign luma.log.level in console to control logging: \\\n // 0: none, 1: minimal, 2: verbose, 3: attribute/uniforms, 4: gl logs\n // luma.log.break[], set to gl funcs, luma.log.profile[] set to model names`;\n\n if (globalThis.luma && globalThis.luma.VERSION !== VERSION) {\n throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${VERSION}`);\n }\n\n if (!globalThis.luma) {\n if (isBrowser()) {\n log.log(1, `${VERSION} - ${STARTUP_MESSAGE}`)();\n }\n\n globalThis.luma = globalThis.luma || {\n VERSION,\n version: VERSION,\n log,\n\n // A global stats object that various components can add information to\n // E.g. see webgl/resource.js\n stats: lumaStats,\n };\n }\n\n return VERSION;\n}\n\nexport const VERSION = initializeLuma();\n"],"mappings":"AAAA,SAAQA,SAAS,QAAO,eAAe;AAAC,SAChCC,GAAG;AAAA,SACHC,SAAS;AAWjB,SAASC,cAAcA,CAAA,EAAW;EAGhC,MAAMC,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,qBAAqB;EAExF,MAAMC,eAAe,GAAG,qDAAqD;EAK7E,IAAIC,UAAU,CAACC,IAAI,IAAID,UAAU,CAACC,IAAI,CAACJ,OAAO,KAAKA,OAAO,EAAE;IAC1D,MAAM,IAAIK,KAAK,CAAE,yCAAwCF,UAAU,CAACC,IAAI,CAACJ,OAAQ,OAAMA,OAAQ,EAAC,CAAC;EACnG;EAEA,IAAI,CAACG,UAAU,CAACC,IAAI,EAAE;IACpB,IAAIR,SAAS,CAAC,CAAC,EAAE;MACfC,GAAG,CAACA,GAAG,CAAC,CAAC,EAAG,GAAEG,OAAQ,MAAKE,eAAgB,EAAC,CAAC,CAAC,CAAC;IACjD;IAEAC,UAAU,CAACC,IAAI,GAAGD,UAAU,CAACC,IAAI,IAAI;MACnCJ,OAAO;MACPM,OAAO,EAAEN,OAAO;MAChBH,GAAG;MAIHU,KAAK,EAAET;IACT,CAAC;EACH;EAEA,OAAOE,OAAO;AAChB;AAEA,OAAO,MAAMA,OAAO,GAAGD,cAAc,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compiler-message.js","names":[],"sources":["../../../src/lib/compiler-log/compiler-message.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n/** WebGPU style compiler message */\nexport type CompilerMessage = {\n type: 'error' | 'warning' | 'info';\n message: string;\n lineNum: number;\n linePos: number;\n}\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-compiler-log.js","names":["formatCompilerLog","shaderLog","source","options","formattedLog","lines","split","log","slice","sort","a","b","lineNum","showSourceCode","currentMessage","length","getNumberedLine","message","formatCompilerMessage","inlineSource","numberedLines","getNumberedLines","positionIndicator","linePos","repeat","type","toUpperCase","html","lineIndex","sourceLine","undefined","line","escapedLine","escapeHTML","padLeft","String","string","paddedLength","result","i","unsafe","replaceAll"],"sources":["../../../src/lib/compiler-log/format-compiler-log.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {CompilerMessage} from './compiler-message';\n\n/** @returns annotated errors or warnings */\nexport function formatCompilerLog(\n shaderLog: readonly CompilerMessage[],\n source: string,\n options?: {\n /** Include source code in the log. Either just the lines before issues or all source code */\n showSourceCode?: 'no' | 'issues' | 'all';\n html?: boolean;\n }\n): string {\n let formattedLog = '';\n const lines = source.split(/\\r?\\n/);\n const log = shaderLog.slice().sort((a, b) => a.lineNum - b.lineNum);\n\n switch (options?.showSourceCode || 'no') {\n case 'all':\n // Parse the error - note: browser and driver dependent\n let currentMessage = 0;\n for (let lineNum = 1; lineNum <= lines.length; lineNum++) {\n formattedLog += getNumberedLine(lines[lineNum - 1], lineNum, options);\n while (log.length > currentMessage && log[currentMessage].lineNum === lineNum) {\n const message = log[currentMessage++];\n formattedLog += formatCompilerMessage(message, lines, message.lineNum, {\n ...options,\n inlineSource: false\n });\n }\n }\n return formattedLog;\n\n case 'issues':\n case 'no':\n // Parse the error - note: browser and driver dependent\n for (const message of shaderLog) {\n formattedLog += formatCompilerMessage(message, lines, message.lineNum, {\n inlineSource: options?.showSourceCode !== 'no'\n });\n }\n return formattedLog;\n }\n}\n\n// Helpers\n\n/** Format one message */\nfunction formatCompilerMessage(\n message: CompilerMessage,\n lines: readonly string[],\n lineNum: number,\n options: {\n inlineSource?: boolean;\n html?: boolean;\n }\n): string {\n if (options?.inlineSource) {\n const numberedLines = getNumberedLines(lines, lineNum);\n // If we got error position on line add a `^^^` indicator on next line\n const positionIndicator = message.linePos > 0 ? `${' '.repeat(message.linePos + 5)}^^^\\n` : '';\n return `\n${numberedLines}${positionIndicator}${message.type.toUpperCase()}: ${message.message}\n\n`;\n }\n return options?.html\n ? `<div class='luma-compiler-log-error' style=\"color:red;\"><b> ${message.type.toUpperCase()}: ${message.message}</b></div>`\n : `${message.type.toUpperCase()}: ${message.message}`;\n}\n\nfunction getNumberedLines(\n lines: readonly string[],\n lineNum: number,\n options?: {html?: boolean}\n): string {\n let numberedLines = '';\n for (let lineIndex = lineNum - 2; lineIndex <= lineNum; lineIndex++) {\n const sourceLine = lines[lineIndex - 1];\n if (sourceLine !== undefined) {\n numberedLines += getNumberedLine(sourceLine, lineNum, options);\n }\n }\n return numberedLines;\n}\n\nfunction getNumberedLine(line: string, lineNum: number, options?: {html?: boolean}): string {\n const escapedLine = options?.html ? escapeHTML(line) : line;\n return `${padLeft(String(lineNum), 4)}: ${escapedLine}${options?.html ? '<br/>' : '\\n'}`;\n}\n\n/**\n * Pads a string with a number of spaces (space characters) to the left\n * @param {String} string - string to pad\n * @param {Number} digits - number of spaces to add\n * @return {String} string - The padded string\n */\nfunction padLeft(string: string, paddedLength: number): string {\n let result = '';\n for (let i = string.length; i < paddedLength; ++i) {\n result += ' ';\n }\n return result + string;\n}\n\nfunction escapeHTML(unsafe: string): string {\n return unsafe\n .replaceAll('&', '&')\n .replaceAll('<', '<')\n .replaceAll('>', '>')\n .replaceAll('\"', '"')\n .replaceAll('\\'', ''');\n}\n"],"mappings":"AAIA,OAAO,SAASA,iBAAiBA,CAC/BC,SAAqC,EACrCC,MAAc,EACdC,OAIC,EACO;EACR,IAAIC,YAAY,GAAG,EAAE;EACrB,MAAMC,KAAK,GAAGH,MAAM,CAACI,KAAK,CAAC,OAAO,CAAC;EACnC,MAAMC,GAAG,GAAGN,SAAS,CAACO,KAAK,CAAC,CAAC,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,OAAO,GAAGD,CAAC,CAACC,OAAO,CAAC;EAEnE,QAAQ,CAAAT,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEU,cAAc,KAAI,IAAI;IACrC,KAAK,KAAK;MAER,IAAIC,cAAc,GAAG,CAAC;MACtB,KAAK,IAAIF,OAAO,GAAG,CAAC,EAAEA,OAAO,IAAIP,KAAK,CAACU,MAAM,EAAEH,OAAO,EAAE,EAAE;QACxDR,YAAY,IAAIY,eAAe,CAACX,KAAK,CAACO,OAAO,GAAG,CAAC,CAAC,EAAEA,OAAO,EAAET,OAAO,CAAC;QACrE,OAAOI,GAAG,CAACQ,MAAM,GAAGD,cAAc,IAAIP,GAAG,CAACO,cAAc,CAAC,CAACF,OAAO,KAAKA,OAAO,EAAE;UAC7E,MAAMK,OAAO,GAAGV,GAAG,CAACO,cAAc,EAAE,CAAC;UACrCV,YAAY,IAAIc,qBAAqB,CAACD,OAAO,EAAEZ,KAAK,EAAEY,OAAO,CAACL,OAAO,EAAE;YACrE,GAAGT,OAAO;YACVgB,YAAY,EAAE;UAChB,CAAC,CAAC;QACJ;MACF;MACA,OAAOf,YAAY;IAErB,KAAK,QAAQ;IACb,KAAK,IAAI;MAEP,KAAK,MA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C,UAAU,GAAGxB,KAAK,CAACuB,SAAS,GAAG,CAAC,CAAC;IACvC,IAAIC,UAAU,KAAKC,SAAS,EAAE;MAC5BV,aAAa,IAAIJ,eAAe,CAACa,UAAU,EAAEjB,OAAO,EAAET,OAAO,CAAC;IAChE;EACF;EACA,OAAOiB,aAAa;AACtB;AAEA,SAASJ,eAAeA,CAACe,IAAY,EAAEnB,OAAe,EAAET,OAA0B,EAAU;EAC1F,MAAM6B,WAAW,GAAG7B,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEwB,IAAI,GAAGM,UAAU,CAACF,IAAI,CAAC,GAAGA,IAAI;EAC3D,OAAQ,GAAEG,OAAO,CAACC,MAAM,CAACvB,OAAO,CAAC,EAAE,CAAC,CAAE,KAAIoB,WAAY,GAAE7B,OAAO,aAAPA,OAAO,eAAPA,OAAO,CAAEwB,IAAI,GAAG,OAAO,GAAG,IAAK,EAAC;AAC1F;AAQA,SAASO,OAAOA,CAACE,MAAc,EAAEC,YAAoB,EAAU;EAC7D,IAAIC,MAAM,GAAG,EAAE;EACf,KAAK,IAAIC,CAAC,GAAGH,MAAM,CAACrB,MAAM,EAAEwB,CAAC,GAAGF,YAAY,EAAE,EAAEE,CAAC,EAAE;IACjDD,MAAM,IAAI,GAAG;EACf;EACA,OAAOA,MAAM,GAAGF,MAAM;AACxB;AAEA,SAASH,UAAUA,CAACO,MAAc,EAAU;EAC1C,OAAOA,MAAM,CACVC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CACxBA,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CACvBA,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CACvBA,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CACzBA,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC;AAC/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-shader-info.js","names":["getShaderInfo","source","defaultName","name","getShaderName","language","version","getShaderVersion","shader","arguments","length","undefined","SHADER_NAME_REGEXP","match","exec","words","v","parseInt","Number","isFinite"],"sources":["../../../src/lib/compiler-log/get-shader-info.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n// Note: This was the only dependency that made @luma.gl/webgl depend on @luma.gl/shadertools\n// This file was coped from shadertools to avoid the dependency\n\n/** Information extracted from shader source code */\nexport type ShaderInfo = {\n name: string;\n language: 'glsl' | 'wgsl';\n version: number;\n};\n\n/** Extracts information from shader source code */\nexport function getShaderInfo(source: string, defaultName?: string): ShaderInfo {\n return {\n name: getShaderName(source, defaultName),\n language: 'glsl',\n version: getShaderVersion(source)\n };\n}\n\n/** Extracts GLSLIFY style naming of shaders: `#define SHADER_NAME ...` */\nfunction getShaderName(shader: string, defaultName: string = 'unnamed'): string {\n const SHADER_NAME_REGEXP = /#define[\\s*]SHADER_NAME[\\s*]([A-Za-z0-9_-]+)[\\s*]/;\n const match = SHADER_NAME_REGEXP.exec(shader);\n return match ? match[1] : defaultName;\n}\n\n/** returns GLSL shader version of given shader string */\nfunction getShaderVersion(source: string): number {\n let version = 100;\n const words = source.match(/[^\\s]+/g);\n if (words && words.length >= 2 && words[0] === '#version') {\n const v = parseInt(words[1], 10);\n if (Number.isFinite(v)) {\n version = v;\n }\n }\n return version;\n}\n"],"mappings":"AAcA,OAAO,SAASA,aAAaA,CAACC,MAAc,EAAEC,WAAoB,EAAc;EAC9E,OAAO;IACLC,IAAI,EAAEC,aAAa,CAACH,MAAM,EAAEC,WAAW,CAAC;IACxCG,QAAQ,EAAE,MAAM;IAChBC,OAAO,EAAEC,gBAAgB,CAACN,MAAM;EAClC,CAAC;AACH;AAGA,SAASG,aAAaA,CAACI,MAAc,EAA2C;EAAA,IAAzCN,WAAmB,GAAAO,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,SAAS;EACpE,MAAMG,kBAAkB,GAAG,mDAAmD;EAC9E,MAAMC,KAAK,GAAGD,kBAAkB,CAACE,IAAI,CAACN,MAAM,CAAC;EAC7C,OAAOK,KAAK,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGX,WAAW;AACvC;AAGA,SAASK,gBAAgBA,CAACN,MAAc,EAAU;EAChD,IAAIK,OAAO,GAAG,GAAG;EACjB,MAAMS,KAAK,GAAGd,MAAM,CAACY,KAAK,CAAC,SAAS,CAAC;EACrC,IAAIE,KAAK,IAAIA,KAAK,CAACL,MAAM,IAAI,CAAC,IAAIK,KAAK,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE;IACzD,MAAMC,CAAC,GAAGC,QAAQ,CAACF,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAChC,IAAIG,MAAM,CAACC,QAAQ,CAACH,CAAC,CAAC,EAAE;MACtBV,OAAO,GAAGU,CAAC;IACb;EACF;EACA,OAAOV,OAAO;AAChB"}
|
package/dist/lib/luma.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"luma.js","names":["Device","lumaStats","log","assert","deviceList","Map","luma","registerDevices","deviceClasses","deviceClass","type","isSupported","create","set","getAvailableDevices","Array","from","map","getSupportedDevices","filter","setDefaultDeviceProps","props","Object","assign","defaultProps","createDevice","arguments","length","undefined","gl","DeviceClass","get","Error","stats"],"sources":["../../src/lib/luma.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Log} from '@probe.gl/log';\nimport type {DeviceProps} from '../adapter/device';\nimport {Device} from '../adapter/device';\nimport {StatsManager} from '../utils/stats-manager';\nimport {lumaStats} from '../utils/stats-manager';\nimport {log} from '../utils/log';\nimport {assert} from '../utils/assert';\n\n\nconst deviceList = new Map<string, typeof Device>();\n\n/**\n * Entry point to the luma.gl GPU abstraction\n * Register WebGPU and/or WebGL devices (controls application bundle size)\n * Run-time selection of the first available Device\n */\nexport class luma {\n /** Global stats for all devices */\n static stats: StatsManager = lumaStats;\n\n /** Global log */\n static log: Log = log;\n\n static registerDevices(deviceClasses: any[] /* : typeof Device */): void {\n for (const deviceClass of deviceClasses) {\n assert(deviceClass.type && deviceClass.isSupported && deviceClass.create);\n deviceList.set(deviceClass.type, deviceClass);\n }\n }\n\n static getAvailableDevices(): string[] {\n // @ts-expect-error\n return Array.from(deviceList).map(Device => Device.type);\n }\n\n static getSupportedDevices(): string[] {\n // @ts-expect-error\n return Array.from(deviceList).filter(Device => Device.isSupported()).map(Device => Device.type);\n }\n\n static setDefaultDeviceProps(props: DeviceProps): void {\n Object.assign(Device.defaultProps, props);\n }\n\n /** Creates a device. Asynchronously. */\n static async createDevice(props: DeviceProps = {}): Promise<Device> {\n props = {...Device.defaultProps, ...props}\n if (props.gl) {\n props.type = 'webgl';\n }\n\n let DeviceClass: any;\n switch (props.type) {\n case 'webgpu':\n DeviceClass = deviceList.get('webgpu');\n if (DeviceClass) {\n return await DeviceClass.create(props);\n }\n break;\n case 'webgl':\n case 'webgl1':\n case 'webgl2':\n DeviceClass = deviceList.get('webgl');\n if (DeviceClass) {\n return await DeviceClass.create(props);\n }\n break;\n case 'best-available':\n DeviceClass = deviceList.get('webgpu');\n if (DeviceClass && DeviceClass.isSupported()) {\n return await DeviceClass.create(props);\n }\n DeviceClass = deviceList.get('webgl');\n if (DeviceClass && DeviceClass.isSupported()) {\n return await DeviceClass.create(props);\n }\n break;\n }\n throw new Error('No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.');\n }\n}\n"],"mappings":"SAKQA,MAAM;AAAA,SAENC,SAAS;AAAA,SACTC,GAAG;AAAA,SACHC,MAAM;AAGd,MAAMC,UAAU,GAAG,IAAIC,GAAG,CAAwB,CAAC;AAOnD,OAAO,MAAMC,IAAI,CAAC;EAOhB,OAAOC,eAAeA,CAACC,aAAoB,EAA8B;IACvE,KAAK,MAAMC,WAAW,IAAID,aAAa,EAAE;MACvCL,MAAM,CAACM,WAAW,CAACC,IAAI,IAAID,WAAW,CAACE,WAAW,IAAIF,WAAW,CAACG,MA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W,EAAE;UACf,OAAO,MAAMA,WAAW,CAAClB,MAAM,CAACS,KAAK,CAAC;QACxC;QACA;MACF,KAAK,gBAAgB;QACnBS,WAAW,GAAG1B,UAAU,CAAC2B,GAAG,CAAC,QAAQ,CAAC;QACtC,IAAID,WAAW,IAAIA,WAAW,CAACnB,WAAW,CAAC,CAAC,EAAE;UAC5C,OAAO,MAAMmB,WAAW,CAAClB,MAAM,CAACS,KAAK,CAAC;QACxC;QACAS,WAAW,GAAG1B,UAAU,CAAC2B,GAAG,CAAC,OAAO,CAAC;QACrC,IAAID,WAAW,IAAIA,WAAW,CAACnB,WAAW,CAAC,CAAC,EAAE;UAC5C,OAAO,MAAMmB,WAAW,CAAClB,MAAM,CAACS,KAAK,CAAC;QACxC;QACA;IACJ;IACA,MAAM,IAAIW,KAAK,CAAC,kGAAkG,CAAC;EACrH;AACF;AAhEa1B,IAAI,CAER2B,KAAK,GAAiBhC,SAAS;AAF3BK,IAAI,CAKRJ,GAAG,GAAQA,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uniform-block.js","names":["arrayEqual","arrayCopy","UniformBlock","constructor","props","name","uniforms","modifiedUniforms","modified","bindingLayout","needsRedraw","shaderLayout","_props$shaderLayout$b","binding","bindings","find","type","Error","uniformBlock","uniform","setUniforms","key","value","Object","entries","_setUniform","setNeedsRedraw","reason","getAllUniforms"],"sources":["../../../src/lib/uniforms/uniform-block.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {ShaderUniformType} from '../../adapter/types/shader-types';\nimport type {UniformValue} from '../../adapter/types/types';\nimport {\n ShaderLayout,\n UniformInfo,\n UniformBufferBindingLayout\n} from '../../adapter/types/shader-layout';\nimport {arrayEqual, arrayCopy} from '../../utils/array-equal';\n\n/**\n * A uniform block holds values of the of uniform values for one uniform block / buffer.\n * It also does some book keeping on what has changed, to minimize unnecessary writes to uniform buffers.\n * @todo - Track changes to individual uniforms (for WebGL1)\n */\nexport class UniformBlock<TUniforms extends Record<string, UniformValue> = Record<string, UniformValue>> {\n name: string;\n\n uniforms: Record<keyof TUniforms, UniformValue> = {} as Record<keyof TUniforms, UniformValue>;\n modifiedUniforms: Record<keyof TUniforms, boolean> = {} as Record<keyof TUniforms, boolean>;\n modified: boolean = true;\n\n readonly bindingLayout: Record<string, UniformInfo> = {};\n needsRedraw: string | false = 'initialized';\n\n constructor(props?: {\n name?: string;\n shaderLayout?: ShaderLayout;\n uniformTypes?: Record<keyof TUniforms, Record<string, ShaderUniformType>>;\n }) {\n this.name = props?.name;\n\n // TODO - Extract uniform layout from the shaderLayout object\n if (props?.name && props?.shaderLayout) {\n const binding = props?.shaderLayout.bindings?.find(\n binding => binding.type === 'uniform' && binding.name === props?.name\n );\n if (!binding) {\n throw new Error(props?.name);\n }\n\n const uniformBlock = binding as UniformBufferBindingLayout;\n for (const uniform of uniformBlock.uniforms || []) {\n this.bindingLayout[uniform.name] = uniform;\n }\n }\n }\n\n /** Set a map of uniforms */\n setUniforms(uniforms: Partial<TUniforms>): void {\n for (const [key, value] of Object.entries(uniforms)) {\n this._setUniform(key, value);\n if (!this.needsRedraw) {\n this.setNeedsRedraw(`${this.name}.${key}=${value}`);\n }\n }\n }\n\n setNeedsRedraw(reason: string): void {\n this.needsRedraw = this.needsRedraw || reason;\n }\n\n /** Returns all uniforms */\n getAllUniforms(): Record<string, UniformValue> {\n // @ts-expect-error\n this.modifiedUniforms = {};\n this.needsRedraw = false;\n return (this.uniforms || {}) as Record<string, UniformValue>;\n }\n\n /** Set a single uniform */\n private _setUniform(key: keyof TUniforms, value: UniformValue) {\n if (arrayEqual(this.uniforms[key], value)) {\n return;\n }\n this.uniforms[key] = arrayCopy(value);\n this.modifiedUniforms[key] = true;\n this.modified = true;\n }\n}\n"],"mappings":"SAQQA,UAAU,EAAEC,SAAS;AAO7B,OAAO,MAAMC,YAAY,CAAgF;EAUvGC,WAAWA,CAACC,KAIX,EAAE;IAAA,KAbHC,IAAI;IAAA,KAEJC,QAAQ,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AE,GAAE,IAAI,CAACrB,IAAK,IAAGgB,GAAI,IAAGC,KAAM,EAAC,CAAC;MACrD;IACF;EACF;EAEAI,cAAcA,CAACC,MAAc,EAAQ;IACnC,IAAI,CAACjB,WAAW,GAAG,IAAI,CAACA,WAAW,IAAIiB,MAAM;EAC/C;EAGAC,cAAcA,CAAA,EAAiC;IAE7C,IAAI,CAACrB,gBAAgB,GAAG,CAAC,CAAC;IAC1B,IAAI,CAACG,WAAW,GAAG,KAAK;IACxB,OAAQ,IAAI,CAACJ,QAAQ,IAAI,CAAC,CAAC;EAC7B;EAGQmB,WAAWA,CAACJ,GAAoB,EAAEC,KAAmB,EAAE;IAC7D,IAAItB,UAAU,CAAC,IAAI,CAACM,QAAQ,CAACe,GAAG,CAAC,EAAEC,KAAK,CAAC,EAAE;MACzC;IACF;IACA,IAAI,CAAChB,QAAQ,CAACe,GAAG,CAAC,GAAGpB,SAAS,CAACqB,KAAK,CAAC;IACrC,IAAI,CAACf,gBAAgB,CAACc,GAAG,CAAC,GAAG,IAAI;IACjC,IAAI,CAACb,QAAQ,GAAG,IAAI;EACtB;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uniform-buffer-layout.js","names":["decodeShaderUniformType","alignTo","getScratchArrayBuffer","isNumberArray","log","minBufferSize","UniformBufferLayout","constructor","uniformTypes","layout","byteLength","size","key","uniformType","Object","entries","typeAndComponents","type","components","count","offset","actualByteLength","Math","max","getData","uniformValues","bufferSize","arrayBuffer","typedArrays","i32","Int32Array","u32","Uint32Array","f32","Float32Array","f16","Uint16Array","name","value","uniformLayout","warn","typedArray","Number","numericArray","set","Uint8Array","has","Boolean","get"],"sources":["../../../src/lib/uniforms/uniform-buffer-layout.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {ShaderUniformType, ShaderDataType} from '../../adapter/types/shader-types';\nimport type {UniformValue} from '../../adapter/types/types';\nimport {decodeShaderUniformType, alignTo} from '../../adapter/type-utils/decode-shader-types';\nimport {getScratchArrayBuffer} from '../../utils/array-utils-flat';\nimport {isNumberArray} from '../../utils/is-array';\nimport { log } from '../../utils/log';\n\n/** \n * Smallest buffer size that can be used for uniform buffers.\n * TODO - does this depend on device?\n */\nconst minBufferSize: number = 1024;\n\n/**\n * Std140 layout for uniform buffers\n * Supports manual listing of uniforms\n */\nexport class UniformBufferLayout {\n readonly layout: Record<string, {offset: number, size: number, type: ShaderDataType}> = {};\n\n /** number of bytes needed for buffer allocation */\n readonly byteLength: number;\n\n\n /** Create a new UniformBufferLayout given a map of attributes. */\n constructor(uniformTypes: Record<string, ShaderUniformType>) {\n /** number of 4 byte slots taken */\n let size: number = 0;\n\n // Add layout (type, size and offset) definitions for each uniform in the layout\n for (const [key, uniformType] of Object.entries(uniformTypes)) {\n const typeAndComponents = decodeShaderUniformType(uniformType);\n const {type, components: count} = typeAndComponents;\n // First, align (bump) current offset to an even multiple of current object (1, 2, 4)\n size = alignTo(size, count);\n // Use the aligned size as the offset of the current uniform.\n const offset = size;\n // Then, add our object's padded size ((1, 2, multiple of 4) to the current offset\n size += count;\n this.layout[key] = {type, size: count, offset};\n }\n size += (4 - (size % 4)) % 4;\n\n const actualByteLength = size * 4;\n this.byteLength = Math.max(actualByteLength, minBufferSize);\n }\n\n /** Get the data for the complete buffer */\n getData(uniformValues: Record<string, UniformValue>): Uint8Array {\n const bufferSize = Math.max(this.byteLength, minBufferSize);\n\n // Allocate three typed arrays pointing at same memory\n const arrayBuffer = getScratchArrayBuffer(bufferSize);\n const typedArrays = {\n i32: new Int32Array(arrayBuffer),\n u32: new Uint32Array(arrayBuffer),\n f32: new Float32Array(arrayBuffer),\n // TODO not implemented\n f16: new Uint16Array(arrayBuffer)\n };\n // TODO is this needed?\n // typedArrays.i32.fill(0);\n \n for (const [name, value] of Object.entries(uniformValues)) {\n const uniformLayout = this.layout[name];\n if (!uniformLayout) {\n log.warn(`Supplied uniform value ${name} not present in uniform block layout`)();\n // eslint-disable-next-line no-continue\n continue;\n }\n\n const {type, size, offset} = uniformLayout;\n const typedArray = typedArrays[type];\n if (size === 1) {\n if (typeof value !== 'number' && typeof value !== 'boolean') {\n log.warn(`Supplied value for single component uniform ${name} is not a number: ${value}`)();\n // eslint-disable-next-line no-continue\n continue;\n }\n // single value -> just set it\n typedArray[offset] = Number(value);\n } else {\n const numericArray = isNumberArray(value);\n if (!numericArray) {\n log.warn(`Supplied value for multi component / array uniform ${name} is not a numeric array: ${value}`)();\n // eslint-disable-next-line no-continue\n continue;\n }\n // vector/matrix -> copy the supplied (typed) array, starting from offset\n // TODO: we should limit or check size in case the supplied data overflows\n typedArray.set(numericArray, offset);\n }\n }\n\n return new Uint8Array(arrayBuffer);\n } \n\n /** Does this layout have a field with specified name */\n has(name: string) {\n return Boolean(this.layout[name]);\n }\n\n /** Get offset and size for a field with specified name */\n get(name: string): {offset: number, size: number} | undefined {\n const layout = this.layout[name];\n return layout;\n }\n}\n"],"mappings":"SAGQA,uBAAuB,EAAEC,OAAO;AAAA,SAChCC,qBAAqB;AAAA,SACrBC,aAAa;AAAA,SACZC,GAAG;AAMZ,MAAMC,aAAqB,GAAG,IAAI;AAMlC,OAAO,MAAMC,mBAAmB,CAAC;EAQ/BC,WAAWA,CAACC,YAA+C,EAAE;IAAA,KAPpDC,MAAM,GAAyE,CAAC,CAAC;IAAA,KAGjFC,UAAU;IAMjB,IAAIC,IAAY,GAAG,CAAC;IAGpB,KAAK,MAAM,CAACC,GAAG,EAAEC,WAAW,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACP,YAAY,CAAC,EAAE;MAC7D,MAAMQ,iBAAiB,GAAGhB,uBAAuB,CAACa,WAAW,CAAC;MAC9D,MAAM;QAACI,IAAI;QAAEC,UAAU,EAAEC;MAAK,CAAC,GAAGH,iBAAiB;MAEnDL,IAAI,GAAGV,OAAO,CAACU,IAAI,EAAEQ,KAAK,CAAC;MAE3B,MAAMC,MAAM,GAAGT,IAAI;MAEnBA,IAAI,IAAIQ,KAAK;MACb,IAAI,CAACV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AAE;UAC3DlC,GAAG,CAACoC,IAAI,CAAE,+CAA8CH,IAAK,qBAAoBC,KAAM,EAAC,CAAC,CAAC,CAAC;UAE3F;QACF;QAEAG,UAAU,CAACrB,MAAM,CAAC,GAAGsB,MAAM,CAACJ,KAAK,CAAC;MACpC,CAAC,MAAM;QACL,MAAMK,YAAY,GAAGxC,aAAa,CAACmC,KAAK,CAAC;QACzC,IAAI,CAACK,YAAY,EAAE;UACjBvC,GAAG,CAACoC,IAAI,CAAE,sDAAqDH,IAAK,4BAA2BC,KAAM,EAAC,CAAC,CAAC,CAAC;UAEzG;QACF;QAGAG,UAAU,CAACG,GAAG,CAACD,YAAY,EAAEvB,MAAM,CAAC;MACtC;IACF;IAEA,OAAO,IAAIyB,UAAU,CAAClB,WAAW,CAAC;EACpC;EAGAmB,GAAGA,CAACT,IAAY,EAAE;IAChB,OAAOU,OAAO,CAAC,IAAI,CAACtC,MAAM,CAAC4B,IAAI,CAAC,CAAC;EACnC;EAGAW,GAAGA,CAACX,IAAY,EAA8C;IAC5D,MAAM5B,MAAM,GAAG,IAAI,CAACA,MAAM,CAAC4B,IAAI,CAAC;IAChC,OAAO5B,MAAM;EACf;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uniform-store.js","names":["Buffer","UniformBlock","UniformBufferLayout","log","UniformStore","constructor","blocks","uniformBlocks","Map","uniformBufferLayouts","uniformBuffers","bufferName","block","Object","entries","uniformBufferName","uniformBufferLayout","uniformTypes","set","uniformBlock","name","setUniforms","defaultUniforms","destroy","uniformBuffer","values","uniforms","blockName","uniformValues","get","updateUniformBuffers","getUniformBufferByteLength","byteLength","getUniformBufferData","getAllUniforms","getData","createUniformBuffer","device","createBuffer","usage","UNIFORM","COPY_DST","uniformBufferData","write","getManagedUniformBuffer","reason","keys","bufferReason","updateUniformBuffer","needsRedraw","String"],"sources":["../../../src/lib/uniforms/uniform-store.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {ShaderUniformType} from '../../adapter/types/shader-types';\nimport type {UniformValue} from '../../adapter/types/types';\nimport type {Device} from '../../adapter/device';\nimport {Buffer} from '../../adapter/resources/buffer';\nimport {UniformBlock} from './uniform-block';\nimport {UniformBufferLayout} from './uniform-buffer-layout';\nimport {log} from '../../utils/log';\n\nexport type ShaderModuleInputs = {\n uniformTypes?: Record<string, ShaderUniformType>;\n defaultProps?: Record<string, unknown>;\n defaultUniforms?: Record<string, UniformValue>;\n};\n\n/**\n * A uniform store holds a uniform values for one or more uniform blocks,\n * - It can generate binary data for any uniform buffer\n * - It can manage a uniform buffer for each block\n * - It can update managed uniform buffers with a single call\n * - It performs some book keeping on what has changed to minimize unnecessary writes to uniform buffers.\n */\nexport class UniformStore<\n TPropGroups extends Record<string, Record<string, unknown>> = Record<\n string,\n Record<string, unknown>\n >\n> {\n /** Stores the uniform values for each uniform block */\n uniformBlocks = new Map<keyof TPropGroups, UniformBlock>();\n /** Can generate data for a uniform buffer for each block from data */\n uniformBufferLayouts = new Map<keyof TPropGroups, UniformBufferLayout>();\n /** Actual buffer for the blocks */\n uniformBuffers = new Map<keyof TPropGroups, Buffer>();\n\n /**\n * Create a new UniformStore instance\n * @param blocks\n */\n constructor(\n blocks: Record<\n keyof TPropGroups,\n {\n uniformTypes?: Record<string, ShaderUniformType>;\n defaultProps?: Record<string, unknown>;\n defaultUniforms?: Record<string, UniformValue>;\n }\n >\n ) {\n for (const [bufferName, block] of Object.entries(blocks)) {\n const uniformBufferName = bufferName as keyof TPropGroups;\n\n // Create a layout object to help us generate correctly formatted binary uniform buffers\n const uniformBufferLayout = new UniformBufferLayout(block.uniformTypes || {});\n this.uniformBufferLayouts.set(uniformBufferName, uniformBufferLayout);\n\n // Create a Uniform block to store the uniforms for each buffer.\n const uniformBlock = new UniformBlock({name: bufferName});\n uniformBlock.setUniforms(block.defaultUniforms || {});\n this.uniformBlocks.set(uniformBufferName, uniformBlock);\n }\n }\n\n /** Destroy any managed uniform buffers */\n destroy(): void {\n for (const uniformBuffer of Object.values(this.uniformBuffers)) {\n uniformBuffer.destroy();\n }\n }\n\n /**\n * Set uniforms\n * Makes all properties partial\n */\n setUniforms(\n uniforms: Partial<{[group in keyof TPropGroups]: Partial<TPropGroups[group]>}>\n ): void {\n for (const [blockName, uniformValues] of Object.entries(uniforms)) {\n this.uniformBlocks.get(blockName).setUniforms(uniformValues);\n // We leverage logging in updateUniformBuffers(), even though slightly less efficient\n // this.updateUniformBuffer(blockName);\n }\n\n this.updateUniformBuffers();\n }\n\n /** Get the required minimum length of the uniform buffer */\n getUniformBufferByteLength(uniformBufferName: keyof TPropGroups): number {\n return this.uniformBufferLayouts.get(uniformBufferName).byteLength;\n }\n\n /** Get formatted binary memory that can be uploaded to a buffer */\n getUniformBufferData(uniformBufferName: keyof TPropGroups): Uint8Array {\n const uniformValues = this.uniformBlocks.get(uniformBufferName).getAllUniforms();\n return this.uniformBufferLayouts.get(uniformBufferName).getData(uniformValues);\n }\n\n /**\n * Creates an unmanaged uniform buffer (umnanaged means that application is responsible for destroying it)\n * The new buffer is initialized with current / supplied values\n */\n createUniformBuffer(\n device: Device,\n uniformBufferName: keyof TPropGroups,\n uniforms?: Partial<{[group in keyof TPropGroups]: Partial<TPropGroups[group]>}>\n ): Buffer {\n if (uniforms) {\n this.setUniforms(uniforms);\n }\n const byteLength = this.getUniformBufferByteLength(uniformBufferName);\n const uniformBuffer = device.createBuffer({\n usage: Buffer.UNIFORM | Buffer.COPY_DST,\n byteLength\n });\n // Note that this clears the needs redraw flag\n const uniformBufferData = this.getUniformBufferData(uniformBufferName);\n uniformBuffer.write(uniformBufferData);\n return uniformBuffer;\n }\n\n /** Get the managed uniform buffer. \"managed\" resources are destroyed when the uniformStore is destroyed. */\n getManagedUniformBuffer(device: Device, uniformBufferName: keyof TPropGroups): Buffer {\n if (!this.uniformBuffers.get(uniformBufferName)) {\n const byteLength = this.getUniformBufferByteLength(uniformBufferName);\n const uniformBuffer = device.createBuffer({\n usage: Buffer.UNIFORM | Buffer.COPY_DST,\n byteLength\n });\n this.uniformBuffers.set(uniformBufferName, uniformBuffer);\n }\n // this.updateUniformBuffers();\n return this.uniformBuffers.get(uniformBufferName);\n }\n\n /** Updates all uniform buffers where values have changed */\n updateUniformBuffers(): false | string {\n let reason: false | string = false;\n for (const uniformBufferName of this.uniformBlocks.keys()) {\n const bufferReason = this.updateUniformBuffer(uniformBufferName);\n reason ||= bufferReason;\n }\n if (reason) {\n log.log(3, `UniformStore.updateUniformBuffers(): ${reason}`)();\n }\n return reason;\n }\n\n /** Update one uniform buffer. Only updates if values have changed */\n updateUniformBuffer(uniformBufferName: keyof TPropGroups): false | string {\n const uniformBlock = this.uniformBlocks.get(uniformBufferName);\n const uniformBuffer = this.uniformBuffers.get(uniformBufferName);\n\n let reason: false | string = false;\n if (uniformBuffer && uniformBlock.needsRedraw) {\n reason ||= uniformBlock.needsRedraw;\n // This clears the needs redraw flag\n const uniformBufferData = this.getUniformBufferData(uniformBufferName);\n\n const uniformBuffer = this.uniformBuffers.get(uniformBufferName);\n uniformBuffer.write(uniformBufferData);\n\n // logging - TODO - don't query the values unnecessarily\n const uniformValues = this.uniformBlocks.get(uniformBufferName).getAllUniforms();\n log.log(\n 4,\n `Writing to uniform buffer ${String(uniformBufferName)}`,\n uniformBufferData,\n uniformValues\n )();\n }\n return reason;\n }\n}\n"],"mappings":"SAIQA,MAAM;AAAA,SACNC,YAAY;AAAA,SACZC,mBAAmB;AAAA,SACnBC,GAAG;AAeX,OAAO,MAAMC,YAAY,CAKvB;EAYAC,WAAWA,CACTC,MAOC,EACD;IAAA,KAnBFC,aAAa,GAAG,IAAIC,GAAG,CAAkC,CAAC;IAAA,KAE1DC,oBAAoB,GAAG,IAAID,GAAG,CAAyC,CAAC;IAAA,KAExEE,cAAc,GAAG,IAAIF,GAAG,CAA4B,CAAC;IAgBnD,KAAK,MAAM,CAACG,UAAU,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACR,MAAM,CAAC,EAAE;MACx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,MAAM,GAAKE,YAAY;IACzB;IACA,IAAIF,MAAM,EAAE;MACV1C,GAAG,CAACA,GAAG,CAAC,CAAC,EAAG,wCAAuC0C,MAAO,EAAC,CAAC,CAAC,CAAC;IAChE;IACA,OAAOA,MAAM;EACf;EAGAG,mBAAmBA,CAACjC,iBAAoC,EAAkB;IACxE,MAAMI,YAAY,GAAG,IAAI,CAACZ,aAAa,CAACsB,GAAG,CAACd,iBAAiB,CAAC;IAC9D,MAAMS,aAAa,GAAG,IAAI,CAACd,cAAc,CAACmB,GAAG,CAACd,iBAAiB,CAAC;IAEhE,IAAI8B,MAAsB,GAAG,KAAK;IAClC,IAAIrB,aAAa,IAAIL,YAAY,CAAC8B,WAAW,EAAE;MAC7CJ,MAAM,KAANA,MAAM,GAAK1B,YAAY,CAAC8B,WAAW;MAEnC,MAAMP,iBAAiB,GAAG,IAAI,CAACT,oBAAoB,CAAClB,iBAAiB,CAAC;MAEtE,MAAMS,aAAa,GAAG,IAAI,CAACd,cAAc,CAACmB,GAAG,CAACd,iBAAiB,CAAC;MAChES,aAAa,CAACmB,KAAK,CAACD,iBAAiB,CAAC;MAGtC,MAAMd,aAAa,GAAG,IAAI,CAACrB,aAAa,CAACsB,GAAG,CAACd,iBAAiB,CAAC,CAACmB,cAAc,CAAC,CAAC;MAChF/B,GAAG,CAACA,GAAG,CACL,CAAC,EACA,6BAA4B+C,MAAM,CAACnC,iBAAiB,CAAE,EAAC,EACxD2B,iBAAiB,EACjBd,aACF,CAAC,CAAC,CAAC;IACL;IACA,OAAOiB,MAAM;EACf;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uniform.js","names":["isNumberArray","isUniformValue","value","splitUniformsAndBindings","uniforms","result","bindings","Object","keys","forEach","name","uniform"],"sources":["../../../src/lib/uniforms/uniform.ts"],"sourcesContent":["import type {UniformValue} from '../../adapter/types/types';\nimport type {Binding} from '../../adapter/types/shader-layout';\nimport {isNumberArray} from '../../utils/is-array';\n\nexport function isUniformValue(value: unknown): boolean {\n return isNumberArray(value) !== null || (typeof value === 'number') || (typeof value === 'boolean');\n}\n\ntype UniformsAndBindings = {\n bindings: Record<string, Binding>,\n uniforms: Record<string, UniformValue>\n};\nexport function splitUniformsAndBindings(uniforms: Record<string, Binding | UniformValue>): UniformsAndBindings {\n const result: UniformsAndBindings = { bindings: {}, uniforms: {} } \n Object.keys(uniforms).forEach(name => {\n const uniform = uniforms[name];\n if(isUniformValue(uniform)) {\n result.uniforms[name] = uniform as UniformValue;\n } else {\n result.bindings[name] = uniform as Binding;\n }\n });\n\n return result;\n}\n"],"mappings":"SAEQA,aAAa;AAErB,OAAO,SAASC,cAAcA,CAACC,KAAc,EAAW;EACtD,OAAOF,aAAa,CAACE,KAAK,CAAC,KAAK,IAAI,IAAK,OAAOA,KAAK,KAAK,QAAS,IAAK,OAAOA,KAAK,KAAK,SAAU;AACrG;AAMA,OAAO,SAASC,wBAAwBA,CAACC,QAAgD,EAAuB;EAC9G,MAAMC,MAA2B,GAAG;IAAEC,QAAQ,EAAE,CAAC,CAAC;IAAEF,QAAQ,EAAE,CAAC;EAAE,CAAC;EAClEG,MAAM,CAACC,IAAI,CAACJ,QAAQ,CAAC,CAACK,OAAO,CAACC,IAAI,IAAI;IACpC,MAAMC,OAAO,GAAGP,QAAQ,CAACM,IAAI,CAAC;IAC9B,IAAGT,cAAc,CAACU,OAAO,CAAC,EAAE;MAC1BN,MAAM,CAACD,QAAQ,CAACM,IAAI,CAAC,GAAGC,OAAuB;IACjD,CAAC,MAAM;MACLN,MAAM,CAACC,QAAQ,CAACI,IAAI,CAAC,GAAGC,OAAkB;IAC5C;EACF,CAAC,CAAC;EAEF,OAAON,MAAM;AACf"}
|
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["TypedArray","NumberArray"],"sources":["../src/types.ts"],"sourcesContent":["/** TypeScript type covering all typed arrays */\nimport {TypedArray, NumberArray} from '@math.gl/types';\n\nexport {TypedArray, NumberArray};\n\n/** TypeScript type covering constructors of any of the typed arrays */\nexport type TypedArrayConstructor =\n | Int8ArrayConstructor\n | Uint8ArrayConstructor\n | Int16ArrayConstructor\n | Uint16ArrayConstructor\n | Int32ArrayConstructor\n | Uint32ArrayConstructor\n | Uint8ClampedArrayConstructor\n | Float32ArrayConstructor\n | Float64ArrayConstructor;\n\n/** Keep big int arrays separate as they are still problematic, can't be indexed and don't work well on Safari */\nexport type BigIntTypedArray = BigInt64Array | BigUint64Array;\n\nexport type BigIntOrNumberArray = NumberArray | BigIntTypedArray;\n\n/** Get the constructor type of a type */\nexport interface ConstructorOf<T> {\n new (...args: unknown[]): T;\n}\n\n/** \n * Make specific fields in a type optional. Granular version of `Partial<T>` \n * @example \n * type PartialProps = PartialBy<Required<DeviceProps>, 'device' | 'canvas'>\n */\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n"],"mappings":"AACA,SAAQA,UAAU,EAAEC,WAAW,QAAO,gBAAgB;AAEtD,SAAQD,UAAU,EAAEC,WAAW"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array-equal.js","names":["isNumberArray","arrayEqual","a","b","limit","arguments","length","undefined","arrayA","arrayB","i","arrayCopy","numberArray","slice"],"sources":["../../src/utils/array-equal.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {isNumberArray} from './is-array';\n\n/** Test if two arrays are deep equal, with a length limit that defaults to 16 */\nexport function arrayEqual(a: unknown, b: unknown, limit: number = 16) {\n if (a !== b) {\n return false;\n }\n const arrayA = isNumberArray(a);\n if (!arrayA) {\n return false;\n }\n const arrayB = isNumberArray(b);\n if (arrayB && arrayA.length === arrayB.length) {\n for (let i = 0; i < arrayA.length; ++i) {\n if (arrayB[i] !== arrayA[i]) {\n return false;\n }\n }\n }\n return true;\n}\n\n/** Copy a value */\nexport function arrayCopy<T>(a: T): T {\n const numberArray = isNumberArray(a);\n if (numberArray) {\n return numberArray.slice() as T;\n }\n return a;\n}\n"],"mappings":"SAGQA,aAAa;AAGrB,OAAO,SAASC,UAAUA,CAACC,CAAU,EAAEC,CAAU,EAAsB;EAAA,IAApBC,KAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EACnE,IAAIH,CAAC,KAAKC,CAAC,EAAE;IACX,OAAO,KAAK;EACd;EACA,MAAMK,MAAM,GAAGR,aAAa,CAACE,CAAC,CAAC;EAC/B,IAAI,CAACM,MAAM,EAAE;IACX,OAAO,KAAK;EACd;EACA,MAAMC,MAAM,GAAGT,aAAa,CAACG,CAAC,CAAC;EAC/B,IAAIM,MAAM,IAAID,MAAM,CAACF,MAAM,KAAKG,MAAM,CAACH,MAAM,EAAE;IAC7C,KAAK,IAAII,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,CAACF,MAAM,EAAE,EAAEI,CAAC,EAAE;MACtC,IAAID,MAAM,CAACC,CAAC,CAAC,KAAKF,MAAM,CAACE,CAAC,CAAC,EAAE;QAC3B,OAAO,KAAK;MACd;IACF;EACF;EACA,OAAO,IAAI;AACb;AAGA,OAAO,SAASC,SAASA,CAAIT,CAAI,EAAK;EACpC,MAAMU,WAAW,GAAGZ,aAAa,CAACE,CAAC,CAAC;EACpC,IAAIU,WAAW,EAAE;IACf,OAAOA,WAAW,CAACC,KAAK,CAAC,CAAC;EAC5B;EACA,OAAOX,CAAC;AACV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array-utils-flat.js","names":["arrayBuffer","getScratchArrayBuffer","byteLength","ArrayBuffer","getScratchArray","Type","length","scratchArrayBuffer","BYTES_PER_ELEMENT","fillArray","options","target","source","start","count","total","copied","i","copyWithin"],"sources":["../../src/utils/array-utils-flat.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {TypedArray, NumberArray} from '../types';\n\nlet arrayBuffer: ArrayBuffer;\n\nexport function getScratchArrayBuffer(byteLength: number): ArrayBuffer {\n if (!arrayBuffer || arrayBuffer.byteLength < byteLength) {\n arrayBuffer = new ArrayBuffer(byteLength);\n }\n return arrayBuffer;\n}\n\nexport function getScratchArray(Type: any, length: number): TypedArray {\n const scratchArrayBuffer = getScratchArrayBuffer(Type.BYTES_PER_ELEMENT * length);\n return new Type(scratchArrayBuffer, 0, length); // arrayBuffer, byteOffset, length (in elements)\n}\n\n// Uses copyWithin to significantly speed up typed array value filling\nexport function fillArray(options: {target: NumberArray, source: NumberArray, start?: number, count?: number}): NumberArray {\n const {target, source, start = 0, count = 1} = options;\n const length = source.length;\n const total = count * length;\n let copied = 0;\n for (let i = start; copied < length; copied++) {\n target[i++] = source[copied] ;\n }\n\n while (copied < total) {\n // If we have copied less than half, copy everything we got\n // else copy remaining in one operation\n if (copied < total - copied) {\n target.copyWithin(start + copied, start, start + copied);\n copied *= 2;\n } else {\n target.copyWithin(start + copied, start, start + total - copied);\n copied = total;\n }\n }\n\n return options.target;\n}\n"],"mappings":"AAKA,IAAIA,WAAwB;AAE5B,OAAO,SAASC,qBAAqBA,CAACC,UAAkB,EAAe;EACrE,IAAI,CAACF,WAAW,IAAIA,WAAW,CAACE,UAAU,GAAGA,UAAU,EAAE;IACvDF,WAAW,GAAG,IAAIG,WAAW,CAACD,UAAU,CAAC;EAC3C;EACA,OAAOF,WAAW;AACpB;AAEA,OAAO,SAASI,eAAeA,CAACC,IAAS,EAAEC,MAAc,EAAc;EACrE,MAAMC,kBAAkB,GAAGN,qBAAqB,CAACI,IAAI,CAACG,iBAAiB,GAAGF,MAAM,CAAC;EACjF,OAAO,IAAID,IAAI,CAACE,kBAAkB,EAAE,CAAC,EAAED,MAAM,CAAC;AAChD;AAGA,OAAO,SAASG,SAASA,CAACC,OAAmF,EAAe;EAC1H,MAAM;IAACC,MAAM;IAAEC,MAAM;IAAEC,KAAK,GAAG,CAAC;IAAEC,KAAK,GAAG;EAAC,CAAC,GAAGJ,OAAO;EACtD,MAAMJ,MAAM,GAAGM,MAAM,CAACN,MAAM;EAC5B,MAAMS,KAAK,GAAGD,KAAK,GAAGR,MAAM;EAC5B,IAAIU,MAAM,GAAG,CAAC;EACd,KAAK,IAAIC,CAAC,GAAGJ,KAAK,EAAEG,MAAM,GAAGV,MAAM,EAAEU,MAAM,EAAE,EAAE;IAC7CL,MAAM,CAACM,CAAC,EAAE,CAAC,GAAGL,MAAM,CAACI,MAAM,CAAC;EAC9B;EAEA,OAAOA,MAAM,GAAGD,KAAK,EAAE;IAGrB,IAAIC,MAAM,GAAGD,KAAK,GAAGC,MAAM,EAAE;MAC3BL,MAAM,CAACO,UAAU,CAACL,KAAK,GAAGG,MAAM,EAAEH,KAAK,EAAEA,KAAK,GAAGG,MAAM,CAAC;MACxDA,MAAM,IAAI,CAAC;IACb,CAAC,MAAM;MACLL,MAAM,CAACO,UAAU,CAACL,KAAK,GAAGG,MAAM,EAAEH,KAAK,EAAEA,KAAK,GAAGE,KAAK,GAAGC,MAAM,CAAC;MAChEA,MAAM,GAAGD,KAAK;IAChB;EACF;EAEA,OAAOL,OAAO,CAACC,MAAM;AACvB"}
|
package/dist/utils/assert.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assert.js","names":["assert","condition","message","Error"],"sources":["../../src/utils/assert.ts"],"sourcesContent":["// Recommendation is to ignore message but current test suite checks agains the\n// message so keep it for now.\nexport function assert(condition: unknown, message?: string): void | never {\n if (!condition) {\n throw new Error(message || 'luma.gl: assertion failed.');\n }\n}\n"],"mappings":"AAEA,OAAO,SAASA,MAAMA,CAACC,SAAkB,EAAEC,OAAgB,EAAgB;EACzE,IAAI,CAACD,SAAS,EAAE;IACd,MAAM,IAAIE,KAAK,CAACD,OAAO,IAAI,4BAA4B,CAAC;EAC1D;AACF"}
|
package/dist/utils/cast.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cast.js","names":["cast","value"],"sources":["../../src/utils/cast.ts"],"sourcesContent":["/** Helper for type downcasts, e.g. Buffer -> WebGPUBuffer */\nexport function cast<T>(value: any) {\n return value as T;\n}\n"],"mappings":"AACA,OAAO,SAASA,IAAIA,CAAIC,KAAU,EAAE;EAClC,OAAOA,KAAK;AACd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check-props.js","names":["log","checkProps","className","props","propChecks","removedProps","deprecatedProps","replacedProps","propName","replacementProp","replacement","removed","deprecated","newProps","Object","entries","assign"],"sources":["../../src/utils/check-props.ts"],"sourcesContent":["import {log} from './log';\n\n/* Use as\nimport {checkProps} from '../util/check-props;'\n\nconst PROP_CHECKS = {\n // Removed props no longer supported, print error and link to upgrade guide\n removedProps: {\n },\n // Deprecated props\n deprecatedProps: {\n offset: 'accessor',\n stride: 'accessor',\n type: 'accessor',\n size: 'accessor',\n divisor: 'accessor',\n normalized: 'accessor',\n integer: 'accessor'\n },\n // Deprecated props that can be autosubstituted, print warning and return updated props object\n replacedProps: {\n bytes: 'byteLength'\n }\n}\n\nclass Buffer {\n setProps(props) {\n checkProps('Buffer', props, PROP_CHECKS);\n }\n}\n*/\n\nexport type PropChecks = {\n removedProps?: Record<string, any>;\n replacedProps?: Record<string, string>;\n deprecatedProps?: Record<string, string>;\n};\n\nexport function checkProps(className: string, props: Record<string, any>, propChecks: PropChecks): Record<string, unknown> {\n const {removedProps = {}, deprecatedProps = {}, replacedProps = {}} = propChecks;\n\n // removedProps: Removed props no longer supported\n // print error and link to upgrade guide\n for (const propName in removedProps) {\n if (propName in props) {\n const replacementProp = removedProps[propName];\n const replacement = replacementProp ? `${className}.${removedProps[propName]}` : 'N/A';\n log.removed(`${className}.${propName}`, replacement)();\n }\n }\n\n // deprecatedProps: Deprecated props that can not be autosubstituted\n // print warning and rely on caller to substitute\n for (const propName in deprecatedProps) {\n if (propName in props) {\n const replacementProp = deprecatedProps[propName];\n log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();\n }\n }\n\n // replacedProps: Deprecated props that can be autosubstituted\n // print warning and return updated props object\n let newProps = null;\n for (const [propName, replacementProp] of Object.entries(replacedProps)) {\n if (propName in props) {\n log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();\n newProps = newProps || Object.assign({}, props);\n newProps[replacementProp] = props[propName];\n delete newProps[propName];\n }\n }\n\n return newProps || props;\n}\n"],"mappings":"SAAQA,GAAG;AAsCX,OAAO,SAASC,UAAUA,CAACC,SAAiB,EAAEC,KAA0B,EAAEC,UAAsB,EAA2B;EACzH,MAAM;IAACC,YAAY,GAAG,CAAC,CAAC;IAAEC,eAAe,GAAG,CAAC,CAAC;IAAEC,aAAa,GAAG,CAAC;EAAC,CAAC,GAAGH,UAAU;EAIhF,KAAK,MAAMI,QAAQ,IAAIH,YAAY,EAAE;IACnC,IAAIG,QAAQ,IAAIL,KAAK,EAAE;MACrB,MAAMM,eAAe,GAAGJ,YAAY,CAACG,QAAQ,CAAC;MAC9C,MAAME,WAAW,GAAGD,eAAe,GAAI,GAAEP,SAAU,IAAGG,YAAY,CAACG,QAAQ,CAAE,EAAC,GAAG,KAAK;MACtFR,GAAG,CAACW,OAAO,CAAE,GAAET,SAAU,IAAGM,QAAS,EAAC,EAAEE,WAAW,CAAC,CAAC,CAAC;IACxD;EACF;EAIA,KAAK,MAAMF,QAAQ,IAAIF,eAAe,EAAE;IACtC,IAAIE,QAAQ,IAAIL,KAAK,EAAE;MACrB,MAAMM,eAAe,GAAGH,eAAe,CAACE,QAAQ,CAAC;MACjDR,GAAG,CAACY,UAAU,CAAE,GAAEV,SAAU,IAAGM,QAAS,EAAC,EAAG,GAAEN,SAAU,IAAGO,eAAgB,EAAC,CAAC,CAAC,CAAC;IACjF;EACF;EAIA,IAAII,QAAQ,GAAG,IAAI;EACnB,KAAK,MAAM,CAACL,QAAQ,EAAEC,eAAe,CAAC,IAAIK,MAAM,CAACC,OAAO,CAACR,aAAa,CAAC,EAAE;IACvE,IAAIC,QAAQ,IAAIL,KAAK,EAAE;MACrBH,GAAG,CAACY,UAAU,CAAE,GAAEV,SAAU,IAAGM,QAAS,EAAC,EAAG,GAAEN,SAAU,IAAGO,eAAgB,EAAC,CAAC,CAAC,CAAC;MAC/EI,QAAQ,GAAGA,QAAQ,IAAIC,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC,EAAEb,KAAK,CAAC;MAC/CU,QAAQ,CAACJ,eAAe,CAAC,GAAGN,KAAK,CAACK,QAAQ,CAAC;MAC3C,OAAOK,QAAQ,CAACL,QAAQ,CAAC;IAC3B;EACF;EAEA,OAAOK,QAAQ,IAAIV,KAAK;AAC1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deep-equal.js","names":["deepEqual","a","b","depth","Array","isArray","length","i","aKeys","Object","keys","bKeys","key","hasOwnProperty"],"sources":["../../src/utils/deep-equal.ts"],"sourcesContent":["/**\n * Fast partial deep equal for prop.\n *\n * @param a Prop\n * @param b Prop to compare against `a`\n * @param depth Depth to which to recurse in nested Objects/Arrays. Use 0 (default) for shallow comparison, -1 for infinite depth\n */\n/* eslint-disable complexity */\nexport function deepEqual(a: any, b: any, depth: number): boolean {\n if (a === b) {\n return true;\n }\n if (!depth || !a || !b) {\n return false;\n }\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i], depth - 1)) {\n return false;\n }\n }\n return true;\n }\n if (Array.isArray(b)) {\n return false;\n }\n if (typeof a === 'object' && typeof b === 'object') {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n for (const key of aKeys) {\n if (!b.hasOwnProperty(key)) {\n return false;\n }\n if (!deepEqual(a[key], b[key], depth - 1)) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n"],"mappings":"AAQA,OAAO,SAASA,SAASA,CAACC,CAAM,EAAEC,CAAM,EAA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AAC,EAAE;QACzC,OAAO,KAAK;MACd;IACF;IACA,OAAO,IAAI;EACb;EACA,OAAO,KAAK;AACd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-value.js","names":["formatArrayValue","v","opts","arguments","length","undefined","maxElts","size","string","i","formatValue","terminator","EPSILON","isInteger","Array","isArray","ArrayBuffer","isView","String","Math","abs","toFixed","toPrecision","decimal","indexOf","slice"],"sources":["../../src/utils/format-value.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport type {NumberArray} from '../types';\n\n/** TODO @deprecated - delete when confident that probe.gl logging implements all opts */\nfunction formatArrayValue(v: NumberArray, opts: {maxElts?: number, size?: number} = {}): string {\n const {maxElts = 16, size = 1} = opts;\n let string = '[';\n for (let i = 0; i < v.length && i < maxElts; ++i) {\n if (i > 0) {\n string += `,${i % size === 0 ? ' ' : ''}`;\n }\n string += formatValue(v[i], opts);\n }\n const terminator = v.length > maxElts ? '...' : ']';\n return `${string}${terminator}`;\n}\n\n/** TODO @deprecated - delete when confident that probe.gl logging implements all opts */\nexport function formatValue(v: number | NumberArray | unknown, opts: {isInteger?: boolean, size?: number} = {}): string {\n const EPSILON = 1e-16;\n const {isInteger = false} = opts;\n if (Array.isArray(v) || ArrayBuffer.isView(v)) {\n return formatArrayValue(v as NumberArray, opts);\n }\n if (typeof v !== 'number') {\n return String(v);\n }\n if (Math.abs(v) < EPSILON) {\n return isInteger ? '0' : '0.';\n }\n if (isInteger) {\n return v.toFixed(0);\n }\n if (Math.abs(v) > 100 && Math.abs(v) < 10000) {\n return v.toFixed(0);\n }\n const string = v.toPrecision(2);\n const decimal = string.indexOf('.0');\n return decimal === string.length - 2 ? string.slice(0, -1) : string;\n}\n"],"mappings":"AAIA,SAASA,gBAAgBA,CAACC,CAAc,EAAwD;EAAA,IAAtDC,IAAuC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACpF,MAA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oB,OAAO,CAAC,CAAC,CAAC;EACrB;EACA,IAAIF,IAAI,CAACC,GAAG,CAACnB,CAAC,CAAC,GAAG,GAAG,IAAIkB,IAAI,CAACC,GAAG,CAACnB,CAAC,CAAC,GAAG,KAAK,EAAE;IAC5C,OAAOA,CAAC,CAACoB,OAAO,CAAC,CAAC,CAAC;EACrB;EACA,MAAMb,MAAM,GAAGP,CAAC,CAACqB,WAAW,CAAC,CAAC,CAAC;EAC/B,MAAMC,OAAO,GAAGf,MAAM,CAACgB,OAAO,CAAC,IAAI,CAAC;EACpC,OAAOD,OAAO,KAAKf,MAAM,CAACJ,MAAM,GAAG,CAAC,GAAGI,MAAM,CAACiB,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAGjB,MAAM;AACrE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-array.js","names":["isTypedArray","value","ArrayBuffer","isView","DataView","isNumberArray","Array","isArray","length"],"sources":["../../src/utils/is-array.ts"],"sourcesContent":["import {TypedArray, NumberArray} from '../types';\n\n/**\n * Check is an array is a typed array\n * @param value value to be tested\n * @returns input as TypedArray, or null\n * @todo this should be provided by @math.gl/types\n */\nexport function isTypedArray(value: unknown): TypedArray | null {\n return ArrayBuffer.isView(value) && !(value instanceof DataView) ? (value as TypedArray) : null;\n}\n\n/**\n * Check is an array is a numeric array (typed array or array of numbers)\n * @param value value to be tested\n * @returns input as NumberArray, or null\n * @todo this should be provided by @math.gl/types\n */\nexport function isNumberArray(value: unknown): NumberArray | null {\n if (Array.isArray(value)) {\n return value.length === 0 || typeof value[0] === 'number' ? (value as number[]) : null;\n }\n return isTypedArray(value);\n}\n"],"mappings":"AAQA,OAAO,SAASA,YAAYA,CAACC,KAAc,EAAqB;EAC9D,OAAOC,WAAW,CAACC,MAAM,CAACF,KAAK,CAAC,IAAI,EAAEA,KAAK,YAAYG,QAAQ,CAAC,GAAIH,KAAK,GAAkB,IAAI;AACjG;AAQA,OAAO,SAASI,aAAaA,CAACJ,KAAc,EAAsB;EAChE,IAAIK,KAAK,CAACC,OAAO,CAACN,KAAK,CAAC,EAAE;IACxB,OAAOA,KAAK,CAACO,MAAM,KAAK,CAAC,IAAI,OAAOP,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,GAAIA,KAAK,GAAgB,IAAI;EACxF;EACA,OAAOD,YAAY,CAACC,KAAK,CAAC;AAC5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-file.js","names":["pathPrefix","setPathPrefix","prefix","loadFile","url","options","startsWith","dataType","response","fetch","loadImageBitmap","opts","image","Image","crossOrigin","src","decode","createImageBitmap","loadImage","Promise","resolve","reject","onload","onerror","Error","error","loadScript","scriptUrl","scriptId","head","document","getElementsByTagName","script","createElement","setAttribute","id","appendChild"],"sources":["../../src/utils/load-file.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nlet pathPrefix = '';\n\n/**\n * Set a relative path prefix\n */\nexport function setPathPrefix(prefix: string) {\n pathPrefix = prefix;\n}\n\n/**\n * Reads raw file data. Respects setPathPrefix.\n */\nexport async function loadFile(\n url: string,\n options?: {dataType?: 'text' | 'arrayBuffer'} & RequestInit\n): Promise<any> {\n url = url.startsWith('http') ? url : pathPrefix + url;\n const dataType = options?.dataType || 'text';\n const response = await fetch(url, options);\n return await response[dataType]();\n}\n\n/**\n * Loads ImageBitmap asynchronously. Respects setPathPrefix.\n * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'\n * @returns a promise tracking the load\n */\nexport async function loadImageBitmap(\n url: string,\n opts?: {crossOrigin?: string}\n): Promise<ImageBitmap> {\n const image = new Image();\n image.crossOrigin = opts?.crossOrigin || 'anonymous';\n image.src = url.startsWith('http') ? url : pathPrefix + url;\n await image.decode();\n return await createImageBitmap(image);\n}\n\n/**\n * Loads image asynchronously. Respects setPathPrefix.\n * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'\n * @returns a promise tracking the load\n * @deprecated Use `loadImageBitmap()` unless you are supporting old versions of Safari.\n */\nexport async function loadImage(\n url: string,\n opts?: {crossOrigin?: string}\n): Promise<HTMLImageElement> {\n return new Promise((resolve, reject) => {\n try {\n const image = new Image();\n image.onload = () => resolve(image);\n image.onerror = () => reject(new Error(`Could not load image ${url}.`));\n image.crossOrigin = opts?.crossOrigin || 'anonymous';\n image.src = url.startsWith('http') ? url : pathPrefix + url;\n } catch (error) {\n reject(error);\n }\n });\n}\n\n/**\n * Load a script (identified by an url). When the url returns, the\n * content of this file is added into a new script element, attached to the DOM (body element)\n * @param scriptUrl defines the url of the script to laod\n * @param scriptId defines the id of the script element\n */\nexport async function loadScript(scriptUrl: string, scriptId?: string): Promise<Event> {\n const head = document.getElementsByTagName('head')[0];\n if (!head) {\n throw new Error('loadScript');\n }\n\n const script = document.createElement('script');\n script.setAttribute('type', 'text/javascript');\n script.setAttribute('src', scriptUrl);\n if (scriptId) {\n script.id = scriptId;\n }\n\n return new Promise((resolve, reject) => {\n script.onload = resolve;\n script.onerror = (error) => reject(new Error(`Unable to load script '${scriptUrl}': ${error as string}`));\n head.appendChild(script);\n });\n}\n"],"mappings":"AAGA,IAAIA,UAAU,GAAG,EAAE;AAKnB,OAAO,SAASC,aAAaA,CAACC,MAAc,EAAE;EAC5CF,UAAU,GAAGE,MAAM;AACrB;AAKA,OAAO,eAAeC,QAAQA,CAC5BC,GAAW,EACXC,OAA2D,EAC7C;EACdD,GAAG,GAAGA,GAAG,CAACE,UAAU,CAAC,MAAM,CAAC,GAAGF,GAAG,GAAGJ,UAAU,GAAGI,GAAG;EACrD,MAAMG,QAAQ,GAAG,CAAAF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,QAAQ,KAAI,MAAM;EAC5C,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAACL,GAAG,EAAEC,OAAO,CAAC;EAC1C,OAAO,MAAMG,QAAQ,CAACD,QAAQ,CAAC,CAAC,CAAC;AACnC;AAOA,OAAO,eAA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IACT,MAAM,IAAIL,KAAK,CAAC,YAAY,CAAC;EAC/B;EAEA,MAAMQ,MAAM,GAAGF,QAAQ,CAACG,aAAa,CAAC,QAAQ,CAAC;EAC/CD,MAAM,CAACE,YAAY,CAAC,MAAM,EAAE,iBAAiB,CAAC;EAC9CF,MAAM,CAACE,YAAY,CAAC,KAAK,EAAEP,SAAS,CAAC;EACrC,IAAIC,QAAQ,EAAE;IACZI,MAAM,CAACG,EAAE,GAAGP,QAAQ;EACtB;EAEA,OAAO,IAAIT,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtCW,MAAM,CAACV,MAAM,GAAGF,OAAO;IACvBY,MAAM,CAACT,OAAO,GAAIE,KAAK,IAAKJ,MAAM,CAAC,IAAIG,KAAK,CAAE,0BAAyBG,SAAU,MAAKF,KAAgB,EAAC,CAAC,CAAC;IACzGI,IAAI,CAACO,WAAW,CAACJ,MAAM,CAAC;EAC1B,CAAC,CAAC;AACJ"}
|
package/dist/utils/log.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","names":["Log","log","id"],"sources":["../../src/utils/log.ts"],"sourcesContent":["import {Log} from '@probe.gl/log';\n\n/** Global log instance */\nexport const log: Log = new Log({id: 'luma.gl'});\n"],"mappings":"AAAA,SAAQA,GAAG,QAAO,eAAe;AAGjC,OAAO,MAAMC,GAAQ,GAAG,IAAID,GAAG,CAAC;EAACE,EAAE,EAAE;AAAS,CAAC,CAAC"}
|
package/dist/utils/random.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"random.js","names":["makeRandomNumberGenerator","s","c","Math","sin","cos","fract","abs","n","floor","random"],"sources":["../../src/utils/random.ts"],"sourcesContent":["/** Creates a deterministic pseudorandom number generator */\nexport function makeRandomNumberGenerator(): () => number {\n let s = 1;\n let c = 1;\n return () => {\n s = Math.sin(c * 17.23);\n c = Math.cos(s * 27.92);\n return fract(Math.abs(s * c) * 1432.71);\n };\n}\n\nfunction fract(n: number): number {\n return n - Math.floor(n);\n}\n\n/** Generates a deterministic pseudorandom number */\nexport const random = makeRandomNumberGenerator();\n"],"mappings":"AACA,OAAO,SAASA,yBAAyBA,CAAA,EAAiB;EACxD,IAAIC,CAAC,GAAG,CAAC;EACT,IAAIC,CAAC,GAAG,CAAC;EACT,OAAO,MAAM;IACXD,CAAC,GAAGE,IAAI,CAACC,GAAG,CAACF,CAAC,GAAG,KAAK,CAAC;IACvBA,CAAC,GAAGC,IAAI,CAACE,GAAG,CAACJ,CAAC,GAAG,KAAK,CAAC;IACvB,OAAOK,KAAK,CAACH,IAAI,CAACI,GAAG,CAACN,CAAC,GAAGC,CAAC,CAAC,GAAG,OAAO,CAAC;EACzC,CAAC;AACH;AAEA,SAASI,KAAKA,CAACE,CAAS,EAAU;EAChC,OAAOA,CAAC,GAAGL,IAAI,CAACM,KAAK,CAACD,CAAC,CAAC;AAC1B;AAGA,OAAO,MAAME,MAAM,GAAGV,yBAAyB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-animation-frame.js","names":["requestAnimationFrame","callback","window","setTimeout","cancelAnimationFrame","timerId","clearTimeout"],"sources":["../../src/utils/request-animation-frame.ts"],"sourcesContent":["// Node.js polyfills for requestAnimationFrame and cancelAnimationFrame\n/* global window, setTimeout, clearTimeout */\n\n// / <reference types=\"@types/node\" />\nexport function requestAnimationFrame(callback: (time?: any) => void): any {\n return typeof window !== 'undefined' && window.requestAnimationFrame\n ? window.requestAnimationFrame(callback)\n : setTimeout(callback, 1000 / 60);\n}\n\nexport function cancelAnimationFrame(timerId: any): void {\n return typeof window !== 'undefined' && window.cancelAnimationFrame\n ? window.cancelAnimationFrame(timerId)\n : clearTimeout(timerId);\n}\n"],"mappings":"AAIA,OAAO,SAASA,qBAAqBA,CAACC,QAA8B,EAAO;EACzE,OAAO,OAAOC,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACF,qBAAqB,GAChEE,MAAM,CAACF,qBAAqB,CAACC,QAAQ,CAAC,GACtCE,UAAU,CAACF,QAAQ,EAAE,IAAI,GAAG,EAAE,CAAC;AACrC;AAEA,OAAO,SAASG,oBAAoBA,CAACC,OAAY,EAAQ;EACvD,OAAO,OAAOH,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACE,oBAAoB,GAC/DF,MAAM,CAACE,oBAAoB,CAACC,OAAO,CAAC,GACpCC,YAAY,CAACD,OAAO,CAAC;AAC3B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats-manager.js","names":["Stats","StatsManager","constructor","stats","Map","getStats","name","get","has","set","id","lumaStats"],"sources":["../../src/utils/stats-manager.ts"],"sourcesContent":["import {Stats} from '@probe.gl/stats';\n\n/** \n * Helper class managing a collection of probe.gl stats objects \n */\nexport class StatsManager {\n stats = new Map();\n\n getStats(name: string): Stats {\n return this.get(name);\n }\n\n get(name: string): Stats {\n if (!this.stats.has(name)) {\n this.stats.set(name, new Stats({id: name}));\n }\n\n return this.stats.get(name);\n }\n}\n\n/** Global stats for all luma.gl devices */\nexport const lumaStats: StatsManager = new StatsManager();\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,iBAAiB;AAKrC,OAAO,MAAMC,YAAY,CAAC;EAAAC,YAAA;IAAA,KACxBC,KAAK,GAAG,IAAIC,GAAG,CAAC,CAAC;EAAA;EAEjBC,QAAQA,CAACC,IAAY,EAAS;IAC5B,OAAO,IAAI,CAACC,GAAG,CAACD,IAAI,CAAC;EACvB;EAEAC,GAAGA,CAACD,IAAY,EAAS;IACvB,IAAI,CAAC,IAAI,CAACH,KAAK,CAACK,GAAG,CAACF,IAAI,CAAC,EAAE;MACzB,IAAI,CAACH,KAAK,CAACM,GAAG,CAACH,IAAI,EAAE,IAAIN,KAAK,CAAC;QAACU,EAAE,EAAEJ;MAAI,CAAC,CAAC,CAAC;IAC7C;IAEA,OAAO,IAAI,CAACH,KAAK,CAACI,GAAG,CAACD,IAAI,CAAC;EAC7B;AACF;AAGA,OAAO,MAAMK,SAAuB,GAAG,IAAIV,YAAY,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stub-methods.js","names":["log","stubRemovedMethods","instance","className","version","methodNames","upgradeMessage","prototype","Object","getPrototypeOf","forEach","methodName","removed","Error"],"sources":["../../src/utils/stub-methods.ts"],"sourcesContent":["import {log} from './log';\n\n// Install stubs for removed methods\nexport function stubRemovedMethods(instance: any, className: string, version: string, methodNames: string[]) {\n const upgradeMessage = `See luma.gl ${version} Upgrade Guide at \\\nhttps://luma.gl/docs/upgrade-guide`;\n\n const prototype = Object.getPrototypeOf(instance);\n\n methodNames.forEach((methodName: string): void => {\n if (prototype.methodName) {\n return;\n }\n\n prototype[methodName] = () => {\n log.removed(`Calling removed method ${className}.${methodName}: `, upgradeMessage)();\n throw new Error(methodName);\n };\n });\n}\n"],"mappings":"SAAQA,GAAG;AAGX,OAAO,SAASC,kBAAkBA,CAACC,QAAa,EAAEC,SAAiB,EAAEC,OAAe,EAAEC,WAAqB,EAAE;EAC3G,MAAMC,cAAc,GAAI,eAAcF,OAAQ;AAChD,mCAAmC;EAEjC,MAAMG,SAAS,GAAGC,MAAM,CAACC,cAAc,CAACP,QAAQ,CAAC;EAEjDG,WAAW,CAACK,OAAO,CAAEC,UAAkB,IAAW;IAChD,IAAIJ,SAAS,CAACI,UAAU,EAAE;MACxB;IACF;IAEAJ,SAAS,CAACI,UAAU,CAAC,GAAG,MAAM;MAC5BX,GAAG,CAACY,OAAO,CAAE,0BAAyBT,SAAU,IAAGQ,UAAW,IAAG,EAAEL,cAAc,CAAC,CAAC,CAAC;MACpF,MAAM,IAAIO,KAAK,CAACF,UAAU,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;AACJ"}
|
package/dist/utils/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["uidCounters","uid","id","arguments","length","undefined","count","isPowerOfTwo","n","isObjectEmpty","obj","isEmpty","key"],"sources":["../../src/utils/utils.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nconst uidCounters: Record<string, number> = {};\n\n/**\n * Returns a UID.\n * @param id= - Identifier base name\n * @return uid\n **/\nexport function uid(id: string = 'id'): string {\n uidCounters[id] = uidCounters[id] || 1;\n const count = uidCounters[id]++;\n return `${id}-${count}`;\n}\n\n/**\n * Verifies if a given number is power of two or not.\n * @param n - The number to check.\n * @return Returns true if the given number is power of 2, false otherwise.\n **/\nexport function isPowerOfTwo(n: number): boolean {\n return (n > 0) && (n & (n - 1)) === 0;\n}\n\n/** Returns true if given object is empty, false otherwise. */\nexport function isObjectEmpty(obj: object): boolean {\n let isEmpty = true;\n // @ts-ignore key is unused\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const key in obj) {\n isEmpty = false;\n break;\n }\n return isEmpty;\n}\n"],"mappings":"AAGA,MAAMA,WAAmC,GAAG,CAAC,CAAC;AAO9C,OAAO,SAASC,GAAGA,CAAA,EAA4B;EAAA,IAA3BC,EAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EACnCH,WAAW,CAACE,EAAE,CAAC,GAAGF,WAAW,CAACE,EAAE,CAAC,IAAI,CAAC;EACtC,MAAMI,KAAK,GAAGN,WAAW,CAACE,EAAE,CAAC,EAAE;EAC/B,OAAQ,GAAEA,EAAG,IAAGI,KAAM,EAAC;AACzB;AAOA,OAAO,SAASC,YAAYA,CAACC,CAAS,EAAW;EAC/C,OAAQA,CAAC,GAAG,CAAC,IAAK,CAACA,CAAC,GAAIA,CAAC,GAAG,CAAE,MAAM,CAAC;AACvC;AAGA,OAAO,SAASC,aAAaA,CAACC,GAAW,EAAW;EAClD,IAAIC,OAAO,GAAG,IAAI;EAGlB,KAAK,MAAMC,GAAG,IAAIF,GAAG,EAAE;IACrBC,OAAO,GAAG,KAAK;IACf;EACF;EACA,OAAOA,OAAO;AAChB"}
|