Commit Graph

3651 Commits

Author SHA1 Message Date
Techjar 80b05b6f0d Make arbitrary mipmap detection toggle invalidate the texture cache
We want this setting to invalidate the cache because it may affect the appearance of textures in the rendered scene, therefore one would expect changing it while the game is running to have the expected effect immediately.
2018-07-03 18:44:11 -04:00
Jonathan Hamilton b54803a074 Remove unused sRGB conversion functions
Now the arbitrary mipmap reference downsampling is just done in linear space,
these are no longer used.
2018-07-02 09:53:54 -07:00
Jonathan Hamilton ac05d1a593 Do all arbitrary mipmap detection in integer space
This no longer converts from sRGB to linear for the reference mip
downsample - even if the original mipmap creation tool used an sRGB
colorspace (which isn't really guaranteed, and may even change per
game), this is a "fast" heuristic that's only an estimate anyway.

The average diff is also now stored in a u64, avoiding floating point
calculations in the per-pixel hot loop.

This should speed up the detection significantly, hopefully fixing
jank when loading in new textures.
2018-07-02 09:52:15 -07:00
Techjar 25bfee2233 VideoCommon: Fix auto IR being very overzealous 2018-06-25 00:48:57 -04:00
Markus Wick 0459a1a9e6
Merge pull request #6875 from JonnyH/WIP/mipmap-heuristic-tweaks
Make arbitrary mipmap detection a config option
2018-06-21 10:19:47 +02:00
Markus Wick bf50348d9f
Merge pull request #6539 from degasus/async
VideoCommon: Flush the GPU pipeline on async requests.
2018-06-21 10:16:54 +02:00
Lioncash de9c5fd375 ConfigManager: Convert GPUDeterminismMode into an enum class
Makes the values strongly-typed and gets more identifiers out of the
global namespace.

We are forced to use anything that is not "None" to mean none, because
X11 is garbage in that it has:

\#define None 0L

Because clearly no one else will ever want to use that identifier for
anything in their own code (and is why you should prefix literally
any and all preprocessor macros you expose to library users in public
headers).
2018-06-15 14:45:30 -04:00
Lioncash 3f210836ad Compiler: Rename __forceinline define to DOLPHIN_FORCE_INLINE
This is much better as prefixed double underscores are reserved for the
implementation when it comes to identifiers. Another reason its better,
is that, on Windows, where __forceinline is a compiler built-in, with
the previous define, header inclusion software that detects unnecessary
includes will erroneously flag usages of Compiler.h as unnecessary
(despite being necessary on other platforms). So we define a macro
that's used by Windows and other platforms to ensure this doesn't
happen.
2018-06-09 12:20:25 -04:00
Lioncash 03414e8e84 Common: Add header for compiler-specifics
Instead of globbing things under an ambiguous Common.h header, move
compiler-specifics over to Compiler.h. This gives us a dedicated home
for anything related to compilers that we want to make functional across
all compilers that we support.

This moves us a little closer to eliminating Common.h entirely.
2018-06-09 12:10:05 -04:00
master0fdisaster 7a90ea2752 Add OSD message for Volume Hotkeys
This pr adds an OnScreenDisplay message when you use the Volume hotkeys.
Just to have visual feedback.
2018-06-06 17:11:43 +02:00
Markus Wick 3860219899 VideoCommon: Flush the GPU pipeline on async requests. 2018-06-06 09:22:01 +02:00
Anthony 36ff2a20d5
Merge pull request #6954 from degasus/coherent
OGL/Streambuffer: Use coherent mapping by default.
2018-06-05 12:06:17 -07:00
Lioncash 72feeb4d18 BPMemory: Silence a -Wmissing-braces warning
Fairly trivial to resolve, we just initialize the std::array with two
sets of braces (one set to create the array, the other to start and end the
aggregate data that we'll end up returning)
2018-05-28 14:52:59 -04:00
Markus Wick cddc2d52c2
Merge pull request #6965 from stenzek/d3d-feature-level-10
D3D: Don't emit uint outputs when logic op is unsupported
2018-05-28 09:52:07 +02:00
degasus 3307946e2a VertexLoaderArm: Fix 565 color format.
Copy & paste error for enforcing A=255.
It was copied from the 888X format, which stores the output data in another register.
2018-05-27 11:27:15 +02:00
Stenzek 57976c947b ShaderGen: Don't emit integer outputs when logic op is unsupported
This may have been causing issues for D3D10 hardware, where logic op was
not supported.
2018-05-26 00:09:29 +10:00
Stenzek 9a5c2119e5 ShaderCache: Remove unused UID bits before inserting into shader map 2018-05-26 00:09:10 +10:00
Stenzek 640bfb8135 VideoConfig: Add a field for indicating logic op support in the backend 2018-05-26 00:07:20 +10:00
degasus fdfd8b19d6 OGL/Streambuffer: Use coherent mapping by default.
Coherent mappings have a lower overhead and less GL codes.
So enables coherent mapping by default for all drivers.
Both Qualcomm and ARM performs very bad with explicit flushing, so this change helps them as well.

AFAIK there was one GPU generation which was slower on coherent mapping: nvidia tesla
So Geforce 200 and 300 series should be tested with this PR before merging.
As this was last tested many years ago, this issue might have been fixed as well.
Those GPUs are close to 10 years old and not supported any more by nvidia.
2018-05-24 00:00:02 +02:00
Stenzek f7a0cae7f4 HiresTextures: Do not load compressed textures with unaligned dimensions
D3D11 cannot handle block compressed textures where the first mip level
is not a multiple of the block size. The simple fix for texture pack
authors: leave these textures uncompressed. You can still use a .dds
container.
2018-05-22 16:15:18 +10:00
Stenzek f74dbc794c EFB2RAM: Apply copy filter as a float coefficient after sampling
Using 8-bit integer math here lead to precision loss for depth copies,
which broke various effects in games, e.g. lens flare in MK:DD.

It's unlikely the console implements this as a floating-point multiply
(fixed-point perhaps), but since we have the float round trip in our
EFB2RAM shaders anyway, it's not going to make things any worse. If we
do rewrite our shaders to use integer math completely, then it might be
worth switching this conversion back to integers.

However, the range of the values (format) should be known, or we should
expand all values out to 24-bits first.
2018-05-22 12:24:08 +10:00
Lioncash c4d27cc8ec PostProcessing: Make GetShader() return by constant reference
We don't need to create copies of the shader string when they can be
avoided.
2018-05-21 12:07:51 -04:00
Lioncash 9d1b6cdea4 PostProcessing: Make member functions const qualified where applicable
These functions don't modify internal class state
2018-05-21 11:59:08 -04:00
Lioncash 8ce6f9bae5 PostProcessing: Replace typedef with a using alias 2018-05-21 11:57:15 -04:00
Lioncash f9c20571ab PostProcessing: Default constructor and destructor of PostProcessingShaderConfiguration
Also ensure that all members of the class are initialized on
construction as well. Previously the bool indicating if options are
dirty wouldn't be initialized, which could be read uninitialized if an
instance was constructed and then IsDirty() is called.
2018-05-21 11:54:56 -04:00
Lioncash ba94ffd51d VideoBackendBase: Include parameter names in member function declarations
Given this is a base class, we should clearly state what the parameters
to the functions in its exposed interface actually mean or represent.
This avoids needing to hunt for the definition of the functions in cpp
files.

While we're at it, normalize said parameter names so they follow our
naming guidelines.
2018-05-20 16:27:16 -04:00
Emmanuel Gil Peyrot c51ae9c62a Remove SOIL altogether from the project. 2018-05-20 13:44:42 +02:00
Emmanuel Gil Peyrot 6d0143647e VideoCommon: Remove a workaround mutex used for SOIL 2018-05-20 13:44:41 +02:00
Emmanuel Gil Peyrot 17e65a7167 VideoCommon: Replace SOIL with libpng for hires textures 2018-05-20 13:44:38 +02:00
Lioncash 4dbd6f6bbc BPMemory: Use Common::BitCast where applicable
Gets rid of memcpy boilerplating for reinterpreting bits properly.
2018-05-18 14:25:44 -04:00
Jonathan Hamilton b30d56ccc0 Texture AverageDiff: Do more in int space and avoid excessive float conversion
Multiplying 2x 8bit values is guaranteed to fit in 16bits, 4 channels then in
18bits, which means an 'int' shouild be sufficient to avoid overflows
2018-05-17 09:39:39 -07:00
Markus Wick c485efdfe1
Merge pull request #6743 from stenzek/faster-disabled-copy-filter
TextureConversionShader: Don't sample from adjacent rows when not needed
2018-05-17 10:45:50 +02:00
Jonathan Hamilton 61a81795e5 Change the arbitrary mipmap detection to use the square of the error
Hopefully this better matches the user's view of a texture - as large changes in
colour should be weighted higher than lots of very small changes

Note: This likely invalidates the current heuristic threshold default
2018-05-16 17:51:50 -07:00
Jonathan Hamilton 8be5cdfcad Make the arbitrary mipmap detection threshold configureable
This is likely a "superuser" option at best, but I want to be able to play with
it without rebuilding if I want to tweak the heuristics
2018-05-16 17:49:19 -07:00
Jonathan Hamilton 29b7e33c14 Make arbitrary mipmap detection a config option
Under GFX::Enhancements::ArbitraryMipmapDetection - default enabled
2018-05-16 17:15:38 -07:00
Lioncash 011ee110bc Common/Hash: Namespace code under the Common namespace
Brings more common code under the Common namespace.
2018-05-16 15:39:23 -04:00
Markus Wick c267262a66
Merge pull request #6786 from stenzek/crop-negative-y
RenderBase: Ensure the draw size does not exceed the window size
2018-05-13 08:55:59 +02:00
Léo Lam 6763a3fce1 Config: Add support for enums
This makes it possible to use enums as the config type.
Default values are now clearer and there's no need for casts
when calling Config::Get/Set anymore.

In order to add support for enums, the common code was updated to
handle enums by using the underlying type when loading/saving settings.

A copy constructor is also provided for conversions from
`ConfigInfo<Enum>` to `ConfigInfo<underlying_type<Enum>>`
so that enum settings can still easily work with code that doesn't care
about the actual enum values (like Graphics{Choice,Radio} in DolphinQt2
which only treat the setting as an integer).
2018-05-12 18:10:26 +02:00
spycrab 16e2ac9257 VideoCommon/RenderBase: Refactor OSD messages 2018-05-11 18:24:08 +02:00
Lioncash ba01f6dba3 CommonFuncs: Convert ROUND_UP_POW2 macro to a function
Also move it to MathUtils where it belongs with the rest of the
power-of-two functions. This gets rid of pollution of the current scope
of any translation unit with b<value> macros that aren't intended to be
used directly.
2018-05-10 19:42:20 -04:00
Lioncash e020f5b04b RenderBase: Remove unused PixelPerfQuery enum
Neither the values or the identifier name of the enum is used anywhere
in the codebase.
2018-05-09 12:11:29 -04:00
Stenzek fd5aaa096c RenderBase: Ensure the draw size does not exceed the window size
This was happening when crop was enabled, causing blank outputs for some
Vulkan drivers (namely radv), as the draw rectangle is used as the
viewport.
2018-05-08 23:19:38 +10:00
Stenzek a5e410b7c9
Merge pull request #6744 from stenzek/ui-disable-vram-copies
UI: Add Disable EFB Copies to VRAM to Advanced Options
2018-05-04 12:01:29 +10:00
Stenzek 0152f63655 TextureCacheBase: Make "disable vram copies" part of the active config 2018-05-03 14:24:44 +10:00
Stenzek 4faac3a627 TextureConversionShader: Don't sample from adjacent rows when not needed 2018-05-03 14:09:32 +10:00
Stenzek a93830056f TextureConversionShader: Fix more implicit conversion errors 2018-05-03 11:32:06 +10:00
Stenzek 2c6b20bb03 TextureConversionShader: Fix compile errors in OpenGL ES 2018-05-02 21:54:13 +10:00
Stenzek 9e798eec94 Implement EFB copy filter and gamma in hardware backends
Also makes y_scale a dynamic parameter for EFB copies, as it doesn't
make sense to keep it as part of the uid, otherwise we're generating
redundant shaders.
2018-04-29 19:05:20 +10:00
Scott Mansell fc96479f12 VideoSoftware: Implement xfb copy filter (Deflickering/Brightness) 2018-04-29 17:56:51 +10:00
JosJuice e604641b12 Remove leftovers of projection hack support 2018-04-13 12:52:42 +02:00