@@ -20,8 +20,7 @@ use tracing::warn;
20
20
21
21
use super :: {
22
22
ClusterConfig , ClusterFarZMode , ClusteredDecal , Clusters , GlobalClusterSettings ,
23
- GlobalVisibleClusterableObjects , ViewClusterBindings , VisibleClusterableObjects ,
24
- MAX_UNIFORM_BUFFER_CLUSTERABLE_OBJECTS ,
23
+ GlobalVisibleClusterableObjects , VisibleClusterableObjects ,
25
24
} ;
26
25
use crate :: {
27
26
prelude:: EnvironmentMapLight , ExtractedPointLight , LightProbe , PointLight , SpotLight ,
@@ -263,7 +262,7 @@ pub(crate) fn assign_objects_to_clusters(
263
262
} ) ) ;
264
263
}
265
264
266
- if clusterable_objects. len ( ) > MAX_UNIFORM_BUFFER_CLUSTERABLE_OBJECTS
265
+ if clusterable_objects. len ( ) > global_cluster_settings . max_uniform_buffer_clusterable_objects
267
266
&& !global_cluster_settings. supports_storage_buffers
268
267
{
269
268
clusterable_objects. sort_by_cached_key ( |clusterable_object| {
@@ -282,7 +281,9 @@ pub(crate) fn assign_objects_to_clusters(
282
281
let mut clusterable_objects_in_view_count = 0 ;
283
282
clusterable_objects. retain ( |clusterable_object| {
284
283
// take one extra clusterable object to check if we should emit the warning
285
- if clusterable_objects_in_view_count == MAX_UNIFORM_BUFFER_CLUSTERABLE_OBJECTS + 1 {
284
+ if clusterable_objects_in_view_count
285
+ == global_cluster_settings. max_uniform_buffer_clusterable_objects + 1
286
+ {
286
287
false
287
288
} else {
288
289
let clusterable_object_sphere = clusterable_object. sphere ( ) ;
@@ -298,17 +299,19 @@ pub(crate) fn assign_objects_to_clusters(
298
299
}
299
300
} ) ;
300
301
301
- if clusterable_objects. len ( ) > MAX_UNIFORM_BUFFER_CLUSTERABLE_OBJECTS
302
+ if clusterable_objects. len ( )
303
+ > global_cluster_settings. max_uniform_buffer_clusterable_objects
302
304
&& !* max_clusterable_objects_warning_emitted
303
305
{
304
306
warn ! (
305
- "MAX_UNIFORM_BUFFER_CLUSTERABLE_OBJECTS ({}) exceeded" ,
306
- MAX_UNIFORM_BUFFER_CLUSTERABLE_OBJECTS
307
+ "max_uniform_buffer_clusterable_objects ({}) exceeded" ,
308
+ global_cluster_settings . max_uniform_buffer_clusterable_objects
307
309
) ;
308
310
* max_clusterable_objects_warning_emitted = true ;
309
311
}
310
312
311
- clusterable_objects. truncate ( MAX_UNIFORM_BUFFER_CLUSTERABLE_OBJECTS ) ;
313
+ clusterable_objects
314
+ . truncate ( global_cluster_settings. max_uniform_buffer_clusterable_objects ) ;
312
315
}
313
316
314
317
for (
@@ -448,14 +451,17 @@ pub(crate) fn assign_objects_to_clusters(
448
451
( xy_count. x + x_overlap) * ( xy_count. y + y_overlap) * z_count as f32 ;
449
452
}
450
453
451
- if cluster_index_estimate > ViewClusterBindings :: MAX_INDICES as f32 {
454
+ if cluster_index_estimate
455
+ > global_cluster_settings. view_cluster_bindings_max_indices as f32
456
+ {
452
457
// scale x and y cluster count to be able to fit all our indices
453
458
454
459
// we take the ratio of the actual indices over the index estimate.
455
460
// this is not guaranteed to be small enough due to overlapped tiles, but
456
461
// the conservative estimate is more than sufficient to cover the
457
462
// difference
458
- let index_ratio = ViewClusterBindings :: MAX_INDICES as f32 / cluster_index_estimate;
463
+ let index_ratio = global_cluster_settings. view_cluster_bindings_max_indices as f32
464
+ / cluster_index_estimate;
459
465
let xy_ratio = index_ratio. sqrt ( ) ;
460
466
461
467
requested_cluster_dimensions. x =
0 commit comments