188 Commits

Author SHA1 Message Date
Henrik Rydgård cf9c0c5c84 Restructure the sprite detection, no longer require Smart 2D texture filtering to apply 2026-06-06 11:21:46 +02:00
Henrik Rydgård 169f473b95 Smart 2D texture filtering: Use the new vertex path to check for pixel mapping in transformed geometry
Previously, "Smart 2D texture filtering" was limited to through-mode
draws, but many games use fully transformed draws to do 2D elements.

An example of this is Outrun in the menus, and it's always been plagued by
horrible filtering artifacts.

With the improved Smart 2D texture filtering, the artifacts are gone!
Of course, instead of glitchy bilinear you instead get point sampled
texturing so it looks more pixellated, but no more ugly borders between letters
in the game.
2026-06-04 17:04:04 +02:00
Henrik Rydgård 652e3e2c22 Use fastcull on indexed draws too. 2026-06-04 11:24:15 +02:00
Henrik Rydgård bdd72c08f3 Fix dirtying caused by clip flag state. This could probably be a bit smarter. 2026-05-30 21:47:21 +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 189dde8115 Cache the cull matrix. Minor bbox optimization. 2026-05-30 19:07:59 +02:00
Henrik Rydgård e75d9f8a5f Unify the bounding depth checks, correct them if minmax clip is needed 2026-05-30 19:07:59 +02:00
Henrik Rydgård d849db6be5 Buildfix, remove redundant variable 2026-05-30 19:07:59 +02:00
Henrik Rydgård 5ad24adc93 Cleanup, increase the max cull count. Flatout water works now. 2026-05-30 19:07:59 +02:00
Henrik Rydgård 86f9618cb9 Fallback to software transform if draw intersects -W<Z<W 2026-05-30 19:07:59 +02:00
Henrik Rydgård 5eb114d3d9 Put more useful data in BoundingDepths. Slightly more costly. 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 08f4c8fae8 Compute min/max Z and W from the culling loop, use to cull some more 2026-05-30 19:07:58 +02:00
Henrik Rydgård ae98055cec Delete a lot of legacy depth and viewport code, fix OpenGL 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
Henrik Rydgård b65bbaf92c Merge pull request #21678 from nintendo424/gpu-save-first-frame
gpu: Preserve first-frame font render targets
2026-05-27 12:22:47 +02:00
Henrik Rydgård 2eca0123f1 Correct culling in case of some weird viewport setups 2026-05-23 14:49:17 +02:00
Henrik Rydgård fa856fbf68 Pass the culling unit tests. 2026-05-23 14:40:15 +02:00
Henrik Rydgård 0d33cd0a65 Convert the BBOX/BJUMP culling to use the worldviewproj matrix and a screen space check. 2026-05-23 14:40:15 +02:00
Henrik Rydgård 893bc732a1 Fast culling: Use the worldviewproj matrix to avoid the need for planes 2026-05-23 14:40:15 +02:00
Henrik Rydgård 5cfbf50111 Keep updated products of view*proj and world*view*proj matrices. Use to simplify bbox culling. 2026-05-21 19:18:32 +02:00
nintendo424 e5689d1adc gpu: Preserve first-frame font render targets
Some games render HLE sceFont glyphs into small VRAM-backed framebuffers and immediately sample them as textures. This needs both the source glyph buffer and the temporary render target to be preserved before later commands overwrite or rebind them.

Save first-frame data from the previous render target before creating a new framebuffer, since ResizeFramebufFBO() makes the new framebuffer current. Also flush pending draws before PGF writes over a glyph buffer that may still be referenced by queued texture draws.

Backend software transform normally reports safe framebuffer size during draw flush, but first-frame readback can happen before queued draws reach that path. Estimate through-mode rectangle/triangle bounds before SubmitPrim() and feed those bounds to SetSafeSize(), using actual vertices clamped to scissor instead of a tiny-target heuristic.

Fixes missing text in Evangelion JO.
2026-05-15 12:23:14 -04:00
Henrik Rydgård 10759dc8b9 DrawEngineCommon: Avoid using member variables as loop counters, bad for perf 2026-01-30 14:10:36 +01:00
Henrik Rydgård 7853881210 GPU header cleanup: Avoid including GPUCommon.h in some places 2025-11-23 20:37:37 +01:00
Henrik Rydgård 44d06ec42f Add some sanity checks guided by Android crash reports 2025-06-07 16:35:19 +02:00
Henrik Rydgård 9d1f8a2575 Don't forget to update the vertex addr even when culling 2D draws
Fixes #20454
2025-06-06 17:53:49 +02:00
Henrik Rydgård 8ed898c5e6 GPU: Constify VertexDecoder pointers, remove in some cases 2025-05-14 15:13:59 +02:00
Henrik Rydgård 5d85d5ed22 Depth raster: Rename some variables, fix incorrect draw limit 2025-04-10 17:49:06 +02:00
Henrik Rydgård b080f7da6b Small depth raster refactor 2025-04-10 17:13:48 +02:00
Henrik Rydgård c23c3e8d03 Measure the available time for "background depth raster". The idea is viable. 2024-12-29 09:45:55 +01:00
Henrik Rydgård 6d539cc5e0 More fixes 2024-12-28 23:50:42 +01:00
Henrik Rydgård aec17d8829 Actually queue up depth draws 2024-12-28 23:21:54 +01:00
Henrik Rydgård 25d79afd47 Small rename, remove some obsolete reporting 2024-12-28 23:05:07 +01:00
Henrik Rydgård 1e8eb88bf0 Unify the ends of the two depth draw paths 2024-12-28 19:22:23 +01:00
Henrik Rydgård 3c3dfe5273 Reorganize depth raster draw state handling 2024-12-28 18:51:34 +01:00
Henrik Rydgård 2371fdfedd Rework depth raster to fully support software transform 2024-12-21 21:22:22 +01:00
Henrik Rydgård a344d0225f DepthRaster: Fix bug where we used the wrong vertex count. 2024-12-21 14:28:00 +01:00
Henrik Rydgård 67078d439b Depth raster: Switch to a SoA data layout for the screen space verts 2024-12-21 14:28:00 +01:00
Henrik Rydgård bdb5f3a91b Reorganize the depth vertex pipeline for future optimizations 2024-12-21 14:27:59 +01:00
Henrik Rydgård c5ad81e3d5 Add DepthRaster.cpp/h. Rasterize depth rectangles, some triangles 2024-12-21 14:27:53 +01:00
Henrik Rydgård df6ed8cfc9 Do some cleanup of #includes in GPU 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 0b06cd1379 Actually avoid looking up the vertex decoder more than once 2024-12-17 22:42:07 +01:00
Henrik Rydgård 15b4f0c299 Lookup the decoder outside of DrawEngine 2024-12-17 19:27:01 +01:00
Henrik Rydgård 61b14df329 Delete obsolete empty function ClearTrackedVertexArrays 2024-12-17 19:15:25 +01:00
Henrik Rydgård fe4504f612 Small simplification 2024-12-17 19:15:06 +01:00
Henrik Rydgård a2a089b8c1 Remove the member function NormalizeVertices 2024-12-17 19:15:03 +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 abb2558535 When overriding skinning in sw transform mode, don't write/restore member variables 2024-12-17 18:52:49 +01:00