Commit graph

3485 commits

Author SHA1 Message Date
iwubcode
2cd9565b18 Add an additional flag fo 'XFB Copy' 2017-11-17 22:11:29 -06:00
iwubcode
65cd085f9b Add new GUI option to skip XFBToRam and remove old XFB options 2017-11-17 22:11:28 -06:00
iwubcode
198d3b69b4 Add ability to dump xfb copies to texture for debugging purposes 2017-11-17 22:11:28 -06:00
iwubcode
a9f0d1783b Support frame and video dumping from VideoCommon 2017-11-17 22:11:23 -06:00
iwubcode
79387dddb2 Add support for hybrid XFB 2017-11-17 19:47:56 -06:00
Lioncash
8e654528fc VideoConfig: Add const specifier to IsVSync() member function
This member function doesn't alter VideoConfig's state.
2017-11-10 22:23:15 -05:00
Anthony
4dc425b9c9
Merge pull request #6158 from Tomcc/master
Improved arbitrary mipmap detection (Mario Sunshine water fix)
2017-11-09 18:06:58 -08:00
Tommaso Checchi
aa23684d66 Improved detection: it doesn't desaturate the input anymore (woops) also it makes its own whole chain! This way it "notices" much better gradual divergences. Fixes Mario Sunshine, moss on the window in Zelda TP 2017-11-06 21:49:48 -08:00
JosJuice
a310cbec8e Fix incorrect handling of auto IR
Some lines of code in Dolphin just plainly grabbed the value of
g_ActiveConfig.iEFBScale, which resulted in Auto being treated as
0x rather than the actual automatically selected scale.
2017-11-03 16:04:46 +01:00
Tommaso Checchi
5fb6ceac45 Fixed fog, lava, water in Mario Galaxy (and possibly other games) in higher IRs by detecting & fixing the mipmaps that aren't just used for downscaling, but are handmade to create a gradient. 2017-10-27 00:45:20 -07:00
Markus Wick
802fda26ab Merge pull request #6093 from endrift/fix-efb-overflow
VideoCommon: Fix overflow trying to access outside of EFB bounds
2017-10-26 21:01:27 +02:00
Leo Lam
0eafb2f2a2 Merge pull request #6110 from lioncash/texture-config-hash
TextureConfig: Specialize std::hash for TextureConfig
2017-10-11 11:07:09 +02:00
Stenzek
edb5f855c2 VideoConfig: Prevent race condition on g_Config when refreshing
There was a race condition between the video thread and the host thread,
if corrections need to be made by VerifyValidity(). Briefly, the config
will contain invalid values. Instead, pause emulation first, which will
flush the video thread, update the config and correct it, then resume
emulation, after which the video thread will detect the config has
changed and act accordingly.
2017-10-10 23:56:33 +10:00
Lioncash
c8af9e5f7b TextureConfig: Specialize std::hash for TextureConfig
This allows the hashing for TextureConfig instances to automatically be resolved instead of needing to directly specify it all the time.
2017-10-08 23:55:14 -04:00
Vicki Pfau
e0a326a493 VideoCommon: Fix overflow trying to access outside of EFB bounds 2017-10-01 12:09:16 -07:00
Stenzek
24ddea04ce VideoBackends: Move SamplerState to common 2017-09-11 20:01:54 +10:00
Stenzek
340aabbb06 VideoCommon: Add helpers for generating common render states 2017-09-11 20:01:52 +10:00
Stenzek
836b9b9acb Renderer: Move cull mode to a rasterization state object
Also moves logic for primitive handling to VideoCommon.
2017-09-11 20:01:45 +10:00
Stenzek
2869c570f1 Renderer: Move depth state to VideoCommon and seperate from bpmem 2017-09-11 19:40:26 +10:00
Stenzek
134daf3b00 Vulkan: Extend the NVIDIA MSAA bug to render-pass based clears
Calling vkCmdClearAttachments with a partial rect, or specifying a
render area in a render pass with the load op set to clear can cause the
GPU to lock up, or raise a bounds violation. This only occurs on MSAA
framebuffers, and it seems when there are multiple clears in a single
command buffer. Worked around by back to the slow path (drawing quads)
when MSAA is enabled.
2017-09-07 17:05:43 +10:00
Stenzek
b573319f8f D3D: Fix shader compile error with logicop and alpha test enabled 2017-09-07 11:48:01 +10:00
Stenzek
84f8ebd95f VideoBackends: Clear uid bits that are unused for the current backend
Currently, this is only the logic op bit, but this will be extended to
the framebuffer fetch/blend modes. In the future, when/if we move to
VideoCommon pipelines, this state will be part of the pipeline UID
anyway, and we can mask it out in the backend by using a two-level map,
so the shaders/programs are shared.
2017-09-05 23:49:42 +10:00
Stenzek
6d32cce2f5 ShaderGen: Output uint when logic op is enabled for D3D ubershaders 2017-09-05 23:49:42 +10:00
Anthony
ee6930a231 Merge pull request #6013 from stenzek/d3d-logic-op
D3D: Implement logic op support
2017-09-03 19:26:50 -07:00
Anthony
26e777d80b Merge pull request #5337 from stenzek/d3d-common-blending-state
D3D: Use blending state from VideoCommon
2017-09-03 19:25:46 -07:00
Mat M
edf4bfaf5f Merge pull request #5989 from lioncash/constantmgr
ConstantManager: Use std::array where applicable
2017-09-03 13:18:10 -04:00
Jules Blok
75574ec6cc Merge pull request #5946 from stenzek/ubershader-stereo-texture-samples
UberShaderPixel: Fix sampling of EFB copies in stereo modes
2017-09-03 12:26:52 +02:00
Stenzek
0622979d3b ShaderGen: Support writing integer colors when logic op is enabled
This is required for D3D to support logic op.
2017-09-03 16:33:25 +10:00
Stenzek
3dd675e613 Renderer: Change SetBlendState to accept a BlendingState
This decouples the state generation (from the emulated GPU) from the
management of internal backend state.
2017-09-03 14:14:54 +10:00
Stenzek
22b8cbae35 RenderBase: Drop SetColorMask and SetLogicOpMode
These are now incorporated into the blend state for all backends.
2017-09-03 14:14:54 +10:00
Stenzek
7a4348b641 Merge pull request #5649 from JonnyH/WIP/disable-vk-clear-renderpass
Add DriverDetails::BUG to Disable "LoadOp" clear renderpass in vulkan
2017-09-03 13:49:51 +10:00
Pierre Bourdon
425a8cb378 Merge pull request #5718 from mimimi085181/partial-updates-update
Update to partial texture updates
2017-09-03 03:16:55 +02:00
Mat M
657195fad5 Merge pull request #6006 from JonnyH/WIP/parse-imgtec-gl_version-string
Parse IMGTEC's GL_VERSION string format
2017-09-02 17:10:59 -04:00
Markus Wick
30e01834e2 Merge pull request #6002 from lioncash/include
CommandProcessor: Remove unnecessary include
2017-09-02 23:05:58 +02:00
Jonathan Hamilton
658a4a6e29 Mark an ImgTec driver bug as fixed in 1.8@4693462
Now we correctly parse ImgTec's GL_VERSION string we can actually use
the BugInfo's version stuff correctly here
2017-09-02 14:05:16 -07:00
Lioncash
6f97e3faa6 AsyncShaderCompiler: use std::make_unique in CreateWorkItem()
Same behavior, simpler code.
2017-09-02 14:08:00 -04:00
Lioncash
62615c601e AsyncShaderCompiler: Forward arguments to the specified type's constructor in CreateWorkItem()
As this just hands off the arguments to another type's constructor,
perfect forwarding should be used here to preserve any potential move semantics.
2017-09-02 14:06:48 -04:00
Lioncash
f6e3a39c0e CommandProcessor: Remove unnecessary include
Gets rid of some indirect inclusion.
2017-09-02 13:34:21 -04:00
Jonathan Hamilton
62e8d25cd1 Add Bug to Disable "LoadOp" clear renderpass in vulkan
This optimisation doesn't work on PowerVR's Vulkan implementation. We
(incorrectly) disallow Framebuffer objects to be used with a different
load or store op than that which they were created with, despite the
spec allowing such.

This fixes the windwaker intro "smearing"
2017-08-28 18:01:35 -07:00
Jonathan Hamilton
11057649ee Add VideoLogic (ImgTec) PCI ID 2017-08-28 18:01:16 -07:00
Lioncash
9c1f9c1c00 ConstantManager: Use std::array where applicable
Modernizes the arrays and makes future simplifications possible (e.g. usages within the software renderer).

It also makes cases where we use array->pointer decay explicit.
2017-08-27 15:41:36 -04:00
Chris Burgener
cc03e49024 Remove FFMPEG check for Renderer::IsFrameDumping() 2017-08-24 11:15:50 -04:00
JosJuice
09f3f9b41a Remove NonCopyable
The class NonCopyable is, like the name says, supposed to disallow
copying. But should it allow moving?

For a long time, NonCopyable used to not allow moving. (It declared
a deleted copy constructor and assigment operator without declaring
a move constructor and assignment operator, making the compiler
implicitly delete the move constructor and assignment operator.)
That's fine if the classes that inherit from NonCopyable don't need
to be movable or if writing the move constructor and assignment
operator by hand is fine, but that's not the case for all classes,
as I discovered when I was working on the DirectoryBlob PR.

Because of that, I decided to make NonCopyable movable in c7602cc,
allowing me to use NonCopyable in DirectoryBlob.h. That was however
an unfortunate decision, because some of the classes that inherit
from NonCopyable have incorrect behavior when moved by default-
generated move constructors and assignment operators, and do not
explicitly delete the move constructors and assignment operators,
relying on NonCopyable being non-movable.

So what can we do about this? There are four solutions that I can
think of:

1. Make NonCopyable non-movable and tell DirectoryBlob to suck it.

2. Keep allowing moving NonCopyable, and expect that classes that
   don't support moving will delete the move constructor and
   assignment operator manually. Not only is this inconsistent
   (having classes disallow copying one way and disallow moving
   another way), but deleting the move constructor and assignment
   operator manually is too easy to forget compared to how tricky
   the resulting problems are.

3. Have one "MovableNonCopyable" and one "NonMovableNonCopyable".
   It works, but it feels rather silly...

4. Don't have a NonCopyable class at all. Considering that deleting
   the copy constructor and assignment operator only takes two lines
   of code, I don't see much of a reason to keep NonCopyable. I
   suppose that there was more of a point in having NonCopyable back
   in the pre-C++11 days, when it wasn't possible to use "= delete".

I decided to go with the fourth one (like the commit title says).
The implementation of the commit is fairly straight-forward, though
I would like to point out that I skipped adding "= delete" lines
for classes whose only reason for being uncopyable is that they
contain uncopyable classes like File::IOFile and std::unique_ptr,
because the compiler makes such classes uncopyable automatically.
2017-08-22 16:40:34 +02:00
N.E.C
ebda7db437 VideoCommon: Fix bug #10464 (RA4 format not handled in TextureDecoder) 2017-08-21 10:22:15 -07:00
Jules Blok
390f3f13ba RenderState: Fix incorrect blending factors when removing the color usage. 2017-08-21 16:33:10 +02:00
Stenzek
a7f217c3f4 UberShaderPixel: Fix sampling of EFB copies in stereo modes 2017-08-20 18:08:24 +10:00
Anthony
6a272f22de Merge pull request #5478 from stenzek/vulkan-nvidia
Vulkan: Don't use vkCmdClearAttachments on NVIDIA with MSAA
2017-08-14 13:12:41 -07:00
Stenzek
f8a64ab1fc UberShaderPixel: Use an if trees instead of switch statements on GL
The switch statements in these functions appear to get transformed into
an if..else chain on NVIDIA's OpenGL/Vulkan drivers, resulting in lower
performance than the D3D counterparts. Transforming the switch into a
binary tree of ifs can increase performance by up to 20%.
2017-08-12 00:16:19 +10:00
Leo Lam
c91211b6ce Merge pull request #5867 from leoetlino/widescreen
GameINI: Replace Wii.Widescreen with AspectRatio
2017-08-11 18:23:54 +08:00
Léo Lam
b2c41cec0a Config: Include SYSCONF in base layer
Settings that come from the SYSCONF are now included in Dolphin's
config system as part of the base layer. They are handled in a
special way compared to other settings to make sure they are only
loaded from and saved to the SYSCONF (to avoid different, possibly
contradicting sources of truth).
2017-08-11 15:36:31 +08:00
Leo Lam
e41a9905c0 Merge pull request #5744 from JosJuice/remove-non-integer-irs
Remove non-integer IRs
2017-08-10 17:10:26 +08:00
N.E.C
b52aff7966 VideoCommon: Fix typo in comments introduced by #5849 2017-08-09 00:02:27 -07:00
JosJuice
f090a94319 Remove non-integer IRs 2017-08-08 12:09:50 +02:00
mimimi085181
cdbd9863b4 Keep textures that are overwritten by efb copies, if the stride matches
This is supposed to get efb2tex to the same texture as efb2ram, by applying the related efb copies as updates after each other, in the order of their creation.
2017-08-06 03:13:57 +02:00
mimimi085181
4e8ff42503 Do not load overwritten textures by hash
In this case, comparing the hash is not enough to check, if two textures are identical.
2017-08-06 03:13:57 +02:00
mimimi085181
a21ac22e07 fix stored memory stride for normal textures 2017-08-06 03:13:57 +02:00
Léo Lam
e58ba76f07 Don't force the aspect ratio in GameINIs
Instead, add a SuggestedAspectRatio option which tells Dolphin which
aspect ratio to use when the aspect ratio option is set to Auto.
2017-08-05 14:27:16 +08:00
N.E.C
c3a57bbad5 Video: Clearly separate Texture and EFB Copy formats
Improve bookkeeping around formats. Hopefully make code less confusing.

- Rename TlutFormat -> TLUTFormat to follow conventions.
- Use enum classes to prevent using a Texture format where an EFB Copy format
  is expected or vice-versa.
- Use common EFBCopyFormat names regardless of depth and YUV configurations.
2017-08-03 18:35:29 -07:00
Stenzek
7f88711186 Vulkan: Add a driver bug for NV when MSAA is enabled
This causes the card to lock up when vkCmdClearAttachments is called,
when multisampling is enabled. Seems to be restricted to Maxwell and
newer?
2017-08-03 17:40:15 +10:00
Stenzek
d0bcdc7f89 Merge pull request #5858 from stenzek/ubershader-6-bit-color
Ubershaders: Fix 6-bit color truncation not being applied
2017-08-02 20:10:34 +10:00
Stenzek
fe65b26d53 Merge pull request #5834 from stenzek/bc7
Support loading BC7 (BPTC) textures from DDS files
2017-08-01 12:39:19 +10:00
Stenzek
63305e9173 HiresTextures: Support loading BC7 (BPTC) from DDS files 2017-08-01 11:59:38 +10:00
Stenzek
852e30bb8c Ubershaders: Fix 6-bit color truncation not being applied 2017-08-01 00:01:09 +10:00
Stenzek
d62dcd397d VideoConfig: Drop force vertex/pixel ubershader settings
This was mainly included for debugging, but could end up being confusing
for users, as well as polluting the GL program cache with a mix of uber
and specialized shaders if the option was changed.
2017-07-31 23:21:38 +10:00
Stenzek
b154edb4fb VideoCommon: Move WM_USER_CREATE message to after backend initialization
Fixes the mouse cursor being left visible after ubershader
precompilation when the hide option is checked.
2017-07-30 17:43:59 +10:00
Stenzek
d54ca2a16a PixelShaderGen: Don't include host early z support in UID
Disable it at shader generation time instead. This way the UIDs are
sharable.
2017-07-30 17:43:59 +10:00
Stenzek
e968c191ff Ubershaders: Support per-pixel lighting 2017-07-30 17:43:59 +10:00
Stenzek
c8f31656cb VideoBackends: Support a different number of threads for precompiling
At runtime, we only really want a single shader compiler thread.
However, for initial boots, we can use a higher number to speed things
up.
2017-07-30 17:43:59 +10:00
Stenzek
e17efb1d8d ShaderGen: Use consistent variable names for texture coordinates 2017-07-30 17:43:59 +10:00
Stenzek
25338c53e0 NativeVertexFormat: Drop unused virtual method SetupVertexPointers 2017-07-30 17:43:59 +10:00
Stenzek
81b4ed2a81 Vulkan: Uber shader support 2017-07-30 17:43:59 +10:00
Stenzek
cd502990fa OGL: Uber shader support 2017-07-30 17:43:59 +10:00
Stenzek
901bf9c257 VideoConfig: Add config options for ubershaders 2017-07-30 17:43:59 +10:00
Stenzek
745d541527 ShaderGen: Implement vertex ubershaders 2017-07-30 17:43:59 +10:00
Stenzek
7d78cf0f6f ShaderGen: Implement pixel ubershaders 2017-07-30 17:43:59 +10:00
Stenzek
07591e7d5c PixelShaderGen: Move header generation to seperate function 2017-07-30 17:43:59 +10:00
Stenzek
c783cd2aaf GeometryShaderGen: Add UID enumeration functions 2017-07-30 17:43:59 +10:00
Stenzek
38c48ff72e VertexLoaderManager: Add methods to generate "uber" vertex formats
These vertex formats enable all attributes. Inactive attributes are set
to offset=0, and the smallest type possible. This "optimization" stops
the NV compiler from generating variants of vertex shaders.
2017-07-30 17:43:59 +10:00
Stenzek
f48ef65bec XFMemory: Convert several registers to bitfields 2017-07-30 17:43:59 +10:00
Scott Mansell
479abde9f4 BPMemory: Convert a number of unions to BitFields 2017-07-30 17:43:59 +10:00
Stenzek
0a9574eaa1 VideoCommon: Add AsyncShaderCompiler class implementation 2017-07-30 17:43:59 +10:00
Stenzek
621287e7eb VideoCommon: Improve precision of FPS counter 2017-07-30 12:38:48 +10:00
Stenzek
3ea9d86faa ShaderGen: Pass host config to shader generation functions
Also moves the host config checks to common.
2017-07-20 17:54:33 +10:00
Stenzek
d01b0bf60f VideoCommon: Move shader cache filename generation to common 2017-07-20 17:46:59 +10:00
Stenzek
d1381f5021 VideoConfig: Add host config union
Contains all host state that can affect shadergen.
2017-07-20 17:46:59 +10:00
Stenzek
82c27182a8 ShaderGen: Remove host state from shader uids 2017-07-20 17:46:59 +10:00
Anthony
ab5a5ee3ea Merge pull request #5726 from mimimi085181/minimal-tmem-cache-emulation
Implement minimal emulation of TMEM caching
2017-07-11 22:49:19 -07:00
Leo Lam
b6c3479bb4 Merge pull request #5720 from JosJuice/file-metadata
FileUtil: Redesign Exists/IsDirectory/GetSize
2017-07-11 00:28:34 +02:00
mimimi085181
53663c00b9 Implement minimal emulation of TMEM caching
This is a remake of https://github.com/dolphin-emu/dolphin/pull/3749

Full credit goes to phire.

Old message:
"If none of the texture registers have changed and TMEM hasn't been invalidated or changed in other ways, we can blindly reuse the old texture cache entries without rehashing.

Not only does this fix the bloom effect in Spyro: A Hero's Tail (The game abused texture cache) but it will also provide speedups for other games which use the same texture over multiple draw calls, especially when safe texture cache is in use."

Changed the pr per phire's instructions to only return the current texture(s) if none of the texture registers were changed. If any texture register was changed, fall back to the default hashing and rebuilding textures from memory.
2017-07-10 01:49:27 +02:00
Jules Blok
8476d0271d PixelShaderGen: Add missing inputs.
This fixes a linkage warning in D3D because of mismatched inputs.
2017-07-05 22:43:39 +02:00
Jules Blok
179602e921 D3D: Add quad-buffer stereoscopy support. 2017-07-05 22:43:39 +02:00
JosJuice
5ca3aee00a FileUtil: Add a class for Exists/IsDirectory/GetSize
Some code was calling more than one of these functions in a row
(in particular, FileUtil.cpp itself did it a lot...), which is
a waste since it's possible to call stat a single time and then
read all three values from the stat struct. This commit adds a
File::FileInfo class that calls stat once on construction and
then lets Exists/IsDirectory/GetSize be executed very quickly.

The performance improvement mostly matters for functions that
can be handling a lot of files, such as File::ScanDirectoryTree.

I've also done some cleanup in code that uses these functions.
For instance, some code had checks like !Exists() || !IsDirectory(),
which is functionally equivalent to !IsDirectory(), and some
code was using File::GetSize even though there was an IOFile
object that the code could call GetSize on.
2017-06-29 19:07:29 +02:00
Shawn Hoffman
ed8f293b4f Change "blocking" BlockingLoop::Stop to give up and die after a timeout.
This fixes the global-static fifo object causing infinite hangs in some
cases. Notably, failure to initialize a graphics backend would result in
BlockingLoop::Prepare being called but never executing Run(), leaving the
object in a bad state.
2017-06-25 20:47:30 -07:00
Shawn Hoffman
c5fa470ad8 replace DoFileSearch with optimized version 2017-06-23 17:25:53 -07:00
Lioncash
59a947d41d AbstractTexture: Return config by const reference
Returning by const value isn't really necessary (and usually an indicator const reference was intended).
2017-06-18 23:38:42 -04:00
Lioncash
07cddf6f7f AbstractTexture: Add missing includes (and remove unnecessary ones) 2017-06-18 23:29:22 -04:00
Lioncash
0c57543205 VideoCommon: Fix VS filter for AbstractTexture.cpp
This would cause failures when building with VS.
2017-06-18 22:58:02 -04:00
shuffle2
e63c337830 Merge pull request #5305 from iwubcode/abstract_texture
Abstract Texture
2017-06-18 12:57:05 -07:00
Stenzek
68fef47aef Merge pull request #5314 from stenzek/revert-efb-source-truncation
TextureConversionShader: Use integer math for truncating EFB format
2017-06-17 15:21:48 +10:00
Stenzek
adebe2239e TextureConversionShader: Use integer math for truncating EFB format 2017-06-17 12:17:09 +10:00