typegpu 0.4.2 → 0.4.3
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/{attributes-Di0A7-Fw.d.cts → attributes--1y4Kirx.d.cts} +2 -2
- package/{attributes-CkPkK-h9.d.ts → attributes-Dri8dk1v.d.ts} +2 -2
- package/{chunk-DEMK5MOR.cjs → chunk-7X4KDNDZ.cjs} +2 -2
- package/chunk-7X4KDNDZ.cjs.map +1 -0
- package/{chunk-R4S4YVH4.cjs → chunk-O7JKWPDH.cjs} +2 -2
- package/chunk-O7JKWPDH.cjs.map +1 -0
- package/{chunk-IHC2SDHN.js → chunk-OERXDFXG.js} +2 -2
- package/{chunk-C5JKINT2.js → chunk-ZHXAQ2YE.js} +2 -2
- package/{chunk-C5JKINT2.js.map → chunk-ZHXAQ2YE.js.map} +1 -1
- package/data/index.cjs +1 -1
- package/data/index.cjs.map +1 -1
- package/data/index.d.cts +3 -3
- package/data/index.d.ts +3 -3
- package/data/index.js +1 -1
- package/index.cjs +7 -7
- package/index.cjs.map +1 -1
- package/index.d.cts +29 -18
- package/index.d.ts +29 -18
- package/index.js +7 -7
- package/index.js.map +1 -1
- package/package.json +1 -2
- package/std/index.cjs +1 -1
- package/std/index.cjs.map +1 -1
- package/std/index.d.cts +1 -1
- package/std/index.d.ts +1 -1
- package/std/index.js +1 -1
- package/{wgslTypes-D8LnuOPy.d.cts → wgslTypes-D0JqCGnw.d.cts} +1 -1
- package/{wgslTypes-D8LnuOPy.d.ts → wgslTypes-D0JqCGnw.d.ts} +1 -1
- package/chunk-DEMK5MOR.cjs.map +0 -1
- package/chunk-R4S4YVH4.cjs.map +0 -1
- /package/{chunk-IHC2SDHN.js.map → chunk-OERXDFXG.js.map} +0 -0
package/index.d.cts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { A as AnyWgslData, T as TgpuNamable, I as Infer,
|
2
|
-
import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation,
|
1
|
+
import { A as AnyWgslData, T as TgpuNamable, I as Infer, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, D as Decorated, n as AnyWgslStruct, B as BaseData, L as Location, W as WgslStruct, o as Default, p as UnionToIntersection, q as WgslArray, r as Disarray, s as Unstruct, t as VertexFormat, u as TgpuVertexAttrib, K as KindToDefaultFormatMap, v as KindToAcceptedAttribMap, w as AnyData, O as OmitProps, P as Prettify, M as Mutable, x as WgslTypeLiteral, y as InferPartial, z as MemIdentity, C as AnyVecInstance, E as AnyMatInstance } from './wgslTypes-D0JqCGnw.cjs';
|
2
|
+
import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation, b as AnyFragmentInputBuiltin, c as AnyFragmentOutputBuiltin, O as OmitBuiltins } from './attributes--1y4Kirx.cjs';
|
3
3
|
import * as smol from 'tinyest';
|
4
4
|
import { Block } from 'tinyest';
|
5
5
|
|
@@ -88,11 +88,14 @@ declare function computeFn<ComputeIn extends Record<string, AnyComputeBuiltin>>(
|
|
88
88
|
workgroupSize: number[];
|
89
89
|
}): TgpuComputeFnShell<ComputeIn>;
|
90
90
|
|
91
|
-
interface
|
91
|
+
interface StorageFlag {
|
92
92
|
usableAsStorage: true;
|
93
93
|
}
|
94
|
-
|
95
|
-
|
94
|
+
/**
|
95
|
+
* @deprecated Use StorageFlag instead.
|
96
|
+
*/
|
97
|
+
type Storage = StorageFlag;
|
98
|
+
declare function isUsableAsStorage<T>(value: T): value is T & StorageFlag;
|
96
99
|
|
97
100
|
/**
|
98
101
|
* Used to transpile JS resources into SMoL on demand.
|
@@ -423,7 +426,7 @@ interface Render {
|
|
423
426
|
usableAsRender: true;
|
424
427
|
}
|
425
428
|
type LiteralToExtensionMap = {
|
426
|
-
storage:
|
429
|
+
storage: StorageFlag;
|
427
430
|
sampled: Sampled;
|
428
431
|
render: Render;
|
429
432
|
};
|
@@ -544,7 +547,7 @@ declare function vertexLayout<TData extends WgslArray | Disarray>(schemaForCount
|
|
544
547
|
interface TgpuRenderPipeline<Output extends IOLayout = IOLayout> extends TgpuNamable {
|
545
548
|
readonly resourceType: 'render-pipeline';
|
546
549
|
readonly label: string | undefined;
|
547
|
-
with<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: TgpuBuffer<TData> &
|
550
|
+
with<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: TgpuBuffer<TData> & VertexFlag): TgpuRenderPipeline<IOLayout>;
|
548
551
|
with<Entries extends Record<string, TgpuLayoutEntry | null>>(bindGroupLayout: TgpuBindGroupLayout<Entries>, bindGroup: TgpuBindGroup<Entries>): TgpuRenderPipeline<IOLayout>;
|
549
552
|
withColorAttachment(attachment: FragmentOutToColorAttachment<Output>): TgpuRenderPipeline<IOLayout>;
|
550
553
|
withDepthStencilAttachment(attachment: DepthStencilAttachment): TgpuRenderPipeline<IOLayout>;
|
@@ -794,7 +797,7 @@ interface RenderPass {
|
|
794
797
|
* Defaults to the size of the buffer minus the offset.
|
795
798
|
*/
|
796
799
|
setIndexBuffer<TData extends WgslArray | Disarray>(buffer: TgpuBuffer<TData> | GPUBuffer, indexFormat: GPUIndexFormat, offset?: GPUSize64, size?: GPUSize64): void;
|
797
|
-
setVertexBuffer<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: (TgpuBuffer<TData> &
|
800
|
+
setVertexBuffer<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: (TgpuBuffer<TData> & VertexFlag) | GPUBuffer, offset?: GPUSize64, size?: GPUSize64): void;
|
798
801
|
setBindGroup<Entries extends Record<string, TgpuLayoutEntry | null>>(bindGroupLayout: TgpuBindGroupLayout<Entries>, bindGroup: TgpuBindGroup<Entries> | GPUBindGroup): void;
|
799
802
|
/**
|
800
803
|
* Draws primitives.
|
@@ -910,13 +913,21 @@ interface ExperimentalTgpuRoot extends TgpuRoot, WithBinding {
|
|
910
913
|
flush(): void;
|
911
914
|
}
|
912
915
|
|
913
|
-
interface
|
916
|
+
interface UniformFlag {
|
914
917
|
usableAsUniform: true;
|
915
918
|
}
|
916
|
-
|
919
|
+
/**
|
920
|
+
* @deprecated Use UniformFlag instead.
|
921
|
+
*/
|
922
|
+
type Uniform = UniformFlag;
|
923
|
+
interface VertexFlag {
|
917
924
|
usableAsVertex: true;
|
918
925
|
}
|
919
|
-
|
926
|
+
/**
|
927
|
+
* @deprecated Use VertexFlag instead.
|
928
|
+
*/
|
929
|
+
type Vertex = VertexFlag;
|
930
|
+
type LiteralToUsageType<T extends 'uniform' | 'storage' | 'vertex'> = T extends 'uniform' ? UniformFlag : T extends 'storage' ? StorageFlag : T extends 'vertex' ? VertexFlag : never;
|
920
931
|
type ViewUsages<TBuffer extends TgpuBuffer<BaseData>> = (boolean extends TBuffer['usableAsUniform'] ? never : 'uniform') | (boolean extends TBuffer['usableAsStorage'] ? never : 'readonly' | 'mutable');
|
921
932
|
type UsageTypeToBufferUsage<TData extends BaseData> = {
|
922
933
|
uniform: TgpuBufferUniform<TData> & TgpuFixedBufferUsage<TData>;
|
@@ -943,7 +954,7 @@ interface TgpuBuffer<TData extends BaseData> extends TgpuNamable {
|
|
943
954
|
destroy(): void;
|
944
955
|
}
|
945
956
|
declare function isBuffer<T extends TgpuBuffer<AnyData>>(value: T | unknown): value is T;
|
946
|
-
declare function isUsableAsVertex<T extends TgpuBuffer<AnyData>>(buffer: T): buffer is T &
|
957
|
+
declare function isUsableAsVertex<T extends TgpuBuffer<AnyData>>(buffer: T): buffer is T & VertexFlag;
|
947
958
|
type RestrictVertexUsages<TData extends BaseData> = TData extends {
|
948
959
|
readonly type: WgslTypeLiteral;
|
949
960
|
} ? ('uniform' | 'storage' | 'vertex')[] : 'vertex'[];
|
@@ -1156,7 +1167,7 @@ type GetStorageTextureRestriction<T extends TgpuLayoutStorageTexture> = Default<
|
|
1156
1167
|
format: T['storageTexture'];
|
1157
1168
|
dimension: Dimension;
|
1158
1169
|
} : never;
|
1159
|
-
type LayoutEntryToInput<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? (TgpuBuffer<UnwrapRuntimeConstructor<T['uniform']>> &
|
1170
|
+
type LayoutEntryToInput<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? (TgpuBuffer<UnwrapRuntimeConstructor<T['uniform']>> & UniformFlag) | GPUBuffer : T extends TgpuLayoutStorage ? (TgpuBuffer<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>>>) : T extends TgpuLayoutStorageTexture ? GPUTextureView | (StorageFlag & TgpuTexture<Prettify<TextureProps & GetStorageTextureRestriction<T>>>) : T extends TgpuLayoutExternalTexture ? GPUExternalTexture : never;
|
1160
1171
|
type BindLayoutEntry<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? TgpuBufferUniform<UnwrapRuntimeConstructor<T['uniform']>> : T extends TgpuLayoutStorage ? StorageUsageForEntry<T> : T extends TgpuLayoutSampler ? TgpuSampler : T extends TgpuLayoutComparisonSampler ? TgpuComparisonSampler : T extends TgpuLayoutTexture ? TgpuSampledTexture<Default<GetDimension<T['viewDimension']>, '2d'>, ChannelFormatToSchema[T['texture']]> : T extends TgpuLayoutStorageTexture ? StorageTextureUsageForEntry<T> : never;
|
1161
1172
|
type TgpuBindGroup<Entries extends Record<string, TgpuLayoutEntry | null> = Record<string, TgpuLayoutEntry | null>> = {
|
1162
1173
|
readonly resourceType: 'bind-group';
|
@@ -1183,19 +1194,19 @@ interface TgpuFixedBufferUsage<TData extends BaseData> extends TgpuNamable {
|
|
1183
1194
|
}
|
1184
1195
|
interface TgpuBufferMutable<TData extends BaseData> extends TgpuBufferUsage<TData, 'mutable'> {
|
1185
1196
|
}
|
1186
|
-
declare function isUsableAsUniform<T extends TgpuBuffer<AnyData>>(buffer: T): buffer is T &
|
1197
|
+
declare function isUsableAsUniform<T extends TgpuBuffer<AnyData>>(buffer: T): buffer is T & UniformFlag;
|
1187
1198
|
/**
|
1188
1199
|
* @deprecated Use buffer.as('mutable') instead.
|
1189
1200
|
*/
|
1190
|
-
declare function asMutable<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> &
|
1201
|
+
declare function asMutable<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> & StorageFlag): TgpuBufferMutable<TData> & TgpuFixedBufferUsage<TData>;
|
1191
1202
|
/**
|
1192
1203
|
* @deprecated Use buffer.as('readonly') instead.
|
1193
1204
|
*/
|
1194
|
-
declare function asReadonly<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> &
|
1205
|
+
declare function asReadonly<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> & StorageFlag): TgpuBufferReadonly<TData> & TgpuFixedBufferUsage<TData>;
|
1195
1206
|
/**
|
1196
1207
|
* @deprecated Use buffer.as('uniform') instead.
|
1197
1208
|
*/
|
1198
|
-
declare function asUniform<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> &
|
1209
|
+
declare function asUniform<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> & UniformFlag): TgpuBufferUniform<TData> & TgpuFixedBufferUsage<TData>;
|
1199
1210
|
|
1200
1211
|
interface TgpuExternalTexture {
|
1201
1212
|
readonly resourceType: 'external-texture';
|
@@ -1500,4 +1511,4 @@ declare const tgpu: {
|
|
1500
1511
|
};
|
1501
1512
|
};
|
1502
1513
|
|
1503
|
-
export { type BindLayoutEntry, type Eventual, type InitFromDeviceOptions, type InitOptions, type LayoutEntryToInput, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, RandomNameRegistry, type Render, ResolutionError, type Sampled, Storage, StrictNameRegistry, type TextureProps, type TgpuAccessor, type TgpuAnyTextureView, type TgpuBindGroup, type TgpuBindGroupLayout, type TgpuBuffer, type TgpuBufferMutable, type TgpuBufferReadonly, type TgpuBufferUniform, type TgpuComputeFn, type TgpuComputeFnShell, type TgpuComputePipeline, type TgpuConst, type TgpuDeclare, type TgpuDerived, type TgpuFn, type TgpuFnShell, type TgpuFragmentFn, type TgpuFragmentFnShell, type TgpuLayoutComparisonSampler, type TgpuLayoutEntry, type TgpuLayoutExternalTexture, type TgpuLayoutSampler, type TgpuLayoutStorage, type TgpuLayoutStorageTexture, type TgpuLayoutTexture, type TgpuLayoutUniform, type TgpuMutableTexture, type TgpuReadonlyTexture, type TgpuRenderPipeline, type TgpuRoot, type TgpuSampledTexture, type TgpuSampler, type TgpuSlot, type TgpuTexture, type TgpuVar, type TgpuVertexFn, type TgpuVertexFnShell, type TgpuVertexLayout, type TgpuWriteonlyTexture, type Uniform, type VariableScope, type Vertex, type WithBinding, type WithCompute, type WithFragment, type WithVertex, tgpu as default, isBuffer, isComparisonSampler, isDerived, isSampledTextureView, isSampler, isSlot, isStorageTextureView, isTexture, isTgpuFn, isUsableAsRender, isUsableAsSampled, isUsableAsStorage, isUsableAsUniform, isUsableAsVertex, tgpu, asMutable as unstable_asMutable, asReadonly as unstable_asReadonly, asUniform as unstable_asUniform };
|
1514
|
+
export { type BindLayoutEntry, type Eventual, type InitFromDeviceOptions, type InitOptions, type LayoutEntryToInput, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, RandomNameRegistry, type Render, ResolutionError, type Sampled, type Storage, type StorageFlag, StrictNameRegistry, type TextureProps, type TgpuAccessor, type TgpuAnyTextureView, type TgpuBindGroup, type TgpuBindGroupLayout, type TgpuBuffer, type TgpuBufferMutable, type TgpuBufferReadonly, type TgpuBufferUniform, type TgpuComputeFn, type TgpuComputeFnShell, type TgpuComputePipeline, type TgpuConst, type TgpuDeclare, type TgpuDerived, type TgpuFn, type TgpuFnShell, type TgpuFragmentFn, type TgpuFragmentFnShell, type TgpuLayoutComparisonSampler, type TgpuLayoutEntry, type TgpuLayoutExternalTexture, type TgpuLayoutSampler, type TgpuLayoutStorage, type TgpuLayoutStorageTexture, type TgpuLayoutTexture, type TgpuLayoutUniform, type TgpuMutableTexture, type TgpuReadonlyTexture, type TgpuRenderPipeline, type TgpuRoot, type TgpuSampledTexture, type TgpuSampler, type TgpuSlot, type TgpuTexture, type TgpuVar, type TgpuVertexFn, type TgpuVertexFnShell, type TgpuVertexLayout, type TgpuWriteonlyTexture, type Uniform, type UniformFlag, type VariableScope, type Vertex, type VertexFlag, type WithBinding, type WithCompute, type WithFragment, type WithVertex, tgpu as default, isBuffer, isComparisonSampler, isDerived, isSampledTextureView, isSampler, isSlot, isStorageTextureView, isTexture, isTgpuFn, isUsableAsRender, isUsableAsSampled, isUsableAsStorage, isUsableAsUniform, isUsableAsVertex, tgpu, asMutable as unstable_asMutable, asReadonly as unstable_asReadonly, asUniform as unstable_asUniform };
|
package/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { A as AnyWgslData, T as TgpuNamable, I as Infer,
|
2
|
-
import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation,
|
1
|
+
import { A as AnyWgslData, T as TgpuNamable, I as Infer, F as F32, a as F16, b as I32, U as U32, V as Vec2f, c as Vec3f, d as Vec4f, e as Vec2h, f as Vec3h, g as Vec4h, h as Vec2i, i as Vec3i, j as Vec4i, k as Vec2u, l as Vec3u, m as Vec4u, D as Decorated, n as AnyWgslStruct, B as BaseData, L as Location, W as WgslStruct, o as Default, p as UnionToIntersection, q as WgslArray, r as Disarray, s as Unstruct, t as VertexFormat, u as TgpuVertexAttrib, K as KindToDefaultFormatMap, v as KindToAcceptedAttribMap, w as AnyData, O as OmitProps, P as Prettify, M as Mutable, x as WgslTypeLiteral, y as InferPartial, z as MemIdentity, C as AnyVecInstance, E as AnyMatInstance } from './wgslTypes-D0JqCGnw.js';
|
2
|
+
import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation, b as AnyFragmentInputBuiltin, c as AnyFragmentOutputBuiltin, O as OmitBuiltins } from './attributes-Dri8dk1v.js';
|
3
3
|
import * as smol from 'tinyest';
|
4
4
|
import { Block } from 'tinyest';
|
5
5
|
|
@@ -88,11 +88,14 @@ declare function computeFn<ComputeIn extends Record<string, AnyComputeBuiltin>>(
|
|
88
88
|
workgroupSize: number[];
|
89
89
|
}): TgpuComputeFnShell<ComputeIn>;
|
90
90
|
|
91
|
-
interface
|
91
|
+
interface StorageFlag {
|
92
92
|
usableAsStorage: true;
|
93
93
|
}
|
94
|
-
|
95
|
-
|
94
|
+
/**
|
95
|
+
* @deprecated Use StorageFlag instead.
|
96
|
+
*/
|
97
|
+
type Storage = StorageFlag;
|
98
|
+
declare function isUsableAsStorage<T>(value: T): value is T & StorageFlag;
|
96
99
|
|
97
100
|
/**
|
98
101
|
* Used to transpile JS resources into SMoL on demand.
|
@@ -423,7 +426,7 @@ interface Render {
|
|
423
426
|
usableAsRender: true;
|
424
427
|
}
|
425
428
|
type LiteralToExtensionMap = {
|
426
|
-
storage:
|
429
|
+
storage: StorageFlag;
|
427
430
|
sampled: Sampled;
|
428
431
|
render: Render;
|
429
432
|
};
|
@@ -544,7 +547,7 @@ declare function vertexLayout<TData extends WgslArray | Disarray>(schemaForCount
|
|
544
547
|
interface TgpuRenderPipeline<Output extends IOLayout = IOLayout> extends TgpuNamable {
|
545
548
|
readonly resourceType: 'render-pipeline';
|
546
549
|
readonly label: string | undefined;
|
547
|
-
with<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: TgpuBuffer<TData> &
|
550
|
+
with<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: TgpuBuffer<TData> & VertexFlag): TgpuRenderPipeline<IOLayout>;
|
548
551
|
with<Entries extends Record<string, TgpuLayoutEntry | null>>(bindGroupLayout: TgpuBindGroupLayout<Entries>, bindGroup: TgpuBindGroup<Entries>): TgpuRenderPipeline<IOLayout>;
|
549
552
|
withColorAttachment(attachment: FragmentOutToColorAttachment<Output>): TgpuRenderPipeline<IOLayout>;
|
550
553
|
withDepthStencilAttachment(attachment: DepthStencilAttachment): TgpuRenderPipeline<IOLayout>;
|
@@ -794,7 +797,7 @@ interface RenderPass {
|
|
794
797
|
* Defaults to the size of the buffer minus the offset.
|
795
798
|
*/
|
796
799
|
setIndexBuffer<TData extends WgslArray | Disarray>(buffer: TgpuBuffer<TData> | GPUBuffer, indexFormat: GPUIndexFormat, offset?: GPUSize64, size?: GPUSize64): void;
|
797
|
-
setVertexBuffer<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: (TgpuBuffer<TData> &
|
800
|
+
setVertexBuffer<TData extends WgslArray | Disarray>(vertexLayout: TgpuVertexLayout<TData>, buffer: (TgpuBuffer<TData> & VertexFlag) | GPUBuffer, offset?: GPUSize64, size?: GPUSize64): void;
|
798
801
|
setBindGroup<Entries extends Record<string, TgpuLayoutEntry | null>>(bindGroupLayout: TgpuBindGroupLayout<Entries>, bindGroup: TgpuBindGroup<Entries> | GPUBindGroup): void;
|
799
802
|
/**
|
800
803
|
* Draws primitives.
|
@@ -910,13 +913,21 @@ interface ExperimentalTgpuRoot extends TgpuRoot, WithBinding {
|
|
910
913
|
flush(): void;
|
911
914
|
}
|
912
915
|
|
913
|
-
interface
|
916
|
+
interface UniformFlag {
|
914
917
|
usableAsUniform: true;
|
915
918
|
}
|
916
|
-
|
919
|
+
/**
|
920
|
+
* @deprecated Use UniformFlag instead.
|
921
|
+
*/
|
922
|
+
type Uniform = UniformFlag;
|
923
|
+
interface VertexFlag {
|
917
924
|
usableAsVertex: true;
|
918
925
|
}
|
919
|
-
|
926
|
+
/**
|
927
|
+
* @deprecated Use VertexFlag instead.
|
928
|
+
*/
|
929
|
+
type Vertex = VertexFlag;
|
930
|
+
type LiteralToUsageType<T extends 'uniform' | 'storage' | 'vertex'> = T extends 'uniform' ? UniformFlag : T extends 'storage' ? StorageFlag : T extends 'vertex' ? VertexFlag : never;
|
920
931
|
type ViewUsages<TBuffer extends TgpuBuffer<BaseData>> = (boolean extends TBuffer['usableAsUniform'] ? never : 'uniform') | (boolean extends TBuffer['usableAsStorage'] ? never : 'readonly' | 'mutable');
|
921
932
|
type UsageTypeToBufferUsage<TData extends BaseData> = {
|
922
933
|
uniform: TgpuBufferUniform<TData> & TgpuFixedBufferUsage<TData>;
|
@@ -943,7 +954,7 @@ interface TgpuBuffer<TData extends BaseData> extends TgpuNamable {
|
|
943
954
|
destroy(): void;
|
944
955
|
}
|
945
956
|
declare function isBuffer<T extends TgpuBuffer<AnyData>>(value: T | unknown): value is T;
|
946
|
-
declare function isUsableAsVertex<T extends TgpuBuffer<AnyData>>(buffer: T): buffer is T &
|
957
|
+
declare function isUsableAsVertex<T extends TgpuBuffer<AnyData>>(buffer: T): buffer is T & VertexFlag;
|
947
958
|
type RestrictVertexUsages<TData extends BaseData> = TData extends {
|
948
959
|
readonly type: WgslTypeLiteral;
|
949
960
|
} ? ('uniform' | 'storage' | 'vertex')[] : 'vertex'[];
|
@@ -1156,7 +1167,7 @@ type GetStorageTextureRestriction<T extends TgpuLayoutStorageTexture> = Default<
|
|
1156
1167
|
format: T['storageTexture'];
|
1157
1168
|
dimension: Dimension;
|
1158
1169
|
} : never;
|
1159
|
-
type LayoutEntryToInput<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? (TgpuBuffer<UnwrapRuntimeConstructor<T['uniform']>> &
|
1170
|
+
type LayoutEntryToInput<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? (TgpuBuffer<UnwrapRuntimeConstructor<T['uniform']>> & UniformFlag) | GPUBuffer : T extends TgpuLayoutStorage ? (TgpuBuffer<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>>>) : T extends TgpuLayoutStorageTexture ? GPUTextureView | (StorageFlag & TgpuTexture<Prettify<TextureProps & GetStorageTextureRestriction<T>>>) : T extends TgpuLayoutExternalTexture ? GPUExternalTexture : never;
|
1160
1171
|
type BindLayoutEntry<T extends TgpuLayoutEntry | null> = T extends TgpuLayoutUniform ? TgpuBufferUniform<UnwrapRuntimeConstructor<T['uniform']>> : T extends TgpuLayoutStorage ? StorageUsageForEntry<T> : T extends TgpuLayoutSampler ? TgpuSampler : T extends TgpuLayoutComparisonSampler ? TgpuComparisonSampler : T extends TgpuLayoutTexture ? TgpuSampledTexture<Default<GetDimension<T['viewDimension']>, '2d'>, ChannelFormatToSchema[T['texture']]> : T extends TgpuLayoutStorageTexture ? StorageTextureUsageForEntry<T> : never;
|
1161
1172
|
type TgpuBindGroup<Entries extends Record<string, TgpuLayoutEntry | null> = Record<string, TgpuLayoutEntry | null>> = {
|
1162
1173
|
readonly resourceType: 'bind-group';
|
@@ -1183,19 +1194,19 @@ interface TgpuFixedBufferUsage<TData extends BaseData> extends TgpuNamable {
|
|
1183
1194
|
}
|
1184
1195
|
interface TgpuBufferMutable<TData extends BaseData> extends TgpuBufferUsage<TData, 'mutable'> {
|
1185
1196
|
}
|
1186
|
-
declare function isUsableAsUniform<T extends TgpuBuffer<AnyData>>(buffer: T): buffer is T &
|
1197
|
+
declare function isUsableAsUniform<T extends TgpuBuffer<AnyData>>(buffer: T): buffer is T & UniformFlag;
|
1187
1198
|
/**
|
1188
1199
|
* @deprecated Use buffer.as('mutable') instead.
|
1189
1200
|
*/
|
1190
|
-
declare function asMutable<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> &
|
1201
|
+
declare function asMutable<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> & StorageFlag): TgpuBufferMutable<TData> & TgpuFixedBufferUsage<TData>;
|
1191
1202
|
/**
|
1192
1203
|
* @deprecated Use buffer.as('readonly') instead.
|
1193
1204
|
*/
|
1194
|
-
declare function asReadonly<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> &
|
1205
|
+
declare function asReadonly<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> & StorageFlag): TgpuBufferReadonly<TData> & TgpuFixedBufferUsage<TData>;
|
1195
1206
|
/**
|
1196
1207
|
* @deprecated Use buffer.as('uniform') instead.
|
1197
1208
|
*/
|
1198
|
-
declare function asUniform<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> &
|
1209
|
+
declare function asUniform<TData extends AnyWgslData>(buffer: TgpuBuffer<TData> & UniformFlag): TgpuBufferUniform<TData> & TgpuFixedBufferUsage<TData>;
|
1199
1210
|
|
1200
1211
|
interface TgpuExternalTexture {
|
1201
1212
|
readonly resourceType: 'external-texture';
|
@@ -1500,4 +1511,4 @@ declare const tgpu: {
|
|
1500
1511
|
};
|
1501
1512
|
};
|
1502
1513
|
|
1503
|
-
export { type BindLayoutEntry, type Eventual, type InitFromDeviceOptions, type InitOptions, type LayoutEntryToInput, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, RandomNameRegistry, type Render, ResolutionError, type Sampled, Storage, StrictNameRegistry, type TextureProps, type TgpuAccessor, type TgpuAnyTextureView, type TgpuBindGroup, type TgpuBindGroupLayout, type TgpuBuffer, type TgpuBufferMutable, type TgpuBufferReadonly, type TgpuBufferUniform, type TgpuComputeFn, type TgpuComputeFnShell, type TgpuComputePipeline, type TgpuConst, type TgpuDeclare, type TgpuDerived, type TgpuFn, type TgpuFnShell, type TgpuFragmentFn, type TgpuFragmentFnShell, type TgpuLayoutComparisonSampler, type TgpuLayoutEntry, type TgpuLayoutExternalTexture, type TgpuLayoutSampler, type TgpuLayoutStorage, type TgpuLayoutStorageTexture, type TgpuLayoutTexture, type TgpuLayoutUniform, type TgpuMutableTexture, type TgpuReadonlyTexture, type TgpuRenderPipeline, type TgpuRoot, type TgpuSampledTexture, type TgpuSampler, type TgpuSlot, type TgpuTexture, type TgpuVar, type TgpuVertexFn, type TgpuVertexFnShell, type TgpuVertexLayout, type TgpuWriteonlyTexture, type Uniform, type VariableScope, type Vertex, type WithBinding, type WithCompute, type WithFragment, type WithVertex, tgpu as default, isBuffer, isComparisonSampler, isDerived, isSampledTextureView, isSampler, isSlot, isStorageTextureView, isTexture, isTgpuFn, isUsableAsRender, isUsableAsSampled, isUsableAsStorage, isUsableAsUniform, isUsableAsVertex, tgpu, asMutable as unstable_asMutable, asReadonly as unstable_asReadonly, asUniform as unstable_asUniform };
|
1514
|
+
export { type BindLayoutEntry, type Eventual, type InitFromDeviceOptions, type InitOptions, type LayoutEntryToInput, MissingBindGroupsError, MissingLinksError, MissingSlotValueError, MissingVertexBuffersError, NotUniformError, RandomNameRegistry, type Render, ResolutionError, type Sampled, type Storage, type StorageFlag, StrictNameRegistry, type TextureProps, type TgpuAccessor, type TgpuAnyTextureView, type TgpuBindGroup, type TgpuBindGroupLayout, type TgpuBuffer, type TgpuBufferMutable, type TgpuBufferReadonly, type TgpuBufferUniform, type TgpuComputeFn, type TgpuComputeFnShell, type TgpuComputePipeline, type TgpuConst, type TgpuDeclare, type TgpuDerived, type TgpuFn, type TgpuFnShell, type TgpuFragmentFn, type TgpuFragmentFnShell, type TgpuLayoutComparisonSampler, type TgpuLayoutEntry, type TgpuLayoutExternalTexture, type TgpuLayoutSampler, type TgpuLayoutStorage, type TgpuLayoutStorageTexture, type TgpuLayoutTexture, type TgpuLayoutUniform, type TgpuMutableTexture, type TgpuReadonlyTexture, type TgpuRenderPipeline, type TgpuRoot, type TgpuSampledTexture, type TgpuSampler, type TgpuSlot, type TgpuTexture, type TgpuVar, type TgpuVertexFn, type TgpuVertexFnShell, type TgpuVertexLayout, type TgpuWriteonlyTexture, type Uniform, type UniformFlag, type VariableScope, type Vertex, type VertexFlag, type WithBinding, type WithCompute, type WithFragment, type WithVertex, tgpu as default, isBuffer, isComparisonSampler, isDerived, isSampledTextureView, isSampler, isSlot, isStorageTextureView, isTexture, isTgpuFn, isUsableAsRender, isUsableAsSampled, isUsableAsStorage, isUsableAsUniform, isUsableAsVertex, tgpu, asMutable as unstable_asMutable, asReadonly as unstable_asReadonly, asUniform as unstable_asUniform };
|