Compare commits

...

4 commits

Author SHA1 Message Date
acc93cb564 fix
All checks were successful
eden-license / license-header (pull_request) Successful in 27s
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2025-10-07 19:02:23 +02:00
8d8a68dc6d [core] use memcpy instead of hand rolling aligned cases
Hand rolling memcpy like this is always frowned upon because the compiler has more insight on whats going on (plus the code resolves to a worse version of itself on assembly). This removes some branches that are just straight up redundant. May save stuff especially for systems without fastmem enabled.

Signed-off-by: lizzie <lizzie@eden-emu.dev>
2025-10-07 19:02:23 +02:00
cf0628af46
[compat] improve thread naming logic (#271)
Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: #271
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
2025-10-07 06:38:22 +02:00
dbeae7add0
[vk, ogl] Add VK_QCOM ZTC, Bspline, Mitchell filter weights, add MMPX filter (#2577)
Adds native support for QCOM cubic filter weights, and for devices whom do not support said weights, just implement them in shaders

TODO: ZTC filter is wrong!?

Signed-off-by: lizzie <lizzie@eden-emu.dev>

Reviewed-on: #2577
Reviewed-by: crueter <crueter@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
2025-10-07 06:35:57 +02:00
23 changed files with 449 additions and 245 deletions

View file

@ -7,4 +7,4 @@ This handbook is primarily aimed at the end-user - baking useful knowledge for e
- **[The Basics](user/Basics.md)**
- **[Audio](user/Audio.md)**
- **[Graphics](user/Graphics.md)**
- **[Platforms and Architectures](user/Architectures.md)**
- **[Platforms and Architectures](user/Architectures.md)**

View file

@ -253,12 +253,16 @@
<item>@string/scaling_filter_nearest_neighbor</item>
<item>@string/scaling_filter_bilinear</item>
<item>@string/scaling_filter_bicubic</item>
<item>@string/scaling_filter_zero_tangent</item>
<item>@string/scaling_filter_bspline</item>
<item>@string/scaling_filter_mitchell</item>
<item>@string/scaling_filter_spline1</item>
<item>@string/scaling_filter_gaussian</item>
<item>@string/scaling_filter_lanczos</item>
<item>@string/scaling_filter_scale_force</item>
<item>@string/scaling_filter_fsr</item>
<item>@string/scaling_filter_area</item>
<item>@string/scaling_filter_mmpx</item>
</string-array>
<integer-array name="rendererScalingFilterValues">
@ -271,6 +275,10 @@
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
</integer-array>
<string-array name="rendererAntiAliasingNames">

View file

@ -1018,6 +1018,10 @@
<string name="scaling_filter_scale_force">ScaleForce</string>
<string name="scaling_filter_fsr">AMD FidelityFX™ Super Resolution</string>
<string name="scaling_filter_area">Area</string>
<string name="scaling_filter_zero_tangent">Zero-Tangent</string>
<string name="scaling_filter_bspline">B-Spline</string>
<string name="scaling_filter_mitchell">Mitchell</string>
<string name="scaling_filter_mmpx">MMPX</string>
<!-- Anti-Aliasing -->
<string name="anti_aliasing_none">None</string>

View file

@ -143,7 +143,7 @@ ENUM(ConfirmStop, Ask_Always, Ask_Based_On_Game, Ask_Never);
ENUM(FullscreenMode, Borderless, Exclusive);
ENUM(NvdecEmulation, Off, Cpu, Gpu);
ENUM(ResolutionSetup, Res1_4X, Res1_2X, Res3_4X, Res1X, Res5_4X, Res3_2X, Res2X, Res3X, Res4X, Res5X, Res6X, Res7X, Res8X);
ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, Spline1, Gaussian, Lanczos, ScaleForce, Fsr, Area, MaxEnum);
ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, ZeroTangent, BSpline, Mitchell, Spline1, Gaussian, Lanczos, ScaleForce, Fsr, Area, Mmpx, MaxEnum);
ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum);
ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch);
ENUM(ConsoleMode, Handheld, Docked);

View file

@ -1,6 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -18,9 +17,8 @@
#else
#if defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#include <pthread_np.h>
#else
#include <pthread.h>
#endif
#include <pthread.h>
#include <sched.h>
#endif
#ifndef _WIN32
@ -93,33 +91,35 @@ void SetCurrentThreadName(const char* name) {
#else // !MSVC_VER, so must be POSIX threads
// MinGW with the POSIX threading model does not support pthread_setname_np
#if !defined(_WIN32) || defined(_MSC_VER)
void SetCurrentThreadName(const char* name) {
// See for reference
// https://gitlab.freedesktop.org/mesa/mesa/-/blame/main/src/util/u_thread.c?ref_type=heads#L75
#ifdef __APPLE__
pthread_setname_np(name);
#elif defined(__HAIKU__)
rename_thread(find_thread(NULL), name);
#elif defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
pthread_set_name_np(pthread_self(), name);
#elif defined(__NetBSD__)
pthread_setname_np(pthread_self(), "%s", (void*)name);
#elif defined(__linux__)
// Linux limits thread names to 15 characters and will outright reject any
// attempt to set a longer name with ERANGE.
std::string truncated(name, (std::min)(strlen(name), static_cast<size_t>(15)));
if (int e = pthread_setname_np(pthread_self(), truncated.c_str())) {
errno = e;
LOG_ERROR(Common, "Failed to set thread name to '{}': {}", truncated, GetLastErrorMsg());
#elif defined(__linux__) || defined(__CYGWIN__) || defined(__sun__) || defined(__glibc__) || defined(__managarm__)
int ret = pthread_setname_np(pthread_self(), name);
if (ret == ERANGE) {
// Linux limits thread names to 15 characters and will outright reject any
// attempt to set a longer name with ERANGE.
char buf[16];
size_t const len = std::min<size_t>(std::strlen(name), sizeof(buf) - 1);
std::memcpy(buf, name, len);
buf[len] = '\0';
pthread_setname_np(pthread_self(), buf);
}
#elif !defined(_WIN32) || defined(_MSC_VER)
// mingw stub
(void)name;
#else
pthread_setname_np(pthread_self(), name);
#endif
}
#endif
#if defined(_WIN32)
void SetCurrentThreadName(const char* name) {
// Do Nothing on MingW
}
#endif
#endif

View file

@ -10,6 +10,7 @@
#include <mutex>
#include <span>
#include <thread>
#include <type_traits>
#include <vector>
#include "common/assert.h"
@ -681,22 +682,17 @@ struct Memory::Impl {
}
}
[[nodiscard]] u8* GetPointerImpl(u64 vaddr, auto on_unmapped, auto on_rasterizer) const {
template<typename F, typename G>
[[nodiscard]] u8* GetPointerImpl(u64 vaddr, F&& on_unmapped, G&& on_rasterizer) const {
// AARCH64 masks the upper 16 bit of all memory accesses
vaddr = vaddr & 0xffffffffffffULL;
if (!AddressSpaceContains(*current_page_table, vaddr, 1)) [[unlikely]] {
on_unmapped();
return nullptr;
} else {
vaddr &= 0xffffffffffffULL;
if (AddressSpaceContains(*current_page_table, vaddr, 1)) [[likely]] {
// Avoid adding any extra logic to this fast-path block
const uintptr_t raw_pointer = current_page_table->pointers[vaddr >> YUZU_PAGEBITS].Raw();
if (const uintptr_t pointer = Common::PageTable::PageInfo::ExtractPointer(raw_pointer)) {
if (const uintptr_t pointer = Common::PageTable::PageInfo::ExtractPointer(raw_pointer)) [[likely]] {
return reinterpret_cast<u8*>(pointer + vaddr);
} else {
switch (Common::PageTable::PageInfo::ExtractType(raw_pointer)) {
case Common::PageType::Unmapped:
on_unmapped();
return nullptr;
case Common::PageType::Memory:
ASSERT_MSG(false, "Mapped memory page without a pointer @ 0x{:016X}", vaddr);
return nullptr;
@ -707,11 +703,18 @@ struct Memory::Impl {
on_rasterizer();
return host_ptr;
}
case Common::PageType::Unmapped: [[unlikely]] {
on_unmapped();
return nullptr;
}
default:
UNREACHABLE();
}
return nullptr;
}
} else {
on_unmapped();
return nullptr;
}
}
@ -729,172 +732,38 @@ struct Memory::Impl {
GetInteger(vaddr), []() {}, []() {});
}
/**
* Reads a particular data type out of memory at the given virtual address.
*
* @param vaddr The virtual address to read the data type from.
*
* @tparam T The data type to read out of memory. This type *must* be
* trivially copyable, otherwise the behavior of this function
* is undefined.
*
* @returns The instance of T read from the specified virtual address.
*/
/// @brief Reads a particular data type out of memory at the given virtual address.
/// @param vaddr The virtual address to read the data type from.
/// @tparam T The data type to read out of memory.
/// @returns The instance of T read from the specified virtual address.
template <typename T>
T Read(Common::ProcessAddress vaddr) {
// Fast path for aligned reads of common sizes
inline T Read(Common::ProcessAddress vaddr) noexcept requires(std::is_trivially_copyable_v<T>) {
const u64 addr = GetInteger(vaddr);
if constexpr (std::is_same_v<T, u8> || std::is_same_v<T, s8>) {
// 8-bit reads are always aligned
const u8* const ptr = GetPointerImpl(
addr,
[addr]() {
LOG_ERROR(HW_Memory, "Unmapped Read8 @ 0x{:016X}", addr);
},
[&]() { HandleRasterizerDownload(addr, sizeof(T)); });
if (ptr) {
return static_cast<T>(*ptr);
}
return 0;
} else if constexpr (std::is_same_v<T, u16_le> || std::is_same_v<T, s16_le>) {
// Check alignment for 16-bit reads
if ((addr & 1) == 0) {
const u8* const ptr = GetPointerImpl(
addr,
[addr]() {
LOG_ERROR(HW_Memory, "Unmapped Read16 @ 0x{:016X}", addr);
},
[&]() { HandleRasterizerDownload(addr, sizeof(T)); });
if (ptr) {
return static_cast<T>(*reinterpret_cast<const u16*>(ptr));
}
}
} else if constexpr (std::is_same_v<T, u32_le> || std::is_same_v<T, s32_le>) {
// Check alignment for 32-bit reads
if ((addr & 3) == 0) {
const u8* const ptr = GetPointerImpl(
addr,
[addr]() {
LOG_ERROR(HW_Memory, "Unmapped Read32 @ 0x{:016X}", addr);
},
[&]() { HandleRasterizerDownload(addr, sizeof(T)); });
if (ptr) {
return static_cast<T>(*reinterpret_cast<const u32*>(ptr));
}
}
} else if constexpr (std::is_same_v<T, u64_le> || std::is_same_v<T, s64_le>) {
// Check alignment for 64-bit reads
if ((addr & 7) == 0) {
const u8* const ptr = GetPointerImpl(
addr,
[addr]() {
LOG_ERROR(HW_Memory, "Unmapped Read64 @ 0x{:016X}", addr);
},
[&]() { HandleRasterizerDownload(addr, sizeof(T)); });
if (ptr) {
return static_cast<T>(*reinterpret_cast<const u64*>(ptr));
}
}
}
// Fall back to the general case for other types or unaligned access
T result = 0;
const u8* const ptr = GetPointerImpl(
addr,
[addr]() {
LOG_ERROR(HW_Memory, "Unmapped Read{} @ 0x{:016X}", sizeof(T) * 8, addr);
},
[&]() { HandleRasterizerDownload(addr, sizeof(T)); });
if (ptr) {
if (auto const ptr = GetPointerImpl(addr, [addr]() {
LOG_ERROR(HW_Memory, "Unmapped Read{} @ 0x{:016X}", sizeof(T) * 8, addr);
}, [&]() {
HandleRasterizerDownload(addr, sizeof(T));
}); ptr) [[likely]] {
// It may be tempting to rewrite this particular section to use "reinterpret_cast";
// afterall, it's trivially copyable so surely it can be copied ov- Alignment.
// Remember, alignment. memcpy() will deal with all the alignment extremely fast.
T result{};
std::memcpy(&result, ptr, sizeof(T));
return result;
}
return result;
return T{};
}
/**
* Writes a particular data type to memory at the given virtual address.
*
* @param vaddr The virtual address to write the data type to.
*
* @tparam T The data type to write to memory. This type *must* be
* trivially copyable, otherwise the behavior of this function
* is undefined.
*/
/// @brief Writes a particular data type to memory at the given virtual address.
/// @param vaddr The virtual address to write the data type to.
/// @tparam T The data type to write to memory.
template <typename T>
void Write(Common::ProcessAddress vaddr, const T data) {
// Fast path for aligned writes of common sizes
inline void Write(Common::ProcessAddress vaddr, const T data) noexcept requires(std::is_trivially_copyable_v<T>) {
const u64 addr = GetInteger(vaddr);
if constexpr (std::is_same_v<T, u8> || std::is_same_v<T, s8>) {
// 8-bit writes are always aligned
u8* const ptr = GetPointerImpl(
addr,
[addr, data]() {
LOG_ERROR(HW_Memory, "Unmapped Write8 @ 0x{:016X} = 0x{:02X}", addr,
static_cast<u8>(data));
},
[&]() { HandleRasterizerWrite(addr, sizeof(T)); });
if (ptr) {
*ptr = static_cast<u8>(data);
}
return;
} else if constexpr (std::is_same_v<T, u16_le> || std::is_same_v<T, s16_le>) {
// Check alignment for 16-bit writes
if ((addr & 1) == 0) {
u8* const ptr = GetPointerImpl(
addr,
[addr, data]() {
LOG_ERROR(HW_Memory, "Unmapped Write16 @ 0x{:016X} = 0x{:04X}", addr,
static_cast<u16>(data));
},
[&]() { HandleRasterizerWrite(addr, sizeof(T)); });
if (ptr) {
*reinterpret_cast<u16*>(ptr) = static_cast<u16>(data);
return;
}
}
} else if constexpr (std::is_same_v<T, u32_le> || std::is_same_v<T, s32_le>) {
// Check alignment for 32-bit writes
if ((addr & 3) == 0) {
u8* const ptr = GetPointerImpl(
addr,
[addr, data]() {
LOG_ERROR(HW_Memory, "Unmapped Write32 @ 0x{:016X} = 0x{:08X}", addr,
static_cast<u32>(data));
},
[&]() { HandleRasterizerWrite(addr, sizeof(T)); });
if (ptr) {
*reinterpret_cast<u32*>(ptr) = static_cast<u32>(data);
return;
}
}
} else if constexpr (std::is_same_v<T, u64_le> || std::is_same_v<T, s64_le>) {
// Check alignment for 64-bit writes
if ((addr & 7) == 0) {
u8* const ptr = GetPointerImpl(
addr,
[addr, data]() {
LOG_ERROR(HW_Memory, "Unmapped Write64 @ 0x{:016X} = 0x{:016X}", addr,
static_cast<u64>(data));
},
[&]() { HandleRasterizerWrite(addr, sizeof(T)); });
if (ptr) {
*reinterpret_cast<u64*>(ptr) = static_cast<u64>(data);
return;
}
}
}
// Fall back to the general case for other types or unaligned access
u8* const ptr = GetPointerImpl(
addr,
[addr, data]() {
LOG_ERROR(HW_Memory, "Unmapped Write{} @ 0x{:016X} = 0x{:016X}", sizeof(T) * 8,
addr, static_cast<u64>(data));
},
[&]() { HandleRasterizerWrite(addr, sizeof(T)); });
if (ptr) {
if (auto const ptr = GetPointerImpl(addr, [addr, data]() {
LOG_ERROR(HW_Memory, "Unmapped Write{} @ 0x{:016X} = 0x{:016X}", sizeof(T) * 8, addr, u64(data));
}, [&]() { HandleRasterizerWrite(addr, sizeof(T)); }); ptr) [[likely]]
std::memcpy(ptr, &data, sizeof(T));
}
}
template <typename T>

View file

@ -555,12 +555,16 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QObject* parent)
PAIR(ScalingFilter, NearestNeighbor, tr("Nearest Neighbor")),
PAIR(ScalingFilter, Bilinear, tr("Bilinear")),
PAIR(ScalingFilter, Bicubic, tr("Bicubic")),
PAIR(ScalingFilter, ZeroTangent, tr("Zero-Tangent")),
PAIR(ScalingFilter, BSpline, tr("B-Spline")),
PAIR(ScalingFilter, Mitchell, tr("Mitchell")),
PAIR(ScalingFilter, Spline1, tr("Spline-1")),
PAIR(ScalingFilter, Gaussian, tr("Gaussian")),
PAIR(ScalingFilter, Lanczos, tr("Lanczos")),
PAIR(ScalingFilter, ScaleForce, tr("ScaleForce")),
PAIR(ScalingFilter, Fsr, tr("AMD FidelityFX™ Super Resolution")),
PAIR(ScalingFilter, Area, tr("Area")),
PAIR(ScalingFilter, Mmpx, tr("MMPX")),
}});
translations->insert({Settings::EnumMetadata<Settings::AntiAliasing>::Index(),
{

View file

@ -38,6 +38,9 @@ static const std::map<Settings::ScalingFilter, QString> scaling_filter_texts_map
{Settings::ScalingFilter::Bilinear,
QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Bilinear"))},
{Settings::ScalingFilter::Bicubic, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Bicubic"))},
{Settings::ScalingFilter::ZeroTangent, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Zero-Tangent"))},
{Settings::ScalingFilter::BSpline, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "B-Spline"))},
{Settings::ScalingFilter::Mitchell, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Mitchell"))},
{Settings::ScalingFilter::Spline1,
QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Spline-1"))},
{Settings::ScalingFilter::Gaussian,
@ -48,6 +51,7 @@ static const std::map<Settings::ScalingFilter, QString> scaling_filter_texts_map
QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "ScaleForce"))},
{Settings::ScalingFilter::Fsr, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "FSR"))},
{Settings::ScalingFilter::Area, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Area"))},
{Settings::ScalingFilter::Mmpx, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "MMPX"))},
};
static const std::map<Settings::ConsoleMode, QString> use_docked_mode_texts_map = {

View file

@ -44,9 +44,13 @@ set(SHADER_FILES
pitch_unswizzle.comp
present_area.frag
present_bicubic.frag
present_zero_tangent.frag
present_bspline.frag
present_mitchell.frag
present_gaussian.frag
present_lanczos.frag
present_spline1.frag
present_mmpx.frag
queries_prefix_scan_sum.comp
queries_prefix_scan_sum_nosubgroups.comp
resolve_conditional_render.comp

View file

@ -1,56 +1,37 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#version 460 core
layout (location = 0) in vec2 frag_tex_coord;
layout (location = 0) out vec4 color;
layout (binding = 0) uniform sampler2D color_texture;
vec4 cubic(float v) {
vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - v;
vec4 s = n * n * n;
float x = s.x;
float y = s.y - 4.0 * s.x;
float z = s.z - 4.0 * s.y + 6.0 * s.x;
float w = 6.0 - x - y - z;
return vec4(x, y, z, w) * (1.0 / 6.0);
vec4 cubic(float x) {
float x2 = x * x;
float x3 = x2 * x;
return vec4(1.0, x, x2, x3) * transpose(mat4x4(
0.0, 2.0, 0.0, 0.0,
-1.0, 0.0, 1.0, 0.0,
2.0, -5.0, 4.0, -1.0,
-1.0, 3.0, -3.0, 1.0
) * (1.0 / 2.0));
}
vec4 textureBicubic( sampler2D textureSampler, vec2 texCoords ) {
vec2 texSize = textureSize(textureSampler, 0);
vec2 invTexSize = 1.0 / texSize;
texCoords = texCoords * texSize - 0.5;
vec2 fxy = fract(texCoords);
texCoords -= fxy;
vec4 xcubic = cubic(fxy.x);
vec4 ycubic = cubic(fxy.y);
vec4 c = texCoords.xxyy + vec2(-0.5, +1.5).xyxy;
vec4 s = vec4(xcubic.xz + xcubic.yw, ycubic.xz + ycubic.yw);
vec4 offset = c + vec4(xcubic.yw, ycubic.yw) / s;
offset *= invTexSize.xxyy;
vec4 sample0 = texture(textureSampler, offset.xz);
vec4 sample1 = texture(textureSampler, offset.yz);
vec4 sample2 = texture(textureSampler, offset.xw);
vec4 sample3 = texture(textureSampler, offset.yw);
float sx = s.x / (s.x + s.y);
float sy = s.z / (s.z + s.w);
return mix(mix(sample3, sample2, sx), mix(sample1, sample0, sx), sy);
vec4 textureBicubic(sampler2D samp, vec2 uv) {
vec2 tex_size = vec2(textureSize(samp, 0));
vec2 cc_tex = uv * tex_size - 0.5f;
vec2 fex = cc_tex - floor(cc_tex);
vec4 xcubic = cubic(fex.x);
vec4 ycubic = cubic(fex.y);
vec4 c = floor(cc_tex).xxyy + vec2(-0.5f, 1.5f).xyxy;
vec4 z = vec4(xcubic.yw, ycubic.yw);
vec4 s = vec4(xcubic.xz, ycubic.xz) + z;
vec4 offset = (c + z / s) * (1.0f / tex_size).xxyy;
vec2 n = vec2(s.x / (s.x + s.y), s.z / (s.z + s.w));
return mix(
mix(texture(samp, offset.yw), texture(samp, offset.xw), n.x),
mix(texture(samp, offset.yz), texture(samp, offset.xz), n.x),
n.y);
}
void main() {
color = textureBicubic(color_texture, frag_tex_coord);
}

View file

@ -0,0 +1,35 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#version 460 core
layout (location = 0) in vec2 frag_tex_coord;
layout (location = 0) out vec4 color;
layout (binding = 0) uniform sampler2D color_texture;
vec4 cubic(float x) {
float x2 = x * x;
float x3 = x2 * x;
return vec4(1.0, x, x2, x3) * transpose(mat4x4(
1.0, 4.0, 1.0, 0.0,
-3.0, 0.0, 3.0, 0.0,
3.0, -6.0, 3.0, 0.0,
-1.0, 3.0, -3.0, 1.0
) * (1.0 / 6.0));
}
vec4 textureBicubic(sampler2D samp, vec2 uv) {
vec2 tex_size = vec2(textureSize(samp, 0));
vec2 cc_tex = uv * tex_size - 0.5f;
vec2 fex = cc_tex - floor(cc_tex);
vec4 xcubic = cubic(fex.x);
vec4 ycubic = cubic(fex.y);
vec4 c = floor(cc_tex).xxyy + vec2(-0.5f, 1.5f).xyxy;
vec4 z = vec4(xcubic.yw, ycubic.yw);
vec4 s = vec4(xcubic.xz, ycubic.xz) + z;
vec4 offset = (c + z / s) * (1.0f / tex_size).xxyy;
vec2 n = vec2(s.x / (s.x + s.y), s.z / (s.z + s.w));
return mix(
mix(texture(samp, offset.yw), texture(samp, offset.xw), n.x),
mix(texture(samp, offset.yz), texture(samp, offset.xz), n.x),
n.y);
}
void main() {
color = textureBicubic(color_texture, frag_tex_coord);
}

View file

@ -0,0 +1,35 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#version 460 core
layout (location = 0) in vec2 frag_tex_coord;
layout (location = 0) out vec4 color;
layout (binding = 0) uniform sampler2D color_texture;
vec4 cubic(float x) {
float x2 = x * x;
float x3 = x2 * x;
return vec4(1.0, x, x2, x3) * transpose(mat4x4(
1.0, 16.0, 1.0, 0.0,
-9.0, 0.0, 9.0, 0.0,
15.0, -36.0, 27.0, -6.0,
-7.0, 21.0, -21.0, 7.0
) * (1.0 / 18.0));
}
vec4 textureBicubic(sampler2D samp, vec2 uv) {
vec2 tex_size = vec2(textureSize(samp, 0));
vec2 cc_tex = uv * tex_size - 0.5f;
vec2 fex = cc_tex - floor(cc_tex);
vec4 xcubic = cubic(fex.x);
vec4 ycubic = cubic(fex.y);
vec4 c = floor(cc_tex).xxyy + vec2(-0.5f, 1.5f).xyxy;
vec4 z = vec4(xcubic.yw, ycubic.yw);
vec4 s = vec4(xcubic.xz, ycubic.xz) + z;
vec4 offset = (c + z / s) * (1.0f / tex_size).xxyy;
vec2 n = vec2(s.x / (s.x + s.y), s.z / (s.z + s.w));
return mix(
mix(texture(samp, offset.yw), texture(samp, offset.xw), n.x),
mix(texture(samp, offset.yz), texture(samp, offset.xz), n.x),
n.y);
}
void main() {
color = textureBicubic(color_texture, frag_tex_coord);
}

View file

@ -0,0 +1,131 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright 2023 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#version 460 core
layout(location = 0) in vec2 tex_coord;
layout(location = 0) out vec4 frag_color;
layout(binding = 0) uniform sampler2D tex;
#define src(x, y) texture(tex, coord + vec2(x, y) * 1.0 / source_size)
float luma(vec4 col) {
return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * (1.0 - col.a);
}
bool same(vec4 B, vec4 A0) {
return all(equal(B, A0));
}
bool notsame(vec4 B, vec4 A0) {
return any(notEqual(B, A0));
}
bool all_eq2(vec4 B, vec4 A0, vec4 A1) {
return (same(B,A0) && same(B,A1));
}
bool all_eq3(vec4 B, vec4 A0, vec4 A1, vec4 A2) {
return (same(B,A0) && same(B,A1) && same(B,A2));
}
bool all_eq4(vec4 B, vec4 A0, vec4 A1, vec4 A2, vec4 A3) {
return (same(B,A0) && same(B,A1) && same(B,A2) && same(B,A3));
}
bool any_eq3(vec4 B, vec4 A0, vec4 A1, vec4 A2) {
return (same(B,A0) || same(B,A1) || same(B,A2));
}
bool none_eq2(vec4 B, vec4 A0, vec4 A1) {
return (notsame(B,A0) && notsame(B,A1));
}
bool none_eq4(vec4 B, vec4 A0, vec4 A1, vec4 A2, vec4 A3) {
return (notsame(B,A0) && notsame(B,A1) && notsame(B,A2) && notsame(B,A3));
}
void main()
{
vec2 source_size = vec2(textureSize(tex, 0));
vec2 pos = fract(tex_coord * source_size) - vec2(0.5, 0.5);
vec2 coord = tex_coord - pos / source_size;
vec4 E = src(0.0,0.0);
vec4 A = src(-1.0,-1.0);
vec4 B = src(0.0,-1.0);
vec4 C = src(1.0,-1.0);
vec4 D = src(-1.0,0.0);
vec4 F = src(1.0,0.0);
vec4 G = src(-1.0,1.0);
vec4 H = src(0.0,1.0);
vec4 I = src(1.0,1.0);
vec4 J = E;
vec4 K = E;
vec4 L = E;
vec4 M = E;
frag_color = E;
if(same(E,A) && same(E,B) && same(E,C) && same(E,D) && same(E,F) && same(E,G) && same(E,H) && same(E,I)) return;
vec4 P = src(0.0,2.0);
vec4 Q = src(-2.0,0.0);
vec4 R = src(2.0,0.0);
vec4 S = src(0.0,2.0);
float Bl = luma(B);
float Dl = luma(D);
float El = luma(E);
float Fl = luma(F);
float Hl = luma(H);
if (((same(D,B) && notsame(D,H) && notsame(D,F))) && ((El>=Dl) || same(E,A)) && any_eq3(E,A,C,G) && ((El<Dl) || notsame(A,D) || notsame(E,P) || notsame(E,Q))) J=mix(D, J, 0.5);
if (((same(B,F) && notsame(B,D) && notsame(B,H))) && ((El>=Bl) || same(E,C)) && any_eq3(E,A,C,I) && ((El<Bl) || notsame(C,B) || notsame(E,P) || notsame(E,R))) K=mix(B, K, 0.5);
if (((same(H,D) && notsame(H,F) && notsame(H,B))) && ((El>=Hl) || same(E,G)) && any_eq3(E,A,G,I) && ((El<Hl) || notsame(G,H) || notsame(E,S) || notsame(E,Q))) L=mix(H, L, 0.5);
if (((same(F,H) && notsame(F,B) && notsame(F,D))) && ((El>=Fl) || same(E,I)) && any_eq3(E,C,G,I) && ((El<Fl) || notsame(I,H) || notsame(E,R) || notsame(E,S))) M=mix(F, M, 0.5);
if ((notsame(E,F) && all_eq4(E,C,I,D,Q) && all_eq2(F,B,H)) && notsame(F,src(3.0,0.0))) {M=mix(M, F, 0.5); K=mix(K, M, 0.5);};
if ((notsame(E,D) && all_eq4(E,A,G,F,R) && all_eq2(D,B,H)) && notsame(D,src(-3.0,0.0))) {L=mix(L, D, 0.5); J=mix(J, L, 0.5);};
if ((notsame(E,H) && all_eq4(E,G,I,B,P) && all_eq2(H,D,F)) && notsame(H,src(0.0,3.0))) {M=mix(M, H, 0.5); L=mix(L, M, 0.5);};
if ((notsame(E,B) && all_eq4(E,A,C,H,S) && all_eq2(B,D,F)) && notsame(B,src(0.0,-3.0))) {K=mix(K, B, 0.5); J=mix(J, K, 0.5);};
if ((Bl<El) && all_eq4(E,G,H,I,S) && none_eq4(E,A,D,C,F)) {K=mix(K, B, 0.5); J=mix(J, K, 0.5);}
if ((Hl<El) && all_eq4(E,A,B,C,P) && none_eq4(E,D,G,I,F)) {M=mix(M, H, 0.5); L=mix(L, M, 0.5);}
if ((Fl<El) && all_eq4(E,A,D,G,Q) && none_eq4(E,B,C,I,H)) {M=mix(M, F, 0.5); K=mix(K, M, 0.5);}
if ((Dl<El) && all_eq4(E,C,F,I,R) && none_eq4(E,B,A,G,H)) {L=mix(L, D, 0.5); J=mix(J, L, 0.5);}
if (notsame(H,B)) {
if (notsame(H,A) && notsame(H,E) && notsame(H,C)) {
if (all_eq3(H,G,F,R) && none_eq2(H,D,src(2.0,-1.0))) L=mix(M, L, 0.5);
if (all_eq3(H,I,D,Q) && none_eq2(H,F,src(-2.0,-1.0))) M=mix(L, M, 0.5);
}
if (notsame(B,I) && notsame(B,G) && notsame(B,E)) {
if (all_eq3(B,A,F,R) && none_eq2(B,D,src(2.0,1.0))) J=mix(K, L, 0.5);
if (all_eq3(B,C,D,Q) && none_eq2(B,F,src(-2.0,1.0))) K=mix(J, K, 0.5);
}
}
if (notsame(F,D)) {
if (notsame(D,I) && notsame(D,E) && notsame(D,C)) {
if (all_eq3(D,A,H,S) && none_eq2(D,B,src(1.0,2.0))) J=mix(L, J, 0.5);
if (all_eq3(D,G,B,P) && none_eq2(D,H,src(1.0,2.0))) L=mix(J, L, 0.5);
}
if (notsame(F,E) && notsame(F,A) && notsame(F,G)) {
if (all_eq3(F,C,H,S) && none_eq2(F,B,src(-1.0,2.0))) K=mix(M, K, 0.5);
if (all_eq3(F,I,B,P) && none_eq2(F,H,src(-1.0,-2.0))) M=mix(K, M, 0.5);
}
}
vec2 a = fract(tex_coord * source_size);
vec4 colour = (a.x < 0.5) ? (a.y < 0.5 ? J : L) : (a.y < 0.5 ? K : M);
frag_color = colour;
}

View file

@ -0,0 +1,35 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#version 460 core
layout (location = 0) in vec2 frag_tex_coord;
layout (location = 0) out vec4 color;
layout (binding = 0) uniform sampler2D color_texture;
vec4 cubic(float x) {
float x2 = x * x;
float x3 = x2 * x;
return vec4(1.0, x, x2, x3) * transpose(mat4x4(
0.0, 2.0, 0.0, 0.0,
-2.0, 0.0, 2.0, 0.0,
4.0, -4.0, 2.0, -2.0,
-2.0, 2.0, -2.0, 1.0
) * (1.0 / 2.0));
}
vec4 textureBicubic(sampler2D samp, vec2 uv) {
vec2 tex_size = vec2(textureSize(samp, 0));
vec2 cc_tex = uv * tex_size - 0.5f;
vec2 fex = cc_tex - floor(cc_tex);
vec4 xcubic = cubic(fex.x);
vec4 ycubic = cubic(fex.y);
vec4 c = floor(cc_tex).xxyy + vec2(-0.5f, 1.5f).xyxy;
vec4 z = vec4(xcubic.yw, ycubic.yw);
vec4 s = vec4(xcubic.xz, ycubic.xz) + z;
vec4 offset = (c + z / s) * (1.0f / tex_size).xxyy;
vec2 n = vec2(s.x / (s.x + s.y), s.z / (s.z + s.w));
return mix(
mix(texture(samp, offset.yw), texture(samp, offset.xw), n.x),
mix(texture(samp, offset.yz), texture(samp, offset.xz), n.x),
n.y);
}
void main() {
color = textureBicubic(color_texture, frag_tex_coord);
}

View file

@ -8,6 +8,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/settings.h"
#include "common/settings_enums.h"
#include "video_core/present.h"
#include "video_core/renderer_opengl/gl_blit_screen.h"
#include "video_core/renderer_opengl/gl_state_tracker.h"
@ -86,6 +87,15 @@ void BlitScreen::CreateWindowAdapt() {
case Settings::ScalingFilter::Bicubic:
window_adapt = MakeBicubic(device);
break;
case Settings::ScalingFilter::ZeroTangent:
window_adapt = MakeZeroTangent(device);
break;
case Settings::ScalingFilter::BSpline:
window_adapt = MakeBSpline(device);
break;
case Settings::ScalingFilter::Mitchell:
window_adapt = MakeMitchell(device);
break;
case Settings::ScalingFilter::Gaussian:
window_adapt = MakeGaussian(device);
break;
@ -101,6 +111,9 @@ void BlitScreen::CreateWindowAdapt() {
case Settings::ScalingFilter::Area:
window_adapt = MakeArea(device);
break;
case Settings::ScalingFilter::Mmpx:
window_adapt = MakeMmpx(device);
break;
case Settings::ScalingFilter::Fsr:
case Settings::ScalingFilter::Bilinear:
default:

View file

@ -14,6 +14,10 @@
#include "video_core/host_shaders/present_gaussian_frag.h"
#include "video_core/host_shaders/present_lanczos_frag.h"
#include "video_core/host_shaders/present_spline1_frag.h"
#include "video_core/host_shaders/present_mitchell_frag.h"
#include "video_core/host_shaders/present_bspline_frag.h"
#include "video_core/host_shaders/present_zero_tangent_frag.h"
#include "video_core/host_shaders/present_mmpx_frag.h"
#include "video_core/renderer_opengl/present/filters.h"
#include "video_core/renderer_opengl/present/util.h"
@ -39,6 +43,21 @@ std::unique_ptr<WindowAdaptPass> MakeBicubic(const Device& device) {
HostShaders::PRESENT_BICUBIC_FRAG);
}
std::unique_ptr<WindowAdaptPass> MakeMitchell(const Device& device) {
return std::make_unique<WindowAdaptPass>(device, CreateBilinearSampler(),
HostShaders::PRESENT_MITCHELL_FRAG);
}
std::unique_ptr<WindowAdaptPass> MakeZeroTangent(const Device& device) {
return std::make_unique<WindowAdaptPass>(device, CreateBilinearSampler(),
HostShaders::PRESENT_ZERO_TANGENT_FRAG);
}
std::unique_ptr<WindowAdaptPass> MakeBSpline(const Device& device) {
return std::make_unique<WindowAdaptPass>(device, CreateBilinearSampler(),
HostShaders::PRESENT_BSPLINE_FRAG);
}
std::unique_ptr<WindowAdaptPass> MakeGaussian(const Device& device) {
return std::make_unique<WindowAdaptPass>(device, CreateBilinearSampler(),
HostShaders::PRESENT_GAUSSIAN_FRAG);
@ -60,4 +79,9 @@ std::unique_ptr<WindowAdaptPass> MakeArea(const Device& device) {
HostShaders::PRESENT_AREA_FRAG);
}
std::unique_ptr<WindowAdaptPass> MakeMmpx(const Device& device) {
return std::make_unique<WindowAdaptPass>(device, CreateNearestNeighborSampler(),
HostShaders::PRESENT_MMPX_FRAG);
}
} // namespace OpenGL

View file

@ -17,10 +17,14 @@ namespace OpenGL {
std::unique_ptr<WindowAdaptPass> MakeNearestNeighbor(const Device& device);
std::unique_ptr<WindowAdaptPass> MakeBilinear(const Device& device);
std::unique_ptr<WindowAdaptPass> MakeBicubic(const Device& device);
std::unique_ptr<WindowAdaptPass> MakeZeroTangent(const Device& device);
std::unique_ptr<WindowAdaptPass> MakeMitchell(const Device& device);
std::unique_ptr<WindowAdaptPass> MakeBSpline(const Device& device);
std::unique_ptr<WindowAdaptPass> MakeGaussian(const Device& device);
std::unique_ptr<WindowAdaptPass> MakeSpline1(const Device& device);
std::unique_ptr<WindowAdaptPass> MakeLanczos(const Device& device);
std::unique_ptr<WindowAdaptPass> MakeScaleForce(const Device& device);
std::unique_ptr<WindowAdaptPass> MakeArea(const Device& device);
std::unique_ptr<WindowAdaptPass> MakeMmpx(const Device& device);
} // namespace OpenGL

View file

@ -7,6 +7,8 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <vulkan/vulkan_core.h>
#include "common/assert.h"
#include "common/common_types.h"
#include "video_core/host_shaders/present_area_frag_spv.h"
@ -14,6 +16,10 @@
#include "video_core/host_shaders/present_gaussian_frag_spv.h"
#include "video_core/host_shaders/present_lanczos_frag_spv.h"
#include "video_core/host_shaders/present_spline1_frag_spv.h"
#include "video_core/host_shaders/present_mitchell_frag_spv.h"
#include "video_core/host_shaders/present_bspline_frag_spv.h"
#include "video_core/host_shaders/present_zero_tangent_frag_spv.h"
#include "video_core/host_shaders/present_mmpx_frag_spv.h"
#include "video_core/host_shaders/vulkan_present_frag_spv.h"
#include "video_core/host_shaders/vulkan_present_scaleforce_fp16_frag_spv.h"
#include "video_core/host_shaders/vulkan_present_scaleforce_fp32_frag_spv.h"
@ -52,13 +58,28 @@ std::unique_ptr<WindowAdaptPass> MakeSpline1(const Device& device, VkFormat fram
BuildShader(device, PRESENT_SPLINE1_FRAG_SPV));
}
std::unique_ptr<WindowAdaptPass> MakeBicubic(const Device& device, VkFormat frame_format) {
std::unique_ptr<WindowAdaptPass> MakeBicubic(const Device& device, VkFormat frame_format, VkCubicFilterWeightsQCOM qcom_weights) {
// No need for handrolled shader -- if the VK impl can do it for us ;)
if (device.IsExtFilterCubicSupported())
return std::make_unique<WindowAdaptPass>(device, frame_format, CreateCubicSampler(device),
BuildShader(device, VULKAN_PRESENT_FRAG_SPV));
return std::make_unique<WindowAdaptPass>(device, frame_format, CreateBilinearSampler(device),
BuildShader(device, PRESENT_BICUBIC_FRAG_SPV));
// Catmull-Rom is default bicubic for all implementations...
if (device.IsExtFilterCubicSupported() && (device.IsQcomFilterCubicWeightsSupported() || qcom_weights == VK_CUBIC_FILTER_WEIGHTS_CATMULL_ROM_QCOM)) {
return std::make_unique<WindowAdaptPass>(device, frame_format, CreateCubicSampler(device,
qcom_weights), BuildShader(device, VULKAN_PRESENT_FRAG_SPV));
} else {
return std::make_unique<WindowAdaptPass>(device, frame_format, CreateBilinearSampler(device), [&](){
switch (qcom_weights) {
case VK_CUBIC_FILTER_WEIGHTS_CATMULL_ROM_QCOM:
return BuildShader(device, PRESENT_BICUBIC_FRAG_SPV);
case VK_CUBIC_FILTER_WEIGHTS_ZERO_TANGENT_CARDINAL_QCOM:
return BuildShader(device, PRESENT_ZERO_TANGENT_FRAG_SPV);
case VK_CUBIC_FILTER_WEIGHTS_B_SPLINE_QCOM:
return BuildShader(device, PRESENT_BSPLINE_FRAG_SPV);
case VK_CUBIC_FILTER_WEIGHTS_MITCHELL_NETRAVALI_QCOM:
return BuildShader(device, PRESENT_MITCHELL_FRAG_SPV);
default:
UNREACHABLE();
}
}());
}
}
std::unique_ptr<WindowAdaptPass> MakeGaussian(const Device& device, VkFormat frame_format) {
@ -81,4 +102,9 @@ std::unique_ptr<WindowAdaptPass> MakeArea(const Device& device, VkFormat frame_f
BuildShader(device, PRESENT_AREA_FRAG_SPV));
}
std::unique_ptr<WindowAdaptPass> MakeMmpx(const Device& device, VkFormat frame_format) {
return std::make_unique<WindowAdaptPass>(device, frame_format, CreateNearestNeighborSampler(device),
BuildShader(device, PRESENT_MMPX_FRAG_SPV));
}
} // namespace Vulkan

View file

@ -17,11 +17,12 @@ class MemoryAllocator;
std::unique_ptr<WindowAdaptPass> MakeNearestNeighbor(const Device& device, VkFormat frame_format);
std::unique_ptr<WindowAdaptPass> MakeBilinear(const Device& device, VkFormat frame_format);
std::unique_ptr<WindowAdaptPass> MakeBicubic(const Device& device, VkFormat frame_format);
std::unique_ptr<WindowAdaptPass> MakeBicubic(const Device& device, VkFormat frame_format, VkCubicFilterWeightsQCOM qcom_weights);
std::unique_ptr<WindowAdaptPass> MakeSpline1(const Device& device, VkFormat frame_format);
std::unique_ptr<WindowAdaptPass> MakeGaussian(const Device& device, VkFormat frame_format);
std::unique_ptr<WindowAdaptPass> MakeLanczos(const Device& device, VkFormat frame_format);
std::unique_ptr<WindowAdaptPass> MakeScaleForce(const Device& device, VkFormat frame_format);
std::unique_ptr<WindowAdaptPass> MakeArea(const Device& device, VkFormat frame_format);
std::unique_ptr<WindowAdaptPass> MakeMmpx(const Device& device, VkFormat frame_format);
} // namespace Vulkan

View file

@ -624,8 +624,8 @@ vk::Sampler CreateNearestNeighborSampler(const Device& device) {
return device.GetLogical().CreateSampler(ci_nn);
}
vk::Sampler CreateCubicSampler(const Device& device) {
const VkSamplerCreateInfo ci_nn{
vk::Sampler CreateCubicSampler(const Device& device, VkCubicFilterWeightsQCOM qcom_weights) {
VkSamplerCreateInfo ci_nn{
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
@ -645,7 +645,14 @@ vk::Sampler CreateCubicSampler(const Device& device) {
.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK,
.unnormalizedCoordinates = VK_FALSE,
};
const VkSamplerCubicWeightsCreateInfoQCOM ci_qcom_nn{
.sType = VK_STRUCTURE_TYPE_SAMPLER_CUBIC_WEIGHTS_CREATE_INFO_QCOM,
.pNext = nullptr,
.cubicWeights = qcom_weights
};
// If not specified, assume Catmull-Rom
if (qcom_weights != VK_CUBIC_FILTER_WEIGHTS_CATMULL_ROM_QCOM)
ci_nn.pNext = &ci_qcom_nn;
return device.GetLogical().CreateSampler(ci_nn);
}

View file

@ -57,7 +57,7 @@ VkWriteDescriptorSet CreateWriteDescriptorSet(std::vector<VkDescriptorImageInfo>
VkDescriptorSet set, u32 binding);
vk::Sampler CreateBilinearSampler(const Device& device);
vk::Sampler CreateNearestNeighborSampler(const Device& device);
vk::Sampler CreateCubicSampler(const Device& device);
vk::Sampler CreateCubicSampler(const Device& device, VkCubicFilterWeightsQCOM qcom_weights);
void BeginRenderPass(vk::CommandBuffer& cmdbuf, VkRenderPass render_pass, VkFramebuffer framebuffer,
VkExtent2D extent);

View file

@ -7,6 +7,7 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <vulkan/vulkan_core.h>
#include "video_core/framebuffer_config.h"
#include "video_core/present.h"
#include "video_core/renderer_vulkan/present/filters.h"
@ -41,7 +42,16 @@ void BlitScreen::SetWindowAdaptPass() {
window_adapt = MakeNearestNeighbor(device, swapchain_view_format);
break;
case Settings::ScalingFilter::Bicubic:
window_adapt = MakeBicubic(device, swapchain_view_format);
window_adapt = MakeBicubic(device, swapchain_view_format, VK_CUBIC_FILTER_WEIGHTS_CATMULL_ROM_QCOM);
break;
case Settings::ScalingFilter::ZeroTangent:
window_adapt = MakeBicubic(device, swapchain_view_format, VK_CUBIC_FILTER_WEIGHTS_ZERO_TANGENT_CARDINAL_QCOM);
break;
case Settings::ScalingFilter::BSpline:
window_adapt = MakeBicubic(device, swapchain_view_format, VK_CUBIC_FILTER_WEIGHTS_B_SPLINE_QCOM);
break;
case Settings::ScalingFilter::Mitchell:
window_adapt = MakeBicubic(device, swapchain_view_format, VK_CUBIC_FILTER_WEIGHTS_MITCHELL_NETRAVALI_QCOM);
break;
case Settings::ScalingFilter::Spline1:
window_adapt = MakeSpline1(device, swapchain_view_format);
@ -58,6 +68,9 @@ void BlitScreen::SetWindowAdaptPass() {
case Settings::ScalingFilter::Area:
window_adapt = MakeArea(device, swapchain_view_format);
break;
case Settings::ScalingFilter::Mmpx:
window_adapt = MakeMmpx(device, swapchain_view_format);
break;
case Settings::ScalingFilter::Fsr:
case Settings::ScalingFilter::Bilinear:
default:

View file

@ -89,7 +89,8 @@ VK_DEFINE_HANDLE(VmaAllocator)
EXTENSION(NV, VIEWPORT_ARRAY2, viewport_array2) \
EXTENSION(NV, VIEWPORT_SWIZZLE, viewport_swizzle) \
EXTENSION(EXT, DESCRIPTOR_INDEXING, descriptor_indexing) \
EXTENSION(EXT, FILTER_CUBIC, filter_cubic)
EXTENSION(EXT, FILTER_CUBIC, filter_cubic) \
EXTENSION(QCOM, FILTER_CUBIC_WEIGHTS, filter_cubic_weights)
// Define extensions which must be supported.
#define FOR_EACH_VK_MANDATORY_EXTENSION(EXTENSION_NAME) \
@ -558,6 +559,11 @@ public:
return extensions.filter_cubic;
}
/// Returns true if the device supports VK_QCOM_filter_cubic_weights
bool IsQcomFilterCubicWeightsSupported() const {
return extensions.filter_cubic_weights;
}
/// Returns true if the device supports VK_EXT_line_rasterization.
bool IsExtLineRasterizationSupported() const {
return extensions.line_rasterization;