spirv_std::arch

Trait Derivative

Source
pub unsafe trait Derivative: Sealed + Default {
    // Provided methods
    fn dfdx(self) -> Self { ... }
    fn dfdx_fine(self) -> Self { ... }
    fn dfdx_coarse(self) -> Self { ... }
    fn dfdy(self) -> Self { ... }
    fn dfdy_fine(self) -> Self { ... }
    fn dfdy_coarse(self) -> Self { ... }
    fn fwidth(self) -> Self { ... }
    fn fwidth_fine(self) -> Self { ... }
    fn fwidth_coarse(self) -> Self { ... }
}
Expand description

Types that can be derived by partial derivatives

§Safety

Result Type must be a scalar or vector of floating-point type using the IEEE 754 encoding. The component width must be 32 bits.

Provided Methods§

Source

fn dfdx(self) -> Self

Result is the partial derivative of Self with respect to the window x coordinate. Uses local differencing based on the value of Self. Same result as either Self::dfdx_fine or Self::dfdx_coarse on Self. Selection of which one is based on external factors.

An invocation will not execute a dynamic instance of this instruction (X’) until all invocations in its derivative group have executed all dynamic instances that are program-ordered before X’.

This instruction is only valid in the Fragment Execution Model.

Source

fn dfdx_fine(self) -> Self

Result is the partial derivative of Self with respect to the window x coordinate. Uses local differencing based on the value of Self for the current fragment and its immediate neighbor(s).

An invocation will not execute a dynamic instance of this instruction (X’) until all invocations in its derivative group have executed all dynamic instances that are program-ordered before X’.

This instruction is only valid in the Fragment Execution Model.

Source

fn dfdx_coarse(self) -> Self

Result is the partial derivative of Self with respect to the window x coordinate. Uses local differencing based on the value of Self for the current fragment’s neighbors, and possibly, but not necessarily, includes the value of Self for the current fragment. That is, over a given area, the implementation can compute x derivatives in fewer unique locations than would be allowed for Self::dfdx_fine.

An invocation will not execute a dynamic instance of this instruction (X’) until all invocations in its derivative group have executed all dynamic instances that are program-ordered before X’.

This instruction is only valid in the Fragment Execution Model.

Source

fn dfdy(self) -> Self

Result is the partial derivative of Self with respect to the window y coordinate. Uses local differencing based on the value of Self. Same result as either Self::dfdy_fine or Self::dfdy_coarse on Self. Selection of which one is based on external factors.

An invocation will not execute a dynamic instance of this instruction (X’) until all invocations in its derivative group have executed all dynamic instances that are program-ordered before X’.

This instruction is only valid in the Fragment Execution Model.

Source

fn dfdy_fine(self) -> Self

Result is the partial derivative of Self with respect to the window y coordinate. Uses local differencing based on the value of Self for the current fragment and its immediate neighbor(s).

An invocation will not execute a dynamic instance of this instruction (X’) until all invocations in its derivative group have executed all dynamic instances that are program-ordered before X’.

This instruction is only valid in the Fragment Execution Model.

Source

fn dfdy_coarse(self) -> Self

Result is the partial derivative of Self with respect to the window y coordinate. Uses local differencing based on the value of Self for the current fragment’s neighbors, and possibly, but not necessarily, includes the value of Self for the current fragment. That is, over a given area, the implementation can compute y derivatives in fewer unique locations than would be allowed for Self::dfdy_fine.

An invocation will not execute a dynamic instance of this instruction (X’) until all invocations in its derivative group have executed all dynamic instances that are program-ordered before X’.

This instruction is only valid in the Fragment Execution Model.

Source

fn fwidth(self) -> Self

Result is the same as computing the sum of the absolute values of Self::dfdx and Self::dfdy on P.

An invocation will not execute a dynamic instance of this instruction (X’) until all invocations in its derivative group have executed all dynamic instances that are program-ordered before X’.

This instruction is only valid in the Fragment Execution Model.

Source

fn fwidth_fine(self) -> Self

Result is the same as computing the sum of the absolute values of Self::dfdx_fine and Self::dfdy_fine on P.

An invocation will not execute a dynamic instance of this instruction (X’) until all invocations in its derivative group have executed all dynamic instances that are program-ordered before X’.

This instruction is only valid in the Fragment Execution Model.

Source

fn fwidth_coarse(self) -> Self

Result is the same as computing the sum of the absolute values of Self::dfdx_coarse and Self::dfdy_coarse on P.

An invocation will not execute a dynamic instance of this instruction (X’) until all invocations in its derivative group have executed all dynamic instances that are program-ordered before X’.

This instruction is only valid in the Fragment Execution Model.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Derivative for f32

Source§

impl Derivative for Vec3A

Source§

impl Derivative for Vec4

Source§

impl Derivative for Vec2

Source§

impl Derivative for Vec3

Implementors§