Commit graph

132 commits

Author SHA1 Message Date
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
TellowKrinkle
1eb3aaa548 VideoCommon: Use std::array in PortableVertexDeclaration 2022-09-19 16:28:24 -05:00
TellowKrinkle
4c629c2bee VideoCommon: Add dynamic vertex loader to ubershaders 2022-09-19 16:28:23 -05:00
Pokechu22
8129874d11 Sanitize and use increased precision when normalizing light directions
This normalization was added in 02ac5e95c8, and changed to use floats in 4bf031c064.  The conversion to floats means that sometimes there is insufficient precision for the normalization process, which results in values of NaN or infinity.  Performing the whole process with doubles prevents that, but games also sometimes set the values to NaN or infinity directly (possibly accidentally due to the values not being initialized due to them not being used in the current configuration?).

The version of Mesa currently in use on FifoCI (20.3.5) has issues with NaN.  Although this bug has been fixed (b3f3287eac in 21.2.0), FifoCI is stuck with the older version.

This change may or may not be incorrect, but it should result in the same behavior as already present in Dolphin, while working around the Mesa bug.
2022-08-04 08:52:44 -07:00
iwubcode
4788a05c76 VideoCommon: fix projection graphics mod affecting more than the intended draw call 2022-06-29 20:04:59 -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
f3eff70e2f Implement ImGui window for scissor rectangles
This is mainly for debugging, and is only exposed by manually editing the configuration.
2022-04-16 12:35:00 -07:00
Pokechu22
076392a0f6 VideoCommon: Rework scissor handling
This increases accuracy, fixing the white rendering in Major Minor's Majestic March.  However, the hardware backends can only have one viewport and scissor rectangle at a time, while sometimes multiple are needed to accurately emulate what is happening.  If possible, this will need to be fixed later.
2022-04-16 10:26:11 -07:00
Pokechu22
4595b89ad8 VideoCommon: Remove bSupportsOversizedViewports
I think this is a relic of D3D9.  D3D11 and D3D12 seem to work fine without it.  Plus, ViewportCorrectionMatrix just didn't work correctly (at least with the viewports being generated by the new scissor code).
2022-04-16 10:26:11 -07:00
Pokechu22
dbb857b175 VertexShaderManager: Use g_ActiveConfig.UseVertexRounding() 2022-04-08 18:30:59 -07:00
Pokechu22
d039b1bc0d VideoCommon: Move VertexLoaderManager logic out of CPState 2021-12-18 15:21:48 -08:00
iwubcode
514475646d VideoCommon: update Free Look camera's 'FieldOfView' function to 'FieldOfViewMultiplier' to better reflect usage 2021-10-08 18:17:20 -05:00
iwubcode
e70157474b Core / VideoCommon: refactor FreeLookCamera to have the underlying controller handle all the logic (field-of-view, movement, etc) 2021-10-08 18:16:32 -05: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
c583cac568 Hack to hide debug cubes in Super Mario Sunshine
... while not breaking other games.
2021-06-09 20:50:49 -07: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
Pokechu22
f749fcfa9f Convert CPMemory to BitField and enum class
Additionally, VCacheEnhance has been added to UVAT_group1.  According to YAGCD, this field is always 1.

TVtxDesc also now has separate low and high fields whose hex values correspond with the proper registers, instead of having one 33-bit value.  This change was made in a way that should be backwards-compatible.
2021-03-06 19:27:08 -08:00
iwubcode
bcf63c463b VideoCommon: Add 'Active' state to FreelookCamera to future proof if we ever add multiple cameras 2020-12-24 13:49:25 -06:00
iwubcode
f6ab9a9b6f Core / VideoCommon: Remove old Free Look config 2020-12-24 13:49:25 -06:00
Stenzek
51724c1ccd LightingShaderGen: Always calculate lighting for both color channels
Cel-damage depends on lighting being calculated for the first channel
even though there is no color in the vertex format (defaults to the
material color). If lighting for the channel is not enabled, the vertex
will use the default color as before.

The default value of the color is determined by the number of elements in
the vertex format. This fixes the grey cubes in Super Mario Sunshine.

If the color channel count is zero, we set the color to black before the
end of the vertex shader. It's possible that this would be undefined
behavior on hardware if a vertex color index that was greater than the
channel count was used within TEV.
2020-11-20 15:54:04 -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
Connor McLaughlin
9c12a843f8
Merge pull request #8884 from iwubcode/freelook_performance_fix
VertexShaderManager: Only look for freelook config changes if we're using freelook
2020-07-04 14:19:59 +10:00
iwubcode
0441d6aa5e VertexShaderManager: Avoid accessing freelook control type configuration each call which caused a performance hit, move check to RenderBase where it is checked when config changes 2020-07-02 12:55:08 -05:00
iwubcode
3d7d4dfc8a VideoCommon: Use freelook field of view to change the perspective of the camera 2020-06-25 13:34:42 -05:00
iwubcode
a65ef35f1a VideoCommon: Clean freelook camera dirty state when getting the new view 2020-06-17 12:07:40 -05:00
iwubcode
e125c61d47 VideoCommon: remove VertexShaderManager functions instead preferring the direct freelook camera methods 2020-05-03 13:34:13 -05: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
c1c5276729 VideoCommon/VertexShaderManager: Use std::array where applicable
We can use this to shorten up the initialization code a little bit.

Despite being saved to savestates, this is a non-breaking change.
2019-06-20 08:13:04 -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
Lioncash
a9663669dc Common/CommonFuncs: Remove now-unneccessary ArraySize function
Since C++17, non-member std::size() is present in the standard library
which also operates on regular C arrays. Given that, we can just replace
usages of ArraySize with that where applicable.

In many cases, we can just change the actual C array ArraySize() was
called on into a std::array and just use its .size() member function
instead.

In some other cases, we can collapse the loops they were used in, into a
ranged-for loop, eliminating the need for en explicit bounds query.
2019-06-01 10:07:57 -04:00
Jordan Woyak
779e618046 VideoCommon: Change free-look's middle-mouse action to roll the camera. 2019-04-17 05:10:11 -05:00
Jordan Woyak
69b617ce76 WiimoteEmu: Remove redundant Matrix library and use the one in Common. 2019-02-03 12:02:02 -06:00
Jordan Woyak
b9a00a40a9 Common: Move Matrix classes out of MathUtil into their own files and make their interface more friendly. 2019-02-03 11:35:31 -06:00
Techjar
8560eecd49 VideoCommon: Clean up class-memaccess warnings 2018-10-14 23:05:47 -04:00
JosJuice
91732e2baf Remove support for projection hacks
This isn't really useful for anything anymore as far as I know.
2018-04-01 21:41:18 +02:00
Stenzek
5359396099 BPFunctions: Move GX viewport conversion to VideoCommon 2018-02-20 00:49:32 +10:00
Lioncash
9c1f9c1c00 ConstantManager: Use std::array where applicable
Modernizes the arrays and makes future simplifications possible (e.g. usages within the software renderer).

It also makes cases where we use array->pointer decay explicit.
2017-08-27 15:41:36 -04:00
JosJuice
f090a94319 Remove non-integer IRs 2017-08-08 12:09:50 +02:00
Stenzek
745d541527 ShaderGen: Implement vertex ubershaders 2017-07-30 17:43:59 +10:00
Stenzek
f48ef65bec XFMemory: Convert several registers to bitfields 2017-07-30 17:43:59 +10:00
MerryMage
f8a99ca192 VertexShaderManager: Rename projection hack variables 2017-06-15 16:38:10 +01:00
Michael Maltese
d10d09ccc1 VideoCommon: rework anamorphic widescreen heuristic
Some widescreen hacks (see below) properly force anamorphic output, but
don't make the last projection in a frame 16:9, so Dolphin doesn't
display it correctly.

This changes the heuristic code to assume a frame is anamorphic based on
the total number of vertex flushes in 4:3 and 16:9 projections that
frame. It also adds a bit of "aspect ratio inertia" by making it harder
to switch aspect ratios, which takes care of aspect ratio flickering
that some games / widescreen hacks would be susceptible with the new
logic.

I've tested this on SSX Tricky's native anamorphic support, Tom Clancy's
Splinter Cell (it stayed in 4:3 the whole time), and on the following
widescreen hacks for which the heuristic doesn't currently work:

Paper Mario: The Thousand-Year Door (Gecko widescreen code from Nintendont)
C202F310 00000003
3DC08042 3DE03FD8
91EEF6D8 4E800020
60000000 00000000
04199598 4E800020
C200F500 00000004
3DE08082 3DC0402B
61CE12A2 91CFA1BC
60000000 387D015C
60000000 00000000
C200F508 00000004
3DE08082 3DC04063
61CEE8D3 91CFA1BC
60000000 7FC3F378
60000000 00000000

The Simpsons: Hit & Run (AR widescreen code from the wiki)
04004600 C002A604
04004604 C09F0014
04004608 FC002040
0400460C 4082000C
04004610 C002A608
04004614 EC630032
04004618 48220508
04041A5C 38600001
04224344 C002A60C
04224B1C 4BDDFAE4
044786B0 3FAAAAAB
04479F28 3FA33333
2017-04-05 17:23:16 -07:00
iwubcode
a9d08a31a6 Add configurable toggle that rounds vertices to the nearest pixel when
w=1.  This fixes some games at higher IRs.
2017-04-04 09:52:18 -05:00
Markus Wick
e99cd57eb3 Merge pull request #4935 from Armada651/depth-range-fix
VideoBackends: Set the maximum range when the depth range is oversized.
2017-03-10 18:05:52 +01:00
Stenzek
277829d842 VideoCommon: Eliminate static state in Renderer 2017-03-04 16:39:50 +10:00
gamemasterplc
4c4a96bfc5 Widescreen Hack improvement
Fixes Projection alignment in some N64 VC games. The original code forgot to multiply rawProjection[1] and rawProjection[3].
2017-02-26 12:55:57 -06:00
Jules Blok
a15555fe03 VideoBackends: Use vertex shader depth range if ztexture is used. 2017-02-26 11:34:48 +01:00
Jules Blok
94522d4cf3 OGL: Add support for glDepthRangedNV to handle oversized depth ranges. 2017-02-24 14:54:16 +01:00
Jules Blok
271a9fe7a9 VertexShaderManager: Break up the conditions to make it readable. 2017-01-13 14:01:17 +01:00