Commit Graph
10208 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5.5 763bcde73e Sample the last texel where the projected q isn't positive
The GE doesn't divide by a q <= 0: it samples the last texel in u and v,
whatever s and t are, in clamp and repeat modes alike (gpu/texmtx/negq). The
hardware backends divided, which mirrors a projected texture behind its
projector: Fate/Extra's character shadows ran up the school's walls (#18667).
The software renderer sampled (0, 0) instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 01:04:23 +02:00
Henrik RydgårdandClaude Opus 5.5 b9b1a29c42 Read CLUT8 from 16-bit framebuffers in the shader, replacing the SOCOM hack
The shader depal CLUT8 mode now handles 565, 5551 and 4444 framebuffers
(the format goes in the depal format bits, which this mode didn't fill
before), rebuilding the 16-bit pixel and taking its low or high byte.
This replaces SOCOMClut8Replacement, which assumed the high byte.

- The GE samples a pixel at its corner, the GPU at its center. With u
  stepping two bytes per pixel (SOCOM and Bend's games use u = 1 + 2x)
  that's a whole byte, so the shader steps back to the corner.
- The CLUT index shift, mask and start are applied, as in the other
  depal modes.
- The self-render copy region counted CLUT8's U in pixels, not bytes.

SOCOM, Star Wars: The Force Unleashed and the NPJG90068 dumps improve a
lot. Syphon Filter and Resistance: Retribution now read the right bytes,
which exposes a 16-bit precision difference in their bright pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 01:04:23 +02:00
Henrik RydgårdandClaude Opus 5.5 8a852ec47c Fix the Burnout Dominator lens flare at even render scales
The flare's occlusion result is rendered into every other 16-bit pixel of a
palette whose other half is uploaded from memory, then read back as a CLUT.
Two things broke it at 2x:

- The CLUT8-from-8888 shader depal picked the byte out of each pixel using
  the scaled texture size, so at 2x it read the wrong byte. It now works in
  PSP units (from u_texclamp, which it now always gets) and samples the
  pixel's center, not its edge, which is a render pixel boundary when
  scaled.
- The palette upload was linearly filtered when stretched, blending each
  16-bit half with its neighbour. Burnout Dominator joins Ridge Racer in
  NearestFilteringOnFramebufferCreate.

1x and 3x only worked because their sample points happened to land inside
the right texels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 01:04:23 +02:00
Henrik RydgårdandClaude Opus 5.5 b28d70c6fe Fix the SOCOM CLUT8-from-5551 depal: index and texture width
The float depal shader built the index as a * 128 + b * 64, but the byte the
GE reads is the pixel's high byte, a << 7 | b << 2 | g >> 3, so the glow came
out about a third as strong as on the PSP.

The depal pass also reset curTextureWidth to the buffer width, undoing the
doubled width that U (which counts bytes) needs. Each 240-pixel strip then
sampled the whole framebuffer squashed in half, leaving a ghost and a seam
down the middle. The crop bounds mixed bytes and pixels the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 01:04:23 +02:00
Henrik RydgårdandClaude Opus 5.5 b28a975d88 Update the mip bias uniforms when only the bias changes
DIRTY_MIPBIAS wasn't part of DIRTY_BASE_UNIFORMS, so on Vulkan and D3D11 a
new bias (u_mipBias for 3D textures, u_texLodBias since the last commit)
only reached the shader along with some other base uniform. The fast prim
loop also changed texlevel in auto mode without dirtying it. Fixes the F1
Grand Prix railings on Vulkan, where the texture was drawn from the
smallest mip level.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 01:04:23 +02:00
Henrik RydgårdandClaude Opus 5.5 1fe8071875 Vulkan: Apply the texture LOD bias in the shader where samplers ignore it
MoltenVK doesn't support a sampler mipLodBias (the portability subset's
samplerMipLodBias is false), so the PSP's LOD bias did nothing on Mac and
iOS, and biased textures came out a mip level blurrier than on OpenGL and
the PSP: MLB's signs and crowd, Burnout Legends, MediEvil, Ridge Racer 2.
Query the portability subset, and where the bias is missing, pass the auto
mode bias to texture() from a uniform instead.

VK_ENABLE_BETA_EXTENSIONS, which declares the portability subset, is now
defined for App Store iOS builds too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 01:04:23 +02:00
Henrik Rydgård 0ac523c4b5 Merge pull request #22475 from hrydgard/cars-brightness
Tantalus games: Fix brightness, fix vertical stripes
2026-10-09 19:22:00 +02:00
Henrik Rydgård 1e532014e5 Merge pull request #22481 from hrydgard/vulkan-fixed-blend-precision
Vulkan: Fix the new more exact blend to use the best available precision
2026-10-09 19:17:14 +02:00
Henrik Rydgård 324e6c3954 Merge pull request #22476 from hrydgard/community-security-fixes
Two security fixes by acts-1631, and more found by Claude
2026-10-09 18:55:57 +02:00
Henrik Rydgård 8218e0b210 Merge pull request #22479 from hrydgard/record-dirty-blocks
GE dump recording: Track every VRAM block a range touches
2026-10-09 18:54:23 +02:00
Henrik RydgårdandClaude Opus 5.5 ce310e69a6 Keep the GE-exact FIXA/FIXB blend within fp16's range
Compute the product as (c+0.5) * (2f+1)/512, which is still exact in fp32, and
use mediump where highp isn't available instead of falling back to the old
blend. Simulated over all inputs, about 3% of fp16 results come out a level
too bright, against nearly half with the plain blend factors. With mediump
forced on NVIDIA's Vulkan driver (which runs it as fp16), the Split/Second
bloom dumps land within 2% of the highp result.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 18:50:22 +02:00
Henrik RydgårdandClaude Opus 5.5 b882155d23 Only use the GE-exact FIXA/FIXB blend with highp in the fragment shader
Old GLES devices without highp fragment floats get the previous plain multiply.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 18:43:26 +02:00
Henrik RydgårdandClaude Opus 5.5 f35ddce87f Vulkan: Do the GE-exact FIXA/FIXB blend math in highp
The fragment shader's default precision is lowp, which NVIDIA's Vulkan driver
runs as fp16, and the product (2c+1)(2f+1) reaches 511*511, past fp16's range.
Split/Second's bloom saturated whole channels; its two bloom dumps go from MSE
2354/9305 to 80/153, the same as OpenGL.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 18:43:26 +02:00
Henrik Rydgård b0ea555b79 Fix a couple of problems with recent commits in MSVC debug builds 2026-10-09 17:52:55 +02:00
Henrik RydgårdandClaude Opus 5.5 0c9f9c05a8 GE dump recording: Track every VRAM block a range touches
Both DirtyVRAM and GetTargetFlags counted blocks from the size alone, so a
range starting partway into a block missed its last block: a write there didn't
mark it dirty, and a snapshot didn't check it. And GetTargetFlags marked the
partly covered last block clean, since its `i < blocks` was always true. Either
way a later snapshot could be flagged unchanged while the dump didn't have the
data. Memcpy and memset also marked partly covered blocks clean.

Checked against the recorder's own copy of what the dump delivered: recording
from savestates, 4511 of Cars Race-O-Rama's unchanged snapshots and 103 of MX
vs ATV Reflex's didn't match VRAM (small textures at unaligned addresses), and
none do now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:41:30 +02:00
Henrik RydgårdandClaude Opus 5.5 e896203f32 Reinterpret between 16- and 32-bit framebuffers by PSP pixel at higher render scales
The 16-to-32-bit reinterpret sampled a quarter texel either side of the
render pixel, which only lands in the two 16-bit halves of a 32-bit pixel at
1x: at 3x, two of every three render pixels took both halves from the same
16-bit pixel. The 32-to-16-bit one picked the half by render pixel too. Now
both go by the PSP pixel. Cars Race-O-Rama rewrites its 8888 frame through
565 views in 16-pixel columns, and drew vertical stripes at 2x and up
(#15914); now it renders like 1x. Nothing changes at 1x.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:01:37 +02:00
Henrik RydgårdandClaude Opus 5.5 a9b18a9192 Compat: Read back Cars Race-O-Rama's luminance reduction for its brightness adaptation
The game reduces the scene to 8x8 on the GPU, block transfers that into RAM,
and the CPU sets its brightness adaptation from it. With BlockTransferAllowCreateFB
the copy went into a GPU-side buffer instead, the CPU read stale RAM, and the
game kept getting darker on the hardware backends (#15914).

New compat flag BlockTransferReadbackSmall: transfers of up to 64 pixels into
RAM are still read back, a frame late, so it doesn't stall. Brightness from
the issue's savestate now follows the software renderer's (72 vs 84 at 6 s,
84 vs 95 at 20 s, from 25 and falling), at the same speed as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 17:01:37 +02:00
Henrik RydgårdandClaude Opus 5.5 ed0d0c1aec GE dump playback: Copy a needed target snapshot at a depth mirror linearly
Me & My Katamari textures a 512x512 render target through 0x04288000, and later
snapshots read the textures past its depth buffer at linear addresses. Through
the swizzled depth mirror those came back permuted, which left a black band
over the horizon. Other snapshots at a mirror still go through it, since they
hold depth as the game saw it there. Software now matches the PSP on the three
Katamari dumps (#16131).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:57:14 +02:00
Henrik RydgårdandClaude Opus 5.5 2f4ce91a15 GE dump playback: Copy render target snapshots later ones rely on in software mode
The recorder leaves VRAM out of a snapshot as unchanged when an earlier snapshot
had it, and that earlier one can be a render target's, which software playback
skipped. Copy such a target snapshot (around what the replay drew), as the PSP
replayer now does. Software now matches the PSP on the three Madden NFL 10 dumps
(#16131), Need for Speed ProStreet (#16175) and Hammerin' Hero, and no dump gets
worse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:57:14 +02:00
Henrik Rydgård 7ec4d02b24 Merge pull request #22472 from hrydgard/msaa-fixes
MSAA fixes by Claude
2026-10-09 16:53:35 +02:00
Henrik RydgårdandClaude Opus 5.5 ed7de3ea76 Readback: Only scale a framebuffer down when it's rendered above maxScaleFactor
ReadFramebufferForDebug scaled the buffer down, cropped to its drawn size,
whenever the render width was more than the drawn width times maxScaleFactor.
At 1x that's any buffer wider than what has been drawn in it, though nothing
needs scaling.

Headless compares at maxScaleFactor 1, so this cut off most of the screen in
Gangs of London, which draws a 256 px wide region: its dumps went from 78 to
62,017 pixels differing from the PSP.

Now it only scales down when the render scale is above maxScaleFactor, and
then scales the whole buffer, since a display at an offset can sit past the
drawn width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:22:05 +02:00
Henrik RydgårdandClaude Opus 5.5 896eb31e87 Copy depth for offset rendering with MSAA too
ShiftDepthForOffsetRendering copied through a single-sampled temp buffer, so
with MSAA CopyDepthRect fell back to a depth blit, which Vulkan can't do with
multisampled images (PerformBlit asserts). Give the temp buffer the same
samples and copy; multisampled depth is never blitted or drawn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 15:49:15 +02:00
Henrik RydgårdandClaude Opus 5.5 4202368b1e Vulkan: Look up multisampled framebuffers through a CLUT by their first sample
With MSAA, a framebuffer textured as CLUT indices was read resolved, so the
indices along edges were averages of the samples and looked up wrong colors.
Dragon Ball Z: Tenkaichi Tag Team draws its outlines from a CLUT32 lookup of
its framebuffer, and they came out noisy and miscolored. Copy each pixel's
first sample with texelFetch into a temporary buffer and look up that.

This needs the multisampled color images to be sampled, and transitioned
back to attachment layout before rendering to them again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 15:49:15 +02:00
Henrik RydgårdandClaude Opus 5.5 70c5b8f07f Vulkan: Interpolate texture coordinates and colors at the centroid
With MSAA, a pixel that a primitive only partly covers otherwise
extrapolates them to the pixel center, outside the primitive, and samples
textures outside its UV range. Without MSAA nothing changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 15:49:15 +02:00
Henrik RydgårdandClaude Opus 5.5 71367037c0 Copy depth between framebuffers instead of drawing it, where supported
BlitFramebuffer drew depth with a raster copy. With MSAA that reads the
single-sampled depth, which is never resolved: Silent Hill: Origins resizes
its light buffer mid-frame, and with garbage depth its depth-EQUAL light
passes drew nothing, so the flashlight was missing. The raster copy isn't
exact without MSAA either: Burnout Dominator's recursive rendering (#11100)
goes from 112k to 6k pixels off the PSP with a copy. Now depth is copied
wherever the backend can copy just part of it (Vulkan).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 15:49:15 +02:00
Henrik Rydgård 06fbbf1218 Merge pull request #22471 from hrydgard/parallel-loop-max-threads
Allow specifying a cap on the number of threads used in ParallelLoop
2026-10-09 15:38:09 +02:00
Henrik RydgårdandClaude Opus 5.5 65fdadf5dd GE: Validate display list stack pointers and pending interrupt list IDs on load
CALL/RET only check stackptr against exactly 32 and 0, and getList() doesn't
check the ID at all.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 15:32:05 +02:00
Henrik Rydgård 8b626e0648 Merge pull request #22466 from hrydgard/hw-framebuffer-fixes
HW backends: Various framebuffer fixes
2026-10-09 14:50:05 +02:00
Henrik Rydgård 831acb099e Allow specifying a cap on the number of threads used in ParallelLoop 2026-10-09 14:33:58 +02:00
Henrik RydgårdandClaude Opus 5.5 7563b43818 Keep 5551 stencil marks when an EQUAL 0 test fails
ConvertStencilFunc5551 rewrites INCR to INVERT when the test is EQUAL 0,
which is only right where the test passed and the value is known to be 0.
It rewrote sFail too, so a pixel that failed against a set stencil got it
cleared again. Warriors Orochi 2 draws its sky in layers that each test
EQUAL 0 and INCR on pass and fail, so every other layer drew again over
the previous one and covered the mountains (#20867): 28650 -> 10285
pixels off the PSP on Vulkan and OpenGL. NOTEQUAL 0's INVERT to ZERO had
the same problem on sFail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:05:20 +02:00
Henrik RydgårdandClaude Opus 5.5 8a7a67ae25 SoftGPU: Use larger tiles now that pixels are cheaper
With the span drawing and sampling faster, the setup a triangle repeats
for each tile it touches weighs more, so the rule is now eight tiles per
thread instead of sixteen (64x32 on eight threads). Against sixteen, in
wall time on five games: God of War -2.6%, Wipeout -1.7%, LocoRoco -5.2%,
Tekken 6 -5.6%, Burnout -3.3%, with 2.5-8% less CPU. Four per thread used
the least CPU but was slower than eight in wall time in most of them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 11:39:29 +02:00
Henrik RydgårdandClaude Opus 5.5 9ce774d9f9 SoftGPU: Let the quad sampler skip the level check when all is level 0
Staged spans without mip levels pass no level arrays, and the sampler goes
straight to its one level path. 4% fewer instructions in God of War.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 11:39:29 +02:00
Henrik RydgårdandClaude Opus 5.5 cf3848d073 SoftGPU: Lerp two channels per lane in the four-pixel bilinear sampler
The texels come out corner by corner, so no transpose, and R with B, G with
A, share 32-bit lanes as 16-bit halves: no lerp of 8-bit values needs more
than 16 bits, and masking after each shift truncates both halves as before.
2.5% fewer instructions in God of War.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 11:39:29 +02:00
Henrik RydgårdandClaude Opus 5.5 0787732168 SoftGPU: Skip the level of detail when nothing depends on it
Without mip levels and with one filter for both, a span's texturing is the
quad sampler at level 0: staged spans call it directly instead of going
through ApplyTexturing, which also skips the level calculation. God of War
retires 7% fewer instructions.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 11:39:28 +02:00
Henrik RydgårdandClaude Opus 5.5 2cca146b7e SoftGPU: Filter the four-pixel bilinear samples a channel per vector
SampleLinearQuadT filtered each pixel's four texels as 16-bit channels in a 64-bit integer, then
transposed the results into a vector per channel for the texture function. Now the lerps run on a
channel of all four pixels at a time, producing that layout directly. God of War about 6% faster.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 11:39:28 +02:00
Henrik Rydgård bdf05ae874 Merge pull request #22464 from hrydgard/softgpu-spans
SoftGPU: Render in 4x1 spans instead of 2x2 quads, like the PSP. Optimize span functions with templating
2026-10-09 11:38:52 +02:00
Henrik RydgårdandClaude Opus 5.5 f317ca76d9 Copy in shared depth for a pass that tests against it, across frames too
CheckDepthUsage marked the framebuffer's depth as used this frame before
SetDepthFrameBuffer looked for newer depth in a framebuffer sharing it, so
depth from an earlier frame never counted as newer. Brooktown High clears
depth through another framebuffer as the last thing in a frame, and the
next frame's draws test against it: everything failed the depth test and
the hardware backends showed a black screen (#7223).

Now a pass whose first depth use tests against the depth checks for newer
depth first. One that only writes depth keeps the old order, so it doesn't
copy what it overwrites anyway. Of the benchmark savestates, God of War and
Daxter now copy depth once a frame, and God of War comes closer to the
software renderer for it; Burnout and LocoRoco would have copied too
without that restriction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:15:46 +02:00
Henrik RydgårdandClaude Opus 5.5 35de8e5d97 Screenshot the display from wherever in a framebuffer it is
The display can point inside a larger framebuffer: Silent Hill flips
between two halves of a 1024-wide 565 buffer. Presenting it found the
framebuffer and the offset, but screenshots looked up only an exact
address match, and otherwise read RAM, which with a hardware renderer
holds something stale (Silent Hill: Origins' savestate thumbnails showed
the loading screen). Screenshots of the display now use the same lookup
and read back the 480x272 at the offset.

Headless screenshots go the same way: eight Silent Hill frame dumps
(Origins and Shattered Memories) now match the PSP exactly on Vulkan and
OpenGL, from 0.8k-104k differing pixels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:15:46 +02:00
Henrik RydgårdandClaude Opus 5.5 6cbba6ee24 Fix Silent Hill: Origins' flashlight shadows on the hardware backends
The game does shadow mapping without depth textures (#16126):
- It renders the scene once into 44170000 with depth, then draws it again
  into 44170400 (the same buffer 256 pixels to the right) with the same
  depth address and an EQUAL depth test. We render 44170400 into the
  same framebuffer at an X offset, which moves the depth test along with
  the color, so it compared against the wrong depth and the shadow pass
  drew nothing. Copy the depth over to the offset once per pass.
- It reads its 256x256 565 light-depth map as CLUT32. The reinterpret to
  8888 went into an existing 8888 buffer at the same address that was
  only 128x128, which cut the map off below row 128. Grow it first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:15:46 +02:00
Henrik RydgårdandClaude Opus 5.5 e12c4ca0eb Size the render target viewport from the whole buffer, not the guessed drawing size
The viewport (and u_xywh, which must match it) used the framebuffer's
estimated drawing size, so anything drawn past it was clipped even though the
buffer has the rows and the scissor allows them. Tokimeki Memorial 4 draws its
characters to y 271 into a buffer whose height was guessed from a 256 tall
viewport: the bottom 16 rows were cut off, a line through every character, and
its arms broke when the two halves were stitched (#6379, #11249).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:15:46 +02:00
Henrik RydgårdandClaude Opus 5.5 8ff41f3cb2 Keep the render target when a block transfer upload resizes another buffer
ResizeFramebufFBO makes the resized buffer the current render target, and
the rebind after the upload then kept drawing to it. The game's draws to its
own render target went into the uploaded buffer until it changed the
framebuffer pointer. God of War: Ghost of Sparta and Chains of Olympus lost
most of their scenes this way (#12215, #11953, #16170, #11123, #12169).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:15:46 +02:00
Henrik RydgårdandClaude Opus 5.5 5df1fd70eb Set the framebuffer format before binding the target for immediate prims
FlushImm bound the render target with whatever format the last regular prim
left in gstate_c.framebufFormat. ThrillVille draws immediate prims first, so
its 5551 framebuffer was created as 565 and displayed with the wrong colours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:15:46 +02:00
Henrik RydgårdandClaude Opus 5.5 d9b36b7e46 CrossSIMD: Keep the C++ fallback's integer ops defined, like the SIMD ones
The fallback (which RISC-V uses) did its integer arithmetic in plain int,
where signed overflow and left shifts of negative values are undefined,
and converted out of range floats with a cast, which is undefined too:
RISC-V gives INT_MAX for NaN where SSE gives INT_MIN and NEON 0. With GCC
on RISC-V that broke GEUVSpanCore in the GEMath unit test. Now the
arithmetic wraps through uint32_t, like the SIMD instructions, and an out
of range or NaN conversion gives INT_MIN, like SSE.

Also skip GERowSum's zero terms before computing their shift, as their
exponent can be INT_MIN. Found with -fsanitize=undefined on the fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:12:48 +02:00
Henrik Rydgård bd8f37bf0f Merge pull request #22465 from hrydgard/hw-ge-blends
HW backends: Improve accuracy of blending
2026-10-09 11:05:28 +02:00
Henrik RydgårdandClaude Opus 5.5 10f5de6ded SoftGPU: Find each edge's row bounds once
The coverage and the drawn range took the same three edge bounds, each a
64-bit division. 1% fewer cycles in God of War.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 10:34:39 +02:00
Henrik RydgårdandClaude Opus 5.5 bb72b748e1 SoftGPU: Pick the span function by blend kind, and decide the vector path once
The span functions come in three blend kinds (none, source alpha over the
destination, and the general one), and states with logic ops or signed blend
factors get the pixel at a time function up front instead of checking per
span. 4.5% fewer instructions in God of War.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 10:34:39 +02:00
Henrik RydgårdandClaude Opus 5.5 770dc0fe43 SoftGPU: Early depth test of staged spans in vector lanes
CheckDepthTestPassed4 only has an SSE path, so on ARM it compared lane by
lane. Adds Vec4S32::LoadU16 for the depth values.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 10:34:39 +02:00
Henrik RydgårdandClaude Opus 5.5 d979f4fe3c SoftGPU: Leave out a zero secondary color, and fill constant span buffers once
A flat secondary color of zero (no specular) isn't added to each span, and
a flat secondary color or absent fog fills its buffer once per triangle
rather than once per row. 3% fewer instructions in God of War.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 10:34:39 +02:00
Henrik RydgårdandClaude Opus 5.5 52aa78f5ae SoftGPU: Draw rectangles in stages like triangle rows
DrawRectangle computed each span's UVs from the planes in 64 bits through the general GEUVSpan. It
now fills the staged rows' buffers (flat colors, z and fog, the coverage and the early depth test)
and draws them with DrawStagedSpans, which takes the 32-bit UV path when the planes allow it. Each
pixel still picks its mip level from its own q.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 10:34:39 +02:00
Henrik RydgårdandClaude Opus 5.5 c9ddd26cd2 SoftGPU: Walk the staged rows' planes four pixels at a time
When a plane's values at both ends of the chunk fit in 32 bits, so do all between, and 32-bit
wrapping arithmetic gets them exactly: then in vector lanes, with the clamp.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 10:34:39 +02:00