@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.
@@ -1 +1,33 @@
1
- import{BRAND,RAW}from"@agpu/helpers/decorators";import DC_MEMBER from"../../../helpers/types/DCMember";import PipelineLayoutCreator from"./pipelineLayout";import ShaderModuleCreator from"../data/shaderModule";export interface ComputePipelineCreator extends RAW<Promise<GPUComputePipeline>>,BRAND<"ComputePipelineCreator">{label():Promise<string>;label<T extends string>(label:T):Promise<T>}export declare class ComputePipelineCreator{#private;computePipeline:Promise<GPUComputePipeline>;constructor(device:GPUDevice,sm:COMPUTE_PIPELINE_OPTION|GPUComputePipeline);init():Promise<boolean>;clone():ComputePipelineCreator}export default ComputePipelineCreator;export interface COMPUTE_PIPELINE_OPTION extends GPUObjectDescriptorBase{module:ShaderModuleCreator|DC_MEMBER<"ShaderModule">;async?:boolean;layout:PipelineLayoutCreator}
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";import{BRAND,LABEL,RAW}from"@agpu/helpers/decorators";import BindGroupLayoutCreator from"../data/bindGroupLayout";export interface PipelineLayoutCreator extends RAW<GPUPipelineLayout>,BRAND<"PipelineLayoutCreator">,LABEL{}export declare class PipelineLayoutCreator{#private;pipelineLayout:GPUPipelineLayout;constructor(device:GPUDevice,pipelineLayoutOrOptions:GPUPipelineLayout|PIPELINE_LAYOUT_OPTIONS);clone():PipelineLayoutCreator}export default PipelineLayoutCreator;export interface PIPELINE_LAYOUT_OPTIONS extends GPUObjectDescriptorBase{bindGroupLayouts?:(InstanceType<DeviceControls["BindGroupLayout"]>|BindGroupLayoutCreator)[]}
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";export interface QuerySetCreator extends RAW<GPUQuerySet>,BRAND<"QuerySetCreator">{label():string;label<T extends string>(label:T):T}export declare class QuerySetCreator{#private;querySet:GPUQuerySet;queryDescriptor:GPUQuerySetDescriptor;constructor(device:GPUDevice,options:GPUQuerySetDescriptor|GPUQuerySet);clone():QuerySetCreator;destroy():boolean;destroy<T extends boolean>(destroy:T):T}export default QuerySetCreator;
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";export interface RenderBundleCreator extends RAW<GPURenderBundle>,BRAND<"RenderBundleCreator">,LABEL{}export declare class RenderBundleCreator{renderBundle:GPURenderBundle;constructor(renbun:GPURenderBundle)}export default RenderBundleCreator;
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";import RenderEncoderBase from"./commandEncoder/renderEncoderBase";export interface RenderBundleEncoderCreator extends RAW<GPURenderBundleEncoder>,BRAND<"RenderBundleEncoderCreator">,LABEL{}export declare class RenderBundleEncoderCreator extends RenderEncoderBase<GPURenderBundleEncoder>{constructor(device:GPUDevice,renBun:GPURenderBundleEncoder);finish({label}?:{label?:string}):void}export default RenderBundleEncoderCreator;
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";import UNSURE from"@agpu/helpers/unsure";import DeviceControls from"../../main/device";import BindGroupLayoutCreator from"../data/bindGroupLayout";import ShaderModuleCreator from"../data/shaderModule";import PipelineLayoutCreator from"./pipelineLayout";export interface RenderPipelineCreator extends RAW<Promise<GPURenderPipeline>>,BRAND<"RenderPipelineCreator">{label():Promise<UNSURE<string>>;label<T extends string>(label:T):Promise<T>}export declare class RenderPipelineCreator{#private;pipeline:Promise<GPURenderPipeline>;constructor(device:GPUDevice,optionsOrPipeline:RENDER_PIPELINE_OPTIONS|GPURenderPipeline);init():Promise<unknown>;bindGroupLayout:(index:number)=>Promise<{"__#private@#device"?:GPUDevice;"__#private@#descriptor"?:GPUBindGroupLayoutDescriptor;readonly bindGroupLayout:GPUBindGroupLayout;clone():BindGroupLayoutCreator;raw():GPUBindGroupLayout;readonly __brand:"BindGroupLayoutCreator";[Symbol.hasInstance](instance:any):boolean;label():string;label<T extends string>(val:T):T}>;clone():RenderPipelineCreator}export interface RENDER_PIPELINE_OPTIONS extends GPUObjectDescriptorBase{vertex:VERTEX_STATE;primitive?:GPUPrimitiveState;depthStencil?:DEPTH_STENCIL;multisample?:GPUMultisampleState;fragment?:FRAGMENT_STATE;layout:InstanceType<DeviceControls["PipelineLayout"]>|PipelineLayoutCreator|GPUAutoLayoutMode;async?:boolean}export interface DEPTH_STENCIL{format:GPUTextureFormat;depth?:{write?:boolean;compare?:GPUCompareFunction};stencil?:{front?:STENCIL_FACE_STATE;back?:STENCIL_FACE_STATE;mask?:{read?:GPUStencilValue;write?:GPUStencilValue}};depthBias?:{value?:GPUDepthBias;slopeScale?:number;clamp?:number}}export interface STENCIL_FACE_STATE{compare?:GPUCompareFunction;operation?:{fail?:GPUStencilOperation;depthFail?:GPUStencilOperation;pass?:GPUStencilOperation}}export interface VERTEX_STATE extends PROGRAMMABLE_STAGE{buffers?:Iterable<UNSURE<GPUVertexBufferLayout>>}export interface PROGRAMMABLE_STAGE{module:InstanceType<DeviceControls["ShaderModule"]>|ShaderModuleCreator}export interface FRAGMENT_STATE extends PROGRAMMABLE_STAGE{targets:Iterable<GPUColorTargetState>}export default RenderPipelineCreator;
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";export interface SamplerCreator extends RAW<GPUSampler>,BRAND<"SamplerCreator">,LABEL{}export declare class SamplerCreator{#private;sampler:GPUSampler;constructor(device:GPUDevice,optionsOrSampler:GPUSamplerDescriptor|GPUSampler);clone():SamplerCreator}export default SamplerCreator;
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;
@@ -1 +1,5 @@
1
- declare const BufferUsage:GPUBufferUsage;export default BufferUsage;
1
+ /**
2
+ * Re-export of the native `GPUBufferUsage` enum-like object.
3
+ */
4
+ declare const BufferUsage: GPUBufferUsage;
5
+ export default BufferUsage;
@@ -1 +1,5 @@
1
- declare const TextureUsage:GPUTextureUsage;export default TextureUsage;
1
+ /**
2
+ * Re-export of the native `GPUTextureUsage` enum-like object.
3
+ */
4
+ declare const TextureUsage: GPUTextureUsage;
5
+ export default TextureUsage;
@@ -1 +1,5 @@
1
- export declare const align:(n:number,alignment:number)=>number;export default align;
1
+ /**
2
+ * Rounds `n` up to the next multiple of `alignment`.
3
+ */
4
+ export declare const align: (n: number, alignment: number) => number;
5
+ export default align;
@@ -1 +1,8 @@
1
- declare const defaults:{bufferUsage:number;textureUsage:number};export default defaults;
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;
@@ -1 +1,5 @@
1
- import{AndromedaError}from"@agpu/helpers/errors";export default function error(code:number,message:string,hint?:string):AndromedaError;
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,4 @@
1
- export default function getBindGroups(code:string):Set<Readonly<number>>;
1
+ /**
2
+ * Extracts bind-group indices referenced by WGSL source.
3
+ */
4
+ export default function getBindGroups(code: string): Set<Readonly<number>>;
@@ -1 +1,9 @@
1
- import DeviceControls from"../../classes/main/device";type CLASS_KEYS<T>={[K in keyof T]:T[K]extends abstract new(...args:any)=>any?K:never}[keyof T];type DC_MEMBER<K extends CLASS_KEYS<DeviceControls>>=DeviceControls[K]extends abstract new(...args:any)=>infer R?R:never;export default DC_MEMBER;
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
- import BufferUsage from"./constants/bufferusage";import TextureUsage from"./constants/textureusage";import WebGPUControls from"./classes/main/webgpucontrols";export{WebGPUControls,BufferUsage,TextureUsage};
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 };
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "@webgpu/types": "^0.1.69"
17
17
  },
18
18
  "name": "@agpu/bindings",
19
- "version": "0.2.4",
19
+ "version": "0.2.6",
20
20
  "author": {
21
21
  "name": "Kryft Studios",
22
22
  "email": "AfriaStudios@outlook.in",