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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AnyWgslData, T as TgpuNamable, I as Infer, D as Decorated, 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, n as AnyWgslStruct, B as BaseData, L as Location, W as WgslStruct, o as Default, p as UnionToIntersection, q as WgslArray, r as Disarray, K as KindToAcceptedAttribMap, s as Unstruct, t as VertexFormat, u as TgpuVertexAttrib, v as KindToDefaultFormatMap, w as AnyData, O as OmitProps, P as Prettify, M as Mutable, x as InferPartial, y as MemIdentity, z as WgslTypeLiteral, C as AnyVecInstance, E as AnyMatInstance } from './wgslTypes-D8LnuOPy.cjs';
2
- import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation, O as OmitBuiltins, b as AnyFragmentOutputBuiltin, c as AnyFragmentInputBuiltin } from './attributes-Di0A7-Fw.cjs';
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 Storage {
91
+ interface StorageFlag {
92
92
  usableAsStorage: true;
93
93
  }
94
- declare const Storage: Storage;
95
- declare function isUsableAsStorage<T>(value: T): value is T & Storage;
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: 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> & Vertex): TgpuRenderPipeline<IOLayout>;
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> & Vertex) | GPUBuffer, offset?: GPUSize64, size?: GPUSize64): void;
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 Uniform {
916
+ interface UniformFlag {
914
917
  usableAsUniform: true;
915
918
  }
916
- interface Vertex {
919
+ /**
920
+ * @deprecated Use UniformFlag instead.
921
+ */
922
+ type Uniform = UniformFlag;
923
+ interface VertexFlag {
917
924
  usableAsVertex: true;
918
925
  }
919
- type LiteralToUsageType<T extends 'uniform' | 'storage' | 'vertex'> = T extends 'uniform' ? Uniform : T extends 'storage' ? Storage : T extends 'vertex' ? Vertex : never;
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 & Vertex;
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']>> & Uniform) | GPUBuffer : T extends TgpuLayoutStorage ? (TgpuBuffer<UnwrapRuntimeConstructor<T['storage']>> & Storage) | 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 | (Storage & TgpuTexture<Prettify<TextureProps & GetStorageTextureRestriction<T>>>) : T extends TgpuLayoutExternalTexture ? GPUExternalTexture : never;
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 & Uniform;
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> & Storage): TgpuBufferMutable<TData> & TgpuFixedBufferUsage<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> & Storage): TgpuBufferReadonly<TData> & TgpuFixedBufferUsage<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> & Uniform): TgpuBufferUniform<TData> & TgpuFixedBufferUsage<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, D as Decorated, 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, n as AnyWgslStruct, B as BaseData, L as Location, W as WgslStruct, o as Default, p as UnionToIntersection, q as WgslArray, r as Disarray, K as KindToAcceptedAttribMap, s as Unstruct, t as VertexFormat, u as TgpuVertexAttrib, v as KindToDefaultFormatMap, w as AnyData, O as OmitProps, P as Prettify, M as Mutable, x as InferPartial, y as MemIdentity, z as WgslTypeLiteral, C as AnyVecInstance, E as AnyMatInstance } from './wgslTypes-D8LnuOPy.js';
2
- import { A as AnyAttribute, a as AnyComputeBuiltin, D as Decorate, I as IsBuiltin, H as HasCustomLocation, O as OmitBuiltins, b as AnyFragmentOutputBuiltin, c as AnyFragmentInputBuiltin } from './attributes-CkPkK-h9.js';
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 Storage {
91
+ interface StorageFlag {
92
92
  usableAsStorage: true;
93
93
  }
94
- declare const Storage: Storage;
95
- declare function isUsableAsStorage<T>(value: T): value is T & Storage;
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: 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> & Vertex): TgpuRenderPipeline<IOLayout>;
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> & Vertex) | GPUBuffer, offset?: GPUSize64, size?: GPUSize64): void;
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 Uniform {
916
+ interface UniformFlag {
914
917
  usableAsUniform: true;
915
918
  }
916
- interface Vertex {
919
+ /**
920
+ * @deprecated Use UniformFlag instead.
921
+ */
922
+ type Uniform = UniformFlag;
923
+ interface VertexFlag {
917
924
  usableAsVertex: true;
918
925
  }
919
- type LiteralToUsageType<T extends 'uniform' | 'storage' | 'vertex'> = T extends 'uniform' ? Uniform : T extends 'storage' ? Storage : T extends 'vertex' ? Vertex : never;
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 & Vertex;
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']>> & Uniform) | GPUBuffer : T extends TgpuLayoutStorage ? (TgpuBuffer<UnwrapRuntimeConstructor<T['storage']>> & Storage) | 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 | (Storage & TgpuTexture<Prettify<TextureProps & GetStorageTextureRestriction<T>>>) : T extends TgpuLayoutExternalTexture ? GPUExternalTexture : never;
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 & Uniform;
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> & Storage): TgpuBufferMutable<TData> & TgpuFixedBufferUsage<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> & Storage): TgpuBufferReadonly<TData> & TgpuFixedBufferUsage<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> & Uniform): TgpuBufferUniform<TData> & TgpuFixedBufferUsage<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 };