[vulkan] add native cubic filtering (#88)

Co-authored-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/88

This implements the use of VK_FILTER_CUBIC_EXT as a replacement for the software-based bicubic window adapting filter, used primarily for texture sampling in upscaled or downscaled surfaces such as UI, transparency effects, and screen-space elements in Unreal Engine 4 titles.

The Vulkan cubic filter is now conditionally enabled if the following are satisfied:

The device supports VK_EXT_filter_cubic

The format used supports VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT

This change improves visual quality while reducing GPU workload by offloading cubic filtering to the driver instead of running custom sampling code in shaders. On supported hardware (e.g. desktop GPUs or high-end Adreno/AMD devices), it results in smoother transitions, improved transparency sampling, and better fidelity with lower shader complexity.

Fallback to the original software bicubic logic remains in place for devices lacking the extension or format capability.

Tested on several UE4 titles and confirmed to preserve or enhance visual output, especially in alpha-blended and UI-heavy scenes.
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2025-07-22 20:49:00 +02:00 committed by crueter
parent 8d86b615d5
commit b66adfe04c
Signed by: crueter
GPG key ID: 425ACD2D4830EBC6
5 changed files with 50 additions and 4 deletions

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -85,7 +88,8 @@ VK_DEFINE_HANDLE(VmaAllocator)
EXTENSION(NV, GEOMETRY_SHADER_PASSTHROUGH, geometry_shader_passthrough) \
EXTENSION(NV, VIEWPORT_ARRAY2, viewport_array2) \
EXTENSION(NV, VIEWPORT_SWIZZLE, viewport_swizzle) \
EXTENSION(EXT, DESCRIPTOR_INDEXING, descriptor_indexing)
EXTENSION(EXT, DESCRIPTOR_INDEXING, descriptor_indexing) \
EXTENSION(EXT, FILTER_CUBIC, filter_cubic)
// Define extensions which must be supported.
#define FOR_EACH_VK_MANDATORY_EXTENSION(EXTENSION_NAME) \
@ -549,6 +553,11 @@ public:
return dynamic_state3_enables;
}
/// Returns true if the device supports VK_EXT_filter_cubic
bool IsExtFilterCubicSupported() const {
return extensions.filter_cubic;
}
/// Returns true if the device supports VK_EXT_line_rasterization.
bool IsExtLineRasterizationSupported() const {
return extensions.line_rasterization;