Commit Graph

4195 Commits

Author SHA1 Message Date
Techjar 0c01712d13 DriverDetails: Remove bug for broken GPU Texture Decoding 2020-10-08 10:13:40 -04:00
Techjar de2d099200 Re-enable GPU Texture Decoding under MoltenVK 2020-10-08 10:11:02 -04:00
iwubcode 4fff04db3c Core: Load custom textures after inputs has been loaded and avoid sending force texture reload during startup for dynamic textures. This ensures that custom texture loading only happens once and users don't see any weird flashes on startup 2020-10-03 17:10:36 -05:00
iwubcode fd3af4c5d3 InputCommon: Introducing the "Dynamic Input Texture". Configuration links an emulated input action to an image based on what host key is defined for that emulated input. Specific regions are called out in configuration that mark where to replace an input button with a host key image. 2020-10-03 17:10:35 -05:00
iwubcode 8a1539f948 VideoCommon: Make a reusable free function for getting top level directories that have a matching gameid text file underneath 2020-10-03 17:10:35 -05:00
Stenzek 880f7ca6bb FramebufferManager: Fix EFB readbacks with MSAA on
Regression from #8827.
2020-09-25 20:58:02 +10:00
JMC47 6ada03fca2
Merge pull request #9075 from JosJuice/android-osd-left-margin
Android: Move OSD out of the way when menu is open
2020-09-16 16:42:04 -04:00
JMC47 655308255e
Merge pull request #9073 from darkain/patch-1
Adding AmdPowerXpressRequestHighPerformance
2020-09-16 15:56:04 -04:00
JosJuice 161f99b864 Android: Move OSD out of the way when menu is open
https://bugs.dolphin-emu.org/issues/12256
2020-09-16 18:36:15 +02:00
JMC47 dcbe9da279
Merge pull request #8743 from Techjar/apple-pls-support-standard-api
VideoBackends: Disable GPU Texture Decoding under MoltenVK
2020-09-10 09:54:11 -04:00
Vincent Milum Jr 4e443ed857
Adding AmdPowerXpressRequestHighPerformance
Adding AmdPowerXpressRequestHighPerformance

This will allow AMD drivers to detect the request to use the dGPU instead of the iGPU on compatible hybrid graphics systems.

Reference: https://community.amd.com/thread/169965
2020-09-09 22:09:34 -07:00
LC b350cf043b
Merge pull request #8976 from JosJuice/port-some-settings
Port some settings to the new config system
2020-09-07 22:37:46 -04:00
Techjar 69358b2186 VideoBackends: Disable GPU Texture Decoding under MoltenVK
It's broken and causes spectacular artifacts and crashes.
2020-09-07 17:28:05 -04:00
JosJuice 6eefc3c524 Make default graphics backend not show up as empty
Fixes https://bugs.dolphin-emu.org/issues/12245.

I considered making a change to DolphinQt instead of
the core, but then additional effort would've been
required to add the same fix to the Android GUI once
we start using the new config system there.
2020-09-06 12:56:45 +02:00
Shawn Hoffman 969ea6e4f5 msvc: enable /Zc:preprocessor and make build compile cleanly 2020-08-27 21:58:48 -07:00
Shawn Hoffman 6ef9d70701 name some threads 2020-08-22 17:22:07 -07:00
Shawn Hoffman 2f47f486af msbuild: re-enable standalone vcxproj processing 2020-08-22 16:17:50 -07:00
Shawn Hoffman 94bf48b67c msbuild: refactor stuff out of project files (for dolphin) 2020-08-22 16:17:50 -07:00
Shawn Hoffman 36ace8eb52 prettify some constructs in vcxproj files 2020-08-22 16:17:50 -07:00
JosJuice bd87285f3a FrameDump: Don't ignore the time base numerator
Fixes a regression where f72b756 made all dumped video super long.
2020-08-11 11:17:22 +02:00
JosJuice 7385e9129c Remove wait_for_completion parameter from Renderer::SaveScreenshot
This is now unused. Seems like it was an improper fix
(there would be a race if saving the screenshot took longer
than 2 seconds) back when it was used too.
2020-08-06 21:57:12 +02:00
JosJuice b0f9bb9f13 Port some settings to the new config system
Other than the controller settings and JIT debug settings,
these are the only settings which were defined in Java code
but not defined in the new config system in C++. (There are
still a lot of settings that are defined in the new config
system but not yet saveable in the new config system, though.)
2020-08-03 15:07:53 +02:00
Felk f775e9b99d OnScreenDisplay: fix names rgba -> argb 2020-08-02 01:37:20 +02:00
LC b354e343a7
Merge pull request #8988 from JosJuice/no-refresh-rate-round
VideoCommon: Don't round the refresh rate
2020-07-28 17:17:34 -04:00
JosJuice f72b756778 VideoCommon: Don't round the refresh rate
We now provide a double to the FPS counter and exact values
to FIFO recording and frame dumping.
2020-07-28 21:01:38 +02:00
Lioncash 4b21bc7508 LightingShaderGen: Transition over to fmt 2020-07-24 13:50:09 -04:00
Lioncash 7f7db6d3e7 VertexShaderGen: Transition over to using fmt 2020-07-24 13:34:47 -04:00
iwubcode 9c8338ec4c DolphinQt / VideoCommon: Add additional texture dumping options. Specifically, this enables users to choose whether to dump mip maps, base level textures, or both. 2020-07-22 19:30:27 -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
LC 4ff560a6e4
Merge pull request #8913 from JosJuice/msvc-preprocessor
Support the new MSVC preprocessor
2020-06-30 04:34:10 -04:00
JosJuice 293745afce Support the new MSVC preprocessor
Intends to fix https://bugs.dolphin-emu.org/issues/12170.
2020-06-29 13:50:59 +02:00
JosJuice 81d399a4f2 VideoCommon: Show profiler output again
This profiler was added in 94d9d13, but must've broken at some point.
2020-06-29 11:59:47 +02:00
Admiral H. Curtiss 27e49c00b3 FreeLookCamera: Fix savestate branch inconsistency.
Fixes https://bugs.dolphin-emu.org/issues/12168
2020-06-28 02:31:37 +02:00
iwubcode 8ccb684711 VideoCommon: change freelook camera fov step size and expose it 2020-06-25 13:34:42 -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
JosJuice c9edfa0eaa Replace Windows CMake lambda constexpr capture workaround
While manually capturing constexpr variables used in lambda
expressions does work, it's really easy to forget doing so since
we don't have a Windows CMake builder and the workaround isn't
necessary anywhere else. Fortunately, MSVC has a flag that fixes
the constexpr capture behavior, so let's use that instead.
2020-06-25 13:11:29 +02:00
iwubcode a65ef35f1a VideoCommon: Clean freelook camera dirty state when getting the new view 2020-06-17 12:07:40 -05: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
Lioncash e3506ff4ef VideoCommon/ShaderGenCommon: Convert helper functions over to fmt
A very trivial conversion, this simply converts calls to Write over to
WriteFmt and adjusts the formatting specifiers as necessary.

This also allows the const char* parameters to become std::string_view
instances, allowing for ease of use with other string types.
2020-05-25 21:12:29 -04:00
Markus Wick 68706973d2
Merge pull request #8828 from stenzek/gles-readpixels
FramebufferManager: Copy to color format for depth readbacks on GLES
2020-05-25 08:57:20 +02: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
Léo Lam 8df56cb319 Migrate video backend setting to the new config system
Fixes https://bugs.dolphin-emu.org/issues/12087
2020-05-22 16:54:53 +02:00
Pierre Bourdon cea779cc84
Merge pull request #8767 from iwubcode/freelook-camera-type
Expand freelook camera with control options
2020-05-17 17:33:04 +02:00
JosJuice 2137fb7813 Externals: Add zstd
I had to rename Source/Common/Compiler.h because the VS build
confuses it with Externals/zstd/lib/common/compiler.h otherwise.
2020-05-13 20:53:10 +02:00
iwubcode e125c61d47 VideoCommon: remove VertexShaderManager functions instead preferring the direct freelook camera methods 2020-05-03 13:34:13 -05:00
iwubcode 6e7d1e0e71 VideoCommon: Add Free Look camera with separate modes 2020-05-03 13:31:47 -05:00
JosJuice bf57abc0d5 Fix Windows CMake build errors
Lambda expressions with uncaptured constants were leading to errors,
and there were also some warnings about deprecated functions
(QFontMetrics::width and inet_ntoa).
2020-05-03 14:10:24 +02:00
degasus fc0df37d94 Fix windows build system. 2020-04-29 12:56:52 +02:00
Pierre Bourdon b7db359081
XFMemory: SETPOSMTXINFO should be SETPOSTMTXINFO
It actually maps to postMtxInfo, not posMtxInfo (which isn't a thing).
This is especially confusing because there *are* position matrices (as
opposed to post-transform matrices).
2020-04-29 05:26:02 +02:00
Léo Lam 0fe4985f8d
Merge pull request #8689 from howard0su/cleanup_sign
Remove warnings of -Wsign-compare
2020-04-28 13:36:21 +02:00
Jun Su f3d7b82f83 Cleanup warnings of -Wswitch
Add default branch to the switch-case.
2020-04-28 13:16:30 +02: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
JMC47 935b12d785
Merge pull request #8730 from JosJuice/frame-advance-duplicate-frame
Core: Skip duplicate frames when using frame advance
2020-04-16 18:29:16 -04:00
JMC47 c0ae9cbc45
Merge pull request #8584 from jordan-woyak/widescreen-heuristic-fix
VideoCommon: Tweak widescreen heuristic.
2020-04-13 05:57:19 -04:00
JosJuice 812ad4257c Core: Skip duplicate frames when using frame advance
It used to be the case that frame advance skipped duplicate frames
(i.e. it would take 30 frame advances to get through one second
of emulated time in a 30 fps game), but this broke in 9c5c3c0.
Skipping duplicate frames making TASing less annoying.
2020-04-09 11:39:29 +02:00
JosJuice 1a42355f96 Core: Clarify Callback_VideoCopiedToXFB and FrameUpdate 2020-04-09 00:21:04 +02: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
Jun Su 81f8099cc6 Remove warnings of -Wsign-compare
Cast the variable to the coresponding type.
2020-03-25 07:57:14 +08:00
Jun Su da223a2271 Cleanup warnings of -Wunused-lambda-capture
Remove unused lambda captures.
2020-03-24 20:14:10 +08:00
iwubcode bba92019dc VideoCommon: Allow texture folders to be determined by a <gameid>.txt file 2020-03-15 12:34:04 -05:00
Stenzek a545344268 VideoBackends: Make it possible for PrepareWindow to change the surface
Again, needed for MoltenVK.
2020-03-11 23:10:30 +10:00
Jordan Woyak 7cbb9822c1 VideoCommon: Remove widescreen heuristic debug logs. 2020-02-09 13:22:27 -06:00
Jordan Woyak 10223da6a8 VideoCommon: Tweak widescreen heuristic and clean up some related Renderer logic. 2020-02-09 13:22:25 -06:00
Lioncash abd2897377 VideoCommon: Amend formatting code to handle the upgrade to fmt
It seems that the newer version of fmt gets tripped up by bitfields
within structs. However, we can just specify the intended type where
necessary to get around this.
2020-02-04 14:55:20 -05:00
Techjar 3a3dc28d54 VertexLoaderX64: Don't use PDEP on AMD Zen 2020-01-26 22:12:00 -05:00
Tilka 2edcb29706
Merge pull request #8582 from jordan-woyak/osd-disabled-fix
VideoCommon/OSD: Process OSD messages even when they are disabled.
2020-01-25 21:11:37 +00:00
Tilka b0e040431a
Merge pull request #8581 from jordan-woyak/ciface-ar-aware
InputCommon: Make "Cursor" inputs aware of the rendered aspect ratio.
2020-01-25 20:28:01 +00:00
Connor McLaughlin e3a7922e12
Merge pull request #8336 from Ebola16/PS
Add Dolphin version and current video backend to shader compilation logs
2020-01-25 11:52:14 +10:00
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