Commit graph

252 commits

Author SHA1 Message Date
Techjar
ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
Léo Lam
ab9ece9bca Replace MathUtil::Clamp with std::clamp 2019-05-04 23:12:17 +02:00
Léo Lam
99a4ca8de7
Merge pull request #7839 from ShFil119/impr/redundant
Remove redundant initialization
2019-05-04 22:50:51 +02:00
Filip Gawin
c110ffcdaa Remove redundant initialization 2019-04-30 01:22:24 +02:00
Connor McLaughlin
1b1662773e
Merge pull request #8048 from stenzek/vulkan-negative-scissor-rect
Vulkan: Don't set a negative offset in scissor rect
2019-04-28 23:37:51 +10:00
Stenzek
53af27b133 FramebufferManager: Fix invalid transitions for 1xIR in EFB cache 2019-04-28 16:13:49 +10:00
Stenzek
d5b3595314 TextureCache: Fix incorrect format string in GetXFBTexture() 2019-04-28 14:32:37 +10:00
Stenzek
f8c1ba409c Replace EFBRectangle/TargetRectangle with MathUtil::Rectangle 2019-04-21 14:28:14 +10:00
Stenzek
b09a0e1a60 TextureCache: Check for out-of-range partial copy rect after scaling 2019-04-21 12:54:32 +10:00
Stenzek
3791262d96 TextureCache: Use linear filtering on y-scaled and >1xIR VRAM copies 2019-04-21 12:41:15 +10:00
Stenzek
708bd3d9f7 TextureCache: Simplify XFB reconstruction
This also better handles in-memory interlaced XFB data placed by the CPU
by considering the stride from the VI.
2019-04-21 12:41:15 +10:00
Stenzek
3c455de799 FramebufferManager: Fix broken EFB peeks in GL with MSAA on 2019-03-30 03:14:29 +10:00
Stenzek
087b11e780 TextureCacheBase: Fix possible crash on shutdown with deferred EFB copies 2019-03-29 20:54:44 +10:00
Stenzek
bf0b52efc6 TextureCacheBase: Fix infinite loop in DoPartialTextureUpdates 2019-03-20 20:05:51 +10:00
Tilka
6be35422e9
Merge pull request #7832 from stenzek/xfb-decoding-regression
TextureCache: Fix GPU decoding of XFB copies
2019-02-28 11:03:25 +00:00
Stenzek
db6763019d TextureCache: Fix GPU decoding of XFB copies not falling back to CPU 2019-02-28 20:19:37 +10:00
Stenzek
7f0111b022 TextureCache: Fix EFB2RAM copies at >1xIR sampling out-of-range 2019-02-28 20:11:46 +10:00
Stenzek
f039149198 Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00
Stenzek
933f3ba008 TextureCache: Don't copy out-of-range rectangles when stitching textures
This can cause driver crashes or GPU hangs if we do.
2019-02-17 16:35:43 +10:00
Stenzek
50bdcb8d9c TextureCache: Bind textures/samplers after loading all textures
Since loading textures can result in rendering, e.g. partial copies, we
don't want to disturb partially-bound GX state.
2019-02-17 16:35:43 +10:00
Stenzek
1070192165 TextureCache: Fix a possible crash when partial updating palette textures 2019-01-19 23:38:02 +10:00
Stenzek
84bcbef944 TextureCache: Don't partial copy to non-existant texture layers 2019-01-19 23:38:00 +10:00
Stenzek
ade255a5ff TextureCache: Fix broken XFB stitching with stereoscopy is enabled 2019-01-19 23:23:21 +10:00
weihuoya
184b2edc30 fx texture overlap 2018-12-25 21:24:25 +08:00
Stenzek
502c4c0e87 TextureCache: Recompute overlapping XFB copy hashes after copying to RAM 2018-11-13 12:48:27 +10:00
Stenzek
78056686fd TextureCache: Fix leaking TCacheEntry instances 2018-11-08 11:52:17 +10:00
Stenzek
8e2c063d62 TextureCache: Implement deferred/batched EFB copies 2018-11-07 16:25:01 +10:00
Tilka
660fb3fca0
Merge pull request #7412 from AdmiralCurtiss/xfb-stitch-in-order
Stitch together overlapping XFB regions in order of XFB copy creation.
2018-10-14 12:00:41 +01:00
Admiral H. Curtiss
f2fa63783b Do not consider XFB copies for invalidating textures when loading a new texture.
This fixes severe image flickering in some cutscenes of Twin Snakes. The game appears to sometimes load a previously made XFB copy as a texture before it is actually rendered to the screen, which we took as an invitation to invalidate the XFB copy.
2018-09-15 13:56:45 +02:00
Admiral H. Curtiss
3e95d3c477 Stitch together overlapping XFB regions in order of XFB copy creation. 2018-09-14 19:41:27 +02:00
Lioncash
34c3a65de6
VideoCommon/TextureCacheBase: Resolve a -Wmissing-braces warning in GetRAMCopyFilterCoefficients() 2018-07-06 19:56:35 -04:00
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