Skip to content

getTargetShaderLanguage

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

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

If invoked during the resolution process, it returns the name of the shader language that is ultimately being generated (usually wgsl); otherwise, returns undefined.

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

Inside simulate, it always returns undefined.

Inside comptime, it returns the shader language that is ultimately being generated (usually wgsl) if called during the resolution process; otherwise, undefined.