Commit Graph

20 Commits

Author SHA1 Message Date
DotDebian bf635fae68
feat(shader): implement image_bvh64_intersect_ray
MIMG 0xe7 is the node test of image_bvh_intersect_ray with a 64-bit node
pointer: the pointer takes the first two address dwords (low, high), so
the instruction addresses 12 dwords, or 9 with A16.

The node index and address are computed from the whole pointer. A zero
base in the T# is a null BVH only for the 32-bit form: with 64-bit
pointers the T# may cover all of memory from base 0 and the pointer then
carries the node address, so only the T# size bounds the node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 00:26:32 +00:00
Dean 07404b67e4
Merge pull request #581 from DotDebian/fix/mimg-a16-bias-dword
fix(shader): give the a16 bias of image samples its own address dword
2026-10-05 12:50:04 +13:00
DotDebian 7a4e1a2245 fix(shader): give the a16 bias of image samples its own address dword
With a16 the bias is a half that occupies a full address dword and the
coordinates start in the next one. The layout packed the first
coordinate into the upper half of the bias dword, so image_sample_b,
image_sample_b_cl, image_sample_b_o and the biased gathers read their
coordinates from the wrong halves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 01:30:17 +02:00
Dean d4c1bca1e1
Merge pull request #497 from adriadam10/feat/mimg-dlc
feat(shader): accept the dlc cache bit on MIMG
2026-10-05 12:09:53 +13:00
Dean 3fe90689ca
Merge pull request #562 from adriadam10/feat/image-atomics-float
feat(shader): implement image_atomic_fmin, fmax and fcmpswap
2026-10-05 11:44:47 +13:00
Adrià Franch d1f77107bc feat(shader): implement image_atomic_fmin, fmax and fcmpswap
The three MIMG float atomics threw as unknown opcodes. They now run as a
compare-and-swap loop on the 32-bit texel with the bit-level rules the
float buffer atomics already use (NaN, signed zero and sNaN quieting as
measured on RDNA2), so no float atomic feature is needed from the driver.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 23:01:27 +02:00
Adrià Franch 6dd5a61541 feat(shader): accept the dlc cache bit on MIMG
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 22:54:05 +02:00
Adrià Franch ef84d7bfa7 feat(shader): implement image_store_pck and image_store_mip_pck
Write the raw texel bits: dmask bit i selects texel dword i, taken from the
next data register, and every other dword of the texel is written as 0; the
descriptor swizzle is ignored (measured on RDNA2 hardware). Only formats whose
bits go through the storage view unchanged are accepted (unsigned integer
components, raw 32-bit signed integer and 32-bit float); normalized, 16-bit
float, narrow signed and 96-bit formats throw.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 22:46:58 +02:00
Adrià Franch e2ac1a6690 feat(shader): implement image_load_pck and image_load_mip_pck with signed variants
Return the raw texel bits: dmask bit i selects texel dword i, dwords past the
texel read 0 and the _sgn forms sign-extend texels narrower than 32 bits
(measured on RDNA2 hardware). Only formats whose bits are exactly recoverable
from the sampled view are accepted (unsigned/signed integer, unorm up to 16
bits, 32-bit float components), on a direct sampled image with identity
swizzle; anything else throws.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-04 22:32:13 +02:00
Dean ad473fa569
Merge pull request #389 from DotDebian/feat/mimg-sample-d-cl-o
feat(shader): decode image_sample_d_cl_o
2026-10-04 14:04:47 +13:00
Alexey 5335ce0316
Merge pull request #368 from DotDebian/feat/mimg-image-atomics
feat(shader): implement the missing integer image atomics
2026-10-03 11:02:17 +03:00
DotDebian b4506a359c feat(shader): decode image_sample_d_cl_o
MIMG opcode 0x33 samples with explicit derivatives, an LOD clamp and a
texel offset. The three address flags already exist; only the opcode was
missing from the decoder table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 19:07:30 +02:00
asimplestray f6e689de2f feat(shader): implement MIMG sample/gather flag variants 2026-10-02 15:59:39 +00:00
DotDebian de534fb927 feat(shader): implement the missing integer image atomics
Decode MIMG image_atomic_cmpswap, sub, smin, smax, inc and dec and
recompile them on the image texel pointer. sub, smin and smax map to
the SPIR-V atomic of the same name. cmpswap takes the new value from
VDATA[0] and the comparand from VDATA[1] (dmask 0x3) and returns the
previous value in VDATA[0]. inc and dec use the compare-exchange loop
of ds_inc/ds_dec, whose replacement helpers are now shared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 17:39:14 +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 9bb94163ea feat(shader): image_bvh_intersect_ray tests the ray against the BVH node
Every ray query returned a miss (a stub). The node test is now the GFX10
(RT IP 1.1) one AMD's GPURT software fallback defines (IntersectCommon.hlsl)
with the TriangleNode1_0 and BoxNode1_0 layouts, as SharpEmu ports it: the T#
(base, size, box grow and sort, triangle return mode) and the node pointer
are run-time values, triangle nodes return t over its denominator with the
barycentric numerators or the triangle id, float16/float32 box nodes the hit
children (clipped slabs, NaN misses, optionally sorted by entry time); an
inactive lane, a null BVH, an out-of-range node or another type returns four
invalid dwords.

The decoder addresses 11 dwords (8 with A16, the directions as halves), the
translation emits ImageBvhIntersectRay with the T#, MakeImageAddress and exec,
and the program takes the BDA path: one probe covers the node and direct loads
read it (a node the table does not map as one range records an Unmapped
fault); EmitBdaDwordReads can read every dword for the per-byte fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 21:22:22 +03:00
STL1te 8e6614500a feat(shader): MIMG UNORM, _a sample aliases, LOD clamp, VOP3 carry-in
- MIMG word0 bit 12 (UNORM) is accepted on every op without a sampler
  (compute image stores set it, as the ISA asks); sample and gather still
  reject it, and rejections name the instruction words.
- The image_sample_*_a opcodes keep the plain address layout, as in Kyty.
- The _cl LOD clamp becomes the MinLod image operand (or clamps an
  explicit level) on devices with shaderResourceMinLod; a gather with a
  clamp fails loudly.
- v_add_co_ci_u32, v_sub_co_ci_u32 and v_subrev_co_ci_u32 in VOP3 form
  take their carry-in from the SGPR pair of their third source, not VCC:
  a glyph upload's reciprocal division corrected its quotient on the
  wrong lanes and UI text came out stippled.
- Pixel exports follow each MRT slot's component mapping and write only
  the components of their export format (32_R, 32_GR, 32_AR).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 21:22:12 +03:00
OverkillLabs a1814def3b style: strip explanatory comments per CONVENTIONS.md
Comments in this codebase may only mark technical debt (human-added
only), the end of #endif, and the end of a namespace, per
docs/dev/CONVENTIONS.md. Remove the inline rationale comments added in
the AGC PM4 opcode and shader recompiler robustness commits; the code
itself, the commit history, and the PR description now carry that
context instead.

Notably, Command::WriteMemSemaphore takes the corrected 4-argument
form (address, waitForMailbox, signalType, operation): an earlier
revision of this helper used a different, incompatible argument
order. sceAgc*MemSemaphore callers derive waitForMailbox/signalType
from the low two bits of clientCode, and operation from action
(0 = signal, 1 = wait). This ABI note previously lived as an inline
comment; it is recorded here instead per the no-comments convention.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-29 04:20:09 +03:00
OverkillLabs cf202b352d Shader recompiler: SRT handle-invariance guard, BVH ray-query stub, rect-list interpolant truncation
- Optimization/SrtWalker/SrtPlanBuilder.cpp: PlanBuilder::Collect now requires
  RuntimeValidator(...).Run(inst) before folding an offset built from a Phi merging a
  constant on one path with a per-invocation value on another. Confirmed upstream's
  Collect is unchanged since the fork (still just offset->HasImmediate()), so a Phi
  that reports HasImmediate() on its constant edge alone could still be folded into
  the wrong, divergent SRT slot.
- RdnaDecoder + Translation: adds an IMAGE_BVH_INTERSECT_RAY (opcode 0xE6) decode path
  and a TranslationContext::imageBvhIntersectRay stub that reports a clean hardware
  miss (all result dwords 0xFFFFFFFF) instead of faulting on an undefined MIMG opcode.
  No BVH/ray-tracing support exists upstream at all, so this is an honest "not
  supported yet" stub, not a silent wrong answer.
- SpirvBackend/RectListShaders.cpp: raises the accepted spirvVersion ceiling to
  0x10500 and truncates excess fragment interpolants to the tightest per-vertex
  tessellation component limit instead of hard-refusing the whole rect-list draw.
  A rect-list draw is a tile clear, so a pixel shader's result comes from its
  constants and render target; truncated interpolants are simply left unwritten,
  which upstream's own "missing" (unexported) parameter handling already tolerates.

Dropped after checking against current upstream (both would be redundant or
out of scope):
- ResourcePlanKnownToFail / SpirvWords (Recompiler.cpp/hpp): upstream already has an
  equivalent mechanism for both. SourceEntry::planFailure (std::exception_ptr) already
  memoizes and rethrows a failed IrResourcePlan build, and RecompileResult::spirv is
  already the refcounted/hashed SharedSpirv class (see Recompiler.hpp), not a plain
  vector. Porting either would have added a second, competing mechanism.
- ScalarInstructions.cpp SAVEEXEC changes: skipped. The audit could only confirm 3 of
  6 64-bit SAVEEXEC cases were converted in the prior patch, which is a half-finished
  edit rather than a complete correctness fix; not safe to port without re-deriving
  sSaveexec()'s full semantics from scratch.
- ControlFlowInstructions.cpp vMovrelsB32/vMovreldB32 hardening (offset & 0xFF mask +
  kMaxM0RelativeWindow cap): skipped as optional per review; upstream's core fix for
  this file is otherwise already in place.
- All diagnostic-only stderr tracing (IrBuilderCore.cpp, ResourceTracker.cpp,
  ShaderInfoCollector.cpp, SrtDescriptorEvaluation.cpp, SrtEvaluator.cpp,
  SpirvMemoryInstructions.cpp) and the superseded Optimization/ResourceProgram.hpp
  API (replaced upstream by CaptureResources/SourceHandle/ResourceCapture): not
  ported, no functional change or already gone upstream.
2026-09-28 13:25:47 +03:00
boykopovar d084eed394 feat(shader): rdna memory op decoder impl 2026-09-15 07:07:50 +03:00
Renamed from core/shader/recompilier/RdnaDecoder/src/RdnaImageOpDecoder.cpp (Browse further)