typegpu 0.0.0-alpha.4 → 0.0.0-alpha.5
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/chunk-337KOXP7.js +2 -0
- package/chunk-337KOXP7.js.map +1 -0
- package/chunk-6WFXH2OR.js +8 -0
- package/chunk-6WFXH2OR.js.map +1 -0
- package/chunk-G6QA55EY.cjs +8 -0
- package/chunk-G6QA55EY.cjs.map +1 -0
- package/chunk-S55XYV7U.cjs +2 -0
- package/chunk-S55XYV7U.cjs.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.d.cts +64 -23
- package/data/index.d.ts +64 -23
- package/data/index.js +1 -1
- package/index.cjs +1 -48
- package/index.cjs.map +1 -1
- package/index.d.cts +55 -327
- package/index.d.ts +55 -327
- package/index.js +1 -48
- package/index.js.map +1 -1
- package/macro/index.cjs +3 -3
- package/macro/index.cjs.map +1 -1
- package/macro/index.d.cts +1 -1
- package/macro/index.d.ts +1 -1
- package/macro/index.js +2 -2
- package/macro/index.js.map +1 -1
- package/package.json +7 -8
- package/types-DU0c7BuW.d.cts +207 -0
- package/types-DU0c7BuW.d.ts +207 -0
- package/chunk-7HTWRNOH.cjs +0 -12
- package/chunk-7HTWRNOH.cjs.map +0 -1
- package/chunk-K2GYQABQ.js +0 -12
- package/chunk-K2GYQABQ.js.map +0 -1
- package/std140-Cv7GDE9w.d.ts +0 -26
- package/std140-DRitCcmc.d.cts +0 -26
- package/types-ENDwr_p9.d.cts +0 -243
- package/types-ENDwr_p9.d.ts +0 -243
package/index.d.cts
CHANGED
@@ -1,348 +1,76 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
import { S as SimpleWgslData } from './std140-DRitCcmc.cjs';
|
1
|
+
import { Parsed } from 'typed-binary';
|
2
|
+
import { A as AnyTgpuData, B as BufferUsage, T as TgpuBindable, a as TgpuAllocatable, b as TgpuNamable, c as TgpuPlum, v as vecBase, d as vec3f, e as vec3i, f as vec3u } from './types-DU0c7BuW.cjs';
|
3
|
+
export { h as TexelFormat, g as TgpuData } from './types-DU0c7BuW.cjs';
|
5
4
|
|
6
|
-
|
7
|
-
* An error that happens during resolution of WGSL code.
|
8
|
-
* Contains a trace of all ancestor resolvables in
|
9
|
-
* which this error originated.
|
10
|
-
*
|
11
|
-
* @category Errors
|
12
|
-
*/
|
13
|
-
declare class ResolutionError extends Error {
|
14
|
-
readonly cause: unknown;
|
15
|
-
readonly trace: WgslResolvable[];
|
16
|
-
constructor(cause: unknown, trace: WgslResolvable[]);
|
17
|
-
appendToTrace(ancestor: WgslResolvable): ResolutionError;
|
18
|
-
}
|
19
|
-
/**
|
20
|
-
* @category Errors
|
21
|
-
*/
|
22
|
-
declare class MissingSlotValueError extends Error {
|
23
|
-
readonly slot: WgslSlot<unknown>;
|
24
|
-
constructor(slot: WgslSlot<unknown>);
|
25
|
-
}
|
26
|
-
/**
|
27
|
-
* @category Errors
|
28
|
-
*/
|
29
|
-
declare class RecursiveDataTypeError extends Error {
|
30
|
-
constructor();
|
31
|
-
}
|
32
|
-
|
33
|
-
declare abstract class Callable<TArgs extends [...any[]], TReturn> extends Function {
|
34
|
-
_bound: Callable<TArgs, TReturn>;
|
35
|
-
constructor();
|
36
|
-
abstract _call(...args: TArgs): TReturn;
|
37
|
-
}
|
38
|
-
type ICallable<TArgs extends [...any[]], TReturn> = (...args: TArgs) => TReturn;
|
39
|
-
type AsCallable<T, TArgs extends [...any[]], TReturn> = T & ICallable<TArgs, TReturn>;
|
40
|
-
|
41
|
-
type PlumListener<T> = (newValue: T) => unknown;
|
42
|
-
|
43
|
-
interface WgslCode extends WgslResolvable {
|
44
|
-
$name(label?: string | undefined): WgslCode;
|
45
|
-
with<T>(slot: WgslSlot<T>, value: Eventual<T>): BoundWgslCode;
|
5
|
+
interface TgpuBufferUsage<TData extends AnyTgpuData, TUsage extends BufferUsage = BufferUsage> extends TgpuBindable<TData, TUsage> {
|
46
6
|
}
|
47
|
-
type BoundWgslCode = Omit<WgslCode, '$name'>;
|
48
|
-
declare function code(strings: TemplateStringsArray, ...params: (Wgsl | Wgsl[] | InlineResolve)[]): WgslCode;
|
49
7
|
|
50
|
-
interface
|
51
|
-
readonly descriptor: GPUSamplerDescriptor;
|
52
|
-
$name(label: string): WgslSampler;
|
53
|
-
}
|
54
|
-
declare function sampler(descriptor: GPUSamplerDescriptor): WgslSampler;
|
55
|
-
|
56
|
-
interface WgslAnyTextureView extends WgslRenderResource {
|
57
|
-
readonly descriptor: GPUTextureViewDescriptor;
|
58
|
-
readonly texture: WgslAnyTexture;
|
59
|
-
readonly dataType: AnyWgslPrimitive | AnyWgslTexelFormat;
|
60
|
-
readonly access: StorageTextureAccess | undefined;
|
61
|
-
}
|
62
|
-
interface WgslAnyTexture {
|
63
|
-
readonly descriptor: Omit<GPUTextureDescriptor, 'usage'>;
|
64
|
-
get flags(): GPUTextureUsageFlags;
|
65
|
-
}
|
66
|
-
interface WgslTexture<TAllows extends TextureUsage = never> {
|
67
|
-
readonly descriptor: Omit<GPUTextureDescriptor, 'usage'>;
|
68
|
-
get label(): string | undefined;
|
69
|
-
get flags(): GPUTextureUsageFlags;
|
70
|
-
$name(label: string): WgslTexture<TAllows>;
|
71
|
-
$allowSampled(): WgslTexture<TAllows | 'sampled'>;
|
72
|
-
$allowStorage(): WgslTexture<TAllows | 'storage'>;
|
73
|
-
asStorage(params: StorageTextureParams): 'storage' extends TAllows ? WgslTextureView<AnyWgslTexelFormat, 'storage'> : null;
|
74
|
-
asSampled(params: SampledTextureParams): 'sampled' extends TAllows ? WgslTextureView<typeof params.dataType, 'sampled'> : null;
|
75
|
-
}
|
76
|
-
interface WgslTextureView<TData extends AnyWgslPrimitive | AnyWgslTexelFormat, TUsage extends TextureUsage> extends WgslRenderResource {
|
77
|
-
readonly texture: WgslTexture<TUsage>;
|
78
|
-
readonly descriptor: Omit<GPUTextureViewDescriptor, 'usage'>;
|
79
|
-
readonly type: WgslRenderResourceType;
|
80
|
-
readonly dataType: TData;
|
81
|
-
readonly access: StorageTextureAccess | undefined;
|
82
|
-
$name(label: string): WgslTextureView<TData, TUsage>;
|
83
|
-
}
|
84
|
-
interface WgslTextureExternal extends WgslRenderResource {
|
85
|
-
readonly descriptor: GPUExternalTextureDescriptor;
|
86
|
-
}
|
87
|
-
declare function texture<TUsage extends TextureUsage = never>(descriptor: Omit<GPUTextureDescriptor, 'usage'>): WgslTexture<TUsage>;
|
88
|
-
declare function textureExternal(descriptor: GPUExternalTextureDescriptor): WgslTextureExternalImpl;
|
89
|
-
declare class WgslTextureExternalImpl implements WgslTextureExternal {
|
90
|
-
readonly descriptor: GPUExternalTextureDescriptor;
|
91
|
-
private _label;
|
92
|
-
readonly type = "texture_external";
|
93
|
-
constructor(descriptor: GPUExternalTextureDescriptor);
|
94
|
-
get label(): string | undefined;
|
95
|
-
$name(label: string | undefined): this;
|
96
|
-
resolve(ctx: ResolutionCtx): string;
|
97
|
-
}
|
98
|
-
|
99
|
-
type SetPlumAction<T> = T | ((prev: T) => T);
|
100
|
-
interface TypeGpuRuntime {
|
8
|
+
interface Unmanaged {
|
101
9
|
readonly device: GPUDevice;
|
102
|
-
|
103
|
-
* The current command encoder. This property will
|
104
|
-
* hold the same value until `flush()` is called.
|
105
|
-
*/
|
106
|
-
readonly commandEncoder: GPUCommandEncoder;
|
107
|
-
readPlum<TPlum extends WgslPlum>(plum: TPlum): ExtractPlumValue<TPlum>;
|
108
|
-
setPlum<TPlum extends WgslPlum & WgslSettable>(plum: TPlum, value: SetPlumAction<ExtractPlumValue<TPlum>>): void;
|
109
|
-
onPlumChange<TValue>(plum: WgslPlum<TValue>, listener: PlumListener<TValue>): Unsubscribe;
|
110
|
-
writeBuffer<TValue extends AnyWgslData>(allocatable: WgslAllocatable<TValue>, data: Parsed<TValue>): void;
|
111
|
-
readBuffer<TData extends AnyWgslData>(allocatable: WgslAllocatable<TData>): Promise<Parsed<TData>>;
|
112
|
-
bufferFor(allocatable: WgslAllocatable): GPUBuffer;
|
113
|
-
textureFor(view: WgslAnyTexture | WgslAnyTextureView): GPUTexture;
|
114
|
-
viewFor(view: WgslAnyTextureView): GPUTextureView;
|
115
|
-
externalTextureFor(texture: WgslTextureExternal): GPUExternalTexture;
|
116
|
-
samplerFor(sampler: WgslSampler): GPUSampler;
|
117
|
-
dispose(): void;
|
118
|
-
/**
|
119
|
-
* Causes all commands enqueued by pipelines to be
|
120
|
-
* submitted to the GPU.
|
121
|
-
*/
|
122
|
-
flush(): void;
|
123
|
-
makeRenderPipeline(options: RenderPipelineOptions): RenderPipelineExecutor;
|
124
|
-
makeComputePipeline(options: ComputePipelineOptions): ComputePipelineExecutor;
|
125
|
-
}
|
126
|
-
interface RenderPipelineOptions {
|
127
|
-
vertex: {
|
128
|
-
code: WgslCode | BoundWgslCode;
|
129
|
-
output: {
|
130
|
-
[K in symbol]: string;
|
131
|
-
} & {
|
132
|
-
[K in string]: AnyWgslData;
|
133
|
-
};
|
134
|
-
};
|
135
|
-
fragment: {
|
136
|
-
code: WgslCode | BoundWgslCode;
|
137
|
-
target: Iterable<GPUColorTargetState | null>;
|
138
|
-
};
|
139
|
-
primitive: GPUPrimitiveState;
|
140
|
-
externalLayouts?: GPUBindGroupLayout[];
|
141
|
-
label?: string;
|
142
|
-
}
|
143
|
-
interface ComputePipelineOptions {
|
144
|
-
code: WgslCode | BoundWgslCode;
|
145
|
-
workgroupSize?: readonly [number, number?, number?];
|
146
|
-
externalLayouts?: GPUBindGroupLayout[];
|
147
|
-
label?: string;
|
10
|
+
readonly buffer: GPUBuffer;
|
148
11
|
}
|
149
|
-
|
150
|
-
|
151
|
-
instanceCount?: number;
|
152
|
-
firstVertex?: number;
|
153
|
-
firstInstance?: number;
|
154
|
-
externalBindGroups?: GPUBindGroup[];
|
155
|
-
};
|
156
|
-
interface RenderPipelineExecutor {
|
157
|
-
execute(options: RenderPipelineExecutorOptions): void;
|
158
|
-
}
|
159
|
-
type ComputePipelineExecutorOptions = {
|
160
|
-
workgroups?: readonly [number, number?, number?];
|
161
|
-
externalBindGroups?: GPUBindGroup[];
|
162
|
-
};
|
163
|
-
interface ComputePipelineExecutor {
|
164
|
-
execute(options?: ComputePipelineExecutorOptions): void;
|
12
|
+
interface AllowUniform {
|
13
|
+
uniformAllowed: true;
|
165
14
|
}
|
166
|
-
|
167
|
-
|
168
|
-
interface NameRegistry {
|
169
|
-
nameFor(item: WgslResolvable): string;
|
15
|
+
interface AllowReadonly {
|
16
|
+
readonlyAllowed: true;
|
170
17
|
}
|
171
|
-
|
172
|
-
|
173
|
-
private names;
|
174
|
-
nameFor(item: WgslResolvable): string;
|
18
|
+
interface AllowMutable {
|
19
|
+
mutableAllowed: true;
|
175
20
|
}
|
176
|
-
|
177
|
-
|
178
|
-
* Allows to provide a good fallback for instances of the
|
179
|
-
* same function that are bound to different slot values.
|
180
|
-
*/
|
181
|
-
private readonly _usedNames;
|
182
|
-
private readonly _assignedNames;
|
183
|
-
nameFor(item: WgslResolvable): string;
|
21
|
+
interface AllowVertex {
|
22
|
+
vertexAllowed: true;
|
184
23
|
}
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
readonly
|
189
|
-
|
24
|
+
type AllowedUsages<TData extends AnyTgpuData> = {
|
25
|
+
uniform: TgpuBufferUsage<TData, 'uniform'> | null;
|
26
|
+
mutable: TgpuBufferUsage<TData, 'mutable'> | null;
|
27
|
+
readonly: TgpuBufferUsage<TData, 'readonly'> | null;
|
28
|
+
vertex: TgpuBufferUsage<TData, 'vertex'> | null;
|
190
29
|
};
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
30
|
+
interface TgpuBuffer<TData extends AnyTgpuData> extends TgpuAllocatable<TData>, TgpuNamable {
|
31
|
+
$allowUniform(): this & AllowUniform;
|
32
|
+
$allowReadonly(): this & AllowReadonly;
|
33
|
+
$allowMutable(): this & AllowMutable;
|
34
|
+
$allowVertex(stepMode: 'vertex' | 'instance'): this & AllowVertex;
|
35
|
+
$addFlags(flags: GPUBufferUsageFlags): this;
|
36
|
+
$device(device: GPUDevice): this & Unmanaged;
|
37
|
+
_usages: AllowedUsages<TData>;
|
38
|
+
readonly label: string | undefined;
|
39
|
+
}
|
40
|
+
declare function buffer<TData extends AnyTgpuData>(typeSchema: TData, initial?: Parsed<TData> | TgpuPlum<Parsed<TData>> | undefined): TgpuBuffer<TData>;
|
41
|
+
declare function buffer<TData extends AnyTgpuData>(typeSchema: TData, gpuBuffer: GPUBuffer): TgpuBuffer<TData>;
|
42
|
+
|
43
|
+
declare function write<TData extends AnyTgpuData>(buffer: TgpuBuffer<TData> & Unmanaged, data: Parsed<TData>): void;
|
44
|
+
declare function read<TData extends AnyTgpuData>(buffer: TgpuBuffer<TData> & Unmanaged): Promise<Parsed<TData>>;
|
45
|
+
|
46
|
+
declare const tgpu: {
|
47
|
+
createBuffer: typeof buffer;
|
48
|
+
read: typeof read;
|
49
|
+
write: typeof write;
|
195
50
|
};
|
196
|
-
declare class ProgramBuilder {
|
197
|
-
private runtime;
|
198
|
-
private root;
|
199
|
-
constructor(runtime: TypeGpuRuntime, root: WgslResolvable);
|
200
|
-
build(options: BuildOptions): Program;
|
201
|
-
}
|
202
|
-
|
203
|
-
type VariableScope = 'private' | 'workgroup';
|
204
|
-
interface WgslVar<TDataType extends AnyWgslData> extends WgslResolvable {
|
205
|
-
$name(label: string): WgslVar<TDataType>;
|
206
|
-
}
|
207
51
|
|
208
|
-
interface WgslBufferUsage<TData extends AnyWgslData, TUsage extends BufferUsage = BufferUsage> extends WgslBindable<TData, TUsage> {
|
209
|
-
$name(label: string): WgslBufferUsage<TData, TUsage>;
|
210
|
-
}
|
211
|
-
|
212
|
-
type UsageGuard<TUsage extends BufferUsage, TData extends AnyWgslData, TAllows> = TUsage extends TAllows ? WgslBufferUsage<TData, TUsage> : null;
|
213
|
-
interface WgslBuffer<TData extends AnyWgslData, TAllows extends BufferUsage = never> extends WgslAllocatable<TData> {
|
214
|
-
$name(label: string): WgslBuffer<TData, TAllows>;
|
215
|
-
$allowUniform(): WgslBuffer<TData, TAllows | 'uniform'>;
|
216
|
-
$allowReadonly(): WgslBuffer<TData, TAllows | 'readonly'>;
|
217
|
-
$allowMutable(): WgslBuffer<TData, TAllows | 'mutable'>;
|
218
|
-
$allowVertex(stepMode: 'vertex' | 'instance'): WgslBuffer<TData, TAllows | 'vertex'>;
|
219
|
-
$addFlags(flags: GPUBufferUsageFlags): WgslBuffer<TData, TAllows>;
|
220
|
-
asUniform(): UsageGuard<'uniform', TData, TAllows>;
|
221
|
-
asMutable(): UsageGuard<'mutable', TData, TAllows>;
|
222
|
-
asReadonly(): UsageGuard<'readonly', TData, TAllows>;
|
223
|
-
asVertex(): UsageGuard<'vertex', TData, TAllows>;
|
224
|
-
}
|
225
|
-
declare function buffer<TData extends AnyWgslData, TUsage extends BufferUsage = never>(typeSchema: TData, initial?: Parsed<TData> | WgslPlum<Parsed<TData>> | undefined): WgslBuffer<TData, TUsage>;
|
226
|
-
|
227
|
-
interface WgslConst extends WgslResolvable {
|
228
|
-
$name(label: string): WgslConst;
|
229
|
-
}
|
230
52
|
/**
|
231
|
-
*
|
232
|
-
* to the passed in expression.
|
53
|
+
* @category Errors
|
233
54
|
*/
|
234
|
-
declare
|
235
|
-
|
236
|
-
interface WgslDeclare extends WgslResolvable {
|
237
|
-
}
|
238
|
-
declare function declare(strings: TemplateStringsArray, ...params: (Wgsl | Wgsl[] | InlineResolve)[]): WgslDeclare;
|
239
|
-
|
240
|
-
interface WgslFn$1 extends WgslResolvable {
|
241
|
-
$name(label: string): WgslFn$1;
|
242
|
-
with<T>(slot: WgslSlot<T>, value: Eventual<T>): BoundWgslFn;
|
243
|
-
}
|
244
|
-
type BoundWgslFn = Omit<WgslFn$1, '$name'>;
|
245
|
-
declare function fn$1(strings: TemplateStringsArray, ...params: (Wgsl | InlineResolve)[]): WgslFn$1;
|
246
|
-
|
247
|
-
interface WgslFn<TArgTypes extends [WgslFnArgument, ...WgslFnArgument[]] | [], TReturn extends AnyWgslData | undefined = undefined> extends WgslResolvable, Callable<SegmentsFromTypes<TArgTypes>, WgslFunctionCall<TArgTypes, TReturn>> {
|
248
|
-
}
|
249
|
-
declare function fn<TArgTypes extends [WgslFnArgument, ...WgslFnArgument[]] | [], TReturn extends AnyWgslData | undefined = undefined>(argTypes: TArgTypes, returnType?: TReturn): (bodyProducer: (...args: ValuesFromTypes<TArgTypes>) => Wgsl) => AsCallable<WgslFnImpl<TArgTypes, TReturn>, SegmentsFromTypes<TArgTypes>, WgslFunctionCall<TArgTypes>>;
|
250
|
-
type ValuesFromTypes<TArgTypes extends WgslFnArgument[]> = {
|
251
|
-
[K in keyof TArgTypes]: WgslValue<TArgTypes[K]> & WgslIdentifier;
|
252
|
-
};
|
253
|
-
type PairsFromTypes<TArgTypes extends WgslFnArgument[]> = {
|
254
|
-
[K in keyof TArgTypes]: readonly [WgslIdentifier, TArgTypes[K]];
|
255
|
-
};
|
256
|
-
type SegmentsFromTypes<TArgTypes extends WgslFnArgument[]> = {
|
257
|
-
[K in keyof TArgTypes]: Wgsl;
|
258
|
-
};
|
259
|
-
declare class WgslFunctionCall<TArgTypes extends [WgslFnArgument, ...WgslFnArgument[]] | [], TReturn extends AnyWgslData | undefined = undefined> implements WgslResolvable {
|
260
|
-
private usedFn;
|
261
|
-
private readonly args;
|
262
|
-
constructor(usedFn: WgslFn<TArgTypes, TReturn>, args: SegmentsFromTypes<TArgTypes>);
|
263
|
-
resolve(ctx: ResolutionCtx): string;
|
264
|
-
toString(): string;
|
265
|
-
}
|
266
|
-
declare class WgslFnImpl<TArgTypes extends [WgslFnArgument, ...WgslFnArgument[]] | [], TReturn extends AnyWgslData | undefined = undefined> extends Callable<SegmentsFromTypes<TArgTypes>, WgslFunctionCall<TArgTypes, TReturn>> implements WgslFn<TArgTypes, TReturn> {
|
267
|
-
private argPairs;
|
268
|
-
private returnType;
|
269
|
-
private readonly body;
|
270
|
-
private _label;
|
271
|
-
constructor(argPairs: PairsFromTypes<TArgTypes>, returnType: TReturn | undefined, body: Wgsl);
|
272
|
-
get label(): string | undefined;
|
273
|
-
$name(label: string): this;
|
274
|
-
resolve(ctx: ResolutionCtx): string;
|
275
|
-
_call(...args: SegmentsFromTypes<TArgTypes>): WgslFunctionCall<TArgTypes, TReturn>;
|
276
|
-
toString(): string;
|
55
|
+
declare class RecursiveDataTypeError extends Error {
|
56
|
+
constructor();
|
277
57
|
}
|
278
58
|
|
279
|
-
declare
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
constant: typeof constant;
|
291
|
-
declare: typeof declare;
|
292
|
-
var: <TDataType extends AnyWgslData>(dataType: TDataType, initialValue?: Wgsl, scope?: VariableScope) => WgslVar<TDataType>;
|
293
|
-
sampler: typeof sampler;
|
294
|
-
texture: typeof texture;
|
295
|
-
textureExternal: typeof textureExternal;
|
296
|
-
builtin: {
|
297
|
-
readonly vertexIndex: symbol;
|
298
|
-
readonly instanceIndex: symbol;
|
299
|
-
readonly position: symbol;
|
300
|
-
readonly clipDistances: symbol;
|
301
|
-
readonly frontFacing: symbol;
|
302
|
-
readonly fragDepth: symbol;
|
303
|
-
readonly sampleIndex: symbol;
|
304
|
-
readonly sampleMask: symbol;
|
305
|
-
readonly fragment: symbol;
|
306
|
-
readonly localInvocationId: symbol;
|
307
|
-
readonly localInvocationIndex: symbol;
|
308
|
-
readonly globalInvocationId: symbol;
|
309
|
-
readonly workgroupId: symbol;
|
310
|
-
readonly numWorkgroups: symbol;
|
311
|
-
};
|
59
|
+
declare const std: {
|
60
|
+
add: <T extends vecBase>(lhs: T, rhs: T) => T;
|
61
|
+
sub: <T extends vecBase>(lhs: T, rhs: T) => T;
|
62
|
+
mul: <T extends vecBase>(s: number, v: T) => T;
|
63
|
+
dot: <T extends vecBase>(lhs: T, rhs: T) => number;
|
64
|
+
normalize: <T extends vecBase>(v: T) => T;
|
65
|
+
cross: <T extends vec3f | vec3i | vec3u>(a: T, b: T) => T;
|
66
|
+
fract: (a: number) => number;
|
67
|
+
length: <T extends vecBase>(vector: T) => number;
|
68
|
+
sin: (x: number) => number;
|
69
|
+
cos: (x: number) => number;
|
312
70
|
};
|
313
71
|
|
314
72
|
/**
|
315
|
-
*
|
316
|
-
*/
|
317
|
-
type CreateRuntimeOptions = {
|
318
|
-
adapter: GPURequestAdapterOptions | undefined;
|
319
|
-
device: GPUDeviceDescriptor | undefined;
|
320
|
-
};
|
321
|
-
/**
|
322
|
-
* @param options
|
323
|
-
* @returns
|
324
|
-
*
|
325
|
-
* @example
|
326
|
-
* When given no options, the function will ask the browser for a suitable GPU device.
|
327
|
-
* ```ts
|
328
|
-
* createRuntime();
|
329
|
-
* ```
|
330
|
-
*
|
331
|
-
* @example
|
332
|
-
* If there are specific options that should be used when requesting a device, you can pass those in.
|
333
|
-
* ```ts
|
334
|
-
* const adapterOptions: GPURequestAdapterOptions = ...;
|
335
|
-
* const deviceDescriptor: GPUDeviceDescriptor = ...;
|
336
|
-
* createRuntime({ adapter: adapterOptions, device: deviceDescriptor });
|
337
|
-
* ```
|
338
|
-
*
|
339
|
-
* @example
|
340
|
-
* If a specific device should be used instead, it can be passed in as a parameter.
|
341
|
-
* ```ts
|
342
|
-
* const device: GPUDevice = ...;
|
343
|
-
* createRuntime(device);
|
344
|
-
* ```
|
73
|
+
* @module typegpu
|
345
74
|
*/
|
346
|
-
declare function createRuntime(options?: CreateRuntimeOptions | GPUDevice): Promise<TypeGpuRuntime>;
|
347
75
|
|
348
|
-
export {
|
76
|
+
export { AnyTgpuData, RecursiveDataTypeError, type TgpuBuffer, tgpu as default, std };
|