Repository navigation
Conversation
…ile shader The mode is compiled in only with BYTE_OUTPUT: it adds the original buffer binding, a specialization constant and the base offset of the original in the push constants. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
…changed-only detile mode In the byte-output variant copyElement compares each byte of an element with the original and writes only the ones that changed. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
The same source is compiled a second time with BYTE_OUTPUT and embedded as TEXTURE_DETILE_CHANGED_SPV. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
A changed-only dispatch binds source, destination and original. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
The descriptor set layout can hold the original buffer and the push constants carry its base offset; ordinary dispatches still create their sets with two bindings. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
pipeline() takes a changedOnly flag, which selects the byte-output module, its own specialization and its own cache key. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
Dispatch takes the offset of the original bytes; a non-zero offset selects the changed-only variant and sizes the original range like the source range. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
…ly detile The descriptor update writes the third binding and the push constants carry originalBase. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
The detiler test checks that an ordinary detile has no baseline, that a changed-only dispatch binds the original with a sub-word offset, reuses one pipeline across baseline offsets and that ordinary retiling afterwards is unchanged. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
PrepareLinearDraw and FinishLinearDraw, and the buffer a linear draw keeps its original bytes in. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
PrepareLinearDraw writes back and flushes what is pending, uploads the target, then copies the image into a buffer that holds the bytes the draw started from next to a baseline copy; the recorder keeps the buffer and counts its bytes. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
FinishLinearDraw flushes the target's pending store and drops the snapshot once no layer is pending. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
…ass starts recordDraw calls PrepareLinearDraw for every target, ahead of StartDrawPass. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com> Ported onto main: main added the indexInputBehindGpuWrite argument to StartDrawPass, so the snapshot loop was placed before that call and the call keeps main's arguments.
recordPreparedDraw does the same for the targets it binds when the draw is recorded. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
The completion store of a drawn linear target goes through FinishLinearDraw. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
Write-back compares the 64 KiB blocks written since the draw's snapshot and leaves the ones the CPU changed. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com> Ported onto main: main renamed the per-target tracked flag to layerTracked, so the new block and the unknown check use layerTracked.
A write-back that used the draw's snapshot publishes the whole shadow, not the partial units. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
The write-back detiles into the buffer the draw started from instead of a new one and keeps it with its size. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
…napshot With a snapshot the write-back runs the changed-only detile against the draw's original bytes and no longer copies the tiled scratch over the import. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com> Ported onto main: main moved the direct host-import retile into its own branch, so the snapshot retile runs only in the scratch branch (else). The import-retile gate also skips snapshot targets, as the PR's own version did, so they never take the direct whole-layer import.
A copy of the destination is taken before the store and the bytes the write-back did not change are put back, so concurrent CPU bytes survive. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
…napshot main stores a drawn linear target through storeDrawnRect, which copies the whole drawn rectangle over the import and so overwrites the bytes of channels the draw masked out that the CPU wrote since. A target with a draw snapshot already stores only the bytes that changed, so writeBackLayers takes the rectangle path only when there is no snapshot. Ported onto main: main renamed the tracked flag to layerTracked, so the condition keeps layerTracked where the PR used tracked.
Resources, the detiler and the standard headers it now uses. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
…rget A left-half geometry and a program whose blue constant can be chosen. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
…k and vertices The draw helper can halve the destination with blending, restrict the color write mask and the scissor, and take its own vertices. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
…in the resident test The resident test gets a Coverage mode, the APS5_NO_RESIDENT_LINEAR flag, checks of queued and cached draws and of the bytes a draw leaves alone, a CPU snapshot check, a changed-only retile check and a --recipe mode that replays the draw through a draw recipe. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
agc_driver_linear_target_recipe runs agc_driver_linear_target_resident_tests --recipe. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
Draws into a linear target while the CPU writes other bytes of it and checks that the CPU's bytes are kept. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
Six cases (mask, geometry, reader, eviction, alias, same) check what a resident linear target publishes after a draw; registered per case. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
A CPU-write regression with two switches, APS5_LINEAR_SAME_OUTPUT and APS5_LINEAR_SEED_LEFT, and a seeded registration; the switches are documented in ENVIRONMENT.md. Co-authored-by: Rajveer Shekhawat <rajveershekhawat626@gmail.com> Co-authored-by: embersas <30363137+embersas@users.noreply.github.com>
…he whole target The write-back of the previous draw leaves the image current, so the forced whole-surface upload before every recorded draw copied bytes the image already held. Refresh uploads only the layers whose guest memory changed since the image was last current, which includes the CPU's writes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes boykopovar#8152: a later write-back from a recorded linear-target draw could overwrite CPU stores made after
Drawreturned.This PR uses the coordinated implementation authored by Rajveer Shekhawat (two commits) and the concurrent-byte correction authored by embersas. The original three commits were split into a series of smaller ones, so each commit derived from their work carries
Co-authored-bytrailers for both; the drawn-rectangle fix (leave the drawn-rectangle store to targets without a draw snapshot) and the finalRefresh()commit are mine and carry none. It snapshots the resident image around a recorded linear draw and merges changed bytes through the linear detiler so untouched guest bytes and CPU writes survive. The regression coverage includes seeded and unseeded partial draws, masked channels, partial geometry, later blending, queued overlapping draws, cached-recipe replay and GPU detiles for supported element widths.This is separate from boykopovar#1191's resident-target performance path and boykopovar#7154's depth-plane buffer coherence. It does not depend on either PR.
Tested
Current head
db12f5d6fb(30 commits, rebased ontomain3fea2a937b):agc_driver_linear_target_*tests plusagc_driver_graphics: 22 pass and 2 skip on lavapipe (direct_write_completion,import_creation). WithANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationthere are 0VUID-lines (the layer is inserted at instance and device level). The same run onmainis not posted yet.main, flat in the number of draws and targets (one live snapshot per draw). Per-draw cost was measured only with the guest memory not write-watched (kernel 6.1, no write watch), where the target is compared or uploaded whole: about 44 ms onmainand 74 to 99 ms with this PR depending on whether the CPU writes before each draw. No number from a write-watched host and notools/trace_digest.pysummary are available yet. Details are in the comments below.python3 tools/check_conventions.py --base upstream/mainandgit diff --checkpass.Earlier reports, on older heads and not repeated on this one:
e5b9ac546against base3fd1cc393, the author reports 36/36 fresh focused runs passed on NVIDIA RTX 5070 (driver 617.42) and AMD Radeon(TM) Graphics (driver 32.0.21030.2001), Windows 11 Pro 26200, GCC 15.2 Release with SPIRV-Tools and Khronos validation/synchronization validation enabled, with no new VUIDs or validation warnings, and 118/118 common selected tests per GPU on both base and change.fea0c0cd8a2e8f85454e0d4b5b917915e0e3035b), 15/15 focused tests and 20/20 repeated key-case executions on a Windows 11 RTX 4070 Laptop, NVIDIA 592.82, with Khronos synchronization validation. The concurrent regression recorded 5,668 lost CPU updates on the then-current head and the original unseeded control onmainlost 7,680 of 8,192 CPU-written bytes; the corrected cases passed 20/20 repeats with zero lost updates.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)e5b9ac546); NVIDIA RTX 4070 Laptop / driver 592.82 on Windows 11 Pro (reported by Embersas on an older correction tree)