typegpu 0.12.3 → 0.12.4

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.
@@ -3,7 +3,7 @@ import { isVoid, isWgslStruct } from "../../data/wgslTypes.js";
3
3
  export function connectTargetsToShader(fragmentOut, targets) {
4
4
  let presentationFormat;
5
5
  if (isVoid(fragmentOut) || isBuiltin(fragmentOut)) {
6
- return [null];
6
+ return [];
7
7
  }
8
8
  if (isWgslStruct(fragmentOut)) {
9
9
  const result = [];
@@ -409,7 +409,7 @@ class RenderPipelineCore {
409
409
  // One other reason is that if the shelled fragment has already been resolved in this namespace,
410
410
  // then this.#latestAutoFragmentOut will be undefined.
411
411
  const fragmentOut = fragment?.shell?.returnType ?? this.#latestAutoFragmentOut;
412
- const connectedTargets = fragmentOut ? connectTargetsToShader(fragmentOut, targets) : [null];
412
+ const connectedTargets = fragmentOut ? connectTargetsToShader(fragmentOut, targets) : [];
413
413
  const descriptor = {
414
414
  layout: device.createPipelineLayout({
415
415
  label: `${getName(this) ?? '<unnamed>'} - Pipeline Layout`,
package/index.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  // NOTE: This is a barrel file, internal files should not import things from this file
6
6
 
7
- export declare const tgpu: {
7
+ declare const tgpu_default: {
8
8
  const: typeof import('./core/constant/tgpuConstant.ts').constant;
9
9
  fn: typeof import('./core/function/tgpuFn.ts').fn;
10
10
  comptime: typeof import('./core/function/comptime.ts').comptime;
@@ -28,6 +28,7 @@ export declare const tgpu: {
28
28
  '~unstable': typeof import('./tgpuUnstable.ts');
29
29
  };
30
30
 
31
- export default tgpu;
31
+ export { tgpu_default as tgpu };
32
+ export default tgpu_default;
32
33
 
33
34
  export * from './indexNamedExports.ts';
package/index.js CHANGED
@@ -2,7 +2,6 @@
2
2
  * @module typegpu
3
3
  */
4
4
  // NOTE: This is a barrel file, internal files should not import things from this file
5
- import * as tgpu from "./tgpu.js";
6
5
  export * as tgpu from "./tgpu.js";
7
- export default tgpu;
6
+ export * as default from "./tgpu.js";
8
7
  export * from "./indexNamedExports.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typegpu",
3
- "version": "0.12.3",
3
+ "version": "0.12.4",
4
4
  "description": "A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.",
5
5
  "keywords": [
6
6
  "compute",
@@ -50,7 +50,7 @@
50
50
  "dependencies": {
51
51
  "tsover-runtime": "^0.0.7",
52
52
  "typed-binary": "^4.3.3",
53
- "tinyest": "~0.3.2"
53
+ "tinyest": "~0.3.3"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">=12.20.0"
package/resolutionCtx.js CHANGED
@@ -845,6 +845,9 @@ export class ResolutionCtxImpl {
845
845
  if (schema && isWgslStruct(schema)) {
846
846
  return this.gen.typeInstantiation(schema, Object.entries(schema.propTypes).map(([key, propType]) => snip(item[key], propType, /* origin */ 'runtime')));
847
847
  }
848
+ if (item === null) {
849
+ throw new WgslTypeError(`'null' is not resolvable. 'null' is only allowed in comptime checks.`);
850
+ }
848
851
  throw new WgslTypeError(`Value ${safeStringify(item)} is not resolvable${schema && schema !== UnknownData ? ` to type ${safeStringify(schema)}` : ''}`);
849
852
  }
850
853
  resolveSnippet(snippet) {
package/shared/meta.js CHANGED
@@ -1,4 +1,4 @@
1
- const version = "0.12.3";
1
+ const version = "0.12.4";
2
2
  import { DEV, TEST } from "./env.js";
3
3
  import { $getNameForward, $soul, isMarkedInternal } from "./symbols.js";
4
4
  import { normalizeMetadata } from "./normalizeMetadata.js";
package/shared/symbols.js CHANGED
@@ -1,4 +1,4 @@
1
- const version = "0.12.3";
1
+ const version = "0.12.4";
2
2
  export const $internal = Symbol(`typegpu:${version}:$internal`);
3
3
  /** A plain record of all definitional state of a resource, surviving transfer between runtimes */
4
4
  export const $soul = Symbol(`typegpu:${version}:$soul`);
package/shared/tseynit.js CHANGED
@@ -124,6 +124,9 @@ function stringifyExpression(node, ident) {
124
124
  if (node[0] === NODE.conditionalExpr) {
125
125
  return `${wrapIfComplex(node[1], ident)} ? ${wrapIfComplex(node[2], ident)} : ${wrapIfComplex(node[3], ident)}`;
126
126
  }
127
+ if (node[0] === NODE.nullLiteral) {
128
+ return 'null';
129
+ }
127
130
  assertExhaustive(node);
128
131
  }
129
132
  function assertExhaustive(value) {
@@ -145,7 +148,8 @@ function isExpression(node) {
145
148
  node[0] === NODE.preUpdate ||
146
149
  node[0] === NODE.postUpdate ||
147
150
  node[0] === NODE.objectExpr ||
148
- node[0] === NODE.conditionalExpr) {
151
+ node[0] === NODE.conditionalExpr ||
152
+ node[0] === NODE.nullLiteral) {
149
153
  node;
150
154
  return true;
151
155
  }
@@ -734,6 +734,9 @@ export class WgslGenerator {
734
734
  if (expression[0] === NODE.preUpdate) {
735
735
  throw new Error('Cannot use pre-updates in TypeGPU functions.');
736
736
  }
737
+ if (expression[0] === NODE.nullLiteral) {
738
+ return snip(null, UnknownData, 'constant', false);
739
+ }
737
740
  assertExhaustive(expression);
738
741
  }
739
742
  declareGlobalConst(options) {