Commit graph

4234 commits

Author SHA1 Message Date
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