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.
Files changed (52) hide show
  1. package/{chunk-6WF2EZIT.js → chunk-6U5HPHCJ.js} +2 -2
  2. package/{chunk-B254XDWG.js → chunk-CGQB3SER.js} +2 -2
  3. package/{chunk-XEUNEHAZ.js → chunk-CRZWTZM2.js} +6 -6
  4. package/chunk-CRZWTZM2.js.map +1 -0
  5. package/chunk-ECR2EGZX.js +7 -0
  6. package/chunk-ECR2EGZX.js.map +1 -0
  7. package/chunk-PWBIFP67.js +2 -0
  8. package/chunk-PWBIFP67.js.map +1 -0
  9. package/common/index.d.ts +1 -1
  10. package/common/index.js +1 -1
  11. package/data/index.d.ts +3 -3
  12. package/data/index.js +1 -1
  13. package/index.d.ts +2 -2
  14. package/index.js +40 -40
  15. package/index.js.map +1 -1
  16. package/{matrix-C6mMH7pB.d.ts → matrix-DIfOiRyz.d.ts} +1 -1
  17. package/package.json +5 -13
  18. package/std/index.d.ts +2 -2
  19. package/std/index.js +1 -1
  20. package/std/index.js.map +1 -1
  21. package/{tgpuConstant-DzGgwe0I.d.ts → tgpuConstant-BTQFNlQH.d.ts} +13 -8
  22. package/chunk-A5APHF7K.cjs +0 -10
  23. package/chunk-A5APHF7K.cjs.map +0 -1
  24. package/chunk-LL6NPRFE.cjs +0 -7
  25. package/chunk-LL6NPRFE.cjs.map +0 -1
  26. package/chunk-M2P3FJT7.cjs +0 -2
  27. package/chunk-M2P3FJT7.cjs.map +0 -1
  28. package/chunk-PO6SIMTQ.js +0 -2
  29. package/chunk-PO6SIMTQ.js.map +0 -1
  30. package/chunk-T2GBOTUH.js +0 -7
  31. package/chunk-T2GBOTUH.js.map +0 -1
  32. package/chunk-TRAG63HY.cjs +0 -3
  33. package/chunk-TRAG63HY.cjs.map +0 -1
  34. package/chunk-U3CXOCRG.cjs +0 -2
  35. package/chunk-U3CXOCRG.cjs.map +0 -1
  36. package/chunk-XEUNEHAZ.js.map +0 -1
  37. package/common/index.cjs +0 -7
  38. package/common/index.cjs.map +0 -1
  39. package/common/index.d.cts +0 -24
  40. package/data/index.cjs +0 -2
  41. package/data/index.cjs.map +0 -1
  42. package/data/index.d.cts +0 -402
  43. package/index.cjs +0 -192
  44. package/index.cjs.map +0 -1
  45. package/index.d.cts +0 -369
  46. package/matrix-Cn2jQILV.d.cts +0 -122
  47. package/std/index.cjs +0 -2
  48. package/std/index.cjs.map +0 -1
  49. package/std/index.d.cts +0 -639
  50. package/tgpuConstant-DzGgwe0I.d.cts +0 -5196
  51. /package/{chunk-6WF2EZIT.js.map → chunk-6U5HPHCJ.js.map} +0 -0
  52. /package/{chunk-B254XDWG.js.map → chunk-CGQB3SER.js.map} +0 -0
package/common/index.cjs DELETED
@@ -1,7 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTRAG63HYcjs = require('../chunk-TRAG63HY.cjs');var _chunkA5APHF7Kcjs = require('../chunk-A5APHF7K.cjs');var o=_chunkTRAG63HYcjs.h.call(void 0, {in:{vertexIndex:_chunkA5APHF7Kcjs.vc.vertexIndex},out:{pos:_chunkA5APHF7Kcjs.vc.position,uv:_chunkA5APHF7Kcjs.Ya}})`{
2
- const pos = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));
3
- const uv = array<vec2f, 3>(vec2f(0, 1), vec2f(2, 1), vec2f(0, -1));
4
-
5
- return Out(vec4f(pos[in.vertexIndex], 0, 1), uv[in.vertexIndex]);
6
- }`;exports.fullScreenTriangle = o;
7
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/iwo/Projects/wigsill/packages/typegpu/dist/common/index.cjs","../../src/common/fullScreenTriangle.ts"],"names":["fullScreenTriangle","vertexFn","builtin","vec2f"],"mappings":"AAAA,kIAAyC,yDAAmD,ICoB/EA,CAAAA,CAAqBC,iCAAAA,CAChC,EAAA,CAAI,CAAE,WAAA,CAAaC,oBAAAA,CAAQ,WAAY,CAAA,CACvC,GAAA,CAAK,CAAE,GAAA,CAAKA,oBAAAA,CAAQ,QAAA,CAAU,EAAA,CAAIC,oBAAM,CAC1C,CAAC,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;ADlBD,CAAC,CAAC,CAAC,+BAA+B","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/common/index.cjs","sourcesContent":[null,"import { builtin } from '../builtin.ts';\nimport { vertexFn } from '../core/function/tgpuVertexFn.ts';\nimport { vec2f } from '../data/vector.ts';\n\n/**\n * A vertex function that defines a single full-screen triangle out\n * of three points.\n *\n * @example\n * ```ts\n * import { fullScreenTriangle } from 'typegpu/common';\n *\n * const pipeline = root['~unstable']\n * .withVertex(fullScreenTriangle)\n * .withFragment(yourFragmentShader)\n * .createPipeline();\n *\n * pipeline.draw(3);\n * ```\n */\nexport const fullScreenTriangle = vertexFn({\n in: { vertexIndex: builtin.vertexIndex },\n out: { pos: builtin.position, uv: vec2f },\n})`{\n const pos = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n const uv = array<vec2f, 3>(vec2f(0, 1), vec2f(2, 1), vec2f(0, -1));\n\n return Out(vec4f(pos[in.vertexIndex], 0, 1), uv[in.vertexIndex]);\n}`;\n"]}
@@ -1,24 +0,0 @@
1
- import { aH as TgpuVertexFn, aP as Vec2f } from '../tgpuConstant-DzGgwe0I.cjs';
2
- import 'tinyest';
3
-
4
- /**
5
- * A vertex function that defines a single full-screen triangle out
6
- * of three points.
7
- *
8
- * @example
9
- * ```ts
10
- * import { fullScreenTriangle } from 'typegpu/common';
11
- *
12
- * const pipeline = root['~unstable']
13
- * .withVertex(fullScreenTriangle)
14
- * .withFragment(yourFragmentShader)
15
- * .createPipeline();
16
- *
17
- * pipeline.draw(3);
18
- * ```
19
- */
20
- declare const fullScreenTriangle: TgpuVertexFn<{}, {
21
- uv: Vec2f;
22
- }>;
23
-
24
- export { fullScreenTriangle };
package/data/index.cjs DELETED
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM2P3FJT7cjs = require('../chunk-M2P3FJT7.cjs');var _chunkLL6NPRFEcjs = require('../chunk-LL6NPRFE.cjs');var _chunkA5APHF7Kcjs = require('../chunk-A5APHF7K.cjs');exports.Void = _chunkA5APHF7Kcjs.q; exports.align = _chunkA5APHF7Kcjs.kc; exports.alignmentOf = _chunkA5APHF7Kcjs.gc; exports.arrayOf = _chunkA5APHF7Kcjs.uc; exports.atomic = _chunkLL6NPRFEcjs.R; exports.bool = _chunkA5APHF7Kcjs.Ra; exports.builtin = _chunkA5APHF7Kcjs.vc; exports.comparisonSampler = _chunkLL6NPRFEcjs.t; exports.deepEqual = _chunkM2P3FJT7cjs.i; exports.disarrayOf = _chunkM2P3FJT7cjs.g; exports.f16 = _chunkA5APHF7Kcjs.Wa; exports.f32 = _chunkA5APHF7Kcjs.Va; exports.float16 = _chunkA5APHF7Kcjs.Ob; exports.float16x2 = _chunkA5APHF7Kcjs.Pb; exports.float16x4 = _chunkA5APHF7Kcjs.Qb; exports.float32 = _chunkA5APHF7Kcjs.Rb; exports.float32x2 = _chunkA5APHF7Kcjs.Sb; exports.float32x3 = _chunkA5APHF7Kcjs.Tb; exports.float32x4 = _chunkA5APHF7Kcjs.Ub; exports.formatToWGSLType = _chunkA5APHF7Kcjs.ob; exports.i32 = _chunkA5APHF7Kcjs.Ua; exports.interpolate = _chunkA5APHF7Kcjs.nc; exports.invariant = _chunkA5APHF7Kcjs.oc; exports.isAlignAttrib = _chunkA5APHF7Kcjs.G; exports.isAtomic = _chunkA5APHF7Kcjs.F; exports.isBuiltin = _chunkA5APHF7Kcjs.pc; exports.isBuiltinAttrib = _chunkA5APHF7Kcjs.K; exports.isData = _chunkA5APHF7Kcjs.V; exports.isDecorated = _chunkA5APHF7Kcjs.L; exports.isDisarray = _chunkA5APHF7Kcjs.R; exports.isInterpolateAttrib = _chunkA5APHF7Kcjs.J; exports.isLocationAttrib = _chunkA5APHF7Kcjs.I; exports.isLooseData = _chunkA5APHF7Kcjs.Q; exports.isLooseDecorated = _chunkA5APHF7Kcjs.T; exports.isPackedData = _chunkA5APHF7Kcjs.dc; exports.isPtr = _chunkA5APHF7Kcjs.E; exports.isSizeAttrib = _chunkA5APHF7Kcjs.H; exports.isUnstruct = _chunkA5APHF7Kcjs.S; exports.isWgslArray = _chunkA5APHF7Kcjs.C; exports.isWgslData = _chunkA5APHF7Kcjs.B; exports.isWgslStruct = _chunkA5APHF7Kcjs.D; exports.location = _chunkA5APHF7Kcjs.mc; exports.mat2x2f = _chunkLL6NPRFEcjs.j; exports.mat3x3f = _chunkLL6NPRFEcjs.k; exports.mat4x4f = _chunkLL6NPRFEcjs.l; exports.matToArray = _chunkLL6NPRFEcjs.m; exports.packedFormats = _chunkA5APHF7Kcjs.pb; exports.ptrFn = _chunkM2P3FJT7cjs.a; exports.ptrHandle = _chunkM2P3FJT7cjs.f; exports.ptrPrivate = _chunkM2P3FJT7cjs.b; exports.ptrStorage = _chunkM2P3FJT7cjs.d; exports.ptrUniform = _chunkM2P3FJT7cjs.e; exports.ptrWorkgroup = _chunkM2P3FJT7cjs.c; exports.sampler = _chunkLL6NPRFEcjs.s; exports.sint16 = _chunkA5APHF7Kcjs.Fb; exports.sint16x2 = _chunkA5APHF7Kcjs.Gb; exports.sint16x4 = _chunkA5APHF7Kcjs.Hb; exports.sint32 = _chunkA5APHF7Kcjs.Zb; exports.sint32x2 = _chunkA5APHF7Kcjs._b; exports.sint32x3 = _chunkA5APHF7Kcjs.$b; exports.sint32x4 = _chunkA5APHF7Kcjs.ac; exports.sint8 = _chunkA5APHF7Kcjs.tb; exports.sint8x2 = _chunkA5APHF7Kcjs.ub; exports.sint8x4 = _chunkA5APHF7Kcjs.vb; exports.size = _chunkA5APHF7Kcjs.lc; exports.sizeOf = _chunkA5APHF7Kcjs.jc; exports.snorm16 = _chunkA5APHF7Kcjs.Lb; exports.snorm16x2 = _chunkA5APHF7Kcjs.Mb; exports.snorm16x4 = _chunkA5APHF7Kcjs.Nb; exports.snorm8 = _chunkA5APHF7Kcjs.zb; exports.snorm8x2 = _chunkA5APHF7Kcjs.Ab; exports.snorm8x4 = _chunkA5APHF7Kcjs.Bb; exports.struct = _chunkA5APHF7Kcjs.sc; exports.texture1d = _chunkLL6NPRFEcjs.y; exports.texture2d = _chunkLL6NPRFEcjs.z; exports.texture2dArray = _chunkLL6NPRFEcjs.B; exports.texture3d = _chunkLL6NPRFEcjs.E; exports.textureCube = _chunkLL6NPRFEcjs.C; exports.textureCubeArray = _chunkLL6NPRFEcjs.D; exports.textureDepth2d = _chunkLL6NPRFEcjs.J; exports.textureDepth2dArray = _chunkLL6NPRFEcjs.L; exports.textureDepthCube = _chunkLL6NPRFEcjs.M; exports.textureDepthCubeArray = _chunkLL6NPRFEcjs.N; exports.textureDepthMultisampled2d = _chunkLL6NPRFEcjs.K; exports.textureExternal = _chunkLL6NPRFEcjs.O; exports.textureMultisampled2d = _chunkLL6NPRFEcjs.A; exports.textureStorage1d = _chunkLL6NPRFEcjs.F; exports.textureStorage2d = _chunkLL6NPRFEcjs.G; exports.textureStorage2dArray = _chunkLL6NPRFEcjs.H; exports.textureStorage3d = _chunkLL6NPRFEcjs.I; exports.u16 = _chunkA5APHF7Kcjs.Ta; exports.u32 = _chunkA5APHF7Kcjs.Sa; exports.uint16 = _chunkA5APHF7Kcjs.Cb; exports.uint16x2 = _chunkA5APHF7Kcjs.Db; exports.uint16x4 = _chunkA5APHF7Kcjs.Eb; exports.uint32 = _chunkA5APHF7Kcjs.Vb; exports.uint32x2 = _chunkA5APHF7Kcjs.Wb; exports.uint32x3 = _chunkA5APHF7Kcjs.Xb; exports.uint32x4 = _chunkA5APHF7Kcjs.Yb; exports.uint8 = _chunkA5APHF7Kcjs.qb; exports.uint8x2 = _chunkA5APHF7Kcjs.rb; exports.uint8x4 = _chunkA5APHF7Kcjs.sb; exports.unorm10_10_10_2 = _chunkA5APHF7Kcjs.bc; exports.unorm16 = _chunkA5APHF7Kcjs.Ib; exports.unorm16x2 = _chunkA5APHF7Kcjs.Jb; exports.unorm16x4 = _chunkA5APHF7Kcjs.Kb; exports.unorm8 = _chunkA5APHF7Kcjs.wb; exports.unorm8x2 = _chunkA5APHF7Kcjs.xb; exports.unorm8x4 = _chunkA5APHF7Kcjs.yb; exports.unorm8x4_bgra = _chunkA5APHF7Kcjs.cc; exports.unstruct = _chunkM2P3FJT7cjs.h; exports.vec2b = _chunkA5APHF7Kcjs.ab; exports.vec2f = _chunkA5APHF7Kcjs.Ya; exports.vec2h = _chunkA5APHF7Kcjs.Za; exports.vec2i = _chunkA5APHF7Kcjs._a; exports.vec2u = _chunkA5APHF7Kcjs.$a; exports.vec3b = _chunkA5APHF7Kcjs.fb; exports.vec3f = _chunkA5APHF7Kcjs.bb; exports.vec3h = _chunkA5APHF7Kcjs.cb; exports.vec3i = _chunkA5APHF7Kcjs.db; exports.vec3u = _chunkA5APHF7Kcjs.eb; exports.vec4b = _chunkA5APHF7Kcjs.kb; exports.vec4f = _chunkA5APHF7Kcjs.gb; exports.vec4h = _chunkA5APHF7Kcjs.hb; exports.vec4i = _chunkA5APHF7Kcjs.ib; exports.vec4u = _chunkA5APHF7Kcjs.jb;
2
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/iwo/Projects/wigsill/packages/typegpu/dist/data/index.cjs"],"names":[],"mappings":"AAAA,kIAA0G,yDAA+N,yDAAqyB,koKAA27D","file":"/Users/iwo/Projects/wigsill/packages/typegpu/dist/data/index.cjs"}
package/data/index.d.cts DELETED
@@ -1,402 +0,0 @@
1
- import { aQ as Vec2b, aP as Vec2f, aR as Vec2h, aS as Vec2i, aT as Vec2u, aU as Vec3b, aV as Vec3f, aW as Vec3h, aX as Vec3i, aY as Vec3u, aZ as Vec4b, a_ as Vec4f, a$ as Vec4h, b0 as Vec4i, b1 as Vec4u, b2 as Bool, b3 as F16, b4 as F32, b5 as I32, b6 as U16, b7 as U32, j as AnyWgslData, b8 as WgslStruct, b9 as DualFn, o as WgslArray, ba as StorableData, bb as Ptr, A as AnyData, D as Disarray, bc as BaseData, bd as Unstruct, be as Atomic } from '../tgpuConstant-DzGgwe0I.cjs';
2
- export { br as Align, cx as AnyAttribute, cL as AnyBuiltin, bR as AnyLooseData, bs as AnyVecInstance, bt as AnyWgslStruct, bu as Builtin, cM as BuiltinClipDistances, cN as BuiltinFragDepth, cO as BuiltinFrontFacing, cP as BuiltinGlobalInvocationId, cQ as BuiltinInstanceIndex, cR as BuiltinLocalInvocationId, cS as BuiltinLocalInvocationIndex, cT as BuiltinNumWorkgroups, cU as BuiltinPosition, cV as BuiltinSampleIndex, cW as BuiltinSampleMask, cX as BuiltinVertexIndex, cY as BuiltinWorkgroupId, bv as Decorated, c$ as FormatToWGSLType, cy as HasCustomLocation, I as Infer, cZ as InferGPU, c_ as InferPartial, bw as Interpolate, cB as IsBuiltin, bx as Location, bS as LooseDecorated, bB as Mat2x2f, bC as Mat3x3f, bD as Mat4x4f, dJ as PackedData, bE as Size, d0 as TgpuVertexFormatData, bq as Void, cu as WgslComparisonSampler, c8 as WgslExternalTexture, cv as WgslSampler, c9 as WgslStorageTexture, ca as WgslStorageTexture1d, cb as WgslStorageTexture2d, cc as WgslStorageTexture2dArray, cd as WgslStorageTexture3d, ce as WgslStorageTextureProps, cf as WgslTexture, cg as WgslTexture1d, ch as WgslTexture2d, ci as WgslTexture2dArray, cj as WgslTexture3d, ck as WgslTextureCube, cl as WgslTextureCubeArray, cm as WgslTextureDepth2d, cn as WgslTextureDepth2dArray, co as WgslTextureDepthCube, cp as WgslTextureDepthCubeArray, cq as WgslTextureDepthMultisampled2d, cr as WgslTextureMultisampled2d, cw as align, cK as builtin, cs as comparisonSampler, ds as float16, dt as float16x2, du as float16x4, dv as float32, dw as float32x2, dx as float32x3, dy as float32x4, d1 as formatToWGSLType, cz as interpolate, cA as invariant, bf as isAlignAttrib, bg as isAtomic, cC as isBuiltin, bh as isBuiltinAttrib, cF as isData, bi as isDecorated, cG as isDisarray, bj as isInterpolateAttrib, bk as isLocationAttrib, cH as isLooseData, cI as isLooseDecorated, dK as isPackedData, bl as isPtr, bm as isSizeAttrib, cJ as isUnstruct, bn as isWgslArray, bo as isWgslData, bp as isWgslStruct, cD as location, by as m2x2f, bz as m3x3f, bA as m4x4f, d2 as packedFormats, ct as sampler, di as sint16, dj as sint16x2, dk as sint16x4, dD as sint32, dE as sint32x2, dF as sint32x3, dG as sint32x4, d6 as sint8, d7 as sint8x2, d8 as sint8x4, cE as size, dp as snorm16, dq as snorm16x2, dr as snorm16x4, dc as snorm8, dd as snorm8x2, de as snorm8x4, bT as texture1d, bU as texture2d, bV as texture2dArray, bW as texture3d, bX as textureCube, bY as textureCubeArray, bZ as textureDepth2d, b_ as textureDepth2dArray, b$ as textureDepthCube, c0 as textureDepthCubeArray, c1 as textureDepthMultisampled2d, c2 as textureExternal, c3 as textureMultisampled2d, c4 as textureStorage1d, c5 as textureStorage2d, c6 as textureStorage2dArray, c7 as textureStorage3d, df as uint16, dg as uint16x2, dh as uint16x4, dz as uint32, dA as uint32x2, dB as uint32x3, dC as uint32x4, d3 as uint8, d4 as uint8x2, d5 as uint8x4, dH as unorm10_10_10_2, dl as unorm16, dm as unorm16x2, dn as unorm16x4, d9 as unorm8, da as unorm8x2, db as unorm8x4, dI as unorm8x4_bgra, bF as v2b, bG as v2f, bH as v2i, bI as v2u, bJ as v3b, bK as v3f, bL as v3i, bM as v3u, bN as v4b, bO as v4f, bP as v4i, bQ as v4u } from '../tgpuConstant-DzGgwe0I.cjs';
3
- export { m as mat2x2f, a as mat3x3f, b as mat4x4f, c as matToArray } from '../matrix-Cn2jQILV.cjs';
4
- import 'tinyest';
5
-
6
- /**
7
- * Schema representing vec2f - a vector with 2 elements of type f32.
8
- * Also a constructor function for this vector value.
9
- *
10
- * @example
11
- * const vector = d.vec2f(); // (0.0, 0.0)
12
- * const vector = d.vec2f(1); // (1.0, 1.0)
13
- * const vector = d.vec2f(0.5, 0.1); // (0.5, 0.1)
14
- *
15
- * @example
16
- * const buffer = root.createBuffer(d.vec2f, d.vec2f(0, 1)); // buffer holding a d.vec2f value, with an initial value of vec2f(0, 1);
17
- */
18
- declare const vec2f: Vec2f;
19
- /**
20
- * Schema representing vec2h - a vector with 2 elements of type f16.
21
- * Also a constructor function for this vector value.
22
- *
23
- * @example
24
- * const vector = d.vec2h(); // (0.0, 0.0)
25
- * const vector = d.vec2h(1); // (1.0, 1.0)
26
- * const vector = d.vec2h(0.5, 0.1); // (0.5, 0.1)
27
- *
28
- * @example
29
- * const buffer = root.createBuffer(d.vec2h, d.vec2h(0, 1)); // buffer holding a d.vec2h value, with an initial value of vec2h(0, 1);
30
- */
31
- declare const vec2h: Vec2h;
32
- /**
33
- * Schema representing vec2i - a vector with 2 elements of type i32.
34
- * Also a constructor function for this vector value.
35
- *
36
- * @example
37
- * const vector = d.vec2i(); // (0, 0)
38
- * const vector = d.vec2i(1); // (1, 1)
39
- * const vector = d.vec2i(-1, 1); // (-1, 1)
40
- *
41
- * @example
42
- * const buffer = root.createBuffer(d.vec2i, d.vec2i(0, 1)); // buffer holding a d.vec2i value, with an initial value of vec2i(0, 1);
43
- */
44
- declare const vec2i: Vec2i;
45
- /**
46
- * Schema representing vec2u - a vector with 2 elements of type u32.
47
- * Also a constructor function for this vector value.
48
- *
49
- * @example
50
- * const vector = d.vec2u(); // (0, 0)
51
- * const vector = d.vec2u(1); // (1, 1)
52
- * const vector = d.vec2u(1, 2); // (1, 2)
53
- *
54
- * @example
55
- * const buffer = root.createBuffer(d.vec2u, d.vec2u(0, 1)); // buffer holding a d.vec2u value, with an initial value of vec2u(0, 1);
56
- */
57
- declare const vec2u: Vec2u;
58
- /**
59
- * Schema representing `vec2<bool>` - a vector with 2 elements of type `bool`.
60
- * Also a constructor function for this vector value.
61
- *
62
- * @example
63
- * const vector = d.vec2b(); // (false, false)
64
- * const vector = d.vec2b(true); // (true, true)
65
- * const vector = d.vec2b(false, true); // (false, true)
66
- */
67
- declare const vec2b: Vec2b;
68
- /**
69
- * Schema representing vec3f - a vector with 3 elements of type f32.
70
- * Also a constructor function for this vector value.
71
- *
72
- * @example
73
- * const vector = d.vec3f(); // (0.0, 0.0, 0.0)
74
- * const vector = d.vec3f(1); // (1.0, 1.0, 1.0)
75
- * const vector = d.vec3f(1, 2, 3.5); // (1.0, 2.0, 3.5)
76
- *
77
- * @example
78
- * const buffer = root.createBuffer(d.vec3f, d.vec3f(0, 1, 2)); // buffer holding a d.vec3f value, with an initial value of vec3f(0, 1, 2);
79
- */
80
- declare const vec3f: Vec3f;
81
- /**
82
- * Schema representing vec3h - a vector with 3 elements of type f16.
83
- * Also a constructor function for this vector value.
84
- *
85
- * @example
86
- * const vector = d.vec3h(); // (0.0, 0.0, 0.0)
87
- * const vector = d.vec3h(1); // (1.0, 1.0, 1.0)
88
- * const vector = d.vec3h(1, 2, 3.5); // (1.0, 2.0, 3.5)
89
- *
90
- * @example
91
- * const buffer = root.createBuffer(d.vec3h, d.vec3h(0, 1, 2)); // buffer holding a d.vec3h value, with an initial value of vec3h(0, 1, 2);
92
- */
93
- declare const vec3h: Vec3h;
94
- /**
95
- * Schema representing vec3i - a vector with 3 elements of type i32.
96
- * Also a constructor function for this vector value.
97
- *
98
- * @example
99
- * const vector = d.vec3i(); // (0, 0, 0)
100
- * const vector = d.vec3i(1); // (1, 1, 1)
101
- * const vector = d.vec3i(1, 2, -3); // (1, 2, -3)
102
- *
103
- * @example
104
- * const buffer = root.createBuffer(d.vec3i, d.vec3i(0, 1, 2)); // buffer holding a d.vec3i value, with an initial value of vec3i(0, 1, 2);
105
- */
106
- declare const vec3i: Vec3i;
107
- /**
108
- * Schema representing vec3u - a vector with 3 elements of type u32.
109
- * Also a constructor function for this vector value.
110
- *
111
- * @example
112
- * const vector = d.vec3u(); // (0, 0, 0)
113
- * const vector = d.vec3u(1); // (1, 1, 1)
114
- * const vector = d.vec3u(1, 2, 3); // (1, 2, 3)
115
- *
116
- * @example
117
- * const buffer = root.createBuffer(d.vec3u, d.vec3u(0, 1, 2)); // buffer holding a d.vec3u value, with an initial value of vec3u(0, 1, 2);
118
- */
119
- declare const vec3u: Vec3u;
120
- /**
121
- * Schema representing `vec3<bool>` - a vector with 3 elements of type `bool`.
122
- * Also a constructor function for this vector value.
123
- *
124
- * @example
125
- * const vector = d.vec3b(); // (false, false, false)
126
- * const vector = d.vec3b(true); // (true, true, true)
127
- * const vector = d.vec3b(false, true, false); // (false, true, false)
128
- */
129
- declare const vec3b: Vec3b;
130
- /**
131
- * Schema representing vec4f - a vector with 4 elements of type f32.
132
- * Also a constructor function for this vector value.
133
- *
134
- * @example
135
- * const vector = d.vec4f(); // (0.0, 0.0, 0.0, 0.0)
136
- * const vector = d.vec4f(1); // (1.0, 1.0, 1.0, 1.0)
137
- * const vector = d.vec4f(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
138
- *
139
- * @example
140
- * const buffer = root.createBuffer(d.vec4f, d.vec4f(0, 1, 2, 3)); // buffer holding a d.vec4f value, with an initial value of vec4f(0, 1, 2, 3);
141
- */
142
- declare const vec4f: Vec4f;
143
- /**
144
- * Schema representing vec4h - a vector with 4 elements of type f16.
145
- * Also a constructor function for this vector value.
146
- *
147
- * @example
148
- * const vector = d.vec4h(); // (0.0, 0.0, 0.0, 0.0)
149
- * const vector = d.vec4h(1); // (1.0, 1.0, 1.0, 1.0)
150
- * const vector = d.vec4h(1, 2, 3, 4.5); // (1.0, 2.0, 3.0, 4.5)
151
- *
152
- * @example
153
- * const buffer = root.createBuffer(d.vec4h, d.vec4h(0, 1, 2, 3)); // buffer holding a d.vec4h value, with an initial value of vec4h(0, 1, 2, 3);
154
- */
155
- declare const vec4h: Vec4h;
156
- /**
157
- * Schema representing vec4i - a vector with 4 elements of type i32.
158
- * Also a constructor function for this vector value.
159
- *
160
- * @example
161
- * const vector = d.vec4i(); // (0, 0, 0, 0)
162
- * const vector = d.vec4i(1); // (1, 1, 1, 1)
163
- * const vector = d.vec4i(1, 2, 3, -4); // (1, 2, 3, -4)
164
- *
165
- * @example
166
- * const buffer = root.createBuffer(d.vec4i, d.vec4i(0, 1, 2, 3)); // buffer holding a d.vec4i value, with an initial value of vec4i(0, 1, 2, 3);
167
- */
168
- declare const vec4i: Vec4i;
169
- /**
170
- * Schema representing vec4u - a vector with 4 elements of type u32.
171
- * Also a constructor function for this vector value.
172
- *
173
- * @example
174
- * const vector = d.vec4u(); // (0, 0, 0, 0)
175
- * const vector = d.vec4u(1); // (1, 1, 1, 1)
176
- * const vector = d.vec4u(1, 2, 3, 4); // (1, 2, 3, 4)
177
- *
178
- * @example
179
- * const buffer = root.createBuffer(d.vec4u, d.vec4u(0, 1, 2, 3)); // buffer holding a d.vec4u value, with an initial value of vec4u(0, 1, 2, 3);
180
- */
181
- declare const vec4u: Vec4u;
182
- /**
183
- * Schema representing `vec4<bool>` - a vector with 4 elements of type `bool`.
184
- * Also a constructor function for this vector value.
185
- *
186
- * @example
187
- * const vector = d.vec4b(); // (false, false, false, false)
188
- * const vector = d.vec4b(true); // (true, true, true, true)
189
- * const vector = d.vec4b(false, true, false, true); // (false, true, false, true)
190
- */
191
- declare const vec4b: Vec4b;
192
-
193
- /**
194
- * A schema that represents a boolean value. (equivalent to `bool` in WGSL)
195
- *
196
- * Can also be called to cast a value to a bool in accordance with WGSL casting rules.
197
- *
198
- * @example
199
- * const value = bool(); // false
200
- * @example
201
- * const value = bool(0); // false
202
- * @example
203
- * const value = bool(-0); // false
204
- * @example
205
- * const value = bool(21.37); // true
206
- */
207
- declare const bool: Bool;
208
- /**
209
- * A schema that represents an unsigned 32-bit integer value. (equivalent to `u32` in WGSL)
210
- *
211
- * Can also be called to cast a value to an u32 in accordance with WGSL casting rules.
212
- *
213
- * @example
214
- * const value = u32(); // 0
215
- * @example
216
- * const value = u32(7); // 7
217
- * @example
218
- * const value = u32(3.14); // 3
219
- * @example
220
- * const value = u32(-1); // 4294967295
221
- * @example
222
- * const value = u32(-3.1); // 0
223
- */
224
- declare const u32: U32;
225
- declare const u16: U16;
226
- /**
227
- * A schema that represents a signed 32-bit integer value. (equivalent to `i32` in WGSL)
228
- *
229
- * Can also be called to cast a value to an i32 in accordance with WGSL casting rules.
230
- *
231
- * @example
232
- * const value = i32(); // 0
233
- * @example
234
- * const value = i32(3.14); // 3
235
- * @example
236
- * const value = i32(-3.9); // -3
237
- * @example
238
- * const value = i32(10000000000) // 1410065408
239
- */
240
- declare const i32: I32;
241
- /**
242
- * A schema that represents a 32-bit float value. (equivalent to `f32` in WGSL)
243
- *
244
- * Can also be called to cast a value to an f32.
245
- *
246
- * @example
247
- * const value = f32(); // 0
248
- * @example
249
- * const value = f32(1.23); // 1.23
250
- * @example
251
- * const value = f32(true); // 1
252
- */
253
- declare const f32: F32;
254
- /**
255
- * A schema that represents a 16-bit float value. (equivalent to `f16` in WGSL)
256
- *
257
- * Can also be called to cast a value to an f16.
258
- *
259
- * @example
260
- * const value = f16(); // 0
261
- * @example
262
- * const value = f32(1.23); // 1.23
263
- * @example
264
- * const value = f16(true); // 1
265
- * @example
266
- * const value = f16(21877.5); // 21872
267
- */
268
- declare const f16: F16;
269
-
270
- /**
271
- * Creates a struct schema that can be used to construct GPU buffers.
272
- * Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).
273
- * The order of members matches the passed in properties object.
274
- *
275
- * @example
276
- * const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });
277
- *
278
- * @param props Record with `string` keys and `TgpuData` values,
279
- * each entry describing one struct member.
280
- */
281
- declare function struct<TProps extends Record<string, AnyWgslData>>(props: TProps): WgslStruct<TProps>;
282
-
283
- interface WgslArrayConstructor {
284
- <TElement extends AnyWgslData>(elementType: TElement): (elementCount: number) => WgslArray<TElement>;
285
- <TElement extends AnyWgslData>(elementType: TElement, elementCount: number): WgslArray<TElement>;
286
- }
287
- /**
288
- * Creates an array schema that can be used to construct gpu buffers.
289
- * Describes arrays with fixed-size length, storing elements of the same type.
290
- *
291
- * @example
292
- * const LENGTH = 3;
293
- * const array = d.arrayOf(d.u32, LENGTH);
294
- *
295
- * If `elementCount` is not specified, a partially applied function is returned.
296
- * @example
297
- * const array = d.arrayOf(d.vec3f);
298
- * // ^? (n: number) => WgslArray<d.Vec3f>
299
- *
300
- * @param elementType The type of elements in the array.
301
- * @param elementCount The number of elements in the array.
302
- */
303
- declare const arrayOf: DualFn<WgslArrayConstructor>;
304
-
305
- declare function ptrFn<T extends StorableData>(inner: T): Ptr<'function', T, 'read-write'>;
306
- declare function ptrPrivate<T extends StorableData>(inner: T): Ptr<'private', T, 'read-write'>;
307
- declare function ptrWorkgroup<T extends StorableData>(inner: T): Ptr<'workgroup', T, 'read-write'>;
308
- declare function ptrStorage<T extends StorableData, TAccess extends 'read' | 'read-write' = 'read'>(inner: T, access?: TAccess): Ptr<'storage', T, TAccess>;
309
- declare function ptrUniform<T extends StorableData>(inner: T): Ptr<'uniform', T, 'read'>;
310
- declare function ptrHandle<T extends StorableData>(inner: T): Ptr<'handle', T, 'read'>;
311
-
312
- interface DisarrayConstructor {
313
- <TElement extends AnyData>(elementType: TElement): (elementCount: number) => Disarray<TElement>;
314
- <TElement extends AnyData>(elementType: TElement, elementCount: number): Disarray<TElement>;
315
- }
316
- /**
317
- * Creates an array schema that can be used to construct vertex buffers.
318
- * Describes arrays with fixed-size length, storing elements of the same type.
319
- *
320
- * Elements in the schema are not aligned in respect to their `byteAlignment`,
321
- * unless they are explicitly decorated with the custom align attribute
322
- * via `d.align` function.
323
- *
324
- * @example
325
- * const disarray = d.disarrayOf(d.vec3f, 3); // packed array of vec3f
326
- *
327
- * @example
328
- * const disarray = d.disarrayOf(d.align(16, d.vec3f), 3);
329
- *
330
- * If `elementCount` is not specified, a partially applied function is returned.
331
- * @example
332
- * const disarray = d.disarrayOf(d.vec3f);
333
- * // ^? (n: number) => Disarray<d.Vec3f>
334
- *
335
- * @param elementType The type of elements in the array.
336
- * @param elementCount The number of elements in the array.
337
- */
338
- declare const disarrayOf: DualFn<DisarrayConstructor>;
339
-
340
- /**
341
- * Creates a loose struct schema that can be used to construct vertex buffers.
342
- * Describes structs with members of both loose and non-loose types.
343
- *
344
- * The order of members matches the passed in properties object.
345
- * Members are not aligned in respect to their `byteAlignment`,
346
- * unless they are explicitly decorated with the custom align attribute
347
- * via `d.align` function.
348
- *
349
- * @example
350
- * const CircleStruct = d.unstruct({ radius: d.f32, pos: d.vec3f }); // packed struct with no padding
351
- *
352
- * @example
353
- * const CircleStruct = d.unstruct({ radius: d.f32, pos: d.align(16, d.vec3f) });
354
- *
355
- * @param properties Record with `string` keys and `TgpuData` or `TgpuLooseData` values,
356
- * each entry describing one struct member.
357
- */
358
- declare function unstruct<TProps extends Record<string, BaseData>>(properties: TProps): Unstruct<TProps>;
359
-
360
- /**
361
- * Marks a concrete integer scalar type schema (u32 or i32) as a WGSL atomic.
362
- *
363
- * @example
364
- * const atomicU32 = d.atomic(d.u32);
365
- * const atomicI32 = d.atomic(d.i32);
366
- *
367
- * @param data Underlying type schema.
368
- */
369
- declare function atomic<TSchema extends U32 | I32>(data: TSchema): Atomic<TSchema>;
370
-
371
- /**
372
- * Returns the size (in bytes) of data represented by the `schema`.
373
- */
374
- declare function PUBLIC_sizeOf(schema: AnyData): number;
375
-
376
- /**
377
- * Returns the alignment (in bytes) of data represented by the `schema`.
378
- */
379
- declare function PUBLIC_alignmentOf(schema: AnyData): number;
380
-
381
- /**
382
- * Performs a deep comparison of two TypeGPU data schemas.
383
- *
384
- * @param a The first data schema to compare.
385
- * @param b The second data schema to compare.
386
- * @returns `true` if the schemas are deeply equal, `false` otherwise.
387
- *
388
- * @example
389
- * ```ts
390
- * import { vec3f, struct, deepEqual } from 'typegpu/data';
391
- *
392
- * const schema1 = struct({ a: vec3f });
393
- * const schema2 = struct({ a: vec3f });
394
- * const schema3 = struct({ b: vec3f });
395
- *
396
- * console.log(deepEqual(schema1, schema2)); // true
397
- * console.log(deepEqual(schema1, schema3)); // false
398
- * ```
399
- */
400
- declare function deepEqual(a: AnyData, b: AnyData): boolean;
401
-
402
- export { AnyData, AnyWgslData, Atomic, BaseData, BaseData as BaseWgslData, Bool, Disarray, F16, F32, I32, Ptr, StorableData, U16, U32, Unstruct, Vec2b, Vec2f, Vec2h, Vec2i, Vec2u, Vec3b, Vec3f, Vec3h, Vec3i, Vec3u, Vec4b, Vec4f, Vec4h, Vec4i, Vec4u, WgslArray, WgslStruct, PUBLIC_alignmentOf as alignmentOf, arrayOf, atomic, bool, deepEqual, disarrayOf, f16, f32, i32, ptrFn, ptrHandle, ptrPrivate, ptrStorage, ptrUniform, ptrWorkgroup, PUBLIC_sizeOf as sizeOf, struct, u16, u32, unstruct, vec2b, vec2f, vec2h, vec2i, vec2u, vec3b, vec3f, vec3h, vec3i, vec3u, vec4b, vec4f, vec4h, vec4i, vec4u };