Commit graph

127 commits

Author SHA1 Message Date
iwubcode
a2ad3ca6f7 VideoCommon: don't do pointer copies during graphics mod callback iteration 2023-07-02 13:58:07 -05:00
Robin Kertels
93fce0e4b6
VideoCommon:VertexManagerBase: Only calculate remaining indices once
Before, both of those were calculated 3 times due to the ASSERTs.
2023-03-20 20:59:50 +01:00
Scott Mansell
31cfe8250d Lint fixes 2023-02-09 18:36:20 +13:00
Scott Mansell
abfc75f362 Cleanup headers 2023-01-31 19:41:24 +13:00
Scott Mansell
0da69055d9 Split out everying remaining from Swap 2023-01-31 19:41:24 +13:00
Scott Mansell
2a18b34a73 Wire up frame before/after events 2023-01-31 19:41:24 +13:00
Scott Mansell
ca5ec13e13 Move GraphicsMod out of RenderBase 2023-01-31 19:41:24 +13:00
Scott Mansell
99d3e489ea Move BoundingBox out of RenderBase
They were essentially just pass-though methods
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
Pierre Bourdon
9c9310bf44
Merge pull request #11208 from TellowKrinkle/CPUCull
Cull vertices on the CPU
2023-01-26 23:15:23 +01:00
TellowKrinkle
1be0149146 VideoCommon: Cull vertices on the CPU 2023-01-25 02:21:56 -06:00
Pokechu22
d91f340c86 VertexManagerBase: Move free space check to after the buffer is reset
Fixes incorrect logspam when the buffer needed to be reset on flushes (which we already were doing, but 52feed04db moved it to after the check was made). This is https://bugs.dolphin-emu.org/issues/10312.

I also converted it to an assert, as if this does happen, things are going to render incorrectly, so we want to make it obvious.
2023-01-03 17:06:51 -08:00
Admiral H. Curtiss
cb0a603c72
VideoCommon: De-globalize GeometryShaderManager class. 2022-12-29 15:33:19 +01:00
Admiral H. Curtiss
50625728e0
VideoCommon: De-globalize VertexShaderManager class. 2022-12-28 15:52:29 +01:00
Admiral H. Curtiss
725bd64ec2
VideoCommon: De-globalize PixelShaderManager class. 2022-12-27 20:13:24 +01:00
TellowKrinkle
1e9b6f88e4 VideoCommon: Support hot reloading of VS expand 2022-10-22 20:18:02 -05:00
TellowKrinkle
68f49df0f8 VideoCommon: Add vertex shader point and line expansion 2022-10-22 20:13:24 -05:00
Pokechu22
ffed23c059 Simplify saving CP state
Rather than makring some parts of VertexLoaderManager dirty in some places and some in others, do it all in VideoState. Also, since CPState no longer contains pointers/non-CP data after d039b1bc0d, we can just use p.Do on it instead of manually saving each field.
2022-10-09 19:32:59 -07:00
Pokechu22
05f3bbfa4d Include tangent/binormal cache in savestates
This theoretically matters for RS2/RS3, although in practice these games reconfigure it each frame so it shouldn't matter for savestates.
2022-10-09 16:21:49 -07:00
iwubcode
bc360584a3 VideoCommon: add structures to graphics mods to allow for future adding or removing parameters with less code overhead 2022-10-09 00:00:01 -05:00
JMC47
e237aa1435
Merge pull request #10777 from tellowkrinkle/EFBFlush
VideoCommon: Remember to flush command buffers after multiple EFB copies
2022-07-13 19:45:31 -04:00
TellowKrinkle
3ee4b89a46 VideoCommon: Remember to flush command buffers after multiple EFB copies 2022-07-06 18:38:05 -05:00
iwubcode
892678648e VideoCommon: trigger mod calls in TextureCacheBase (efb/xfb calls), VertexManagerBase (draw calls), and VertexShaderManager (projection calls) 2022-06-27 18:20:52 -05:00
Dentomologist
f6b9acccfc Common: Refactor PointerWrap 2022-05-25 13:06:41 -07:00
Pokechu22
2a5c77f43f VideoCommon: Handle emboss texgen with only a single normal
Fixes a large number of effects in Rogue Squadron 2 and 3.
2022-04-22 16:54:38 -07:00
Pokechu22
39b2854b98 VertexLoader: Convert count register to remaining register
This more accurately represents what's going on, and also ends at 0 instead of 1, making some indexing operations easier.  This also changes it so that position_matrix_index_cache actually starts from index 0 instead of index 1.
2022-04-22 16:54:38 -07:00
Pokechu22
97d0ff58c8 Convert vertex loader position cache to std::array 2022-04-22 16:54:38 -07:00
Pokechu22
3aaeb2b9ef Convert OpcodeDecoder::Opcode and OpcodeDecoder::Primitive to enum class 2021-12-18 12:51:56 -08:00
Pokechu22
6236a0d494 Eliminate SamplerCommon 2021-11-17 20:04:34 -08:00
Scott Mansell
88bd10cd30 Extend TMEM cache implementation
Now works with games that deliberately avoid invalidating TMEM because
they know textures are too large to fit:

 * Sonic Riders
 * Metal Arms: Glitch in the System
 * Godzilla: Destroy All Monsters Melee
 * NHL Slapshot
 * Tak and the Power of Juju
 * Night at the Museum: Battle of the Smithsonian
 * 428: Fūsa Sareta Shibuya de
2021-10-12 15:51:24 +13:00
Techjar
1161af8059 VideoCommon: Abstract bounding box
This moves much of the duplicated bounding box code into VideoCommon,
leaving only the specific buffer implementations in each backend.
2021-10-04 15:51:24 -04: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
Pokechu22
aab81d5aa0 Convert XFMemory to BitField and enum class
Additionally a new ClipDisable union has been added (though it is not currently used by Dolphin).
2021-03-06 19:27:14 -08:00
Shawn Hoffman
07fd02f207 rename Core/Analytics to Core/DolphinAnalytics 2021-01-27 14:29:47 -08:00
Lioncash
3d9b2aa005 VideoCommon: Migrate over to fmt
Migrates off the printf-based formatting where applicable.
2020-11-17 21:23:58 -05: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
Sintendo
523954e03a Analytics: Report correct quirk for mismatched xf/bp colors
Looks like a copy-paste error. The quirk for mismatched xf/bp texgens
was used twice.
2020-04-24 02:22:51 +02:00
JMC47
d845b31579
Merge pull request #8717 from stenzek/mismatched-xf-bp
VertexManagerBase: Skip drawing objects with mismatched xf/bp stages
2020-04-21 10:07:36 -04:00
Stenzek
ff7180cac4 Analytics: Add quirk for mismatched xf/bp texgens/colors 2020-04-02 12:52:16 +10:00
Stenzek
a9c1dcf656 VertexManagerBase: Skip drawing objects with mismatched xf/bp stages
Hardware tests have shown that if the number of texgens/channels do not
match, you get garbage rendering. Presumably because the output
registers from the XF stage are fed into the incorrect input registers
for TEV/BP.

Currently, this causes Dolphin to crash/generate invalid shaders with an
assertion failure in the hardware backends. Instead, we log an error.

Perhaps in the future we should just spit out all texgens/colors anyway
from both stages, and let cross-stage optimization take care of DCE'ing
it away. But doing so would require changing the UIDs and invalidating
everyone's shader caches.
2020-04-02 12:51:41 +10:00
Jordan Woyak
10223da6a8 VideoCommon: Tweak widescreen heuristic and clean up some related Renderer logic. 2020-02-09 13:22:25 -06:00
David Korth
c2dd2e8a2e Use std::istringstream or std::ostringstream instead of std::stringstream where possible.
This removes std::iostream from the inheritance chain, which reduces
overhead slightly.
2019-12-29 23:45:02 -05:00
Anthony
fdb78b64e1
Merge pull request #8513 from lioncash/bounding-box
VideoCommon/BoundingBox: Make interface for querying bounding box data
2019-12-07 18:40:02 -08:00
Lioncash
9bd533ebe4 VideoCommon/BoundingBox: Make interface for querying bounding box data
Rather than expose the bounding box members directly, we can instead
provide an interface for code to use. This makes it nicer to transition
from global data, as the interface function names are already in
place.
2019-12-05 11:48:42 -05:00
Lioncash
10f7674651 VideoCommon/IndexGenerator: Eliminate static state
Now that we've extracted all of the stateless functions that can be
hidden, it's time to make the index generator a regular class with
active data members.

This can just be a member that sits within the vertex manager base
class. By deglobalizing the state of the index generator we also get rid
of the wonky dual-initializing that was going on within the OpenGL
backend.

Since the renderer is always initialized before the vertex manager, we
now only call Init() once throughout the execution lifecycle.
2019-12-05 10:49:32 -05:00
Stenzek
1082468133 TextureCache: Support saving cache entries, including EFB copies 2019-07-24 04:10:38 +10:00
Stenzek
b26bb0605b VideoBackendBase: Do save state logic on the GPU thread 2019-07-24 04:08:25 +10:00
Lioncash
d4337eebde VideoCommon/Statistics: Rename stats global to g_stats
Makes the global variable follow our convention of prefixing g_ on
global variables to make it obvious in surrounding code that it's not a
local variable.
2019-07-10 23:34:54 -04:00
Lioncash
a99c7d01e1 VideoCommon/Statistics: Normalize statistic variable names
Normalizes all variables related to statistics so that they follow our
coding style.

These are relatively low traffic areas, so this modification isn't too
noisy.
2019-07-10 23:19:10 -04:00
Lioncash
04c06ec661 VideoCommon/Statistics: Use std::array for projection values
Makes the members within the interface much nicer to look at, and also
makes copying them over much nicer too.
2019-06-20 08:06:20 -04:00