Frames shown as soon as presented, underwater shader back, warm-up restart only with frame generation

- Swap chain: DXGI's tearing support where the system has it, so a focused
  window (independent flip) no longer waits for each refresh, about 2 fps
  more in front. VICTORY_TEARING=0 turns it off; a refused present of that
  kind falls back to presenting at the next refresh for the rest of the run,
  and is logged.
- Shaders: a program that has no wave32 lowering with the loop step on
  (VICTORY_LOOPS_WAVE) is translated again without it, so the water compute
  shader 926c46bab3b86bd6 runs again (black or missing water underwater,
  #539, #570).
- The first start of a new exe restarts by itself only when DLSS frame
  generation is ready or on; without it a first run plays at full speed.
- F1: turning frame generation on in a run started without it says
  "RESTART REQUIRED TO ENABLE FRAME GENERATION".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
trustno1-coderandClaude Opus 5.5 committed 2026-11-27 18:44:17 -08:00
1 parent b4e1b08245
commit 8fc22547c8
4 files changed
+127 -4

No files matched your search

+38 -2
View File
@@ -511,7 +511,11 @@ fn translate_plain(container: &[u8]) -> Result<HostShader, ShaderError> {
emit(&c, &native, &p, &st, &io, &res)
}
/// Emits a program whose earlier stages already ran.
/// Emits a program whose earlier stages already ran ([`emit_once`]). A wave64 compute program
/// that does not translate with the branches that close or leave its loops taken by each host
/// wave together ([`loops_wave`]) is tried once more without them, as before that step: the
/// underwater picture's program (`926c46bab3b86bd6`) translated before it and no longer did, so
/// its dispatch was dropped and diving showed a field of white flares (#539, #570).
pub fn emit(
c: &Container,
native: &NativeProgram,
@@ -519,6 +523,38 @@ pub fn emit(
st: &structure::Structured,
io: &io::Io,
res: &resource::Resources,
) -> Result<HostShader, ShaderError> {
let first = emit_once(c, native, p, st, io, res);
if !matches!(first, Err(ShaderError::Unsupported { .. })) || !loops_wave(native) {
return first;
}
LOOPS_OFF.with(|off| off.set(true));
let again = emit_once(c, native, p, st, io, res);
LOOPS_OFF.with(|off| off.set(false));
match again {
Ok(shader) => {
if std::env::var_os("VICTORY_WAVE_WHY").is_some() {
eprintln!("WAVE-LOOPS left out: the program translates without them");
}
Ok(shader)
}
Err(_) => first,
}
}
thread_local! {
/// [`emit`]'s second try: [`loops_wave`] off.
static LOOPS_OFF: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
}
/// One try of [`emit`].
fn emit_once(
c: &Container,
native: &NativeProgram,
p: &ir::Program,
st: &structure::Structured,
io: &io::Io,
res: &resource::Resources,
) -> Result<HostShader, ShaderError> {
// (what an earlier program's lowering on this thread left behind)
lower::take_needs();
@@ -903,7 +939,7 @@ fn widen(
/// - `2`: every compute program;
/// - `0`: none, as before.
fn loops_wave(native: &NativeProgram) -> bool {
if native.stage != HwStage::Cs {
if native.stage != HwStage::Cs || LOOPS_OFF.with(std::cell::Cell::get) {
return false;
}
match std::env::var("VICTORY_LOOPS_WAVE").ok().as_deref().map(str::trim) {