Commit Graph

46 Commits

Author SHA1 Message Date
mitaclaw 9bd1dae41d Modernize `std::fill` with ranges
In DSPCore.cpp, there were two `std::fill` uses that could be simplified using `std::fill_n`. Due to their proximity with other `std::fill` algorithms being modernized with ranges, I chose to make these examples into the rare `std::ranges::fill_n`.
2024-10-10 00:53:48 -07:00
TellowKrinkle fd94ff252d VideoCommon: Dirty pixel shader manager on efb scale changes 2024-09-30 01:12:55 -05:00
Lioncash cac66317aa VideoCommon/Statistics: Remove global system accessor from s_after_frame_event
Instead, we make the event take a reference to the system and then pass
it in when the event is triggered.

This does introduce two other accessors, but these are much easier to
refactor out over time, and without modification to the existing event
interface.
2024-01-31 13:12:09 -05:00
iwubcode 12dd15c8dd VideoBackends / VideoCommon: add type enum to dictate whether a texture is a 2D texture, a texture array, or a cube map; support 2D texture type across backends
Co-authored-by: TellowKrinkle <tellowkrinkle@gmail.com>
2023-12-15 11:06:02 -06:00
Scott Mansell d3ddd96cee Make sure m_prev_efb_format is initilized 2023-02-09 18:36:20 +13:00
Scott Mansell 2cfc02a116 Move m_prev_efb_format into FramebufferManager 2023-02-09 18:36:20 +13:00
Scott Mansell 31cfe8250d Lint fixes 2023-02-09 18:36:20 +13:00
Scott Mansell 11de923dcb Move xfb tracking and IR scaling out of RenderBase 2023-02-09 18:36:20 +13:00
Scott Mansell e009002411 Refactor ClearRegion
And fix bug where opengl was getting the wrong coordinates
2023-02-09 18:36:20 +13:00
Scott Mansell 0da69055d9 Split out everying remaining from Swap 2023-01-31 19:41:24 +13:00
Scott Mansell 8a23629345 Split AbstractGfx out of Renderer
Almost all the virtual functions in Renderer are part of dolphin's
"graphics api abstraction layer", which has slowly formed over the
last decade or two.

Most of the work was done previously with the introduction of the
various "AbstractX" classes, associated with texture cache cleanups
and implementation of newer graphics APIs (Direct3D 12, Vulkan, Metal).
We are simply taking the last step and yeeting these functions out
of Renderer.

This "AbstractGfx" class is now completely agnostic of any details
from the flipper/hollywood GPU we are emulating, though somewhat
specialized.

(Will not build, this commit only contains changes outside VideoBackends)
2023-01-31 18:46:02 +13:00
Pokechu22 1fdf15a1be VideoCommon/FramebufferManager: Rename m_efb_cache_tiles_wide to m_efb_cache_tile_row_stride
This also initializes it in the non-tiled case just for consistency, although it's not actually read in that case.
2022-11-15 16:04:41 -08:00
Pokechu22 55e1c3b51d VideoCommon/FramebufferManager: use !IsUsingTiledEFBCache() in GetEFBCacheTileRect
This is for readability only, and should behave identically.
2022-11-15 15:48:56 -08:00
Pokechu22 90d05fe37e VideoCommon/FramebufferManager: Always update frame access mask on depth peeks
0e02ddcf52 removed separate logic for tiled versus non-tiled EFB peek caches, and as part of that made it so that color peeks updated the frame access mask even when a non-tiled cache is in use. However, the same change was not made for depth peeks. I'm not sure if this affected anything in practice.
2022-11-15 15:34:03 -08:00
Robin Kertels 0e02ddcf52
VideoCommon:FramebufferManager: Cleanup 2022-11-04 01:18:23 +01:00
Robin Kertels 371935d61e
VideoCommon:FramebufferManager: Mark cache as valid after refresh
Otherwise we might never hit the early return
if either depth or color doesnt have any active
tiles.
2022-11-04 01:18:23 +01:00
Robin Kertels 779fe13e62
VideoCommon: Update EFB peek cache on draw done and tokens
Massively improves performance in Mario Galaxy on Android.
2022-10-01 18:08:38 +02:00
TellowKrinkle 6ee0248eab VideoBackends:Metal: MSAA support 2022-07-21 20:44:19 -05:00
Dentomologist f6b9acccfc Common: Refactor PointerWrap 2022-05-25 13:06:41 -07:00
Pokechu22 23cbd570a1 FramebufferManager: Flush pending EFB pokes in PopulateEFBCache
I.e. flush pokes before running an EFB peek, if the cache tile isn't present.  If the cache tile is present, then EFB pokes should have been written to the cache tile and thus don't need to be flushed.
2022-02-21 13:23:22 -08:00
Pokechu22 afd02b79a5 VideoCommon: Add names for textures and shaders 2022-01-01 11:38:56 -08:00
Pokechu22 27cb704466 Eliminate VarType for ComponentFormat 2021-12-18 15:21:48 -08:00
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Lioncash 3d9b2aa005 VideoCommon: Migrate over to fmt
Migrates off the printf-based formatting where applicable.
2020-11-17 21:23:58 -05:00
Stenzek 880f7ca6bb FramebufferManager: Fix EFB readbacks with MSAA on
Regression from #8827.
2020-09-25 20:58:02 +10:00
Connor McLaughlin b4e063311e
Merge pull request #8827 from stenzek/adreno-more-like-brokenreno
FramebufferManager: Fix invalid readback of EFB D24S8 depth
2020-05-28 16:55:42 +10:00
Lioncash 86f8768268 VideoCommon/ShaderGenCommon: Make template functions regular functions
These are only ever used with ShaderCode instances and nothing else.
Given that, we can convert these helper functions to expect that type of
object as an argument and remove the need for templates, improving
compiler throughput a marginal amount, as the template instantiation
process doesn't need to be performed.

We can also move the definitions of these functions into the cpp file,
which allows us to remove a few inclusions from the ShaderGenCommon
header. This uncovered a few instances of indirect inclusions being
relied upon in other source files.

One other benefit is this allows changes to be made to the definitions
of the functions without needing to recompile all translation units that
make use of these functions, making change testing a little quicker.

Moving the definitions into the cpp file also allows us to completely
hide DefineOutputMember() from external view, given it's only ever used
inside of GenerateVSOutputMembers().
2020-05-25 21:12:29 -04:00
Stenzek bf74553878 FramebufferManager: Copy to color format for depth readbacks on GLES
glReadPixels() with depth formats is not supported.

Should fix broken EFB access on GLES.
2020-05-24 16:11:11 +10:00
Stenzek ad373950a2 FramebufferManager: Fix invalid readback of EFB D24S8 depth
Fixes assertion tripping when saving state on Adreno.
2020-05-24 15:36:04 +10:00
Connor McLaughlin 1092efa77a
Merge pull request #8276 from stenzek/adreno-efb-access
Fix CPU EFB access on Adreno with Vulkan backend
2019-08-08 12:23:27 +10:00
Stenzek 25b3e5e029 FramebufferManager: Fix restoring of EFB depth buffer
Correct state wasn't being set.
2019-08-03 01:46:54 +10:00
Stenzek 06daf58032 FramebufferManager: Correctly handle read back D24S8 textures
Needed for the Adreno/Vulkan workaround, and if we ever switch to a D24
texture for the depth buffer w/ unrestricted depth range.
2019-07-31 15:33:28 +10:00
Stenzek 53e30c06e8 Config: Add an option to skip saving texture cache to save state 2019-07-24 05:19:22 +10:00
Stenzek 137009affe FramebufferManager: Support saving EFB to save state 2019-07-24 05:19:22 +10:00
Stenzek 53af27b133 FramebufferManager: Fix invalid transitions for 1xIR in EFB cache 2019-04-28 16:13:49 +10:00
Stenzek 3c455de799 FramebufferManager: Fix broken EFB peeks in GL with MSAA on 2019-03-30 03:14:29 +10:00
Connor McLaughlin 1304e963ad
Merge pull request #7895 from stenzek/framebuffer-corruption
FramebufferManager: Don't discard in ReinterpretPixelData
2019-03-29 20:03:13 +10:00
JMC47 b4b0ebae27
Merge pull request #7934 from stenzek/stretched-efb-peeks
FramebufferManager: Fix EFB peek cache stretching last tile
2019-03-27 10:53:47 -04:00
Stenzek 92fa6c34cd FramebufferManager: Fix EFB pokes being offset by 1 in D3D 2019-03-27 23:28:34 +10:00
Stenzek c28393d6f9 FramebufferManager: Fix EFB peek cache stretching last tile 2019-03-27 22:12:40 +10:00
Stenzek cff60f5ba0 FramebufferManager: Only clear tile array when valid
When looking into the Faron Woods fifolog, I noticed this code was quite
high in the profile (~10%). Clearing 4096 entries from the vector isn't
needed every draw, we only need to do this when the cache was actually
valid in the first place.

Should provide a slight general performance boost.
2019-03-24 15:03:04 +10:00
Stenzek 8aa0ea10d9 FramebufferManager: Don't discard in ReinterpretPixelData
This was causing the depth buffer to be discarded as well, which
has an effect on mobiles (doesn't get loaded into tile memory).

If we find this is hindering performance (remember, the EFB is
only a 640x528 texture), it may be worth changing the interface to
support discarding only the colour buffer.
2019-03-16 23:45:08 +10:00
Stenzek cce7ac43d4 FramebufferManager: Fix panic in VertexManager with large EFB depth poke batches 2019-03-12 18:26:07 +10:00
Stenzek a218a794cb FramebufferManager: Implement deferred EFB cache invalidation 2019-03-09 12:24:04 +10:00
Stenzek 6bc4bfd26a FramebufferManager: Implement EFB tile cache
The new tile cache is dynamic in size and can be turned on/off.
2019-03-09 12:23:33 +10:00
Stenzek f039149198 Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00