Move convert GL state into renderer backend

This commit is contained in:
2026-06-04 20:27:43 +02:00
parent 51601adf6d
commit 967a15f15f
8 changed files with 172 additions and 25 deletions

View File

@@ -3,6 +3,7 @@
#include "app.h"
#include "app_core/document_platform_io.h"
#include "log.h"
#include "platform_api/network_tls_policy.h"
#include "renderer_gl/opengl_capabilities.h"
@@ -57,6 +58,11 @@ void invoke_picked_path_if_selected(
callback(path);
}
void enable_gl_capability(std::uint32_t state) noexcept
{
glEnable(static_cast<GLenum>(state));
}
// DEBT-0017: fallback for platforms that do not inject PlatformServices yet.
class LegacyPlatformServices final : public pp::platform::PlatformServices {
public:
@@ -259,8 +265,12 @@ public:
void apply_render_platform_hints() override
{
#if defined(__OSX__)
glEnable(static_cast<GLenum>(pp::renderer::gl::program_point_size_state()));
glEnable(static_cast<GLenum>(pp::renderer::gl::line_smooth_state()));
const auto status = pp::renderer::gl::apply_opengl_render_platform_hints(
pp::renderer::gl::OpenGlRenderPlatformHintDispatch {
.enable = enable_gl_capability,
});
if (!status.ok())
LOG("OpenGL legacy render platform hints failed: %s", status.message);
#endif
}