typegpu 0.9.0 → 0.10.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.
- package/README.md +1 -1
- package/builtin-DdtWpk2t.js +818 -0
- package/builtin-DdtWpk2t.js.map +1 -0
- package/chunk-BYypO7fO.js +18 -0
- package/common/index.d.ts +8 -23
- package/common/index.d.ts.map +1 -0
- package/common/index.js +7 -5
- package/common/index.js.map +1 -1
- package/data/index.d.ts +7 -401
- package/data/index.d.ts.map +1 -0
- package/data/index.js +164 -1
- package/data/index.js.map +1 -1
- package/deepEqual-DQxK4vdp.js +413 -0
- package/deepEqual-DQxK4vdp.js.map +1 -0
- package/extensions-DIVuAfBM.js +2032 -0
- package/extensions-DIVuAfBM.js.map +1 -0
- package/fullScreenTriangle-CfFyQd_0.js +543 -0
- package/fullScreenTriangle-CfFyQd_0.js.map +1 -0
- package/index.d.ts +124 -310
- package/index.d.ts.map +1 -0
- package/index.js +6282 -153
- package/index.js.map +1 -1
- package/indexNamedExports-oL6tyaJ9.d.ts +5697 -0
- package/indexNamedExports-oL6tyaJ9.d.ts.map +1 -0
- package/operators-d-PMVTo7.js +4158 -0
- package/operators-d-PMVTo7.js.map +1 -0
- package/package.json +3 -2
- package/std/index.d.ts +7 -621
- package/std/index.d.ts.map +1 -0
- package/std/index.js +165 -1
- package/std/index.js.map +1 -1
- package/texture-BagDrrks.js +205 -0
- package/texture-BagDrrks.js.map +1 -0
- package/chunk-5ABKYSJD.js +0 -2
- package/chunk-5ABKYSJD.js.map +0 -1
- package/chunk-D5UYO3OX.js +0 -3
- package/chunk-D5UYO3OX.js.map +0 -1
- package/chunk-EHLRP4V2.js +0 -2
- package/chunk-EHLRP4V2.js.map +0 -1
- package/chunk-LMPPDGRD.js +0 -2
- package/chunk-LMPPDGRD.js.map +0 -1
- package/chunk-MBB2XFH6.js +0 -2
- package/chunk-MBB2XFH6.js.map +0 -1
- package/chunk-SHSILTWI.js +0 -10
- package/chunk-SHSILTWI.js.map +0 -1
- package/comptime-DKpw1IVu.d.ts +0 -28
- package/matrix-C4IFKU1R.d.ts +0 -123
- package/tgpuConstant-BOn7U_lv.d.ts +0 -4031
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions-DIVuAfBM.js","names":[],"sources":["../src/core/texture/textureFormats.ts","../src/std/numeric.ts","../src/std/array.ts","../src/std/bitcast.ts","../src/std/packing.ts","../src/wgslExtensions.ts","../src/std/boolean.ts","../src/std/discard.ts","../src/std/matrix.ts","../src/std/atomic.ts","../src/std/derivative.ts","../src/std/texture.ts","../src/std/subgroup.ts","../src/std/extensions.ts"],"sourcesContent":["import { f32, i32, u32 } from '../../data/numeric.ts';\nimport { vec4f, vec4i, vec4u } from '../../data/vector.ts';\nimport type {\n F32,\n I32,\n U32,\n Vec4f,\n Vec4i,\n Vec4u,\n} from '../../data/wgslTypes.ts';\n\nexport type ViewDimensionToDimension = {\n '1d': '1d';\n '2d': '2d';\n '2d-array': '2d';\n '3d': '3d';\n cube: '2d';\n 'cube-array': '2d';\n};\n\nexport type StorageTextureFormats =\n | 'rgba8unorm'\n | 'rgba8snorm'\n | 'rgba8uint'\n | 'rgba8sint'\n | 'rgba16unorm'\n | 'rgba16snorm'\n | 'rgba16uint'\n | 'rgba16sint'\n | 'rgba16float'\n | 'rg8unorm'\n | 'rg8snorm'\n | 'rg8uint'\n | 'rg8sint'\n | 'rg16unorm'\n | 'rg16snorm'\n | 'rg16uint'\n | 'rg16sint'\n | 'rg16float'\n | 'r32uint'\n | 'r32sint'\n | 'r32float'\n | 'rg32uint'\n | 'rg32sint'\n | 'rg32float'\n | 'rgba32uint'\n | 'rgba32sint'\n | 'rgba32float'\n | 'bgra8unorm'\n | 'r8unorm'\n | 'r8snorm'\n | 'r8uint'\n | 'r8sint'\n | 'r16unorm'\n | 'r16snorm'\n | 'r16uint'\n | 'r16sint'\n | 'r16float'\n | 'rgb10a2unorm'\n | 'rgb10a2uint'\n | 'rg11b10ufloat';\n\ntype ParseChannelType<T extends GPUTextureFormat> = T extends\n `${string}uint${string}` ? 'u32'\n : T extends `${string}sint${string}` ? 'i32'\n : 'f32';\n\ntype ChannelTypeToSampleType<T extends 'f32' | 'i32' | 'u32'> = {\n f32: F32;\n i32: I32;\n u32: U32;\n}[T];\n\ntype ChannelTypeToVectorType<T extends 'f32' | 'i32' | 'u32'> = {\n f32: Vec4f;\n i32: Vec4i;\n u32: Vec4u;\n}[T];\n\nexport type TextureFormats = {\n [K in GPUTextureFormat]: {\n channelType: ChannelTypeToSampleType<ParseChannelType<K>>;\n vectorType: ChannelTypeToVectorType<ParseChannelType<K>>;\n };\n};\n\n// Runtime\n\nexport type AspectInfo = {\n readonly channelType: F32 | I32 | U32;\n readonly vectorType: Vec4f | Vec4i | Vec4u;\n readonly sampleTypes: readonly GPUTextureSampleType[];\n};\n\nexport type TextureFormatInfo = {\n readonly channelType: F32 | I32 | U32;\n readonly vectorType: Vec4f | Vec4i | Vec4u;\n readonly texelSize: number | 'non-copyable';\n readonly sampleTypes: readonly GPUTextureSampleType[];\n readonly canRenderAttachment: boolean;\n readonly depthAspect?: AspectInfo & {\n readonly texelSize: number | 'non-copyable';\n };\n readonly stencilAspect?: AspectInfo & { readonly texelSize: number };\n};\n\nconst DEPTH_ASPECT_NON_COPYABLE = {\n channelType: f32,\n vectorType: vec4f,\n sampleTypes: ['depth', 'unfilterable-float'],\n texelSize: 'non-copyable',\n} as const;\n\nconst DEPTH_ASPECT_16 = {\n channelType: f32,\n vectorType: vec4f,\n sampleTypes: ['depth', 'unfilterable-float'],\n texelSize: 2,\n} as const;\n\nconst DEPTH_ASPECT_32 = {\n channelType: f32,\n vectorType: vec4f,\n sampleTypes: ['depth', 'unfilterable-float'],\n texelSize: 4,\n} as const;\n\nconst STENCIL_ASPECT = {\n channelType: u32,\n vectorType: vec4u,\n sampleTypes: ['uint'],\n texelSize: 1,\n} as const;\n\nconst formatInfoCache = new Map<GPUTextureFormat, TextureFormatInfo>();\n\nexport function getTextureFormatInfo(\n format: GPUTextureFormat,\n): TextureFormatInfo {\n let info = formatInfoCache.get(format);\n if (info === undefined) {\n info = createFormatInfo(format);\n formatInfoCache.set(format, info);\n }\n return info;\n}\n\nfunction createFormatInfo(format: GPUTextureFormat): TextureFormatInfo {\n const channelType = parseChannelType(format);\n const depthAspect = getDepthAspect(format);\n const hasStencil = format.includes('stencil');\n\n return {\n channelType,\n vectorType: channelType === u32\n ? vec4u\n : channelType === i32\n ? vec4i\n : vec4f,\n texelSize: parseTexelSize(format),\n sampleTypes: parseSampleTypes(format),\n canRenderAttachment: canRenderAttachment(format),\n ...(depthAspect && { depthAspect }),\n ...(hasStencil && { stencilAspect: STENCIL_ASPECT }),\n };\n}\n\nfunction getDepthAspect(format: GPUTextureFormat) {\n if (format === 'depth16unorm') return DEPTH_ASPECT_16;\n if (format === 'depth32float' || format === 'depth32float-stencil8') {\n return DEPTH_ASPECT_32;\n }\n if (format === 'depth24plus' || format === 'depth24plus-stencil8') {\n return DEPTH_ASPECT_NON_COPYABLE;\n }\n return undefined;\n}\n\nfunction canRenderAttachment(format: GPUTextureFormat): boolean {\n if (\n format.startsWith('bc') ||\n format.startsWith('etc2') ||\n format.startsWith('eac') ||\n format.startsWith('astc')\n ) {\n return false;\n }\n if (format === 'rgb9e5ufloat') return false;\n return true;\n}\n\nfunction parseChannelType(format: GPUTextureFormat): F32 | I32 | U32 {\n if (format === 'stencil8') return u32;\n if (format.includes('uint')) return u32;\n if (format.includes('sint')) return i32;\n return f32;\n}\n\nfunction parseTexelSize(format: GPUTextureFormat): number | 'non-copyable' {\n // Standard formats: channel count encoded in prefix length (r=1, rg=2, rgba/bgra=4)\n const [, channels, bits] = format.match(/^(rgba|bgra|rg|r)(8|16|32)/) ?? [];\n if (channels && bits) {\n return (channels.length * Number(bits)) / 8;\n }\n\n // Depth/stencil\n if (format === 'stencil8') return 1;\n if (format === 'depth16unorm') return 2;\n if (format === 'depth32float') return 4;\n if (format === 'depth32float-stencil8') return 5;\n // depth24plus formats have undefined copy size\n if (format === 'depth24plus' || format === 'depth24plus-stencil8') {\n return 'non-copyable';\n }\n\n // Compressed: 8-byte blocks (bc1, bc4, etc2-rgb8*, eac-r11*)\n if (/^(bc[14]-|etc2-rgb8|eac-r11)/.test(format)) return 8;\n // Compressed: 16-byte blocks (bc2-7, astc, etc2-rgba8*, eac-rg11*)\n if (/^(bc|astc-|etc2-rgba|eac-rg)/.test(format)) return 16;\n\n // Packed 32-bit (rgb9e5ufloat, rgb10a2unorm, rgb10a2uint, rg11b10ufloat)\n return 4;\n}\n\nfunction parseSampleTypes(format: string): readonly GPUTextureSampleType[] {\n if (format === 'stencil8') return ['uint'];\n if (format.includes('uint')) return ['uint'];\n if (format.includes('sint')) return ['sint'];\n if (format.includes('depth')) return ['depth', 'unfilterable-float'];\n if (/^(r|rg|rgba)16(u|s)norm$/.test(format)) return ['unfilterable-float'];\n return ['float', 'unfilterable-float'];\n}\n\nconst FLOAT32_FORMATS = new Set(['r32float', 'rg32float', 'rgba32float']);\n\nexport function getEffectiveSampleTypes(\n device: GPUDevice,\n format: GPUTextureFormat,\n): readonly GPUTextureSampleType[] {\n if (\n FLOAT32_FORMATS.has(format) && !device.features.has('float32-filterable')\n ) {\n return ['unfilterable-float'];\n }\n return getTextureFormatInfo(format).sampleTypes;\n}\n","import { dualImpl, MissingCpuImplError } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport { mat2x2f, mat3x3f, mat4x4f } from '../data/matrix.ts';\nimport { smoothstepScalar } from '../data/numberOps.ts';\nimport {\n abstractFloat,\n abstractInt,\n f16,\n f32,\n i32,\n u32,\n} from '../data/numeric.ts';\nimport type { Snippet } from '../data/snippet.ts';\nimport { abstruct } from '../data/struct.ts';\nimport {\n vec2f,\n vec2h,\n vec2i,\n vec2u,\n vec3f,\n vec3h,\n vec3i,\n vec3u,\n vec4f,\n vec4h,\n vec4i,\n vec4u,\n} from '../data/vector.ts';\nimport { VectorOps } from '../data/vectorOps.ts';\nimport {\n type AnyFloat32VecInstance,\n type AnyFloatVecInstance,\n type AnyIntegerVecInstance,\n type AnyMatInstance,\n type AnyNumericVecInstance,\n type AnySignedVecInstance,\n type BaseData,\n isHalfPrecisionSchema,\n isVecInstance,\n type v2f,\n type v2h,\n type v2i,\n type v3f,\n type v3h,\n type v3i,\n type v4f,\n type v4h,\n type v4i,\n type Vec2f,\n type VecData,\n} from '../data/wgslTypes.ts';\nimport { SignatureNotSupportedError } from '../errors.ts';\nimport type { Infer } from '../shared/repr.ts';\nimport { unify } from '../tgsl/conversion.ts';\nimport type { ResolutionCtx } from '../types.ts';\nimport { mul, sub } from './operators.ts';\n\ntype NumVec = AnyNumericVecInstance;\n\n// helpers\n\nconst unaryIdentitySignature = (arg: BaseData) => {\n return {\n argTypes: [arg],\n returnType: arg,\n };\n};\n\nconst variadicUnifySignature = (...args: BaseData[]) => {\n const uargs = unify(args) ?? args;\n return ({\n argTypes: uargs,\n returnType: uargs[0] as BaseData,\n });\n};\n\nconst unifyRestrictedSignature = (restrict: BaseData[]) =>\n(\n ...args: BaseData[]\n) => {\n const uargs = unify(args, restrict);\n if (!uargs) {\n throw new SignatureNotSupportedError(args, restrict);\n }\n return ({\n argTypes: uargs,\n returnType: uargs[0] as BaseData,\n });\n};\n\nfunction variadicReduce<T>(fn: (a: T, b: T) => T) {\n return (fst: T, ...rest: T[]): T => {\n let acc = fst;\n for (const r of rest) {\n acc = fn(acc, r);\n }\n return acc;\n };\n}\n\nfunction variadicStitch(wrapper: string) {\n return (\n _ctx: ResolutionCtx,\n [fst, ...rest]: [fst: Snippet, ...rest: Snippet[]],\n ): string => {\n let acc = stitch`${fst}`;\n for (const r of rest) {\n acc = stitch`${wrapper}(${acc}, ${r})`;\n }\n return acc;\n };\n}\n\nconst anyFloatPrimitive = [f32, f16, abstractFloat];\nconst anyFloatVec = [\n vec2f,\n vec3f,\n vec4f,\n vec2h,\n vec3h,\n vec4h,\n];\nconst anyFloat = [...anyFloatPrimitive, ...anyFloatVec];\nconst anyConcreteIntegerPrimitive = [i32, u32];\nconst anyConcreteIntegerVec = [vec2i, vec3i, vec4i, vec2u, vec3u, vec4u];\nconst anyConcreteInteger = [\n ...anyConcreteIntegerPrimitive,\n ...anyConcreteIntegerVec,\n];\n\n// std\n\nfunction cpuAbs(value: number): number;\nfunction cpuAbs<T extends NumVec | number>(value: T): T;\nfunction cpuAbs<T extends NumVec | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.abs(value) as T;\n }\n return VectorOps.abs[value.kind](value) as T;\n}\n\nexport const abs = dualImpl({\n name: 'abs',\n signature: unaryIdentitySignature,\n normalImpl: cpuAbs,\n codegenImpl: (_ctx, [value]) => stitch`abs(${value})`,\n});\n\nfunction cpuAcos(value: number): number;\nfunction cpuAcos<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuAcos<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.acos(value) as T;\n }\n return VectorOps.acos[value.kind](value) as T;\n}\n\nexport const acos = dualImpl({\n name: 'acos',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuAcos,\n codegenImpl: (_ctx, [value]) => stitch`acos(${value})`,\n});\n\nfunction cpuAcosh(value: number): number;\nfunction cpuAcosh<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuAcosh<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.acosh(value) as T;\n }\n return VectorOps.acosh[value.kind](value) as T;\n}\n\nexport const acosh = dualImpl({\n name: 'acosh',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuAcosh,\n codegenImpl: (_ctx, [value]) => stitch`acosh(${value})`,\n});\n\nfunction cpuAsin(value: number): number;\nfunction cpuAsin<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuAsin<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.asin(value) as T;\n }\n return VectorOps.asin[value.kind](value) as T;\n}\n\nexport const asin = dualImpl({\n name: 'asin',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuAsin,\n codegenImpl: (_ctx, [value]) => stitch`asin(${value})`,\n});\n\nfunction cpuAsinh(value: number): number;\nfunction cpuAsinh<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuAsinh<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.asinh(value) as T;\n }\n return VectorOps.asinh[value.kind](value) as T;\n}\n\nexport const asinh = dualImpl({\n name: 'asinh',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuAsinh,\n codegenImpl: (_ctx, [value]) => stitch`asinh(${value})`,\n});\n\nfunction cpuAtan(value: number): number;\nfunction cpuAtan<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuAtan<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.atan(value) as T;\n }\n return VectorOps.atan[value.kind](value) as T;\n}\n\nexport const atan = dualImpl({\n name: 'atan',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuAtan,\n codegenImpl: (_ctx, [value]) => stitch`atan(${value})`,\n});\n\nfunction cpuAtanh(value: number): number;\nfunction cpuAtanh<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuAtanh<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.atanh(value) as T;\n }\n return VectorOps.atanh[value.kind](value) as T;\n}\n\nexport const atanh = dualImpl({\n name: 'atanh',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuAtanh,\n codegenImpl: (_ctx, [value]) => stitch`atanh(${value})`,\n});\n\nfunction cpuAtan2(y: number, x: number): number;\nfunction cpuAtan2<T extends AnyFloatVecInstance>(y: T, x: T): T;\nfunction cpuAtan2<T extends AnyFloatVecInstance | number>(y: T, x: T): T {\n if (typeof y === 'number' && typeof x === 'number') {\n return Math.atan2(y, x) as T;\n }\n return VectorOps.atan2[(y as AnyFloatVecInstance).kind](\n y as never,\n x as never,\n ) as T;\n}\n\nexport const atan2 = dualImpl({\n name: 'atan2',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuAtan2,\n codegenImpl: (_ctx, [y, x]) => stitch`atan2(${y}, ${x})`,\n});\n\nfunction cpuCeil(value: number): number;\nfunction cpuCeil<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuCeil<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.ceil(value) as T;\n }\n return VectorOps.ceil[value.kind](value) as T;\n}\n\nexport const ceil = dualImpl({\n name: 'ceil',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuCeil,\n codegenImpl: (_ctx, [value]) => stitch`ceil(${value})`,\n});\n\nfunction cpuClamp(value: number, low: number, high: number): number;\nfunction cpuClamp<T extends NumVec | number>(value: T, low: T, high: T): T;\nfunction cpuClamp<T extends NumVec | number>(value: T, low: T, high: T): T {\n if (typeof value === 'number') {\n return Math.min(Math.max(low as number, value), high as number) as T;\n }\n return VectorOps.clamp[value.kind](\n value,\n low as NumVec,\n high as NumVec,\n ) as T;\n}\n\nexport const clamp = dualImpl({\n name: 'clamp',\n signature: variadicUnifySignature,\n normalImpl: cpuClamp,\n codegenImpl: (_ctx, [value, low, high]) =>\n stitch`clamp(${value}, ${low}, ${high})`,\n});\n\nfunction cpuCos(value: number): number;\nfunction cpuCos<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuCos<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.cos(value) as T;\n }\n return VectorOps.cos[value.kind](value) as T;\n}\n\nexport const cos = dualImpl({\n name: 'cos',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuCos,\n codegenImpl: (_ctx, [value]) => stitch`cos(${value})`,\n});\n\nfunction cpuCosh(value: number): number;\nfunction cpuCosh<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuCosh<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.cosh(value) as T;\n }\n return VectorOps.cosh[value.kind](value) as T;\n}\n\nexport const cosh = dualImpl({\n name: 'cosh',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuCosh,\n codegenImpl: (_ctx, [value]) => stitch`cosh(${value})`,\n});\n\nfunction cpuCountLeadingZeros(value: number): number;\nfunction cpuCountLeadingZeros<T extends AnyIntegerVecInstance>(value: T): T;\nfunction cpuCountLeadingZeros<T extends AnyIntegerVecInstance | number>(\n _value: T,\n): T {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const countLeadingZeros = dualImpl<typeof cpuCountLeadingZeros>({\n name: 'countLeadingZeros',\n signature: unifyRestrictedSignature(anyConcreteInteger),\n normalImpl:\n 'CPU implementation for countLeadingZeros not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [value]) => stitch`countLeadingZeros(${value})`,\n});\n\nfunction cpuCountOneBits(value: number): number;\nfunction cpuCountOneBits<T extends AnyIntegerVecInstance>(value: T): T;\nfunction cpuCountOneBits<T extends AnyIntegerVecInstance | number>(\n _value: T,\n): T {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const countOneBits = dualImpl<typeof cpuCountOneBits>({\n name: 'countOneBits',\n signature: unifyRestrictedSignature(anyConcreteInteger),\n normalImpl:\n 'CPU implementation for countOneBits not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [value]) => stitch`countOneBits(${value})`,\n});\n\nfunction cpuCountTrailingZeros(value: number): number;\nfunction cpuCountTrailingZeros<T extends AnyIntegerVecInstance>(value: T): T;\nfunction cpuCountTrailingZeros<T extends AnyIntegerVecInstance | number>(\n _value: T,\n): T {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const countTrailingZeros = dualImpl<typeof cpuCountTrailingZeros>({\n name: 'countTrailingZeros',\n signature: unifyRestrictedSignature(anyConcreteInteger),\n normalImpl:\n 'CPU implementation for countTrailingZeros not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [value]) => stitch`countTrailingZeros(${value})`,\n});\n\nexport const cross = dualImpl({\n name: 'cross',\n signature: unifyRestrictedSignature([vec3f, vec3h]),\n normalImpl: <T extends v3f | v3h>(a: T, b: T): T =>\n VectorOps.cross[a.kind](a, b),\n codegenImpl: (_ctx, [a, b]) => stitch`cross(${a}, ${b})`,\n});\n\nfunction cpuDegrees(value: number): number;\nfunction cpuDegrees<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuDegrees<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return ((value * 180) / Math.PI) as T;\n }\n throw new MissingCpuImplError(\n 'CPU implementation for degrees on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n );\n}\n\nexport const degrees = dualImpl<typeof cpuDegrees>({\n name: 'degrees',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuDegrees,\n codegenImpl: (_ctx, [value]) => stitch`degrees(${value})`,\n});\n\nexport const determinant = dualImpl<(value: AnyMatInstance) => number>({\n name: 'determinant',\n signature: (arg) => {\n if (\n !(arg.type === 'mat2x2f' || arg.type === 'mat3x3f' ||\n arg.type === 'mat4x4f')\n ) {\n throw new SignatureNotSupportedError([arg], [mat2x2f, mat3x3f, mat4x4f]);\n }\n return { argTypes: [arg], returnType: f32 };\n },\n normalImpl:\n 'CPU implementation for determinant not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [value]) => stitch`determinant(${value})`,\n});\n\nfunction cpuDistance(a: number, b: number): number;\nfunction cpuDistance<T extends AnyFloatVecInstance>(a: T, b: T): number;\nfunction cpuDistance<T extends AnyFloatVecInstance | number>(\n a: T,\n b: T,\n): number {\n if (typeof a === 'number' && typeof b === 'number') {\n return Math.abs(a - b);\n }\n return length(\n sub(a as AnyFloatVecInstance, b as AnyFloatVecInstance),\n );\n}\n\nexport const distance = dualImpl({\n name: 'distance',\n signature: (...args) => {\n const uargs = unify(args, anyFloat);\n if (!uargs) {\n throw new SignatureNotSupportedError(args, anyFloat);\n }\n return {\n argTypes: uargs,\n returnType: isHalfPrecisionSchema(uargs[0]) ? f16 : f32,\n };\n },\n normalImpl: cpuDistance,\n codegenImpl: (_ctx, [a, b]) => stitch`distance(${a}, ${b})`,\n});\n\nexport const dot = dualImpl({\n name: 'dot',\n signature: (...args) => ({\n argTypes: args,\n returnType: (args[0] as VecData).primitive,\n }),\n normalImpl: <T extends NumVec>(lhs: T, rhs: T): number =>\n VectorOps.dot[lhs.kind](lhs, rhs),\n codegenImpl: (_ctx, [lhs, rhs]) => stitch`dot(${lhs}, ${rhs})`,\n});\n\nexport const dot4U8Packed = dualImpl<(e1: number, e2: number) => number>({\n name: 'dot4U8Packed',\n signature: { argTypes: [u32, u32], returnType: u32 },\n normalImpl:\n 'CPU implementation for dot4U8Packed not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [e1, e2]) => stitch`dot4U8Packed(${e1}, ${e2})`,\n});\n\nexport const dot4I8Packed = dualImpl<(e1: number, e2: number) => number>({\n name: 'dot4I8Packed',\n signature: { argTypes: [u32, u32], returnType: i32 },\n normalImpl:\n 'CPU implementation for dot4I8Packed not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [e1, e2]) => stitch`dot4I8Packed(${e1}, ${e2})`,\n});\n\nfunction cpuExp(value: number): number;\nfunction cpuExp<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuExp<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.exp(value) as T;\n }\n return VectorOps.exp[value.kind](value) as T;\n}\n\nexport const exp = dualImpl({\n name: 'exp',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuExp,\n codegenImpl: (_ctx, [value]) => stitch`exp(${value})`,\n});\n\nfunction cpuExp2(value: number): number;\nfunction cpuExp2<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuExp2<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return (2 ** value) as T;\n }\n return VectorOps.exp2[value.kind](value) as T;\n}\n\nexport const exp2 = dualImpl({\n name: 'exp2',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuExp2,\n codegenImpl: (_ctx, [value]) => stitch`exp2(${value})`,\n});\n\nfunction cpuExtractBits(e: number, offset: number, count: number): number;\nfunction cpuExtractBits<T extends AnyIntegerVecInstance>(\n e: T,\n offset: number,\n count: number,\n): T;\nfunction cpuExtractBits<T extends AnyIntegerVecInstance | number>(\n _e: T,\n _offset: number,\n _count: number,\n): T {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const extractBits = dualImpl<typeof cpuExtractBits>({\n name: 'extractBits',\n signature: (arg, _offset, _count) => {\n const argRestricted = unify([arg], anyConcreteInteger)?.[0];\n if (!argRestricted) {\n throw new SignatureNotSupportedError([arg], anyConcreteInteger);\n }\n return {\n argTypes: [argRestricted, u32, u32],\n returnType: argRestricted,\n };\n },\n normalImpl:\n 'CPU implementation for extractBits not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [e, offset, count]) =>\n stitch`extractBits(${e}, ${offset}, ${count})`,\n});\n\nexport const faceForward = dualImpl<\n <T extends AnyFloatVecInstance>(e1: T, e2: T, e3: T) => T\n>({\n name: 'faceForward',\n signature: unifyRestrictedSignature(anyFloatVec),\n normalImpl:\n 'CPU implementation for faceForward not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [e1, e2, e3]) => stitch`faceForward(${e1}, ${e2}, ${e3})`,\n});\n\nfunction cpuFirstLeadingBit(value: number): number;\nfunction cpuFirstLeadingBit<T extends AnyIntegerVecInstance>(value: T): T;\nfunction cpuFirstLeadingBit<T extends AnyIntegerVecInstance | number>(\n _value: T,\n): T {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const firstLeadingBit = dualImpl<typeof cpuFirstLeadingBit>({\n name: 'firstLeadingBit',\n signature: unaryIdentitySignature,\n normalImpl:\n 'CPU implementation for firstLeadingBit not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [value]) => stitch`firstLeadingBit(${value})`,\n});\n\nfunction cpuFirstTrailingBit(value: number): number;\nfunction cpuFirstTrailingBit<T extends AnyIntegerVecInstance>(value: T): T;\nfunction cpuFirstTrailingBit<T extends AnyIntegerVecInstance | number>(\n _value: T,\n): T {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const firstTrailingBit = dualImpl<typeof cpuFirstTrailingBit>({\n name: 'firstTrailingBit',\n signature: unifyRestrictedSignature(anyConcreteInteger),\n normalImpl:\n 'CPU implementation for firstTrailingBit not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [value]) => stitch`firstTrailingBit(${value})`,\n});\n\nfunction cpuFloor(value: number): number;\nfunction cpuFloor<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuFloor<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.floor(value) as T;\n }\n return VectorOps.floor[value.kind](value) as T;\n}\n\nexport const floor = dualImpl({\n name: 'floor',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuFloor,\n codegenImpl: (_ctx, [arg]) => stitch`floor(${arg})`,\n});\n\nfunction cpuFma(e1: number, e2: number, e3: number): number;\nfunction cpuFma<T extends AnyFloatVecInstance>(e1: T, e2: T, e3: T): T;\nfunction cpuFma<T extends AnyFloatVecInstance | number>(\n e1: T,\n e2: T,\n e3: T,\n): T {\n if (typeof e1 === 'number') {\n return (e1 * (e2 as number) + (e3 as number)) as T;\n }\n throw new MissingCpuImplError(\n 'CPU implementation for fma on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n );\n}\n\nexport const fma = dualImpl({\n name: 'fma',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuFma,\n codegenImpl: (_ctx, [e1, e2, e3]) => stitch`fma(${e1}, ${e2}, ${e3})`,\n});\n\nfunction cpuFract(value: number): number;\nfunction cpuFract<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuFract<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return (value - Math.floor(value)) as T;\n }\n return VectorOps.fract[value.kind](value) as T;\n}\n\nexport const fract = dualImpl({\n name: 'fract',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuFract,\n codegenImpl: (_ctx, [a]) => stitch`fract(${a})`,\n});\n\nconst FrexpResults = {\n f32: abstruct({ fract: f32, exp: i32 }),\n f16: abstruct({ fract: f16, exp: i32 }),\n abstractFloat: abstruct({ fract: abstractFloat, exp: abstractInt }),\n vec2f: abstruct({ fract: vec2f, exp: vec2i }),\n vec3f: abstruct({ fract: vec3f, exp: vec3i }),\n vec4f: abstruct({ fract: vec4f, exp: vec4i }),\n vec2h: abstruct({ fract: vec2h, exp: vec2i }),\n vec3h: abstruct({ fract: vec3h, exp: vec3i }),\n vec4h: abstruct({ fract: vec4h, exp: vec4i }),\n} as const;\n\ntype FrexpOverload = {\n (value: number): Infer<typeof FrexpResults['f32']>;\n <T extends AnyFloatVecInstance>(\n value: T,\n ): Infer<typeof FrexpResults[T['kind']]>;\n};\n\nexport const frexp = dualImpl<FrexpOverload>({\n name: 'frexp',\n normalImpl:\n 'CPU implementation for frexp not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n signature: (value) => {\n const returnType = FrexpResults[value.type as keyof typeof FrexpResults];\n\n if (!returnType) {\n throw new SignatureNotSupportedError([value], anyFloat);\n }\n\n return { argTypes: [value], returnType };\n },\n codegenImpl: (_ctx, [value]) => stitch`frexp(${value})`,\n});\n\nfunction cpuInsertBits(\n e: number,\n newbits: number,\n offset: number,\n count: number,\n): number;\nfunction cpuInsertBits<T extends AnyIntegerVecInstance>(\n e: T,\n newbits: T,\n offset: number,\n count: number,\n): T;\nfunction cpuInsertBits<T extends AnyIntegerVecInstance | number>(\n _e: T,\n _newbits: T,\n _offset: number,\n _count: number,\n): T {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const insertBits = dualImpl<typeof cpuInsertBits>({\n name: 'insertBits',\n signature: (e, newbits, _offset, _count) => {\n const uargs = unify([e, newbits], anyConcreteInteger);\n if (!uargs) {\n throw new SignatureNotSupportedError([e, newbits], anyConcreteInteger);\n }\n return {\n argTypes: [...uargs, u32, u32],\n returnType: uargs[0],\n };\n },\n normalImpl:\n 'CPU implementation for insertBits not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [e, newbits, offset, count]) =>\n stitch`insertBits(${e}, ${newbits}, ${offset}, ${count})`,\n});\n\nfunction cpuInverseSqrt(value: number): number;\nfunction cpuInverseSqrt<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuInverseSqrt<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return (1 / Math.sqrt(value)) as T;\n }\n throw new MissingCpuImplError(\n 'CPU implementation for inverseSqrt on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n );\n}\n\nexport const inverseSqrt = dualImpl({\n name: 'inverseSqrt',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuInverseSqrt,\n codegenImpl: (_ctx, [value]) => stitch`inverseSqrt(${value})`,\n});\n\nfunction cpuLdexp(e1: number, e2: number): number;\nfunction cpuLdexp<T extends v2f | v2h>(e1: T, e2: v2i): T;\nfunction cpuLdexp<T extends v3f | v3h>(e1: T, e2: v3i): T;\nfunction cpuLdexp<T extends v4f | v4h>(e1: T, e2: v4i): T;\nfunction cpuLdexp<T extends AnyFloatVecInstance | number>(\n _e1: T,\n _e2: AnyIntegerVecInstance | number,\n): T {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const ldexp = dualImpl<typeof cpuLdexp>({\n name: 'ldexp',\n signature: (e1, _e2) => {\n switch (e1.type) {\n case 'abstractFloat':\n return { argTypes: [e1, abstractInt], returnType: e1 };\n case 'f32':\n case 'f16':\n return { argTypes: [e1, i32], returnType: e1 };\n case 'vec2f':\n case 'vec2h':\n return { argTypes: [e1, vec2i], returnType: e1 };\n case 'vec3f':\n case 'vec3h':\n return { argTypes: [e1, vec3i], returnType: e1 };\n case 'vec4f':\n case 'vec4h':\n return { argTypes: [e1, vec4i], returnType: e1 };\n default:\n throw new Error(\n `Unsupported data type for ldexp: ${e1.type}. Supported types are abstractFloat, f32, f16, vec2f, vec2h, vec3f, vec3h, vec4f, vec4h.`,\n );\n }\n },\n normalImpl:\n 'CPU implementation for ldexp not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [e1, e2]) => stitch`ldexp(${e1}, ${e2})`,\n});\n\nfunction cpuLength(value: number): number;\nfunction cpuLength<T extends AnyFloatVecInstance>(value: T): number;\nfunction cpuLength<T extends AnyFloatVecInstance | number>(value: T): number {\n if (typeof value === 'number') {\n return Math.abs(value);\n }\n return VectorOps.length[value.kind](value);\n}\n\nexport const length = dualImpl({\n name: 'length',\n signature: (arg) => {\n const uarg = unify([arg], anyFloat);\n if (!uarg) {\n throw new SignatureNotSupportedError([arg], anyFloat);\n }\n return {\n argTypes: uarg,\n returnType: isHalfPrecisionSchema(uarg[0]) ? f16 : f32,\n };\n },\n normalImpl: cpuLength,\n codegenImpl: (_ctx, [arg]) => stitch`length(${arg})`,\n});\n\nfunction cpuLog(value: number): number;\nfunction cpuLog<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuLog<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.log(value) as T;\n }\n return VectorOps.log[value.kind](value) as T;\n}\n\nexport const log = dualImpl({\n name: 'log',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuLog,\n codegenImpl: (_ctx, [value]) => stitch`log(${value})`,\n});\n\nfunction cpuLog2(value: number): number;\nfunction cpuLog2<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuLog2<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.log2(value) as T;\n }\n return VectorOps.log2[value.kind](value) as T;\n}\n\nexport const log2 = dualImpl({\n name: 'log2',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuLog2,\n codegenImpl: (_ctx, [value]) => stitch`log2(${value})`,\n});\n\nfunction cpuMax(a: number, b: number): number;\nfunction cpuMax<T extends NumVec>(a: T, b: T): T;\nfunction cpuMax<T extends NumVec | number>(a: T, b: T): T {\n if (typeof a === 'number') {\n return Math.max(a, b as number) as T;\n }\n return VectorOps.max[a.kind](a, b as NumVec) as T;\n}\n\ntype VariadicOverload = {\n (fst: number, ...rest: number[]): number;\n <T extends NumVec>(fst: T, ...rest: T[]): T;\n};\n\nexport const max = dualImpl({\n name: 'max',\n signature: variadicUnifySignature,\n normalImpl: variadicReduce(cpuMax) as VariadicOverload,\n codegenImpl: variadicStitch('max'),\n});\n\nfunction cpuMin(a: number, b: number): number;\nfunction cpuMin<T extends NumVec>(a: T, b: T): T;\nfunction cpuMin<T extends NumVec | number>(a: T, b: T): T {\n if (typeof a === 'number') {\n return Math.min(a, b as number) as T;\n }\n return VectorOps.min[a.kind](a, b as NumVec) as T;\n}\n\nexport const min = dualImpl({\n name: 'min',\n signature: variadicUnifySignature,\n normalImpl: variadicReduce(cpuMin) as VariadicOverload,\n codegenImpl: variadicStitch('min'),\n});\n\nfunction cpuMix(e1: number, e2: number, e3: number): number;\nfunction cpuMix<T extends AnyFloatVecInstance>(e1: T, e2: T, e3: number): T;\nfunction cpuMix<T extends AnyFloatVecInstance>(e1: T, e2: T, e3: T): T;\nfunction cpuMix<T extends AnyFloatVecInstance | number>(\n e1: T,\n e2: T,\n e3: T,\n): T {\n if (typeof e1 === 'number') {\n if (typeof e3 !== 'number' || typeof e2 !== 'number') {\n throw new Error(\n 'When e1 and e2 are numbers, the blend factor must be a number.',\n );\n }\n return (e1 * (1 - e3) + e2 * e3) as T;\n }\n\n if (typeof e1 === 'number' || typeof e2 === 'number') {\n throw new Error('e1 and e2 need to both be vectors of the same kind.');\n }\n\n return VectorOps.mix[e1.kind](e1, e2, e3) as T;\n}\n\nexport const mix = dualImpl({\n name: 'mix',\n signature: (e1, e2, e3) => {\n if (e1.type.startsWith('vec') && !e3.type.startsWith('vec')) {\n const uarg = unify([e3], [(e1 as unknown as Vec2f).primitive]);\n if (!uarg) {\n throw new SignatureNotSupportedError([e3], [\n (e1 as unknown as Vec2f).primitive,\n ]);\n }\n return { argTypes: [e1, e2, uarg[0]], returnType: e1 };\n }\n const uargs = unify([e1, e2, e3], anyFloat);\n if (!uargs) {\n throw new SignatureNotSupportedError([e1, e2, e3], anyFloat);\n }\n return { argTypes: uargs, returnType: uargs[0] };\n },\n normalImpl: cpuMix,\n codegenImpl: (_ctx, [e1, e2, e3]) => stitch`mix(${e1}, ${e2}, ${e3})`,\n});\n\nconst ModfResult = {\n f32: abstruct({ fract: f32, whole: f32 }),\n f16: abstruct({ fract: f16, whole: f16 }),\n abstractFloat: abstruct({ fract: abstractFloat, whole: abstractFloat }),\n vec2f: abstruct({ fract: vec2f, whole: vec2f }),\n vec3f: abstruct({ fract: vec3f, whole: vec3f }),\n vec4f: abstruct({ fract: vec4f, whole: vec4f }),\n vec2h: abstruct({ fract: vec2h, whole: vec2h }),\n vec3h: abstruct({ fract: vec3h, whole: vec3h }),\n vec4h: abstruct({ fract: vec4h, whole: vec4h }),\n} as const;\n\ntype ModfOverload = {\n (value: number): Infer<typeof ModfResult['f32']>;\n <T extends AnyFloatVecInstance>(\n value: T,\n ): Infer<typeof ModfResult[T['kind']]>;\n};\nfunction cpuModf(e: number): Infer<typeof ModfResult['f32']>;\nfunction cpuModf<T extends AnyFloatVecInstance>(\n e: T,\n): Infer<typeof ModfResult[T['kind']]>;\nfunction cpuModf<T extends AnyFloatVecInstance | number>(\n _value: T,\n): Infer<typeof ModfResult[keyof typeof ModfResult]> {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const modf: ModfOverload = dualImpl<typeof cpuModf>({\n name: 'modf',\n signature: (e) => {\n const returnType = ModfResult[e.type as keyof typeof ModfResult];\n\n if (!returnType) {\n throw new Error(\n `Unsupported data type for modf: ${e.type}. Supported types are f32, f16, abstractFloat, vec2f, vec3f, vec4f, vec2h, vec3h, vec4h.`,\n );\n }\n\n return { argTypes: [e], returnType };\n },\n normalImpl:\n 'CPU implementation for modf not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [value]) => stitch`modf(${value})`,\n});\n\nexport const normalize = dualImpl({\n name: 'normalize',\n signature: unifyRestrictedSignature(anyFloatVec),\n normalImpl: <T extends AnyFloatVecInstance>(v: T): T =>\n VectorOps.normalize[v.kind](v),\n codegenImpl: (_ctx, [value]) => stitch`normalize(${value})`,\n});\n\nfunction powCpu(base: number, exponent: number): number;\nfunction powCpu<T extends AnyFloatVecInstance>(\n base: T,\n exponent: T,\n): T;\nfunction powCpu<T extends AnyFloatVecInstance | number>(\n base: T,\n exponent: T,\n): T {\n if (typeof base === 'number' && typeof exponent === 'number') {\n return (base ** exponent) as T;\n }\n if (isVecInstance(base) && isVecInstance(exponent)) {\n return VectorOps.pow[base.kind](base, exponent) as T;\n }\n throw new Error(`Invalid arguments to pow(): '${base}' '${exponent}'`);\n}\n\nexport const pow = dualImpl({\n name: 'pow',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: powCpu,\n codegenImpl: (_ctx, [lhs, rhs]) => stitch`pow(${lhs}, ${rhs})`,\n});\nfunction cpuQuantizeToF16(value: number): number;\nfunction cpuQuantizeToF16<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuQuantizeToF16<T extends AnyFloat32VecInstance | number>(\n _value: T,\n): T {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const quantizeToF16 = dualImpl<typeof cpuQuantizeToF16>({\n name: 'quantizeToF16',\n signature: (arg) => {\n const candidates = [vec2f, vec3f, vec4f, f32];\n const uarg = unify([arg], candidates)?.[0];\n if (!uarg) {\n throw new SignatureNotSupportedError([arg], candidates);\n }\n return { argTypes: [uarg], returnType: uarg };\n },\n normalImpl:\n 'CPU implementation for quantizeToF16 not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [value]) => stitch`quantizeToF16(${value})`,\n});\n\nfunction cpuRadians(value: number): number;\nfunction cpuRadians<T extends AnyFloatVecInstance | number>(value: T): T;\nfunction cpuRadians<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return ((value * Math.PI) / 180) as T;\n }\n throw new MissingCpuImplError(\n 'CPU implementation for radians on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n );\n}\n\nexport const radians = dualImpl({\n name: 'radians',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuRadians,\n codegenImpl: (_ctx, [value]) => stitch`radians(${value})`,\n});\n\nexport const reflect = dualImpl({\n name: 'reflect',\n signature: (...args) => {\n const uargs = unify(args, anyFloatVec);\n if (!uargs) {\n throw new SignatureNotSupportedError(args, anyFloatVec);\n }\n return {\n argTypes: uargs,\n returnType: uargs[0],\n };\n },\n normalImpl: <T extends AnyFloatVecInstance>(e1: T, e2: T): T =>\n sub(e1, mul(2 * dot(e2, e1), e2)),\n codegenImpl: (_ctx, [e1, e2]) => stitch`reflect(${e1}, ${e2})`,\n});\n\nexport const refract = dualImpl<\n <T extends AnyFloatVecInstance>(e1: T, e2: T, e3: number) => T\n>({\n name: 'refract',\n normalImpl:\n 'CPU implementation for refract not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [e1, e2, e3]) => stitch`refract(${e1}, ${e2}, ${e3})`,\n signature: (e1, e2, _e3) => ({\n argTypes: [\n e1,\n e2,\n isHalfPrecisionSchema(e1) ? f16 : f32,\n ],\n returnType: e1,\n }),\n});\nfunction cpuReverseBits(value: number): number;\nfunction cpuReverseBits<T extends AnyIntegerVecInstance>(value: T): T;\nfunction cpuReverseBits<T extends AnyIntegerVecInstance | number>(\n _value: T,\n): T {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const reverseBits = dualImpl<typeof cpuReverseBits>({\n name: 'reverseBits',\n signature: unifyRestrictedSignature(anyConcreteInteger),\n normalImpl:\n 'CPU implementation for reverseBits not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [value]) => stitch`reverseBits(${value})`,\n});\n\nfunction cpuRound(value: number): number;\nfunction cpuRound<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuRound<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n const floor = Math.floor(value);\n if (value === floor + 0.5) {\n if (floor % 2 === 0) {\n return floor as T;\n }\n return (floor + 1) as T;\n }\n return Math.round(value) as T;\n }\n throw new MissingCpuImplError(\n 'CPU implementation for round on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n );\n}\n\nexport const round = dualImpl({\n name: 'round',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuRound,\n codegenImpl: (_ctx, [value]) => stitch`round(${value})`,\n});\n\nfunction cpuSaturate(value: number): number;\nfunction cpuSaturate<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuSaturate<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.max(0, Math.min(1, value)) as T;\n }\n throw new MissingCpuImplError(\n 'CPU implementation for saturate on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n );\n}\n\nexport const saturate = dualImpl({\n name: 'saturate',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuSaturate,\n codegenImpl: (_ctx, [value]) => stitch`saturate(${value})`,\n});\n\nfunction cpuSign(e: number): number;\nfunction cpuSign<T extends AnySignedVecInstance>(e: T): T;\nfunction cpuSign<T extends AnySignedVecInstance | number>(e: T): T {\n if (typeof e === 'number') {\n return Math.sign(e) as T;\n }\n return VectorOps.sign[e.kind](e) as T;\n}\n\nexport const sign = dualImpl({\n name: 'sign',\n signature: (arg) => {\n const candidates = [...anyFloat, i32, vec2i, vec3i, vec4i];\n const uarg = unify([arg], candidates)?.[0];\n if (!uarg) {\n throw new SignatureNotSupportedError([arg], candidates);\n }\n return { argTypes: [uarg], returnType: uarg };\n },\n normalImpl: cpuSign,\n codegenImpl: (_ctx, [e]) => stitch`sign(${e})`,\n});\n\nfunction cpuSin(value: number): number;\nfunction cpuSin<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuSin<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.sin(value) as T;\n }\n return VectorOps.sin[value.kind](value) as T;\n}\n\nexport const sin = dualImpl({\n name: 'sin',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuSin,\n codegenImpl: (_ctx, [value]) => stitch`sin(${value})`,\n});\n\nfunction cpuSinh(value: number): number;\nfunction cpuSinh<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuSinh<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.sinh(value) as T;\n }\n throw new MissingCpuImplError(\n 'CPU implementation for sinh on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n );\n}\n\nexport const sinh = dualImpl({\n name: 'sinh',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuSinh,\n codegenImpl: (_ctx, [value]) => stitch`sinh(${value})`,\n});\n\nfunction cpuSmoothstep(edge0: number, edge1: number, x: number): number;\nfunction cpuSmoothstep<T extends AnyFloatVecInstance>(\n edge0: T,\n edge1: T,\n x: T,\n): T;\nfunction cpuSmoothstep<T extends AnyFloatVecInstance | number>(\n edge0: T,\n edge1: T,\n x: T,\n): T {\n if (typeof x === 'number') {\n return smoothstepScalar(\n edge0 as number,\n edge1 as number,\n x,\n ) as T;\n }\n return VectorOps.smoothstep[x.kind](\n edge0 as AnyFloatVecInstance,\n edge1 as AnyFloatVecInstance,\n x,\n ) as T;\n}\n\nexport const smoothstep = dualImpl({\n name: 'smoothstep',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuSmoothstep,\n codegenImpl: (_ctx, [edge0, edge1, x]) =>\n stitch`smoothstep(${edge0}, ${edge1}, ${x})`,\n});\n\nfunction cpuSqrt(value: number): number;\nfunction cpuSqrt<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuSqrt<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.sqrt(value) as T;\n }\n return VectorOps.sqrt[value.kind](value) as T;\n}\n\nexport const sqrt = dualImpl({\n name: 'sqrt',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuSqrt,\n codegenImpl: (_ctx, [value]) => stitch`sqrt(${value})`,\n});\n\nfunction cpuStep(edge: number, x: number): number;\nfunction cpuStep<T extends AnyFloatVecInstance | number>(edge: T, x: T): T;\nfunction cpuStep<T extends AnyFloatVecInstance | number>(edge: T, x: T): T {\n if (typeof edge === 'number') {\n return (edge <= (x as number) ? 1.0 : 0.0) as T;\n }\n throw new MissingCpuImplError(\n 'CPU implementation for step on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n );\n}\n\nexport const step = dualImpl({\n name: 'step',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuStep,\n codegenImpl: (_ctx, [edge, x]) => stitch`step(${edge}, ${x})`,\n});\n\nfunction cpuTan(value: number): number;\nfunction cpuTan<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuTan<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.tan(value) as T;\n }\n throw new MissingCpuImplError(\n 'CPU implementation for tan on vectors not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n );\n}\n\nexport const tan = dualImpl({\n name: 'tan',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuTan,\n codegenImpl: (_ctx, [value]) => stitch`tan(${value})`,\n});\n\nfunction cpuTanh(value: number): number;\nfunction cpuTanh<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuTanh<T extends AnyFloatVecInstance | number>(value: T): T {\n if (typeof value === 'number') {\n return Math.tanh(value) as T;\n }\n return VectorOps.tanh[value.kind](value) as T;\n}\n\nexport const tanh = dualImpl({\n name: 'tanh',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl: cpuTanh,\n codegenImpl: (_ctx, [value]) => stitch`tanh(${value})`,\n});\n\nexport const transpose = dualImpl<<T extends AnyMatInstance>(e: T) => T>({\n name: 'transpose',\n signature: unaryIdentitySignature,\n normalImpl:\n 'CPU implementation for transpose not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [e]) => stitch`transpose(${e})`,\n});\n\nfunction cpuTrunc(value: number): number;\nfunction cpuTrunc<T extends AnyFloatVecInstance>(value: T): T;\nfunction cpuTrunc<T extends AnyFloatVecInstance | number>(_value: T): T {\n throw new Error('Unreachable code. The function is only used for the type.');\n}\n\nexport const trunc = dualImpl<typeof cpuTrunc>({\n name: 'trunc',\n signature: unifyRestrictedSignature(anyFloat),\n normalImpl:\n 'CPU implementation for trunc not implemented yet. Please submit an issue at https://github.com/software-mansion/TypeGPU/issues',\n codegenImpl: (_ctx, [value]) => stitch`trunc(${value})`,\n});\n","import { dualImpl } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport { abstractInt, u32 } from '../data/numeric.ts';\nimport { ptrFn } from '../data/ptr.ts';\nimport { type _ref as ref, isRef } from '../data/ref.ts';\nimport { isPtr, isWgslArray, type StorableData } from '../data/wgslTypes.ts';\n\nconst sizeOfPointedToArray = (dataType: unknown) =>\n isPtr(dataType) && isWgslArray(dataType.inner)\n ? dataType.inner.elementCount\n : 0;\n\nexport const arrayLength = dualImpl({\n name: 'arrayLength',\n signature: (arg) => {\n const ptrArg = isPtr(arg) ? arg : ptrFn(arg as StorableData);\n return ({\n argTypes: [ptrArg],\n returnType: sizeOfPointedToArray(ptrArg) > 0 ? abstractInt : u32,\n });\n },\n normalImpl: (a: unknown[] | ref<unknown[]>) =>\n isRef(a) ? a.$.length : a.length,\n codegenImpl(_ctx, [a]) {\n const length = sizeOfPointedToArray(a.dataType);\n return length > 0 ? `${length}` : stitch`arrayLength(${a})`;\n },\n});\n","import { dualImpl } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport { bitcastU32toF32Impl, bitcastU32toI32Impl } from '../data/numberOps.ts';\nimport { f32, i32, u32 } from '../data/numeric.ts';\nimport { isVec } from '../data/wgslTypes.ts';\nimport { vec2f, vec2i, vec3f, vec3i, vec4f, vec4i } from '../data/vector.ts';\nimport { VectorOps } from '../data/vectorOps.ts';\nimport type {\n v2f,\n v2i,\n v2u,\n v3f,\n v3i,\n v3u,\n v4f,\n v4i,\n v4u,\n} from '../data/wgslTypes.ts';\nimport { unify } from '../tgsl/conversion.ts';\n\nexport type BitcastU32toF32Overload =\n & ((value: number) => number)\n & ((value: v2u) => v2f)\n & ((value: v3u) => v3f)\n & ((value: v4u) => v4f);\n\nexport const bitcastU32toF32 = dualImpl({\n name: 'bitcastU32toF32',\n normalImpl: ((value) => {\n if (typeof value === 'number') {\n return bitcastU32toF32Impl(value);\n }\n return VectorOps.bitcastU32toF32[value.kind](value);\n }) as BitcastU32toF32Overload,\n codegenImpl: (_ctx, [n]) => stitch`bitcast<f32>(${n})`,\n signature: (...arg) => {\n const uargs = unify(arg, [u32]) ?? arg;\n return {\n argTypes: uargs,\n returnType: isVec(uargs[0])\n ? uargs[0].type === 'vec2u'\n ? vec2f\n : uargs[0].type === 'vec3u'\n ? vec3f\n : vec4f\n : f32,\n };\n },\n});\n\nexport type BitcastU32toI32Overload =\n & ((value: number) => number)\n & ((value: v2u) => v2i)\n & ((value: v3u) => v3i)\n & ((value: v4u) => v4i);\n\nexport const bitcastU32toI32 = dualImpl({\n name: 'bitcastU32toI32',\n normalImpl: ((value) => {\n if (typeof value === 'number') {\n return bitcastU32toI32Impl(value);\n }\n return VectorOps.bitcastU32toI32[value.kind](value);\n }) as BitcastU32toI32Overload,\n codegenImpl: (_ctx, [n]) => stitch`bitcast<i32>(${n})`,\n signature: (...arg) => {\n const uargs = unify(arg, [u32]) ?? arg;\n return {\n argTypes: uargs,\n returnType: isVec(uargs[0])\n ? uargs[0].type === 'vec2u'\n ? vec2i\n : uargs[0].type === 'vec3u'\n ? vec3i\n : vec4i\n : i32,\n };\n },\n});\n","import * as TB from 'typed-binary';\nimport { dualImpl } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport { u32 } from '../data/numeric.ts';\nimport { vec2f, vec4f } from '../data/vector.ts';\nimport type { v2f, v4f } from '../data/wgslTypes.ts';\n\n/**\n * @privateRemarks\n * https://gpuweb.github.io/gpuweb/wgsl/#unpack2x16float-builtin\n */\nexport const unpack2x16float = dualImpl({\n name: 'unpack2x16float',\n normalImpl: (e: number): v2f => {\n const buffer = new ArrayBuffer(4);\n const writer = new TB.BufferWriter(buffer);\n writer.writeUint32(e);\n const reader = new TB.BufferReader(buffer);\n return vec2f(reader.readFloat16(), reader.readFloat16());\n },\n signature: { argTypes: [u32], returnType: vec2f },\n codegenImpl: (_ctx, [e]) => stitch`unpack2x16float(${e})`,\n});\n\n/**\n * @privateRemarks\n * https://gpuweb.github.io/gpuweb/wgsl/#pack2x16float-builtin\n */\nexport const pack2x16float = dualImpl({\n name: 'pack2x16float',\n normalImpl: (e: v2f): number => {\n const buffer = new ArrayBuffer(4);\n const writer = new TB.BufferWriter(buffer);\n writer.writeFloat16(e.x);\n writer.writeFloat16(e.y);\n const reader = new TB.BufferReader(buffer);\n return u32(reader.readUint32());\n },\n signature: { argTypes: [vec2f], returnType: u32 },\n codegenImpl: (_ctx, [e]) => stitch`pack2x16float(${e})`,\n});\n\n/**\n * @privateRemarks\n * https://gpuweb.github.io/gpuweb/wgsl/#unpack4x8unorm-builtin\n */\nexport const unpack4x8unorm = dualImpl({\n name: 'unpack4x8unorm',\n normalImpl: (e: number): v4f => {\n const buffer = new ArrayBuffer(4);\n const writer = new TB.BufferWriter(buffer);\n writer.writeUint32(e);\n const reader = new TB.BufferReader(buffer);\n return vec4f(\n reader.readUint8() / 255,\n reader.readUint8() / 255,\n reader.readUint8() / 255,\n reader.readUint8() / 255,\n );\n },\n signature: { argTypes: [u32], returnType: vec4f },\n codegenImpl: (_ctx, [e]) => stitch`unpack4x8unorm(${e})`,\n});\n\n/**\n * @privateRemarks\n * https://gpuweb.github.io/gpuweb/wgsl/#pack4x8unorm-builtin\n */\nexport const pack4x8unorm = dualImpl({\n name: 'pack4x8unorm',\n normalImpl: (e: v4f): number => {\n const buffer = new ArrayBuffer(4);\n const writer = new TB.BufferWriter(buffer);\n writer.writeUint8(e.x * 255);\n writer.writeUint8(e.y * 255);\n writer.writeUint8(e.z * 255);\n writer.writeUint8(e.w * 255);\n const reader = new TB.BufferReader(buffer);\n return u32(reader.readUint32());\n },\n signature: { argTypes: [vec4f], returnType: u32 },\n codegenImpl: (_ctx, [e]) => stitch`pack4x8unorm(${e})`,\n});\n","export const wgslExtensions = [\n 'f16',\n 'clip_distances',\n 'dual_source_blending',\n 'subgroups',\n 'primitive_index',\n] as const;\nexport type WgslExtension = (typeof wgslExtensions)[number];\n\nexport const wgslExtensionToFeatureName: Record<WgslExtension, GPUFeatureName> =\n {\n f16: 'shader-f16',\n clip_distances: 'clip-distances',\n dual_source_blending: 'dual-source-blending',\n subgroups: 'subgroups',\n primitive_index: 'primitive-index' as GPUFeatureName,\n };\n","import { dualImpl } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport { bool, f32 } from '../data/numeric.ts';\nimport { isSnippetNumeric, snip } from '../data/snippet.ts';\nimport { vec2b, vec3b, vec4b } from '../data/vector.ts';\nimport { VectorOps } from '../data/vectorOps.ts';\nimport {\n type AnyBooleanVecInstance,\n type AnyFloatVecInstance,\n type AnyNumericVecInstance,\n type AnyVec2Instance,\n type AnyVec3Instance,\n type AnyVecInstance,\n type AnyWgslData,\n type BaseData,\n isVecInstance,\n type v2b,\n type v3b,\n type v4b,\n} from '../data/wgslTypes.ts';\nimport { unify } from '../tgsl/conversion.ts';\nimport { sub } from './operators.ts';\n\nfunction correspondingBooleanVectorSchema(dataType: BaseData) {\n if (dataType.type.includes('2')) {\n return vec2b;\n }\n if (dataType.type.includes('3')) {\n return vec3b;\n }\n return vec4b;\n}\n\n// comparison\n\n/**\n * Checks whether `lhs == rhs` on all components.\n * Equivalent to `all(eq(lhs, rhs))`.\n * @example\n * allEq(vec2f(0.0, 1.0), vec2f(0.0, 2.0)) // returns false\n * allEq(vec3u(0, 1, 2), vec3u(0, 1, 2)) // returns true\n */\nexport const allEq = dualImpl({\n name: 'allEq',\n signature: (...argTypes) => ({ argTypes, returnType: bool }),\n normalImpl: <T extends AnyVecInstance>(lhs: T, rhs: T) =>\n cpuAll(cpuEq(lhs, rhs)),\n codegenImpl: (_ctx, [lhs, rhs]) => stitch`all(${lhs} == ${rhs})`,\n});\n\nconst cpuEq = <T extends AnyVecInstance>(lhs: T, rhs: T) =>\n VectorOps.eq[lhs.kind](lhs, rhs);\n\n/**\n * Checks **component-wise** whether `lhs == rhs`.\n * This function does **not** return `bool`, for that use-case, wrap the result in `all`, or use `allEq`.\n * @example\n * eq(vec2f(0.0, 1.0), vec2f(0.0, 2.0)) // returns vec2b(true, false)\n * eq(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(false, true, false)\n * all(eq(vec4i(4, 3, 2, 1), vec4i(4, 3, 2, 1))) // returns true\n * allEq(vec4i(4, 3, 2, 1), vec4i(4, 3, 2, 1)) // returns true\n */\nexport const eq = dualImpl({\n name: 'eq',\n signature: (...argTypes) => ({\n argTypes,\n returnType: correspondingBooleanVectorSchema(argTypes[0]),\n }),\n normalImpl: cpuEq,\n codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} == ${rhs})`,\n});\n\n/**\n * Checks **component-wise** whether `lhs != rhs`.\n * This function does **not** return `bool`, for that use-case, wrap the result in `any`.\n * @example\n * ne(vec2f(0.0, 1.0), vec2f(0.0, 2.0)) // returns vec2b(false, true)\n * ne(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(true, false, true)\n * any(ne(vec4i(4, 3, 2, 1), vec4i(4, 2, 2, 1))) // returns true\n */\nexport const ne = dualImpl({\n name: 'ne',\n signature: (...argTypes) => ({\n argTypes,\n returnType: correspondingBooleanVectorSchema(argTypes[0]),\n }),\n normalImpl: <T extends AnyVecInstance>(lhs: T, rhs: T) =>\n cpuNot(cpuEq(lhs, rhs)),\n codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} != ${rhs})`,\n});\n\nconst cpuLt = <T extends AnyNumericVecInstance>(lhs: T, rhs: T) =>\n VectorOps.lt[lhs.kind](lhs, rhs);\n\n/**\n * Checks **component-wise** whether `lhs < rhs`.\n * This function does **not** return `bool`, for that use-case, wrap the result in `all`.\n * @example\n * lt(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(false, true)\n * lt(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(true, false, false)\n * all(lt(vec4i(1, 2, 3, 4), vec4i(2, 3, 4, 5))) // returns true\n */\nexport const lt = dualImpl({\n name: 'lt',\n signature: (...argTypes) => ({\n argTypes,\n returnType: correspondingBooleanVectorSchema(argTypes[0]),\n }),\n normalImpl: cpuLt,\n codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} < ${rhs})`,\n});\n\n/**\n * Checks **component-wise** whether `lhs <= rhs`.\n * This function does **not** return `bool`, for that use-case, wrap the result in `all`.\n * @example\n * le(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(true, true)\n * le(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(true, true, false)\n * all(le(vec4i(1, 2, 3, 4), vec4i(2, 3, 3, 5))) // returns true\n */\nexport const le = dualImpl({\n name: 'le',\n signature: (...argTypes) => ({\n argTypes,\n returnType: correspondingBooleanVectorSchema(argTypes[0]),\n }),\n normalImpl: <T extends AnyNumericVecInstance>(lhs: T, rhs: T) =>\n cpuOr(cpuLt(lhs, rhs), cpuEq(lhs, rhs)),\n codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} <= ${rhs})`,\n});\n\n/**\n * Checks **component-wise** whether `lhs > rhs`.\n * This function does **not** return `bool`, for that use-case, wrap the result in `all`.\n * @example\n * gt(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(false, false)\n * gt(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(false, false, true)\n * all(gt(vec4i(2, 3, 4, 5), vec4i(1, 2, 3, 4))) // returns true\n */\nexport const gt = dualImpl({\n name: 'gt',\n signature: (...argTypes) => ({\n argTypes,\n returnType: correspondingBooleanVectorSchema(argTypes[0]),\n }),\n normalImpl: <T extends AnyNumericVecInstance>(lhs: T, rhs: T) =>\n cpuAnd(cpuNot(cpuLt(lhs, rhs)), cpuNot(cpuEq(lhs, rhs))),\n codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} > ${rhs})`,\n});\n\n/**\n * Checks **component-wise** whether `lhs >= rhs`.\n * This function does **not** return `bool`, for that use-case, wrap the result in `all`.\n * @example\n * ge(vec2f(0.0, 0.0), vec2f(0.0, 1.0)) // returns vec2b(true, false)\n * ge(vec3u(0, 1, 2), vec3u(2, 1, 0)) // returns vec3b(false, true, true)\n * all(ge(vec4i(2, 2, 4, 5), vec4i(1, 2, 3, 4))) // returns true\n */\nexport const ge = dualImpl({\n name: 'ge',\n signature: (...argTypes) => ({\n argTypes: argTypes,\n returnType: correspondingBooleanVectorSchema(argTypes[0]),\n }),\n normalImpl: <T extends AnyNumericVecInstance>(lhs: T, rhs: T) =>\n cpuNot(cpuLt(lhs, rhs)),\n codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} >= ${rhs})`,\n});\n\n// logical ops\n\nconst cpuNot = <T extends AnyBooleanVecInstance>(value: T): T =>\n VectorOps.neg[value.kind](value);\n\n/**\n * Returns **component-wise** `!value`.\n * @example\n * not(vec2b(false, true)) // returns vec2b(true, false)\n * not(vec3b(true, true, false)) // returns vec3b(false, false, true)\n */\nexport const not = dualImpl({\n name: 'not',\n signature: (...argTypes) => ({ argTypes, returnType: argTypes[0] }),\n normalImpl: cpuNot,\n codegenImpl: (_ctx, [arg]) => stitch`!(${arg})`,\n});\n\nconst cpuOr = <T extends AnyBooleanVecInstance>(lhs: T, rhs: T) =>\n VectorOps.or[lhs.kind](lhs, rhs);\n\n/**\n * Returns **component-wise** logical `or` result.\n * @example\n * or(vec2b(false, true), vec2b(false, false)) // returns vec2b(false, true)\n * or(vec3b(true, true, false), vec3b(false, true, false)) // returns vec3b(true, true, false)\n */\nexport const or = dualImpl({\n name: 'or',\n signature: (...argTypes) => ({ argTypes, returnType: argTypes[0] }),\n normalImpl: cpuOr,\n codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} | ${rhs})`,\n});\n\nconst cpuAnd = <T extends AnyBooleanVecInstance>(lhs: T, rhs: T) =>\n cpuNot(cpuOr(cpuNot(lhs), cpuNot(rhs)));\n\n/**\n * Returns **component-wise** logical `and` result.\n * @example\n * and(vec2b(false, true), vec2b(true, true)) // returns vec2b(false, true)\n * and(vec3b(true, true, false), vec3b(false, true, false)) // returns vec3b(false, true, false)\n */\nexport const and = dualImpl({\n name: 'and',\n signature: (...argTypes) => ({ argTypes, returnType: argTypes[0] }),\n normalImpl: cpuAnd,\n codegenImpl: (_ctx, [lhs, rhs]) => stitch`(${lhs} & ${rhs})`,\n});\n\n// logical aggregation\n\nconst cpuAll = (value: AnyBooleanVecInstance) =>\n VectorOps.all[value.kind](value);\n\n/**\n * Returns `true` if each component of `value` is true.\n * @example\n * all(vec2b(false, true)) // returns false\n * all(vec3b(true, true, true)) // returns true\n */\nexport const all = dualImpl({\n name: 'all',\n signature: (...argTypes) => ({ argTypes, returnType: bool }),\n normalImpl: cpuAll,\n codegenImpl: (_ctx, [value]) => stitch`all(${value})`,\n});\n\n/**\n * Returns `true` if any component of `value` is true.\n * @example\n * any(vec2b(false, true)) // returns true\n * any(vec3b(false, false, false)) // returns false\n */\nexport const any = dualImpl({\n name: 'any',\n signature: (...argTypes) => ({ argTypes, returnType: bool }),\n normalImpl: (value: AnyBooleanVecInstance) => !cpuAll(cpuNot(value)),\n codegenImpl: (_ctx, [arg]) => stitch`any(${arg})`,\n});\n\n// other\n\n/**\n * Checks whether the given elements differ by at most the `precision` value.\n * Checks all elements of `lhs` and `rhs` if arguments are vectors.\n * @example\n * isCloseTo(0, 0.1) // returns false\n * isCloseTo(vec3f(0, 0, 0), vec3f(0.002, -0.009, 0)) // returns true\n *\n * @param {number} precision argument that specifies the maximum allowed difference, 0.01 by default.\n */\nexport const isCloseTo = dualImpl({\n name: 'isCloseTo',\n signature: (...args) => ({\n argTypes: args as AnyWgslData[],\n returnType: bool,\n }),\n // CPU implementation\n normalImpl: <T extends AnyFloatVecInstance | number>(\n lhs: T,\n rhs: T,\n precision = 0.01,\n ): boolean => {\n if (typeof lhs === 'number' && typeof rhs === 'number') {\n return Math.abs(lhs - rhs) < precision;\n }\n if (isVecInstance(lhs) && isVecInstance(rhs)) {\n return VectorOps.isCloseToZero[lhs.kind](sub(lhs, rhs), precision);\n }\n return false;\n },\n // GPU implementation\n codegenImpl: (\n _ctx,\n [lhs, rhs, precision = snip(0.01, f32, /* origin */ 'constant')],\n ) => {\n if (isSnippetNumeric(lhs) && isSnippetNumeric(rhs)) {\n return stitch`(abs(f32(${lhs}) - f32(${rhs})) <= ${precision})`;\n }\n if (!isSnippetNumeric(lhs) && !isSnippetNumeric(rhs)) {\n // https://www.w3.org/TR/WGSL/#vector-multi-component:~:text=Binary%20arithmetic%20expressions%20with%20mixed%20scalar%20and%20vector%20operands\n // (a-a)+prec creates a vector of a.length elements, all equal to prec\n return stitch`all(abs(${lhs} - ${rhs}) <= (${lhs} - ${lhs}) + ${precision})`;\n }\n return 'false';\n },\n});\n\nfunction cpuSelect(f: boolean, t: boolean, cond: boolean): boolean;\nfunction cpuSelect(f: number, t: number, cond: boolean): number;\nfunction cpuSelect<T extends AnyVecInstance>(\n f: T,\n t: T,\n cond:\n | boolean\n | (T extends AnyVec2Instance ? v2b\n : T extends AnyVec3Instance ? v3b\n : v4b),\n): T;\nfunction cpuSelect<T extends number | boolean | AnyVecInstance>(\n f: T,\n t: T,\n cond: AnyBooleanVecInstance | boolean,\n) {\n if (typeof cond === 'boolean') {\n return cond ? t : f;\n }\n return VectorOps.select[(f as AnyVecInstance).kind](\n f as AnyVecInstance,\n t as AnyVecInstance,\n cond,\n );\n}\n\n/**\n * Returns `t` if `cond` is `true`, and `f` otherwise.\n * Component-wise if `cond` is a vector.\n * @example\n * select(1, 2, false) // returns 1\n * select(1, 2, true) // returns 2\n * select(vec2i(1, 2), vec2i(3, 4), true) // returns vec2i(3, 4)\n * select(vec2i(1, 2), vec2i(3, 4), vec2b(false, true)) // returns vec2i(1, 4)\n */\nexport const select = dualImpl({\n name: 'select',\n signature: (f, t, cond) => {\n const [uf, ut] = unify([f, t]) ?? [f, t] as const;\n return ({ argTypes: [uf, ut, cond], returnType: uf });\n },\n normalImpl: cpuSelect,\n codegenImpl: (_ctx, [f, t, cond]) => stitch`select(${f}, ${t}, ${cond})`,\n});\n","import { dualImpl } from '../core/function/dualImpl.ts';\nimport { Void } from '../data/wgslTypes.ts';\n\nexport const discard = dualImpl<() => never>({\n name: 'discard',\n normalImpl:\n '`discard` relies on GPU resources and cannot be executed outside of a draw call',\n signature: { argTypes: [], returnType: Void },\n codegenImpl: () => 'discard;',\n});\n","import { stitch } from '../core/resolve/stitch.ts';\nimport {\n mat4x4f,\n rotationX4,\n rotationY4,\n rotationZ4,\n scaling4,\n translation4,\n} from '../data/matrix.ts';\nimport type { m4x4f, v3f } from '../data/wgslTypes.ts';\nimport { dualImpl } from '../core/function/dualImpl.ts';\nimport { mul } from './operators.ts';\nimport { $gpuCallable } from '../shared/symbols.ts';\nimport { vec3f } from '../data/vector.ts';\nimport { f32 } from '../data/numeric.ts';\n\nconst gpuTranslation4 = translation4[$gpuCallable].call.bind(translation4);\nconst gpuScaling4 = scaling4[$gpuCallable].call.bind(scaling4);\nconst gpuRotationX4 = rotationX4[$gpuCallable].call.bind(rotationX4);\nconst gpuRotationY4 = rotationY4[$gpuCallable].call.bind(rotationY4);\nconst gpuRotationZ4 = rotationZ4[$gpuCallable].call.bind(rotationZ4);\n\n/**\n * Translates the given 4-by-4 matrix by the given vector.\n * @param {m4x4f} matrix - The matrix to be modified.\n * @param {v3f} vector - The vector by which to translate the matrix.\n * @returns {m4x4f} The translated matrix.\n */\nexport const translate4 = dualImpl({\n name: 'translate4',\n normalImpl: (matrix: m4x4f, vector: v3f) => mul(translation4(vector), matrix),\n signature: { argTypes: [mat4x4f, vec3f], returnType: mat4x4f },\n codegenImpl: (ctx, [matrix, vector]) =>\n stitch`(${gpuTranslation4(ctx, [vector])} * ${matrix})`,\n});\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount given by the corresponding entry in the given vector.\n * @param {m4x4f} matrix - The matrix to be modified.\n * @param {v3f} vector - A vector of three entries specifying the factor by which to scale in each dimension.\n * @returns {m4x4f} The scaled matrix.\n */\nexport const scale4 = dualImpl({\n name: 'scale4',\n normalImpl: (matrix: m4x4f, vector: v3f) => mul(scaling4(vector), matrix),\n signature: { argTypes: [mat4x4f, vec3f], returnType: mat4x4f },\n codegenImpl: (ctx, [matrix, vector]) =>\n stitch`(${(gpuScaling4(ctx, [vector]))} * ${matrix})`,\n});\n\nconst rotateSignature = { argTypes: [mat4x4f, f32], returnType: mat4x4f };\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given angle.\n * @param {m4x4f} matrix - The matrix to be modified.\n * @param {number} angle - The angle by which to rotate (in radians).\n * @returns {m4x4f} The rotated matrix.\n */\nexport const rotateX4 = dualImpl({\n name: 'rotateX4',\n normalImpl: (matrix: m4x4f, angle: number) => mul(rotationX4(angle), matrix),\n signature: rotateSignature,\n codegenImpl: (ctx, [matrix, angle]) =>\n stitch`(${(gpuRotationX4(ctx, [angle]))} * ${matrix})`,\n});\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given angle.\n * @param {m4x4f} matrix - The matrix to be modified.\n * @param {number} angle - The angle by which to rotate (in radians).\n * @returns {m4x4f} The rotated matrix.\n */\nexport const rotateY4 = dualImpl({\n name: 'rotateY4',\n normalImpl: (matrix: m4x4f, angle: number) => mul(rotationY4(angle), matrix),\n signature: rotateSignature,\n codegenImpl: (ctx, [matrix, angle]) =>\n stitch`(${(gpuRotationY4(ctx, [angle]))} * ${matrix})`,\n});\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given angle.\n * @param {m4x4f} matrix - The matrix to be modified.\n * @param {number} angle - The angle by which to rotate (in radians).\n * @returns {m4x4f} The rotated matrix.\n */\nexport const rotateZ4 = dualImpl({\n name: 'rotateZ4',\n normalImpl: (matrix: m4x4f, angle: number) => mul(rotationZ4(angle), matrix),\n signature: rotateSignature,\n codegenImpl: (ctx, [matrix, angle]) =>\n stitch`(${(gpuRotationZ4(ctx, [angle]))} * ${matrix})`,\n});\n","import { dualImpl } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport { i32, u32 } from '../data/numeric.ts';\nimport {\n type atomicI32,\n type atomicU32,\n type BaseData,\n isAtomic,\n Void,\n} from '../data/wgslTypes.ts';\nimport { safeStringify } from '../shared/stringify.ts';\ntype AnyAtomic = atomicI32 | atomicU32;\n\nexport const workgroupBarrier = dualImpl({\n name: 'workgroupBarrier',\n normalImpl: 'workgroupBarrier is a no-op outside of CODEGEN mode.',\n signature: { argTypes: [], returnType: Void },\n codegenImpl: () => 'workgroupBarrier()',\n});\n\nexport const storageBarrier = dualImpl({\n name: 'storageBarrier',\n normalImpl: 'storageBarrier is a no-op outside of CODEGEN mode.',\n signature: { argTypes: [], returnType: Void },\n codegenImpl: () => 'storageBarrier()',\n});\n\nexport const textureBarrier = dualImpl({\n name: 'textureBarrier',\n normalImpl: 'textureBarrier is a no-op outside of CODEGEN mode.',\n signature: { argTypes: [], returnType: Void },\n codegenImpl: () => 'textureBarrier()',\n});\n\nconst atomicNormalError =\n 'Atomic operations are not supported outside of CODEGEN mode.';\n\nexport const atomicLoad = dualImpl<<T extends AnyAtomic>(a: T) => number>({\n name: 'atomicLoad',\n normalImpl: atomicNormalError,\n signature: (a) => {\n if (!isAtomic(a)) {\n throw new Error(`Invalid atomic type: ${safeStringify(a)}`);\n }\n return { argTypes: [a], returnType: a.inner };\n },\n codegenImpl: (_ctx, [a]) => stitch`atomicLoad(&${a})`,\n});\n\nconst atomicActionSignature = (a: BaseData) => {\n if (!isAtomic(a)) {\n throw new Error(`Invalid atomic type: ${safeStringify(a)}`);\n }\n return {\n argTypes: [a, a.inner.type === 'u32' ? u32 : i32],\n returnType: Void,\n };\n};\n\nconst atomicOpSignature = (a: BaseData) => {\n if (!isAtomic(a)) {\n throw new Error(`Invalid atomic type: ${safeStringify(a)}`);\n }\n const paramType = a.inner.type === 'u32' ? u32 : i32;\n return {\n argTypes: [a, paramType],\n returnType: paramType,\n };\n};\n\nexport const atomicStore = dualImpl<\n <T extends AnyAtomic>(a: T, value: number) => void\n>({\n name: 'atomicStore',\n normalImpl: atomicNormalError,\n signature: atomicActionSignature,\n codegenImpl: (_ctx, [a, value]) => stitch`atomicStore(&${a}, ${value})`,\n});\n\nexport const atomicAdd = dualImpl<\n <T extends AnyAtomic>(a: T, value: number) => number\n>({\n name: 'atomicAdd',\n normalImpl: atomicNormalError,\n signature: atomicOpSignature,\n codegenImpl: (_ctx, [a, value]) => stitch`atomicAdd(&${a}, ${value})`,\n});\n\nexport const atomicSub = dualImpl<\n <T extends AnyAtomic>(a: T, value: number) => number\n>({\n name: 'atomicSub',\n normalImpl: atomicNormalError,\n signature: atomicOpSignature,\n codegenImpl: (_ctx, [a, value]) => stitch`atomicSub(&${a}, ${value})`,\n});\n\nexport const atomicMax = dualImpl<\n <T extends AnyAtomic>(a: T, value: number) => number\n>({\n name: 'atomicMax',\n normalImpl: atomicNormalError,\n signature: atomicOpSignature,\n codegenImpl: (_ctx, [a, value]) => stitch`atomicMax(&${a}, ${value})`,\n});\n\nexport const atomicMin = dualImpl<\n <T extends AnyAtomic>(a: T, value: number) => number\n>({\n name: 'atomicMin',\n normalImpl: atomicNormalError,\n signature: atomicOpSignature,\n codegenImpl: (_ctx, [a, value]) => stitch`atomicMin(&${a}, ${value})`,\n});\n\nexport const atomicAnd = dualImpl<\n <T extends AnyAtomic>(a: T, value: number) => number\n>({\n name: 'atomicAnd',\n normalImpl: atomicNormalError,\n signature: atomicOpSignature,\n codegenImpl: (_ctx, [a, value]) => stitch`atomicAnd(&${a}, ${value})`,\n});\n\nexport const atomicOr = dualImpl<\n <T extends AnyAtomic>(a: T, value: number) => number\n>({\n name: 'atomicOr',\n normalImpl: atomicNormalError,\n signature: atomicOpSignature,\n codegenImpl: (_ctx, [a, value]) => stitch`atomicOr(&${a}, ${value})`,\n});\n\nexport const atomicXor = dualImpl<\n <T extends AnyAtomic>(a: T, value: number) => number\n>({\n name: 'atomicXor',\n normalImpl: atomicNormalError,\n signature: atomicOpSignature,\n codegenImpl: (_ctx, [a, value]) => stitch`atomicXor(&${a}, ${value})`,\n});\n","import { dualImpl } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport type { AnyFloat32VecInstance } from '../data/wgslTypes.ts';\n\ntype DerivativeSignature =\n & ((value: number) => number)\n & (<T extends AnyFloat32VecInstance>(value: T) => T);\n\nconst derivativeNormalError = 'Derivative builtins are not allowed on the CPU';\n\nexport const dpdx = dualImpl<DerivativeSignature>({\n name: 'dpdx',\n normalImpl: derivativeNormalError,\n signature: (value) => ({ argTypes: [value], returnType: value }),\n codegenImpl: (_ctx, [value]) => stitch`dpdx(${value})`,\n});\n\nexport const dpdxCoarse = dualImpl<DerivativeSignature>({\n name: 'dpdxCoarse',\n normalImpl: derivativeNormalError,\n signature: (value) => ({ argTypes: [value], returnType: value }),\n codegenImpl: (_ctx, [value]) => stitch`dpdxCoarse(${value})`,\n});\n\nexport const dpdxFine = dualImpl<DerivativeSignature>({\n name: 'dpdxFine',\n normalImpl: derivativeNormalError,\n signature: (value) => ({ argTypes: [value], returnType: value }),\n codegenImpl: (_ctx, [value]) => stitch`dpdxFine(${value})`,\n});\n\nexport const dpdy = dualImpl<DerivativeSignature>({\n name: 'dpdy',\n normalImpl: derivativeNormalError,\n signature: (value) => ({ argTypes: [value], returnType: value }),\n codegenImpl: (_ctx, [value]) => stitch`dpdy(${value})`,\n});\n\nexport const dpdyCoarse = dualImpl<DerivativeSignature>({\n name: 'dpdyCoarse',\n normalImpl: derivativeNormalError,\n signature: (value) => ({ argTypes: [value], returnType: value }),\n codegenImpl: (_ctx, [value]) => stitch`dpdyCoarse(${value})`,\n});\n\nexport const dpdyFine = dualImpl<DerivativeSignature>({\n name: 'dpdyFine',\n normalImpl: derivativeNormalError,\n signature: (value) => ({ argTypes: [value], returnType: value }),\n codegenImpl: (_ctx, [value]) => stitch`dpdyFine(${value})`,\n});\n\nexport const fwidth = dualImpl<DerivativeSignature>({\n name: 'fwidth',\n normalImpl: derivativeNormalError,\n signature: (value) => ({ argTypes: [value], returnType: value }),\n codegenImpl: (_ctx, [value]) => stitch`fwidth(${value})`,\n});\n\nexport const fwidthCoarse = dualImpl<DerivativeSignature>({\n name: 'fwidthCoarse',\n normalImpl: derivativeNormalError,\n signature: (value) => ({ argTypes: [value], returnType: value }),\n codegenImpl: (_ctx, [value]) => stitch`fwidthCoarse(${value})`,\n});\n\nexport const fwidthFine = dualImpl<DerivativeSignature>({\n name: 'fwidthFine',\n normalImpl: derivativeNormalError,\n signature: (value) => ({ argTypes: [value], returnType: value }),\n codegenImpl: (_ctx, [value]) => stitch`fwidthFine(${value})`,\n});\n","import { stitch } from '../core/resolve/stitch.ts';\nimport {\n isWgslTexture,\n type WgslExternalTexture,\n type WgslStorageTexture,\n type WgslTexture,\n} from '../data/texture.ts';\nimport type { TexelData } from '../core/texture/texture.ts';\nimport { dualImpl, MissingCpuImplError } from '../core/function/dualImpl.ts';\nimport { f32, i32, u32 } from '../data/numeric.ts';\nimport { vec2u, vec3u, vec4f, vec4i, vec4u } from '../data/vector.ts';\nimport {\n type BaseData,\n type v2f,\n type v2i,\n type v2u,\n type v3f,\n type v3i,\n type v3u,\n type v4f,\n type v4i,\n type v4u,\n Void,\n} from '../data/wgslTypes.ts';\nimport {\n getTextureFormatInfo,\n type StorageTextureFormats,\n type TextureFormats,\n} from '../core/texture/textureFormats.ts';\nimport type { $internal, $repr } from '../shared/symbols.ts';\nimport type {\n texture1d,\n texture2d,\n texture2dArray,\n texture3d,\n textureCube,\n textureCubeArray,\n textureDepth2d,\n textureDepth2dArray,\n textureDepthCube,\n textureDepthCubeArray,\n textureExternal,\n textureMultisampled2d,\n textureStorage1d,\n textureStorage2d,\n textureStorage2dArray,\n textureStorage3d,\n} from '../data/texture.ts';\n\nimport type { comparisonSampler, sampler } from '../data/sampler.ts';\n\nfunction sampleCpu<T extends texture1d>(\n texture: T,\n sampler: sampler,\n coords: number,\n): v4f;\nfunction sampleCpu<T extends texture2d>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n offset?: v2i,\n): v4f;\nfunction sampleCpu<T extends texture2dArray>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n arrayIndex: number,\n offset?: v2i,\n): v4f;\nfunction sampleCpu<T extends texture3d | textureCube>(\n texture: T,\n sampler: sampler,\n coords: v3f,\n): v4f;\nfunction sampleCpu<T extends texture3d>(\n texture: T,\n sampler: sampler,\n coords: v3f,\n offset: v3i,\n): v4f;\nfunction sampleCpu<T extends textureCubeArray>(\n texture: T,\n sampler: sampler,\n coords: v3f,\n arrayIndex: number,\n): v4f;\nfunction sampleCpu<T extends textureDepth2d>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n offset?: v2i,\n): number;\nfunction sampleCpu<T extends textureDepth2dArray>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n arrayIndex: number,\n offset?: v2i,\n): number;\nfunction sampleCpu<T extends textureDepthCube>(\n texture: T,\n sampler: sampler,\n coords: v3f,\n arrayIndex?: number,\n): number;\nfunction sampleCpu(\n _texture: WgslTexture,\n _sampler: sampler,\n _coords: number | v2f | v3f,\n _offsetOrArrayIndex?: v2i | v3i | number,\n _maybeOffset?: v2i | v3i,\n): v4f | number {\n throw new MissingCpuImplError(\n 'Texture sampling relies on GPU resources and cannot be executed outside of a draw call',\n );\n}\n\nexport const textureSample = dualImpl({\n name: 'textureSample',\n normalImpl: sampleCpu,\n codegenImpl: (_ctx, args) => stitch`textureSample(${args})`,\n signature: (...args) => {\n const isDepth = (args[0] as WgslTexture).type.startsWith('texture_depth');\n return {\n argTypes: args as BaseData[],\n returnType: isDepth ? f32 : vec4f,\n };\n },\n});\n\nfunction sampleBiasCpu<T extends texture1d>(\n texture: T,\n sampler: sampler,\n coords: number,\n bias: number,\n): v4f;\nfunction sampleBiasCpu<T extends texture2d>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n bias: number,\n offset?: v2i,\n): v4f;\nfunction sampleBiasCpu<T extends texture2dArray>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n arrayIndex: number,\n bias: number,\n offset?: v2i,\n): v4f;\nfunction sampleBiasCpu<T extends texture3d | textureCube>(\n texture: T,\n sampler: sampler,\n coords: v3f,\n bias: number,\n offset?: v3i,\n): v4f;\nfunction sampleBiasCpu<T extends textureCubeArray>(\n texture: T,\n sampler: sampler,\n coords: v3f,\n arrayIndex: number,\n bias: number,\n): v4f;\nfunction sampleBiasCpu(\n _texture: WgslTexture,\n _sampler: sampler,\n _coords: number | v2f | v3f,\n _biasOrArrayIndex: number,\n _biasOrOffset?: number | v2i | v3i,\n _maybeOffset?: v2i | v3i,\n): v4f {\n throw new MissingCpuImplError(\n 'Texture sampling with bias relies on GPU resources and cannot be executed outside of a draw call',\n );\n}\n\nexport const textureSampleBias = dualImpl({\n name: 'textureSampleBias',\n normalImpl: sampleBiasCpu,\n codegenImpl: (_ctx, args) => stitch`textureSampleBias(${args})`,\n signature: (...args) => ({\n argTypes: args as BaseData[],\n returnType: vec4f,\n }),\n});\n\nfunction sampleLevelCpu<T extends texture1d>(\n texture: T,\n sampler: sampler,\n coords: number,\n level: number,\n): v4f;\nfunction sampleLevelCpu<T extends texture2d>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n level: number,\n): v4f;\nfunction sampleLevelCpu<T extends texture2d>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n level: number,\n offset: v2i,\n): v4f;\nfunction sampleLevelCpu<T extends texture2dArray>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n arrayIndex: number,\n level: number,\n): v4f;\nfunction sampleLevelCpu<T extends texture2dArray>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n arrayIndex: number,\n level: number,\n offset: v2i,\n): v4f;\nfunction sampleLevelCpu<T extends texture3d | textureCube>(\n texture: T,\n sampler: sampler,\n coords: v3f,\n level: number,\n): v4f;\nfunction sampleLevelCpu<T extends texture3d>(\n texture: T,\n sampler: sampler,\n coords: v3f,\n level: number,\n offset: v3i,\n): v4f;\nfunction sampleLevelCpu<T extends textureCubeArray>(\n texture: T,\n sampler: sampler,\n coords: v3f,\n arrayIndex: number,\n level: number,\n): v4f;\nfunction sampleLevelCpu<T extends textureDepth2d>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n level: number,\n): number;\nfunction sampleLevelCpu<T extends textureDepth2d>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n level: number,\n offset: v2i,\n): number;\nfunction sampleLevelCpu<T extends textureDepth2dArray>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n arrayIndex: number,\n level: number,\n): number;\nfunction sampleLevelCpu<T extends textureDepth2dArray>(\n texture: T,\n sampler: sampler,\n coords: v2f,\n arrayIndex: number,\n level: number,\n offset: v2i,\n): number;\nfunction sampleLevelCpu<T extends textureDepthCube>(\n texture: T,\n sampler: sampler,\n coords: v3f,\n level: number,\n): number;\nfunction sampleLevelCpu<T extends textureCubeArray>(\n texture: T,\n sampler: sampler,\n coords: v3f,\n arrayIndex: number,\n level: number,\n): number;\nfunction sampleLevelCpu(\n _texture: WgslTexture,\n _sampler: sampler,\n _coords: number | v2f | v3f,\n _level: number,\n _offsetOrArrayIndex?: v2i | v3i | number,\n _maybeOffset?: v2i | v3i,\n): v4f | number {\n throw new MissingCpuImplError(\n 'Texture sampling relies on GPU resources and cannot be executed outside of a draw call',\n );\n}\n\nexport const textureSampleLevel = dualImpl({\n name: 'textureSampleLevel',\n normalImpl: sampleLevelCpu,\n codegenImpl: (_ctx, args) => stitch`textureSampleLevel(${args})`,\n signature: (...args) => {\n const isDepth = (args[0] as WgslTexture).type.startsWith('texture_depth');\n return {\n argTypes: args,\n returnType: isDepth ? f32 : vec4f,\n };\n },\n});\n\ntype PrimitiveToLoadedType = {\n f32: v4f;\n i32: v4i;\n u32: v4u;\n};\n\ntype TexelFormatToInstanceType<T extends StorageTextureFormats> =\n TextureFormats[T]['vectorType'][typeof $repr];\n\nfunction textureLoadCpu<T extends texture1d>(\n texture: T,\n coords: number,\n level: number,\n): PrimitiveToLoadedType[T[typeof $internal]['type']];\nfunction textureLoadCpu<T extends texture2d>(\n texture: T,\n coords: v2i | v2u,\n level: number,\n): PrimitiveToLoadedType[T[typeof $internal]['type']];\nfunction textureLoadCpu<T extends texture2dArray>(\n texture: T,\n coords: v2i | v2u,\n arrayIndex: number,\n level: number,\n): PrimitiveToLoadedType[T[typeof $internal]['type']];\nfunction textureLoadCpu<T extends texture3d>(\n texture: T,\n coords: v3i | v3u,\n level: number,\n): PrimitiveToLoadedType[T[typeof $internal]['type']];\nfunction textureLoadCpu<T extends textureMultisampled2d>(\n texture: T,\n coords: v2i | v2u,\n sampleIndex: number,\n): PrimitiveToLoadedType[T[typeof $internal]['type']];\nfunction textureLoadCpu<T extends textureStorage1d>(\n texture: T,\n coords: number,\n): TexelFormatToInstanceType<T[typeof $internal][0]>;\nfunction textureLoadCpu<T extends textureStorage2d>(\n texture: T,\n coords: v2i | v2u,\n): TexelFormatToInstanceType<T[typeof $internal][0]>;\nfunction textureLoadCpu<T extends textureStorage2dArray>(\n texture: T,\n coords: v2i | v2u,\n arrayIndex: number,\n): TexelFormatToInstanceType<T[typeof $internal][0]>;\nfunction textureLoadCpu<T extends textureStorage3d>(\n texture: T,\n coords: v3i | v3u,\n): TexelFormatToInstanceType<T[typeof $internal][0]>;\nfunction textureLoadCpu(\n _texture: WgslTexture | WgslStorageTexture,\n _coords: number | v2i | v2u | v3i | v3u,\n _levelOrArrayIndex?: number,\n): TexelData {\n throw new MissingCpuImplError(\n '`textureLoad` relies on GPU resources and cannot be executed outside of a draw call',\n );\n}\n\nexport const textureLoad = dualImpl({\n name: 'textureLoad',\n normalImpl: textureLoadCpu,\n codegenImpl: (_ctx, args) => stitch`textureLoad(${args})`,\n signature: (...args) => {\n const texture = args[0] as WgslTexture | WgslStorageTexture;\n if (isWgslTexture(texture)) {\n const isDepth = texture.type.startsWith('texture_depth');\n const sampleType = texture.sampleType;\n return {\n argTypes: args,\n returnType: isDepth\n ? f32\n : sampleType.type === 'f32'\n ? vec4f\n : sampleType.type === 'u32'\n ? vec4u\n : vec4i,\n };\n }\n const format = texture.format;\n const dataType = getTextureFormatInfo(format).vectorType;\n return {\n argTypes: args,\n returnType: dataType,\n };\n },\n});\n\nfunction textureStoreCpu<T extends textureStorage1d>(\n texture: T,\n coords: number,\n value: TexelFormatToInstanceType<T[typeof $internal][0]>,\n): void;\nfunction textureStoreCpu<T extends textureStorage2d>(\n texture: T,\n coords: v2i | v2u,\n value: TexelFormatToInstanceType<T[typeof $internal][0]>,\n): void;\nfunction textureStoreCpu<T extends textureStorage2dArray>(\n texture: T,\n coords: v2i | v2u,\n arrayIndex: number,\n value: TexelFormatToInstanceType<T[typeof $internal][0]>,\n): void;\nfunction textureStoreCpu<T extends textureStorage3d>(\n texture: T,\n coords: v3i | v3u,\n value: TexelFormatToInstanceType<T[typeof $internal][0]>,\n): void;\nfunction textureStoreCpu(\n _texture: WgslStorageTexture,\n _coords: number | v2i | v2u | v3i | v3u,\n _arrayIndexOrValue?: number | TexelData,\n _maybeValue?: TexelData,\n): void {\n throw new MissingCpuImplError(\n '`textureStore` relies on GPU resources and cannot be executed outside of a draw call',\n );\n}\n\nexport const textureStore = dualImpl({\n name: 'textureStore',\n normalImpl: textureStoreCpu,\n codegenImpl: (_ctx, args) => stitch`textureStore(${args})`,\n signature: (...args) => ({ argTypes: args, returnType: Void }),\n});\n\nfunction textureDimensionsCpu<T extends texture1d | textureStorage1d>(\n texture: T,\n): number;\nfunction textureDimensionsCpu<T extends texture1d>(\n texture: T,\n level: number,\n): number;\nfunction textureDimensionsCpu<\n T extends\n | texture2d\n | texture2dArray\n | textureCube\n | textureCubeArray\n | textureStorage2d\n | textureStorage2dArray\n | textureExternal,\n>(texture: T): v2u;\nfunction textureDimensionsCpu<\n T extends\n | texture2d\n | texture2dArray\n | textureCube\n | textureCubeArray,\n>(texture: T, level: number): v2u;\nfunction textureDimensionsCpu<T extends texture3d | textureStorage3d>(\n texture: T,\n): v3u;\nfunction textureDimensionsCpu<T extends texture3d>(\n texture: T,\n level: number,\n): v3u;\nfunction textureDimensionsCpu(\n _texture: WgslTexture | WgslStorageTexture | WgslExternalTexture,\n _level?: number,\n): number | v2u | v3u {\n throw new MissingCpuImplError(\n '`textureDimensions` relies on GPU resources and cannot be executed outside of a draw call',\n );\n}\n\nexport const textureDimensions = dualImpl({\n name: 'textureDimensions',\n normalImpl: textureDimensionsCpu,\n codegenImpl: (_ctx, args) => stitch`textureDimensions(${args})`,\n signature: (...args) => {\n const dim = (\n args[0] as WgslTexture | WgslStorageTexture | WgslExternalTexture\n ).dimension;\n if (dim === '1d') {\n return {\n argTypes: args,\n returnType: u32,\n };\n }\n if (dim === '3d') {\n return {\n argTypes: args,\n returnType: vec3u,\n };\n }\n return {\n argTypes: args,\n returnType: vec2u,\n };\n },\n});\n\ntype Gather2dArgs<T extends texture2d = texture2d> = [\n component: number,\n texture: T,\n sampler: sampler,\n coords: v2f,\n offset?: v2i,\n];\ntype Gather2dArrayArgs<T extends texture2dArray = texture2dArray> = [\n component: number,\n texture: T,\n sampler: sampler,\n coords: v2f,\n arrayIndex: number,\n offset?: v2i,\n];\ntype GatherCubeArgs<T extends textureCube = textureCube> = [\n component: number,\n texture: T,\n sampler: sampler,\n coords: v3f,\n];\ntype GatherCubeArrayArgs<T extends textureCubeArray = textureCubeArray> = [\n component: number,\n texture: T,\n sampler: sampler,\n coords: v3f,\n arrayIndex: number,\n];\ntype GatherDepth2dArgs = [\n texture: textureDepth2d,\n sampler: sampler,\n coords: v2f,\n offset?: v2i,\n];\ntype GatherDepth2dArrayArgs = [\n texture: textureDepth2dArray,\n sampler: sampler,\n coords: v2f,\n arrayIndex: number,\n offset?: v2i,\n];\ntype GatherDepthCubeArgs = [\n texture: textureDepthCube,\n sampler: sampler,\n coords: v3f,\n];\ntype GatherDepthCubeArrayArgs = [\n texture: textureDepthCubeArray,\n sampler: sampler,\n coords: v3f,\n arrayIndex: number,\n];\n\ntype TextureGatherCpuArgs =\n | Gather2dArgs\n | Gather2dArrayArgs\n | GatherCubeArgs\n | GatherCubeArrayArgs\n | GatherDepth2dArgs\n | GatherDepth2dArrayArgs\n | GatherDepthCubeArgs\n | GatherDepthCubeArrayArgs;\n\ntype TextureGatherCpuFn = {\n <T extends texture2d>(\n ...args: Gather2dArgs<T>\n ): PrimitiveToLoadedType[T[typeof $internal]['type']];\n <T extends texture2dArray>(\n ...args: Gather2dArrayArgs<T>\n ): PrimitiveToLoadedType[T[typeof $internal]['type']];\n <T extends textureCube>(\n ...args: GatherCubeArgs<T>\n ): PrimitiveToLoadedType[T[typeof $internal]['type']];\n <T extends textureCubeArray>(\n ...args: GatherCubeArrayArgs<T>\n ): PrimitiveToLoadedType[T[typeof $internal]['type']];\n (...args: GatherDepth2dArgs): v4f;\n (...args: GatherDepth2dArrayArgs): v4f;\n (...args: GatherDepthCubeArgs): v4f;\n (...args: GatherDepthCubeArrayArgs): v4f;\n};\n\nexport const textureGatherCpu: TextureGatherCpuFn = (\n ..._args: TextureGatherCpuArgs\n): v4f => {\n throw new Error(\n 'Texture gather relies on GPU resources and cannot be executed outside of a draw call',\n );\n};\n\nconst sampleTypeToVecType = {\n f32: vec4f,\n i32: vec4i,\n u32: vec4u,\n};\n\nexport const textureGather = dualImpl({\n name: 'textureGather',\n normalImpl: textureGatherCpu,\n codegenImpl: (_ctx, args) => stitch`textureGather(${args})`,\n signature: (...args) => {\n if (args[0].type.startsWith('texture')) {\n const [texture, sampler, coords, _, ...rest] = args;\n\n const isArrayTexture = texture.type === 'texture_depth_2d_array' ||\n texture.type === 'texture_depth_cube_array';\n\n const argTypes = isArrayTexture\n ? [texture, sampler, coords, [u32, i32], ...rest]\n : args as BaseData[];\n\n return { argTypes: argTypes as BaseData[], returnType: vec4f };\n }\n\n const [_, texture, sampler, coords, ...rest] = args;\n\n const isArrayTexture = texture.type === 'texture_2d_array' ||\n texture.type === 'texture_cube_array';\n\n const argTypes = isArrayTexture\n ? [[u32, i32], texture, sampler, coords, [u32, i32], ...rest]\n : [[u32, i32], texture, sampler, coords, ...rest];\n\n return {\n argTypes: argTypes as BaseData[],\n returnType: sampleTypeToVecType[(texture as WgslTexture).sampleType.type],\n };\n },\n});\n\nfunction textureSampleCompareCpu<T extends textureDepth2d>(\n texture: T,\n sampler: comparisonSampler,\n coords: v2f,\n depthRef: number,\n): number;\nfunction textureSampleCompareCpu<T extends textureDepth2d>(\n texture: T,\n sampler: comparisonSampler,\n coords: v2f,\n depthRef: number,\n offset: v2i,\n): number;\nfunction textureSampleCompareCpu<T extends textureDepth2dArray>(\n texture: T,\n sampler: comparisonSampler,\n coords: v2f,\n arrayIndex: number,\n depthRef: number,\n): number;\nfunction textureSampleCompareCpu<T extends textureDepth2dArray>(\n texture: T,\n sampler: comparisonSampler,\n coords: v2f,\n arrayIndex: number,\n depthRef: number,\n offset: v2i,\n): number;\nfunction textureSampleCompareCpu<T extends textureDepthCube>(\n texture: T,\n sampler: comparisonSampler,\n coords: v3f,\n depthRef: number,\n): number;\nfunction textureSampleCompareCpu<T extends textureDepthCubeArray>(\n texture: T,\n sampler: comparisonSampler,\n coords: v3f,\n arrayIndex: number,\n depthRef: number,\n): number;\nfunction textureSampleCompareCpu(\n _texture: WgslTexture,\n _sampler: comparisonSampler,\n _coords: v2f | v3f,\n _depthRefOrArrayIndex: number,\n _depthRefOrOffset?: number | v2i,\n _maybeOffset?: v2i,\n): number {\n throw new MissingCpuImplError(\n 'Texture comparison sampling relies on GPU resources and cannot be executed outside of a draw call',\n );\n}\n\nexport const textureSampleCompare = dualImpl({\n name: 'textureSampleCompare',\n normalImpl: textureSampleCompareCpu,\n codegenImpl: (_ctx, args) => stitch`textureSampleCompare(${args})`,\n signature: (...args) => ({\n argTypes: args,\n returnType: f32,\n }),\n});\n\nfunction textureSampleCompareLevelCpu<T extends textureDepth2d>(\n texture: T,\n sampler: comparisonSampler,\n coords: v2f,\n depthRef: number,\n): number;\nfunction textureSampleCompareLevelCpu<T extends textureDepth2d>(\n texture: T,\n sampler: comparisonSampler,\n coords: v2f,\n depthRef: number,\n offset: v2i,\n): number;\nfunction textureSampleCompareLevelCpu<T extends textureDepth2dArray>(\n texture: T,\n sampler: comparisonSampler,\n coords: v2f,\n arrayIndex: number,\n depthRef: number,\n): number;\nfunction textureSampleCompareLevelCpu<T extends textureDepth2dArray>(\n texture: T,\n sampler: comparisonSampler,\n coords: v2f,\n arrayIndex: number,\n depthRef: number,\n offset: v2i,\n): number;\nfunction textureSampleCompareLevelCpu<T extends textureDepthCube>(\n texture: T,\n sampler: comparisonSampler,\n coords: v3f,\n depthRef: number,\n): number;\nfunction textureSampleCompareLevelCpu<T extends textureDepthCubeArray>(\n texture: T,\n sampler: comparisonSampler,\n coords: v3f,\n arrayIndex: number,\n depthRef: number,\n): number;\nfunction textureSampleCompareLevelCpu(\n _texture: WgslTexture,\n _sampler: comparisonSampler,\n _coords: v2f | v3f,\n _depthRefOrArrayIndex: number,\n _depthRefOrOffset?: number | v2i,\n _maybeOffset?: v2i,\n): number {\n throw new MissingCpuImplError(\n 'Texture comparison sampling with level relies on GPU resources and cannot be executed outside of a draw call',\n );\n}\n\nexport const textureSampleCompareLevel = dualImpl({\n name: 'textureSampleCompareLevel',\n normalImpl: textureSampleCompareLevelCpu,\n codegenImpl: (ctx, args) => stitch`textureSampleCompareLevel(${args})`,\n signature: (...args) => ({\n argTypes: args,\n returnType: f32,\n }),\n});\n\nfunction textureSampleBaseClampToEdgeCpu<\n T extends texture2d | textureExternal,\n>(_texture: T, _sampler: sampler, _coords: v2f): v4f {\n throw new MissingCpuImplError(\n 'Texture sampling with base clamp to edge is not supported outside of GPU mode.',\n );\n}\n\nexport const textureSampleBaseClampToEdge = dualImpl({\n name: 'textureSampleBaseClampToEdge',\n normalImpl: textureSampleBaseClampToEdgeCpu,\n codegenImpl: (_ctx, args) => stitch`textureSampleBaseClampToEdge(${args})`,\n signature: (...args) => ({\n argTypes: args,\n returnType: vec4f,\n }),\n});\n","import { dualImpl } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport { bool, i32, u32 } from '../data/numeric.ts';\nimport { vec4u } from '../data/vector.ts';\nimport type {\n AnyIntegerVecInstance,\n AnyNumericVecInstance,\n AnyWgslData,\n v4u,\n} from '../data/wgslTypes.ts';\nimport { unify } from '../tgsl/conversion.ts';\n\ninterface IdentityNumOrVec {\n (e: number): number;\n <T extends AnyNumericVecInstance>(e: T): T;\n}\n\ninterface IdentityIntNumOrVec {\n (e: number): number;\n <T extends AnyIntegerVecInstance>(e: T): T;\n}\n\ninterface IdentityNumOrVecWithIdx {\n (e: number, index: number): number;\n <T extends AnyNumericVecInstance>(e: T, index: number): T;\n}\n\ninterface IdentityNumOrVecWithDelta {\n (e: number, delta: number): number;\n <T extends AnyNumericVecInstance>(e: T, delta: number): T;\n}\n\ninterface IdentityNumOrVecWithMask {\n (e: number, mask: number): number;\n <T extends AnyNumericVecInstance>(e: T, mask: number): T;\n}\n\nconst errorMessage = 'Subgroup operations can only be used in the GPU context.';\n\nexport const subgroupAdd = dualImpl<IdentityNumOrVec>({\n name: 'subgroupAdd',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [arg]) => stitch`subgroupAdd(${arg})`,\n});\n\nexport const subgroupExclusiveAdd = dualImpl<IdentityNumOrVec>({\n name: 'subgroupExclusiveAdd',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [arg]) => stitch`subgroupExclusiveAdd(${arg})`,\n});\n\nexport const subgroupInclusiveAdd = dualImpl<IdentityNumOrVec>({\n name: 'subgroupInclusiveAdd',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [arg]) => stitch`subgroupInclusiveAdd(${arg})`,\n});\n\nexport const subgroupAll = dualImpl<(e: boolean) => boolean>({\n name: 'subgroupAll',\n signature: { argTypes: [bool], returnType: bool },\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e]) => stitch`subgroupAll(${e})`,\n});\n\nexport const subgroupAnd = dualImpl<IdentityIntNumOrVec>({\n name: 'subgroupAnd',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e]) => stitch`subgroupAnd(${e})`,\n});\n\nexport const subgroupAny = dualImpl<(e: boolean) => boolean>({\n name: 'subgroupAny',\n signature: { argTypes: [bool], returnType: bool },\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e]) => stitch`subgroupAny(${e})`,\n});\n\nexport const subgroupBallot = dualImpl<(e: boolean) => v4u>({\n name: 'subgroupBallot',\n signature: { argTypes: [bool], returnType: vec4u },\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e]) => stitch`subgroupBallot(${e})`,\n});\n\nexport const subgroupBroadcast = dualImpl<IdentityNumOrVecWithIdx>({\n name: 'subgroupBroadcast',\n signature: (...args) => {\n const id = unify([args[1]] as [AnyWgslData], [i32, u32]);\n if (!id) {\n throw new Error(\n `subgroupBroadcast's second argument has to be compatible with i32 or u32. Got: ${\n args[1].type\n }`,\n );\n }\n return { argTypes: [args[0], id[0]], returnType: args[0] };\n },\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e, index]) => stitch`subgroupBroadcast(${e}, ${index})`,\n});\n\nexport const subgroupBroadcastFirst = dualImpl<IdentityNumOrVec>({\n name: 'subgroupBroadcastFirst',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e]) => stitch`subgroupBroadcastFirst(${e})`,\n});\n\nexport const subgroupElect = dualImpl<() => boolean>({\n name: 'subgroupElect',\n signature: { argTypes: [], returnType: bool },\n normalImpl: errorMessage,\n codegenImpl: () => stitch`subgroupElect()`,\n});\n\nexport const subgroupMax = dualImpl<IdentityNumOrVec>({\n name: 'subgroupMax',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [arg]) => stitch`subgroupMax(${arg})`,\n});\n\nexport const subgroupMin = dualImpl<IdentityNumOrVec>({\n name: 'subgroupMin',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [arg]) => stitch`subgroupMin(${arg})`,\n});\n\nexport const subgroupMul = dualImpl<IdentityNumOrVec>({\n name: 'subgroupMul',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [arg]) => stitch`subgroupMul(${arg})`,\n});\n\nexport const subgroupExclusiveMul = dualImpl<IdentityNumOrVec>({\n name: 'subgroupExclusiveMul',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [arg]) => stitch`subgroupExclusiveMul(${arg})`,\n});\n\nexport const subgroupInclusiveMul = dualImpl<IdentityNumOrVec>({\n name: 'subgroupInclusiveMul',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [arg]) => stitch`subgroupInclusiveMul(${arg})`,\n});\n\nexport const subgroupOr = dualImpl<IdentityIntNumOrVec>({\n name: 'subgroupOr',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e]) => stitch`subgroupOr(${e})`,\n});\n\nexport const subgroupShuffle = dualImpl<IdentityNumOrVecWithIdx>({\n name: 'subgroupShuffle',\n signature: (...args) => {\n const id = unify([args[1]] as [AnyWgslData], [i32, u32]);\n if (!id) {\n throw new Error(\n `subgroupShuffle's second argument has to be compatible with i32 or u32. Got: ${\n args[1].type\n }`,\n );\n }\n return { argTypes: [args[0], id[0]], returnType: args[0] };\n },\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e, index]) => stitch`subgroupShuffle(${e}, ${index})`,\n});\n\nexport const subgroupShuffleDown = dualImpl<IdentityNumOrVecWithDelta>({\n name: 'subgroupShuffleDown',\n signature: (...args) => {\n const delta = unify([args[1]] as [AnyWgslData], [u32]);\n if (!delta) {\n throw new Error(\n `subgroupShuffleDown's second argument has to be compatible with u32. Got: ${\n args[1].type\n }`,\n );\n }\n return { argTypes: [args[0], delta[0]], returnType: args[0] };\n },\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e, delta]) =>\n stitch`subgroupShuffleDown(${e}, ${delta})`,\n});\n\nexport const subgroupShuffleUp = dualImpl<IdentityNumOrVecWithDelta>({\n name: 'subgroupShuffleUp',\n signature: (...args) => {\n const delta = unify([args[1]] as [AnyWgslData], [u32]);\n if (!delta) {\n throw new Error(\n `subgroupShuffleUp's second argument has to be compatible with u32. Got: ${\n args[1].type\n }`,\n );\n }\n return { argTypes: [args[0], delta[0]], returnType: args[0] };\n },\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e, delta]) => stitch`subgroupShuffleUp(${e}, ${delta})`,\n});\n\nexport const subgroupShuffleXor = dualImpl<IdentityNumOrVecWithMask>({\n name: 'subgroupShuffleXor',\n signature: (...args) => {\n const mask = unify([args[1]] as [AnyWgslData], [u32]);\n if (!mask) {\n throw new Error(\n `subgroupShuffleXor's second argument has to be compatible with u32. Got: ${\n args[1].type\n }`,\n );\n }\n return { argTypes: [args[0], mask[0]], returnType: args[0] };\n },\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e, mask]) => stitch`subgroupShuffleXor(${e}, ${mask})`,\n});\n\nexport const subgroupXor = dualImpl<IdentityIntNumOrVec>({\n name: 'subgroupXor',\n signature: (arg) => ({ argTypes: [arg], returnType: arg }),\n normalImpl: errorMessage,\n codegenImpl: (_ctx, [e]) => stitch`subgroupXor(${e})`,\n});\n","import { comptime } from '../core/function/comptime.ts';\nimport { getResolutionCtx } from '../execMode.ts';\nimport { type WgslExtension, wgslExtensions } from '../wgslExtensions.ts';\n\nexport const extensionEnabled = comptime(\n (extensionName: WgslExtension): boolean => {\n const resolutionCtx = getResolutionCtx();\n if (!resolutionCtx) {\n throw new Error(\n \"Functions using `extensionEnabled` cannot be called directly. Either generate WGSL from them, or use tgpu['~unstable'].simulate(...)\",\n );\n }\n\n if (\n typeof extensionName !== 'string' ||\n !(wgslExtensions.includes(extensionName))\n ) {\n throw new Error(\n `extensionEnabled has to be called with a string literal representing a valid WGSL extension name. Got: '${extensionName}'`,\n );\n }\n\n return (resolutionCtx.enableExtensions ?? []).includes(extensionName);\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