typegpu 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{chunk-6WF2EZIT.js → chunk-6U5HPHCJ.js} +2 -2
- package/{chunk-B254XDWG.js → chunk-CGQB3SER.js} +2 -2
- package/{chunk-XEUNEHAZ.js → chunk-CRZWTZM2.js} +6 -6
- package/chunk-CRZWTZM2.js.map +1 -0
- package/chunk-ECR2EGZX.js +7 -0
- package/chunk-ECR2EGZX.js.map +1 -0
- package/chunk-PWBIFP67.js +2 -0
- package/chunk-PWBIFP67.js.map +1 -0
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -1
- package/data/index.d.ts +3 -3
- package/data/index.js +1 -1
- package/index.d.ts +2 -2
- package/index.js +40 -40
- package/index.js.map +1 -1
- package/{matrix-C6mMH7pB.d.ts → matrix-DIfOiRyz.d.ts} +1 -1
- package/package.json +5 -13
- package/std/index.d.ts +2 -2
- package/std/index.js +1 -1
- package/std/index.js.map +1 -1
- package/{tgpuConstant-DzGgwe0I.d.ts → tgpuConstant-BTQFNlQH.d.ts} +13 -8
- package/chunk-A5APHF7K.cjs +0 -10
- package/chunk-A5APHF7K.cjs.map +0 -1
- package/chunk-LL6NPRFE.cjs +0 -7
- package/chunk-LL6NPRFE.cjs.map +0 -1
- package/chunk-M2P3FJT7.cjs +0 -2
- package/chunk-M2P3FJT7.cjs.map +0 -1
- package/chunk-PO6SIMTQ.js +0 -2
- package/chunk-PO6SIMTQ.js.map +0 -1
- package/chunk-T2GBOTUH.js +0 -7
- package/chunk-T2GBOTUH.js.map +0 -1
- package/chunk-TRAG63HY.cjs +0 -3
- package/chunk-TRAG63HY.cjs.map +0 -1
- package/chunk-U3CXOCRG.cjs +0 -2
- package/chunk-U3CXOCRG.cjs.map +0 -1
- package/chunk-XEUNEHAZ.js.map +0 -1
- package/common/index.cjs +0 -7
- package/common/index.cjs.map +0 -1
- package/common/index.d.cts +0 -24
- package/data/index.cjs +0 -2
- package/data/index.cjs.map +0 -1
- package/data/index.d.cts +0 -402
- package/index.cjs +0 -192
- package/index.cjs.map +0 -1
- package/index.d.cts +0 -369
- package/matrix-Cn2jQILV.d.cts +0 -122
- package/std/index.cjs +0 -2
- package/std/index.cjs.map +0 -1
- package/std/index.d.cts +0 -639
- package/tgpuConstant-DzGgwe0I.d.cts +0 -5196
- /package/{chunk-6WF2EZIT.js.map → chunk-6U5HPHCJ.js.map} +0 -0
- /package/{chunk-B254XDWG.js.map → chunk-CGQB3SER.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bB as Mat2x2f, bC as Mat3x3f, bD as Mat4x4f, by as m2x2f, bz as m3x3f, bA as m4x4f, b9 as DualFn, bK as v3f } from './tgpuConstant-
|
|
1
|
+
import { bB as Mat2x2f, bC as Mat3x3f, bD as Mat4x4f, by as m2x2f, bz as m3x3f, bA as m4x4f, b9 as DualFn, bK as v3f } from './tgpuConstant-BTQFNlQH.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a 2-by-2 identity matrix.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typegpu",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.2",
|
|
5
5
|
"description": "A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -9,27 +9,19 @@
|
|
|
9
9
|
"./package.json": "./package.json",
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./index.d.ts",
|
|
12
|
-
"
|
|
13
|
-
"import": "./index.js",
|
|
14
|
-
"default": "./index.cjs"
|
|
12
|
+
"default": "./index.js"
|
|
15
13
|
},
|
|
16
14
|
"./data": {
|
|
17
15
|
"types": "./data/index.d.ts",
|
|
18
|
-
"
|
|
19
|
-
"import": "./data/index.js",
|
|
20
|
-
"default": "./data/index.cjs"
|
|
16
|
+
"default": "./data/index.js"
|
|
21
17
|
},
|
|
22
18
|
"./std": {
|
|
23
19
|
"types": "./std/index.d.ts",
|
|
24
|
-
"
|
|
25
|
-
"import": "./std/index.js",
|
|
26
|
-
"default": "./std/index.cjs"
|
|
20
|
+
"default": "./std/index.js"
|
|
27
21
|
},
|
|
28
22
|
"./common": {
|
|
29
23
|
"types": "./common/index.d.ts",
|
|
30
|
-
"
|
|
31
|
-
"import": "./common/index.js",
|
|
32
|
-
"default": "./common/index.cjs"
|
|
24
|
+
"default": "./common/index.js"
|
|
33
25
|
}
|
|
34
26
|
},
|
|
35
27
|
"sideEffects": false,
|
package/std/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b9 as DualFn, dL as AnyNumericVecInstance, dM as AnyFloatVecInstance, dN as AnyIntegerVecInstance, bK as v3f, dO as v3h, dP as AnyMatInstance, I as Infer, b8 as WgslStruct, b4 as F32, b5 as I32, b3 as F16, dQ as AbstractFloat, dR as AbstractInt, aP as Vec2f, aS as Vec2i, aV as Vec3f, aX as Vec3i, a_ as Vec4f, b0 as Vec4i, aR as Vec2h, aW as Vec3h, a$ as Vec4h, bG as v2f, dS as v2h, bH as v2i, bL as v3i, bO as v4f, dT as v4h, bP as v4i, dU as AnyFloat32VecInstance, dV as AnySignedVecInstance, dW as vBaseForMat, dX as mBaseForVec, bA as m4x4f, bs as AnyVecInstance, dY as AnyVec2Instance, bF as v2b, dZ as AnyVec3Instance, bJ as v3b, bN as v4b, d_ as AnyBooleanVecInstance, d$ as atomicI32, e0 as atomicU32, bT as texture1d, c4 as textureStorage1d, bU as texture2d, bV as texture2dArray, bX as textureCube, bY as textureCubeArray, c5 as textureStorage2d, c6 as textureStorage2dArray, c2 as textureExternal, bI as v2u, bW as texture3d, c7 as textureStorage3d, bM as v3u, bQ as v4u, $ as $internal, c3 as textureMultisampled2d, e1 as StorageTextureFormats, e2 as TextureFormats, e3 as $repr, ct as sampler, bZ as textureDepth2d, b_ as textureDepth2dArray, b$ as textureDepthCube, cs as comparisonSampler, d as WgslExtension } from '../tgpuConstant-
|
|
2
|
-
export { i as identity2, d as identity3, e as identity4, r as rotationX4, f as rotationY4, g as rotationZ4, s as scaling4, t as translation4 } from '../matrix-
|
|
1
|
+
import { b9 as DualFn, dL as AnyNumericVecInstance, dM as AnyFloatVecInstance, dN as AnyIntegerVecInstance, bK as v3f, dO as v3h, dP as AnyMatInstance, I as Infer, b8 as WgslStruct, b4 as F32, b5 as I32, b3 as F16, dQ as AbstractFloat, dR as AbstractInt, aP as Vec2f, aS as Vec2i, aV as Vec3f, aX as Vec3i, a_ as Vec4f, b0 as Vec4i, aR as Vec2h, aW as Vec3h, a$ as Vec4h, bG as v2f, dS as v2h, bH as v2i, bL as v3i, bO as v4f, dT as v4h, bP as v4i, dU as AnyFloat32VecInstance, dV as AnySignedVecInstance, dW as vBaseForMat, dX as mBaseForVec, bA as m4x4f, bs as AnyVecInstance, dY as AnyVec2Instance, bF as v2b, dZ as AnyVec3Instance, bJ as v3b, bN as v4b, d_ as AnyBooleanVecInstance, d$ as atomicI32, e0 as atomicU32, bT as texture1d, c4 as textureStorage1d, bU as texture2d, bV as texture2dArray, bX as textureCube, bY as textureCubeArray, c5 as textureStorage2d, c6 as textureStorage2dArray, c2 as textureExternal, bI as v2u, bW as texture3d, c7 as textureStorage3d, bM as v3u, bQ as v4u, $ as $internal, c3 as textureMultisampled2d, e1 as StorageTextureFormats, e2 as TextureFormats, e3 as $repr, ct as sampler, bZ as textureDepth2d, b_ as textureDepth2dArray, b$ as textureDepthCube, cs as comparisonSampler, d as WgslExtension } from '../tgpuConstant-BTQFNlQH.js';
|
|
2
|
+
export { i as identity2, d as identity3, e as identity4, r as rotationX4, f as rotationY4, g as rotationZ4, s as scaling4, t as translation4 } from '../matrix-DIfOiRyz.js';
|
|
3
3
|
import 'tinyest';
|
|
4
4
|
|
|
5
5
|
declare const discard: DualFn<() => never>;
|
package/std/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as G,c as nt,d as ut,e as at,f as pt,g as st,h as it,i as P,k as mt,l as dt,m as lt,n as ct,o as xt,p as Tt,q as ft,r as yt,s as bt,t as vt,u as gt,v as It,w as ht,x as wt}from"../chunk-PO6SIMTQ.js";import{a as U}from"../chunk-6WF2EZIT.js";import{$ as J,$a as Je,Aa as Ce,Ba as Ae,Ca as Se,Da as Ee,Ea as De,Fa as $e,Ga as Fe,Ha as Oe,Ia as Ve,Ja as Le,Ka as We,La as Be,Ma as Ne,Na as _e,Oa as Me,P as M,Pa as Ge,Qa as Pe,Ra as Ue,Sa as ke,Ta as Xe,Ua as Re,V as j,Va as Ze,W as Y,Wa as je,X as F,Xa as Ye,Y as q,Ya as qe,Z as z,Za as ze,_ as H,_a as He,aa as K,ab as Ke,b as X,ba as Q,bb as Qe,c as R,ca as ee,cb as et,d as Z,da as te,db as tt,e as C,ea as re,eb as rt,f as A,fa as oe,fb as ot,g as S,ga as ne,h as E,ha as ue,i as D,ia as ae,ja as pe,ka as se,la as ie,ma as me,na as de,oa as le,pa as ce,qa as xe,ra as Te,sa as fe,ta as ye,ua as be,va as ve,wa as ge,xa as Ie,ya as he,za as we}from"../chunk-T2GBOTUH.js";import{$a as B,Aa as V,B as l,C as O,Da as L,E as $,Ea as r,Ia as y,Ma as u,Oa as n,Pa as W,Ra as T,Sa as m,Ua as g,Va as I,a as p,aa as o,eb as N,gb as b,ib as _,jb as w,mb as c,q as x}from"../chunk-XEUNEHAZ.js";var Ct=u(()=>{throw new Error("`discard` relies on GPU resources and cannot be executed outside of a draw call")},()=>o("discard;",x),"discard");var h=F[p].jsImpl,At=C[p].jsImpl,St=C[p].gpuImpl,Et=A[p].jsImpl,Dt=A[p].gpuImpl,$t=S[p].jsImpl,Ft=S[p].gpuImpl,Ot=E[p].jsImpl,Vt=E[p].gpuImpl,Lt=D[p].jsImpl,Wt=D[p].gpuImpl,Bt=u((e,t)=>h(At(t),e),(e,t)=>o(r`(${St(t)} * ${e})`,e.dataType),"translate4"),Nt=u((e,t)=>h(Et(t),e),(e,t)=>o(r`(${Dt(t)} * ${e})`,e.dataType),"scale4"),_t=u((e,t)=>h($t(t),e),(e,t)=>o(r`(${Ft(t)} * ${e})`,e.dataType),"rotateX4"),Mt=u((e,t)=>h(Ot(t),e),(e,t)=>o(r`(${Vt(t)} * ${e})`,e.dataType),"rotateY4"),Gt=u((e,t)=>h(Lt(t),e),(e,t)=>o(r`(${Wt(t)} * ${e})`,e.dataType),"rotateZ4");var Pt=u(()=>console.warn("workgroupBarrier is a no-op outside of CODEGEN mode."),()=>o("workgroupBarrier()",x),"workgroupBarrier"),Ut=u(()=>console.warn("storageBarrier is a no-op outside of CODEGEN mode."),()=>o("storageBarrier()",x),"storageBarrier"),kt=u(()=>console.warn("textureBarrier is a no-op outside of CODEGEN mode."),()=>o("textureBarrier()",x),"textureBarrier"),Xt=u(e=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},e=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicLoad(&${e})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicLoad"),Rt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(!l(e.dataType)||e.dataType.type!=="atomic")throw new Error(`Invalid atomic type: ${c(e.dataType)}`);return o(r`atomicStore(&${e}, ${t})`,x)},"atomicStore"),f=(e,t)=>e.dataType.type==="atomic"&&e.dataType.inner.type==="i32"?[e.dataType,g]:[e.dataType,m],Zt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicAdd(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicAdd",f),jt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicSub(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicSub",f),Yt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicMax(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicMax",f),qt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicMin(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicMin",f),zt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicAnd(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicAnd",f),Ht=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicOr(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicOr",f),Jt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicXor(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicXor",f);function Kt(e){throw new Error("Derivative builtins are not allowed on the cpu")}var Qt=u(Kt,e=>o(r`dpdx(${e})`,e.dataType),"dpdx");function er(e){throw new Error("Derivative builtins are not allowed on the cpu")}var tr=u(er,e=>o(r`dpdxCoarse(${e})`,e.dataType),"dpdxCoarse");function rr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var or=u(rr,e=>o(r`dpdxFine(${e})`,e.dataType),"dpdxFine");function nr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var ur=u(nr,e=>o(r`dpdy(${e})`,e.dataType),"dpdy");function ar(e){throw new Error("Derivative builtins are not allowed on the cpu")}var pr=u(ar,e=>o(r`dpdyCoarse(${e})`,e.dataType),"dpdyCoarse");function sr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var ir=u(sr,e=>o(r`dpdyFine(${e})`,e.dataType),"dpdyFine");function mr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var dr=u(mr,e=>o(r`fwidth(${e})`,e.dataType),"fwidth");function lr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var cr=u(lr,e=>o(r`fwidthCoarse(${e})`,e.dataType),"fwidthCoarse");function xr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var Tr=u(xr,e=>o(r`fwidthFine(${e})`,e.dataType),"fwidthFine");var k=e=>$(e)&&O(e.inner)?e.inner.elementCount:0,fr=n({name:"arrayLength",signature:e=>{let t=$(e)?e:U(e);return{argTypes:[t],returnType:k(t)>0?W:m}},normalImpl:e=>e.length,codegenImpl(e){let t=k(e.dataType);return t>0?String(t):r`arrayLength(${e})`}});function yr(e,t,d,i,s){throw new Error("Texture sampling relies on GPU resources and cannot be executed outside of a draw call")}var br=n({name:"textureSample",normalImpl:yr,codegenImpl:(...e)=>r`textureSample(${e})`,signature:(...e)=>{let t=e[0].type.startsWith("texture_depth");return{argTypes:e,returnType:t?I:b}}});function vr(e,t,d,i,s,v){throw new Error("Texture sampling with bias relies on GPU resources and cannot be executed outside of a draw call")}var gr=n({name:"textureSampleBias",normalImpl:vr,codegenImpl:(...e)=>r`textureSampleBias(${e})`,signature:(...e)=>({argTypes:e,returnType:b})});function Ir(e,t,d,i,s,v){throw new Error("Texture sampling relies on GPU resources and cannot be executed outside of a draw call")}var hr=n({name:"textureSampleLevel",normalImpl:Ir,codegenImpl:(...e)=>r`textureSampleLevel(${e})`,signature:(...e)=>{let t=e[0].type.startsWith("texture_depth");return{argTypes:e,returnType:t?I:b}}});function wr(e,t,d){throw new Error("`textureLoad` relies on GPU resources and cannot be executed outside of a draw call")}var Cr=n({name:"textureLoad",normalImpl:wr,codegenImpl:(...e)=>r`textureLoad(${e})`,signature:(...e)=>{let t=e[0];if(M(t)){let s=t.type.startsWith("texture_depth"),v=t.sampleType;return{argTypes:e,returnType:s?I:v.type==="f32"?b:v.type==="u32"?w:_}}let d=t.format,i=G[d].vectorType;return{argTypes:e,returnType:i}}});function Ar(e,t,d,i){throw new Error("`textureStore` relies on GPU resources and cannot be executed outside of a draw call")}var Sr=n({name:"textureStore",normalImpl:Ar,codegenImpl:(...e)=>r`textureStore(${e})`,signature:(...e)=>({argTypes:e,returnType:x})});function Er(e,t){throw new Error("`textureDimensions` relies on GPU resources and cannot be executed outside of a draw call")}var Dr=n({name:"textureDimensions",normalImpl:Er,codegenImpl:(...e)=>r`textureDimensions(${e})`,signature:(...e)=>{let t=e[0].dimension;return t==="1d"?{argTypes:e,returnType:m}:t==="3d"?{argTypes:e,returnType:N}:{argTypes:e,returnType:B}}});function $r(e,t,d,i,s,v){throw new Error("Texture comparison sampling relies on GPU resources and cannot be executed outside of a draw call")}var Fr=n({name:"textureSampleCompare",normalImpl:$r,codegenImpl:(...e)=>r`textureSampleCompare(${e})`,signature:(...e)=>({argTypes:e,returnType:I})});function Or(e,t,d){throw new Error("Texture sampling with base clamp to edge is not supported outside of GPU mode.")}var Vr=n({name:"textureSampleBaseClampToEdge",normalImpl:Or,codegenImpl:(...e)=>r`textureSampleBaseClampToEdge(${e})`,signature:(...e)=>({argTypes:e,returnType:b})});var a="Subgroup operations can only be used in the GPU context.",Lr=n({name:"subgroupAdd",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupAdd(${e})`}),Wr=n({name:"subgroupExclusiveAdd",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupExclusiveAdd(${e})`}),Br=n({name:"subgroupInclusiveAdd",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupInclusiveAdd(${e})`}),Nr=n({name:"subgroupAll",signature:{argTypes:[T],returnType:T},normalImpl:a,codegenImpl:e=>r`subgroupAll(${e})`}),_r=n({name:"subgroupAnd",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupAnd(${e})`}),Mr=n({name:"subgroupAny",signature:{argTypes:[T],returnType:T},normalImpl:a,codegenImpl:e=>r`subgroupAny(${e})`}),Gr=n({name:"subgroupBallot",signature:{argTypes:[T],returnType:w},normalImpl:a,codegenImpl:e=>r`subgroupBallot(${e})`}),Pr=n({name:"subgroupBroadcast",signature:(...e)=>{let t=y([e[1]],[g,m]);if(!t)throw new Error(`subgroupBroadcast's second argument has to be compatible with i32 or u32. Got: ${e[1].type}`);return{argTypes:[e[0],t[0]],returnType:e[0]}},normalImpl:a,codegenImpl:(e,t)=>r`subgroupBroadcast(${e}, ${t})`}),Ur=n({name:"subgroupBroadcastFirst",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupBroadcastFirst(${e})`}),kr=n({name:"subgroupElect",signature:{argTypes:[],returnType:T},normalImpl:a,codegenImpl:()=>r`subgroupElect()`}),Xr=n({name:"subgroupMax",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupMax(${e})`}),Rr=n({name:"subgroupMin",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupMin(${e})`}),Zr=n({name:"subgroupMul",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupMul(${e})`}),jr=n({name:"subgroupExclusiveMul",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupExclusiveMul(${e})`}),Yr=n({name:"subgroupInclusiveMul",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupInclusiveMul(${e})`}),qr=n({name:"subgroupOr",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupOr(${e})`}),zr=n({name:"subgroupShuffle",signature:(...e)=>{let t=y([e[1]],[g,m]);if(!t)throw new Error(`subgroupShuffle's second argument has to be compatible with i32 or u32. Got: ${e[1].type}`);return{argTypes:[e[0],t[0]],returnType:e[0]}},normalImpl:a,codegenImpl:(e,t)=>r`subgroupShuffle(${e}, ${t})`}),Hr=n({name:"subgroupShuffleDown",signature:(...e)=>{let t=y([e[1]],[m]);if(!t)throw new Error(`subgroupShuffleDown's second argument has to be compatible with u32. Got: ${e[1].type}`);return{argTypes:[e[0],t[0]],returnType:e[0]}},normalImpl:a,codegenImpl:(e,t)=>r`subgroupShuffleDown(${e}, ${t})`}),Jr=n({name:"subgroupShuffleUp",signature:(...e)=>{let t=y([e[1]],[m]);if(!t)throw new Error(`subgroupShuffleUp's second argument has to be compatible with u32. Got: ${e[1].type}`);return{argTypes:[e[0],t[0]],returnType:e[0]}},normalImpl:a,codegenImpl:(e,t)=>r`subgroupShuffleUp(${e}, ${t})`}),Kr=n({name:"subgroupShuffleXor",signature:(...e)=>{let t=y([e[1]],[m]);if(!t)throw new Error(`subgroupShuffleXor's second argument has to be compatible with u32. Got: ${e[1].type}`);return{argTypes:[e[0],t[0]],returnType:e[0]}},normalImpl:a,codegenImpl:(e,t)=>r`subgroupShuffleXor(${e}, ${t})`}),Qr=n({name:"subgroupXor",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupXor(${e})`});var eo=(()=>{let e=i=>{let s=V();if(!s)throw new Error("extensionEnabled can only be called in a GPU codegen context.");return(s.enableExtensions??[]).includes(i)},t=i=>{let{value:s}=i;if(typeof s!="string"||!P.includes(s))throw new Error(`extensionEnabled has to be called with a string literal representing a valid WGSL extension name. Got: ${s}`);return o(e(s),T)},d=i=>{if(L())return t(i);throw new Error("extensionEnabled can only be called in a GPU codegen context.")};return Object.defineProperty(d,p,{value:{jsImpl:e,gpuImpl:t,argConversionHint:"keep"}}),d})();export{J as abs,K as acos,Q as acosh,j as add,gt as all,mt as allEq,vt as and,It as any,fr as arrayLength,ee as asin,te as asinh,re as atan,ne as atan2,oe as atanh,Zt as atomicAdd,zt as atomicAnd,Xt as atomicLoad,Yt as atomicMax,qt as atomicMin,Ht as atomicOr,Rt as atomicStore,jt as atomicSub,Jt as atomicXor,nt as bitcastU32toF32,ut as bitcastU32toI32,ue as ceil,ae as clamp,pe as cos,se as cosh,ie as countLeadingZeros,me as countOneBits,de as countTrailingZeros,le as cross,ce as degrees,xe as determinant,Ct as discard,Te as distance,q as div,fe as dot,be as dot4I8Packed,ye as dot4U8Packed,Qt as dpdx,tr as dpdxCoarse,or as dpdxFine,ur as dpdy,pr as dpdyCoarse,ir as dpdyFine,dt as eq,ve as exp,ge as exp2,eo as extensionEnabled,Ie as extractBits,he as faceForward,we as firstLeadingBit,Ce as firstTrailingBit,Ae as floor,Se as fma,Ee as fract,De as frexp,dr as fwidth,cr as fwidthCoarse,Tr as fwidthFine,ft as ge,Tt as gt,X as identity2,R as identity3,Z as identity4,$e as insertBits,Fe as inverseSqrt,ht as isCloseTo,Oe as ldexp,xt as le,Ve as length,Le as log,We as log2,ct as lt,Be as max,Ne as min,_e as mix,z as mod,Me as modf,F as mul,lt as ne,H as neg,Ge as normalize,yt as not,bt as or,pt as pack2x16float,it as pack4x8unorm,Pe as pow,Ue as quantizeToF16,ke as radians,Xe as reflect,Re as refract,Ze as reverseBits,_t as rotateX4,Mt as rotateY4,Gt as rotateZ4,S as rotationX4,E as rotationY4,D as rotationZ4,je as round,Ye as saturate,Nt as scale4,A as scaling4,wt as select,qe as sign,ze as sin,He as sinh,Je as smoothstep,Ke as sqrt,Qe as step,Ut as storageBarrier,Y as sub,Lr as subgroupAdd,Nr as subgroupAll,_r as subgroupAnd,Mr as subgroupAny,Gr as subgroupBallot,Pr as subgroupBroadcast,Ur as subgroupBroadcastFirst,kr as subgroupElect,Wr as subgroupExclusiveAdd,jr as subgroupExclusiveMul,Br as subgroupInclusiveAdd,Yr as subgroupInclusiveMul,Xr as subgroupMax,Rr as subgroupMin,Zr as subgroupMul,qr as subgroupOr,zr as subgroupShuffle,Hr as subgroupShuffleDown,Jr as subgroupShuffleUp,Kr as subgroupShuffleXor,Qr as subgroupXor,et as tan,tt as tanh,kt as textureBarrier,Dr as textureDimensions,Cr as textureLoad,br as textureSample,Vr as textureSampleBaseClampToEdge,gr as textureSampleBias,Fr as textureSampleCompare,hr as textureSampleLevel,Sr as textureStore,Bt as translate4,C as translation4,rt as transpose,ot as trunc,at as unpack2x16float,st as unpack4x8unorm,Pt as workgroupBarrier};
|
|
1
|
+
import{a as G,c as nt,d as ut,e as at,f as pt,g as st,h as it,i as P,k as mt,l as dt,m as lt,n as ct,o as xt,p as Tt,q as ft,r as yt,s as bt,t as vt,u as gt,v as It,w as ht,x as wt}from"../chunk-PWBIFP67.js";import{a as U}from"../chunk-6U5HPHCJ.js";import{$ as z,$a as ze,Aa as he,Ba as we,Ca as Ce,Da as Ae,Ea as Se,Fa as Ee,Ga as De,Ha as $e,Ia as Fe,Ja as Oe,Ka as Ve,La as Le,Ma as We,Na as Be,Oa as Ne,Pa as _e,Qa as Me,R as M,Ra as Ge,Sa as Pe,Ta as Ue,Ua as ke,Va as Xe,Wa as Re,X as j,Xa as Ze,Y,Ya as je,Z as F,Za as Ye,_ as q,_a as qe,aa as H,ab as He,b as X,ba as J,bb as Je,c as R,ca as K,cb as Ke,d as Z,da as Q,db as Qe,e as C,ea as ee,eb as et,f as A,fa as te,fb as tt,g as S,ga as re,gb as rt,h as E,ha as oe,hb as ot,i as D,ia as ne,ja as ue,ka as ae,la as pe,ma as se,na as ie,oa as me,pa as de,qa as le,ra as ce,sa as xe,ta as Te,ua as fe,va as ye,wa as be,xa as ve,ya as ge,za as Ie}from"../chunk-ECR2EGZX.js";import{Aa as V,B as l,C as O,Da as L,E as $,Ea as r,Ha as y,La as u,Na as n,Oa as W,Qa as T,Ra as m,Ta as g,Ua as I,_a as B,a as p,aa as o,db as N,fb as b,hb as _,ib as w,lb as c,q as x}from"../chunk-CRZWTZM2.js";var Ct=u(()=>{throw new Error("`discard` relies on GPU resources and cannot be executed outside of a draw call")},()=>o("discard;",x),"discard");var h=F[p].jsImpl,At=C[p].jsImpl,St=C[p].gpuImpl,Et=A[p].jsImpl,Dt=A[p].gpuImpl,$t=S[p].jsImpl,Ft=S[p].gpuImpl,Ot=E[p].jsImpl,Vt=E[p].gpuImpl,Lt=D[p].jsImpl,Wt=D[p].gpuImpl,Bt=u((e,t)=>h(At(t),e),(e,t)=>o(r`(${St(t)} * ${e})`,e.dataType),"translate4"),Nt=u((e,t)=>h(Et(t),e),(e,t)=>o(r`(${Dt(t)} * ${e})`,e.dataType),"scale4"),_t=u((e,t)=>h($t(t),e),(e,t)=>o(r`(${Ft(t)} * ${e})`,e.dataType),"rotateX4"),Mt=u((e,t)=>h(Ot(t),e),(e,t)=>o(r`(${Vt(t)} * ${e})`,e.dataType),"rotateY4"),Gt=u((e,t)=>h(Lt(t),e),(e,t)=>o(r`(${Wt(t)} * ${e})`,e.dataType),"rotateZ4");var Pt=u(()=>console.warn("workgroupBarrier is a no-op outside of CODEGEN mode."),()=>o("workgroupBarrier()",x),"workgroupBarrier"),Ut=u(()=>console.warn("storageBarrier is a no-op outside of CODEGEN mode."),()=>o("storageBarrier()",x),"storageBarrier"),kt=u(()=>console.warn("textureBarrier is a no-op outside of CODEGEN mode."),()=>o("textureBarrier()",x),"textureBarrier"),Xt=u(e=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},e=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicLoad(&${e})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicLoad"),Rt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(!l(e.dataType)||e.dataType.type!=="atomic")throw new Error(`Invalid atomic type: ${c(e.dataType)}`);return o(r`atomicStore(&${e}, ${t})`,x)},"atomicStore"),f=(e,t)=>e.dataType.type==="atomic"&&e.dataType.inner.type==="i32"?[e.dataType,g]:[e.dataType,m],Zt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicAdd(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicAdd",f),jt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicSub(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicSub",f),Yt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicMax(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicMax",f),qt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicMin(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicMin",f),zt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicAnd(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicAnd",f),Ht=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicOr(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicOr",f),Jt=u((e,t)=>{throw new Error("Atomic operations are not supported outside of CODEGEN mode.")},(e,t)=>{if(l(e.dataType)&&e.dataType.type==="atomic")return o(r`atomicXor(&${e}, ${t})`,e.dataType.inner);throw new Error(`Invalid atomic type: ${c(e.dataType)}`)},"atomicXor",f);function Kt(e){throw new Error("Derivative builtins are not allowed on the cpu")}var Qt=u(Kt,e=>o(r`dpdx(${e})`,e.dataType),"dpdx");function er(e){throw new Error("Derivative builtins are not allowed on the cpu")}var tr=u(er,e=>o(r`dpdxCoarse(${e})`,e.dataType),"dpdxCoarse");function rr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var or=u(rr,e=>o(r`dpdxFine(${e})`,e.dataType),"dpdxFine");function nr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var ur=u(nr,e=>o(r`dpdy(${e})`,e.dataType),"dpdy");function ar(e){throw new Error("Derivative builtins are not allowed on the cpu")}var pr=u(ar,e=>o(r`dpdyCoarse(${e})`,e.dataType),"dpdyCoarse");function sr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var ir=u(sr,e=>o(r`dpdyFine(${e})`,e.dataType),"dpdyFine");function mr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var dr=u(mr,e=>o(r`fwidth(${e})`,e.dataType),"fwidth");function lr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var cr=u(lr,e=>o(r`fwidthCoarse(${e})`,e.dataType),"fwidthCoarse");function xr(e){throw new Error("Derivative builtins are not allowed on the cpu")}var Tr=u(xr,e=>o(r`fwidthFine(${e})`,e.dataType),"fwidthFine");var k=e=>$(e)&&O(e.inner)?e.inner.elementCount:0,fr=n({name:"arrayLength",signature:e=>{let t=$(e)?e:U(e);return{argTypes:[t],returnType:k(t)>0?W:m}},normalImpl:e=>e.length,codegenImpl(e){let t=k(e.dataType);return t>0?String(t):r`arrayLength(${e})`}});function yr(e,t,d,i,s){throw new Error("Texture sampling relies on GPU resources and cannot be executed outside of a draw call")}var br=n({name:"textureSample",normalImpl:yr,codegenImpl:(...e)=>r`textureSample(${e})`,signature:(...e)=>{let t=e[0].type.startsWith("texture_depth");return{argTypes:e,returnType:t?I:b}}});function vr(e,t,d,i,s,v){throw new Error("Texture sampling with bias relies on GPU resources and cannot be executed outside of a draw call")}var gr=n({name:"textureSampleBias",normalImpl:vr,codegenImpl:(...e)=>r`textureSampleBias(${e})`,signature:(...e)=>({argTypes:e,returnType:b})});function Ir(e,t,d,i,s,v){throw new Error("Texture sampling relies on GPU resources and cannot be executed outside of a draw call")}var hr=n({name:"textureSampleLevel",normalImpl:Ir,codegenImpl:(...e)=>r`textureSampleLevel(${e})`,signature:(...e)=>{let t=e[0].type.startsWith("texture_depth");return{argTypes:e,returnType:t?I:b}}});function wr(e,t,d){throw new Error("`textureLoad` relies on GPU resources and cannot be executed outside of a draw call")}var Cr=n({name:"textureLoad",normalImpl:wr,codegenImpl:(...e)=>r`textureLoad(${e})`,signature:(...e)=>{let t=e[0];if(M(t)){let s=t.type.startsWith("texture_depth"),v=t.sampleType;return{argTypes:e,returnType:s?I:v.type==="f32"?b:v.type==="u32"?w:_}}let d=t.format,i=G[d].vectorType;return{argTypes:e,returnType:i}}});function Ar(e,t,d,i){throw new Error("`textureStore` relies on GPU resources and cannot be executed outside of a draw call")}var Sr=n({name:"textureStore",normalImpl:Ar,codegenImpl:(...e)=>r`textureStore(${e})`,signature:(...e)=>({argTypes:e,returnType:x})});function Er(e,t){throw new Error("`textureDimensions` relies on GPU resources and cannot be executed outside of a draw call")}var Dr=n({name:"textureDimensions",normalImpl:Er,codegenImpl:(...e)=>r`textureDimensions(${e})`,signature:(...e)=>{let t=e[0].dimension;return t==="1d"?{argTypes:e,returnType:m}:t==="3d"?{argTypes:e,returnType:N}:{argTypes:e,returnType:B}}});function $r(e,t,d,i,s,v){throw new Error("Texture comparison sampling relies on GPU resources and cannot be executed outside of a draw call")}var Fr=n({name:"textureSampleCompare",normalImpl:$r,codegenImpl:(...e)=>r`textureSampleCompare(${e})`,signature:(...e)=>({argTypes:e,returnType:I})});function Or(e,t,d){throw new Error("Texture sampling with base clamp to edge is not supported outside of GPU mode.")}var Vr=n({name:"textureSampleBaseClampToEdge",normalImpl:Or,codegenImpl:(...e)=>r`textureSampleBaseClampToEdge(${e})`,signature:(...e)=>({argTypes:e,returnType:b})});var a="Subgroup operations can only be used in the GPU context.",Lr=n({name:"subgroupAdd",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupAdd(${e})`}),Wr=n({name:"subgroupExclusiveAdd",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupExclusiveAdd(${e})`}),Br=n({name:"subgroupInclusiveAdd",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupInclusiveAdd(${e})`}),Nr=n({name:"subgroupAll",signature:{argTypes:[T],returnType:T},normalImpl:a,codegenImpl:e=>r`subgroupAll(${e})`}),_r=n({name:"subgroupAnd",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupAnd(${e})`}),Mr=n({name:"subgroupAny",signature:{argTypes:[T],returnType:T},normalImpl:a,codegenImpl:e=>r`subgroupAny(${e})`}),Gr=n({name:"subgroupBallot",signature:{argTypes:[T],returnType:w},normalImpl:a,codegenImpl:e=>r`subgroupBallot(${e})`}),Pr=n({name:"subgroupBroadcast",signature:(...e)=>{let t=y([e[1]],[g,m]);if(!t)throw new Error(`subgroupBroadcast's second argument has to be compatible with i32 or u32. Got: ${e[1].type}`);return{argTypes:[e[0],t[0]],returnType:e[0]}},normalImpl:a,codegenImpl:(e,t)=>r`subgroupBroadcast(${e}, ${t})`}),Ur=n({name:"subgroupBroadcastFirst",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupBroadcastFirst(${e})`}),kr=n({name:"subgroupElect",signature:{argTypes:[],returnType:T},normalImpl:a,codegenImpl:()=>r`subgroupElect()`}),Xr=n({name:"subgroupMax",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupMax(${e})`}),Rr=n({name:"subgroupMin",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupMin(${e})`}),Zr=n({name:"subgroupMul",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupMul(${e})`}),jr=n({name:"subgroupExclusiveMul",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupExclusiveMul(${e})`}),Yr=n({name:"subgroupInclusiveMul",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupInclusiveMul(${e})`}),qr=n({name:"subgroupOr",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupOr(${e})`}),zr=n({name:"subgroupShuffle",signature:(...e)=>{let t=y([e[1]],[g,m]);if(!t)throw new Error(`subgroupShuffle's second argument has to be compatible with i32 or u32. Got: ${e[1].type}`);return{argTypes:[e[0],t[0]],returnType:e[0]}},normalImpl:a,codegenImpl:(e,t)=>r`subgroupShuffle(${e}, ${t})`}),Hr=n({name:"subgroupShuffleDown",signature:(...e)=>{let t=y([e[1]],[m]);if(!t)throw new Error(`subgroupShuffleDown's second argument has to be compatible with u32. Got: ${e[1].type}`);return{argTypes:[e[0],t[0]],returnType:e[0]}},normalImpl:a,codegenImpl:(e,t)=>r`subgroupShuffleDown(${e}, ${t})`}),Jr=n({name:"subgroupShuffleUp",signature:(...e)=>{let t=y([e[1]],[m]);if(!t)throw new Error(`subgroupShuffleUp's second argument has to be compatible with u32. Got: ${e[1].type}`);return{argTypes:[e[0],t[0]],returnType:e[0]}},normalImpl:a,codegenImpl:(e,t)=>r`subgroupShuffleUp(${e}, ${t})`}),Kr=n({name:"subgroupShuffleXor",signature:(...e)=>{let t=y([e[1]],[m]);if(!t)throw new Error(`subgroupShuffleXor's second argument has to be compatible with u32. Got: ${e[1].type}`);return{argTypes:[e[0],t[0]],returnType:e[0]}},normalImpl:a,codegenImpl:(e,t)=>r`subgroupShuffleXor(${e}, ${t})`}),Qr=n({name:"subgroupXor",signature:e=>({argTypes:[e],returnType:e}),normalImpl:a,codegenImpl:e=>r`subgroupXor(${e})`});var eo=(()=>{let e=i=>{let s=V();if(!s)throw new Error("extensionEnabled can only be called in a GPU codegen context.");return(s.enableExtensions??[]).includes(i)},t=i=>{let{value:s}=i;if(typeof s!="string"||!P.includes(s))throw new Error(`extensionEnabled has to be called with a string literal representing a valid WGSL extension name. Got: ${s}`);return o(e(s),T)},d=i=>{if(L())return t(i);throw new Error("extensionEnabled can only be called in a GPU codegen context.")};return Object.defineProperty(d,p,{value:{jsImpl:e,gpuImpl:t,argConversionHint:"keep"}}),d})();export{J as abs,K as acos,Q as acosh,j as add,gt as all,mt as allEq,vt as and,It as any,fr as arrayLength,ee as asin,te as asinh,re as atan,ne as atan2,oe as atanh,Zt as atomicAdd,zt as atomicAnd,Xt as atomicLoad,Yt as atomicMax,qt as atomicMin,Ht as atomicOr,Rt as atomicStore,jt as atomicSub,Jt as atomicXor,nt as bitcastU32toF32,ut as bitcastU32toI32,ue as ceil,ae as clamp,pe as cos,se as cosh,ie as countLeadingZeros,me as countOneBits,de as countTrailingZeros,le as cross,ce as degrees,xe as determinant,Ct as discard,Te as distance,q as div,fe as dot,be as dot4I8Packed,ye as dot4U8Packed,Qt as dpdx,tr as dpdxCoarse,or as dpdxFine,ur as dpdy,pr as dpdyCoarse,ir as dpdyFine,dt as eq,ve as exp,ge as exp2,eo as extensionEnabled,Ie as extractBits,he as faceForward,we as firstLeadingBit,Ce as firstTrailingBit,Ae as floor,Se as fma,Ee as fract,De as frexp,dr as fwidth,cr as fwidthCoarse,Tr as fwidthFine,ft as ge,Tt as gt,X as identity2,R as identity3,Z as identity4,$e as insertBits,Fe as inverseSqrt,ht as isCloseTo,Oe as ldexp,xt as le,Ve as length,Le as log,We as log2,ct as lt,Be as max,Ne as min,_e as mix,z as mod,Me as modf,F as mul,lt as ne,H as neg,Ge as normalize,yt as not,bt as or,pt as pack2x16float,it as pack4x8unorm,Pe as pow,Ue as quantizeToF16,ke as radians,Xe as reflect,Re as refract,Ze as reverseBits,_t as rotateX4,Mt as rotateY4,Gt as rotateZ4,S as rotationX4,E as rotationY4,D as rotationZ4,je as round,Ye as saturate,Nt as scale4,A as scaling4,wt as select,qe as sign,ze as sin,He as sinh,Je as smoothstep,Ke as sqrt,Qe as step,Ut as storageBarrier,Y as sub,Lr as subgroupAdd,Nr as subgroupAll,_r as subgroupAnd,Mr as subgroupAny,Gr as subgroupBallot,Pr as subgroupBroadcast,Ur as subgroupBroadcastFirst,kr as subgroupElect,Wr as subgroupExclusiveAdd,jr as subgroupExclusiveMul,Br as subgroupInclusiveAdd,Yr as subgroupInclusiveMul,Xr as subgroupMax,Rr as subgroupMin,Zr as subgroupMul,qr as subgroupOr,zr as subgroupShuffle,Hr as subgroupShuffleDown,Jr as subgroupShuffleUp,Kr as subgroupShuffleXor,Qr as subgroupXor,et as tan,tt as tanh,kt as textureBarrier,Dr as textureDimensions,Cr as textureLoad,br as textureSample,Vr as textureSampleBaseClampToEdge,gr as textureSampleBias,Fr as textureSampleCompare,hr as textureSampleLevel,Sr as textureStore,Bt as translate4,C as translation4,rt as transpose,ot as trunc,at as unpack2x16float,st as unpack4x8unorm,Pt as workgroupBarrier};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/std/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/std/discard.ts","../../src/std/matrix.ts","../../src/std/atomic.ts","../../src/std/derivative.ts","../../src/std/array.ts","../../src/std/texture.ts","../../src/std/subgroup.ts","../../src/std/extensions.ts"],"sourcesContent":["import { snip } from '../data/snippet.ts';\nimport { Void } from '../data/wgslTypes.ts';\nimport { createDualImpl } from '../core/function/dualImpl.ts';\n\nexport const discard = createDualImpl(\n // CPU\n (): never => {\n throw new Error(\n '`discard` relies on GPU resources and cannot be executed outside of a draw call',\n );\n },\n // GPU\n () => snip('discard;', Void),\n 'discard',\n);\n","import { stitch } from '../core/resolve/stitch.ts';\nimport { snip } from '../data/snippet.ts';\nimport {\n rotationX4,\n rotationY4,\n rotationZ4,\n scaling4,\n translation4,\n} from '../data/matrix.ts';\nimport type { m4x4f, v3f } from '../data/wgslTypes.ts';\nimport { createDualImpl } from '../core/function/dualImpl.ts';\nimport { mul } from './operators.ts';\nimport { $internal } from '../shared/symbols.ts';\n\nconst cpuMul = mul[$internal].jsImpl;\n\nconst cpuTranslation4 = translation4[$internal].jsImpl;\nconst gpuTranslation4 = translation4[$internal].gpuImpl;\n\nconst cpuScaling4 = scaling4[$internal].jsImpl;\nconst gpuScaling4 = scaling4[$internal].gpuImpl;\n\nconst cpuRotationX4 = rotationX4[$internal].jsImpl;\nconst gpuRotationX4 = rotationX4[$internal].gpuImpl;\n\nconst cpuRotationY4 = rotationY4[$internal].jsImpl;\nconst gpuRotationY4 = rotationY4[$internal].gpuImpl;\n\nconst cpuRotationZ4 = rotationZ4[$internal].jsImpl;\nconst gpuRotationZ4 = rotationZ4[$internal].gpuImpl;\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 = createDualImpl(\n // CPU implementation\n (matrix: m4x4f, vector: v3f) => cpuMul(cpuTranslation4(vector), matrix),\n // GPU implementation\n (matrix, vector) =>\n snip(stitch`(${gpuTranslation4(vector)} * ${matrix})`, matrix.dataType),\n 'translate4',\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 = createDualImpl(\n // CPU implementation\n (matrix: m4x4f, vector: v3f) => cpuMul(cpuScaling4(vector), matrix),\n // GPU implementation\n (matrix, vector) =>\n snip(stitch`(${(gpuScaling4(vector))} * ${matrix})`, matrix.dataType),\n 'scale4',\n);\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 = createDualImpl(\n // CPU implementation\n (matrix: m4x4f, angle: number) => cpuMul(cpuRotationX4(angle), matrix),\n // GPU implementation\n (matrix, angle) =>\n snip(stitch`(${(gpuRotationX4(angle))} * ${matrix})`, matrix.dataType),\n 'rotateX4',\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 = createDualImpl(\n // CPU implementation\n (matrix: m4x4f, angle: number) => cpuMul(cpuRotationY4(angle), matrix),\n // GPU implementation\n (matrix, angle) =>\n snip(stitch`(${(gpuRotationY4(angle))} * ${matrix})`, matrix.dataType),\n 'rotateY4',\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 = createDualImpl(\n // CPU implementation\n (matrix: m4x4f, angle: number) => cpuMul(cpuRotationZ4(angle), matrix),\n // GPU implementation\n (matrix, angle) =>\n snip(stitch`(${(gpuRotationZ4(angle))} * ${matrix})`, matrix.dataType),\n 'rotateZ4',\n);\n","import { createDualImpl } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport { i32, u32 } from '../data/numeric.ts';\nimport { snip, type Snippet } from '../data/snippet.ts';\nimport {\n type AnyWgslData,\n type atomicI32,\n type atomicU32,\n isWgslData,\n Void,\n} from '../data/wgslTypes.ts';\nimport { safeStringify } from '../shared/stringify.ts';\ntype AnyAtomic = atomicI32 | atomicU32;\n\nexport const workgroupBarrier = createDualImpl(\n // CPU implementation\n () => console.warn('workgroupBarrier is a no-op outside of CODEGEN mode.'),\n // CODEGEN implementation\n () => snip('workgroupBarrier()', Void),\n 'workgroupBarrier',\n);\n\nexport const storageBarrier = createDualImpl(\n // CPU implementation\n () => console.warn('storageBarrier is a no-op outside of CODEGEN mode.'),\n // CODEGEN implementation\n () => snip('storageBarrier()', Void),\n 'storageBarrier',\n);\n\nexport const textureBarrier = createDualImpl(\n // CPU implementation\n () => console.warn('textureBarrier is a no-op outside of CODEGEN mode.'),\n // CODEGEN implementation\n () => snip('textureBarrier()', Void),\n 'textureBarrier',\n);\n\nexport const atomicLoad = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicLoad(&${a})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicLoad',\n);\n\nexport const atomicStore = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): void => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (!isWgslData(a.dataType) || a.dataType.type !== 'atomic') {\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n }\n return snip(stitch`atomicStore(&${a}, ${value})`, Void);\n },\n 'atomicStore',\n);\n\nconst atomicTypeFn = (a: Snippet, _value: Snippet): AnyWgslData[] => {\n if (a.dataType.type === 'atomic' && a.dataType.inner.type === 'i32') {\n return [a.dataType, i32];\n }\n return [a.dataType as AnyWgslData, u32];\n};\n\nexport const atomicAdd = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicAdd(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicAdd',\n atomicTypeFn,\n);\n\nexport const atomicSub = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicSub(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicSub',\n atomicTypeFn,\n);\n\nexport const atomicMax = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicMax(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicMax',\n atomicTypeFn,\n);\n\nexport const atomicMin = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicMin(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicMin',\n atomicTypeFn,\n);\n\nexport const atomicAnd = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicAnd(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicAnd',\n atomicTypeFn,\n);\n\nexport const atomicOr = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicOr(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicOr',\n atomicTypeFn,\n);\n\nexport const atomicXor = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicXor(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicXor',\n atomicTypeFn,\n);\n","import { createDualImpl } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport { snip } from '../data/snippet.ts';\nimport type { AnyFloat32VecInstance } from '../data/wgslTypes.ts';\n\nfunction cpuDpdx(value: number): number;\nfunction cpuDpdx<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdx<T extends AnyFloat32VecInstance | number>(value: T): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdx = createDualImpl(\n cpuDpdx,\n (value) => snip(stitch`dpdx(${value})`, value.dataType),\n 'dpdx',\n);\n\nfunction cpuDpdxCoarse(value: number): number;\nfunction cpuDpdxCoarse<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdxCoarse<T extends AnyFloat32VecInstance | number>(\n value: T,\n): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdxCoarse = createDualImpl(\n cpuDpdxCoarse,\n (value) => snip(stitch`dpdxCoarse(${value})`, value.dataType),\n 'dpdxCoarse',\n);\n\nfunction cpuDpdxFine(value: number): number;\nfunction cpuDpdxFine<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdxFine<T extends AnyFloat32VecInstance | number>(value: T): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdxFine = createDualImpl(\n cpuDpdxFine,\n (value) => snip(stitch`dpdxFine(${value})`, value.dataType),\n 'dpdxFine',\n);\n\nfunction cpuDpdy(value: number): number;\nfunction cpuDpdy<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdy<T extends AnyFloat32VecInstance | number>(value: T): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdy = createDualImpl(\n cpuDpdy,\n (value) => snip(stitch`dpdy(${value})`, value.dataType),\n 'dpdy',\n);\n\nfunction cpuDpdyCoarse(value: number): number;\nfunction cpuDpdyCoarse<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdyCoarse<T extends AnyFloat32VecInstance | number>(\n value: T,\n): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdyCoarse = createDualImpl(\n cpuDpdyCoarse,\n (value) => snip(stitch`dpdyCoarse(${value})`, value.dataType),\n 'dpdyCoarse',\n);\n\nfunction cpuDpdyFine(value: number): number;\nfunction cpuDpdyFine<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdyFine<T extends AnyFloat32VecInstance | number>(value: T): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdyFine = createDualImpl(\n cpuDpdyFine,\n (value) => snip(stitch`dpdyFine(${value})`, value.dataType),\n 'dpdyFine',\n);\n\nfunction cpuFwidth(value: number): number;\nfunction cpuFwidth<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuFwidth<T extends AnyFloat32VecInstance | number>(value: T): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const fwidth = createDualImpl(\n cpuFwidth,\n (value) => snip(stitch`fwidth(${value})`, value.dataType),\n 'fwidth',\n);\n\nfunction cpuFwidthCoarse(value: number): number;\nfunction cpuFwidthCoarse<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuFwidthCoarse<T extends AnyFloat32VecInstance | number>(\n value: T,\n): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const fwidthCoarse = createDualImpl(\n cpuFwidthCoarse,\n (value) => snip(stitch`fwidthCoarse(${value})`, value.dataType),\n 'fwidthCoarse',\n);\n\nfunction cpuFwidthFine(value: number): number;\nfunction cpuFwidthFine<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuFwidthFine<T extends AnyFloat32VecInstance | number>(\n value: T,\n): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const fwidthFine = createDualImpl(\n cpuFwidthFine,\n (value) => snip(stitch`fwidthFine(${value})`, value.dataType),\n 'fwidthFine',\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 { 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[]) => a.length,\n codegenImpl(a) {\n const length = sizeOfPointedToArray(a.dataType);\n return length > 0 ? String(length) : stitch`arrayLength(${a})`;\n },\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 } from '../core/function/dualImpl.ts';\nimport { f32, u32 } from '../data/numeric.ts';\nimport { vec2u, vec3u, vec4f, vec4i, vec4u } from '../data/vector.ts';\nimport {\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 type StorageTextureFormats,\n type TextureFormats,\n 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 textureExternal,\n textureMultisampled2d,\n textureStorage1d,\n textureStorage2d,\n textureStorage2dArray,\n textureStorage3d,\n} from '../data/texture.ts';\n\nimport type { AnyData } from '../data/dataTypes.ts';\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 Error(\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: (...args) => stitch`textureSample(${args})`,\n signature: (...args) => {\n const isDepth = (args[0] as WgslTexture).type.startsWith('texture_depth');\n return {\n argTypes: args as AnyData[],\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 Error(\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: (...args) => stitch`textureSampleBias(${args})`,\n signature: (...args) => ({\n argTypes: args as AnyData[],\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 Error(\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: (...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 Error(\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: (...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 = textureFormats[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 Error(\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: (...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 Error(\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: (...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\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 textureCubeArray>(\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 Error(\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: (...args) => stitch`textureSampleCompare(${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 Error(\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: (...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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (e, delta) => 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: (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: (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: (e) => stitch`subgroupXor(${e})`,\n});\n","import type { DualFn } from '../data/dualFn.ts';\nimport { bool } from '../data/index.ts';\nimport { snip, type Snippet } from '../data/snippet.ts';\nimport { getResolutionCtx, inCodegenMode } from '../execMode.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport { type WgslExtension, wgslExtensions } from '../wgslExtensions.ts';\n\nexport const extensionEnabled: DualFn<\n (extensionName: WgslExtension) => boolean\n> = (() => {\n const jsImpl = (extensionName: WgslExtension) => {\n const resolutionCtx = getResolutionCtx();\n if (!resolutionCtx) {\n throw new Error(\n 'extensionEnabled can only be called in a GPU codegen context.',\n );\n }\n\n return (resolutionCtx.enableExtensions ?? []).includes(extensionName);\n };\n const gpuImpl = (extensionNameSnippet: Snippet) => {\n const { value } = extensionNameSnippet;\n if (\n typeof value !== 'string' ||\n !(wgslExtensions.includes(value as WgslExtension))\n ) {\n throw new Error(\n `extensionEnabled has to be called with a string literal representing a valid WGSL extension name. Got: ${value}`,\n );\n }\n return snip(jsImpl(value as WgslExtension), bool);\n };\n\n const impl = (extensionName: WgslExtension) => {\n if (inCodegenMode()) {\n return gpuImpl(extensionName as unknown as Snippet);\n }\n throw new Error(\n 'extensionEnabled can only be called in a GPU codegen context.',\n );\n };\n\n Object.defineProperty(impl, $internal, {\n value: {\n jsImpl,\n gpuImpl,\n argConversionHint: 'keep' as const,\n },\n });\n return impl;\n})() as unknown as DualFn<\n (extensionName: WgslExtension) => boolean\n>;\n"],"mappings":"0nCAIO,IAAMA,GAAUC,EAErB,IAAa,CACX,MAAM,IAAI,MACR,iFACF,CACF,EAEA,IAAMC,EAAK,WAAYC,CAAI,EAC3B,SACF,ECAA,IAAMC,EAASC,EAAIC,CAAS,EAAE,OAExBC,GAAkBC,EAAaF,CAAS,EAAE,OAC1CG,GAAkBD,EAAaF,CAAS,EAAE,QAE1CI,GAAcC,EAASL,CAAS,EAAE,OAClCM,GAAcD,EAASL,CAAS,EAAE,QAElCO,GAAgBC,EAAWR,CAAS,EAAE,OACtCS,GAAgBD,EAAWR,CAAS,EAAE,QAEtCU,GAAgBC,EAAWX,CAAS,EAAE,OACtCY,GAAgBD,EAAWX,CAAS,EAAE,QAEtCa,GAAgBC,EAAWd,CAAS,EAAE,OACtCe,GAAgBD,EAAWd,CAAS,EAAE,QAQ/BgB,GAAaC,EAExB,CAACC,EAAeC,IAAgBrB,EAAOG,GAAgBkB,CAAM,EAAGD,CAAM,EAEtE,CAACA,EAAQC,I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jH,EAEF,OAAOE,EAAKR,EAAOM,CAAsB,EAAGG,CAAI,CAClD,EAEMC,EAAQT,GAAiC,CAC7C,GAAIU,EAAc,EAChB,OAAOP,EAAQH,CAAmC,EAEpD,MAAM,IAAI,MACR,+DACF,CACF,EAEA,cAAO,eAAeS,EAAME,EAAW,CACrC,MAAO,CACL,OAAAZ,EACA,QAAAI,EACA,kBAAmB,MACrB,CACF,CAAC,EACMM,CACT,GAAG","names":["discard","createDualImpl","snip","Void","cpuMul","mul","$internal","cpuTranslation4","translation4","gpuTranslation4","cpuScaling4","scaling4","gpuScaling4","cpuRotationX4","rotationX4","gpuRotationX4","cpuRotationY4","rotationY4","gpuRotationY4","cpuRotationZ4","rotationZ4","gpuRotationZ4","translate4","createDualImpl","matrix","vector","snip","stitch","scale4","rotateX4","angle","rotateY4","rotateZ4","workgroupBarrier","createDualImpl","snip","Void","storageBarrier","textureBarrier","atomicLoad","a","isWgslData","stitch","safeStringify","atomicStore","value","atomicTypeFn","_value","i32","u32","atomicAdd","atomicSub","atomicMax","atomicMin","atomicAnd","atomicOr","atomicXor","cpuDpdx","value","dpdx","createDualImpl","snip","stitch","cpuDpdxCoarse","dpdxCoarse","cpuDpdxFine","dpdxFine","cpuDpdy","dpdy","cpuDpdyCoarse","dpdyCoarse","cpuDpdyFine","dpdyFine","cpuFwidth","fwidth","cpuFwidthCoarse","fwidthCoarse","cpuFwidthFine","fwidthFine","sizeOfPointedToArray","dataType","isPtr","isWgslArray","arrayLength","dualImpl","arg","ptrArg","ptrFn","abstractInt","u32","a","length","stitch","sampleCpu","_texture","_sampler","_coords","_offsetOrArrayIndex","_maybeOffset","textureSample","dualImpl","args","stitch","isDepth","f32","vec4f","sampleBiasCpu","_biasOrArrayIndex","_biasOrOffset","textureSampleBias","sampleLevelCpu","_level","textureSampleLevel","textureLoadCpu","_levelOrArrayIndex","textureLoad","texture","isWgslTexture","sampleType","vec4u","vec4i","format","dataType","textureFormats","textureStoreCpu","_arrayIndexOrValue","_maybeValue","textureStore","Void","textureDimensionsCpu","textureDimensions","dim","u32","vec3u","vec2u","textureSampleCompareCpu","_depthRefOrArrayIndex","_depthRefOrOffset","textureSampleCompare","textureSampleBaseClampToEdgeCpu","sampler","coords","textureSampleBaseClampToEdge","errorMessage","subgroupAdd","dualImpl","arg","stitch","subgroupExclusiveAdd","subgroupInclusiveAdd","subgroupAll","bool","subgroupAnd","subgroupAny","subgroupBallot","vec4u","subgroupBroadcast","args","id","unify","i32","u32","index","subgroupBroadcastFirst","subgroupElect","subgroupMax","subgroupMin","subgroupMul","subgroupExclusiveMul","subgroupInclusiveMul","subgroupOr","subgroupShuffle","subgroupShuffleDown","delta","subgroupShuffleUp","subgroupShuffleXor","mask","subgroupXor","extensionEnabled","jsImpl","extensionName","resolutionCtx","getResolutionCtx","gpuImpl","extensionNameSnippet","value","wgslExtensions","snip","bool","impl","inCodegenMode","$internal"]}
|
|
1
|
+
{"version":3,"sources":["../../src/std/discard.ts","../../src/std/matrix.ts","../../src/std/atomic.ts","../../src/std/derivative.ts","../../src/std/array.ts","../../src/std/texture.ts","../../src/std/subgroup.ts","../../src/std/extensions.ts"],"sourcesContent":["import { snip } from '../data/snippet.ts';\nimport { Void } from '../data/wgslTypes.ts';\nimport { createDualImpl } from '../core/function/dualImpl.ts';\n\nexport const discard = createDualImpl(\n // CPU\n (): never => {\n throw new Error(\n '`discard` relies on GPU resources and cannot be executed outside of a draw call',\n );\n },\n // GPU\n () => snip('discard;', Void),\n 'discard',\n);\n","import { stitch } from '../core/resolve/stitch.ts';\nimport { snip } from '../data/snippet.ts';\nimport {\n rotationX4,\n rotationY4,\n rotationZ4,\n scaling4,\n translation4,\n} from '../data/matrix.ts';\nimport type { m4x4f, v3f } from '../data/wgslTypes.ts';\nimport { createDualImpl } from '../core/function/dualImpl.ts';\nimport { mul } from './operators.ts';\nimport { $internal } from '../shared/symbols.ts';\n\nconst cpuMul = mul[$internal].jsImpl;\n\nconst cpuTranslation4 = translation4[$internal].jsImpl;\nconst gpuTranslation4 = translation4[$internal].gpuImpl;\n\nconst cpuScaling4 = scaling4[$internal].jsImpl;\nconst gpuScaling4 = scaling4[$internal].gpuImpl;\n\nconst cpuRotationX4 = rotationX4[$internal].jsImpl;\nconst gpuRotationX4 = rotationX4[$internal].gpuImpl;\n\nconst cpuRotationY4 = rotationY4[$internal].jsImpl;\nconst gpuRotationY4 = rotationY4[$internal].gpuImpl;\n\nconst cpuRotationZ4 = rotationZ4[$internal].jsImpl;\nconst gpuRotationZ4 = rotationZ4[$internal].gpuImpl;\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 = createDualImpl(\n // CPU implementation\n (matrix: m4x4f, vector: v3f) => cpuMul(cpuTranslation4(vector), matrix),\n // GPU implementation\n (matrix, vector) =>\n snip(stitch`(${gpuTranslation4(vector)} * ${matrix})`, matrix.dataType),\n 'translate4',\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 = createDualImpl(\n // CPU implementation\n (matrix: m4x4f, vector: v3f) => cpuMul(cpuScaling4(vector), matrix),\n // GPU implementation\n (matrix, vector) =>\n snip(stitch`(${(gpuScaling4(vector))} * ${matrix})`, matrix.dataType),\n 'scale4',\n);\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 = createDualImpl(\n // CPU implementation\n (matrix: m4x4f, angle: number) => cpuMul(cpuRotationX4(angle), matrix),\n // GPU implementation\n (matrix, angle) =>\n snip(stitch`(${(gpuRotationX4(angle))} * ${matrix})`, matrix.dataType),\n 'rotateX4',\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 = createDualImpl(\n // CPU implementation\n (matrix: m4x4f, angle: number) => cpuMul(cpuRotationY4(angle), matrix),\n // GPU implementation\n (matrix, angle) =>\n snip(stitch`(${(gpuRotationY4(angle))} * ${matrix})`, matrix.dataType),\n 'rotateY4',\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 = createDualImpl(\n // CPU implementation\n (matrix: m4x4f, angle: number) => cpuMul(cpuRotationZ4(angle), matrix),\n // GPU implementation\n (matrix, angle) =>\n snip(stitch`(${(gpuRotationZ4(angle))} * ${matrix})`, matrix.dataType),\n 'rotateZ4',\n);\n","import { createDualImpl } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport { i32, u32 } from '../data/numeric.ts';\nimport { snip, type Snippet } from '../data/snippet.ts';\nimport {\n type AnyWgslData,\n type atomicI32,\n type atomicU32,\n isWgslData,\n Void,\n} from '../data/wgslTypes.ts';\nimport { safeStringify } from '../shared/stringify.ts';\ntype AnyAtomic = atomicI32 | atomicU32;\n\nexport const workgroupBarrier = createDualImpl(\n // CPU implementation\n () => console.warn('workgroupBarrier is a no-op outside of CODEGEN mode.'),\n // CODEGEN implementation\n () => snip('workgroupBarrier()', Void),\n 'workgroupBarrier',\n);\n\nexport const storageBarrier = createDualImpl(\n // CPU implementation\n () => console.warn('storageBarrier is a no-op outside of CODEGEN mode.'),\n // CODEGEN implementation\n () => snip('storageBarrier()', Void),\n 'storageBarrier',\n);\n\nexport const textureBarrier = createDualImpl(\n // CPU implementation\n () => console.warn('textureBarrier is a no-op outside of CODEGEN mode.'),\n // CODEGEN implementation\n () => snip('textureBarrier()', Void),\n 'textureBarrier',\n);\n\nexport const atomicLoad = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicLoad(&${a})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicLoad',\n);\n\nexport const atomicStore = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): void => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (!isWgslData(a.dataType) || a.dataType.type !== 'atomic') {\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n }\n return snip(stitch`atomicStore(&${a}, ${value})`, Void);\n },\n 'atomicStore',\n);\n\nconst atomicTypeFn = (a: Snippet, _value: Snippet): AnyWgslData[] => {\n if (a.dataType.type === 'atomic' && a.dataType.inner.type === 'i32') {\n return [a.dataType, i32];\n }\n return [a.dataType as AnyWgslData, u32];\n};\n\nexport const atomicAdd = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicAdd(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicAdd',\n atomicTypeFn,\n);\n\nexport const atomicSub = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicSub(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicSub',\n atomicTypeFn,\n);\n\nexport const atomicMax = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicMax(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicMax',\n atomicTypeFn,\n);\n\nexport const atomicMin = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicMin(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicMin',\n atomicTypeFn,\n);\n\nexport const atomicAnd = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicAnd(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicAnd',\n atomicTypeFn,\n);\n\nexport const atomicOr = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicOr(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicOr',\n atomicTypeFn,\n);\n\nexport const atomicXor = createDualImpl(\n // CPU implementation\n <T extends AnyAtomic>(a: T, value: number): number => {\n throw new Error(\n 'Atomic operations are not supported outside of CODEGEN mode.',\n );\n },\n // CODEGEN implementation\n (a, value) => {\n if (isWgslData(a.dataType) && a.dataType.type === 'atomic') {\n return snip(stitch`atomicXor(&${a}, ${value})`, a.dataType.inner);\n }\n throw new Error(\n `Invalid atomic type: ${safeStringify(a.dataType)}`,\n );\n },\n 'atomicXor',\n atomicTypeFn,\n);\n","import { createDualImpl } from '../core/function/dualImpl.ts';\nimport { stitch } from '../core/resolve/stitch.ts';\nimport { snip } from '../data/snippet.ts';\nimport type { AnyFloat32VecInstance } from '../data/wgslTypes.ts';\n\nfunction cpuDpdx(value: number): number;\nfunction cpuDpdx<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdx<T extends AnyFloat32VecInstance | number>(value: T): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdx = createDualImpl(\n cpuDpdx,\n (value) => snip(stitch`dpdx(${value})`, value.dataType),\n 'dpdx',\n);\n\nfunction cpuDpdxCoarse(value: number): number;\nfunction cpuDpdxCoarse<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdxCoarse<T extends AnyFloat32VecInstance | number>(\n value: T,\n): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdxCoarse = createDualImpl(\n cpuDpdxCoarse,\n (value) => snip(stitch`dpdxCoarse(${value})`, value.dataType),\n 'dpdxCoarse',\n);\n\nfunction cpuDpdxFine(value: number): number;\nfunction cpuDpdxFine<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdxFine<T extends AnyFloat32VecInstance | number>(value: T): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdxFine = createDualImpl(\n cpuDpdxFine,\n (value) => snip(stitch`dpdxFine(${value})`, value.dataType),\n 'dpdxFine',\n);\n\nfunction cpuDpdy(value: number): number;\nfunction cpuDpdy<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdy<T extends AnyFloat32VecInstance | number>(value: T): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdy = createDualImpl(\n cpuDpdy,\n (value) => snip(stitch`dpdy(${value})`, value.dataType),\n 'dpdy',\n);\n\nfunction cpuDpdyCoarse(value: number): number;\nfunction cpuDpdyCoarse<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdyCoarse<T extends AnyFloat32VecInstance | number>(\n value: T,\n): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdyCoarse = createDualImpl(\n cpuDpdyCoarse,\n (value) => snip(stitch`dpdyCoarse(${value})`, value.dataType),\n 'dpdyCoarse',\n);\n\nfunction cpuDpdyFine(value: number): number;\nfunction cpuDpdyFine<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuDpdyFine<T extends AnyFloat32VecInstance | number>(value: T): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const dpdyFine = createDualImpl(\n cpuDpdyFine,\n (value) => snip(stitch`dpdyFine(${value})`, value.dataType),\n 'dpdyFine',\n);\n\nfunction cpuFwidth(value: number): number;\nfunction cpuFwidth<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuFwidth<T extends AnyFloat32VecInstance | number>(value: T): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const fwidth = createDualImpl(\n cpuFwidth,\n (value) => snip(stitch`fwidth(${value})`, value.dataType),\n 'fwidth',\n);\n\nfunction cpuFwidthCoarse(value: number): number;\nfunction cpuFwidthCoarse<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuFwidthCoarse<T extends AnyFloat32VecInstance | number>(\n value: T,\n): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const fwidthCoarse = createDualImpl(\n cpuFwidthCoarse,\n (value) => snip(stitch`fwidthCoarse(${value})`, value.dataType),\n 'fwidthCoarse',\n);\n\nfunction cpuFwidthFine(value: number): number;\nfunction cpuFwidthFine<T extends AnyFloat32VecInstance>(value: T): T;\nfunction cpuFwidthFine<T extends AnyFloat32VecInstance | number>(\n value: T,\n): T {\n throw new Error('Derivative builtins are not allowed on the cpu');\n}\n\nexport const fwidthFine = createDualImpl(\n cpuFwidthFine,\n (value) => snip(stitch`fwidthFine(${value})`, value.dataType),\n 'fwidthFine',\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 { 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[]) => a.length,\n codegenImpl(a) {\n const length = sizeOfPointedToArray(a.dataType);\n return length > 0 ? String(length) : stitch`arrayLength(${a})`;\n },\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 } from '../core/function/dualImpl.ts';\nimport { f32, u32 } from '../data/numeric.ts';\nimport { vec2u, vec3u, vec4f, vec4i, vec4u } from '../data/vector.ts';\nimport {\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 type StorageTextureFormats,\n type TextureFormats,\n 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 textureExternal,\n textureMultisampled2d,\n textureStorage1d,\n textureStorage2d,\n textureStorage2dArray,\n textureStorage3d,\n} from '../data/texture.ts';\n\nimport type { AnyData } from '../data/dataTypes.ts';\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 Error(\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: (...args) => stitch`textureSample(${args})`,\n signature: (...args) => {\n const isDepth = (args[0] as WgslTexture).type.startsWith('texture_depth');\n return {\n argTypes: args as AnyData[],\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 Error(\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: (...args) => stitch`textureSampleBias(${args})`,\n signature: (...args) => ({\n argTypes: args as AnyData[],\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 Error(\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: (...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 Error(\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: (...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 = textureFormats[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 Error(\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: (...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 Error(\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: (...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\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 textureCubeArray>(\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 Error(\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: (...args) => stitch`textureSampleCompare(${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 Error(\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: (...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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (e, delta) => 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: (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: (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: (e) => stitch`subgroupXor(${e})`,\n});\n","import type { DualFn } from '../data/dualFn.ts';\nimport { bool } from '../data/index.ts';\nimport { snip, type Snippet } from '../data/snippet.ts';\nimport { getResolutionCtx, inCodegenMode } from '../execMode.ts';\nimport { $internal } from '../shared/symbols.ts';\nimport { type WgslExtension, wgslExtensions } from '../wgslExtensions.ts';\n\nexport const extensionEnabled: DualFn<\n (extensionName: WgslExtension) => boolean\n> = (() => {\n const jsImpl = (extensionName: WgslExtension) => {\n const resolutionCtx = getResolutionCtx();\n if (!resolutionCtx) {\n throw new Error(\n 'extensionEnabled can only be called in a GPU codegen context.',\n );\n }\n\n return (resolutionCtx.enableExtensions ?? []).includes(extensionName);\n };\n const gpuImpl = (extensionNameSnippet: Snippet) => {\n const { value } = extensionNameSnippet;\n if (\n typeof value !== 'string' ||\n !(wgslExtensions.includes(value as WgslExtension))\n ) {\n throw new Error(\n `extensionEnabled has to be called with a string literal representing a valid WGSL extension name. Got: ${value}`,\n );\n }\n return snip(jsImpl(value as WgslExtension), bool);\n };\n\n const impl = (extensionName: WgslExtension) => {\n if (inCodegenMode()) {\n return gpuImpl(extensionName as unknown as Snippet);\n }\n throw new Error(\n 'extensionEnabled can only be called in a GPU codegen context.',\n );\n };\n\n Object.defineProperty(impl, $internal, {\n value: {\n jsImpl,\n gpuImpl,\n argConversionHint: 'keep' as const,\n },\n });\n return impl;\n})() as unknown as DualFn<\n (extensionName: WgslExtension) => boolean\n>;\n"],"mappings":"unCAIO,IAAMA,GAAUC,EAErB,IAAa,CACX,MAAM,IAAI,MACR,iFACF,CACF,EAEA,IAAMC,EAAK,WAAYC,CAAI,EAC3B,SACF,ECAA,IAAMC,EAASC,EAAIC,CAAS,EAAE,OAExBC,GAAkBC,EAAaF,CAAS,EAAE,OAC1CG,GAAkBD,EAAaF,CAAS,EAAE,QAE1CI,GAAcC,EAASL,CAAS,EAAE,OAClCM,GAAcD,EAASL,CAAS,EAAE,QAElCO,GAAgBC,EAAWR,CAAS,EAAE,OACtCS,GAAgBD,EAAWR,CAAS,EAAE,QAEtCU,GAAgBC,EAAWX,CAAS,EAAE,OACtCY,GAAgBD,EAAWX,CAAS,EAAE,QAEtCa,GAAgBC,EAAWd,CAAS,EAAE,OACtCe,GAAgBD,EAAWd,CAAS,EAAE,QAQ/BgB,GAAaC,EAExB,CAACC,EAAeC,IAAgBrB,EAAOG,GAAgBkB,CAAM,EAAGD,CAAM,EAEtE,CAACA,EAAQC,IACPC,EAAKC,KAAUlB,GAAgBgB,CAAM,CAAC,MAAMD,CAAM,IAAKA,EAAO,QAAQ,EACxE,YACF,EAQaI,GAASL,EAEpB,CAACC,EAAeC,IAAgBrB,EAAOM,GAAYe,CAAM,EAAGD,CAAM,EAElE,CAACA,EAAQC,IACPC,EAAKC,KAAWf,GAAYa,CAAM,CAAE,MAAMD,CAAM,IAAKA,EAAO,QAAQ,EACtE,QACF,EAQaK,GAAWN,EAEtB,CAACC,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ip","Void","cpuMul","mul","$internal","cpuTranslation4","translation4","gpuTranslation4","cpuScaling4","scaling4","gpuScaling4","cpuRotationX4","rotationX4","gpuRotationX4","cpuRotationY4","rotationY4","gpuRotationY4","cpuRotationZ4","rotationZ4","gpuRotationZ4","translate4","createDualImpl","matrix","vector","snip","stitch","scale4","rotateX4","angle","rotateY4","rotateZ4","workgroupBarrier","createDualImpl","snip","Void","storageBarrier","textureBarrier","atomicLoad","a","isWgslData","stitch","safeStringify","atomicStore","value","atomicTypeFn","_value","i32","u32","atomicAdd","atomicSub","atomicMax","atomicMin","atomicAnd","atomicOr","atomicXor","cpuDpdx","value","dpdx","createDualImpl","snip","stitch","cpuDpdxCoarse","dpdxCoarse","cpuDpdxFine","dpdxFine","cpuDpdy","dpdy","cpuDpdyCoarse","dpdyCoarse","cpuDpdyFine","dpdyFine","cpuFwidth","fwidth","cpuFwidthCoarse","fwidthCoarse","cpuFwidthFine","fwidthFine","sizeOfPointedToArray","dataType","isPtr","isWgslArray","arrayLength","dualImpl","arg","ptrArg","ptrFn","abstractInt","u32","a","length","stitch","sampleCpu","_texture","_sampler","_coords","_offsetOrArrayIndex","_maybeOffset","textureSample","dualImpl","args","stitch","isDepth","f32","vec4f","sampleBiasCpu","_biasOrArrayIndex","_biasOrOffset","textureSampleBias","sampleLevelCpu","_level","textureSampleLevel","textureLoadCpu","_levelOrArrayIndex","textureLoad","texture","isWgslTexture","sampleType","vec4u","vec4i","format","dataType","textureFormats","textureStoreCpu","_arrayIndexOrValue","_maybeValue","textureStore","Void","textureDimensionsCpu","textureDimensions","dim","u32","vec3u","vec2u","textureSampleCompareCpu","_depthRefOrArrayIndex","_depthRefOrOffset","textureSampleCompare","textureSampleBaseClampToEdgeCpu","sampler","coords","textureSampleBaseClampToEdge","errorMessage","subgroupAdd","dualImpl","arg","stitch","subgroupExclusiveAdd","subgroupInclusiveAdd","subgroupAll","bool","subgroupAnd","subgroupAny","subgroupBallot","vec4u","subgroupBroadcast","args","id","unify","i32","u32","index","subgroupBroadcastFirst","subgroupElect","subgroupMax","subgroupMin","subgroupMul","subgroupExclusiveMul","subgroupInclusiveMul","subgroupOr","subgroupShuffle","subgroupShuffleDown","delta","subgroupShuffleUp","subgroupShuffleXor","mask","subgroupXor","extensionEnabled","jsImpl","extensionName","resolutionCtx","getResolutionCtx","gpuImpl","extensionNameSnippet","value","wgslExtensions","snip","bool","impl","inCodegenMode","$internal"]}
|
|
@@ -2690,7 +2690,7 @@ interface ColorAttachment {
|
|
|
2690
2690
|
* A {@link GPUTextureView} describing the texture subresource that will be output to for this
|
|
2691
2691
|
* color attachment.
|
|
2692
2692
|
*/
|
|
2693
|
-
view: (TgpuTexture & RenderFlag) | GPUTextureView
|
|
2693
|
+
view: (TgpuTexture & RenderFlag) | GPUTextureView | TgpuTextureView<WgslTexture>;
|
|
2694
2694
|
/**
|
|
2695
2695
|
* Indicates the depth slice index of {@link GPUTextureViewDimension#"3d"} {@link GPURenderPassColorAttachment#view}
|
|
2696
2696
|
* that will be output to for this color attachment.
|
|
@@ -3256,6 +3256,15 @@ interface TgpuGuardedComputePipeline<TArgs extends number[] = number[]> {
|
|
|
3256
3256
|
* "guarded" by a bounds check.
|
|
3257
3257
|
*/
|
|
3258
3258
|
dispatchThreads(...args: TArgs): void;
|
|
3259
|
+
/**
|
|
3260
|
+
* The underlying pipeline used during `dispatchThreads`.
|
|
3261
|
+
*/
|
|
3262
|
+
pipeline: TgpuComputePipeline;
|
|
3263
|
+
/**
|
|
3264
|
+
* The buffer used to automatically pass the thread count to the underlying pipeline during `dispatchThreads`.
|
|
3265
|
+
* For pipelines with a dimension count lower than 3, the remaining coordinates are expected to be 1.
|
|
3266
|
+
*/
|
|
3267
|
+
sizeUniform: TgpuUniform<Vec3u>;
|
|
3259
3268
|
}
|
|
3260
3269
|
interface WithCompute {
|
|
3261
3270
|
createPipeline(): TgpuComputePipeline;
|
|
@@ -3654,18 +3663,14 @@ interface TgpuRoot extends Unwrapper {
|
|
|
3654
3663
|
interface ExperimentalTgpuRoot extends TgpuRoot, WithBinding {
|
|
3655
3664
|
readonly nameRegistrySetting: 'strict' | 'random';
|
|
3656
3665
|
readonly shaderGenerator?: ShaderGenerator | undefined;
|
|
3657
|
-
/**
|
|
3658
|
-
* The current command encoder. This property will
|
|
3659
|
-
* hold the same value until `flush()` is called.
|
|
3660
|
-
*/
|
|
3661
|
-
readonly commandEncoder: GPUCommandEncoder;
|
|
3662
3666
|
createTexture<TWidth extends number, THeight extends number, TDepth extends number, TSize extends readonly [TWidth] | readonly [TWidth, THeight] | readonly [TWidth, THeight, TDepth], TFormat extends GPUTextureFormat, TMipLevelCount extends number, TSampleCount extends number, TViewFormats extends GPUTextureFormat[], TDimension extends GPUTextureDimension>(props: CreateTextureOptions<TSize, TFormat, TMipLevelCount, TSampleCount, TViewFormats, TDimension>): TgpuTexture<CreateTextureResult<TSize, TFormat, TMipLevelCount, TSampleCount, TViewFormats, TDimension>>;
|
|
3663
3667
|
beginRenderPass(descriptor: GPURenderPassDescriptor, callback: (pass: RenderPass) => void): void;
|
|
3664
3668
|
createSampler(props: WgslSamplerProps): TgpuFixedSampler;
|
|
3665
3669
|
createComparisonSampler(props: WgslComparisonSamplerProps): TgpuFixedComparisonSampler;
|
|
3666
3670
|
/**
|
|
3667
|
-
*
|
|
3668
|
-
* submitted to the GPU
|
|
3671
|
+
* @deprecated Used to cause all commands enqueued by pipelines to be
|
|
3672
|
+
* submitted to the GPU, but now commands are immediately dispatched,
|
|
3673
|
+
* which makes this method unnecessary.
|
|
3669
3674
|
*/
|
|
3670
3675
|
flush(): void;
|
|
3671
3676
|
}
|