summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
AgeCommit message (Collapse)Author
2026-11-16Merge pull request #15026 from dokslade/ogl-screenshot-offsetJordan Woyak
VideoCommon: Fix OpenGL screenshots of partial XFB copies
2026-11-15BitSet: Some small additionsMartino Fontana
Also add requirements for using range functions. And micro-optimize testing if a bit is set (GCC and MSVC struggle to emit `bt` or `tbz`/`tbnz` with `bs & (1 << n)` compared to `(bs >> n) & 1`).
2026-11-15VideoCommon: Fix OpenGL screenshots of partial XFB copiesdok.slade
ScaleTexture flipped its rectangles for backends with a lower-left origin, but textures are stored top row first and the copy shader keeps the row order, so the flip is only a no-op for full rectangles. With a sub-rectangle, OpenGL frame dumps and screenshots read the bottom of the texture instead of the top, and came out shifted up with a black band at the bottom. Pass the rectangles through unchanged. Other backends and callers using full rectangles are not affected. Fixes https://bugs.dolphin-emu.org/issues/12286
2026-11-15Merge pull request #14966 from SuperSamus/optimize-efb-xfb-uninitializationJosJuice
TextureCacheBase: Optimize EFB and XFB uninitialization
2026-11-13PerformanceTracker: Fix broken FPS calculation on Windows after a ↵Jordan Woyak
multi-second delay.
2026-11-12Merge pull request #14877 from SuperSamus/performance-tracker-variance-fixupJordan Woyak
PerformanceTracker: Small cleanup, properly use RunningVariance for the standard deviation
2026-11-05VideoCommon: error if the same asset id is used with a different typeiwubcode
2026-11-01Merge pull request #14916 from iwubcode/vertex_manager_draw_refactorJordan Woyak
VideoBackends / VideoCommon: split draw calls into separate commit and render functions
2026-10-31PerformanceTracker: Small cleanup, properly use RunningVariance for the ↵Martino Fontana
standard deviation UpdateStats() was calculating the standard deviation from the entirety of m_dt_queue, which has a noticeable performance impact when the frame rates are very high. On a scene so light it runs at 3000 FPS, UpdateStats() was taking around 5% of the profiling (at default 1s sample window). Now it doesn't.
2026-10-31TextureCacheBase: Optimize EFB and XFB uninitializationMartino Fontana
For EFB, optimize the case where bytes_per_row == stride. For XFB, do that, and make sure that autovectorization is used without intrinsics. They were only used on x86, so that should improve performance on ARM. (MSVC ARM specifically will load to register on every iteration, and I give up on this stupid compiler, but it should still be better than before.) For reference, on x86 with SIMD, on a scene that runs at 3000 FPS, this function takes 1.5% of time according to the profiler. I spent way too much time making all the compilers cooperate, and I hate it.
2026-10-31VideoBackends / VideoCommon: split draw calls into separate commit and ↵iwubcode
render steps
2026-10-31Merge pull request #14943 from Sintendo/vertex-arm64JosJuice
VertexLoaderARM64: Optimize RGB565 and RGBA6666
2026-10-31Merge pull request #14928 from JosJuice/neon-texture-decoderJosJuice
VideoCommon: Add TextureDecoder_ARM64.cpp
2026-10-31Merge pull request #14782 from tygyh/Core/Use-lerp-and-midpointiwubcode
Replace manual calculations with std::lerp and std::midpoint
2026-10-30Merge pull request #14866 from SuperSamus/efb-to-texture-clear-byteiwubcode
VideoCommon: Option for byte to memset in RAM when `EFBToTextureEnable = True`
2026-10-24VertexLoaderARM64: Optimize RGBA6666Sintendo
This commit replaces the old instruction sequence with one that is considerably shorter. Main ideas are as follows: - Use AND with constant mask to isolate the needed bits. - Use ORR + LSL/LSR to shirt the bits into position and combine in one instruction where possible. - Red and alpha are already sequential, so don't need to wait for the byteswap. - Do the expansion from 6 to 8 bits at the end for all 4 components in one step. Before: ldur w14, [x0] rev w14, w14 ubfx w15, w14, #0, #6 orr w15, wzr, w15, lsl #2 orr w15, w15, w15, lsr #6 orr w16, wzr, w15, lsl #24 ubfx w15, w14, #6, #6 orr w15, wzr, w15, lsl #2 orr w15, w15, w15, lsr #6 orr w16, w16, w15, lsl #16 ubfx w15, w14, #12, #6 orr w15, wzr, w15, lsl #2 orr w15, w15, w15, lsr #6 orr w16, w16, w15, lsl #8 ubfx w15, w14, #18, #6 orr w16, w16, w15, lsl #2 orr w16, w16, w15, lsr #4 str w16, [x1, #0xc] After: ldur w14, [x0] rev w15, w14 and w16, w14, #0xfc00 and w14, w14, #0x3f000000 lsr w16, w16, #8 orr w16, w16, w14, lsl #2 and w14, w15, #0xfc0 and w15, w15, #0x3f000 orr w15, w15, w14, lsl #14 orr w16, w16, w15, lsr #2 and w15, w16, #0xc0c0c0c0 orr w16, w16, w15, lsr #6 str w16, [x1, #0xc]
2026-10-24VertexLoaderARM64: Optimize RGB565Sintendo
This replaces the old instruction sequence with one that is considerably shorter. Main ideas are as follows: - Use AND with constant mask to isolate the needed bits. - Use ORR + LSL/LSR to shift the bits into position and combine in one instruction where possible. - Red and blue are already sequential, so don't need to wait for the byteswap. This is especially handy for red, where the bits are already where they need to be. - Red and blue can be expanded from 5 to 8 bits together. Before: ldurh w14, [x0, #0x1] rev16 w14, w14 and w15, w14, #0x1f orr w15, wzr, w15, lsl #3 orr w15, w15, w15, lsr #5 orr w16, wzr, w15, lsl #16 ubfx w15, w14, #5, #6 orr w15, wzr, w15, lsl #2 orr w15, w15, w15, lsr #6 orr w16, w16, w15, lsl #8 ubfx w15, w14, #11, #5 orr w16, w16, w15, lsl #3 orr w16, w16, w15, lsr #2 orr w16, w16, #0xff000000 str w16, [x1, #0xc] After: ldurh w14, [x0, #0x1] rev16 w15, w14 bfi w14, w14, #11, #13 and w16, w14, #0xf800f8 and w14, w14, #0xe000e0 orr w16, w16, #0xff000000 orr w16, w16, w14, lsr #5 and w14, w15, #0x7e0 and w15, w15, #0x600 orr w14, w14, w15, lsr #6 orr w16, w16, w14, lsl #5 str w16, [x1, #0xc]
2026-10-18Merge pull request #14934 from iwubcode/efb_interface_remove_globalJordan Woyak
VideoCommon: remove global framebuffer manager from EFBInterface
2026-10-17Merge pull request #14804 from JosJuice/jit-set-lazy-memory-regionJosJuice
Jit: Use LazyMemoryRegion-backed bit sets
2026-10-16VideoCommon: remove global framebuffer manager from EFBInterface and instead ↵iwubcode
pass it in
2026-10-12Fix build failure on libc++/clang 23WalterCool
libc++ 23 enforces the dependency from certain stdlib. In this case, we need <vector> here or build will fail. Signed-off-by: WalterCool <waltercool@slash.cl>
2026-10-11VideoCommon: Use GPR units more in TexDecoder_DecodeImpl_CMPRJosJuice
This improves the time reported by the CMPR unit test. The lowest value is about 14% lower, but there's more variance, with the highest value being similar to before. The instruction count has increased. I'm putting this in a separate commit so the older implementation is available in the commit history for anyone wanting to look at it.
2026-10-11VideoCommon: Add TextureDecoder_ARM64.cppJosJuice
We already have x64 SIMD implementations for decoding most texture formats. This commit adds AArch64 SIMD implementations for all texture formats except the XFB format. (AArch64 was previously using the non-SIMD implementations from TextureDecoder_Generic.cpp.) I left a few TODO comments about things that could be improved using optional ISA extensions. I don't have any immediate plans to work on these. Performance numbers from the unit test are available below. Note that the unit test fits relatively well in cache, so real workloads might spend more time waiting on memory, which could lead to smaller differences between the old and new implementation. Before: I4 took 2676 ns on average (36 iterations) I8 took 3961 ns on average (36 iterations) IA4 took 7304 ns on average (36 iterations) IA8 took 4555 ns on average (36 iterations) RGB565 took 12146 ns on average (36 iterations) RGB5A3 took 33155 ns on average (36 iterations) RGBA8 took 3702 ns on average (36 iterations) C4 (IA8) took 9149 ns on average (36 iterations) C4 (RGB565) took 19398 ns on average (36 iterations) C4 (RGB5A3) took 28533 ns on average (36 iterations) C8 (IA8) took 6766 ns on average (36 iterations) C8 (RGB565) took 15577 ns on average (36 iterations) C8 (RGB5A3) took 18906 ns on average (36 iterations) C14X2 (IA8) took 10603 ns on average (36 iterations) C14X2 (RGB565) took 20700 ns on average (36 iterations) C14X2 (RGB5A3) took 38878 ns on average (36 iterations) CMPR took 6205 ns on average (36 iterations) After: I4 took 2086 ns on average (36 iterations) I8 took 1699 ns on average (36 iterations) IA4 took 1522 ns on average (36 iterations) IA8 took 1673 ns on average (36 iterations) RGB565 took 2443 ns on average (36 iterations) RGB5A3 took 3922 ns on average (36 iterations) RGBA8 took 1983 ns on average (36 iterations) C4 (IA8) took 1646 ns on average (36 iterations) C4 (RGB565) took 2057 ns on average (36 iterations) C4 (RGB5A3) took 1670 ns on average (36 iterations) C8 (IA8) took 3765 ns on average (36 iterations) C8 (RGB565) took 4275 ns on average (36 iterations) C8 (RGB5A3) took 5146 ns on average (36 iterations) C14X2 (IA8) took 5121 ns on average (36 iterations) C14X2 (RGB565) took 5572 ns on average (36 iterations) C14X2 (RGB5A3) took 7142 ns on average (36 iterations) CMPR took 3250 ns on average (36 iterations)
2026-10-10VideoCommon: Rename TexDecoder_DecodeTexel width parameterJosJuice
All existing callers pass the width minus one, and passing the width without subtracting one gives incorrect results. Let's call the parameter image_width_minus_1, like TextureSampler.cpp already calls it.
2026-10-07Merge pull request #14912 from acts-1631/savestate-fifo-pointer-validationJosJuice
VideoCommon: validate restored FIFO pointers
2026-10-07Merge pull request #14835 from JoshuaVandaele/vulkan-over-glJosJuice
VideoCommon: Prefer Vulkan over OpenGL on Linux
2026-10-06Merge pull request #14836 from iwubcode/dolphin_texture_refactor_1iwubcode
VideoCommon: refactor texture cache frame buffer copies
2026-10-06Merge pull request #14840 from iwubcode/dolphin_texture_refactor_3iwubcode
VideoCommon: split partial texture update logic from the actual rendering
2026-10-06Merge pull request #14908 from iwubcode/vertex_manager_remove_custom_shadersiwubcode
VideoCommon: remove remnants of old custom shader feature
2026-10-04Merge pull request #14907 from iwubcode/texture_return_sharediwubcode
VideoCommon: return a RcTcacheEntry (shared_ptr) from TextureCacheBase::Load()
2026-10-04VideoCommon: validate restored FIFO pointersActs1631
Save states restored video FIFO pointers from unchecked offsets. A crafted offset could place a pointer outside its backing allocation and turn the next gather-pipe copy into an out-of-bounds native write. Require pointer offsets to stay within their backing array and reject a state when either offset is invalid or the read pointer follows the write pointer.
2026-10-04VideoCommon: refactor texture cache frame buffer copies, in preparation for ↵iwubcode
a future enhancement
2026-10-04VideoCommon: remove remnants of old custom shader feature, it will be ↵iwubcode
replaced by Materials in the future
2026-10-04Merge pull request #14899 from Starlightbotanist/adreno-tev-zero-rewriteiwubcode
VideoCommon: Work around Adreno TEV zero input miscompilation
2026-10-04VideoCommon: Work around Adreno TEV zero input miscompilationStarlightbotanist
Some Qualcomm Android drivers from version 700 onward miscompile specialized TEV pixel shaders when color input A or B is TevColorArg::Zero. Use konstLookup[8].rgb, which PixelShaderManager initializes to zero, to keep these inputs dependent on a uniform value. Use the existing driver bug gate for OpenGL and Vulkan. Other inputs and unaffected drivers retain their original shader expressions.
2026-10-03VideoCommon: split partial texture update logic from the actual renderingiwubcode
2026-10-03VideoCommon: return a RcTcacheEntry (shared_ptr) from TextureCacheBase::Load()iwubcode
This allows the texture entry to be stored off or passed around and shared in the future
2026-10-03Merge pull request #14812 from JoshuaVandaele/correct-env-localeJosJuice
Fix crashes when using `std::locale{""}` with an invalid LC_ALL
2026-10-03VideoCommon: Option for byte to memset in RAM when `EFBToTextureEnable = True`Martino Fontana
The main use case is for games that in theory should be compatible with `EFBToTextureEnable = True`, as the CPU never reads the EFB texture and only writes to it completely. However, if what the CPU writes is only zeros, if the texture in RAM was already zeros then Dolphin wouldn't notice the change in RAM and thus wouldn't invalidate the texture in VRAM. This happens in Rhythm Heaven Fever, and with this change it doesn't require `EFBToTextureEnable = False` anymore. But there are other use cases, like setting a clear value that is closer to what the EFB copy would be, like in Excite Truck. (`EFBToTextureEnable` is still `False` by default.) Other games are more subjective (and not changed here): for instance Mario Kart Wii samples the EFB copy to decide whether to display a sun flare. Currently with `EFBToTextureEnable = True` (default) it will never be shown, but maybe someone would prefer for the flare to always be shown, even behind walls. The option currently only supports setting a single byte (that will be memset to the entire texture), as setting a color would be more complex given that a texture can be in multiple formats, and there is no use case (yet) for it.
2026-09-24VideoCommon/Statistics: Use unsigned int where appropriateMartino Fontana
Some poorly coded games are able to overflow some statistics (e.g. Jimmy Neutron: Boy Genius's title screen). While funny, signed integer overflow is undefined behavior, and while in practice here it's extremely unlikely to cause issues, it's still better to avoid it.
2026-09-06Revert "VideoCommon: Use correct size for PE token"Link Mauve
This reverts commit e4349ae1791dec688d91c6813eeadf049a8c73ec. The 0x prefix is included in the characters count (unlike e.g. in Rust where there is no 0x prefix), so that commit was wrong. Sorry about that! Fixes regression introduced in #14842.
2026-09-06Merge pull request #14789 from phire/optimise_vs_uidScott Mansell
Optimize vertex_shader_uid_data down to 28 bytes
2026-09-03VideoCommon: Use correct size for PE tokenLink Mauve
This token is a u16, not a u24, so let’s not display unnecessary 00 padding.
2026-08-31VideoCommon: separate out reinterpret and palette texture creation from ↵iwubcode
rendering
2026-08-31VideoCommon: Prefer Vulkan over OpenGL on LinuxJoshua Vandaële
2026-08-22Common: Add DivideRoundingUp functionJosJuice
Many callers of AlignUp are dividing immediately after aligning. Let's add a helper function for this so callers don't have to specify the alignment size twice.
2026-08-16Replace manual calculations with std::lerp and std::midpointDr. Dystopia
2026-08-12Fix crashes when using `std::locale{""}` with an invalid LC_ALLJoshua Vandaële
2026-08-07Optimize vertex_shader_uid_data down to 28 bytesScott Mansell
This started as a fixing a misalignment issue, but I got carried away. Was originally 41 bytes (overflowing it's expected 40 bytes by 1 bit). Now it's 27 bytes plus 8 bits of padding (ready for future expansion). The savings come from: - Removing UV usage from components, it can be reconstructed from texcoord_elem_count (saved 8 bits) - Removed the 8 unused bits from texMtxInfo_n_projection (saved 8 bits) - Removing unused bit from from start of components (saved 1 bit) - Removed extra bit from inputform, texgentype and sourcerow - packed texMtxInfo_n_projection and texcoord_elem_count back into the per texgen info space freed up above. (saved 24 bits) - Overlayed postMtx index and Emboss mode shifts into a union based on texgentype (saved 56 bits) - Move to a single-bit union tag, freeing up an extra bit for regular texgens. - Move PotMtx normalize into the freed up space (saved 8 bits) Total savings: 105 bits of data EDIT: Even worse, MSVC wasn't respecting pack(1) for bitfields at all, so on windows this struct was actually quite a bit larger. Something like 80 bytes, if not more. Fixed this by dropping the size of any enums used in these bit structs to u8. Our Common::BitField allows for the underlying type to be explicitly specified to something larger. msvc's bitfield packing appears to be completely braindead, can't mix sizes at all.
2026-08-02VideoCommon: Fix custom texture count in OSD messageJosJuice
83dc468 broke the OSD message that shows the number of custom textures. If Prefetch Custom Textures was disabled, the number would always be 0.