Commit graph

3877 commits

Author SHA1 Message Date
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
9802a5e16b VideoCommon/Statistics: Make all member functions non-static
Rather than making Statistics' member functions operate on the global
variable instance of itself, we can make these functions member
functions and operate on a by-instance state, removing the direct
dependency on the global variable itself.

This also makes for less reading, as there's no need to repeat "stats."
for all variable accesses.
2019-07-10 23:24:37 -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
Connor McLaughlin
0a7395bfba
Merge pull request #8128 from altimumdelta/FrameDumpUpgradePrep1
Code: Rename AVIDump to FrameDump
2019-06-30 21:13:19 +10:00
altimumdelta
1df655e376 VideoCommon: Rename AVIDump to FrameDump 2019-06-30 13:02:39 +02:00
Connor McLaughlin
e388f01e11
Merge pull request #8215 from CookiePLMonster/appverifier-sanitize
Fixed various errors spotted with Application Verifier
2019-06-30 01:27:25 +10:00
Léo Lam
0dfff81a56
Merge pull request #8205 from Techjar/crop-fix
VideoCommon/RenderBase: Fix crop
2019-06-29 10:24:37 +02:00
Léo Lam
a9099fc96b
Merge pull request #8207 from lioncash/macro
VideoCommon/Statistics: Use std::array for projection values
2019-06-29 09:36:33 +02:00
Silent
6c21811090
Make DolphinAnalytics a true singleton - static local variables are initialized in a thread safe manner since C++11
Also works around a Visual Studio 2017 bug where static inline class fields are destructed multiple times
2019-06-23 21:43:47 +02: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
2e74a4447a VideoCommon/Statistics: Remove unused setter macros for statistics
Now that the floating point members are assigned in bulk, we can remove
their setter macro. While we're at it, we can also remove the setter for
unsigned int, given it's not used.
2019-06-20 08:06:23 -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
Léo Lam
4885130799
Merge pull request #8194 from lioncash/common-msg
Common/MsgHandler: Tidy up interface and namespace code
2019-06-20 13:37:24 +02:00
Lioncash
4f1f55093f Common/MsgHandler: Namespace code within the Common namespace
Closes another gap in the Common library where code isn't being
namespaced under it.
2019-06-19 16:03:55 -04:00
Techjar
08421db52f VideoCommon/RenderBase: Fix crop
This fixes some mistakes from #8049 that caused crop to behave like
stretch and have a funny offset.
2019-06-18 18:34:13 -04:00
Lioncash
5cafce3cc4 VideoCommon/Statistics: Amend imgui include
This is a library header, so it should be using '<' and '>' to delineate
that.
2019-06-17 02:37:02 -04:00
Lioncash
73710c0745 VideoCommon/Statistics: Remove unused header inclusions
These aren't used anywhere, so they can be removed.
2019-06-17 02:36:41 -04:00
Lioncash
6416fe336c VideoCommon/Statistics: Replace memset with assignment in ResetFrame()
Same behavior, less code, and it doesn't require the type ThisFrame
itself to actually be a trivially-copyable type.
2019-06-17 02:27:36 -04:00
Lioncash
e981fa2073 VideoCommon/Statistics: Use ImGui::TextUnformatted() where applicable
ImGui::Text() assumes that the incoming text is intended to be
formatted, but we don't actually use it to format anything. We can be
explicit by using the relevant function.

This also has a plus of not needing to go through the formatter itself,
but the gains from that are probably minimal.
2019-06-17 02:27:26 -04:00
Lioncash
1c40fd8569 VideoCommon/Statistics: Replace DRAW_STAT macro with variadic lambda
We don't need to use the preprocessor here. We can just use a variadic
lambda function instead and forward the arguments to the formatting
function.
2019-06-17 02:26:25 -04:00
Techjar
56c818b3d8 VideoCommon/RenderBase: Reset scissor rectangle after ImGui rendering
This fixes the problem where OBS game capture only grabs the region
inside an ImGui window whenever one is open, when using the OpenGL
backend. Shouldn't have any negative effects, as the scissor would've
been something completely arbitrary anyways.

This may affect other capture software that uses the same hooking
method, but I've only tested OBS.
2019-06-15 07:12:17 -04:00
Lioncash
92b445618a VideoCommon/DriverDetails: Make look-up table immutable
Previously, this array potentially wouldn't be placed within the
read-only segment, since it wasn't marked const. We can make the lookup
table const, along with any other nearby variables.
2019-06-08 18:06:36 -04:00
Connor McLaughlin
951b66e4ac
Merge pull request #8049 from stenzek/crop
Renderer: Adjust source rectangle when crop would draw off screen
2019-06-08 20:57:52 +10:00
Connor McLaughlin
6b4ca318c9
Merge pull request #8139 from lioncash/const
VideoCommon/PixelShaderGen: Make look-up table arrays immutable where applicable
2019-06-08 20:03:02 +10:00
Lioncash
c0c0e412e0 Core/ConfigManager: Use forward declarations where applicable
Avoids dragging in IniFile, EXI device and SI device headers in this header which is
quite widely used throughout the codebase.

This also uncovered a few cases where indirect inclusions were being
relied upon, which this also fixes.
2019-06-07 19:54:39 -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
Léo Lam
a4837a5c5d
Merge pull request #8143 from lioncash/loader
VertexLoader_*: Minor cleanup
2019-05-31 14:18:16 +02:00
Lioncash
3d27439d9a VideoCommon/CMakeLists: Specify headers in target sources 2019-05-31 06:54:26 -04:00
booto
bc8a4f99c7 VideoCommon: Constrain the array_base registers
The array_base registers as part of CP state do not seem to incorporate
the upper bits in the physical address they try to access.
2019-05-31 03:22:00 -04:00
Techjar
cd3ba570df VideoCommon/ShaderGenCommon: Fix memcmp size in ShaderUid operators 2019-05-30 16:00:46 -04:00
Lioncash
2452747429 VertexLoader_TextCoord: Tidy up public function definitions
We can use u32 instead of unsigned int to shorten up these definitions
and make them much nicer to read.

While we're at it, change the size array to house u32 elements
to match the return value of the function.
2019-05-30 10:29:51 -04:00
Lioncash
9569c79ca2 VertexLoader_TextCoord: Make lookup tables immutable
Allows the compiler to place the data within the read-only segment.
2019-05-30 10:29:50 -04:00
Lioncash
16a03bade2 VertexLoader_TextCoord: Place helper functions in anonymous namespace
Gives them all internal linkage.
2019-05-30 10:29:50 -04:00
Lioncash
6f656b7219 VertexLoader_Position: Tidy up public function definitions
We can use u32 instead of unsigned int to shorten up these definitions
and make them much nicer to read.

While we're at it, change the size array to house u32 elements to match
the return value of the function.
2019-05-30 10:29:50 -04:00
Lioncash
14e544eef8 VertexLoader_Position: Make lookup tables immutable
Allows the compiler to place these arrays within the read-only segment.
2019-05-30 10:29:50 -04:00
Lioncash
be9a03b35f VertexLoader_Position: Place helper functions in anonymous namespace 2019-05-30 10:29:50 -04:00
Lioncash
60a1d0593c VertexLoader_Color: Place helper functions in anonymous namespace
While we're at it, convert the define into a constexpr variable.
2019-05-30 10:29:47 -04:00
Léo Lam
4e7a790648
Merge pull request #8140 from lioncash/vertex
VideoCommon/VertexLoader_Normal: Construct look-up table at compile-time
2019-05-30 14:28:59 +02:00
Léo Lam
90c9991086
Merge pull request #8141 from lioncash/init
VideoCommon/ShaderGenCommon: Simplify initialization of ShaderUid class
2019-05-30 14:15:02 +02:00
Lioncash
f7eff6dab8 VideoCommon/ShaderGenCommon: Simplify operator!= for ShaderUid
This can be implemented as the negation of operator==, placing the
comparison logic for equality and inequality in the same place.
2019-05-30 06:41:57 -04:00
Lioncash
954246d10e VideoCommon/ShaderGenCommon: Remove use of a union within ShaderUid
This is only ever used to retrieve a raw view of the given UID data
structure, however it's already valid C++ to retrieve a char/unsigned
char view of an object for bytewise inspection.

u8 maps to unsigned char on all platforms we support, so we can just do
this directly with a reinterpret cast, simplifying the overall
interface.
2019-05-30 06:41:57 -04:00
Lioncash
149a97e396 VideoCommon: Remove unnecessary memset on ShaderUid instances.
Zero-initialization zeroes out all members and padding bits, so this is
safe to do. While we're at it, also add static assertions that enforce
the necessary requirements of a UID type explicitly within the ShaderUid
class.

This way, we can remove several memset calls around the shader
generation code that makes sure the underlying UID data is zeroed out.
Now our ShaderUid class enforces this for us, so we don't need to care about
it at the usage sites.
2019-05-30 06:41:54 -04:00
Lioncash
e60268bd42 VideoCommon/RenderBase: Use a std::string_view with CreateShaderFromSource()
Greatly simplifies the overall interface when it comes to compiling
shaders. Also allows getting rid of a std::string overload of the same
name. Now std::string and const char* both go through the same function.
2019-05-30 03:29:35 -04:00
Lioncash
0084aeb5d7 VideoCommon/VertexLoader_Normal: Use variable template variants of type traits
Same thing, less reading.
2019-05-30 00:52:59 -04:00
Lioncash
8268b6f454 VideoCommon/VertexLoader_Normal: Initialize function table at compile-time
Makes VertexLoader_Normal completely stateless, eliminating the need for
an Init() function, and by extension, also gets rid of the need for the
FifoAnalyzer to have an Init() function.
2019-05-30 00:52:57 -04:00
Lioncash
911755242d VideoCommon/VertexLoader_Normal: Remove E prefix from enums
This is old formatting that used to be used prior to the coding style
being introduced.
2019-05-29 22:15:46 -04:00
Lioncash
3b8fb22d93 VideoCommon/VertexLoader_Normal: Tidy up function declarations
We can use u32 to shorten up the function declarations. While we're at
it, remove unnecessary comments. These don't help with understanding.
2019-05-29 22:13:20 -04:00
Lioncash
8537f8e095 VideoCommon/PixelShaderGen: Fix up wonky comment formatting
This is likely a remnant of the initial transition to clang-format.
2019-05-29 22:03:02 -04:00
Lioncash
45934dd0c5 VideoCommon/PixelShaderGen: Make arrays immutable
Many of the arrays defined within this file weren't declared as
immutable, which can inhibit the strings being put into the read-only
segment. We can declare them constexpr to make them immutable.

While we're at it, we can use std::array, to allow bounds conditional
bounds checking with standard libraries. The declarations can also be
shortened in the future when all platform toolchain versions we use
support std::array deduction guides. Currently macOS and FreeBSD
builders fail on them.
2019-05-29 22:00:58 -04:00
Lioncash
e28d08e973 VideoCommon/PixelShaderGen: Brace control structures that travel more than one line
Them's the code formatting rules.
2019-05-29 20:16:41 -04:00