typegpu 0.5.8 → 0.5.9
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-734H4JWF.js +2 -0
- package/chunk-734H4JWF.js.map +1 -0
- package/chunk-BJSN5UVV.cjs +41 -0
- package/chunk-BJSN5UVV.cjs.map +1 -0
- package/{chunk-7ACLI4JY.cjs → chunk-BZVU4Q6A.cjs} +2 -2
- package/chunk-BZVU4Q6A.cjs.map +1 -0
- package/chunk-CDUKTYES.cjs +2 -0
- package/chunk-CDUKTYES.cjs.map +1 -0
- package/chunk-CGVYLGBG.js +2 -0
- package/chunk-CGVYLGBG.js.map +1 -0
- package/chunk-SWJVYRFM.js +41 -0
- package/chunk-SWJVYRFM.js.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.cjs.map +1 -1
- package/data/index.d.cts +4 -77
- package/data/index.d.ts +4 -77
- package/data/index.js +1 -1
- package/index.cjs +21 -20
- package/index.cjs.map +1 -1
- package/index.d.cts +5 -3
- package/index.d.ts +5 -3
- package/index.js +21 -20
- package/index.js.map +1 -1
- package/matrix-BULDDGYa.d.ts +122 -0
- package/matrix-BnXitNJ7.d.cts +122 -0
- package/package.json +1 -1
- package/std/index.cjs +1 -1
- package/std/index.cjs.map +1 -1
- package/std/index.d.cts +69 -2
- package/std/index.d.ts +69 -2
- package/std/index.js +1 -1
- package/std/index.js.map +1 -1
- package/{tgpuComputeFn-S61HxwW-.d.ts → tgpuComputeFn-BxPDI5hQ.d.cts} +90 -28
- package/{tgpuComputeFn-S61HxwW-.d.cts → tgpuComputeFn-BxPDI5hQ.d.ts} +90 -28
- package/chunk-7ACLI4JY.cjs.map +0 -1
- package/chunk-L7HIBZAX.js +0 -4
- package/chunk-L7HIBZAX.js.map +0 -1
- package/chunk-SFECI7OX.js +0 -2
- package/chunk-SFECI7OX.js.map +0 -1
- package/chunk-SLWTVY6K.js +0 -2
- package/chunk-SLWTVY6K.js.map +0 -1
- package/chunk-TF6YPHJS.cjs +0 -2
- package/chunk-TF6YPHJS.cjs.map +0 -1
- package/chunk-V4CSEIB2.cjs +0 -4
- package/chunk-V4CSEIB2.cjs.map +0 -1
@@ -959,6 +959,7 @@ interface Mat2x2f {
|
|
959
959
|
(...elements: [number, number, number, number]): m2x2f;
|
960
960
|
(...columns: [v2f, v2f]): m2x2f;
|
961
961
|
(): m2x2f;
|
962
|
+
identity(): m2x2f;
|
962
963
|
}
|
963
964
|
/**
|
964
965
|
* Type of the `d.mat3x3f` object/function: matrix data type schema/constructor
|
@@ -970,6 +971,7 @@ interface Mat3x3f {
|
|
970
971
|
(...elements: [number, number, number, number, number, number, number, number, number]): m3x3f;
|
971
972
|
(...columns: [v3f, v3f, v3f]): m3x3f;
|
972
973
|
(): m3x3f;
|
974
|
+
identity(): m3x3f;
|
973
975
|
}
|
974
976
|
/**
|
975
977
|
* Type of the `d.mat4x4f` object/function: matrix data type schema/constructor
|
@@ -981,6 +983,12 @@ interface Mat4x4f {
|
|
981
983
|
(...elements: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]): m4x4f;
|
982
984
|
(...columns: [v4f, v4f, v4f, v4f]): m4x4f;
|
983
985
|
(): m4x4f;
|
986
|
+
identity(): m4x4f;
|
987
|
+
translation(vec: v3f): m4x4f;
|
988
|
+
scaling(vec: v3f): m4x4f;
|
989
|
+
rotationX(angle: number): m4x4f;
|
990
|
+
rotationY(angle: number): m4x4f;
|
991
|
+
rotationZ(angle: number): m4x4f;
|
984
992
|
}
|
985
993
|
/**
|
986
994
|
* Array schema constructed via `d.arrayOf` function.
|
@@ -1238,6 +1246,22 @@ interface StorageFlag {
|
|
1238
1246
|
type Storage = StorageFlag;
|
1239
1247
|
declare function isUsableAsStorage<T>(value: T): value is T & StorageFlag;
|
1240
1248
|
|
1249
|
+
interface TgpuQuerySet<T extends GPUQueryType> extends TgpuNamable {
|
1250
|
+
readonly resourceType: 'query-set';
|
1251
|
+
readonly type: T;
|
1252
|
+
readonly count: number;
|
1253
|
+
readonly querySet: GPUQuerySet;
|
1254
|
+
readonly destroyed: boolean;
|
1255
|
+
readonly available: boolean;
|
1256
|
+
readonly [$internal]: {
|
1257
|
+
readonly readBuffer: GPUBuffer;
|
1258
|
+
readonly resolveBuffer: GPUBuffer;
|
1259
|
+
};
|
1260
|
+
resolve(): void;
|
1261
|
+
read(): Promise<bigint[]>;
|
1262
|
+
destroy(): void;
|
1263
|
+
}
|
1264
|
+
|
1241
1265
|
/**
|
1242
1266
|
* Used to transpile JS resources into tinyest on demand.
|
1243
1267
|
*/
|
@@ -1280,11 +1304,11 @@ type TgpuFnShellHeader<Args extends AnyData[], Return extends AnyData> = {
|
|
1280
1304
|
* Allows creating tgpu functions by calling this shell
|
1281
1305
|
* and passing the implementation (as WGSL string or JS function) as the argument.
|
1282
1306
|
*/
|
1283
|
-
type TgpuFnShell<Args extends AnyData[], Return extends AnyData> = TgpuFnShellHeader<Args, Return> & ((implementation: (...args: InferArgs<Args>) =>
|
1307
|
+
type TgpuFnShell<Args extends AnyData[], Return extends AnyData> = TgpuFnShellHeader<Args, Return> & ((implementation: (...args: InferArgs<Args>) => Infer<Return>) => TgpuFn<Args, Return>) & ((implementation: string) => TgpuFn<Args, Return>) & ((strings: TemplateStringsArray, ...values: unknown[]) => TgpuFn<Args, Return>) & {
|
1284
1308
|
/**
|
1285
1309
|
* @deprecated Invoke the shell as a function instead.
|
1286
1310
|
*/
|
1287
|
-
does: ((implementation: (...args: InferArgs<Args>) =>
|
1311
|
+
does: ((implementation: (...args: InferArgs<Args>) => Infer<Return>) => TgpuFn<Args, Return>) & ((implementation: string) => TgpuFn<Args, Return>);
|
1288
1312
|
};
|
1289
1313
|
interface TgpuFnBase<Args extends AnyData[], Return extends AnyData> extends TgpuNamable {
|
1290
1314
|
readonly [$internal]: {
|
@@ -1298,10 +1322,10 @@ interface TgpuFnBase<Args extends AnyData[], Return extends AnyData> extends Tgp
|
|
1298
1322
|
with<T>(slot: TgpuSlot<T>, value: Eventual<T>): TgpuFn<Args, Return>;
|
1299
1323
|
with<T extends AnyData>(accessor: TgpuAccessor<T>, value: TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T>): TgpuFn<Args, Return>;
|
1300
1324
|
}
|
1301
|
-
type TgpuFn<Args extends AnyData[] = AnyData[], Return extends AnyData = AnyData> = TgpuFnBase<Args, Return> & ((...args: InferArgs<Args>) =>
|
1325
|
+
type TgpuFn<Args extends AnyData[] = AnyData[], Return extends AnyData = AnyData> = TgpuFnBase<Args, Return> & ((...args: InferArgs<Args>) => Infer<Return>);
|
1302
1326
|
declare function fn<Args extends AnyData[] | []>(argTypes: Args, returnType?: undefined): TgpuFnShell<Args, Void>;
|
1303
1327
|
declare function fn<Args extends AnyData[] | [], Return extends AnyData>(argTypes: Args, returnType: Return): TgpuFnShell<Args, Return>;
|
1304
|
-
declare function isTgpuFn<Args extends AnyData[], Return extends AnyData>(value: unknown | TgpuFn<Args, Return>): value is TgpuFn<Args, Return>;
|
1328
|
+
declare function isTgpuFn<Args extends AnyData[] | [], Return extends AnyData>(value: unknown | TgpuFn<Args, Return>): value is TgpuFn<Args, Return>;
|
1305
1329
|
|
1306
1330
|
interface TgpuSlot<T> extends TgpuNamable {
|
1307
1331
|
readonly resourceType: 'slot';
|
@@ -1348,16 +1372,6 @@ type Providing = {
|
|
1348
1372
|
declare function isSlot<T>(value: unknown | TgpuSlot<T>): value is TgpuSlot<T>;
|
1349
1373
|
declare function isDerived<T extends TgpuDerived<unknown>>(value: T | unknown): value is T;
|
1350
1374
|
|
1351
|
-
interface ComputePipelineInternals {
|
1352
|
-
readonly rawPipeline: GPUComputePipeline;
|
1353
|
-
}
|
1354
|
-
interface TgpuComputePipeline extends TgpuNamable {
|
1355
|
-
readonly [$internal]: ComputePipelineInternals;
|
1356
|
-
readonly resourceType: 'compute-pipeline';
|
1357
|
-
with(bindGroupLayout: TgpuBindGroupLayout, bindGroup: TgpuBindGroup): TgpuComputePipeline;
|
1358
|
-
dispatchWorkgroups(x: number, y?: number | undefined, z?: number | undefined): void;
|
1359
|
-
}
|
1360
|
-
|
1361
1375
|
declare const vertexFormats: readonly ["uint8", "uint8x2", "uint8x4", "sint8", "sint8x2", "sint8x4", "unorm8", "unorm8x2", "unorm8x4", "snorm8", "snorm8x2", "snorm8x4", "uint16", "uint16x2", "uint16x4", "sint16", "sint16x2", "sint16x4", "unorm16", "unorm16x2", "unorm16x4", "snorm16", "snorm16x2", "snorm16x4", "float16", "float16x2", "float16x4", "float32", "float32x2", "float32x3", "float32x4", "uint32", "uint32x2", "uint32x3", "uint32x4", "sint32", "sint32x2", "sint32x3", "sint32x4", "unorm10-10-10-2", "unorm8x4-bgra"];
|
1362
1376
|
type VertexFormat = (typeof vertexFormats)[number];
|
1363
1377
|
declare const kindToDefaultFormatMap: {
|
@@ -1487,7 +1501,7 @@ type VertexOutConstrained = IORecord<BaseIOData | Decorated<BaseIOData, (Locatio
|
|
1487
1501
|
*/
|
1488
1502
|
type TgpuVertexFnShellHeader<VertexIn extends VertexInConstrained, VertexOut extends VertexOutConstrained> = {
|
1489
1503
|
readonly argTypes: [IOLayoutToSchema<VertexIn>] | [];
|
1490
|
-
readonly returnType: IOLayoutToSchema<VertexOut
|
1504
|
+
readonly returnType: IOLayoutToSchema<VertexOut>;
|
1491
1505
|
readonly attributes: [VertexIn];
|
1492
1506
|
readonly isEntry: true;
|
1493
1507
|
};
|
@@ -1505,7 +1519,7 @@ type TgpuVertexFnShell<VertexIn extends VertexInConstrained, VertexOut extends V
|
|
1505
1519
|
interface TgpuVertexFn<VertexIn extends VertexInConstrained = any, VertexOut extends VertexOutConstrained = any> extends TgpuNamable {
|
1506
1520
|
readonly shell: TgpuVertexFnShellHeader<VertexIn, VertexOut>;
|
1507
1521
|
readonly outputType: IOLayoutToSchema<VertexOut>;
|
1508
|
-
readonly inputType: IOLayoutToSchema<VertexIn
|
1522
|
+
readonly inputType: IOLayoutToSchema<VertexIn> | undefined;
|
1509
1523
|
$uses(dependencyMap: Record<string, unknown>): this;
|
1510
1524
|
}
|
1511
1525
|
declare function vertexFn<VertexOut extends VertexOutConstrained>(options: {
|
@@ -1824,15 +1838,15 @@ declare function vertexLayout<TData extends WgslArray | Disarray>(schemaForCount
|
|
1824
1838
|
|
1825
1839
|
interface RenderPipelineInternals {
|
1826
1840
|
readonly core: RenderPipelineCore;
|
1827
|
-
readonly priors: TgpuRenderPipelinePriors;
|
1841
|
+
readonly priors: TgpuRenderPipelinePriors & TimestampWritesPriors;
|
1828
1842
|
}
|
1829
|
-
interface TgpuRenderPipeline<Output extends IOLayout = IOLayout> extends TgpuNamable {
|
1843
|
+
interface TgpuRenderPipeline<Output extends IOLayout = IOLayout> extends TgpuNamable, Timeable<TgpuRenderPipeline> {
|
1830
1844
|
readonly [$internal]: RenderPipelineInternals;
|
1831
1845
|
readonly resourceType: 'render-pipeline';
|
1832
|
-
with<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: TgpuBuffer<TData> & VertexFlag): TgpuRenderPipeline
|
1833
|
-
with<Entries extends Record<string, TgpuLayoutEntry | null>>(bindGroupLayout: TgpuBindGroupLayout<Entries>, bindGroup: TgpuBindGroup<Entries>): TgpuRenderPipeline
|
1834
|
-
withColorAttachment(attachment: FragmentOutToColorAttachment<Output>): TgpuRenderPipeline
|
1835
|
-
withDepthStencilAttachment(attachment: DepthStencilAttachment): TgpuRenderPipeline
|
1846
|
+
with<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: TgpuBuffer<TData> & VertexFlag): TgpuRenderPipeline;
|
1847
|
+
with<Entries extends Record<string, TgpuLayoutEntry | null>>(bindGroupLayout: TgpuBindGroupLayout<Entries>, bindGroup: TgpuBindGroup<Entries>): TgpuRenderPipeline;
|
1848
|
+
withColorAttachment(attachment: FragmentOutToColorAttachment<Output>): TgpuRenderPipeline;
|
1849
|
+
withDepthStencilAttachment(attachment: DepthStencilAttachment): TgpuRenderPipeline;
|
1836
1850
|
draw(vertexCount: number, instanceCount?: number, firstVertex?: number, firstInstance?: number): void;
|
1837
1851
|
}
|
1838
1852
|
type FragmentOutToTargets<T extends IOLayout> = T extends IOData ? GPUColorTargetState : T extends Record<string, unknown> ? {
|
@@ -1952,7 +1966,7 @@ type TgpuRenderPipelinePriors = {
|
|
1952
1966
|
readonly bindGroupLayoutMap?: Map<TgpuBindGroupLayout, TgpuBindGroup> | undefined;
|
1953
1967
|
readonly colorAttachment?: AnyFragmentColorAttachment | undefined;
|
1954
1968
|
readonly depthStencilAttachment?: DepthStencilAttachment | undefined;
|
1955
|
-
};
|
1969
|
+
} & TimestampWritesPriors;
|
1956
1970
|
type Memo = {
|
1957
1971
|
pipeline: GPURenderPipeline;
|
1958
1972
|
bindGroupLayouts: TgpuBindGroupLayout[];
|
@@ -1968,6 +1982,38 @@ declare class RenderPipelineCore {
|
|
1968
1982
|
unwrap(): Memo;
|
1969
1983
|
}
|
1970
1984
|
|
1985
|
+
interface Timeable<T extends TgpuComputePipeline | TgpuRenderPipeline> {
|
1986
|
+
withPerformanceCallback(callback: (start: bigint, end: bigint) => void | Promise<void>): T;
|
1987
|
+
withTimestampWrites(options: {
|
1988
|
+
querySet: TgpuQuerySet<'timestamp'> | GPUQuerySet;
|
1989
|
+
beginningOfPassWriteIndex?: number;
|
1990
|
+
endOfPassWriteIndex?: number;
|
1991
|
+
}): T;
|
1992
|
+
}
|
1993
|
+
type TimestampWritesPriors = {
|
1994
|
+
readonly timestampWrites?: {
|
1995
|
+
querySet: TgpuQuerySet<'timestamp'> | GPUQuerySet;
|
1996
|
+
beginningOfPassWriteIndex?: number;
|
1997
|
+
endOfPassWriteIndex?: number;
|
1998
|
+
};
|
1999
|
+
readonly performanceCallback?: (start: bigint, end: bigint) => void | Promise<void>;
|
2000
|
+
readonly hasAutoQuerySet?: boolean;
|
2001
|
+
};
|
2002
|
+
|
2003
|
+
interface ComputePipelineInternals {
|
2004
|
+
readonly rawPipeline: GPUComputePipeline;
|
2005
|
+
readonly priors: TgpuComputePipelinePriors & TimestampWritesPriors;
|
2006
|
+
}
|
2007
|
+
interface TgpuComputePipeline extends TgpuNamable, Timeable<TgpuComputePipeline> {
|
2008
|
+
readonly [$internal]: ComputePipelineInternals;
|
2009
|
+
readonly resourceType: 'compute-pipeline';
|
2010
|
+
with(bindGroupLayout: TgpuBindGroupLayout, bindGroup: TgpuBindGroup): TgpuComputePipeline;
|
2011
|
+
dispatchWorkgroups(x: number, y?: number | undefined, z?: number | undefined): void;
|
2012
|
+
}
|
2013
|
+
type TgpuComputePipelinePriors = {
|
2014
|
+
readonly bindGroupLayoutMap?: Map<TgpuBindGroupLayout, TgpuBindGroup>;
|
2015
|
+
} & TimestampWritesPriors;
|
2016
|
+
|
1971
2017
|
interface SamplerInternals {
|
1972
2018
|
readonly unwrap?: ((branch: Unwrapper) => GPUSampler) | undefined;
|
1973
2019
|
}
|
@@ -2079,6 +2125,7 @@ interface Unwrapper {
|
|
2079
2125
|
unwrap(resource: TgpuVertexLayout): GPUVertexBufferLayout;
|
2080
2126
|
unwrap(resource: TgpuSampler): GPUSampler;
|
2081
2127
|
unwrap(resource: TgpuComparisonSampler): GPUSampler;
|
2128
|
+
unwrap(resource: TgpuQuerySet<GPUQueryType>): GPUQuerySet;
|
2082
2129
|
}
|
2083
2130
|
|
2084
2131
|
interface WithCompute {
|
@@ -2277,6 +2324,17 @@ interface TgpuRoot extends Unwrapper {
|
|
2277
2324
|
* @param gpuBuffer A vanilla WebGPU buffer.
|
2278
2325
|
*/
|
2279
2326
|
createBuffer<TData extends AnyData>(typeSchema: TData, gpuBuffer: GPUBuffer): TgpuBuffer<TData>;
|
2327
|
+
/**
|
2328
|
+
* Creates a query set for collecting timestamps or occlusion queries.
|
2329
|
+
*
|
2330
|
+
* @remarks
|
2331
|
+
* Typed wrapper around a GPUQuerySet.
|
2332
|
+
*
|
2333
|
+
* @param type The type of queries to collect ('occlusion' or 'timestamp').
|
2334
|
+
* @param count The number of queries in the set.
|
2335
|
+
* @param rawQuerySet An optional pre-existing GPUQuerySet to use instead of creating a new one.
|
2336
|
+
*/
|
2337
|
+
createQuerySet<T extends GPUQueryType>(type: T, count: number, rawQuerySet?: GPUQuerySet | undefined): TgpuQuerySet<T>;
|
2280
2338
|
/**
|
2281
2339
|
* Creates a group of resources that can be bound to a shader based on a specified layout.
|
2282
2340
|
*
|
@@ -2304,6 +2362,11 @@ interface TgpuRoot extends Unwrapper {
|
|
2304
2362
|
createBindGroup<Entries extends Record<string, TgpuLayoutEntry | null> = Record<string, TgpuLayoutEntry | null>>(layout: TgpuBindGroupLayout<Entries>, entries: {
|
2305
2363
|
[K in keyof OmitProps<Entries, null>]: LayoutEntryToInput<Entries[K]>;
|
2306
2364
|
}): TgpuBindGroup<Entries>;
|
2365
|
+
/**
|
2366
|
+
* Retrieves a read-only list of all enabled features of the GPU device.
|
2367
|
+
* @returns A set of strings representing the enabled features.
|
2368
|
+
*/
|
2369
|
+
get enabledFeatures(): ReadonlySet<GPUFeatureName>;
|
2307
2370
|
/**
|
2308
2371
|
* Destroys all underlying resources (i.e. buffers...) created through this root object.
|
2309
2372
|
* If the object is created via `tgpu.init` instead of `tgpu.initFromDevice`,
|
@@ -2491,7 +2554,7 @@ type GetStorageTextureRestriction<T extends TgpuLayoutStorageTexture> = Default<
|
|
2491
2554
|
format: T['storageTexture'];
|
2492
2555
|
dimension: Dimension;
|
2493
2556
|
} : never;
|
2494
|
-
type LayoutEntryToInput<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? (TgpuBuffer<UnwrapRuntimeConstructor<T['uniform']
|
2557
|
+
type LayoutEntryToInput<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? (TgpuBuffer<MemIdentity<UnwrapRuntimeConstructor<T['uniform']>>> & UniformFlag) | GPUBuffer : T extends TgpuLayoutStorage ? (TgpuBuffer<MemIdentity<UnwrapRuntimeConstructor<T['storage']>>> & StorageFlag) | GPUBuffer : T extends TgpuLayoutSampler ? TgpuSampler | GPUSampler : T extends TgpuLayoutComparisonSampler ? TgpuComparisonSampler | GPUSampler : T extends TgpuLayoutTexture ? GPUTextureView | (Sampled & TgpuTexture<Prettify<TextureProps & GetTextureRestriction<T>>>) | TgpuSampledTexture<Default<T['viewDimension'], '2d'>, ChannelFormatToSchema[T['texture']]> : T extends TgpuLayoutStorageTexture ? GPUTextureView | (StorageFlag & TgpuTexture<Prettify<TextureProps & GetStorageTextureRestriction<T>>>) | StorageTextureUsageForEntry<T> : T extends TgpuLayoutExternalTexture ? GPUExternalTexture : never;
|
2495
2558
|
type BindLayoutEntry<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? TgpuBufferUniform<T['uniform']> : T extends TgpuLayoutStorage ? StorageUsageForEntry<T> : T extends TgpuLayoutSampler ? TgpuSampler : T extends TgpuLayoutComparisonSampler ? TgpuComparisonSampler : T extends TgpuLayoutTexture ? TgpuSampledTexture<Default<T['viewDimension'], '2d'>, ChannelFormatToSchema[T['texture']]> : T extends TgpuLayoutStorageTexture ? StorageTextureUsageForEntry<T> : never;
|
2496
2559
|
type InferLayoutEntry<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? Infer<T['uniform']> : T extends TgpuLayoutStorage ? Infer<UnwrapRuntimeConstructor<T['storage']>> : T extends TgpuLayoutSampler ? TgpuSampler : T extends TgpuLayoutComparisonSampler ? TgpuComparisonSampler : T extends TgpuLayoutTexture ? TgpuSampledTexture<Default<T['viewDimension'], '2d'>, ChannelFormatToSchema[T['texture']]> : T extends TgpuLayoutStorageTexture ? StorageTextureUsageForEntry<T> : never;
|
2497
2560
|
type ExtractBindGroupInputFromLayout<T extends Record<string, TgpuLayoutEntry | null>> = {
|
@@ -2998,9 +3061,8 @@ type TranspilationResult = {
|
|
2998
3061
|
type InferArgs<T extends unknown[]> = {
|
2999
3062
|
[Idx in keyof T]: Infer<T[Idx]>;
|
3000
3063
|
};
|
3001
|
-
type
|
3002
|
-
type
|
3003
|
-
type Implementation<Args extends unknown[] | Record<string, unknown> = unknown[] | Record<string, unknown>, Return = unknown> = string | JsImplementation<Args, Return>;
|
3064
|
+
type JsImplementation<Args extends unknown[] | [] = unknown[] | [], Return = unknown> = (...args: InferArgs<Args>) => Infer<Return>;
|
3065
|
+
type Implementation<Args extends unknown[] | [] = unknown[] | [], Return = unknown> = string | JsImplementation<Args, Return>;
|
3004
3066
|
type BaseIOData = F32 | F16 | I32 | U32 | Vec2f | Vec3f | Vec4f | Vec2h | Vec3h | Vec4h | Vec2i | Vec3i | Vec4i | Vec2u | Vec3u | Vec4u;
|
3005
3067
|
type IOData = BaseIOData | Decorated<BaseIOData, AnyAttribute[]> | BuiltinClipDistances;
|
3006
3068
|
type IORecord<TElementType extends IOData = IOData> = Record<string, TElementType>;
|
@@ -3060,4 +3122,4 @@ declare function computeFn<ComputeIn extends IORecord<AnyComputeBuiltin>>(option
|
|
3060
3122
|
workgroupSize: number[];
|
3061
3123
|
}): TgpuComputeFnShell<ComputeIn>;
|
3062
3124
|
|
3063
|
-
export { type TgpuRenderPipeline as $, type AnyWgslData as A, isComparisonSampler as B, isSampler as C, type Disarray as D, isSampledTextureView as E, isStorageTextureView as F, isTexture as G, isUsableAsRender as H, type Infer as I, type JitTranspiler as J, isUsableAsSampled as K, isUsableAsStorage as L, asMutable as M, asReadonly as N, asUniform as O, isUsableAsUniform as P, isTgpuFn as Q, RandomNameRegistry as R, StrictNameRegistry as S, type TgpuRoot as T, type WithBinding as U, type WithCompute as V, type Wgsl as W, type WithFragment as X, type WithVertex as Y, type Storage as Z, type StorageFlag as _, type TgpuFn as a, type Vec4u as a$, type TgpuComputePipeline as a0, type Uniform as a1, type UniformFlag as a2, type Vertex as a3, type VertexFlag as a4, type TgpuBufferMutable as a5, type TgpuBufferReadonly as a6, type TgpuBufferUniform as a7, type Eventual as a8, type TgpuAnyTextureView as a9, type TgpuVertexFnShell as aA, type TgpuFragmentFn as aB, type TgpuFragmentFnShell as aC, type TgpuComputeFn as aD, type TgpuComputeFnShell as aE, type TgpuDeclare as aF, type Bool as aG, type F16 as aH, type F32 as aI, type I32 as aJ, type U32 as aK, type WgslStruct as aL, type Ptr as aM, type Vec2b as aN, type Vec2f as aO, type Vec2h as aP, type Vec2i as aQ, type Vec2u as aR, type Vec3b as aS, type Vec3f as aT, type Vec3h as aU, type Vec3i as aV, type Vec3u as aW, type Vec4b as aX, type Vec4f as aY, type Vec4h as aZ, type Vec4i as a_, type TgpuMutableTexture as aa, type TgpuReadonlyTexture as ab, type TgpuSampledTexture as ac, type TgpuTexture as ad, type TgpuWriteonlyTexture as ae, type TextureProps as af, type Render as ag, type Sampled as ah, type TgpuConst as ai, type TgpuVar as aj, type VariableScope as ak, type TgpuSampler as al, type BindLayoutEntry as am, type ExtractBindGroupInputFromLayout as an, type LayoutEntryToInput as ao, type TgpuBindGroup as ap, type TgpuLayoutComparisonSampler as aq, type TgpuLayoutEntry as ar, type TgpuLayoutExternalTexture as as, type TgpuLayoutSampler as at, type TgpuLayoutStorage as au, type TgpuLayoutStorageTexture as av, type TgpuLayoutTexture as aw, type TgpuLayoutUniform as ax, type TgpuFnShell as ay, type TgpuVertexFn as az, type TgpuBufferUsage as b, type BuiltinLocalInvocationId as b$, type BaseData as b0, type Unstruct as b1, type
|
3125
|
+
export { type TgpuRenderPipeline as $, type AnyWgslData as A, isComparisonSampler as B, isSampler as C, type Disarray as D, isSampledTextureView as E, isStorageTextureView as F, isTexture as G, isUsableAsRender as H, type Infer as I, type JitTranspiler as J, isUsableAsSampled as K, isUsableAsStorage as L, asMutable as M, asReadonly as N, asUniform as O, isUsableAsUniform as P, isTgpuFn as Q, RandomNameRegistry as R, StrictNameRegistry as S, type TgpuRoot as T, type WithBinding as U, type WithCompute as V, type Wgsl as W, type WithFragment as X, type WithVertex as Y, type Storage as Z, type StorageFlag as _, type TgpuFn as a, type Vec4u as a$, type TgpuComputePipeline as a0, type Uniform as a1, type UniformFlag as a2, type Vertex as a3, type VertexFlag as a4, type TgpuBufferMutable as a5, type TgpuBufferReadonly as a6, type TgpuBufferUniform as a7, type Eventual as a8, type TgpuAnyTextureView as a9, type TgpuVertexFnShell as aA, type TgpuFragmentFn as aB, type TgpuFragmentFnShell as aC, type TgpuComputeFn as aD, type TgpuComputeFnShell as aE, type TgpuDeclare as aF, type Bool as aG, type F16 as aH, type F32 as aI, type I32 as aJ, type U32 as aK, type WgslStruct as aL, type Ptr as aM, type Vec2b as aN, type Vec2f as aO, type Vec2h as aP, type Vec2i as aQ, type Vec2u as aR, type Vec3b as aS, type Vec3f as aT, type Vec3h as aU, type Vec3i as aV, type Vec3u as aW, type Vec4b as aX, type Vec4f as aY, type Vec4h as aZ, type Vec4i as a_, type TgpuMutableTexture as aa, type TgpuReadonlyTexture as ab, type TgpuSampledTexture as ac, type TgpuTexture as ad, type TgpuWriteonlyTexture as ae, type TextureProps as af, type Render as ag, type Sampled as ah, type TgpuConst as ai, type TgpuVar as aj, type VariableScope as ak, type TgpuSampler as al, type BindLayoutEntry as am, type ExtractBindGroupInputFromLayout as an, type LayoutEntryToInput as ao, type TgpuBindGroup as ap, type TgpuLayoutComparisonSampler as aq, type TgpuLayoutEntry as ar, type TgpuLayoutExternalTexture as as, type TgpuLayoutSampler as at, type TgpuLayoutStorage as au, type TgpuLayoutStorageTexture as av, type TgpuLayoutTexture as aw, type TgpuLayoutUniform as ax, type TgpuFnShell as ay, type TgpuVertexFn as az, type TgpuBufferUsage as b, type BuiltinLocalInvocationId as b$, type BaseData as b0, type Unstruct as b1, type Atomic as b2, isAlignAttrib as b3, isAtomic as b4, isBuiltinAttrib as b5, isDecorated as b6, isInterpolateAttrib as b7, isLocationAttrib as b8, isPtr as b9, type v3u as bA, type v4b as bB, type v4f as bC, type v4i as bD, type v4u as bE, type AnyLooseData as bF, type LooseDecorated as bG, align as bH, type AnyAttribute as bI, type HasCustomLocation as bJ, interpolate as bK, type IsBuiltin as bL, isBuiltin as bM, location as bN, size as bO, isData as bP, isDisarray as bQ, isLooseData as bR, isLooseDecorated as bS, isUnstruct as bT, builtin as bU, type AnyBuiltin as bV, type BuiltinClipDistances as bW, type BuiltinFragDepth as bX, type BuiltinFrontFacing as bY, type BuiltinGlobalInvocationId as bZ, type BuiltinInstanceIndex as b_, isSizeAttrib as ba, isWgslArray as bb, isWgslData as bc, isWgslStruct as bd, Void as be, type Align as bf, type AnyVecInstance as bg, type AnyWgslStruct as bh, type Builtin as bi, type Decorated as bj, type Interpolate as bk, type Location as bl, type m2x2f as bm, type m3x3f as bn, type m4x4f as bo, type Mat2x2f as bp, type Mat3x3f as bq, type Mat4x4f as br, type Size as bs, type v2b as bt, type v2f as bu, type v2i as bv, type v2u as bw, type v3b as bx, type v3f as by, type v3i as bz, type TgpuAccessor as c, type v4h as c$, type BuiltinLocalInvocationIndex as c0, type BuiltinNumWorkgroups as c1, type BuiltinPosition as c2, type BuiltinSampleIndex as c3, type BuiltinSampleMask as c4, type BuiltinVertexIndex as c5, type BuiltinWorkgroupId as c6, type InferGPU as c7, type InferPartial as c8, type FormatToWGSLType as c9, snorm16x4 as cA, float16 as cB, float16x2 as cC, float16x4 as cD, float32 as cE, float32x2 as cF, float32x3 as cG, float32x4 as cH, uint32 as cI, uint32x2 as cJ, uint32x3 as cK, uint32x4 as cL, sint32 as cM, sint32x2 as cN, sint32x3 as cO, sint32x4 as cP, unorm10_10_10_2 as cQ, unorm8x4_bgra as cR, type PackedData as cS, type TgpuDualFn as cT, type AnyNumericVecInstance as cU, type AnyMatInstance as cV, type vBaseForMat as cW, type mBaseForVec as cX, type AnyFloatVecInstance as cY, type v3h as cZ, type v2h as c_, type TgpuVertexFormatData as ca, formatToWGSLType as cb, packedFormats as cc, uint8 as cd, uint8x2 as ce, uint8x4 as cf, sint8 as cg, sint8x2 as ch, sint8x4 as ci, unorm8 as cj, unorm8x2 as ck, unorm8x4 as cl, snorm8 as cm, snorm8x2 as cn, snorm8x4 as co, uint16 as cp, uint16x2 as cq, uint16x4 as cr, sint16 as cs, sint16x2 as ct, sint16x4 as cu, unorm16 as cv, unorm16x2 as cw, unorm16x4 as cx, snorm16 as cy, snorm16x2 as cz, type TgpuDerived as d, type AnyVec2Instance as d0, type AnyVec3Instance as d1, type AnyBooleanVecInstance as d2, type atomicI32 as d3, type atomicU32 as d4, type TgpuStorageTexture as d5, type TexelData as d6, type ChannelData as d7, type TgpuSlot as e, type TgpuBindGroupLayout as f, type TgpuVertexLayout as g, type WgslArray as h, type TgpuBuffer as i, type AnyData as j, bindGroupLayout as k, fn as l, fragmentFn as m, vertexFn as n, computeFn as o, privateVar as p, constant as q, declare as r, sampler as s, comparisonSampler as t, isBuffer as u, vertexLayout as v, workgroupVar as w, isUsableAsVertex as x, isDerived as y, isSlot as z };
|
@@ -959,6 +959,7 @@ interface Mat2x2f {
|
|
959
959
|
(...elements: [number, number, number, number]): m2x2f;
|
960
960
|
(...columns: [v2f, v2f]): m2x2f;
|
961
961
|
(): m2x2f;
|
962
|
+
identity(): m2x2f;
|
962
963
|
}
|
963
964
|
/**
|
964
965
|
* Type of the `d.mat3x3f` object/function: matrix data type schema/constructor
|
@@ -970,6 +971,7 @@ interface Mat3x3f {
|
|
970
971
|
(...elements: [number, number, number, number, number, number, number, number, number]): m3x3f;
|
971
972
|
(...columns: [v3f, v3f, v3f]): m3x3f;
|
972
973
|
(): m3x3f;
|
974
|
+
identity(): m3x3f;
|
973
975
|
}
|
974
976
|
/**
|
975
977
|
* Type of the `d.mat4x4f` object/function: matrix data type schema/constructor
|
@@ -981,6 +983,12 @@ interface Mat4x4f {
|
|
981
983
|
(...elements: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number]): m4x4f;
|
982
984
|
(...columns: [v4f, v4f, v4f, v4f]): m4x4f;
|
983
985
|
(): m4x4f;
|
986
|
+
identity(): m4x4f;
|
987
|
+
translation(vec: v3f): m4x4f;
|
988
|
+
scaling(vec: v3f): m4x4f;
|
989
|
+
rotationX(angle: number): m4x4f;
|
990
|
+
rotationY(angle: number): m4x4f;
|
991
|
+
rotationZ(angle: number): m4x4f;
|
984
992
|
}
|
985
993
|
/**
|
986
994
|
* Array schema constructed via `d.arrayOf` function.
|
@@ -1238,6 +1246,22 @@ interface StorageFlag {
|
|
1238
1246
|
type Storage = StorageFlag;
|
1239
1247
|
declare function isUsableAsStorage<T>(value: T): value is T & StorageFlag;
|
1240
1248
|
|
1249
|
+
interface TgpuQuerySet<T extends GPUQueryType> extends TgpuNamable {
|
1250
|
+
readonly resourceType: 'query-set';
|
1251
|
+
readonly type: T;
|
1252
|
+
readonly count: number;
|
1253
|
+
readonly querySet: GPUQuerySet;
|
1254
|
+
readonly destroyed: boolean;
|
1255
|
+
readonly available: boolean;
|
1256
|
+
readonly [$internal]: {
|
1257
|
+
readonly readBuffer: GPUBuffer;
|
1258
|
+
readonly resolveBuffer: GPUBuffer;
|
1259
|
+
};
|
1260
|
+
resolve(): void;
|
1261
|
+
read(): Promise<bigint[]>;
|
1262
|
+
destroy(): void;
|
1263
|
+
}
|
1264
|
+
|
1241
1265
|
/**
|
1242
1266
|
* Used to transpile JS resources into tinyest on demand.
|
1243
1267
|
*/
|
@@ -1280,11 +1304,11 @@ type TgpuFnShellHeader<Args extends AnyData[], Return extends AnyData> = {
|
|
1280
1304
|
* Allows creating tgpu functions by calling this shell
|
1281
1305
|
* and passing the implementation (as WGSL string or JS function) as the argument.
|
1282
1306
|
*/
|
1283
|
-
type TgpuFnShell<Args extends AnyData[], Return extends AnyData> = TgpuFnShellHeader<Args, Return> & ((implementation: (...args: InferArgs<Args>) =>
|
1307
|
+
type TgpuFnShell<Args extends AnyData[], Return extends AnyData> = TgpuFnShellHeader<Args, Return> & ((implementation: (...args: InferArgs<Args>) => Infer<Return>) => TgpuFn<Args, Return>) & ((implementation: string) => TgpuFn<Args, Return>) & ((strings: TemplateStringsArray, ...values: unknown[]) => TgpuFn<Args, Return>) & {
|
1284
1308
|
/**
|
1285
1309
|
* @deprecated Invoke the shell as a function instead.
|
1286
1310
|
*/
|
1287
|
-
does: ((implementation: (...args: InferArgs<Args>) =>
|
1311
|
+
does: ((implementation: (...args: InferArgs<Args>) => Infer<Return>) => TgpuFn<Args, Return>) & ((implementation: string) => TgpuFn<Args, Return>);
|
1288
1312
|
};
|
1289
1313
|
interface TgpuFnBase<Args extends AnyData[], Return extends AnyData> extends TgpuNamable {
|
1290
1314
|
readonly [$internal]: {
|
@@ -1298,10 +1322,10 @@ interface TgpuFnBase<Args extends AnyData[], Return extends AnyData> extends Tgp
|
|
1298
1322
|
with<T>(slot: TgpuSlot<T>, value: Eventual<T>): TgpuFn<Args, Return>;
|
1299
1323
|
with<T extends AnyData>(accessor: TgpuAccessor<T>, value: TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T>): TgpuFn<Args, Return>;
|
1300
1324
|
}
|
1301
|
-
type TgpuFn<Args extends AnyData[] = AnyData[], Return extends AnyData = AnyData> = TgpuFnBase<Args, Return> & ((...args: InferArgs<Args>) =>
|
1325
|
+
type TgpuFn<Args extends AnyData[] = AnyData[], Return extends AnyData = AnyData> = TgpuFnBase<Args, Return> & ((...args: InferArgs<Args>) => Infer<Return>);
|
1302
1326
|
declare function fn<Args extends AnyData[] | []>(argTypes: Args, returnType?: undefined): TgpuFnShell<Args, Void>;
|
1303
1327
|
declare function fn<Args extends AnyData[] | [], Return extends AnyData>(argTypes: Args, returnType: Return): TgpuFnShell<Args, Return>;
|
1304
|
-
declare function isTgpuFn<Args extends AnyData[], Return extends AnyData>(value: unknown | TgpuFn<Args, Return>): value is TgpuFn<Args, Return>;
|
1328
|
+
declare function isTgpuFn<Args extends AnyData[] | [], Return extends AnyData>(value: unknown | TgpuFn<Args, Return>): value is TgpuFn<Args, Return>;
|
1305
1329
|
|
1306
1330
|
interface TgpuSlot<T> extends TgpuNamable {
|
1307
1331
|
readonly resourceType: 'slot';
|
@@ -1348,16 +1372,6 @@ type Providing = {
|
|
1348
1372
|
declare function isSlot<T>(value: unknown | TgpuSlot<T>): value is TgpuSlot<T>;
|
1349
1373
|
declare function isDerived<T extends TgpuDerived<unknown>>(value: T | unknown): value is T;
|
1350
1374
|
|
1351
|
-
interface ComputePipelineInternals {
|
1352
|
-
readonly rawPipeline: GPUComputePipeline;
|
1353
|
-
}
|
1354
|
-
interface TgpuComputePipeline extends TgpuNamable {
|
1355
|
-
readonly [$internal]: ComputePipelineInternals;
|
1356
|
-
readonly resourceType: 'compute-pipeline';
|
1357
|
-
with(bindGroupLayout: TgpuBindGroupLayout, bindGroup: TgpuBindGroup): TgpuComputePipeline;
|
1358
|
-
dispatchWorkgroups(x: number, y?: number | undefined, z?: number | undefined): void;
|
1359
|
-
}
|
1360
|
-
|
1361
1375
|
declare const vertexFormats: readonly ["uint8", "uint8x2", "uint8x4", "sint8", "sint8x2", "sint8x4", "unorm8", "unorm8x2", "unorm8x4", "snorm8", "snorm8x2", "snorm8x4", "uint16", "uint16x2", "uint16x4", "sint16", "sint16x2", "sint16x4", "unorm16", "unorm16x2", "unorm16x4", "snorm16", "snorm16x2", "snorm16x4", "float16", "float16x2", "float16x4", "float32", "float32x2", "float32x3", "float32x4", "uint32", "uint32x2", "uint32x3", "uint32x4", "sint32", "sint32x2", "sint32x3", "sint32x4", "unorm10-10-10-2", "unorm8x4-bgra"];
|
1362
1376
|
type VertexFormat = (typeof vertexFormats)[number];
|
1363
1377
|
declare const kindToDefaultFormatMap: {
|
@@ -1487,7 +1501,7 @@ type VertexOutConstrained = IORecord<BaseIOData | Decorated<BaseIOData, (Locatio
|
|
1487
1501
|
*/
|
1488
1502
|
type TgpuVertexFnShellHeader<VertexIn extends VertexInConstrained, VertexOut extends VertexOutConstrained> = {
|
1489
1503
|
readonly argTypes: [IOLayoutToSchema<VertexIn>] | [];
|
1490
|
-
readonly returnType: IOLayoutToSchema<VertexOut
|
1504
|
+
readonly returnType: IOLayoutToSchema<VertexOut>;
|
1491
1505
|
readonly attributes: [VertexIn];
|
1492
1506
|
readonly isEntry: true;
|
1493
1507
|
};
|
@@ -1505,7 +1519,7 @@ type TgpuVertexFnShell<VertexIn extends VertexInConstrained, VertexOut extends V
|
|
1505
1519
|
interface TgpuVertexFn<VertexIn extends VertexInConstrained = any, VertexOut extends VertexOutConstrained = any> extends TgpuNamable {
|
1506
1520
|
readonly shell: TgpuVertexFnShellHeader<VertexIn, VertexOut>;
|
1507
1521
|
readonly outputType: IOLayoutToSchema<VertexOut>;
|
1508
|
-
readonly inputType: IOLayoutToSchema<VertexIn
|
1522
|
+
readonly inputType: IOLayoutToSchema<VertexIn> | undefined;
|
1509
1523
|
$uses(dependencyMap: Record<string, unknown>): this;
|
1510
1524
|
}
|
1511
1525
|
declare function vertexFn<VertexOut extends VertexOutConstrained>(options: {
|
@@ -1824,15 +1838,15 @@ declare function vertexLayout<TData extends WgslArray | Disarray>(schemaForCount
|
|
1824
1838
|
|
1825
1839
|
interface RenderPipelineInternals {
|
1826
1840
|
readonly core: RenderPipelineCore;
|
1827
|
-
readonly priors: TgpuRenderPipelinePriors;
|
1841
|
+
readonly priors: TgpuRenderPipelinePriors & TimestampWritesPriors;
|
1828
1842
|
}
|
1829
|
-
interface TgpuRenderPipeline<Output extends IOLayout = IOLayout> extends TgpuNamable {
|
1843
|
+
interface TgpuRenderPipeline<Output extends IOLayout = IOLayout> extends TgpuNamable, Timeable<TgpuRenderPipeline> {
|
1830
1844
|
readonly [$internal]: RenderPipelineInternals;
|
1831
1845
|
readonly resourceType: 'render-pipeline';
|
1832
|
-
with<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: TgpuBuffer<TData> & VertexFlag): TgpuRenderPipeline
|
1833
|
-
with<Entries extends Record<string, TgpuLayoutEntry | null>>(bindGroupLayout: TgpuBindGroupLayout<Entries>, bindGroup: TgpuBindGroup<Entries>): TgpuRenderPipeline
|
1834
|
-
withColorAttachment(attachment: FragmentOutToColorAttachment<Output>): TgpuRenderPipeline
|
1835
|
-
withDepthStencilAttachment(attachment: DepthStencilAttachment): TgpuRenderPipeline
|
1846
|
+
with<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: TgpuBuffer<TData> & VertexFlag): TgpuRenderPipeline;
|
1847
|
+
with<Entries extends Record<string, TgpuLayoutEntry | null>>(bindGroupLayout: TgpuBindGroupLayout<Entries>, bindGroup: TgpuBindGroup<Entries>): TgpuRenderPipeline;
|
1848
|
+
withColorAttachment(attachment: FragmentOutToColorAttachment<Output>): TgpuRenderPipeline;
|
1849
|
+
withDepthStencilAttachment(attachment: DepthStencilAttachment): TgpuRenderPipeline;
|
1836
1850
|
draw(vertexCount: number, instanceCount?: number, firstVertex?: number, firstInstance?: number): void;
|
1837
1851
|
}
|
1838
1852
|
type FragmentOutToTargets<T extends IOLayout> = T extends IOData ? GPUColorTargetState : T extends Record<string, unknown> ? {
|
@@ -1952,7 +1966,7 @@ type TgpuRenderPipelinePriors = {
|
|
1952
1966
|
readonly bindGroupLayoutMap?: Map<TgpuBindGroupLayout, TgpuBindGroup> | undefined;
|
1953
1967
|
readonly colorAttachment?: AnyFragmentColorAttachment | undefined;
|
1954
1968
|
readonly depthStencilAttachment?: DepthStencilAttachment | undefined;
|
1955
|
-
};
|
1969
|
+
} & TimestampWritesPriors;
|
1956
1970
|
type Memo = {
|
1957
1971
|
pipeline: GPURenderPipeline;
|
1958
1972
|
bindGroupLayouts: TgpuBindGroupLayout[];
|
@@ -1968,6 +1982,38 @@ declare class RenderPipelineCore {
|
|
1968
1982
|
unwrap(): Memo;
|
1969
1983
|
}
|
1970
1984
|
|
1985
|
+
interface Timeable<T extends TgpuComputePipeline | TgpuRenderPipeline> {
|
1986
|
+
withPerformanceCallback(callback: (start: bigint, end: bigint) => void | Promise<void>): T;
|
1987
|
+
withTimestampWrites(options: {
|
1988
|
+
querySet: TgpuQuerySet<'timestamp'> | GPUQuerySet;
|
1989
|
+
beginningOfPassWriteIndex?: number;
|
1990
|
+
endOfPassWriteIndex?: number;
|
1991
|
+
}): T;
|
1992
|
+
}
|
1993
|
+
type TimestampWritesPriors = {
|
1994
|
+
readonly timestampWrites?: {
|
1995
|
+
querySet: TgpuQuerySet<'timestamp'> | GPUQuerySet;
|
1996
|
+
beginningOfPassWriteIndex?: number;
|
1997
|
+
endOfPassWriteIndex?: number;
|
1998
|
+
};
|
1999
|
+
readonly performanceCallback?: (start: bigint, end: bigint) => void | Promise<void>;
|
2000
|
+
readonly hasAutoQuerySet?: boolean;
|
2001
|
+
};
|
2002
|
+
|
2003
|
+
interface ComputePipelineInternals {
|
2004
|
+
readonly rawPipeline: GPUComputePipeline;
|
2005
|
+
readonly priors: TgpuComputePipelinePriors & TimestampWritesPriors;
|
2006
|
+
}
|
2007
|
+
interface TgpuComputePipeline extends TgpuNamable, Timeable<TgpuComputePipeline> {
|
2008
|
+
readonly [$internal]: ComputePipelineInternals;
|
2009
|
+
readonly resourceType: 'compute-pipeline';
|
2010
|
+
with(bindGroupLayout: TgpuBindGroupLayout, bindGroup: TgpuBindGroup): TgpuComputePipeline;
|
2011
|
+
dispatchWorkgroups(x: number, y?: number | undefined, z?: number | undefined): void;
|
2012
|
+
}
|
2013
|
+
type TgpuComputePipelinePriors = {
|
2014
|
+
readonly bindGroupLayoutMap?: Map<TgpuBindGroupLayout, TgpuBindGroup>;
|
2015
|
+
} & TimestampWritesPriors;
|
2016
|
+
|
1971
2017
|
interface SamplerInternals {
|
1972
2018
|
readonly unwrap?: ((branch: Unwrapper) => GPUSampler) | undefined;
|
1973
2019
|
}
|
@@ -2079,6 +2125,7 @@ interface Unwrapper {
|
|
2079
2125
|
unwrap(resource: TgpuVertexLayout): GPUVertexBufferLayout;
|
2080
2126
|
unwrap(resource: TgpuSampler): GPUSampler;
|
2081
2127
|
unwrap(resource: TgpuComparisonSampler): GPUSampler;
|
2128
|
+
unwrap(resource: TgpuQuerySet<GPUQueryType>): GPUQuerySet;
|
2082
2129
|
}
|
2083
2130
|
|
2084
2131
|
interface WithCompute {
|
@@ -2277,6 +2324,17 @@ interface TgpuRoot extends Unwrapper {
|
|
2277
2324
|
* @param gpuBuffer A vanilla WebGPU buffer.
|
2278
2325
|
*/
|
2279
2326
|
createBuffer<TData extends AnyData>(typeSchema: TData, gpuBuffer: GPUBuffer): TgpuBuffer<TData>;
|
2327
|
+
/**
|
2328
|
+
* Creates a query set for collecting timestamps or occlusion queries.
|
2329
|
+
*
|
2330
|
+
* @remarks
|
2331
|
+
* Typed wrapper around a GPUQuerySet.
|
2332
|
+
*
|
2333
|
+
* @param type The type of queries to collect ('occlusion' or 'timestamp').
|
2334
|
+
* @param count The number of queries in the set.
|
2335
|
+
* @param rawQuerySet An optional pre-existing GPUQuerySet to use instead of creating a new one.
|
2336
|
+
*/
|
2337
|
+
createQuerySet<T extends GPUQueryType>(type: T, count: number, rawQuerySet?: GPUQuerySet | undefined): TgpuQuerySet<T>;
|
2280
2338
|
/**
|
2281
2339
|
* Creates a group of resources that can be bound to a shader based on a specified layout.
|
2282
2340
|
*
|
@@ -2304,6 +2362,11 @@ interface TgpuRoot extends Unwrapper {
|
|
2304
2362
|
createBindGroup<Entries extends Record<string, TgpuLayoutEntry | null> = Record<string, TgpuLayoutEntry | null>>(layout: TgpuBindGroupLayout<Entries>, entries: {
|
2305
2363
|
[K in keyof OmitProps<Entries, null>]: LayoutEntryToInput<Entries[K]>;
|
2306
2364
|
}): TgpuBindGroup<Entries>;
|
2365
|
+
/**
|
2366
|
+
* Retrieves a read-only list of all enabled features of the GPU device.
|
2367
|
+
* @returns A set of strings representing the enabled features.
|
2368
|
+
*/
|
2369
|
+
get enabledFeatures(): ReadonlySet<GPUFeatureName>;
|
2307
2370
|
/**
|
2308
2371
|
* Destroys all underlying resources (i.e. buffers...) created through this root object.
|
2309
2372
|
* If the object is created via `tgpu.init` instead of `tgpu.initFromDevice`,
|
@@ -2491,7 +2554,7 @@ type GetStorageTextureRestriction<T extends TgpuLayoutStorageTexture> = Default<
|
|
2491
2554
|
format: T['storageTexture'];
|
2492
2555
|
dimension: Dimension;
|
2493
2556
|
} : never;
|
2494
|
-
type LayoutEntryToInput<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? (TgpuBuffer<UnwrapRuntimeConstructor<T['uniform']
|
2557
|
+
type LayoutEntryToInput<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? (TgpuBuffer<MemIdentity<UnwrapRuntimeConstructor<T['uniform']>>> & UniformFlag) | GPUBuffer : T extends TgpuLayoutStorage ? (TgpuBuffer<MemIdentity<UnwrapRuntimeConstructor<T['storage']>>> & StorageFlag) | GPUBuffer : T extends TgpuLayoutSampler ? TgpuSampler | GPUSampler : T extends TgpuLayoutComparisonSampler ? TgpuComparisonSampler | GPUSampler : T extends TgpuLayoutTexture ? GPUTextureView | (Sampled & TgpuTexture<Prettify<TextureProps & GetTextureRestriction<T>>>) | TgpuSampledTexture<Default<T['viewDimension'], '2d'>, ChannelFormatToSchema[T['texture']]> : T extends TgpuLayoutStorageTexture ? GPUTextureView | (StorageFlag & TgpuTexture<Prettify<TextureProps & GetStorageTextureRestriction<T>>>) | StorageTextureUsageForEntry<T> : T extends TgpuLayoutExternalTexture ? GPUExternalTexture : never;
|
2495
2558
|
type BindLayoutEntry<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? TgpuBufferUniform<T['uniform']> : T extends TgpuLayoutStorage ? StorageUsageForEntry<T> : T extends TgpuLayoutSampler ? TgpuSampler : T extends TgpuLayoutComparisonSampler ? TgpuComparisonSampler : T extends TgpuLayoutTexture ? TgpuSampledTexture<Default<T['viewDimension'], '2d'>, ChannelFormatToSchema[T['texture']]> : T extends TgpuLayoutStorageTexture ? StorageTextureUsageForEntry<T> : never;
|
2496
2559
|
type InferLayoutEntry<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? Infer<T['uniform']> : T extends TgpuLayoutStorage ? Infer<UnwrapRuntimeConstructor<T['storage']>> : T extends TgpuLayoutSampler ? TgpuSampler : T extends TgpuLayoutComparisonSampler ? TgpuComparisonSampler : T extends TgpuLayoutTexture ? TgpuSampledTexture<Default<T['viewDimension'], '2d'>, ChannelFormatToSchema[T['texture']]> : T extends TgpuLayoutStorageTexture ? StorageTextureUsageForEntry<T> : never;
|
2497
2560
|
type ExtractBindGroupInputFromLayout<T extends Record<string, TgpuLayoutEntry | null>> = {
|
@@ -2998,9 +3061,8 @@ type TranspilationResult = {
|
|
2998
3061
|
type InferArgs<T extends unknown[]> = {
|
2999
3062
|
[Idx in keyof T]: Infer<T[Idx]>;
|
3000
3063
|
};
|
3001
|
-
type
|
3002
|
-
type
|
3003
|
-
type Implementation<Args extends unknown[] | Record<string, unknown> = unknown[] | Record<string, unknown>, Return = unknown> = string | JsImplementation<Args, Return>;
|
3064
|
+
type JsImplementation<Args extends unknown[] | [] = unknown[] | [], Return = unknown> = (...args: InferArgs<Args>) => Infer<Return>;
|
3065
|
+
type Implementation<Args extends unknown[] | [] = unknown[] | [], Return = unknown> = string | JsImplementation<Args, Return>;
|
3004
3066
|
type BaseIOData = F32 | F16 | I32 | U32 | Vec2f | Vec3f | Vec4f | Vec2h | Vec3h | Vec4h | Vec2i | Vec3i | Vec4i | Vec2u | Vec3u | Vec4u;
|
3005
3067
|
type IOData = BaseIOData | Decorated<BaseIOData, AnyAttribute[]> | BuiltinClipDistances;
|
3006
3068
|
type IORecord<TElementType extends IOData = IOData> = Record<string, TElementType>;
|
@@ -3060,4 +3122,4 @@ declare function computeFn<ComputeIn extends IORecord<AnyComputeBuiltin>>(option
|
|
3060
3122
|
workgroupSize: number[];
|
3061
3123
|
}): TgpuComputeFnShell<ComputeIn>;
|
3062
3124
|
|
3063
|
-
export { type TgpuRenderPipeline as $, type AnyWgslData as A, isComparisonSampler as B, isSampler as C, type Disarray as D, isSampledTextureView as E, isStorageTextureView as F, isTexture as G, isUsableAsRender as H, type Infer as I, type JitTranspiler as J, isUsableAsSampled as K, isUsableAsStorage as L, asMutable as M, asReadonly as N, asUniform as O, isUsableAsUniform as P, isTgpuFn as Q, RandomNameRegistry as R, StrictNameRegistry as S, type TgpuRoot as T, type WithBinding as U, type WithCompute as V, type Wgsl as W, type WithFragment as X, type WithVertex as Y, type Storage as Z, type StorageFlag as _, type TgpuFn as a, type Vec4u as a$, type TgpuComputePipeline as a0, type Uniform as a1, type UniformFlag as a2, type Vertex as a3, type VertexFlag as a4, type TgpuBufferMutable as a5, type TgpuBufferReadonly as a6, type TgpuBufferUniform as a7, type Eventual as a8, type TgpuAnyTextureView as a9, type TgpuVertexFnShell as aA, type TgpuFragmentFn as aB, type TgpuFragmentFnShell as aC, type TgpuComputeFn as aD, type TgpuComputeFnShell as aE, type TgpuDeclare as aF, type Bool as aG, type F16 as aH, type F32 as aI, type I32 as aJ, type U32 as aK, type WgslStruct as aL, type Ptr as aM, type Vec2b as aN, type Vec2f as aO, type Vec2h as aP, type Vec2i as aQ, type Vec2u as aR, type Vec3b as aS, type Vec3f as aT, type Vec3h as aU, type Vec3i as aV, type Vec3u as aW, type Vec4b as aX, type Vec4f as aY, type Vec4h as aZ, type Vec4i as a_, type TgpuMutableTexture as aa, type TgpuReadonlyTexture as ab, type TgpuSampledTexture as ac, type TgpuTexture as ad, type TgpuWriteonlyTexture as ae, type TextureProps as af, type Render as ag, type Sampled as ah, type TgpuConst as ai, type TgpuVar as aj, type VariableScope as ak, type TgpuSampler as al, type BindLayoutEntry as am, type ExtractBindGroupInputFromLayout as an, type LayoutEntryToInput as ao, type TgpuBindGroup as ap, type TgpuLayoutComparisonSampler as aq, type TgpuLayoutEntry as ar, type TgpuLayoutExternalTexture as as, type TgpuLayoutSampler as at, type TgpuLayoutStorage as au, type TgpuLayoutStorageTexture as av, type TgpuLayoutTexture as aw, type TgpuLayoutUniform as ax, type TgpuFnShell as ay, type TgpuVertexFn as az, type TgpuBufferUsage as b, type BuiltinLocalInvocationId as b$, type BaseData as b0, type Unstruct as b1, type
|
3125
|
+
export { type TgpuRenderPipeline as $, type AnyWgslData as A, isComparisonSampler as B, isSampler as C, type Disarray as D, isSampledTextureView as E, isStorageTextureView as F, isTexture as G, isUsableAsRender as H, type Infer as I, type JitTranspiler as J, isUsableAsSampled as K, isUsableAsStorage as L, asMutable as M, asReadonly as N, asUniform as O, isUsableAsUniform as P, isTgpuFn as Q, RandomNameRegistry as R, StrictNameRegistry as S, type TgpuRoot as T, type WithBinding as U, type WithCompute as V, type Wgsl as W, type WithFragment as X, type WithVertex as Y, type Storage as Z, type StorageFlag as _, type TgpuFn as a, type Vec4u as a$, type TgpuComputePipeline as a0, type Uniform as a1, type UniformFlag as a2, type Vertex as a3, type VertexFlag as a4, type TgpuBufferMutable as a5, type TgpuBufferReadonly as a6, type TgpuBufferUniform as a7, type Eventual as a8, type TgpuAnyTextureView as a9, type TgpuVertexFnShell as aA, type TgpuFragmentFn as aB, type TgpuFragmentFnShell as aC, type TgpuComputeFn as aD, type TgpuComputeFnShell as aE, type TgpuDeclare as aF, type Bool as aG, type F16 as aH, type F32 as aI, type I32 as aJ, type U32 as aK, type WgslStruct as aL, type Ptr as aM, type Vec2b as aN, type Vec2f as aO, type Vec2h as aP, type Vec2i as aQ, type Vec2u as aR, type Vec3b as aS, type Vec3f as aT, type Vec3h as aU, type Vec3i as aV, type Vec3u as aW, type Vec4b as aX, type Vec4f as aY, type Vec4h as aZ, type Vec4i as a_, type TgpuMutableTexture as aa, type TgpuReadonlyTexture as ab, type TgpuSampledTexture as ac, type TgpuTexture as ad, type TgpuWriteonlyTexture as ae, type TextureProps as af, type Render as ag, type Sampled as ah, type TgpuConst as ai, type TgpuVar as aj, type VariableScope as ak, type TgpuSampler as al, type BindLayoutEntry as am, type ExtractBindGroupInputFromLayout as an, type LayoutEntryToInput as ao, type TgpuBindGroup as ap, type TgpuLayoutComparisonSampler as aq, type TgpuLayoutEntry as ar, type TgpuLayoutExternalTexture as as, type TgpuLayoutSampler as at, type TgpuLayoutStorage as au, type TgpuLayoutStorageTexture as av, type TgpuLayoutTexture as aw, type TgpuLayoutUniform as ax, type TgpuFnShell as ay, type TgpuVertexFn as az, type TgpuBufferUsage as b, type BuiltinLocalInvocationId as b$, type BaseData as b0, type Unstruct as b1, type Atomic as b2, isAlignAttrib as b3, isAtomic as b4, isBuiltinAttrib as b5, isDecorated as b6, isInterpolateAttrib as b7, isLocationAttrib as b8, isPtr as b9, type v3u as bA, type v4b as bB, type v4f as bC, type v4i as bD, type v4u as bE, type AnyLooseData as bF, type LooseDecorated as bG, align as bH, type AnyAttribute as bI, type HasCustomLocation as bJ, interpolate as bK, type IsBuiltin as bL, isBuiltin as bM, location as bN, size as bO, isData as bP, isDisarray as bQ, isLooseData as bR, isLooseDecorated as bS, isUnstruct as bT, builtin as bU, type AnyBuiltin as bV, type BuiltinClipDistances as bW, type BuiltinFragDepth as bX, type BuiltinFrontFacing as bY, type BuiltinGlobalInvocationId as bZ, type BuiltinInstanceIndex as b_, isSizeAttrib as ba, isWgslArray as bb, isWgslData as bc, isWgslStruct as bd, Void as be, type Align as bf, type AnyVecInstance as bg, type AnyWgslStruct as bh, type Builtin as bi, type Decorated as bj, type Interpolate as bk, type Location as bl, type m2x2f as bm, type m3x3f as bn, type m4x4f as bo, type Mat2x2f as bp, type Mat3x3f as bq, type Mat4x4f as br, type Size as bs, type v2b as bt, type v2f as bu, type v2i as bv, type v2u as bw, type v3b as bx, type v3f as by, type v3i as bz, type TgpuAccessor as c, type v4h as c$, type BuiltinLocalInvocationIndex as c0, type BuiltinNumWorkgroups as c1, type BuiltinPosition as c2, type BuiltinSampleIndex as c3, type BuiltinSampleMask as c4, type BuiltinVertexIndex as c5, type BuiltinWorkgroupId as c6, type InferGPU as c7, type InferPartial as c8, type FormatToWGSLType as c9, snorm16x4 as cA, float16 as cB, float16x2 as cC, float16x4 as cD, float32 as cE, float32x2 as cF, float32x3 as cG, float32x4 as cH, uint32 as cI, uint32x2 as cJ, uint32x3 as cK, uint32x4 as cL, sint32 as cM, sint32x2 as cN, sint32x3 as cO, sint32x4 as cP, unorm10_10_10_2 as cQ, unorm8x4_bgra as cR, type PackedData as cS, type TgpuDualFn as cT, type AnyNumericVecInstance as cU, type AnyMatInstance as cV, type vBaseForMat as cW, type mBaseForVec as cX, type AnyFloatVecInstance as cY, type v3h as cZ, type v2h as c_, type TgpuVertexFormatData as ca, formatToWGSLType as cb, packedFormats as cc, uint8 as cd, uint8x2 as ce, uint8x4 as cf, sint8 as cg, sint8x2 as ch, sint8x4 as ci, unorm8 as cj, unorm8x2 as ck, unorm8x4 as cl, snorm8 as cm, snorm8x2 as cn, snorm8x4 as co, uint16 as cp, uint16x2 as cq, uint16x4 as cr, sint16 as cs, sint16x2 as ct, sint16x4 as cu, unorm16 as cv, unorm16x2 as cw, unorm16x4 as cx, snorm16 as cy, snorm16x2 as cz, type TgpuDerived as d, type AnyVec2Instance as d0, type AnyVec3Instance as d1, type AnyBooleanVecInstance as d2, type atomicI32 as d3, type atomicU32 as d4, type TgpuStorageTexture as d5, type TexelData as d6, type ChannelData as d7, type TgpuSlot as e, type TgpuBindGroupLayout as f, type TgpuVertexLayout as g, type WgslArray as h, type TgpuBuffer as i, type AnyData as j, bindGroupLayout as k, fn as l, fragmentFn as m, vertexFn as n, computeFn as o, privateVar as p, constant as q, declare as r, sampler as s, comparisonSampler as t, isBuffer as u, vertexLayout as v, workgroupVar as w, isUsableAsVertex as x, isDerived as y, isSlot as z };
|
package/chunk-7ACLI4JY.cjs.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-7ACLI4JY.cjs","../src/data/struct.ts"],"names":["struct","props","WgslStructImpl","$internal","label","setName","getName"],"mappings":"AAAA,m0BAA4O,SCmB5NA,CAAAA,CACdC,CAAAA,CACoB,CACpB,IAAMD,CAAAA,CAAaC,CAAAA,EAAaA,CAAAA,CAChC,OAAA,MAAA,CAAO,cAAA,CAAeD,CAAAA,CAAQE,CAAc,CAAA,CAC5CF,CAAAA,CAAO,SAAA,CAAYC,CAAAA,CAEZD,CACT,CAMA,IAAME,CAAAA,CAAiB,CACrB,CAACC,mBAAS,CAAA,CAAG,CAAA,CAAA,CACb,IAAA,CAAM,QAAA,CAEN,KAAA,CAAMC,CAAAA,CAAe,CACnB,OAAAC,iCAAAA,IAAQ,CAAMD,CAAK,CAAA,CACZ,IACT,CAAA,CAEA,QAAA,CAAA,CAAmB,CACjB,MAAO,CAAA,OAAA,mBAAUE,iCAAAA,IAAY,CAAA,SAAK,aAAW,CAAA,CAAA","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-7ACLI4JY.cjs","sourcesContent":[null,"import { getName, setName } from '../name.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport type { AnyWgslData, WgslStruct } from './wgslTypes.ts';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Creates a struct schema that can be used to construct GPU buffers.\n * Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).\n * The order of members matches the passed in properties object.\n *\n * @example\n * const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });\n *\n * @param props Record with `string` keys and `TgpuData` values,\n * each entry describing one struct member.\n */\nexport function struct<TProps extends Record<string, AnyWgslData>>(\n props: TProps,\n): WgslStruct<TProps> {\n const struct = <T>(props: T) => props;\n Object.setPrototypeOf(struct, WgslStructImpl);\n struct.propTypes = props;\n\n return struct as WgslStruct<TProps>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst WgslStructImpl = {\n [$internal]: true,\n type: 'struct',\n\n $name(label: string) {\n setName(this, label);\n return this;\n },\n\n toString(): string {\n return `struct:${getName(this) ?? '<unnamed>'}`;\n },\n};\n"]}
|