Share retained GL runtime dispatch adapters

This commit is contained in:
2026-06-06 10:51:46 +02:00
parent ab36af0a8f
commit 6c772a1c84
9 changed files with 64 additions and 61 deletions

View File

@@ -2,6 +2,7 @@
#include "log.h"
#include "font.h"
#include "legacy_gl_mesh_dispatch.h"
#include "legacy_ui_gl_dispatch.h"
#include "shader.h"
#include "asset.h"
#include "util.h"
@@ -24,20 +25,9 @@ namespace {
return static_cast<GLint>(pp::renderer::gl::texture_format_for_channel_count(1U).pixel_format);
}
void activate_texture_adapter(std::uint32_t texture_unit) noexcept
{
glActiveTexture(static_cast<GLenum>(texture_unit));
}
void activate_text_texture_unit(std::uint32_t unit_index)
{
const auto status = pp::renderer::gl::activate_opengl_texture_unit(
unit_index,
pp::renderer::gl::OpenGlActiveTextureDispatch {
.active_texture = activate_texture_adapter,
});
if (!status.ok())
LOG("Text active texture dispatch failed because: %s", status.message);
pp::legacy::ui_gl::activate_texture_unit(unit_index, "Text");
}
[[nodiscard]] std::span<const pp::renderer::gl::OpenGlVertexAttribute> text_mesh_vertex_attributes() noexcept