Commit Graph

4558 Commits

Author SHA1 Message Date
OatmealDome 04ec02c06b ConstantManager: Add logic ops to PixelShaderConstants 2021-11-24 17:52:26 -05:00
Scott Mansell f5c550e9cb Delay singlecore gpu interrupts
Fixes Bomberman Jetters in single core mode.

When single core mode pauses the CPU to execute the GPU
FIFO it greedily executes the whole thing. Before this commit,
Finish and Token interrupts would happen instantly, not even
taking into account how long the current FIFO window has
taken to execute. The interrupts would be effectively backdated
to the start of this execution window.

This commit does two things: It pipes the current FIFO window
execution time though to the interrupt scheduling and it enforces
a minimum delay of 500 cycles before an interrupt will be fired.
2021-11-25 11:11:01 +13:00
Léo Lam aa5cb35c86
Merge pull request #10143 from Pokechu22/png-compression-level
Add option for setting the PNG zlib compression level
2021-11-23 16:40:34 +01:00
unknown f43122cd8a Trust MacOS not to crash during shader pre-compilation 2021-11-22 15:32:28 +01:00
DevJPM 613c4563c2 VideoCommon: Gate Multi-Threaded Shader Pre-Compilation behind a bug entry 2021-11-22 09:34:28 +01:00
DevJPM 61cfd8696e Fix CPU Core Count detection and Enable Parallel Shader Compilation
This does this following things:

- Default to the runtime automatic number of threads for pre-compiling shaders
- Adds a distinct automatic thread count computation for pre-compilation  (which has less other things going on
and should scale better beyond 4 cores)
- Removes the unused logical_core_count field from the CPU detection
- Changes the semantics of num_cores from maximaum addressable number of cores to actually available CPU cores
(which is also how it was actually used)
- Updates the computation of the HTT flag now that AMD no longer lies about it for its Zen processors
- Background shader compilation is *not* enabled by default
2021-11-20 16:08:10 +01:00
JMC47 dbaebdc585
Merge pull request #10222 from phire/fix-copy-filter-clamping
Fix copy filter clamping
2021-11-18 17:48:33 -05:00
Pokechu22 94ccf765af Add option for setting the PNG zlib compression level 2021-11-18 13:10:22 -08:00
Pokechu22 1adff1c467 VideoCommon: Skip textureQueryLevels if it doesn't exist 2021-11-17 21:28:39 -08:00
Pokechu22 bdcfb31187 VideoCommon: Handle custom texture sizes correctly
Specifically, when using Manual Texture Sampling, if textures sizes don't match the size the game specifies, things previously broke.  That can happen with custom textures, and also with scaled EFB copies at non-native IRs.  It breaks most obviously by not scaling the texture coordinates (so only part of the texture shows up), but the hardware wrapping functionality also assumes texture sizes are a power of 2 (or else it will behave weirdly in a way that matches how hardware behaves weirdly).  The fix is to provide alternative texture wrapping logic when custom texture sizes are possible.
2021-11-17 21:28:36 -08:00
Pokechu22 93eea7cb13 VideoCommon: Add option to use old behavior (Fast Texture Sampling)
Co-authored-by: JosJuice <josjuice@gmail.com>
2021-11-17 21:27:32 -08:00
Pokechu22 ee80298ca4 VideoCommon: Implement diagonal LOD
Note that both GLSL and HLSL provide a fwidth (fragment width) function defined as `fwidth(p) = abs(dFdx(p)) + abs(dFdy(p))`.  However, it's easy enough to implement this ourselves (and it makes the code a bit more obvious).
2021-11-17 20:04:34 -08:00
Pokechu22 51e3334526 VideoCommon: Use coarse derivatives for Manual Texture Sampling if possible 2021-11-17 20:04:34 -08:00
Pokechu22 ddf2691395 VideoCommon: Manually handle texture wrapping and sampling 2021-11-17 20:04:34 -08:00
Pokechu22 4a9b26de86 VideoCommon: Expose SamplerState to shaders
The benefit to exposing this over the raw BP state is that adjustments Dolphin makes, such as LOD biases from arbitrary mipmap detection, will work properly.
2021-11-17 20:04:34 -08:00
Pokechu22 9ef228503a VideoCommon: Provide raw texdims to shaders 2021-11-17 20:04:34 -08:00
Pokechu22 a273b65566 RenderState: Use operator== for operator!= and adjust constructors 2021-11-17 20:04:34 -08:00
Pokechu22 6236a0d494 Eliminate SamplerCommon 2021-11-17 20:04:34 -08:00
Pokechu22 3096f77ba0 Eliminate SamplerCommon::AreBpTexMode0MipmapsEnabled
This was added in 0b9a72a62d but became irrelevant in 70f9fc4e75 as the check is now self-explanatory due to a rejiggering of the bitfields.
2021-11-17 20:04:34 -08:00
Pokechu22 d2041b4c2a VideoCommon: Add signed version of BitfieldExtract 2021-11-17 20:04:33 -08:00
Pokechu22 555a93057c VideoCommon: Allow BitfieldExtract in specialized shaders 2021-11-17 20:04:33 -08:00
Scott Mansell 7128befb39 Fix copy filter clamping regression in Spyro
This fixes horizontal lines in the bloom effect of Spyro: A Hero's Tail,
which is a regression caused by PR #10204

Screenshot of regression:
https://user-images.githubusercontent.com/138484/142030503-90fcd8d5-63d3-4820-874a-72e9be0c4768.png

Fixed:
https://user-images.githubusercontent.com/138484/142031598-b85ff55c-1302-4e4d-bcb2-57848974056b.png

Spyro uses an 640x80 pixel sub-buffer within the EFB to calculate
it's bloom effects, which it places below the main 640x448 buffer.

EFB layout:
https://user-images.githubusercontent.com/138484/142030573-e933b6ae-c37e-4be6-86d4-0bc779b92535.png
Note: Colors are wrong because the main color buffer uses RGBA6,
      while the bloom is calculated in RGB8

This allows it to do bloom without backing up part of the EFB to
main memory, as most games do.

But, since some of the sub-buffers used in the bloom effect are taller
than 80 pixels, they need to be sliced up into smaller sub, sub buffers
which get combined later when copied to main memory.

At one point, a 320x224 buffer is broken up into 320x80, 320x64 and
320x80 slices. These are copied out with the copy filter set to a
vertical blur.

Because there was an off-by-one errror in the clamping coordinates,
the bottom line of the color buffer would be blurred into
the top of each slice.

Final combined EFB copy:
https://user-images.githubusercontent.com/138484/142031360-2c076839-7c96-4b3b-a093-d899d0a2c7ae.png

Fixed version:
https://user-images.githubusercontent.com/138484/142031370-72e41a35-3b3e-4662-a483-79203e357ecc.png

Before #10204 the copy filter wasn't enabled for efb copies, and most
other games don't do this type of slicing.

FIFO CI shows that a few other games are effected, it's always just a minor difference to the top line where there was previously a slight hint of garbage.
2021-11-17 06:12:46 +13:00
Pokechu22 868de78f16 VideoCommon: Use the copy filter for EFB copies as well as XFB copies
This fixes the pink screens in EA Sports Active.  See https://gist.github.com/Pokechu22/49455f9094ed0ff017da64e3f7aa0404 for details.
2021-11-11 17:22:50 -08:00
Mai M 6c72e6814d
Merge pull request #10169 from leoetlino/fmt-localtime
Use fmt::localtime instead of thread-unsafe std::localtime
2021-11-07 00:08:14 -04:00
Emmanuel Gil Peyrot 5a1333026b VideoCommon: Add missing algorithm include for std::none_of
Otherwise this is an error on gcc/libstdc++, and there are no transitive
includes for this header.
2021-11-02 13:50:21 +01:00
Emmanuel Gil Peyrot 7590f07b80 FrameDump: Remove deprecated call to av_init_packet()
This function was deprecated in ffmpeg in January[1], while its
replacement got introduced in 2015[2], so now might be the time to start
using it in Dolphin. :)

[1] f7db77bd87
[2] a9a6010637
2021-11-02 13:50:21 +01:00
Emmanuel Gil Peyrot 25b136ac17 VideoCommon: Fix a -Wclass-memaccess in gcc 11 2021-11-02 13:50:21 +01:00
Pokechu22 db54e4f2b0 Externals: Update imgui to 1.85 2021-10-26 15:07:57 -07:00
Léo Lam fd7df2ccae
Use fmt::localtime instead of thread-unsafe std::localtime
fmt::localtime is also less awkward to use compared to std::localtime.
2021-10-15 22:49:13 +02:00
Pokechu22 a372a5947b VideoCommon: Fix color channel logic when per-pixel lighting is in use
This was broken in #10012 (specifically by 06579e4d53 and c3dec34391).
2021-10-13 20:43:32 -07:00
Pokechu22 78bfd25964 Fix all uninitialized variable warnings (C26495) 2021-10-13 12:32:16 -07:00
Scott Mansell edb66dab84 TextureCache: Remove deleted textures from bound_textures
Fixes issue where vulkan might crash trying to bind a deleted
texture.
2021-10-12 15:51:24 +13:00
Scott Mansell d771bee0fe TMEM: Add some helpful comments 2021-10-12 15:51:24 +13:00
Scott Mansell a33cf27885 TMEM: Handle savestate and init 2021-10-12 15:51:24 +13:00
Scott Mansell 88bd10cd30 Extend TMEM cache implementation
Now works with games that deliberately avoid invalidating TMEM because
they know textures are too large to fit:

 * Sonic Riders
 * Metal Arms: Glitch in the System
 * Godzilla: Destroy All Monsters Melee
 * NHL Slapshot
 * Tak and the Power of Juju
 * Night at the Museum: Battle of the Smithsonian
 * 428: Fūsa Sareta Shibuya de
2021-10-12 15:51:24 +13:00
Scott Mansell 5a8455e8ce BoundingBox: Add missing include 2021-10-10 13:21:31 +13:00
Scott Mansell 9fa26624b0 BPMemory: Refactor/consolidate TexUnit Addressing
Currently the logic for addressing the individual TexUnits is splattered all
across dolphin's codebase, this commit attempts to consolidate it all into a
single place and formalise it using our new TexUnitAddress struct.
2021-10-10 09:09:43 +13:00
Scott Mansell ef0e401708 BPMem: Abstract TexUnit Addressing into struct
The addressing of the texture units is a bit non-obvious.
This struct abstracts the complexity away.
2021-10-10 09:01:57 +13:00
iwubcode 514475646d VideoCommon: update Free Look camera's 'FieldOfView' function to 'FieldOfViewMultiplier' to better reflect usage 2021-10-08 18:17:20 -05:00
iwubcode aa07fde8a0 VideoCommon: update fov multiplier variables and add constant variables for defaults to the Free Look camera 2021-10-08 18:17:20 -05:00
iwubcode e70157474b Core / VideoCommon: refactor FreeLookCamera to have the underlying controller handle all the logic (field-of-view, movement, etc) 2021-10-08 18:16:32 -05:00
Léo Lam ff1cb5a1c0
Merge pull request #9803 from Techjar/bbox-videocommon
VideoCommon: Abstract bounding box
2021-10-08 22:24:38 +02:00
nonoteal 90437d1574 Change how FFmpeg is imported for Apple computers.
Imports Apple libraries and also pulls swresample in, so when compiling Dolphin doesn't throw undefined symbols.
2021-10-06 18:11:32 -10:00
Techjar 1161af8059 VideoCommon: Abstract bounding box
This moves much of the duplicated bounding box code into VideoCommon,
leaving only the specific buffer implementations in each backend.
2021-10-04 15:51:24 -04:00
Shawn Hoffman e11fdaabf1 fix unused variable warning 2021-09-30 14:27:53 -04:00
sowens99 30dcac15fa RenderBase: Show input count on m_ShowFrameCount
Just to stay consistent, I believe it is best to show total input polls alongside the framecount.
2021-09-29 14:36:09 -04:00
Scott Mansell a47b91e946
Merge pull request #9945 from OatmealDome/intel-broken-discard
DriverDetails: Add broken dual source blending bug to MoltenVK on Intel GPUs
2021-09-30 06:04:06 +13:00
sowens99 53ca2ec274 RenderBase: show total framecount on movie playback
Previously, when playing back a movie, you could not see the total frame count of a movie, only the total number of input polls.

This change simply shows the total frame count on movie playback.

Note that this change also results in the framecount and framecount total ALWAYS being displayed if show_movie_window is true, regardless of whether or not m_ShowFrameCount is true. I believe this is fine, as TASers are much more likely to reference the framecount than the input poll count.
2021-09-28 22:15:25 -04:00
OatmealDome a256c11d2f DriverDetails: Add broken dual source blending bug to MoltenVK on Intel GPUs 2021-09-20 19:14:41 -04:00
Scott Mansell ce80a96aee BPStructs: ensure side effects are same
Missed this side effect when fixing crash in Mario Kart Wii wifi
2021-09-18 23:58:24 +12:00
OatmealDome 7e8f5208fe VulkanContext: Disable subgroup reduction on macOS with AMD GPUs 2021-09-16 23:32:10 -04:00
Scott Mansell 7c7609f5b9 BPStructs: Ignore malformed efb copies 2021-09-17 12:42:23 +12:00
Scott Mansell eb8bfabdfd BPStructs: make copy width/height const 2021-09-15 11:54:40 +12:00
Scott Mansell 37b80e2170 BPStructs: fix out-of-range EFB copy clamping
Previous code from #7950 only clamps correctly when the efb copies
left and top coordinates are (0, 0)

Now we should handle all situations.

Spyro: A hero's tail is an example of a game that does an oversized
EFB copy with a non-zero origin.
2021-09-15 02:31:38 +12:00
JMC47 05f86b9f5b
Merge pull request #10012 from Pokechu22/thps4-green-sky
UberShaderVertex: Fix Tony Hawk Pro Skater 4
2021-09-09 17:58:35 -04:00
Pokechu22 52c82733f6 Use custom isnan implementation to avoid HLSL optimizer issues
This adjusts the NaN replacement logic introduced in #9928 to work around the HLSL compiler optimizing away calls to isnan, which caused that functionality to not work with ubershaders on D3D11 and D3D12 (it did work with specialized shaders, despite a warning being logged for both; that warning is also now gone).  Note that the `D3DCOMPILE_IEEE_STRICTNESS` flag did not solve this issue, despite the warning suggesting that it might.

Suggested by @kayru and @jamiehayes.
2021-09-07 19:04:40 -07:00
Lioncash f36fd5fa39 BPMemory: Make ZTexOp enum an enum class
Avoids placing generic names in the surrounding namespace.
2021-09-01 18:23:22 -04:00
iwubcode 1f2f505373 VideoBackends / VideoCommon: allow the ability to set debug names for shaders / textures. These names are visible in applications like RenderDoc 2021-08-30 13:47:48 -05:00
Pokechu22 c3dec34391 UberShaderVertex: Simplify color channel logic 2021-08-18 10:40:54 -07:00
Pokechu22 06579e4d53 VertexShaderGen: Simplify color channel logic 2021-08-18 10:40:54 -07:00
Pokechu22 2519d14e36 UberShaderVertex: Fix Tony Hawk Pro Skater 4
Fixes https://bugs.dolphin-emu.org/issues/12620

The changed code did not match the corresponding code in VertexShaderGen.  Some parts of the sky have 2 color channels in each vertex, while others only have 1, despite only color channel 0 being used and XFMEM_SETNUMCHAN being set to 1 for both of them.  The old code (from #4601) caused channel 0 to be set to channel 1 if the vertex contained both color channels but the number of channels was set to 1, which is wrong.
2021-08-18 10:40:53 -07:00
Tillmann Karras f9d2d42a4c VideoCommon: report games that set bits in XFMEM_CLIPDISABLE
The SDK only exposes the lowest bit. The Nintendo Channel intro is currently
broken because we don't implement this (see issue 12562).
2021-08-15 04:41:49 +01:00
JosJuice c79757618d
Merge pull request #9993 from Techjar/late-vi-output
VI: Implement post-scanout XFB output
2021-08-07 12:41:59 +02:00
Techjar 797d0b7b1b VI: Implement post-scanout XFB output
This adds about a frame of latency, and since most games don't change
VI registers during scanout, we can get away with outputting the XFB at
the start of scanout. WWE Crush Hour is the (only currently known)
exception, which has flickering problems when doing it this way.

This adds a path to perform the output at the end of scanout, and gates
it behind an option which defaults to using the latency-reducing
pre-scanout path.
2021-08-03 23:37:50 -04:00
Léo Lam c9c5f7a89c
Merge pull request #9928 from Pokechu22/shadow-the-hedgehog-eyelids-NaN
Convert NaN to 1 when generating texture coordinates
2021-08-04 03:08:34 +02:00
Léo Lam 35bf5e3839
Merge pull request #9962 from OatmealDome/macos-vulkan-default
VideoBackendBase: Prefer Vulkan over OGL on macOS Mojave and newer
2021-08-02 03:39:12 +02:00
Pokechu22 f46fe77264 GeometryShaderGen: Rename ApiType to api_type 2021-08-01 15:17:21 -07:00
Pokechu22 3b752c4d5d UberShaderPixel: Rename ApiType to api_type 2021-08-01 15:09:20 -07:00
Pokechu22 b6d2938731 Recompile shaders when 'Enable API Validation Layers' is toggled 2021-07-28 21:35:36 -07:00
Pokechu22 eb81968fe6 Convert ShaderHostConfig to BitField 2021-07-28 21:35:36 -07:00
Pokechu22 1640fa9096 Remove note about anisotropic filtering requiring edge LOD
This was added because YAGCD's info on MAXANISO (near TX_SETMODE0 in Section 5.11.1) claims it's the case, but Extrems says it does work.  I haven't tested anything myself, and dolphin still does not actually implement anisotropic filtering based on this field.
2021-07-27 19:33:31 -07:00
OatmealDome 46e331d000 VideoBackendBase: Prefer Vulkan over OGL on macOS Mojave and newer 2021-07-25 19:21:06 -04:00
Pokechu22 3a4d8379bf Convert NaN to 1 when generating texture coordinates
This fixes eyelids in Shadow the Hedgehog during cutscenes (https://bugs.dolphin-emu.org/issues/11458)
2021-07-24 22:20:35 -07:00
Pokechu22 19332575aa WrapMode=3 behaves the same as Clamp 2021-07-20 19:23:23 -07:00
JosJuice 92fc4f1eca PixelShaderGen: Fix OpenGL ES bounding box compilation error 2021-07-20 11:39:32 +02:00
Techjar 5e0520b6e0 VideoCommon: Expand vector comparisons instead of overloading any()
For whatever stupid reason, Mali drivers do not allow overloading
built-in functions.
2021-07-20 05:24:47 -04:00
Tillmann Karras c948d7f436 PostProcessing: fix link error when switching shaders
Switching to a post-processing shader with different configuration options will
change the UBO, so we need to recompile the vertex shader as well.
2021-07-18 04:08:48 +01:00
Connor McLaughlin 9b17805be9
Merge pull request #9881 from blaahaj/postprocessing-fix
PostProcessing: Fix OpenGL UBO linking with configuration options
2021-07-14 13:14:17 +10:00
Markus Wick edc4396603
Merge pull request #9888 from JosJuice/jitarm64-logicalimm-everywhere
JitArm64: Stop using hand-encoded logical immediates
2021-07-12 23:03:31 +02:00
JosJuice 8af5095ff4 JitArm64: Stop using hand-encoded logical immediates 2021-07-12 22:25:49 +02:00
CrystalGamma beb6ec0569 VideoCommon: fix generic build
On x86/ARM Common/Assert.h is included by way of
VideoCommon/VertexLoader{X64,ARM64}.h, on other platforms it is missing.
2021-07-12 04:30:43 +02:00
Pokechu22 b880be0aa5 Use separate fmt::formatters for each indirect matrix column
This also fixes a bug where the float version of row 1 actually showed row 0 again.
2021-07-11 15:01:42 -07:00
Pokechu22 f467c02d1a Ignore the top bit of the indirect texture matrix scale
This fixes the Zora eye coloration in Twilight Princess.
2021-07-11 15:01:37 -07:00
Tilka 20a8e9c872
Merge pull request #9876 from Pokechu22/skyward-sword-map
Fix indirect textures when format is not ITF_8
2021-07-11 22:59:23 +01:00
JosJuice 9e80db123f JitArm64: Encode logical immediates at compile-time where possible
Manually encoding and decoding logical immediates is error-prone.
Using ORRI2R and friends lets us avoid doing the work manually,
but in exchange, there is a runtime performance penalty. It's
probably rather small, but still, it would be nice if we could
let the compiler do the work at compile-time. And that's exactly
what this commit does, so now I have no excuse for trying to
manually write logical immediates anymore.
2021-07-10 20:43:59 +02:00
Pokechu22 a379456f38 Fix indentation for alphabump 2021-07-08 15:48:14 -07:00
Pokechu22 2feced2e33 Fix indirect textures when format is not ITF_8 2021-07-08 15:48:14 -07:00
blåhaj debeb09dee PostProcessing: Fix OpenGL UBO linking with configuration options 2021-07-07 21:28:22 +02:00
Léo Lam 56fdde5d74
Merge pull request #9595 from Dentomologist/fix_vertex_loader_test_warnings
VertexLoaderTest: Fix memset assignment warning
2021-07-06 11:50:23 +02:00
Mai M ffdc8538a1
Merge pull request #9862 from delroth/spdx-tags
Use SPDX for Dolphin licensing info
2021-07-06 01:02:57 -04:00
JMC47 6cc195e02f
Merge pull request #9640 from v1993/patch-1
Allow post-processing shaders to query reciprocal of window resolution
2021-07-05 16:30:54 -04:00
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Léo Lam a632a6a404
Merge pull request #9833 from Pokechu22/ubershaders-tevcoord
UberShaderPixel: always set tevcoord, even if the stage has no texture
2021-06-24 01:05:17 +02:00
Léo Lam b66e88e4b9
Merge pull request #9837 from AdmiralCurtiss/mysterious-voodoo-performance-fix
VideoCommon/Fifo: Move SConfig::GetInstance() outside the GPU loop.
2021-06-24 00:41:43 +02:00
JMC47 95ecb73b11
Merge pull request #9826 from Techjar/fix-tmem-mips
VideoCommon/TextureInfo: Fix mipmap loading from tmem
2021-06-23 18:21:55 -04:00
Admiral H. Curtiss 1183fb3d2d VideoCommon/Fifo: Move SConfig::GetInstance() outside the GPU loop. 2021-06-23 23:52:26 +02:00
Pokechu22 2f1726e3f3 UberShaderPixel: always set tevcoord, even if the stage has no texture
This fixes NES game graphics when UberShaders are in use.
2021-06-21 13:01:25 -07:00
Techjar 2d59dcb95d VideoCommon/TextureInfo: Fix mipmap loading from tmem
Even address needs to be offset to the first mipmap entry.
2021-06-20 16:49:39 -04:00
iwubcode df53a5f880 VideoCommon: enhance hi res texture support by having exact matches be picked before wildcard matches. Additionally, add the ability to ignore the texture hash portion of the texture name when loading a hi res texture 2021-06-19 21:15:38 -05:00
iwubcode 8fb0f91331 VideoCommon: split the texture hash from the base name when generating the texture name 2021-06-19 21:15:38 -05:00
Techjar 3da0976a81 VideoCommon: Define scalar any() and all() functions in GLSL
This fixes bounding box shaders failing to compile under Vulkan, due to
differences between GLSL and HLSL in the return value of vector
comparisons and what types these functions accept. I included all() for
the sake of completeness.
2021-06-13 04:50:35 -04:00
JMC47 0c6e00ce0c
Merge pull request #9801 from Techjar/bbox-rounding-hack
VideoCommon: Only include centered pixels in bounding box
2021-06-11 00:41:11 -04:00
Techjar b267f54259 VideoCommon: Only include centered pixels in bounding box
At higher resolutions, our bounding box dimensions end up being
slightly larger than original hardware in some cases. This is not
necessarily wrong, it's just an artifact of rendering at a higher
resolution, due to bringing out detail that wouldn't have appeared on
original hardware. It causes a texel to fall partially on what would
have been a single pixel at native resolution, resulting in the
coordinates getting bumped up to the next valid value. In many cases,
these slightly larger bounding boxes are perfectly fine, as games don't
hard-code expected dimensions. It is problematic in Paper Mario TTYD
though, for a somewhat complicated reason.

Paper Mario TTYD frequently uses EFB copies to pre-render a bunch of
animation frames for a character sprite (especially in Chapter 2), so
that it can then render 100 or more of them without bringing the
GameCube to its knees. Based on my observation, the game seems to set
aside a region of memory to store these EFB copies. This region is
obviously fairly small, as the GameCube only has 24MB of RAM. There are
2 rooms in Chapter 2 where you fight a horde of as many as 100 Jabbies,
which are also rendered using EFB copies, so in this room the game ends
up making 130(!) EFB copies just for Puni and Jabbi sprites. This seems
to nearly fill the region of memory it set aside for them.
Unfortunately, our slightly larger bounding boxes at higher resolutions
results in overflowing this memory, causing very strange behavior. Some
EFB copies partially overlap game state, resulting in reading it as a
garbage RGB5A3 texture that constantly changes. Others apparently
somehow trigger a corner case in our persistent buffer mapping, causing
them to partially overwrite earlier EFB copies.

What this change does is only include the screen coordinates that align
with the equivalent native resolution pixel centers, which generally
results in the bounding boxes being more in line with original
hardware. It isn't perfect, but it's enough to fix Paper Mario TTYD's
Jabbi rooms by avoiding the buffer overflow. Notably, it is more
accurate at odd resolutions than at even resolutions. Native resolution
is completely unaffected by this change, as should be the case. This
change may also have a small positive impact on shader performance at
higher resolutions, as there will be less atomic operations performed.
2021-06-10 21:49:52 -04:00
Pokechu22 1500a0119b Eliminate TVtxDesc.GetLegacyHex 2021-06-09 20:50:50 -07:00
Pokechu22 820d9ffbfa Remove PixelShaderGen hasindstage 2021-06-09 20:50:49 -07:00
Pokechu22 c583cac568 Hack to hide debug cubes in Super Mario Sunshine
... while not breaking other games.
2021-06-09 20:50:49 -07:00
Connor McLaughlin c729852d72
Merge pull request #9782 from Techjar/bbox-ogl-upsidedown-fix
VideoCommon: Perform OpenGL bounding box inversion in pixel shader
2021-06-08 13:24:03 +10:00
Léo Lam 5e371bb4be
Merge pull request #9792 from sepalani/lint
Lint: End of namespace
2021-06-07 12:16:08 +02:00
Sepalani ce8004c9c1 Lint: End of namespace 2021-06-07 12:55:52 +04:00
Techjar 4866002c9b VideoCommon: Perform OpenGL bounding box inversion in pixel shader
Running the min/max operation on the upside down, quad-rounded pixel
coordinates before inverting them to the standard upper-left origin
produces wrong results. Therefore, we need to do the inversion before
rounding to pixel quads.
2021-06-06 20:55:06 -04:00
Techjar 83d55704aa VideoCommon: Round bounding box coordinates down and remove pixel center offset
Fragment coordinates always have a 0.5 offset from a whole integer, as
that's where the pixel center is on modern GPUs. Therefore, we want to
always round the fragment coordinates down for bounding box
calculations. This also renders the pixel center offset useless, as 0.5
vs ~0.5833333 makes no difference when rounding down.
2021-06-05 00:34:10 -04:00
JMC47 a12865570d
Merge pull request #9764 from Pokechu22/amd-opengl-bbox-fix
VideoCommon: Fix bounding box on AMD/OpenGL/Windows
2021-06-01 19:55:54 -04:00
Techjar 8cfe49295f VideoCommon: Add fallback handling for bounding box when disabled or unsupported
The SDK seems to write "default" bounding box values before every draw
(1023 0 1023 0 are the only values encountered so far, which happen to
be the extents allowed by the BP registers) to reset the registers for
comparison in the pixel engine, and presumably to detect whether GX has
updated the registers with real values. Handling these writes and
returning them on read when bounding box emulation is disabled or
unsupported, even without computing real values from rendering, seems
to prevent games from corrupting memory or crashing.

This obviously does not fix any effects that rely on bounding box
emulation, but having the game not clobber its own code/data or just
outright crash is a definite improvement.
2021-05-31 19:56:24 -04:00
Pokechu22 c58837964f VideoCommon: Fix bounding box on AMD/OpenGL/Windows
Co-authored-by: Techjar <tecknojar@gmail.com>
2021-05-31 16:22:50 -07:00
Techjar 2f1b639f0a VideoCommon: Restore BBox* forwarding functions 2021-05-31 18:01:47 -04:00
Tillmann Karras faec77a971 Fix -Wreorder warnings 2021-05-30 17:10:20 +01:00
Techjar a24e78b3cf VideoCommon: Remove BBox* forwarding functions 2021-05-29 01:45:21 -04:00
Techjar e4aef0a85b VideoCommon: Move bounding box pixel quads rounding to shader
This avoids rounding values that the game writes to the bounding box
registers, especially the default values.
2021-05-28 23:30:22 -04:00
Pokechu22 5928182a4c Skip indirect operation for out of bounds indirect stages
This fixes rendering issues in Viewtiful Joe (https://bugs.dolphin-emu.org/issues/12525), but it is not entirely hardware accurate, as hardware testing showed other, more complex behavior in this case.  However, it should be good enough for our purposes.
2021-05-27 22:13:42 -07:00
Léo Lam 51671921c4
Merge pull request #9441 from skylersaleh/master
Apple M1 Support for MacOS
2021-05-24 12:39:01 +02:00
Mai M 95aadff0e7
Merge pull request #9737 from Techjar/fix-textureinfo-hasmips
VideoCommon/TextureInfo: Restore old mipmap detection logic
2021-05-22 19:39:52 -04:00
Skyler Saleh 76ed9310f2 Apple M1: RAII Wrapper for JITPageWrite*Execute*()
Added RAII wrapper around the the JITPageWriteEnableExecuteDisable() and
JITPageWriteDisableExecuteEnable() to make it so that it is harder to forget to
pair the calls in all code branches as suggested by leoetlino.
2021-05-22 15:25:18 -07:00
Skyler Saleh 4ecb3084b7 Apple M1 Support for MacOS
This commit adds support for compiling Dolphin for ARM on MacOS so that it can
run natively on the M1 processors without running through Rosseta2 emulation
providing a 30-50% performance speedup and less hitches from Rosseta2.

It consists of several key changes:

- Adding support for W^X allocation(MAP_JIT) for the ARM JIT
- Adding the machine context and config info to identify the M1 processor
- Additions to the build system and docs to support building universal binaries
- Adding code signing entitlements to access the MAP_JIT functionality
- Updating the MoltenVK libvulkan.dylib to a newer version with M1 support
2021-05-22 15:25:17 -07:00
Techjar be6b000bec VideoCommon: Account for pixel quads in bounding box calculation
The GC/Wii GPU rasterizes in 2x2 pixel groups, so bounding box values
will be rounded to the extents of these groups, rather than the exact
pixel. To account for this, we'll round the top/left down to even and
the bottom/right up to odd. I have verified that the values resulting
from this change exactly match a real Wii.
2021-05-22 05:58:52 -04:00
Techjar 0f17990137 VideoCommon: Split BBox* functions into common and backend implementation variants
This will allow for some aspects of bounding box to be handled in
VideoCommon instead of individual backends.
2021-05-22 01:11:57 -04:00
Techjar 42d1658c50 VideoCommon/TextureInfo: Restore old mipmap detection logic 2021-05-22 00:35:43 -04:00
Mai M 8b81481920
Merge pull request #9710 from JosJuice/volatile-begone
Remove all remaining volatile qualifiers
2021-05-20 10:20:22 -04:00
JMC47 93e9d8be86
Merge pull request #8923 from Filoppi/OSD-fixes
fixes for "On Display Messages"
2021-05-18 00:33:15 -04:00
JosJuice 8a0f5ea04a Remove all remaining volatile qualifiers 2021-05-15 09:52:04 +02:00
Mat M d74a1068b8
Merge pull request #9540 from Pokechu22/better-fifo-analyzer-part-2
Fifo analyzer quality of life improvements
2021-05-14 15:51:53 -04:00
Mat M 964fed77c5
Merge pull request #9707 from JosJuice/remove-atomic-header
Remove Atomic.h
2021-05-14 14:33:24 -04:00
Scott Mansell 9f91fb6447
Merge pull request #9688 from Filoppi/input_cleanup
Input cleanup
2021-05-14 20:51:33 +12:00
JosJuice b93983b50a Remove Atomic.h
The STL has everything we need nowadays.

I have tried to not alter any behavior or semantics with this
change wherever possible. In particular, WriteLow and WriteHigh
in CommandProcessor retain the ability to accidentally undo
another thread's write to the upper half or lower half
respectively. If that should be fixed, it should be done in a
separate commit for clarity. One thing did change: The places
where we were using += on a volatile variable (not an atomic
operation) are now using fetch_add (actually an atomic operation).

Tested with single core and dual core on x86-64 and AArch64.
2021-05-13 18:56:27 +02:00
Mat M d034c830ac
Merge pull request #9681 from iwubcode/texture-info
VideoCommon: move all texture calculations to a "TextureInfo" class
2021-05-13 06:44:08 -04:00
Filoppi f4fec42165 Add mixed comments to input code, make some tooltip clearer 2021-05-12 18:27:23 +03:00
iwubcode 182dfc38e6 VideoCommon: move all texture calculations to a "TextureInfo" class. This ever so slightly improves readability and allows for the full texture name to be generated outside of the hires texture cache 2021-05-11 22:58:36 -05:00
JMC47 eb5cd9be78
Merge pull request #9694 from iwubcode/xfb-tcache-hash
VideoCommon: update TextureCache logic for finding oversized XFBs
2021-05-09 15:20:53 -04:00
iwubcode 6fd7867c56 VideoCommon: simplify TextureCacheBase by comparing a xfb's hash against a newly calculated one. This fixes games like Teenage Mutant Ninja Turtles (Wii) which use oversized textures where the stride doesn't match the BytesPerRow and that resulted in a different hash algorithm being used. By not hashing the texture before, we improve performance by hashing at most once in all direct XFB lookup scenarios. 2021-05-08 01:29:48 -05:00
Pokechu22 e1d45e9ba6 UberShaderPixel: always run indirect stage logic
Hardware testing has confirmed that fb_addprev and wrapping both run even when the indirect stage is disabled.
2021-05-07 16:37:47 -07:00
Pokechu22 b5844ab195 PixelShaderGen: always run indirect stage logic
Hardware testing has confirmed that fb_addprev and wrapping both run even when the indirect stage is disabled.
2021-05-07 16:37:47 -07:00
Pokechu22 5e3360c2cc UberShaderPixel: Fix OOB tex coord indices
Previously we set the texture coordinate to zero, now we set
the texture coordinate *index* to zero. This fixes the ripple
effect of the Mario painting in Luigi's Mansion.
2021-05-07 16:37:47 -07:00
Pokechu22 ed02034967 UberShaderPixel: Return fixed-point values from selectTexCoord
This change should have no behavioral differences itself, but allows for changing the behavior of out of bounds tex coord indices more easily in the next commit.  Without this change, returning tex0 for out of bounds cases and then applying the fixed-point logic would use the wrong tex dimension info (tex0 with I_TEXDIMS[1] or such), which is inaccurate.
2021-05-07 16:37:10 -07:00
Tillmann Karras f6cf85a8bc PixelShaderGen: Fix OOB tex coord indices
Previously we set the texture coordinate to zero, now we set
the texture coordinate *index* to zero. This fixes the ripple
effect of the Mario painting in Luigi's Mansion.

Co-authored-by: Pokechu22 <Pokechu022@gmail.com>
2021-05-07 16:28:09 -07:00
Pokechu22 002ff4e4dd PixelShaderGen: Remove unused num_texgens argument
It became unused in f039149198.
2021-05-07 16:28:08 -07:00
Pokechu22 c3668e179c Split TevStageIndirect::mid into matrix_index and matrix_id 2021-05-07 16:27:52 -07:00
Pokechu22 1d628d087b Add 1 when displaying the number of TEV stages 2021-05-07 16:14:19 -07:00
Pokechu22 072304404c Correct indirect stage ref typos
YAGCD uses BI0/BC0/BI1/BC1/BI2/BC2/BI3/BC3, so I'm pretty sure the BI2/BC3/BI4/BC4 names are a typo that just was propagated.
2021-05-07 16:14:18 -07:00
Pokechu22 77b1cca987 Separate vertex components by spaces 2021-05-07 15:42:26 -07:00
Pokechu22 df77a687e8 Add descriptions for GX_LOAD_INDX_A/B/C/D 2021-05-07 15:42:26 -07:00
Pokechu22 0a906f553f Move vertex size and component calculation to VertexLoaderBase 2021-05-07 15:42:17 -07:00
Pokechu22 fa7077763f Remove VertexLoaderBase::IsInitialized
It is no longer relevant for the current set of loaders after 7030542546.  If it becomes relevant again, a static function named IsUsable or IsCompatibleWithCurrentMachine or something would be a better approach.
2021-05-07 15:42:17 -07:00
Pokechu22 cafffff75e Eliminate TVtxAttr 2021-05-07 15:42:17 -07:00
Pokechu22 0a71ce143a Extract VertexLoaderARM64::GetLoadSize into a new function 2021-05-07 15:42:16 -07:00
Pokechu22 252ef6bb34 Use bool bitfields in VAT 2021-05-07 15:42:16 -07:00
Pokechu22 b6149623aa Remove VertexLoader::ToString 2021-05-07 15:42:13 -07:00
Pokechu22 bc7da726a5 Convert VertexLoader_Color to a table 2021-05-07 15:42:11 -07:00
Léo Lam a6f6211dde
Merge pull request #9633 from Pokechu22/BitfieldExtract-pointer-to-member
Change BitfieldExtract to use a pointer to the bitfield member
2021-05-08 00:21:15 +02:00
Pokechu22 0f7c9ef767 Change BitfieldExtract to use a pointer to the bitfield member 2021-05-07 15:11:17 -07:00
Léo Lam 049b92b7ef
Merge pull request #9417 from Filoppi/input-1
Fix FPS counter and Game Window speed % breaking on pause/unpause
2021-05-07 15:08:01 +02:00
Léo Lam 2b632f6d5d
Merge pull request #9641 from lynlevenick/ash/texture-cache-opt
Remove spurious memory allocations in TextureCacheBase::SerializeTexture and DeserializeTexture
2021-05-07 15:01:23 +02:00
Filoppi 818672b585 Fix FPS counter and Game Window speed % breaking on pause/unpause
-Add pause state to FPSCounter.
-Add ability to have more than one "OnStateChanged" callback in core.
-Add GetActualEmulationSpeed() to Core. Returns 1 by default. It's used by my input PRs.
2021-05-06 01:10:04 +03:00
Scott Mansell ab55c948a1 Update zcompression format change TODO 2021-05-05 11:32:42 +12:00
Scott Mansell a4796e512a Implement EFB Peeks for compressed z16 formats
This fixes an issue in RS3 where engine lens flares would shine
though ships during cutscenes
2021-05-05 11:32:29 +12:00
Filoppi 3492f51eaf OnScreenDisplay: a few fixes
-They might have never drawn if DrawMessages wasn't called before they actually expired
-Their fade was wrong if the duration of the message was less than the fade time

This makes them much more useful for debugging, I know there might be other means
of debugging like logs and imgui, but this was the simplest so that's what I used.
If you want to print the same message every frame, but with a slightly different value
to see the changes, it now work.

To compensate for the fact that they are now always rendered once,
so on start up a lot of old messages (printed while the emulation was off) could show up,
I've added a "drop" time, which means if a msg isn't rendered for the first
time within that time, it will be dropped and never rendered.
2021-04-25 15:45:30 +03:00
ezio1900 97ea3a603e VideoCommon: Fix scissorOffset, handle negative value correctly
VideoCommon: Change the type of BPMemory.scissorOffset to 10bit signed: S32X10Y10
VideoBackends: Fix Software Clipper.PerspectiveDivide function, use BPMemory.scissorOffset instead of hard code 342
2021-04-24 08:46:21 +08:00
ash!! 43ceba4fef optimize TextureCacheBase::SerializeTexture, ::DeserializeTexture
texture serialization and deserialization used to involve many memory
allocations and deallocations, along with many copies to and from
those allocations. avoid those by reserving a memory region inside the
output and writing there directly, skipping the allocation and copy to
an intermediate buffer entirely.
2021-04-18 13:40:42 -07:00
JMC47 821e51cda4
Merge pull request #7214 from stenzek/cp-access-sync
Fifo: Run/sync with the GPU on command processor register access
2021-04-18 11:17:25 -04:00
Stenzek e3ac5dca32 Fifo: Run/sync with the GPU on command processor register access 2021-04-18 03:24:01 +10:00
Valeri b3b1518f91
Allow shaders to query reciprocal of window resolution 2021-04-13 20:14:17 +03:00
sspacelynx aba9cae5ab
DriverDetails: Fix broken vector bitwise AND on Mali drivers 2021-04-11 15:15:02 +02:00
Pokechu22 f32b771f7a Skip loading unknown XF registers in the FIFO player
This avoids some warnings, which were originally fixed by ignoring loads with a value of zero (see 636bedb207 / #3242).

Note that FifoCI will report some changes, but only on the first frame; these seem to be timing related as they don't happen if a different write is used to replace skipped ones.
2021-04-06 11:54:49 -07:00
Pokechu22 cde6cf2ab5 Track and log CP commands 0x00/0x10/0x20 differently from other unknown commands
They appear to relate to perf queries, and combining them with truely unknown commands would probably hide useful information.  Furthermore, 0x20 is issued by every title, so without this every title would be recorded as using an unknown command, which is very unhelpful.
2021-04-06 11:54:49 -07:00
Pokechu22 193f6a67a7 Log a warning for inexact uses of MATINDEX or VCD commands 2021-04-06 11:54:48 -07:00
Pokechu22 7fe1292c62 Add game quirks for unknown BP/CP/XF commands 2021-04-06 11:44:31 -07:00
Léo Lam 6d1eb6ae5a
Merge pull request #9621 from Pokechu22/cassert
Replace uses of cassert with Common/Assert.h
2021-04-03 12:46:21 +02:00
Pokechu22 004dfd1586 Replace uses of cassert with Common/Assert.h 2021-04-02 10:18:18 -07:00
blåhaj f339bc69c8 VertexShaderGen: Sonic epsilon hack for OpenGL ES
debaf63fe8 moved the "Sonic epsilon hack"
to vertex shaders. However, it was only done for targets with depth
clamping. If this is not available, for example the target is OpenGL ES,
the Sonic problem appears (https://bugs.dolphin-emu.org/issues/11897).

A version of the "Sonic epsilon hack" is added for targets without
depth clamping.
2021-04-02 15:12:30 +02:00
JMC47 ce8e87c64b
Merge pull request #8747 from iwubcode/map-freelook
Support controlling Free Look via input bindings (motion controls, gamepad, etc!)
2021-04-01 01:05:00 -04:00
Pokechu22 51de3d0fd1 Refactor CP array constants slightly 2021-03-26 17:27:21 -07:00
Dentomologist 1cc035eb05 VertexLoaderTest: Fix memset assignment warning
Initialize and assign members of TVtxDesc and VAT structs directly
instead of using memset.

Fixes -Wclass-memaccess warning from gcc on Debian.
2021-03-18 21:10:29 -07:00
iwubcode 425ee13d35 FreeLook: update camera and manager to use a delta time for movement (in case we decide to move this somewhere else in the future) 2021-03-18 17:54:12 -05:00
iwubcode 80cf87158e VideoCommon: update FreeLook camera to add quaternion based rotation, fix orbital and fps implementations 2021-03-17 20:58:33 -05:00
JosJuice a45a0a2066
Merge pull request #9494 from Dentomologist/convert_arm64reg_to_enum_class
Arm64Gen: Convert ARM64Reg to enum class
2021-03-17 00:05:23 +01:00
Dentomologist f0f206714f Arm64Gen: Convert ARM64Reg to enum class
Most changes are just adding ARM64Reg:: in front of the constants.
2021-03-13 10:10:59 -08:00
Dentomologist 95c86ee48b FreeLookCamera: Add override specifiers 2021-03-07 10:10:00 -08:00
Dentomologist 1c71d33ed5 FreeLookCamera: Remove unused variable 2021-03-07 10:10:00 -08:00
Pokechu22 df81210e96 Use formatters in GetBPRegInfo; add missing commands
BPMEM_TEV_COLOR_ENV + 6 (0xC6) was missing due to a typo.  BPMEM_BP_MASK (0xFE) does not lend itself well to documentation with the current FIFO analyzer implementation (since it requires remembering the values in BP memory) but still shouldn't be treated as unknown.  BPMEM_TX_SETMODE0_4 and BPMEM_TX_SETMODE1_4 (0xA4-0xAB) were missing entirely.
2021-03-06 19:27:20 -08:00
Pokechu22 70f9fc4e75 Convert BPMemory to BitField and enum class
Additional changes:
- For TevStageCombiner's ColorCombiner and AlphaCombiner, op/comparison and scale/compare_mode have been split as there are different meanings and enums if bias is set to compare.  (Shift has also been renamed to scale)
- In TexMode0, min_filter has been split into min_mip and min_filter.
- In TexImage1, image_type is now cache_manually_managed.
- The unused bit in GenMode is now exposed.
- LPSize's lineaspect is now named adjust_for_aspect_ratio.
2021-03-06 19:27:19 -08:00
Pokechu22 db8ced7e4e Add FogParam0::FloatValue and FogParam3::FloatValue
This value will be used in the register description; so expose it in a way that can be re-used instead of calculating it in 2 places later.
2021-03-06 19:27:18 -08:00
Pokechu22 f2bea67709 Fix typo with ztex2 op in UseVertexDepthRange 2021-03-06 19:27:17 -08:00
Pokechu22 762fe33a3d Rename BPMEM_EFB_BR to BPMEM_EFB_WH 2021-03-06 19:27:16 -08:00
Pokechu22 81b84a5ebe Use XFMEM_REGISTERS_START/END in XFRegWritten and LoadXFReg 2021-03-06 19:27:15 -08:00
Pokechu22 8c80369373 Add names and descriptions for regular XF memory 2021-03-06 19:27:15 -08:00
Pokechu22 2d6ec7457d Add names and descriptions for XF registers to the FIFO analyzer 2021-03-06 19:27:14 -08:00
Pokechu22 aab81d5aa0 Convert XFMemory to BitField and enum class
Additionally a new ClipDisable union has been added (though it is not currently used by Dolphin).
2021-03-06 19:27:14 -08:00
Pokechu22 953e09428f Add names and descriptions for CP registers to the FIFO analyzer 2021-03-06 19:27:14 -08:00
Pokechu22 f749fcfa9f Convert CPMemory to BitField and enum class
Additionally, VCacheEnhance has been added to UVAT_group1.  According to YAGCD, this field is always 1.

TVtxDesc also now has separate low and high fields whose hex values correspond with the proper registers, instead of having one 33-bit value.  This change was made in a way that should be backwards-compatible.
2021-03-06 19:27:08 -08:00
Pokechu22 c27efb3f1f Create constants for CP registers and masks 2021-03-06 17:34:05 -08:00
iwubcode 0a9c764dc4 VideoCommon: Join the prefetch thread before clearing to avoid a potential crash that can occur by multiple threads touching a single resource 2021-02-11 19:18:38 -06:00
Léo Lam c386c5acc2
Merge pull request #9366 from iwubcode/freelook_camera_quaternion
VideoCommon: allow Free Look to be manipulated by a quaternion
2021-01-28 01:34:09 +01:00
iwubcode 586c689d63 VideoCommon: use Quaternion for Free Look orientation 2021-01-27 18:22:10 -06:00
Shawn Hoffman 500a694ca8 msbuild: bundle all dolphin "core" code into single library 2021-01-27 14:29:49 -08:00
Shawn Hoffman 84128d9532 rename Common/File to Common/IOFile 2021-01-27 14:29:48 -08:00
Shawn Hoffman 07fd02f207 rename Core/Analytics to Core/DolphinAnalytics 2021-01-27 14:29:47 -08:00
Dentomologist e3237661ec Arm64Emitter: Convert ShiftType to enum class 2021-01-17 16:21:38 -08:00
Dentomologist 70c54065ab Arm64Emitter: Convert IndexType to enum class 2021-01-15 23:27:11 -08:00
Léo Lam eafb9de047
Merge pull request #9323 from waddlesplash/haiku
Rehabilitate Haiku support.
2021-01-05 16:09:43 +01:00
Filippo Tarpini a5a6ef8512
Fix a couple of typos
[committer note: fixed commit message style]
2021-01-05 15:24:21 +01:00
waddlesplash 2df11d3911 Rehabilitate Haiku support. 2021-01-02 16:54:24 -05:00
iwubcode 16dc2fa379 VideoCommon: Fix crash that occurs on loading a fifo log due to uninitialized Free Look control type 2020-12-26 17:26:21 -06:00
iwubcode c7b24d6213 VideoCommon: Update active config when we check for config changes, this ensures Free Look settings are copied at the start of the frame. Also update the camera's controller type at this time 2020-12-24 13:51:46 -06:00
iwubcode bcf63c463b VideoCommon: Add 'Active' state to FreelookCamera to future proof if we ever add multiple cameras 2020-12-24 13:49:25 -06:00
iwubcode a37fd8c5d9 VideoCommon: Update Free Look camera with settings change... 2020-12-24 13:49:25 -06:00
iwubcode f6ab9a9b6f Core / VideoCommon: Remove old Free Look config 2020-12-24 13:49:25 -06:00
iwubcode d5bc209eb6 VideoCommon: Change 'Zoom' to 'MoveForward' since it really isn't a zoom 2020-12-24 13:48:38 -06:00
iwubcode cb6ae6a4b1 VideoCommon: Add speed to Free Look camera 2020-12-24 13:48:38 -06:00
Léo Lam 0ad2f3da45
Core: Remove ImageWrite and get rid of -Wmissing-declarations warnings 2020-12-16 16:04:19 +01:00
Léo Lam eafe005672
Fix -Wclass-memaccess warnings
We want to clear/memset the padding bytes, not just each member,
so using assignment or {} initialization is not an option.

To silence the warnings, cast the object pointer to u8* (which is not
undefined behavior) to make it explicit to the compiler that we want
to fill the object representation.
2020-12-16 15:37:43 +01:00
David Carlier 2c355b81f2
Add NetBSD support 2020-12-15 02:34:25 +01:00
Léo Lam fd5c69deca
Merge pull request #9289 from AdmiralCurtiss/simple-png-api-write
Use Simplified libpng API for writing PNGs.
2020-12-11 10:24:16 +01:00
Léo Lam d8b9a040ed
Merge pull request #9275 from JosJuice/framedump-boot-time
FrameDump: Start timing at 0 ticks when starting from boot
2020-12-05 23:57:41 +01:00
Lioncash 139d4fc76e General: Convert PanicAlerts over to fmt equivalent
Converts lingering panic alert calls over to the fmt-capable ones.
2020-12-02 13:38:33 -05:00
JosJuice d69f243c32 FrameDump: Start timing at 0 ticks when starting from boot 2020-11-27 17:54:08 +01:00
Admiral H. Curtiss 324de7fa02 VideoCommon: Use Common::SavePNG() to write textures. 2020-11-26 23:55:05 +01:00
Lioncash 978e5469af Core: Remove commented out logs
Commented out logs shouldn't be kept around, since it makes performing
renames and migrations harder, as tooling generally doesn't inspect
comments.
2020-11-26 07:49:37 -05:00
JosJuice 28c696fa74 Fix vertex ubershader GLES compile errors
Regression from 51724c1.
2020-11-23 11:42:41 +01:00
JosJuice 118d056410 FrameDump: Re-add call to av_register_all
This was removed in 4902146329.
We still need this for the ffmpeg version we're using on Windows.
2020-11-22 00:11:23 +01:00
Stenzek 51724c1ccd LightingShaderGen: Always calculate lighting for both color channels
Cel-damage depends on lighting being calculated for the first channel
even though there is no color in the vertex format (defaults to the
material color). If lighting for the channel is not enabled, the vertex
will use the default color as before.

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

If the color channel count is zero, we set the color to black before the
end of the vertex shader. It's possible that this would be undefined
behavior on hardware if a vertex color index that was greater than the
channel count was used within TEV.
2020-11-20 15:54:04 -08:00
JosJuice e63b00e562 Fix translatable strings which contain non-positional arguments 2020-11-20 20:24:30 +01:00
Léo Lam bca82bb942
Merge pull request #9239 from altimumdelta/FFDUMP_Separate_Logging
FrameDump Logging: Separate log type and migrate to fmt
2020-11-20 02:21:57 +01:00
Lioncash 3d9b2aa005 VideoCommon: Migrate over to fmt
Migrates off the printf-based formatting where applicable.
2020-11-17 21:23:58 -05:00
altimumdelta f44b13ffcd FrameDump Logging: Separate log type and migrate to fmt 2020-11-10 17:17:43 +01:00
Lioncash a5b28f1f07 ShaderGenCommon: Rename WriteFmt() to Write()
Now that we've converted all of the shader generators over to using fmt,
we can drop the old Write() member function and perform a rename
operation on the WriteFmt() to turn it into the new Write() function.

All changes within this are the removal of a <cstdarg> header, since the
previous printf-based Write() required it, and renaming. No functional
changes are made at all.
2020-11-09 02:31:49 -05:00
LC add2b44eb7
Merge pull request #9197 from lioncash/uber-pixel
UberShaderPixel: Migrate over to fmt
2020-11-09 02:13:57 -05:00
JosJuice 28aa04312c Common/LinearDiskCache: Replace std::fstream with File::IOFile
File::IOFile is better suited to this type of task.
Split out from a future PR.
2020-11-05 00:31:17 +01:00
JMC47 6a3a71cfd7
Merge pull request #9141 from Techjar/but-for-how-long
Re-enable GPU Texture Decoding under MoltenVK
2020-10-29 01:22:13 -04:00
Lioncash dc72edf0e2 UberShaderPixel: Migrate over to fmt
Completes the migration over to using the fmt-formatting WriteFmt
function. The next PR will rename all usages of WriteFmt, while
simultaneously getting rid of the old printf code.
2020-10-27 13:25:11 -04:00
Léo Lam d2a2ec870d
Merge pull request #9171 from lioncash/pixel
PixelShaderGen: Migrate over to fmt
2020-10-26 20:35:47 +01:00
Léo Lam 7f66de062c
Merge pull request #9188 from jordan-woyak/stop-caring-about-old-avcodec-versions
VideoCommon/FrameDump: Remove code for older versions of avcodec.
2020-10-26 18:55:48 +01:00
iwubcode 8a4773bc91 VideoCommon: update vcproj file to set HAS_OPENGL 2020-10-23 17:08:53 -05:00
iwubcode a34745926e VideoCommon: remove HAS_OPENGL from VideoBackendBase 2020-10-23 17:00:32 -05:00
iwubcode 272717b3f4 VideoCommon: update vcproj file to set HAS_VULKAN 2020-10-23 17:00:05 -05:00
iwubcode d12380f26b VideoCommon: rename USE_VULKAN to HAS_VULKAN in VideoBackendBase 2020-10-23 16:59:22 -05:00
Lioncash 5de2244acf PixelShaderGen: Migrate over to fmt
Continues the migration of the shader generators over to fmt.

After this, all that remains in the Ubershader pixel generator.
2020-10-23 17:17:55 -04:00
Jordan Woyak 4902146329 VideoCommon/FrameDump: Remove code for older versions of avcodec. 2020-10-23 14:43:50 -05:00
mazes-80 f375ee72a2
CMake: Add option to enable/disable Vulkan video backend 2020-10-23 20:14:46 +02:00
JosJuice 908d6f8fa0
Merge pull request #9179 from leoetlino/available-video-backends
VideoCommon: Get rid of the global g_available_video_backends
2020-10-23 20:02:21 +02:00
Jordan Woyak 4807a5e157 VideoCommon: FrameDump fixes/cleanups. 2020-10-22 12:17:26 -05:00
Léo Lam 89b01cd6d3
Merge pull request #9169 from lioncash/uber-vert
UberShaderVertex: Migrate over to fmt
2020-10-22 01:21:31 +02:00
Léo Lam d08b80828d
VideoCommon: Simplify VideoBackendBase::GetDefaultBackendName
Now we can just call GetDefaultVideoBackend to get the default backend
and get its name by calling GetName.
2020-10-21 22:00:10 +02:00
Léo Lam aaaa3896c0
VideoCommon: Get rid of the global g_available_video_backends
Replace it with a function-local static that is initialized on first
use. This gets rid of a global variable and removes the need for
manual initialization in UICommon.

This commit also replaces the weird find_if that looks for a non-null
unique_ptr with a simple "is vector empty" check considering that
none of the pointers can be null by construction.
2020-10-21 22:00:10 +02:00
Lioncash 751d67a59a UberShaderVertex: Migrate over to fmt
Continues migration of the shader generators over to fmt.

With this, all that's left to move over are the pixel shaders (regular
and ubershader variants)
2020-10-20 09:24:10 -04:00
Léo Lam ce59b026c0
Merge pull request #9168 from lioncash/ifconst
DataReader: Make use of if constexpr where applicable
2020-10-20 14:56:24 +02:00
Lioncash 7bc2bbc508 DataReader: Make use of if constexpr where applicable
We can make use of if constexpr for cases where booleans will always
statically be known at compile-time.
2020-10-20 08:42:32 -04:00
Léo Lam dc5ae5ee66
Merge pull request #9165 from lioncash/ubercommon
UberShaderCommon: Migrate over to fmt
2020-10-20 14:42:19 +02:00
Léo Lam 49b7f10b39
Merge pull request #9163 from lioncash/fbgen
FramebufferShaderGen: Migrate over to fmt
2020-10-20 13:25:50 +02:00
Lioncash 83db7a707c UberShaderCommon: Migrate over to fmt
Continues migration of the shader generators over to fmt.
2020-10-20 06:22:48 -04:00
Léo Lam 7b1e0dba9b
Merge pull request #9164 from lioncash/geoshader
GeometryShaderGen: Migrate over to fmt
2020-10-20 11:59:45 +02:00
Léo Lam fc3b474cce
Merge pull request #8318 from iwubcode/dynamic_input_textures
InputCommon: Dynamic Input Textures
2020-10-20 02:10:29 +02:00
Lioncash 5475a8d6eb GeometryShaderGen: Migrate over to fmt
Continues migration of the shader generators over to fmt.
2020-10-19 19:22:02 -04:00
Lioncash df11615bde FramebufferShaderGen: Migrate over to fmt
Continures the migration of the shader generators over to fmt.
2020-10-19 18:49:01 -04:00
Admiral H. Curtiss b93adeaad7 VertexShaderGen: Fix unescaped { in D3D shader. 2020-10-19 20:05:07 +02:00
LC cec47b9c32
Merge pull request #8981 from lioncash/vtx-fmt
LightingShaderGen/VertexShaderGen: Migrate over to fmt
2020-10-19 07:52:55 -04:00
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