pub struct TextBindCache { /* private fields */ }Expand description
The text-overlay state one draw call would set that the previous call in the same pass already left bound. A heads-up display is overwhelmingly many labels sharing one atlas and one full-window scissor, so tracking the last value bound turns a per-label bind into a per-change bind.
The scissor is the canonical (x, y, w, h) in attachment pixels that
clip_rect_to_scissor returns and every backend’s own rect type converts
from, so one cache serves all three backends.
A cache starts empty rather than seeded with whatever the pass began with, so the first call of each kind always binds and the cache never has to assume what the surrounding pass left in place.
Both queries record as they answer, so a caller must ask only where it goes on to bind: asking and then skipping the bind desynchronises the cache from the recorder.
Implementations§
Source§impl TextBindCache
impl TextBindCache
Sourcepub fn atlas_changed(&mut self, idx: usize) -> bool
pub fn atlas_changed(&mut self, idx: usize) -> bool
Whether the atlas at idx still needs binding, recording it as bound.