@@ -977,18 +977,10 @@ impl<T: RenderTarget> RenderTargetList<T> {
977
977
gpu_cache : & mut GpuCache ,
978
978
render_tasks : & mut RenderTaskTree ,
979
979
deferred_resolves : & mut Vec < DeferredResolve > ,
980
- ) -> DeviceUintSize {
981
- let mut max_used_size = DeviceUintSize :: zero ( ) ;
982
-
980
+ ) {
983
981
for target in & mut self . targets {
984
- let used_rect = target. used_rect ( ) ;
985
- max_used_size. width = cmp:: max ( max_used_size. width , used_rect. size . width as u32 ) ;
986
- max_used_size. height = cmp:: max ( max_used_size. height , used_rect. size . height as u32 ) ;
987
-
988
982
target. build ( ctx, gpu_cache, render_tasks, deferred_resolves) ;
989
983
}
990
-
991
- max_used_size
992
984
}
993
985
994
986
fn add_task (
@@ -1084,7 +1076,8 @@ impl RenderTarget for ColorRenderTarget {
1084
1076
fn used_rect ( & self ) -> DeviceIntRect {
1085
1077
self . allocator
1086
1078
. as_ref ( )
1087
- . map_or ( DeviceIntRect :: zero ( ) , |allocator| allocator. used_rect )
1079
+ . expect ( "bug: used_rect called on framebuffer" )
1080
+ . used_rect
1088
1081
}
1089
1082
1090
1083
fn build (
@@ -1309,10 +1302,8 @@ pub struct RenderPass {
1309
1302
pub color_texture : Option < Texture > ,
1310
1303
pub alpha_texture : Option < Texture > ,
1311
1304
dynamic_tasks : FastHashMap < RenderTaskKey , DynamicTaskInfo > ,
1312
- pub color_allocator_size : DeviceUintSize ,
1313
- pub alpha_allocator_size : DeviceUintSize ,
1314
- pub max_used_color_target_size : DeviceUintSize ,
1315
- pub max_used_alpha_target_size : DeviceUintSize ,
1305
+ pub max_color_target_size : DeviceUintSize ,
1306
+ pub max_alpha_target_size : DeviceUintSize ,
1316
1307
}
1317
1308
1318
1309
impl RenderPass {
@@ -1325,10 +1316,8 @@ impl RenderPass {
1325
1316
color_texture : None ,
1326
1317
alpha_texture : None ,
1327
1318
dynamic_tasks : FastHashMap :: default ( ) ,
1328
- color_allocator_size : DeviceUintSize :: new ( MIN_TARGET_SIZE , MIN_TARGET_SIZE ) ,
1329
- alpha_allocator_size : DeviceUintSize :: new ( MIN_TARGET_SIZE , MIN_TARGET_SIZE ) ,
1330
- max_used_color_target_size : DeviceUintSize :: zero ( ) ,
1331
- max_used_alpha_target_size : DeviceUintSize :: zero ( ) ,
1319
+ max_color_target_size : DeviceUintSize :: new ( MIN_TARGET_SIZE , MIN_TARGET_SIZE ) ,
1320
+ max_alpha_target_size : DeviceUintSize :: new ( MIN_TARGET_SIZE , MIN_TARGET_SIZE ) ,
1332
1321
}
1333
1322
}
1334
1323
@@ -1340,16 +1329,16 @@ impl RenderPass {
1340
1329
) {
1341
1330
match target_kind {
1342
1331
RenderTargetKind :: Color => {
1343
- self . color_allocator_size . width =
1344
- cmp:: max ( self . color_allocator_size . width , size. width as u32 ) ;
1345
- self . color_allocator_size . height =
1346
- cmp:: max ( self . color_allocator_size . height , size. height as u32 ) ;
1332
+ self . max_color_target_size . width =
1333
+ cmp:: max ( self . max_color_target_size . width , size. width as u32 ) ;
1334
+ self . max_color_target_size . height =
1335
+ cmp:: max ( self . max_color_target_size . height , size. height as u32 ) ;
1347
1336
}
1348
1337
RenderTargetKind :: Alpha => {
1349
- self . alpha_allocator_size . width =
1350
- cmp:: max ( self . alpha_allocator_size . width , size. width as u32 ) ;
1351
- self . alpha_allocator_size . height =
1352
- cmp:: max ( self . alpha_allocator_size . height , size. height as u32 ) ;
1338
+ self . max_alpha_target_size . width =
1339
+ cmp:: max ( self . max_alpha_target_size . width , size. width as u32 ) ;
1340
+ self . max_alpha_target_size . height =
1341
+ cmp:: max ( self . max_alpha_target_size . height , size. height as u32 ) ;
1353
1342
}
1354
1343
}
1355
1344
@@ -1407,9 +1396,9 @@ impl RenderPass {
1407
1396
let alloc_size = DeviceUintSize :: new ( size. width as u32 , size. height as u32 ) ;
1408
1397
let ( alloc_origin, target_index) = match target_kind {
1409
1398
RenderTargetKind :: Color => self . color_targets
1410
- . allocate ( alloc_size, self . color_allocator_size ) ,
1399
+ . allocate ( alloc_size, self . max_color_target_size ) ,
1411
1400
RenderTargetKind :: Alpha => self . alpha_targets
1412
- . allocate ( alloc_size, self . alpha_allocator_size ) ,
1401
+ . allocate ( alloc_size, self . max_alpha_target_size ) ,
1413
1402
} ;
1414
1403
1415
1404
let origin = Some ( (
@@ -1457,9 +1446,9 @@ impl RenderPass {
1457
1446
}
1458
1447
}
1459
1448
1460
- self . max_used_color_target_size = self . color_targets
1449
+ self . color_targets
1461
1450
. build ( ctx, gpu_cache, render_tasks, deferred_resolves) ;
1462
- self . max_used_alpha_target_size = self . alpha_targets
1451
+ self . alpha_targets
1463
1452
. build ( ctx, gpu_cache, render_tasks, deferred_resolves) ;
1464
1453
}
1465
1454
}
0 commit comments