Commit Graph

4122 Commits

Author SHA1 Message Date
Jordan Woyak c08671c4ce VideoCommon/OSD: Process OSD messages even when they are disabled. 2020-01-24 11:00:58 -06:00
Jordan Woyak b92f6480a0 InputCommon: Make "Cursor" inputs aware of the rendered aspect ratio. 2020-01-24 09:20:41 -06:00
Ryan Meredith e5f6d9320f Add Dolphin version and current video backend to shader compilation logs 2020-01-24 03:29:38 -05:00
Lioncash 687f1f0330 VideoCommon/TextureConversionShader: Make use of fmt where applicable
Now that we've converted the shader generation over to ShaderCode, we
can now make use of the fmt-capable WriteFmt function.
2020-01-23 14:19:40 -05:00
Lioncash aa77dff3a2 VideoCommon/TextureConversionShader: Convert over to using ShaderCode
Migrates the shader generator off the use of a global array, eliminating
the use of some global state. This also allows us to move the shader
generation over to using fmt in a subsequent change.
2020-01-23 14:19:36 -05:00
Stenzek 11ba623f26 Add an option to present/skip presenting duplicate frames
Currently, we do not display every second frame in 25fps/30fps games
which run to vsync. This improves performance as there's less rendering
for the GPU to perform, but when combined with vsync, could cause frame
pacing issues.

This commit adds an option to force every frame generated by the console
to be displayed to the host, which may improve pacing for these games.
2020-01-14 10:57:35 +10: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
Stenzek d744c5a148 Compile fixes for Windows-on-ARM64 2019-12-28 19:20:41 +10:00
Stenzek 6fcb1c6c46 Add an ARM64 target to Visual Studio projects 2019-12-28 19:20:41 +10:00
Stenzek 6a0067fd26 FrameDump: Set first_frame if movie frame number <= 1
The frame number is incremented before the first frame is swapped out.

Fixes ffmpeg creating invalid video files on output if the emulator only
runs for a single frame, e.g. FifoCI.
2019-12-22 11:54:34 +10:00
Anthony bac8c060b5
Merge pull request #8508 from lioncash/fmt-tex
VideoCommon/TextureConverterShaderGen: Convert over to fmt
2019-12-07 18:41:14 -08:00
Anthony 9ef50a1d4b
Merge pull request #8509 from lioncash/shader-str
VideoCommon/FramebufferShaderGen: Minor clean up
2019-12-07 18:40:56 -08:00
Anthony 19ea546a0a
Merge pull request #8511 from lioncash/if-constexpr
VideoCommon/OpcodeDecoding: Make use of if constexpr
2019-12-07 18:40:15 -08: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 2c9ec6cb8a VideoCommon/BoundingBox: Move PixelShaderManager::SetBoundingBoxActive() calls into Enable()/Disable()
Now that we have an actual interface to manage things, we can stop
duplicating the calls to to the pixel shader manager and remove the
need to remember to actually do so when disabling or enabling the
bounding box.
2019-12-05 11:57:58 -05: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
Lioncash 159947ab68 VideoCommon/IndexGenerator: Make use of if constexpr
We can use if constexpr with the template functions that pass in a
non-type template parameter, allowing the removal of branches that
aren't taken at compile time.

Compilers will generally do this by default, however, we now give a
gentle prodding to the compiler if this would otherwise not be the case.
2019-12-05 10:49:32 -05:00
Lioncash fb3fda775f VideoCommon/IndexGenerator: Move stateless functions into anonymous namespace
These don't rely on any of the static members within the IndexGenerator
class, so we can make all of these functions fully internal to the
translation unit.
2019-12-05 10:49:29 -05:00
Lioncash 69f2ca2230 VideoCommon/IndexGenerator: Make use of anonymous namespace
More things will be moved into this in subsequent changes. While we're
at it, we can also make use of std::array.
2019-12-05 09:36:41 -05:00
Lioncash 1f46a6a64b VideoCommon/OpcodeDecoding: Make use of if constexpr
We can make use of if constexpr in several scenarios here to allow
compilers to exise the relevant code paths out.

Technically a decent compiler would do this already, but now we can give
compilers a little more nudging here in the event that isn't the case.
2019-12-05 09:13:06 -05:00
Lioncash 99353c3baa VideoCommon/OpcodeDecoding: Remove unused headers
Nothing provided by these headers are used, so we can remove them.
2019-12-05 09:13:06 -05:00
Lioncash 6339a5ea8e VideoCommon/OpcodeDecoding: Resolve implicit signedness conversion
cmd2 is a u32, so any bitwise arithmetic on it with a type of the same
size or smaller will result in a u32 value. This is also implicitly
converted to an unsigned type in the if statement as well, given that
size_t * int -> size_t.

This is just more explicit about the operations occurring and also
likely silences a sign conversion warning.
2019-12-05 09:13:06 -05:00
Lioncash 4710b82f43 VideoCommon/OpcodeDecoding: Remove use of goto in Run()
With the use of a lambda and a change in switch fallthrough, we can
completely eliminate the use of goto within Run().
2019-12-05 09:13:06 -05:00
Lioncash f74503cce0 VideoCommon/OpcodeDecoding: Make use of anonymous namespace
Provides a region for all internal utilities.
2019-12-05 09:13:06 -05:00
Lioncash 6b4e340995 VideoCommon/OpcodeDecoding: Amend comment formatting
Amends a documentation comment that acquired some wonky formatting
during the introduction of clang-format a few years ago.
2019-12-05 09:13:06 -05:00
Lioncash b2a9c36501 VideoCommon/OpcodeDecoding: Move g_bRecordFifoData into namespace
Keeps the global localized with the code that it's primarily related to.

Now it's obvious from a glance what the global variable is affecting.
2019-12-05 09:13:03 -05:00
Lioncash d8063e9c54 VideoCommon/OpcodeDecoding: Normalize variable naming
Provides consistent naming of variables within the translation unit.

While we're at it, we can mark them const where applicable.
2019-12-05 08:05:29 -05:00
Lioncash f29730944f VideoCommon/FramebufferShaderGen: Make use of std::ostringstream internally
We only use these string streams to output into a final std::string
instance, we don't read into types with them. Because of this, we can
just make use of std::ostringstream, rather than the fully-fledged
std::stringstream.
2019-12-05 00:18:00 -05:00
Lioncash fff445cc10 VideoCommon/FramebufferShaderGen: Make use of std::string_view where applicable
Prevents the use of the null pointer as an input to any functions.
2019-12-05 00:15:37 -05:00
Lioncash 3405815f09 VideoCommon/FramebufferShaderGen: Remove unused Config struct
This isn't used anywhere within the codebase, so it can be removed
entirely.
2019-12-04 23:54:15 -05:00
Lioncash 3a8d17c140 VideoCommon/FramebufferShaderGen: Use an anonymous namespace where applicable
Places all internal helpers and types within an anonymous namespace.
2019-12-04 23:51:26 -05:00
Lioncash eefd6a10f5 VideoCommon/FramebufferShaderGen: Add missing initial source file comments
Makes the source files consistent with the rest of the VideoCommon code.
2019-12-04 23:48:59 -05:00
Lioncash f8c90f0484 VideoCommon/FramebufferShaderGen: Collapse stream insertions
No behavioral change. This is intended to make the transition to fmt
less noisy in subsequent changes by combining insertions of multiple
string literals into one where applicable.
2019-12-04 23:45:15 -05:00
Lioncash 0f28f4049b VideoCommon/TextureConverterShaderGen: Convert over to fmt
Easily the most straightforward to convert over, given the lack of
significant formatting arguments.
2019-12-03 05:05:02 -05:00
Lioncash 8af6bfb8b0 VideoCommon/ShaderGenCommon: Add function for writing fmt-based strings
Begins the conversion of the shader generators over to using fmt
formatting specifiers.

This also has a benefit over the older StringFromFormat-based API in
that all formatted data is appended to the existing buffer rather than
creating a completely separate string and then appending it to the
internal string buffer.
2019-12-03 04:49:48 -05:00
Stenzek dd23a1ee79 Update VS projects/solutions to VS2019 2019-11-30 13:42:52 +10:00
Anthony 4a0611df54
Merge pull request #8487 from lioncash/video-fmt
VideoCommon: Make use of fmt outside of shader generators
2019-11-28 15:03:23 -08:00
Scott Mansell ac77df9e90
Merge pull request #8490 from vadosnaprimer/dumping
2 minor dumping fixes
2019-11-25 10:38:44 +13:00
feos cb6a632c60 fix missing frame when you start another dump without closing dolphin 2019-11-24 18:02:38 +03:00
feos 15e6e7ddd2 figure out new segment on the fly right in FrameDump::Start() 2019-11-24 18:02:36 +03:00
Lioncash 6fbbc2683e VideoCommon: Make use of fmt outside of shader generators
Migrates most of VideoCommon over to using fmt, with the exception being
the shader generator code. The shader generators are quite large and
have more corner cases to deal with in terms of conversion (shaders have
braces in them, so we need to make sure to escape them).

Because of the large amount of code that would need to be converted, the
conversion of VideoCommon will be in two parts:

- This change (which converts over the general case string formatting),
- A follow up change that will specifically deal with converting over
  the shader generators.
2019-11-23 16:00:45 -05:00
Connor McLaughlin 5440be96e7
Merge pull request #8378 from stenzek/quad-buffer-stereo
Various quad-buffered ("HDMI 3D") stereo fixes
2019-11-08 10:26:58 +10:00
Connor McLaughlin d3ee0a4535
Merge pull request #8379 from stenzek/mali
Vulkan: Optimizations for Mali with EFB2RAM on
2019-10-31 22:44:19 +10:00
feos 5d03d5dde0 Another AVI fix for WinAPI importers
When not using native resolution, FFMPEG automatically selects FFV1 version 3 for whatever reason, and that can't be decoded by VirtualDub/AVISynth.
2019-10-05 23:31:06 +03:00
Stenzek ae83d02e54 Drop 3D Vision Support 2019-10-04 13:40:21 +10:00
Stenzek 328d89db70 Vulkan: Add a DriverDetails bug for "slow cached readback memory"
Using the cached memory type appears to be slower on Mali drivers, with
~10-15% CPU spent in the __pi___inval_cache_range kernel function.
2019-10-02 21:34:58 +10:00
Stenzek 33a6d265e5 PostProcessing: Use interface blocks for shaders 2019-10-02 12:59:50 +10:00
Stenzek af849126b3 Renderer: Use interface blocks for ImGui shaders 2019-10-02 12:52:45 +10:00
Stenzek c98a5f7dfd Renderer: Draw ImGui interface to both eyes 2019-10-02 12:19:47 +10:00
Stenzek b44a0980eb PostProcessing: Use correct layer in quad-buffered modes
Previously, only the left eye was being used.
2019-10-02 11:52:54 +10:00
Stenzek e88c269d02 PostProcessing: Don't use GS expansion shader for quad buffering w/ OpenGL
OpenGL doesn't render to a 2-layer backbuffer like D3D/Vulkan for quad-buffered
stereo, instead drawing twice with the eye selected by glDrawBuffer()
(see OGL::Renderer::RenderXFBToScreen).
2019-10-02 11:33:25 +10:00
Stenzek 135f0a1385 ShaderCache: EFB2RAM pipelines should not use a geometry shader
Only the left eye is used when creating the RAM copy.
2019-10-01 11:44:31 +10:00
Stenzek c989e5c50c ShaderCache: Recompile shared pipelines on shader cache reload
Fixes broken stereoscopy when switching on/off at runtime.
2019-10-01 11:43:02 +10:00
Silent 37ef5a54c9
Core: Use move semantics for Renderer::SaveScreenshot 2019-08-28 19:52:35 +02:00
Connor McLaughlin 48ca2c6f2e
Merge pull request #8233 from JosJuice/stringutil-string-view
StringUtil: Use std::string_view more
2019-08-09 23:39:01 +10:00
Connor McLaughlin 22ed2c0e0c
Merge pull request #8269 from lioncash/osd-move
VideoCommon/OnScreenDisplay: Minor cleanup
2019-08-08 12:38:44 +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
Connor McLaughlin 9477c8b0ed
Merge pull request #8293 from lioncash/ref
VideoCommon/TextureCacheBase: Make OnConfigChanged's parameter a const reference
2019-08-08 12:17:26 +10:00
Connor McLaughlin 24718c1a38
Merge pull request #8294 from lioncash/render-const
VideoCommon/RenderBase: Make functions const where applicable
2019-08-05 16:25:21 +10:00
Lioncash 07aa18eb2b VideoCommon/TextureCacheBase: Collapse for loop into a fill() in Invalidate()
Same thing, less code.
2019-08-04 23:30:27 -04:00
Lioncash d52dd2e04f VideoCommon/TextureCacheBase: Use emplace_back where applicable
Same thing, less code.
2019-08-04 23:28:14 -04:00
Lioncash fd12ae1408 VideoCommon/TextureCacheBase: Remove use of the texture cache global
We can just call the functions that are part of the interface instead of
using the global in order to execute those functions.
2019-08-04 23:23:04 -04:00
Lioncash 7366b4281f VideoCommon/RenderBase: Remove dependency on renderer global within renderer
There's no need to have a dependency when we can simply call the
function itself as part of the instance itself.
2019-08-04 23:01:19 -04:00
Lioncash cfdfbbff38 VideoCommon/RenderBase: Use structured bindings where applicable
Same behavior, but immediately assigns to variables, allowing them to be
const.
2019-08-04 22:59:07 -04:00
Lioncash dd5b8895fe VideoCommon/RenderBase: Make functions const where applicable 2019-08-04 22:52:00 -04:00
Lioncash 86a651e27f VideoCommon/TextureCacheBase: Remove dependence on global variables from OnConfigChanged()
The active config will always be passed as the reference parameter, we
can make use of the parameter instead of accessing the global variable.
2019-08-04 22:33:18 -04:00
Lioncash 7d017be666 VideoCommon/TextureCacheBase: Make OnConfigChanged's parameter a const reference
This reference isn't actually modified within this function
2019-08-04 22:31:27 -04:00
Connor McLaughlin 7de6b57c13
Merge pull request #8284 from stenzek/logic-op-hack
RenderState: Approximate logic op with blending if unsupported
2019-08-04 14:39:38 +10:00
Stenzek f6f9dc0cac RenderState: Approximate logic op with blending if unsupported
This is a giant hack which was previously removed because it causes
broken rendering. However, it seems that some devices still do not
support logical operations (looking at you, Adreno/Mali). Therefore, for
a handful of cases where the hack actually makes things slightly better,
we can use it.

... but not without spamming the log with warnings. With my warning
message PR, we can inform the users before emulation starts anyway.
2019-08-04 14:06:08 +10:00
Stenzek d6460e0b18 FramebufferShaderGen: Fix upside-down EFB being restored in OpenGL 2019-08-03 01:48:57 +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
Lioncash 3f947f086f VideoCommon/OnScreenDisplay: Use deduction guides for std::lock_guard
Same behavior without hardcoding the type of the mutex within the lock
guards. This means the type of the mutex would be able to be changed
without needing to also change all occurrences lock guards are used.
2019-07-28 23:08:21 -04:00
Lioncash a565e41cb8 VideoCommon/OnScreenDisplay: Remove unused headers
While we're at it, fix up the imgui include to use the convention we use
for referencing external library headers.
2019-07-28 23:04:52 -04:00
Lioncash c212310fbe VideoCommon/OnScreenDisplay: Take Message's std::string parameter by value
Allows callers to std::move strings into the functions (or automatically
assume the move constructor/move assignment operator for rvalue
references, potentially avoiding copies altogether.
2019-07-28 23:00:58 -04:00
Lioncash 50b240fcbd VideoCommon/OnScreenDisplay: Default initialize all Message members
Provides a deterministic initial state in the case of the default
constructor.
2019-07-28 22:42:45 -04:00
Silent 890f781cd0
Factorize software renderer backend switching warning to be fetched from a new GetWarningMessage in video backend - will be needed for DX11.1 feature set warnings 2019-07-26 19:39:07 +02:00
Connor McLaughlin d48dabc1fd
Merge pull request #8259 from stenzek/macos-disable-reversed-depth
Vulkan: Disable reversed viewport depth on macOS/MoltenVK
2019-07-25 14:11:09 +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 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
JosJuice a2a1e04fc9 StringUtil: Use std::string_view more 2019-07-23 14:49:12 +02:00
Stenzek 8b44a48383 Vulkan: Disable reversed viewport depth on macOS/MoltenVK
Apparently this is broken despite being allowed by the spec.
2019-07-21 13:27:35 +10:00
Connor McLaughlin fc8859a414
Merge pull request #8249 from lioncash/rect
VideoCommon: Remove unused MathUtil.h include from VideoCommon.h
2019-07-19 16:32:30 +10:00
Stenzek 97d81ac97c FramebufferShaderGen: Fix format reinterpret shaders on GLES 2019-07-19 15:33:32 +10:00
Stenzek 6f53a4d0da TextureCache: Don't crash when conversion pipelines fail to compile 2019-07-19 15:32:50 +10:00
Stenzek f269c4c798 EFB2Tex: Set alpha channel of Z24X8 copies to 1
Matches EFB2RAM.
2019-07-18 23:51:07 +10:00
Stenzek 68bd4cd79a Vulkan: Use reversed depth range in viewport
Also adds a DriverDetails bug to disable on drivers where this is still
broken.
2019-07-18 23:43:12 +10:00
Lioncash 2b9389202e VideoCommon: Remove unused MathUtil.h include from VideoCommon.h
This header doesn't actually make use of MathUtil.h within itself, so
this can be removed. Many other source files used VideoCommon.h as an
indirect include to include MathUtil.h, so these includes can also be
adjusted.

While we're at it, we can also migrate valid inclusions of VideoCommon.h
into cpp files where it can feasibly be done to minimize propagating it
via other headers.
2019-07-16 20:54:34 -04:00
Stenzek 946571b759 TextureCache: Support reinterpreting formats for VRAM textures 2019-07-14 19:16:27 +10:00
Stenzek 77f406c8a8 TextureCache: Combine ApplyPaletteToEntry and ConvertTexture 2019-07-14 14:07:37 +10:00
Stenzek dfae87d69a TextureConversionShader: Swap bytes for RG8/GB8 format
Matches the software renderer.
2019-07-14 13:36:43 +10:00
Lioncash 9c245655fb VideoCommon/Statistics: Remove unused DECSTAT macro
This isn't used anywhere, so it can be removed. This also potentially
fixes an underlying compilation error waiting to happen, given DECSTAT
could have potentially been used, someone disables statistics (for
whatever reason), then gets a compilation error due to the #else case
not containing an empty definition of DECSTAT.
2019-07-10 23:40:13 -04: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 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
Léo Lam 0cfdcf436d
Merge pull request #8136 from lioncash/arglist
VideoCommon/{NetPlayChatUI/NetPlayGolfUI}: Minor changes
2019-05-29 13:18:03 +02:00
Lioncash 1a0f8e7804 VideoCommon/VertexLoaderX64: Add missing header guard 2019-05-29 06:35:22 -04:00
Lioncash 778623c48c VideoCommon/NetPlayGolfUI: Remove unused header
This header doesn't actually make use of any std::string facilities.
2019-05-29 06:20:57 -04:00
Lioncash cf0f2bbf1d VideoCommon/NetPlayGolfUI: Default the destructor in the cpp file
Ensures the destruction logic is kept local to the translation unit. It
also doesn't really do much to have it specified in the header.
2019-05-29 06:20:05 -04:00
Lioncash 0fabab0760 VideoCommon/NetPlayGolfUI: Initialize netplay_client in the constructor initializer list 2019-05-29 06:20:05 -04:00
Lioncash c958fc1278 VideoCommon/NetPlayChatUI: Default destructor in the cpp file
Ensures that the destruction logic is kept local to the translation unit
(making it nicer when it comes to forward declaring non-trivial types).
It also doesn't really do much to define it in the header.
2019-05-29 06:20:05 -04:00
Lioncash 53b115b81e VideoCommon/NetPlayChatUI: Use nullptr where applicable
We gotsa type dedicated to this concept already :P
2019-05-29 06:14:43 -04:00
Lioncash 50a15b7484 VideoCommon/NetPlayChatUI: Take std::string by value in AppendChat()
Given we're simply storing the std::string into a deque. We can emplace
it and move it. Completely avoiding copies with the current usage of the
function.
2019-05-29 06:12:29 -04:00
Lioncash 08223bad9f VideoCommon/NetPlayChatUI: Set member variable within the constructor initializer list
Member variables should be initialized within the constructor
initializer list if possible.
2019-05-29 06:09:49 -04:00
Connor McLaughlin 707266aeed
Merge pull request #8069 from iwubcode/passive_support
VideoCommon: Implement passive stereoscopic 3D
2019-05-12 15:15:34 +10:00
Stenzek 3e29fdb4a7 CommandProcessor: Don't reset the video buffer when FIFO distance is changed
This prevents partially-processed commands from being lost when switching buffers.
2019-05-11 00:31:37 +10:00
weihuoya e98f43d2af bbox minor fx 2019-05-09 17:30:17 +08:00
Techjar ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
iwubcode c513bb5309 VideoCommon: Implement passive stereoscopic 3D 2019-05-04 22:58:00 -05:00
Léo Lam ab9ece9bca Replace MathUtil::Clamp with std::clamp 2019-05-04 23:12:17 +02:00
Léo Lam 99a4ca8de7
Merge pull request #7839 from ShFil119/impr/redundant
Remove redundant initialization
2019-05-04 22:50:51 +02:00
z0z0z 5bacb2e4c6 Disable Vulkan overrides for RADV driver 2019-05-01 07:59:54 -04:00
Filip Gawin c110ffcdaa Remove redundant initialization 2019-04-30 01:22:24 +02:00
Connor McLaughlin 1b1662773e
Merge pull request #8048 from stenzek/vulkan-negative-scissor-rect
Vulkan: Don't set a negative offset in scissor rect
2019-04-28 23:37:51 +10:00
Stenzek 32359bf2bb Renderer: Adjust target rectangle in the base class 2019-04-28 23:33:24 +10:00
Stenzek 3c64f0c616 Renderer: Adjust source rectangle when crop would draw off screen
This prevents us from requiring an oversized and/or negative viewport by
shrinking the source rectangle instead.
2019-04-28 23:31:57 +10:00
Connor McLaughlin d2d8d7ce90
Merge pull request #8051 from JosJuice/efb-constexpr
Turn EFB_WIDTH/EFB_HEIGHT into constexpr
2019-04-28 20:37:25 +10:00
JosJuice ced2306fc5 Turn EFB_WIDTH/EFB_HEIGHT into constexpr
https://bugs.dolphin-emu.org/issues/11692#note-5

Also change const into constexpr while we're at it.
2019-04-28 11:50:17 +02:00
Connor McLaughlin f7199397a0
Merge pull request #8047 from stenzek/d3d-feature-level-10
D3D11: Fix Dolphin crashing on feature level 10.0 devices
2019-04-28 17:07:37 +10:00
Stenzek 53af27b133 FramebufferManager: Fix invalid transitions for 1xIR in EFB cache 2019-04-28 16:13:49 +10:00
Stenzek 51154d6907 FramebufferShaderGen: Don't emit SV_SampleIndex when not using SSAA 2019-04-28 15:26:21 +10:00
Stenzek d5b3595314 TextureCache: Fix incorrect format string in GetXFBTexture() 2019-04-28 14:32:37 +10:00
iwubcode c2abf092e9 VideoCommon: Do not reset the gather pipe (WPAR buffer) as this does not reflect what actually happens on real hardware. On hardware, there's no way for the GPU to signal to reset the WPAR buffer. Instead, the WPAR buffer will be reset automatically upon receiving 32 bytes or when spr[WPAR] is written 2019-04-26 22:20:53 -05:00
Connor McLaughlin 59c0e51f5b
Merge pull request #8000 from stenzek/more-videocommon-cleanup
Additional cleanup/fixes from VideoCommon merge
2019-04-22 12:50:22 +10:00
Connor McLaughlin 93be178f28
Merge pull request #7857 from stenzek/opengl-stereo
OGL: Fix stereoscopy
2019-04-22 12:41:12 +10:00
Connor McLaughlin 44d5a71e27
Merge pull request #7965 from jordan-woyak/condvar-fixes
Minor changes to usages of std::condition_variable.
2019-04-21 23:50:53 +10:00
Stenzek 9577d0641b ShaderCache: Fix crash at shutdown on shared shader compilation fail 2019-04-21 14:28:14 +10:00
Stenzek f8c1ba409c Replace EFBRectangle/TargetRectangle with MathUtil::Rectangle 2019-04-21 14:28:14 +10:00
Connor McLaughlin 5b4ebccf6b
Merge pull request #8012 from stenzek/bounding-box-shaders
PixelShaderGen: Don't emit bounding box shader code for old UIDs when disabled
2019-04-21 13:27:05 +10:00
Stenzek b09a0e1a60 TextureCache: Check for out-of-range partial copy rect after scaling 2019-04-21 12:54:32 +10:00
Stenzek 3791262d96 TextureCache: Use linear filtering on y-scaled and >1xIR VRAM copies 2019-04-21 12:41:15 +10:00
Stenzek 708bd3d9f7 TextureCache: Simplify XFB reconstruction
This also better handles in-memory interlaced XFB data placed by the CPU
by considering the stride from the VI.
2019-04-21 12:41:15 +10:00
Stenzek dbaba0062a TextureDecoder: Move XFB decoding to Common
This was previously missing for generic (which is used on ARM).
2019-04-21 12:41:15 +10:00
Stenzek eddde3e6c8 ShaderGen: Use interface blocks when geometry shaders are supported
We don't use explicit locations in OpenGL currently, so this breaks
when we use alternative names in the geometry shaders.
2019-04-20 23:44:33 +10:00
Stenzek c6b45c5ca9 ShaderCache: Fix crash if pipeline from uid cache fails creation 2019-04-20 23:16:29 +10:00
Stenzek 96aa762d1e PixelShaderGen: Don't emit bounding box shader code for old UIDs when disabled
If bounding box is enabled when a UID cache is created, then later disabled,
we shouldn't emit the bounding box portion of the shader.

Fixes pipeline creation errors on D3D12 backend for this case.
2019-04-20 23:16:14 +10:00
Connor McLaughlin c26f53bf84
Merge pull request #7999 from stenzek/pipeline-cache-data
Implement pipeline data cache for OpenGL and D3D12
2019-04-20 12:56:02 +10:00
Jordan Woyak 779e618046 VideoCommon: Change free-look's middle-mouse action to roll the camera. 2019-04-17 05:10:11 -05:00
Stenzek 00b83b4196 ShaderCache: Utilize pipeline cache data where possible 2019-04-16 00:39:43 +10:00
Stenzek 61a656570e AbstractPipeline: Support returning "cache data"
"Cache data" can be used to assist a driver with creating pipelines by
using previously-compiled shader ISA.
2019-04-16 00:09:47 +10:00
Jordan Woyak d34a9afe04 Minor changes to usages of std::condition_variable. 2019-04-06 17:39:25 -05:00
spycrab e44433c2f6
Merge pull request #7955 from Techjar/netplay-golf-mode
NetPlay golf mode
2019-04-05 17:25:23 +02:00
Techjar 6c393f9ff4 Add imgui golf mode overlay 2019-04-05 07:01:03 -04:00
Techjar a318c55cec PixelShaderGen: Fix bounding box coordinates being offset by 1 pixel 2019-04-03 10:09:05 -04:00
Stenzek f2d8c8d2a8 D3D12: Fix rare case where command list was executed with open queries 2019-04-01 20:49:24 +10:00
Connor McLaughlin 32e330eb35
Merge pull request #7950 from stenzek/out-of-range-efb-copies
BPStructs: Gracefully handle out-of-range EFB copies
2019-04-01 13:08:11 +10:00
Stenzek 113bd60fe7 Implement D3D12 backend 2019-04-01 11:24:55 +10:00
Stenzek 378b605669 BPStructs: Gracefully handle out-of-range EFB copies
Since the copy X and Y coordinates/sizes are 10-bit, the game can configure a
copy region up to 1024x1024. Hardware tests have found that the number of bytes
written does not depend on the configured stride, instead it is based on the
size registers, writing beyond the length  of a single row. The data written
for the pixels which lie outside the EFB bounds does not wrap around instead
returning different colors based on the pixel format of the EFB.

This suggests it's not based on coordinates, but instead on memory addresses.
The effect of a within-bounds size but out-of-bounds offset
(e.g. offset 320,0, size 640,480) are the same.

As it would be difficult to emulate the exact behavior of out-of-bounds reads,
instead of writing the junk data, we don't write anything to RAM at all for
over-sized copies, and clamp to the EFB borders for over-offset copies.
2019-03-31 22:05:53 +10:00
Stenzek 3c455de799 FramebufferManager: Fix broken EFB peeks in GL with MSAA on 2019-03-30 03:14:29 +10:00
Stenzek 087b11e780 TextureCacheBase: Fix possible crash on shutdown with deferred EFB copies 2019-03-29 20:54:44 +10:00