(&mut self, width: u32, height: u32, logical_width: u32, logical_height: u32)
| 6332 | } |
| 6333 | |
| 6334 | pub fn resize(&mut self, width: u32, height: u32, logical_width: u32, logical_height: u32) { |
| 6335 | if width > 0 && height > 0 { |
| 6336 | // Cascade fit depends on the projection aspect ratio, so a |
| 6337 | // resize can shift the VPs even with the camera stationary. |
| 6338 | // Force a re-render next frame. |
| 6339 | self.shadow_map.invalidate(); |
| 6340 | self.surface_config.width = width; |
| 6341 | self.surface_config.height = height; |
| 6342 | self.logical_width = logical_width.max(1); |
| 6343 | self.logical_height = logical_height.max(1); |
| 6344 | self.surface.configure(&self.device, &self.surface_config); |
| 6345 | |
| 6346 | // Render-resolution RTs (G-buffer + composed), sized to |
| 6347 | // `surface * render_scale`. TAA (or the upscale pass) |
| 6348 | // brings the composed_rt back to full surface; the rest |
| 6349 | // of the post-FX chain (DoF/MB/SSS) and composite stay |
| 6350 | // at full surface. |
| 6351 | let (rw, rh) = self.render_extent(); |
| 6352 | |
| 6353 | let (dt, dv) = create_depth_texture(&self.device, rw, rh); |
| 6354 | self.depth_texture = dt; |
| 6355 | self.depth_view = dv; |
| 6356 | let (hdr_t, hdr_v) = create_hdr_rt(&self.device, rw, rh); |
| 6357 | self.hdr_rt_texture = hdr_t; |
| 6358 | self.hdr_rt_view = hdr_v; |
| 6359 | let (mat_t, mat_v) = create_material_rt(&self.device, rw, rh); |
| 6360 | self.material_rt_texture = mat_t; |
| 6361 | self.material_rt_view = mat_v; |
| 6362 | let (alb_t, alb_v) = create_albedo_rt(&self.device, rw, rh); |
| 6363 | let (cmp_t, cmp_v) = create_composed_rt(&self.device, rw, rh); |
| 6364 | self.composed_rt_texture = cmp_t; |
| 6365 | self.composed_rt_view = cmp_v; |
| 6366 | self.albedo_rt_texture = alb_t; |
| 6367 | self.albedo_rt_view = alb_v; |
| 6368 | let (bt, bm, bf) = create_bloom_chain(&self.device, width, height, BLOOM_MIP_COUNT); |
| 6369 | self.bloom_chain_textures = bt; |
| 6370 | self.bloom_mip_views = bm; |
| 6371 | self.bloom_full_view = bf; |
| 6372 | let (st, sv) = create_ssao_rt(&self.device, width, height); |
| 6373 | self.ssao_rt_texture = st; |
| 6374 | self.ssao_rt_view = sv; |
| 6375 | let (sht, shv) = create_ssao_history_textures(&self.device, width, height); |
| 6376 | self.ssao_history_textures = sht; |
| 6377 | self.ssao_history_views = shv; |
| 6378 | self.ssao_history_idx = 0; |
| 6379 | self.ssao_history_frame = 0; |
| 6380 | let (sbt, sbv) = create_ssao_blur_rt(&self.device, width, height); |
| 6381 | self.ssao_blur_rt_texture = sbt; |
| 6382 | self.ssao_blur_rt_view = sbv; |
| 6383 | let (hiz_t, hiz_v) = create_linear_depth_hiz_chain(&self.device, width, height); |
| 6384 | self.hiz_textures = hiz_t; |
| 6385 | self.hiz_views = hiz_v; |
| 6386 | let (taa_t, taa_v) = create_taa_textures(&self.device, width, height); |
| 6387 | self.taa_textures = taa_t; |
| 6388 | self.taa_views = taa_v; |
| 6389 | self.taa_frame_index = 0; // reset jitter sequence on resize |
| 6390 | let (sr_t, sr_v) = create_ssr_rt(&self.device, width, height); |
| 6391 | self.ssr_rt_texture = sr_t; |
no test coverage detected