Pick the card (VICTORY_ADAPTER); RTX 5060 Ti results; Series S 1080p crashes
- host.rs: VICTORY_ADAPTER=<part of a card's name, or #index> creates the host device on that card instead of Windows' default; the log names the card, or lists the cards when nothing matches. play-nvidia.ps1 -Adapter. - README: RTX 5060 Ti 16 GB vs RTX 5070 12 GB on the same PC, same build and settings (Series S 540p): 14.9 vs 19.3 fps. The GPU work is close; the 5060 Ti's slot is PCIe 4.0 x4 with no display, and this layer's copies dominate. - README: Series S at 1080p (render scale 1.0) stops at a breakpoint at start on a 12 GB card too, so it is not video memory; use 720p or lower. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d3cd650c12
commit
033be27f33
3 files changed
+80
-4
No files matched your search
@@ -884,6 +884,9 @@ fn create() -> windows::core::Result<Host> {
|
||||
let adapter = warp_adapter()?;
|
||||
D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut device)?;
|
||||
tracing::info!("host device on the software adapter (WARP)");
|
||||
} else if let Some(adapter) = chosen_adapter() {
|
||||
D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut device)?;
|
||||
crate::tdr::log();
|
||||
} else {
|
||||
D3D12CreateDevice(None, D3D_FEATURE_LEVEL_12_0, &mut device)?;
|
||||
// Whether a GPU hang ends the run or freezes the PC (#1054).
|
||||
@@ -982,6 +985,51 @@ impl Host {
|
||||
|
||||
/// DXGI may return hardware for `EnumWarpAdapter` (notably under Proton).
|
||||
/// Reject it before creating a device in diagnostics' software-only mode.
|
||||
/// LOCAL: the card `VICTORY_ADAPTER` names, for a PC with more than one.
|
||||
/// The value is part of the card's name, any case (`5060`, `RTX 5070`), or
|
||||
/// its index in DXGI's order (`#1`). Unset: Windows' default card. A value
|
||||
/// that matches no hardware card is logged with the list and ignored.
|
||||
fn chosen_adapter() -> Option<IDXGIAdapter1> {
|
||||
let want = std::env::var("VICTORY_ADAPTER").ok()?;
|
||||
let want = want.trim();
|
||||
if want.is_empty() {
|
||||
return None;
|
||||
}
|
||||
// SAFETY: plain DXGI adapter queries.
|
||||
unsafe {
|
||||
let factory: IDXGIFactory4 = CreateDXGIFactory2(DXGI_CREATE_FACTORY_FLAGS(0)).ok()?;
|
||||
let index = want.strip_prefix('#').and_then(|n| n.parse::<u32>().ok());
|
||||
let mut seen = Vec::new();
|
||||
for i in 0.. {
|
||||
let Ok(adapter) = factory.EnumAdapters1(i) else { break };
|
||||
let Ok(desc) = adapter.GetDesc1() else { continue };
|
||||
let len = desc.Description.iter().position(|&c| c == 0).unwrap_or(desc.Description.len());
|
||||
let name = String::from_utf16_lossy(&desc.Description[..len]);
|
||||
let software = desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0;
|
||||
let hit = match index {
|
||||
Some(n) => n == i,
|
||||
None => name.to_lowercase().contains(&want.to_lowercase()),
|
||||
};
|
||||
if hit && !software {
|
||||
tracing::warn!(
|
||||
adapter = %name,
|
||||
index = i,
|
||||
memory_mb = desc.DedicatedVideoMemory / (1024 * 1024),
|
||||
"host device on the card VICTORY_ADAPTER names"
|
||||
);
|
||||
return Some(adapter);
|
||||
}
|
||||
seen.push(format!("#{i} {name}"));
|
||||
}
|
||||
tracing::warn!(
|
||||
want,
|
||||
cards = %seen.join(", "),
|
||||
"VICTORY_ADAPTER names no hardware card; Windows' default card is used"
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn warp_adapter() -> windows::core::Result<IDXGIAdapter> {
|
||||
// SAFETY: plain DXGI adapter queries.
|
||||
unsafe {
|
||||
|
||||
Reference in new issue
Block a user