Bring a decoration bake's own sources up to date before it runs
The title bakes characters' skin and decorations once into textures of its own (PS_BakeDecorations_*, PS_DecorationBlend_*); what a bake reads wrong stays for good: coloured specks over a character's skin, already in the G-buffer. Their native code picks the skin texture at byte 0x20 of the constants at table 1 and each decoration's textures from its 304-byte record of the structured buffer at table 1, records [0x78, 0x7c) of the constants. The pass before a bake serves due slots newest write first within a budget, refuses new host copies while the card has no room (holding them back for about four seconds), and does not look at a slot served before unless something told of a change, so a source could still show a stand-in (another texture of the same kind) or old bytes. Now every slot the bake's constants and records name is checked right before the bake: a slot not made from its present view, a texture with no host copy, or a host copy not filled from the bytes title memory holds now is uploaded on the bake's own synchronous list, whatever the card's room and the pass's budget, and published with the others. A log line per bake that found such a source (and totals at bakes 1, 2, 4...) says how many and why. VICTORY_BAKE_SOURCES=0: as before. Also a diagnostic: a texture the title places inside (not at the start of) the memory of a texture the host writes is said once per kind of pair; such a view is filled from title memory the host never writes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
9a791323ba
commit
b3d49db34f
2 files changed
+342
No files matched your search
@@ -1556,6 +1556,55 @@ pub(crate) fn alias_of(this: This) -> Option<This> {
|
||||
same.then_some(other)
|
||||
}
|
||||
|
||||
/// Says (once per kind of pair, at most 64 lines) that the texture the
|
||||
/// title placed at `address` ([`texture_at`]), `this`, lies inside the
|
||||
/// memory of a texture the host renders to or writes without starting
|
||||
/// where that texture starts. [`alias_of`] finds only a view at the very
|
||||
/// start; one placed further in (a level, a layer, a corner of an atlas) is
|
||||
/// filled from title memory, which the host's writes never reach: what
|
||||
/// lay there before (another texture's bytes) or zeros. Diagnostics for
|
||||
/// textures that read as noise or black where the title rendered them.
|
||||
#[cfg(windows)]
|
||||
fn placed_inside_target(address: u64, this: This) {
|
||||
let hit = {
|
||||
let targets = TARGETS_AT.lock().unwrap_or_else(|e| e.into_inner());
|
||||
targets.range(..address).next_back().map(|(&start, &other)| (start, other))
|
||||
};
|
||||
let Some((start, other)) = hit else {
|
||||
return;
|
||||
};
|
||||
let (r, o) = (resource(this), resource(other as This));
|
||||
let Some(size) = footprint(&o.desc).map(|f| f.size) else {
|
||||
return;
|
||||
};
|
||||
if address >= start.saturating_add(size) {
|
||||
return;
|
||||
}
|
||||
static SAID: std::sync::Mutex<std::collections::BTreeSet<[u32; 8]>> =
|
||||
std::sync::Mutex::new(std::collections::BTreeSet::new());
|
||||
let pair = [
|
||||
r.desc.width as u32,
|
||||
r.desc.height,
|
||||
r.desc.format,
|
||||
u32::from(r.desc.mip_levels),
|
||||
o.desc.width as u32,
|
||||
o.desc.height,
|
||||
o.desc.format,
|
||||
u32::from(o.desc.mip_levels),
|
||||
];
|
||||
let mut said = SAID.lock().unwrap_or_else(|e| e.into_inner());
|
||||
if said.len() < 64 && said.insert(pair) {
|
||||
tracing::warn!(
|
||||
view = ?this,
|
||||
texture = ?other,
|
||||
offset = format_args!("{:#x}", address - start),
|
||||
target_bytes = size,
|
||||
target_flags = format_args!("{:#x}", o.desc.flags),
|
||||
"a placed texture lies inside the memory of a texture the host writes, not at its start: it is filled from title memory, which the host's writes never reach (width, height, format, levels of each): {pair:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether host copies are made on first use. On by default;
|
||||
/// `VICTORY_LAZY_TEXTURES=0` makes each when the title creates its texture,
|
||||
/// as before.
|
||||
@@ -3159,6 +3208,7 @@ pub(crate) fn texture_at(address: u64, desc: &[u32; 14]) -> Option<This> {
|
||||
}
|
||||
map.insert((address, *desc), out as usize);
|
||||
crate::texture::placed_in_host_written(address, desc);
|
||||
placed_inside_target(address, out);
|
||||
resource(out)
|
||||
.host
|
||||
.placed
|
||||
|
||||
Reference in new issue
Block a user