@@ -24,9 +24,9 @@ use crate::{
2424 experimental:: occlusion_culling:: OcclusionCulling ,
2525 render_phase:: {
2626 BinnedPhaseItem , BinnedRenderPhaseBatch , BinnedRenderPhaseBatchSet ,
27- BinnedRenderPhaseBatchSets , CachedRenderPipelinePhaseItem , PhaseItemBatchSetKey as _ ,
28- PhaseItemExtraIndex , SortedPhaseItem , SortedRenderPhase , UnbatchableBinnedEntityIndices ,
29- ViewBinnedRenderPhases , ViewSortedRenderPhases ,
27+ BinnedRenderPhaseBatchSets , CachedRenderPipelinePhaseItem , InputUniformIndex ,
28+ PhaseItemBatchSetKey as _ , PhaseItemExtraIndex , SortedPhaseItem , SortedRenderPhase ,
29+ UnbatchableBinnedEntityIndices , ViewBinnedRenderPhases , ViewSortedRenderPhases ,
3030 } ,
3131 render_resource:: { Buffer , BufferVec , GpuArrayBufferable , RawBufferVec , UninitBufferVec } ,
3232 renderer:: { RenderAdapter , RenderDevice , RenderQueue } ,
@@ -1271,7 +1271,7 @@ pub fn batch_and_prepare_sorted_render_phase<I, GFBD>(
12711271 // Start a new batch.
12721272 if let Some ( indirect_parameters_index) = indirect_parameters_index {
12731273 GFBD :: write_batch_indirect_parameters_metadata (
1274- current_input_index. into ( ) ,
1274+ InputUniformIndex ( current_input_index. into ( ) ) ,
12751275 item_is_indexed,
12761276 output_index,
12771277 None ,
@@ -1382,12 +1382,7 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
13821382 let first_output_index = data_buffer. len ( ) as u32 ;
13831383 let mut batch: Option < BinnedRenderPhaseBatch > = None ;
13841384
1385- for main_entity in bin. entities ( ) {
1386- let Some ( input_index) =
1387- GFBD :: get_binned_index ( & system_param_item, * main_entity)
1388- else {
1389- continue ;
1390- } ;
1385+ for ( & main_entity, & input_index) in bin. entities ( ) {
13911386 let output_index = data_buffer. add ( ) as u32 ;
13921387
13931388 match batch {
@@ -1397,7 +1392,7 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
13971392 work_item_buffer. push (
13981393 batch_set_key. indexed ( ) ,
13991394 PreprocessWorkItem {
1400- input_index : input_index. into ( ) ,
1395+ input_index : * input_index,
14011396 output_index : first_output_index,
14021397 indirect_parameters_index : match batch. extra_index {
14031398 PhaseItemExtraIndex :: IndirectParametersIndex {
@@ -1419,7 +1414,7 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
14191414 . get_next_batch_set_index ( batch_set_key. indexed ( ) ) ;
14201415
14211416 GFBD :: write_batch_indirect_parameters_metadata (
1422- input_index. into ( ) ,
1417+ input_index,
14231418 batch_set_key. indexed ( ) ,
14241419 output_index,
14251420 batch_set_index,
@@ -1429,13 +1424,13 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
14291424 work_item_buffer. push (
14301425 batch_set_key. indexed ( ) ,
14311426 PreprocessWorkItem {
1432- input_index : input_index. into ( ) ,
1427+ input_index : * input_index,
14331428 output_index : first_output_index,
14341429 indirect_parameters_index,
14351430 } ,
14361431 ) ;
14371432 batch = Some ( BinnedRenderPhaseBatch {
1438- representative_entity : ( Entity :: PLACEHOLDER , * main_entity) ,
1433+ representative_entity : ( Entity :: PLACEHOLDER , main_entity) ,
14391434 instance_range : output_index..output_index + 1 ,
14401435 extra_index : PhaseItemExtraIndex :: maybe_indirect_parameters_index (
14411436 NonMaxU32 :: new ( indirect_parameters_index) ,
@@ -1481,11 +1476,7 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
14811476 let first_output_index = data_buffer. len ( ) as u32 ;
14821477
14831478 let mut batch: Option < BinnedRenderPhaseBatch > = None ;
1484- for main_entity in phase. batchable_mesh_values [ key] . entities ( ) {
1485- let Some ( input_index) = GFBD :: get_binned_index ( & system_param_item, * main_entity)
1486- else {
1487- continue ;
1488- } ;
1479+ for ( & main_entity, & input_index) in phase. batchable_mesh_values [ key] . entities ( ) {
14891480 let output_index = data_buffer. add ( ) as u32 ;
14901481
14911482 match batch {
@@ -1502,7 +1493,7 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
15021493 work_item_buffer. push (
15031494 key. 0 . indexed ( ) ,
15041495 PreprocessWorkItem {
1505- input_index : input_index. into ( ) ,
1496+ input_index : * input_index,
15061497 output_index : if no_indirect_drawing {
15071498 output_index
15081499 } else {
@@ -1528,7 +1519,7 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
15281519 indirect_parameters_buffers. get_next_batch_set_index ( key. 0 . indexed ( ) ) ;
15291520
15301521 GFBD :: write_batch_indirect_parameters_metadata (
1531- input_index. into ( ) ,
1522+ input_index,
15321523 key. 0 . indexed ( ) ,
15331524 output_index,
15341525 batch_set_index,
@@ -1538,13 +1529,13 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
15381529 work_item_buffer. push (
15391530 key. 0 . indexed ( ) ,
15401531 PreprocessWorkItem {
1541- input_index : input_index. into ( ) ,
1532+ input_index : * input_index,
15421533 output_index : first_output_index,
15431534 indirect_parameters_index,
15441535 } ,
15451536 ) ;
15461537 batch = Some ( BinnedRenderPhaseBatch {
1547- representative_entity : ( Entity :: PLACEHOLDER , * main_entity) ,
1538+ representative_entity : ( Entity :: PLACEHOLDER , main_entity) ,
15481539 instance_range : output_index..output_index + 1 ,
15491540 extra_index : PhaseItemExtraIndex :: IndirectParametersIndex {
15501541 range : indirect_parameters_index..( indirect_parameters_index + 1 ) ,
@@ -1558,13 +1549,13 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
15581549 work_item_buffer. push (
15591550 key. 0 . indexed ( ) ,
15601551 PreprocessWorkItem {
1561- input_index : input_index. into ( ) ,
1552+ input_index : * input_index,
15621553 output_index,
15631554 indirect_parameters_index : 0 ,
15641555 } ,
15651556 ) ;
15661557 batch = Some ( BinnedRenderPhaseBatch {
1567- representative_entity : ( Entity :: PLACEHOLDER , * main_entity) ,
1558+ representative_entity : ( Entity :: PLACEHOLDER , main_entity) ,
15681559 instance_range : output_index..output_index + 1 ,
15691560 extra_index : PhaseItemExtraIndex :: None ,
15701561 } ) ;
@@ -1627,7 +1618,7 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
16271618 // We're in indirect mode, so add an indirect parameters
16281619 // index.
16291620 GFBD :: write_batch_indirect_parameters_metadata (
1630- input_index. into ( ) ,
1621+ InputUniformIndex ( input_index. into ( ) ) ,
16311622 key. 0 . indexed ( ) ,
16321623 output_index,
16331624 None ,
0 commit comments