pub struct Renderer {
Show 30 fields device: Arc<Device>, queue: Queue, surface: Surface, surface_config: SurfaceConfiguration, sampler: Sampler, depth_sampler: Sampler, state: State, recreation_pending: Option<PipelineModes>, layouts: Layouts, locals: Locals, views: Views, noise_tex: Texture, quad_index_buffer_u16: Buffer<u16>, quad_index_buffer_u32: Buffer<u32>, shaders: AssetHandle<Shaders>, shaders_watcher: ReloadWatcher, pipeline_modes: PipelineModes, other_modes: OtherModes, resolution: Vec2<u32>, take_screenshot: Option<Box<dyn FnOnce(Result<RgbImage, String>) + Send>>, profiler: GpuProfiler, profile_times: Vec<GpuTimerScopeResult>, profiler_features_enabled: bool, ui_premultiply_uploads: BatchedUploads, egui_renderpass: RenderPass, is_minimized: bool, graphics_backend: String, intermediate_format: TextureFormat, present_modes: Vec<PresentMode>, max_texture_size: u32,
}
Expand description

A type that encapsulates rendering state. Renderer is central to Voxygen’s rendering subsystem and contains any state necessary to interact with the GPU, along with pipeline state objects (PSOs) needed to renderer different kinds of models to the screen.

Fields§

§device: Arc<Device>§queue: Queue§surface: Surface§surface_config: SurfaceConfiguration§sampler: Sampler§depth_sampler: Sampler§state: State§recreation_pending: Option<PipelineModes>§layouts: Layouts§locals: Locals§views: Views§noise_tex: Texture§quad_index_buffer_u16: Buffer<u16>§quad_index_buffer_u32: Buffer<u32>§shaders: AssetHandle<Shaders>§shaders_watcher: ReloadWatcher§pipeline_modes: PipelineModes§other_modes: OtherModes§resolution: Vec2<u32>§take_screenshot: Option<Box<dyn FnOnce(Result<RgbImage, String>) + Send>>§profiler: GpuProfiler§profile_times: Vec<GpuTimerScopeResult>§profiler_features_enabled: bool§ui_premultiply_uploads: BatchedUploads§egui_renderpass: RenderPass§is_minimized: bool§graphics_backend: String§intermediate_format: TextureFormat

The texture format used for the intermediate rendering passes

§present_modes: Vec<PresentMode>

Supported present modes.

§max_texture_size: u32

Cached max texture size.

Implementations§

source§

impl Renderer

source

pub fn bind_globals( &self, global_model: &GlobalModel, lod_data: &LodData ) -> GlobalsBindGroup

source

pub fn bind_sprite_globals( &self, global_model: &GlobalModel, lod_data: &LodData, sprite_verts: &SpriteVerts ) -> SpriteGlobalsBindGroup

source

pub fn create_debug_bound_locals(&mut self, vals: &[Locals]) -> BoundLocals

source

pub fn create_ui_bound_locals(&mut self, vals: &[Locals]) -> BoundLocals

source

pub fn ui_bind_texture(&mut self, texture: &Texture) -> TextureBindGroup

source

pub fn create_figure_bound_locals( &mut self, locals: &[Locals], bone_data: &[BoneData] ) -> BoundLocals

source

pub fn create_rope_bound_locals(&mut self, locals: &[Locals]) -> BoundLocals

source

pub fn create_terrain_bound_locals(&mut self, locals: &[Locals]) -> BoundLocals

source

pub fn create_shadow_bound_locals(&mut self, locals: &[Locals]) -> BoundLocals

source

pub fn create_rain_occlusion_bound_locals( &mut self, locals: &[Locals] ) -> BoundLocals

source

pub fn figure_bind_atlas_textures( &self, col_light: Texture ) -> AtlasTextures<Locals, FigureSpriteAtlasData>

source

pub fn terrain_bind_atlas_textures( &self, col_light: Texture, kinds: Texture ) -> AtlasTextures<Locals, TerrainAtlasData>

source

pub fn sprite_bind_atlas_textures( &self, col_light: Texture ) -> AtlasTextures<Locals, FigureSpriteAtlasData>

source§

impl Renderer

source

pub fn new( window: &Window, mode: RenderMode, runtime: &Runtime ) -> Result<Self, RenderError>

Create a new Renderer from a variety of backend-specific components and the window targets.

source

pub fn graphics_backend(&self) -> &str

Get the graphics backend being used

source

pub fn pipeline_creation_status(&self) -> Option<(usize, usize)>

Check the status of the intial pipeline creation Returns None if complete Returns Some((total, complete)) if in progress

source

pub fn pipeline_recreation_status(&self) -> Option<(usize, usize)>

Check the status the pipeline recreation Returns None if pipelines are currently not being recreated Returns Some((total, complete)) if in progress

source

pub fn set_render_mode(&mut self, mode: RenderMode) -> Result<(), RenderError>

Change the render mode.

source

pub fn pipeline_modes(&self) -> &PipelineModes

Get the pipelines mode.

source

pub fn present_modes(&self) -> &[PresentMode]

Get the supported present modes.

source

pub fn timings(&self) -> Vec<(u8, &str, f64)>

Get the current profiling times Nested timings immediately follow their parent Returns Vec<(how nested this timing is, label, length in seconds)>

source

pub fn on_resize(&mut self, dims: Vec2<u32>)

Resize internal render targets to match window render target dimensions.

source

pub fn maintain(&self)

source

fn create_rt_views( device: &Device, size: (u32, u32), pipeline_modes: &PipelineModes, other_modes: &OtherModes, format: TextureFormat ) -> (Views, [Vec2<f32>; 5])

Create render target views

source

pub fn resolution(&self) -> Vec2<u32>

Get the resolution of the render target.

source

pub fn get_shadow_resolution(&self) -> (Vec2<u32>, Vec2<u32>)

Get the resolution of the shadow render target.

source

pub fn start_recording_frame<'a>( &'a mut self, globals: &'a GlobalsBindGroup ) -> Result<Option<Drawer<'a>>, RenderError>

NOTE: Supported by Vulkan (by default), DirectX 10+ (it seems–it’s hard to find proof of this, but Direct3D 10 apparently does it by default, and 11 definitely does, so I assume it’s natively supported by DirectX itself), OpenGL 3.2+, and Metal (done by default). While there may be some GPUs that don’t quite support it correctly, the impact is relatively small, so there is no reason not to enable it where available. Start recording the frame When the returned Drawer is dropped the recorded draw calls will be submitted to the queue If there is an intermittent issue with the swap chain then Ok(None) will be returned

source

fn recreate_pipelines(&mut self, pipeline_modes: PipelineModes)

Recreate the pipelines

source

pub fn create_consts<T: Copy + Pod>(&mut self, vals: &[T]) -> Consts<T>

Create a new set of constants with the provided values.

source

pub fn create_consts_inner<T: Copy + Pod>( device: &Device, queue: &Queue, vals: &[T] ) -> Consts<T>

source

pub fn update_consts<T: Copy + Pod>(&self, consts: &mut Consts<T>, vals: &[T])

Update a set of constants with the provided values.

source

pub fn update_clouds_locals(&mut self, new_val: Locals)

source

pub fn update_postprocess_locals(&mut self, new_val: Locals)

source

pub fn create_instances<T: Copy + Pod>(&mut self, vals: &[T]) -> Instances<T>

Create a new set of instances with the provided values.

source

pub(super) fn ensure_sufficient_index_length<V: Vertex>( &mut self, vert_length: usize )

Ensure that the quad index buffer is large enough for a quad vertex buffer with this many vertices

source

pub fn create_sprite_verts(&mut self, mesh: Mesh<Vertex>) -> SpriteVerts

source

pub fn create_model<V: Vertex>(&mut self, mesh: &Mesh<V>) -> Option<Model<V>>

Create a new model from the provided mesh. If the provided mesh is empty this returns None

source

pub fn create_dynamic_model<V: Vertex>( &mut self, size: usize ) -> DynamicModel<V>

Create a new dynamic model with the specified size.

source

pub fn update_model<V: Vertex>( &self, model: &DynamicModel<V>, mesh: &Mesh<V>, offset: usize )

Update a dynamic model with a mesh and a offset.

source

pub fn max_texture_size(&self) -> u32

Return the maximum supported texture size.

source

pub fn create_texture_with_data_raw( &mut self, texture_info: &TextureDescriptor<'_>, view_info: &TextureViewDescriptor<'_>, sampler_info: &SamplerDescriptor<'_>, data: &[u8] ) -> Texture

Create a new immutable texture from the provided image.

Panics

If the provided data doesn’t completely fill the texture this function will panic.

source

pub fn create_texture_raw( &mut self, texture_info: &TextureDescriptor<'_>, view_info: &TextureViewDescriptor<'_>, sampler_info: &SamplerDescriptor<'_> ) -> Texture

Create a new raw texture.

source

pub fn create_texture( &mut self, image: &DynamicImage, filter_method: Option<FilterMode>, address_mode: Option<AddressMode> ) -> Result<Texture, RenderError>

Create a new texture from the provided image.

source

pub fn create_dynamic_texture(&mut self, dims: Vec2<u32>) -> Texture

Create a new dynamic texture with the specified dimensions.

Currently only supports Rgba8Srgb.

source

pub fn update_texture<T: Pod>( &mut self, texture: &Texture, offset: [u32; 2], size: [u32; 2], data: &[T] )

Update a texture with the provided offset, size, and data.

source

pub fn ui_premultiply_upload( &mut self, target_texture: &Arc<Texture>, batch: UploadBatchId, image: &RgbaImage, offset: Vec2<u16> ) -> UploadBatchId

source

pub fn create_screenshot( &mut self, screenshot_handler: impl FnOnce(Result<RgbImage, String>) + Send + 'static )

Queue to obtain a screenshot on the next frame render

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, U> Cast<U> for T
where U: FromCast<T>,

§

fn cast(self) -> U

Numeric cast from self to T.
§

impl<T> Chain<T> for T

§

fn len(&self) -> usize

The number of items that this chain link consists of.
§

fn append_to(self, v: &mut Vec<T>)

Append the elements in this link to the chain.
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromCast<T> for T

§

fn from_cast(t: T) -> T

Numeric cast from T to Self.
§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> GetSetFdFlags for T

§

fn get_fd_flags(&self) -> Result<FdFlags, Error>
where T: AsFilelike,

Query the “status” flags for the self file descriptor.
§

fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>
where T: AsFilelike,

Create a new SetFdFlags value for use with set_fd_flags. Read more
§

fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>
where T: AsFilelike,

Set the “status” flags for the self file descriptor. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Pointer = u32

§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<Context> SubContext<Context> for Context

source§

fn sub_context(self) -> Context

§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Any for T
where T: Any,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> WasmNotSend for T
where T: Send,