#[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: u16Left edge in pixels.
y: u16Top edge in pixels (a multiple of Tile::HEIGHT).
width: u16Width in pixels.
dense_width_or_rect_height: u16Width of the alpha-sampled (dense) part in pixels, or, for a rect instance, the rect’s height in pixels.
col_idx_or_rect_frac: u32Index of the instance’s first alpha column in the alpha texture, or, for a rect instance, its packed coverage fraction.
payload: u32Paint-dependent payload — a packed color, or the coordinates the paint is sampled at.
paint_and_rect_flag: u32Packed paint descriptor, with RECT_STRIP_FLAG in bit 31.
depth_index: u32Painter’s-order index driving early-z rejection: the backmost draw is 0 and each draw in front of it increments.
Implementations§
Source§impl GpuStrip
impl GpuStrip
Sourcepub const QUAD_VERTICES: u32 = 4
pub const QUAD_VERTICES: u32 = 4
Vertices in the quad each instance expands to.
Sourcepub fn vertex_attributes() -> [VertexAttribute; 6]
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.
Sourcepub fn vertex_layout() -> VertexLayout
pub fn vertex_layout() -> VertexLayout
The instance-stepped vertex buffer layout over GpuStrip.
Sourcepub fn vertex_range() -> Range<u32> ⓘ
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.
Sourcepub fn instance_range(first_instance: u32, count: u32) -> Range<u32> ⓘ
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.
Sourcepub fn from_strip(strip: &Strip, width: u16, draw: StripDraw) -> Self
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.
Sourcepub fn from_strip_pair(strip: &Strip, next: &Strip, draw: StripDraw) -> Self
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.
Sourcepub fn gap_fill(strip: &Strip, next: &Strip, draw: StripDraw) -> Option<Self>
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.
Sourcepub fn solid_fill(x: u16, y: u16, width: u16, draw: StripDraw) -> Self
pub fn solid_fill(x: u16, y: u16, width: u16, draw: StripDraw) -> Self
A solid instance covering one strip row, sampling no coverage.
Sourcepub fn from_rect(
x: u16,
y: u16,
width: u16,
height: u16,
frac: u32,
draw: StripDraw,
) -> Self
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.
Sourcepub const fn paint(&self) -> u32
pub const fn paint(&self) -> u32
The packed paint descriptor with RECT_STRIP_FLAG masked off.
Trait Implementations§
impl Copy for GpuStrip
impl Eq for GpuStrip
impl Pod for GpuStrip
impl StructuralPartialEq for GpuStrip
Auto Trait Implementations§
impl Freeze for GpuStrip
impl RefUnwindSafe for GpuStrip
impl Send for GpuStrip
impl Sync for GpuStrip
impl Unpin for GpuStrip
impl UnsafeUnpin for GpuStrip
impl UnwindSafe for GpuStrip
Blanket Implementations§
impl<T> AnyBitPattern for Twhere
T: Pod,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
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
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.