@agpu/bindings 0.2.4 → 0.2.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/classes/main/adapter.d.ts +34 -1
- package/dist/classes/main/context.d.ts +24 -1
- package/dist/classes/main/device.d.ts +481 -1
- package/dist/classes/main/device.js +1 -1
- package/dist/classes/main/webgpucontrols.d.ts +14 -1
- package/dist/classes/sub/pipeline/commandEncoder/computepass.d.ts +149 -1
- package/dist/classes/sub/pipeline/commandEncoder/renderEncoderBase.d.ts +89 -1
- package/dist/classes/sub/pipeline/commandEncoder/renderPass/indirectBuffer.d.ts +28 -1
- package/dist/classes/sub/pipeline/commandEncoder/renderPass.d.ts +128 -1
- package/dist/classes/sub/pipeline/commandEncoder.d.ts +176 -1
- package/dist/classes/sub/pipeline/commandEncoder.js +1 -1
- package/dist/classes/sub/pipeline/computePipeline.d.ts +33 -1
- package/dist/classes/sub/pipeline/pipelineLayout.d.ts +24 -1
- package/dist/classes/sub/pipeline/querySet.d.ts +24 -1
- package/dist/classes/sub/pipeline/renderBundleEncoder/renderBundle.d.ts +11 -1
- package/dist/classes/sub/pipeline/renderBundleEncoder.d.ts +17 -1
- package/dist/classes/sub/pipeline/renderPipeline.d.ts +112 -1
- package/dist/classes/sub/pipeline/sampler.d.ts +16 -1
- package/dist/constants/bufferusage.d.ts +5 -1
- package/dist/constants/textureusage.d.ts +5 -1
- package/dist/helpers/align.d.ts +5 -1
- package/dist/helpers/defaults.d.ts +8 -1
- package/dist/helpers/errors.d.ts +5 -1
- package/dist/helpers/shaderRegex.d.ts +4 -1
- package/dist/helpers/types/DCMember.d.ts +9 -1
- package/dist/index.d.ts +9 -1
- package/package.json +1 -1
|
@@ -1 +1,33 @@
|
|
|
1
|
-
import{BRAND,RAW}from"@agpu/helpers/decorators";
|
|
1
|
+
import { BRAND, RAW } from "@agpu/helpers/decorators";
|
|
2
|
+
import DC_MEMBER from "../../../helpers/types/DCMember";
|
|
3
|
+
import PipelineLayoutCreator from "./pipelineLayout";
|
|
4
|
+
import ShaderModuleCreator from "../data/shaderModule";
|
|
5
|
+
export interface ComputePipelineCreator extends RAW<Promise<GPUComputePipeline>>, BRAND<"ComputePipelineCreator"> {
|
|
6
|
+
label(): Promise<string>;
|
|
7
|
+
label<T extends string>(label: T): Promise<T>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Wrapper around {@link GPUComputePipeline}.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ComputePipelineCreator {
|
|
13
|
+
#private;
|
|
14
|
+
computePipeline: Promise<GPUComputePipeline>;
|
|
15
|
+
constructor(device: GPUDevice, sm: COMPUTE_PIPELINE_OPTION | GPUComputePipeline);
|
|
16
|
+
/**
|
|
17
|
+
* Resolves once the underlying pipeline has been created.
|
|
18
|
+
*/
|
|
19
|
+
init(): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Recreates the compute pipeline from its original module/layout when available.
|
|
22
|
+
*/
|
|
23
|
+
clone(): ComputePipelineCreator;
|
|
24
|
+
}
|
|
25
|
+
export default ComputePipelineCreator;
|
|
26
|
+
/**
|
|
27
|
+
* Options used to create a compute pipeline wrapper.
|
|
28
|
+
*/
|
|
29
|
+
export interface COMPUTE_PIPELINE_OPTION extends GPUObjectDescriptorBase {
|
|
30
|
+
module: ShaderModuleCreator | DC_MEMBER<"ShaderModule">;
|
|
31
|
+
async?: boolean;
|
|
32
|
+
layout: PipelineLayoutCreator;
|
|
33
|
+
}
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
import DeviceControls from"../../main/device";
|
|
1
|
+
import DeviceControls from "../../main/device";
|
|
2
|
+
import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
|
|
3
|
+
import BindGroupLayoutCreator from "../data/bindGroupLayout";
|
|
4
|
+
export interface PipelineLayoutCreator extends RAW<GPUPipelineLayout>, BRAND<"PipelineLayoutCreator">, LABEL {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Wrapper around {@link GPUPipelineLayout}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PipelineLayoutCreator {
|
|
10
|
+
#private;
|
|
11
|
+
pipelineLayout: GPUPipelineLayout;
|
|
12
|
+
constructor(device: GPUDevice, pipelineLayoutOrOptions: GPUPipelineLayout | PIPELINE_LAYOUT_OPTIONS);
|
|
13
|
+
/**
|
|
14
|
+
* Recreates the pipeline layout from its original bind group layouts when available.
|
|
15
|
+
*/
|
|
16
|
+
clone(): PipelineLayoutCreator;
|
|
17
|
+
}
|
|
18
|
+
export default PipelineLayoutCreator;
|
|
19
|
+
/**
|
|
20
|
+
* Options used to create a pipeline layout wrapper.
|
|
21
|
+
*/
|
|
22
|
+
export interface PIPELINE_LAYOUT_OPTIONS extends GPUObjectDescriptorBase {
|
|
23
|
+
bindGroupLayouts?: (InstanceType<DeviceControls["BindGroupLayout"]> | BindGroupLayoutCreator)[];
|
|
24
|
+
}
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
import{BRAND,RAW}from"@agpu/helpers/decorators";
|
|
1
|
+
import { BRAND, RAW } from "@agpu/helpers/decorators";
|
|
2
|
+
export interface QuerySetCreator extends RAW<GPUQuerySet>, BRAND<"QuerySetCreator"> {
|
|
3
|
+
label(): string;
|
|
4
|
+
label<T extends string>(label: T): T;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Wrapper around {@link GPUQuerySet}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class QuerySetCreator {
|
|
10
|
+
#private;
|
|
11
|
+
querySet: GPUQuerySet;
|
|
12
|
+
queryDescriptor: GPUQuerySetDescriptor;
|
|
13
|
+
constructor(device: GPUDevice, options: GPUQuerySetDescriptor | GPUQuerySet);
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new query set wrapper from the cached descriptor.
|
|
16
|
+
*/
|
|
17
|
+
clone(): QuerySetCreator;
|
|
18
|
+
/**
|
|
19
|
+
* Getter / Setter for destroying the QuerySet
|
|
20
|
+
*/
|
|
21
|
+
destroy(): boolean;
|
|
22
|
+
destroy<T extends boolean>(destroy: T): T;
|
|
23
|
+
}
|
|
24
|
+
export default QuerySetCreator;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
import{BRAND,LABEL,RAW}from"@agpu/helpers/decorators";
|
|
1
|
+
import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
|
|
2
|
+
export interface RenderBundleCreator extends RAW<GPURenderBundle>, BRAND<"RenderBundleCreator">, LABEL {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Wrapper around a finished {@link GPURenderBundle}.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RenderBundleCreator {
|
|
8
|
+
renderBundle: GPURenderBundle;
|
|
9
|
+
constructor(renbun: GPURenderBundle);
|
|
10
|
+
}
|
|
11
|
+
export default RenderBundleCreator;
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
import{BRAND,LABEL,RAW}from"@agpu/helpers/decorators";
|
|
1
|
+
import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
|
|
2
|
+
import RenderEncoderBase from "./commandEncoder/renderEncoderBase";
|
|
3
|
+
export interface RenderBundleEncoderCreator extends RAW<GPURenderBundleEncoder>, BRAND<"RenderBundleEncoderCreator">, LABEL {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Wrapper around {@link GPURenderBundleEncoder}.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RenderBundleEncoderCreator extends RenderEncoderBase<GPURenderBundleEncoder> {
|
|
9
|
+
constructor(device: GPUDevice, renBun: GPURenderBundleEncoder);
|
|
10
|
+
/**
|
|
11
|
+
* Finishes recording and returns a wrapped render bundle.
|
|
12
|
+
*/
|
|
13
|
+
finish({ label }?: {
|
|
14
|
+
label?: string;
|
|
15
|
+
}): void;
|
|
16
|
+
}
|
|
17
|
+
export default RenderBundleEncoderCreator;
|
|
@@ -1 +1,112 @@
|
|
|
1
|
-
import{BRAND,RAW}from"@agpu/helpers/decorators";
|
|
1
|
+
import { BRAND, RAW } from "@agpu/helpers/decorators";
|
|
2
|
+
import UNSURE from "@agpu/helpers/unsure";
|
|
3
|
+
import DeviceControls from "../../main/device";
|
|
4
|
+
import BindGroupLayoutCreator from "../data/bindGroupLayout";
|
|
5
|
+
import ShaderModuleCreator from "../data/shaderModule";
|
|
6
|
+
import PipelineLayoutCreator from "./pipelineLayout";
|
|
7
|
+
export interface RenderPipelineCreator extends RAW<Promise<GPURenderPipeline>>, BRAND<"RenderPipelineCreator"> {
|
|
8
|
+
label(): Promise<UNSURE<string>>;
|
|
9
|
+
label<T extends string>(label: T): Promise<T>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Wrapper around {@link GPURenderPipeline}.
|
|
13
|
+
*/
|
|
14
|
+
export declare class RenderPipelineCreator {
|
|
15
|
+
#private;
|
|
16
|
+
pipeline: Promise<GPURenderPipeline>;
|
|
17
|
+
constructor(device: GPUDevice, optionsOrPipeline: RENDER_PIPELINE_OPTIONS | GPURenderPipeline);
|
|
18
|
+
/**
|
|
19
|
+
* Wait for the pipeline to resolve/reject
|
|
20
|
+
*/
|
|
21
|
+
init(): Promise<unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Represents {@link GPUPipelineBase.getBindGroupLayout}
|
|
24
|
+
*/
|
|
25
|
+
bindGroupLayout: (index: number) => Promise<{
|
|
26
|
+
"__#private@#device"?: GPUDevice;
|
|
27
|
+
"__#private@#descriptor"?: GPUBindGroupLayoutDescriptor;
|
|
28
|
+
readonly bindGroupLayout: GPUBindGroupLayout;
|
|
29
|
+
clone(): BindGroupLayoutCreator;
|
|
30
|
+
raw(): GPUBindGroupLayout;
|
|
31
|
+
readonly __brand: "BindGroupLayoutCreator";
|
|
32
|
+
[Symbol.hasInstance](instance: any): boolean;
|
|
33
|
+
label(): string;
|
|
34
|
+
label<T extends string>(val: T): T;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Recreates the render pipeline from its original descriptor when available.
|
|
38
|
+
*/
|
|
39
|
+
clone(): RenderPipelineCreator;
|
|
40
|
+
}
|
|
41
|
+
export interface RENDER_PIPELINE_OPTIONS extends GPUObjectDescriptorBase {
|
|
42
|
+
/** {@link GPURenderPipelineDescriptor.vertex} */
|
|
43
|
+
vertex: VERTEX_STATE;
|
|
44
|
+
/** {@link GPURenderPipelineDescriptor.primitive} */
|
|
45
|
+
primitive?: GPUPrimitiveState;
|
|
46
|
+
/** {@link GPURenderPipelineDescriptor.depthStencil} */
|
|
47
|
+
depthStencil?: DEPTH_STENCIL;
|
|
48
|
+
/** {@link GPURenderPipelineDescriptor.multisample} */
|
|
49
|
+
multisample?: GPUMultisampleState;
|
|
50
|
+
/** {@link GPURenderPipelineDescriptor.fragment} */
|
|
51
|
+
fragment?: FRAGMENT_STATE;
|
|
52
|
+
/**{@link GPUPipelineDescriptorBase.layout} */
|
|
53
|
+
layout: InstanceType<DeviceControls["PipelineLayout"]> | PipelineLayoutCreator | GPUAutoLayoutMode;
|
|
54
|
+
/**Whether to create the pipeline async */
|
|
55
|
+
async?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Depth/stencil configuration used when creating render pipelines.
|
|
59
|
+
*/
|
|
60
|
+
export interface DEPTH_STENCIL {
|
|
61
|
+
format: GPUTextureFormat;
|
|
62
|
+
depth?: {
|
|
63
|
+
write?: boolean;
|
|
64
|
+
compare?: GPUCompareFunction;
|
|
65
|
+
};
|
|
66
|
+
stencil?: {
|
|
67
|
+
front?: STENCIL_FACE_STATE;
|
|
68
|
+
back?: STENCIL_FACE_STATE;
|
|
69
|
+
mask?: {
|
|
70
|
+
read?: GPUStencilValue;
|
|
71
|
+
write?: GPUStencilValue;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
depthBias?: {
|
|
75
|
+
value?: GPUDepthBias;
|
|
76
|
+
slopeScale?: number;
|
|
77
|
+
clamp?: number;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Stencil-face state used by {@link DEPTH_STENCIL}.
|
|
82
|
+
*/
|
|
83
|
+
export interface STENCIL_FACE_STATE {
|
|
84
|
+
compare?: GPUCompareFunction;
|
|
85
|
+
operation?: {
|
|
86
|
+
fail?: GPUStencilOperation;
|
|
87
|
+
depthFail?: GPUStencilOperation;
|
|
88
|
+
pass?: GPUStencilOperation;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Vertex stage configuration used by {@link RENDER_PIPELINE_OPTIONS}.
|
|
93
|
+
*/
|
|
94
|
+
export interface VERTEX_STATE extends PROGRAMMABLE_STAGE {
|
|
95
|
+
/**{@link GPUVertexState.buffers} */
|
|
96
|
+
buffers?: Iterable<UNSURE<GPUVertexBufferLayout>>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Shared programmable stage configuration.
|
|
100
|
+
*/
|
|
101
|
+
export interface PROGRAMMABLE_STAGE {
|
|
102
|
+
/**{@link DeviceControls.ShaderModule} */
|
|
103
|
+
module: InstanceType<DeviceControls["ShaderModule"]> | ShaderModuleCreator;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Fragment stage configuration used by {@link RENDER_PIPELINE_OPTIONS}.
|
|
107
|
+
*/
|
|
108
|
+
export interface FRAGMENT_STATE extends PROGRAMMABLE_STAGE {
|
|
109
|
+
/**{@link GPUFragmentState.targets} */
|
|
110
|
+
targets: Iterable<GPUColorTargetState>;
|
|
111
|
+
}
|
|
112
|
+
export default RenderPipelineCreator;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
import{BRAND,LABEL,RAW}from"@agpu/helpers/decorators";
|
|
1
|
+
import { BRAND, LABEL, RAW } from "@agpu/helpers/decorators";
|
|
2
|
+
export interface SamplerCreator extends RAW<GPUSampler>, BRAND<"SamplerCreator">, LABEL {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Wrapper around {@link GPUSampler}.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SamplerCreator {
|
|
8
|
+
#private;
|
|
9
|
+
sampler: GPUSampler;
|
|
10
|
+
constructor(device: GPUDevice, optionsOrSampler: GPUSamplerDescriptor | GPUSampler);
|
|
11
|
+
/**
|
|
12
|
+
* Recreates the sampler from its original descriptor when available.
|
|
13
|
+
*/
|
|
14
|
+
clone(): SamplerCreator;
|
|
15
|
+
}
|
|
16
|
+
export default SamplerCreator;
|
package/dist/helpers/align.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Default usage flags used when explicit options are omitted.
|
|
3
|
+
*/
|
|
4
|
+
declare const defaults: {
|
|
5
|
+
bufferUsage: number;
|
|
6
|
+
textureUsage: number;
|
|
7
|
+
};
|
|
8
|
+
export default defaults;
|
package/dist/helpers/errors.d.ts
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import{AndromedaError}from"@agpu/helpers/errors";
|
|
1
|
+
import { AndromedaError } from "@agpu/helpers/errors";
|
|
2
|
+
/**
|
|
3
|
+
* Creates an {@link AndromedaError} with a standardized message format.
|
|
4
|
+
*/
|
|
5
|
+
export default function error(code: number, message: string, hint?: string): AndromedaError;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
import DeviceControls from"../../classes/main/device";
|
|
1
|
+
import DeviceControls from "../../classes/main/device";
|
|
2
|
+
type CLASS_KEYS<T> = {
|
|
3
|
+
[K in keyof T]: T[K] extends abstract new (...args: any) => any ? K : never;
|
|
4
|
+
}[keyof T];
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a `DeviceControls` constructor key to the corresponding instance type.
|
|
7
|
+
*/
|
|
8
|
+
type DC_MEMBER<K extends CLASS_KEYS<DeviceControls>> = DeviceControls[K] extends abstract new (...args: any) => infer R ? R : never;
|
|
9
|
+
export default DC_MEMBER;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* **@andromeda-gpu/bindings**
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
* The main bindings package for andromeda-3d's webgpu support
|
|
5
|
+
*/
|
|
6
|
+
import BufferUsage from "./constants/bufferusage";
|
|
7
|
+
import TextureUsage from "./constants/textureusage";
|
|
8
|
+
import WebGPUControls from "./classes/main/webgpucontrols";
|
|
9
|
+
export { WebGPUControls, BufferUsage, TextureUsage };
|