typegpu 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunk-DVZNNZFQ.js +2 -0
- package/{chunk-VOFHV4Z6.js.map → chunk-DVZNNZFQ.js.map} +1 -1
- package/chunk-FM3TKZFZ.cjs +2 -0
- package/chunk-FM3TKZFZ.cjs.map +1 -0
- package/chunk-M4VUFFPZ.cjs +4 -0
- package/chunk-M4VUFFPZ.cjs.map +1 -0
- package/chunk-RMXVIINO.js +2 -0
- package/{chunk-KVOFUY5A.js.map → chunk-RMXVIINO.js.map} +1 -1
- package/chunk-UHU5Z2IS.js +4 -0
- package/{chunk-DR55IHDD.js.map → chunk-UHU5Z2IS.js.map} +1 -1
- package/chunk-UPPJES6W.cjs +2 -0
- package/chunk-UPPJES6W.cjs.map +1 -0
- package/data/index.cjs +1 -1
- package/data/index.cjs.map +1 -1
- package/data/index.js +1 -1
- package/index.cjs +17 -17
- package/index.cjs.map +1 -1
- package/index.js +17 -17
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/std/index.cjs +1 -1
- package/std/index.cjs.map +1 -1
- package/std/index.js +1 -1
- package/chunk-3JTP2ATR.cjs +0 -2
- package/chunk-3JTP2ATR.cjs.map +0 -1
- package/chunk-3QXCKMEJ.cjs +0 -2
- package/chunk-3QXCKMEJ.cjs.map +0 -1
- package/chunk-DR55IHDD.js +0 -4
- package/chunk-KVOFUY5A.js +0 -2
- package/chunk-QRLTUOBJ.cjs +0 -4
- package/chunk-QRLTUOBJ.cjs.map +0 -1
- package/chunk-VOFHV4Z6.js +0 -2
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;var _chunkM4VUFFPZcjs = require('./chunk-M4VUFFPZ.cjs');function Q(t){let e=n=>n;return Object.setPrototypeOf(e,X),e.propTypes=t,e}var X={type:"struct",_label:void 0,get label(){return this._label},$name(t){return this._label=t,this},toString(){return`struct:${_nullishCoalesce(this.label, () => ("<unnamed>"))}`}};var d=(t,e)=>{let n=e-1,i=~n;return(t&n)===0?t:(t&i)+e};var $=["uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],Vt= exports.b ={f32:"float32",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",f16:"float16",vec2h:"float16x2",vec4h:"float16x4",u32:"uint32",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",i32:"sint32",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4"};var Y=["unstruct","disarray","loose-decorated",...$];function _(t){return Y.includes(_optionalChain([t, 'optionalAccess', _2 => _2.type]))}function T(t){return _optionalChain([t, 'optionalAccess', _3 => _3.type])==="disarray"}function g(t){return _optionalChain([t, 'optionalAccess', _4 => _4.type])==="unstruct"}function l(t){return _optionalChain([t, 'optionalAccess', _5 => _5.type])==="loose-decorated"}function b(t){return _optionalChain([t, 'access', _6 => _6.attribs, 'optionalAccess', _7 => _7.find, 'call', _8 => _8(_chunkM4VUFFPZcjs.X), 'optionalAccess', _9 => _9.value])}function j(t){return _optionalChain([t, 'access', _10 => _10.attribs, 'optionalAccess', _11 => _11.find, 'call', _12 => _12(_chunkM4VUFFPZcjs.Y), 'optionalAccess', _13 => _13.value])}function _t(t){return _optionalChain([t, 'access', _14 => _14.attribs, 'optionalAccess', _15 => _15.find, 'call', _16 => _16(_chunkM4VUFFPZcjs.Z), 'optionalAccess', _17 => _17.value])}function Z(t){return _chunkM4VUFFPZcjs.S.call(void 0, t)||_(t)}var r=class{constructor(e){this.type=e}},tt= exports.k ={uint8:_chunkM4VUFFPZcjs.I,uint8x2:_chunkM4VUFFPZcjs.s,uint8x4:_chunkM4VUFFPZcjs.A,sint8:_chunkM4VUFFPZcjs.J,sint8x2:_chunkM4VUFFPZcjs.r,sint8x4:_chunkM4VUFFPZcjs.z,unorm8:_chunkM4VUFFPZcjs.K,unorm8x2:_chunkM4VUFFPZcjs.p,unorm8x4:_chunkM4VUFFPZcjs.x,snorm8:_chunkM4VUFFPZcjs.K,snorm8x2:_chunkM4VUFFPZcjs.p,snorm8x4:_chunkM4VUFFPZcjs.x,uint16:_chunkM4VUFFPZcjs.I,uint16x2:_chunkM4VUFFPZcjs.s,uint16x4:_chunkM4VUFFPZcjs.A,sint16:_chunkM4VUFFPZcjs.J,sint16x2:_chunkM4VUFFPZcjs.r,sint16x4:_chunkM4VUFFPZcjs.z,unorm16:_chunkM4VUFFPZcjs.K,unorm16x2:_chunkM4VUFFPZcjs.p,unorm16x4:_chunkM4VUFFPZcjs.x,snorm16:_chunkM4VUFFPZcjs.K,snorm16x2:_chunkM4VUFFPZcjs.p,snorm16x4:_chunkM4VUFFPZcjs.x,float16:_chunkM4VUFFPZcjs.K,float16x2:_chunkM4VUFFPZcjs.p,float16x4:_chunkM4VUFFPZcjs.x,float32:_chunkM4VUFFPZcjs.K,float32x2:_chunkM4VUFFPZcjs.p,float32x3:_chunkM4VUFFPZcjs.t,float32x4:_chunkM4VUFFPZcjs.x,uint32:_chunkM4VUFFPZcjs.I,uint32x2:_chunkM4VUFFPZcjs.s,uint32x3:_chunkM4VUFFPZcjs.w,uint32x4:_chunkM4VUFFPZcjs.A,sint32:_chunkM4VUFFPZcjs.J,sint32x2:_chunkM4VUFFPZcjs.r,sint32x3:_chunkM4VUFFPZcjs.v,sint32x4:_chunkM4VUFFPZcjs.z,"unorm10-10-10-2":_chunkM4VUFFPZcjs.x,"unorm8x4-bgra":_chunkM4VUFFPZcjs.x},K= exports.l =Object.keys(tt),Ut= exports.m =new r("uint8"),Ct= exports.n =new r("uint8x2"),zt= exports.o =new r("uint8x4"),Et= exports.p =new r("sint8"),Ot= exports.q =new r("sint8x2"),Rt= exports.r =new r("sint8x4"),Mt= exports.s =new r("unorm8"),Nt= exports.t =new r("unorm8x2"),Gt= exports.u =new r("unorm8x4"),$t= exports.v =new r("snorm8"),jt= exports.w =new r("snorm8x2"),Kt= exports.x =new r("snorm8x4"),Ht= exports.y =new r("uint16"),Jt= exports.z =new r("uint16x2"),qt= exports.A =new r("uint16x4"),Qt= exports.B =new r("sint16"),Xt= exports.C =new r("sint16x2"),Yt= exports.D =new r("sint16x4"),Zt= exports.E =new r("unorm16"),te= exports.F =new r("unorm16x2"),ee= exports.G =new r("unorm16x4"),re= exports.H =new r("snorm16"),ne= exports.I =new r("snorm16x2"),oe= exports.J =new r("snorm16x4"),ie= exports.K =new r("float16"),ae= exports.L =new r("float16x2"),se= exports.M =new r("float16x4"),pe= exports.N =new r("float32"),ue= exports.O =new r("float32x2"),xe= exports.P =new r("float32x3"),le= exports.Q =new r("float32x4"),me= exports.R =new r("uint32"),ce= exports.S =new r("uint32x2"),ye= exports.T =new r("uint32x3"),fe= exports.U =new r("uint32x4"),de= exports.V =new r("sint32"),Te= exports.W =new r("sint32x2"),ge= exports.X =new r("sint32x3"),be= exports.Y =new r("sint32x4"),De= exports.Z =new r("unorm10-10-10-2"),Ae= exports._ =new r("unorm8x4-bgra");var et={bool:4,f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2h:4,vec2i:8,vec2u:8,vec3f:16,vec3h:8,vec3i:16,vec3u:16,vec4f:16,vec4h:8,vec4i:16,vec4u:16,mat2x2f:8,mat3x3f:16,mat4x4f:16,atomic:4};function rt(t){let e=_optionalChain([t, 'optionalAccess', _18 => _18.type]),n=et[e];if(n!==void 0)return n;if(_chunkM4VUFFPZcjs.U.call(void 0, t))return Object.values(t.propTypes).map(u).reduce((i,c)=>i>c?i:c);if(_chunkM4VUFFPZcjs.T.call(void 0, t))return u(t.elementType);if(g(t)){let i=Object.values(t.propTypes)[0];return i?_nullishCoalesce(b(i), () => (1)):1}if(T(t))return _nullishCoalesce(b(t.elementType), () => (1));if(_chunkM4VUFFPZcjs.aa.call(void 0, t)||l(t))return _nullishCoalesce(b(t), () => (u(t.inner)));if(K.includes(e))return 1;throw new Error(`Cannot determine alignment of data: ${JSON.stringify(t)}`)}function nt(t){if(g(t)){let e=Object.values(t.propTypes)[0];return e?D(e):1}return T(t)?D(t.elementType):l(t)?_nullishCoalesce(b(t), () => (D(t.inner))):_nullishCoalesce(b(t), () => (1))}var H=new WeakMap,J=new WeakMap;function u(t){let e=H.get(t);return e===void 0&&(e=rt(t),H.set(t,e)),e}function D(t){let e=J.get(t);return e===void 0&&(e=nt(t),J.set(t,e)),e}function ot(t){return u(t)}var it={bool:4,f32:4,f16:2,i32:4,u32:4,vec2f:8,vec2h:4,vec2i:8,vec2u:8,vec3f:12,vec3h:6,vec3i:12,vec3u:12,vec4f:16,vec4h:8,vec4i:16,vec4u:16,mat2x2f:16,mat3x3f:48,mat4x4f:64,uint8:1,uint8x2:2,uint8x4:4,sint8:1,sint8x2:2,sint8x4:4,unorm8:1,unorm8x2:2,unorm8x4:4,snorm8:1,snorm8x2:2,snorm8x4:4,uint16:2,uint16x2:4,uint16x4:8,sint16:2,sint16x2:4,sint16x4:8,unorm16:2,unorm16x2:4,unorm16x4:8,snorm16:2,snorm16x2:4,snorm16x4:8,float16:2,float16x2:4,float16x4:8,float32:4,float32x2:8,float32x3:12,float32x4:16,uint32:4,uint32x2:8,uint32x3:12,uint32x4:16,sint32:4,sint32x2:8,sint32x3:12,sint32x4:16,"unorm10-10-10-2":4,"unorm8x4-bgra":4,atomic:4};function at(t){let e=0;for(let n of Object.values(t.propTypes)){if(Number.isNaN(e))throw new Error("Only the last property of a struct can be unbounded");if(e=d(e,u(n)),e+=x(n),Number.isNaN(e)&&n.type!=="array")throw new Error("Cannot nest unbounded struct within another struct")}return d(e,u(t))}function st(t){let e=0;for(let n of Object.values(t.propTypes)){let i=D(n);e=d(e,i),e+=x(n)}return e}function pt(t){let e=it[_optionalChain([t, 'optionalAccess', _19 => _19.type])];if(e!==void 0)return e;if(_chunkM4VUFFPZcjs.U.call(void 0, t))return at(t);if(g(t))return st(t);if(_chunkM4VUFFPZcjs.T.call(void 0, t)){if(t.elementCount===0)return Number.NaN;let n=u(t.elementType);return d(x(t.elementType),n)*t.elementCount}if(T(t)){let n=D(t.elementType);return d(x(t.elementType),n)*t.elementCount}if(_chunkM4VUFFPZcjs.aa.call(void 0, t)||l(t))return _nullishCoalesce(j(t), () => (x(t.inner)));throw new Error(`Cannot determine size of data: ${t}`)}var q=new WeakMap;function x(t){let e=q.get(t);return e===void 0&&(e=pt(t),q.set(t,e)),e}function ut(t){return x(t)}function R(t,e){return new O(t,e)}var O= (_class =class{constructor(e,n){;_class.prototype.__init.call(this);this.elementType=e;this.elementCount=n;if(Number.isNaN(x(e)))throw new Error("Cannot nest runtime sized arrays.");if(!Number.isInteger(n)||n<0)throw new Error(`Cannot create array schema with invalid element count: ${n}.`)}__init() {this.type="array"}toString(){return`arrayOf(${this.elementType})`}}, _class);function xt(t){return{type:"ptr",inner:t,addressSpace:"function",access:"read-write"}}function lt(t){return{type:"ptr",inner:t,addressSpace:"private",access:"read-write"}}function mt(t){return{type:"ptr",inner:t,addressSpace:"workgroup",access:"read-write"}}function ct(t,e="read"){return{type:"ptr",inner:t,addressSpace:"storage",access:e}}function yt(t){return{type:"ptr",inner:t,addressSpace:"uniform",access:"read"}}function ft(t){return{type:"ptr",inner:t,addressSpace:"handle",access:"read"}}function dt(t,e){return new M(t,e)}var M= (_class2 =class{constructor(e,n){;_class2.prototype.__init2.call(this);this.elementType=e;this.elementCount=n;if(!Number.isInteger(n)||n<0)throw new Error(`Cannot create disarray schema with invalid element count: ${n}.`)}__init2() {this.type="disarray"}}, _class2);function Tt(t){return new N(t)}var N= (_class3 =class{constructor(e){;_class3.prototype.__init3.call(this);this.propTypes=e}__init3() {this.type="unstruct"}get label(){return this._label}$name(e){return this._label=e,this}}, _class3);function gt(t){return new G(t)}var G= (_class4 =class{constructor(e){;_class4.prototype.__init4.call(this);this.inner=e}__init4() {this.type="atomic"}}, _class4);function o(t,e){return _chunkM4VUFFPZcjs.aa.call(void 0, t)?new k(t.inner,[e,...t.attribs]):l(t)?new W(t.inner,[e,...t.attribs]):_(t)?new W(t,[e]):new k(t,[e])}function bt(t,e){return o(e,{type:"@align",value:t})}function Dt(t,e){return o(e,{type:"@size",value:t})}function At(t,e){return o(e,{type:"@location",value:t})}function It(t,e){return o(e,{type:"@interpolate",value:t})}function vt(t){return(_chunkM4VUFFPZcjs.aa.call(void 0, t)||l(t))&&t.attribs.find(_chunkM4VUFFPZcjs.$)!==void 0}function Ne(t){return!_chunkM4VUFFPZcjs.aa.call(void 0, t)&&!l(t)?"":t.attribs.map(e=>`${e.type}(${e.value}) `).join("")}var L=class{constructor(e,n){this.inner=e;this.attribs=n;let i=_optionalChain([n, 'access', _20 => _20.find, 'call', _21 => _21(_chunkM4VUFFPZcjs.X), 'optionalAccess', _22 => _22.value]),c=_optionalChain([n, 'access', _23 => _23.find, 'call', _24 => _24(_chunkM4VUFFPZcjs.Y), 'optionalAccess', _25 => _25.value]);if(i!==void 0){if(i<=0)throw new Error(`Custom data alignment must be a positive number, got: ${i}.`);if(Math.log2(i)%1!==0)throw new Error(`Alignment has to be a power of 2, got: ${i}.`);if(_chunkM4VUFFPZcjs.S.call(void 0, this.inner)&&i%u(this.inner)!==0)throw new Error(`Custom alignment has to be a multiple of the standard data alignment. Got: ${i}, expected multiple of: ${u(this.inner)}.`)}if(c!==void 0){if(c<x(this.inner))throw new Error(`Custom data size cannot be smaller then the standard data size. Got: ${c}, expected at least: ${x(this.inner)}.`);if(c<=0)throw new Error(`Custom data size must be a positive number. Got: ${c}.`)}}},k= (_class5 =class extends L{constructor(...args) { super(...args); _class5.prototype.__init5.call(this); }__init5() {this.type="decorated"}}, _class5),W= (_class6 =class extends L{constructor(...args2) { super(...args2); _class6.prototype.__init6.call(this); }__init6() {this.type="loose-decorated"}}, _class6);var wt={vertexIndex:o(_chunkM4VUFFPZcjs.I,{type:"@builtin",value:"vertex_index"}),instanceIndex:o(_chunkM4VUFFPZcjs.I,{type:"@builtin",value:"instance_index"}),position:o(_chunkM4VUFFPZcjs.x,{type:"@builtin",value:"position"}),clipDistances:o(R(_chunkM4VUFFPZcjs.I,8),{type:"@builtin",value:"clip_distances"}),frontFacing:o(_chunkM4VUFFPZcjs.K,{type:"@builtin",value:"front_facing"}),fragDepth:o(_chunkM4VUFFPZcjs.K,{type:"@builtin",value:"frag_depth"}),sampleIndex:o(_chunkM4VUFFPZcjs.I,{type:"@builtin",value:"sample_index"}),sampleMask:o(_chunkM4VUFFPZcjs.I,{type:"@builtin",value:"sample_mask"}),localInvocationId:o(_chunkM4VUFFPZcjs.w,{type:"@builtin",value:"local_invocation_id"}),localInvocationIndex:o(_chunkM4VUFFPZcjs.I,{type:"@builtin",value:"local_invocation_index"}),globalInvocationId:o(_chunkM4VUFFPZcjs.w,{type:"@builtin",value:"global_invocation_id"}),workgroupId:o(_chunkM4VUFFPZcjs.w,{type:"@builtin",value:"workgroup_id"}),numWorkgroups:o(_chunkM4VUFFPZcjs.w,{type:"@builtin",value:"num_workgroups"}),subgroupInvocationId:o(_chunkM4VUFFPZcjs.I,{type:"@builtin",value:"subgroup_invocation_id"}),subgroupSize:o(_chunkM4VUFFPZcjs.I,{type:"@builtin",value:"subgroup_size"})};exports.a = $; exports.b = Vt; exports.c = _; exports.d = T; exports.e = g; exports.f = l; exports.g = _t; exports.h = Z; exports.i = Q; exports.j = d; exports.k = tt; exports.l = K; exports.m = Ut; exports.n = Ct; exports.o = zt; exports.p = Et; exports.q = Ot; exports.r = Rt; exports.s = Mt; exports.t = Nt; exports.u = Gt; exports.v = $t; exports.w = jt; exports.x = Kt; exports.y = Ht; exports.z = Jt; exports.A = qt; exports.B = Qt; exports.C = Xt; exports.D = Yt; exports.E = Zt; exports.F = te; exports.G = ee; exports.H = re; exports.I = ne; exports.J = oe; exports.K = ie; exports.L = ae; exports.M = se; exports.N = pe; exports.O = ue; exports.P = xe; exports.Q = le; exports.R = me; exports.S = ce; exports.T = ye; exports.U = fe; exports.V = de; exports.W = Te; exports.X = ge; exports.Y = be; exports.Z = De; exports._ = Ae; exports.$ = u; exports.aa = D; exports.ba = ot; exports.ca = x; exports.da = ut; exports.ea = R; exports.fa = xt; exports.ga = lt; exports.ha = mt; exports.ia = ct; exports.ja = yt; exports.ka = ft; exports.la = dt; exports.ma = Tt; exports.na = gt; exports.oa = o; exports.pa = bt; exports.qa = Dt; exports.ra = At; exports.sa = It; exports.ta = vt; exports.ua = Ne; exports.va = wt;
|
2
|
+
//# sourceMappingURL=chunk-UPPJES6W.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-UPPJES6W.cjs","../src/data/struct.ts"],"names":["struct","props","WgslStructImpl","label"],"mappings":"AAAA,szBAA8K,SCoD9JA,CAAAA,CACdC,CAAAA,CAC8B,CAC9B,IAAMD,CAAAA,CAAaC,CAAAA,EAAaA,CAAAA,CAChC,OAAA,MAAA,CAAO,cAAA,CAAeD,CAAAA,CAAQE,CAAc,CAAA,CAC5CF,CAAAA,CAAO,SAAA,CAAYC,CAAAA,CAEZD,CACT,CAMA,IAAME,CAAAA,CAAiB,CACrB,IAAA,CAAM,QAAA,CACN,MAAA,CAAQ,KAAA,CAAA,CAER,IAAI,KAAA,CAAA,CAA4B,CAC9B,OAAO,IAAA,CAAK,MACd,CAAA,CAEA,KAAA,CAAMC,CAAAA,CAAe,CACnB,OAAA,IAAA,CAAK,MAAA,CAASA,CAAAA,CACP,IACT,CAAA,CAEA,QAAA,CAAA,CAAmB,CACjB,MAAO,CAAA,OAAA,mBAAU,IAAA,CAAK,KAAA,SAAS,aAAW,CAAA,CAAA","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/chunk-UPPJES6W.cjs","sourcesContent":[null,"import type { TgpuNamable } from '../namable';\nimport type {\n InferGPURecord,\n InferPartialRecord,\n InferRecord,\n MemIdentityRecord,\n} from '../shared/repr';\nimport type { Prettify } from '../shared/utilityTypes';\nimport type { AnyWgslData, BaseData } from './wgslTypes';\n\n// ----------\n// Public API\n// ----------\n\n/**\n * Struct schema constructed via `d.struct` function.\n *\n * Responsible for handling reading and writing struct values\n * between binary and JS representation. Takes into account\n * the `byteAlignment` requirement of its members.\n */\nexport interface WgslStruct<\n TProps extends Record<string, BaseData> = Record<string, BaseData>,\n> extends TgpuNamable {\n (props: InferRecord<TProps>): InferRecord<TProps>;\n readonly type: 'struct';\n readonly label?: string | undefined;\n readonly propTypes: TProps;\n /** Type-token, not available at runtime */\n readonly '~repr': Prettify<InferRecord<TProps>>;\n /** Type-token, not available at runtime */\n readonly '~gpuRepr': InferGPURecord<TProps>;\n /** Type-token, not available at runtime */\n readonly '~memIdent': WgslStruct<MemIdentityRecord<TProps>>;\n /** Type-token, not available at runtime */\n readonly '~reprPartial': Prettify<Partial<InferPartialRecord<TProps>>>;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <we need the type to be broader than WgslStruct<Record<string, BaseWgslData>>\nexport type AnyWgslStruct = WgslStruct<any>;\n\n/**\n * Creates a struct schema that can be used to construct GPU buffers.\n * Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).\n * The order of members matches the passed in properties object.\n *\n * @example\n * const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });\n *\n * @param props Record with `string` keys and `TgpuData` values,\n * each entry describing one struct member.\n */\nexport function struct<TProps extends Record<string, AnyWgslData>>(\n props: TProps,\n): WgslStruct<Prettify<TProps>> {\n const struct = <T>(props: T) => props;\n Object.setPrototypeOf(struct, WgslStructImpl);\n struct.propTypes = props;\n\n return struct as unknown as WgslStruct<Prettify<TProps>>;\n}\n\n// --------------\n// Implementation\n// --------------\n\nconst WgslStructImpl = {\n type: 'struct',\n _label: undefined as string | undefined,\n\n get label(): string | undefined {\n return this._label;\n },\n\n $name(label: string) {\n this._label = label;\n return this;\n },\n\n toString(): string {\n return `struct:${this.label ?? '<unnamed>'}`;\n },\n};\n"]}
|
package/data/index.cjs
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkUPPJES6Wcjs = require('../chunk-UPPJES6W.cjs');var _chunkM4VUFFPZcjs = require('../chunk-M4VUFFPZ.cjs');exports.align = _chunkUPPJES6Wcjs.pa; exports.alignmentOf = _chunkUPPJES6Wcjs.ba; exports.arrayOf = _chunkUPPJES6Wcjs.ea; exports.atomic = _chunkUPPJES6Wcjs.na; exports.bool = _chunkM4VUFFPZcjs.H; exports.builtin = _chunkUPPJES6Wcjs.va; exports.disarrayOf = _chunkUPPJES6Wcjs.la; exports.f16 = _chunkM4VUFFPZcjs.L; exports.f32 = _chunkM4VUFFPZcjs.K; exports.float16 = _chunkUPPJES6Wcjs.K; exports.float16x2 = _chunkUPPJES6Wcjs.L; exports.float16x4 = _chunkUPPJES6Wcjs.M; exports.float32 = _chunkUPPJES6Wcjs.N; exports.float32x2 = _chunkUPPJES6Wcjs.O; exports.float32x3 = _chunkUPPJES6Wcjs.P; exports.float32x4 = _chunkUPPJES6Wcjs.Q; exports.formatToWGSLType = _chunkUPPJES6Wcjs.k; exports.i32 = _chunkM4VUFFPZcjs.J; exports.interpolate = _chunkUPPJES6Wcjs.sa; exports.isAlignAttrib = _chunkM4VUFFPZcjs.X; exports.isAtomic = _chunkM4VUFFPZcjs.W; exports.isBuiltin = _chunkUPPJES6Wcjs.ta; exports.isBuiltinAttrib = _chunkM4VUFFPZcjs.$; exports.isData = _chunkUPPJES6Wcjs.h; exports.isDecorated = _chunkM4VUFFPZcjs.aa; exports.isDisarray = _chunkUPPJES6Wcjs.d; exports.isInterpolateAttrib = _chunkM4VUFFPZcjs._; exports.isLocationAttrib = _chunkM4VUFFPZcjs.Z; exports.isLooseData = _chunkUPPJES6Wcjs.c; exports.isLooseDecorated = _chunkUPPJES6Wcjs.f; exports.isPtr = _chunkM4VUFFPZcjs.V; exports.isSizeAttrib = _chunkM4VUFFPZcjs.Y; exports.isUnstruct = _chunkUPPJES6Wcjs.e; exports.isWgslArray = _chunkM4VUFFPZcjs.T; exports.isWgslData = _chunkM4VUFFPZcjs.S; exports.isWgslStruct = _chunkM4VUFFPZcjs.U; exports.location = _chunkUPPJES6Wcjs.ra; exports.mat2x2f = _chunkM4VUFFPZcjs.B; exports.mat3x3f = _chunkM4VUFFPZcjs.C; exports.mat4x4f = _chunkM4VUFFPZcjs.D; exports.matToArray = _chunkM4VUFFPZcjs.E; exports.packedFormats = _chunkUPPJES6Wcjs.l; exports.ptrFn = _chunkUPPJES6Wcjs.fa; exports.ptrHandle = _chunkUPPJES6Wcjs.ka; exports.ptrPrivate = _chunkUPPJES6Wcjs.ga; exports.ptrStorage = _chunkUPPJES6Wcjs.ia; exports.ptrUniform = _chunkUPPJES6Wcjs.ja; exports.ptrWorkgroup = _chunkUPPJES6Wcjs.ha; exports.sint16 = _chunkUPPJES6Wcjs.B; exports.sint16x2 = _chunkUPPJES6Wcjs.C; exports.sint16x4 = _chunkUPPJES6Wcjs.D; exports.sint32 = _chunkUPPJES6Wcjs.V; exports.sint32x2 = _chunkUPPJES6Wcjs.W; exports.sint32x3 = _chunkUPPJES6Wcjs.X; exports.sint32x4 = _chunkUPPJES6Wcjs.Y; exports.sint8 = _chunkUPPJES6Wcjs.p; exports.sint8x2 = _chunkUPPJES6Wcjs.q; exports.sint8x4 = _chunkUPPJES6Wcjs.r; exports.size = _chunkUPPJES6Wcjs.qa; exports.sizeOf = _chunkUPPJES6Wcjs.da; exports.snorm16 = _chunkUPPJES6Wcjs.H; exports.snorm16x2 = _chunkUPPJES6Wcjs.I; exports.snorm16x4 = _chunkUPPJES6Wcjs.J; exports.snorm8 = _chunkUPPJES6Wcjs.v; exports.snorm8x2 = _chunkUPPJES6Wcjs.w; exports.snorm8x4 = _chunkUPPJES6Wcjs.x; exports.struct = _chunkUPPJES6Wcjs.i; exports.u32 = _chunkM4VUFFPZcjs.I; exports.uint16 = _chunkUPPJES6Wcjs.y; exports.uint16x2 = _chunkUPPJES6Wcjs.z; exports.uint16x4 = _chunkUPPJES6Wcjs.A; exports.uint32 = _chunkUPPJES6Wcjs.R; exports.uint32x2 = _chunkUPPJES6Wcjs.S; exports.uint32x3 = _chunkUPPJES6Wcjs.T; exports.uint32x4 = _chunkUPPJES6Wcjs.U; exports.uint8 = _chunkUPPJES6Wcjs.m; exports.uint8x2 = _chunkUPPJES6Wcjs.n; exports.uint8x4 = _chunkUPPJES6Wcjs.o; exports.unorm10_10_10_2 = _chunkUPPJES6Wcjs.Z; exports.unorm16 = _chunkUPPJES6Wcjs.E; exports.unorm16x2 = _chunkUPPJES6Wcjs.F; exports.unorm16x4 = _chunkUPPJES6Wcjs.G; exports.unorm8 = _chunkUPPJES6Wcjs.s; exports.unorm8x2 = _chunkUPPJES6Wcjs.t; exports.unorm8x4 = _chunkUPPJES6Wcjs.u; exports.unorm8x4_bgra = _chunkUPPJES6Wcjs._; exports.unstruct = _chunkUPPJES6Wcjs.ma; exports.vec2f = _chunkM4VUFFPZcjs.p; exports.vec2h = _chunkM4VUFFPZcjs.q; exports.vec2i = _chunkM4VUFFPZcjs.r; exports.vec2u = _chunkM4VUFFPZcjs.s; exports.vec3f = _chunkM4VUFFPZcjs.t; exports.vec3h = _chunkM4VUFFPZcjs.u; exports.vec3i = _chunkM4VUFFPZcjs.v; exports.vec3u = _chunkM4VUFFPZcjs.w; exports.vec4f = _chunkM4VUFFPZcjs.x; exports.vec4h = _chunkM4VUFFPZcjs.y; exports.vec4i = _chunkM4VUFFPZcjs.z; exports.vec4u = _chunkM4VUFFPZcjs.A;
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/data/index.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["/Users/
|
1
|
+
{"version":3,"sources":["/Users/iwo/Projects/wigsill/packages/typegpu/dist/data/index.cjs"],"names":[],"mappings":"AAAA,kIAAsjB,yDAAoQ,g5HAAq6C","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/data/index.cjs"}
|
package/data/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{A as aa,B as ba,C as ca,D as da,E as ea,F as fa,G as ga,H as ha,I as ia,J as ja,K as ka,L as la,M as ma,N as na,O as oa,P as pa,Q as qa,R as ra,S as sa,T as ta,U as ua,V as va,W as wa,X as xa,Y as ya,Z as za,_ as Aa,ba as Ba,c as G,d as H,da as Ca,e as I,ea as Da,f as J,fa as Ea,ga as Fa,h as K,ha as Ga,i as L,ia as Ha,ja as Ia,k as M,ka as Ja,l as N,la as Ka,m as O,ma as La,n as P,na as Ma,o as Q,p as R,pa as Na,q as S,qa as Oa,r as T,ra as Pa,s as U,sa as Qa,t as V,ta as Ra,u as W,v as X,va as Sa,w as Y,x as Z,y as _,z as $}from"../chunk-
|
1
|
+
import{A as aa,B as ba,C as ca,D as da,E as ea,F as fa,G as ga,H as ha,I as ia,J as ja,K as ka,L as la,M as ma,N as na,O as oa,P as pa,Q as qa,R as ra,S as sa,T as ta,U as ua,V as va,W as wa,X as xa,Y as ya,Z as za,_ as Aa,ba as Ba,c as G,d as H,da as Ca,e as I,ea as Da,f as J,fa as Ea,ga as Fa,h as K,ha as Ga,i as L,ia as Ha,ja as Ia,k as M,ka as Ja,l as N,la as Ka,m as O,ma as La,n as P,na as Ma,o as Q,p as R,pa as Na,q as S,qa as Oa,r as T,ra as Pa,s as U,sa as Qa,t as V,ta as Ra,u as W,v as X,va as Sa,w as Y,x as Z,y as _,z as $}from"../chunk-DVZNNZFQ.js";import{$ as E,A as l,B as m,C as n,D as o,E as p,H as q,I as r,J as s,K as t,L as u,S as v,T as w,U as x,V as y,W as z,X as A,Y as B,Z as C,_ as D,aa as F,p as a,q as b,r as c,s as d,t as e,u as f,v as g,w as h,x as i,y as j,z as k}from"../chunk-UHU5Z2IS.js";export{Na as align,Ba as alignmentOf,Da as arrayOf,Ma as atomic,q as bool,Sa as builtin,Ka as disarrayOf,u as f16,t as f32,ka as float16,la as float16x2,ma as float16x4,na as float32,oa as float32x2,pa as float32x3,qa as float32x4,M as formatToWGSLType,s as i32,Qa as interpolate,A as isAlignAttrib,z as isAtomic,Ra as isBuiltin,E as isBuiltinAttrib,K as isData,F as isDecorated,H as isDisarray,D as isInterpolateAttrib,C as isLocationAttrib,G as isLooseData,J as isLooseDecorated,y as isPtr,B as isSizeAttrib,I as isUnstruct,w as isWgslArray,v as isWgslData,x as isWgslStruct,Pa as location,m as mat2x2f,n as mat3x3f,o as mat4x4f,p as matToArray,N as packedFormats,Ea as ptrFn,Ja as ptrHandle,Fa as ptrPrivate,Ha as ptrStorage,Ia as ptrUniform,Ga as ptrWorkgroup,ba as sint16,ca as sint16x2,da as sint16x4,va as sint32,wa as sint32x2,xa as sint32x3,ya as sint32x4,R as sint8,S as sint8x2,T as sint8x4,Oa as size,Ca as sizeOf,ha as snorm16,ia as snorm16x2,ja as snorm16x4,X as snorm8,Y as snorm8x2,Z as snorm8x4,L as struct,r as u32,_ as uint16,$ as uint16x2,aa as uint16x4,ra as uint32,sa as uint32x2,ta as uint32x3,ua as uint32x4,O as uint8,P as uint8x2,Q as uint8x4,za as unorm10_10_10_2,ea as unorm16,fa as unorm16x2,ga as unorm16x4,U as unorm8,V as unorm8x2,W as unorm8x4,Aa as unorm8x4_bgra,La as unstruct,a as vec2f,b as vec2h,c as vec2i,d as vec2u,e as vec3f,f as vec3h,g as vec3i,h as vec3u,i as vec4f,j as vec4h,k as vec4i,l as vec4u};
|
2
2
|
//# sourceMappingURL=index.js.map
|