1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#[cfg(any(target_os = "macos", target_os = "ios"))]
compile_error!("RenderDoc does not support this platform.");
#[macro_use]
extern crate bitflags;
extern crate float_cmp;
extern crate libloading;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate renderdoc_derive;
extern crate renderdoc_sys;
#[cfg(feature = "glutin")]
extern crate glutin;
#[cfg(target_os = "windows")]
extern crate winapi;
#[cfg(target_os = "windows")]
extern crate wio;
pub use self::handles::{DevicePointer, WindowHandle};
pub use self::renderdoc::RenderDoc;
pub use self::settings::{CaptureOption, InputButton, OverlayBits};
pub use self::version::{Entry, HasPrevious, Version, V100, V110, V111, V112, V120, V130, V140};
use std::os::raw::c_ulonglong;
#[cfg(windows)]
use winapi::shared::guiddef::GUID;
#[cfg(windows)]
use wio::com::ComPtr;
mod handles;
mod renderdoc;
mod settings;
mod version;
#[cfg(windows)]
pub const SHADER_MAGIC_DEBUG_VALUE_STRUCT: GUID = GUID {
Data1: 0xeab25520,
Data2: 0x6670,
Data3: 0x4865,
Data4: [0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, 0x00, 0xff],
};
pub const SHADER_MAGIC_DEBUG_VALUE_BYTE_ARRAY: &[u8] = &[
0x20, 0x55, 0xb2, 0xea, 0x70, 0x66, 0x65, 0x48, 0x84, 0x29, 0x6c, 0x8, 0x51, 0x54, 0x00, 0xff,
];
pub const SHADER_MAGIC_DEBUG_VALUE_TRUNCATED: c_ulonglong = 0x0485_6670_eab2_5520;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn get_set_capture_option_f32() {
let mut rd: RenderDoc<V110> = RenderDoc::new().expect("Failed to init");
let delay = rd.get_capture_option_f32(CaptureOption::DelayForDebugger);
assert_eq!(delay, 0.0f32);
rd.set_capture_option_f32(CaptureOption::DelayForDebugger, 2.5f32);
let delay = rd.get_capture_option_f32(CaptureOption::DelayForDebugger);
assert_eq!(delay, 2.0f32);
}
#[test]
fn get_set_capture_option_u32() {
let rd: RenderDoc<V110> = RenderDoc::new().expect("Failed to init");
let vsync = rd.get_capture_option_u32(CaptureOption::AllowVSync);
assert_eq!(vsync, 1u32);
let is_full = rd.get_capture_option_u32(CaptureOption::AllowFullscreen);
assert_eq!(is_full, 1u32);
let api_val_mode = rd.get_capture_option_u32(CaptureOption::ApiValidation);
let debug_mode = rd.get_capture_option_u32(CaptureOption::ApiValidation);
assert_eq!(api_val_mode, 0u32);
assert_eq!(api_val_mode, debug_mode);
let cc = rd.get_capture_option_u32(CaptureOption::CaptureCallstacks);
assert_eq!(cc, 0u32);
let cc_draw = rd.get_capture_option_u32(CaptureOption::CaptureCallstacksOnlyDraws);
assert_eq!(cc_draw, 0u32);
let ver_map = rd.get_capture_option_u32(CaptureOption::VerifyMapWrites);
assert_eq!(ver_map, 0u32);
let hook_in = rd.get_capture_option_u32(CaptureOption::HookIntoChildren);
assert_eq!(hook_in, 0u32);
let ref_all = rd.get_capture_option_u32(CaptureOption::RefAllResources);
assert_eq!(ref_all, 0u32);
let intls = rd.get_capture_option_u32(CaptureOption::SaveAllInitials);
assert_eq!(intls, 1u32);
let cmds = rd.get_capture_option_u32(CaptureOption::CaptureAllCmdLists);
assert_eq!(cmds, 0u32);
let is_muted = rd.get_capture_option_u32(CaptureOption::DebugOutputMute);
assert_eq!(is_muted, 1u32);
}
}