Move initial GL state policy into renderer GL

This commit is contained in:
2026-06-03 05:35:39 +02:00
parent 8b12ae35d4
commit 692fe08d9f
7 changed files with 51 additions and 28 deletions

View File

@@ -45,36 +45,11 @@ namespace {
return static_cast<GLenum>(pp::renderer::gl::shading_language_version_string_name());
}
[[nodiscard]] GLenum depth_test_state() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::depth_test_state());
}
[[nodiscard]] GLenum scissor_test_state() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::scissor_test_state());
}
[[nodiscard]] GLenum source_alpha_blend_factor() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::source_alpha_blend_factor());
}
[[nodiscard]] GLenum one_minus_source_alpha_blend_factor() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::one_minus_source_alpha_blend_factor());
}
[[nodiscard]] GLenum add_blend_equation() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::add_blend_equation());
}
[[nodiscard]] GLenum max_blend_equation() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::max_blend_equation());
}
[[nodiscard]] GLint rgba8_internal_format() noexcept
{
return static_cast<GLint>(pp::renderer::gl::rgba8_internal_format());
@@ -414,10 +389,19 @@ void App::init()
// }
//}
glDisable(depth_test_state());
const auto initial_state = pp::renderer::gl::panopainter_initial_state();
if (initial_state.depth_test_enabled)
glEnable(static_cast<GLenum>(initial_state.depth_test_state));
else
glDisable(static_cast<GLenum>(initial_state.depth_test_state));
App::I->apply_render_platform_hints();
glBlendFunc(source_alpha_blend_factor(), one_minus_source_alpha_blend_factor());
glBlendEquationSeparate(add_blend_equation(), max_blend_equation());
glBlendFunc(
static_cast<GLenum>(initial_state.source_color_factor),
static_cast<GLenum>(initial_state.destination_color_factor));
glBlendEquationSeparate(
static_cast<GLenum>(initial_state.color_equation),
static_cast<GLenum>(initial_state.alpha_equation));
});
int run_counter = Settings::value<Serializer::Integer>("run_counter") + 1;