Commit Graph

731 Commits

Author SHA1 Message Date
ParantezTech 521360f04b [ShaderCompiler] Look up fused programs without the registry lock
Every shader header lookup and decode asked the fused-program registry under
its lock. The registry now publishes an immutable dictionary that readers
take with a volatile read, and a registration copies it under the lock.
2026-10-02 19:03:43 +03:00
ParantezTech 2a42567bcf [Gpu] Reuse image lookups that found the same backing
FindImage remembers, in a 256-slot table, each request that resolved to an
image with the same backing, keyed by the request bytes and a generation
that every index registration or removal advances. A repeated request
touches the image and returns the remembered result without walking the page
owner index. SHARPEMU_IMAGE_LOOKUP_MEMO=0 turns it off; [PERF][IMAGE_LOOKUP]
reports hits and misses.
2026-10-02 19:03:43 +03:00
ParantezTech f125d17510 [ShaderCompiler] Prefetch contiguous resource words in one resident read
Resource materialization read every descriptor and flattened-table word
through its own guarded TryReadGuestWord call, about 2.6 million per five
seconds in Demon's Souls. The raw reads of each plan are grouped once; at run
time their addresses are resolved, sorted and read as contiguous runs through
the resident guest reader, and the values seed the evaluator cache. A run the
GPU may still own, or one out of bounds or through a null base, falls back to
the word reads. The cache recorder records the prefetched words, and
SHARPEMU_RESOURCE_PREFETCH=0 turns the prefetch off.
2026-10-02 19:03:43 +03:00
ParantezTech 6277441eb3 [Gpu] Read GPU-written guest memory back asynchronously and ahead of time
VulkanAsyncReadback keeps eight slots: slot zero serves synchronous reads and
the others carry asynchronous downloads. A guest thread that reads GPU-written
memory lets the render thread start the copy and waits for it on its own
thread, then the render thread applies it if the range is unchanged; a
foreign read keeps the source buffer alive until it completes.

Windows the render thread had to read synchronously become hot. When a batch
writes into a hot window, the window is downloaded right after the batch is
submitted, and the next read uses that copy if it is still current. A pending
write to a hot window ends the open batch early. SHARPEMU_ASYNC_GUEST_READBACK=0
keeps the synchronous path; [PERF][ASYNC_READBACK] reports the counts.
2026-10-02 19:03:37 +03:00
ParantezTech 46a9dd223d [VideoOut] Read resource words through cached clean pages and the backing alias
TryReadGuestWord and TryReadResidentGuestBytes remember the last 64 pages
found free of GPU-dirty bytes, keyed by the GPU-modified version, and read
them through the backing alias inside the alias access window that each
command stream slice now holds. GPU-dirty checks are byte-precise, and a
resident read refuses unreadable ranges before it asks the page tracker.
2026-10-02 19:03:37 +03:00
ParantezTech afa7018e13 [ShaderCompiler] Keep recent materialization variants per draw key
A cache key now holds up to four materializations in most-recently-used order,
so alternating descriptor contents reuse their earlier result instead of
re-materializing. The cache report counts stale and unreadable entries and
table refreshes, and ReadingTable tells a reader when the flattened table is
being evaluated.
2026-10-02 19:03:37 +03:00
ParantezTech 64d885981a [Diagnostics] Trace shader resource reads that wait for GPU-written memory
SHARPEMU_TRACE_GPU_READS=1 writes the shader, stage, address and table phase
of a resource read that has to synchronize GPU-written memory, once per shader
and page.
2026-10-02 19:03:21 +03:00
ParantezTech 8324faed84 [HLE] Resolve backing aliases for readers that hold an access window
SharedBackingViews publishes its view snapshot as an alias identity, and a
reader can enter an alias access window once and resolve guest pages to their
backing alias without the views lock until the snapshot changes.
2026-10-02 18:48:24 +03:00
ParantezTech e47798a854 [Gpu] Turn AGC fill compute shaders into buffer fills
BoundedFillDetector recognizes the AGC range-fill and pattern-fill compute
programs, including thread-dimension dispatches, and a dispatch of one that
targets DCC metadata becomes a DCC fill instead of a compute dispatch.
Refused conversions are reported by the DCC writer trace.
2026-10-02 18:48:12 +03:00
ParantezTech 73eace56b0 [Gpu] Fill DCC metadata on the GPU and in guest memory at once
A fill that targets DCC metadata which no GPU write owns is recorded as a GPU
fill and also written to the guest backing directly, so the range never
becomes GPU-dirty and later CPU reads need no readback. Ranges the GPU still
owns or that overlap an image keep the plain buffer fill.
2026-10-02 18:48:11 +03:00
ParantezTech 42182ebcb8 [Diagnostics] Trace the GPU writers of DCC metadata and of a chosen address
SHARPEMU_TRACE_DCC_WRITERS=1 writes the shader program and a call stack for
GPU buffer writes that overlap DCC metadata; SHARPEMU_TRACE_WRITER_ADDRESS
does the same for writes that cover one guest address.
2026-10-02 18:48:02 +03:00
ParantezTech 792953c90b [Gpu] Track the extent of DCC metadata and answer overlap queries
A color target records the size of its DCC metadata, and the image cache can
tell whether a guest range overlaps registered DCC metadata.
2026-10-02 18:48:02 +03:00
ParantezTech 7085532257 [Gpu] Version the GPU-modified buffer ranges
A written range bumps GpuModifiedVersion only when it adds bytes to the
GPU-modified set, so readers can cache a clean verdict for a page until the
GPU writes something new.
2026-10-02 18:47:46 +03:00
ParantezTech 50bd6a9e11 [Gpu] Skip syncing a written buffer range that is already GPU-owned
SynchronizeBuffer returns early when a written range lies entirely in the
GPU-modified ranges, uses the lock-free CPU-dirty query for reads, and the
render profile splits buffer sync time into written, texel and upload parts.
2026-10-02 18:47:22 +03:00
ParantezTech f2d55afe69 [GpuMemory] Scan possibly CPU-dirty blocks 64 at a time
ForEachPossiblyCpuDirtyRange combined a region lookup and a summary read for
every 4 MiB block of mapped memory on each device-address sweep. A bitset of
blocks that have a region and the dirty summary words are now scanned a word
at a time, with the same runs as before.
2026-10-02 18:47:22 +03:00
ParantezTech 87c5195ba3 [Gpu] Skip the device-address sweep while no page became CPU-dirty
PrepareBda remembers the CPU-dirty epoch and the mapping it swept last and
skips the full sweep of mapped memory until either changes.
2026-10-02 18:47:15 +03:00
ParantezTech defa313acc [GpuMemory] Answer CPU-dirty range queries without the tracker lock
MayHaveCpuDirtyPages reads the per-block summary and the region masks without
taking the region lock; a true answer still goes through the locked path.
Regions also bump a CPU-dirty epoch whenever a page becomes CPU-dirty.
2026-10-02 18:47:15 +03:00
ParantezTech 9fa858a82a [Vk] Spin briefly before blocking on a GPU wait
A GPU wait polls the timeline for SHARPEMU_GPU_WAIT_SPIN_US microseconds
(150 by default) before it sleeps, which saves the wake-up latency when the
work completes soon.
2026-10-02 18:47:06 +03:00
ParantezTech 6fad30011b [HLE] Reserve a host core for the render thread
On Windows hosts with 8 to 64 logical processors the render thread gets the
last physical core of the fastest efficiency class at the highest priority,
and guest threads are kept off that core so spinning job workers cannot take
the renderer's SMT sibling. SHARPEMU_RENDER_CORE=0 turns it off.
2026-10-02 18:47:06 +03:00
ParantezTech 82be3a52bf [Vk] Measure GPU busy time from per-submission timestamps
Per-draw timestamps are written only with SHARPEMU_PROFILE_GPU_DRAWS=1; by
default each submission gets two timestamps and the overlapping intervals
are merged into a [PERF][GPU_BUSY] line with the busy share and the longest
submission.
2026-10-02 18:46:58 +03:00
kuba 6d138afb13 [Vulkan] Forget driver cache identities of destroyed shader modules
The remaining change of the updated #1006 head (e6659681) that the integration branch did not carry.
2026-10-02 14:22:25 +03:00
ParantezTech ef13f85f52 Merge xnetcat's integration of PRs #916-#1006 2026-10-02 14:21:19 +03:00
ParantezTech e7a4f0a0ce [Gpu] Expose HDR output support and handle PQ buffer attribute changes 2026-10-02 03:37:17 +03:00
ParantezTech f199acd42f [SharedBackingViewsTests] using await Task.WhenAll instead Task.WaitAll 2026-10-02 02:57:25 +03:00
Berk 5a3755fbdc
[GUI] revision of default settings (#1009)
* [GUI] revision of default settings

* [test] fix performance profile settings tests to use the new default values
2026-10-02 02:51:50 +03:00
Thegamerx808 8e1c6255b8
libSceFont: scale layout metrics with font size and accept layout pointer in rdx (#1008)
sceFontGetHorizontalLayout returned fixed 16px-era values regardless of
the scale set with sceFontSetScalePixel. Games that size their render
surfaces from the reported baseline (Astro Bot) ended up with surfaces too
short for the requested glyph size, so DrawGlyph cropped the bottom half of
every character. The layout values now derive from the font's current
pixel height, matching the ascent convention already used by glyph
metrics and the rasterizer.

Some callers pass the layout output pointer in rdx instead of rsi, which
the stub read exclusively, causing an INVALID_ARGUMENT return and Astro
Bot's own assert in FontSystem.cpp followed by the string being skipped
entirely. Fall back to rdx before failing.
2026-10-02 02:07:06 +03:00
ParantezTech e007d43181 [readme] update readme with new image 2026-10-01 21:44:07 +03:00
kuba 5b917072de Merge upstream main into combined integration
Preserve combined mip-tail refresh and export routing while taking upstream stencil and no-pixel-stage handling. Adapt upstream uint flags and wave64 exchange to per-register shader state; retain upstream LDS sizing and phase synchronization.
2026-10-01 20:36:38 +02:00
Berk 36acf4a40e
Des dcc fixes (#1000)
* [SpirvTranslator] Take high products from extended multiplies

Co-authored-by: TarkusR <90155059+TarkusR@users.noreply.github.com>

* [SpirvTranslator] Keep shader flags in uint variables

Co-authored-by: TarkusR <90155059+TarkusR@users.noreply.github.com>

* [SpirvTranslator] Synchronize shared memory phases in multi block shaders

Co-authored-by: TarkusR <90155059+TarkusR@users.noreply.github.com>

* [GPU] Merge device address ranges before buffers are bound

Co-authored-by: TarkusR <90155059+TarkusR@users.noreply.github.com>

* [GPU] Track per-slice guest DCC clear metadata

* [GPU] Materialize guest DCC clears in color and sampled images

* [GPU] Preserve color targets without pixel shader exports

* [ShaderCompiler] Track wave-indexed image descriptor waterfalls

* [ShaderCompiler] Analyze wave64 half masks and shared-memory hazards

* [ShaderCompiler] Pass guest LDS size to SPIR-V compilation

* [SpirvTranslator] Synchronize wave64 half masks through LDS exchange

---------

Co-authored-by: TarkusR <90155059+TarkusR@users.noreply.github.com>
2026-10-01 21:15:55 +03:00
kuba 01745089ee Merge content-addressed Vulkan driver caches 2026-10-01 18:31:19 +02:00
kuba b7a0ecadbe Merge bounded Vulkan descriptor scratch reuse 2026-10-01 18:31:18 +02:00
kuba 86f194c4fa Merge scalar graph interning and persistent analysis cache 2026-10-01 18:31:18 +02:00
kuba a89477adac [Tests] Keep presenter allocation fixture independent of diagnostics 2026-10-01 18:31:18 +02:00
kuba 8666442b9d Merge shader materialization allocation reductions 2026-10-01 18:31:18 +02:00
kuba cd15ee772b Merge bit-exact movie conversion vectorization 2026-10-01 18:31:18 +02:00
kuba a1f5e6ebef Merge safe fiber allocation reduction 2026-10-01 18:31:18 +02:00
kuba 68f31747c6 [Vulkan] Load content-addressed driver cache shards on demand 2026-10-01 18:31:03 +02:00
kuba 2c062f389b [ShaderCompiler] Bind cached graph payloads to their input keys 2026-10-01 18:29:09 +02:00
kuba 71b68bc755 [GPU] Remove duplicated image layouts from texture bindings 2026-10-01 18:29:09 +02:00
kuba d994ff4e34 [ShaderCompiler] Persist versioned scalar analysis across launches 2026-10-01 18:29:09 +02:00
kuba a721e38d34 [GPU] Reuse bounded descriptor preparation scratch arrays 2026-10-01 18:29:09 +02:00
kuba 3f6d3a15ef [Vulkan] Keep temporary descriptor writes off the managed heap 2026-10-01 18:29:09 +02:00
kuba efa2f549cb [Tests] Initialize presenter state for GPU binding validation 2026-10-01 18:29:09 +02:00
kuba 73afbd2015 [Shader] Reuse scratch storage for resource read recording 2026-10-01 18:28:48 +02:00
kuba 932ef17981 [Media] Vectorize movie YUV conversion without changing pixels 2026-10-01 18:28:48 +02:00
kuba 99a19fa2fa [ShaderCompiler] Intern scalar graphs without string keys or hit allocations 2026-10-01 18:28:48 +02:00
kuba 145d26b94c [Shader] Build materialization cache ranges without temporary copies 2026-10-01 18:28:48 +02:00
kuba dba1b202e3 [Fiber] Avoid formatting unused names and disabled traces 2026-10-01 18:28:10 +02:00
ParantezTech 658e839933 [readme] hi from astro-bot 2026-10-01 15:46:36 +03:00
ParantezTech 5d640293c2 [readme] added new screenshot 2026-10-01 14:23:10 +03:00