Commit Graph
12734 Commits
Author SHA1 Message Date
Stenzek 8e7c28987e Timers: Fix sysclk IRQs being delayed by gate changes
SetGate() rescheduled the sysclk event without updating the counters
first when the gated timer was GPU-clocked, so the next IRQ got pushed
back by however long it had been since the last update. Gate changes
that were more frequent than the IRQ stopped it from firing at all.
2026-10-15 23:50:33 +10:00
Stenzek 22c78a107d GPU/SW: Enable AVX2 rasterizer on x64 2026-10-15 23:50:33 +10:00
Stenzek d177f7adb6 Common: Fix AVX2 vector helpers
Replace AVX-512-only intrinsics and fix wrong-width ge16/ge32/u8to64.
2026-10-15 23:50:32 +10:00
Stenzek c94a799f56 GPU/SW: Force inline vector constructors
The PixelVectors/TriangleVectors constructors were the only vector
helpers left to the compiler's discretion. Clang already outlines the
textured ones at -Os, which forces every field through memory.
2026-10-15 23:50:32 +10:00
Stenzek 7883f38c7b GPU/SW: Remove some redundant vector operations
- The base of the texture page is ORed in with the texture window for
  Y, since the result always fits in VRAM, the mask did nothing. Same
  for the X mask with 4-bit textures.
- Green only needs a single shift to end up in the high word.
- blend8() is used to select between the new and existing pixels.
- Bit 15 is not set before blending for textured pixels, as they are
  only blended when it is already set. It was also being set before
  shifting it out again for quarter foreground blending.

Semi-transparent primitives are around 5-10% faster, the rest is
within noise.
2026-10-15 23:50:32 +10:00
Stenzek 3054fb0f0b GPU/SW: Only copy VRAM in reverse when necessary
Every copy with the destination to the right of the source was taking
the reverse path, which is not vectorized. Since rows are always copied
from top to bottom, the direction within a row only matters when the
source and destination overlap within the same row, so everything else
can use the forward path.

A 320x240 copy to the right goes from 40us to 2.4us.
2026-10-15 23:50:32 +10:00
Stenzek dd5370f91d GPU/SW: Simplify colour unpacking and packing
Bit 15 is passed through from the texture as-is, so there is no need
to unpack it, carry it through modulation, and pack it again. That
leaves the high half of BA as zero, which along with the components
already being clamped means most of the masking when packing can go.

For modulation, the dither is shifted up to line up with the colour
instead of shifting the colour down before adding it, so only one
shift is needed afterwards: ((x >> 4) + d) >> 3 == (x + (d << 4)) >> 7.

Around 3-15% faster for modulated textures.
2026-10-15 23:50:32 +10:00
Stenzek 84dcb202da GPU/SW: Remove redundant clip test for triangle spans
Spans are clipped to the drawing area before the loop, so the test for
each vector never masked any additional pixels, and since the loop only
runs for as many vectors as the span covers, there was never a vector
with nothing to draw either.

Around 4-17% faster for triangles, depending on size.
2026-10-15 23:50:32 +10:00
Stenzek 96ecf13a0b GPU/SW: Load sequential texels for sprites
Texture coordinates increase by one for each pixel of a sprite, so
unless the texture window is rearranging them, the texels for each
vector are next to each other in VRAM, and can be loaded together
instead of being gathered one at a time.

16-bit textures turn into a single load, and 4-bit textures a single
load followed by the palette shuffle. 8-bit indices still have to be
looked up individually, so those keep using the gather.

Sampling is split out of ShadePixel() so that it can be skipped.

Around 25% faster for 16-bit sprites and 20-45% faster for 4-bit
sprites. Small 8-bit sprites are up to 10% slower because of the extra
check for each vector.
2026-10-15 23:50:32 +10:00
Stenzek 5542670f44 GPU/SW: Use shuffle for 4-bit palette lookups
The CLUT only has 16 entries in 4-bit mode, so split into low and high
bytes it fits in a pair of registers, and can be looked up with a byte
shuffle, instead of extracting each index and loading the colour from
memory.

Without variable shifts, the index is moved to the top of the word by
multiplying, which replaces the scalar shifts as well.

Around 5-20% faster for 4-bit textured primitives.
2026-10-15 23:50:32 +10:00
Stenzek 65c554c44a GPU/SW: Read 8-bit palette indices as bytes
Each index is exactly one byte, so it can be read straight out of VRAM
and used to index the CLUT. Previously, the word containing the index
was gathered into a vector, then extracted again along with the shift
to get at the index, which without variable shifts (i.e. SSE4) meant
12 extracts and 4 scalar shifts for every 4 pixels.

Around 13-25% faster for small/medium 8-bit textured triangles, and
40-65% faster for large triangles and sprites.
2026-10-15 23:50:32 +10:00
Stenzek 0ed7e2815c GPU/SW: Add drawing and copy tests
Rectangles and axis-aligned quads are compared against a simple
per-pixel version of the pixel pipeline, clipped triangles against
the same triangle drawn without clipping, and VRAM copies against a
row-by-row copy.
2026-10-15 23:50:32 +10:00
Stenzek 46307c77b2 GPU/SW: Fix signed overflow in attribute steppers
The step is a fixed-point value which is expected to wrap around when
multiplied by the coordinate, but the multiplication was signed, which
makes the overflow undefined behaviour.

Multiply as unsigned instead, the result is the same.
2026-10-15 23:50:31 +10:00
Stenzek 4df2fcc5a6 GPU/SW: Fix source desync in masked VRAM writes
The scalar loop only advanced the source pointer when the destination
pixel was not masked, so every pixel after a masked one was written
with the wrong source data for the rest of the transfer.

The vectorized loop always advances, so this only affected the trailing
pixels of each row, writes which wrap around, and the scalar
implementation.
2026-10-15 23:50:31 +10:00
Stenzek 66888ba0d4 FullscreenUI: Fix sort column being disabled 2026-10-15 23:49:49 +10:00
Stenzek 4e072ef9cf FullscreenUI: Subtle visual improvements 2026-10-15 23:48:44 +10:00
Stenzek d7fce2d183 FullscreenUI: Add Waves background shader 2026-10-15 23:32:32 +10:00
Stenzek 2434029f8b Qt: Add new strings to non-machine translations
I've done this to avoid disturbing any existing strings with the machine
translation pipeline, but also to avoid translating all the new Android
strings...
2026-10-15 23:24:13 +10:00
Stenzek 4e7516f8f6 Qt: Update machine translations 2026-10-15 23:24:13 +10:00
Stenzek a1b6f64b08 FullscreenUI: Update translation strings 2026-10-15 23:24:13 +10:00
Stenzek 16409920ef Translation: Add Android string list 2026-10-15 23:24:13 +10:00
Stenzek 34c37444aa MemoryCard: Save card to file asynchronously
Hopefully eliminate stutter caused by slow scoped storage on Android.
2026-10-14 21:03:18 +10:00
Stenzek 5df2b5617e GPU: Guess automatic resolution scale while initializing
Hopefully won't change from non-upscaled to upscaled then, because
that's what recompiles most of the shaders.
2026-10-14 00:08:27 +10:00
Stenzek 53209ba754 System: Avoid redundant resolution change with auto upscale 2026-10-13 23:49:51 +10:00
Stenzek a6f0faad93 GPU: Fix automatic resolution scale when loading state 2026-10-13 22:04:50 +10:00
Stenzek cc1970f644 MSBuild: Work around broken MSVC release builds 2026-10-13 21:59:56 +10:00
Stenzek 20d784e8e4 ShaderGen: Use explicit output locations for MRT on GLES 3.0 2026-10-13 21:59:56 +10:00
Stenzek 32dab77072 OpenGLDevice: Fix timer query feature check and debug labels 2026-10-13 21:59:56 +10:00
Stenzek 8123e67aea OpenGLDevice: Add FlushPipelineCache(), fix pipeline cache error paths 2026-10-13 21:59:55 +10:00
Stenzek 68d234219a OpenGLDevice: Delete samplers, check for optional sampler state 2026-10-13 21:06:40 +10:00
Stenzek c5325add3b OpenGLDevice: Fix MRT output locations without binding layouts, detach shaders 2026-10-13 21:06:40 +10:00
Stenzek 4f0af1a28e OpenGLDevice: Fix depth-only framebuffers and sRGB render targets 2026-10-13 21:06:40 +10:00
Stenzek a4179f5352 OpenGLDevice: Fix vsync mode and surface leak when creating swap chains 2026-10-13 21:06:40 +10:00
Stenzek 0e138ae200 OpenGLDevice: Use stable VAO cache pointers and a default VAO 2026-10-13 21:06:40 +10:00
Stenzek 65056bdba8 OpenGLDevice: Don't disable async downloads when only PBO uploads are slow 2026-10-13 21:06:39 +10:00
Stenzek 0aa7687e7b OpenGLTexture: Fix format table, MSAA creation and upload sizing 2026-10-13 20:48:44 +10:00
Stenzek ce9ee819ed OpenGLDevice: Fix clear value handling for non-RGBA8 targets 2026-10-13 20:48:44 +10:00
Stenzek 9e77097e43 OpenGLDevice: Fix texture copy/resolve/download targets and ordering 2026-10-13 20:48:44 +10:00
Stenzek 6282dfde0e OpenGLDevice: Reset last program when unbinding pipeline 2026-10-13 20:48:44 +10:00
Stenzek 9c61b14898 OpenGLDevice: glBlitFramebuffer() to self is not allowed in GLES
Except it was in GLES3.0, but then denied in GLES3.1. Awful API.
2026-10-13 20:48:44 +10:00
Stenzek b540517f7e OpenGLDevice: Fix uniform range padding and buffer mapping issues 2026-10-13 20:48:44 +10:00
Stenzek a9c8dd0d19 GPUDevice: Remove unused DispatchWithPushConstants() 2026-10-13 20:48:44 +10:00
Stenzek d5702262e6 GPUDevice: Support mirrored surface pre-transforms
Otherwise the Vulkan swap chain stays suboptimal, and is recreated every frame.
2026-10-13 20:48:44 +10:00
Stenzek d90a4da1bf VulkanDevice: Wait for image acquire when submitting mid-present 2026-10-13 20:46:56 +10:00
Stenzek ed81176c49 VulkanDevice: Fix double free when texture buffer creation fails 2026-10-13 20:46:56 +10:00
Stenzek ef5a84ecee VulkanDevice: Remove unused GetRenderPassForRestarting() 2026-10-13 20:46:55 +10:00
Stenzek 57533b520e VulkanSwapChain: Don't request unsupported composite alpha 2026-10-13 20:46:55 +10:00
Stenzek da59abe4e8 VulkanDevice: Check swapchain maintenance feature and push descriptor limit 2026-10-13 20:46:55 +10:00
Stenzek 90b7ec71b6 VulkanDevice: Fix render pass state after flushing mid-present
Restart used the unrotated size, and the pass may not be restarted.
2026-10-13 20:46:55 +10:00
Stenzek ca9a7f36a5 VulkanDevice: Add self-dependency when framebuffer fetch is disabled
Barriers are used in that case, and need it in the render pass.
2026-10-13 20:46:55 +10:00