Henrik Rydgård and Claude Opus 5.5
f48251c90a
SoftGPU: Cull primitives by z like the GE
...
The GE counts a vertex as outside when |z| > w, comparing the float24 clip
coordinates without dividing, and culls a primitive only when all its vertices
are outside, with depth clamp on or off. Points were never culled, and lines,
triangles and rectangles were culled on a single outside vertex with clamp off.
Measured with gpu/probe for every primitive type, both clamp modes and a
range of w.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com >
2026-10-02 15:09:42 -06:00
Henrik Rydgård
5808afef10
Implement minZ/maxZ through user clip planes
2026-05-30 19:07:58 +02:00
Henrik Rydgård
3e198c53b2
More include cleanup
2024-12-18 13:57:26 +01:00
Unknown W. Brackets
8f404a1961
softgpu: Fix minor typo.
2023-07-25 19:42:36 -07: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
909f3feaea
softgpu: Allow inversions when w >= -1.0.
...
This seems to match desired cases well, see #16131 . Likely still
inaccurate to what hardware actually does.
2022-11-26 12:11:56 -08:00
Unknown W. Brackets
71b4407889
softgpu: Throw away all inverted polygons.
...
This is actually incorrect in some cases, but there are a number of games
affected by inversions, and they're practically always undesired.
2022-11-19 20:30:49 -08:00
Unknown W. Brackets
a66056217f
softgpu: Avoid splitting rectangles for fog.
...
If the fog factor would result in the same amount of fog, we're just
adding more work for no reason.
2022-11-13 09:23:06 -08:00
Unknown W. Brackets
21064edfca
softgpu: Correct tex on fogged rectangles.
2022-11-13 09:17:29 -08:00
Unknown W. Brackets
d33986a5ad
softgpu: Cull a triangle with all negative w.
...
Per tests, this seems to happen but only when all points are below zero.
2022-10-15 11:49:28 -07:00
Unknown W. Brackets
23af9be9f4
softgpu: Handle rectangle texture projection.
2022-09-26 18:44:39 -07:00
Unknown W. Brackets
8376176b2f
softgpu: Split clippos out of rasterization vert.
...
We don't use it, except w, at all in rasterization, so no need to keep it
in the bin queue.
2022-09-26 16:50:40 -07:00
Unknown W. Brackets
de080e2594
softgpu: Simplify vertex range culling.
...
The previous logic was harder to understand and easier to get wrong.
Just drop them when clipping the primitive.
2022-09-18 06:16:25 -07:00
Unknown W. Brackets
7a83f8bab5
softgpu: Use vertType prim override for flags.
...
These parameters are a real shame, was so clean before...
2022-09-06 22:20:45 -07:00
Unknown W. Brackets
cc6491342e
softgpu: Prepare dedicated rectangle path.
...
We're still sometimes using the slow rect-as-triangles path, let's do
something faster. As a first step, just handle binning.
2022-02-20 09:38:51 -08:00
Unknown W. Brackets
8e7bc80e4b
softgpu: Avoid modifying source vertex data.
...
This was dangerous for strips and fans, which reuse the verts for
subsequent primitives.
2022-02-12 10:39:25 -08:00
Henrik Rydgård
eba93f2ee0
Merge pull request #15340 from unknownbrackets/softgpu-textures
...
Correct UV rotation and through mipmaps, optimize texenv blend a bit
2022-01-24 08:19:34 +01:00
Unknown W. Brackets
818d17183b
softgpu: Correct clear mode dither.
...
It does apply, but have to be careful about alpha.
2022-01-23 12:39:50 -08:00
Unknown W. Brackets
648b71616e
softgpu: Correct UV rotation for transformed rects.
2022-01-23 08:15:15 -08:00
Unknown W. Brackets
abef17caca
softgpu: Simplify mask check.
...
This performs a bit better.
2022-01-16 23:40:57 -08:00
Unknown W. Brackets
89bc87a388
softgpu: Reduce copying during clipping.
...
Common case is nothing needs to be clipped.
2022-01-16 23:33:46 -08:00
Unknown W. Brackets
cf3384c993
softgpu: Avoid double calculating screenpos.
2022-01-15 11:22:36 -08:00
Unknown W. Brackets
a0a9b1e89b
softgpu: Add class to manage and enqueue for bins.
...
For now, just forwarding.
2022-01-13 09:26:59 -08:00
Unknown W. Brackets
d5c5e9478e
softgpu: Prepare more state per prim call.
2022-01-10 22:12:35 -08:00
Unknown W. Brackets
d7a82ab7b8
softgpu: Compute func IDs once per batch of verts.
...
This saves a decent chunk of time, especially when many verts are being
drawn.
2022-01-10 22:12:35 -08:00
Unknown W. Brackets
6367d5dc8f
softgpu: Draw top left of rectangles first.
...
This helps when things do self-rendering, since this way we won't read
from things we've just written to when scaling down. See #11623 .
2022-01-08 20:53:01 -08:00
Unknown W. Brackets
8db2d37e64
softgpu: Fix depth cull in softgpu.
...
Was improperly skipping cull for positive Z.
2021-11-05 21:38:13 -07:00
Unknown W. Brackets
121c56e6db
softgpu: Clip only on -Z, cull if entirely outside.
...
This is important for several issues, like #12058 or #12060 , where
something is drawn entirely outside valid Z, and should be culled.
2021-09-09 20:13:42 -07:00
Unknown W. Brackets
f32f89dd90
Global: Remove some unused variables.
2021-02-15 11:59:45 -08:00
Henrik Rydgård
821817e6d4
Move the profiler to Common
2020-10-04 11:42:16 +02:00
Unknown W. Brackets
5fae2171cc
softgpu: Correct cull handling for sprites.
2020-09-08 16:29:45 -07:00
Henrik Rydgård
2e06386cf6
Software renderer clipper: Don't clip on the sides. Fixes #4845 and should fix #7124 for the SW renderer.
2020-08-16 21:38:07 +02:00
Henrik Rydgård
970adfbcc9
Isolate most of the softgpu specialization code to RasterizerRectangle.
...
See comments.
2019-10-28 09:33:30 +01:00
Henrik Rydgård
86c781e434
Hack around most of the problems with the save/load dialog. Software stretch gets enabled in non-wide mode, so wallpapers work at a cost of speed.
2019-10-27 20:55:32 +01:00
Henrik Rydgård
290e9971a7
More specialization work.
2019-10-27 20:54:36 +01:00
Henrik Rydgård
9099441973
Darkstalkers: Gross hack to avoid the game's own stretch, and present the raw buffer instead for a sharper image.
2019-10-27 20:54:36 +01:00
Henrik Rydgård
2dd7a9aa12
More darkstalkers work
2019-10-27 20:54:36 +01:00
Henrik Rydgård
c7f6724f7e
Detect sprite drawing (1:1 texture mapping), run a simpler function without the triangle state tracking.
...
This will allow further simplification and specialization.
2019-10-27 20:54:36 +01:00
Henrik Rydgård
510229b68b
SoftGPU: Detect through-mode rectangles from triangle strips
2019-10-27 20:54:36 +01:00
Henrik Rydgård
3a0804a7dd
Start slowly migrating from macros
2019-10-27 20:54:36 +01:00
Unknown W. Brackets
11a8857a7e
SoftGPU: Correct clipping for flat shading.
...
It needs to use the provoking color, regardless of culling or clipping.
Fixes Blade Dancer lighting (see #4140.)
2018-11-22 17:48:55 -08:00
Unknown W. Brackets
817b5d7c1c
SoftGPU: Support fog on 3D rectangles.
2018-09-09 23:59:48 -07:00
Unknown W. Brackets
e22cc7ef6d
SoftGPU: Always clip, without special neg z case.
...
Depth clamping doesn't change whether it clips. Also, avoid culling when
a vertex is behind the near plane.
2018-08-05 17:47:05 -07:00
Unknown W. Brackets
77f0499f7f
GPU: Rename clipping flag to depth clamp.
...
It seems to just to depth clamp. When depth clamp happens, it affects
clipping a little, but only for vertices that needed clamping.
2018-08-05 17:11:51 -07:00
Unknown W. Brackets
b94ca6e75e
Vulkan: Use depth clamping, where available.
...
This fixes, for example, Shadow of Destiny, even without the hack.
2017-12-26 16:54:39 -08:00
Unknown W. Brackets
ed34cf06b8
SoftGPU: Add a clear mode fast path.
...
This skips a lot of extra work for clears, which are pretty common.
2017-11-11 21:04:32 -08:00
Unknown W. Brackets
9d64597fb3
SoftGPU: Clip lines entirely outside early.
...
Some were getting through, which may mean the line clipping isn't working
so well...
2017-05-14 18:28:47 -07:00
Unknown W. Brackets
e4f2ff1464
SoftGPU: Implement lines in transform mode.
2017-05-14 16:10:59 -07:00
Unknown W. Brackets
b2d3058386
SoftGPU: Correct fog for rectangles.
...
Gods Eater Burst uses fog in its bloom, with rectangles.
2017-05-13 17:27:34 -07:00
Unknown W. Brackets
dfed20701a
SoftGPU: Correct negative coord handling.
...
Fixes #5159 - we need this signed to handle negative values properly.
2017-04-15 19:52:17 -07:00