Share retained GL runtime dispatch adapters
This commit is contained in:
20
src/hmd.cpp
20
src/hmd.cpp
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user