aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan/blit_image.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/nx2' into fe-fsr31Duck91229 hours1-0/+1
|\ | | | | | | | | | | # Conflicts: # src/video_core/renderer_vulkan/blit_image.cpp # src/video_core/renderer_vulkan/blit_image.h
| * nx2: decode sRGB in the upscale fallback when the program doesTakoroka45 hours1-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Splatoon Raiders' upscaler program ends by decoding its result from sRGB to linear (HSETP2 against 0.04045, HMUL2 by 2.4 between MUFU.LG2 and MUFU.EX2) before its surface store. The bilinear copy that stands in for it while HMMA isn't emulated wrote the sRGB input as-is, so the later passes encoded it a second time: outdoor scenes were washed out, with a pale sky and a white haze. When the program carries those two immediates, the copy now decodes like it, through a new copy operation of the blit helper (a fragment shader with the piecewise sRGB decode). Programs without them, such as Kirby Air Riders' upscaler, keep the plain copy. The OpenGL backend ignores the operation.
* | video_core: sharpen the temporal DLSS stand-inDuck91231 hours1-5/+20
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fire Emblem: Fortune's Weave's DLSS input matches Eden's (same 720p image, same detail), but the stand-in's 1440p output was blurrier than a plain bilinear 2x of it (Laplacian 0.0066 vs 0.0081; Eden's real DLSS 0.0111), and the image drifted darker over time: - the sample kernel was about twice too wide for the output resolution; - the history was kept in the output's B10G11R11 format, whose 5-6 bit mantissas round away a frame's 0.03-0.1 share; - the 1-sigma neighbourhood clip removed detail that only some jitter positions sample (railings, thin edges). The history is now an RGBA16F pair the shader writes as a storage image, with no per-frame copy. Still pixels use a third of the kernel width and a 1.5-sigma clip, so detail from many jitter positions accumulates. Moving pixels keep the old kernel and 1-sigma clip, and so do pixels that moved recently or whose history falls far outside the neighbourhood (content that changes without motion vectors), remembered in the history's alpha. Static output goes from 0.0066 to 0.0102 with no brightness drift and no new ghosting. With resolution scaling the stand-in used to fall back to a bilinear blit. The images are now scaled up as BlitImage does, the jitter is scaled to host pixels and the history follows the framebuffer's render area. RCAS (temporal_sharpen.frag) sharpens a copy of each result, never the history, in range-compressed space since the output is HDR. Its strength is the sharpness slider, relabelled "RCAS Sharpness" (0% turns it off). EDEN_NX2_TEMPORAL_KERNEL, _CLIP, _KERNEL_MOTION, _CLIP_MOTION and _WEIGHT tune the filter (all four filter values at 1 give the old one), and EDEN_NX2_TEMPORAL_SHARPEN=<stops>|off overrides the slider. Assisted-by: Claude Opus 5.5 (debugging, implementation and drafting) Signed-off-by: Duck912 <350528965+Duck912@users.noreply.github.com>
* video_core: temporal upscale stand-in for Fortune's Weave's DLSSDuck9122 days1-0/+15
| | | | | | | | | | | | | | | | | The one-frame blit left 3D edges aliased and shaking: the game jitters its camera every frame for DLSS to accumulate. Fire Emblem: Fortune's Weave's first DLSS pass (also rejected) has the motion vectors (cbuf0+0x290, R16G16) and the frame's jitter (+0x1b0/+0x1b4, in input pixels). Kepler compute keeps them, and the stand-in for the last network pass now draws temporal_upscale.frag: input samples placed where the jitter put them and weighted by distance, blended with the previous result reprojected along the motion vectors (Catmull-Rom) and clipped to the 3x3 neighbourhood in YCoCg. The history is copied from the result right after drawing it, so post-processing the game later applies to its output does not feed back. EDEN_NX2_TEMPORAL_UPSCALE=0 restores the blit. Assisted-by: Claude Opus 5.5 (debugging, implementation and drafting) Signed-off-by: Duck912 <350528965+Duck912@users.noreply.github.com>
* [vulkan] Adjustments on MSAA and BlitHelpers (#4287)crueter2026-08-231-0/+71
| | | | | | | | | | | | | | | PR/Commit Owner: CamilleLaVey This PR contains changes complementary to the MSAA refactor from some weeks ago, adds proper shader convert to depth, stencil for msaa and non msaa convertions; removes redundant helpers and unify paths on the resolve functions, just to make the readability and maintainability better; includes fixes for the blit operations on Nvidia, Intel/Windows (previously banned) and ensures Linux retain the fix without extra burden; fixes the QCOM driver bug on resolution upscaling on any games above x1 (includes turnip on A8xx series) and fixes crashes/ resolution upscaled bugs on certain games that used to have wrong viewporting effect on screen or directly device loss on Vulkan. Adds fixes for regressions caused by previous MSAA refactor on games as Fire Emblem: Engage. Special Thanks 1.- Big Smolio (@Gidoly) Co-authored-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4287 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Samuel <lizzie@eden-emu.dev>
* [vulkan] 4th Vulkan Global Maintenance (#4212)CamilleLaVey2026-07-161-0/+57
| | | | | | | | | | The approach on this PR moves around refactoring/ updating residual work; main issue was the whole logic behind msaa upload/download images with the constant image copy per pass required; which was gated via shaderStorageImageMultisample, which is not available on all the platforms supported including Android, making them to rely into a more heavier approach to convert msaa image copy into a non msaa image copy, not only losing precision in the conversion, but also creating bugs around the resolve of the image itself, if the supported path had to copy 2 times the same image to be actually presentable, when the fallback was enabled 3 copies were performed, not only decreasing the performance but also increasing race conditions due to the certain capabilities processed in this chain (storage_views). In order to resolve them more naturally, the constant copies were removed from the now "common" path along establishing a proper color resolve for Android and actually making them more direct. Yet this opened a new pack of outdated handling on our current backend; since we now pass msaa images more directly (whenever a game request a msaa type of image/ which seems to be not common + each fragment resolves images on how it's actually required, adding missing depth/stencil), how we often load and store them becomes a critical issue, since our current configuration renderpass/framebuffer forces to always load and load clear whenever a new attachment it's passing through the renderpass, making this really heavier on memory bandwidth limited devices as SteamDeck and others that doesn't rely on the inmediate rendering mode (Tilers vs iGPU); to prevent over allocating data, I had to re-structure part of the current renderpass and framebuffer to actually reuse part of the data/ attachments called, with flags as DON'T_CARE, simplifying partially on how we actually call attachments including their barriers and conditions (occlusion, etc), the DON'T_CARE it's specifically useful to not only prevent calling new loads (which is a flush and heavier on tiler devices) and not only reusing the actual data store, which works on the future time, this saves memory bandwidth and gives space to actually avoid the constant pressure on SYSMEM/GMEM shader resolver path. This maintenance also improved the current removal features logic on QCOM drivers, closing gaps between implementations on descriptors (VK_EXT_indexing_descriptor), adjusting the whole WMEL to avoid being so stricter if certain capabilities are missing to actually use this feature, leading to test and play more on how QCOM drivers are actually behaving; meanwhile the main objective is to open path for a robust and bigger implementation in the future, the changes made here also contains small bug fixes on SPIR-V logic, adding missing cases to resolve shaders (FP64 -> FP16), adding more robustness on how narrow features are actually being used and how to wired them whenever they're not available, meanwhile there are still some issues in regards on how Tegra vs Adreno can preserve unorms at FP32 and FP16, leaving better understanding on base for what VK_EXT_shader_float_controls is actually doing most of the times (flushes NaN's and Denorms equally). Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4212
* [vk] remove unused vk_texture_manager.cpp and unused shader conversions (#3432)lizzie2026-01-311-31/+1
| | | | | | | | | | | | | - Trivial dead code removal, also these shaders are useless TODO: maybe in a future do YUV280 or whatever in shader for vic :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3432 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: DraVee <dravee@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [vk] Implement Shader Read Barrier (#2671)Ribbit2025-10-041-5/+8
| | | | | | | | | | | Adding the shader read barrier keeps every render/compute/transfer write visible before the image is sampled, so it prevents the “read-before-writes-finish” hazards. Without it you can get random stale frames, flickering post process passes, partially updated HUD textures, and corrupted depth-to-color conversions especially in scenes that render into an offscreen image and immediately feed that image to a shader (reflections, bloom, dynamic resolution, depth visualizers, etc.). This fix makes those R2T chains deterministic again across all Vulkan drivers. Co-authored-by: Ribbit <ribbit@placeholder.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2671 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: Ribbit <ribbit@eden-emu.dev> Co-committed-by: Ribbit <ribbit@eden-emu.dev>
* Some fixes before Release (#92)MrPurple6662025-05-081-1/+0
| | | | | Co-authored-by: MrPurple666 <antoniosacramento666@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/92
* video_core: Add new shader format conversion pipelinesZephyron2025-04-111-0/+25
| | | | | | | | | | | | | | | | | | | | | | | Adds several new shader-based format conversion pipelines to support additional texture formats and operations: - RGBA8 to BGRA8 conversion - YUV420/RGB conversions - BC7 to RGBA8 decompression - ASTC HDR to RGBA16F decompression - RGBA16F to RGBA8 conversion - Temporal dithering - Dynamic resolution scaling Updates the texture cache runtime to handle these new conversion paths and adds helper functions to check format compatibility for dithering and scaling operations. The changes include: - New shader files and CMake entries - Additional conversion pipeline setup in BlitImageHelper - Extended format conversion logic in TextureCacheRuntime - New format compatibility check helpers
* video_core: Add sRGB to D24S8 depth-stencil conversion supportZephyron2025-04-111-0/+5
| | | | | | | | | | | | | | | Implements conversion from sRGB color formats to D24S8 depth-stencil format in the Vulkan renderer. This change includes: - New fragment shader convert_abgr8_srgb_to_d24s8.frag that handles proper sRGB to linear conversion before depth calculation - Added shader to CMake build system - Extended BlitImageHelper with new conversion pipeline and methods - Updated texture cache to handle sRGB to D24S8 format conversion paths The conversion properly handles sRGB color space by first converting to linear space before calculating luminance values for the depth component, while preserving alpha channel data for the stencil component.
* Changes based on hardware testsSquall-Leonhart2023-10-171-4/+0
| | | | | | Removes unnecessary d32f to bgra shader and blit functions, update vk_texture_cache to use abgr shader for d32f to BGRA formats updates abgr to d32f shader to comply with hardware tests
* Another missing copy connected to Bravely Default IISquall-Leonhart2023-10-161-0/+4
| | | | adds blit_image_helper.ConvertABGR8ToD32F and fragment shader for performing ABGR and BGRA to D32F copies
* Implement missing formats for Bravely Default 2Squall-Leonhart2023-10-151-0/+4
|
* Implements D32_Float to A8B8G8R8_UNORM format copySquall-Leonhart2023-10-041-0/+4
| | | | Corrects some visual issues in games such as Disney SpeedStorm
* Masked depthstencil clearsKelebek12023-08-191-0/+19
|
* video_core: Implement vulkan clear specified channelFengChen2023-01-281-0/+10
|
* Address feedbackFeng Chen2023-01-161-2/+2
|
* video_core: Implement opengl/vulkan draw_textureFeng Chen2023-01-051-0/+6
|
* video_core: Replace VKScheduler with Schedulergerman772022-06-261-3/+3
|
* general: Convert source file copyright comments over to SPDXMorph2022-04-231-3/+2
| | | | | This formats all copyright comments according to SPDX formatting guidelines. Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
* video_core: Reduce unused includesameerj2022-03-191-2/+0
|
* Vulkan: convert S8D24 <-> ABGR8Liam2022-03-151-0/+4
|
* blit_image: Remove unused functionameerj2021-12-231-3/+0
|
* blit_image: Refactor upscale factors usageameerj2021-12-051-14/+8
| | | | The image view itself can be queried to see if it is being rescaled or not, removing the need to pass the upscale/down shift factors from the texture cache.
* blit_image: Refactor ConvertPipeline functionsameerj2021-12-051-0/+2
|
* blit_image: Refactor ConvertPipelineEx functionsameerj2021-12-051-2/+5
| | | | reduces much of the duplication between the color/depth variants
* Revert "Merge pull request #7395 from Morph1984/resolve-comments"ameerj2021-12-051-3/+0
| | | | | This reverts commit 0442db9ad629520f0d7e5ae4803246fefa1f3645, reversing changes made to 15212de85a0dec537197d50d365e998c8106ab79.
* Merge pull request #7396 from FernandoS27/blit-this-mfFernando S2021-11-281-21/+4
|\ | | | | TextureCache: Eliminate format deduction as full depth conversion has been supported.
| * TextureCache: Simplify blitting of D24S8 formats and fix bugs.Fernando Sahmkow2021-11-221-21/+4
| |
* | vk_blit_image: Consolidate CreatePipelineTargetEx functionsMorph2021-11-201-0/+3
|/
* TextureCache: Add R16G16 to D24S8 converter.Fernando Sahmkow2021-11-201-0/+5
|
* TextureCache: Add B10G11R11 to D24S8 converter.Fernando Sahmkow2021-11-191-2/+10
|
* TextureCache: Implement additional D24S8 convertions.Fernando Sahmkow2021-11-191-0/+10
|
* Vulkan: implement D24S8 <-> RGBA8 convertions.Fernando Sahmkow2021-11-191-0/+16
|
* Vulkan: Fix Blit Depth StencilFernando Sahmkow2021-11-161-3/+4
|
* Texture Cache: Rescale conversions between depth and colorFernandoS272021-11-161-5/+9
|
* vk_texture_cache: Use 3D to scale images when blit is unsupportedameerj2021-11-161-1/+1
|
* vulkan: Rework descriptor allocation algorithmReinUsesLisp2021-07-221-1/+1
| | | | | | Create multiple descriptor pools on demand. There are some degrees of freedom what is considered a compatible pool to avoid wasting large pools on small descriptors.
* texture_cache: Handle out of bound texture blitsameerj2021-05-071-6/+4
| | | | Some games interleave a texture blit using regions which are out-of-bounds. This addresses the interleaving to avoid oob reads from the src texture.
* renderer_vulkan: Rename VKDevice to DeviceReinUsesLisp2021-01-031-6/+5
| | | | | | | The "VK" prefix predates the "Vulkan" namespace. It was carried around the codebase for consistency. "VKDevice" currently is a bad alias with "VkDevice" (only an upcase character of difference) that can cause confusion. Rename all instances of it.
* vulkan_common: Rename renderer_vulkan/wrapper.h to ↵ReinUsesLisp2020-12-311-1/+1
| | | | | | vulkan_common/vulkan_wrapper.h Allows sharing Vulkan wrapper code between different rendering backends.
* video_core: Rewrite the texture cacheReinUsesLisp2020-12-301-0/+97
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.