Fix no indirect drawing (#18628)
# Objective The `NoIndirectDrawing` wasn't working and was causing the scene not to be rendered. ## Solution Check the configured preprocessing mode when adding new batch sets and mark them as batchable instead of muli-drawable if indirect rendering has been disabled. ## Testing `cargo run --example many_cubes -- --no-indirect-drawing`
This commit is contained in:
parent
a2b14983f4
commit
831c57d8b1
@ -165,6 +165,9 @@ where
|
|||||||
/// remove the entity from the old bin during
|
/// remove the entity from the old bin during
|
||||||
/// [`BinnedRenderPhase::sweep_old_entities`].
|
/// [`BinnedRenderPhase::sweep_old_entities`].
|
||||||
entities_that_changed_bins: Vec<EntityThatChangedBins<BPI>>,
|
entities_that_changed_bins: Vec<EntityThatChangedBins<BPI>>,
|
||||||
|
/// The gpu preprocessing mode configured for the view this phase is associated
|
||||||
|
/// with.
|
||||||
|
gpu_preprocessing_mode: GpuPreprocessingMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All entities that share a mesh and a material and can be batched as part of
|
/// All entities that share a mesh and a material and can be batched as part of
|
||||||
@ -381,8 +384,8 @@ pub enum BinnedRenderPhaseType {
|
|||||||
/// can be batched with other meshes of the same type.
|
/// can be batched with other meshes of the same type.
|
||||||
MultidrawableMesh,
|
MultidrawableMesh,
|
||||||
|
|
||||||
/// The item is a mesh that's eligible for single-draw indirect rendering
|
/// The item is a mesh that can be batched with other meshes of the same type and
|
||||||
/// and can be batched with other meshes of the same type.
|
/// drawn in a single draw call.
|
||||||
BatchableMesh,
|
BatchableMesh,
|
||||||
|
|
||||||
/// The item is a mesh that's eligible for indirect rendering, but can't be
|
/// The item is a mesh that's eligible for indirect rendering, but can't be
|
||||||
@ -466,9 +469,17 @@ where
|
|||||||
bin_key: BPI::BinKey,
|
bin_key: BPI::BinKey,
|
||||||
(entity, main_entity): (Entity, MainEntity),
|
(entity, main_entity): (Entity, MainEntity),
|
||||||
input_uniform_index: InputUniformIndex,
|
input_uniform_index: InputUniformIndex,
|
||||||
phase_type: BinnedRenderPhaseType,
|
mut phase_type: BinnedRenderPhaseType,
|
||||||
change_tick: Tick,
|
change_tick: Tick,
|
||||||
) {
|
) {
|
||||||
|
// If the user has overridden indirect drawing for this view, we need to
|
||||||
|
// force the phase type to be batchable instead.
|
||||||
|
if self.gpu_preprocessing_mode == GpuPreprocessingMode::PreprocessingOnly
|
||||||
|
&& phase_type == BinnedRenderPhaseType::MultidrawableMesh
|
||||||
|
{
|
||||||
|
phase_type = BinnedRenderPhaseType::BatchableMesh;
|
||||||
|
}
|
||||||
|
|
||||||
match phase_type {
|
match phase_type {
|
||||||
BinnedRenderPhaseType::MultidrawableMesh => {
|
BinnedRenderPhaseType::MultidrawableMesh => {
|
||||||
match self.multidrawable_meshes.entry(batch_set_key.clone()) {
|
match self.multidrawable_meshes.entry(batch_set_key.clone()) {
|
||||||
@ -1023,6 +1034,7 @@ where
|
|||||||
cached_entity_bin_keys: IndexMap::default(),
|
cached_entity_bin_keys: IndexMap::default(),
|
||||||
valid_cached_entity_bin_keys: FixedBitSet::new(),
|
valid_cached_entity_bin_keys: FixedBitSet::new(),
|
||||||
entities_that_changed_bins: vec![],
|
entities_that_changed_bins: vec![],
|
||||||
|
gpu_preprocessing_mode: gpu_preprocessing,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -711,6 +711,9 @@ impl From<ColorGrading> for ColorGradingUniform {
|
|||||||
///
|
///
|
||||||
/// The vast majority of applications will not need to use this component, as it
|
/// The vast majority of applications will not need to use this component, as it
|
||||||
/// generally reduces rendering performance.
|
/// generally reduces rendering performance.
|
||||||
|
///
|
||||||
|
/// Note: This component should only be added when initially spawning a camera. Adding
|
||||||
|
/// or removing after spawn can result in unspecified behavior.
|
||||||
#[derive(Component, Default)]
|
#[derive(Component, Default)]
|
||||||
pub struct NoIndirectDrawing;
|
pub struct NoIndirectDrawing;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user