(&mut self)
| 624 | pub shader_variant_mode: crate::ShaderVariantMode, |
| 625 | pub shadow_quality: crate::ShadowQuality, |
| 626 | } |
| 627 | |
| 628 | struct GpuCameraStreamTarget { |
| 629 | texture: wgpu::Texture, |
| 630 | post_input: Option<wgpu::Texture>, |
| 631 | tonemap_input: Option<wgpu::Texture>, |
| 632 | depth: Option<wgpu::Texture>, |
| 633 | resolution: [u32; 2], |
| 634 | post_view_key: u64, |
| 635 | } |
| 636 | |
| 637 | struct CameraStreamContentRevision { |
| 638 | draws: Arc<[CameraStreamDraw3DState]>, |
| 639 | draw_revision: u64, |
| 640 | sprites: Arc<[Sprite2DCommand]>, |
| 641 | sprite_revision: u64, |
| 642 | } |
| 643 | |
| 644 | fn update_camera_stream_content_revisions( |
| 645 | revisions: &mut AHashMap<NodeID, CameraStreamContentRevision>, |
| 646 | next_revision: &mut u64, |
| 647 | node: NodeID, |
| 648 | draws: &Arc<[CameraStreamDraw3DState]>, |
| 649 | sprites: &Arc<[Sprite2DCommand]>, |
| 650 | ) -> (u64, u64) { |
| 651 | match revisions.entry(node) { |
| 652 | std::collections::hash_map::Entry::Occupied(mut entry) => { |
| 653 | let state = entry.get_mut(); |
| 654 | // ptr_eq fast path: no upsert since last render leaves the same |
| 655 | // Arc in the retained state, so skip the elementwise compare. On |
| 656 | // equal content in a fresh allocation (no-op upsert), converge to |
| 657 | // the new Arc so later frames hit the pointer check again. |
| 658 | if !Arc::ptr_eq(&state.draws, draws) { |
| 659 | if state.draws.as_ref() != draws.as_ref() { |
| 660 | *next_revision = next_nonzero_generation(*next_revision); |
| 661 | state.draw_revision = *next_revision; |
| 662 | } |
| 663 | state.draws = draws.clone(); |
| 664 | } |
| 665 | if !Arc::ptr_eq(&state.sprites, sprites) { |
| 666 | if state.sprites.as_ref() != sprites.as_ref() { |
| 667 | *next_revision = next_nonzero_generation(*next_revision); |
| 668 | state.sprite_revision = *next_revision; |
| 669 | } |
| 670 | state.sprites = sprites.clone(); |
| 671 | } |
| 672 | (state.draw_revision, state.sprite_revision) |
| 673 | } |
| 674 | std::collections::hash_map::Entry::Vacant(entry) => { |
| 675 | *next_revision = next_nonzero_generation(*next_revision); |
| 676 | let draw_revision = *next_revision; |
| 677 | *next_revision = next_nonzero_generation(*next_revision); |
| 678 | let sprite_revision = *next_revision; |
| 679 | entry.insert(CameraStreamContentRevision { |
no test coverage detected