357 Commits

Author SHA1 Message Date
Stenzek
eee67a30da
GPU/HW: Fix off-by-one in sprite UV rect calculation
CheckForTexPageOverlap() makes it exclusive already.

Fixes replacements for FF8 title screen not applying in the third
texture page, because it thought it was sampling from an unwritten
area of VRAM.
2025-06-03 18:54:29 +10:00
Stenzek
17dfb95d6a
GPU/HW: Fix MSAA+depth buffer combination
Clear should wipe out all samples, copy should copy all samples.
2025-05-17 19:44:23 +10:00
Stenzek
d35cefb02a
GPU/HW: Check for depth clears for lines 2025-05-17 15:22:01 +10:00
Stenzek
844869c0c1
GPU/HW: Fix precise lines failing depth test 2025-05-17 15:04:22 +10:00
Stenzek
a375d558f6
GPU/HW: ScaleNx/MMPX do not require blending 2025-05-17 14:05:56 +10:00
Stenzek
2b280bddd0
GPU/TextureCache: Display replacement info on game start 2025-05-13 21:21:16 +10:00
Stenzek
751d81eff0
GPU/TextureCache: Handle FetchTexture() fails 2025-04-14 22:19:17 +10:00
Stenzek
2eecf6b79d
GPU/HW: Clear depth at vblank time in 480i games
If this is a 480i single buffer game, then rendering should complete within one vblank.
Therefore we should clear the depth buffer, because the drawing area may not change.
2025-04-10 22:02:40 +10:00
Stenzek
c7139b943c
GPU/HW: Remove redundant check 2025-03-30 23:42:02 +10:00
Stenzek
741e971681
GPU/HW: Add 'True Color (Full)' dithering mode
This is equivalent to the old 'True Color' mode.

The new 'True Color' mode truncates flat-shaded sprites/polygons
to 16-bit color before drawing. Doing so fixes:

- Menu background in Breath of Fire IV.
- Loading background in JumpStart Wildlife Safari - Field Trip.
- and other similar games.
2025-03-22 18:32:31 +10:00
Stenzek
2311c8d287
Settings: Convert dithering/true color options to a dropdown
Half of them are mutually exclusive, so this simplifies things.
Fewer options = better, right?
2025-03-22 18:20:51 +10:00
Stenzek
62d7a73381
GPU/HW: Add 'Scaled Interlacing' option
Disabling this option causes rendering to skip N lines instead of 1
line, where N is the internal resolution multiplier.
2025-03-22 01:19:01 +10:00
Stenzek
d176109d3b
GPU/HW: Fix incorrect interlaced VRAM extract offset
Fixes exascerbated combing when upscaling.
2025-03-22 01:11:24 +10:00
Stenzek
5c41a48e39
GPU/HW: Fix crash when changing downsampling factor 2025-03-20 21:19:08 +10:00
Stenzek
58dc7562a3
GPU/HW: Add in-pass clear depth pipeline
Instead of clearing the entire buffer, we only need to wipe out the
current drawing area. Saves a decent chunk of memory bandwidth in games
that end up spamming clears.
2025-03-07 21:33:06 +10:00
Stenzek
ee6887b68a
GPU/HW: Add stat for depth buffer clears 2025-03-07 21:33:02 +10:00
Stenzek
3ea26cc910
GPU: Rewrite automatic resolution scaling
Make it play nice with rewind/runahead.
2025-02-21 23:58:05 +10:00
Stenzek
958fd0049c
GPU/HW: Don't use shader for self-overlapping copies
If we use the shader here, we're going to immediately end the
render pass since the area we read and wrote to is going to be
dirty again.

This is problematic on Mali where the render passes are really
expensive. Test case: Dino Crisis 2 - open menu
2025-02-15 17:20:30 +10:00
Stenzek
06b02183cb
GPU/HW: Split transparent draws if dual-source blend unsupported
The ordering is not correct otherwise. Ape Escape has a bunch of
overlapping sprites that have a mix of opaque and transparent texels,
and the transparent texels are repeated multiple times when the
opaque texels should cancel them out.

Only affects old Mali drivers.
2025-02-09 13:07:53 +10:00
Stenzek
f8c39ace1c
GPU/HW: Warning fix 2025-02-05 22:40:59 +10:00
Stenzek
24354cb39f
GPU: Fix more GPU thread-reading-CPU-thread-settings locations 2025-02-02 13:08:08 +10:00
Stenzek
635ae5de31
GPU/HW: Don't use sprites-as-fills for small/offscreen points 2025-01-31 19:50:33 +10:00
Stenzek
7188ab863a
GPU/HW: Treat fill-like sprites as fills if TC is enabled
Umihara Kawase Shun clears the framebuffer with a single large
sprite, which causes the texture cache to think the pages have
been drawn.
2025-01-28 17:35:52 +10:00
Stenzek
389276bb03
GPUDevice: Normalize supports_texture_buffers => texture_buffers 2025-01-21 19:06:59 +10:00
Stenzek
7905793ae0
GPU: Use screen alignment for overlay instead of display rect 2025-01-19 21:13:16 +10:00
Stenzek
e1cbb50c64
GPU: Fix various capture/screenshot issues
- Simplify functions for rendering display.

- Post-processing should only when the target size matches the window.
  Otherwise the shaders are constantly recompiled.

- Include border overlay in capture/screenshots when above condition
  is satisfied.

- Relax video alignment size when using screen resolution + auto.

- Fix "Internal Resolution (Uncorrected)" capture mode.
2025-01-19 13:42:38 +10:00
Stenzek
88b43370dc
GPUDevice: Replace explicit GL_PUSH/GL_POP with nested GL_SCOPE 2025-01-18 22:59:49 +10:00
Stenzek
e0a9bbe600
PostProcessing: Move into GPU presenter
Means that the renderer can be changed without reloading shaders,
and speeds up config change detection.
2025-01-18 22:59:48 +10:00
Stenzek
6cba825bac
System: Add fatal error shutdown path
Switch to a null backend and shut down the system instead of crashing.
2025-01-18 22:59:48 +10:00
Stenzek
d52bf795e4
GPU: Split backend into Backend+Presenter 2025-01-18 22:59:48 +10:00
Stenzek
092b2803c5
GPU/HW: Flipping the mask bit test should flush 2025-01-16 23:50:40 +10:00
Stenzek
45b500bc2c
GPU/HW: Fix draw call count spiking in some scenarios 2025-01-15 22:50:29 +10:00
Stenzek
ccfc60ec94
GPU/HW: Remove extra barrier on VRAM download
Seems to work around download texture corruption on AMD/Vulkan/Windows.
2025-01-10 20:06:56 +10:00
Stenzek
d25cffebd5
GPU/HW: Disable depth testing with semitransparency
But provide an option to enable it.
2025-01-09 21:45:14 +10:00
Stenzek
d9c9b3038d
GPU/HW: Fix ROV depth being written with semitransparency 2025-01-09 21:21:12 +10:00
Stenzek
7d2898b94c
GPU/HW: Exclude 2D polygons from depth buffer
Fixes UI getting obscured in Kingsley's Adventure.
2025-01-09 21:21:12 +10:00
Stenzek
670dc461c1
GPU/HW: Slight re-shuffling of field offsets
Free up some bits in the middle.
2025-01-07 23:20:26 +10:00
Stenzek
4c801c3ff3
GPUDevice: Move size-matches check into ResizeTexture() 2025-01-07 23:20:25 +10:00
Stenzek
b9186139d0
GPU/HW: Use sized tristrips instead of fullscreen quads 2025-01-07 23:20:25 +10:00
Stenzek
c5bd4101b3
GPU: Refactor and simplify deinterlacing
Both HW and SW deal with half-height buffers coming in now.
2024-12-30 14:36:17 +10:00
Stenzek
9cba1decad
GPU/HW: Compiler warning fix 2024-12-29 22:34:39 +10:00
Stenzek
b7832e609f
GPU/HW: Vectorize flipped sprite handling 2024-12-29 17:25:55 +10:00
Stenzek
1a211e0a21
GPU/HW: Fix mask bit regression from FF8 fix
Fixes overbright polygons appearing in Silent Hill.
2024-12-29 17:25:54 +10:00
Stenzek
799f5bdf97
GPU: Assume vertex commands are 8-byte aligned 2024-12-28 20:24:22 +10:00
Stenzek
c2589461e9
GPU/HW: Remove extra debug group pop 2024-12-28 20:24:21 +10:00
Stenzek
74fd217afb
GPU/HW: Always update/load/save CLUT
We have the headroom with multithreading now, and it prevents issues
saving/loading state in loading screens in some games.
2024-12-28 20:24:21 +10:00
Stenzek
25b0bb752a
GPU/HW: Try truncating culled vertices
What is this monstrosity? Final Fantasy VIII relies on X coordinates
being truncated during scanline drawing, with negative coordinates
becoming positive and vice versa. Fortunately the bits that we need
are consistent across the entire polygon, so we can get away with
truncating the vertices. However, we can't do this to all vertices,
because other game's vertices break in various ways. For example,
+1024 becomes -1024, which is a valid vertex position as the ending
coordinate is exclusive. Therefore, 1024 is never truncated, only
1023. Luckily, FF8's vertices get culled as they do not intersect
with the clip rectangle, so we can do this fixup only when culled,
and everything seems happy.
2024-12-28 20:24:21 +10:00
Stenzek
c99625e4c3
GPU: Move vertex culling to GPU thread
i.e. push all primitives through unless they are oversized, which the
GPU will definitely skip.

Needed because of coordinate truncation in Final Fantasy VIII, these
scenes will now render correctly with the software renderer again.
2024-12-28 20:24:09 +10:00
Stenzek
b03127b206
GPU: Move background dumping to HW+GPU thread
And only dump when the mask bit check is not enabled.

The replacements are gated by the mask bit check anyway, so there's
no point dumping anything that can't be replaced.
2024-12-25 15:53:53 +10:00
Stenzek
b8fa97e1a7
GPU: Fix sprite texture filtering with TC enabled 2024-12-24 00:24:37 +10:00