summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
AgeCommit message (Collapse)Author
2022-04-18Common/PointerWrap: Prevent reads/writes past the end of the buffer.Admiral H. Curtiss
2022-01-29Fix copy filter clamping when EFB VRAM copies are disabledPokechu22
2022-01-25Fix incorrect copy filter clampingPokechu22
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-01VideoCommon: Add names for textures and shadersPokechu22
2021-12-18TextureCacheBase: Re-wrap GetTexture commentPokechu22
2021-11-18Merge pull request #10222 from phire/fix-copy-filter-clampingJMC47
Fix copy filter clamping
2021-11-17VideoCommon: Expose SamplerState to shadersPokechu22
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-17Eliminate SamplerCommonPokechu22
2021-11-17Eliminate SamplerCommon::AreBpTexMode0MipmapsEnabledPokechu22
This was added in 0b9a72a62d38481ff08f742b2318d07f29ff5dff but became irrelevant in 70f9fc4e7526fc9cfc008a43cd33229f62be99b6 as the check is now self-explanatory due to a rejiggering of the bitfields.
2021-11-17Fix copy filter clamping regression in SpyroScott Mansell
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-10-12TextureCache: Remove deleted textures from bound_texturesScott Mansell
Fixes issue where vulkan might crash trying to bind a deleted texture.
2021-10-12Extend TMEM cache implementationScott Mansell
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-10BPMemory: Refactor/consolidate TexUnit AddressingScott Mansell
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-07-05treewide: convert GPLv2+ license info to SPDX tagsPierre Bourdon
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-05-13Merge pull request #9681 from iwubcode/texture-infoMat M
VideoCommon: move all texture calculations to a "TextureInfo" class
2021-05-11VideoCommon: move all texture calculations to a "TextureInfo" class. This ↵iwubcode
ever so slightly improves readability and allows for the full texture name to be generated outside of the hires texture cache
2021-05-09Merge pull request #9694 from iwubcode/xfb-tcache-hashJMC47
VideoCommon: update TextureCache logic for finding oversized XFBs
2021-05-08VideoCommon: simplify TextureCacheBase by comparing a xfb's hash against a ↵iwubcode
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-04-18optimize TextureCacheBase::SerializeTexture, ::DeserializeTextureash!!
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-03-06Convert BPMemory to BitField and enum classPokechu22
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.
2020-11-17VideoCommon: Migrate over to fmtLioncash
Migrates off the printf-based formatting where applicable.
2020-10-03InputCommon: Introducing the "Dynamic Input Texture". Configuration links ↵iwubcode
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-07-22DolphinQt / VideoCommon: Add additional texture dumping options. ↵iwubcode
Specifically, this enables users to choose whether to dump mip maps, base level textures, or both.
2020-03-24Cleanup warnings of -Wunused-lambda-captureJun Su
Remove unused lambda captures.
2019-12-05VideoCommon/OpcodeDecoding: Move g_bRecordFifoData into namespaceLioncash
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-11-23VideoCommon: Make use of fmt outside of shader generatorsLioncash
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-08-08Merge pull request #8293 from lioncash/refConnor McLaughlin
VideoCommon/TextureCacheBase: Make OnConfigChanged's parameter a const reference
2019-08-04VideoCommon/TextureCacheBase: Collapse for loop into a fill() in Invalidate()Lioncash
Same thing, less code.
2019-08-04VideoCommon/TextureCacheBase: Use emplace_back where applicableLioncash
Same thing, less code.
2019-08-04VideoCommon/TextureCacheBase: Remove use of the texture cache globalLioncash
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-04VideoCommon/TextureCacheBase: Remove dependence on global variables from ↵Lioncash
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-04VideoCommon/TextureCacheBase: Make OnConfigChanged's parameter a const referenceLioncash
This reference isn't actually modified within this function
2019-07-24Config: Add an option to skip saving texture cache to save stateStenzek
2019-07-24TextureCache: Support saving cache entries, including EFB copiesStenzek
2019-07-19TextureCache: Don't crash when conversion pipelines fail to compileStenzek
2019-07-14TextureCache: Support reinterpreting formats for VRAM texturesStenzek
2019-07-14TextureCache: Combine ApplyPaletteToEntry and ConvertTextureStenzek
2019-07-10VideoCommon/Statistics: Rename stats global to g_statsLioncash
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-10VideoCommon/Statistics: Normalize statistic variable namesLioncash
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-05-06Reformat repo to clang-format 7.0 rulesTechjar
2019-05-04Replace MathUtil::Clamp with std::clampLéo Lam
2019-05-04Merge pull request #7839 from ShFil119/impr/redundantLéo Lam
Remove redundant initialization
2019-04-30Remove redundant initializationFilip Gawin
2019-04-28Merge pull request #8048 from stenzek/vulkan-negative-scissor-rectConnor McLaughlin
Vulkan: Don't set a negative offset in scissor rect
2019-04-28FramebufferManager: Fix invalid transitions for 1xIR in EFB cacheStenzek
2019-04-28TextureCache: Fix incorrect format string in GetXFBTexture()Stenzek
2019-04-21Replace EFBRectangle/TargetRectangle with MathUtil::RectangleStenzek
2019-04-21TextureCache: Check for out-of-range partial copy rect after scalingStenzek
2019-04-21TextureCache: Use linear filtering on y-scaled and >1xIR VRAM copiesStenzek
2019-04-21TextureCache: Simplify XFB reconstructionStenzek
This also better handles in-memory interlaced XFB data placed by the CPU by considering the stride from the VI.