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

@@ -1,30 +1,14 @@
#include "pch.h"
#include "hmd.h"
#include "legacy_ui_gl_dispatch.h"
#include "log.h"
#include "renderer_gl/opengl_capabilities.h"
#include <array>
namespace {
void set_opengl_viewport(std::int32_t x, std::int32_t y, std::int32_t width, std::int32_t height) noexcept
{
glViewport(static_cast<GLint>(x), static_cast<GLint>(y), static_cast<GLsizei>(width), static_cast<GLsizei>(height));
}
void apply_hmd_viewport(std::int32_t x, std::int32_t y, std::int32_t width, std::int32_t height)
{
const auto status = pp::renderer::gl::apply_opengl_viewport(
pp::renderer::gl::OpenGlViewportRect {
.x = x,
.y = y,
.width = width,
.height = height,
},
pp::renderer::gl::OpenGlViewportDispatch {
.viewport = set_opengl_viewport,
});
if (!status.ok())
LOG("HMD viewport dispatch failed because: %s", status.message);
pp::legacy::ui_gl::apply_viewport(x, y, width, height, "HMD");
}
}