@luma.gl/webgpu 9.0.0-beta.5 → 9.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/helpers/accessor-to-format.js +4 -1
- package/dist/adapter/helpers/convert-texture-format.d.ts.map +1 -1
- package/dist/adapter/helpers/convert-texture-format.js +3 -0
- package/dist/adapter/helpers/generate-mipmaps.d.ts.map +1 -1
- package/dist/adapter/helpers/generate-mipmaps.js +22 -13
- package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.js +3 -0
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +9 -2
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +3 -0
- package/dist/adapter/resources/webgpu-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.js +16 -9
- package/dist/adapter/resources/webgpu-command-encoder.d.ts +7 -1
- package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.js +8 -0
- package/dist/adapter/resources/webgpu-compute-pass.d.ts +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.js +21 -4
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js +14 -10
- package/dist/adapter/resources/webgpu-external-texture.d.ts +2 -2
- package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-external-texture.js +12 -7
- package/dist/adapter/resources/webgpu-framebuffer.d.ts +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.js +3 -0
- package/dist/adapter/resources/webgpu-query-set.d.ts +17 -0
- package/dist/adapter/resources/webgpu-query-set.d.ts.map +1 -0
- package/dist/adapter/resources/webgpu-query-set.js +25 -0
- package/dist/adapter/resources/webgpu-render-pass.d.ts +4 -2
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +27 -9
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts +3 -4
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +25 -33
- package/dist/adapter/resources/webgpu-sampler.d.ts +1 -1
- package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-shader.d.ts +1 -1
- package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-shader.js +4 -3
- package/dist/adapter/resources/webgpu-texture-view.d.ts +20 -0
- package/dist/adapter/resources/webgpu-texture-view.d.ts.map +1 -0
- package/dist/adapter/resources/webgpu-texture-view.js +32 -0
- package/dist/adapter/resources/webgpu-texture.d.ts +5 -4
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +18 -15
- package/dist/adapter/resources/webgpu-vertex-array.d.ts +7 -9
- package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-vertex-array.js +11 -13
- package/dist/adapter/webgpu-canvas-context.d.ts +3 -3
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-canvas-context.js +6 -4
- package/dist/adapter/webgpu-device.d.ts +24 -21
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +74 -57
- package/dist/dist.dev.js +248 -171
- package/dist/index.cjs +233 -161
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist.min.js +1 -1
- package/package.json +2 -2
- package/src/adapter/helpers/accessor-to-format.ts +5 -1
- package/src/adapter/helpers/convert-texture-format.ts +4 -1
- package/src/adapter/helpers/generate-mipmaps.ts +37 -26
- package/src/adapter/helpers/get-bind-group.ts +8 -2
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +12 -4
- package/src/adapter/helpers/webgpu-parameters.ts +79 -15
- package/src/adapter/resources/webgpu-buffer.ts +21 -10
- package/src/adapter/resources/webgpu-command-encoder.ts +24 -9
- package/src/adapter/resources/webgpu-compute-pass.ts +26 -8
- package/src/adapter/resources/webgpu-compute-pipeline.ts +15 -10
- package/src/adapter/resources/webgpu-external-texture.ts +12 -6
- package/src/adapter/resources/webgpu-framebuffer.ts +4 -0
- package/src/adapter/resources/webgpu-query-set.ts +35 -0
- package/src/adapter/resources/webgpu-render-pass.ts +37 -14
- package/src/adapter/resources/webgpu-render-pipeline.ts +30 -41
- package/src/adapter/resources/webgpu-sampler.ts +1 -1
- package/src/adapter/resources/webgpu-shader.ts +5 -4
- package/src/adapter/resources/webgpu-texture-view.ts +43 -0
- package/src/adapter/resources/webgpu-texture.ts +23 -19
- package/src/adapter/resources/webgpu-vertex-array.ts +25 -20
- package/src/adapter/webgpu-canvas-context.ts +8 -4
- package/src/adapter/webgpu-device.ts +90 -58
- package/src/index.ts +2 -1
- package/src/adapter/resources/webgpu-query.ts +0 -43
- package/src/adapter/webgpu-types.ts +0 -0
- package/src/glsl/glsllang.ts +0 -14
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="dist" />
|
|
2
|
-
import type { Binding,
|
|
2
|
+
import type { Binding, RenderPass, VertexArray } from '@luma.gl/core';
|
|
3
3
|
import { RenderPipeline, RenderPipelineProps } from '@luma.gl/core';
|
|
4
|
-
import type { WebGPUDevice } from
|
|
5
|
-
import type { WebGPUShader } from
|
|
4
|
+
import type { WebGPUDevice } from "../webgpu-device.js";
|
|
5
|
+
import type { WebGPUShader } from "./webgpu-shader.js";
|
|
6
6
|
/** Creates a new render pipeline when parameters change */
|
|
7
7
|
export declare class WebGPURenderPipeline extends RenderPipeline {
|
|
8
8
|
device: WebGPUDevice;
|
|
@@ -15,7 +15,6 @@ export declare class WebGPURenderPipeline extends RenderPipeline {
|
|
|
15
15
|
constructor(device: WebGPUDevice, props: RenderPipelineProps);
|
|
16
16
|
destroy(): void;
|
|
17
17
|
setBindings(bindings: Record<string, Binding>): void;
|
|
18
|
-
setUniforms(uniforms: Record<string, UniformValue>): void;
|
|
19
18
|
draw(options: {
|
|
20
19
|
renderPass: RenderPass;
|
|
21
20
|
vertexArray: VertexArray;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"webgpu-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-render-pipeline.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAY,MAAM,eAAe,CAAC;AAS7E,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AAEnD,OAAO,KAAK,EAAC,YAAY,EAAC,2BAAwB;AAKlD,2DAA2D;AAC3D,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,iBAAiB,CAAC;IAE1B,EAAE,EAAE,YAAY,CAAC;IACjB,EAAE,EAAE,YAAY,GAAG,IAAI,CAAQ;IAO/B,4CAA4C;IAC5C,OAAO,CAAC,gBAAgB,CAAmC;IAC3D,OAAO,CAAC,UAAU,CAA6B;gBAEnC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,mBAAmB;IAoBnD,OAAO,IAAI,IAAI;IA2BxB,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IASpD,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,EAAE,UAAU,CAAC;QACvB,WAAW,EAAE,WAAW,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,IAAI;IA0CR,iDAAiD;IACjD,aAAa;IAiBb;;OAEG;IACH,SAAS,CAAC,4BAA4B;CAyFvC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// luma.gl MIT license
|
|
2
|
-
import { RenderPipeline, cast, log
|
|
3
|
-
import { applyParametersToRenderPipelineDescriptor } from
|
|
4
|
-
import { getWebGPUTextureFormat } from
|
|
5
|
-
import { getBindGroup } from
|
|
6
|
-
import { getVertexBufferLayout } from
|
|
2
|
+
import { RenderPipeline, cast, log } from '@luma.gl/core';
|
|
3
|
+
import { applyParametersToRenderPipelineDescriptor } from "../helpers/webgpu-parameters.js";
|
|
4
|
+
import { getWebGPUTextureFormat } from "../helpers/convert-texture-format.js";
|
|
5
|
+
import { getBindGroup } from "../helpers/get-bind-group.js";
|
|
6
|
+
import { getVertexBufferLayout } from "../helpers/get-vertex-buffer-layout.js";
|
|
7
7
|
// RENDER PIPELINE
|
|
8
8
|
/** Creates a new render pipeline when parameters change */
|
|
9
9
|
export class WebGPURenderPipeline extends RenderPipeline {
|
|
@@ -41,28 +41,23 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
41
41
|
// setIndexBuffer(indexBuffer: Buffer): void {
|
|
42
42
|
// this._indexBuffer = cast<WebGPUBuffer>(indexBuffer);
|
|
43
43
|
// }
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// }
|
|
62
|
-
}
|
|
63
|
-
*/
|
|
64
|
-
// setConstantAttributes(attributes: Record<string, TypedArray>): void {
|
|
65
|
-
// throw new Error('not implemented');
|
|
44
|
+
// setAttributes(attributes: Record<string, Buffer>): void {
|
|
45
|
+
// for (const [name, buffer] of Object.entries(attributes)) {
|
|
46
|
+
// const bufferIndex = this._bufferSlots[name];
|
|
47
|
+
// if (bufferIndex >= 0) {
|
|
48
|
+
// this._buffers[bufferIndex] = buffer;
|
|
49
|
+
// } else {
|
|
50
|
+
// throw new Error(
|
|
51
|
+
// `Setting attribute '${name}' not listed in shader layout for program ${this.id}`
|
|
52
|
+
// );
|
|
53
|
+
// }
|
|
54
|
+
// }
|
|
55
|
+
// // for (let i = 0; i < this._bufferSlots.length; ++i) {
|
|
56
|
+
// // const bufferName = this._bufferSlots[i];
|
|
57
|
+
// // if (attributes[bufferName]) {
|
|
58
|
+
// // this.handle
|
|
59
|
+
// // }
|
|
60
|
+
// // }
|
|
66
61
|
// }
|
|
67
62
|
setBindings(bindings) {
|
|
68
63
|
// if (isObjectEmpty(bindings)) {
|
|
@@ -71,11 +66,6 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
71
66
|
// Do we want to save things on CPU side?
|
|
72
67
|
Object.assign(this.props.bindings, bindings);
|
|
73
68
|
}
|
|
74
|
-
setUniforms(uniforms) {
|
|
75
|
-
if (!isObjectEmpty(uniforms)) {
|
|
76
|
-
throw new Error('WebGPU does not support uniforms');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
69
|
draw(options) {
|
|
80
70
|
const webgpuRenderPass = cast(options.renderPass) || this.device.getDefaultRenderPass();
|
|
81
71
|
// Set pipeline
|
|
@@ -107,7 +97,9 @@ export class WebGPURenderPipeline extends RenderPipeline {
|
|
|
107
97
|
// Get hold of the bind group layout. We don't want to do this unless we know there is at least one bind group
|
|
108
98
|
this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0);
|
|
109
99
|
// Set up the bindings
|
|
110
|
-
this._bindGroup =
|
|
100
|
+
this._bindGroup =
|
|
101
|
+
this._bindGroup ||
|
|
102
|
+
getBindGroup(this.device.handle, this._bindGroupLayout, this.props.shaderLayout, this.props.bindings);
|
|
111
103
|
return this._bindGroup;
|
|
112
104
|
}
|
|
113
105
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="dist" />
|
|
2
2
|
import { Sampler, SamplerProps } from '@luma.gl/core';
|
|
3
|
-
import type { WebGPUDevice } from
|
|
3
|
+
import type { WebGPUDevice } from "../webgpu-device.js";
|
|
4
4
|
export type WebGPUSamplerProps = SamplerProps & {
|
|
5
5
|
handle?: GPUSampler;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-sampler.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-sampler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAC,YAAY,EAAC,
|
|
1
|
+
{"version":3,"file":"webgpu-sampler.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-sampler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AAEnD,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAC9C,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,aAAc,SAAQ,OAAO;IACxC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;gBAEhB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,kBAAkB;IAclD,OAAO,IAAI,IAAI;CAGzB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="dist" />
|
|
2
2
|
import type { ShaderProps, CompilerMessage } from '@luma.gl/core';
|
|
3
3
|
import { Shader } from '@luma.gl/core';
|
|
4
|
-
import type { WebGPUDevice } from
|
|
4
|
+
import type { WebGPUDevice } from "../webgpu-device.js";
|
|
5
5
|
export type WebGPUShaderProps = ShaderProps & {
|
|
6
6
|
handle?: GPUShaderModule;
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-shader.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-shader.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"webgpu-shader.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-shader.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAChE,OAAO,EAAC,MAAM,EAAM,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AAEnD,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAC5C,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAa,SAAQ,MAAM;IACtC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;gBAErB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,iBAAiB;IAYpD,sBAAsB,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAcxE,OAAO,IAAI,IAAI;IAKxB,+CAA+C;IACzC,kBAAkB,IAAI,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC;IAO/D,SAAS,CAAC,YAAY,IAAI,eAAe;CAuB1C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { Shader, log } from '@luma.gl/core';
|
|
4
5
|
/**
|
|
@@ -16,7 +17,7 @@ export class WebGPUShader extends Shader {
|
|
|
16
17
|
this._checkCompilationError(this.device.handle.popErrorScope());
|
|
17
18
|
}
|
|
18
19
|
async _checkCompilationError(errorScope) {
|
|
19
|
-
const error = await errorScope;
|
|
20
|
+
const error = (await errorScope);
|
|
20
21
|
if (error) {
|
|
21
22
|
// The `Shader` base class will determine if debug window should be opened based on props
|
|
22
23
|
this.debugShader();
|
|
@@ -52,7 +53,7 @@ export class WebGPUShader extends Shader {
|
|
|
52
53
|
return this.device.handle.createShaderModule({
|
|
53
54
|
code: source,
|
|
54
55
|
// @ts-expect-error
|
|
55
|
-
transform:
|
|
56
|
+
transform: glsl => this.device.glslang.compileGLSL(glsl, stage)
|
|
56
57
|
});
|
|
57
58
|
default:
|
|
58
59
|
throw new Error(language);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="dist" />
|
|
2
|
+
import { TextureView, TextureViewProps } from '@luma.gl/core';
|
|
3
|
+
import type { WebGPUDevice } from "../webgpu-device.js";
|
|
4
|
+
import type { WebGPUTexture } from "./webgpu-texture.js";
|
|
5
|
+
export type WebGPUTextureViewProps = TextureViewProps & {
|
|
6
|
+
handle?: GPUTextureView;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare class WebGPUTextureView extends TextureView {
|
|
12
|
+
readonly device: WebGPUDevice;
|
|
13
|
+
readonly handle: GPUTextureView;
|
|
14
|
+
readonly texture: WebGPUTexture;
|
|
15
|
+
constructor(device: WebGPUDevice, props: WebGPUTextureViewProps & {
|
|
16
|
+
texture: WebGPUTexture;
|
|
17
|
+
});
|
|
18
|
+
destroy(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=webgpu-texture-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgpu-texture-view.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-texture-view.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AACnD,OAAO,KAAK,EAAC,aAAa,EAAC,4BAAyB;AAEpD,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IACtD,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;gBAEpB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,sBAAsB,GAAG;QAAC,OAAO,EAAE,aAAa,CAAA;KAAC;IAmBjF,OAAO,IAAI,IAAI;CAGzB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { TextureView } from '@luma.gl/core';
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export class WebGPUTextureView extends TextureView {
|
|
9
|
+
device;
|
|
10
|
+
handle;
|
|
11
|
+
texture;
|
|
12
|
+
constructor(device, props) {
|
|
13
|
+
super(device, props);
|
|
14
|
+
this.device = device;
|
|
15
|
+
this.texture = props.texture;
|
|
16
|
+
this.handle =
|
|
17
|
+
this.handle ||
|
|
18
|
+
this.texture.handle.createView({
|
|
19
|
+
format: (props.format || this.texture.format),
|
|
20
|
+
dimension: props.dimension || this.texture.dimension,
|
|
21
|
+
aspect: props.aspect,
|
|
22
|
+
baseMipLevel: props.baseMipLevel,
|
|
23
|
+
mipLevelCount: props.mipLevelCount, // GPUIntegerCoordinate;
|
|
24
|
+
baseArrayLayer: props.baseArrayLayer, // GPUIntegerCoordinate;
|
|
25
|
+
arrayLayerCount: props.arrayLayerCount // GPUIntegerCoordinate;
|
|
26
|
+
});
|
|
27
|
+
this.handle.label = this.props.id;
|
|
28
|
+
}
|
|
29
|
+
destroy() {
|
|
30
|
+
// this.handle.destroy();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/// <reference types="dist" />
|
|
2
2
|
import { Texture, TextureProps, Sampler, SamplerProps } from '@luma.gl/core';
|
|
3
|
-
import type { WebGPUDevice } from
|
|
4
|
-
import { WebGPUSampler } from
|
|
3
|
+
import type { WebGPUDevice } from "../webgpu-device.js";
|
|
4
|
+
import { WebGPUSampler } from "./webgpu-sampler.js";
|
|
5
|
+
import { WebGPUTextureView } from "./webgpu-texture-view.js";
|
|
5
6
|
export declare class WebGPUTexture extends Texture {
|
|
6
7
|
readonly device: WebGPUDevice;
|
|
7
8
|
readonly handle: GPUTexture;
|
|
8
|
-
readonly view: GPUTextureView;
|
|
9
|
-
sampler: WebGPUSampler;
|
|
10
9
|
height: number;
|
|
11
10
|
width: number;
|
|
11
|
+
sampler: WebGPUSampler;
|
|
12
|
+
view: WebGPUTextureView;
|
|
12
13
|
constructor(device: WebGPUDevice, props: TextureProps);
|
|
13
14
|
protected initialize(props: TextureProps): void;
|
|
14
15
|
protected createHandle(): GPUTexture;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-texture.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"webgpu-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-texture.ts"],"names":[],"mappings":";AAIA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAE3E,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AACnD,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAC/C,OAAO,EAAC,iBAAiB,EAAC,iCAA8B;AAWxD,qBAAa,aAAc,SAAQ,OAAO;IACxC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAEnB,MAAM,EAAE,MAAM,CAAK;IACnB,KAAK,EAAE,MAAM,CAAK;IAE3B,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,iBAAiB,CAAC;gBASZ,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY;IAiBrD,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAwC/C,SAAS,CAAC,YAAY,IAAI,UAAU;IAsB3B,OAAO,IAAI,IAAI;IAIxB;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;IAMjD,OAAO,CAAC,OAAO,EAAE;QAAC,IAAI,EAAE,GAAG,CAAA;KAAC;;;;IAI5B,gBAAgB;IAChB,QAAQ,CAAC,OAAO,EAAE;QAChB,MAAM,EAAE,WAAW,GAAG,iBAAiB,GAAG,eAAe,CAAC;QAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,MAAM,CAAC,EAAE,KAAK,GAAG,cAAc,GAAG,YAAY,CAAC;QAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,GAAG;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC;IA0CnC,mEAAmE;IACnE,UAAU,IAAI,cAAc;CAqF7B"}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
2
4
|
import { Texture } from '@luma.gl/core';
|
|
3
|
-
import { getWebGPUTextureFormat } from
|
|
4
|
-
import { WebGPUSampler } from
|
|
5
|
+
import { getWebGPUTextureFormat } from "../helpers/convert-texture-format.js";
|
|
6
|
+
import { WebGPUSampler } from "./webgpu-sampler.js";
|
|
7
|
+
import { WebGPUTextureView } from "./webgpu-texture-view.js";
|
|
5
8
|
const BASE_DIMENSIONS = {
|
|
6
9
|
'1d': '1d',
|
|
7
10
|
'2d': '2d',
|
|
8
11
|
'2d-array': '2d',
|
|
9
|
-
|
|
12
|
+
cube: '2d',
|
|
10
13
|
'cube-array': '2d',
|
|
11
14
|
'3d': '3d'
|
|
12
15
|
};
|
|
13
16
|
export class WebGPUTexture extends Texture {
|
|
14
17
|
device;
|
|
15
18
|
handle;
|
|
16
|
-
view;
|
|
17
|
-
sampler;
|
|
18
19
|
height = 1;
|
|
19
20
|
width = 1;
|
|
21
|
+
sampler;
|
|
22
|
+
view;
|
|
20
23
|
// static async createFromImageURL(src, usage = 0) {
|
|
21
24
|
// const img = document.createElement('img');
|
|
22
25
|
// img.src = src;
|
|
@@ -54,11 +57,14 @@ export class WebGPUTexture extends Texture {
|
|
|
54
57
|
// this.usage = this.handle.usage;
|
|
55
58
|
// Create a default sampler. This mimics the WebGL1 API where sampler props are stored on the texture
|
|
56
59
|
// this.setSampler(props.sampler);
|
|
57
|
-
this.sampler =
|
|
60
|
+
this.sampler =
|
|
61
|
+
props.sampler instanceof WebGPUSampler
|
|
62
|
+
? props.sampler
|
|
63
|
+
: new WebGPUSampler(this.device, props.sampler);
|
|
58
64
|
// TODO - To support texture arrays we need to create custom views...
|
|
59
65
|
// But we are not ready to expose TextureViews to the public API.
|
|
60
66
|
// @ts-expect-error
|
|
61
|
-
this.view = this.
|
|
67
|
+
this.view = new WebGPUTextureView(this.device, { ...this.props, texture: this });
|
|
62
68
|
// format: this.props.format,
|
|
63
69
|
// dimension: this.props.dimension,
|
|
64
70
|
// aspect = "all";
|
|
@@ -95,7 +101,8 @@ export class WebGPUTexture extends Texture {
|
|
|
95
101
|
* Accept a sampler instance or set of props;
|
|
96
102
|
*/
|
|
97
103
|
setSampler(sampler) {
|
|
98
|
-
this.sampler =
|
|
104
|
+
this.sampler =
|
|
105
|
+
sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
|
|
99
106
|
return this;
|
|
100
107
|
}
|
|
101
108
|
setData(options) {
|
|
@@ -121,14 +128,10 @@ export class WebGPUTexture extends Texture {
|
|
|
121
128
|
premultipliedAlpha
|
|
122
129
|
},
|
|
123
130
|
// copySize: GPUExtent3D
|
|
124
|
-
[
|
|
125
|
-
width,
|
|
126
|
-
height,
|
|
127
|
-
depth
|
|
128
|
-
]);
|
|
131
|
+
[width, height, depth]);
|
|
129
132
|
return { width, height };
|
|
130
133
|
}
|
|
131
|
-
// WebGPU specific
|
|
134
|
+
// WebGPU specific
|
|
132
135
|
/** TODO - intention is to expose TextureViews in the public API */
|
|
133
136
|
createView() {
|
|
134
137
|
return this.handle.createView({ label: this.id });
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import type { Device, Buffer, VertexArrayProps, RenderPass
|
|
1
|
+
import type { Device, Buffer, VertexArrayProps, RenderPass } from '@luma.gl/core';
|
|
2
2
|
import { VertexArray } from '@luma.gl/core';
|
|
3
|
-
import { WebGPUDevice } from
|
|
3
|
+
import { WebGPUDevice } from "../webgpu-device.js";
|
|
4
4
|
/** VertexArrayObject wrapper */
|
|
5
5
|
export declare class WebGPUVertexArray extends VertexArray {
|
|
6
6
|
get [Symbol.toStringTag](): string;
|
|
7
7
|
readonly device: WebGPUDevice;
|
|
8
8
|
/** Vertex Array is a helper class under WebGPU */
|
|
9
9
|
readonly handle: never;
|
|
10
|
-
/**
|
|
11
|
-
* Attribute 0 can not be disable on most desktop OpenGL based browsers
|
|
12
|
-
* TODO is this even an issue for WebGPU?
|
|
13
|
-
*/
|
|
14
|
-
static isConstantAttributeZeroSupported(device: Device): boolean;
|
|
15
10
|
constructor(device: WebGPUDevice, props?: VertexArrayProps);
|
|
16
11
|
destroy(): void;
|
|
17
12
|
/**
|
|
@@ -21,9 +16,12 @@ export declare class WebGPUVertexArray extends VertexArray {
|
|
|
21
16
|
setIndexBuffer(buffer: Buffer | null): void;
|
|
22
17
|
/** Set a bufferSlot in vertex attributes array to a buffer, enables the bufferSlot, sets divisor */
|
|
23
18
|
setBuffer(bufferSlot: number, buffer: Buffer): void;
|
|
24
|
-
/** Set a location in vertex attributes array to a constant value, disables the location */
|
|
25
|
-
setConstant(location: number, value: TypedArray): void;
|
|
26
19
|
bindBeforeRender(renderPass: RenderPass, firstIndex?: number, indexCount?: number): void;
|
|
27
20
|
unbindAfterRender(renderPass: RenderPass): void;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated is this even an issue for WebGPU?
|
|
23
|
+
* Attribute 0 can not be disable on most desktop OpenGL based browsers
|
|
24
|
+
*/
|
|
25
|
+
static isConstantAttributeZeroSupported(device: Device): boolean;
|
|
28
26
|
}
|
|
29
27
|
//# sourceMappingURL=webgpu-vertex-array.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-vertex-array.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgpu-vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-vertex-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAChF,OAAO,EAAC,WAAW,EAAM,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAK9C,gCAAgC;AAChC,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;gBAGX,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,gBAAgB;IAKjD,OAAO,IAAI,IAAI;IAExB;;;OAGG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAK3C,oGAAoG;IACpG,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAS1C,gBAAgB,CACvB,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI;IAqBE,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAQxD;;;OAGG;IACH,MAAM,CAAC,gCAAgC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAGjE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { VertexArray, log } from '@luma.gl/core';
|
|
4
5
|
import { getBrowser } from '@probe.gl/env';
|
|
@@ -10,13 +11,6 @@ export class WebGPUVertexArray extends VertexArray {
|
|
|
10
11
|
device;
|
|
11
12
|
/** Vertex Array is a helper class under WebGPU */
|
|
12
13
|
handle;
|
|
13
|
-
/**
|
|
14
|
-
* Attribute 0 can not be disable on most desktop OpenGL based browsers
|
|
15
|
-
* TODO is this even an issue for WebGPU?
|
|
16
|
-
*/
|
|
17
|
-
static isConstantAttributeZeroSupported(device) {
|
|
18
|
-
return getBrowser() === 'Chrome';
|
|
19
|
-
}
|
|
20
14
|
// Create a VertexArray
|
|
21
15
|
constructor(device, props) {
|
|
22
16
|
super(device, props);
|
|
@@ -39,10 +33,6 @@ export class WebGPUVertexArray extends VertexArray {
|
|
|
39
33
|
// }
|
|
40
34
|
this.attributes[bufferSlot] = buffer;
|
|
41
35
|
}
|
|
42
|
-
/** Set a location in vertex attributes array to a constant value, disables the location */
|
|
43
|
-
setConstant(location, value) {
|
|
44
|
-
log.warn(`${this.id} constant attributes not supported on WebGPU`);
|
|
45
|
-
}
|
|
46
36
|
bindBeforeRender(renderPass, firstIndex, indexCount) {
|
|
47
37
|
const webgpuRenderPass = renderPass;
|
|
48
38
|
const webgpuIndexBuffer = this.indexBuffer;
|
|
@@ -61,8 +51,16 @@ export class WebGPUVertexArray extends VertexArray {
|
|
|
61
51
|
// TODO - emit warnings/errors/throw if constants have been set on this vertex array
|
|
62
52
|
}
|
|
63
53
|
unbindAfterRender(renderPass) {
|
|
64
|
-
// On WebGPU we don't need to unbind.
|
|
54
|
+
// On WebGPU we don't need to unbind.
|
|
65
55
|
// In fact we can't easily do it. setIndexBuffer/setVertexBuffer don't accept null.
|
|
66
56
|
// Unbinding presumably happens automatically when the render pass is ended.
|
|
67
57
|
}
|
|
58
|
+
// DEPRECATED METHODS
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated is this even an issue for WebGPU?
|
|
61
|
+
* Attribute 0 can not be disable on most desktop OpenGL based browsers
|
|
62
|
+
*/
|
|
63
|
+
static isConstantAttributeZeroSupported(device) {
|
|
64
|
+
return getBrowser() === 'Chrome';
|
|
65
|
+
}
|
|
68
66
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="dist" />
|
|
2
2
|
import type { Texture, TextureFormat, CanvasContextProps } from '@luma.gl/core';
|
|
3
3
|
import { CanvasContext } from '@luma.gl/core';
|
|
4
|
-
import { WebGPUDevice } from
|
|
5
|
-
import { WebGPUFramebuffer } from
|
|
6
|
-
import { WebGPUTexture } from
|
|
4
|
+
import { WebGPUDevice } from "./webgpu-device.js";
|
|
5
|
+
import { WebGPUFramebuffer } from "./resources/webgpu-framebuffer.js";
|
|
6
|
+
import { WebGPUTexture } from "./resources/webgpu-texture.js";
|
|
7
7
|
/**
|
|
8
8
|
* Holds a WebGPU Canvas Context
|
|
9
9
|
* The primary job of the CanvasContext is to generate textures for rendering into the current canvas
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-canvas-context.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"webgpu-canvas-context.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-canvas-context.ts"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAC,aAAa,EAAM,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAC7C,OAAO,EAAC,iBAAiB,EAAC,0CAAuC;AACjE,OAAO,EAAC,aAAa,EAAC,sCAAmC;AAEzD;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;IACpD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,aAAa,CAA6D;IAC3F,gDAAgD;IAChD,kBAAkB,EAAE,aAAa,CAAiB;IAElD,OAAO,CAAC,sBAAsB,CAAwB;gBAE1C,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,kBAAkB;IAehF,2FAA2F;IAC3F,OAAO,IAAI,IAAI;IAIf,0EAA0E;IAC1E,qBAAqB,IAAI,iBAAiB;IA2B1C,sDAAsD;IACtD,MAAM;IA6BN,MAAM,CAAC,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAC,GAAG,IAAI;IAI7F,mEAAmE;IACnE,iBAAiB,IAAI,aAAa;IAOlC,8FAA8F;IAC9F,6BAA6B;CAY9B"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { CanvasContext, log } from '@luma.gl/core';
|
|
2
|
-
import { getWebGPUTextureFormat } from
|
|
3
|
-
import { WebGPUFramebuffer } from
|
|
5
|
+
import { getWebGPUTextureFormat } from "./helpers/convert-texture-format.js";
|
|
6
|
+
import { WebGPUFramebuffer } from "./resources/webgpu-framebuffer.js";
|
|
4
7
|
/**
|
|
5
8
|
* Holds a WebGPU Canvas Context
|
|
6
9
|
* The primary job of the CanvasContext is to generate textures for rendering into the current canvas
|
|
@@ -10,7 +13,6 @@ export class WebGPUCanvasContext extends CanvasContext {
|
|
|
10
13
|
device;
|
|
11
14
|
gpuCanvasContext;
|
|
12
15
|
/** Format of returned textures: "bgra8unorm", "rgba8unorm", "rgba16float". */
|
|
13
|
-
// @ts-ignore - TODO - fix this
|
|
14
16
|
format = navigator.gpu.getPreferredCanvasFormat();
|
|
15
17
|
/** Default stencil format for depth textures */
|
|
16
18
|
depthStencilFormat = 'depth24plus';
|
|
@@ -44,7 +46,7 @@ export class WebGPUCanvasContext extends CanvasContext {
|
|
|
44
46
|
// width: this.width,
|
|
45
47
|
// height: this.height
|
|
46
48
|
// });
|
|
47
|
-
// Wrap the current canvas context texture in a luma.gl texture
|
|
49
|
+
// Wrap the current canvas context texture in a luma.gl texture
|
|
48
50
|
const currentColorAttachment = this.getCurrentTexture();
|
|
49
51
|
this.width = currentColorAttachment.width;
|
|
50
52
|
this.height = currentColorAttachment.height;
|
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
/// <reference types="dist" />
|
|
2
|
-
import type { DeviceProps, DeviceInfo, DeviceLimits,
|
|
3
|
-
import { Device } from '@luma.gl/core';
|
|
4
|
-
import { WebGPUBuffer } from
|
|
5
|
-
import { WebGPUTexture } from
|
|
6
|
-
import { WebGPUExternalTexture } from
|
|
7
|
-
import { WebGPUSampler } from
|
|
8
|
-
import { WebGPUShader } from
|
|
9
|
-
import { WebGPURenderPipeline } from
|
|
10
|
-
import { WebGPUFramebuffer } from
|
|
11
|
-
import { WebGPUComputePipeline } from
|
|
12
|
-
import { WebGPURenderPass } from
|
|
13
|
-
import { WebGPUComputePass } from
|
|
14
|
-
import { WebGPUVertexArray } from
|
|
15
|
-
import { WebGPUCanvasContext } from
|
|
2
|
+
import type { DeviceProps, DeviceInfo, DeviceLimits, CanvasContextProps, BufferProps, SamplerProps, ShaderProps, Texture, TextureProps, TextureFormat, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipelineProps, RenderPassProps, ComputePassProps, VertexArrayProps, TransformFeedback, TransformFeedbackProps, QuerySet, QuerySetProps } from '@luma.gl/core';
|
|
3
|
+
import { Device, DeviceFeatures } from '@luma.gl/core';
|
|
4
|
+
import { WebGPUBuffer } from "./resources/webgpu-buffer.js";
|
|
5
|
+
import { WebGPUTexture } from "./resources/webgpu-texture.js";
|
|
6
|
+
import { WebGPUExternalTexture } from "./resources/webgpu-external-texture.js";
|
|
7
|
+
import { WebGPUSampler } from "./resources/webgpu-sampler.js";
|
|
8
|
+
import { WebGPUShader } from "./resources/webgpu-shader.js";
|
|
9
|
+
import { WebGPURenderPipeline } from "./resources/webgpu-render-pipeline.js";
|
|
10
|
+
import { WebGPUFramebuffer } from "./resources/webgpu-framebuffer.js";
|
|
11
|
+
import { WebGPUComputePipeline } from "./resources/webgpu-compute-pipeline.js";
|
|
12
|
+
import { WebGPURenderPass } from "./resources/webgpu-render-pass.js";
|
|
13
|
+
import { WebGPUComputePass } from "./resources/webgpu-compute-pass.js";
|
|
14
|
+
import { WebGPUVertexArray } from "./resources/webgpu-vertex-array.js";
|
|
15
|
+
import { WebGPUCanvasContext } from "./webgpu-canvas-context.js";
|
|
16
16
|
/** WebGPU Device implementation */
|
|
17
17
|
export declare class WebGPUDevice extends Device {
|
|
18
|
+
static type: string;
|
|
19
|
+
/** The underlying WebGPU device */
|
|
18
20
|
readonly handle: GPUDevice;
|
|
19
21
|
readonly adapter: GPUAdapter;
|
|
22
|
+
readonly adapterInfo: GPUAdapterInfo;
|
|
23
|
+
readonly features: DeviceFeatures;
|
|
24
|
+
readonly info: DeviceInfo;
|
|
25
|
+
readonly limits: DeviceLimits;
|
|
20
26
|
readonly lost: Promise<{
|
|
21
27
|
reason: 'destroyed';
|
|
22
28
|
message: string;
|
|
23
29
|
}>;
|
|
24
30
|
canvasContext: WebGPUCanvasContext | null;
|
|
31
|
+
private _isLost;
|
|
25
32
|
commandEncoder: GPUCommandEncoder | null;
|
|
26
33
|
renderPass: WebGPURenderPass | null;
|
|
27
|
-
private _info;
|
|
28
|
-
private _isLost;
|
|
29
|
-
static type: string;
|
|
30
34
|
/** Check if WebGPU is available */
|
|
31
35
|
static isSupported(): boolean;
|
|
32
36
|
static create(props: DeviceProps): Promise<WebGPUDevice>;
|
|
33
37
|
constructor(device: GPUDevice, adapter: GPUAdapter, adapterInfo: GPUAdapterInfo, props: DeviceProps);
|
|
34
38
|
destroy(): void;
|
|
35
|
-
get info(): DeviceInfo;
|
|
36
|
-
features: Set<DeviceFeature>;
|
|
37
|
-
get limits(): DeviceLimits;
|
|
38
39
|
isTextureFormatSupported(format: TextureFormat): boolean;
|
|
39
40
|
/** @todo implement proper check? */
|
|
40
41
|
isTextureFormatFilterable(format: TextureFormat): boolean;
|
|
@@ -57,6 +58,7 @@ export declare class WebGPUDevice extends Device {
|
|
|
57
58
|
beginRenderPass(props: RenderPassProps): WebGPURenderPass;
|
|
58
59
|
beginComputePass(props: ComputePassProps): WebGPUComputePass;
|
|
59
60
|
createTransformFeedback(props: TransformFeedbackProps): TransformFeedback;
|
|
61
|
+
createQuerySet(props: QuerySetProps): QuerySet;
|
|
60
62
|
createCanvasContext(props: CanvasContextProps): WebGPUCanvasContext;
|
|
61
63
|
/**
|
|
62
64
|
* Gets default renderpass encoder.
|
|
@@ -66,7 +68,8 @@ export declare class WebGPUDevice extends Device {
|
|
|
66
68
|
*/
|
|
67
69
|
getDefaultRenderPass(): WebGPURenderPass;
|
|
68
70
|
submit(): void;
|
|
69
|
-
|
|
71
|
+
protected _getInfo(): DeviceInfo;
|
|
72
|
+
protected _getFeatures(): DeviceFeatures;
|
|
70
73
|
copyExternalImageToTexture(options: {
|
|
71
74
|
texture: Texture;
|
|
72
75
|
mipLevel?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-device.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"webgpu-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-device.ts"],"names":[],"mappings":";AAOA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,YAAY,EAEZ,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,OAAO,EACP,YAAY,EACZ,aAAa,EACb,oBAAoB,EAC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