aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/textures/astc.cpp
Commit message (Collapse)AuthorAgeFilesLines
* textures: ASTC opaque scan from a table of block modesTakoroka3 days1-11/+47
| | | | | | | | | | | | | | | | | | Choosing BC1 or BC3 for an ASTC texture re-compressed on the GPU scans every block of it for an alpha endpoint mode when the image is made, on the GPU thread. Each block's mode was decoded bit by bit (DecodeBlockInfo): 224 us per new ASTC texture on Mario Kart World's title screen, which streams textures in by the thousand, and ~10% of the time in its frames over 100 ms. DecodeBlockInfo reads nothing but a block's 11 mode bits, so its result for all 2048 of them is worked out once; the scan takes the partition count and endpoint modes straight from the block's first word. Same answer as before for all 2^29 values of the bits the scan reads (random data in the rest, 538M blocks). A 4 MiB opaque texture scans in 1.6 ms instead of 12 ms; the title screen's new ASTC textures in 37 us each instead of 224.
* Texture cache: stop the churn, the per-frame image leak and garbage texturesTakoroka6 days1-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | - Unmapped GPU addresses get a stand-in CPU address fixed by the GPU address. A fresh one per lookup meant FindImage never found an image there again: title 1's bloom chain at 0xf0000-0x15b600 was re-created on every use (~5,400 images per 600 frames), filling VRAM. - ASTC whose blocks carry no alpha (exact endpoint-mode scan reusing the decoder's block parsing) is re-compressed to BC1 instead of BC3, half the size; about 70% of title 1's ASTC qualifies. Copies between BC1 and BC3 hosts are skipped (their guest data is uploaded instead). EDEN_NX2_ASTC_BC1=0 turns it off. - Deleting an image cancels every decode still queued for it. An image re-decoded mid-decode has two; the first to finish cleared IsDecoding, the second was not cancelled and was uploaded into the next image to take the slot: garbage textures (the title logo, road patches) and a staging overrun when that image was smaller. - Diagnostics: images created and deleted per 600 frames by shape, collector deletions, async decodes, BC1/BC3 split; collector thresholds overridable (EDEN_NX2_TC_EXPECTED_MIB/CRITICAL_MIB); GPU ASTC decode wait timing (EDEN_NX2_ASTC_FLUSH=1 submits without it). Title 1 attract loop: device memory 4.8-5.1 GB instead of 5.9-6.1 GB, no decoded textures evicted, ~17 -> 22-23 fps.
* [vulkan] Re-adjusting ASTC resolve (#4250)CamilleLaVey2026-08-051-0/+11
| | | | | | | | | | | | | This is an adjustment made due to problems caused by my ASTC changes some pr's earlier; added sanity to decoded blocks, removes the inconditional storage view for ASTC formats (verified against MaxwellToVk logic), added support to VK_EXT_astc_decode_mode which will ensure a better way to resolve RGFA16/RGFA32 on tilers, simplified ASTC HDR decoding into LDR valid formats. This fixes some issues with SteamDeck, Fire Emblem: Engage washed colors and other problems related to ASTC. _Special Thanks_ 1.- Meowly The Smol (@Gidoly) 2.- @simply0001 for the actual idea on the redundant storage views on the transcoded ASTC path. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4250
* [video_core] Implementation on ASTC HDR formats + Vulkan fixes (#4190)CamilleLaVey2026-07-091-10/+344
| | | | | | | | | | | | Based on the register of the ASTC implementation from Ameerj (yuzu), currently our conversion from ASTC on Desktop tends to duplicates the unpacking of ASTC converted textures, leading to bad performance; since there are some graphical effects that actually access on the band of 32bits (RGAF32) than the common 16bits (RGAF16) from our ASTC path decoding method, which commonly uses ARGB8 (degradation -> LDR) transformation to reduce the memory cost per conversion; meanwhile it could actually provide initially better performance; the engine tended to get stalled when this writted stage effect got skipped; mostly because CPU tends to look for an unimplemented texture/ format query (from which doesn't exist on our MaxwellToVK); unlike what's commonly believed HDR was a format to write enviroment effects even before their appearance on video output (since Switch doesn't have HDR, only SDR on certain engines). The test result on this PR showed games like Astral Chain and other heavy reliant on ASTC decoding improved their performance and stability by around 15%; meanwhile could it be tied to a hardware gain, it's clearly a gain for direct access on what's required on most games. This PR also contains few Vulkan bug fix I encountered along this implementation. Special Thanks: -> Mr. Smoly Gidolard (@gidoly) Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4190
* [common] remove ranges polyfill (#2546)lizzie2025-09-241-1/+1
| | | | | | | | | Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2546 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [meta] fix license headers (#2547)lizzie2025-09-211-0/+3
| | | | | | | Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2547 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [cmake] enable clang-cl and WoA builds (#348)lizzie2025-09-091-5/+5
| | | | | | | | | | | | | | Compilation and CMake fixes for both Windows on ARM and clang-cl, meaning Windows can now be built on both MSVC and clang on both amd64 and aarch64. Compiling on clang is *dramatically* faster so this should be useful for CI. Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: crueter <crueter@crueter.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/348 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* textures: add BC1 and BC3 compressors and recompression settingLiam2023-05-231-3/+2
|
* general: fix spelling mistakesLiam2023-03-121-1/+1
|
* configuration: Add async ASTC decode settingameerj2023-02-221-2/+2
|
* general: fix compile for Apple ClangLiam2022-11-221-0/+1
|
* general: Resolve -Wunused-lambda-capture and C5233Morph2022-10-221-2/+2
|
* common: remove "yuzu:" prefix from thread namesLiam2022-10-031-1/+1
|
* Merge pull request #8910 from vonchenplus/astc_decode_errorbunnei2022-09-301-1/+1
|\ | | | | video_core: Modify astc texture decode error fill value
| * video_core: Modify astc texture decode error fill valueFengChen2022-09-151-1/+1
| |
* | astc: Enable parallel CPU astc decodingMorph2022-09-161-21/+35
|/ | | | | Given the issues with GPU accelerated ASTC decoding with NVIDIA's latest drivers, parallelize astc decoding on the CPU. Uses half the available threads in the system for astc decoding.
* chore: add missing SPDX tagsAndrea Pappacoda2022-04-281-14/+3
| | | | Follow-up to 2b87305d319f0bd04da36fb96314934f37b12637
* general: Fix clang/gcc build errorsameerj2022-03-201-0/+1
|
* astc_decoder: Optimize the use EncodingDataameerj2021-07-311-0/+70
| | | | | | | This buffer was a list of EncodingData structures sorted by their bit length, with some duplication from the cpu decoder implementation. We can take advantage of its sorted property to optimize its usage in the shader. Thanks to wwylele for the optimization idea.
* astc.h: Move data to cpp implementationameerj2021-07-311-23/+63
| | | | Moves leftover values that are no longer used by the gpu decoder back to the cpp implementation.
* video_core: Silence signed/unsigned mismatch warningsMorph2021-06-281-2/+2
|
* astc_decoder.comp: Remove unnecessary LUT SSBOsameerj2021-06-191-4/+4
| | | | We can move them to instead be compile time constants within the shader.
* astc: Various robustness enhancements for the gpu decoderameerj2021-06-191-0/+2
| | | | | | These changes should help in reducing crashes/drivers panics that may occur due to synchronization issues between the shader completion and later access of the decoded texture.
* astc_decoder: Fix LDR CEM1 endpoint calculationameerj2021-06-151-1/+1
| | | | | | | | Per the spec, L1 is clamped to the value 0xff if it is greater than 0xff. An oversight caused us to take the maximum of L1 and 0xff, rather than the minimum. Huge thanks to wwylele for finding this. Co-Authored-By: Weiyi Wang <wwylele@gmail.com>
* textures: Reintroduce CPU ASTC decoderameerj2021-06-151-0/+1577
| | | | | | | Users may want to fall back to the CPU ASTC texture decoder due to hangs and crashes that may be caused by keeping the GPU under compute heavy loads for extended periods of time. This is especially the case in games such as Astral Chain which make extensive use of ASTC textures.
* astc_decoder: Refactor for style and more efficient memory useameerj2021-03-251-1710/+0
|
* astc: Increase integer encoded vector sizeReinUsesLisp2021-01-151-1/+1
| | | | | Invalid ASTC textures seem to write more bytes here, increase the size to something that can't make us push out of bounds.
* astc: Return zero on out of bound bitsReinUsesLisp2021-01-151-17/+22
| | | | | Avoid out of bound reads on invalid ASTC textures. Games can bind invalid textures that make us read or write out of bounds.
* video_core: Rewrite the texture cacheReinUsesLisp2020-12-301-30/+28
| | | | | | | | | | | | | | The current texture cache has several points that hurt maintainability and performance. It's easy to break unrelated parts of the cache when doing minor changes. The cache can easily forget valuable information about the cached textures by CPU writes or simply by its normal usage.The current texture cache has several points that hurt maintainability and performance. It's easy to break unrelated parts of the cache when doing minor changes. The cache can easily forget valuable information about the cached textures by CPU writes or simply by its normal usage. This commit aims to address those issues.
* astc: Hard code bit depth changes to 8 and use fast replicateReinUsesLisp2020-04-091-21/+15
|
* astc: Use boost's static_vector to avoid heap allocationsReinUsesLisp2020-04-091-10/+14
|
* astc: Implement a fast precompiled alternative for ReplicateReinUsesLisp2020-04-091-2/+57
|
* astc: Move Replicate to a constexpr LUT when possibleReinUsesLisp2020-04-091-8/+38
|
* astc: Make InputBitStream constexprReinUsesLisp2020-04-091-11/+11
|
* astc: OutputBitStream style changes and make it constexprReinUsesLisp2020-04-091-32/+26
|
* astc: Fix clang build issuesReinUsesLisp2020-03-181-12/+12
|
* astc: Fix typos from search and replaceReinUsesLisp2020-03-141-3/+3
|
* astc: Minor changes to InputBitStreamReinUsesLisp2020-03-141-28/+34
|
* astc: Pass val in Replicate by copyReinUsesLisp2020-03-141-1/+1
|
* astc: Call std::vector:reserve on decodedClolorValues to avoid reallocatingReinUsesLisp2020-03-141-0/+2
|
* astc: Call std::vector::reserve on texelWeightValues to avoid reallocatingReinUsesLisp2020-03-131-0/+2
|
* astc: Create a LUT at compile time for encoding valuesReinUsesLisp2020-03-131-7/+19
|
* astc: Make IntegerEncodedValue a trivial structureReinUsesLisp2020-03-131-212/+177
|
* astc: Make IntegerEncodedValue constructor constexprReinUsesLisp2020-03-131-5/+6
|
* astc: Make IntegerEncodedValue trivially copyableReinUsesLisp2020-03-131-9/+2
|
* astc: Rename C types to common_typesReinUsesLisp2020-03-131-79/+78
|
* astc: Move Popcnt to an anonymous namespace and make it constexprReinUsesLisp2020-03-131-9/+13
|
* astc: Use common types instead of stdint.h integer typesReinUsesLisp2020-03-131-284/+282
|
* astc: Use 'enum class' instead of 'enum' for EIntegerEncodingReinUsesLisp2020-03-131-25/+25
|
* video_core: Silence implicit conversion warningsReinUsesLisp2019-11-081-35/+38
|