@luma.gl/webgpu 9.0.0-alpha.5 → 9.0.0-alpha.50
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 +3 -1
- package/dist/adapter/helpers/accessor-to-format.js.map +1 -1
- package/dist/adapter/helpers/convert-texture-format.d.ts +2 -2
- package/dist/adapter/helpers/convert-texture-format.d.ts.map +1 -1
- package/dist/adapter/helpers/convert-texture-format.js +0 -1
- package/dist/adapter/helpers/convert-texture-format.js.map +1 -1
- package/dist/adapter/helpers/generate-mipmaps.d.ts +1 -1
- package/dist/adapter/helpers/generate-mipmaps.js +20 -15
- package/dist/adapter/helpers/generate-mipmaps.js.map +1 -1
- package/dist/adapter/helpers/get-bind-group.d.ts +4 -4
- package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.js +8 -17
- package/dist/adapter/helpers/get-bind-group.js.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +5 -5
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +32 -40
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.d.ts +2 -2
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +51 -48
- package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.d.ts +5 -6
- package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.js +19 -33
- package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.d.ts +6 -15
- package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.js +11 -29
- package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.d.ts +6 -6
- package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.js +14 -27
- package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +4 -4
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js +6 -11
- package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgpu-external-texture.d.ts +5 -5
- package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-external-texture.js +6 -14
- package/dist/adapter/resources/webgpu-external-texture.js.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.d.ts +4 -21
- package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.js +4 -105
- package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgpu-query.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.d.ts +12 -7
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +59 -36
- package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts +14 -10
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +50 -67
- package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.d.ts +5 -5
- package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.js +11 -11
- package/dist/adapter/resources/webgpu-sampler.js.map +1 -1
- package/dist/adapter/resources/webgpu-shader.d.ts +7 -7
- package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-shader.js +11 -25
- package/dist/adapter/resources/webgpu-shader.js.map +1 -1
- package/dist/adapter/resources/webgpu-texture.d.ts +15 -8
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +17 -27
- package/dist/adapter/resources/webgpu-texture.js.map +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.d.ts +26 -0
- package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -0
- package/dist/adapter/resources/webgpu-vertex-array.js +39 -0
- package/dist/adapter/resources/webgpu-vertex-array.js.map +1 -0
- package/dist/adapter/webgpu-canvas-context.d.ts +16 -12
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-canvas-context.js +26 -47
- package/dist/adapter/webgpu-canvas-context.js.map +1 -1
- package/dist/adapter/webgpu-device.d.ts +39 -22
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +94 -95
- package/dist/adapter/webgpu-device.js.map +1 -1
- package/dist/adapter/webgpu-types.js.map +1 -1
- package/dist/dist.dev.js +2988 -0
- package/dist/glsl/glsllang.js +0 -1
- package/dist/glsl/glsllang.js.map +1 -1
- package/dist/index.cjs +1518 -0
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -7
- package/dist/index.js.map +1 -1
- package/dist.min.js +20 -0
- package/package.json +18 -9
- package/src/adapter/helpers/accessor-to-format.ts +1 -2
- package/src/adapter/helpers/convert-texture-format.ts +1 -1
- package/src/adapter/helpers/generate-mipmaps.ts +2 -2
- package/src/adapter/helpers/get-bind-group.ts +22 -12
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +55 -34
- package/src/adapter/helpers/webgpu-parameters.ts +56 -47
- package/src/adapter/resources/webgpu-buffer.ts +11 -12
- package/src/adapter/resources/webgpu-command-encoder.ts +62 -41
- package/src/adapter/resources/webgpu-compute-pass.ts +13 -13
- package/src/adapter/resources/webgpu-compute-pipeline.ts +6 -5
- package/src/adapter/resources/webgpu-external-texture.ts +5 -5
- package/src/adapter/resources/webgpu-framebuffer.ts +8 -109
- package/src/adapter/resources/webgpu-query.ts +3 -3
- package/src/adapter/resources/webgpu-render-pass.ts +74 -18
- package/src/adapter/resources/webgpu-render-pipeline.ts +64 -39
- package/src/adapter/resources/webgpu-sampler.ts +12 -5
- package/src/adapter/resources/webgpu-shader.ts +13 -10
- package/src/adapter/resources/webgpu-texture.ts +22 -8
- package/src/adapter/resources/webgpu-vertex-array.ts +74 -0
- package/src/adapter/webgpu-canvas-context.ts +52 -27
- package/src/adapter/webgpu-device.ts +158 -64
- package/src/index.ts +7 -9
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -5
- package/dist/bundle.js.map +0 -1
- package/dist/init.d.ts +0 -2
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -4
- package/dist/init.js.map +0 -1
- package/src/bundle.ts +0 -4
- package/src/init.ts +0 -4
|
@@ -2,68 +2,72 @@ function addDepthStencil(descriptor) {
|
|
|
2
2
|
descriptor.depthStencil = descriptor.depthStencil || {
|
|
3
3
|
format: 'depth24plus',
|
|
4
4
|
stencilFront: {},
|
|
5
|
-
stencilBack: {}
|
|
5
|
+
stencilBack: {},
|
|
6
|
+
depthWriteEnabled: false,
|
|
7
|
+
depthCompare: 'less-equal'
|
|
6
8
|
};
|
|
9
|
+
return descriptor.depthStencil;
|
|
7
10
|
}
|
|
8
|
-
|
|
9
11
|
export const PARAMETER_TABLE = {
|
|
10
12
|
cullMode: (parameter, value, descriptor) => {
|
|
13
|
+
descriptor.primitive = descriptor.primitive || {};
|
|
11
14
|
descriptor.primitive.cullMode = value;
|
|
12
15
|
},
|
|
13
16
|
frontFace: (parameter, value, descriptor) => {
|
|
17
|
+
descriptor.primitive = descriptor.primitive || {};
|
|
14
18
|
descriptor.primitive.frontFace = value;
|
|
15
19
|
},
|
|
16
20
|
depthWriteEnabled: (parameter, value, descriptor) => {
|
|
17
|
-
addDepthStencil(descriptor);
|
|
18
|
-
|
|
21
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
22
|
+
depthStencil.depthWriteEnabled = value;
|
|
19
23
|
},
|
|
20
24
|
depthCompare: (parameter, value, descriptor) => {
|
|
21
|
-
addDepthStencil(descriptor);
|
|
22
|
-
|
|
25
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
26
|
+
depthStencil.depthCompare = value;
|
|
23
27
|
},
|
|
24
28
|
depthFormat: (parameter, value, descriptor) => {
|
|
25
|
-
addDepthStencil(descriptor);
|
|
26
|
-
|
|
29
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
30
|
+
depthStencil.format = value;
|
|
27
31
|
},
|
|
28
32
|
depthBias: (parameter, value, descriptor) => {
|
|
29
|
-
addDepthStencil(descriptor);
|
|
30
|
-
|
|
33
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
34
|
+
depthStencil.depthBias = value;
|
|
31
35
|
},
|
|
32
36
|
depthBiasSlopeScale: (parameter, value, descriptor) => {
|
|
33
|
-
addDepthStencil(descriptor);
|
|
34
|
-
|
|
37
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
38
|
+
depthStencil.depthBiasSlopeScale = value;
|
|
35
39
|
},
|
|
36
40
|
depthBiasClamp: (parameter, value, descriptor) => {
|
|
37
|
-
addDepthStencil(descriptor);
|
|
38
|
-
|
|
41
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
42
|
+
depthStencil.depthBiasClamp = value;
|
|
39
43
|
},
|
|
40
44
|
stencilReadMask: (parameter, value, descriptor) => {
|
|
41
|
-
addDepthStencil(descriptor);
|
|
42
|
-
|
|
45
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
46
|
+
depthStencil.stencilReadMask = value;
|
|
43
47
|
},
|
|
44
48
|
stencilWriteMask: (parameter, value, descriptor) => {
|
|
45
|
-
addDepthStencil(descriptor);
|
|
46
|
-
|
|
49
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
50
|
+
depthStencil.stencilWriteMask = value;
|
|
47
51
|
},
|
|
48
52
|
stencilCompare: (parameter, value, descriptor) => {
|
|
49
|
-
addDepthStencil(descriptor);
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
54
|
+
depthStencil.stencilFront.compare = value;
|
|
55
|
+
depthStencil.stencilBack.compare = value;
|
|
52
56
|
},
|
|
53
57
|
stencilPassOperation: (parameter, value, descriptor) => {
|
|
54
|
-
addDepthStencil(descriptor);
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
59
|
+
depthStencil.stencilFront.passOp = value;
|
|
60
|
+
depthStencil.stencilBack.passOp = value;
|
|
57
61
|
},
|
|
58
62
|
stencilFailOperation: (parameter, value, descriptor) => {
|
|
59
|
-
addDepthStencil(descriptor);
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
64
|
+
depthStencil.stencilFront.failOp = value;
|
|
65
|
+
depthStencil.stencilBack.failOp = value;
|
|
62
66
|
},
|
|
63
67
|
stencilDepthFailOperation: (parameter, value, descriptor) => {
|
|
64
|
-
addDepthStencil(descriptor);
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
const depthStencil = addDepthStencil(descriptor);
|
|
69
|
+
depthStencil.stencilFront.depthFailOp = value;
|
|
70
|
+
depthStencil.stencilBack.depthFailOp = value;
|
|
67
71
|
},
|
|
68
72
|
sampleCount: (parameter, value, descriptor) => {
|
|
69
73
|
descriptor.multisample = descriptor.multisample || {};
|
|
@@ -78,16 +82,11 @@ export const PARAMETER_TABLE = {
|
|
|
78
82
|
descriptor.multisample.alphaToCoverageEnabled = value;
|
|
79
83
|
},
|
|
80
84
|
colorMask: (parameter, value, descriptor) => {
|
|
81
|
-
addColorState(descriptor);
|
|
82
|
-
const targets = descriptor.fragment.targets;
|
|
85
|
+
const targets = addColorState(descriptor);
|
|
83
86
|
targets[0].writeMask = value;
|
|
84
87
|
},
|
|
85
88
|
blendColorOperation: (parameter, value, descriptor) => {
|
|
86
89
|
addColorState(descriptor);
|
|
87
|
-
const targets = descriptor.fragment.targets;
|
|
88
|
-
targets[0].blend = targets[0].blend || {};
|
|
89
|
-
targets[0].blend.color = targets[0].blend.color || {};
|
|
90
|
-
targets[0].blend.color.operation = value;
|
|
91
90
|
}
|
|
92
91
|
};
|
|
93
92
|
const DEFAULT_PIPELINE_DESCRIPTOR = {
|
|
@@ -103,32 +102,36 @@ const DEFAULT_PIPELINE_DESCRIPTOR = {
|
|
|
103
102
|
module: undefined,
|
|
104
103
|
entryPoint: 'main',
|
|
105
104
|
targets: []
|
|
106
|
-
}
|
|
105
|
+
},
|
|
106
|
+
layout: 'auto'
|
|
107
107
|
};
|
|
108
|
-
export function applyParametersToRenderPipelineDescriptor(pipelineDescriptor
|
|
109
|
-
|
|
108
|
+
export function applyParametersToRenderPipelineDescriptor(pipelineDescriptor) {
|
|
109
|
+
let parameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
110
|
+
Object.assign(pipelineDescriptor, {
|
|
111
|
+
...DEFAULT_PIPELINE_DESCRIPTOR,
|
|
110
112
|
...pipelineDescriptor
|
|
111
113
|
});
|
|
112
114
|
setParameters(pipelineDescriptor, parameters);
|
|
113
115
|
}
|
|
114
|
-
|
|
115
116
|
function setParameters(pipelineDescriptor, parameters) {
|
|
116
117
|
for (const [key, value] of Object.entries(parameters)) {
|
|
117
118
|
const setterFunction = PARAMETER_TABLE[key];
|
|
118
|
-
|
|
119
119
|
if (!setterFunction) {
|
|
120
|
-
throw new Error(
|
|
120
|
+
throw new Error(`Illegal parameter ${key}`);
|
|
121
121
|
}
|
|
122
|
-
|
|
123
122
|
setterFunction(key, value, pipelineDescriptor);
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
|
-
|
|
127
125
|
function addColorState(descriptor) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (descriptor.fragment
|
|
131
|
-
|
|
126
|
+
var _descriptor$fragment, _descriptor$fragment2, _descriptor$fragment3, _descriptor$fragment4;
|
|
127
|
+
descriptor.fragment.targets = ((_descriptor$fragment = descriptor.fragment) === null || _descriptor$fragment === void 0 ? void 0 : _descriptor$fragment.targets) || [];
|
|
128
|
+
if (!Array.isArray((_descriptor$fragment2 = descriptor.fragment) === null || _descriptor$fragment2 === void 0 ? void 0 : _descriptor$fragment2.targets)) {
|
|
129
|
+
throw new Error('colorstate');
|
|
130
|
+
}
|
|
131
|
+
if (((_descriptor$fragment3 = descriptor.fragment) === null || _descriptor$fragment3 === void 0 || (_descriptor$fragment3 = _descriptor$fragment3.targets) === null || _descriptor$fragment3 === void 0 ? void 0 : _descriptor$fragment3.length) === 0) {
|
|
132
|
+
var _descriptor$fragment$;
|
|
133
|
+
(_descriptor$fragment$ = descriptor.fragment.targets) === null || _descriptor$fragment$ === void 0 ? void 0 : _descriptor$fragment$.push({});
|
|
132
134
|
}
|
|
135
|
+
return (_descriptor$fragment4 = descriptor.fragment) === null || _descriptor$fragment4 === void 0 ? void 0 : _descriptor$fragment4.targets;
|
|
133
136
|
}
|
|
134
137
|
//# sourceMappingURL=webgpu-parameters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapter/helpers/webgpu-parameters.ts"],"names":["addDepthStencil","descriptor","depthStencil","format","stencilFront","stencilBack","PARAMETER_TABLE","cullMode","parameter","value","primitive","frontFace","depthWriteEnabled","depthCompare","depthFormat","depthBias","depthBiasSlopeScale","depthBiasClamp","stencilReadMask","stencilWriteMask","stencilCompare","compare","stencilPassOperation","passOp","stencilFailOperation","failOp","stencilDepthFailOperation","depthFailOp","sampleCount","multisample","count","sampleMask","mask","sampleAlphaToCoverageEnabled","alphaToCoverageEnabled","colorMask","addColorState","targets","fragment","writeMask","blendColorOperation","blend","color","operation","DEFAULT_PIPELINE_DESCRIPTOR","topology","vertex","module","undefined","entryPoint","applyParametersToRenderPipelineDescriptor","pipelineDescriptor","parameters","Object","assign","setParameters","key","entries","setterFunction","Error","length","push"],"mappings":"AAEA,SAASA,eAAT,CAAyBC,UAAzB,EAAwE;AACtEA,EAAAA,UAAU,CAACC,YAAX,GAA0BD,UAAU,CAACC,YAAX,IAA2B;AAEnDC,IAAAA,MAAM,EAAE,aAF2C;AAGnDC,IAAAA,YAAY,EAAE,EAHqC;AAInDC,IAAAA,WAAW,EAAE;AAJsC,GAArD;AAMD;;AAOD,OAAO,MAAMC,eAAmD,GAAG;AAGjEC,EAAAA,QAAQ,EAAE,CAACC,SAAD,EAA8BC,KAA9B,EAA0CR,UAA1C,KAAsF;AAC9FA,IAAAA,UAAU,CAACS,SAAX,CAAqBH,QAArB,GAAgCE,KAAhC;AACD,GALgE;AAOjEE,EAAAA,SAAS,EAAE,CAACH,SAAD,EAA8BC,KAA9B,EAA0CR,UAA1C,KAAsF;AAC/FA,IAAAA,UAAU,CAACS,SAAX,CAAqBC,SAArB,GAAiCF,KAAjC;AACD,GATgE;AAajEG,EAAAA,iBAAiB,EAAE,CAACJ,SAAD,EAA8BC,KAA9B,EAA0CR,UAA1C,KAAsF;AACvGD,IAAAA,eAAe,CAACC,UAAD,CAAf;AACAA,IAAAA,UAAU,CAACC,YAAX,CAAwBU,iBAAxB,GAA4CH,KAA5C;AACD,GAhBgE;AAkBjEI,EAAAA,YAAY,EAAE,CAACL,SAAD,EAA8BC,KAA9B,EAA0CR,UAA1C,KAAsF;AAClGD,IAAAA,eAAe,CAACC,UAAD,CAAf;AACAA,IAAAA,UAAU,CAACC,YAAX,CAAwBW,YAAxB,GAAuCJ,KAAvC;AACD,GArBgE;AAuBjEK,EAAAA,WAAW,EAAE,CAACN,SAAD,EAA8BC,KAA9B,EAA0CR,UAA1C,KAAsF;AACjGD,IAAAA,eAAe,CAACC,UAAD,CAAf;AACAA,IAAAA,UAAU,CAACC,YAAX,CAAwBC,MAAxB,GA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uC,CAA3C,EAA8C;AAE5C3D,IAAAA,UAAU,CAACqC,QAAX,CAAoBD,OAApB,CAA4BwB,IAA5B,CAAiC,EAAjC;AACD;AACF","sourcesContent":["import {Parameters} from '@luma.gl/api';\n\nfunction addDepthStencil(descriptor: GPURenderPipelineDescriptor): void {\n descriptor.depthStencil = descriptor.depthStencil || {\n // required, set something\n format: 'depth24plus',\n stencilFront: {},\n stencilBack: {}\n };\n}\n\n/**\n * Supports for luma.gl's flat parameter space\n * Populates the corresponding sub-objects in a GPURenderPipelineDescriptor\n */\n// @ts-expect-error\nexport const PARAMETER_TABLE: Record<keyof Parameters, Function> = {\n // RASTERIZATION PARAMETERS\n\n cullMode: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.primitive.cullMode = value;\n },\n\n frontFace: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.primitive.frontFace = value;\n },\n\n // DEPTH\n\n depthWriteEnabled: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.depthWriteEnabled = value;\n },\n\n depthCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.depthCompare = value;\n },\n\n depthFormat: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.format = value;\n },\n\n depthBias: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.depthBias = value;\n },\n\n depthBiasSlopeScale: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.depthBiasSlopeScale = value;\n },\n\n depthBiasClamp: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.depthBiasClamp = value;\n },\n\n // STENCIL\n\n stencilReadMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilReadMask = value;\n },\n\n stencilWriteMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilWriteMask = value;\n },\n\n stencilCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilFront.compare = value;\n descriptor.depthStencil.stencilBack.compare = value;\n },\n\n stencilPassOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilFront.passOp = value;\n descriptor.depthStencil.stencilBack.passOp = value;\n },\n\n stencilFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilFront.failOp = value;\n descriptor.depthStencil.stencilBack.failOp = value;\n },\n\n stencilDepthFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilFront.depthFailOp = value;\n descriptor.depthStencil.stencilBack.depthFailOp = value;\n },\n\n // MULTISAMPLE\n\n sampleCount: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.count = value;\n },\n\n sampleMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.mask = value;\n },\n\n sampleAlphaToCoverageEnabled: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.alphaToCoverageEnabled = value;\n },\n\n // COLOR\n\n colorMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n const targets = descriptor.fragment.targets as GPUColorTargetState[];\n targets[0].writeMask = value;\n },\n\n blendColorOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n const targets = descriptor.fragment.targets as GPUColorTargetState[];\n // @ts-expect-error\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].blend.color.operation = value;\n }\n\n /*\n blendColorSrcTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].blend.color.srcTarget = value;\n },\n\n blendColorDstTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].blend.color.dstTarget = value;\n },\n\n blendAlphaOperation: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.operation = value;\n },\n\n blendAlphaSrcTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.srcTarget = value;\n },\n\n blendAlphaDstTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.dstTarget = value;\n },\n */\n};\n\nconst DEFAULT_PIPELINE_DESCRIPTOR: GPURenderPipelineDescriptor = {\n // depthStencil: {\n // stencilFront: {},\n // stencilBack: {},\n // // depthWriteEnabled: true,\n // // depthCompare: 'less',\n // // format: 'depth24plus-stencil8',\n // },\n\n primitive: {\n cullMode: 'back',\n topology: 'triangle-list'\n },\n\n vertex: {\n module: undefined,\n entryPoint: 'main'\n },\n\n fragment: {\n module: undefined,\n entryPoint: 'main',\n targets: [\n // { format: props.color0Format || 'bgra8unorm' }\n ]\n }\n};\n\nexport function applyParametersToRenderPipelineDescriptor(\n pipelineDescriptor: GPURenderPipelineDescriptor,\n parameters: Parameters = {}\n): void {\n // Apply defaults\n Object.assign(pipelineDescriptor, {...DEFAULT_PIPELINE_DESCRIPTOR, ...pipelineDescriptor});\n setParameters(pipelineDescriptor, parameters);\n}\n\n// Apply any supplied parameters\nfunction setParameters(\n pipelineDescriptor: GPURenderPipelineDescriptor,\n parameters: Parameters\n): void {\n for (const [key, value] of Object.entries(parameters)) {\n const setterFunction = PARAMETER_TABLE[key as keyof Parameters];\n if (!setterFunction) {\n throw new Error(`Illegal parameter ${key}`);\n }\n setterFunction(key, value, pipelineDescriptor);\n }\n}\n\nfunction addColorState(descriptor: GPURenderPipelineDescriptor): void {\n descriptor.fragment.targets = descriptor.fragment.targets || [];\n // @ts-expect-error\n if (descriptor.fragment.targets.length === 0) {\n // @ts-expect-error\n descriptor.fragment.targets.push({});\n }\n}\n"],"file":"webgpu-parameters.js"}
|
|
1
|
+
{"version":3,"file":"webgpu-parameters.js","names":["addDepthStencil","descriptor","depthStencil","format","stencilFront","stencilBack","depthWriteEnabled","depthCompare","PARAMETER_TABLE","cullMode","parameter","value","primitive","frontFace","depthFormat","depthBias","depthBiasSlopeScale","depthBiasClamp","stencilReadMask","stencilWriteMask","stencilCompare","compare","stencilPassOperation","passOp","stencilFailOperation","failOp","stencilDepthFailOperation","depthFailOp","sampleCount","multisample","count","sampleMask","mask","sampleAlphaToCoverageEnabled","alphaToCoverageEnabled","colorMask","targets","addColorState","writeMask","blendColorOperation","DEFAULT_PIPELINE_DESCRIPTOR","topology","vertex","module","undefined","entryPoint","fragment","layout","applyParametersToRenderPipelineDescriptor","pipelineDescriptor","parameters","arguments","length","Object","assign","setParameters","key","entries","setterFunction","Error","_descriptor$fragment","_descriptor$fragment2","_descriptor$fragment3","_descriptor$fragment4","Array","isArray","_descriptor$fragment$","push"],"sources":["../../../src/adapter/helpers/webgpu-parameters.ts"],"sourcesContent":["import {Parameters} from '@luma.gl/core';\n\nfunction addDepthStencil(descriptor: GPURenderPipelineDescriptor): GPUDepthStencilState {\n descriptor.depthStencil = descriptor.depthStencil || {\n // required, set something\n format: 'depth24plus',\n stencilFront: {},\n stencilBack: {},\n // TODO can this cause trouble? Should we set to WebGPU defaults? Are there defaults?\n depthWriteEnabled: false,\n depthCompare: 'less-equal'\n };\n return descriptor.depthStencil;\n}\n\n/**\n * Supports for luma.gl's flat parameter space\n * Populates the corresponding sub-objects in a GPURenderPipelineDescriptor\n */\n// @ts-expect-error\nexport const PARAMETER_TABLE: Record<keyof Parameters, Function> = {\n // RASTERIZATION PARAMETERS\n\n cullMode: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.primitive = descriptor.primitive || {};\n descriptor.primitive.cullMode = value;\n },\n\n frontFace: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.primitive = descriptor.primitive || {};\n descriptor.primitive.frontFace = value;\n },\n\n // DEPTH\n\n depthWriteEnabled: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthWriteEnabled = value;\n },\n\n depthCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthCompare = value;\n },\n\n depthFormat: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.format = value;\n },\n\n depthBias: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBias = value;\n },\n\n depthBiasSlopeScale: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasSlopeScale = value;\n },\n\n depthBiasClamp: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasClamp = value;\n },\n\n // STENCIL\n\n stencilReadMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilReadMask = value;\n },\n\n stencilWriteMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilWriteMask = value;\n },\n\n stencilCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.compare = value;\n depthStencil.stencilBack.compare = value;\n },\n\n stencilPassOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.passOp = value;\n depthStencil.stencilBack.passOp = value;\n },\n\n stencilFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.failOp = value;\n depthStencil.stencilBack.failOp = value;\n },\n\n stencilDepthFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.depthFailOp = value;\n depthStencil.stencilBack.depthFailOp = value;\n },\n\n // MULTISAMPLE\n\n sampleCount: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.count = value;\n },\n\n sampleMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.mask = value;\n },\n\n sampleAlphaToCoverageEnabled: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.alphaToCoverageEnabled = value;\n },\n\n // COLOR\n\n colorMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const targets = addColorState(descriptor);\n targets[0].writeMask = value;\n },\n\n blendColorOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n // const targets = addColorState(descriptor);\n // const target = targets[0];\n // const blend: GPUBlendState = target.blend || {color: {alpha: 0}};\n // blend.color = blend.color || {};\n // target.blend.color.operation = value;\n }\n\n /*\n blendColorSrcTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].blend.color.srcTarget = value;\n },\n\n blendColorDstTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].blend.color.dstTarget = value;\n },\n\n blendAlphaOperation: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.operation = value;\n },\n\n blendAlphaSrcTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.srcTarget = value;\n },\n\n blendAlphaDstTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.dstTarget = value;\n },\n */\n};\n\nconst DEFAULT_PIPELINE_DESCRIPTOR: GPURenderPipelineDescriptor = {\n // depthStencil: {\n // stencilFront: {},\n // stencilBack: {},\n // // depthWriteEnabled: true,\n // // depthCompare: 'less',\n // // format: 'depth24plus-stencil8',\n // },\n\n primitive: {\n cullMode: 'back',\n topology: 'triangle-list'\n },\n\n vertex: {\n module: undefined!,\n entryPoint: 'main'\n },\n\n fragment: {\n module: undefined!,\n entryPoint: 'main',\n targets: [\n // { format: props.color0Format || 'bgra8unorm' }\n ]\n },\n\n layout: 'auto'\n};\n\nexport function applyParametersToRenderPipelineDescriptor(\n pipelineDescriptor: GPURenderPipelineDescriptor,\n parameters: Parameters = {}\n): void {\n // Apply defaults\n Object.assign(pipelineDescriptor, {...DEFAULT_PIPELINE_DESCRIPTOR, ...pipelineDescriptor});\n setParameters(pipelineDescriptor, parameters);\n}\n\n// Apply any supplied parameters\nfunction setParameters(\n pipelineDescriptor: GPURenderPipelineDescriptor,\n parameters: Parameters\n): void {\n for (const [key, value] of Object.entries(parameters)) {\n const setterFunction = PARAMETER_TABLE[key as keyof Parameters];\n if (!setterFunction) {\n throw new Error(`Illegal parameter ${key}`);\n }\n setterFunction(key, value, pipelineDescriptor);\n }\n}\n\nfunction addColorState(descriptor: GPURenderPipelineDescriptor): GPUColorTargetState[] {\n descriptor.fragment.targets = descriptor.fragment?.targets || [];\n if (!Array.isArray(descriptor.fragment?.targets)) {\n throw new Error('colorstate');\n }\n if (descriptor.fragment?.targets?.length === 0) {\n descriptor.fragment.targets?.push({});\n }\n return descriptor.fragment?.targets as GPUColorTargetState[];\n}\n"],"mappings":"AAEA,SAASA,eAAeA,CAACC,UAAuC,EAAwB;EACtFA,UAAU,CAACC,YAAY,GAAGD,UAAU,CAACC,YAAY,IAAI;IAEnDC,MAAM,EAAE,aAAa;IACrBC,YAAY,EAAE,CAAC,CAAC;IAChBC,WAAW,EAAE,CAAC,CAAC;IAEfC,iBAAiB,EAAE,KAAK;IACxBC,YA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AACV,OAAO,GAAG,EAAAwB,oBAAA,GAAA3D,UAAU,CAAC6C,QAAQ,cAAAc,oBAAA,uBAAnBA,oBAAA,CAAqBxB,OAAO,KAAI,EAAE;EAChE,IAAI,CAAC4B,KAAK,CAACC,OAAO,EAAAJ,qBAAA,GAAC5D,UAAU,CAAC6C,QAAQ,cAAAe,qBAAA,uBAAnBA,qBAAA,CAAqBzB,OAAO,CAAC,EAAE;IAChD,MAAM,IAAIuB,KAAK,CAAC,YAAY,CAAC;EAC/B;EACA,IAAI,EAAAG,qBAAA,GAAA7D,UAAU,CAAC6C,QAAQ,cAAAgB,qBAAA,gBAAAA,qBAAA,GAAnBA,qBAAA,CAAqB1B,OAAO,cAAA0B,qBAAA,uBAA5BA,qBAAA,CAA8BV,MAAM,MAAK,CAAC,EAAE;IAAA,IAAAc,qBAAA;IAC9C,CAAAA,qBAAA,GAAAjE,UAAU,CAAC6C,QAAQ,CAACV,OAAO,cAAA8B,qBAAA,uBAA3BA,qBAAA,CAA6BC,IAAI,CAAC,CAAC,CAAC,CAAC;EACvC;EACA,QAAAJ,qBAAA,GAAO9D,UAAU,CAAC6C,QAAQ,cAAAiB,qBAAA,uBAAnBA,qBAAA,CAAqB3B,OAAO;AACrC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
/// <reference types="
|
|
2
|
-
import { Buffer, BufferProps } from '@luma.gl/
|
|
3
|
-
import type WebGPUDevice from '../webgpu-device';
|
|
4
|
-
export
|
|
1
|
+
/// <reference types="dist" />
|
|
2
|
+
import { Buffer, BufferProps } from '@luma.gl/core';
|
|
3
|
+
import type { WebGPUDevice } from '../webgpu-device';
|
|
4
|
+
export declare class WebGPUBuffer extends Buffer {
|
|
5
5
|
readonly device: WebGPUDevice;
|
|
6
6
|
readonly handle: GPUBuffer;
|
|
7
7
|
readonly byteLength: number;
|
|
8
8
|
constructor(device: WebGPUDevice, props: BufferProps);
|
|
9
|
-
protected createHandle(mapBuffer: boolean): GPUBuffer;
|
|
10
9
|
destroy(): void;
|
|
11
10
|
write(data: ArrayBufferView, byteOffset?: number): void;
|
|
12
|
-
readAsync(byteOffset?: number, byteLength?: number): Promise<
|
|
11
|
+
readAsync(byteOffset?: number, byteLength?: number): Promise<Uint8Array>;
|
|
13
12
|
_writeMapped<TypedArray>(typedArray: TypedArray): void;
|
|
14
13
|
mapAsync(mode: number, offset?: number, size?: number): Promise<void>;
|
|
15
14
|
getMappedRange(offset?: number, size?: number): ArrayBuffer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"webgpu-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAMnD,qBAAa,YAAa,SAAQ,MAAM;IACtC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW;IA4B3C,OAAO,IAAI,IAAI;IAKf,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,SAAI;IAUrC,SAAS,CAAC,UAAU,GAAE,MAAU,EAAE,UAAU,GAAE,MAAwB,GAAG,OAAO,CAAC,UAAU,CAAC;IAmB3G,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;IAQtD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE,cAAc,CAAC,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW;IAI9D,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -1,54 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Buffer } from '@luma.gl/api';
|
|
3
|
-
|
|
1
|
+
import { Buffer } from '@luma.gl/core';
|
|
4
2
|
function getByteLength(props) {
|
|
5
3
|
var _props$data;
|
|
6
|
-
|
|
7
4
|
return props.byteLength || ((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.byteLength) || 0;
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
export default class WebGPUBuffer extends Buffer {
|
|
6
|
+
export class WebGPUBuffer extends Buffer {
|
|
11
7
|
constructor(device, props) {
|
|
12
8
|
super(device, props);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_defineProperty(this, "handle", void 0);
|
|
17
|
-
|
|
18
|
-
_defineProperty(this, "byteLength", void 0);
|
|
19
|
-
|
|
9
|
+
this.device = void 0;
|
|
10
|
+
this.handle = void 0;
|
|
11
|
+
this.byteLength = void 0;
|
|
20
12
|
this.device = device;
|
|
21
13
|
this.byteLength = getByteLength(props);
|
|
22
14
|
const mapBuffer = Boolean(props.data);
|
|
15
|
+
const size = Math.ceil(this.byteLength / 4) * 4;
|
|
23
16
|
this.handle = this.props.handle || this.device.handle.createBuffer({
|
|
24
|
-
size
|
|
17
|
+
size,
|
|
25
18
|
usage: this.props.usage || GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
|
|
26
19
|
mappedAtCreation: this.props.mappedAtCreation || mapBuffer,
|
|
27
20
|
label: this.props.id
|
|
28
21
|
});
|
|
29
|
-
|
|
30
22
|
if (props.data) {
|
|
31
23
|
this._writeMapped(props.data);
|
|
32
24
|
}
|
|
33
|
-
|
|
34
25
|
if (mapBuffer && !props.mappedAtCreation) {
|
|
35
26
|
this.handle.unmap();
|
|
36
27
|
}
|
|
37
28
|
}
|
|
38
|
-
|
|
39
|
-
createHandle(mapBuffer) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
29
|
destroy() {
|
|
44
30
|
this.handle.destroy();
|
|
45
31
|
}
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
write(data) {
|
|
33
|
+
let byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
48
34
|
this.device.handle.queue.writeBuffer(this.handle, byteOffset, data.buffer, data.byteOffset, data.byteLength);
|
|
49
35
|
}
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
async readAsync() {
|
|
37
|
+
let byteOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
38
|
+
let byteLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.byteLength;
|
|
52
39
|
const tempBuffer = new WebGPUBuffer(this.device, {
|
|
53
40
|
usage: Buffer.MAP_READ | Buffer.COPY_DST,
|
|
54
41
|
byteLength
|
|
@@ -60,25 +47,24 @@ export default class WebGPUBuffer extends Buffer {
|
|
|
60
47
|
const arrayBuffer = tempBuffer.handle.getMappedRange().slice(0);
|
|
61
48
|
tempBuffer.handle.unmap();
|
|
62
49
|
tempBuffer.destroy();
|
|
63
|
-
return arrayBuffer;
|
|
50
|
+
return new Uint8Array(arrayBuffer);
|
|
64
51
|
}
|
|
65
|
-
|
|
66
52
|
_writeMapped(typedArray) {
|
|
67
53
|
const arrayBuffer = this.handle.getMappedRange();
|
|
68
54
|
new typedArray.constructor(arrayBuffer).set(typedArray);
|
|
69
55
|
}
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
mapAsync(mode) {
|
|
57
|
+
let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
58
|
+
let size = arguments.length > 2 ? arguments[2] : undefined;
|
|
72
59
|
return this.handle.mapAsync(mode, offset, size);
|
|
73
60
|
}
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
getMappedRange() {
|
|
62
|
+
let offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
63
|
+
let size = arguments.length > 1 ? arguments[1] : undefined;
|
|
76
64
|
return this.handle.getMappedRange(offset, size);
|
|
77
65
|
}
|
|
78
|
-
|
|
79
66
|
unmap() {
|
|
80
67
|
this.handle.unmap();
|
|
81
68
|
}
|
|
82
|
-
|
|
83
69
|
}
|
|
84
70
|
//# sourceMappingURL=webgpu-buffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webgpu-buffer.js","names":["Buffer","getByteLength","props","_props$data","byteLength","data","WebGPUBuffer","constructor","device","handle","mapBuffer","Boolean","size","Math","ceil","createBuffer","usage","GPUBufferUsage","VERTEX","COPY_DST","mappedAtCreation","label","id","_writeMapped","unmap","destroy","write","byteOffset","arguments","length","undefined","queue","writeBuffer","buffer","readAsync","tempBuffer","MAP_READ","commandEncoder","createCommandEncoder","copyBufferToBuffer","submit","finish","mapAsync","GPUMapMode","READ","arrayBuffer","getMappedRange","slice","Uint8Array","typedArray","set","mode","offset"],"sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"sourcesContent":["// WEBGPU Buffer implementation\nimport {Buffer, BufferProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nfunction getByteLength(props: BufferProps): number {\n return props.byteLength || props.data?.byteLength || 0;\n}\n\nexport class WebGPUBuffer extends Buffer {\n readonly device: WebGPUDevice;\n readonly handle: GPUBuffer;\n readonly byteLength: number;\n\n constructor(device: WebGPUDevice, props: BufferProps) {\n super(device, props);\n this.device = device;\n\n this.byteLength = getByteLength(props);\n const mapBuffer = Boolean(props.data);\n\n // WebGPU buffers must be aligned to 4 bytes\n const size = Math.ceil(this.byteLength / 4) * 4;\n\n this.handle = this.props.handle || this.device.handle.createBuffer({\n size,\n // usage defaults to vertex\n usage: this.props.usage || (GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST),\n mappedAtCreation: this.props.mappedAtCreation || mapBuffer,\n label: this.props.id\n });\n\n if (props.data) {\n this._writeMapped(props.data);\n // this.handle.writeAsync({data: props.data, map: false, unmap: false});\n }\n\n if (mapBuffer && !props.mappedAtCreation) {\n this.handle.unmap();\n }\n }\n\n override destroy(): void {\n this.handle.destroy();\n }\n\n // WebGPU provides multiple ways to write a buffer...\n override write(data: ArrayBufferView, byteOffset = 0) {\n this.device.handle.queue.writeBuffer(\n this.handle,\n byteOffset,\n data.buffer,\n data.byteOffset,\n data.byteLength\n );\n }\n\n override async readAsync(byteOffset: number = 0, byteLength: number = this.byteLength): Promise<Uint8Array> {\n // We need MAP_READ flag, but only COPY_DST buffers can have MAP_READ flag, so we need to create a temp buffer\n const tempBuffer = new WebGPUBuffer(this.device, {usage: Buffer.MAP_READ | Buffer.COPY_DST, byteLength});\n\n // Now do a GPU-side copy into the temp buffer we can actually read.\n // TODO - we are spinning up an independent command queue here, what does this mean\n const commandEncoder = this.device.handle.createCommandEncoder();\n commandEncoder.copyBufferToBuffer(this.handle, byteOffset, tempBuffer.handle, 0, byteLength);\n this.device.handle.queue.submit([commandEncoder.finish()]);\n\n // Map the temp buffer and read the data.\n await tempBuffer.handle.mapAsync(GPUMapMode.READ, byteOffset, byteLength);\n const arrayBuffer = tempBuffer.handle.getMappedRange().slice(0);\n tempBuffer.handle.unmap();\n tempBuffer.destroy();\n\n return new Uint8Array(arrayBuffer);\n }\n\n _writeMapped<TypedArray>(typedArray: TypedArray): void {\n const arrayBuffer = this.handle.getMappedRange();\n // @ts-expect-error\n new typedArray.constructor(arrayBuffer).set(typedArray);\n }\n\n // WEBGPU API\n\n mapAsync(mode: number, offset: number = 0, size?: number): Promise<void> {\n return this.handle.mapAsync(mode, offset, size);\n }\n\n getMappedRange(offset: number = 0, size?: number): ArrayBuffer {\n return this.handle.getMappedRange(offset, size);\n }\n\n unmap(): void {\n this.handle.unmap();\n }\n}\n"],"mappings":"AACA,SAAQA,MAA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ommandEncoderProps, Buffer, Texture } from '@luma.gl/
|
|
3
|
-
import WebGPUDevice from '../webgpu-device';
|
|
4
|
-
export
|
|
1
|
+
/// <reference types="dist" />
|
|
2
|
+
import { CommandEncoder, CommandEncoderProps, Buffer, Texture, CopyTextureToTextureOptions, CopyTextureToBufferOptions } from '@luma.gl/core';
|
|
3
|
+
import { WebGPUDevice } from '../webgpu-device';
|
|
4
|
+
export declare class WebGPUCommandEncoder extends CommandEncoder {
|
|
5
5
|
readonly device: WebGPUDevice;
|
|
6
6
|
readonly handle: GPUCommandEncoder;
|
|
7
7
|
constructor(device: WebGPUDevice, props: CommandEncoderProps);
|
|
8
|
-
protected createHandle(): GPUCommandEncoder;
|
|
9
8
|
destroy(): void;
|
|
10
9
|
finish(options?: {
|
|
11
10
|
id?: string;
|
|
@@ -28,16 +27,8 @@ export default class WebGPUCommandEncoder extends CommandEncoder {
|
|
|
28
27
|
origin?: number[] | [number, number, number];
|
|
29
28
|
extent?: number[] | [number, number, number];
|
|
30
29
|
}): void;
|
|
31
|
-
copyTextureToBuffer(options:
|
|
32
|
-
|
|
33
|
-
destination: GPUImageCopyBuffer;
|
|
34
|
-
copySize: GPUExtent3D;
|
|
35
|
-
}): void;
|
|
36
|
-
copyTextureToTexture(options: {
|
|
37
|
-
source: GPUImageCopyTexture;
|
|
38
|
-
destination: GPUImageCopyTexture;
|
|
39
|
-
copySize: GPUExtent3D;
|
|
40
|
-
}): void;
|
|
30
|
+
copyTextureToBuffer(options: CopyTextureToBufferOptions): void;
|
|
31
|
+
copyTextureToTexture(options: CopyTextureToTextureOptions): void;
|
|
41
32
|
pushDebugGroup(groupLabel: string): void;
|
|
42
33
|
popDebugGroup(): void;
|
|
43
34
|
insertDebugMarker(markerLabel: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-command-encoder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,c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AC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;KAC7C,GACE,IAAI;IAuBP,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAW9D,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAWvD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIxC,aAAa,IAAI,IAAI;IAIrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAatD"}
|
|
@@ -1,39 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export default class WebGPUCommandEncoder extends CommandEncoder {
|
|
1
|
+
import { CommandEncoder, cast } from '@luma.gl/core';
|
|
2
|
+
export class WebGPUCommandEncoder extends CommandEncoder {
|
|
4
3
|
constructor(device, props) {
|
|
5
|
-
super(props);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "handle", void 0);
|
|
10
|
-
|
|
4
|
+
super(device, props);
|
|
5
|
+
this.device = void 0;
|
|
6
|
+
this.handle = void 0;
|
|
11
7
|
this.device = device;
|
|
12
|
-
this.handle =
|
|
8
|
+
this.handle = props.handle || this.device.handle.createCommandEncoder({});
|
|
13
9
|
this.handle.label = this.props.id;
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
createHandle() {
|
|
17
|
-
return this.device.handle.createCommandEncoder({
|
|
18
|
-
measureExecutionTime: this.props.measureExecutionTime
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
11
|
destroy() {}
|
|
23
|
-
|
|
24
12
|
finish(options) {
|
|
25
13
|
return this.finish(options);
|
|
26
14
|
}
|
|
27
|
-
|
|
28
15
|
copyBufferToBuffer(options) {
|
|
29
16
|
var _options$sourceOffset, _options$destinationO, _options$size;
|
|
30
|
-
|
|
31
17
|
this.handle.copyBufferToBuffer(cast(options.source).handle, (_options$sourceOffset = options.sourceOffset) !== null && _options$sourceOffset !== void 0 ? _options$sourceOffset : 0, cast(options.destination).handle, (_options$destinationO = options.destinationOffset) !== null && _options$destinationO !== void 0 ? _options$destinationO : 0, (_options$size = options.size) !== null && _options$size !== void 0 ? _options$size : 0);
|
|
32
18
|
}
|
|
33
|
-
|
|
34
19
|
copyBufferToTexture(options) {
|
|
35
20
|
var _options$offset, _options$mipLevel, _options$origin;
|
|
36
|
-
|
|
37
21
|
this.handle.copyBufferToTexture({
|
|
38
22
|
buffer: cast(options.source).handle,
|
|
39
23
|
offset: (_options$offset = options.offset) !== null && _options$offset !== void 0 ? _options$offset : 0,
|
|
@@ -43,24 +27,22 @@ export default class WebGPUCommandEncoder extends CommandEncoder {
|
|
|
43
27
|
texture: cast(options.destination).handle,
|
|
44
28
|
mipLevel: (_options$mipLevel = options.mipLevel) !== null && _options$mipLevel !== void 0 ? _options$mipLevel : 0,
|
|
45
29
|
origin: (_options$origin = options.origin) !== null && _options$origin !== void 0 ? _options$origin : {}
|
|
46
|
-
},
|
|
30
|
+
}, {
|
|
31
|
+
width: options.extent[0],
|
|
32
|
+
height: options.extent[1],
|
|
33
|
+
depthOrArrayLayers: options.extent[2]
|
|
34
|
+
});
|
|
47
35
|
}
|
|
48
|
-
|
|
49
36
|
copyTextureToBuffer(options) {}
|
|
50
|
-
|
|
51
37
|
copyTextureToTexture(options) {}
|
|
52
|
-
|
|
53
38
|
pushDebugGroup(groupLabel) {
|
|
54
39
|
this.handle.pushDebugGroup(groupLabel);
|
|
55
40
|
}
|
|
56
|
-
|
|
57
41
|
popDebugGroup() {
|
|
58
42
|
this.handle.popDebugGroup();
|
|
59
43
|
}
|
|
60
|
-
|
|
61
44
|
insertDebugMarker(markerLabel) {
|
|
62
45
|
this.handle.insertDebugMarker(markerLabel);
|
|
63
46
|
}
|
|
64
|
-
|
|
65
47
|
}
|
|
66
48
|
//# sourceMappingURL=webgpu-command-encoder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webgpu-command-encoder.js","names":["CommandEncoder","cast","WebGPUCommandEncoder","constructor","device","props","handle","createCommandEncoder","label","id","destroy","finish","options","copyBufferToBuffer","_options$sourceOffset","_options$destinationO","_options$size","source","sourceOffset","destination","destinationOffset","size","copyBufferToTexture","_options$offset","_options$mipLevel","_options$origin","buffer","offset","bytesPerRow","rowsPerImage","texture","mipLevel","origin","width","extent","height","depthOrArrayLayers","copyTextureToBuffer","copyTextureToTexture","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgpu-command-encoder.ts"],"sourcesContent":["import {CommandEncoder, CommandEncoderProps, Buffer, Texture, cast, \n CopyTextureToTextureOptions, \n CopyTextureToBufferOptions\n // CopyBufferToTextureOptions,\n // CopyBufferToBufferOptions,\n} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\nimport {WebGPUTexture} from './webgpu-texture';\n\nexport class WebGPUCommandEncoder extends CommandEncoder {\n readonly device: WebGPUDevice;\n readonly handle: GPUCommandEncoder;\n\n constructor(device: WebGPUDevice, props: CommandEncoderProps) {\n super(device, props);\n this.device = device;\n this.handle = props.handle || this.device.handle.createCommandEncoder({\n // TODO was this removed in standard?\n // measureExecutionTime: this.props.measureExecutionTime\n });\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {}\n\n finish(options?: {id?: string}): GPUCommandBuffer {\n return this.finish(options);\n }\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n\n copyBufferToBuffer(options: // CopyBufferToBufferOptions\n {\n source: Buffer,\n sourceOffset?: number,\n destination: Buffer,\n destinationOffset?: number,\n size?: number\n }\n ): void {\n this.handle.copyBufferToBuffer(\n cast<WebGPUBuffer>(options.source).handle,\n options.sourceOffset ?? 0,\n cast<WebGPUBuffer>(options.destination).handle,\n options.destinationOffset ?? 0,\n options.size ?? 0\n );\n }\n\n copyBufferToTexture(options: // CopyBufferToTextureOptions\n {\n source: Buffer,\n offset?: number,\n bytesPerRow: number,\n rowsPerImage: number,\n\n destination: Texture,\n mipLevel?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only',\n\n origin?: number[] | [number, number, number],\n extent?: number[] | [number, number, number]\n }\n ): void {\n this.handle.copyBufferToTexture(\n {\n buffer: cast<WebGPUBuffer>(options.source).handle,\n offset: options.offset ?? 0,\n bytesPerRow: options.bytesPerRow,\n rowsPerImage: options.rowsPerImage,\n },\n {\n texture: cast<WebGPUTexture>(options.destination).handle,\n mipLevel: options.mipLevel ?? 0,\n origin: options.origin ?? {},\n // aspect: options.aspect\n },\n {\n // TODO exclamation mark hack\n width: options.extent[0],\n height: options.extent[1],\n depthOrArrayLayers: options.extent[2]\n }\n );\n }\n\n copyTextureToBuffer(options: CopyTextureToBufferOptions): void {\n // this.handle.copyTextureToBuffer(\n // // source\n // {},\n // // destination\n // {},\n // // copySize\n // {}\n // );\n }\n\n copyTextureToTexture(options: CopyTextureToTextureOptions): void {\n // this.handle.copyTextureToTexture(\n // // source\n // {},\n // // destination\n // {},\n // // copySize\n // {}\n // );\n }\n\n override pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n\n override popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n\n override insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\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}"],"mappings":"AAAA,SAAQA,cAAc,EAAwCC,IAAI,QAK3D,eAAe;AAKtB,OAAO,MAAMC,oBAAoB,SAASF,cAAc,CAAC;EAIvDG,WAAWA,CAACC,MAAoB,EAAEC,KAA0B,EAAE;IAC5D,KAAK,CAACD,MAAM,EAAEC,KA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AAW;MAChCC,YAAY,EAAEjB,OAAO,CAACiB;IACxB,CAAC,EACD;MACEC,OAAO,EAAE7B,IAAI,CAAgBW,OAAO,CAACO,WAAW,CAAC,CAACb,MAAM;MACxDyB,QAAQ,GAAAP,iBAAA,GAAEZ,OAAO,CAACmB,QAAQ,cAAAP,iBAAA,cAAAA,iBAAA,GAAI,CAAC;MAC/BQ,MAAM,GAAAP,eAAA,GAAEb,OAAO,CAACoB,MAAM,cAAAP,eAAA,cAAAA,eAAA,GAAI,CAAC;IAE7B,CAAC,EACD;MAEEQ,KAAK,EAAErB,OAAO,CAACsB,MAAM,CAAC,CAAC,CAAC;MACxBC,MAAM,EAAEvB,OAAO,CAACsB,MAAM,CAAC,CAAC,CAAC;MACzBE,kBAAkB,EAAExB,OAAO,CAACsB,MAAM,CAAC,CAAC;IACtC,CACF,CAAC;EACH;EAEAG,mBAAmBA,CAACzB,OAAmC,EAAQ,CAS/D;EAEA0B,oBAAoBA,CAAC1B,OAAoC,EAAQ,CASjE;EAES2B,cAAcA,CAACC,UAAkB,EAAQ;IAChD,IAAI,CAAClC,MAAM,CAACiC,cAAc,CAACC,UAAU,CAAC;EACxC;EAESC,aAAaA,CAAA,EAAS;IAC7B,IAAI,CAACnC,MAAM,CAACmC,aAAa,CAAC,CAAC;EAC7B;EAESC,iBAAiBA,CAACC,WAAmB,EAAQ;IACpD,IAAI,CAACrC,MAAM,CAACoC,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAWF"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/// <reference types="
|
|
2
|
-
import { ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding } from '@luma.gl/
|
|
3
|
-
import WebGPUDevice from '../webgpu-device';
|
|
4
|
-
export
|
|
1
|
+
/// <reference types="dist" />
|
|
2
|
+
import { ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding } from '@luma.gl/core';
|
|
3
|
+
import { WebGPUDevice } from '../webgpu-device';
|
|
4
|
+
export declare class WebGPUComputePass extends ComputePass {
|
|
5
5
|
readonly device: WebGPUDevice;
|
|
6
6
|
readonly handle: GPUComputePassEncoder;
|
|
7
|
-
_bindGroupLayout: GPUBindGroupLayout;
|
|
7
|
+
_bindGroupLayout: GPUBindGroupLayout | null;
|
|
8
8
|
constructor(device: WebGPUDevice, props: ComputePassProps);
|
|
9
9
|
/** @note no WebGPU destroy method, just gc */
|
|
10
10
|
destroy(): void;
|
|
11
|
-
|
|
11
|
+
end(): void;
|
|
12
12
|
setPipeline(pipeline: ComputePipeline): void;
|
|
13
13
|
/** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
|
|
14
14
|
setBindings(bindings: Binding[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"webgpu-compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAO,MAAM,eAAe,CAAC;AACpG,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAK9C,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,kBAAkB,GAAG,IAAI,CAAQ;gBAEvC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAUzD,8CAA8C;IACrC,OAAO,IAAI,IAAI;IAExB,GAAG,IAAI,IAAI;IAIX,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAM5C,2EAA2E;IAC3E,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtC;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAIjD;;;;OAIG;IACH,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,GAAE,MAAU,GAAG,IAAI;IAI1E,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAO7C"}
|