typegpu 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-3JTP2ATR.cjs","../src/core/slot/slotTypes.ts","../src/shared/symbols.ts","../src/types.ts"],"names":["isSlot","value","isDerived","isProviding","isAccessor","$internal","UnknownData","Void","isSelfResolvable","isWgsl","isWgslData","isGPUBuffer","isBufferUsage","hasInternalDataType","_a"],"mappings":"AAAA,iIAAwC,SCiExBA,CAAAA,CAAUC,CAAAA,CAAoD,CAC5E,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAuB,YAAA,CAAA,GAAiB,MAClD,CAEO,SAASC,CAAAA,CACdD,CAAAA,CACY,CACZ,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAa,YAAA,CAAA,GAAiB,SACxC,CAEO,SAASE,CAAAA,CACdF,CAAAA,CACsC,CACtC,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAwC,YAAA,CAAA,CAAA,GAAkB,KAAA,CACpE,CAEO,SAASG,CAAAA,CACdH,CAAAA,CAC0B,CAC1B,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAA2B,YAAA,CAAA,GAAiB,UACtD,CCrFO,IAAMI,CAAAA,CAAY,MAAA,CAAO,UAAU,CAAA,CCuEnC,IAAMC,CAAAA,CAAc,CACzB,IAAA,CAAM,SACR,CAAA,CAEaC,CAAAA,aAAO,CAClB,IAAA,CAAM,MACR,CAAA,CAgHO,SAASC,CAAAA,CAAiBP,CAAAA,CAAyC,CACxE,OAAO,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAA2B,UAAA,CAAA,CAAA,EAAgB,UAC5D,CAEO,SAASQ,CAAAA,CAAOR,CAAAA,CAA+B,CACpD,OACE,OAAOA,CAAAA,EAAU,QAAA,EACjB,OAAOA,CAAAA,EAAU,SAAA,EACjB,OAAOA,CAAAA,EAAU,QAAA,EACjBO,CAAAA,CAAiBP,CAAK,CAAA,EACtBS,iCAAAA,CAAgB,CAAA,EAChBV,CAAAA,CAAOC,CAAK,CAAA,EACZC,CAAAA,CAAUD,CAAK,CAAA,EACfE,CAAAA,CAAYF,CAAK,CAErB,CAKO,SAASU,CAAAA,CAAYV,CAAAA,CAAoC,CAC9D,MACE,CAAC,CAACA,CAAAA,EACF,OAAOA,CAAAA,EAAU,QAAA,EACjB,gBAAA,GAAoBA,CAAAA,EACpB,UAAA,GAAcA,CAElB,CAEO,SAASW,CAAAA,CAKdX,CAAAA,CAAgC,CAChC,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAa,YAAA,CAAA,GAAiB,cACxC,CAEO,SAASY,CAAAA,CACdZ,CAAAA,CACkD,CArOpD,IAAAa,CAAAA,CAsOE,MACE,CAAC,CAACb,CAAAA,EACF,OAAOA,CAAAA,EAAU,QAAA,EACjB,CAAC,CAAA,CAAA,CAAEa,CAAAA,CAAAb,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAoDI,CAAAA,CAAAA,CAAAA,EAApD,IAAA,EAAAS,CAAAA,CAAgE,QAAA,CAEvE,CAAA,mLAAA","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-3JTP2ATR.cjs","sourcesContent":[null,"import type { AnyWgslData } from '../../data';\nimport type { TgpuNamable } from '../../namable';\nimport type { Infer } from '../../shared/repr';\nimport type { Labelled } from '../../types';\nimport type { TgpuFn } from '../function/tgpuFn';\nimport type { TgpuBufferUsage } from './../buffer/bufferUsage';\n\nexport interface TgpuSlot<T> extends TgpuNamable, Labelled {\n readonly resourceType: 'slot';\n '~repr': Infer<T>;\n\n readonly defaultValue: T | undefined;\n\n /**\n * Used to determine if code generated using either value `a` or `b` in place\n * of the slot will be equivalent. Defaults to `Object.is`.\n */\n areEqual(a: T, b: T): boolean;\n\n readonly value: Infer<T>;\n}\n\nexport interface TgpuDerived<T> {\n readonly resourceType: 'derived';\n readonly value: Infer<T>;\n '~repr': Infer<T>;\n readonly '~providing'?: Providing | undefined;\n\n with<TValue>(slot: TgpuSlot<TValue>, value: Eventual<TValue>): TgpuDerived<T>;\n\n /**\n * @internal\n */\n '~compute'(): T;\n}\n\nexport interface TgpuAccessor<T extends AnyWgslData = AnyWgslData>\n extends TgpuNamable,\n Labelled {\n readonly resourceType: 'accessor';\n '~repr': Infer<T>;\n\n readonly schema: T;\n readonly defaultValue:\n | TgpuFn<[], T>\n | TgpuBufferUsage<T>\n | Infer<T>\n | undefined;\n readonly slot: TgpuSlot<TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T>>;\n\n readonly value: Infer<T>;\n}\n\n/**\n * Represents a value that is available at resolution time.\n */\nexport type Eventual<T> = T | TgpuSlot<T> | TgpuDerived<T>;\n\nexport type SlotValuePair<T = unknown> = [TgpuSlot<T>, T];\n\nexport type Providing = {\n inner: unknown;\n pairs: SlotValuePair[];\n};\n\nexport function isSlot<T>(value: unknown | TgpuSlot<T>): value is TgpuSlot<T> {\n return (value as TgpuSlot<T>)?.resourceType === 'slot';\n}\n\nexport function isDerived<T extends TgpuDerived<unknown>>(\n value: T | unknown,\n): value is T {\n return (value as T)?.resourceType === 'derived';\n}\n\nexport function isProviding(\n value: unknown,\n): value is { '~providing': Providing } {\n return (value as { '~providing': Providing })?.['~providing'] !== undefined;\n}\n\nexport function isAccessor<T extends AnyWgslData>(\n value: unknown | TgpuAccessor<T>,\n): value is TgpuAccessor<T> {\n return (value as TgpuAccessor<T>)?.resourceType === 'accessor';\n}\n","export const $internal = Symbol('internal');\n","import type { Block } from 'tinyest';\nimport type {\n TgpuBufferMutable,\n TgpuBufferReadonly,\n TgpuBufferUniform,\n TgpuBufferUsage,\n} from './core/buffer/bufferUsage';\nimport type { TgpuConst } from './core/constant/tgpuConstant';\nimport type { TgpuDeclare } from './core/declare/tgpuDeclare';\nimport type { TgpuComputeFn } from './core/function/tgpuComputeFn';\nimport type { TgpuFn } from './core/function/tgpuFn';\nimport type { TgpuFragmentFn } from './core/function/tgpuFragmentFn';\nimport type { TgpuVertexFn } from './core/function/tgpuVertexFn';\nimport type { TgpuComputePipeline } from './core/pipeline/computePipeline';\nimport type { TgpuRenderPipeline } from './core/pipeline/renderPipeline';\nimport type { TgpuSampler } from './core/sampler/sampler';\nimport {\n type Eventual,\n type SlotValuePair,\n type TgpuAccessor,\n type TgpuSlot,\n isDerived,\n isProviding,\n isSlot,\n} from './core/slot/slotTypes';\nimport type { TgpuExternalTexture } from './core/texture/externalTexture';\nimport type { TgpuAnyTextureView, TgpuTexture } from './core/texture/texture';\nimport type { TgpuVar } from './core/variable/tgpuVariable';\nimport type { AnyData } from './data';\nimport {\n type AbstractFloat,\n type AbstractInt,\n type AnyMatInstance,\n type AnyVecInstance,\n type AnyWgslData,\n type BaseData,\n isWgslData,\n} from './data/wgslTypes';\nimport type { NameRegistry } from './nameRegistry';\nimport type { Infer } from './shared/repr';\nimport { $internal } from './shared/symbols';\nimport type {\n TgpuBindGroupLayout,\n TgpuLayoutEntry,\n} from './tgpuBindGroupLayout';\n\nexport type ResolvableObject =\n | SelfResolvable\n | TgpuBufferUsage\n | TgpuConst\n | TgpuDeclare\n | TgpuFn\n | TgpuComputeFn\n | TgpuFragmentFn\n | TgpuComputePipeline\n | TgpuRenderPipeline\n | TgpuVertexFn\n | TgpuSampler\n | TgpuAccessor\n | TgpuExternalTexture\n | TgpuTexture\n | TgpuAnyTextureView\n | TgpuVar\n | AnyVecInstance\n | AnyMatInstance\n | AnyData\n // biome-ignore lint/suspicious/noExplicitAny: <has to be more permissive than unknown>\n | TgpuFn<any, any>;\n\nexport type Wgsl = Eventual<string | number | boolean | ResolvableObject>;\n\nexport const UnknownData = {\n type: 'unknown',\n};\nexport type UnknownData = typeof UnknownData;\nexport const Void = {\n type: 'void' as const,\n};\nexport type Void = typeof Void;\n\nexport type Resource = {\n value: unknown;\n dataType: AnyWgslData | UnknownData | AbstractInt | AbstractFloat | Void;\n};\n\nexport type TgpuShaderStage = 'compute' | 'vertex' | 'fragment';\n\nexport interface FnToWgslOptions {\n args: Resource[];\n returnType: AnyWgslData;\n body: Block;\n externalMap: Record<string, unknown>;\n}\n\nexport type ItemLayer = {\n type: 'item';\n usedSlots: Set<TgpuSlot<unknown>>;\n};\n\nexport interface ItemStateStack {\n readonly itemDepth: number;\n readonly topItem: ItemLayer;\n\n pushItem(): void;\n popItem(): void;\n pushSlotBindings(pairs: SlotValuePair<unknown>[]): void;\n popSlotBindings(): void;\n pushFunctionScope(\n args: Resource[],\n returnType: AnyWgslData | undefined,\n externalMap: Record<string, unknown>,\n ): void;\n popFunctionScope(): void;\n pushBlockScope(): void;\n popBlockScope(): void;\n pop(type?: 'functionScope' | 'blockScope' | 'slotBinding' | 'item'): void;\n readSlot<T>(slot: TgpuSlot<T>): T | undefined;\n getResourceById(id: string): Resource | undefined;\n defineBlockVariable(id: string, type: AnyWgslData | UnknownData): Resource;\n}\n\n/**\n * Passed into each resolvable item. All items in a tree share a resolution ctx,\n * but there can be layers added and removed from the item stack when going down\n * and up the tree.\n */\nexport interface ResolutionCtx {\n readonly names: NameRegistry;\n\n addDeclaration(declaration: string): void;\n\n /**\n * Reserves a bind group number, and returns a placeholder that will be replaced\n * with a concrete number at the end of the resolution process.\n */\n allocateLayoutEntry(layout: TgpuBindGroupLayout): string;\n\n /**\n * Reserves a spot in the catch-all bind group, without the indirection of a bind-group.\n * This means the resource is 'fixed', and cannot be swapped between code execution.\n */\n allocateFixedEntry(\n layoutEntry: TgpuLayoutEntry,\n resource: object,\n ): {\n group: string;\n binding: number;\n };\n\n withSlots<T>(pairs: SlotValuePair<unknown>[], callback: () => T): T;\n\n /**\n * Unwraps all layers of slot/derived indirection and returns the concrete value if available.\n * @throws {MissingSlotValueError}\n */\n unwrap<T>(eventual: Eventual<T>): T;\n\n resolve(item: unknown): string;\n resolveValue<T extends BaseData>(value: Infer<T>, schema: T): string;\n\n transpileFn(fn: string): {\n argNames: string[];\n body: Block;\n externalNames: string[];\n };\n fnToWgsl(options: FnToWgslOptions): {\n head: Wgsl;\n body: Wgsl;\n };\n\n [$internal]: {\n itemStateStack: ItemStateStack;\n };\n}\n\n/**\n * Houses a method '~resolve` that returns a code string\n * representing it, as opposed to offloading the resolution\n * to another mechanism.\n */\nexport interface SelfResolvable {\n '~resolve'(ctx: ResolutionCtx): string;\n toString(): string;\n}\n\nexport interface Labelled {\n readonly label?: string | undefined;\n}\n\nexport function isSelfResolvable(value: unknown): value is SelfResolvable {\n return typeof (value as SelfResolvable)?.['~resolve'] === 'function';\n}\n\nexport function isWgsl(value: unknown): value is Wgsl {\n return (\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'string' ||\n isSelfResolvable(value) ||\n isWgslData(value) ||\n isSlot(value) ||\n isDerived(value) ||\n isProviding(value)\n );\n}\n\nexport type BindableBufferUsage = 'uniform' | 'readonly' | 'mutable';\nexport type BufferUsage = 'uniform' | 'readonly' | 'mutable' | 'vertex';\n\nexport function isGPUBuffer(value: unknown): value is GPUBuffer {\n return (\n !!value &&\n typeof value === 'object' &&\n 'getMappedRange' in value &&\n 'mapAsync' in value\n );\n}\n\nexport function isBufferUsage<\n T extends\n | TgpuBufferUniform<BaseData>\n | TgpuBufferReadonly<BaseData>\n | TgpuBufferMutable<BaseData>,\n>(value: T | unknown): value is T {\n return (value as T)?.resourceType === 'buffer-usage';\n}\n\nexport function hasInternalDataType(\n value: unknown,\n): value is { [$internal]: { dataType: BaseData } } {\n return (\n !!value &&\n typeof value === 'object' &&\n !!(value as { [$internal]: { dataType: BaseData } })?.[$internal]?.dataType\n );\n}\n"]}
1
+ {"version":3,"sources":["/Users/marcinhawryluk/Documents/wigsill/packages/typegpu/dist/chunk-3JTP2ATR.cjs","../src/core/slot/slotTypes.ts","../src/shared/symbols.ts","../src/types.ts"],"names":["isSlot","value","isDerived","isProviding","isAccessor","$internal","UnknownData","Void","isSelfResolvable","isWgsl","isWgslData","isGPUBuffer","isBufferUsage","hasInternalDataType","_a"],"mappings":"AAAA,iIAAwC,SCiExBA,CAAAA,CAAUC,CAAAA,CAAoD,CAC5E,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAuB,YAAA,CAAA,GAAiB,MAClD,CAEO,SAASC,CAAAA,CACdD,CAAAA,CACY,CACZ,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAa,YAAA,CAAA,GAAiB,SACxC,CAEO,SAASE,CAAAA,CACdF,CAAAA,CACsC,CACtC,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAwC,YAAA,CAAA,CAAA,GAAkB,KAAA,CACpE,CAEO,SAASG,CAAAA,CACdH,CAAAA,CAC0B,CAC1B,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAA2B,YAAA,CAAA,GAAiB,UACtD,CCrFO,IAAMI,CAAAA,CAAY,MAAA,CAAO,UAAU,CAAA,CCuEnC,IAAMC,CAAAA,CAAc,CACzB,IAAA,CAAM,SACR,CAAA,CAEaC,CAAAA,aAAO,CAClB,IAAA,CAAM,MACR,CAAA,CAgHO,SAASC,CAAAA,CAAiBP,CAAAA,CAAyC,CACxE,OAAO,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAA2B,UAAA,CAAA,CAAA,EAAgB,UAC5D,CAEO,SAASQ,CAAAA,CAAOR,CAAAA,CAA+B,CACpD,OACE,OAAOA,CAAAA,EAAU,QAAA,EACjB,OAAOA,CAAAA,EAAU,SAAA,EACjB,OAAOA,CAAAA,EAAU,QAAA,EACjBO,CAAAA,CAAiBP,CAAK,CAAA,EACtBS,iCAAAA,CAAgB,CAAA,EAChBV,CAAAA,CAAOC,CAAK,CAAA,EACZC,CAAAA,CAAUD,CAAK,CAAA,EACfE,CAAAA,CAAYF,CAAK,CAErB,CAKO,SAASU,CAAAA,CAAYV,CAAAA,CAAoC,CAC9D,MACE,CAAC,CAACA,CAAAA,EACF,OAAOA,CAAAA,EAAU,QAAA,EACjB,gBAAA,GAAoBA,CAAAA,EACpB,UAAA,GAAcA,CAElB,CAEO,SAASW,CAAAA,CAKdX,CAAAA,CAAgC,CAChC,MAAA,CAAQA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAa,YAAA,CAAA,GAAiB,cACxC,CAEO,SAASY,CAAAA,CACdZ,CAAAA,CACkD,CArOpD,IAAAa,CAAAA,CAsOE,MACE,CAAC,CAACb,CAAAA,EACF,OAAOA,CAAAA,EAAU,QAAA,EACjB,CAAC,CAAA,CAAA,CAAEa,CAAAA,CAAAb,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAoDI,CAAAA,CAAAA,CAAAA,EAApD,IAAA,EAAAS,CAAAA,CAAgE,QAAA,CAEvE,CAAA,mLAAA","file":"/Users/marcinhawryluk/Documents/wigsill/packages/typegpu/dist/chunk-3JTP2ATR.cjs","sourcesContent":[null,"import type { AnyWgslData } from '../../data';\nimport type { TgpuNamable } from '../../namable';\nimport type { Infer } from '../../shared/repr';\nimport type { Labelled } from '../../types';\nimport type { TgpuFn } from '../function/tgpuFn';\nimport type { TgpuBufferUsage } from './../buffer/bufferUsage';\n\nexport interface TgpuSlot<T> extends TgpuNamable, Labelled {\n readonly resourceType: 'slot';\n '~repr': Infer<T>;\n\n readonly defaultValue: T | undefined;\n\n /**\n * Used to determine if code generated using either value `a` or `b` in place\n * of the slot will be equivalent. Defaults to `Object.is`.\n */\n areEqual(a: T, b: T): boolean;\n\n readonly value: Infer<T>;\n}\n\nexport interface TgpuDerived<T> {\n readonly resourceType: 'derived';\n readonly value: Infer<T>;\n '~repr': Infer<T>;\n readonly '~providing'?: Providing | undefined;\n\n with<TValue>(slot: TgpuSlot<TValue>, value: Eventual<TValue>): TgpuDerived<T>;\n\n /**\n * @internal\n */\n '~compute'(): T;\n}\n\nexport interface TgpuAccessor<T extends AnyWgslData = AnyWgslData>\n extends TgpuNamable,\n Labelled {\n readonly resourceType: 'accessor';\n '~repr': Infer<T>;\n\n readonly schema: T;\n readonly defaultValue:\n | TgpuFn<[], T>\n | TgpuBufferUsage<T>\n | Infer<T>\n | undefined;\n readonly slot: TgpuSlot<TgpuFn<[], T> | TgpuBufferUsage<T> | Infer<T>>;\n\n readonly value: Infer<T>;\n}\n\n/**\n * Represents a value that is available at resolution time.\n */\nexport type Eventual<T> = T | TgpuSlot<T> | TgpuDerived<T>;\n\nexport type SlotValuePair<T = unknown> = [TgpuSlot<T>, T];\n\nexport type Providing = {\n inner: unknown;\n pairs: SlotValuePair[];\n};\n\nexport function isSlot<T>(value: unknown | TgpuSlot<T>): value is TgpuSlot<T> {\n return (value as TgpuSlot<T>)?.resourceType === 'slot';\n}\n\nexport function isDerived<T extends TgpuDerived<unknown>>(\n value: T | unknown,\n): value is T {\n return (value as T)?.resourceType === 'derived';\n}\n\nexport function isProviding(\n value: unknown,\n): value is { '~providing': Providing } {\n return (value as { '~providing': Providing })?.['~providing'] !== undefined;\n}\n\nexport function isAccessor<T extends AnyWgslData>(\n value: unknown | TgpuAccessor<T>,\n): value is TgpuAccessor<T> {\n return (value as TgpuAccessor<T>)?.resourceType === 'accessor';\n}\n","export const $internal = Symbol('internal');\n","import type { Block } from 'tinyest';\nimport type {\n TgpuBufferMutable,\n TgpuBufferReadonly,\n TgpuBufferUniform,\n TgpuBufferUsage,\n} from './core/buffer/bufferUsage';\nimport type { TgpuConst } from './core/constant/tgpuConstant';\nimport type { TgpuDeclare } from './core/declare/tgpuDeclare';\nimport type { TgpuComputeFn } from './core/function/tgpuComputeFn';\nimport type { TgpuFn } from './core/function/tgpuFn';\nimport type { TgpuFragmentFn } from './core/function/tgpuFragmentFn';\nimport type { TgpuVertexFn } from './core/function/tgpuVertexFn';\nimport type { TgpuComputePipeline } from './core/pipeline/computePipeline';\nimport type { TgpuRenderPipeline } from './core/pipeline/renderPipeline';\nimport type { TgpuSampler } from './core/sampler/sampler';\nimport {\n type Eventual,\n type SlotValuePair,\n type TgpuAccessor,\n type TgpuSlot,\n isDerived,\n isProviding,\n isSlot,\n} from './core/slot/slotTypes';\nimport type { TgpuExternalTexture } from './core/texture/externalTexture';\nimport type { TgpuAnyTextureView, TgpuTexture } from './core/texture/texture';\nimport type { TgpuVar } from './core/variable/tgpuVariable';\nimport type { AnyData } from './data';\nimport {\n type AbstractFloat,\n type AbstractInt,\n type AnyMatInstance,\n type AnyVecInstance,\n type AnyWgslData,\n type BaseData,\n isWgslData,\n} from './data/wgslTypes';\nimport type { NameRegistry } from './nameRegistry';\nimport type { Infer } from './shared/repr';\nimport { $internal } from './shared/symbols';\nimport type {\n TgpuBindGroupLayout,\n TgpuLayoutEntry,\n} from './tgpuBindGroupLayout';\n\nexport type ResolvableObject =\n | SelfResolvable\n | TgpuBufferUsage\n | TgpuConst\n | TgpuDeclare\n | TgpuFn\n | TgpuComputeFn\n | TgpuFragmentFn\n | TgpuComputePipeline\n | TgpuRenderPipeline\n | TgpuVertexFn\n | TgpuSampler\n | TgpuAccessor\n | TgpuExternalTexture\n | TgpuTexture\n | TgpuAnyTextureView\n | TgpuVar\n | AnyVecInstance\n | AnyMatInstance\n | AnyData\n // biome-ignore lint/suspicious/noExplicitAny: <has to be more permissive than unknown>\n | TgpuFn<any, any>;\n\nexport type Wgsl = Eventual<string | number | boolean | ResolvableObject>;\n\nexport const UnknownData = {\n type: 'unknown',\n};\nexport type UnknownData = typeof UnknownData;\nexport const Void = {\n type: 'void' as const,\n};\nexport type Void = typeof Void;\n\nexport type Resource = {\n value: unknown;\n dataType: AnyWgslData | UnknownData | AbstractInt | AbstractFloat | Void;\n};\n\nexport type TgpuShaderStage = 'compute' | 'vertex' | 'fragment';\n\nexport interface FnToWgslOptions {\n args: Resource[];\n returnType: AnyWgslData;\n body: Block;\n externalMap: Record<string, unknown>;\n}\n\nexport type ItemLayer = {\n type: 'item';\n usedSlots: Set<TgpuSlot<unknown>>;\n};\n\nexport interface ItemStateStack {\n readonly itemDepth: number;\n readonly topItem: ItemLayer;\n\n pushItem(): void;\n popItem(): void;\n pushSlotBindings(pairs: SlotValuePair<unknown>[]): void;\n popSlotBindings(): void;\n pushFunctionScope(\n args: Resource[],\n returnType: AnyWgslData | undefined,\n externalMap: Record<string, unknown>,\n ): void;\n popFunctionScope(): void;\n pushBlockScope(): void;\n popBlockScope(): void;\n pop(type?: 'functionScope' | 'blockScope' | 'slotBinding' | 'item'): void;\n readSlot<T>(slot: TgpuSlot<T>): T | undefined;\n getResourceById(id: string): Resource | undefined;\n defineBlockVariable(id: string, type: AnyWgslData | UnknownData): Resource;\n}\n\n/**\n * Passed into each resolvable item. All items in a tree share a resolution ctx,\n * but there can be layers added and removed from the item stack when going down\n * and up the tree.\n */\nexport interface ResolutionCtx {\n readonly names: NameRegistry;\n\n addDeclaration(declaration: string): void;\n\n /**\n * Reserves a bind group number, and returns a placeholder that will be replaced\n * with a concrete number at the end of the resolution process.\n */\n allocateLayoutEntry(layout: TgpuBindGroupLayout): string;\n\n /**\n * Reserves a spot in the catch-all bind group, without the indirection of a bind-group.\n * This means the resource is 'fixed', and cannot be swapped between code execution.\n */\n allocateFixedEntry(\n layoutEntry: TgpuLayoutEntry,\n resource: object,\n ): {\n group: string;\n binding: number;\n };\n\n withSlots<T>(pairs: SlotValuePair<unknown>[], callback: () => T): T;\n\n /**\n * Unwraps all layers of slot/derived indirection and returns the concrete value if available.\n * @throws {MissingSlotValueError}\n */\n unwrap<T>(eventual: Eventual<T>): T;\n\n resolve(item: unknown): string;\n resolveValue<T extends BaseData>(value: Infer<T>, schema: T): string;\n\n transpileFn(fn: string): {\n argNames: string[];\n body: Block;\n externalNames: string[];\n };\n fnToWgsl(options: FnToWgslOptions): {\n head: Wgsl;\n body: Wgsl;\n };\n\n [$internal]: {\n itemStateStack: ItemStateStack;\n };\n}\n\n/**\n * Houses a method '~resolve` that returns a code string\n * representing it, as opposed to offloading the resolution\n * to another mechanism.\n */\nexport interface SelfResolvable {\n '~resolve'(ctx: ResolutionCtx): string;\n toString(): string;\n}\n\nexport interface Labelled {\n readonly label?: string | undefined;\n}\n\nexport function isSelfResolvable(value: unknown): value is SelfResolvable {\n return typeof (value as SelfResolvable)?.['~resolve'] === 'function';\n}\n\nexport function isWgsl(value: unknown): value is Wgsl {\n return (\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n typeof value === 'string' ||\n isSelfResolvable(value) ||\n isWgslData(value) ||\n isSlot(value) ||\n isDerived(value) ||\n isProviding(value)\n );\n}\n\nexport type BindableBufferUsage = 'uniform' | 'readonly' | 'mutable';\nexport type BufferUsage = 'uniform' | 'readonly' | 'mutable' | 'vertex';\n\nexport function isGPUBuffer(value: unknown): value is GPUBuffer {\n return (\n !!value &&\n typeof value === 'object' &&\n 'getMappedRange' in value &&\n 'mapAsync' in value\n );\n}\n\nexport function isBufferUsage<\n T extends\n | TgpuBufferUniform<BaseData>\n | TgpuBufferReadonly<BaseData>\n | TgpuBufferMutable<BaseData>,\n>(value: T | unknown): value is T {\n return (value as T)?.resourceType === 'buffer-usage';\n}\n\nexport function hasInternalDataType(\n value: unknown,\n): value is { [$internal]: { dataType: BaseData } } {\n return (\n !!value &&\n typeof value === 'object' &&\n !!(value as { [$internal]: { dataType: BaseData } })?.[$internal]?.dataType\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-3QXCKMEJ.cjs","../src/data/struct.ts"],"names":["struct","props","WgslStructImpl","label","_a"],"mappings":"AAAA,iIAAuL,SCoDvKA,EAAAA,CACdC,CAAAA,CAC8B,CAC9B,IAAMD,CAAAA,CAAaC,CAAAA,EAAaA,CAAAA,CAChC,OAAA,MAAA,CAAO,cAAA,CAAeD,CAAAA,CAAQE,EAAc,CAAA,CAC5CF,CAAAA,CAAO,SAAA,CAAYC,CAAAA,CAEZD,CACT,CAMA,IAAME,EAAAA,CAAiB,CACrB,IAAA,CAAM,QAAA,CACN,MAAA,CAAQ,KAAA,CAAA,CAER,IAAI,KAAA,CAAA,CAA4B,CAC9B,OAAO,IAAA,CAAK,MACd,CAAA,CAEA,KAAA,CAAMC,CAAAA,CAAe,CACnB,OAAA,IAAA,CAAK,MAAA,CAASA,CAAAA,CACP,IACT,CAAA,CAEA,QAAA,CAAA,CAAmB,CA/ErB,IAAAC,CAAAA,CAgFI,MAAO,CAAA,OAAA,EAAA,CAAUA,CAAAA,CAAA,IAAA,CAAK,KAAA,CAAA,EAAL,IAAA,CAAAA,CAAAA,CAAc,WAAW,CAAA,CAAA","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-3QXCKMEJ.cjs","sourcesContent":[null,"import type { TgpuNamable } from '../namable';\nimport type {\n InferGPURecord,\n InferPartialRecord,\n InferRecord,\n MemIdentityRecord,\n} from '../shared/repr';\nimport type { Prettify } from '../shared/utilityTypes';\nimport type { AnyWgslData, BaseData } from './wgslTypes';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Struct schema constructed via `d.struct` function.\n *\n * Responsible for handling reading and writing struct values\n * between binary and JS representation. Takes into account\n * the `byteAlignment` requirement of its members.\n */\nexport interface WgslStruct<\n TProps extends Record<string, BaseData> = Record<string, BaseData>,\n> extends TgpuNamable {\n (props: InferRecord<TProps>): InferRecord<TProps>;\n readonly type: 'struct';\n readonly label?: string | undefined;\n readonly propTypes: TProps;\n /** Type-token, not available at runtime */\n readonly '~repr': Prettify<InferRecord<TProps>>;\n /** Type-token, not available at runtime */\n readonly '~gpuRepr': InferGPURecord<TProps>;\n /** Type-token, not available at runtime */\n readonly '~memIdent': WgslStruct<MemIdentityRecord<TProps>>;\n /** Type-token, not available at runtime */\n readonly '~reprPartial': Prettify<Partial<InferPartialRecord<TProps>>>;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <we need the type to be broader than WgslStruct<Record<string, BaseWgslData>>\nexport type AnyWgslStruct = WgslStruct<any>;\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<Prettify<TProps>> {\n const struct = <T>(props: T) => props;\n Object.setPrototypeOf(struct, WgslStructImpl);\n struct.propTypes = props;\n\n return struct as unknown as WgslStruct<Prettify<TProps>>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst WgslStructImpl = {\n type: 'struct',\n _label: undefined as string | undefined,\n\n get label(): string | undefined {\n return this._label;\n },\n\n $name(label: string) {\n this._label = label;\n return this;\n },\n\n toString(): string {\n return `struct:${this.label ?? '<unnamed>'}`;\n },\n};\n"]}
1
+ {"version":3,"sources":["/Users/marcinhawryluk/Documents/wigsill/packages/typegpu/dist/chunk-3QXCKMEJ.cjs","../src/data/struct.ts"],"names":["struct","props","WgslStructImpl","label","_a"],"mappings":"AAAA,iIAAuL,SCoDvKA,EAAAA,CACdC,CAAAA,CAC8B,CAC9B,IAAMD,CAAAA,CAAaC,CAAAA,EAAaA,CAAAA,CAChC,OAAA,MAAA,CAAO,cAAA,CAAeD,CAAAA,CAAQE,EAAc,CAAA,CAC5CF,CAAAA,CAAO,SAAA,CAAYC,CAAAA,CAEZD,CACT,CAMA,IAAME,EAAAA,CAAiB,CACrB,IAAA,CAAM,QAAA,CACN,MAAA,CAAQ,KAAA,CAAA,CAER,IAAI,KAAA,CAAA,CAA4B,CAC9B,OAAO,IAAA,CAAK,MACd,CAAA,CAEA,KAAA,CAAMC,CAAAA,CAAe,CACnB,OAAA,IAAA,CAAK,MAAA,CAASA,CAAAA,CACP,IACT,CAAA,CAEA,QAAA,CAAA,CAAmB,CA/ErB,IAAAC,CAAAA,CAgFI,MAAO,CAAA,OAAA,EAAA,CAAUA,CAAAA,CAAA,IAAA,CAAK,KAAA,CAAA,EAAL,IAAA,CAAAA,CAAAA,CAAc,WAAW,CAAA,CAAA","file":"/Users/marcinhawryluk/Documents/wigsill/packages/typegpu/dist/chunk-3QXCKMEJ.cjs","sourcesContent":[null,"import type { TgpuNamable } from '../namable';\nimport type {\n InferGPURecord,\n InferPartialRecord,\n InferRecord,\n MemIdentityRecord,\n} from '../shared/repr';\nimport type { Prettify } from '../shared/utilityTypes';\nimport type { AnyWgslData, BaseData } from './wgslTypes';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Struct schema constructed via `d.struct` function.\n *\n * Responsible for handling reading and writing struct values\n * between binary and JS representation. Takes into account\n * the `byteAlignment` requirement of its members.\n */\nexport interface WgslStruct<\n TProps extends Record<string, BaseData> = Record<string, BaseData>,\n> extends TgpuNamable {\n (props: InferRecord<TProps>): InferRecord<TProps>;\n readonly type: 'struct';\n readonly label?: string | undefined;\n readonly propTypes: TProps;\n /** Type-token, not available at runtime */\n readonly '~repr': Prettify<InferRecord<TProps>>;\n /** Type-token, not available at runtime */\n readonly '~gpuRepr': InferGPURecord<TProps>;\n /** Type-token, not available at runtime */\n readonly '~memIdent': WgslStruct<MemIdentityRecord<TProps>>;\n /** Type-token, not available at runtime */\n readonly '~reprPartial': Prettify<Partial<InferPartialRecord<TProps>>>;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <we need the type to be broader than WgslStruct<Record<string, BaseWgslData>>\nexport type AnyWgslStruct = WgslStruct<any>;\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<Prettify<TProps>> {\n const struct = <T>(props: T) => props;\n Object.setPrototypeOf(struct, WgslStructImpl);\n struct.propTypes = props;\n\n return struct as unknown as WgslStruct<Prettify<TProps>>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst WgslStructImpl = {\n type: 'struct',\n _label: undefined as string | undefined,\n\n get label(): string | undefined {\n return this._label;\n },\n\n $name(label: string) {\n this._label = label;\n return this;\n },\n\n toString(): string {\n return `struct:${this.label ?? '<unnamed>'}`;\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-QRLTUOBJ.cjs","../src/errors.ts"],"names":["prefix","invariant","condition","message","ResolutionError","_ResolutionError","cause","trace","entries","ancestor"],"mappings":"AAAA,6KAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,aAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,aAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CCOpe,IAAMA,CAAAA,CAAS,kBAAA,CAKR,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACmB,CACnB,EAAA,CAAID,CAAAA,CAEF,MAAA,CAKA,MAAM,IAAI,KAAA,CAAMF,CAAM,CAa1B,CASO,IAAMI,CAAAA,CAAN,MAAMC,EAAAA,QAAwB,KAAM,CACzC,WAAA,CACkBC,CAAAA,CACAC,CAAAA,CAChB,CACA,IAAIC,CAAAA,CAAUD,CAAAA,CAAM,GAAA,CAAKE,CAAAA,EAAa,CAAA,EAAA,EAAKA,CAAQ,CAAA,CAAA;AAQU;AA2CpB","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-QRLTUOBJ.cjs","sourcesContent":[null,"import type { TgpuBuffer } from './core/buffer/buffer';\nimport type { TgpuSlot } from './core/slot/slotTypes';\nimport type { TgpuVertexLayout } from './core/vertexLayout/vertexLayout';\nimport type { AnyData, Disarray } from './data/dataTypes';\nimport type { WgslArray } from './data/wgslTypes';\nimport type { TgpuBindGroupLayout } from './tgpuBindGroupLayout';\n\nconst prefix = 'Invariant failed';\n\n/**\n * Inspired by: https://github.com/alexreardon/tiny-invariant/blob/master/src/tiny-invariant.ts\n */\nexport function invariant(\n condition: unknown,\n message?: string | (() => string),\n): asserts condition {\n if (condition) {\n // Condition passed\n return;\n }\n\n // In production we strip the message but still throw\n if (process.env.NODE_ENV === 'production') {\n throw new Error(prefix);\n }\n\n // When not in production we allow the message to pass through\n // *This block will be removed in production builds*\n\n const provided = typeof message === 'function' ? message() : message;\n\n // Options:\n // 1. message provided: `${prefix}: ${provided}`\n // 2. message not provided: prefix\n const value = provided ? `${prefix}: ${provided}` : prefix;\n throw new Error(value);\n}\n\n/**\n * An error that happens during resolution of WGSL code.\n * Contains a trace of all ancestor resolvables in\n * which this error originated.\n *\n * @category Errors\n */\nexport class ResolutionError extends Error {\n constructor(\n public readonly cause: unknown,\n public readonly trace: unknown[],\n ) {\n let entries = trace.map((ancestor) => `- ${ancestor}`);\n\n // Showing only the root and leaf nodes.\n if (entries.length > 20) {\n entries = [...entries.slice(0, 11), '...', ...entries.slice(-10)];\n }\n\n super(\n `Resolution of the following tree failed: \\n${entries.join('\\n')}: ${cause && typeof cause === 'object' && 'message' in cause ? cause.message : cause}`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, ResolutionError.prototype);\n }\n\n appendToTrace(ancestor: unknown): ResolutionError {\n const newTrace = [ancestor, ...this.trace];\n\n return new ResolutionError(this.cause, newTrace);\n }\n}\n\n/**\n * @category Errors\n */\nexport class MissingSlotValueError extends Error {\n constructor(public readonly slot: TgpuSlot<unknown>) {\n super(`Missing value for '${slot}'`);\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingSlotValueError.prototype);\n }\n}\n\n/**\n * @category Errors\n */\nexport class NotUniformError extends Error {\n constructor(value: TgpuBuffer<AnyData>) {\n super(\n `Buffer '${value.label ?? '<unnamed>'}' is not bindable as a uniform. Use .$usage('uniform') to allow it.`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, NotUniformError.prototype);\n }\n}\n\nexport class MissingLinksError extends Error {\n constructor(fnLabel: string | undefined, externalNames: string[]) {\n super(\n `The function '${fnLabel ?? '<unnamed>'}' is missing links to the following external values: ${externalNames}.`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingLinksError.prototype);\n }\n}\n\nexport class MissingBindGroupsError extends Error {\n constructor(layouts: Iterable<TgpuBindGroupLayout>) {\n super(\n `Missing bind groups for layouts: '${[...layouts].map((layout) => layout.label ?? '<unnamed>').join(', ')}'. Please provide it using pipeline.with(layout, bindGroup).(...)`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingBindGroupsError.prototype);\n }\n}\n\nexport class MissingVertexBuffersError extends Error {\n constructor(layouts: Iterable<TgpuVertexLayout<WgslArray | Disarray>>) {\n super(\n `Missing vertex buffers for layouts: '${[...layouts].map((layout) => layout.label ?? '<unnamed>').join(', ')}'. Please provide it using pipeline.with(layout, buffer).(...)`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingVertexBuffersError.prototype);\n }\n}\n"]}
1
+ {"version":3,"sources":["/Users/marcinhawryluk/Documents/wigsill/packages/typegpu/dist/chunk-QRLTUOBJ.cjs","../src/errors.ts"],"names":["prefix","invariant","condition","message","ResolutionError","_ResolutionError","cause","trace","entries","ancestor"],"mappings":"AAAA,6KAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,aAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,aAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CCOpe,IAAMA,CAAAA,CAAS,kBAAA,CAKR,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACmB,CACnB,EAAA,CAAID,CAAAA,CAEF,MAAA,CAKA,MAAM,IAAI,KAAA,CAAMF,CAAM,CAa1B,CASO,IAAMI,CAAAA,CAAN,MAAMC,EAAAA,QAAwB,KAAM,CACzC,WAAA,CACkBC,CAAAA,CACAC,CAAAA,CAChB,CACA,IAAIC,CAAAA,CAAUD,CAAAA,CAAM,GAAA,CAAKE,CAAAA,EAAa,CAAA,EAAA,EAAKA,CAAQ,CAAA,CAAA;AAQU;AA2CpB","file":"/Users/marcinhawryluk/Documents/wigsill/packages/typegpu/dist/chunk-QRLTUOBJ.cjs","sourcesContent":[null,"import type { TgpuBuffer } from './core/buffer/buffer';\nimport type { TgpuSlot } from './core/slot/slotTypes';\nimport type { TgpuVertexLayout } from './core/vertexLayout/vertexLayout';\nimport type { AnyData, Disarray } from './data/dataTypes';\nimport type { WgslArray } from './data/wgslTypes';\nimport type { TgpuBindGroupLayout } from './tgpuBindGroupLayout';\n\nconst prefix = 'Invariant failed';\n\n/**\n * Inspired by: https://github.com/alexreardon/tiny-invariant/blob/master/src/tiny-invariant.ts\n */\nexport function invariant(\n condition: unknown,\n message?: string | (() => string),\n): asserts condition {\n if (condition) {\n // Condition passed\n return;\n }\n\n // In production we strip the message but still throw\n if (process.env.NODE_ENV === 'production') {\n throw new Error(prefix);\n }\n\n // When not in production we allow the message to pass through\n // *This block will be removed in production builds*\n\n const provided = typeof message === 'function' ? message() : message;\n\n // Options:\n // 1. message provided: `${prefix}: ${provided}`\n // 2. message not provided: prefix\n const value = provided ? `${prefix}: ${provided}` : prefix;\n throw new Error(value);\n}\n\n/**\n * An error that happens during resolution of WGSL code.\n * Contains a trace of all ancestor resolvables in\n * which this error originated.\n *\n * @category Errors\n */\nexport class ResolutionError extends Error {\n constructor(\n public readonly cause: unknown,\n public readonly trace: unknown[],\n ) {\n let entries = trace.map((ancestor) => `- ${ancestor}`);\n\n // Showing only the root and leaf nodes.\n if (entries.length > 20) {\n entries = [...entries.slice(0, 11), '...', ...entries.slice(-10)];\n }\n\n super(\n `Resolution of the following tree failed: \\n${entries.join('\\n')}: ${cause && typeof cause === 'object' && 'message' in cause ? cause.message : cause}`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, ResolutionError.prototype);\n }\n\n appendToTrace(ancestor: unknown): ResolutionError {\n const newTrace = [ancestor, ...this.trace];\n\n return new ResolutionError(this.cause, newTrace);\n }\n}\n\n/**\n * @category Errors\n */\nexport class MissingSlotValueError extends Error {\n constructor(public readonly slot: TgpuSlot<unknown>) {\n super(`Missing value for '${slot}'`);\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingSlotValueError.prototype);\n }\n}\n\n/**\n * @category Errors\n */\nexport class NotUniformError extends Error {\n constructor(value: TgpuBuffer<AnyData>) {\n super(\n `Buffer '${value.label ?? '<unnamed>'}' is not bindable as a uniform. Use .$usage('uniform') to allow it.`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, NotUniformError.prototype);\n }\n}\n\nexport class MissingLinksError extends Error {\n constructor(fnLabel: string | undefined, externalNames: string[]) {\n super(\n `The function '${fnLabel ?? '<unnamed>'}' is missing links to the following external values: ${externalNames}.`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingLinksError.prototype);\n }\n}\n\nexport class MissingBindGroupsError extends Error {\n constructor(layouts: Iterable<TgpuBindGroupLayout>) {\n super(\n `Missing bind groups for layouts: '${[...layouts].map((layout) => layout.label ?? '<unnamed>').join(', ')}'. Please provide it using pipeline.with(layout, bindGroup).(...)`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingBindGroupsError.prototype);\n }\n}\n\nexport class MissingVertexBuffersError extends Error {\n constructor(layouts: Iterable<TgpuVertexLayout<WgslArray | Disarray>>) {\n super(\n `Missing vertex buffers for layouts: '${[...layouts].map((layout) => layout.label ?? '<unnamed>').join(', ')}'. Please provide it using pipeline.with(layout, buffer).(...)`,\n );\n\n // Set the prototype explicitly.\n Object.setPrototypeOf(this, MissingVertexBuffersError.prototype);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/iwo/Projects/wigsill/packages/typegpu/dist/data/index.cjs"],"names":[],"mappings":"AAAA,kIAAsjB,yDAAuQ,m5HAAq6C","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/data/index.cjs"}
1
+ {"version":3,"sources":["/Users/marcinhawryluk/Documents/wigsill/packages/typegpu/dist/data/index.cjs"],"names":[],"mappings":"AAAA,kIAAsjB,yDAAuQ,m5HAAq6C","file":"/Users/marcinhawryluk/Documents/wigsill/packages/typegpu/dist/data/index.cjs"}