Skip to documentation
SLOP

tiny.gpu.RenderDepthBias

Reference tiny.gpu RenderDepthBias

Defined in contract.

An offset added to each fragment's depth before the depth test, so that a decal drawn over a coplanar surface passes a test the surface's own depth would tie.

API (5)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callscontractRenderDepthBias
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/gpu/src/contract.zig:446

zig
/// An offset added to each fragment's depth before the depth test, so that a decal drawn over a/// coplanar surface passes a test the surface's own depth would tie. With `m` the triangle's/// depth slope in pixels and `r` the step of depth32_float at the triangle's largest vertex depth/// `z`, the offset is `o = m * slope + r * constant`, where `r = 2^(e - 23)` for `z = f * 2^e`/// with `f` in [1, 2). A positive `clamp` caps `o` at `clamp`, a negative one floors `o` at/// `clamp`, and zero leaves `o` unclamped. A bias that moves a depth outside [0, 1] leaves what/// is stored to the backend: the CPU backend stores it as computed.////// Vulkan lets `m` be `sqrt(dz/dx^2 + dz/dy^2)` or `max(|dz/dx|, |dz/dy|)`. The CPU backend takes/// the maximum. The two agree when depth changes along one screen axis, and otherwise the maximum is/// at most the root and at least 1/sqrt(2) of it, so a sloped bias matches another backend only/// to that factor.pub const RenderDepthBias = struct {    constant: f32 = 0,    slope: f32 = 0,    clamp: f32 = 0,    pub fn valid(self: RenderDepthBias) bool {        if (!std.math.isFinite(self.constant)) return false;        if (!std.math.isFinite(self.slope)) return false;        return std.math.isFinite(self.clamp);    }    pub fn enabled(self: RenderDepthBias) bool {        return self.constant != 0 or self.slope != 0;    }};

Source: lib/gpu/src/root.zig:139

zig
pub const RenderDepthBias = contract.RenderDepthBias;

Audit

Definitions3
Public names6
Members3
Version26.7.0
Revisiondaab053ee433