mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-20 06:08:56 +02:00
[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: https://git.eden-emu.dev/eden-emu/eden/pulls/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>
This commit is contained in:
parent
62369aa2d5
commit
dbeae7add0
21 changed files with 395 additions and 60 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue