Commit Graph

10 Commits

Author SHA1 Message Date
Celegans12 619ec7ad39 feat(agc): accept samplers that force sRGB decoding of sRGB textures
A sampler with FORCE_DEGAMMA (S# word 0 bit 20) threw at decode, so
every dispatch or draw sampling through one was skipped.

DecodeSamplerResource now records the bit, but accepts it only for a
caller that pairs the sampler with its images. The direct sampler
binding does, and RequireDegammaFormat checks each sampled image
against its paired samplers: only already sRGB formats (8, 8_8 and
8_8_8_8 SRGB, BC1, BC2, BC3 and BC7 SRGB) pass, decoded once, as
shadPS4 (PS4) models it. Other textures and unpaired decodes still
throw; gfx10 behaviour is not measured.
2026-10-10 01:38:17 +02:00
Celegans12 1afcd20281 feat(agc): implement min and max sampler reduction modes
An S# with FILTER_MODE (word0 bits 29-30) set threw in
DecodeSamplerResource. Modes 1 and 2 now map to Vulkan's MIN and MAX
sampler reduction through VK_EXT_sampler_filter_minmax, which the device
enables when it reports both filterMinmax properties; mode 3 throws.

Min/max still throws with anisotropy, a linear mip filter (lavapipe and
NVIDIA disagree there), depth comparison, color-texture compare
emulation, and, in PointFilteredSamplerWord (S# words 0 and 2), when it
filters between texels or mips of an image the recompiler point-samples.
A texture sampled through a linear min/max sampler needs
SAMPLED_IMAGE_FILTER_MINMAX on its view format; the image-sampler pairs
travel in DescriptorBinding::imageSamplers (shader disk cache format 5).

Adds the agc_driver_image_sample_reduction GPU test and extends the
sampler, emulated color compare and disk cache tests.
2026-10-07 09:04:26 +02:00
Adrià 8a126b7b88
Merge pull request #799 from Celegans12/feat/agc-unnormalized-sampler-coordinates
feat(agc): implement unnormalized sampler coordinates on single-level 1D and 2D views
2026-10-07 08:50:16 +02:00
Akhil Moola ad56d004f2 fix(agc): accept a border colour table that no address mode reads
A sampler descriptor with BORDER_COLOR_TYPE 3 names an entry of the border
colour table, but the hardware reads it only through an axis that addresses
the border (clamp modes 4 to 7). DecodeSamplerResource threw for every
table border colour, so a sampler that clamps to the edge on all axes, as
PPSA21567's Armadillo Challenge 2 compute shader uses, stopped the title
although its border colour is never sampled. It now throws only when an
axis uses a border mode, the same rule the colour compare emulation
applies, and otherwise uses a fixed Vulkan border colour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 12:49:24 -06:00
Celegans12 76ddd9b6d4 feat(agc): implement unnormalized sampler coordinates on single-level 1D and 2D views
An S# with FORCE_UNNORMALIZED threw in DecodeSamplerResource. It is now
bound through a Vulkan sampler with unnormalizedCoordinates when every
use stays where the S# and the host select the same texels.

ShaderInfoCollector records the live uses of each sampler after Apply
and dead-code elimination, and the emitter shares its explicit-LOD
predicate. Populate flags a direct S# with the bit that only explicit-LOD
image_sample without offset, comparison, derivatives or _a uses, paired
only with direct 1D or 2D images without a format conversion; anything
else throws. The driver checks the S# filters, clamps, TRUNC_COORD and
MC_COORD_TRUNC, creates the sampler with nearest mips and a zero LOD
range, and requires a single-level, single-layer 1D or 2D view of mip 0.
The shader disk cache format becomes 5.
2026-10-06 07:36:30 +02:00
STL1te 6b36c050fe style: drop the branch's code comments per CONVENTIONS.md
Only the lines this branch added lose their comments; the commits before
keep them, with the reasoning behind each change, for whoever digs into
that code later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 21:25:29 +03:00
STL1te c8913314bc test(agc-driver): the graphics and BDA device tests link and run to the end
Both suites stopped at their first stale expectation, so nothing after
it ran; the BDA device tests did not link.

- the BDA device tests define the one recorder entry Resources.cpp
  reaches (no recorder) and fail loudly on the others
- Buffer::Invalidate refuses memory that is not host mapped again (lost
  in 8a69fef); the device tests expect it for a device-local buffer
- APS5_PIN_WAIT_MS (60000 by default, unchanged) bounds the wait before
  a mutation of a leased range is refused, and the refusal names it; the
  graphics tests set 200 ms, as they expect about a dozen refusals
- the expectations follow the behaviour the code chose since: a buffer's
  four-DWORD V# is refused as a T#, a sampler exceeds the mock's zero
  sampler slots, a V# at unmapped memory binds its committed pages only,
  a rect-list fragment input without a vertex export reads as zero,
  detiled rows span the padded block width, mip ranges are checked in
  address order, block-compressed and 128/129/132 formats use render
  target tiling, an XOR swizzle is refused only over a base that is not
  64 KiB aligned, DCC and partial mip chain views decode, a cube reads as
  a 2D array, the sampler fixture's max LOD fits the 4.8 field, a BDA
  program with barriers is accepted, a tessellation control stage is
  refused, a corrupt request fails on its signature and a newer one on
  its version
- the DCC comment in the texture decoder no longer claims metadata
  compression is refused

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 21:22:23 +03:00
devilismyfriend 8a69fefe13 perf(agc): batch GPU work in a recorder with host-imported guest memory
Replaces the synchronous per-command execution model, and with it the
upstream render-target, pipeline-cache, tile-buffer, batched-draw and
memory-ownership commits (5a280ce, 7ed5a0b, 46c799d, 598caac, 40df528),
whose files are removed.

- Recorder: one open command buffer per device; dispatches, resident
  draws, uploads, write-backs, labels, fills and copies record into it;
  timeline-semaphore serials let drains wait without the GPU mutex;
  completions run in order at reap.
- one worker thread per PM4 queue; labels and stores written by the GPU
  into the host import; GPU-side DISPATCH_INDIRECT; the buffer-fill
  kernel replaced by vkCmdFillBuffer; a dispatch cache validated by
  write watch; filler packets tolerated; rejected submissions dumped.
- guest memory: page-state cache, 64 KiB write generations, host imports
  with VK_EXT_external_memory_host, persistent mirrors of the executable
  image, GPU copies of misaligned sub-ranges.
- textures: shader-written images stay resident with deferred
  write-back (adjacent-generation rule for packed video planes), sampled
  views of storage images, DCC key handling, addrlib swizzle equations,
  bidirectional detiler.
- draws: MRT, more formats, dynamic viewport/scissor, cached pipelines,
  resident 64 KiB targets, draws recorded into the recorder.
- ShaderResources: two-stage build, descriptor and sampler caches, a
  content-keyed resource cache; presentation from the resident image.
- a label deferred behind a completion is no longer re-stored by the
  CPU at reap time unless a write-back overwrote it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0177gthrWEBBfBu5xJDXgBfo
2026-09-25 16:27:49 -07:00
boykopovar 0b3ffe47b0 fix(shader): distinguish descriptor resources by register 2026-09-23 12:20:33 +03:00
boykopovar b521e1f811 test(agc): add texture resource and detiling coverage 2026-09-23 10:57:27 +03:00