ORACLE_GPU_STUB_NAMES
On this page

ORACLE_GPU_STUB_NAMES

Constant in CPU oracle

The names of every GPU-only intrinsic the CPU backends cannot genuinely evaluate, as a read-only set: textureSample, textureSampleLevel, textureSampleBias, textureSampleGrad, textureLoad, their 2d-array forms, the depth comparisons, textureDimensions, textureNumLayers, and the derivatives fwidth, dpdx and dpdy.

import { ORACLE_GPU_STUB_NAMES } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

const ORACLE_GPU_STUB_NAMES: ReadonlySet<string>

Description

A texture read needs the GPU’s sampler and texture memory, and a derivative needs neighbouring fragments; a CPU run of a single invocation has neither. Calling one of these from a module compiled with compileModule or compileModuleJs throws, unless the module was compiled with { gpuStubs: true }; then it returns a placeholder: [0, 0, 0, 1] for a texture read, [1, 1] for textureDimensions, 1 for textureNumLayers and 0 for a derivative. Meant for tests: the union of this set and ORACLE_BUILTIN_NAMES should cover every intrinsic in INTRINSICS and PORTABLE_INTRINSICS, so a test can assert that each intrinsic a shader can emit has either a CPU implementation or a documented placeholder.

In the guide

See also

Source

src/core/cpu-runtime.ts, line 1095, at commit 26de7be8

Edit this page Report a problem