debugger.rs (1937B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 use crate::{DebugFlags, PictureRect, DeviceRect, RenderCommandInfo}; 6 use crate::image::ImageFormat; 7 8 // Shared type definitions between the WR crate and the debugger 9 10 #[derive(Serialize, Deserialize, Debug, Clone, Copy, Eq, Hash, PartialEq)] 11 pub struct ProfileCounterId(pub usize); 12 13 #[derive(Serialize, Deserialize, Debug, Clone)] 14 pub struct ProfileCounterDescriptor { 15 pub id: ProfileCounterId, 16 pub name: String, 17 } 18 19 #[derive(Serialize, Deserialize, Debug, Clone)] 20 pub struct ProfileCounterUpdate { 21 pub id: ProfileCounterId, 22 pub value: f64, 23 } 24 25 #[derive(Serialize, Deserialize)] 26 pub struct SetDebugFlagsMessage { 27 pub flags: DebugFlags, 28 } 29 30 #[derive(Serialize, Deserialize)] 31 pub struct InitProfileCountersMessage { 32 pub counters: Vec<ProfileCounterDescriptor>, 33 } 34 35 #[derive(Serialize, Deserialize)] 36 pub struct FrameLogMessage { 37 pub profile_counters: Option<Vec<ProfileCounterUpdate>>, 38 pub render_commands: Option<Vec<RenderCommandInfo>>, 39 } 40 41 #[derive(Serialize, Deserialize)] 42 pub enum DebuggerMessage { 43 SetDebugFlags(SetDebugFlagsMessage), 44 InitProfileCounters(InitProfileCountersMessage), 45 UpdateFrameLog(FrameLogMessage), 46 } 47 48 #[derive(Serialize, Deserialize)] 49 pub struct CompositorDebugTile { 50 pub local_rect: PictureRect, 51 pub device_rect: DeviceRect, 52 pub clip_rect: DeviceRect, 53 pub z_id: i32, 54 } 55 56 #[derive(Serialize, Deserialize)] 57 pub struct CompositorDebugInfo { 58 pub enabled_z_layers: u64, 59 pub tiles: Vec<CompositorDebugTile>, 60 } 61 62 #[derive(Debug, Serialize, Deserialize)] 63 pub struct DebuggerTextureContent { 64 pub name: String, 65 pub category: crate::TextureCacheCategory, 66 pub width: u32, 67 pub height: u32, 68 pub format: ImageFormat, 69 pub data: Vec<u8>, 70 }