Skip to content

getTargetShaderLanguage

const getTargetShaderLanguage: TgpuComptime<() => string | undefined>

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

Returns wgsl if invoked during the resolution process; otherwise, returns undefined.

const f = () => {
'use gpu';
return getTargetShaderLanguage() === 'wgsl';
};
f(); // returns false, but resolved WGSL looks like this:
fn f() -> bool {
return true;
}

Inside lazy, it always returns wgsl. Inside simulate, it always returns undefined. Inside comptime, it returns wgsl if called during the resolution process; otherwise, undefined.