зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1515654 - Update webrender to commit 6bdd0d26afe3fc5a24f10c19d4ca8569d0182a37 (WR PR #3440). r=kats
https://github.com/servo/webrender/pull/3440 Differential Revision: https://phabricator.services.mozilla.com/D15224 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2ec2bac2eb
Коммит
abec9d5cf6
|
@ -1 +1 @@
|
|||
57379d1fec269ea70cbab28d4353614fd9c58122
|
||||
6bdd0d26afe3fc5a24f10c19d4ca8569d0182a37
|
||||
|
|
|
@ -11,6 +11,7 @@ use std::env;
|
|||
use std::path::PathBuf;
|
||||
use webrender;
|
||||
use winit;
|
||||
use webrender::DebugFlags;
|
||||
use webrender::ShaderPrecacheFlags;
|
||||
use webrender::api::*;
|
||||
|
||||
|
@ -147,13 +148,14 @@ pub fn main_wrapper<E: Example>(
|
|||
println!("Device pixel ratio: {}", device_pixel_ratio);
|
||||
|
||||
println!("Loading shaders...");
|
||||
let mut debug_flags = DebugFlags::ECHO_DRIVER_MESSAGES | DebugFlags::TEXTURE_CACHE_DBG;
|
||||
let opts = webrender::RendererOptions {
|
||||
resource_override_path: res_path,
|
||||
precache_flags: E::PRECACHE_SHADER_FLAGS,
|
||||
device_pixel_ratio,
|
||||
clear_color: Some(ColorF::new(0.3, 0.0, 0.0, 1.0)),
|
||||
//scatter_gpu_cache_updates: false,
|
||||
debug_flags: webrender::DebugFlags::ECHO_DRIVER_MESSAGES,
|
||||
debug_flags,
|
||||
..options.unwrap_or(webrender::RendererOptions::default())
|
||||
};
|
||||
|
||||
|
@ -179,8 +181,6 @@ pub fn main_wrapper<E: Example>(
|
|||
renderer.set_external_image_handler(external_image_handler);
|
||||
}
|
||||
|
||||
renderer.toggle_debug_flags(webrender::DebugFlags::TEXTURE_CACHE_DBG);
|
||||
|
||||
let epoch = Epoch(0);
|
||||
let pipeline_id = PipelineId(0, 0);
|
||||
let layout_size = framebuffer_size.to_f32() / euclid::TypedScale::new(device_pixel_ratio);
|
||||
|
@ -211,6 +211,7 @@ pub fn main_wrapper<E: Example>(
|
|||
let mut txn = Transaction::new();
|
||||
let mut custom_event = true;
|
||||
|
||||
let old_flags = debug_flags;
|
||||
match global_event {
|
||||
winit::Event::WindowEvent {
|
||||
event: winit::WindowEvent::CloseRequested,
|
||||
|
@ -228,22 +229,17 @@ pub fn main_wrapper<E: Example>(
|
|||
..
|
||||
} => match key {
|
||||
winit::VirtualKeyCode::Escape => return winit::ControlFlow::Break,
|
||||
winit::VirtualKeyCode::P => renderer.toggle_debug_flags(webrender::DebugFlags::PROFILER_DBG),
|
||||
winit::VirtualKeyCode::O => renderer.toggle_debug_flags(webrender::DebugFlags::RENDER_TARGET_DBG),
|
||||
winit::VirtualKeyCode::I => renderer.toggle_debug_flags(webrender::DebugFlags::TEXTURE_CACHE_DBG),
|
||||
winit::VirtualKeyCode::S => renderer.toggle_debug_flags(webrender::DebugFlags::COMPACT_PROFILER),
|
||||
winit::VirtualKeyCode::Q => renderer.toggle_debug_flags(
|
||||
webrender::DebugFlags::GPU_TIME_QUERIES | webrender::DebugFlags::GPU_SAMPLE_QUERIES
|
||||
winit::VirtualKeyCode::P => debug_flags.toggle(DebugFlags::PROFILER_DBG),
|
||||
winit::VirtualKeyCode::O => debug_flags.toggle(DebugFlags::RENDER_TARGET_DBG),
|
||||
winit::VirtualKeyCode::I => debug_flags.toggle(DebugFlags::TEXTURE_CACHE_DBG),
|
||||
winit::VirtualKeyCode::S => debug_flags.toggle(DebugFlags::COMPACT_PROFILER),
|
||||
winit::VirtualKeyCode::Q => debug_flags.toggle(
|
||||
DebugFlags::GPU_TIME_QUERIES | DebugFlags::GPU_SAMPLE_QUERIES
|
||||
),
|
||||
winit::VirtualKeyCode::F => renderer.toggle_debug_flags(
|
||||
webrender::DebugFlags::NEW_FRAME_INDICATOR | webrender::DebugFlags::NEW_SCENE_INDICATOR
|
||||
),
|
||||
winit::VirtualKeyCode::G => api.send_debug_cmd(
|
||||
// go through the API so that we reach the render backend
|
||||
DebugCommand::EnableGpuCacheDebug(
|
||||
!renderer.get_debug_flags().contains(webrender::DebugFlags::GPU_CACHE_DBG)
|
||||
),
|
||||
winit::VirtualKeyCode::F => debug_flags.toggle(
|
||||
DebugFlags::NEW_FRAME_INDICATOR | DebugFlags::NEW_SCENE_INDICATOR
|
||||
),
|
||||
winit::VirtualKeyCode::G => debug_flags.toggle(DebugFlags::GPU_CACHE_DBG),
|
||||
winit::VirtualKeyCode::Key1 => txn.set_window_parameters(
|
||||
framebuffer_size,
|
||||
DeviceIntRect::new(DeviceIntPoint::zero(), framebuffer_size),
|
||||
|
@ -282,6 +278,10 @@ pub fn main_wrapper<E: Example>(
|
|||
_ => return winit::ControlFlow::Continue,
|
||||
};
|
||||
|
||||
if debug_flags != old_flags {
|
||||
api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
}
|
||||
|
||||
if custom_event {
|
||||
let mut builder = DisplayListBuilder::new(pipeline_id, layout_size);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use glutin::GlContext;
|
|||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use webrender::api::*;
|
||||
use webrender::DebugFlags;
|
||||
use winit::dpi::LogicalSize;
|
||||
|
||||
struct Notifier {
|
||||
|
@ -142,6 +143,7 @@ impl Window {
|
|||
let mut do_exit = false;
|
||||
let my_name = &self.name;
|
||||
let renderer = &mut self.renderer;
|
||||
let api = &mut self.api;
|
||||
|
||||
self.events_loop.poll_events(|global_event| match global_event {
|
||||
winit::Event::WindowEvent { event, .. } => match event {
|
||||
|
@ -163,8 +165,8 @@ impl Window {
|
|||
},
|
||||
..
|
||||
} => {
|
||||
println!("toggle flags {}", my_name);
|
||||
renderer.toggle_debug_flags(webrender::DebugFlags::PROFILER_DBG);
|
||||
println!("set flags {}", my_name);
|
||||
api.send_debug_cmd(DebugCommand::SetFlags(DebugFlags::PROFILER_DBG))
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -278,7 +280,7 @@ impl Window {
|
|||
);
|
||||
txn.set_root_pipeline(self.pipeline_id);
|
||||
txn.generate_frame();
|
||||
self.api.send_transaction(self.document_id, txn);
|
||||
api.send_transaction(self.document_id, txn);
|
||||
|
||||
renderer.update();
|
||||
renderer.render(framebuffer_size).unwrap();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use api::{ApiMsg, DebugCommand, DeviceIntSize};
|
||||
use api::{ApiMsg, DebugCommand, DebugFlags, DeviceIntSize};
|
||||
use api::channel::MsgSender;
|
||||
use print_tree::PrintTreePrinter;
|
||||
use std::sync::mpsc::{channel, Receiver};
|
||||
|
@ -26,6 +26,7 @@ struct Server {
|
|||
ws: ws::Sender,
|
||||
debug_tx: Sender<DebugMsg>,
|
||||
api_tx: MsgSender<ApiMsg>,
|
||||
debug_flags: DebugFlags,
|
||||
}
|
||||
|
||||
impl ws::Handler for Server {
|
||||
|
@ -46,25 +47,35 @@ impl ws::Handler for Server {
|
|||
fn on_message(&mut self, msg: ws::Message) -> ws::Result<()> {
|
||||
match msg {
|
||||
ws::Message::Text(string) => {
|
||||
let cmd = match string.as_str() {
|
||||
"enable_profiler" => DebugCommand::EnableProfiler(true),
|
||||
"disable_profiler" => DebugCommand::EnableProfiler(false),
|
||||
"enable_texture_cache_debug" => DebugCommand::EnableTextureCacheDebug(true),
|
||||
"disable_texture_cache_debug" => DebugCommand::EnableTextureCacheDebug(false),
|
||||
"enable_render_target_debug" => DebugCommand::EnableRenderTargetDebug(true),
|
||||
"disable_render_target_debug" => DebugCommand::EnableRenderTargetDebug(false),
|
||||
"enable_gpu_time_queries" => DebugCommand::EnableGpuTimeQueries(true),
|
||||
"disable_gpu_time_queries" => DebugCommand::EnableGpuTimeQueries(false),
|
||||
"enable_gpu_sample_queries" => DebugCommand::EnableGpuSampleQueries(true),
|
||||
"disable_gpu_sample_queries" => DebugCommand::EnableGpuSampleQueries(false),
|
||||
"fetch_passes" => DebugCommand::FetchPasses,
|
||||
"fetch_screenshot" => DebugCommand::FetchScreenshot,
|
||||
"fetch_documents" => DebugCommand::FetchDocuments,
|
||||
"fetch_clip_scroll_tree" => DebugCommand::FetchClipScrollTree,
|
||||
"fetch_render_tasks" => DebugCommand::FetchRenderTasks,
|
||||
msg => {
|
||||
error!("unknown msg {}", msg);
|
||||
return Ok(());
|
||||
// First, check for flag change commands.
|
||||
let mut set_flags = true;
|
||||
match string.as_str() {
|
||||
"enable_profiler" => self.debug_flags.insert(DebugFlags::PROFILER_DBG),
|
||||
"disable_profiler" => self.debug_flags.remove(DebugFlags::PROFILER_DBG),
|
||||
"enable_texture_cache_debug" => self.debug_flags.insert(DebugFlags::TEXTURE_CACHE_DBG),
|
||||
"disable_texture_cache_debug" => self.debug_flags.remove(DebugFlags::TEXTURE_CACHE_DBG),
|
||||
"enable_render_target_debug" => self.debug_flags.insert(DebugFlags::RENDER_TARGET_DBG),
|
||||
"disable_render_target_debug" => self.debug_flags.remove(DebugFlags::RENDER_TARGET_DBG),
|
||||
"enable_gpu_time_queries" => self.debug_flags.insert(DebugFlags::GPU_TIME_QUERIES),
|
||||
"disable_gpu_time_queries" => self.debug_flags.remove(DebugFlags::GPU_TIME_QUERIES),
|
||||
"enable_gpu_sample_queries" => self.debug_flags.insert(DebugFlags::GPU_SAMPLE_QUERIES),
|
||||
"disable_gpu_sample_queries" => self.debug_flags.remove(DebugFlags::GPU_SAMPLE_QUERIES),
|
||||
_ => set_flags = false,
|
||||
};
|
||||
|
||||
let cmd = if set_flags {
|
||||
DebugCommand::SetFlags(self.debug_flags)
|
||||
} else {
|
||||
match string.as_str() {
|
||||
"fetch_passes" => DebugCommand::FetchPasses,
|
||||
"fetch_screenshot" => DebugCommand::FetchScreenshot,
|
||||
"fetch_documents" => DebugCommand::FetchDocuments,
|
||||
"fetch_clip_scroll_tree" => DebugCommand::FetchClipScrollTree,
|
||||
"fetch_render_tasks" => DebugCommand::FetchRenderTasks,
|
||||
msg => {
|
||||
error!("unknown msg {}", msg);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -97,6 +108,7 @@ impl DebugServer {
|
|||
ws: out,
|
||||
debug_tx: debug_tx.clone(),
|
||||
api_tx: api_tx.clone(),
|
||||
debug_flags: DebugFlags::empty(),
|
||||
}
|
||||
})
|
||||
.unwrap();
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
//! address in the GPU cache of a given resource slot
|
||||
//! for this frame.
|
||||
|
||||
use api::{PremultipliedColorF, TexelRect};
|
||||
use api::{DebugFlags, PremultipliedColorF, TexelRect};
|
||||
use api::{VoidPtrToSizeFn};
|
||||
use euclid::TypedRect;
|
||||
use profiler::GpuCacheProfileCounters;
|
||||
|
@ -234,7 +234,6 @@ pub enum GpuCacheUpdate {
|
|||
|
||||
pub struct GpuDebugChunk {
|
||||
pub address: GpuCacheAddress,
|
||||
pub fresh: bool,
|
||||
pub tag: u8,
|
||||
pub size: u16,
|
||||
}
|
||||
|
@ -541,9 +540,8 @@ pub struct GpuCache {
|
|||
/// Number of blocks requested this frame that don't
|
||||
/// need to be re-uploaded.
|
||||
saved_block_count: usize,
|
||||
/// True if the Renderer expects to receive the metadata
|
||||
/// about GPU blocks with on each update.
|
||||
in_debug: bool,
|
||||
/// The current debug flags for the system.
|
||||
debug_flags: DebugFlags,
|
||||
}
|
||||
|
||||
impl GpuCache {
|
||||
|
@ -552,7 +550,7 @@ impl GpuCache {
|
|||
frame_id: FrameId::INVALID,
|
||||
texture: Texture::new(),
|
||||
saved_block_count: 0,
|
||||
in_debug: false,
|
||||
debug_flags: DebugFlags::empty(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -653,13 +651,12 @@ impl GpuCache {
|
|||
GpuCacheUpdateList {
|
||||
frame_id: self.frame_id,
|
||||
height: self.texture.height,
|
||||
debug_chunks: if self.in_debug {
|
||||
debug_chunks: if self.debug_flags.contains(DebugFlags::GPU_CACHE_DBG) {
|
||||
self.texture.updates
|
||||
.iter()
|
||||
.map(|update| match *update {
|
||||
GpuCacheUpdate::Copy { address, block_index, block_count } => GpuDebugChunk {
|
||||
GpuCacheUpdate::Copy { address, block_index: _, block_count } => GpuDebugChunk {
|
||||
address,
|
||||
fresh: self.frame_id == self.texture.blocks[block_index].last_access_time,
|
||||
tag: 0, //TODO
|
||||
size: block_count.min(0xFFFF) as u16,
|
||||
}
|
||||
|
@ -673,9 +670,9 @@ impl GpuCache {
|
|||
}
|
||||
}
|
||||
|
||||
/// Enable GPU block debugging.
|
||||
pub fn set_debug(&mut self, enable: bool) {
|
||||
self.in_debug = enable;
|
||||
/// Sets the current debug flags for the system.
|
||||
pub fn set_debug_flags(&mut self, flags: DebugFlags) {
|
||||
self.debug_flags = flags;
|
||||
}
|
||||
|
||||
/// Get the actual GPU address in the texture for a given slot ID.
|
||||
|
|
|
@ -17,7 +17,7 @@ use api::{IdNamespace, LayoutPoint, PipelineId, RenderNotifier, SceneMsg, Scroll
|
|||
use api::{MemoryReport, VoidPtrToSizeFn};
|
||||
use api::{ScrollLocation, ScrollNodeState, TransactionMsg, ResourceUpdate, BlobImageKey};
|
||||
use api::{NotificationRequest, Checkpoint};
|
||||
use api::channel::{MsgReceiver, Payload};
|
||||
use api::channel::{MsgReceiver, MsgSender, Payload};
|
||||
#[cfg(feature = "capture")]
|
||||
use api::CaptureBits;
|
||||
#[cfg(feature = "replay")]
|
||||
|
@ -1031,10 +1031,6 @@ impl RenderBackend {
|
|||
// We don't want to forward this message to the renderer.
|
||||
return true;
|
||||
}
|
||||
DebugCommand::EnableGpuCacheDebug(enable) => {
|
||||
self.gpu_cache.set_debug(enable);
|
||||
ResultMsg::DebugCommand(option)
|
||||
}
|
||||
DebugCommand::FetchDocuments => {
|
||||
let json = self.get_docs_for_debugger();
|
||||
ResultMsg::DebugOutput(DebugOutput::FetchDocuments(json))
|
||||
|
@ -1107,6 +1103,7 @@ impl RenderBackend {
|
|||
}
|
||||
DebugCommand::SetFlags(flags) => {
|
||||
self.resource_cache.set_debug_flags(flags);
|
||||
self.gpu_cache.set_debug_flags(flags);
|
||||
ResultMsg::DebugCommand(option)
|
||||
}
|
||||
_ => ResultMsg::DebugCommand(option),
|
||||
|
@ -1502,7 +1499,7 @@ impl RenderBackend {
|
|||
serde_json::to_string(&debug_root).unwrap()
|
||||
}
|
||||
|
||||
fn report_memory(&self, tx: ::api::channel::MsgSender<MemoryReport>) {
|
||||
fn report_memory(&self, tx: MsgSender<MemoryReport>) {
|
||||
let mut report = MemoryReport::default();
|
||||
let op = self.size_of_op.unwrap();
|
||||
report.gpu_cache_metadata = self.gpu_cache.malloc_size_of(op);
|
||||
|
|
|
@ -2384,33 +2384,6 @@ impl Renderer {
|
|||
|
||||
fn handle_debug_command(&mut self, command: DebugCommand) {
|
||||
match command {
|
||||
DebugCommand::EnableProfiler(enable) => {
|
||||
self.set_debug_flag(DebugFlags::PROFILER_DBG, enable);
|
||||
}
|
||||
DebugCommand::EnableTextureCacheDebug(enable) => {
|
||||
self.set_debug_flag(DebugFlags::TEXTURE_CACHE_DBG, enable);
|
||||
}
|
||||
DebugCommand::EnableRenderTargetDebug(enable) => {
|
||||
self.set_debug_flag(DebugFlags::RENDER_TARGET_DBG, enable);
|
||||
}
|
||||
DebugCommand::EnableGpuCacheDebug(enable) => {
|
||||
self.set_debug_flag(DebugFlags::GPU_CACHE_DBG, enable);
|
||||
}
|
||||
DebugCommand::EnableGpuTimeQueries(enable) => {
|
||||
self.set_debug_flag(DebugFlags::GPU_TIME_QUERIES, enable);
|
||||
}
|
||||
DebugCommand::EnableGpuSampleQueries(enable) => {
|
||||
self.set_debug_flag(DebugFlags::GPU_SAMPLE_QUERIES, enable);
|
||||
}
|
||||
DebugCommand::EnableNewFrameIndicator(enable) => {
|
||||
self.set_debug_flag(DebugFlags::NEW_FRAME_INDICATOR, enable);
|
||||
}
|
||||
DebugCommand::EnableNewSceneIndicator(enable) => {
|
||||
self.set_debug_flag(DebugFlags::NEW_SCENE_INDICATOR, enable);
|
||||
}
|
||||
DebugCommand::EnableShowOverdraw(enable) => {
|
||||
self.set_debug_flag(DebugFlags::SHOW_OVERDRAW, enable);
|
||||
}
|
||||
DebugCommand::EnableDualSourceBlending(_) => {
|
||||
panic!("Should be handled by render backend");
|
||||
}
|
||||
|
@ -4257,18 +4230,6 @@ impl Renderer {
|
|||
self.debug_flags = flags;
|
||||
}
|
||||
|
||||
pub fn set_debug_flag(&mut self, flag: DebugFlags, enabled: bool) {
|
||||
let mut new_flags = self.debug_flags;
|
||||
new_flags.set(flag, enabled);
|
||||
self.set_debug_flags(new_flags);
|
||||
}
|
||||
|
||||
pub fn toggle_debug_flags(&mut self, toggle: DebugFlags) {
|
||||
let mut new_flags = self.debug_flags;
|
||||
new_flags.toggle(toggle);
|
||||
self.set_debug_flags(new_flags);
|
||||
}
|
||||
|
||||
pub fn save_cpu_profile(&self, filename: &str) {
|
||||
write_profile(filename);
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ pub enum SceneBuilderRequest {
|
|||
SimulateLongSceneBuild(u32),
|
||||
SimulateLongLowPrioritySceneBuild(u32),
|
||||
Stop,
|
||||
ReportMemory(MemoryReport, ::api::channel::MsgSender<MemoryReport>),
|
||||
ReportMemory(MemoryReport, MsgSender<MemoryReport>),
|
||||
#[cfg(feature = "capture")]
|
||||
SaveScene(CaptureConfig),
|
||||
#[cfg(feature = "replay")]
|
||||
|
|
|
@ -680,26 +680,10 @@ pub struct CapturedDocument {
|
|||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub enum DebugCommand {
|
||||
/// Display the frame profiler on screen.
|
||||
EnableProfiler(bool),
|
||||
/// Display all texture cache pages on screen.
|
||||
EnableTextureCacheDebug(bool),
|
||||
/// Display intermediate render targets on screen.
|
||||
EnableRenderTargetDebug(bool),
|
||||
/// Display the contents of GPU cache.
|
||||
EnableGpuCacheDebug(bool),
|
||||
/// Display GPU timing results.
|
||||
EnableGpuTimeQueries(bool),
|
||||
/// Display GPU overdraw results
|
||||
EnableGpuSampleQueries(bool),
|
||||
/// Sets the provided debug flags.
|
||||
SetFlags(DebugFlags),
|
||||
/// Configure if dual-source blending is used, if available.
|
||||
EnableDualSourceBlending(bool),
|
||||
/// Show an indicator that moves every time a frame is rendered.
|
||||
EnableNewFrameIndicator(bool),
|
||||
/// Show an indicator that moves every time a scene is built.
|
||||
EnableNewSceneIndicator(bool),
|
||||
/// Show an overlay displaying overdraw amount.
|
||||
EnableShowOverdraw(bool),
|
||||
/// Fetch current documents and display lists.
|
||||
FetchDocuments,
|
||||
/// Fetch current passes and batches.
|
||||
|
@ -724,9 +708,6 @@ pub enum DebugCommand {
|
|||
/// Causes the low priority scene builder to pause for a given amount of miliseconds
|
||||
/// each time it processes a transaction.
|
||||
SimulateLongLowPrioritySceneBuild(u32),
|
||||
/// Sets the provided debug flags. This may overlap with some of the functionality
|
||||
/// above.
|
||||
SetFlags(DebugFlags),
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
|
@ -980,18 +961,26 @@ impl RenderApiSender {
|
|||
bitflags! {
|
||||
#[derive(Default, Deserialize, Serialize)]
|
||||
pub struct DebugFlags: u32 {
|
||||
/// Display the frame profiler on screen.
|
||||
const PROFILER_DBG = 1 << 0;
|
||||
/// Display intermediate render targets on screen.
|
||||
const RENDER_TARGET_DBG = 1 << 1;
|
||||
/// Display all texture cache pages on screen.
|
||||
const TEXTURE_CACHE_DBG = 1 << 2;
|
||||
/// Display GPU timing results.
|
||||
const GPU_TIME_QUERIES = 1 << 3;
|
||||
const GPU_SAMPLE_QUERIES = 1 << 4;
|
||||
const DISABLE_BATCHING = 1 << 5;
|
||||
const EPOCHS = 1 << 6;
|
||||
const COMPACT_PROFILER = 1 << 7;
|
||||
const ECHO_DRIVER_MESSAGES = 1 << 8;
|
||||
/// Show an indicator that moves every time a frame is rendered.
|
||||
const NEW_FRAME_INDICATOR = 1 << 9;
|
||||
/// Show an indicator that moves every time a scene is built.
|
||||
const NEW_SCENE_INDICATOR = 1 << 10;
|
||||
/// Show an overlay displaying overdraw amount.
|
||||
const SHOW_OVERDRAW = 1 << 11;
|
||||
/// Display the contents of GPU cache.
|
||||
const GPU_CACHE_DBG = 1 << 12;
|
||||
const SLOW_FRAME_INDICATOR = 1 << 13;
|
||||
const TEXTURE_CACHE_DBG_CLEAR_EVICTED = 1 << 14;
|
||||
|
|
|
@ -565,6 +565,7 @@ fn render<'a>(
|
|||
wrench.update(dim);
|
||||
thing.do_frame(wrench);
|
||||
|
||||
let mut debug_flags = DebugFlags::empty();
|
||||
let mut body = |wrench: &mut Wrench, global_event: winit::Event| {
|
||||
let mut do_frame = false;
|
||||
let mut do_render = false;
|
||||
|
@ -597,36 +598,39 @@ fn render<'a>(
|
|||
return winit::ControlFlow::Break;
|
||||
}
|
||||
VirtualKeyCode::P => {
|
||||
wrench.renderer.toggle_debug_flags(DebugFlags::PROFILER_DBG);
|
||||
debug_flags.toggle(DebugFlags::PROFILER_DBG);
|
||||
wrench.api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
do_render = true;
|
||||
}
|
||||
VirtualKeyCode::O => {
|
||||
wrench.renderer.toggle_debug_flags(DebugFlags::RENDER_TARGET_DBG);
|
||||
debug_flags.toggle(DebugFlags::RENDER_TARGET_DBG);
|
||||
wrench.api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
do_render = true;
|
||||
}
|
||||
VirtualKeyCode::I => {
|
||||
wrench.renderer.toggle_debug_flags(DebugFlags::TEXTURE_CACHE_DBG);
|
||||
debug_flags.toggle(DebugFlags::TEXTURE_CACHE_DBG);
|
||||
wrench.api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
do_render = true;
|
||||
}
|
||||
VirtualKeyCode::S => {
|
||||
wrench.renderer.toggle_debug_flags(DebugFlags::COMPACT_PROFILER);
|
||||
debug_flags.toggle(DebugFlags::COMPACT_PROFILER);
|
||||
wrench.api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
do_render = true;
|
||||
}
|
||||
VirtualKeyCode::Q => {
|
||||
wrench.renderer.toggle_debug_flags(
|
||||
DebugFlags::GPU_TIME_QUERIES | DebugFlags::GPU_SAMPLE_QUERIES
|
||||
);
|
||||
debug_flags.toggle(DebugFlags::GPU_TIME_QUERIES | DebugFlags::GPU_SAMPLE_QUERIES);
|
||||
wrench.api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
do_render = true;
|
||||
}
|
||||
VirtualKeyCode::V => {
|
||||
wrench.renderer.toggle_debug_flags(DebugFlags::SHOW_OVERDRAW);
|
||||
debug_flags.toggle(DebugFlags::SHOW_OVERDRAW);
|
||||
wrench.api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
do_render = true;
|
||||
}
|
||||
VirtualKeyCode::G => {
|
||||
// go through the API so that we reach the render backend
|
||||
wrench.api.send_debug_cmd(DebugCommand::EnableGpuCacheDebug(
|
||||
!wrench.renderer.get_debug_flags().contains(webrender::DebugFlags::GPU_CACHE_DBG)
|
||||
));
|
||||
debug_flags.toggle(DebugFlags::GPU_CACHE_DBG);
|
||||
wrench.api.send_debug_cmd(DebugCommand::SetFlags(debug_flags));
|
||||
|
||||
// force scene rebuild to see the full set of used GPU cache entries
|
||||
let mut txn = Transaction::new();
|
||||
txn.set_root_pipeline(wrench.root_pipeline_id);
|
||||
|
|
Загрузка…
Ссылка в новой задаче