Skip to content

isBeingTranspiled

const isBeingTranspiled: DualFn<() => boolean> = impl

Defined in: packages/typegpu/src/std/environment.ts:33

Returns true when the direct callee is being transpiled for GPU, otherwise false.

const f = () => {
'use gpu';
return isBeingTranspiled() ? 1 : 0;
};
f(); // returns 0, but resolved WGSL looks like this:
fn f() -> i32 {
return 1;
}

Inside comptime, lazy or simulate, it always returns false.