Commit graph

221 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
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
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
Emmanuel Gil Peyrot
17e65a7167 VideoCommon: Replace SOIL with libpng for hires textures 2018-05-20 13:44:38 +02: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
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
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
spycrab
40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
Lioncash
50a476c371 Assert: Uppercase assertion macros
Macros should be all upper-cased. This is also kind of a wart that's
been sticking out for quite a while now (we avoid prefixing
underscores).
2018-03-14 22:03:12 -04:00
Henrik Rydgård
6cbb716f60 SSE-optimize UninitializeXFBMemory
Lowest hanging fruit I could find with a profiler.

Not sure this stuff actually needs to be done, but assuming it is, why
not do it quickly? 10x faster, goes from 1% CPU to 0.09%.
2018-03-13 11:55:28 +01:00
Stenzek
93fb0e1e1c TextureCache: Add an option to disable EFB copies to VRAM
The option is named DisableCopyToVRAM under the Hacks section in
GFX.ini. It is intentionally not exposed to the GUI, as users should not
need to use it under normal circumstances. The main use is debugging
issues in the EFB-to-RAM shaders.
2018-02-11 15:48:46 +10:00
Stenzek
84b990faa0 VideoConfig: Remove bForceCopyToRam field
It's the inverse of supports-copy-to-vram.
2018-02-11 15:29:37 +10:00
Stenzek
38e0b6e2ab AbstractTexture: Move Bind() method to Renderer
This makes state tracking simpler, and enables easier porting to command
lists later on.
2018-01-22 13:22:09 +10:00
JosJuice
c25fffc9a0 Treat custom textures with "_arb" suffix as having arbitrary mipmaps
This is adapted from Bighead's code that was posted at
https://forums.dolphin-emu.org/Thread-dolphin-custom-texture-mipmaps?pid=460867#pid460867

In master, custom textures are never treated as having arbitrary mipmaps,
so we need either a change like this or a change that makes us apply the
arbitrary mipmap heuristic even when a custom texture is used.
2018-01-10 17:51:45 +01:00
Markus Wick
56d153f548 VideoCommon: Apply the yscale as upscaling of the XFB. 2018-01-06 10:36:33 +01:00
iwubcode
e1332b1d7e Texture Cache Base: Move PAL vertical scaling to be baked into the texture size. This saves on a number of multiplications and fixes an issue where we were multiplying the y-scaling factor by the srcRectangle's height + 1 which was causing a crash in some GC titles 2017-12-21 21:19:26 -06:00
JosJuice
a3355a3e4a Only use the "Scaled EFB Copy" setting for EFB, not XFB
The hybrid XFB PR made it apply to both EFB copies and XFB copies.
2017-12-19 12:59:36 +01:00
Stenzek
2579f8eaa5 TextureCache: Don't dump custom textures
They don't have a basename, therefore were being saved to empty files, and potentially can be compressed.
2017-12-10 15:31:46 +10:00
degasus
02dd062518 VideoCommon: Drop now unused efb2tex matrix generation. 2017-12-06 09:30:03 +01:00
Markus Wick
491c10ec96 VideoBackends: Use VideoCommon shader generators for efb2tex copies.
This will generate one shader per copy format. For now, it is the same
shader with the colmat hard coded. So it should already improve the GPU
performance a bit, but a rewrite of the shader generator is suggested.

Half of the patch is done by linkmauve1:
VideoCommon: Reorganise the shader writes.
2017-12-02 15:17:39 +01:00
Stenzek
193763ca3a TextureCacheBase: Don't crop last row/column of XFB copies
Unsure why this was happening in the first place.
2017-11-22 18:49:33 +10:00
Stenzek
56afebeb44 AbstractTexture: Seperate CopyRectangleFromTexture to two methods
ScaleRectangleFromTexture, which does a draw, and
CopyRectangleFromTexture, which where possible, does a bit-for-bit copy.
2017-11-22 18:47:04 +10:00
Stenzek
49a9c33bd7 VideoCommon: Move abstract texture creation function to Renderer 2017-11-22 18:47:04 +10:00
Leo Lam
80bcc0d58d
Merge pull request #6186 from lioncash/enum-class
VideoConfig: Make AspectMode and StereoMode enum classes
2017-11-19 15:08:16 +01:00
Lioncash
518f6a3624 VideoCommon: Resolve -Wmissing-brace warnings
Resolves around 5 -Wmissing-brace warnings on macOS.
2017-11-19 01:49:39 -05:00
Lioncash
5337e58284 VideoConfig: Make StereoMode an enum class
Makes for more strongly-typed identifiers (and doesn't pollute
surrounding namespaces)
2017-11-18 23:19:53 -05:00
iwubcode
dd54617a08 TextureCacheBase: Set uninitialized XFB memory to fuchsia color 2017-11-17 22:11:34 -06:00
iwubcode
8d1cbeb25e Hybrid XFB: Fix lint errors 2017-11-17 22:11:34 -06:00
iwubcode
61541ab243 Enhance xfb dumping to distinguish between the xfbs created from memory and the xfbs created from overlapping copies 2017-11-17 22:11:34 -06:00
iwubcode
8678e8ddd3 Texture Cache Base: Optimization to allow stitched or memory xfb textures to be looked up from cache directly if they were defined previously and their hash hasn't changed 2017-11-17 22:11:33 -06:00
iwubcode
332af8aa49 TextureCacheBase: Fix issue in Rogue Squadron 2 where overlapping textures caused a hash change which would cause us to do a lookup from memory that gave us an incorrect result in XFB2Ram 2017-11-17 22:11:33 -06:00
iwubcode
ada37ec642 TextureCacheBase: Remove vertical scaling from EFB path and have copy checks only check EFBs 2017-11-17 22:11:33 -06:00
iwubcode
7248dd47d5 Hybrid XFB: Fix lint errors 2017-11-17 22:11:32 -06:00
iwubcode
2c87a53f11 TextureCacheBase: make sure stitching rectangle bounds don't exceed the
texture size they are meant to represent
2017-11-17 22:11:32 -06:00
iwubcode
74610646ce TextureCacheBase: Add XFB specific functions 2017-11-17 22:11:32 -06:00
iwubcode
53684701fa HybridXFB: Fix lint errors 2017-11-17 22:11:31 -06:00
iwubcode
1090549552 Software Backend: Force EFB/XFB to copy to ram 2017-11-17 22:11:31 -06:00
iwubcode
e6d85b0915 Video Common: Avoid 'presenting' duplicate frames by detecting when swap
hasn't changed since the last frame
2017-11-17 22:11:31 -06:00
iwubcode
2295d60fdc VideoCommon: Output gamma now comes from the xfb copy 2017-11-17 22:11:30 -06:00
iwubcode
b285188de1 Video Backends: Implement vertical scaling for xfb copies. This fixes the
display of PAL games that run in 50hz mode.
2017-11-17 22:11:29 -06:00
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