@luma.gl/core 9.0.0-alpha.39 → 9.0.0-alpha.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -1
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +1 -1
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.js.map +1 -1
- package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/framebuffer.js.map +1 -1
- package/dist/adapter/resources/sampler.d.ts.map +1 -1
- package/dist/adapter/resources/sampler.js.map +1 -1
- package/dist/adapter/type-utils/decode-shader-types.d.ts.map +1 -1
- package/dist/adapter/type-utils/decode-shader-types.js.map +1 -1
- package/dist/adapter/types/shader-types.d.ts.map +1 -1
- package/dist/adapter/types/shader-types.js.map +1 -1
- package/dist/adapter/types/texture-formats.d.ts.map +1 -1
- package/dist/adapter/types/texture-formats.js.map +1 -1
- package/dist/adapter/types/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/types/vertex-formats.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/compiler-log/compiler-message.d.ts.map +1 -1
- package/dist/lib/compiler-log/compiler-message.js.map +1 -1
- package/dist/lib/luma.d.ts.map +1 -1
- package/dist/lib/luma.js.map +1 -1
- package/dist/lib/utils/array-equal.d.ts.map +1 -1
- package/dist/lib/utils/array-equal.js.map +1 -1
- package/dist/lib/utils/array-utils-flat.d.ts.map +1 -1
- package/dist/lib/utils/array-utils-flat.js.map +1 -1
- package/dist/lib/utils/load-file.d.ts.map +1 -1
- package/dist/lib/utils/load-file.js.map +1 -1
- package/dist/lib/utils/utils.d.ts.map +1 -1
- package/dist/lib/utils/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/adapter/attribute-utils/get-attribute-from-layouts.ts +1 -0
- package/src/adapter/resources/framebuffer.ts +1 -0
- package/src/adapter/resources/sampler.ts +1 -0
- package/src/adapter/type-utils/decode-shader-types.ts +1 -0
- package/src/adapter/types/shader-types.ts +1 -0
- package/src/adapter/types/texture-formats.ts +1 -0
- package/src/adapter/types/vertex-formats.ts +1 -0
- package/src/index.ts +1 -0
- package/src/lib/compiler-log/compiler-message.ts +1 -0
- package/src/lib/luma.ts +1 -0
- package/src/lib/utils/array-equal.ts +1 -0
- package/src/lib/utils/array-utils-flat.ts +1 -0
- package/src/lib/utils/load-file.ts +1 -0
- package/src/lib/utils/utils.ts +1 -0
package/LICENSE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-attribute-from-layouts.d.ts","sourceRoot":"","sources":["../../../src/adapter/attribute-utils/get-attribute-from-layouts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-attribute-from-layouts.d.ts","sourceRoot":"","sources":["../../../src/adapter/attribute-utils/get-attribute-from-layouts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAuB,MAAM,wBAAwB,CAAC;AAC/E,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAE/E,OAAO,KAAK,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAGtE,gGAAgG;AAChG,MAAM,MAAM,aAAa,GAAG;IAC1B,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,UAAU,EAAE,mBAAmB,CAAC;IAChC,+EAA+E;IAC/E,cAAc,EAAE,cAAc,CAAC;IAC/B,yFAAyF;IACzF,gBAAgB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,0GAA0G;IAC1G,OAAO,EAAE,OAAO,CAAC;IAEjB,iBAAiB;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,YAAY,EAAE,YAAY,CAAC;IAC3B,6DAA6D;IAC7D,cAAc,EAAE,UAAU,CAAC;IAC3B,iFAAiF;IACjF,gBAAgB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,uEAAuE;IACvE,UAAU,EAAE,OAAO,CAAC;IAEpB,mHAAmH;IACnH,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAC;IAEhC,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAWF;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,GAC3B,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAU/B;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,EAC5B,mBAAmB,GAAE,MAAW,GAC/B,aAAa,EAAE,CAOjB;AAgJD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,YAAY,EACxB,cAAc,EAAE,YAAY,GAC3B,YAAY,CAiBd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-attribute-from-layouts.js","names":["log","decodeShaderAttributeType","decodeVertexFormat","getAttributeInfosFromLayouts","shaderLayout","bufferLayout","attributeInfos","attribute","attributes","name","getAttributeInfoFromLayouts","getAttributeInfosByLocation","maxVertexAttributes","arguments","length","undefined","locationInfos","Array","fill","attributeInfo","Object","values","location","shaderDeclaration","getAttributeFromShaderLayout","bufferMapping","getAttributeFromBufferLayout","attributeTypeInfo","type","vertexFormat","defaultVertexFormat","vertexFormatInfo","attributeName","bufferName","shaderType","shaderDataType","dataType","shaderComponents","components","bufferDataType","bufferComponents","normalized","integer","stepMode","byteOffset","byteStride","find","attr","warn","bufferLayouts","checkBufferLayouts","bufferLayoutInfo","getAttributeFromShortHand","getAttributeFromAttributesList","format","_bufferLayout$attribu","attributeMapping","info","byteLength","mapping","mergeShaderLayout","baseLayout","overrideLayout","mergedLayout","map","baseAttribute"],"sources":["../../../src/adapter/attribute-utils/get-attribute-from-layouts.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport {log} from '../../lib/utils/log';\nimport type {ShaderLayout, AttributeDeclaration} from '../types/shader-layout';\nimport type {BufferLayout} from '../types/buffer-layout';\nimport type {ShaderDataType, ShaderAttributeType} from '../types/shader-types';\nimport {decodeShaderAttributeType} from '../type-utils/decode-attribute-type';\nimport type {VertexFormat, VertexType} from '../types/vertex-formats';\nimport {decodeVertexFormat} from '../type-utils/decode-vertex-format';\n\n/** Resolved info for a buffer / attribute combination to help backend configure it correctly */\nexport type AttributeInfo = {\n /** Attribute name */\n attributeName: string;\n /** Location in shader */\n location: number;\n /** Type / precision used in shader (buffer values may be converted) */\n shaderType: ShaderAttributeType;\n /** Calculations are done in this type in the shader's attribute declaration */\n shaderDataType: ShaderDataType;\n /** Components refer to the number of components in the shader's attribute declaration */\n shaderComponents: 1 | 2 | 3 | 4;\n /** It is the shader attribute declaration that determines whether GPU will process as integer or float */\n integer: boolean;\n\n /** BufferName */\n bufferName: string;\n /** Format of buffer data */\n vertexFormat: VertexFormat;\n /** Memory data type refers to the data type in the buffer */\n bufferDataType: VertexType;\n /** Components refer to the number of components in the buffer's vertex format */\n bufferComponents: 1 | 2 | 3 | 4;\n /** Normalization is encoded in the buffer layout's vertex format... */\n normalized: boolean;\n\n /** If not specified, the step mode is inferred from the attribute name in the shader (contains string instance) */\n stepMode: 'vertex' | 'instance';\n\n /** The byteOffset is encoded in or calculated from the buffer layout */\n byteOffset: number;\n /** The byteStride is encoded in or calculated from the buffer layout */\n byteStride: number;\n};\n\ntype BufferAttributeInfo = {\n attributeName: string;\n bufferName: string;\n stepMode?: 'vertex' | 'instance';\n vertexFormat: VertexFormat;\n byteOffset: number;\n byteStride: number;\n};\n\n/** \n * Map from \"attribute names\" to \"resolved attribute infos\" \n * containing information about both buffer layouts and shader attribute declarations\n */\nexport function getAttributeInfosFromLayouts(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[]\n): Record<string, AttributeInfo> {\n const attributeInfos: Record<string, AttributeInfo> = {};\n for (const attribute of shaderLayout.attributes) {\n attributeInfos[attribute.name] = getAttributeInfoFromLayouts(\n shaderLayout,\n bufferLayout,\n attribute.name\n );\n }\n return attributeInfos;\n}\n\n/** \n * Array indexed by \"location\" holding \"resolved attribute infos\" \n */\nexport function getAttributeInfosByLocation(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[],\n maxVertexAttributes: number = 16\n): AttributeInfo[] {\n const attributeInfos = getAttributeInfosFromLayouts(shaderLayout, bufferLayout);\n const locationInfos: AttributeInfo[] = new Array(maxVertexAttributes).fill(null);\n for (const attributeInfo of Object.values(attributeInfos)) {\n locationInfos[attributeInfo.location] = attributeInfo;\n }\n return locationInfos;\n}\n\n/**\n * Get the combined information from a shader layout and a buffer layout for a specific attribute\n */\nfunction getAttributeInfoFromLayouts(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[],\n name: string\n): AttributeInfo | null {\n const shaderDeclaration = getAttributeFromShaderLayout(shaderLayout, name);\n const bufferMapping: BufferAttributeInfo = getAttributeFromBufferLayout(bufferLayout, name);\n\n // TODO should no longer happen\n if (!shaderDeclaration) {\n // || !bufferMapping\n return null;\n }\n\n const attributeTypeInfo = decodeShaderAttributeType(shaderDeclaration.type);\n const vertexFormat = bufferMapping?.vertexFormat || attributeTypeInfo.defaultVertexFormat;\n const vertexFormatInfo = decodeVertexFormat(vertexFormat);\n\n return {\n attributeName: bufferMapping?.attributeName || shaderDeclaration.name,\n bufferName: bufferMapping?.bufferName || shaderDeclaration.name,\n location: shaderDeclaration.location,\n shaderType: shaderDeclaration.type,\n shaderDataType: attributeTypeInfo.dataType,\n shaderComponents: attributeTypeInfo.components,\n vertexFormat,\n bufferDataType: vertexFormatInfo.type,\n bufferComponents: vertexFormatInfo.components,\n // normalized is a property of the buffer's vertex format\n normalized: vertexFormatInfo.normalized,\n // integer is a property of the shader declaration\n integer: attributeTypeInfo.integer,\n stepMode: bufferMapping?.stepMode || shaderDeclaration.stepMode,\n byteOffset: bufferMapping?.byteOffset || 0,\n byteStride: bufferMapping?.byteStride || 0\n };\n}\n\nfunction getAttributeFromShaderLayout(\n shaderLayout: ShaderLayout,\n name: string\n): AttributeDeclaration | null {\n const attribute = shaderLayout.attributes.find(attr => attr.name === name);\n if (!attribute) {\n log.warn(`shader layout attribute \"${name}\" not present in shader`);\n }\n return attribute || null;\n}\n\nfunction getAttributeFromBufferLayout(\n bufferLayouts: BufferLayout[],\n name: string\n): BufferAttributeInfo | null {\n // Check that bufferLayouts are valid (each either has format or attribute)\n checkBufferLayouts(bufferLayouts);\n\n let bufferLayoutInfo = getAttributeFromShortHand(bufferLayouts, name);\n if (bufferLayoutInfo) {\n return bufferLayoutInfo;\n }\n\n bufferLayoutInfo = getAttributeFromAttributesList(bufferLayouts, name);\n if (bufferLayoutInfo) {\n return bufferLayoutInfo;\n }\n\n // Didn't find...\n log.warn(`layout for attribute \"${name}\" not present in buffer layout`);\n return null;\n}\n\n/** Check that bufferLayouts are valid (each either has format or attribute) */\nfunction checkBufferLayouts(bufferLayouts: BufferLayout[]) {\n for (const bufferLayout of bufferLayouts) {\n if (\n (bufferLayout.attributes && bufferLayout.format) ||\n (!bufferLayout.attributes && !bufferLayout.format)\n ) {\n log.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`);\n }\n }\n}\n\n/** Get attribute from format shorthand if specified */\nfunction getAttributeFromShortHand(\n bufferLayouts: BufferLayout[],\n name: string\n): BufferAttributeInfo | null {\n for (const bufferLayout of bufferLayouts) {\n if (bufferLayout.format && bufferLayout.name === name) {\n return {\n attributeName: bufferLayout.name,\n bufferName: name,\n stepMode: bufferLayout.stepMode,\n vertexFormat: bufferLayout.format,\n // If offset is needed, use `attributes` field.\n byteOffset: 0,\n byteStride: bufferLayout.byteStride || 0\n };\n }\n }\n return null;\n}\n\n/**\n * Search attribute mappings (e.g. interleaved attributes) for buffer mapping.\n * Not the name of the buffer might be the same as one of the interleaved attributes.\n */\nfunction getAttributeFromAttributesList(\n bufferLayouts: BufferLayout[],\n name: string\n): BufferAttributeInfo | null {\n for (const bufferLayout of bufferLayouts) {\n let byteStride: number | undefined = bufferLayout.byteStride;\n\n // Calculate a default byte stride if not provided\n if (typeof bufferLayout.byteStride !== 'number') {\n for (const attributeMapping of bufferLayout.attributes || []) {\n const info = decodeVertexFormat(attributeMapping.format);\n byteStride += info.byteLength;\n }\n }\n\n const attributeMapping = bufferLayout.attributes?.find(mapping => mapping.attribute === name);\n if (attributeMapping) {\n return {\n attributeName: attributeMapping.attribute,\n bufferName: bufferLayout.name,\n stepMode: bufferLayout.stepMode,\n vertexFormat: attributeMapping.format,\n byteOffset: attributeMapping.byteOffset,\n byteStride\n };\n }\n }\n\n return null;\n}\n\n/**\n * Merges an provided shader layout into a base shader layout\n * In WebGL, this allows the auto generated shader layout to be overridden by the application\n * Typically to change the format of the vertex attributes (from float32x4 to uint8x4 etc).\n * @todo Drop this? Aren't all use cases covered by mergeBufferLayout()?\n */\nexport function mergeShaderLayout(\n baseLayout: ShaderLayout,\n overrideLayout: ShaderLayout\n): ShaderLayout {\n // Deep clone the base layout\n const mergedLayout: ShaderLayout = {\n ...baseLayout,\n attributes: baseLayout.attributes.map(attribute => ({...attribute}))\n };\n // Merge the attributes\n for (const attribute of overrideLayout?.attributes || []) {\n const baseAttribute = mergedLayout.attributes.find(attr => attr.name === attribute.name);\n if (!baseAttribute) {\n log.warn(`shader layout attribute ${attribute.name} not present in shader`);\n } else {\n baseAttribute.type = attribute.type || baseAttribute.type;\n baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;\n }\n }\n return mergedLayout;\n}\n"],"mappings":"SAEQA,GAAG;AAAA,SAIHC,yBAAyB;AAAA,SAEzBC,kBA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MyD,aAAa,GAAGF,YAAY,CAACvD,UAAU,CAACsC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACtC,IAAI,KAAKF,SAAS,CAACE,IAAI,CAAC;IACxF,IAAI,CAACwD,aAAa,EAAE;MAClBjE,GAAG,CAACgD,IAAI,CAAE,2BAA0BzC,SAAS,CAACE,IAAK,wBAAuB,CAAC;IAC7E,CAAC,MAAM;MACLwD,aAAa,CAACrC,IAAI,GAAGrB,SAAS,CAACqB,IAAI,IAAIqC,aAAa,CAACrC,IAAI;MACzDqC,aAAa,CAACtB,QAAQ,GAAGpC,SAAS,CAACoC,QAAQ,IAAIsB,aAAa,CAACtB,QAAQ;IACvE;EACF;EACA,OAAOoB,YAAY;AACrB"}
|
|
1
|
+
{"version":3,"file":"get-attribute-from-layouts.js","names":["log","decodeShaderAttributeType","decodeVertexFormat","getAttributeInfosFromLayouts","shaderLayout","bufferLayout","attributeInfos","attribute","attributes","name","getAttributeInfoFromLayouts","getAttributeInfosByLocation","maxVertexAttributes","arguments","length","undefined","locationInfos","Array","fill","attributeInfo","Object","values","location","shaderDeclaration","getAttributeFromShaderLayout","bufferMapping","getAttributeFromBufferLayout","attributeTypeInfo","type","vertexFormat","defaultVertexFormat","vertexFormatInfo","attributeName","bufferName","shaderType","shaderDataType","dataType","shaderComponents","components","bufferDataType","bufferComponents","normalized","integer","stepMode","byteOffset","byteStride","find","attr","warn","bufferLayouts","checkBufferLayouts","bufferLayoutInfo","getAttributeFromShortHand","getAttributeFromAttributesList","format","_bufferLayout$attribu","attributeMapping","info","byteLength","mapping","mergeShaderLayout","baseLayout","overrideLayout","mergedLayout","map","baseAttribute"],"sources":["../../../src/adapter/attribute-utils/get-attribute-from-layouts.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {log} from '../../lib/utils/log';\nimport type {ShaderLayout, AttributeDeclaration} from '../types/shader-layout';\nimport type {BufferLayout} from '../types/buffer-layout';\nimport type {ShaderDataType, ShaderAttributeType} from '../types/shader-types';\nimport {decodeShaderAttributeType} from '../type-utils/decode-attribute-type';\nimport type {VertexFormat, VertexType} from '../types/vertex-formats';\nimport {decodeVertexFormat} from '../type-utils/decode-vertex-format';\n\n/** Resolved info for a buffer / attribute combination to help backend configure it correctly */\nexport type AttributeInfo = {\n /** Attribute name */\n attributeName: string;\n /** Location in shader */\n location: number;\n /** Type / precision used in shader (buffer values may be converted) */\n shaderType: ShaderAttributeType;\n /** Calculations are done in this type in the shader's attribute declaration */\n shaderDataType: ShaderDataType;\n /** Components refer to the number of components in the shader's attribute declaration */\n shaderComponents: 1 | 2 | 3 | 4;\n /** It is the shader attribute declaration that determines whether GPU will process as integer or float */\n integer: boolean;\n\n /** BufferName */\n bufferName: string;\n /** Format of buffer data */\n vertexFormat: VertexFormat;\n /** Memory data type refers to the data type in the buffer */\n bufferDataType: VertexType;\n /** Components refer to the number of components in the buffer's vertex format */\n bufferComponents: 1 | 2 | 3 | 4;\n /** Normalization is encoded in the buffer layout's vertex format... */\n normalized: boolean;\n\n /** If not specified, the step mode is inferred from the attribute name in the shader (contains string instance) */\n stepMode: 'vertex' | 'instance';\n\n /** The byteOffset is encoded in or calculated from the buffer layout */\n byteOffset: number;\n /** The byteStride is encoded in or calculated from the buffer layout */\n byteStride: number;\n};\n\ntype BufferAttributeInfo = {\n attributeName: string;\n bufferName: string;\n stepMode?: 'vertex' | 'instance';\n vertexFormat: VertexFormat;\n byteOffset: number;\n byteStride: number;\n};\n\n/** \n * Map from \"attribute names\" to \"resolved attribute infos\" \n * containing information about both buffer layouts and shader attribute declarations\n */\nexport function getAttributeInfosFromLayouts(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[]\n): Record<string, AttributeInfo> {\n const attributeInfos: Record<string, AttributeInfo> = {};\n for (const attribute of shaderLayout.attributes) {\n attributeInfos[attribute.name] = getAttributeInfoFromLayouts(\n shaderLayout,\n bufferLayout,\n attribute.name\n );\n }\n return attributeInfos;\n}\n\n/** \n * Array indexed by \"location\" holding \"resolved attribute infos\" \n */\nexport function getAttributeInfosByLocation(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[],\n maxVertexAttributes: number = 16\n): AttributeInfo[] {\n const attributeInfos = getAttributeInfosFromLayouts(shaderLayout, bufferLayout);\n const locationInfos: AttributeInfo[] = new Array(maxVertexAttributes).fill(null);\n for (const attributeInfo of Object.values(attributeInfos)) {\n locationInfos[attributeInfo.location] = attributeInfo;\n }\n return locationInfos;\n}\n\n/**\n * Get the combined information from a shader layout and a buffer layout for a specific attribute\n */\nfunction getAttributeInfoFromLayouts(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[],\n name: string\n): AttributeInfo | null {\n const shaderDeclaration = getAttributeFromShaderLayout(shaderLayout, name);\n const bufferMapping: BufferAttributeInfo = getAttributeFromBufferLayout(bufferLayout, name);\n\n // TODO should no longer happen\n if (!shaderDeclaration) {\n // || !bufferMapping\n return null;\n }\n\n const attributeTypeInfo = decodeShaderAttributeType(shaderDeclaration.type);\n const vertexFormat = bufferMapping?.vertexFormat || attributeTypeInfo.defaultVertexFormat;\n const vertexFormatInfo = decodeVertexFormat(vertexFormat);\n\n return {\n attributeName: bufferMapping?.attributeName || shaderDeclaration.name,\n bufferName: bufferMapping?.bufferName || shaderDeclaration.name,\n location: shaderDeclaration.location,\n shaderType: shaderDeclaration.type,\n shaderDataType: attributeTypeInfo.dataType,\n shaderComponents: attributeTypeInfo.components,\n vertexFormat,\n bufferDataType: vertexFormatInfo.type,\n bufferComponents: vertexFormatInfo.components,\n // normalized is a property of the buffer's vertex format\n normalized: vertexFormatInfo.normalized,\n // integer is a property of the shader declaration\n integer: attributeTypeInfo.integer,\n stepMode: bufferMapping?.stepMode || shaderDeclaration.stepMode,\n byteOffset: bufferMapping?.byteOffset || 0,\n byteStride: bufferMapping?.byteStride || 0\n };\n}\n\nfunction getAttributeFromShaderLayout(\n shaderLayout: ShaderLayout,\n name: string\n): AttributeDeclaration | null {\n const attribute = shaderLayout.attributes.find(attr => attr.name === name);\n if (!attribute) {\n log.warn(`shader layout attribute \"${name}\" not present in shader`);\n }\n return attribute || null;\n}\n\nfunction getAttributeFromBufferLayout(\n bufferLayouts: BufferLayout[],\n name: string\n): BufferAttributeInfo | null {\n // Check that bufferLayouts are valid (each either has format or attribute)\n checkBufferLayouts(bufferLayouts);\n\n let bufferLayoutInfo = getAttributeFromShortHand(bufferLayouts, name);\n if (bufferLayoutInfo) {\n return bufferLayoutInfo;\n }\n\n bufferLayoutInfo = getAttributeFromAttributesList(bufferLayouts, name);\n if (bufferLayoutInfo) {\n return bufferLayoutInfo;\n }\n\n // Didn't find...\n log.warn(`layout for attribute \"${name}\" not present in buffer layout`);\n return null;\n}\n\n/** Check that bufferLayouts are valid (each either has format or attribute) */\nfunction checkBufferLayouts(bufferLayouts: BufferLayout[]) {\n for (const bufferLayout of bufferLayouts) {\n if (\n (bufferLayout.attributes && bufferLayout.format) ||\n (!bufferLayout.attributes && !bufferLayout.format)\n ) {\n log.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`);\n }\n }\n}\n\n/** Get attribute from format shorthand if specified */\nfunction getAttributeFromShortHand(\n bufferLayouts: BufferLayout[],\n name: string\n): BufferAttributeInfo | null {\n for (const bufferLayout of bufferLayouts) {\n if (bufferLayout.format && bufferLayout.name === name) {\n return {\n attributeName: bufferLayout.name,\n bufferName: name,\n stepMode: bufferLayout.stepMode,\n vertexFormat: bufferLayout.format,\n // If offset is needed, use `attributes` field.\n byteOffset: 0,\n byteStride: bufferLayout.byteStride || 0\n };\n }\n }\n return null;\n}\n\n/**\n * Search attribute mappings (e.g. interleaved attributes) for buffer mapping.\n * Not the name of the buffer might be the same as one of the interleaved attributes.\n */\nfunction getAttributeFromAttributesList(\n bufferLayouts: BufferLayout[],\n name: string\n): BufferAttributeInfo | null {\n for (const bufferLayout of bufferLayouts) {\n let byteStride: number | undefined = bufferLayout.byteStride;\n\n // Calculate a default byte stride if not provided\n if (typeof bufferLayout.byteStride !== 'number') {\n for (const attributeMapping of bufferLayout.attributes || []) {\n const info = decodeVertexFormat(attributeMapping.format);\n byteStride += info.byteLength;\n }\n }\n\n const attributeMapping = bufferLayout.attributes?.find(mapping => mapping.attribute === name);\n if (attributeMapping) {\n return {\n attributeName: attributeMapping.attribute,\n bufferName: bufferLayout.name,\n stepMode: bufferLayout.stepMode,\n vertexFormat: attributeMapping.format,\n byteOffset: attributeMapping.byteOffset,\n byteStride\n };\n }\n }\n\n return null;\n}\n\n/**\n * Merges an provided shader layout into a base shader layout\n * In WebGL, this allows the auto generated shader layout to be overridden by the application\n * Typically to change the format of the vertex attributes (from float32x4 to uint8x4 etc).\n * @todo Drop this? Aren't all use cases covered by mergeBufferLayout()?\n */\nexport function mergeShaderLayout(\n baseLayout: ShaderLayout,\n overrideLayout: ShaderLayout\n): ShaderLayout {\n // Deep clone the base layout\n const mergedLayout: ShaderLayout = {\n ...baseLayout,\n attributes: baseLayout.attributes.map(attribute => ({...attribute}))\n };\n // Merge the attributes\n for (const attribute of overrideLayout?.attributes || []) {\n const baseAttribute = mergedLayout.attributes.find(attr => attr.name === attribute.name);\n if (!baseAttribute) {\n log.warn(`shader layout attribute ${attribute.name} not present in shader`);\n } else {\n baseAttribute.type = attribute.type || baseAttribute.type;\n baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;\n }\n }\n return mergedLayout;\n}\n"],"mappings":"SAGQA,GAAG;AAAA,SAIHC,yBAAyB;AAAA,SAEzBC,kBAAkB;AAkD1B,OAAO,SAASC,4BAA4BA,CAC1CC,YAA0B,EAC1BC,YAA4B,EACG;EAC/B,MAAMC,cAA6C,GAAG,CAAC,CAAC;EACxD,KAAK,MAAMC,SAAS,IAAIH,YAAY,CAACI,UAAU,EAAE;IAC/CF,cAAc,CAACC,SAAS,CAACE,IAAI,CAAC,GAAGC,2BAA2B,CAC1DN,YAAY,EACZC,YAAY,EACZE,SAAS,CAACE,IACZ,CAAC;EACH;EACA,OAAOH,cAAc;AACvB;AAKA,O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rC,IAAI;MACzDqC,aAAa,CAACtB,QAAQ,GAAGpC,SAAS,CAACoC,QAAQ,IAAIsB,aAAa,CAACtB,QAAQ;IACvE;EACF;EACA,OAAOoB,YAAY;AACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/framebuffer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/framebuffer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,kBAAkB,EAAE,yBAAyB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC3G,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAGlC,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,CAAC,OAAO,GAAG,kBAAkB,CAAC,EAAE,CAAC;IACpD,sBAAsB,CAAC,EAAE,CAAC,OAAO,GAAG,yBAAyB,CAAC,GAAG,IAAI,CAAC;CACvE,CAAC;AAEF;;;GAGG;AACH,8BAAsB,WAAY,SAAQ,QAAQ,CAAC,gBAAgB,CAAC;IAClE,OAAgB,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAMtD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,gBAAgB,EAAE,OAAO,EAAE,CAAM;IACjC,4CAA4C;IAC5C,sBAAsB,EAAE,OAAO,GAAG,IAAI,CAAQ;gBAElC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,gBAAqB;IASxD;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;KAAC,GAAG,IAAI;IACpD,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IACnD,MAAM,IAAI,IAAI;IAkEd,gCAAgC;IAChC,SAAS,CAAC,4BAA4B;IAqBtC,6BAA6B;IAC7B,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAU5D,mCAAmC;IACnC,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAUnE;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAyDjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framebuffer.js","names":["Resource","Texture","log","_Symbol$toStringTag","Symbol","toStringTag","Framebuffer","constructor","device","props","arguments","length","undefined","defaultProps","width","height","colorAttachments","depthStencilAttachment","resize","size","updateSize","Array","isArray","id","resizeAttachments","autoCreateAttachmentTextures","map","attachment","texture","createColorTexture","attachResource","createDepthStencilTexture","format","createTexture","usage","RENDER_ATTACHMENT","i","resizedTexture","_createTexture","destroyAttachedResource"],"sources":["../../../src/adapter/resources/framebuffer.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {ColorTextureFormat, DepthStencilTextureFormat, TextureFormat} from '../types/texture-formats';\nimport type {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\nimport {Texture} from './texture';\nimport {log} from '../../lib/utils/log';\n\nexport type FramebufferProps = ResourceProps & {\n width?: number;\n height?: number;\n colorAttachments?: (Texture | ColorTextureFormat)[];\n depthStencilAttachment?: (Texture | DepthStencilTextureFormat) | null;\n};\n\n/**\n * Create new textures with correct size for all attachments.\n * @note resize() destroys existing textures (if size has changed).\n */\nexport abstract class Framebuffer extends Resource<FramebufferProps> {\n static override defaultProps: Required<FramebufferProps> = {\n ...Resource.defaultProps,\n width: 1,\n height: 1,\n colorAttachments: [], // ['rgba8unorm-unsized'],\n depthStencilAttachment: null // 'depth24plus-stencil8'\n }; \n\n override get [Symbol.toStringTag](): string {\n return 'Framebuffer';\n }\n\n /** Width of all attachments in this framebuffer */\n width: number;\n /** Height of all attachments in this framebuffer */\n height: number;\n /** Color attachments */\n colorAttachments: Texture[] = [];\n /** Depth-stencil attachment, if provided */\n depthStencilAttachment: Texture | null = null;\n\n constructor(device: Device, props: FramebufferProps = {}) {\n super(device, props, Framebuffer.defaultProps);\n this.width = this.props.width;\n this.height = this.props.height;\n\n // NOTE: call from subclass constructor as we cannot call overridden methods here (subclass not yet constructed)\n // this.autoCreateAttachmentTextures();\n }\n\n /**\n * Resizes all attachments\n * @note resize() destroys existing textures (if size has changed).\n */\n resize(size: {width: number; height: number;}): void;\n resize(size: [width: number, height: number]): void;\n resize(): void;\n resize(size?: {width: number; height: number} | [width: number, height: number]): void {\n let updateSize: boolean = !size;\n if (size) {\n const [width, height] = Array.isArray(size) ? size : [size.width, size.height];\n updateSize = updateSize || height !== this.height || width !== this.width;\n this.width = width;\n this.height = height;\n }\n if (updateSize) {\n log.log(2, `Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)();\n this.resizeAttachments(this.width, this.height);\n }\n }\n\n // /** Returns fully populated attachment object. */\n // protected normalizeColorAttachment(\n // attachment: Texture | ColorTextureFormat\n // ): Required<ColorAttachment> {\n\n // const COLOR_ATTACHMENT_DEFAULTS: Required<ColorAttachment> = {\n // texture: undefined!,\n // format: undefined!,\n // clearValue: [0.0, 0.0, 0.0, 0.0],\n // loadOp: 'clear',\n // storeOp: 'store'\n // };\n\n // if (attachment instanceof Texture) {\n // return {...COLOR_ATTACHMENT_DEFAULTS, texture: attachment};\n // }\n // if (typeof attachment === 'string') {\n // return {...COLOR_ATTACHMENT_DEFAULTS, format: attachment};\n // }\n // return {...COLOR_ATTACHMENT_DEFAULTS, ...attachment};\n // }\n\n // /** Wraps texture inside fully populated attachment object. */\n // protected normalizeDepthStencilAttachment(\n // attachment: DepthStencilAttachment | Texture | DepthStencilTextureFormat\n // ): Required<DepthStencilAttachment> {\n // const DEPTH_STENCIL_ATTACHMENT_DEFAULTS: Required<DepthStencilAttachment> = {\n // texture: undefined!,\n // format: undefined!,\n\n // depthClearValue: 1.0,\n // depthLoadOp: 'clear',\n // depthStoreOp: 'store',\n // depthReadOnly: false,\n\n // stencilClearValue: 0,\n // stencilLoadOp: 'clear',\n // stencilStoreOp: 'store',\n // stencilReadOnly: false\n // };\n\n // if (typeof attachment === 'string') {\n // return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, format: attachment};\n // }\n // // @ts-expect-error attachment instanceof Texture doesn't cover Renderbuffer\n // if (attachment.handle || attachment instanceof Texture) {\n // return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, texture: attachment as Texture};\n // }\n // return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, ...attachment};\n // }\n\n /** Auto creates any textures */\n protected autoCreateAttachmentTextures(){\n this.colorAttachments = this.props.colorAttachments.map(attachment => {\n if (typeof attachment === 'string') {\n const texture = this.createColorTexture(attachment);\n this.attachResource(texture);\n return texture;\n }\n return attachment;\n });\n\n if (this.props.depthStencilAttachment) {\n if (typeof this.props.depthStencilAttachment === 'string') {\n const texture = this.createDepthStencilTexture(this.props.depthStencilAttachment);\n this.attachResource(texture);\n this.depthStencilAttachment = texture;\n } else {\n this.depthStencilAttachment = this.props.depthStencilAttachment;\n }\n }\n }\n\n /** Create a color texture */\n protected createColorTexture(format: TextureFormat): Texture {\n return this.device.createTexture({\n id: 'color-attachment',\n usage: Texture.RENDER_ATTACHMENT,\n format,\n width: this.width,\n height: this.height,\n });\n }\n\n /** Create depth stencil texture */\n protected createDepthStencilTexture(format: TextureFormat): Texture {\n return this.device.createTexture({\n id: 'depth-stencil-attachment',\n usage: Texture.RENDER_ATTACHMENT,\n format,\n width: this.width,\n height: this.height\n });\n }\n\n /**\n * Default implementation of resize\n * Creates new textures with correct size for all attachments.\n * and destroys existing textures if owned\n */\n protected resizeAttachments(width: number, height: number): void {\n for (let i = 0; i < this.colorAttachments.length; ++i) {\n if (this.colorAttachments[i]) {\n const resizedTexture = this.device._createTexture({\n ...this.colorAttachments[i].props,\n width,\n height\n });\n this.destroyAttachedResource(this.colorAttachments[i]);\n this.colorAttachments[i] = resizedTexture;\n this.attachResource(resizedTexture);\n }\n }\n\n if (this.depthStencilAttachment) {\n const resizedTexture = this.device._createTexture({\n ...this.depthStencilAttachment.props,\n width,\n height\n });\n this.destroyAttachedResource(this.depthStencilAttachment);\n this.depthStencilAttachment = resizedTexture;\n this.attachResource(resizedTexture);\n }\n }\n\n /** Create a color attachment for WebGL *\n protected override createColorTexture(colorAttachment: Required<ColorAttachment>): Required<ColorAttachment> {\n return this.device._createTexture({\n id: `${this.id}-color`,\n data: null, // reserves texture memory, but texels are undefined\n format,\n // type: GL.UNSIGNED_BYTE,\n width: this.width,\n height: this.height,\n // Note: Mipmapping can be disabled by texture resource when we resize the texture\n // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant\n // behavior we always disable mipmaps.\n mipmaps: false,\n // Set MIN and MAG filtering parameters so mipmaps are not used in sampling.\n // Use LINEAR so subpixel algos like fxaa work.\n // Set WRAP modes that support NPOT textures too.\n sampler: {\n minFilter: 'linear',\n magFilter: 'linear',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge'\n }\n // parameters: {\n // [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,\n // [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,\n // [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,\n // [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO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AAC;EACTC,gBAAgB,EAAE,EAAE;EACpBC,sBAAsB,EAAE;AAC1B,CAAC"}
|
|
1
|
+
{"version":3,"file":"framebuffer.js","names":["Resource","Texture","log","_Symbol$toStringTag","Symbol","toStringTag","Framebuffer","constructor","device","props","arguments","length","undefined","defaultProps","width","height","colorAttachments","depthStencilAttachment","resize","size","updateSize","Array","isArray","id","resizeAttachments","autoCreateAttachmentTextures","map","attachment","texture","createColorTexture","attachResource","createDepthStencilTexture","format","createTexture","usage","RENDER_ATTACHMENT","i","resizedTexture","_createTexture","destroyAttachedResource"],"sources":["../../../src/adapter/resources/framebuffer.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {ColorTextureFormat, DepthStencilTextureFormat, TextureFormat} from '../types/texture-formats';\nimport type {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\nimport {Texture} from './texture';\nimport {log} from '../../lib/utils/log';\n\nexport type FramebufferProps = ResourceProps & {\n width?: number;\n height?: number;\n colorAttachments?: (Texture | ColorTextureFormat)[];\n depthStencilAttachment?: (Texture | DepthStencilTextureFormat) | null;\n};\n\n/**\n * Create new textures with correct size for all attachments.\n * @note resize() destroys existing textures (if size has changed).\n */\nexport abstract class Framebuffer extends Resource<FramebufferProps> {\n static override defaultProps: Required<FramebufferProps> = {\n ...Resource.defaultProps,\n width: 1,\n height: 1,\n colorAttachments: [], // ['rgba8unorm-unsized'],\n depthStencilAttachment: null // 'depth24plus-stencil8'\n }; \n\n override get [Symbol.toStringTag](): string {\n return 'Framebuffer';\n }\n\n /** Width of all attachments in this framebuffer */\n width: number;\n /** Height of all attachments in this framebuffer */\n height: number;\n /** Color attachments */\n colorAttachments: Texture[] = [];\n /** Depth-stencil attachment, if provided */\n depthStencilAttachment: Texture | null = null;\n\n constructor(device: Device, props: FramebufferProps = {}) {\n super(device, props, Framebuffer.defaultProps);\n this.width = this.props.width;\n this.height = this.props.height;\n\n // NOTE: call from subclass constructor as we cannot call overridden methods here (subclass not yet constructed)\n // this.autoCreateAttachmentTextures();\n }\n\n /**\n * Resizes all attachments\n * @note resize() destroys existing textures (if size has changed).\n */\n resize(size: {width: number; height: number;}): void;\n resize(size: [width: number, height: number]): void;\n resize(): void;\n resize(size?: {width: number; height: number} | [width: number, height: number]): void {\n let updateSize: boolean = !size;\n if (size) {\n const [width, height] = Array.isArray(size) ? size : [size.width, size.height];\n updateSize = updateSize || height !== this.height || width !== this.width;\n this.width = width;\n this.height = height;\n }\n if (updateSize) {\n log.log(2, `Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)();\n this.resizeAttachments(this.width, this.height);\n }\n }\n\n // /** Returns fully populated attachment object. */\n // protected normalizeColorAttachment(\n // attachment: Texture | ColorTextureFormat\n // ): Required<ColorAttachment> {\n\n // const COLOR_ATTACHMENT_DEFAULTS: Required<ColorAttachment> = {\n // texture: undefined!,\n // format: undefined!,\n // clearValue: [0.0, 0.0, 0.0, 0.0],\n // loadOp: 'clear',\n // storeOp: 'store'\n // };\n\n // if (attachment instanceof Texture) {\n // return {...COLOR_ATTACHMENT_DEFAULTS, texture: attachment};\n // }\n // if (typeof attachment === 'string') {\n // return {...COLOR_ATTACHMENT_DEFAULTS, format: attachment};\n // }\n // return {...COLOR_ATTACHMENT_DEFAULTS, ...attachment};\n // }\n\n // /** Wraps texture inside fully populated attachment object. */\n // protected normalizeDepthStencilAttachment(\n // attachment: DepthStencilAttachment | Texture | DepthStencilTextureFormat\n // ): Required<DepthStencilAttachment> {\n // const DEPTH_STENCIL_ATTACHMENT_DEFAULTS: Required<DepthStencilAttachment> = {\n // texture: undefined!,\n // format: undefined!,\n\n // depthClearValue: 1.0,\n // depthLoadOp: 'clear',\n // depthStoreOp: 'store',\n // depthReadOnly: false,\n\n // stencilClearValue: 0,\n // stencilLoadOp: 'clear',\n // stencilStoreOp: 'store',\n // stencilReadOnly: false\n // };\n\n // if (typeof attachment === 'string') {\n // return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, format: attachment};\n // }\n // // @ts-expect-error attachment instanceof Texture doesn't cover Renderbuffer\n // if (attachment.handle || attachment instanceof Texture) {\n // return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, texture: attachment as Texture};\n // }\n // return {...DEPTH_STENCIL_ATTACHMENT_DEFAULTS, ...attachment};\n // }\n\n /** Auto creates any textures */\n protected autoCreateAttachmentTextures(){\n this.colorAttachments = this.props.colorAttachments.map(attachment => {\n if (typeof attachment === 'string') {\n const texture = this.createColorTexture(attachment);\n this.attachResource(texture);\n return texture;\n }\n return attachment;\n });\n\n if (this.props.depthStencilAttachment) {\n if (typeof this.props.depthStencilAttachment === 'string') {\n const texture = this.createDepthStencilTexture(this.props.depthStencilAttachment);\n this.attachResource(texture);\n this.depthStencilAttachment = texture;\n } else {\n this.depthStencilAttachment = this.props.depthStencilAttachment;\n }\n }\n }\n\n /** Create a color texture */\n protected createColorTexture(format: TextureFormat): Texture {\n return this.device.createTexture({\n id: 'color-attachment',\n usage: Texture.RENDER_ATTACHMENT,\n format,\n width: this.width,\n height: this.height,\n });\n }\n\n /** Create depth stencil texture */\n protected createDepthStencilTexture(format: TextureFormat): Texture {\n return this.device.createTexture({\n id: 'depth-stencil-attachment',\n usage: Texture.RENDER_ATTACHMENT,\n format,\n width: this.width,\n height: this.height\n });\n }\n\n /**\n * Default implementation of resize\n * Creates new textures with correct size for all attachments.\n * and destroys existing textures if owned\n */\n protected resizeAttachments(width: number, height: number): void {\n for (let i = 0; i < this.colorAttachments.length; ++i) {\n if (this.colorAttachments[i]) {\n const resizedTexture = this.device._createTexture({\n ...this.colorAttachments[i].props,\n width,\n height\n });\n this.destroyAttachedResource(this.colorAttachments[i]);\n this.colorAttachments[i] = resizedTexture;\n this.attachResource(resizedTexture);\n }\n }\n\n if (this.depthStencilAttachment) {\n const resizedTexture = this.device._createTexture({\n ...this.depthStencilAttachment.props,\n width,\n height\n });\n this.destroyAttachedResource(this.depthStencilAttachment);\n this.depthStencilAttachment = resizedTexture;\n this.attachResource(resizedTexture);\n }\n }\n\n /** Create a color attachment for WebGL *\n protected override createColorTexture(colorAttachment: Required<ColorAttachment>): Required<ColorAttachment> {\n return this.device._createTexture({\n id: `${this.id}-color`,\n data: null, // reserves texture memory, but texels are undefined\n format,\n // type: GL.UNSIGNED_BYTE,\n width: this.width,\n height: this.height,\n // Note: Mipmapping can be disabled by texture resource when we resize the texture\n // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant\n // behavior we always disable mipmaps.\n mipmaps: false,\n // Set MIN and MAG filtering parameters so mipmaps are not used in sampling.\n // Use LINEAR so subpixel algos like fxaa work.\n // Set WRAP modes that support NPOT textures too.\n sampler: {\n minFilter: 'linear',\n magFilter: 'linear',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge'\n }\n // parameters: {\n // [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,\n // [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,\n // [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,\n // [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE\n // }\n });\n }\n */\n}\n"],"mappings":";SAKQA,QAAQ;AAAA,SACRC,OAAO;AAAA,SACPC,GAAG;AAAAC,mBAAA,GAsBKC,MAAM,CAACC,WAAW;AATlC,OAAO,MAAeC,WAAW,SAASN,QAAQ,CAAmB;EASnE,KAAAG,mBAAA,IAA4C;IAC1C,OAAO,aAAa;EACtB;EAWAI,WAAWA,CAACC,MAAc,EAAgC;IAAA,IAA9BC,KAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IACtD,KAAK,CAACF,MAAM,EAAEC,KAAK,EAAEH,WAAW,CAACO,YAAY,CAAC;IAAC,KATjDC,KAAK;IAAA,KAELC,MAAM;IAAA,KAENC,gBAAgB,GAAc,EAAE;IAAA,KAEhCC,sBAAsB,GAAmB,IAAI;IAI3C,IAAI,CAACH,KAAK,G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CAAC;QACF,IAAI,CAACwB,uBAAuB,CAAC,IAAI,CAACvB,gBAAgB,CAACoB,CAAC,CAAC,CAAC;QACtD,IAAI,CAACpB,gBAAgB,CAACoB,CAAC,CAAC,GAAGC,cAAc;QACzC,IAAI,CAACP,cAAc,CAACO,cAAc,CAAC;MACrC;IACF;IAEA,IAAI,IAAI,CAACpB,sBAAsB,EAAE;MAC/B,MAAMoB,cAAc,GAAG,IAAI,CAAC7B,MAAM,CAAC8B,cAAc,CAAC;QAChD,GAAG,IAAI,CAACrB,sBAAsB,CAACR,KAAK;QACpCK,KAAK;QACLC;MACF,CAAC,CAAC;MACF,IAAI,CAACwB,uBAAuB,CAAC,IAAI,CAACtB,sBAAsB,CAAC;MACzD,IAAI,CAACA,sBAAsB,GAAGoB,cAAc;MAC5C,IAAI,CAACP,cAAc,CAACO,cAAc,CAAC;IACrC;EACF;AAiCF;AAjNsB/B,WAAW,CACfO,YAAY,GAA+B;EACzD,GAAGb,QAAQ,CAACa,YAAY;EACxBC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,gBAAgB,EAAE,EAAE;EACpBC,sBAAsB,EAAE;AAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sampler.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/sampler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sampler.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/sampler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAEnD,gCAAgC;AAChC,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,QAAQ,GAAG,eAAe,CAAC;AAE9E,6BAA6B;AAC7B,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG;IACzC,iGAAiG;IACjG,IAAI,CAAC,EAAE,eAAe,GAAG,oBAAoB,CAAC;IAC9C,yCAAyC;IACzC,YAAY,CAAC,EAAE,eAAe,GAAG,QAAQ,GAAG,eAAe,CAAC;IAC5D,yCAAyC;IACzC,YAAY,CAAC,EAAE,eAAe,GAAG,QAAQ,GAAG,eAAe,CAAC;IAC5D,yCAAyC;IACzC,YAAY,CAAC,EAAE,eAAe,GAAG,QAAQ,GAAG,eAAe,CAAC;IAE5D,uFAAuF;IACvF,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC,qFAAqF;IACrF,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC,iHAAiH;IACjH,YAAY,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACpC,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8FAA8F;IAC9F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iHAAiH;IACjH,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,aAAa,CAAC,CAAC;AAExE,+BAA+B;AAC/B,8BAAsB,OAAQ,SAAQ,QAAQ,CAAC,YAAY,CAAC;IAC1D,OAAgB,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC,CAalD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;gBAEW,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;CAGhD"}
|
|
@@ -1 +1 @@
|
|
|
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\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":";
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode-shader-types.d.ts","sourceRoot":"","sources":["../../../src/adapter/type-utils/decode-shader-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decode-shader-types.d.ts","sourceRoot":"","sources":["../../../src/adapter/type-utils/decode-shader-types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,uBAAuB,CAAC;AA2BxE,2DAA2D;AAC3D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG;IAAC,IAAI,EAAE,cAAc,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAI7G;AAED,4DAA4D;AAC5D,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAO3D"}
|
|
@@ -1 +1 @@
|
|
|
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\nimport {assert} from '../../lib/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":"
|
|
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 '../../lib/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,CAA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,CAACK,MAAM,CAAC;EACd,OAAOC,OAAO;AAChB;AAGA,OAAO,SAASC,OAAOA,CAACC,IAAY,EAAEC,KAAa,EAAU;EAE3D,QAAQA,KAAK;IACX,KAAK,CAAC;MAAE,OAAOD,IAAI;IACnB,KAAK,CAAC;MAAE,OAAOA,IAAI,GAAIA,IAAI,GAAG,CAAE;IAChC;MAAS,OAAOA,IAAI,GAAI,CAAC,CAAC,GAAIA,IAAI,GAAG,CAAE,IAAI,CAAE;EAC/C;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-types.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/shader-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shader-types.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/shader-types.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,WAAW,GACX,WAAW,GACX,WAAW,GACX,KAAK,GACL,WAAW,GACX,WAAW,GACX,WAAW,GACX,KAAK,GACL,WAAW,GACX,WAAW,GACX,WAAW,GAEX,KAAK,GACL,WAAW,GACX,WAAW,GACX,WAAW,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,KAAK,GACL,KAAK,GACL,KAAK,GACL,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,gDAAgD;AAChD,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GAEP,OAAO,GACP,OAAO,GACP,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-types.js","names":[],"sources":["../../../src/adapter/types/shader-types.ts"],"sourcesContent":["// luma.gl, MIT license\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
|
+
{"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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/texture-formats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"texture-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/texture-formats.ts"],"names":[],"mappings":"AAGA,sBAAsB;AACtB,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,yBAAyB,CAAC;AAE3E,wCAAwC;AACxC,MAAM,MAAM,yBAAyB,GACnC,UAAU,GACV,cAAc,GACd,aAAa,GACb,sBAAsB,GACtB,cAAc,GAEd,uBAAuB,GAEvB,uBAAuB,CAAC;AAE1B,4CAA4C;AAC5C,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,wBAAwB,GAAG,yBAAyB,CAAC;AAEjH,MAAM,MAAM,wBAAwB,GAElC,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GAGR,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,GACV,SAAS,GACT,SAAS,GAGT,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,YAAY,GACZ,WAAW,GACX,WAAW,GACX,YAAY,GACZ,iBAAiB,GAEjB,cAAc,GACd,cAAc,GACd,eAAe,GAGf,UAAU,GACV,UAAU,GACV,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,aAAa,GAGb,YAAY,GACZ,YAAY,GACZ,aAAa,GAIb,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,aAAa,GACb,aAAa,GACb,cAAc,GACd,cAAc,GACd,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,qBAAqB,GAIrB,gBAAgB,GAChB,qBAAqB,GACrB,kBAAkB,GAClB,uBAAuB,GACvB,iBAAiB,GACjB,sBAAsB,GACtB,cAAc,GACd,cAAc,GACd,eAAe,GACf,eAAe,GAIf,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,iBAAiB,GACjB,sBAAsB,GACtB,iBAAiB,GACjB,sBAAsB,GACtB,iBAAiB,GACjB,sBAAsB,GACtB,kBAAkB,GAClB,uBAAuB,GACvB,kBAAkB,GAClB,uBAAuB,GACvB,kBAAkB,GAClB,uBAAuB,CACtB;AAEH,qEAAqE;AACrE,MAAM,MAAM,yBAAyB,GAGnC,mBAAmB,GACnB,oBAAoB,CAGnB;AAEH,wEAAwE;AACxE,MAAM,MAAM,wBAAwB,GAClC,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,oBAAoB,GACpB,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,kBAAkB,GAClB,qBAAqB,GACrB,0BAA0B,GAC1B,uBAAuB,GACvB,wBAAwB,GACxB,uBAAuB,GACvB,wBAAwB,GACxB,sBAAsB,GACtB,qBAAqB,GACrB,sBAAsB,GACtB,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture-formats.js","names":[],"sources":["../../../src/adapter/types/texture-formats.ts"],"sourcesContent":["// luma.gl, MIT license\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
|
+
{"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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertex-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/vertex-formats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vertex-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/types/vertex-formats.ts"],"names":[],"mappings":"AAGA,kFAAkF;AAClF,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,CAAC;AAEd,+DAA+D;AAC/D,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GAIR,SAAS,GACT,SAAS,CACV;AAEH,2EAA2E;AAC3E,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAEpB,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,cAAc,GACd,UAAU,GACV,gBAAgB,GAChB,UAAU,GACV,cAAc,GACd,UAAU,GACV,gBAAgB,GAChB,UAAU,GAEV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GAEX,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,GACV,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,GAWV,WAAW,GACX,WAAW,GACX,SAAS,GACT,WAAW,GACX,WAAW,GACX,WAAW,CACZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertex-formats.js","names":[],"sources":["../../../src/adapter/types/vertex-formats.ts"],"sourcesContent":["// luma.gl, MIT license\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":""}
|
|
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.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAG/B,YAAY,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAGtD,YAAY,EACV,UAAU,EACV,qBAAqB,EACrB,WAAW,EACX,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAGjE,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAEhC,YAAY,EAAC,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACxC,YAAY,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC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oB,EAAC,MAAM,+BAA+B,CAAC;AAI1F;;;GAGG;AACH,eAAO,MAAM,IAAI,MAAO,oBAAoB,WAAW,CAAC;AAIxD,YAAY,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,qCAAqC,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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","UniformBufferLayout","UniformBlock","UniformStore","decodeVertexFormat","decodeTextureFormat","decodeShaderUniformType","decodeShaderAttributeType","formatCompilerLog","getAttributeInfosFromLayouts","mergeShaderLayout","StatsManager","assert","cast","log","uid","isPowerOfTwo","isObjectEmpty","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\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 {\n TypedArray,\n TypedArrayConstructor,\n NumberArray,\n BigIntOrNumberArray\n} from './types';\n\nexport {isTypedArray, isNumberArray} from './lib/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\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';\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 './lib/utils/stats-manager';\nexport {assert} from './lib/utils/assert';\nexport {cast} from './lib/utils/cast';\nexport {log} from './lib/utils/log';\nexport {uid, isPowerOfTwo, isObjectEmpty} from './lib/utils/utils';\nexport {formatValue} from './lib/utils/format-value';\nexport {stubRemovedMethods} from './lib/utils/stub-methods';\nexport {checkProps} from './lib/utils/check-props';\nexport {\n setPathPrefix,\n loadFile,\n loadImage,\n loadImageBitmap,\n loadScript\n} from './lib/utils/load-file';\nexport {getScratchArrayBuffer, getScratchArray, fillArray} from './lib/utils/array-utils-flat';\nexport {makeRandomNumberGenerator, random} from './lib/utils/random';\nexport {deepEqual} from './lib/utils/deep-equal';\n\n// ENGINE - TODO/move to @luma.gl/engine once that module is webgl-independent?\nexport {requestAnimationFrame, cancelAnimationFrame} from './lib/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":"
|
|
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","UniformBufferLayout","UniformBlock","UniformStore","decodeVertexFormat","decodeTextureFormat","decodeShaderUniformType","decodeShaderAttributeType","formatCompilerLog","getAttributeInfosFromLayouts","mergeShaderLayout","StatsManager","assert","cast","log","uid","isPowerOfTwo","isObjectEmpty","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 {\n TypedArray,\n TypedArrayConstructor,\n NumberArray,\n BigIntOrNumberArray\n} from './types';\n\nexport {isTypedArray, isNumberArray} from './lib/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\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';\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 './lib/utils/stats-manager';\nexport {assert} from './lib/utils/assert';\nexport {cast} from './lib/utils/cast';\nexport {log} from './lib/utils/log';\nexport {uid, isPowerOfTwo, isObjectEmpty} from './lib/utils/utils';\nexport {formatValue} from './lib/utils/format-value';\nexport {stubRemovedMethods} from './lib/utils/stub-methods';\nexport {checkProps} from './lib/utils/check-props';\nexport {\n setPathPrefix,\n loadFile,\n loadImage,\n loadImageBitmap,\n loadScript\n} from './lib/utils/load-file';\nexport {getScratchArrayBuffer, getScratchArray, fillArray} from './lib/utils/array-utils-flat';\nexport {makeRandomNumberGenerator, random} from './lib/utils/random';\nexport {deepEqual} from './lib/utils/deep-equal';\n\n// ENGINE - TODO/move to @luma.gl/engine once that module is webgl-independent?\nexport {requestAnimationFrame, cancelAnimationFrame} from './lib/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,SAaPC,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,SAqDXC,mBAAmB;AAAA,SACnBC,YAAY;AAAA,SACZC,YAAY;AAAA,SAGZC,kBAAkB;AAAA,SAClBC,mBAAmB;AAAA,SAGnBC,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,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler-message.d.ts","sourceRoot":"","sources":["../../../src/lib/compiler-log/compiler-message.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compiler-message.d.ts","sourceRoot":"","sources":["../../../src/lib/compiler-log/compiler-message.ts"],"names":[],"mappings":"AAGA,oCAAoC;AACpC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler-message.js","names":[],"sources":["../../../src/lib/compiler-log/compiler-message.ts"],"sourcesContent":["// luma.gl, MIT license\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
|
+
{"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":""}
|
package/dist/lib/luma.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"luma.d.ts","sourceRoot":"","sources":["../../src/lib/luma.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"luma.d.ts","sourceRoot":"","sources":["../../src/lib/luma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,eAAe,CAAC;AAMvC;;;;GAIG;AACH,qBAAa,IAAI;IACf,mCAAmC;IACnC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAa;IAEvC,iBAAiB;IACjB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAO;IAEtB,MAAM,CAAC,eAAe,CAAC,aAAa,EAAE,GAAG,EAAE,GAAyB,IAAI;IAOxE,MAAM,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAKtC,MAAM,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAKtC,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAItD,wCAAwC;WAC3B,YAAY,CAAC,KAAK,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;CAmCpE"}
|
package/dist/lib/luma.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"luma.js","names":["DEFAULT_DEVICE_PROPS","lumaStats","log","assert","deviceList","Map","luma","registerDevices","deviceClasses","deviceClass","type","isSupported","create","set","getAvailableDevices","Array","from","map","Device","getSupportedDevices","filter","setDefaultDeviceProps","props","Object","assign","createDevice","arguments","length","undefined","gl","get","Error","stats"],"sources":["../../src/lib/luma.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {Device, DeviceProps} from '../adapter/device';\nimport {DEFAULT_DEVICE_PROPS} from '../adapter/device';\nimport {StatsManager} from './utils/stats-manager';\nimport {lumaStats} from './utils/stats-manager';\nimport type {Log} from '@probe.gl/log';\nimport {log} from './utils/log';\nimport {assert} from '..';\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(DEFAULT_DEVICE_PROPS, props);\n }\n\n /** Creates a device. Asynchronously. */\n static async createDevice(props: DeviceProps = {}): Promise<Device> {\n props = {...DEFAULT_DEVICE_PROPS, ...props}\n if (props.gl) {\n props.type = 'webgl';\n }\n\n let Device: any;\n switch (props.type) {\n case 'webgpu':\n Device = deviceList.get('webgpu');\n if (Device) {\n return await Device.create(props);\n }\n break;\n case 'webgl':\n case 'webgl1':\n case 'webgl2':\n Device = deviceList.get('webgl');\n if (Device) {\n return await Device.create(props);\n }\n break;\n case 'best-available':\n // Device = deviceList.get('webgpu');\n // if (Device && Device.isSupported()) {\n // return await Device.create(props);\n // }\n Device = deviceList.get('webgl');\n if (Device && Device.isSupported()) {\n return await Device.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":"
|
|
1
|
+
{"version":3,"file":"luma.js","names":["DEFAULT_DEVICE_PROPS","lumaStats","log","assert","deviceList","Map","luma","registerDevices","deviceClasses","deviceClass","type","isSupported","create","set","getAvailableDevices","Array","from","map","Device","getSupportedDevices","filter","setDefaultDeviceProps","props","Object","assign","createDevice","arguments","length","undefined","gl","get","Error","stats"],"sources":["../../src/lib/luma.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Device, DeviceProps} from '../adapter/device';\nimport {DEFAULT_DEVICE_PROPS} from '../adapter/device';\nimport {StatsManager} from './utils/stats-manager';\nimport {lumaStats} from './utils/stats-manager';\nimport type {Log} from '@probe.gl/log';\nimport {log} from './utils/log';\nimport {assert} from '..';\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(DEFAULT_DEVICE_PROPS, props);\n }\n\n /** Creates a device. Asynchronously. */\n static async createDevice(props: DeviceProps = {}): Promise<Device> {\n props = {...DEFAULT_DEVICE_PROPS, ...props}\n if (props.gl) {\n props.type = 'webgl';\n }\n\n let Device: any;\n switch (props.type) {\n case 'webgpu':\n Device = deviceList.get('webgpu');\n if (Device) {\n return await Device.create(props);\n }\n break;\n case 'webgl':\n case 'webgl1':\n case 'webgl2':\n Device = deviceList.get('webgl');\n if (Device) {\n return await Device.create(props);\n }\n break;\n case 'best-available':\n // Device = deviceList.get('webgpu');\n // if (Device && Device.isSupported()) {\n // return await Device.create(props);\n // }\n Device = deviceList.get('webgl');\n if (Device && Device.isSupported()) {\n return await Device.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":"SAIQA,oBAAoB;AAAA,SAEpBC,SAAS;AAAA,SAETC,GAAG;AAAA,SACHC,MAAM;AAEd,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,CAACC,MAAM,IAAIA,MAAM,CAACR,IAAI,CAAC;EAC1D;EAEA,OAAOS,mBAAmBA,CAAA,EAAa;IAErC,OAAOJ,KAAK,CAACC,IAAI,CAACZ,UAAU,CAAC,CAACgB,MAAM,CAACF,MAAM,IAAIA,MAAM,CAACP,WAAW,CAAC,CAAC,CAAC,CAACM,GAAG,CAACC,MAAM,IAAIA,MAAM,CAACR,IAAI,CAAC;EACjG;EAEA,OAAOW,qBAAqBA,CAACC,KAAkB,EAAQ;IACrDC,M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ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"array-equal.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/array-equal.ts"],"names":[],"mappings":"AAKA,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,GAAE,MAAW,WAiBpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-equal.js","names":["isNumberArray","arrayEqual","a","b","limit","arguments","length","undefined","arrayA","arrayB","i"],"sources":["../../../src/lib/utils/array-equal.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport {isNumberArray} from '../utils/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"],"mappings":"
|
|
1
|
+
{"version":3,"file":"array-equal.js","names":["isNumberArray","arrayEqual","a","b","limit","arguments","length","undefined","arrayA","arrayB","i"],"sources":["../../../src/lib/utils/array-equal.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {isNumberArray} from '../utils/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"],"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-utils-flat.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/array-utils-flat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"array-utils-flat.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/array-utils-flat.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,UAAU,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAIzD,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAKrE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAGrE;AAGD,wBAAgB,SAAS,CAAC,OAAO,EAAE;IAAC,MAAM,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,WAAW,CAsB1H"}
|
|
@@ -1 +1 @@
|
|
|
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/lib/utils/array-utils-flat.ts"],"sourcesContent":["// luma.gl, MIT license\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":"
|
|
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/lib/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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-file.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/load-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"load-file.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/load-file.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,QAE3C;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAAA;CAAC,GAAG,WAAW,GAC1D,OAAO,CAAC,GAAG,CAAC,CAKd;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAC,GAC5B,OAAO,CAAC,WAAW,CAAC,CAMtB;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAC,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAY3B;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAkBrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-file.js","names":["pathPrefix","setPathPrefix","prefix","loadFile","url","options","startsWith","dataType","response","fetch","loadImageBitmap","opts","image","Image","crossOrigin","src","decode","createImageBitmap","loadImage","Promise","resolve","reject","onload","onerror","Error","error","loadScript","scriptUrl","scriptId","head","document","getElementsByTagName","script","createElement","setAttribute","id","appendChild"],"sources":["../../../src/lib/utils/load-file.ts"],"sourcesContent":["// luma.gl, MIT license\n\nlet pathPrefix = '';\n\n/**\n * Set a relative path prefix\n */\nexport function setPathPrefix(prefix: string) {\n pathPrefix = prefix;\n}\n\n/**\n * Reads raw file data. Respects setPathPrefix.\n */\nexport async function loadFile(\n url: string,\n options?: {dataType?: 'text' | 'arrayBuffer'} & RequestInit\n): Promise<any> {\n url = url.startsWith('http') ? url : pathPrefix + url;\n const dataType = options?.dataType || 'text';\n const response = await fetch(url, options);\n return await response[dataType]();\n}\n\n/**\n * Loads ImageBitmap asynchronously. Respects setPathPrefix.\n * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'\n * @returns a promise tracking the load\n */\nexport async function loadImageBitmap(\n url: string,\n opts?: {crossOrigin?: string}\n): Promise<ImageBitmap> {\n const image = new Image();\n image.crossOrigin = opts?.crossOrigin || 'anonymous';\n image.src = url.startsWith('http') ? url : pathPrefix + url;\n await image.decode();\n return await createImageBitmap(image);\n}\n\n/**\n * Loads image asynchronously. Respects setPathPrefix.\n * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'\n * @returns a promise tracking the load\n * @deprecated Use `loadImageBitmap()` unless you are supporting old versions of Safari.\n */\nexport async function loadImage(\n url: string,\n opts?: {crossOrigin?: string}\n): Promise<HTMLImageElement> {\n return new Promise((resolve, reject) => {\n try {\n const image = new Image();\n image.onload = () => resolve(image);\n image.onerror = () => reject(new Error(`Could not load image ${url}.`));\n image.crossOrigin = opts?.crossOrigin || 'anonymous';\n image.src = url.startsWith('http') ? url : pathPrefix + url;\n } catch (error) {\n reject(error);\n }\n });\n}\n\n/**\n * Load a script (identified by an url). When the url returns, the\n * content of this file is added into a new script element, attached to the DOM (body element)\n * @param scriptUrl defines the url of the script to laod\n * @param scriptId defines the id of the script element\n */\nexport async function loadScript(scriptUrl: string, scriptId?: string): Promise<Event> {\n const head = document.getElementsByTagName('head')[0];\n if (!head) {\n throw new Error('loadScript');\n }\n\n const script = document.createElement('script');\n script.setAttribute('type', 'text/javascript');\n script.setAttribute('src', scriptUrl);\n if (scriptId) {\n script.id = scriptId;\n }\n\n return new Promise((resolve, reject) => {\n script.onload = resolve;\n script.onerror = (error) => reject(new Error(`Unable to load script '${scriptUrl}': ${error}`));\n head.appendChild(script);\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"load-file.js","names":["pathPrefix","setPathPrefix","prefix","loadFile","url","options","startsWith","dataType","response","fetch","loadImageBitmap","opts","image","Image","crossOrigin","src","decode","createImageBitmap","loadImage","Promise","resolve","reject","onload","onerror","Error","error","loadScript","scriptUrl","scriptId","head","document","getElementsByTagName","script","createElement","setAttribute","id","appendChild"],"sources":["../../../src/lib/utils/load-file.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nlet pathPrefix = '';\n\n/**\n * Set a relative path prefix\n */\nexport function setPathPrefix(prefix: string) {\n pathPrefix = prefix;\n}\n\n/**\n * Reads raw file data. Respects setPathPrefix.\n */\nexport async function loadFile(\n url: string,\n options?: {dataType?: 'text' | 'arrayBuffer'} & RequestInit\n): Promise<any> {\n url = url.startsWith('http') ? url : pathPrefix + url;\n const dataType = options?.dataType || 'text';\n const response = await fetch(url, options);\n return await response[dataType]();\n}\n\n/**\n * Loads ImageBitmap asynchronously. Respects setPathPrefix.\n * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'\n * @returns a promise tracking the load\n */\nexport async function loadImageBitmap(\n url: string,\n opts?: {crossOrigin?: string}\n): Promise<ImageBitmap> {\n const image = new Image();\n image.crossOrigin = opts?.crossOrigin || 'anonymous';\n image.src = url.startsWith('http') ? url : pathPrefix + url;\n await image.decode();\n return await createImageBitmap(image);\n}\n\n/**\n * Loads image asynchronously. Respects setPathPrefix.\n * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'\n * @returns a promise tracking the load\n * @deprecated Use `loadImageBitmap()` unless you are supporting old versions of Safari.\n */\nexport async function loadImage(\n url: string,\n opts?: {crossOrigin?: string}\n): Promise<HTMLImageElement> {\n return new Promise((resolve, reject) => {\n try {\n const image = new Image();\n image.onload = () => resolve(image);\n image.onerror = () => reject(new Error(`Could not load image ${url}.`));\n image.crossOrigin = opts?.crossOrigin || 'anonymous';\n image.src = url.startsWith('http') ? url : pathPrefix + url;\n } catch (error) {\n reject(error);\n }\n });\n}\n\n/**\n * Load a script (identified by an url). When the url returns, the\n * content of this file is added into a new script element, attached to the DOM (body element)\n * @param scriptUrl defines the url of the script to laod\n * @param scriptId defines the id of the script element\n */\nexport async function loadScript(scriptUrl: string, scriptId?: string): Promise<Event> {\n const head = document.getElementsByTagName('head')[0];\n if (!head) {\n throw new Error('loadScript');\n }\n\n const script = document.createElement('script');\n script.setAttribute('type', 'text/javascript');\n script.setAttribute('src', scriptUrl);\n if (scriptId) {\n script.id = scriptId;\n }\n\n return new Promise((resolve, reject) => {\n script.onload = resolve;\n script.onerror = (error) => reject(new Error(`Unable to load script '${scriptUrl}': ${error}`));\n head.appendChild(script);\n });\n}\n"],"mappings":"AAGA,IAAIA,UAAU,GAAG,EAAE;AAKnB,OAAO,SAASC,aAAaA,CAACC,MAAc,EAAE;EAC5CF,UAAU,GAAGE,MAAM;AACrB;AAKA,OAAO,eAAeC,QAAQA,CAC5BC,GAAW,EACXC,OAA2D,EAC7C;EACdD,GAAG,GAAGA,GAAG,CAACE,UAAU,CAAC,MAAM,CAAC,GAAGF,GAAG,GAAGJ,UAAU,GAAGI,GAAG;EACrD,MAAMG,QAAQ,GAAG,CAAAF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,QAAQ,KAAI,MAAM;EAC5C,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAACL,GAAG,EAAEC,OAAO,CAAC;EAC1C,OAAO,MAAMG,QAAQ,CAACD,QAAQ,CAAC,CAAC,CAAC;AACnC;AAOA,OAAO,eAAeG,eAAeA,CACnCN,GAAW,EACXO,IAA6B,EACP;EACtB,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAC;EACzBD,KAAK,CAACE,WAAW,GAAG,CAAAH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,WAAW,KAAI,WAAW;EACpDF,KAAK,CAACG,GAAG,GAAGX,GAAG,CAACE,UAAU,CAAC,MAAM,CAAC,GAAGF,GAAG,GAAGJ,UAAU,GAAGI,GAAG;EAC3D,MAAMQ,KAAK,CAACI,MAAM,CAAC,CAAC;EACpB,OAAO,MAAMC,iBAAiB,CAACL,KAAK,CAAC;AACvC;AAQA,OAAO,eAAeM,SAASA,CAC7Bd,GAAW,EACXO,IAA6B,EACF;EAC3B,OAAO,IAAIQ,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtC,IAAI;MACF,MAAMT,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAC;MACzBD,KAAK,CAACU,MAAM,GAA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-1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/utils.ts"],"names":[],"mappings":"AAKA;;;;IAII;AACJ,wBAAgB,GAAG,CAAC,EAAE,GAAE,MAAa,GAAG,MAAM,CAI7C;AAED;;;;IAII;AACJ,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CASlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["uidCounters","uid","id","arguments","length","undefined","count","isPowerOfTwo","n","isObjectEmpty","obj","isEmpty","key"],"sources":["../../../src/lib/utils/utils.ts"],"sourcesContent":["// luma.gl, MIT license\n\nconst uidCounters: Record<string, number> = {};\n\n/**\n * Returns a UID.\n * @param id= - Identifier base name\n * @return uid\n **/\nexport function uid(id: string = 'id'): string {\n uidCounters[id] = uidCounters[id] || 1;\n const count = uidCounters[id]++;\n return `${id}-${count}`;\n}\n\n/**\n * Verifies if a given number is power of two or not.\n * @param n - The number to check.\n * @return Returns true if the given number is power of 2, false otherwise.\n **/\nexport function isPowerOfTwo(n: number): boolean {\n return (n > 0) && (n & (n - 1)) === 0;\n}\n\n/** Returns true if given object is empty, false otherwise. */\nexport function isObjectEmpty(obj: object): boolean {\n let isEmpty = true;\n // @ts-ignore key is unused\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const key in obj) {\n isEmpty = false;\n break;\n }\n return isEmpty;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["uidCounters","uid","id","arguments","length","undefined","count","isPowerOfTwo","n","isObjectEmpty","obj","isEmpty","key"],"sources":["../../../src/lib/utils/utils.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nconst uidCounters: Record<string, number> = {};\n\n/**\n * Returns a UID.\n * @param id= - Identifier base name\n * @return uid\n **/\nexport function uid(id: string = 'id'): string {\n uidCounters[id] = uidCounters[id] || 1;\n const count = uidCounters[id]++;\n return `${id}-${count}`;\n}\n\n/**\n * Verifies if a given number is power of two or not.\n * @param n - The number to check.\n * @return Returns true if the given number is power of 2, false otherwise.\n **/\nexport function isPowerOfTwo(n: number): boolean {\n return (n > 0) && (n & (n - 1)) === 0;\n}\n\n/** Returns true if given object is empty, false otherwise. */\nexport function isObjectEmpty(obj: object): boolean {\n let isEmpty = true;\n // @ts-ignore key is unused\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const key in obj) {\n isEmpty = false;\n break;\n }\n return isEmpty;\n}\n"],"mappings":"AAGA,MAAMA,WAAmC,GAAG,CAAC,CAAC;AAO9C,OAAO,SAASC,GAAGA,CAAA,EAA4B;EAAA,IAA3BC,EAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EACnCH,WAAW,CAACE,EAAE,CAAC,GAAGF,WAAW,CAACE,EAAE,CAAC,IAAI,CAAC;EACtC,MAAMI,KAAK,GAAGN,WAAW,CAACE,EAAE,CAAC,EAAE;EAC/B,OAAQ,GAAEA,EAAG,IAAGI,KAAM,EAAC;AACzB;AAOA,OAAO,SAASC,YAAYA,CAACC,CAAS,EAAW;EAC/C,OAAQA,CAAC,GAAG,CAAC,IAAK,CAACA,CAAC,GAAIA,CAAC,GAAG,CAAE,MAAM,CAAC;AACvC;AAGA,OAAO,SAASC,aAAaA,CAACC,GAAW,EAAW;EAClD,IAAIC,OAAO,GAAG,IAAI;EAGlB,KAAK,MAAMC,GAAG,IAAIF,GAAG,EAAE;IACrBC,OAAO,GAAG,KAAK;IACf;EACF;EACA,OAAOA,OAAO;AAChB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/core",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.40",
|
|
4
4
|
"description": "luma.gl API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
43
43
|
"@types/offscreencanvas": "^2019.6.4"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "5a6f2bc7a4d24a65b74ae905844ad5bfc36c5645"
|
|
46
46
|
}
|
package/src/index.ts
CHANGED
package/src/lib/luma.ts
CHANGED