Share retained GL runtime dispatch adapters
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#include "platform_windows/windows_platform_services.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "legacy_gl_runtime_dispatch.h"
|
||||
#include "legacy_ui_gl_dispatch.h"
|
||||
#include "platform_api/network_tls_policy.h"
|
||||
#include "platform_api/platform_policy.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
@@ -84,11 +86,6 @@ void handle_gl_callback(
|
||||
}
|
||||
}
|
||||
|
||||
void enable_gl_capability(std::uint32_t state) noexcept
|
||||
{
|
||||
glEnable(static_cast<GLenum>(state));
|
||||
}
|
||||
|
||||
void show_cursor(bool visible)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(main_task_mutex);
|
||||
@@ -313,9 +310,7 @@ public:
|
||||
void acquire_render_context() override
|
||||
{
|
||||
async_lock();
|
||||
glBindFramebuffer(
|
||||
static_cast<GLenum>(pp::renderer::gl::framebuffer_target()),
|
||||
static_cast<GLuint>(pp::renderer::gl::default_framebuffer_id()));
|
||||
bind_default_render_target();
|
||||
}
|
||||
|
||||
void release_render_context() override
|
||||
@@ -330,8 +325,8 @@ public:
|
||||
|
||||
void bind_default_render_target() override
|
||||
{
|
||||
glBindFramebuffer(
|
||||
static_cast<GLenum>(pp::renderer::gl::framebuffer_target()),
|
||||
pp::legacy::ui_gl::bind_opengl_framebuffer(
|
||||
pp::renderer::gl::framebuffer_target(),
|
||||
pp::renderer::gl::default_framebuffer_id());
|
||||
}
|
||||
|
||||
@@ -344,7 +339,7 @@ public:
|
||||
{
|
||||
const auto status = pp::renderer::gl::apply_opengl_render_platform_hints(
|
||||
pp::renderer::gl::OpenGlRenderPlatformHintDispatch {
|
||||
.enable = enable_gl_capability,
|
||||
.enable = pp::legacy::ui_gl::enable_opengl_state,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("OpenGL render platform hints failed: %s", status.message);
|
||||
@@ -352,15 +347,15 @@ public:
|
||||
|
||||
void install_render_debug_callback() override
|
||||
{
|
||||
if (!glDebugMessageCallback)
|
||||
if (!pp::legacy::gl_runtime::has_opengl_debug_message_callback())
|
||||
return;
|
||||
|
||||
// colors: http://stackoverflow.com/questions/4053837/colorizing-text-in-the-console-with-c
|
||||
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &render_debug_console_info);
|
||||
glDebugMessageCallback(handle_gl_callback, nullptr);
|
||||
pp::legacy::gl_runtime::install_opengl_debug_message_callback(handle_gl_callback, nullptr);
|
||||
const auto status = pp::renderer::gl::apply_opengl_debug_output_states(
|
||||
pp::renderer::gl::OpenGlDebugOutputStateDispatch {
|
||||
.enable = enable_gl_capability,
|
||||
.enable = pp::legacy::ui_gl::enable_opengl_state,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("OpenGL debug output states failed: %s", status.message);
|
||||
|
||||
Reference in New Issue
Block a user