feat: Add Lanczos

This commit is contained in:
collecting
2025-10-06 02:13:55 +00:00
parent 5785ae746e
commit 41fc8ee272

View File

@@ -64,10 +64,10 @@ void WindowAdaptPass::DrawToFramebuffer(ProgramManager& program_manager, std::li
glViewportIndexedf(0, 0.0f, 0.0f, static_cast<GLfloat>(layout.width), glViewportIndexedf(0, 0.0f, 0.0f, static_cast<GLfloat>(layout.width),
static_cast<GLfloat>(layout.height)); static_cast<GLfloat>(layout.height));
glEnableVertexAttribArray(PositionLocation);
glEnableVertexAttribArray(TexCoordLocation);
glVertexAttribDivisor(PositionLocation, 0); glVertexAttribDivisor(PositionLocation, 0);
glVertexAttribDivisor(TexCoordLocation, 0); glVertexAttribDivisor(TexCoordLocation, 0);
glEnableVertexAttribArray(PositionLocation);
glEnableVertexAttribArray(TexCoordLocation);
glVertexAttribFormat(PositionLocation, 2, GL_FLOAT, GL_FALSE, glVertexAttribFormat(PositionLocation, 2, GL_FLOAT, GL_FALSE,
offsetof(ScreenRectVertex, position)); offsetof(ScreenRectVertex, position));
glVertexAttribFormat(TexCoordLocation, 2, GL_FLOAT, GL_FALSE, glVertexAttribFormat(TexCoordLocation, 2, GL_FLOAT, GL_FALSE,
@@ -84,7 +84,6 @@ void WindowAdaptPass::DrawToFramebuffer(ProgramManager& program_manager, std::li
glBindSampler(0, sampler.handle); glBindSampler(0, sampler.handle);
// Update background color before drawing
glClearColor(Settings::values.bg_red.GetValue() / 255.0f, glClearColor(Settings::values.bg_red.GetValue() / 255.0f,
Settings::values.bg_green.GetValue() / 255.0f, Settings::values.bg_green.GetValue() / 255.0f,
Settings::values.bg_blue.GetValue() / 255.0f, 1.0f); Settings::values.bg_blue.GetValue() / 255.0f, 1.0f);
@@ -107,6 +106,11 @@ void WindowAdaptPass::DrawToFramebuffer(ProgramManager& program_manager, std::li
break; break;
} }
if (Settings::values.scaling_filter.GetValue() == Settings::ScalingFilter::Lanczos) {
glProgramUniform1i(frag.handle, 0, Settings::values.lanczos_quality.GetValue());
}
glBindTextureUnit(0, textures[i]); glBindTextureUnit(0, textures[i]);
glProgramUniformMatrix3x2fv(vert.handle, ModelViewMatrixLocation, 1, GL_FALSE, glProgramUniformMatrix3x2fv(vert.handle, ModelViewMatrixLocation, 1, GL_FALSE,
matrices[i].data()); matrices[i].data());