@luma.gl/core 9.0.0-beta.4 → 9.0.0-beta.5
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.js +140 -109
- package/dist/adapter/canvas-context.js +305 -233
- package/dist/adapter/device.d.ts +9 -11
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +114 -95
- package/dist/adapter/resources/buffer.d.ts +1 -1
- package/dist/adapter/resources/buffer.d.ts.map +1 -1
- package/dist/adapter/resources/buffer.js +65 -57
- package/dist/adapter/resources/command-buffer.js +13 -13
- package/dist/adapter/resources/command-encoder.js +17 -17
- package/dist/adapter/resources/compute-pass.js +10 -13
- package/dist/adapter/resources/compute-pipeline.js +19 -18
- package/dist/adapter/resources/external-texture.js +10 -15
- package/dist/adapter/resources/framebuffer.js +155 -94
- package/dist/adapter/resources/render-pass.js +28 -21
- package/dist/adapter/resources/render-pipeline.d.ts +3 -1
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.js +37 -34
- package/dist/adapter/resources/resource.js +131 -93
- package/dist/adapter/resources/sampler.js +24 -24
- package/dist/adapter/resources/shader.d.ts +2 -2
- package/dist/adapter/resources/shader.d.ts.map +1 -1
- package/dist/adapter/resources/shader.js +90 -78
- package/dist/adapter/resources/texture.js +49 -43
- package/dist/adapter/resources/transform-feedback.d.ts +2 -2
- package/dist/adapter/resources/transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/transform-feedback.js +13 -15
- package/dist/adapter/resources/vertex-array.js +30 -22
- package/dist/adapter/type-utils/decode-attribute-type.js +56 -52
- package/dist/adapter/type-utils/decode-data-type.js +36 -35
- package/dist/adapter/type-utils/decode-shader-types.js +36 -97
- package/dist/adapter/type-utils/decode-texture-format.js +160 -93
- package/dist/adapter/type-utils/decode-vertex-format.js +28 -23
- package/dist/adapter/type-utils/vertex-format-from-attribute.js +69 -65
- package/dist/adapter/type-utils/wgsl-utils.js +14 -13
- package/dist/adapter/types/accessor.js +0 -1
- package/dist/adapter/types/buffer-layout.js +0 -1
- package/dist/adapter/types/parameters.js +31 -26
- package/dist/adapter/types/shader-layout.js +0 -1
- package/dist/adapter/types/shader-types.js +2 -1
- package/dist/adapter/types/texture-formats.d.ts +1 -1
- package/dist/adapter/types/texture-formats.d.ts.map +1 -1
- package/dist/adapter/types/texture-formats.js +2 -1
- package/dist/adapter/types/types.js +0 -1
- package/dist/adapter/types/vertex-formats.js +2 -1
- package/dist/dist.dev.js +453 -270
- package/dist/index.cjs +66 -168
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -46
- package/dist/init.js +29 -19
- package/dist/lib/compiler-log/compiler-message.js +2 -1
- package/dist/lib/compiler-log/format-compiler-log.js +66 -48
- package/dist/lib/compiler-log/get-shader-info.js +22 -19
- package/dist/lib/luma.d.ts.map +1 -1
- package/dist/lib/luma.js +60 -55
- package/dist/lib/uniforms/uniform-block.d.ts +0 -1
- package/dist/lib/uniforms/uniform-block.d.ts.map +1 -1
- package/dist/lib/uniforms/uniform-block.js +50 -43
- package/dist/lib/uniforms/uniform-buffer-layout.js +87 -70
- package/dist/lib/uniforms/uniform-store.js +112 -79
- package/dist/lib/uniforms/uniform.js +13 -16
- package/dist/types.js +1 -3
- package/dist/utils/array-equal.js +25 -23
- package/dist/utils/array-utils-flat.js +28 -28
- package/dist/utils/assert.js +5 -4
- package/dist/utils/cast.js +2 -2
- package/dist/utils/check-props.js +28 -27
- package/dist/utils/deep-equal.js +39 -32
- package/dist/utils/format-value.js +33 -39
- package/dist/utils/is-array.js +17 -6
- package/dist/utils/load-file.js +62 -37
- package/dist/utils/log.js +2 -4
- package/dist/utils/random.js +10 -9
- package/dist/utils/request-animation-frame.js +9 -3
- package/dist/utils/stats-manager.js +13 -14
- package/dist/utils/stub-methods.js +13 -13
- package/dist/utils/utils.d.ts +0 -6
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +20 -15
- package/dist.min.js +8 -23
- package/package.json +6 -6
- package/src/adapter/device.ts +38 -59
- package/src/adapter/resources/buffer.ts +1 -1
- package/src/adapter/resources/render-pipeline.ts +3 -1
- package/src/adapter/resources/shader.ts +2 -2
- package/src/adapter/resources/transform-feedback.ts +2 -2
- package/src/adapter/types/texture-formats.ts +1 -1
- package/src/index.ts +1 -1
- package/src/lib/luma.ts +0 -2
- package/src/lib/uniforms/uniform-block.ts +0 -1
- package/src/utils/utils.ts +0 -9
- 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":"render-pipeline.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","RenderPipeline","constructor","device","props","defaultProps","hash","vs","fs","shaderLayout","bufferLayout","vsEntryPoint","vsConstants","fsEntryPoint","fsConstants","topology","parameters","vertexCount","instanceCount","bindings","uniforms"],"sources":["../../../src/adapter/resources/render-pipeline.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Device} from '../device';\nimport type {UniformValue} from '../types/types';\nimport type {PrimitiveTopology, RenderPipelineParameters} from '../types/parameters';\nimport type {ShaderLayout, Binding} from '../types/shader-layout';\nimport type {BufferLayout} from '../types/buffer-layout';\n// import {normalizeAttributeMap} from '../helpers/attribute-bindings';\nimport {Resource, ResourceProps} from './resource';\nimport type {Shader} from './shader';\nimport type {RenderPass} from './render-pass';\nimport {VertexArray} from './vertex-array';\nimport {TransformFeedback} from './transform-feedback';\n\nexport type RenderPipelineProps = ResourceProps & {\n // Shaders and shader layout\n\n /** Compiled vertex shader */\n vs?: Shader | null;\n /** Vertex shader entry point (defaults to 'main'). WGSL only */\n vsEntryPoint?: string; //\n /** Constants to apply to compiled vertex shader (WGSL only) */\n vsConstants?: Record<string, number>; // WGSL only\n /** Compiled fragment shader */\n fs?: Shader | null;\n /** Fragment shader entry point (defaults to 'main'). WGSL only */\n fsEntryPoint?: string; // WGSL only\n /** Constants to apply to compiled fragment shader (WGSL only) */\n fsConstants?: Record<string, number>;\n\n /** Describes the attributes and bindings exposed by the pipeline shader(s). */\n shaderLayout?: ShaderLayout | null;\n /**\n * Describes the buffers accepted by this pipeline and how they are mapped to shader attributes.\n * A default mapping of one buffer per attribute is always created.\n */\n bufferLayout?: BufferLayout[]; // Record<string, Omit<BufferLayout, 'name'>\n\n /** Determines how vertices are read from the 'vertex' attributes */\n topology?: PrimitiveTopology;\n /** Parameters that are controlled by pipeline */\n parameters?: RenderPipelineParameters;\n\n // Can be changed after creation\n // TODO make pipeline immutable? these could be supplied to draw as parameters, in WebGPU they are set on the render pass\n\n /** Number of vertices */\n vertexCount?: number;\n /** Number of instances */\n instanceCount?: number;\n\n /** Buffers, Textures, Samplers for the shader bindings */\n bindings?: Record<string, Binding>;\n /** @deprecated uniforms (WebGL only) */\n uniforms?: Record<string, UniformValue>;\n};\n\n/**\n * A compiled and linked shader program\n */\nexport abstract class RenderPipeline extends Resource<RenderPipelineProps> {\n static override defaultProps: Required<RenderPipelineProps> = {\n ...Resource.defaultProps,\n\n vs: null,\n vsEntryPoint: '', // main\n vsConstants: {},\n\n fs: null,\n fsEntryPoint: '', // main\n fsConstants: {},\n\n shaderLayout: null,\n bufferLayout: [],\n topology: 'triangle-list',\n parameters: {},\n\n vertexCount: 0,\n instanceCount: 0,\n\n bindings: {},\n uniforms: {}\n };\n\n override get [Symbol.toStringTag](): string {\n return 'RenderPipeline';\n }\n\n hash: string = '';\n abstract readonly vs: Shader;\n abstract readonly fs: Shader | null;\n /** The merged layout */\n shaderLayout: ShaderLayout;\n /** Buffer map describing buffer interleaving etc */\n readonly bufferLayout: BufferLayout[];\n\n constructor(device: Device, props: RenderPipelineProps) {\n super(device, props, RenderPipeline.defaultProps);\n this.shaderLayout = this.props.shaderLayout;\n this.bufferLayout = this.props.bufferLayout || [];\n }\n\n /** Set bindings (stored on pipeline and set before each call) */\n abstract setBindings(bindings: Record<string, Binding>): void;\n /** Uniforms\n * @deprecated Only supported on WebGL devices.\n * @note textures, samplers and uniform buffers should be set via `setBindings()`, these are not considered uniforms.\n * @note In WebGL uniforms have a performance penalty, they are reset before each call to enable pipeline sharing.\n */\n abstract setUniforms(bindings: Record<string, UniformValue>): void;\n\n /** Draw call */\n abstract draw(options: {\n /** Render pass to draw into (targeting screen or framebuffer) */\n renderPass?: RenderPass;\n /** vertex attributes */\n vertexArray: VertexArray;\n /** Number of \"rows\" in index buffer */\n indexCount?: number;\n /** Number of \"rows\" in 'vertex' buffers */\n vertexCount?: number;\n /** Number of \"rows\" in 'instance' buffers */\n instanceCount?: number;\n /** First vertex to draw from */\n firstVertex?: number;\n /** First index to draw from */\n firstIndex?: number;\n /** First instance to draw from */\n firstInstance?: number;\n baseVertex?: number;\n /** Transform feedback. WebGL 2 only. */\n transformFeedback?: TransformFeedback;\n }): void;\n}\n"],"mappings":";SAOQA,QAAQ;AAAAC,mBAAA,GA4EAC,MAAM,CAACC,WAAW;AAxBlC,OAAO,MAAeC,cAAc,SAASJ,QAAQ,CAAsB;EAwBzE,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,gBAAgB;EACzB;EAUAI,WAAWA,CAACC,MAAc,EAAEC,KAA0B,EAAE;IACtD,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,cAAc,CAACI,YAAY,CAAC;IAAC,KATpDC,IAAI,GAAW,EAAE;IAAA,KACCC,EAAE;IAAA,KACFC,EAAE;IAAA,KAEpBC,YAAY;IAAA,KAEHC,YAAY;IAInB,IAAI,CAACD,YAAY,GAAG,IAAI,CAACL,KAAK,CAACK,YAAY;IAC3C,IAAI,CAACC,YAAY,GAAG,IAAI,CAACN,KAAK,CAACM,YAAY,IAAI,EAAE;EACnD;AAiCF;AAzEsBT,cAAc,CAClBI,YAAY,GAAkC;EAC5D,GAAGR,QAAQ,CAACQ,YAAY;EAExBE,EAAE,EAAE,IAAI;EACRI,YAAY,EAAE,EAAE;EAChBC,WAAW,EAAE,CAAC,CAAC;EAEfJ,EAAE,EAAE,IAAI;EACRK,YAAY,EAAE,EAAE;EAChBC,WAAW,EAAE,CAAC,CAAC;EAEfL,YAAY,EAAE,IAAI;EAClBC,YAAY,EAAE,EAAE;EAChBK,QAAQ,EAAE,eAAe;EACzBC,UAAU,EAAE,CAAC,CAAC;EAEdC,WAAW,EAAE,CAAC;EACdC,aAAa,EAAE,CAAC;EAEhBC,QAAQ,EAAE,CAAC,CAAC;EACZC,QAAQ,EAAE,CAAC;AACb,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.js","names":["uid","Resource","constructor","device","props","defaultProps","id","userData","_device","destroyed","allocatedBytes","_attachedResources","Set","Error","selectivelyMerge","Symbol","toStringTag","addStats","destroy","destroyResource","delete","toString","name","getProps","attachResource","resource","add","detachResource","destroyAttachedResource","destroyAttachedResources","Object","values","removeStats","stats","statsManager","getStats","get","decrementCount","trackAllocatedMemory","bytes","arguments","length","undefined","addCount","trackDeallocatedMemory","subtractCount","incrementCount","handle","mergedProps","key"],"sources":["../../../src/adapter/resources/resource.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Device} from '../device';\nimport {uid} from '../../utils/utils';\n\nexport type ResourceProps = {\n /** Name of resource, mainly for debugging purposes. A unique name will be assigned if not provided */\n id?: string;\n /** Handle for the underlying resources (WebGL object or WebGPU handle) */\n handle?: any;\n /** User provided data stored on this resource */\n userData?: {[key: string]: any};\n}\n\n/**\n * Base class for GPU (WebGPU/WebGL) Resources\n */\nexport abstract class Resource<Props extends ResourceProps> {\n /** Default properties for resource */\n static defaultProps: Required<ResourceProps> = {\n id: 'undefined',\n handle: undefined,\n userData: undefined,\n };\n \n abstract get [Symbol.toStringTag](): string;\n\n /** props.id, for debugging. */\n id: string;\n readonly props: Required<Props>;\n readonly userData: Record<string, unknown> = {};\n abstract readonly device: Device;\n private _device: Device;\n\n /** Whether this resource has been destroyed */\n destroyed: boolean = false;\n /** For resources that allocate GPU memory */\n private allocatedBytes: number = 0;\n /** Attached resources will be destroyed when this resource is destroyed. Tracks auto-created \"sub\" resources. */\n private _attachedResources = new Set<Resource<unknown>>();\n\n\n /**\n * Create a new Resource. Called from Subclass\n */\n constructor(device: Device, props: Props, defaultProps: Required<Props>) {\n if (!device) {\n throw new Error('no device');\n }\n this._device = device;\n this.props = selectivelyMerge<Props>(props, defaultProps);\n\n const id = this.props.id !== 'undefined' ? this.props.id as string : uid(this[Symbol.toStringTag]);\n this.props.id = id;\n this.id = id;\n this.userData = this.props.userData || {};\n\n this.addStats();\n }\n\n /**\n * destroy can be called on any resource to release it before it is garbage collected.\n */\n destroy(): void {\n this.destroyResource();\n }\n\n /** @deprecated Use destroy() */\n delete(): this {\n this.destroy();\n return this;\n }\n\n toString(): string {\n return `${this[Symbol.toStringTag] || this.constructor.name}(${this.id})`;\n }\n\n /**\n * Combines a map of user props and default props, only including props from defaultProps\n * @returns returns a map of overridden default props\n */\n getProps(): object {\n return this.props;\n }\n\n // ATTACHED RESOURCES\n\n /** \n * Attaches a resource. Attached resources are auto destroyed when this resource is destroyed\n * Called automatically when sub resources are auto created but can be called by application\n */\n attachResource(resource: Resource<unknown>): void {\n this._attachedResources.add(resource);\n }\n\n /** \n * Detach an attached resource. The resource will no longer be auto-destroyed when this resource is destroyed.\n */\n detachResource(resource: Resource<unknown>): void {\n this._attachedResources.delete(resource);\n }\n \n /** \n * Destroys a resource (only if owned), and removes from the owned (auto-destroy) list for this resource.\n */\n destroyAttachedResource(resource: Resource<unknown>): void {\n if (this._attachedResources.delete(resource)) {\n resource.destroy();\n }\n }\n\n /** Destroy all owned resources. Make sure the resources are no longer needed before calling. */\n destroyAttachedResources(): void {\n for (const resource of Object.values(this._attachedResources)) {\n resource.destroy();\n }\n // don't remove while we are iterating\n this._attachedResources = new Set<Resource<unknown>>();\n }\n\n // PROTECTED METHODS\n\n /** Perform all destroy steps. Can be called by derived resources when overriding destroy() */\n protected destroyResource(): void {\n this.destroyAttachedResources();\n this.removeStats();\n this.destroyed = true;\n }\n\n /** Called by .destroy() to track object destruction. Subclass must call if overriding destroy() */\n protected removeStats(): void {\n const stats = this._device.statsManager.getStats('Resource Counts');\n const name = this[Symbol.toStringTag];\n stats.get(`${name}s Active`).decrementCount();\n }\n\n /** Called by subclass to track memory allocations */\n protected trackAllocatedMemory(bytes: number, name = this[Symbol.toStringTag]): void {\n const stats = this._device.statsManager.getStats('Resource Counts');\n stats.get('GPU Memory').addCount(bytes);\n stats.get(`${name} Memory`).addCount(bytes);\n this.allocatedBytes = bytes;\n }\n\n /** Called by subclass to track memory deallocations */\n protected trackDeallocatedMemory(name = this[Symbol.toStringTag]): void {\n const stats = this._device.statsManager.getStats('Resource Counts');\n stats.get('GPU Memory').subtractCount(this.allocatedBytes);\n stats.get(`${name} Memory`).subtractCount(this.allocatedBytes);\n this.allocatedBytes = 0;\n }\n\n /** Called by resource constructor to track object creation */\n private addStats(): void {\n const stats = this._device.statsManager.getStats('Resource Counts');\n const name = this[Symbol.toStringTag];\n stats.get('Resources Created').incrementCount();\n stats.get(`${name}s Created`).incrementCount();\n stats.get(`${name}s Active`).incrementCount();\n }\n}\n\n/**\n * Combines a map of user props and default props, only including props from defaultProps\n * @param props\n * @param defaultProps\n * @returns returns a map of overridden default props\n */\nfunction selectivelyMerge<Props>(props: Props, defaultProps: Required<Props>): Required<Props> {\n const mergedProps = {...defaultProps};\n for (const key in props) {\n if (props[key] !== undefined) {\n mergedProps[key] = props[key];\n }\n }\n return mergedProps;\n}\n"],"mappings":"SAEQA,GAAG;AAcX,OAAO,MAAeC,QAAQ,CAA8B;EA4B1DC,WAAWA,CAACC,MAAc,EAAEC,KAAY,EAAEC,YAA6B,EAAE;IAAA,KAjBzEC,EAAE;IAAA,KACOF,KAAK;IAAA,KACLG,QAAQ,GAA4B,CAAC,CAAC;IAAA,KAC7BJ,MAAM;IAAA,KAChBK,OAAO;IAAA,KAGfC,SAAS,GAAY,KAAK;IAAA,KAElBC,cAAc,GAAW,CAAC;IAAA,KAE1BC,kBAAkB,GAAG,IAAIC,GAAG,CAAoB,CAAC;IAOvD,IAAI,CAACT,MAAM,EAAE;MACX,MAAM,IAAIU,KAAK,CAAC,WAAW,CAAC;IAC9B;IACA,IAAI,CAACL,OAAO,GAAGL,MAAM;IACrB,IAAI,CAACC,KAAK,GAAGU,gBAAgB,CAAQV,KAAK,EAAEC,YAAY,CAAC;IAEzD,MAAMC,EAAE,GAAG,IAAI,CAACF,KAAK,CAACE,EAAE,KAAK,WAAW,GAAG,IAAI,CAACF,KAAK,CAACE,EAAE,GAAaN,GAAG,CAAC,IAAI,CAACe,MAAM,CAACC,WAAW,CAAC,CAAC;IAClG,IAAI,CAACZ,KAAK,CAACE,EAAE,GAAGA,EAAE;IAClB,IAAI,CAACA,EAAE,GAAGA,EAAE;IACZ,IAAI,CAACC,QAAQ,GAAG,IAAI,CAACH,KAAK,CAACG,QAAQ,IAAI,CAAC,CAAC;IAEzC,IAAI,CAACU,QAAQ,CAAC,CAA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AAC,iBAAiB,CAAC;IACnE,MAAMb,IAAI,GAAG,IAAI,CAACP,MAAM,CAACC,WAAW,CAAC;IACrCiB,KAAK,CAACG,GAAG,CAAC,mBAAmB,CAAC,CAACU,cAAc,CAAC,CAAC;IAC/Cb,KAAK,CAACG,GAAG,CAAE,GAAEd,IAAK,WAAU,CAAC,CAACwB,cAAc,CAAC,CAAC;IAC9Cb,KAAK,CAACG,GAAG,CAAE,GAAEd,IAAK,UAAS,CAAC,CAACwB,cAAc,CAAC,CAAC;EAC/C;AACF;AA/IsB7C,QAAQ,CAErBI,YAAY,GAA4B;EAC7CC,EAAE,EAAE,WAAW;EACfyC,MAAM,EAAEL,SAAS;EACjBnC,QAAQ,EAAEmC;AACZ,CAAC;AAiJH,SAAS5B,gBAAgBA,CAAQV,KAAY,EAAEC,YAA6B,EAAmB;EAC7F,MAAM2C,WAAW,GAAG;IAAC,GAAG3C;EAAY,CAAC;EACrC,KAAK,MAAM4C,GAAG,IAAI7C,KAAK,EAAE;IACvB,IAAIA,KAAK,CAAC6C,GAAG,CAAC,KAAKP,SAAS,EAAE;MAC5BM,WAAW,CAACC,GAAG,CAAC,GAAG7C,KAAK,CAAC6C,GAAG,CAAC;IAC/B;EACF;EACA,OAAOD,WAAW;AACpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sampler.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","Sampler","constructor","device","props","defaultProps","type","addressModeU","addressModeV","addressModeW","magFilter","minFilter","mipmapFilter","lodMinClamp","lodMaxClamp","compare","maxAnisotropy"],"sources":["../../../src/adapter/resources/sampler.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Device} from '../device';\nimport {CompareFunction} from '../types/parameters';\nimport {Resource, ResourceProps} from './resource';\n\n/** Edge values sampling mode */\nexport type SamplerAddressMode = 'clamp-to-edge' | 'repeat' | 'mirror-repeat';\n\n/** Sampler filtering mode */\nexport type SamplerFilterMode = 'nearest' | 'linear';\n\n/**\n * Properties for initializing a sampler\n */\nexport type SamplerProps = ResourceProps & {\n /** Comparison / shadow samplers are used with depth textures. See the `Sampler.compare` field */\n type?: 'color-sampler' | 'comparison-sampler';\n /** Edge value sampling in X direction */\n addressModeU?: 'clamp-to-edge' | 'repeat' | 'mirror-repeat';\n /** Edge value sampling in Y direction */\n addressModeV?: 'clamp-to-edge' | 'repeat' | 'mirror-repeat';\n /** Edge value sampling in Z direction */\n addressModeW?: 'clamp-to-edge' | 'repeat' | 'mirror-repeat';\n\n /** Magnification: the area of the fragment in texture space is smaller than a texel */\n magFilter?: 'nearest' | 'linear';\n /** Minification: the area of the fragment in texture space is larger than a texel */\n minFilter?: 'nearest' | 'linear';\n /** mipmapping: select between multiple mipmaps based on angle and size of the texture relative to the screen. */\n mipmapFilter?: 'nearest' | 'linear';\n /** Affects the mipmap image selection */\n lodMinClamp?: number;\n /** Affects the mipmap image selection */\n lodMaxClamp?: number;\n /** Maximum number of samples that can be taken of the texture during any one texture fetch */\n maxAnisotropy?: number; \n /** How to compare reference values provided in shader shadow sampler calls with those pulled from the texture */\n compare?: CompareFunction;\n};\n\nexport type SamplerParameters = Omit<SamplerProps, keyof ResourceProps>;\n\n/** Immutable Sampler object */\nexport abstract class Sampler extends Resource<SamplerProps> {\n static override defaultProps: Required<SamplerProps> = {\n ...Resource.defaultProps,\n type: 'color-sampler',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge',\n addressModeW: 'clamp-to-edge',\n magFilter: 'nearest',\n minFilter: 'nearest',\n mipmapFilter: 'nearest',\n lodMinClamp: 0,\n lodMaxClamp: 32, // Per WebGPU spec\n compare: 'less-equal',\n maxAnisotropy: 1\n };\n \n override get [Symbol.toStringTag](): string {\n return 'Sampler';\n }\n\n constructor(device: Device, props: SamplerProps) {\n super(device, props, Sampler.defaultProps);\n }\n}\n"],"mappings":";SAKQA,QAAQ;AAAAC,mBAAA,GAwDAC,MAAM,CAACC,WAAW;AAhBlC,OAAO,MAAeC,OAAO,SAASJ,QAAQ,CAAe;EAgB3D,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,SAAS;EAClB;EAEAI,WAAWA,CAACC,MAAc,EAAEC,KAAmB,EAAE;IAC/C,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,OAAO,CAACI,YAAY,CAAC;EAC5C;AACF;AAvBsBJ,OAAO,CACXI,YAAY,GAA2B;EACrD,GAAGR,QAAQ,CAACQ,YAAY;EACxBC,IAAI,EAAE,eAAe;EACrBC,YAAY,EAAE,eAAe;EAC7BC,YAAY,EAAE,eAAe;EAC7BC,YAAY,EAAE,eAAe;EAC7BC,SAAS,EAAE,SAAS;EACpBC,SAAS,EAAE,SAAS;EACpBC,YAAY,EAAE,SAAS;EACvBC,WAAW,EAAE,CAAC;EACdC,WAAW,EAAE,EAAE;EACfC,OAAO,EAAE,YAAY;EACrBC,aAAa,EAAE;AACjB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shader.js","names":["Resource","uid","formatCompilerLog","getShaderInfo","_Symbol$toStringTag","Symbol","toStringTag","Shader","constructor","device","props","id","getShaderIdFromProps","defaultProps","stage","source","compilationStatus","getCompilationInfoSync","debugShader","debug","messages","getCompilationInfo","length","_displayShaderLog","_document","_errors$","document","createElement","shaderName","name","shaderTitle","htmlLog","showSourceCode","html","button","innerHTML","style","top","left","position","zIndex","width","textAlign","body","appendChild","errors","getElementsByClassName","scrollIntoView","onclick","dataURI","encodeURIComponent","navigator","clipboard","writeText","language","sourceMap","entryPoint"],"sources":["../../../src/adapter/resources/shader.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\n// import { log } from '../../utils/log';\nimport {uid} from '../../utils/utils';\nimport {CompilerMessage} from '../../lib/compiler-log/compiler-message';\nimport {formatCompilerLog} from '../../lib/compiler-log/format-compiler-log';\nimport {getShaderInfo} from '../../lib/compiler-log/get-shader-info';\n\n/**\n * Properties for a Shader\n */\nexport type ShaderProps = ResourceProps & {\n /** Shader language (defaults to auto) */\n language?: 'glsl' | 'wgsl' | 'auto';\n /** Which stage are we compiling? Required by WebGL and GLSL transpiler */\n stage: 'vertex' | 'fragment' | 'compute';\n /** Shader source code */\n source: string;\n /** Optional shader source map (WebGPU only) */\n sourceMap?: string | null;\n /** Optional shader entry point (WebGPU only) */\n entryPoint?: string;\n /** Show shader source in browser? */\n debug?: 'never' | 'errors' | 'warnings' | 'always';\n};\n\n/**\n * Immutable Shader object\n * In WebGPU the handle can be copied between threads\n */\nexport abstract class Shader extends Resource<ShaderProps> {\n static override defaultProps: Required<ShaderProps> = {\n ...Resource.defaultProps,\n language: 'auto',\n stage: 'vertex',\n source: '',\n sourceMap: null,\n entryPoint: 'main',\n debug: 'errors'\n };\n\n override get [Symbol.toStringTag](): string {\n return 'Shader';\n }\n\n /** The stage of this shader */\n readonly stage: 'vertex' | 'fragment' | 'compute';\n /** The source code of this shader */\n readonly source: string;\n /** The compilation status of this shader. May be 'pending' if compilation is done asynchronously */\n compilationStatus: 'success' | 'error' | 'pending' = 'pending';\n\n /** Create a new Shader instance */\n constructor(device: Device, props: ShaderProps) {\n super(device, {id: getShaderIdFromProps(props), ...props}, Shader.defaultProps);\n this.stage = this.props.stage;\n this.source = this.props.source;\n }\n\n /** Get compiler log asynchronously */\n abstract getCompilationInfo(): Promise<readonly CompilerMessage[]>;\n\n /** Get compiler log synchronously (WebGL only) */\n getCompilationInfoSync(): readonly CompilerMessage[] | null {\n return null;\n }\n\n // PORTABLE HELPERS\n\n /** In browser logging of errors */\n async debugShader(): Promise<void> {\n switch (this.props.debug) {\n case 'never':\n return;\n case 'errors':\n // On WebGL - Don't extract the log unless errors\n if (this.compilationStatus === 'success') {\n return;\n }\n break;\n case 'warnings':\n case 'always':\n break;\n }\n\n const messages = await this.getCompilationInfo();\n if (this.props.debug === 'warnings' && messages?.length === 0) {\n return;\n }\n this._displayShaderLog(messages);\n }\n\n // PRIVATE\n\n /** In-browser UI logging of errors */\n protected _displayShaderLog(messages: readonly CompilerMessage[]): void {\n // Return if under Node.js / incomplete `document` polyfills\n if (typeof document === 'undefined' || !document?.createElement) {\n return;\n }\n\n const shaderName: string = getShaderInfo(this.source).name;\n const shaderTitle: string = `${this.stage} ${shaderName}`;\n const htmlLog = formatCompilerLog(messages, this.source, {showSourceCode: 'all', html: true});\n\n // Make it clickable so we can copy to clipboard\n const button = document.createElement('Button');\n button.innerHTML = `\n<h1>Shader Compilation Error in ${shaderTitle}</h1><br /><br />\n<code style=\"user-select:text;\"><pre>\n${htmlLog}\n</pre></code>`;\n button.style.top = '10px';\n button.style.left = '10px';\n button.style.position = 'absolute';\n button.style.zIndex = '9999';\n button.style.width = '100%';\n button.style.textAlign = 'left';\n document.body.appendChild(button);\n\n const errors = document.getElementsByClassName('luma-compiler-log-error');\n if (errors[0]?.scrollIntoView) {\n errors[0].scrollIntoView();\n }\n\n // TODO - add a small embedded copy button (instead of main button)\n button.onclick = () => {\n // const source = this.source.replaceAll('\\n', '<br />');\n const dataURI = `data:text/plain,${encodeURIComponent(this.source)}`;\n navigator.clipboard.writeText(dataURI);\n };\n\n // TODO - add a small embedded close button\n }\n}\n\n// HELPERS\n\n/** Deduce an id, from shader source, or supplied id, or shader type */\nfunction getShaderIdFromProps(props: ShaderProps): string {\n return getShaderInfo(props.source).name || props.id || uid(`unnamed ${props.stage}-shader`);\n}\n"],"mappings":";SAEQA,QAAQ;AAAA,SAERC,GAAG;AAAA,SAEHC,iBAAiB;AAAA,SACjBC,aAAa;AAAAC,mBAAA,GAmCLC,MAAM,CAACC,WAAW;AAXlC,OAAO,MAAeC,MAAM,SAASP,QAAQ,CAAc;EAWzD,KAAAI,mBAAA,IAA4C;IAC1C,OAAO,QAAQ;EACjB;EAUAI,WAAWA,CAACC,MAAc,EAAEC,KAAkB,EAAE;IAC9C,KAAK,CAACD,MAAM,EAAE;MAACE,EAAE,EAAEC,oBAAoB,CAACF,KA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,EAAE;AACT,CAAC;AAoGH,SAASP,oBAAoBA,CAACF,KAAkB,EAAU;EACxD,OAAOP,aAAa,CAACO,KAAK,CAACK,MAAM,CAAC,CAACc,IAAI,IAAInB,KAAK,CAACC,EAAE,IAAIV,GAAG,CAAE,WAAUS,KAAK,CAACI,KAAM,SAAQ,CAAC;AAC7F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"texture.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","Texture","constructor","device","props","defaultProps","arguments","length","undefined","dimension","format","width","height","depth","sampler","data","mipmaps","compressed","usage","mipLevels","samples","type","COPY_SRC","COPY_DST","TEXTURE_BINDING","STORAGE_BINDING","RENDER_ATTACHMENT"],"sources":["../../../src/adapter/resources/texture.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Device} from '../device';\nimport type {TypedArray} from '../../types';\nimport type {TextureFormat} from '../types/texture-formats';\nimport {Resource, ResourceProps} from './resource';\nimport {Sampler, SamplerProps} from './sampler';\n\n// required GPUExtent3D size;\n// GPUIntegerCoordinate mipLevelCount = 1;\n// GPUSize32 sampleCount = 1;\n// GPUTextureDimension dimension = \"2d\";\n// required GPUTextureFormat format;\n// required GPUTextureUsageFlags usage;\n\n/** Data types that can be used to initialize textures */\nexport type TextureData = \n TypedArray | ArrayBuffer | Buffer | ImageBitmap | HTMLImageElement\n ;\n\nexport type CubeTextureData = \n Record<string, TextureData> |\n Record<string, Promise<TextureData>>\n ;\n\nexport type ExternalTextureData = HTMLVideoElement;\n\n/** Abstract Texture interface */\nexport type TextureProps = ResourceProps & {\n format?: TextureFormat;\n dimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n width?: number | undefined;\n height?: number | undefined;\n depth?: number;\n usage?: number;\n\n data?: TextureData | Promise<TextureData> | CubeTextureData | string | HTMLVideoElement | null;\n mipmaps?: boolean;\n sampler?: Sampler | SamplerProps;\n\n mipLevels?: number;\n samples?: number;\n type?: number;\n compressed?: boolean;\n};\n\nexport type WebGPUTextureProps = ResourceProps & {\n width: number;\n height: number;\n depth?: number;\n mipLevels?: number;\n format?: string;\n};\n\nexport type TextureViewProps = {\n format: string;\n dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n arrayLayerCount: number;\n baseArrayLayer?: number;\n mipLevels?: number;\n baseMipLevel?: number;\n};\n\n/** \n * @deprecated\n * @todo remove, are these even used anymore?\n */\nexport type DeprecatedWebGLTextureProps = {\n /** @deprecated use props.sampler */\n parameters?: Record<number, number>;\n /** @deprecated use props.data */\n pixels?: any;\n /** @deprecated use props.format */\n dataFormat?: number | null;\n /** @deprecated rarely supported */\n border?: number;\n /** @deprecated WebGL only. */\n pixelStore?: object;\n /** @deprecated WebGL only. */\n textureUnit?: number;\n /** @deprecated WebGL only. Use dimension. */\n target?: number;\n};\n\n/**\n * Abstract Texture interface\n * Texture Object\n * https://gpuweb.github.io/gpuweb/#gputexture\n */\nexport abstract class Texture<Props extends TextureProps = TextureProps> extends Resource<Props> {\n static override defaultProps: Required<TextureProps> = {\n ...Resource.defaultProps,\n data: null,\n dimension: '2d',\n format: 'rgba8unorm',\n width: undefined!,\n height: undefined!,\n depth: 1,\n mipmaps: true,\n sampler: {},\n // type: undefined,\n compressed: false,\n // mipLevels: 1,\n usage: 0,\n // usage: GPUTextureUsage.COPY_DST\n mipLevels: undefined!,\n samples: undefined!,\n type: undefined!\n };\n \n static COPY_SRC = 0x01;\n static COPY_DST = 0x02;\n static TEXTURE_BINDING = 0x04;\n static STORAGE_BINDING = 0x08;\n static RENDER_ATTACHMENT = 0x10;\n\n override get [Symbol.toStringTag](): string { return 'Texture'; }\n\n /** dimension of this texture */\n readonly dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n /** format of this texture */\n readonly format: TextureFormat;\n /** width in pixels of this texture */\n width: number;\n /** height in pixels of this texture */\n height: number;\n /** depth of this texture */\n readonly depth: number;\n /** Default sampler for this texture */\n abstract sampler: Sampler;\n\n constructor(device: Device, props: Props, defaultProps = Texture.defaultProps as Required<Props>) {\n super(device, props, defaultProps);\n this.dimension = this.props.dimension;\n this.format = this.props.format ;\n this.width = this.props.width;\n this.height = this.props.height;\n this.depth = this.props.depth;\n }\n}\n"],"mappings":";SAIQA,QAAQ;AAAAC,mBAAA,GAgHAC,MAAM,CAACC,WAAW;AA3BlC,OAAO,MAAeC,OAAO,SAAoDJ,QAAQ,CAAQ;EA2B/F,KAAAC,mBAAA,IAA4C;IAAE,OAAO,SAAS;EAAE;EAehEI,WAAWA,CAACC,MAAc,EAAEC,KAAY,EAA0D;IAAA,IAAxDC,YAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGL,OAAO,CAACI,YAAY;IAC3E,KAAK,CAACF,MAAM,EAAEC,KAAK,EAAEC,YAAY,CAAC;IAAC,KAb5BI,SAAS;IAAA,KAETC,MAAM;IAAA,KAEfC,KAAK;IAAA,KAELC,MAAM;IAAA,KAEGC,KAAK;IAAA,KAELC,OAAO;IAId,IAAI,CAACL,SAAS,GAAG,IAAI,CAACL,KAAK,CAACK,SAAS;IACrC,IAAI,CAACC,MAAM,GAAG,IAAI,CAACN,KAAK,CAACM,MAAM;IAC/B,IAAI,CAACC,KAAK,GAAG,IAAI,CAACP,KAAK,CAACO,KAAK;IAC7B,IAAI,CAACC,MAAM,GAAG,IAAI,CAACR,KAAK,CAACQ,MAAM;IAC/B,IAAI,CAACC,KAAK,GAAG,IAAI,CAACT,KAAK,CAACS,KAAK;EAC/B;AACF;AAlDsBZ,OAAO,CACXI,YAAY,GAA2B;EACrD,GAAGR,QAAQ,CAACQ,YAAY;EACxBU,IAAI,EAAE,IAAI;EACVN,SAAS,EAAE,IAAI;EACfC,MAAM,EAAE,YAAY;EACpBC,KAAK,EAAEH,SAAU;EACjBI,MAAM,EAAEJ,SAAU;EAClBK,KAAK,EAAE,CAAC;EACRG,OAAO,EAAE,IAAI;EACbF,OAAO,EAAE,CAAC,CAAC;EAEXG,UAAU,EAAE,KAAK;EAEjBC,KAAK,EAAE,CAAC;EAERC,SAAS,EAAEX,SAAU;EACrBY,OAAO,EAAEZ,SAAU;EACnBa,IAAI,EAAEb;AACR,CAAC;AAnBmBP,OAAO,CAqBpBqB,QAAQ,GAAG,IAAI;AArBFrB,OAAO,CAsBpBsB,QAAQ,GAAG,IAAI;AAtBFtB,OAAO,CAuBpBuB,eAAe,GAAG,IAAI;AAvBTvB,OAAO,CAwBpBwB,eAAe,GAAG,IAAI;AAxBTxB,OAAO,CAyBpByB,iBAAiB,GAAG,IAAI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transform-feedback.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","TransformFeedback","constructor","device","props","defaultProps","layout","undefined","buffers"],"sources":["../../../src/adapter/resources/transform-feedback.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {Device} from '../device';\nimport {PrimitiveTopology} from '../types/parameters';\nimport {ShaderLayout} from '../types/shader-layout';\nimport type {Buffer} from './buffer';\nimport {Resource, ResourceProps} from './resource';\n\n/** For bindRange */\nexport type BufferRange = {\n buffer: Buffer;\n byteOffset?: number;\n byteLength?: number;\n};\n\n/** Configures a set of output buffers for pipeline (WebGL 2 only) */\nexport type TransformFeedbackProps = ResourceProps & {\n /** Layout of shader (for varyings) */\n layout: ShaderLayout;\n /** Buffer bindings (for varyings) */\n buffers: Record<string, Buffer | BufferRange>;\n};\n\n/** Holds a set of output buffers for pipeline (WebGL 2 only) */\nexport abstract class TransformFeedback extends Resource<TransformFeedbackProps> {\n static override defaultProps: Required<TransformFeedbackProps> = {\n ...Resource.defaultProps,\n layout: undefined!,\n buffers: {}\n };\n\n get [Symbol.toStringTag](): string {\n return 'TransformFeedback';\n }\n\n constructor(device: Device, props?: TransformFeedbackProps) {\n super(device, props, TransformFeedback.defaultProps);\n }\n\n abstract begin(topology?: PrimitiveTopology): void;\n abstract end(): void;\n\n abstract setBuffers(buffers: Record<string, Buffer | BufferRange>): void;\n abstract setBuffer(locationOrName: string | number, bufferOrRange: Buffer | BufferRange): void;\n abstract getBuffer(locationOrName: string | number): Buffer | BufferRange | null;\n}\n"],"mappings":";SAKQA,QAAQ;AAAAC,mBAAA,GAyBTC,MAAM,CAACC,WAAW;AAPzB,OAAO,MAAeC,iBAAiB,SAASJ,QAAQ,CAAyB;EAO/E,KAAAC,mBAAA,IAAmC;IACjC,OAAO,mBAAmB;EAC5B;EAEAI,WAAWA,CAACC,MAAc,EAAEC,KAA8B,EAAE;IAC1D,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,iBAAiB,CAACI,YAAY,CAAC;EACtD;AAQF;AArBsBJ,iBAAiB,CACrBI,YAAY,GAAqC;EAC/D,GAAGR,QAAQ,CAACQ,YAAY;EACxBC,MAAM,EAAEC,SAAU;EAClBC,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vertex-array.js","names":["getAttributeInfosByLocation","Resource","_Symbol$toStringTag","Symbol","toStringTag","VertexArray","constructor","device","props","defaultProps","maxVertexAttributes","attributeInfos","indexBuffer","attributes","limits","Array","fill","renderPipeline","shaderLayout","bufferLayout"],"sources":["../../../src/adapter/resources/vertex-array.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {TypedArray} from '../../types';\nimport {\n AttributeInfo,\n getAttributeInfosByLocation\n} from '../attribute-utils/get-attribute-from-layouts';\nimport type {Device} from '../device';\nimport type {Buffer} from './buffer';\nimport type {RenderPass} from './render-pass';\nimport type {RenderPipeline} from './render-pipeline';\nimport {Resource, ResourceProps} from './resource';\n\n/** Properties for initializing a VertexArray */\nexport type VertexArrayProps = ResourceProps & {\n renderPipeline: RenderPipeline | null;\n};\n\n/**\n * Stores attribute bindings.\n * Makes it easy to share a render pipeline and use separate vertex arrays.\n * @note On WebGL, VertexArray allows non-constant bindings to be performed in advance\n * reducing the number of WebGL calls per draw call.\n * @note On WebGPU this is just a convenience class that collects the bindings.\n */\nexport abstract class VertexArray extends Resource<VertexArrayProps> {\n static override defaultProps: Required<VertexArrayProps> = {\n ...Resource.defaultProps,\n renderPipeline: null\n };\n\n override get [Symbol.toStringTag](): string {\n return 'VertexArray';\n }\n\n /** Max number of vertex attributes */\n readonly maxVertexAttributes: number;\n /** Attribute infos indexed by location - TODO only needed by webgl module? */\n protected readonly attributeInfos: AttributeInfo[];\n\n /** Index buffer */\n indexBuffer: Buffer | null = null;\n /** Attributes indexed by buffer slot */\n attributes: (Buffer | TypedArray | null)[];\n\n constructor(device: Device, props: VertexArrayProps) {\n super(device, props, VertexArray.defaultProps);\n this.maxVertexAttributes = device.limits.maxVertexAttributes;\n this.attributes = new Array(this.maxVertexAttributes).fill(null);\n this.attributeInfos = getAttributeInfosByLocation(\n props.renderPipeline.shaderLayout,\n props.renderPipeline.bufferLayout,\n this.maxVertexAttributes\n );\n }\n\n /** Set attributes (stored on pipeline and set before each call) */\n abstract setIndexBuffer(indices: Buffer | null): void;\n /** Set attributes (stored on pipeline and set before each call) */\n abstract setBuffer(bufferSlot: number, buffer: Buffer | null): void;\n /** Set constant attributes (WebGL only) */\n abstract setConstant(location: number, value: TypedArray | null): void;\n\n abstract bindBeforeRender(renderPass: RenderPass): void;\n abstract unbindAfterRender(renderPass: RenderPass): void;\n}\n"],"mappings":";SAIEA,2BAA2B;AAAA,SAMrBC,QAAQ;AAAAC,mBAAA,GAoBAC,MAAM,CAACC,WAAW;AANlC,OAAO,MAAeC,WAAW,SAASJ,QAAQ,CAAmB;EAMnE,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,aAAa;EACtB;EAYAI,WAAWA,CAACC,MAAc,EAAEC,KAAuB,EAAE;IACnD,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,WAAW,CAACI,YAAY,CAAC;IAAC,KAVxCC,mBAAmB;IAAA,KAETC,cAAc;IAAA,KAGjCC,WAAW,GAAkB,IAAI;IAAA,KAEjCC,UAAU;IAIR,IAAI,CAACH,mBAAmB,GAAGH,MAAM,CAACO,MAAM,CAACJ,mBAAmB;IAC5D,IAAI,CAACG,UAAU,GAAG,IAAIE,KAAK,CAAC,IAAI,CAACL,mBAAmB,CAAC,CAACM,IAAI,CAAC,IAAI,CAAC;IAChE,IAAI,CAACL,cAAc,GAAGX,2BAA2B,CAC/CQ,KAAK,CAACS,cAAc,CAACC,YAAY,EACjCV,KAAK,CAACS,cAAc,CAACE,YAAY,EACjC,IAAI,CAACT,mBACP,CAAC;EACH;AAWF;AAxCsBL,WAAW,CACfI,YAAY,GAA+B;EACzD,GAAGR,QAAQ,CAACQ,YAAY;EACxBQ,cAAc,EAAE;AAClB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decode-attribute-type.js","names":["decodeShaderAttributeType","attributeType","dataType","components","TYPE_INFO","integer","signed","byteLength","TYPE_SIZES","defaultVertexFormat","getCompatibleVertexFormat","vertexType","f32","f16","i32","u32"],"sources":["../../../src/adapter/type-utils/decode-attribute-type.ts"],"sourcesContent":["// luma.gl, MIT licese\nimport {ShaderDataType, ShaderAttributeType} from '../types/shader-types';\nimport {VertexFormat, VertexType} from '../types/vertex-formats';\n\n/** Information extracted from a ShaderAttributeInfo constant */\nexport type ShaderAttributeTypeInfo = {\n /** WGSL-style primitive data type, f32, i32, u32 */\n dataType: ShaderDataType,\n /** Whether this is a normalized integer (that must be used as float) */\n components: 1 | 2 | 3 | 4;\n /** Length in bytes of the data for one vertex */\n byteLength?: number;\n /** Whether this is for integer or float vert */\n integer: boolean;\n /** Whether this data type is signed */\n signed: boolean;\n /** The simplest vertex format that matches the shader attribute's data type */\n defaultVertexFormat?: VertexFormat;\n};\n\n/** Decodes a vertex type, returning byte length and flags (integer, signed, normalized) */\nexport function decodeShaderAttributeType(attributeType: ShaderAttributeType): ShaderAttributeTypeInfo {\n const [dataType, components] = TYPE_INFO[attributeType];\n const integer: boolean = dataType === 'i32' || dataType === 'u32';\n const signed: boolean = dataType !== 'u32';\n\n const byteLength = TYPE_SIZES[dataType] * components;\n const defaultVertexFormat = getCompatibleVertexFormat(dataType, components);\n return {\n dataType,\n components,\n defaultVertexFormat,\n byteLength,\n integer,\n signed\n };\n}\n\n/** Get the \"default\" vertex format for a certain shader data type */\nfunction getCompatibleVertexFormat(dataType: ShaderDataType, components: 1 | 2 | 3 | 4): VertexFormat {\n let vertexType: VertexType;\n switch (dataType) {\n case 'f32': vertexType = 'float32'; break;\n case 'i32': vertexType = 'sint32'; break;\n case 'u32': vertexType = 'uint32'; break;\n case 'f16': \n return components <= 2 ? 'float16x2' : 'float16x4';\n }\n // TODO logic does not work for float16\n if (components === 1) {\n return vertexType;\n }\n return `${vertexType}x${components}`;\n}\n\n/** All valid shader attribute types. A table guarantees exhaustive list and fast execution */\nconst TYPE_INFO: Record<ShaderAttributeType, [ShaderDataType, 1 | 2 | 3 | 4]> = {\n f32: ['f32', 1],\n 'vec2<f32>': ['f32', 2],\n 'vec3<f32>': ['f32', 3],\n 'vec4<f32>': ['f32', 4],\n f16: ['f16', 1],\n 'vec2<f16>': ['f16', 2],\n 'vec3<f16>': ['f16', 3],\n 'vec4<f16>': ['f16', 4],\n i32: ['i32', 1],\n 'vec2<i32>': ['i32', 2],\n 'vec3<i32>': ['i32', 3],\n 'vec4<i32>': ['i32', 4],\n u32: ['u32', 1],\n 'vec2<u32>': ['u32', 2],\n 'vec3<u32>': ['u32', 3],\n 'vec4<u32>': ['u32', 4]\n};\n\nconst TYPE_SIZES: Record<ShaderDataType, number> = {\n f32: 4,\n f16: 2,\n i32: 4,\n u32: 4,\n // 'bool-webgl': 4, \n};\n"],"mappings":"AAqBA,OAAO,SAASA,yBAAyBA,CAACC,aAAkC,EAA2B;EACrG,MAAM,CAACC,QAAQ,EAAEC,UAAU,CAAC,GAAGC,SAAS,CAACH,aAAa,CAAC;EACvD,MAAMI,OAAgB,GAAGH,QAAQ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AAW,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;EACvB,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;EACvB,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;EACvBC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;EACf,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;EACvB,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;EACvB,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC;AAED,MAAMP,UAA0C,GAAG;EACjDI,GAAG,EAAE,CAAC;EACNC,GAAG,EAAE,CAAC;EACNC,GAAG,EAAE,CAAC;EACNC,GAAG,EAAE;AAEP,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decode-data-type.js","names":["decodeVertexType","type","dataType","TYPE_MAP","bytes","getDataTypeBytes","normalized","includes","integer","startsWith","signed","byteLength","TYPE_SIZES","uint8","sint8","unorm8","snorm8","uint16","sint16","unorm16","snorm16","float16","float32","uint32","sint32"],"sources":["../../../src/adapter/type-utils/decode-data-type.ts"],"sourcesContent":["import {DataType, NormalizedDataType} from '../types/vertex-formats';\n\nexport type DecodedVertexType = {\n /** WebGPU data type */\n dataType: DataType,\n /** Length in bytes of the data for one vertex */\n byteLength: number;\n /** Whether this is for integer or float vert */\n integer: boolean;\n /** Whether this data type is signed */\n signed: boolean;\n /** Whether this is a normalized integer (that must be used as float) */\n normalized: boolean;\n};\n\n/** Decodes a vertex type, returning byte length and flags (integer, signed, normalized) */\nexport function decodeVertexType(type: NormalizedDataType): DecodedVertexType {\n const dataType = TYPE_MAP[type];\n const bytes = getDataTypeBytes(dataType);\n const normalized: boolean = type.includes('norm');\n const integer: boolean = !normalized && !type.startsWith('float');\n const signed: boolean = type.startsWith('s');\n return {\n dataType: TYPE_MAP[type],\n byteLength: bytes,\n integer,\n signed,\n normalized\n };\n}\n\nfunction getDataTypeBytes(type: DataType): number {\n const bytes = TYPE_SIZES[type];\n // assert(bytes);\n return bytes;\n}\n\nconst TYPE_MAP: Record<NormalizedDataType, DataType> = {\n uint8: 'uint8',\n sint8: 'sint8',\n unorm8: 'uint8',\n snorm8: 'sint8',\n uint16: 'uint16',\n sint16: 'sint16',\n unorm16: 'uint16',\n snorm16: 'sint16',\n float16: 'float16',\n float32: 'float32',\n uint32: 'uint32',\n sint32: 'sint32'\n};\n\nconst TYPE_SIZES: Record<DataType, number> = {\n uint8: 1,\n sint8: 1,\n uint16: 2,\n sint16: 2,\n float16: 2,\n float32: 4,\n uint32: 4,\n sint32: 4\n};\n"],"mappings":"AAgBA,OAAO,SAASA,gBAAgBA,CAACC,IAAwB,EAAqB;EAC5E,MAAMC,QAAQ,GAAGC,QAAQ,CAACF,IAAI,CAAC;EAC/B,MAAMG,KAAK,GAAGC,gBAAgB,CAACH,QAAQ,CAAC;EACxC,MAAMI,UAAmB,GAAGL,IAAI,CAACM,QAAQ,CAAC,MAAM,CAAC;EACjD,MAAMC,OAAgB,GAAG,CAACF,UAAU,IAAI,CAACL,IAAI,CAACQ,UAAU,CAAC,OAAO,CAAC;EACjE,MAAMC,MAAe,GAAGT,IAAI,CAACQ,UAAU,CAAC,GAAG,CAAC;EAC5C,OAAO;IACLP,QAAQ,EAAEC,QAAQ,CAACF,IAAI,CAAC;IACxBU,UAAU,EAAEP,KAAK;IACjBI,OAAO;IACPE,MAAM;IACNJ;EACF,CAAC;AACH;AAEA,SAASD,gBAAgBA,CAACJ,IAAc,EAAU;EAChD,MAAMG,KAAK,GAAGQ,UAAU,CAACX,IAAI,CAAC;EAE9B,OAAOG,KAAK;AACd;AAEA,MAAMD,QAA8C,GAAG;EACrDU,KAAK,EAAE,OAAO;EACdC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE,OAAO;EACfC,MAAM,EAAE,OAAO;EACfC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE,QAAQ;EAChBC,OAAO,EAAE,QAAQ;EACjBC,OAAO,EAAE,QAAQ;EACjBC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE;AACV,CAAC;AAED,MAAMZ,UAAoC,GAAG;EAC3CC,KAAK,EAAE,CAAC;EACRC,KAAK,EAAE,CAAC;EACRG,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,CAAC;EACTG,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,CAAC;EACVC,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE;AACV,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decode-shader-types.js","names":["assert","UNIFORM_FORMATS","type","components","decodeShaderUniformType","format","decoded","alignTo","size","count"],"sources":["../../../src/adapter/type-utils/decode-shader-types.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {assert} from '../../utils/assert';\nimport {ShaderUniformType, ShaderDataType} from '../types/shader-types';\n\nconst UNIFORM_FORMATS: Record<ShaderUniformType, {type: ShaderDataType, components: number}> = {\n 'f32': {type: 'f32', components: 1},\n 'i32': {type: 'i32', components: 1},\n 'u32': {type: 'u32', components: 1},\n // 'bool-webgl': {type: 'bool-webgl', components: 1},\n 'vec2<f32>': {type: 'f32', components: 2},\n 'vec3<f32>': {type: 'f32', components: 3},\n 'vec4<f32>': {type: 'f32', components: 4},\n 'vec2<i32>': {type: 'i32', components: 2},\n 'vec3<i32>': {type: 'i32', components: 3},\n 'vec4<i32>': {type: 'i32', components: 4},\n 'vec2<u32>': {type: 'u32', components: 2},\n 'vec3<u32>': {type: 'u32', components: 3},\n 'vec4<u32>': {type: 'u32', components: 4},\n 'mat2x2<f32>': {type: 'f32', components: 4},\n 'mat2x3<f32>': {type: 'f32', components: 6},\n 'mat2x4<f32>': {type: 'f32', components: 8},\n 'mat3x2<f32>': {type: 'f32', components: 6},\n 'mat3x3<f32>': {type: 'f32', components: 9},\n 'mat3x4<f32>': {type: 'f32', components: 12},\n 'mat4x2<f32>': {type: 'f32', components: 8},\n 'mat4x3<f32>': {type: 'f32', components: 12},\n 'mat4x4<f32>': {type: 'f32', components: 16},\n};\n\n/** Split a uniform type string into type and components */\nexport function decodeShaderUniformType(format: ShaderUniformType): {type: ShaderDataType, components: number} {\n const decoded = UNIFORM_FORMATS[format];\n assert(format);\n return decoded;\n} \n\n/** Align offset to 1, 2 or 4 elements (4, 8 or 16 bytes) */\nexport function alignTo(size: number, count: number): number {\n // prettier-ignore\n switch (count) {\n case 1: return size; // Pad upwards to even multiple of 2\n case 2: return size + (size % 2); // Pad upwards to even multiple of 2\n default: return size + ((4 - (size % 4)) % 4); // Pad upwards to even multiple of 4\n }\n}\n\n"],"mappings":"SAGQA,MAAM;AAGd,MAAMC,eAAsF,GAAG;EAC7F,KAAK,EAAE;IAACC,IAAI,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAC,CAAC;EACnC,KAAK,EAAE;IAACD,IAAI,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAC,CAAC;EACnC,KAAK,EAAE;IAACD,IAAI,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAC,CAAC;EAEnC,WAAW,EAAE;IAACD,IAAI,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAC,CAAC;EACzC,WAAW,EAAE;IAACD,IAAI,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAC,CAAC;EACzC,WAAW,EAAE;IAACD,IAAI,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAC,CAAC;EACzC,WAAW,EAAE;IAACD,IAAI,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAC,CAAC;EACzC,WAAW,EAAE;IAACD,IAAI,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAC,CAAC;EACzC,WAAW,EAAE;IAACD,IAAI,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAC,CAAC;EACzC,WAAW,EAAE;IAACD,IAAI,EAAE,KAAK;IAAEC,UAAU,EA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,CAAE,IAAI,CAAE;EAC/C;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decode-texture-format.js","names":["decodeVertexType","REGEX","decodeTextureFormat","format","matches","exec","length","type","srgb","suffix","dataType","decodedType","components","unsized","webgl","decodeNonStandardFormat","EXCEPTIONS","bpp","bbp","a","_data$format","data","Error","byteLength"],"sources":["../../../src/adapter/type-utils/decode-texture-format.ts"],"sourcesContent":["import {TextureFormat} from '../types/texture-formats';\nimport {VertexType} from '../types/vertex-formats';\nimport {decodeVertexType} from './decode-data-type';\n\nconst REGEX = /^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;\n\nexport type DecodedTextureFormat = {\n format: 'r' | 'rg' | 'rgb' | 'rgba';\n components: 1 | 2 | 3 | 4;\n dataType?: VertexType;\n srgb: boolean;\n webgl: boolean;\n unsized: boolean;\n byteLength: number;\n integer: boolean;\n signed: boolean;\n normalized: boolean;\n}\n\n/**\n * Decodes a vertex format, returning type, components, byte length and flags (integer, signed, normalized)\n */\nexport function decodeTextureFormat(format: TextureFormat): DecodedTextureFormat {\n const matches = REGEX.exec((format as string));\n if (matches) {\n const [, format, length, type, srgb, suffix] = matches;\n if (format) {\n const dataType = `${type}${length}` as VertexType;\n const decodedType = decodeVertexType(dataType);\n return {\n format: format as 'r' | 'rg' | 'rgb' | 'rgba',\n components: format.length as 1 | 2 | 3 | 4,\n // dataType - overwritten by decodedType\n srgb: srgb === '-srgb',\n unsized: suffix === '-unsized',\n webgl: suffix === '-webgl',\n ...decodedType\n };\n }\n }\n\n return decodeNonStandardFormat(format);\n}\n\n// https://www.w3.org/TR/webgpu/#texture-format-caps\n\nconst EXCEPTIONS: Partial<Record<TextureFormat, any>> = {\n // Packed 16 bit formats\n 'rgba4unorm-webgl': {format: 'rgba', bpp: 2}, \n 'rgb565unorm-webgl': {format: 'rgb', bpp: 2},\n 'rgb5a1unorm-webgl': {format: 'rgba', bbp: 2}, \n // Packed 32 bit formats\n 'rgb9e5ufloat': {format: 'rgb', bbp: 4},\n 'rg11b10ufloat': {format: 'rgb', bbp: 4},\n 'rgb10a2unorm': {format: 'rgba', bbp: 4},\n 'rgb10a2unorm-webgl': {format: 'rgba', bbp: 4},\n // Depth/stencil\n 'stencil8': {components: 1, bpp: 1, a: 'stencil'},\n 'depth16unorm': {components: 1, bpp: 2, a: 'depth'},\n 'depth24plus': {components: 1, bpp: 3, a: 'depth'},\n 'depth32float': {components: 1, bpp: 4, a: 'depth'},\n 'depth24plus-stencil8': {components: 2, bpp: 4, a: 'depth-stencil'},\n // \"depth24unorm-stencil8\" feature\n 'depth24unorm-stencil8': {components: 2, bpp: 4, a: 'depth-stencil'},\n // \"depth32float-stencil8\" feature\n 'depth32float-stencil8': {components: 2, bpp: 4, a: 'depth-stencil'}\n};\n\nfunction decodeNonStandardFormat(format: TextureFormat): DecodedTextureFormat {\n const data = EXCEPTIONS[format];\n if (!data) {\n throw new Error(`Unknown format ${format}`);\n }\n return {\n format: data.format || '',\n components: data.components || data.format?.length || 1,\n byteLength: data.bpp || 1,\n srgb: false,\n unsized: false \n } as DecodedTextureFormat;\n}\n\n/*\n'r8unorm':\t{s: \"float\"}, // \t✓\t✓\t✓\t},\n'r8snorm':\t{s: \"float\"}, // \t\t✓\t\t},\n'r8uint':\t{s: \"uint\"}, // \t✓\t✓\t\t},\n'r8sint':\t{s: \"sint\"}, // \t✓\t✓\t\t},\n'rg8unorm':\t{s: \"float\"}, // \t✓\t✓\t✓\t},\n'rg8snorm':\t{s: \"float\"}, // \t\t✓\t\t},\n'rg8uint':\t{s: \"uint\"}, // \t✓\t✓\t\t},\n'rg8sint':\t{s: \"sint\"}, // \t✓\t✓\t\t},\n'rgba8unorm':\t{s: \"float\"}, // \t✓\t✓\t✓\t✓},\n'rgba8unorm-srgb': {s: \"float\"}, // \t✓\t✓\t✓\t},\n'rgba8snorm':\t{s: \"float\"}, // \t\t✓\t\t✓},\n'rgba8uint':\t{s: \"uint\"}, // \t✓\t✓\t\t✓},\n'rgba8sint':\t{s: \"sint\"}, // \t✓\t✓\t\t✓},\n'bgra8unorm':\t{s: \"float\"}, // \t✓\t✓\t✓\t},\n'bgra8unorm-srgb': {s: \"float\"}, // \t✓\t✓\t✓\t},\n// 16-bit per component\t\t\t\t\t\n'r16uint': {s: \"uint\"}, // \t✓\t✓\t\t},\n'r16sint': {s: \"sint\"}, // \t✓\t✓\t\t},\n'r16float': {s: \"float\"}, // \t✓\t✓\t✓\t},\n'rg16uint': {s: \"uint\"}, // \t✓\t✓\t\t},\n'rg16sint': {s: \"sint\"}, // \t✓\t✓\t\t},\n'rg16float': {s: \"float\"}, // \t✓\t✓\t✓\t},\n'rgba16uint': {s: \"uint\"}, // \t✓\t✓\t\t✓},\n'rgba16sint': {s: \"sint\"}, // \t✓\t✓\t\t✓},\n'rgba16float': {s: \"float\"}, // \t✓\t✓\t✓\t✓},\n// 32-bit per component\t\t\t\t\t\n'r32uint': {s: \"uint\"}, // \t✓\t\t\t✓},\n'r32sint': {s: \"sint\"}, // \t✓\t\t\t✓},\n'r32float': {\"unfilterable-float\"\t✓\t✓\t\t✓},\n'rg32uint': {s: \"uint\"}, // \t✓\t\t\t✓},\n'rg32sint': {s: \"sint\"}, // \t✓\t\t\t✓},\n'rg32float': {\"unfilterable-float\"\t✓\t\t\t✓},\n'rgba32uint': {s: \"uint\"}, // \t✓\t\t\t✓},\n'rgba32sint': {s: \"sint\"}, // \t✓\t\t\t✓},\n'rgba32float': {\"unfilterable-float\"\t✓\t\t\t✓},\n// mixed component width\t\t\t\t\t\n'rgb10a2unorm': {s: \"float\"}, // \t✓\t✓\t✓\t}\n'rg11b10ufloat': {s: \"float\"}, // \t\t✓\t\t}\n// Format\tBytes per texel\tAspect\tGPUTextureSampleType\tValid image copy source\tValid image copy destination\n'stencil8': {1 − 4\tstencil\t\"uint\"\t✓}\n'depth16unorm': {2\tdepth\t\"depth\"\t✓}\n'depth24plus': {4\tdepth\t\"depth\"\t✗}\n'depth24plus': {stencil8\t4 − 8\tdepth\t\"depth\"\t✗}\n'stencil': {s: \"uint\"}, // \t✓}\n'depth32float': {4\tdepth\t\"depth\"\t✓\t✗}\n'depth24unorm': {stencil8\t4\tdepth\t\"depth\"\t✗}\n'stencil': {s: \"uint\"}, // \t✓}\n'depth32float': {stencil8}\n\n// Format\tBytes per block\tGPUTextureSampleType\tBlock Size\tFeature\n'rgb9e5ufloat': {c: 4, s: \"float\",\tbpp: 4/(1*1)},\n\n'bc1-rgba-unorm': {c: 4. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc1-rgba-unorm-srgb': {c: 4. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc2-rgba-unorm': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc2-rgba-unorm-srgb': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc3-rgba-unorm': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc3-rgba-unorm-srgb': {c: 4. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc4-r-unorm': {c: 1. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc4-r-snorm': {c: 1. s: \"float\", bpp: 8/(4 * 4) f: 'texture-compression-bc'},\n'bc5-rg-unorm': {c: 2. s: \"float\", bpp: 16/(4 * 4) f: 'texture-compression-bc'},\n'bc5-rg-snorm': { },\n'bc6h-rgb-ufloat': {\t16 },\n'bc6h-rgb-float': { },\n'bc7-rgba-unorm': {\t16 },\n'bc7-rgba-unorm-srgb': { },\n\n'etc2-rgb8unorm': {\t8\t\"float\"\t4 × 4\ttexture-compression-etc2 },\n'etc2-rgb8unorm-srgb': { },\n'etc2-rgb8a1unorm': {\t8 },\n'etc2-rgb8a1unorm-srgb': { },\n'etc2-rgba8unorm': {\t16 },\n'etc2-rgba8unorm-srgb': { },\n\n'eac-r11unorm': {\t8 },\n'eac-r11snorm': { },\n'eac-rg11unorm': {\t16 },\n'eac-rg11snorm': { },\n\n'astc-4x4-unorm': {\t16\t\"float\"\t4 × 4\ttexture-compression-astc },\n'astc-4x4-unorm-srgb': { },\n'astc-5x4-unorm': {\t16\t5 × 4 },\n'astc-5x4-unorm-srgb': { },\n'astc-5x5-unorm': {\t16\t5 × 5 },\n'astc-5x5-unorm-srgb': { },\n'astc-6x5-unorm': {\t16\t6 × 5 },\n'astc-6x5-unorm-srgb': { },\n'astc-6x6-unorm': {\t16\t6 × 6 },\n'astc-6x6-unorm-srgb': { },\n'astc-8x5-unorm': {\t16\t8 × 5 },\n'astc-8x5-unorm-srgb': { },\n'astc-8x6-unorm': {\t16\t8 × 6 },\n'astc-8x6-unorm-srgb': { },\n'astc-8x8-unorm': {\t16\t8 × 8 },\n'astc-8x8-unorm-srgb': { },\n'astc-10x5-unorm': {\t16\t10 × 5 },\n'astc-10x5-unorm-srgb': { },\n'astc-10x6-unorm': {\t16\t10 × 6 },\n'astc-10x6-unorm-srgb': { },\n'astc-10x8-unorm': {\t16\t10 × 8 },\n'astc-10x8-unorm-srgb': { },\n'astc-10x10-unorm': {\t16\t10 × 10 },\n'astc-10x10-unorm-srgb': { },\n'astc-12x10-unorm': {\t16\t12 × 10 },\n'astc-12x10-unorm-srgb': { },\n'astc-12x12-unorm': {\t16 },\n*/\n"],"mappings":"SAEQA,gBAAgB;AAExB,MAAMC,KAAK,GAAG,uDAAuD;AAkBrE,OAAO,SAASC,mBAAmBA,CAACC,MAAqB,EAAwB;EAC/E,MAAMC,OAAO,GAAGH,KAAK,CAACI,IAAI,CAAEF,MAAiB,CAAC;EAC9C,IAAIC,OAAO,EAAE;IACX,MAAM,GAAGD,MAAM,EAAEG,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,CAAC,GAAGL,OAAO;IACtD,IAAID,MAAM,EAAE;MACV,MAAMO,QAAQ,GAAI,GAAEH,IAAK,GAAED,MAA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CAAC;IAAEK,GAAG,EAAE,CAAC;IAAEE,CAAC,EAAE;EAAO,CAAC;EACnD,sBAAsB,EAAE;IAACP,UAAU,EAAE,CAAC;IAAEK,GAAG,EAAE,CAAC;IAAEE,CAAC,EAAE;EAAe,CAAC;EAEnE,uBAAuB,EAAE;IAACP,UAAU,EAAE,CAAC;IAAEK,GAAG,EAAE,CAAC;IAAEE,CAAC,EAAE;EAAe,CAAC;EAEpE,uBAAuB,EAAE;IAACP,UAAU,EAAE,CAAC;IAAEK,GAAG,EAAE,CAAC;IAAEE,CAAC,EAAE;EAAe;AACrE,CAAC;AAED,SAASJ,uBAAuBA,CAACZ,MAAqB,EAAwB;EAAA,IAAAiB,YAAA;EAC5E,MAAMC,IAAI,GAAGL,UAAU,CAACb,MAAM,CAAC;EAC/B,IAAI,CAACkB,IAAI,EAAE;IACT,MAAM,IAAIC,KAAK,CAAE,kBAAiBnB,MAAO,EAAC,CAAC;EAC7C;EACA,OAAO;IACLA,MAAM,EAAEkB,IAAI,CAAClB,MAAM,IAAI,EAAE;IACzBS,UAAU,EAAES,IAAI,CAACT,UAAU,MAAAQ,YAAA,GAAIC,IAAI,CAAClB,MAAM,cAAAiB,YAAA,uBAAXA,YAAA,CAAad,MAAM,KAAI,CAAC;IACvDiB,UAAU,EAAEF,IAAI,CAACJ,GAAG,IAAI,CAAC;IACzBT,IAAI,EAAE,KAAK;IACXK,OAAO,EAAE;EACX,CAAC;AACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decode-vertex-format.js","names":["decodeVertexType","decodeVertexFormat","format","webglOnly","endsWith","replace","type_","count","split","type","components","parseInt","decodedType","result","byteLength","integer","signed","normalized"],"sources":["../../../src/adapter/type-utils/decode-vertex-format.ts"],"sourcesContent":["import {VertexFormat, VertexType} from '../types/vertex-formats';\nimport {decodeVertexType} from './decode-data-type';\n\nexport type VertexFormatInfo = {\n /** Length in bytes */\n byteLength: number;\n /** Type of each component */\n type: VertexType;\n /** Number of components per vertex / row */\n components: 1 | 2 | 3 | 4;\n /** Is this an integer format (normalized integer formats are not integer) */\n integer: boolean;\n /** Is this a signed format? */\n signed: boolean;\n /** Is this a normalized format? */\n normalized: boolean;\n /** Is this a webgl only format? */\n webglOnly?: boolean;\n};\n\n/**\n * Decodes a vertex format, returning type, components, byte length and flags (integer, signed, normalized)\n */\nexport function decodeVertexFormat(format: VertexFormat): VertexFormatInfo {\n // Strip the -webgl ending if present\n let webglOnly: boolean | undefined;\n if (format.endsWith('-webgl')) {\n format.replace('-webgl', '');\n webglOnly = true;\n }\n // split components from type\n const [type_, count] = format.split('x');\n const type = type_ as VertexType;\n const components = (count ? parseInt(count) : 1) as 1 | 2 | 3 | 4;\n // decode the type\n const decodedType = decodeVertexType(type);\n const result: VertexFormatInfo = {\n type,\n components,\n byteLength: decodedType.byteLength * components,\n integer: decodedType.integer,\n signed: decodedType.signed,\n normalized: decodedType.normalized\n };\n if (webglOnly) {\n result.webglOnly = true;\n }\n return result;\n}\n"],"mappings":"SACQA,gBAAgB;AAsBxB,OAAO,SAASC,kBAAkBA,CAACC,MAAoB,EAAoB;EAEzE,IAAIC,SAA8B;EAClC,IAAID,MAAM,CAACE,QAAQ,CAAC,QAAQ,CAAC,EAAE;IAC7BF,MAAM,CAACG,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC5BF,SAAS,GAAG,IAAI;EAClB;EAEA,MAAM,CAACG,KAAK,EAAEC,KAAK,CAAC,GAAGL,MAAM,CAACM,KAAK,CAAC,GAAG,CAAC;EACxC,MAAMC,IAAI,GAAGH,KAAmB;EAChC,MAAMI,UAAU,GAAIH,KAAK,GAAGI,QAAQ,CAACJ,KAAK,CAAC,GAAG,CAAmB;EAEjE,MAAMK,WAAW,GAAGZ,gBAAgB,CAACS,IAAI,CAAC;EAC1C,MAAMI,MAAwB,GAAG;IAC/BJ,IAAI;IACJC,UAAU;IACVI,UAAU,EAAEF,WAAW,CAACE,UAAU,GAAGJ,UAAU;IAC/CK,OAAO,EAAEH,WAAW,CAACG,OAAO;IAC5BC,MAAM,EAAEJ,WAAW,CAACI,MAAM;IAC1BC,UAAU,EAAEL,WAAW,CAACK;EAC1B,CAAC;EACD,IAAId,SAAS,EAAE;IACbU,MAAM,CAACV,SAAS,GAAG,IAAI;EACzB;EACA,OAAOU,MAAM;AACf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vertex-format-from-attribute.js","names":["getDataTypeFromTypedArray","arrayOrType","type","ArrayBuffer","isView","constructor","Float32Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","Int8Array","Int16Array","Int32Array","Error","name","getTypedArrayFromDataType","dataType","getVertexFormatFromAttribute","typedArray","size","normalized","components","replace"],"sources":["../../../src/adapter/type-utils/vertex-format-from-attribute.ts"],"sourcesContent":["// luma.gl, MIT licese\nimport {TypedArray, TypedArrayConstructor} from '../..';\nimport {VertexFormat} from '../types/vertex-formats';\n\n// import {DataType} from '../types/vertex-formats';\n// type Omit<DataType, 'float16'> unfortunately breaks Typescript inferance\ntype DataType = 'uint8' | 'sint8' | 'uint16' | 'sint16' | 'uint32' | 'sint32' | 'float32';\ntype DataTypeNorm = 'unorm8' | 'snorm8' | 'unorm16' | 'snorm16';\n\nexport function getDataTypeFromTypedArray(\n arrayOrType: TypedArray | TypedArrayConstructor\n): DataType {\n const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;\n switch (type) {\n case Float32Array:\n return 'float32';\n case Uint16Array:\n return 'uint16';\n case Uint32Array:\n return 'uint32';\n case Uint8Array:\n case Uint8ClampedArray:\n return 'uint8';\n case Int8Array:\n return 'sint8';\n case Int16Array:\n return 'sint16';\n case Int32Array:\n return 'sint32';\n default:\n // Failed to deduce data type from typed array\n throw new Error(type.constructor.name);\n }\n}\n\nexport function getTypedArrayFromDataType(\n dataType: DataType | DataTypeNorm\n): TypedArrayConstructor {\n switch (dataType) {\n case 'float32':\n return Float32Array;\n case 'uint32':\n return Uint32Array;\n case 'sint32':\n return Int32Array;\n case 'uint16':\n case 'unorm16':\n return Uint16Array;\n case 'sint16':\n case 'snorm16':\n return Int16Array;\n case 'uint8':\n case 'unorm8':\n return Uint8Array;\n case 'sint8':\n case 'snorm8':\n return Int8Array;\n default:\n // Failed to deduce typed array from data type\n throw new Error(dataType);\n }\n}\n\n/** Get the vertex format for an attribute with TypedArray and size */\nexport function getVertexFormatFromAttribute(\n typedArray: TypedArray,\n size: number,\n normalized?: boolean\n): VertexFormat {\n if (!size || size > 4) {\n throw new Error(`size ${size}`);\n }\n\n const components = size as 1 | 2 | 3 | 4;\n let dataType: DataType | DataTypeNorm = getDataTypeFromTypedArray(typedArray);\n\n if (dataType === 'uint8' || dataType === 'sint8') {\n if (components === 1 || components === 3) {\n // WebGPU 8 bit formats must be aligned to 16 bit boundaries');\n throw new Error(`size: ${size}`);\n }\n if (normalized) {\n dataType = dataType.replace('int', 'norm') as 'unorm8' | 'snorm8';\n }\n return `${dataType}x${components}`;\n }\n if (dataType === 'uint16' || dataType === 'sint16') {\n if (components === 1 || components === 3) {\n // WebGPU 16 bit formats must be aligned to 32 bit boundaries\n throw new Error(`size: ${size}`);\n }\n if (normalized) {\n dataType = dataType.replace('int', 'norm') as 'unorm16' | 'snorm16';\n }\n return `${dataType}x${components}`;\n }\n\n if (components === 1) {\n return dataType;\n }\n\n return `${dataType}x${components}`;\n}\n"],"mappings":"AASA,OAAO,SAASA,yBAAyBA,CACvCC,WAA+C,EACrC;EACV,MAAMC,IAAI,GAAGC,WAAW,CAACC,MAAM,CAACH,WAAW,CAAC,GAAGA,WAAW,CAACI,WAAW,GAAGJ,WAAW;EACpF,QAAQC,IAAI;IACV,KAAKI,YAAY;MACf,OAAO,SAAS;IAClB,KAAKC,WAAW;MACd,OAAO,QAAQ;IACjB,KAAKC,WAAW;MACd,OAAO,QAAQ;IACjB,KAAKC,UAAU;IACf,KAAKC,iBAAiB;MACpB,OAAO,OAAO;IAChB,KAAKC,SAAS;MACZ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S,IAAGK,UAAW,EAAC;EACpC;EACA,IAAIL,QAAQ,KAAK,QAAQ,IAAIA,QAAQ,KAAK,QAAQ,EAAE;IAClD,IAAIK,UAAU,KAAK,CAAC,IAAIA,UAAU,KAAK,CAAC,EAAE;MAExC,MAAM,IAAIR,KAAK,CAAE,SAAQM,IAAK,EAAC,CAAC;IAClC;IACA,IAAIC,UAAU,EAAE;MACdJ,QAAQ,GAAGA,QAAQ,CAACM,OAAO,CAAC,KAAK,EAAE,MAAM,CAA0B;IACrE;IACA,OAAQ,GAAEN,QAAS,IAAGK,UAAW,EAAC;EACpC;EAEA,IAAIA,UAAU,KAAK,CAAC,EAAE;IACpB,OAAOL,QAAQ;EACjB;EAEA,OAAQ,GAAEA,QAAS,IAAGK,UAAW,EAAC;AACpC"}
|
|
@@ -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,SA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A,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,MAAM,CAAC;MACzER,UAAU,CAACS,GAAG,CAACJ,WAAW,CAACC,IAAI,EAAED,WAAW,CAAC;IAC/C;EACF;EAEA,OAAOK,mBAAmBA,CAAA,EAAa;IAErC,OAAOC,KAAK,CAACC,IAAI,CAACZ,UAAU,CAAC,CAACa,GAAG,CAACjB,MAAM,IAAIA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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,GAA0C,CAAC,CAAC;IAAA,KACpDC,gBAAgB,GAAqC,CAAC,CAAC;IAAA,KACvDC,QAAQ,GAAY,IAAI;IAAA,KAEfC,aAAa,GAAgC,CAAC,CAAC;IAAA,KACxDC,WAAW,GAAmB,aAAa;IAOzC,IAAI,CAACL,IAAI,GAAGD,KAAK,aAAL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AA,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,MAAM,CAACG,GAAG,CAAC,GAAG;QAACK,IAAI;QAAEN,IAAI,EAAEQ,KAAK;QAAEC;MAAM,CAAC;IAChD;IACAT,IAAI,IAAI,CAAC,CAAC,GAAIA,IAAI,GAAG,CAAE,IAAI,CAAC;IAE5B,MAAMU,gBAAgB,GAAGV,IAAI,GAAG,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AY,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;MACxD,MAAMS,iBAAiB,GAAGJ,UAA+B;MAGzD,MAAMK,mBAAmB,GAAG,IAAId,mBAAmB,CAACU,KAAK,CAACK,YAAY,IAAI,CAAC,CAAC,CAAC;MAC7E,IAAI,CAACR,oBAAoB,CAACS,GAAG,CAACH,iBAAiB,EAAEC,mBAAmB,CAAC;MAGr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xE,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[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AC,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,EAAEC,KAAa,EAAW;EAChE,IAAIF,CAAC,KAAKC,CAAC,EAAE;IACX,OAAO,IAAI;EACb;EACA,IAAI,CAACC,KAAK,IAAI,CAACF,CAAC,IAAI,CAACC,CAAC,EAAE;IACtB,OAAO,KAAK;EACd;EACA,IAAIE,KAAK,CAACC,OAAO,CAACJ,CAAC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