Move sampler parameter mapping to renderer gl

This commit is contained in:
2026-06-01 18:13:55 +02:00
parent f1e2743d58
commit 8130a922d0
6 changed files with 78 additions and 12 deletions

View File

@@ -304,11 +304,12 @@ void Sampler::set(GLint filter /*= GL_LINEAR*/, GLint wrap /*= GL_CLAMP_TO_EDGE*
App::I->render_task([=]
{
#if USE_SAMPLER
glSamplerParameteri(id, GL_TEXTURE_WRAP_S, wrap);
glSamplerParameteri(id, GL_TEXTURE_WRAP_T, wrap);
glSamplerParameteri(id, GL_TEXTURE_WRAP_R, wrap);
glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, filter);
glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, filter);
for (const auto parameter : pp::renderer::gl::sampler_parameters_for_filter_wrap(
static_cast<std::uint32_t>(filter),
static_cast<std::uint32_t>(wrap)))
{
glSamplerParameteri(id, static_cast<GLenum>(parameter.name), static_cast<GLint>(parameter.value));
}
#endif // USE_SAMPLER
});
}
@@ -317,8 +318,12 @@ void Sampler::set_filter(GLint filter_min, GLint filter_mag)
App::I->render_task([=]
{
#if USE_SAMPLER
glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, filter_min);
glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, filter_mag);
for (const auto parameter : pp::renderer::gl::sampler_filter_parameters(
static_cast<std::uint32_t>(filter_min),
static_cast<std::uint32_t>(filter_mag)))
{
glSamplerParameteri(id, static_cast<GLenum>(parameter.name), static_cast<GLint>(parameter.value));
}
#endif // USE_SAMPLER
});
}