typegpu 0.11.0-rc.1 → 0.11.0

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/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.11.0-rc.1";
2
+ var version = "0.11.0";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typegpu",
3
- "version": "0.11.0-rc.1",
3
+ "version": "0.11.0",
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",
@@ -45,8 +45,8 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "tinyest": "~0.3.1",
48
- "tsover-runtime": "^0.0.5",
49
- "typed-binary": "^4.3.1"
48
+ "tsover-runtime": "^0.0.6",
49
+ "typed-binary": "^4.3.3"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=12.20.0"
@@ -213,6 +213,15 @@ ${this.ctx.pre}}`;
213
213
  if (expression[0] === NODE.logicalExpr || expression[0] === NODE.binaryExpr || expression[0] === NODE.assignmentExpr) {
214
214
  const [exprType, lhs, op, rhs] = expression;
215
215
  const lhsExpr = this._expression(lhs);
216
+ if ((op === "||" || op === "&&") && isKnownAtComptime(lhsExpr)) {
217
+ if (!(op === "&&" ? lhsExpr.value : !lhsExpr.value)) return snip(op === "||", bool, "constant");
218
+ const rhsExpr = this._expression(rhs);
219
+ if (rhsExpr.dataType === UnknownData) throw new WgslTypeError(`Right-hand side of '${op}' is of unknown type`);
220
+ if (isKnownAtComptime(rhsExpr)) return snip(!!rhsExpr.value, bool, "constant");
221
+ const convRhs = tryConvertSnippet(this.ctx, rhsExpr, bool, false);
222
+ const rhsStr = this.ctx.resolve(convRhs.value, convRhs.dataType).value;
223
+ return snip(rhsStr, bool, "runtime");
224
+ }
216
225
  const rhsExpr = this._expression(rhs);
217
226
  if (rhsExpr.value instanceof RefOperator) throw new WgslTypeError(stitch`Cannot assign a ref to an existing variable '${lhsExpr}', define a new variable instead.`);
218
227
  if (op === "==") throw new Error("Please use the === operator instead of ==");