#[repr(C, align(16))]pub struct GpuConfig {
pub width: u32,
pub height: u32,
pub strip_height: u32,
pub alphas_tex_width_bits: u32,
pub encoded_paints_tex_width_bits: u32,
pub strip_offset_x: i32,
pub strip_offset_y: i32,
pub negate_ndc: u32,
}Expand description
The uniform block the strip shaders read once per draw.
Laid out to match the reference renderer’s Config byte for byte: eight
4-byte scalars in a 16-byte-aligned block.
Fields§
§width: u32Width of the render target in pixels.
height: u32Height of the render target in pixels.
strip_height: u32Height of one strip in pixels — always Tile::HEIGHT.
alphas_tex_width_bits: u32log2 of the alpha texture’s width in texels.
Pre-computed on the CPU because a downlevel (GLES 3.0 / WebGL2)
target has no firstTrailingBit; the shader shifts by this instead of
dividing.
encoded_paints_tex_width_bits: u32log2 of the encoded-paint texture’s width in texels, pre-computed
for the same reason as Self::alphas_tex_width_bits.
strip_offset_x: i32Horizontal offset applied to every strip, in pixels.
strip_offset_y: i32Vertical offset applied to every strip, in pixels.
negate_ndc: u32Whether the shader negates the y component of its NDC position (non-zero) or leaves it alone (zero).
Kept for a future GLSL/WebGL backend: transpiling WGSL to GLSL applies a y-flip to reconcile WebGPU’s y-down clip space with a WebGL framebuffer’s y-up one. Rendering straight into a caller-provided framebuffer wants that flip undone rather than a second framebuffer allocated and blitted, and the rest of the strip pipeline (slot textures included) assumes y-down throughout. Every backend this crate drives today leaves it zero.
Implementations§
Source§impl GpuConfig
impl GpuConfig
Sourcepub fn new(
width: u32,
height: u32,
alphas_tex_width: u32,
encoded_paints_tex_width: u32,
) -> Self
pub fn new( width: u32, height: u32, alphas_tex_width: u32, encoded_paints_tex_width: u32, ) -> Self
A config for a width x height target sampling resource textures
alphas_tex_width and encoded_paints_tex_width texels wide, with no
strip offset and no NDC negation.
Both texture widths must be powers of two: the shader reconstructs
them as 1 << bits (see tex_width_bits).
Sourcepub const fn with_strip_offset(self, x: i32, y: i32) -> Self
pub const fn with_strip_offset(self, x: i32, y: i32) -> Self
The same config with strips offset by (x, y) pixels.
Sourcepub const fn with_negate_ndc(self, negate: bool) -> Self
pub const fn with_negate_ndc(self, negate: bool) -> Self
The same config with NDC y negation switched on or off
(Self::negate_ndc).
Trait Implementations§
impl Copy for GpuConfig
impl Pod for GpuConfig
Auto Trait Implementations§
impl Freeze for GpuConfig
impl RefUnwindSafe for GpuConfig
impl Send for GpuConfig
impl Sync for GpuConfig
impl Unpin for GpuConfig
impl UnsafeUnpin for GpuConfig
impl UnwindSafe for GpuConfig
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.