dont multiply shit randomly, just premult the texcoord to scale :)

This commit is contained in:
lizzie 2026-01-24 11:35:51 +00:00
parent f5da8df578
commit dee9634db9
3 changed files with 27 additions and 41 deletions

View file

@ -3,11 +3,15 @@
#version 450
layout( push_constant ) uniform constants {
highp vec4 ViewportInfo[1];
highp vec2 ResizeFactor;
};
layout(location = 0) out highp vec2 texcoord;
void main() {
float x = float((gl_VertexIndex & 1) << 2);
float y = float((gl_VertexIndex & 2) << 1);
gl_Position = vec4(x - 1.0f, y - 1.0f, 0.0, 1.0f);
texcoord = vec2(x, y) / 2.0;
texcoord = vec2(x, y) * ResizeFactor * 0.5;
}

View file

@ -17,7 +17,7 @@
namespace Vulkan {
using PushConstants = std::array<u32, 4>;
using PushConstants = std::array<u32, 4 + 2>;
SGSR::SGSR(const Device& device, MemoryAllocator& memory_allocator, size_t image_count, VkExtent2D extent, bool edge_dir)
: m_device{device}, m_memory_allocator{memory_allocator}
@ -110,6 +110,8 @@ VkImageView SGSR::Draw(Scheduler& scheduler, size_t image_index, VkImage source_
viewport_con[1] = std::bit_cast<u32>(1.f / viewport_height);
viewport_con[2] = std::bit_cast<u32>(viewport_width);
viewport_con[3] = std::bit_cast<u32>(viewport_height);
viewport_con[4] = std::bit_cast<u32>(viewport_width / input_image_width);
viewport_con[5] = std::bit_cast<u32>(viewport_height / input_image_height);
UploadImages(scheduler);
UpdateDescriptorSets(source_image_view, image_index);