From 60dc5c7206c2f6c7922c97435c57176e33a9c569 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sat, 24 Jan 2026 09:01:32 +0000 Subject: [PATCH] edgedir fix --- .patch/sgsr/0001-fix-glsl.patch | 21 +++++++++++++++---- .../renderer_vulkan/present/sgsr.cpp | 3 +-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.patch/sgsr/0001-fix-glsl.patch b/.patch/sgsr/0001-fix-glsl.patch index 37bb823572..3fd8c531a1 100644 --- a/.patch/sgsr/0001-fix-glsl.patch +++ b/.patch/sgsr/0001-fix-glsl.patch @@ -88,7 +88,7 @@ index 7074999..9e2122e 100644 float mean = (left.y+left.z+right.x+right.w)*0.25; left = left - vec4(mean); diff --git a/sgsr/v1/include/glsl/sgsr1_shader_mobile_edge_direction.frag b/sgsr/v1/include/glsl/sgsr1_shader_mobile_edge_direction.frag -index d2df646..91a8d4d 100644 +index d2df646..3e4f5cd 100644 --- a/sgsr/v1/include/glsl/sgsr1_shader_mobile_edge_direction.frag +++ b/sgsr/v1/include/glsl/sgsr1_shader_mobile_edge_direction.frag @@ -1,4 +1,4 @@ @@ -97,7 +97,20 @@ index d2df646..91a8d4d 100644 //============================================================================================================ // -@@ -50,7 +50,7 @@ uniform highp vec4 ViewportInfo[1]; +@@ -40,17 +40,16 @@ precision highp int; + //////////////////////// + + #if defined(UseUniformBlock) +-layout (set=0, binding = 0) uniform UniformBlock +-{ +- highp vec4 ViewportInfo[1]; ++layout( push_constant ) uniform constants { ++ highp vec4 ViewportInfo[1]; + }; +-layout(set = 0, binding = 1) uniform mediump sampler2D ps0; ++layout(set = 0, binding = 0) uniform mediump sampler2D ps0; + #else + uniform highp vec4 ViewportInfo[1]; uniform mediump sampler2D ps0; #endif @@ -106,7 +119,7 @@ index d2df646..91a8d4d 100644 layout(location=0) out vec4 out_Target0; float fastLanczos2(float x) -@@ -98,11 +98,15 @@ vec2 edgeDirection(vec4 left, vec4 right) +@@ -98,11 +97,15 @@ vec2 edgeDirection(vec4 left, vec4 right) void main() { @@ -124,7 +137,7 @@ index d2df646..91a8d4d 100644 highp float xCenter; xCenter = abs(in_TEXCOORD0.x+-0.5); -@@ -116,18 +120,21 @@ void main() +@@ -116,18 +119,21 @@ void main() highp vec2 imgCoord = ((in_TEXCOORD0.xy*ViewportInfo[0].zw)+vec2(-0.5,0.5)); highp vec2 imgCoordPixel = floor(imgCoord); highp vec2 coord = (imgCoordPixel*ViewportInfo[0].xy); diff --git a/src/video_core/renderer_vulkan/present/sgsr.cpp b/src/video_core/renderer_vulkan/present/sgsr.cpp index e4cb5dbb4c..3dda457b7f 100644 --- a/src/video_core/renderer_vulkan/present/sgsr.cpp +++ b/src/video_core/renderer_vulkan/present/sgsr.cpp @@ -41,7 +41,7 @@ SGSR::SGSR(const Device& device, MemoryAllocator& memory_allocator, size_t image ? BuildShader(m_device, SGSR1_SHADER_MOBILE_EDGE_DIRECTION_FRAG_SPV) : BuildShader(m_device, SGSR1_SHADER_MOBILE_FRAG_SPV); // 2 descriptors, 2 descriptor sets per invocation - m_descriptor_pool = CreateWrappedDescriptorPool(m_device, 2 * m_image_count, 2 * m_image_count); + m_descriptor_pool = CreateWrappedDescriptorPool(m_device, SGSR_STAGE_COUNT * m_image_count, SGSR_STAGE_COUNT * m_image_count); m_descriptor_set_layout = CreateWrappedDescriptorSetLayout(m_device, {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER}); std::vector layouts(SGSR_STAGE_COUNT, *m_descriptor_set_layout); @@ -72,7 +72,6 @@ void SGSR::UpdateDescriptorSets(VkImageView image_view, size_t image_index) { std::vector updates; image_infos.reserve(1); updates.push_back(CreateWriteDescriptorSet(image_infos, *m_sampler, image_view, images.descriptor_sets[0], 0)); - updates.push_back(CreateWriteDescriptorSet(image_infos, *m_sampler, *images.image_views[0], images.descriptor_sets[1], 0)); m_device.GetLogical().UpdateDescriptorSets(updates, {}); }