Skip to content

render: Reintroduce the render_trace feature #17402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions desktop/Cargo.toml
Original file line number Diff line number Diff line change
@@ -74,6 +74,7 @@ tracy = ["tracing-tracy", "ruffle_render_wgpu/profile-with-tracy"]

# wgpu features
render_debug_labels = ["ruffle_render_wgpu/render_debug_labels"]
render_trace = ["ruffle_render_wgpu/render_trace"]

# sandboxing
sandbox = []
16 changes: 16 additions & 0 deletions desktop/src/cli.rs
Original file line number Diff line number Diff line change
@@ -103,6 +103,11 @@ pub struct Opt {
#[clap(long, action)]
pub force_scale: bool,

/// Location to store a wgpu trace output
#[clap(long)]
#[cfg(feature = "render_trace")]
trace_path: Option<std::path::PathBuf>,

/// Location to store save data for games.
///
/// This option has no effect if `storage` is not `disk`.
@@ -266,6 +271,17 @@ fn parse_gamepad_button(mapping: &str) -> Result<(GamepadButton, KeyCode), Error
}

impl Opt {
#[cfg(feature = "render_trace")]
pub fn trace_path(&self) -> Option<&Path> {
if let Some(path) = &self.trace_path {
let _ = std::fs::create_dir_all(path);
Some(path)
} else {
None
}
}

#[cfg(not(feature = "render_trace"))]
pub fn trace_path(&self) -> Option<&Path> {
None
}
1 change: 1 addition & 0 deletions exporter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -24,4 +24,5 @@ anyhow = { workspace = true }
[features]
avm_debug = ["ruffle_core/avm_debug"]
render_debug_labels = ["ruffle_render_wgpu/render_debug_labels"]
render_trace = ["ruffle_render_wgpu/render_trace"]
lzma = ["ruffle_core/lzma"]
16 changes: 16 additions & 0 deletions exporter/src/main.rs
Original file line number Diff line number Diff line change
@@ -73,6 +73,11 @@ struct Opt {
#[clap(long, short, default_value = "high")]
power: PowerPreference,

/// Location to store a wgpu trace output
#[clap(long)]
#[cfg(feature = "render_trace")]
trace_path: Option<PathBuf>,

/// Skip unsupported movie types (currently AVM 2)
#[clap(long, action)]
skip_unsupported: bool,
@@ -377,6 +382,17 @@ fn capture_multiple_swfs(descriptors: Arc<Descriptors>, opt: &Opt) -> Result<()>
Ok(())
}

#[cfg(feature = "render_trace")]
fn trace_path(opt: &Opt) -> Option<&Path> {
if let Some(path) = &opt.trace_path {
let _ = std::fs::create_dir_all(path);
Some(path)
} else {
None
}
}

#[cfg(not(feature = "render_trace"))]
fn trace_path(_opt: &Opt) -> Option<&Path> {
None
}
1 change: 1 addition & 0 deletions render/wgpu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@ features = ["HtmlCanvasElement"]

[features]
render_debug_labels = []
render_trace = ["wgpu/trace"]
webgl = ["wgpu/webgl"]
profile-with-tracy = ["profiling", "profiling/profile-with-tracy"]