pub struct GpuResourceBudget {
pub atlas_initial_size: u32,
pub instance_buffer_initial_size: usize,
pub instance_buffer_max_size: usize,
}Expand description
GPU resource budget.
instance_buffer_max_size is new in 0.9. Existing struct literals that listed
only atlas and initial-buffer fields will not compile. Use
Self::new or ..GpuResourceBudget::default() to keep a two-field update
path; presets already fill the ceiling.
Fields§
§atlas_initial_size: u32Initial width and height (in device pixels) for newly created atlas textures.
Atlas textures are allocated lazily when glyphs or images are first rasterized. This controls the minimum size of each texture. If a single glyph or image is larger, the texture will be sized to fit.
Default: 1024 (meaning 1024×1024). For minimal applications, 512 is recommended.
Memory impact (per texture):
- Monochrome (R8):
size × size × 1bytes - Polychrome (BGRA):
size × size × 4bytes
instance_buffer_initial_size: usizeInitial renderer instance buffer capacity in bytes, where supported.
Instance buffers hold per-frame draw data uploaded to the GPU. This is an initial budget, not a hard cap: renderers may grow the buffer on demand for complex scenes. Lower values reduce idle GPU memory for small apps, while larger values avoid early reallocations for heavy UIs.
Default: 2 MiB for desktop applications.
instance_buffer_max_size: usizeMaximum renderer instance buffer capacity in bytes, where supported.
Batch upload sizes the GPU buffer to fit the whole scene at frame start. This is the growth ceiling after device limits are applied. Desktop matches Zed’s 256 MiB native cap; Utility and Minimal stay lower so a tray or dialog profile cannot balloon to a full-editor working set.
Values below Self::instance_buffer_initial_size are raised to that
initial budget.
Callers that only set atlas and initial size should use Self::new
instead of a struct literal.
Implementations§
Source§impl GpuResourceBudget
impl GpuResourceBudget
Sourcepub fn new(
atlas_initial_size: u32,
instance_buffer_initial_size: usize,
) -> GpuResourceBudget
pub fn new( atlas_initial_size: u32, instance_buffer_initial_size: usize, ) -> GpuResourceBudget
Build a budget from atlas and initial instance-buffer sizes.
The growth ceiling defaults to Zed’s 256 MiB native cap — the implicit limit before this field existed — so two-argument construction stays source-compatible. Presets still apply tighter Utility/Minimal caps.
Sourcepub fn atlas_size(&self) -> Size<DevicePixels>
pub fn atlas_size(&self) -> Size<DevicePixels>
Returns the atlas initial size as a Size<DevicePixels> for renderer use.
Trait Implementations§
Source§impl Clone for GpuResourceBudget
impl Clone for GpuResourceBudget
Source§fn clone(&self) -> GpuResourceBudget
fn clone(&self) -> GpuResourceBudget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GpuResourceBudget
impl Debug for GpuResourceBudget
Source§impl Default for GpuResourceBudget
impl Default for GpuResourceBudget
Source§fn default() -> GpuResourceBudget
fn default() -> GpuResourceBudget
Auto Trait Implementations§
impl Freeze for GpuResourceBudget
impl RefUnwindSafe for GpuResourceBudget
impl Send for GpuResourceBudget
impl Sync for GpuResourceBudget
impl Unpin for GpuResourceBudget
impl UnsafeUnpin for GpuResourceBudget
impl UnwindSafe for GpuResourceBudget
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more