Commit Graph

123 Commits

Author SHA1 Message Date
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
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
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 1082468133 TextureCache: Support saving cache entries, including EFB copies 2019-07-24 04:10:38 +10:00
Lioncash 2b9389202e VideoCommon: Remove unused MathUtil.h include from VideoCommon.h
This header doesn't actually make use of MathUtil.h within itself, so
this can be removed. Many other source files used VideoCommon.h as an
indirect include to include MathUtil.h, so these includes can also be
adjusted.

While we're at it, we can also migrate valid inclusions of VideoCommon.h
into cpp files where it can feasibly be done to minimize propagating it
via other headers.
2019-07-16 20:54:34 -04: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
Stenzek f8c1ba409c Replace EFBRectangle/TargetRectangle with MathUtil::Rectangle 2019-04-21 14:28:14 +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 f039149198 Move most backend functionality to VideoCommon 2019-02-19 16:57:54 +10:00
Stenzek ade255a5ff TextureCache: Fix broken XFB stitching with stereoscopy is enabled 2019-01-19 23:23:21 +10:00
Stenzek 8e2c063d62 TextureCache: Implement deferred/batched EFB copies 2018-11-07 16:25:01 +10: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
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
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
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
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
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 49a9c33bd7 VideoCommon: Move abstract texture creation function to Renderer 2017-11-22 18:47:04 +10:00
iwubcode dd54617a08 TextureCacheBase: Set uninitialized XFB memory to fuchsia color 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 7248dd47d5 Hybrid XFB: Fix lint errors 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 65418a76f5 Video Common: Use correct aspect ratio when saving screenshots / video 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 79387dddb2 Add support for hybrid XFB 2017-11-17 19:47:56 -06: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
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
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
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
iwubcode e4896d39bd Video Backends: Move and rename HostTextureFormat to AbstractTextureFormat 2017-06-13 00:41:56 -05:00
iwubcode 2cdc93f4ab Video Backends: Split texture cache code out into separate files, introduce 'AbstractTexture' 2017-06-13 00:41:51 -05:00
Stenzek cc851c41c1 TextureCache: Move host texture utility functions to VideoCommon
The appropriate place for these would be AbstractTexture, once it is
finished.
2017-04-29 13:46:43 +10:00
Stenzek f4b848949c TextureCache: Support compressed textures and pass pitch/size to upload
This also removes an extra copy of the image for custom textures.
2017-04-29 00:14:23 +10:00
Stenzek e9850aa0f2 VideoBackends: Support updated texture encoding shader generators 2017-04-12 00:11:22 +10:00
Stenzek 79ba946d70 VideoCommon: Changes to TextureCache to support decoding in backend 2017-04-01 12:32:10 +10:00
Lioncash 57c21b9576 TextureCacheBase: Convert bound_textures from a C array to a std::array
Prevents array-to-pointer decay and simplifies some code.
2017-03-25 14:53:25 -04:00
degasus d0a73c1d90 TextureCache: Add a dirty bit for partial updates on overlapping EFB copies. 2016-12-27 17:26:04 +01:00
degasus abf9bb170b TextureCache: Drop unused parameter in backend API. 2016-12-26 22:10:32 +01:00
degasus 04f319066d TextureCache: Extract BP enum check to VideoCommon.
We have TOO many video backends.
2016-12-26 22:10:21 +01:00
Tillmann Karras 44acd9fdb9 VideoCommon: use u32 for texture addresses 2016-12-25 18:48:19 +01:00