@luma.gl/core 9.0.0-alpha.30 → 9.0.0-alpha.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts +43 -0
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +1 -0
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.js +96 -0
- package/dist/adapter/attribute-utils/get-attribute-from-layouts.js.map +1 -0
- package/dist/adapter/device.d.ts +9 -1
- package/dist/adapter/device.d.ts.map +1 -1
- package/dist/adapter/device.js +1 -0
- package/dist/adapter/device.js.map +1 -1
- package/dist/adapter/resources/buffer.d.ts +1 -0
- package/dist/adapter/resources/buffer.d.ts.map +1 -1
- package/dist/adapter/resources/buffer.js +11 -11
- package/dist/adapter/resources/buffer.js.map +1 -1
- package/dist/adapter/resources/command-buffer.d.ts +1 -0
- package/dist/adapter/resources/command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/command-buffer.js +9 -6
- package/dist/adapter/resources/command-buffer.js.map +1 -1
- package/dist/adapter/resources/command-encoder.d.ts +3 -1
- package/dist/adapter/resources/command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/command-encoder.js +11 -7
- package/dist/adapter/resources/command-encoder.js.map +1 -1
- package/dist/adapter/resources/compute-pass.d.ts +1 -0
- package/dist/adapter/resources/compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pass.js +9 -3
- package/dist/adapter/resources/compute-pass.js.map +1 -1
- package/dist/adapter/resources/compute-pipeline.d.ts +7 -2
- package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/compute-pipeline.js +9 -7
- package/dist/adapter/resources/compute-pipeline.js.map +1 -1
- package/dist/adapter/resources/external-texture.d.ts +1 -0
- package/dist/adapter/resources/external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/external-texture.js +11 -8
- package/dist/adapter/resources/external-texture.js.map +1 -1
- package/dist/adapter/resources/framebuffer.d.ts +1 -0
- package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/framebuffer.js +9 -9
- package/dist/adapter/resources/framebuffer.js.map +1 -1
- package/dist/adapter/resources/render-pipeline.d.ts +17 -16
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.js +18 -19
- package/dist/adapter/resources/render-pipeline.js.map +1 -1
- package/dist/adapter/resources/resource.d.ts +0 -5
- package/dist/adapter/resources/resource.d.ts.map +1 -1
- package/dist/adapter/resources/resource.js +5 -6
- package/dist/adapter/resources/resource.js.map +1 -1
- package/dist/adapter/resources/sampler.d.ts +14 -0
- package/dist/adapter/resources/sampler.d.ts.map +1 -1
- package/dist/adapter/resources/sampler.js +15 -12
- package/dist/adapter/resources/sampler.js.map +1 -1
- package/dist/adapter/resources/shader.d.ts +1 -0
- package/dist/adapter/resources/shader.d.ts.map +1 -1
- package/dist/adapter/resources/shader.js +10 -10
- package/dist/adapter/resources/shader.js.map +1 -1
- package/dist/adapter/resources/texture.d.ts +5 -0
- package/dist/adapter/resources/texture.d.ts.map +1 -1
- package/dist/adapter/resources/texture.js +18 -18
- package/dist/adapter/resources/texture.js.map +1 -1
- package/dist/adapter/type-utils/decode-attribute-type.d.ts +20 -0
- package/dist/adapter/type-utils/decode-attribute-type.d.ts.map +1 -0
- package/dist/adapter/type-utils/decode-attribute-type.js +60 -0
- package/dist/adapter/type-utils/decode-attribute-type.js.map +1 -0
- package/dist/adapter/type-utils/decode-data-type.d.ts.map +1 -0
- package/dist/adapter/type-utils/decode-data-type.js.map +1 -0
- package/dist/adapter/{utils → type-utils}/decode-texture-format.d.ts +1 -1
- package/dist/adapter/type-utils/decode-texture-format.d.ts.map +1 -0
- package/dist/adapter/type-utils/decode-texture-format.js.map +1 -0
- package/dist/adapter/type-utils/decode-uniform-type.d.ts +9 -0
- package/dist/adapter/type-utils/decode-uniform-type.d.ts.map +1 -0
- package/dist/adapter/{utils/decode-uniform-format.js → type-utils/decode-uniform-type.js} +23 -23
- package/dist/adapter/type-utils/decode-uniform-type.js.map +1 -0
- package/dist/adapter/{utils → type-utils}/decode-vertex-format.d.ts +1 -1
- package/dist/adapter/type-utils/decode-vertex-format.d.ts.map +1 -0
- package/dist/adapter/type-utils/decode-vertex-format.js.map +1 -0
- package/dist/adapter/type-utils/wgsl-utils.d.ts +4 -0
- package/dist/adapter/type-utils/wgsl-utils.d.ts.map +1 -0
- package/dist/adapter/type-utils/wgsl-utils.js +15 -0
- package/dist/adapter/type-utils/wgsl-utils.js.map +1 -0
- package/dist/adapter/types/accessor.js.map +1 -1
- package/dist/adapter/types/shader-formats.d.ts +21 -0
- package/dist/adapter/types/shader-formats.d.ts.map +1 -0
- package/dist/adapter/types/shader-formats.js +2 -0
- package/dist/adapter/types/shader-formats.js.map +1 -0
- package/dist/adapter/types/shader-layout.d.ts +70 -59
- package/dist/adapter/types/shader-layout.d.ts.map +1 -1
- package/dist/adapter/types/shader-layout.js.map +1 -1
- package/dist/adapter/types/types.d.ts +1 -1
- package/dist/adapter/types/types.d.ts.map +1 -1
- package/dist/adapter/types/types.js.map +1 -1
- package/dist/adapter/types/vertex-formats.d.ts +9 -3
- package/dist/adapter/types/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/types/vertex-formats.js.map +1 -1
- package/dist/dist.dev.js +326 -148
- package/dist/index.cjs +299 -123
- package/dist/index.d.ts +13 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/uniform-buffer-layout.d.ts +3 -3
- package/dist/lib/uniform-buffer-layout.d.ts.map +1 -1
- package/dist/lib/uniform-buffer-layout.js +2 -2
- package/dist/lib/uniform-buffer-layout.js.map +1 -1
- package/dist.min.js +10 -9
- package/package.json +2 -2
- package/src/adapter/attribute-utils/get-attribute-from-layouts.ts +184 -0
- package/src/adapter/device.ts +7 -1
- package/src/adapter/resources/buffer.ts +12 -12
- package/src/adapter/resources/command-buffer.ts +6 -6
- package/src/adapter/resources/command-encoder.ts +9 -8
- package/src/adapter/resources/compute-pass.ts +6 -2
- package/src/adapter/resources/compute-pipeline.ts +16 -13
- package/src/adapter/resources/external-texture.ts +8 -9
- package/src/adapter/resources/framebuffer.ts +10 -10
- package/src/adapter/resources/render-pipeline.ts +45 -49
- package/src/adapter/resources/resource.ts +5 -11
- package/src/adapter/resources/sampler.ts +32 -17
- package/src/adapter/resources/shader.ts +11 -11
- package/src/adapter/resources/texture.ts +26 -29
- package/src/adapter/type-utils/decode-attribute-type.ts +82 -0
- package/src/adapter/{utils → type-utils}/decode-texture-format.ts +1 -1
- package/src/adapter/type-utils/decode-uniform-type.ts +44 -0
- package/src/adapter/{utils → type-utils}/decode-vertex-format.ts +2 -2
- package/src/adapter/type-utils/wgsl-utils.ts +18 -0
- package/src/adapter/types/accessor.ts +1 -1
- package/src/adapter/types/shader-formats.ts +76 -0
- package/src/adapter/types/shader-layout.ts +133 -60
- package/src/adapter/types/types.ts +1 -1
- package/src/adapter/types/vertex-formats.ts +78 -57
- package/src/index.ts +45 -25
- package/src/lib/uniform-buffer-layout.ts +5 -5
- package/dist/adapter/types/uniform-formats.d.ts +0 -3
- package/dist/adapter/types/uniform-formats.d.ts.map +0 -1
- package/dist/adapter/types/uniform-formats.js +0 -2
- package/dist/adapter/types/uniform-formats.js.map +0 -1
- package/dist/adapter/utils/decode-data-type.d.ts.map +0 -1
- package/dist/adapter/utils/decode-data-type.js.map +0 -1
- package/dist/adapter/utils/decode-texture-format.d.ts.map +0 -1
- package/dist/adapter/utils/decode-texture-format.js.map +0 -1
- package/dist/adapter/utils/decode-uniform-format.d.ts +0 -9
- package/dist/adapter/utils/decode-uniform-format.d.ts.map +0 -1
- package/dist/adapter/utils/decode-uniform-format.js.map +0 -1
- package/dist/adapter/utils/decode-vertex-format.d.ts.map +0 -1
- package/dist/adapter/utils/decode-vertex-format.js.map +0 -1
- package/src/adapter/types/uniform-formats.ts +0 -31
- package/src/adapter/utils/decode-uniform-format.ts +0 -43
- /package/dist/adapter/{utils → type-utils}/decode-data-type.d.ts +0 -0
- /package/dist/adapter/{utils → type-utils}/decode-data-type.js +0 -0
- /package/dist/adapter/{utils → type-utils}/decode-texture-format.js +0 -0
- /package/dist/adapter/{utils → type-utils}/decode-vertex-format.js +0 -0
- /package/src/adapter/{utils → type-utils}/decode-data-type.ts +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ShaderLayout, BufferLayout } from '../types/shader-layout';
|
|
2
|
+
import type { ShaderDataType, ShaderAttributeType } from '../types/shader-formats';
|
|
3
|
+
import type { VertexFormat, VertexType } from '../types/vertex-formats';
|
|
4
|
+
/** Resolved info for a buffer / attribute combination to help backend configure it correctly */
|
|
5
|
+
export type AttributeInfo = {
|
|
6
|
+
/** Attribute name */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Location in shader */
|
|
9
|
+
location: number;
|
|
10
|
+
/** Type / precision used in shader (buffer values may be converted) */
|
|
11
|
+
shaderType: ShaderAttributeType;
|
|
12
|
+
/** Calculations are done in this type in the shader's attribute declaration */
|
|
13
|
+
shaderDataType: ShaderDataType;
|
|
14
|
+
/** Components refer to the number of components in the shader's attribute declaration */
|
|
15
|
+
shaderComponents: 1 | 2 | 3 | 4;
|
|
16
|
+
/** It is the shader attribute declaration that determines whether GPU will process as integer or float */
|
|
17
|
+
integer: boolean;
|
|
18
|
+
/** BufferName */
|
|
19
|
+
bufferName: String;
|
|
20
|
+
/** Format of buffer data */
|
|
21
|
+
vertexFormat: VertexFormat;
|
|
22
|
+
/** Memory data type refers to the data type in the buffer */
|
|
23
|
+
bufferDataType: VertexType;
|
|
24
|
+
/** Components refer to the number of components in the buffer's vertex format */
|
|
25
|
+
bufferComponents: 1 | 2 | 3 | 4;
|
|
26
|
+
/** Normalization is encoded in the buffer layout's vertex format... */
|
|
27
|
+
normalized: boolean;
|
|
28
|
+
/** If not specified, the step mode is inferred from the attribute name in the shader (contains string instance) */
|
|
29
|
+
stepMode: 'vertex' | 'instance';
|
|
30
|
+
/** The byteOffset is encoded in or calculated from the buffer layout */
|
|
31
|
+
byteOffset: number;
|
|
32
|
+
/** The byteStride is encoded in or calculated from the buffer layout */
|
|
33
|
+
byteStride: number;
|
|
34
|
+
};
|
|
35
|
+
export declare function getAttributeInfosFromLayouts(shaderLayout: ShaderLayout, bufferLayout: BufferLayout[]): Record<string, AttributeInfo>;
|
|
36
|
+
/**
|
|
37
|
+
* Merges an provided shader layout into a base shader layout
|
|
38
|
+
* In WebGL, this allows the auto generated shader layout to be overridden by the application
|
|
39
|
+
* Typically to change the format of the vertex attributes (from float32x4 to uint8x4 etc).
|
|
40
|
+
* @todo Drop this? Aren't all use cases covered by mergeBufferLayout()?
|
|
41
|
+
*/
|
|
42
|
+
export declare function mergeShaderLayout(baseLayout: ShaderLayout, overrideLayout: ShaderLayout): ShaderLayout;
|
|
43
|
+
//# sourceMappingURL=get-attribute-from-layouts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-attribute-from-layouts.d.ts","sourceRoot":"","sources":["../../../src/adapter/attribute-utils/get-attribute-from-layouts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAwB,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAEjF,OAAO,KAAK,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAGtE,gGAAgG;AAChG,MAAM,MAAM,aAAa,GAAG;IAC1B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,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;AAEF,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAAE,GAC3B,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAU/B;AAoGD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,YAAY,EACxB,cAAc,EAAE,YAAY,GAC3B,YAAY,CAiBd"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { log } from "../../lib/utils/log.js";
|
|
2
|
+
import { decodeShaderAttributeType } from "../type-utils/decode-attribute-type.js";
|
|
3
|
+
import { decodeVertexFormat } from "../type-utils/decode-vertex-format.js";
|
|
4
|
+
export function getAttributeInfosFromLayouts(shaderLayout, bufferLayout) {
|
|
5
|
+
const attributeInfos = {};
|
|
6
|
+
for (const attribute of shaderLayout.attributes) {
|
|
7
|
+
attributeInfos[attribute.name] = getAttributeInfoFromLayouts(shaderLayout, bufferLayout, attribute.name);
|
|
8
|
+
}
|
|
9
|
+
return attributeInfos;
|
|
10
|
+
}
|
|
11
|
+
function getAttributeInfoFromLayouts(shaderLayout, bufferLayout, name) {
|
|
12
|
+
const shaderDeclaration = getAttributeFromShaderLayout(shaderLayout, name);
|
|
13
|
+
const bufferMapping = getAttributeFromBufferLayout(bufferLayout, name);
|
|
14
|
+
if (!shaderDeclaration) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const attributeTypeInfo = decodeShaderAttributeType(shaderDeclaration.type);
|
|
18
|
+
const vertexFormat = (bufferMapping === null || bufferMapping === void 0 ? void 0 : bufferMapping.vertexFormat) || attributeTypeInfo.defaultVertexFormat;
|
|
19
|
+
const vertexFormatInfo = decodeVertexFormat(vertexFormat);
|
|
20
|
+
return {
|
|
21
|
+
name,
|
|
22
|
+
bufferName: (bufferMapping === null || bufferMapping === void 0 ? void 0 : bufferMapping.name) || name,
|
|
23
|
+
location: shaderDeclaration.location,
|
|
24
|
+
shaderType: shaderDeclaration.type,
|
|
25
|
+
shaderDataType: attributeTypeInfo.dataType,
|
|
26
|
+
shaderComponents: attributeTypeInfo.components,
|
|
27
|
+
vertexFormat,
|
|
28
|
+
bufferDataType: vertexFormatInfo.type,
|
|
29
|
+
bufferComponents: vertexFormatInfo.components,
|
|
30
|
+
normalized: vertexFormatInfo.normalized,
|
|
31
|
+
integer: attributeTypeInfo.integer,
|
|
32
|
+
stepMode: (bufferMapping === null || bufferMapping === void 0 ? void 0 : bufferMapping.stepMode) || shaderDeclaration.stepMode,
|
|
33
|
+
byteOffset: (bufferMapping === null || bufferMapping === void 0 ? void 0 : bufferMapping.byteOffset) || 0,
|
|
34
|
+
byteStride: (bufferMapping === null || bufferMapping === void 0 ? void 0 : bufferMapping.byteStride) || 0
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function getAttributeFromShaderLayout(shaderLayout, name) {
|
|
38
|
+
const attribute = shaderLayout.attributes.find(attr => attr.name === name);
|
|
39
|
+
if (!attribute) {
|
|
40
|
+
log.warn("shader layout attribute \"".concat(name, "\" not present in shader"));
|
|
41
|
+
}
|
|
42
|
+
return attribute || null;
|
|
43
|
+
}
|
|
44
|
+
function getAttributeFromBufferLayout(bufferLayout, name) {
|
|
45
|
+
for (const bufferMapping of bufferLayout) {
|
|
46
|
+
if (bufferMapping.name === name) {
|
|
47
|
+
return {
|
|
48
|
+
name: bufferMapping.name,
|
|
49
|
+
bufferName: name,
|
|
50
|
+
vertexFormat: bufferMapping.format,
|
|
51
|
+
byteOffset: bufferMapping.byteOffset || 0,
|
|
52
|
+
byteStride: bufferMapping.byteStride || 0
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
let nextByteOffset = bufferMapping.byteOffset || 0;
|
|
56
|
+
let byteStride = 0;
|
|
57
|
+
for (const interleavedMapping of bufferMapping.attributes || []) {
|
|
58
|
+
const info = decodeVertexFormat(interleavedMapping.format);
|
|
59
|
+
byteStride += info.byteLength;
|
|
60
|
+
}
|
|
61
|
+
for (const interleavedMapping of bufferMapping.attributes || []) {
|
|
62
|
+
const byteOffset = nextByteOffset;
|
|
63
|
+
nextByteOffset += (interleavedMapping === null || interleavedMapping === void 0 ? void 0 : interleavedMapping.byteStrideOffset) || decodeVertexFormat(interleavedMapping.format).byteLength;
|
|
64
|
+
if (interleavedMapping.name === name) {
|
|
65
|
+
return {
|
|
66
|
+
name: bufferMapping.name,
|
|
67
|
+
bufferName: name,
|
|
68
|
+
vertexFormat: interleavedMapping.format,
|
|
69
|
+
byteOffset,
|
|
70
|
+
byteStride: bufferMapping.byteStride || byteStride
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
log.warn("layout for attribute \"".concat(name, "\" not present in buffer layout"));
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
export function mergeShaderLayout(baseLayout, overrideLayout) {
|
|
79
|
+
const mergedLayout = {
|
|
80
|
+
...baseLayout,
|
|
81
|
+
attributes: baseLayout.attributes.map(attribute => ({
|
|
82
|
+
...attribute
|
|
83
|
+
}))
|
|
84
|
+
};
|
|
85
|
+
for (const attribute of (overrideLayout === null || overrideLayout === void 0 ? void 0 : overrideLayout.attributes) || []) {
|
|
86
|
+
const baseAttribute = mergedLayout.attributes.find(attr => attr.name === attribute.name);
|
|
87
|
+
if (!baseAttribute) {
|
|
88
|
+
log.warn("shader layout attribute ".concat(attribute.name, " not present in shader"));
|
|
89
|
+
} else {
|
|
90
|
+
baseAttribute.type = attribute.type || baseAttribute.type;
|
|
91
|
+
baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return mergedLayout;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=get-attribute-from-layouts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-attribute-from-layouts.js","names":["log","decodeShaderAttributeType","decodeVertexFormat","getAttributeInfosFromLayouts","shaderLayout","bufferLayout","attributeInfos","attribute","attributes","name","getAttributeInfoFromLayouts","shaderDeclaration","getAttributeFromShaderLayout","bufferMapping","getAttributeFromBufferLayout","attributeTypeInfo","type","vertexFormat","defaultVertexFormat","vertexFormatInfo","bufferName","location","shaderType","shaderDataType","dataType","shaderComponents","components","bufferDataType","bufferComponents","normalized","integer","stepMode","byteOffset","byteStride","find","attr","warn","concat","format","nextByteOffset","interleavedMapping","info","byteLength","byteStrideOffset","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, BufferLayout} from '../types/shader-layout';\nimport type {ShaderDataType, ShaderAttributeType} from '../types/shader-formats';\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 name: 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\nexport function getAttributeInfosFromLayouts(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[]\n): Record<string, AttributeInfo> {\n const attributeInfos: Record<string, ReturnType<typeof getAttributeInfoFromLayouts>> = {};\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 * 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: Partial<AttributeInfo> = 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 name,\n bufferName: bufferMapping?.name || 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 bufferLayout: BufferLayout[],\n name: string\n): Partial<AttributeInfo> | null {\n for (const bufferMapping of bufferLayout) {\n // If this is the mapping return\n if (bufferMapping.name === name) {\n return {\n name: bufferMapping.name,\n bufferName: name,\n vertexFormat: bufferMapping.format,\n byteOffset: bufferMapping.byteOffset || 0,\n byteStride: bufferMapping.byteStride || 0\n };\n }\n\n // Search interleaved attributes for buffer mapping\n let nextByteOffset = bufferMapping.byteOffset || 0;\n let byteStride = 0;\n for (const interleavedMapping of bufferMapping.attributes || []) {\n const info = decodeVertexFormat(interleavedMapping.format);\n byteStride += info.byteLength;\n }\n for (const interleavedMapping of bufferMapping.attributes || []) {\n const byteOffset = nextByteOffset;\n nextByteOffset +=\n interleavedMapping?.byteStrideOffset ||\n decodeVertexFormat(interleavedMapping.format).byteLength;\n // const interleavedMapping = bufferMapping.attributes?.find(attr => attr.name === name);\n if (interleavedMapping.name === name) {\n return {\n name: bufferMapping.name,\n bufferName: name,\n vertexFormat: interleavedMapping.format,\n byteOffset,\n byteStride: bufferMapping.byteStride || byteStride\n };\n }\n }\n }\n\n // Didn't return...\n log.warn(`layout for attribute \"${name}\" not present in buffer layout`);\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,SAGHC,yBAAyB;AAAA,SAEzBC,kBAAkB;AAqC1B,OAAO,SAASC,4BAA4BA,CAC1CC,YAA0B,EAC1BC,YAA4B,EACG;EAC/B,MAAMC,cAA8E,GAAG,CAAC,CAAC;EACzF,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,SAASI,2BAA2BA,CAClCN,YAA0B,EAC1BC,YAA4B,EAC5BI,IAAY,EACU;EACtB,MAAME,iBAAiB,GAAGC,4BAA4B,CAACR,YAAY,EAAEK,IAAI,CAAC;EAC1E,MAAMI,aAAqC,GAAGC,4BAA4B,CAACT,YAAY,EAAEI,IAAI,CAAC;EAG9F,IAAI,CAACE,iB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vCN,UAAU;UACVC,UAAU,EAAEpB,aAAa,CAACoB,UAAU,IAAIA;QAC1C,CAAC;MACH;IACF;EACF;EAGAjC,GAAG,CAACoC,IAAI,2BAAAC,MAAA,CAA0B5B,IAAI,oCAAgC,CAAC;EACvE,OAAO,IAAI;AACb;AAQA,OAAO,SAASmC,iBAAiBA,CAC/BC,UAAwB,EACxBC,cAA4B,EACd;EAEd,MAAMC,YAA0B,GAAG;IACjC,GAAGF,UAAU;IACbrC,UAAU,EAAEqC,UAAU,CAACrC,UAAU,CAACwC,GAAG,CAACzC,SAAS,KAAK;MAAC,GAAGA;IAAS,CAAC,CAAC;EACrE,CAAC;EAED,KAAK,MAAMA,SAAS,IAAI,CAAAuC,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEtC,UAAU,KAAI,EAAE,EAAE;IACxD,MAAMyC,aAAa,GAAGF,YAAY,CAACvC,UAAU,CAAC0B,IAAI,CAACC,IAAI,IAAIA,IAAI,CAAC1B,IAAI,KAAKF,SAAS,CAACE,IAAI,CAAC;IACxF,IAAI,CAACwC,aAAa,EAAE;MAClBjD,GAAG,CAACoC,IAAI,4BAAAC,MAAA,CAA4B9B,SAAS,CAACE,IAAI,2BAAwB,CAAC;IAC7E,CAAC,MAAM;MACLwC,aAAa,CAACjC,IAAI,GAAGT,SAAS,CAACS,IAAI,IAAIiC,aAAa,CAACjC,IAAI;MACzDiC,aAAa,CAAClB,QAAQ,GAAGxB,SAAS,CAACwB,QAAQ,IAAIkB,aAAa,CAAClB,QAAQ;IACvE;EACF;EACA,OAAOgB,YAAY;AACrB"}
|
package/dist/adapter/device.d.ts
CHANGED
|
@@ -87,11 +87,19 @@ export declare abstract class Device {
|
|
|
87
87
|
get [Symbol.toStringTag](): string;
|
|
88
88
|
static VERSION: string;
|
|
89
89
|
constructor(props: DeviceProps);
|
|
90
|
+
/** id of this device, primarily for debugging */
|
|
90
91
|
readonly id: string;
|
|
92
|
+
/** stats */
|
|
91
93
|
readonly statsManager: StatsManager;
|
|
94
|
+
/** A copy of the device props */
|
|
92
95
|
readonly props: Required<DeviceProps>;
|
|
96
|
+
/** Available for the application to store data on the device */
|
|
93
97
|
userData: {
|
|
94
|
-
[key: string]:
|
|
98
|
+
[key: string]: unknown;
|
|
99
|
+
};
|
|
100
|
+
/** Used by other luma.gl modules to store data on the device */
|
|
101
|
+
_lumaData: {
|
|
102
|
+
[key: string]: unknown;
|
|
95
103
|
};
|
|
96
104
|
/** Information about the device (vendor, versions etc) */
|
|
97
105
|
abstract info: DeviceInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/adapter/device.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAY,MAAM,4BAA4B,CAAC;AAGnE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AACrF,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAC,MAAM,8BAA8B,CAAC;AACxF,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAC,eAAe,EAAE,oBAAoB,EAAC,MAAM,8BAA8B,CAAC;AACxF,OAAO,KAAK,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC3E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
@@ -29,6 +29,7 @@ export class Device {
|
|
|
29
29
|
_defineProperty(this, "statsManager", lumaStats);
|
|
30
30
|
_defineProperty(this, "props", void 0);
|
|
31
31
|
_defineProperty(this, "userData", {});
|
|
32
|
+
_defineProperty(this, "_lumaData", {});
|
|
32
33
|
_defineProperty(this, "info", void 0);
|
|
33
34
|
_defineProperty(this, "lost", void 0);
|
|
34
35
|
_defineProperty(this, "canvasContext", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","names":["VERSION","lumaStats","log","uid","Buffer","DEFAULT_DEVICE_PROPS","id","type","canvas","container","webgl2","webgl1","manageState","width","height","debug","Boolean","get","break","gl","_Symbol$toStringTag","Symbol","toStringTag","Device","constructor","props","_defineProperty","toLowerCase","loseDevice","createTexture","Promise","data","_createTexture","createCommandEncoder","arguments","length","undefined","Error","_getBufferProps","ArrayBuffer","isView","newProps","usage","INDEX","indexType","Uint32Array","Uint16Array"],"sources":["../../src/adapter/device.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {VERSION} from '../init';\nimport {StatsManager, lumaStats} from '../lib/utils/stats-manager';\nimport {log} from '../lib/utils/log';\nimport {uid} from '../lib/utils/utils';\nimport type {TextureFormat} from './types/texture-formats';\nimport type {CanvasContext, CanvasContextProps} from './canvas-context';\nimport type {BufferProps} from './resources/buffer';\nimport {Buffer} from './resources/buffer';\nimport type {RenderPipeline, RenderPipelineProps} from './resources/render-pipeline';\nimport type {ComputePipeline, ComputePipelineProps} from './resources/compute-pipeline';\nimport type {Sampler, SamplerProps} from './resources/sampler';\nimport type {Shader, ShaderProps} from './resources/shader';\nimport type {Texture, TextureProps, TextureData} from './resources/texture';\nimport type {ExternalTexture, ExternalTextureProps} from './resources/external-texture';\nimport type {Framebuffer, FramebufferProps} from './resources/framebuffer';\nimport type {RenderPass, RenderPassProps} from './resources/render-pass';\nimport type {ComputePass, ComputePassProps} from './resources/compute-pass';\nimport type {CommandEncoder, CommandEncoderProps} from './resources/command-encoder';\n\n/** Device properties */\nexport type DeviceProps = {\n id?: string;\n\n type?: 'webgl' | 'webgl1' | 'webgl2' | 'webgpu' | 'best-available';\n\n // Common parameters\n canvas?: HTMLCanvasElement | OffscreenCanvas | string | null; // A canvas element or a canvas string id\n container?: HTMLElement | string | null;\n width?: number /** width is only used when creating a new canvas */;\n height?: number /** height is only used when creating a new canvas */;\n\n // WebGLDevice parameters\n webgl2?: boolean; // Set to false to not create a WebGL2 context (force webgl1)\n webgl1?: boolean; // set to false to not create a WebGL1 context (fails if webgl2 not available)\n\n // WebGLContext PARAMETERS - Can only be set on context creation...\n // alpha?: boolean; // Default render target has an alpha buffer.\n // depth?: boolean; // Default render target has a depth buffer of at least 16 bits.\n // stencil?: boolean; // Default render target has a stencil buffer of at least 8 bits.\n // antialias?: boolean; // Boolean that indicates whether or not to perform anti-aliasing.\n // premultipliedAlpha?: boolean; // Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.\n // preserveDrawingBuffer?: boolean; // Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten\n // failIfMajorPerformanceCaveat?: boolean; // Do not create if the system performance is low.\n\n // Unclear if these are still supported\n debug?: boolean; // Instrument context (at the expense of performance)\n manageState?: boolean; // Set to false to disable WebGL state management instrumentation\n break?: string[]; // TODO: types\n\n // @deprecated Attach to existing context\n gl?: WebGLRenderingContext | WebGL2RenderingContext | null;\n};\n\nexport const DEFAULT_DEVICE_PROPS: Required<DeviceProps> = {\n id: null!,\n type: 'best-available',\n canvas: null,\n container: null,\n webgl2: true, // Attempt to create a WebGL2 context\n webgl1: true, // Attempt to create a WebGL1 context (false to fail if webgl2 not available)\n manageState: true,\n width: 800, // width are height are only used by headless gl\n height: 600,\n debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance)\n break: [],\n\n // alpha: undefined,\n // depth: undefined,\n // stencil: undefined,\n // antialias: undefined,\n // premultipliedAlpha: undefined,\n // preserveDrawingBuffer: undefined,\n // failIfMajorPerformanceCaveat: undefined\n\n gl: null\n};\n\nexport type ShadingLanguage = 'glsl' | 'wgsl';\n\n/**\n * Identifies the GPU vendor and driver.\n * @see https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/\n * @note Current WebGPU support is very limited\n */\nexport type DeviceInfo = {\n type: 'webgl' | 'webgl2' | 'webgpu';\n vendor: string;\n renderer: string;\n version: string;\n gpu: 'nvidia' | 'amd' | 'intel' | 'apple' | 'software' | 'unknown';\n shadingLanguages: ShadingLanguage[];\n shadingLanguageVersions: Record<string, string>;\n vendorMasked?: string;\n rendererMasked?: string;\n};\n\n/** Limits for a device */\nexport type DeviceLimits = {\n readonly maxTextureDimension1D?: number;\n readonly maxTextureDimension2D?: number;\n readonly maxTextureDimension3D?: number;\n readonly maxTextureArrayLayers?: number;\n readonly maxBindGroups: number;\n readonly maxDynamicUniformBuffersPerPipelineLayout: number;\n readonly maxDynamicStorageBuffersPerPipelineLayout: number;\n readonly maxSampledTexturesPerShaderStage: number;\n readonly maxSamplersPerShaderStage: number;\n readonly maxStorageBuffersPerShaderStage: number;\n readonly maxStorageTexturesPerShaderStage: number;\n readonly maxUniformBuffersPerShaderStage: number;\n readonly maxUniformBufferBindingSize: number;\n readonly maxStorageBufferBindingSize?: number;\n readonly minUniformBufferOffsetAlignment?: number;\n readonly minStorageBufferOffsetAlignment?: number;\n readonly maxVertexBuffers?: number;\n readonly maxVertexAttributes?: number;\n readonly maxVertexBufferArrayStride?: number;\n readonly maxInterStageShaderComponents?: number;\n readonly maxComputeWorkgroupStorageSize?: number;\n readonly maxComputeInvocationsPerWorkgroup?: number;\n readonly maxComputeWorkgroupSizeX?: number;\n readonly maxComputeWorkgroupSizeY?: number;\n readonly maxComputeWorkgroupSizeZ?: number;\n readonly maxComputeWorkgroupsPerDimension?: number;\n};\n\nexport type WebGPUDeviceFeature =\n | 'depth-clip-control'\n | 'depth24unorm-stencil8'\n | 'depth32float-stencil8'\n | 'timestamp-query'\n | 'indirect-first-instance'\n | 'texture-compression-bc'\n | 'texture-compression-etc2'\n | 'texture-compression-astc';\n\n// obsolete...\n// 'depth-clamping' |\n// 'depth24unorm-stencil8' |\n// 'depth32float-stencil8' |\n// 'pipeline-statistics-query' |\n// 'timestamp-query' |\n// 'texture-compression-bc'\n\nexport type WebGLDeviceFeature =\n | 'webgpu'\n | 'webgl2'\n | 'webgl'\n\n // api support (unify with WebGPU timestamp-query?)\n | 'timer-query-webgl'\n | 'uniform-buffers-webgl'\n | 'uniforms-webgl'\n\n // texture filtering\n | 'texture-filter-linear-float32-webgl'\n | 'texture-filter-linear-float16-webgl'\n | 'texture-filter-anisotropic-webgl'\n\n // texture rendering\n | 'texture-renderable-float32-webgl'\n | 'texture-renderable-float16-webgl'\n | 'texture-renderable-rgba32float-webgl' // TODO - remove\n\n // texture blending\n | 'texture-blend-float-webgl1'\n\n // texture format support\n | 'texture-formats-norm16-webgl'\n | 'texture-formats-srgb-webgl1'\n | 'texture-formats-depth-webgl1'\n | 'texture-formats-float32-webgl1'\n | 'texture-formats-float16-webgl1'\n\n // api support\n | 'vertex-array-object-webgl1'\n | 'instanced-rendering-webgl1'\n | 'multiple-render-targets-webgl1'\n | 'index-uint32-webgl1'\n | 'blend-minmax-webgl1'\n\n // glsl extensions\n | 'glsl-frag-data'\n | 'glsl-frag-depth'\n | 'glsl-derivatives'\n | 'glsl-texture-lod';\n\ntype WebGLCompressedTextureFeatures =\n | 'texture-compression-bc5-webgl'\n | 'texture-compression-etc1-webgl'\n | 'texture-compression-pvrtc-webgl'\n | 'texture-compression-atc-webgl';\n\n/** Valid feature strings */\nexport type DeviceFeature =\n | WebGPUDeviceFeature\n | WebGLDeviceFeature\n | WebGLCompressedTextureFeatures;\n\n/**\n * WebGPU Device/WebGL context abstraction\n */\nexport abstract class Device {\n get [Symbol.toStringTag](): string {\n return 'Device';\n }\n\n static VERSION = VERSION;\n\n constructor(props: DeviceProps) {\n this.props = {...DEFAULT_DEVICE_PROPS, ...props};\n this.id = this.props.id || uid(this[Symbol.toStringTag].toLowerCase());\n }\n\n readonly id: string;\n readonly statsManager: StatsManager = lumaStats;\n readonly props: Required<DeviceProps>;\n userData: {[key: string]: any} = {};\n\n // Capabilities\n\n /** Information about the device (vendor, versions etc) */\n abstract info: DeviceInfo;\n\n /** Optional capability discovery */\n abstract get features(): Set<DeviceFeature>;\n\n /** WebGPU style device limits */\n abstract get limits(): DeviceLimits;\n\n /** Check if device supports a specific texture format (creation and `nearest` sampling) */\n abstract isTextureFormatSupported(format: TextureFormat): boolean;\n\n /** Check if linear filtering (sampler interpolation) is supported for a specific texture format */\n abstract isTextureFormatFilterable(format: TextureFormat): boolean;\n\n /** Check if device supports rendering to a specific texture format */\n abstract isTextureFormatRenderable(format: TextureFormat): boolean;\n\n // Device loss\n\n /** `true` if device is already lost */\n abstract get isLost(): boolean;\n\n /** Promise that resolves when device is lost */\n abstract readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n\n /** \n * Trigger device loss. \n * @returns `true` if context loss could actually be triggered. \n * @note primarily intended for testing how application reacts to device loss \n */\n loseDevice(): boolean {\n return false;\n }\n\n // Canvas context\n\n /** Default / primary canvas context. Can be null as WebGPU devices can be created without a CanvasContext */\n abstract canvasContext: CanvasContext | null;\n\n /** Creates a new CanvasContext (WebGPU only) */\n abstract createCanvasContext(props?: CanvasContextProps): CanvasContext;\n\n /** Call after rendering a frame (necessary e.g. on WebGL OffscreenCanvas) */\n abstract submit(): void;\n\n // Resource creation\n\n /** Create a buffer */\n abstract createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): Buffer;\n\n /** Create a texture */\n abstract _createTexture(props: TextureProps): Texture;\n createTexture(props: TextureProps): Texture;\n createTexture(data: Promise<TextureData>): Texture;\n createTexture(url: string): Texture;\n\n createTexture(props: TextureProps | Promise<TextureData> | string): Texture {\n // Signature: new Texture2D(gl, url | Promise)\n if (props instanceof Promise || typeof props === 'string') {\n props = {data: props};\n }\n return this._createTexture(props);\n }\n\n /** Create a temporary texture view of a video source */\n abstract createExternalTexture(props: ExternalTextureProps): ExternalTexture;\n\n /** Create a sampler */\n abstract createSampler(props: SamplerProps): Sampler;\n\n abstract createFramebuffer(props: FramebufferProps): Framebuffer;\n\n /** Create a shader */\n abstract createShader(props: ShaderProps): Shader;\n\n /** Create a render pipeline (aka program) */\n abstract createRenderPipeline(props: RenderPipelineProps): RenderPipeline;\n\n /** Create a compute pipeline (aka program) */\n abstract createComputePipeline(props: ComputePipelineProps): ComputePipeline;\n\n createCommandEncoder(props: CommandEncoderProps = {}): CommandEncoder {\n throw new Error('not implemented');\n }\n\n /** Create a RenderPass */\n abstract beginRenderPass(props?: RenderPassProps): RenderPass;\n\n /** Create a ComputePass */\n abstract beginComputePass(props?: ComputePassProps): ComputePass;\n\n /** Get a renderpass that is set up to render to the primary CanvasContext */\n abstract getDefaultRenderPass(): RenderPass;\n\n // Resource creation helpers\n\n protected _getBufferProps(props: BufferProps | ArrayBuffer | ArrayBufferView): BufferProps {\n\n if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {\n return {data: props};\n }\n\n // TODO - fragile, as this is done before we merge with default options\n // inside the Buffer constructor\n\n const newProps = {...props};\n // Deduce indexType\n if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {\n if (props.data instanceof Uint32Array) {\n newProps.indexType = 'uint32';\n } else if (props.data instanceof Uint16Array) {\n newProps.indexType = 'uint16';\n }\n }\n return newProps; \n }\n}\n"],"mappings":";;SACQA,OAAO;AAAA,SACOC,SAAS;AAAA,SACvBC,GAAG;AAAA,SACHC,GAAG;AAAA,SAIHC,MAAM;AA8Cd,OAAO,MAAMC,oBAA2C,GAAG;EACzDC,EAAE,EAAE,IAAK;EACTC,IAAI,EAAE,gBAAgB;EACtBC,MAAM,EAAE,IAAI;EACZC,SAAS,EAAE,IAAI;EACfC,MAAM,EAAE,IAAI;EACZC,MAAM,EAAE,IAAI;EACZC,WAAW,EAAE,IAAI;EACjBC,KAAK,EAAE,GAAG;EACVC,MAAM,EAAE,GAAG;EACXC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AAO;QAACM,IAAI,EAAEN;MAAK,CAAC;IACtB;IAKA,MAAMgB,QAAQ,GAAG;MAAC,GAAGhB;IAAK,CAAC;IAE3B,IAAI,CAACA,KAAK,CAACiB,KAAK,IAAI,CAAC,IAAItC,MAAM,CAACuC,KAAK,IAAI,CAAClB,KAAK,CAACmB,SAAS,EAAE;MACzD,IAAInB,KAAK,CAACM,IAAI,YAAYc,WAAW,EAAE;QACrCJ,QAAQ,CAACG,SAAS,GAAG,QAAQ;MAC/B,CAAC,MAAM,IAAInB,KAAK,CAACM,IAAI,YAAYe,WAAW,EAAE;QAC5CL,QAAQ,CAACG,SAAS,GAAG,QAAQ;MAC/B;IACF;IACA,OAAOH,QAAQ;EACjB;AACF;AAACf,eAAA,CAxIqBH,MAAM,aAKTvB,OAAO"}
|
|
1
|
+
{"version":3,"file":"device.js","names":["VERSION","lumaStats","log","uid","Buffer","DEFAULT_DEVICE_PROPS","id","type","canvas","container","webgl2","webgl1","manageState","width","height","debug","Boolean","get","break","gl","_Symbol$toStringTag","Symbol","toStringTag","Device","constructor","props","_defineProperty","toLowerCase","loseDevice","createTexture","Promise","data","_createTexture","createCommandEncoder","arguments","length","undefined","Error","_getBufferProps","ArrayBuffer","isView","newProps","usage","INDEX","indexType","Uint32Array","Uint16Array"],"sources":["../../src/adapter/device.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {VERSION} from '../init';\nimport {StatsManager, lumaStats} from '../lib/utils/stats-manager';\nimport {log} from '../lib/utils/log';\nimport {uid} from '../lib/utils/utils';\nimport type {TextureFormat} from './types/texture-formats';\nimport type {CanvasContext, CanvasContextProps} from './canvas-context';\nimport type {BufferProps} from './resources/buffer';\nimport {Buffer} from './resources/buffer';\nimport type {RenderPipeline, RenderPipelineProps} from './resources/render-pipeline';\nimport type {ComputePipeline, ComputePipelineProps} from './resources/compute-pipeline';\nimport type {Sampler, SamplerProps} from './resources/sampler';\nimport type {Shader, ShaderProps} from './resources/shader';\nimport type {Texture, TextureProps, TextureData} from './resources/texture';\nimport type {ExternalTexture, ExternalTextureProps} from './resources/external-texture';\nimport type {Framebuffer, FramebufferProps} from './resources/framebuffer';\nimport type {RenderPass, RenderPassProps} from './resources/render-pass';\nimport type {ComputePass, ComputePassProps} from './resources/compute-pass';\nimport type {CommandEncoder, CommandEncoderProps} from './resources/command-encoder';\n\n/** Device properties */\nexport type DeviceProps = {\n id?: string;\n\n type?: 'webgl' | 'webgl1' | 'webgl2' | 'webgpu' | 'best-available';\n\n // Common parameters\n canvas?: HTMLCanvasElement | OffscreenCanvas | string | null; // A canvas element or a canvas string id\n container?: HTMLElement | string | null;\n width?: number /** width is only used when creating a new canvas */;\n height?: number /** height is only used when creating a new canvas */;\n\n // WebGLDevice parameters\n webgl2?: boolean; // Set to false to not create a WebGL2 context (force webgl1)\n webgl1?: boolean; // set to false to not create a WebGL1 context (fails if webgl2 not available)\n\n // WebGLContext PARAMETERS - Can only be set on context creation...\n // alpha?: boolean; // Default render target has an alpha buffer.\n // depth?: boolean; // Default render target has a depth buffer of at least 16 bits.\n // stencil?: boolean; // Default render target has a stencil buffer of at least 8 bits.\n // antialias?: boolean; // Boolean that indicates whether or not to perform anti-aliasing.\n // premultipliedAlpha?: boolean; // Boolean that indicates that the page compositor will assume the drawing buffer contains colors with pre-multiplied alpha.\n // preserveDrawingBuffer?: boolean; // Default render target buffers will not be automatically cleared and will preserve their values until cleared or overwritten\n // failIfMajorPerformanceCaveat?: boolean; // Do not create if the system performance is low.\n\n // Unclear if these are still supported\n debug?: boolean; // Instrument context (at the expense of performance)\n manageState?: boolean; // Set to false to disable WebGL state management instrumentation\n break?: string[]; // TODO: types\n\n // @deprecated Attach to existing context\n gl?: WebGLRenderingContext | WebGL2RenderingContext | null;\n};\n\nexport const DEFAULT_DEVICE_PROPS: Required<DeviceProps> = {\n id: null!,\n type: 'best-available',\n canvas: null,\n container: null,\n webgl2: true, // Attempt to create a WebGL2 context\n webgl1: true, // Attempt to create a WebGL1 context (false to fail if webgl2 not available)\n manageState: true,\n width: 800, // width are height are only used by headless gl\n height: 600,\n debug: Boolean(log.get('debug')), // Instrument context (at the expense of performance)\n break: [],\n\n // alpha: undefined,\n // depth: undefined,\n // stencil: undefined,\n // antialias: undefined,\n // premultipliedAlpha: undefined,\n // preserveDrawingBuffer: undefined,\n // failIfMajorPerformanceCaveat: undefined\n\n gl: null\n};\n\nexport type ShadingLanguage = 'glsl' | 'wgsl';\n\n/**\n * Identifies the GPU vendor and driver.\n * @see https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/\n * @note Current WebGPU support is very limited\n */\nexport type DeviceInfo = {\n type: 'webgl' | 'webgl2' | 'webgpu';\n vendor: string;\n renderer: string;\n version: string;\n gpu: 'nvidia' | 'amd' | 'intel' | 'apple' | 'software' | 'unknown';\n shadingLanguages: ShadingLanguage[];\n shadingLanguageVersions: Record<string, string>;\n vendorMasked?: string;\n rendererMasked?: string;\n};\n\n/** Limits for a device */\nexport type DeviceLimits = {\n readonly maxTextureDimension1D?: number;\n readonly maxTextureDimension2D?: number;\n readonly maxTextureDimension3D?: number;\n readonly maxTextureArrayLayers?: number;\n readonly maxBindGroups: number;\n readonly maxDynamicUniformBuffersPerPipelineLayout: number;\n readonly maxDynamicStorageBuffersPerPipelineLayout: number;\n readonly maxSampledTexturesPerShaderStage: number;\n readonly maxSamplersPerShaderStage: number;\n readonly maxStorageBuffersPerShaderStage: number;\n readonly maxStorageTexturesPerShaderStage: number;\n readonly maxUniformBuffersPerShaderStage: number;\n readonly maxUniformBufferBindingSize: number;\n readonly maxStorageBufferBindingSize?: number;\n readonly minUniformBufferOffsetAlignment?: number;\n readonly minStorageBufferOffsetAlignment?: number;\n readonly maxVertexBuffers?: number;\n readonly maxVertexAttributes?: number;\n readonly maxVertexBufferArrayStride?: number;\n readonly maxInterStageShaderComponents?: number;\n readonly maxComputeWorkgroupStorageSize?: number;\n readonly maxComputeInvocationsPerWorkgroup?: number;\n readonly maxComputeWorkgroupSizeX?: number;\n readonly maxComputeWorkgroupSizeY?: number;\n readonly maxComputeWorkgroupSizeZ?: number;\n readonly maxComputeWorkgroupsPerDimension?: number;\n};\n\nexport type WebGPUDeviceFeature =\n | 'depth-clip-control'\n | 'depth24unorm-stencil8'\n | 'depth32float-stencil8'\n | 'timestamp-query'\n | 'indirect-first-instance'\n | 'texture-compression-bc'\n | 'texture-compression-etc2'\n | 'texture-compression-astc';\n\n// obsolete...\n// 'depth-clamping' |\n// 'depth24unorm-stencil8' |\n// 'depth32float-stencil8' |\n// 'pipeline-statistics-query' |\n// 'timestamp-query' |\n// 'texture-compression-bc'\n\nexport type WebGLDeviceFeature =\n | 'webgpu'\n | 'webgl2'\n | 'webgl'\n\n // api support (unify with WebGPU timestamp-query?)\n | 'timer-query-webgl'\n | 'uniform-buffers-webgl'\n | 'uniforms-webgl'\n\n // texture filtering\n | 'texture-filter-linear-float32-webgl'\n | 'texture-filter-linear-float16-webgl'\n | 'texture-filter-anisotropic-webgl'\n\n // texture rendering\n | 'texture-renderable-float32-webgl'\n | 'texture-renderable-float16-webgl'\n | 'texture-renderable-rgba32float-webgl' // TODO - remove\n\n // texture blending\n | 'texture-blend-float-webgl1'\n\n // texture format support\n | 'texture-formats-norm16-webgl'\n | 'texture-formats-srgb-webgl1'\n | 'texture-formats-depth-webgl1'\n | 'texture-formats-float32-webgl1'\n | 'texture-formats-float16-webgl1'\n\n // api support\n | 'vertex-array-object-webgl1'\n | 'instanced-rendering-webgl1'\n | 'multiple-render-targets-webgl1'\n | 'index-uint32-webgl1'\n | 'blend-minmax-webgl1'\n\n // glsl extensions\n | 'glsl-frag-data'\n | 'glsl-frag-depth'\n | 'glsl-derivatives'\n | 'glsl-texture-lod';\n\ntype WebGLCompressedTextureFeatures =\n | 'texture-compression-bc5-webgl'\n | 'texture-compression-etc1-webgl'\n | 'texture-compression-pvrtc-webgl'\n | 'texture-compression-atc-webgl';\n\n/** Valid feature strings */\nexport type DeviceFeature =\n | WebGPUDeviceFeature\n | WebGLDeviceFeature\n | WebGLCompressedTextureFeatures;\n\n/**\n * WebGPU Device/WebGL context abstraction\n */\nexport abstract class Device {\n get [Symbol.toStringTag](): string {\n return 'Device';\n }\n\n static VERSION = VERSION;\n\n constructor(props: DeviceProps) {\n this.props = {...DEFAULT_DEVICE_PROPS, ...props};\n this.id = this.props.id || uid(this[Symbol.toStringTag].toLowerCase());\n }\n\n /** id of this device, primarily for debugging */\n readonly id: string;\n /** stats */\n readonly statsManager: StatsManager = lumaStats;\n /** A copy of the device props */\n readonly props: Required<DeviceProps>;\n /** Available for the application to store data on the device */\n userData: {[key: string]: unknown} = {};\n /** Used by other luma.gl modules to store data on the device */\n _lumaData: {[key: string]: unknown} = {};\n\n // Capabilities\n\n /** Information about the device (vendor, versions etc) */\n abstract info: DeviceInfo;\n\n /** Optional capability discovery */\n abstract get features(): Set<DeviceFeature>;\n\n /** WebGPU style device limits */\n abstract get limits(): DeviceLimits;\n\n /** Check if device supports a specific texture format (creation and `nearest` sampling) */\n abstract isTextureFormatSupported(format: TextureFormat): boolean;\n\n /** Check if linear filtering (sampler interpolation) is supported for a specific texture format */\n abstract isTextureFormatFilterable(format: TextureFormat): boolean;\n\n /** Check if device supports rendering to a specific texture format */\n abstract isTextureFormatRenderable(format: TextureFormat): boolean;\n\n // Device loss\n\n /** `true` if device is already lost */\n abstract get isLost(): boolean;\n\n /** Promise that resolves when device is lost */\n abstract readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n\n /** \n * Trigger device loss. \n * @returns `true` if context loss could actually be triggered. \n * @note primarily intended for testing how application reacts to device loss \n */\n loseDevice(): boolean {\n return false;\n }\n\n // Canvas context\n\n /** Default / primary canvas context. Can be null as WebGPU devices can be created without a CanvasContext */\n abstract canvasContext: CanvasContext | null;\n\n /** Creates a new CanvasContext (WebGPU only) */\n abstract createCanvasContext(props?: CanvasContextProps): CanvasContext;\n\n /** Call after rendering a frame (necessary e.g. on WebGL OffscreenCanvas) */\n abstract submit(): void;\n\n // Resource creation\n\n /** Create a buffer */\n abstract createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): Buffer;\n\n /** Create a texture */\n abstract _createTexture(props: TextureProps): Texture;\n createTexture(props: TextureProps): Texture;\n createTexture(data: Promise<TextureData>): Texture;\n createTexture(url: string): Texture;\n\n createTexture(props: TextureProps | Promise<TextureData> | string): Texture {\n // Signature: new Texture2D(gl, url | Promise)\n if (props instanceof Promise || typeof props === 'string') {\n props = {data: props};\n }\n return this._createTexture(props);\n }\n\n /** Create a temporary texture view of a video source */\n abstract createExternalTexture(props: ExternalTextureProps): ExternalTexture;\n\n /** Create a sampler */\n abstract createSampler(props: SamplerProps): Sampler;\n\n abstract createFramebuffer(props: FramebufferProps): Framebuffer;\n\n /** Create a shader */\n abstract createShader(props: ShaderProps): Shader;\n\n /** Create a render pipeline (aka program) */\n abstract createRenderPipeline(props: RenderPipelineProps): RenderPipeline;\n\n /** Create a compute pipeline (aka program) */\n abstract createComputePipeline(props: ComputePipelineProps): ComputePipeline;\n\n createCommandEncoder(props: CommandEncoderProps = {}): CommandEncoder {\n throw new Error('not implemented');\n }\n\n /** Create a RenderPass */\n abstract beginRenderPass(props?: RenderPassProps): RenderPass;\n\n /** Create a ComputePass */\n abstract beginComputePass(props?: ComputePassProps): ComputePass;\n\n /** Get a renderpass that is set up to render to the primary CanvasContext */\n abstract getDefaultRenderPass(): RenderPass;\n\n // Resource creation helpers\n\n protected _getBufferProps(props: BufferProps | ArrayBuffer | ArrayBufferView): BufferProps {\n\n if (props instanceof ArrayBuffer || ArrayBuffer.isView(props)) {\n return {data: props};\n }\n\n // TODO - fragile, as this is done before we merge with default options\n // inside the Buffer constructor\n\n const newProps = {...props};\n // Deduce indexType\n if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {\n if (props.data instanceof Uint32Array) {\n newProps.indexType = 'uint32';\n } else if (props.data instanceof Uint16Array) {\n newProps.indexType = 'uint16';\n }\n }\n return newProps; \n }\n}\n"],"mappings":";;SACQA,OAAO;AAAA,SACOC,SAAS;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CAACO,cAAc,CAACP,KAAK,CAAC;EACnC;EAmBAQ,oBAAoBA,CAAA,EAAkD;IAAA,IAAjDR,KAA0B,GAAAS,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAClD,MAAM,IAAIG,KAAK,CAAC,iBAAiB,CAAC;EACpC;EAaUC,eAAeA,CAACb,KAAkD,EAAe;IAEzF,IAAIA,KAAK,YAAYc,WAAW,IAAIA,WAAW,CAACC,MAAM,CAACf,KAAK,CAAC,EAAE;MAC7D,OAAO;QAACM,IAAI,EAAEN;MAAK,CAAC;IACtB;IAKA,MAAMgB,QAAQ,GAAG;MAAC,GAAGhB;IAAK,CAAC;IAE3B,IAAI,CAACA,KAAK,CAACiB,KAAK,IAAI,CAAC,IAAItC,MAAM,CAACuC,KAAK,IAAI,CAAClB,KAAK,CAACmB,SAAS,EAAE;MACzD,IAAInB,KAAK,CAACM,IAAI,YAAYc,WAAW,EAAE;QACrCJ,QAAQ,CAACG,SAAS,GAAG,QAAQ;MAC/B,CAAC,MAAM,IAAInB,KAAK,CAACM,IAAI,YAAYe,WAAW,EAAE;QAC5CL,QAAQ,CAACG,SAAS,GAAG,QAAQ;MAC/B;IACF;IACA,OAAOH,QAAQ;EACjB;AACF;AAACf,eAAA,CA9IqBH,MAAM,aAKTvB,OAAO"}
|
|
@@ -18,6 +18,7 @@ export type BufferProps = ResourceProps & {
|
|
|
18
18
|
};
|
|
19
19
|
/** Abstract GPU buffer */
|
|
20
20
|
export declare abstract class Buffer extends Resource<BufferProps> {
|
|
21
|
+
static defaultProps: Required<BufferProps>;
|
|
21
22
|
static MAP_READ: number;
|
|
22
23
|
static MAP_WRITE: number;
|
|
23
24
|
static COPY_SRC: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/buffer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MA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U;IAE9B,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAqB;IAEhE,gCAAgC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IAe9C,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IACvD,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAEzE,OAAO,IAAI,UAAU;CAoDtB"}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
let _Symbol$toStringTag;
|
|
3
|
-
import { Resource
|
|
4
|
-
const DEFAULT_BUFFER_PROPS = {
|
|
5
|
-
...DEFAULT_RESOURCE_PROPS,
|
|
6
|
-
usage: 0,
|
|
7
|
-
byteLength: 0,
|
|
8
|
-
byteOffset: 0,
|
|
9
|
-
data: null,
|
|
10
|
-
indexType: 'uint16',
|
|
11
|
-
mappedAtCreation: false
|
|
12
|
-
};
|
|
3
|
+
import { Resource } from "./resource.js";
|
|
13
4
|
_Symbol$toStringTag = Symbol.toStringTag;
|
|
14
5
|
export class Buffer extends Resource {
|
|
15
6
|
get [_Symbol$toStringTag]() {
|
|
@@ -26,7 +17,7 @@ export class Buffer extends Resource {
|
|
|
26
17
|
deducedProps.indexType = 'uint16';
|
|
27
18
|
}
|
|
28
19
|
}
|
|
29
|
-
super(device, deducedProps,
|
|
20
|
+
super(device, deducedProps, Buffer.defaultProps);
|
|
30
21
|
_defineProperty(this, "byteLength", void 0);
|
|
31
22
|
}
|
|
32
23
|
write(data, byteOffset) {
|
|
@@ -39,6 +30,15 @@ export class Buffer extends Resource {
|
|
|
39
30
|
throw new Error('not implemented');
|
|
40
31
|
}
|
|
41
32
|
}
|
|
33
|
+
_defineProperty(Buffer, "defaultProps", {
|
|
34
|
+
...Resource.defaultProps,
|
|
35
|
+
usage: 0,
|
|
36
|
+
byteLength: 0,
|
|
37
|
+
byteOffset: 0,
|
|
38
|
+
data: null,
|
|
39
|
+
indexType: 'uint16',
|
|
40
|
+
mappedAtCreation: false
|
|
41
|
+
});
|
|
42
42
|
_defineProperty(Buffer, "MAP_READ", 0x01);
|
|
43
43
|
_defineProperty(Buffer, "MAP_WRITE", 0x02);
|
|
44
44
|
_defineProperty(Buffer, "COPY_SRC", 0x0004);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.js","names":["Resource","
|
|
1
|
+
{"version":3,"file":"buffer.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","Buffer","constructor","device","props","deducedProps","usage","INDEX","indexType","data","Uint32Array","Uint16Array","defaultProps","_defineProperty","write","byteOffset","Error","readAsync","byteLength","getData","mappedAtCreation"],"sources":["../../../src/adapter/resources/buffer.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {TypedArray} from '../..';\nimport type {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\n\nexport type BufferProps = ResourceProps & {\n /** Supply a handle to connect to an existing device-specific buffer */\n handle?: WebGLBuffer;\n /** Specifies how this buffer can be used */\n usage?: number;\n /** Length in bytes of memory to be allocated. If not specified, `byteLength` of `props.data` will be used. */\n byteLength?: number;\n /** Data to initialize the buffer with. */\n data?: ArrayBuffer | ArrayBufferView | null;\n /** Byte offset into the newly created Buffer to store data at */\n byteOffset?: number;\n /** If props.usage includes Buffer.INDEX */\n indexType?: 'uint16' | 'uint32';\n\n // TBD\n mappedAtCreation?: boolean;\n}\n\n/** Abstract GPU buffer */\nexport abstract class Buffer extends Resource<BufferProps> {\n static override defaultProps: Required<BufferProps> = {\n ...Resource.defaultProps,\n usage: 0, // Buffer.COPY_DST | Buffer.COPY_SRC\n byteLength: 0,\n byteOffset: 0,\n data: null,\n indexType: 'uint16',\n mappedAtCreation: false\n };\n\n // Usage Flags\n static MAP_READ = 0x01;\n static MAP_WRITE = 0x02;\n static COPY_SRC = 0x0004;\n static COPY_DST = 0x0008;\n static INDEX = 0x0010;\n static VERTEX = 0x0020;\n static UNIFORM = 0x0040;\n static STORAGE = 0x0080;\n static INDIRECT = 0x0100;\n static QUERY_RESOLVE = 0x0200;\n\n override get [Symbol.toStringTag](): string { return 'Buffer'; }\n\n /** Length of buffer in bytes */\n abstract byteLength: number;\n\n constructor(device: Device, props: BufferProps) {\n const deducedProps = {...props};\n\n // Deduce indexType\n if ((props.usage || 0) & Buffer.INDEX && !props.indexType) {\n if (props.data instanceof Uint32Array) {\n deducedProps.indexType = 'uint32';\n } else if (props.data instanceof Uint16Array) {\n deducedProps.indexType = 'uint16';\n }\n }\n\n super(device, deducedProps, Buffer.defaultProps);\n }\n\n write(data: ArrayBufferView, byteOffset?: number): void { throw new Error('not implemented'); }\n readAsync(byteOffset?: number, byteLength?: number): Promise<ArrayBuffer> { throw new Error('not implemented'); }\n // TODO - can sync read be supported in WebGPU?\n getData(): TypedArray { throw new Error('not implemented'); }\n\n // Convenience API\n\n /** Read data from the buffer *\n async readAsync(options: {\n byteOffset?: number,\n byteLength?: number,\n map?: boolean,\n unmap?: boolean\n }): Promise<ArrayBuffer> {\n if (options.map ?? true) {\n await this.mapAsync(Buffer.MAP_READ, options.byteOffset, options.byteLength);\n }\n const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);\n if (options.unmap ?? true) {\n this.unmap();\n }\n return arrayBuffer;\n }\n\n /** Write data to the buffer *\n async writeAsync(options: {\n data: ArrayBuffer,\n byteOffset?: number,\n byteLength?: number,\n map?: boolean,\n unmap?: boolean\n }): Promise<void> {\n if (options.map ?? true) {\n await this.mapAsync(Buffer.MAP_WRITE, options.byteOffset, options.byteLength);\n }\n const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);\n const destArray = new Uint8Array(arrayBuffer);\n const srcArray = new Uint8Array(options.data);\n destArray.set(srcArray);\n if (options.unmap ?? true) {\n this.unmap();\n }\n }\n */\n\n // Mapped API (WebGPU)\n\n /** Maps the memory so that it can be read */\n // abstract mapAsync(mode, byteOffset, byteLength): Promise<void>\n\n /** Get the mapped range of data for reading or writing */\n // abstract getMappedRange(byteOffset, byteLength): ArrayBuffer;\n\n /** unmap makes the contents of the buffer available to the GPU again */\n // abstract unmap(): void;\n}\n"],"mappings":";;SAGQA,QAAQ;AAAAC,mBAAA,GA4CAC,MAAM,CAACC,WAAW;AAvBlC,OAAO,MAAeC,MAAM,SAASJ,QAAQ,CAAc;EAuBzD,KAAAC,mBAAA,IAA4C;IAAE,OAAO,QAAQ;EAAE;EAK/DI,WAAWA,CAACC,MAAc,EAAEC,KAAkB,EAAE;IAC9C,MAAMC,YAAY,GAAG;MAAC,GAAGD;IAAK,CAAC;IAG/B,IAAI,CAACA,KAAK,CAACE,KAAK,IAAI,CAAC,IAAIL,MAAM,CAACM,KAAK,IAAI,CAACH,KAAK,CAACI,SAAS,EAAE;MACzD,IAAIJ,KAAK,CAACK,IAAI,YAAYC,WAAW,EAAE;QACrCL,YAAY,CAACG,SAAS,GAAG,QAAQ;MACnC,CAAC,MAAM,IAAIJ,KAAK,CAACK,IAAI,YAAYE,WAAW,EAAE;QAC5CN,YAAY,CAACG,SAAS,GAAG,QAAQ;MACnC;IACF;IAEA,KAAK,CAACL,MAAM,EAAEE,YAAY,EAAEJ,MAAM,CAACW,YAAY,CAAC;IAACC,eAAA;EACnD;EAEAC,KAAKA,CAACL,IAAqB,EAAEM,UAAmB,EAAQ;IAAE,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EAAE;EAC9FC,SAASA,CAACF,UAAmB,EAAEG,UAAmB,EAAyB;IAAE,MAAM,IAAIF,KAAK,CAAC,iBAAiB,CAAC;EAAE;EAEjHG,OAAOA,CAAA,EAAe;IAAE,MAAM,IAAIH,KAAK,CAAC,iBAAiB,CAAC;EAAE;AAoD9D;AAACH,eAAA,CAlGqBZ,MAAM,kBAC4B;EACpD,GAAGJ,QAAQ,CAACe,YAAY;EACxBN,KAAK,EAAE,CAAC;EACRY,UAAU,EAAE,CAAC;EACbH,UAAU,EAAE,CAAC;EACbN,IAAI,EAAE,IAAI;EACVD,SAAS,EAAE,QAAQ;EACnBY,gBAAgB,EAAE;AACpB,CAAC;AAAAP,eAAA,CATmBZ,MAAM,cAYR,IAAI;AAAAY,eAAA,CAZFZ,MAAM,eAaP,IAAI;AAAAY,eAAA,CAbHZ,MAAM,cAcR,MAAM;AAAAY,eAAA,CAdJZ,MAAM,cAeR,MAAM;AAAAY,eAAA,CAfJZ,MAAM,WAgBX,MAAM;AAAAY,eAAA,CAhBDZ,MAAM,YAiBV,MAAM;AAAAY,eAAA,CAjBFZ,MAAM,aAkBT,MAAM;AAAAY,eAAA,CAlBHZ,MAAM,aAmBT,MAAM;AAAAY,eAAA,CAnBHZ,MAAM,cAoBR,MAAM;AAAAY,eAAA,CApBJZ,MAAM,mBAqBH,MAAM"}
|
|
@@ -4,6 +4,7 @@ export type CommandBufferProps = ResourceProps & {};
|
|
|
4
4
|
* Encodes commands to queue that can be executed later
|
|
5
5
|
*/
|
|
6
6
|
export declare abstract class CommandBuffer extends Resource<CommandBufferProps> {
|
|
7
|
+
static defaultProps: Required<CommandBufferProps>;
|
|
7
8
|
get [Symbol.toStringTag](): string;
|
|
8
9
|
constructor(props: CommandBufferProps);
|
|
9
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/command-buffer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/command-buffer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAiBnD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,EAChD,CAAC;AAEF;;GAEG;AACH,8BAAsB,aAAc,SAAQ,QAAQ,CAAC,kBAAkB,CAAC;IACtE,OAAgB,YAAY,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAExD;IAEF,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;gBAEW,KAAK,EAAE,kBAAkB;CAItC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
let _Symbol$toStringTag;
|
|
3
|
+
import { Resource } from "./resource.js";
|
|
4
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
5
5
|
export class CommandBuffer extends Resource {
|
|
6
|
-
get [
|
|
6
|
+
get [_Symbol$toStringTag]() {
|
|
7
7
|
return 'CommandBuffer';
|
|
8
8
|
}
|
|
9
9
|
constructor(props) {
|
|
10
|
-
super(props,
|
|
10
|
+
super(props, CommandBuffer.defaultProps);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
+
_defineProperty(CommandBuffer, "defaultProps", {
|
|
14
|
+
...Resource.defaultProps
|
|
15
|
+
});
|
|
13
16
|
//# sourceMappingURL=command-buffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-buffer.js","names":["Resource","
|
|
1
|
+
{"version":3,"file":"command-buffer.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","CommandBuffer","constructor","props","defaultProps","_defineProperty"],"sources":["../../../src/adapter/resources/command-buffer.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {Resource, ResourceProps} from './resource';\n\n// interface Queue {\n// submit(commandBuffers);\n\n// // onSubmittedWorkDone(): Promise<undefined>;\n\n// writeBuffer(options: WriteBufferOptions): void;\n// writeTexture(options: WriteTextureOptions): void;\n\n// // copyExternalImageToTexture(\n// // GPUImageCopyExternalImage source,\n// // GPUImageCopyTextureTagged destination,\n// // GPUExtent3D copySize\n// // ): void;\n// }\n\nexport type CommandBufferProps = ResourceProps & {\n};\n\n/**\n * Encodes commands to queue that can be executed later\n */\nexport abstract class CommandBuffer extends Resource<CommandBufferProps> {\n static override defaultProps: Required<CommandBufferProps> = {\n ...Resource.defaultProps\n };\n \n override get [Symbol.toStringTag](): string {\n return 'CommandBuffer';\n }\n\n constructor(props: CommandBufferProps) {\n // @ts-expect-error\n super(props, CommandBuffer.defaultProps);\n }\n}\n"],"mappings":";;SACQA,QAAQ;AAAAC,mBAAA,GA4BAC,MAAM,CAACC,WAAW;AALlC,OAAO,MAAeC,aAAa,SAASJ,QAAQ,CAAqB;EAKvE,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,eAAe;EACxB;EAEAI,WAAWA,CAACC,KAAyB,EAAE;IAErC,KAAK,CAACA,KAAK,EAAEF,aAAa,CAACG,YAAY,CAAC;EAC1C;AACF;AAACC,eAAA,CAbqBJ,aAAa,kBAC4B;EAC3D,GAAGJ,QAAQ,CAACO;AACd,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Device } from '../device';
|
|
1
2
|
import { Resource, ResourceProps } from './resource';
|
|
2
3
|
import { Buffer } from './buffer';
|
|
3
4
|
import { Texture } from './texture';
|
|
@@ -97,8 +98,9 @@ export type CommandEncoderProps = ResourceProps & {
|
|
|
97
98
|
* Encodes commands to queue that can be executed later
|
|
98
99
|
*/
|
|
99
100
|
export declare abstract class CommandEncoder extends Resource<CommandEncoderProps> {
|
|
101
|
+
static defaultProps: Required<CommandEncoderProps>;
|
|
100
102
|
get [Symbol.toStringTag](): string;
|
|
101
|
-
constructor(props: CommandEncoderProps);
|
|
103
|
+
constructor(device: Device, props: CommandEncoderProps);
|
|
102
104
|
abstract finish(): void;
|
|
103
105
|
abstract copyBufferToBuffer(options: CopyBufferToBufferOptions): void;
|
|
104
106
|
abstract copyBufferToTexture(options: CopyBufferToTextureOptions): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/command-encoder.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/command-encoder.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC;IAC7C,MAAM,CAAC,EAAE,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;IAC/C,IAAI,EAAE,YAAY,CAAC;IAEnB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC;CAC3C,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB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AG,IAAI;IAExC,aAAa;IAEb,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAW7C"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
let _Symbol$toStringTag;
|
|
3
|
+
import { Resource } from "./resource.js";
|
|
4
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
5
5
|
export class CommandEncoder extends Resource {
|
|
6
|
-
get [
|
|
6
|
+
get [_Symbol$toStringTag]() {
|
|
7
7
|
return 'CommandEncoder';
|
|
8
8
|
}
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props,
|
|
9
|
+
constructor(device, props) {
|
|
10
|
+
super(device, props, CommandEncoder.defaultProps);
|
|
11
11
|
}
|
|
12
12
|
pushDebugGroup(groupLabel) {}
|
|
13
13
|
popDebugGroup() {}
|
|
14
14
|
insertDebugMarker(markerLabel) {}
|
|
15
15
|
}
|
|
16
|
+
_defineProperty(CommandEncoder, "defaultProps", {
|
|
17
|
+
...Resource.defaultProps,
|
|
18
|
+
measureExecutionTime: undefined
|
|
19
|
+
});
|
|
16
20
|
//# sourceMappingURL=command-encoder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-encoder.js","names":["Resource","
|
|
1
|
+
{"version":3,"file":"command-encoder.js","names":["Resource","_Symbol$toStringTag","Symbol","toStringTag","CommandEncoder","constructor","device","props","defaultProps","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel","_defineProperty","measureExecutionTime","undefined"],"sources":["../../../src/adapter/resources/command-encoder.ts"],"sourcesContent":["// luma.gl, MIT license\nimport {Device} from '../device';\nimport {Resource, ResourceProps} from './resource';\nimport {Buffer} from './buffer';\nimport {Texture} from './texture';\n\nexport type WriteBufferOptions = {\n buffer: Buffer,\n bufferOffset?: number,\n data: BufferSource,\n dataOffset?: number,\n size?: number\n};\n\nexport type WriteTextureOptions = {\n destination: Texture;\n mipLevel?: number; // = 0;\n origin?: [number, number, number] | number[];\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n data: BufferSource;\n // dataLayout;\n offset: number;\n bytesPerRow: number;\n rowsPerImage: number;\n size: [number, number, number] | number[];\n}\n\nexport type CopyBufferToBufferOptions = {\n source: Buffer;\n sourceOffset?: number;\n destination: Buffer;\n destinationOffset?: number;\n size: number;\n};\n\nexport type CopyBufferToTextureOptions = {\n source: Buffer;\n byteOffset?: number;\n destination: Texture;\n mipLevel?: number // = 0;\n origin?: [number, number, number] | number[];\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n bytesPerRow: number;\n rowsPerImage: number;\n size: [number, number, number] | number[];\n};\n\nexport type CopyTextureToBufferOptions = {\n /** Texture to copy to/from. */\n source: Texture;\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n mipLevel?: number;\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from.\n * Together with `copySize`, defines the full copy sub-region.\n */\n /** Defines which aspects of the texture to copy to/from. */\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n\n /** Width to copy */\n width?: number;\n height?: number;\n depthOrArrayLayers?: number;\n origin?: number[];\n\n /** Destination buffer */\n destination: Buffer;\n /** Offset, in bytes, from the beginning of the buffer to the start of the image data (default 0) */\n byteOffset?: number;\n /**\n * The stride, in bytes, between the beginning of each block row and the subsequent block row.\n * Required if there are multiple block rows (i.e. the copy height or depth is more than one block).\n */\n bytesPerRow?: number;\n /**\n * Number of block rows per single image of the texture.\n * rowsPerImage × bytesPerRow is the stride, in bytes, between the beginning of each image of data and the subsequent image.\n * Required if there are multiple images (i.e. the copy depth is more than one).\n */\n rowsPerImage?: number;\n};\n\nexport type CopyTextureToTextureOptions = {\n /** Texture to copy to/from. */\n source: Texture;\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n mipLevel?: number;\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy from. */\n /** Defines which aspects of the {@link GPUImageCopyTexture#texture} to copy to/from. */\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n\n /** Texture to copy to/from. */\n destination: Texture;\n /** Mip-map level of the texture to copy to/from. (Default 0) */\n destinationMipLevel?: number;\n /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to. */\n destinationOrigin?: number[];\n /** Defines which aspects of the {@link GPUImageCopyTexture#texture} to copy to/from. */\n destinationAspect?: 'all' | 'stencil-only' | 'depth-only';\n\n origin?: number[];\n /** Width to copy */\n width?: number;\n height?: number;\n depthOrArrayLayers?: number;\n};\n\n// interface Queue {\n// submit(commandBuffers);\n\n// // onSubmittedWorkDone(): Promise<undefined>;\n\n// writeBuffer(options: WriteBufferOptions): void;\n// writeTexture(options: WriteTextureOptions): void;\n\n// // copyExternalImageToTexture(\n// // GPUImageCopyExternalImage source,\n// // GPUImageCopyTextureTagged destination,\n// // GPUExtent3D copySize\n// // ): void;\n// }\n\nexport type CommandEncoderProps = ResourceProps & {\n measureExecutionTime?: boolean;\n};\n\n/**\n * Encodes commands to queue that can be executed later\n */\nexport abstract class CommandEncoder extends Resource<CommandEncoderProps> {\n static override defaultProps: Required<CommandEncoderProps> = {\n ...Resource.defaultProps,\n measureExecutionTime: undefined\n };\n \n override get [Symbol.toStringTag](): string {\n return 'CommandEncoder';\n }\n\n constructor(device: Device, props: CommandEncoderProps) {\n super(device, props, CommandEncoder.defaultProps);\n }\n \n abstract finish(): void; // TODO - return the CommandBuffer?\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n // finish(options?: {id?: string}): GPUCommandBuffer;\n\n abstract copyBufferToBuffer(options: CopyBufferToBufferOptions): void;\n\n abstract copyBufferToTexture(options: CopyBufferToTextureOptions): void;\n\n abstract copyTextureToBuffer(options: CopyTextureToBufferOptions): void;\n\n abstract copyTextureToTexture(options: CopyTextureToTextureOptions): void;\n\n pushDebugGroup(groupLabel: string): void {}\n\n popDebugGroup() {}\n\n insertDebugMarker(markerLabel: string): void {}\n\n // writeTimestamp(querySet: Query, queryIndex: number): void;\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n // destination: Buffer,\n // destinationOffset?: number;\n // }): void;\n}\n"],"mappings":";;SAEQA,QAAQ;AAAAC,mBAAA,GAoIAC,MAAM,CAACC,WAAW;AANlC,OAAO,MAAeC,cAAc,SAASJ,QAAQ,CAAsB;EAMzE,KAAAC,mBAAA,IAA4C;IAC1C,OAAO,gBAAgB;EACzB;EAEAI,WAAWA,CAACC,MAAc,EAAEC,KAA0B,EAAE;IACtD,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAEH,cAAc,CAACI,YAAY,CAAC;EACnD;EAgBAC,cAAcA,CAACC,UAAkB,EAAQ,CAAC;EAE1CC,aAAaA,CAAA,EAAG,CAAC;EAEjBC,iBAAiBA,CAACC,WAAmB,EAAQ,CAAC;AAWhD;AAACC,eAAA,CA3CqBV,cAAc,kBAC4B;EAC5D,GAAGJ,QAAQ,CAACQ,YAAY;EACxBO,oBAAoB,EAAEC;AACxB,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { Buffer } from './buffer';
|
|
|
4
4
|
import type { Device } from '../device';
|
|
5
5
|
export type ComputePassProps = ResourceProps & {};
|
|
6
6
|
export declare abstract class ComputePass extends Resource<ComputePassProps> {
|
|
7
|
+
static defaultProps: Required<ComputePassProps>;
|
|
7
8
|
get [Symbol.toStringTag](): string;
|
|
8
9
|
constructor(device: Device, props: ComputePassProps);
|
|
9
10
|
abstract destroy(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/compute-pass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/compute-pass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,EAAE,CAAC;AAElD,8BAAsB,WAAY,SAAQ,QAAQ,CAAC,gBAAgB,CAAC;IAClE,OAAgB,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAEvD;IAED,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;gBAEW,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB;aAIjC,OAAO,IAAI,IAAI;IAEjC,QAAQ,CAAC,GAAG,IAAI,IAAI;IAEpB,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAErD,2EAA2E;IAG3E;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAE1D;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAEhF,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACjD,QAAQ,CAAC,aAAa,IAAI,IAAI;IAC9B,QAAQ,CAAC,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAKtD"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
let _Symbol$toStringTag;
|
|
3
|
+
import { Resource } from "./resource.js";
|
|
4
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
2
5
|
export class ComputePass extends Resource {
|
|
3
|
-
get [
|
|
6
|
+
get [_Symbol$toStringTag]() {
|
|
4
7
|
return 'ComputePass';
|
|
5
8
|
}
|
|
6
9
|
constructor(device, props) {
|
|
7
|
-
super(device, props,
|
|
10
|
+
super(device, props, Resource.defaultProps);
|
|
8
11
|
}
|
|
9
12
|
}
|
|
13
|
+
_defineProperty(ComputePass, "defaultProps", {
|
|
14
|
+
...Resource.defaultProps
|
|
15
|
+
});
|
|
10
16
|
//# sourceMappingURL=compute-pass.js.map
|