mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-04-18 18:50:50 -04:00
feat: Add Lanczos
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/frontend/framebuffer_layout.h"
|
#include "core/frontend/framebuffer_layout.h"
|
||||||
@@ -12,6 +13,7 @@
|
|||||||
#include "video_core/renderer_vulkan/vk_shader_util.h"
|
#include "video_core/renderer_vulkan/vk_shader_util.h"
|
||||||
#include "video_core/vulkan_common/vulkan_device.h"
|
#include "video_core/vulkan_common/vulkan_device.h"
|
||||||
#include "video_core/vulkan_common/vulkan_memory_allocator.h"
|
#include "video_core/vulkan_common/vulkan_memory_allocator.h"
|
||||||
|
#include "common/settings.h"
|
||||||
|
|
||||||
namespace Vulkan {
|
namespace Vulkan {
|
||||||
|
|
||||||
@@ -92,8 +94,16 @@ void WindowAdaptPass::Draw(RasterizerVulkan& rasterizer, Scheduler& scheduler, s
|
|||||||
|
|
||||||
for (size_t i = 0; i < layer_count; i++) {
|
for (size_t i = 0; i < layer_count; i++) {
|
||||||
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipelines[i]);
|
cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipelines[i]);
|
||||||
cmdbuf.PushConstants(graphics_pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT,
|
cmdbuf.PushConstants(graphics_pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT, 0,
|
||||||
push_constants[i]);
|
sizeof(PresentPushConstants), &push_constants[i]);
|
||||||
|
|
||||||
|
|
||||||
|
if (Settings::values.scaling_filter.GetValue() == Settings::ScalingFilter::Lanczos) {
|
||||||
|
const s32 lanczos_a = Settings::values.lanczos_quality.GetValue();
|
||||||
|
cmdbuf.PushConstants(graphics_pipeline_layout, VK_SHADER_STAGE_FRAGMENT_BIT,
|
||||||
|
sizeof(PresentPushConstants), sizeof(s32), &lanczos_a);
|
||||||
|
}
|
||||||
|
|
||||||
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipeline_layout, 0,
|
cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipeline_layout, 0,
|
||||||
descriptor_sets[i], {});
|
descriptor_sets[i], {});
|
||||||
cmdbuf.Draw(4, 1, 0, 0);
|
cmdbuf.Draw(4, 1, 0, 0);
|
||||||
@@ -117,20 +127,31 @@ void WindowAdaptPass::CreateDescriptorSetLayout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WindowAdaptPass::CreatePipelineLayout() {
|
void WindowAdaptPass::CreatePipelineLayout() {
|
||||||
const VkPushConstantRange range{
|
|
||||||
|
std::array<VkPushConstantRange, 2> ranges{};
|
||||||
|
|
||||||
|
// Range 0: The existing constants for the Vertex Shader
|
||||||
|
ranges[0] = {
|
||||||
.stageFlags = VK_SHADER_STAGE_VERTEX_BIT,
|
.stageFlags = VK_SHADER_STAGE_VERTEX_BIT,
|
||||||
.offset = 0,
|
.offset = 0,
|
||||||
.size = sizeof(PresentPushConstants),
|
.size = sizeof(PresentPushConstants),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Range 1: Our new constant for the Fragment Shader
|
||||||
|
ranges[1] = {
|
||||||
|
.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT,
|
||||||
|
.offset = sizeof(PresentPushConstants),
|
||||||
|
.size = sizeof(s32),
|
||||||
|
};
|
||||||
|
|
||||||
pipeline_layout = device.GetLogical().CreatePipelineLayout(VkPipelineLayoutCreateInfo{
|
pipeline_layout = device.GetLogical().CreatePipelineLayout(VkPipelineLayoutCreateInfo{
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.setLayoutCount = 1,
|
.setLayoutCount = 1,
|
||||||
.pSetLayouts = descriptor_set_layout.address(),
|
.pSetLayouts = descriptor_set_layout.address(),
|
||||||
.pushConstantRangeCount = 1,
|
.pushConstantRangeCount = static_cast<u32>(ranges.size()),
|
||||||
.pPushConstantRanges = &range,
|
.pPushConstantRanges = ranges.data(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user