aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/textures
Commit message (Collapse)AuthorAgeFilesLines
* video_core: read texture handles as header offsets only on Switch 2Sssnowyyy33 hours1-4/+4
| | | | | | | | | | | | | | 049c9633ed made TextureHeaderIndex take index / 32 for any texture index past the pool that is a multiple of 32, in VisitImageView and in the shader environment. That was written for Switch 2 handles that hold a header byte offset, but it ran for Switch 1 games too, where such an out-of-range index used to give a null view (and fail the shader environment's range check) and now binds an unrelated header. Pass whether the memory manager uses native tiling, which is how Switch 2 titles are set up, and keep the previous behaviour otherwise. Follow-up to 049c9633ed. Assisted-by: Claude Sonnet 5.5 (implementation and commit message)
* Merge remote-tracking branch 'origin/fix/nx2-texture-header-offset-handles' ↵Takoroka2 days1-0/+11
|\ | | | | | | into test/linux-all-prs
| * nx2: read texture handles that hold a header byte offsetTakoroka4 days1-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Switch Sports' scenery shaders take their 64-bit texture handles from a uniform register, and the texture part of those handles is the header's byte offset in the pool (index * 32), not its index: 0x96e46000 names header 8960 (a 640x152 2D texture), while the plain reading, 286720, runs far past the 33067-entry pool. Eden skipped them at draw time (null view) and built the shaders for a garbage header, so the island's ground, cliffs and buildings drew black. When a handle's index falls past the pool but index / 32 lands inside it, take that header, both when building the shader and when binding the view. Handles that already resolve keep their meaning.
* | 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.
* ASTC: decode and re-compress to BC1/BC3 on the GPU; texture cache budgetTakoroka6 days1-4/+5
| | | | | | | | | | | | | | | | | | | - accelerate_astc=Gpu with astc_recompression=Bc1/Bc3 now decodes ASTC with the GPU decoder into a temporary RGBA8 image (dedicated memory, freed once the GPU is past it) and compresses it with a new compute shader (bc_encoder.comp: bounding-box endpoints along the colours' covariance, inset 1/16, nearest palette entry; BC3 alpha ramp; BC1 punch-through), then copies the blocks into the image. No CPU decode, so streamed textures are ready the frame they are first used instead of showing placeholders for seconds; the decode pass no longer waits for the GPU on this path. - The CPU path (CpuAsynchronous) fills a new image with zero blocks before its first decode instead of showing stale VRAM, and the transcode pool is a quarter of the hardware threads. - Switch 2 titles: collector thresholds near the device budget, re-read every 60 frames from VK_EXT_memory_budget (another game shrank it from 7.0 to 5.4 GB). - EDEN_NX2_HIDE_WINDOW=0 now leaves the window visible.
* Texture cache: stop the churn, the per-frame image leak and garbage texturesTakoroka6 days2-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | - 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.
* ASTC transcode pool: an eighth of the hardware threads (at least 2)Takoroka6 days1-2/+11
| | | | | | | With half (8 on a Ryzen 7 8845HS), re-compressing streamed ASTC textures to BC3 took ~3.5 cores away from the six emulated cores and the GPU thread. Title 1 attract loop, 65-150 s: 8 threads 16.0 fps, 4 threads 12.6, 2 threads 18.9 (scene noise is large). EDEN_NX2_TRANSCODE_THREADS overrides.
* Switch 2: present vi2 native images and capture framesTakoroka7 days2-18/+23
| | | | | | | | vi2 229 composites the presented native image (block-linear RGBA8 in the console's GOB layout, from changes.patch) at its SMMU address, which the GPU memory registry now records per mapped range. EDEN_NX2_FRAME_CAPTURE=<dir> saves every 120th presented frame as a TGA for hidden test runs. Also mirrors releases for every two-page gsv semaphore region and logs gsv sub 101 ranges.
* [vulkan] Removal of QCOM sampler limiters + CustomBorderColor and ↵CamilleLaVey2026-08-252-40/+18
| | | | | | | | | | ColorBorderSwizzle adjustments (#4301) This PR removes the artificial limit added for QCOM drivers based on a sampler budget limit (based on #3280 work), removes the ban on CustomBorderColor/BorderColorSwizzle for also QCOM driver, reduce the amount of combination required to created a sampler with custom border color/ color border swizzle; adds cases on R16 formats not able to swizzle on BGR565 formats; degrades samplers and color combinations when there's no color border swizzle available; fixes the srgb (LUT) values from legacy and now all the color variations are cached in the same key, instead of having 7 different handlers for them. In resume, rather than performance (due to the reduced amount of process on duplicated/ synced code on pipeline/texture cache), it's a graphica accuracy work that will improve image quality at the cost of almost 0 performance hit, rather than certain hitch if the color combination wasn't cached before. This applies to all platform. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4301 Reviewed-by: Samuel <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [common, settings] Fixes misaligned Aniso levels (#4295)lizzie2026-08-241-9/+9
| | | | | | | | | | | PR/Commit Owner: CamilleLaVey Just quick fixes to ANISO bugged level selector, removes x32 and x64 from choices, also fixes the none value to actully use default. Co-authored-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4295 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
* [core, gpu, threads] Multithreading refactor (#4254)CamilleLaVey2026-08-081-2/+1
| | | | | | This insufferable work tries to cover some holes on previous threading implementation from yuzu's team, starting with Windows and Linux reordering of priorities (NICE), reworks previous Android's threading and cpu affinity with adpf, adjust emulated clocks/gpu for better "accuracy" with their work, bumps android minSDK for all flavors, legacy will now work with AP 29 to cover A10 - A12, standard will reach A13 as base and finally the optimized build will come with API 35, mostly targeted on devices with A15 support and newer, NDK and AGP wasn't upgraded yet. The performance cost efficiency have been improved based on device power configuration; preventing overheating if certain devices tended to fall into NICE0 (not allocated threads priority, all task ran with higher priority, 11 tasks running within the limited 2 - 7 threads available on the most common configuration 1x3x4 or 1x4x3). Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4254
* [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
* [vk, ogl] Remove dedicated precomputed swizzle table; use shorter inline ↵lizzie2026-07-021-18/+3
| | | | | | | | | | | | | | | | | | | | | | | | table in block_linear swizzle shaders (#4146) old table = 64 * 8 * sizeof(u32) = 512 * 4 = 4096 bytes new table = 8 * sizeof(u32) = 8 * 4 = 32 bytes the expression ```glsl return ((pos & 0x0180) >> 1) | ((pos & 0x0040) >> 2) | ((pos & 0x0020) << 3) | ((pos & 0x0010) << 1) | ((pos & 0x000f) << 0); ``` is equivalent for generating the table but idk if we'd want that Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4146 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [fixup] Revert "[video_core] remove decoders.cpp template<A,B> spam (16 ↵Caio Oliveira2026-01-181-67/+111
| | | | | | | | | | | | | | | | | | | | copies of the same function) (#3263)" (#3333) This make slowdown on: - Mario 3D World (path from World 6 to World 7) - Okami HD (On Docked) Should check the cause for such regression (Maran's Note: looks like VRAM allocation is not being freed?) This reverts commit ea29f169e6c201e2028e08366d989b36b54dedba. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3333 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Co-committed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
* [video_core] remove decoders.cpp template<A,B> spam (16 copies of the same ↵lizzie2026-01-101-111/+67
| | | | | | | | | | | | | | | | | | function) (#3263) 16 for SwizzleImpl another 16 for SwizzleSubrectImpl another 2 for Swizzle while yes, inlining can be good, I think this kind of templatery fuckery is a bit excessive Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3263 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [video_core, settings] Allow to turn of aniso levels completely, provide ↵lizzie2025-11-261-11/+20
| | | | | | | | | | | | | | levels of aniso upto x64 (#3019) Never in my lifetime will I ever need to revise anisotropy levels; I hope :) Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3019 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [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-214-0/+12
| | | | | | | 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-094-11/+11
| | | | | | | | | | | | | | 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>
* configure_graphics_advance: Generate UI at runtimelat9nq2023-07-211-2/+2
| | | | | | | We can iterate through the AdvancedGraphics settings and generate the UI during runtime. This doesn't help runtime efficiency, but it helps a ton in reducing the amount of work a developer needs in order to add a new setting.
* video_core: Add BCn decoding supportGPUCode2023-06-272-6/+4
|
* video_core: Removed AF for all mip modes option as it's default nowWollnashorn2023-06-171-5/+3
|
* video_core: Fallback to default anisotropy instead to 1x anisotropyWollnashorn2023-06-151-2/+2
|
* video_core: Add per-image anisotropy heuristics (format & mip count)Wollnashorn2023-06-151-5/+7
|
* video_core: Apply AF only to samplers with normal LOD range [0, 1+x]Wollnashorn2023-06-141-4/+6
|
* video_core: Fix default anisotropic heuristicWollnashorn2023-06-141-4/+4
|
* video_core: Never apply AF to None mipmap modeWollnashorn2023-06-141-3/+4
| | | | Should fix some artifacts with the "apply anisotropic filtering for all mipmap modes" option
* video_core: Disable anisotropic filtering for samplers with depth compareWollnashorn2023-06-131-2/+3
|
* video_core: Option to apply anisotropic filtering for all mipmap modesWollnashorn2023-06-131-1/+2
|
* textures: add BC1 and BC3 compressors and recompression settingLiam2023-05-235-3/+133
|
* Disable SRGB border color conversion for now, to fix shadows in Xenoblade.Kelebek12023-03-171-6/+8
|
* Merge pull request #9933 from vonchenplus/texture_formatliamwhite2023-03-141-35/+35
|\ | | | | video_core: Update texture format
| * video_core: Update texture formatFeng Chen2023-03-101-35/+35
| |
* | general: fix spelling mistakesLiam2023-03-121-1/+1
|/
* configuration: Add async ASTC decode settingameerj2023-02-221-2/+2
|
* remove static from pointer sized or smaller types for aesthetics, change ↵arades792023-02-141-1/+1
| | | | | | constexpr static to static constexpr for consistency Signed-off-by: arades79 <scravers@protonmail.com>
* add static lifetime to constexpr values to force compile time evaluation ↵arades792023-02-141-1/+1
| | | | | | where possible Signed-off-by: arades79 <scravers@protonmail.com>
* video_core: fix off by one in anisotropic filtering amountLiam2022-12-101-1/+2
|
* general: fix compile for Apple ClangLiam2022-11-221-0/+1
|
* Add break for default casesKyle Kienapfel2022-11-131-0/+3
| | | | | | | | | | | Visual Studio has an option to search all files in a solution, so I did a search in there for "default:" looking for any missing break statements. I've left out default statements that return something, and that throw something, even if via ThrowInvalidType. UNREACHABLE leads towards throw R_THROW macro leads towards a return
* general: Resolve -Wunused-lambda-capture and C5233Morph2022-10-221-2/+2
|
* decoders: Use 2's complement instead of unary -Morph2022-10-221-1/+1
| | | | Resolves C4146 on MSVC
* Decoders: Improve overall speed.Fernando Sahmkow2022-10-061-4/+11
|
* DMA & InlineToMemory Engines Rework.bunnei2022-10-062-177/+81
|
* 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.
* video_core/textures/decoders: Avoid SWIZZLE_TABLEMerry2022-08-092-15/+48
|