pub struct ForwardPlusLane {
pub tile_config: ForwardPlusTileConfig,
pub shader_complexity: ShaderComplexity,
pub gpu_resources: ForwardPlusGpuResources,
/* private fields */
}Expand description
A rendering lane that implements Forward+ (Tiled Forward) rendering.
Forward+ divides the screen into tiles and uses a compute shader to determine which lights affect each tile before the main render pass. This significantly reduces per-fragment lighting cost for scenes with many lights.
§Configuration
The lane is configured via ForwardPlusTileConfig, which controls:
- Tile size: 16x16 or 32x32 pixels (trade-off between culling granularity and overhead)
- Max lights per tile: Memory budget for per-tile light lists
- Depth pre-pass: Optional optimization for depth-bounded light culling
Fields§
§tile_config: ForwardPlusTileConfigTile configuration for light culling.
shader_complexity: ShaderComplexityShader complexity for cost estimation.
gpu_resources: ForwardPlusGpuResourcesGPU resources for compute and render passes.
Implementations§
Source§impl ForwardPlusLane
impl ForwardPlusLane
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new ForwardPlusLane with default settings.
Default configuration:
- Tile size: 16x16 pixels
- Max lights per tile: 128
- No depth pre-pass
Sourcepub fn with_config(config: ForwardPlusTileConfig) -> Self
pub fn with_config(config: ForwardPlusTileConfig) -> Self
Creates a new ForwardPlusLane with the specified configuration.
§Arguments
config- The tile configuration for light culling
Sourcepub fn with_complexity(complexity: ShaderComplexity) -> Self
pub fn with_complexity(complexity: ShaderComplexity) -> Self
Creates a new ForwardPlusLane with the specified shader complexity.
Sourcepub fn set_screen_size(&mut self, width: u32, height: u32)
pub fn set_screen_size(&mut self, width: u32, height: u32)
Updates the screen size used for tile calculations.
This should be called when the window is resized to recalculate tile counts and buffer sizes.
Sourcepub fn tile_count(&self) -> (u32, u32)
pub fn tile_count(&self) -> (u32, u32)
Calculates the number of tiles in each dimension.
Sourcepub fn total_tiles(&self) -> u32
pub fn total_tiles(&self) -> u32
Calculates the total number of tiles on screen.
Sourcepub fn effective_light_count(&self, render_world: &RenderWorld) -> usize
pub fn effective_light_count(&self, render_world: &RenderWorld) -> usize
Returns the effective number of lights in the scene.
This counts all light types (directional, point, spot) that will be processed by the light culling pass.
Trait Implementations§
Source§impl Clone for ForwardPlusLane
impl Clone for ForwardPlusLane
Source§fn clone(&self) -> ForwardPlusLane
fn clone(&self) -> ForwardPlusLane
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ForwardPlusLane
impl Debug for ForwardPlusLane
Source§impl Default for ForwardPlusLane
impl Default for ForwardPlusLane
Source§impl RenderLane for ForwardPlusLane
impl RenderLane for ForwardPlusLane
Source§fn strategy_name(&self) -> &'static str
fn strategy_name(&self) -> &'static str
Source§fn get_pipeline_for_material(
&self,
material_uuid: Option<AssetUUID>,
materials: &Assets<Box<dyn Material>>,
) -> RenderPipelineId
fn get_pipeline_for_material( &self, material_uuid: Option<AssetUUID>, materials: &Assets<Box<dyn Material>>, ) -> RenderPipelineId
Source§fn render(
&self,
render_world: &RenderWorld,
encoder: &mut dyn CommandEncoder,
render_ctx: &RenderContext<'_>,
gpu_meshes: &RwLock<Assets<GpuMesh>>,
materials: &RwLock<Assets<Box<dyn Material>>>,
)
fn render( &self, render_world: &RenderWorld, encoder: &mut dyn CommandEncoder, render_ctx: &RenderContext<'_>, gpu_meshes: &RwLock<Assets<GpuMesh>>, materials: &RwLock<Assets<Box<dyn Material>>>, )
Source§fn estimate_cost(
&self,
render_world: &RenderWorld,
gpu_meshes: &RwLock<Assets<GpuMesh>>,
) -> f32
fn estimate_cost( &self, render_world: &RenderWorld, gpu_meshes: &RwLock<Assets<GpuMesh>>, ) -> f32
RenderWorld with this strategy. Read moreAuto Trait Implementations§
impl Freeze for ForwardPlusLane
impl RefUnwindSafe for ForwardPlusLane
impl Send for ForwardPlusLane
impl Sync for ForwardPlusLane
impl Unpin for ForwardPlusLane
impl UnwindSafe for ForwardPlusLane
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().