MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / gpuConditional

Function gpuConditional

src/compute-engine/compilation/gpu-target.ts:359–368  ·  view source on GitHub ↗

* Emit a conditional `cond ? whenTrue : whenFalse` for the target language. * * GLSL has the ternary operator; WGSL does not and uses * `select(false_value, true_value, condition)` instead.

(
  cond: string,
  whenTrue: string,
  whenFalse: string,
  target?: CompileTarget<Expression>
)

Source from the content-addressed store, hash-verified

357 'using',
358 'virtual',
359 'where',
360]);
361
362/** The reserved-word set for a GPU shader language, or an empty set. */
363function gpuReservedWords(language?: string): ReadonlySet<string> {
364 if (language === 'wgsl') return WGSL_RESERVED;
365 if (language === 'glsl') return GLSL_RESERVED;
366 return new Set();
367}
368
369/**
370 * Fail closed (D6) if `id` is a reserved word in the target shader language.
371 * A user variable / loop index carrying a reserved name would emit source that

Callers 2

gpu-target.tsFile · 0.85
buildFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected