Title buffer copies stand where the list has them (VICTORY_COPIES_IN_PLACE)

On by default. They were all done on the CPU when their submission was
prepared, ahead of its first draw: of copy, draw, copy, draw both draws read
the second, and a source a shader writes earlier in the submission was read as
it was before. The list copies now, in the destination's host copy, out of the
source's host copy where shaders write it, else out of upload memory filled at
submission; copies into textures take what shaders wrote too. Title memory and
the reference of the host copy take the bytes at submission as before, so the
landing finds only what the card made of them.

VICTORY_WINDOWS_OWN=1 (off): windows have two sides as well.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 00:29:19 -06:00
1 parent 193f50fe5a
commit ebd9d33b72
7 files changed
+738 -23

No files matched your search

+33 -7
View File
@@ -808,6 +808,20 @@ fn buffer_range(buffer: This, offset: u64, len: u64) -> Option<*mut u8> {
Some(unsafe { data.add(offset as usize) })
}
/// A copy of title memory that `list` records: on the card at its place in
/// the list ([`crate::host::HostList::place_copy`]), or at submission.
#[cfg(windows)]
fn buffer_copy(this: This, list: &crate::host::HostList, to: *mut u8, from: *const u8, len: usize) {
if len == 0 {
return;
}
if list.place_copy(to as usize, from as usize, len) {
with_state(this, |_, state| state.copied());
} else {
list.defer_copy(to, from, len);
}
}
/// Buffer to buffer: both are host memory, copied at submission.
extern "system" fn copy_buffer_region(
this: This,
@@ -822,7 +836,7 @@ extern "system" fn copy_buffer_region(
&& let Some(to) = buffer_range(dst, dst_offset, len)
&& let Some(from) = buffer_range(src, src_offset, len)
{
list.defer_copy(to, from, len as usize);
buffer_copy(this, list, to, from, len as usize);
}
#[cfg(not(windows))]
let _ = (this, dst, dst_offset, src, src_offset, len);
@@ -875,7 +889,7 @@ extern "system" fn copy_resource(this: This, dst: This, src: This) {
crate::resource::buffer_bytes(dst),
crate::resource::buffer_bytes(src),
) {
list.defer_copy(to, from, a.min(b) as usize);
buffer_copy(this, list, to, from, a.min(b) as usize);
}
}
#[cfg(not(windows))]
@@ -969,12 +983,20 @@ extern "system" fn copy_texture_region(
let Some(data) = buffer_range(src.resource, src.footprint.offset, bytes) else {
return;
};
let Some((buffer, staging)) = list.upload(host, bytes) else {
return;
let buffer = match list.place_source(data as usize, bytes as usize) {
// What shaders wrote to it, at this place of the list.
Some(buffer) => buffer,
None => {
let Some((buffer, staging)) = list.upload(host, bytes) else {
return;
};
// The list owns this mapped D3D12 upload buffer. Wine can
// report its address as MEM_FREE, so use the host-upload
// path.
list.defer_fill_buffer(&buffer, staging, data, bytes as usize);
buffer
}
};
// The list owns this mapped D3D12 upload buffer. Wine can report
// its address as MEM_FREE, so use the host-upload path.
list.defer_fill_buffer(&buffer, staging, data, bytes as usize);
from.resource = buffer.as_raw().cast_const().cast();
from.footprint.offset = 0;
#[cfg(feature = "diagnostics")]
@@ -1298,6 +1320,10 @@ extern "system" fn copy_memory(this: This, dst: u64, src: u64, len: u64, _flags:
&& src != 0
{
let len = len as usize;
if list.place_copy(dst as usize, src as usize, len) {
with_state(this, |_, state| state.copied());
return;
}
list.defer(move || {
if crate::texture::committed(src as *const u8, len)
&& crate::texture::committed(dst as *const u8, len)