textureSampleBias
On this page

textureSampleBias

Function

Samples a float texture through the sampler smp with the implicit level of detail shifted by bias, in the fragment stage only; the coordinate is a vec2 on a texture_2d and a vec3 on a texture_cube or a texture_3d.

The signature and the sentence under each name are the compiler's own text at commit 26de7be8.

Syntax

declare function textureSampleBias(tex: texture_2d<f32>, smp: sampler, uv: vec2, bias: number): vec4
declare function textureSampleBias(
tex: texture_2d_array<f32>,
smp: sampler,
uv: vec2,
layer: number,
bias: number,
): vec4
declare function textureSampleBias(
tex: texture_cube<f32>,
smp: sampler,
dir: vec3,
bias: number,
): vec4
declare function textureSampleBias(
tex: texture_3d<f32>,
smp: sampler,
coord: vec3,
bias: number,
): vec4
declare function textureSampleBias(
tex: texture_cube_array<f32>,
smp: sampler,
dir: vec3,
layer: number,
bias: number,
): vec4

A number in a parameter or a return position is the scalar slot. The ambient file declares a GPU scalar as a branded number whose brand is optional, so a literal and any branded scalar both fill it.

type f32 = number & { readonly [f32Tag]?: true }

A declaration you write still needs a width, and a bare number on a field or a parameter is refused; the TypeScript constructs page carries that row with the compiler's own message.

Parameters

Return value

vec4

Description

On a texture_2d_array the layer comes before the bias. Compiles to textureSampleBias on WGSL and to texture with a bias argument on GLSL.

Targets

WGSL
textureSampleBias(a, b, c, d)
GLSL ES 3.00
texture(a, c, d)

Examples

See also

Edit this page Report a problem