Share retained app UI GL dispatch

This commit is contained in:
2026-06-05 15:19:10 +02:00
parent 96d1903cf2
commit 26470e0fe8
7 changed files with 74 additions and 135 deletions

View File

@@ -2,39 +2,20 @@
#include "app_core/command_convert.h"
#include "app.h"
#include "canvas.h"
#include "legacy_ui_gl_dispatch.h"
#include "log.h"
#include "renderer_gl/opengl_capabilities.h"
namespace {
void enable_opengl_state(std::uint32_t state) noexcept
{
glEnable(static_cast<GLenum>(state));
}
void disable_opengl_state(std::uint32_t state) noexcept
{
glDisable(static_cast<GLenum>(state));
}
void set_opengl_blend_func(std::uint32_t source_factor, std::uint32_t destination_factor) noexcept
{
glBlendFunc(static_cast<GLenum>(source_factor), static_cast<GLenum>(destination_factor));
}
void set_opengl_blend_equation(std::uint32_t equation) noexcept
{
glBlendEquation(static_cast<GLenum>(equation));
}
void apply_convert_command_state()
{
const auto status = pp::renderer::gl::apply_panopainter_convert_command_state(
pp::renderer::gl::OpenGlConvertCommandStateDispatch {
.enable = enable_opengl_state,
.disable = disable_opengl_state,
.blend_func = set_opengl_blend_func,
.blend_equation = set_opengl_blend_equation,
.enable = pp::legacy::ui_gl::enable_opengl_state,
.disable = pp::legacy::ui_gl::disable_opengl_state,
.blend_func = pp::legacy::ui_gl::set_opengl_blend_func,
.blend_equation = pp::legacy::ui_gl::set_opengl_blend_equation,
});
if (!status.ok())
LOG("OpenGL convert command state failed: %s", status.message);