#[repr(C)]pub struct RenderDoc<V>(/* private fields */);
Expand description
An instance of the RenderDoc API with baseline version V
.
Implementations§
Source§impl<V: Version> RenderDoc<V>
impl<V: Version> RenderDoc<V>
Sourcepub unsafe fn raw_api(&self) -> *mut Entry
pub unsafe fn raw_api(&self) -> *mut Entry
Returns the raw entry point of the API.
§Safety
Using the entry point structure directly will discard any thread safety provided by default with this library.
Sourcepub unsafe fn shutdown(self)
pub unsafe fn shutdown(self)
Attempts to shut down RenderDoc.
§Safety
Note that this will work correctly if done immediately after the dynamic library is loaded, before any API work happens. At that point, RenderDoc will remove its injected hooks and shut down. Behavior is undefined if this is called after any API functions have been called.
§Compatibility
This process is only possible on Windows, and even then it is not well defined so may not be possible in all circumstances. This function is provided at your own risk.
Source§impl<V: HasPrevious> RenderDoc<V>
impl<V: HasPrevious> RenderDoc<V>
Sourcepub fn downgrade(self) -> RenderDoc<V::Previous>
pub fn downgrade(self) -> RenderDoc<V::Previous>
Downgrades the current API version to the version immediately preceding it.
§Examples
let current: RenderDoc<V112> = RenderDoc::new()?;
let previous: RenderDoc<V111> = current.downgrade();
// let older: RenderDoc<V100> = previous.downgrade(); // This line does not compile
Source§impl RenderDoc<V100>
impl RenderDoc<V100>
Sourcepub fn get_api_version(&self) -> (u32, u32, u32)
pub fn get_api_version(&self) -> (u32, u32, u32)
Returns the major, minor, and patch version numbers of the RenderDoc API currently in use.
Note that RenderDoc will usually provide a higher API version than the one requested by the user if it’s backwards compatible.
§Examples
let renderdoc: RenderDoc<V100> = RenderDoc::new()?;
let (major, minor, patch) = renderdoc.get_api_version();
assert_eq!(major, 1);
Sourcepub fn set_capture_option_f32(&mut self, opt: CaptureOption, val: f32)
pub fn set_capture_option_f32(&mut self, opt: CaptureOption, val: f32)
Sets the specified CaptureOption
to the given f32
value.
§Panics
This method will panic if the option and/or the value are invalid.
Sourcepub fn set_capture_option_u32(&mut self, opt: CaptureOption, val: u32)
pub fn set_capture_option_u32(&mut self, opt: CaptureOption, val: u32)
Sets the specified CaptureOption
to the given u32
value.
§Panics
This method will panic if the option and/or the value are invalid.
Sourcepub fn get_capture_option_f32(&self, opt: CaptureOption) -> f32
pub fn get_capture_option_f32(&self, opt: CaptureOption) -> f32
Returns the value of the given CaptureOption
as an f32
value.
§Panics
This method will panic if the option is invalid.
Sourcepub fn get_capture_option_u32(&self, opt: CaptureOption) -> u32
pub fn get_capture_option_u32(&self, opt: CaptureOption) -> u32
Returns the value of the given CaptureOption
as a u32
value.
§Panics
This method will panic if the option is invalid.
Sourcepub fn set_capture_keys<I: Into<InputButton> + Clone>(&mut self, keys: &[I])
pub fn set_capture_keys<I: Into<InputButton> + Clone>(&mut self, keys: &[I])
Sets the key bindings used in-application to trigger a capture on the current window.
If the keys
slice is empty, all existing capture key bindings are disabled.
Sourcepub fn set_focus_toggle_keys<I: Into<InputButton> + Clone>(
&mut self,
keys: &[I],
)
pub fn set_focus_toggle_keys<I: Into<InputButton> + Clone>( &mut self, keys: &[I], )
Sets the key bindings used in-application to switch focus between windows.
If the keys
slice is empty, all existing focus toggle key bindings are disabled.
Sourcepub fn unload_crash_handler(&mut self)
pub fn unload_crash_handler(&mut self)
Removes RenderDoc’s injected crash handler from the current process.
This allows you to provide your own global crash handler with which to handle exceptions, if you so desire. After the crash handler has been removed, subsequent calls to this method will do nothing.
Sourcepub fn get_overlay_bits(&self) -> OverlayBits
pub fn get_overlay_bits(&self) -> OverlayBits
Returns a bitmask representing which elements of the RenderDoc overlay are being rendered on each window.
Sourcepub fn mask_overlay_bits(&mut self, and: OverlayBits, or: OverlayBits)
pub fn mask_overlay_bits(&mut self, and: OverlayBits, or: OverlayBits)
Applies the given and
and or
bitflags to determine which elements of the RenderDoc
overlay should be rendered on each window.
This method applies and
to the current mask with a bitwise-and, and then applies or
using a bitwise-or on top.
Sourcepub fn get_log_file_path_template(&self) -> &Path
pub fn get_log_file_path_template(&self) -> &Path
Returns the path template where new captures will be stored.
The template can either be a relative or absolute path, which determines where captures will be saved and how they will be named. Relative paths will be saved relative to the process’ current working directory.
By default, this will be in a folder controlled by the UI - initially the system temporary directory, and the filename is the executable’s filename.
§Examples
let renderdoc: RenderDoc<V100> = RenderDoc::new()?;
println!("{:?}", renderdoc.get_log_file_path_template()); // e.g. `my_captures/example`
Sourcepub fn set_log_file_path_template<P: Into<PathBuf>>(&mut self, path_template: P)
pub fn set_log_file_path_template<P: Into<PathBuf>>(&mut self, path_template: P)
Sets the path template where new capture files should be stored.
The template can either be a relative or absolute path, which determines where captures will be saved and how they will be named. Relative paths will be saved relative to the process’ current working directory.
The default template is in a folder controlled by the UI - initially the system temporary directory, and the filename is the executable’s filename.
§Examples
let mut renderdoc: RenderDoc<V100> = RenderDoc::new()?;
renderdoc.set_log_file_path_template("my_captures/example");
renderdoc.trigger_capture(); // Saved as `my_captures/example_frame123.rdc`
renderdoc.trigger_capture(); // Saved as `my_captures/example_frame456.rdc`
Sourcepub fn get_num_captures(&self) -> u32
pub fn get_num_captures(&self) -> u32
Returns the number of frame captures that have been made.
§Examples
let renderdoc: RenderDoc<V100> = RenderDoc::new()?;
assert_eq!(renderdoc.get_num_captures(), 0);
Sourcepub fn get_capture(&self, index: u32) -> Option<(PathBuf, SystemTime)>
pub fn get_capture(&self, index: u32) -> Option<(PathBuf, SystemTime)>
Retrieves the path and capture time of a capture file indexed by the number index
.
Returns Some
if the index was within 0..get_num_captures()
, otherwise returns None
.
§Examples
let mut renderdoc: RenderDoc<V100> = RenderDoc::new()?;
// Capture a frame.
renderdoc.trigger_capture();
// Get information about the previous capture.
let (file_path, capture_time) = renderdoc.get_capture(0).unwrap();
Sourcepub fn trigger_capture(&mut self)
pub fn trigger_capture(&mut self)
Captures the next frame from the currently active window and API device.
Data is saved to a capture file at the location specified by
set_log_file_path_template()
.
let mut renderdoc: RenderDoc<V100> = RenderDoc::new()?;
// Capture the current frame and save to a file.
renderdoc.trigger_capture();
Sourcepub fn is_remote_access_connected(&self) -> bool
pub fn is_remote_access_connected(&self) -> bool
Returns whether the RenderDoc UI is connected to this application.
§Examples
let renderdoc: RenderDoc<V100> = RenderDoc::new()?;
assert!(!renderdoc.is_remote_access_connected());
Sourcepub fn launch_replay_ui<'a, O>(
&self,
connect_immediately: bool,
extra_opts: O,
) -> Result<u32, Error>
pub fn launch_replay_ui<'a, O>( &self, connect_immediately: bool, extra_opts: O, ) -> Result<u32, Error>
Launches the replay UI associated with the RenderDoc library injected into the running application.
If connect_immediately
is true
, the replay window will automatically connect to this
application once opened, ready to capture frames right away. Optional command-line
arguments to the RenderDoc replay UI can be specified via the extra_opts
parameter.
Returns the PID of the RenderDoc replay process on success.
§Examples
let renderdoc: RenderDoc<V100> = RenderDoc::new()?;
let pid = renderdoc.launch_replay_ui(true, None)?;
Sourcepub fn set_active_window<D>(&mut self, dev: D, win: WindowHandle)where
D: Into<DevicePointer>,
pub fn set_active_window<D>(&mut self, dev: D, win: WindowHandle)where
D: Into<DevicePointer>,
Explicitly set which window is considered “active” by RenderDoc.
The active window is the one that will be captured when the keybinding to trigger a capture
is pressed by the user, as well as when trigger_capture()
is called.
Both dev
and win
must be valid handles.
Sourcepub fn start_frame_capture<D>(&mut self, dev: D, win: WindowHandle)where
D: Into<DevicePointer>,
pub fn start_frame_capture<D>(&mut self, dev: D, win: WindowHandle)where
D: Into<DevicePointer>,
Begins a frame capture for the specified device/window combination.
If either or both dev
and win
are set to std::ptr::null()
, then RenderDoc will
perform a wildcard match.
For example, you can specify null(), null()
for the device to capture on if you have only
one device and only one or zero windows, and RenderDoc will capture from that device.
This function must be paired with a matching end_frame_capture()
to succeed.
let mut renderdoc: RenderDoc<V100> = RenderDoc::new()?;
renderdoc.start_frame_capture(std::ptr::null(), std::ptr::null());
// Capturing window from here onward...
Sourcepub fn is_frame_capturing(&self) -> bool
pub fn is_frame_capturing(&self) -> bool
Returns whether or not a frame capture is currently ongoing anywhere.
§Examples
let renderdoc: RenderDoc<V100> = RenderDoc::new()?;
if renderdoc.is_frame_capturing() {
println!("Frames are being captured.");
} else {
println!("No frame capture is occurring.");
}
Sourcepub fn end_frame_capture<D>(&mut self, dev: D, win: WindowHandle)where
D: Into<DevicePointer>,
pub fn end_frame_capture<D>(&mut self, dev: D, win: WindowHandle)where
D: Into<DevicePointer>,
Ends a frame capture for the specified device/window combination, saving results to disk.
If either or both dev
and win
are set to std::ptr::null()
, then RenderDoc will
perform a wildcard match.
For example, you can specify null(), null()
for the device to capture on if you have only
one device and only one or zero windows, and RenderDoc will capture from that device.
This function must be paired with a matching start_frame_capture()
to complete.
let mut renderdoc: RenderDoc<V100> = RenderDoc::new()?;
renderdoc.start_frame_capture(std::ptr::null(), std::ptr::null());
// Do some rendering here...
renderdoc.end_frame_capture(std::ptr::null(), std::ptr::null());
Source§impl RenderDoc<V110>
impl RenderDoc<V110>
Sourcepub fn trigger_multi_frame_capture(&mut self, num_frames: u32)
pub fn trigger_multi_frame_capture(&mut self, num_frames: u32)
Captures the next n frames from the currently active window and API device.
Data is saved to n separate capture files at the location specified via
set_log_file_path_template()
.
Source§impl RenderDoc<V111>
impl RenderDoc<V111>
Sourcepub fn is_target_control_connected(&self) -> bool
pub fn is_target_control_connected(&self) -> bool
Returns whether the RenderDoc UI is connected to this application.
§Examples
let renderdoc: RenderDoc<V111> = RenderDoc::new()?;
assert!(!renderdoc.is_target_control_connected());
Sourcepub fn is_remote_access_connected(&self) -> bool
👎Deprecated since 1.1.1: renamed to is_target_control_connected
pub fn is_remote_access_connected(&self) -> bool
is_target_control_connected
Returns whether the RenderDoc UI is connected to this application.
Source§impl RenderDoc<V112>
impl RenderDoc<V112>
Sourcepub fn get_capture_file_path_template(&self) -> &Path
pub fn get_capture_file_path_template(&self) -> &Path
Returns the path template where new captures will be stored.
The template can either be a relative or absolute path, which determines where captures will be saved and how they will be named. Relative paths will be saved relative to the process’ current working directory.
By default, this will be in a folder controlled by the UI - initially the system temporary directory, and the filename is the executable’s filename.
§Examples
let renderdoc: RenderDoc<V112> = RenderDoc::new()?;
println!("{:?}", renderdoc.get_capture_file_path_template()); // e.g. `my_captures/example`
Sourcepub fn set_capture_file_path_template<P: Into<PathBuf>>(
&mut self,
path_template: P,
)
pub fn set_capture_file_path_template<P: Into<PathBuf>>( &mut self, path_template: P, )
Sets the path template where new capture files should be stored.
The template can either be a relative or absolute path, which determines where captures will be saved and how they will be named. Relative paths will be saved relative to the process’ current working directory.
The default template is in a folder controlled by the UI - initially the system temporary directory, and the filename is the executable’s filename.
§Examples
let mut renderdoc: RenderDoc<V112> = RenderDoc::new()?;
renderdoc.set_capture_file_path_template("my_captures/example");
renderdoc.trigger_capture(); // Saved as `my_captures/example_frame123.rdc`
renderdoc.trigger_capture(); // Saved as `my_captures/example_frame456.rdc`
Sourcepub fn get_log_file_path_template(&self) -> &Path
👎Deprecated since 1.1.2: renamed to get_capture_file_path_template
pub fn get_log_file_path_template(&self) -> &Path
get_capture_file_path_template
Returns the path template where new captures will be stored.
Sourcepub fn set_log_file_path_template<P: Into<PathBuf>>(&mut self, path_template: P)
👎Deprecated since 1.1.2: renamed to set_capture_file_path_template
pub fn set_log_file_path_template<P: Into<PathBuf>>(&mut self, path_template: P)
set_capture_file_path_template
Sets the path template where new capture files should be stored.
Source§impl RenderDoc<V120>
impl RenderDoc<V120>
Sourcepub fn set_capture_file_comments<'a, P, C>(&mut self, path: P, comments: C)
pub fn set_capture_file_comments<'a, P, C>(&mut self, path: P, comments: C)
Adds or sets an arbitrary comments field to an existing capture on disk, which will then be displayed in the UI to anyone opening the capture file.
If the path
argument is None
, the most recent previous capture file is used.
Source§impl RenderDoc<V140>
impl RenderDoc<V140>
Sourcepub fn discard_frame_capture<D>(&mut self, dev: D, win: WindowHandle) -> boolwhere
D: Into<DevicePointer>,
pub fn discard_frame_capture<D>(&mut self, dev: D, win: WindowHandle) -> boolwhere
D: Into<DevicePointer>,
Ends capturing immediately and discards any data without saving to disk.
Returns true
if the capture was discarded, or false
if no capture is in progress.