|
|
@@ -553,8 +553,7 @@ fn create() -> windows::core::Result<Host> {
|
|
|
// SAFETY: plain D3D12 object creation with valid descriptions.
|
|
|
unsafe {
|
|
|
// The debug layer only in builds with diagnostics.
|
|
|
- let debug =
|
|
|
- cfg!(feature = "diagnostics") && std::env::var_os("VICTORY_D3D12_DEBUG").is_some();
|
|
|
+ let debug = cfg!(feature = "diagnostics") && crate::switch::on("VICTORY_D3D12_DEBUG");
|
|
|
if debug {
|
|
|
let mut layer: Option<ID3D12Debug> = None;
|
|
|
match D3D12GetDebugInterface(&mut layer) {
|
|
|
@@ -565,7 +564,7 @@ fn create() -> windows::core::Result<Host> {
|
|
|
// descriptor heap indices and the like become messages naming
|
|
|
// the command instead of page faults. Without state tracking
|
|
|
// (directly indexed textures are not transitioned).
|
|
|
- if std::env::var_os("VICTORY_D3D12_GBV").is_some()
|
|
|
+ if crate::switch::on("VICTORY_D3D12_GBV")
|
|
|
&& let Some(l) = &layer
|
|
|
{
|
|
|
if let Ok(d1) = l.cast::<ID3D12Debug1>() {
|
|
|
@@ -594,7 +593,7 @@ fn create() -> windows::core::Result<Host> {
|
|
|
// Diagnostics: the software adapter, on which a shader's wild access
|
|
|
// is an access violation in this process (a crash report with the
|
|
|
// address and instruction) instead of a GPU fault and driver reset.
|
|
|
- if cfg!(feature = "diagnostics") && std::env::var_os("VICTORY_D3D12_WARP").is_some() {
|
|
|
+ if cfg!(feature = "diagnostics") && crate::switch::on("VICTORY_D3D12_WARP") {
|
|
|
let adapter = warp_adapter()?;
|
|
|
D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut device)?;
|
|
|
tracing::info!("host device on the software adapter (WARP)");
|
|
|
@@ -1326,9 +1325,7 @@ fn record_twin_copy(
|
|
|
/// builds).
|
|
|
pub(crate) fn dred_on() -> bool {
|
|
|
static ON: OnceLock<bool> = OnceLock::new();
|
|
|
- *ON.get_or_init(|| {
|
|
|
- cfg!(feature = "diagnostics") && std::env::var_os("VICTORY_D3D12_DRED").is_some()
|
|
|
- })
|
|
|
+ *ON.get_or_init(|| cfg!(feature = "diagnostics") && crate::switch::on("VICTORY_D3D12_DRED"))
|
|
|
}
|
|
|
|
|
|
/// Indirect mesh dispatches since the last frame line: the largest group
|
|
|
@@ -1352,7 +1349,7 @@ fn card_budget() -> bool {
|
|
|
#[cfg(feature = "diagnostics")]
|
|
|
fn timing() -> bool {
|
|
|
static ON: OnceLock<bool> = OnceLock::new();
|
|
|
- *ON.get_or_init(|| std::env::var_os("VICTORY_GPU_TIMING").is_some())
|
|
|
+ *ON.get_or_init(|| crate::switch::on("VICTORY_GPU_TIMING"))
|
|
|
}
|
|
|
|
|
|
/// Names a host object for the device-removed report, which names the
|