mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Make player automatically start/stop the capture
This commit is contained in:
parent
09f8f8dfb6
commit
19dfcd93ca
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -85,7 +85,7 @@ jobs:
|
|||||||
channel: stable
|
channel: stable
|
||||||
prepare_command: rustup default stable-msvc
|
prepare_command: rustup default stable-msvc
|
||||||
additional_core_features: trace,serial-pass
|
additional_core_features: trace,serial-pass
|
||||||
additional_player_features: renderdoc
|
additional_player_features:
|
||||||
- name: Windows Nightly
|
- name: Windows Nightly
|
||||||
os: windows-2019
|
os: windows-2019
|
||||||
channel: nightly
|
channel: nightly
|
||||||
|
|||||||
25
Cargo.lock
generated
25
Cargo.lock
generated
@ -395,15 +395,6 @@ version = "0.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "float-cmp"
|
|
||||||
version = "0.8.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e1267f4ac4f343772758f7b1bdcbe767c218bbab93bb432acbf5162bbf85a6c4"
|
|
||||||
dependencies = [
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fnv"
|
name = "fnv"
|
||||||
version = "1.0.7"
|
version = "1.0.7"
|
||||||
@ -1135,7 +1126,6 @@ dependencies = [
|
|||||||
"env_logger",
|
"env_logger",
|
||||||
"log",
|
"log",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"renderdoc",
|
|
||||||
"ron",
|
"ron",
|
||||||
"serde",
|
"serde",
|
||||||
"wgpu-core",
|
"wgpu-core",
|
||||||
@ -1214,21 +1204,6 @@ version = "0.6.21"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
|
checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "renderdoc"
|
|
||||||
version = "0.10.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "58fd0c55a54ecce0889aaca4ee87831cfe8c83c275c439443162be1f0eab5fdc"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"float-cmp",
|
|
||||||
"libloading 0.6.5",
|
|
||||||
"once_cell",
|
|
||||||
"renderdoc-sys",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
"wio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "renderdoc-sys"
|
name = "renderdoc-sys"
|
||||||
version = "0.7.1"
|
version = "0.7.1"
|
||||||
|
|||||||
@ -19,7 +19,6 @@ cross = ["wgc/cross"]
|
|||||||
env_logger = "0.8"
|
env_logger = "0.8"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
raw-window-handle = "0.3"
|
raw-window-handle = "0.3"
|
||||||
renderdoc = { version = "0.10", optional = true, default_features = false }
|
|
||||||
ron = "0.6"
|
ron = "0.6"
|
||||||
winit = { version = "0.24", optional = true }
|
winit = { version = "0.24", optional = true }
|
||||||
|
|
||||||
|
|||||||
@ -19,11 +19,6 @@ fn main() {
|
|||||||
|
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
#[cfg(feature = "renderdoc")]
|
|
||||||
#[cfg_attr(feature = "winit", allow(unused))]
|
|
||||||
let mut rd = renderdoc::RenderDoc::<renderdoc::V110>::new()
|
|
||||||
.expect("Failed to connect to RenderDoc: are you running without it?");
|
|
||||||
|
|
||||||
//TODO: setting for the backend bits
|
//TODO: setting for the backend bits
|
||||||
//TODO: setting for the target frame, or controls
|
//TODO: setting for the target frame, or controls
|
||||||
|
|
||||||
@ -100,15 +95,13 @@ fn main() {
|
|||||||
log::info!("Executing actions");
|
log::info!("Executing actions");
|
||||||
#[cfg(not(feature = "winit"))]
|
#[cfg(not(feature = "winit"))]
|
||||||
{
|
{
|
||||||
#[cfg(feature = "renderdoc")]
|
gfx_select!(device => global.device_start_capture(device));
|
||||||
rd.start_frame_capture(std::ptr::null(), std::ptr::null());
|
|
||||||
|
|
||||||
while let Some(action) = actions.pop() {
|
while let Some(action) = actions.pop() {
|
||||||
gfx_select!(device => global.process(device, action, &dir, &mut command_buffer_id_manager));
|
gfx_select!(device => global.process(device, action, &dir, &mut command_buffer_id_manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "renderdoc")]
|
gfx_select!(device => global.device_stop_capture(device));
|
||||||
rd.end_frame_capture(std::ptr::null(), std::ptr::null());
|
|
||||||
gfx_select!(device => global.device_poll(device, true)).unwrap();
|
gfx_select!(device => global.device_poll(device, true)).unwrap();
|
||||||
}
|
}
|
||||||
#[cfg(feature = "winit")]
|
#[cfg(feature = "winit")]
|
||||||
|
|||||||
@ -4592,6 +4592,24 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
B::hub(self).devices.label_for_resource(id)
|
B::hub(self).devices.label_for_resource(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn device_start_capture<B: GfxBackend>(&self, id: id::DeviceId) {
|
||||||
|
let hub = B::hub(self);
|
||||||
|
let mut token = Token::root();
|
||||||
|
let (device_guard, _) = hub.devices.read(&mut token);
|
||||||
|
if let Ok(device) = device_guard.get(id) {
|
||||||
|
device.raw.start_capture();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn device_stop_capture<B: GfxBackend>(&self, id: id::DeviceId) {
|
||||||
|
let hub = B::hub(self);
|
||||||
|
let mut token = Token::root();
|
||||||
|
let (device_guard, _) = hub.devices.read(&mut token);
|
||||||
|
if let Ok(device) = device_guard.get(id) {
|
||||||
|
device.raw.stop_capture();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn device_drop<B: GfxBackend>(&self, device_id: id::DeviceId) {
|
pub fn device_drop<B: GfxBackend>(&self, device_id: id::DeviceId) {
|
||||||
profiling::scope!("drop", "Device");
|
profiling::scope!("drop", "Device");
|
||||||
|
|
||||||
@ -4868,28 +4886,4 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
//Note: outside inner function so no locks are held when calling the callback
|
//Note: outside inner function so no locks are held when calling the callback
|
||||||
.map(|pending_callback| fire_map_callbacks(pending_callback.into_iter()))
|
.map(|pending_callback| fire_map_callbacks(pending_callback.into_iter()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start_capture<B: GfxBackend>(
|
|
||||||
&self,
|
|
||||||
device_id: id::DeviceId,
|
|
||||||
) -> Result<(), InvalidDevice> {
|
|
||||||
let hub = B::hub(self);
|
|
||||||
let mut token = Token::root();
|
|
||||||
let (device_guard, _) = hub.devices.read(&mut token);
|
|
||||||
let device = device_guard.get(device_id).map_err(|_| InvalidDevice)?;
|
|
||||||
device.raw.start_capture();
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn stop_capture<B: GfxBackend>(
|
|
||||||
&self,
|
|
||||||
device_id: id::DeviceId,
|
|
||||||
) -> Result<(), InvalidDevice> {
|
|
||||||
let hub = B::hub(self);
|
|
||||||
let mut token = Token::root();
|
|
||||||
let (device_guard, _) = hub.devices.read(&mut token);
|
|
||||||
let device = device_guard.get(device_id).map_err(|_| InvalidDevice)?;
|
|
||||||
device.raw.stop_capture();
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user