No graphics object's interface list holds IUnknown, so QueryInterface
for it (and every call that hands out an object by interface id) said
E_NOINTERFACE and returned null. COM code asks for it to compare two
pointers for identity, to keep an object as a plain reference, or to
pass it on to an API that takes any object.
object::is, which all of those go through, now also matches IUnknown.
The DXGI device answers with the D3D12 device, which it already stands
for: one pointer whichever of the object's interfaces is asked.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
(cherry picked from commit 92f2c60c8159e34a47570aa81f3d25624cc6db5c)
The decoder fills an XMA voice's output ring until the write block
(word 0, bits 27-31) comes round to the title's read block (word 9,
bits 0-4). The write block wraps modulo the ring size (word 0, bits
22-26), and so does a read block moved on by command 18, but a read block
the title set up at or past the ring's end was compared as it was: no
write block ever equalled it. With a stream that loops forever the pass
never ended, holding that voice's lock, so the title's next command on
the voice (advance, disable) waited for good, and releasing the context
arrays did too.
Take the read block modulo the ring size as well, as the write side
already does. A test sets up read block 6 on a ring of four with an
endless loop and requires the pass to end within seconds, with blocks 0
and 1 filled.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 1054fe87de08038e887d6f7c6f44e5b07ac7a9f9)
Calls are filed by their block's address, and a call that succeeded with
a result stays filed until XAsyncGetResult takes it. XAsyncBegin refused
any block whose address had a call filed. So when a title never took a
result and freed the block, the next block it was given at that address
could not begin a call: E_INVALIDARG, every time, with the old call's
provider never cleaned up.
A zeroed block is a new one: the block of a result left behind holds the
result's size, so it never reads zero. XAsyncBegin now ends a finished
call filed under the address of a zeroed block (its provider gets its
cleanup) and begins the new one. A call still in flight keeps its
address, and a block still holding a result is refused as before.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
(cherry picked from commit 5cff0007a525b83f5c69912d7a38f53c6dafcfef)
Stack dumps (VICTORY_STACKS, diagnostics builds) read another thread's
TEB right after NtQueryInformationThread and suspended it only later: a
thread exiting in between frees its TEB, and the read faults. The
thread is now suspended first and resumed on every way out.
The dump times went through Duration::from_secs_f64, which panics on
`inf` or `1e20`, killing the dump thread (the crash hook logs it as a
crash). They are parsed by `schedule` now, which leaves out NaN and
times no Duration holds. 1 new test.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit acdcc41687be2ecd2bf2efc43ab7449329483382)
Based on #34 by ka1qux (commit faa0a9a), rebased over #45, which added the
same flag and register helpers for clwb loops; the duplicates are merged
into gpr/cmp_flags/CMP_FLAGS.
clzero: the two loops compilers build around it are done whole in one
exception, leaving registers and flags as the last pass would. Anything else
around it is one line and the next instruction.
rdpru: returns the time-stamp counter for MPERF and APERF, 0 for other
counters, and leaves the flags as they are: a Ryzen 7 5800X3D running it
natively in user mode changes none, for known counters or not.
Added over #34:
- loop 1 rejects cmp rax, rax (it fell into the loop and left wrong flags);
- tests that go through the emulation on any CPU (both loop shapes, the
rax-rax and wrong-neighbour fallbacks, rdpru with both flag states), since
on an AMD host the native tests never enter the handler.
(cherry picked from commit 0de9efced179dfb523748f21cf4bdbe0d3aa7533)
The source resolver's rule (local files only) knew a share as `\..`,
`//..` or `file://server/..`. The host knows more spellings: any two
leading separators (`/\server\share`), the object manager's prefix
(`\??\UNC\server\share`), and a `file:` URL with no host whose path
starts with two separators (`file:////server/share`,
`file:\server\share`, also percent-encoded). Those fell through as
relative paths or drive-less local files and went to the host's
resolver unchanged.
They are refused now, naming the server. Paths with one leading
separator, a drive after the slashes or the prefix, and the path of a
URL that names this machine pass as before.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
(cherry picked from commit 11ca3ce4928cf9ac2f77fcdc1c095d41c62fcbce)
When a frame ended a loop, decode cut it at the loop's end subframe, set
the loop's skip (the subframes of the loop's first frame that lie before
the loop) and then took that skip out of the frame in hand: the loop's
last. So the head of the last frame was dropped instead, and the first
frame played from its start, with the audio before the loop in it. The
number of samples came out the same; the seam did not.
The pending skip is still applied to the frame in hand, and the loop's
skip is set after it, for the frame decoded next.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
(cherry picked from commit 985d8d4b025384b5f13a3177ef906c8b6cce6840)
Decoder::decode took the caller's bit count as the end of the frame. Past
the data the bit reader returns zeros, and a stereo tile header reading
only zeros gives the subframe to no channel, so it never moves on; with a
count beyond the data it never overreads either, and looped for good.
Clamp the end to the bits the data holds. A frame from read_frame always
holds its bits, so its decoding does not change.
Add deterministic noise tests (xorshift64, fixed seeds, as BCPack's):
buffers of noise packets, streams of noise frames with clean and damaged
headers, frames in mono and stereo at each sample rate, bit counts past the
data, and read_frame and packet at any offset. Every walk is bounded and
every decode must give one frame of samples. The bit-count test hangs
without the fix; the others pass on main.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit d4d1822049fed053c6188ea0b016b0976a71bf41)
imdct_half worked out every pre- and post-rotation with sin_cos on each
call (n of them per subframe) and ran its FFT on two fresh Vecs. The
rotations, the bit-reversed order and the butterfly rotations now come
from a table built once for 128, 256 and 512 samples; the work buffers
live on the stack. Every value is computed with the same expression (the
butterflies with the same running product), so the output is bit for
bit what it was.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 4eb0898b3cbd6d0bbbffad540aca5d7e3531ac58)
`victory run GTA6.exe`, run from the game folder, gives an exe path with
an empty parent, and that empty folder was mounted as G:. An empty path
cannot be made absolute, so the root stayed empty and G:\x64\a.rpf
became \x64\a.rpf: the root of the current drive. The title then found
none of its files.
An empty root is now the current directory, which is what an empty
folder means everywhere else (`Path::new("").join("x")` is `x` in the
current directory). Passing a path with a folder in it is unaffected.
(cherry picked from commit 01ae55a3ba04c39a0e8851cc00da16af7a49adbd)
A callback submitted with a delay waited on a thread of its own and was
delivered when the delay ran out, whether or not the queue had been
terminated meanwhile. XTaskQueueTerminate only canceled what was already
in the ports, so a pending delayed callback was not canceled: it ran
later as live work (canceled = false), after the termination callback,
by which time a title may have freed what the callback uses.
The queue now keeps its delayed callbacks in a list until their delay
runs out. Terminate cancels them along with the queued ones, before it
calls the termination callback, and a delay that runs out after that
finds nothing to deliver. A submit racing Terminate checks `terminated`
under the list's lock, so the callback is either canceled or refused.
(cherry picked from commit b9ff219826e61ba6306f6a1378b613319f70da47)
Fail when a requested scan root cannot be opened. Report traversal errors below a readable root alongside the other skipped inputs.
(cherry picked from commit b1bdd8994a456755255b1e096f641ef47ff719c9)
Our own completions looked their call up again by block address: after a
provider's DoWork returned, after a cancel, after a failed begin, and when
queued DoWork ran. A provider usually ends its call itself (XAsyncComplete
from DoWork or Cancel), and once it has, the title may begin a new call on
the same block, from its completion routine or from a thread that polls
the status. The lookup then found that new call:
- the old call's DoWork result (S_OK, size 0) or cancel (E_ABORT) ended
the new call before it had done anything, ran its cleanup and fired the
completion routine a second time;
- DoWork still queued for a canceled call ran the new call's DoWork.
Each queued DoWork now carries the call that scheduled it and runs only
while that call is still the block's, and DoWork, cancel and begin
complete that call. A call that is already over ignores a second
complete, so nothing reaches the next call. XAsyncComplete itself still
goes by block, as providers name their call by its block.
(cherry picked from commit d01b17070dbf5f181e327ee540510cec73facbe9)
A frame that ends in a packet where no frame begins (the tail of a frame that crossed packets, then padding) left the next frame pointing into that padding, which ended the stream early. Now the next frame is found by following each packet's skip to the next packet with frames.
(cherry picked from commit ba42db643c15c1b7fb17ba40464dddda36c1db60)
mirror() previously dropped the SHADER_HEAPS lock inside shader_slot() before using the returned &Heap, allowing a concurrent Heap::drop to free the heap while mirror() accessed it. Also guards copy_simple() against invalid descriptor kinds, rejects placed heaps whose address+size wraps u64, and checks offset+count*bytes in resolve_queries() against overflow (with a regression test).
(cherry picked from commit 628b95da5e738046d00995743e07137e48936ba6)
Descriptor records the title copies as bytes are mirrored before each
submission. Views off their copy's elements: our rule (raw views too, and
now typed views on 16 bytes), the fork's copies. Wave sums of halves: ours
(the fork's test passes with it). Sizes of descriptors nothing uses: ours,
then the fork's for 2D images. The fork's count of cut indirect groups is
left out: up to WIDEST groups run as asked here.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With VICTORY_TEXTURE_NO_WAIT=1 a refresh that met the runtime remapping
title memory read the whole chain or nothing. A texture the title holds
only the smaller levels of is never all there, so nothing was read, and
the upload recorded before put the staging buffer's zeros over the
levels on the card. A staging buffer never filled now takes the pages
that are there; what was away for the moment of a change is read after
it, and a filling with less than was mapped makes the slots due again
(at most 8 times in a row). VICTORY_TEXTURE_FILL=0: as before.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Descriptor records the title copies into its heap as bytes are mirrored
before each submission (pull request #305 by Flyander, after upstream
VIctory 86a5ed6), with a per-slot fingerprint so only records that
changed are mirrored, the page read through the kernel, a switch
(VICTORY_HEAP_SYNC=0) and a counter: about 40,000 records a frame on the
test machine.
- A buffer view off its copy's elements gets a copy of its own bytes
(after upstream 86a5ed6; VICTORY_VIEW_OWN_COPY=0: refused as before).
- Room on the card for the world's first-frame bursts: buffer copies
(VICTORY_CARD_ROOM_FOR_BUFFERS, now on) and render targets
(VICTORY_CARD_ROOM_FOR_TARGETS_MB, 3,072); a copy turned down gives its
room up and is logged; the texture pass asks again every 32 MiB. 98
buffer copies made (945 MB) where earlier runs made 1; 25 MB compared
on the processor a frame where it was 550 to 710.
- Levels on demand: the fixes of pull request #747 by AscilCH. First run
on a card (RTX 4070, VICTORY_LEVELS_ON_DEMAND=1): no device loss, 3.1 GB
not allocated for levels the title does not hold. Still off by default.
- The guarded blocks under storage writes into physical pages are opened
by default (VICTORY_PAGE_WRITES=0: counted only).
- Shaders: a program is translated with first-half interpolation pairs
only if it was refused for one (with it on for every program 8,551
working pixel programs came out changed); parked lane-mask pairs,
f64 conversions and sums, lane permutations: 14 more programs translate.
- Counted, not fixed: an indirect compute pass asks for about 77,500
groups in x and is cut to 65,535.
One five-minute game run of these changes on the test machine: no device
loss, no failed request. This merged tree was built; its test suites
were not run.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The fork's guard over every view of a physical page is kept on our own block
bits, known holes, kernel writes and changing blocks; what both had, ours.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A view D3D12 cannot place (a raw view off 16 bytes, a structured one off
16 and off its stride, a typed one off its element) was null, and the
shader read zeros: the colour-table bakes' parameter blocks are raw views
at byte 8. Such a view now gets a copy of its own bytes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b2a3ce9ced69e669d2d56e20c2dca7011b7e405a)
A shader that walks a structure takes its address out of the structure's
descriptor. The view has no resource, so the address came out 0 and every
ray missed. Also: only programs that store by raw address declare the
copies they reach that way as written.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The console's syncs recorded nothing on the host, which orders nothing
between dispatches by itself. The ray-tracing structure builder has no
other wait between its stages.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
On by default. Sends to card copies were copies out of their CPU sides made
when the card came to them, and later submissions had written those by then:
of three submissions that each copy a value to the same bytes and read them,
all read the last one's (test: 12 of 12 wrong). The bytes are taken into
memory of the submission's own at preparing; short runs go as one scatter per
copy. Title buffer copies go up whether our side changed or not.
VICTORY_CARD_ALL=1 (off): every title buffer's copy has two sides, so that
this holds for the small ones too (they are written in place now, under the
submissions in the air). VICTORY_PICKED_WRITES: 1 declares, 2 lands too.
The check (VICTORY_UPCOPY_CHECK): what a submission took twice is no longer
counted as older values sent; copies of the title's out of their place in a
submission; copies held for unchanged that are not title memory's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title's tile lists are dispatches of a group per tile: in the captured frame 2dc364df5d3278b8 asks for 67,440 groups (the one before it 67,272) and 940c2635dc1312f4 for 47,760, the 115,200 tiles of 2560x1440. The clamp cut the first to 65,535: 1,905 tiles at the list's end, the lowest of the picture, did not run. Up to 2^20 groups run as asked on AMD cards (a test on the card: every group once, under its number); more still runs 65,535.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b856c46dd10bbb550157b255d113a3cca2f3f38a)
The scan was cut to the heap's length, which left out the slots past the
cursor a run that crosses it needs; upstream's corrected test (072fde0).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
After each command that can change a texture, the texel under a point of
the picture is copied out; commands that changed one are named with their
pipeline and the values before and after. The listing names textures.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Blocks the kernel writes, or the runtime is unmapping, are no known holes
and not published; foreign blocks are never held; freed memory forgets its
known holes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pass that uploads textures picked by index asked the host for every
64 KiB of every texture it looked at, and twice for each block that was not
there (12,000 slots wait for their memory during a load, each looked at
again and again): 146 us for a texture of 22 MB, 721 us with 1 MB of it
there. The views of physical pages are known: 1.4 and 0.1 us. Memory that
is in no view is asked of the host as before. VICTORY_MAPPED_BY_VIEWS=0:
always. Measurement: cargo test --release -p victory-gpu --lib look_costs
-- --ignored --nocapture
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Memory sync:
- The guard over every view of a physical page (code by myokex, victory-amd
c6dc4d8, after pull request #115 by Spexivus, its correction by joroyt and
a part of VIctory #1122 by tightfall): the title shows one page at several
addresses and a copy was guarded at one only. 0.8 to 1.0 million writes
through another view in a five-minute run on the test machine.
VICTORY_VIEW_GUARD=0 turns it off.
- Kernel reads into title memory are read beside and copied in (Joshua Odom,
10ea38e).
- Writes of the storage layer into physical pages are counted where the
title has the pages mapped and can open the guards there
(VICTORY_PAGE_WRITES, off: counted only). Failed page-destination reads
are retried.
Card memory:
- Levels on demand, off unless VICTORY_LEVELS_ON_DEMAND=1: a texture the
title fills takes card memory for the levels the title holds; held levels
get memory only while the card has room and are asked for again. Its test
runs on the software adapter; not run on a card yet.
- Refused texture slots are held back so a pass reaches the slots behind
them; room can be kept for card copies of title buffers (off).
Tools: translate --warm all; the shader cache is keyed on the translator's
source; counters for copy-back races, page writes and the copies the
texture sweep never lets go; a walls trace.
Game runs of these changes on an RTX 4070: five five-minute runs without a
device loss or a failed request. This merged tree was built; its test
suites were run on the tree the changes come from (gpu 129, hle 97).
Co-Authored-By: Claude Fable 5.2 <[email protected]>
- All 24 workers read each file through one handle, whose reads the host
does one after the other: 48 KiB at random from levels.rpf gave 185 MB/s
where a handle per worker gives 990 (5 GB/s against 14 from the cache).
VICTORY_DSTORAGE_IO=one|handles|overlapped|direct (handles).
- xmem: the title's pages by number, and where it sees them, each have a
lock of their own, apart from the one its mapping calls hold while the
host maps, commits and unmaps. Looking pages up, filling one and telling
of it, 24 threads beside one that maps: 2.7 million requests a second
for 0.57, 145,000 maps a second for 60,000. A view is noted before the
GPU side is told of it, so that a write between the two is not missed.
- Title memory is not touched with these locks held.
Benchmarks: read_bench (VICTORY_BENCH_FILE), map_bench, both ignored.
Co-Authored-By: Claude Opus 5.5 <[email protected]>