pub struct RenderResources {
pub sampler: Option<Sampler>,
pub uniform_buffer: Option<UniformBuffer>,
pub image_bind_groups: HashMap<u64, BindGroup>,
pub image_bind_group_layout: Option<BindGroupLayout>,
}Expand description
Shared render resources
This corresponds to the RenderResources struct in the C++ implementation. Contains samplers, uniform buffers, and bind group layouts that are shared across all frames.
Fields§
§sampler: Option<Sampler>Texture sampler
uniform_buffer: Option<UniformBuffer>Uniform buffer manager (also owns the common bind group layout)
image_bind_groups: HashMap<u64, BindGroup>Image bind groups cache (texture_id -> bind_group)
image_bind_group_layout: Option<BindGroupLayout>Image bind group layout (cached for efficiency)
Implementations§
Source§impl RenderResources
impl RenderResources
Sourcepub fn initialize(&mut self, device: &Device) -> RendererResult<()>
pub fn initialize(&mut self, device: &Device) -> RendererResult<()>
Initialize render resources
Sourcepub fn create_image_bind_group(
&self,
device: &Device,
texture_view: &TextureView,
) -> RendererResult<BindGroup>
pub fn create_image_bind_group( &self, device: &Device, texture_view: &TextureView, ) -> RendererResult<BindGroup>
Create an image bind group for a texture
Sourcepub fn get_or_create_image_bind_group(
&mut self,
device: &Device,
texture_id: u64,
texture_view: &TextureView,
) -> RendererResult<&BindGroup>
pub fn get_or_create_image_bind_group( &mut self, device: &Device, texture_id: u64, texture_view: &TextureView, ) -> RendererResult<&BindGroup>
Get or create an image bind group for a texture
Sourcepub fn remove_image_bind_group(&mut self, texture_id: u64)
pub fn remove_image_bind_group(&mut self, texture_id: u64)
Remove an image bind group
Sourcepub fn clear_image_bind_groups(&mut self)
pub fn clear_image_bind_groups(&mut self)
Clear all image bind groups
Sourcepub fn uniform_buffer(&self) -> Option<&UniformBuffer>
pub fn uniform_buffer(&self) -> Option<&UniformBuffer>
Get the uniform buffer
Sourcepub fn common_bind_group(&self) -> Option<&BindGroup>
pub fn common_bind_group(&self) -> Option<&BindGroup>
Get the common bind group
Sourcepub fn image_bind_group_layout(&self) -> Option<&BindGroupLayout>
pub fn image_bind_group_layout(&self) -> Option<&BindGroupLayout>
Get the image bind group layout
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if resources are initialized
Sourcepub fn stats(&self) -> RenderResourcesStats
pub fn stats(&self) -> RenderResourcesStats
Get statistics for debugging
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RenderResources
impl !RefUnwindSafe for RenderResources
impl Send for RenderResources
impl Sync for RenderResources
impl Unpin for RenderResources
impl UnsafeUnpin for RenderResources
impl !UnwindSafe for RenderResources
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
Mutably borrows from an owned value. Read more