[BUNDLE] Texture queue on resident mips + face network + Series S picture: #1031, #927, #188 on main, verified together #1052

Open
github-bot wants to merge 17 commits from github-bot/gh-1052 into main AGit
Owner

@⁠pepezin-ai on GitHub · 2026-11-25 17:36 UTC · original
pepezin-ai:bundle/textures-seriess → main · +2607 −158 · 25 files · 17 commits · open

What this is

A bundle of three open PRs on top of main @ ca8829f, tested together on an NVIDIA card. Nothing new in it except one conflict resolution:

  • #1031 (bound texture queue work, keep sampling on resident mips)
  • #927 (16-bit buffer accesses keep their bits: the face network, mouths move)
  • #188 (Series S: the second present plane and a plain stretch for the upscale dispatch)

#188 conflicts with main in crates/victory-gpu/src/host.rs: main split Host::present into a timing wrapper plus present_now (frame log), and #188 added an over: Option<(&ID3D12Resource, u32)> parameter. The resolution keeps both: present takes over, times the call and passes over on to present_now. The one other caller (the held-present path in queue.rs) passes None.

Measurements

Same machine, same save (the prison cell, right after the first prompt), same env as the author's frame-rate notes: VICTORY_INDIRECT_GATHER=1, VICTORY_CARD_REHASH_RUNS=1, VICTORY_TEXTURE_ROOM_PERCENT=96. fps is the host's own per-second line, only samples with more than 1,000 draws (in the world), average of the last third of each run.

Build Console fps in world (avg / last third / max) Textures picked by index still waiting at the end Picture
main ca8829f Series X 2.45 / 3.15 / 5.6 14,215 cell walls black, blocky patch in a corner, stair-stepped clothing edge
main ca8829f Series S n/a n/a black picture (only 4 to 18 draws a frame), audio plays
this bundle Series S 3.09 / 4.58 / 5.2 7,718 picture is back; lower detail, as expected from the S profile
this bundle Series X 3.13 / 3.58 / 4.5 10,706 faces and hair sharp in gameplay, the yard through the window complete; cell walls still dark and patchy

A note for whoever looks at texture room next

VICTORY_TEXTURE_ROOM_PERCENT=96 on its own did not change anything here: the card stayed at about 9.5 of 10.6 GB and the queue kept waiting. room() also counts targets_room_kept() (3,072 MB by default, VICTORY_CARD_ROOM_FOR_TARGETS_MB) and shadow::card_room_kept() as used, so on a 12 GB card the line is reached well before 96 % of the budget is actually filled. Not changed in this bundle; just what the logs show.

Machine

Ryzen 7 5700X 8C/16T, RTX 5070 12 GB, Windows 11. No game files, keys or captures of game content attached.

**@⁠pepezin-ai** on GitHub · 2026-11-25 17:36 UTC · [original](https://github.com/fxceless/victory-fork/pull/1052) `pepezin-ai:bundle/textures-seriess` → `main` · +2607 −158 · 25 files · 17 commits · open ## What this is A bundle of three open PRs on top of `main` @ ca8829f, tested together on an NVIDIA card. Nothing new in it except one conflict resolution: - #1031 (bound texture queue work, keep sampling on resident mips) - #927 (16-bit buffer accesses keep their bits: the face network, mouths move) - #188 (Series S: the second present plane and a plain stretch for the upscale dispatch) #188 conflicts with `main` in `crates/victory-gpu/src/host.rs`: `main` split `Host::present` into a timing wrapper plus `present_now` (frame log), and #188 added an `over: Option<(&ID3D12Resource, u32)>` parameter. The resolution keeps both: `present` takes `over`, times the call and passes `over` on to `present_now`. The one other caller (the held-present path in `queue.rs`) passes `None`. ## Measurements Same machine, same save (the prison cell, right after the first prompt), same env as the author's frame-rate notes: `VICTORY_INDIRECT_GATHER=1`, `VICTORY_CARD_REHASH_RUNS=1`, `VICTORY_TEXTURE_ROOM_PERCENT=96`. fps is the host's own per-second line, only samples with more than 1,000 draws (in the world), average of the last third of each run. | Build | Console | fps in world (avg / last third / max) | Textures picked by index still waiting at the end | Picture | |---|---|---|---|---| | `main` ca8829f | Series X | 2.45 / 3.15 / 5.6 | 14,215 | cell walls black, blocky patch in a corner, stair-stepped clothing edge | | `main` ca8829f | Series S | n/a | n/a | black picture (only 4 to 18 draws a frame), audio plays | | this bundle | Series S | 3.09 / 4.58 / 5.2 | 7,718 | picture is back; lower detail, as expected from the S profile | | this bundle | Series X | 3.13 / 3.58 / 4.5 | 10,706 | faces and hair sharp in gameplay, the yard through the window complete; cell walls still dark and patchy | ## A note for whoever looks at texture room next `VICTORY_TEXTURE_ROOM_PERCENT=96` on its own did not change anything here: the card stayed at about 9.5 of 10.6 GB and the queue kept waiting. `room()` also counts `targets_room_kept()` (3,072 MB by default, `VICTORY_CARD_ROOM_FOR_TARGETS_MB`) and `shadow::card_room_kept()` as used, so on a 12 GB card the line is reached well before 96 % of the budget is actually filled. Not changed in this bundle; just what the logs show. ## Machine Ryzen 7 5700X 8C/16T, RTX 5070 12 GB, Windows 11. No game files, keys or captures of game content attached.
No PC GPU renders to R9G9B9E5, so CreateRenderTargetView on such a
target removes the device. Add it to the existing stand-in table, next
to the 16-bit colour formats.

(cherry picked from commit 7dc19f21f1)
(cherry picked from commit 9ba864a83e)
Two passes of ours for the title's Series S mode, in a new module `over`.

A present there has two planes: the game image at 1920x1080 and the
interface at 3840x2160, empty texels zero with alpha zero. Only the first
plane's first resource was shown, so the window was black through the menus
and loading screens. The second plane (its description 0x48 bytes after the
first, laid out the same) is now drawn over the back buffer after the copy
of the first: one triangle, the plane sampled across the whole buffer,
blended by its alpha, taken as premultiplied.

`list::upscale_stretch` records, on a title list, a compute pass that writes
a texture from the bilinear samples of the top-left part of another, then
replays the list's state. It is what the upscale dispatch is given in place
of the console upscaler (next commit).

Measured on an RTX 3050 8 GB, Windows 11: with `--console series-s` the
menus and loading screens are visible at 30 fps where the window was black.
One plane behaves as before. No test yet; planes after the second and a
plane's placement parameters are not read.
In its Series S mode the title renders at 1280x720 and calls the console's
FidelityFX upscaler (`ffxDispatch` of amd_fidelityfx_loader_xbox.dll) to make
the 1920x1080 output. The loader and upscaler are the title's own DLLs and
run, but the upscaler's passes are compute pipelines in a container that is
not translated ("falling back to NewBE" in the title's log), so the output
was never written: the world was black behind the interface.

The executable's import of `ffxDispatch` is now bound to ours. An upscale
dispatch (type 0x10001, the public FidelityFX API's layout) is recorded as
`victory_gpu::list::upscale_stretch` of its colour input into its output;
any other dispatch, and an upscale that could not be stretched, goes to the
title's DLL. The DLL is not registered as an HLE module: that kept the
title's own from loading and left its other three entry points missing.

Measured on an RTX 3050 8 GB, Windows 11, release build, on top of the
R9G9B9E5 stand-in (#32): the Series S world renders (opening cutscene), 0.4
to 1.2 s a frame with peaks of 3 s, the card about a quarter busy, 7 GB of
video memory, no host error in a five-minute run. Series X is not affected
in the run made (it does not dispatch the upscaler).

Not done: temporal accumulation, sharpening, use of the depth and motion
inputs. No test yet. Only the opening cutscene was looked at.
What the review of #188 asked for.

- over.rs: the stretch's groups are 8 by 8 and reach past a target whose
  size is not a multiple of 8; the shader now reads the target's size and
  returns for texels outside it, instead of leaving them to out-of-bounds
  writes being dropped.
- ffx.rs: a dispatch that was neither stretched nor passed to the title's
  own DLL (none found) returned success with the output unwritten. It now
  returns FFX_API_RETURN_ERROR and says so once in the log.
- queue.rs: the choice of a present's second plane is a function of its own
  (`second_plane`), so it can be tested.
- over.rs: a stretch pass that could not be made is tried again at the next
  dispatch, as the pass over a present is; the two view rings say what their
  fixed sizes rest on.

Tests: the typed-format mapping and the stretch's bounds guard
(`over::tests`), the second plane's choice over seven cases
(`queue::plane_tests`), the upscale description's offsets and the
unanswered dispatch (`ffx::tests`).

`cargo test --release -p victory-gpu -p victory-hle`: 113 passed, 0 failed,
1 ignored; 97 passed, 0 failed; `no_dll_planting` 1 passed. One release run
with `--console series-s` on an RTX 3050 8 GB, about 3.5 minutes: both
passes fire, the world renders, no host error.
Under Wine / Proton the system compiler compiles a [RootSignature] attribute
without writing the signature into the shader, so CreateRootSignature on the
shader failed and both passes of over.rs were never made: Series S stayed
black there (reported on #188, Bazzite, RTX 5060 Laptop, vkd3d-proton).

The signatures are now built from descriptions and serialized with
D3D12SerializeRootSignature: a table of the plane and a bilinear sampler for
the pass over a present; four constants, a table of the source and the
target, and the sampler for the stretch. The sources no longer name one.

cargo test --release -p victory-gpu --lib: 114 passed, 0 failed, 1 ignored
(three runs; an earlier run of the whole test binary ended in an access
violation once and did not again). One release run with --console series-s
on an RTX 3050 8 GB, Windows 11, about 3 minutes: both passes fire, menus
and the world render, no host error. Not run under Wine here.
Run the real stretch and overlay passes on a 3 by 2 blue scene and a 5 by 3 synthetic overlay. Read back the output and check every texel for transparent, half-alpha and opaque regions. On the RTX 5060 Laptop under Proton the previous revision fails to record the stretch and the serialized-root revision passes.

Assisted-by: OpenAI Codex (GPT-6.2-Sol)
(cherry picked from commit 76687ee3b125e7b94bd9db12549fd36705e91023)
The title's colour can be the top left of a larger texture. The sampler clamps at the texture's edge, not at the rendered size's, so the last column and row took in texels beside it. The coordinate now stays half a texel inside the rendered size.

Reported with the fix and the measurement by ArturoWolff on #188; the readback test gets a padded source for it (red beside a blue 3 by 2 scene in a 4 by 3 texture: top right was (51,0,204), now blue).
The title keeps half floats, and indices beside them, in buffers it views
as R16G16B16A16_UINT and R16_UINT, and its programs move them with
buffer_load_format_d16_* and buffer_store_format_d16_*: on the console
each channel's 16 bits go as they are, whatever kind the view's format
is. The DXIL moved them by way of 32-bit floats (load as float,
legacyF32ToF16; legacyF16ToF32, store as float), which only a float view
carries. Through the integer view every value read came out 0.

The network that drives the faces (compute_graph_ops, about 2,650
dispatches a frame, then ped_standard_head_cs) works in such buffers: its
24 MB of tensors and its output were all zeros for whole runs, and no
character's mouth moved.

- victory-shader: such an access through a view of a table moves the 16
  bits as unsigned integers (bufferLoad.i32, bufferStore.i32), and
  HostShader::half_views names the table descriptors it is done through.
- victory-gpu: a table with a 16-bit float or signed buffer view at one
  of those places is made afresh for the draw, with that view in the
  unsigned format of the same layout (descriptor::host::half_view). The
  title's own slot keeps the title's format for other programs.

shortcut: through a view of wider, normalised or signed 8-bit channels,
whose values the console converts to and from halves, the integers are
read and written unconverted (logged once, with the format; the title's
are 16-bit unsigned). Views reached another way than through a table
keep the float path.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Review on #927 (avt0m4t48): half_views took the place from used_kind,
whose entry gives where a range of descriptors starts. With one entry for
a range from dword 0 and the load at byte 0x20, the place was dword 0 and
the host looked at the wrong slot for a 16-bit float view to show as its
unsigned twin.

The place is now the load's own (the traced offset in dwords plus the
first dword read), for a descriptor loaded from a fixed place in a table.
A descriptor picked at run time names nothing and keeps the float path:
its slot, and so its format, is known only then.

The title's 65 programs with d16 typed buffer accesses load all 231 of
their descriptors from fixed places, each at the start of its own entry,
so what they name is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review on #927 (avt0m4t48): a table made afresh because of a half view
took its span from the used-resource entries' starts and the slots picked
by index. With one entry for a range from dword 0 and the half view at
dword 8, the table took one dynamic slot; the next allocation got the
slot the shader reads that view from.

The table's half places are added to the selected slots, as the slots
picked by index are: the table reaches them and they are made readable
like the others. The title's d16 programs name each of their descriptors
with its own entry, so their tables are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The head program reads the face network's output with
buffer_load_format_x (not d16) and uses only the low 16 bits of each
result, as a half (v_fma_mix_f32 with sel_lo): on the console that
view is 16-bit unsigned and the load gives the zero-extended integer.
Lowered as a float load through the title's R16_UINT view it read
garbage once the network's output was no longer all zero (specks on
some faces with this branch).

Such a load now loads the unsigned integer and names its place for the
host, as d16 accesses do, where every access through that place moves
halves (d16, or a format load read only as halves) and the program
picks nothing from that table at run time. A place also read as
numbers keeps the float path. Uses are operand reads: a later write of
the register under EXEC reads the value only to keep it in the lanes
it leaves alone, and a phi carries it on (the head program's loads are
behind a branch).

In the title's shader pack 77 programs name half places: the 65 network
programs, the head program and 11 lighting and water compute programs
that read those views as halves alone. Without the two conditions the
rule named 724, among them hundreds of pixel programs that read one
value of a view as a half and the rest as numbers.

The helpers are in emit/halves.rs, a child module of the emitter like
intersect.rs (lower.rs would pass the repository's 512 KiB file limit).
Also puts used_kind's doc comment back above it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:56:42 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor.rs
  • crates/victory-gpu/src/descriptor/host.rs
  • crates/victory-gpu/src/draw.rs
  • crates/victory-gpu/src/tiles.rs
  • crates/victory-shader/src/emit/lower.rs
  • crates/victory-shader/src/emit/valu_tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1052/head:github-bot/gh-1052'
git switch 'github-bot/gh-1052'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1052'
git switch 'github-bot/gh-1052'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1052'
git switch 'github-bot/gh-1052'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1052'
git switch 'main'
git merge --squash 'github-bot/gh-1052'
git switch 'main'
git merge --ff-only 'github-bot/gh-1052'
git switch 'main'
git merge 'github-bot/gh-1052'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.