Commit Graph
246 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Opus 5 d603396f30 softgpu: Fix subpixel rounding of negative screen coords, and a stale +1
Two leftovers from the sample point having been a sixteenth of a pixel off
center. They're one commit because they can't be separated: each was
compensating for the other, so applying either alone makes
gpu/filtering/precisionnearest3d fail. I tried both orderings.

1. DrawRectangle advanced ST to the first sample with (minX - entireX1 + 1).
   The +1 existed to make up for centerOff being 7 instead of 8; now that minX
   already sits at the pixel center it double-counts and pushes the texture
   coordinate a sixteenth of a texel too far. Only visible when that lands
   exactly on a texel boundary, which is what precisionnearest2d's offset-7 case
   constructs: the sprite spans x from -7/16, so u at pixel 0's center is 0.9375
   and should sample texel 0, but the extra sixteenth made it exactly 1.0.

2. Removing the +1 exposed the other one. ClipToScreenInternal used a plain
   (int) cast, which truncates toward zero - so once the region offset makes the
   value negative it rounds the opposite way from the positive case, and from
   the through-mode path that computes screenpos directly. The two disagreed by
   one subpixel for negative coordinates, which is why the 2D and 3D variants of
   the same test failed at different offsets, 7 and 8. floorf is what the +0.375
   nudge was always meant to pair with, and it makes both paths agree.

Now passing: gpu/filtering/precisionnearest2d, promoted to tests_good since it
passes on Vulkan too. precisionlinear2d and precisionlinear3d also start passing
on software but still fail on the hardware backends, so they stay in tests_next
with a comment saying so, as does gpu/primitives/continue from the last commit.

317 pspautotests pass, 0 fail.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vd8ntC2brCUtCrDJMqLbs8
2026-08-29 13:02:09 +02:00
Henrik RydgårdandClaude Opus 5 e1c81f91be softgpu: Drop the SIMD variants of Dot43
The SSE4 and NEON versions summed pairwise, the scalar Dot() sums left to right,
and float addition isn't associative. Which one ran depended on the build - the
SSE path excluded 32-bit x86 entirely, so Win32 and x64 disagreed on the same
machine - and on cpu_info.bSSE4_1, so one binary disagreed with itself across two
x86 CPUs.

Not cosmetic: the result is fogdepth, which Clipper compares against v0's to
decide whether to split a rectangle into two draws, so a ULP changed the number
of primitives emitted. A 4-element dot product is not where the time goes.

Also parenthesized the sum in Dot(Vec4) so the association is explicit in the
source rather than left to the reader knowing the grammar.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vd8ntC2brCUtCrDJMqLbs8
2026-08-29 12:21:11 +02:00
Henrik Rydgård 61e1ef8f7a Remove the "Software skinning" option. Now always on. 2026-07-14 17:02:57 +02:00
Henrik Rydgård 6d2948a09b Remove the cached UVScale in gstate_c. Conversion is cheap enough to do directly from gstate, no point in caching. 2026-07-03 13:17:35 +02:00
Henrik Rydgård 195455a7f4 Break out VertexReader, prepare VertexReader for CrossSIMD use in software transform 2026-06-04 12:45:17 +02:00
Henrik Rydgård 078197d790 Remove unnecessary scaling and then un-scaling of through-mode Z coordinates 2026-06-03 20:31:05 +02:00
Henrik Rydgård 2ea8a9ac1f Revert "Remove unnecessary scaling and then un-scaling of through-mode Z coordinates"
Didn't mean to commit this, it was supposed to go in a PR.

This reverts commit 6d4c70c67d.
2026-06-03 17:18:10 +02:00
Henrik Rydgård 6d4c70c67d Remove unnecessary scaling and then un-scaling of through-mode Z coordinates 2026-06-03 16:00:40 +02:00
Henrik Rydgård 0dc6e36d19 Delete redundant implementation of vertex preview in SoftGpu 2026-06-02 15:43:11 +02:00
Henrik Rydgård c46774c923 Fix the ImGe debugger vertex list 2026-06-02 14:53:37 +02:00
Henrik Rydgård bb573e6e0c Well, it builds, but doesn't work yet. 2026-06-02 12:33:53 +02:00
Henrik Rydgård 44ece6dfa2 Determine the clip flags directly when culling, simplifying the code. 2026-05-30 19:07:59 +02:00
Henrik Rydgård 8b84fd555d Apply triangle near-clipping in software transform.
Fixes, but only in SW transform, #10914

Re-enable range culling, oops.
2026-05-30 19:07:59 +02:00
Henrik Rydgård b1723086be Plumb through depth information (although not yet always generated) 2026-05-30 19:07:58 +02:00
Henrik Rydgård 5808afef10 Implement minZ/maxZ through user clip planes 2026-05-30 19:07:58 +02:00
Henrik Rydgård f60e27a9b7 Just some refactoring of the GPUStatistics struct, and more use of StringWriter 2026-05-29 14:40:31 +02:00
Herman Semenoff 400d136f51 GPU: modernize use C++17 constexpr for precalculate compilation 2026-05-19 21:57:45 +03:00
Henrik Rydgård e71ffc59a6 Remove unnecessary IsStarted method 2026-02-17 10:18:08 +01:00
Henrik Rydgård 991d7bdfab VertexDecoder: Refactor away lowerbound/upperbound parameters 2026-02-05 13:26:17 +01:00
Henrik Rydgård 32df2f7a03 Remove unused functions 2025-01-28 10:54:43 +01:00
Henrik Rydgård d5bfc1b5eb Finish up this cleanup (move _M_SSE compat define out of Common.h) 2024-12-19 16:23:20 +01:00
Henrik Rydgård 3e198c53b2 More include cleanup 2024-12-18 13:57:26 +01:00
Henrik Rydgård ee297e974d Move more code into SoftwareTransformCommon, cleanup 2024-12-18 13:57:26 +01:00
Henrik Rydgård a07da939ef Some NormalizeVertices interface cleanup 2024-12-17 19:13:38 +01:00
Henrik Rydgård fec232f8a8 GPU: Move things around a little, out of DrawEngine. 2024-12-17 19:13:38 +01:00
Henrik Rydgård e74101a2fb applySkinInDecode belongs in the VertexTypeID, not in the options. 2024-12-17 18:24:18 +01:00
Henrik Rydgård 54d18bb343 Lift some more debugging functionality into GPUCommon 2024-12-15 14:03:05 +01:00
Henrik Rydgård 11dbae3457 Remove the "DispatchFlush" mechanism, not convinced it's a win 2024-12-15 13:42:05 +01:00
Henrik Rydgård 9e019ae246 Remove the notion of the GPU debugger being "Active". Now it's automatic. 2024-12-15 11:12:53 +01:00
Henrik Rydgård f54d701a2e Decentralize the assert for AllocateAlignedMemory failures 2024-10-22 21:49:50 +02:00
Henrik Rydgård e01ca5b057 Logging API change (refactor) (#19324)
* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
2024-07-14 14:42:59 +02:00
Henrik Rydgård db94b0b696 Pass the limit on the number of indices to generate to BuildDrawingParams. 2024-01-15 10:09:04 +01:00
Henrik Rydgård 078018a943 Move the clockwise calculation out of DrawEngineCommon 2023-10-10 13:16:34 +02:00
Henrik Rydgård 963ca50ba7 Merge pull request #17567 from hrydgard/uvscale-as-argument
Pass uvScale in as a fourth argument to the vertex decoder
2023-06-13 09:49:31 +02:00
Unknown W. Brackets a7fa37d114 softgpu: Use SIMD more for dot products. 2023-06-12 19:54:32 -07:00
Henrik Rydgård 01cea7f088 Pass uvScale in as an argument to the vertex decoder
Cleaner than overwriting/restoring gstate_c.uvScale in the decoder
loop. A small cleanup I've been wanting to do for ages.

Expecting a negligble perf boost if any.
2023-06-12 20:25:18 +02:00
Henrik Rydgård 16b243b007 Centralize allocation of vertex decode buffers 2023-04-24 12:11:58 +02:00
Unknown W. Brackets b5206df04f softgpu: Calc worldnormal a bit less often.
This is clearer anyway.
2023-04-16 10:16:32 -07:00
Герман Семенов 122b63b9a8 GPU: using if constexpr C++17 optimization 2023-04-02 16:36:37 +02:00
Unknown W. Brackets be84bc9934 softgpu: Detect binner alloc fail and bail. 2023-01-01 06:59:14 -08:00
Unknown W. Brackets a7b7bf7826 Global: Set many read-only params as const.
This makes what they do and which args to use clearer, if nothing else.
2022-12-10 21:13:36 -08:00
Unknown W. Brackets 3342d5ecb3 softgpu: Remove an unused case. 2022-12-04 08:17:05 -08:00
Henrik Rydgård 116bc9d59a Merge pull request #16485 from unknownbrackets/softgpu-fog-nan
softgpu: Handle infnan fog coefficients better
2022-12-02 19:49:32 +01:00
Unknown W. Brackets 1121a6fb68 softgpu: Handle inf-end + negative constant slope. 2022-12-02 10:20:30 -08:00
Unknown W. Brackets 38de2f11af softgpu: Handle infnan fog coefficients better.
If we ended up with a dot product that had opposing inf signs, the add
would result in NAN and cause problems.
2022-12-02 10:15:15 -08:00
Unknown W. Brackets c5a98e62dd softgpu: Cull verts outside post-viewport Z.
Shouldn't have removed this before, points are still culled when depth
clamp is off and throughmode is off.

Fixes Crazy Taxi graphics glitches.
2022-12-01 21:57:48 -08:00
Henrik Rydgård e6f0f84a45 SSE optimize Float4ToUint8x4, some uses 2022-12-01 16:32:23 +01:00
Unknown W. Brackets dc962094f8 softgpu: Correctly fix inversions, matching tests.
Inversions are allowed just fine, but if clipping results in coordinates
outside range, the triangle should be culled.  Fixes more wanted
inversions.
2022-11-30 23:20:39 -08:00
Unknown W. Brackets 7880eb15c1 softgpu: Always use software skinning.
There's only software skinning, after all.
2022-11-06 08:44:22 -08:00
Unknown W. Brackets 6c36f03a0d GPU: Purify vertTypeIsSkinningEnabled(). 2022-11-06 08:40:54 -08:00