Open
Description
Description
Conditional Array Assignment Limitation
Target WGSL pattern:
var<function> nodeVar: array<vec4<f32>, N>;
if (1 > 0) {
nodeVar = nodebuffer;
} else {
nodeVar = otherBuffer;
}
Current TSL Workaround:
const tempArr = array(new Array(22).fill(vec3(0, 0, 0))).toVar();
If(a.greaterThan(0), () => {
Loop({ start: 0, end: 22, type: 'int' }, ({ i }) => {
tempArr.element(i).assign(uniformArr.element(i));
});
});
Requires explicit element-wise copying inside a conditional.
Desired Syntax - Enable array-level assignment:
const tempArr = array(new Array(22).fill(vec3(0, 0, 0))).toVar();
If(a.greaterThan(0), () => {
tempArr.assign(uniformArr);
});
// or using select