Skip to main content

GpuStrip

Struct GpuStrip 

Source
#[repr(C)]
pub struct GpuStrip { pub x: u16, pub y: u16, pub width: u16, pub dense_width_or_rect_height: u16, pub col_idx_or_rect_frac: u32, pub payload: u32, pub paint_and_rect_flag: u32, pub depth_index: u32, }
Expand description

One strip instance, matching the shaders’ StripInstance byte for byte.

Three of the fields are overloaded by RECT_STRIP_FLAG, which is why they are named for both readings.

Fields§

§x: u16

Left edge in pixels.

§y: u16

Top edge in pixels (a multiple of Tile::HEIGHT).

§width: u16

Width in pixels.

§dense_width_or_rect_height: u16

Width of the alpha-sampled (dense) part in pixels, or, for a rect instance, the rect’s height in pixels.

§col_idx_or_rect_frac: u32

Index of the instance’s first alpha column in the alpha texture, or, for a rect instance, its packed coverage fraction.

§payload: u32

Paint-dependent payload — a packed color, or the coordinates the paint is sampled at.

§paint_and_rect_flag: u32

Packed paint descriptor, with RECT_STRIP_FLAG in bit 31.

§depth_index: u32

Painter’s-order index driving early-z rejection: the backmost draw is 0 and each draw in front of it increments.

Implementations§

Source§

impl GpuStrip

Source

pub const QUAD_VERTICES: u32 = 4

Vertices in the quad each instance expands to.

Source

pub fn vertex_attributes() -> [VertexAttribute; 6]

The six Uint32 vertex attributes the 24-byte instance is read through, at shader locations 0-5.

The u16 pairs are read as packed u32s and unpacked in the shader, so the attribute list stays uniform.

Source

pub fn vertex_layout() -> VertexLayout

The instance-stepped vertex buffer layout over GpuStrip.

Source

pub fn vertex_range() -> Range<u32> ⓘ

The vertex range of a strip draw: one quad, built in the shader from the vertex index, with no vertex buffer behind it.

Source

pub fn instance_range(first_instance: u32, count: u32) -> Range<u32> ⓘ

The instance range of a strip draw covering count instances from first_instance — paired with Self::vertex_range for one draw call.

Source

pub fn from_strip(strip: &Strip, width: u16, draw: StripDraw) -> Self

The alpha-sampled instance for strip, width pixels wide.

The strip’s alpha index becomes the instance’s first alpha column, and the instance is dense across its whole width: every column samples coverage.

Source

pub fn from_strip_pair(strip: &Strip, next: &Strip, draw: StripDraw) -> Self

The alpha-sampled instance for strip, taking its width from next — the strip immediately after it in the same run, which is where a strip’s extent is recorded.

Source

pub fn gap_fill(strip: &Strip, next: &Strip, draw: StripDraw) -> Option<Self>

The solid instance filling the gap between strip and next, or None when there is no gap to fill.

A gap is filled only when next carries the fill-gap flag and sits on the same strip row: the flag means “the winding between me and the previous strip is non-zero”, which says nothing about a strip on another row. The instance samples no coverage, so its dense width and column index are both zero.

Source

pub fn solid_fill(x: u16, y: u16, width: u16, draw: StripDraw) -> Self

A solid instance covering one strip row, sampling no coverage.

Source

pub fn from_rect( x: u16, y: u16, width: u16, height: u16, frac: u32, draw: StripDraw, ) -> Self

A rectangle instance of width x height pixels with packed coverage fraction frac, flagged with RECT_STRIP_FLAG.

Unlike a strip, a rect instance is not bound to one strip row: its height is carried in the instance itself.

Source

pub const fn is_rect(&self) -> bool

Whether this instance is a rectangle rather than a strip.

Source

pub const fn paint(&self) -> u32

The packed paint descriptor with RECT_STRIP_FLAG masked off.

Trait Implementations§

Source§

impl Clone for GpuStrip

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for GpuStrip

Source§

impl Debug for GpuStrip

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for GpuStrip

Source§

impl PartialEq for GpuStrip

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Pod for GpuStrip

Source§

impl StructuralPartialEq for GpuStrip

Source§

impl Zeroable for GpuStrip

Source§

fn zeroed() -> Self

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> NoUninit for T
where T: Pod,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,