TellowKrinkle
716c0980d7
VideoBackends: Add Metal renderer
2022-07-21 20:44:19 -05:00
Pokechu22
791bd16b28
Restructure parameters to TetxureConverterShaderGen/TextureConversionShader
...
This will be used for later refactoring for increased accuracy.
2022-07-16 00:07:10 -07:00
Pokechu22
290e62f179
Remove casts to integers for texture and EFB formats
...
The only remaining casts for these types that I know of are in TextureInfo (where format_name is set to the int version of the format, and since that affects filenames and probably would break resource packs, I'm not changing it) and in TextureDecoder_Common's TexDecoder_DrawOverlay, which will be handled separately.
2022-07-15 12:29:40 -07:00
iwubcode
1480b78f64
VideoCommon: dump EFB with size and texture format details and dump XFB with size details. Finally move count to front of image for XFB/EFB dumps so as to make it easier to see them in order. Change the count value prefix to 'n'
2022-06-27 18:20:52 -05:00
iwubcode
69839df1eb
VideoCommon: support dynamically updating game mods at runtime
2022-06-27 18:20:52 -05:00
iwubcode
892678648e
VideoCommon: trigger mod calls in TextureCacheBase (efb/xfb calls), VertexManagerBase (draw calls), and VertexShaderManager (projection calls)
2022-06-27 18:20:52 -05:00
iwubcode
62c186e14b
VideoCommon: add UninitializeEFBMemory to mirror XFB function
2022-06-27 18:20:52 -05:00
TellowKrinkle
23c1721fbd
VideoCommon: Reduce duplicates of non-palette-requiring texture decode shaders
2022-06-16 02:08:45 -05:00
Dentomologist
f6b9acccfc
Common: Refactor PointerWrap
2022-05-25 13:06:41 -07:00
Admiral H. Curtiss
01d4a2e9cc
TextureCacheBase: Don't log error while measuring state size.
2022-04-26 21:26:42 +02:00
Admiral H. Curtiss
ef760ee012
Common/PointerWrap: Prevent reads/writes past the end of the buffer.
2022-04-18 23:48:00 +02:00
Pokechu22
4aeef95746
Fix copy filter clamping when EFB VRAM copies are disabled
2022-01-29 12:23:32 -08:00
Pokechu22
25c547e9e5
Fix incorrect copy filter clamping
...
We need to clamp to the center of pixels, or else things end up working out incorrectly. This also fixes an off-by-1 for the bottom line.
2022-01-25 19:53:25 -08:00
Pokechu22
afd02b79a5
VideoCommon: Add names for textures and shaders
2022-01-01 11:38:56 -08:00
Pokechu22
e7d5f8ad5c
TextureCacheBase: Re-wrap GetTexture comment
2021-12-18 15:21:48 -08:00
JMC47
dbaebdc585
Merge pull request #10222 from phire/fix-copy-filter-clamping
...
Fix copy filter clamping
2021-11-18 17:48:33 -05:00
Pokechu22
4a9b26de86
VideoCommon: Expose SamplerState to shaders
...
The benefit to exposing this over the raw BP state is that adjustments Dolphin makes, such as LOD biases from arbitrary mipmap detection, will work properly.
2021-11-17 20:04:34 -08:00
Pokechu22
6236a0d494
Eliminate SamplerCommon
2021-11-17 20:04:34 -08:00
Pokechu22
3096f77ba0
Eliminate SamplerCommon::AreBpTexMode0MipmapsEnabled
...
This was added in 0b9a72a62d
but became irrelevant in 70f9fc4e75
as the check is now self-explanatory due to a rejiggering of the bitfields.
2021-11-17 20:04:34 -08:00
Scott Mansell
7128befb39
Fix copy filter clamping regression in Spyro
...
This fixes horizontal lines in the bloom effect of Spyro: A Hero's Tail,
which is a regression caused by PR #10204
Screenshot of regression:
https://user-images.githubusercontent.com/138484/142030503-90fcd8d5-63d3-4820-874a-72e9be0c4768.png
Fixed:
https://user-images.githubusercontent.com/138484/142031598-b85ff55c-1302-4e4d-bcb2-57848974056b.png
Spyro uses an 640x80 pixel sub-buffer within the EFB to calculate
it's bloom effects, which it places below the main 640x448 buffer.
EFB layout:
https://user-images.githubusercontent.com/138484/142030573-e933b6ae-c37e-4be6-86d4-0bc779b92535.png
Note: Colors are wrong because the main color buffer uses RGBA6,
while the bloom is calculated in RGB8
This allows it to do bloom without backing up part of the EFB to
main memory, as most games do.
But, since some of the sub-buffers used in the bloom effect are taller
than 80 pixels, they need to be sliced up into smaller sub, sub buffers
which get combined later when copied to main memory.
At one point, a 320x224 buffer is broken up into 320x80, 320x64 and
320x80 slices. These are copied out with the copy filter set to a
vertical blur.
Because there was an off-by-one errror in the clamping coordinates,
the bottom line of the color buffer would be blurred into
the top of each slice.
Final combined EFB copy:
https://user-images.githubusercontent.com/138484/142031360-2c076839-7c96-4b3b-a093-d899d0a2c7ae.png
Fixed version:
https://user-images.githubusercontent.com/138484/142031370-72e41a35-3b3e-4662-a483-79203e357ecc.png
Before #10204 the copy filter wasn't enabled for efb copies, and most
other games don't do this type of slicing.
FIFO CI shows that a few other games are effected, it's always just a minor difference to the top line where there was previously a slight hint of garbage.
2021-11-17 06:12:46 +13:00
Scott Mansell
edb66dab84
TextureCache: Remove deleted textures from bound_textures
...
Fixes issue where vulkan might crash trying to bind a deleted
texture.
2021-10-12 15:51:24 +13:00
Scott Mansell
88bd10cd30
Extend TMEM cache implementation
...
Now works with games that deliberately avoid invalidating TMEM because
they know textures are too large to fit:
* Sonic Riders
* Metal Arms: Glitch in the System
* Godzilla: Destroy All Monsters Melee
* NHL Slapshot
* Tak and the Power of Juju
* Night at the Museum: Battle of the Smithsonian
* 428: Fūsa Sareta Shibuya de
2021-10-12 15:51:24 +13:00
Scott Mansell
9fa26624b0
BPMemory: Refactor/consolidate TexUnit Addressing
...
Currently the logic for addressing the individual TexUnits is splattered all
across dolphin's codebase, this commit attempts to consolidate it all into a
single place and formalise it using our new TexUnitAddress struct.
2021-10-10 09:09:43 +13: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
Mat M
d034c830ac
Merge pull request #9681 from iwubcode/texture-info
...
VideoCommon: move all texture calculations to a "TextureInfo" class
2021-05-13 06:44:08 -04:00
iwubcode
182dfc38e6
VideoCommon: move all texture calculations to a "TextureInfo" class. This ever so slightly improves readability and allows for the full texture name to be generated outside of the hires texture cache
2021-05-11 22:58:36 -05:00
JMC47
eb5cd9be78
Merge pull request #9694 from iwubcode/xfb-tcache-hash
...
VideoCommon: update TextureCache logic for finding oversized XFBs
2021-05-09 15:20:53 -04:00
iwubcode
6fd7867c56
VideoCommon: simplify TextureCacheBase by comparing a xfb's hash against a newly calculated one. This fixes games like Teenage Mutant Ninja Turtles (Wii) which use oversized textures where the stride doesn't match the BytesPerRow and that resulted in a different hash algorithm being used. By not hashing the texture before, we improve performance by hashing at most once in all direct XFB lookup scenarios.
2021-05-08 01:29:48 -05:00
ash!!
43ceba4fef
optimize TextureCacheBase::SerializeTexture, ::DeserializeTexture
...
texture serialization and deserialization used to involve many memory
allocations and deallocations, along with many copies to and from
those allocations. avoid those by reserving a memory region inside the
output and writing there directly, skipping the allocation and copy to
an intermediate buffer entirely.
2021-04-18 13:40:42 -07:00
Pokechu22
70f9fc4e75
Convert BPMemory to BitField and enum class
...
Additional changes:
- For TevStageCombiner's ColorCombiner and AlphaCombiner, op/comparison and scale/compare_mode have been split as there are different meanings and enums if bias is set to compare. (Shift has also been renamed to scale)
- In TexMode0, min_filter has been split into min_mip and min_filter.
- In TexImage1, image_type is now cache_manually_managed.
- The unused bit in GenMode is now exposed.
- LPSize's lineaspect is now named adjust_for_aspect_ratio.
2021-03-06 19:27:19 -08:00
Lioncash
3d9b2aa005
VideoCommon: Migrate over to fmt
...
Migrates off the printf-based formatting where applicable.
2020-11-17 21:23:58 -05:00
iwubcode
fd3af4c5d3
InputCommon: Introducing the "Dynamic Input Texture". Configuration links an emulated input action to an image based on what host key is defined for that emulated input. Specific regions are called out in configuration that mark where to replace an input button with a host key image.
2020-10-03 17:10:35 -05:00
iwubcode
9c8338ec4c
DolphinQt / VideoCommon: Add additional texture dumping options. Specifically, this enables users to choose whether to dump mip maps, base level textures, or both.
2020-07-22 19:30:27 -05:00
Jun Su
da223a2271
Cleanup warnings of -Wunused-lambda-capture
...
Remove unused lambda captures.
2020-03-24 20:14:10 +08:00
Lioncash
b2a9c36501
VideoCommon/OpcodeDecoding: Move g_bRecordFifoData into namespace
...
Keeps the global localized with the code that it's primarily related to.
Now it's obvious from a glance what the global variable is affecting.
2019-12-05 09:13:03 -05:00
Lioncash
6fbbc2683e
VideoCommon: Make use of fmt outside of shader generators
...
Migrates most of VideoCommon over to using fmt, with the exception being
the shader generator code. The shader generators are quite large and
have more corner cases to deal with in terms of conversion (shaders have
braces in them, so we need to make sure to escape them).
Because of the large amount of code that would need to be converted, the
conversion of VideoCommon will be in two parts:
- This change (which converts over the general case string formatting),
- A follow up change that will specifically deal with converting over
the shader generators.
2019-11-23 16:00:45 -05:00
Connor McLaughlin
9477c8b0ed
Merge pull request #8293 from lioncash/ref
...
VideoCommon/TextureCacheBase: Make OnConfigChanged's parameter a const reference
2019-08-08 12:17:26 +10:00
Lioncash
07aa18eb2b
VideoCommon/TextureCacheBase: Collapse for loop into a fill() in Invalidate()
...
Same thing, less code.
2019-08-04 23:30:27 -04:00
Lioncash
d52dd2e04f
VideoCommon/TextureCacheBase: Use emplace_back where applicable
...
Same thing, less code.
2019-08-04 23:28:14 -04:00
Lioncash
fd12ae1408
VideoCommon/TextureCacheBase: Remove use of the texture cache global
...
We can just call the functions that are part of the interface instead of
using the global in order to execute those functions.
2019-08-04 23:23:04 -04:00
Lioncash
86a651e27f
VideoCommon/TextureCacheBase: Remove dependence on global variables from OnConfigChanged()
...
The active config will always be passed as the reference parameter, we
can make use of the parameter instead of accessing the global variable.
2019-08-04 22:33:18 -04:00
Lioncash
7d017be666
VideoCommon/TextureCacheBase: Make OnConfigChanged's parameter a const reference
...
This reference isn't actually modified within this function
2019-08-04 22:31:27 -04:00
Stenzek
53e30c06e8
Config: Add an option to skip saving texture cache to save state
2019-07-24 05:19:22 +10:00
Stenzek
1082468133
TextureCache: Support saving cache entries, including EFB copies
2019-07-24 04:10:38 +10:00
Stenzek
6f53a4d0da
TextureCache: Don't crash when conversion pipelines fail to compile
2019-07-19 15:32:50 +10:00
Stenzek
946571b759
TextureCache: Support reinterpreting formats for VRAM textures
2019-07-14 19:16:27 +10:00
Stenzek
77f406c8a8
TextureCache: Combine ApplyPaletteToEntry and ConvertTexture
2019-07-14 14:07:37 +10:00
Lioncash
d4337eebde
VideoCommon/Statistics: Rename stats global to g_stats
...
Makes the global variable follow our convention of prefixing g_ on
global variables to make it obvious in surrounding code that it's not a
local variable.
2019-07-10 23:34:54 -04:00
Lioncash
a99c7d01e1
VideoCommon/Statistics: Normalize statistic variable names
...
Normalizes all variables related to statistics so that they follow our
coding style.
These are relatively low traffic areas, so this modification isn't too
noisy.
2019-07-10 23:19:10 -04:00
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
Stenzek
84b990faa0
VideoConfig: Remove bForceCopyToRam field
...
It's the inverse of supports-copy-to-vram.
2018-02-11 15:29:37 +10:00