Route VR UI viewport scissor through renderer GL

This commit is contained in:
2026-06-03 05:59:36 +02:00
parent 155e67fcec
commit 7dcf76c3aa
3 changed files with 50 additions and 6 deletions

View File

@@ -463,9 +463,9 @@ Known local toolchain state:
policy and dispatch application consumed by `App::init`, tested runtime policy and dispatch application consumed by `App::init`, tested runtime
version/vendor/renderer/GLSL string query dispatch, tested default clear version/vendor/renderer/GLSL string query dispatch, tested default clear
color/buffer dispatch consumed by `App::clear`, tested app UI color/buffer dispatch consumed by `App::clear`, tested app UI
viewport/scissor dispatch consumed by `App::draw`, plus renderer API to viewport/scissor dispatch consumed by `App::draw` and `App::vr_draw_ui`,
OpenGL token mapping and command-planning contracts used by the OpenGL parity plus renderer API to OpenGL token mapping and command-planning contracts used
work. by the OpenGL parity work.
- `pano_cli plan-cloud-upload` exposes `pp_app_core` cloud upload availability, - `pano_cli plan-cloud-upload` exposes `pp_app_core` cloud upload availability,
new-document warning, publish prompt, and save-before-upload planning as JSON; new-document warning, publish prompt, and save-before-upload planning as JSON;
the live cloud upload command consumes the same start contract before the live cloud upload command consumes the same start contract before

View File

@@ -528,6 +528,9 @@ Main app UI viewport and scissor execution now dispatch through tested
`pp_renderer_gl` viewport/scissor contracts, leaving `App::draw` and UI node `pp_renderer_gl` viewport/scissor contracts, leaving `App::draw` and UI node
clipping to provide rectangles while the backend owns scissor-state tokens and clipping to provide rectangles while the backend owns scissor-state tokens and
the live OpenGL call sequence. the live OpenGL call sequence.
VR UI framebuffer viewport and scissor-test setup now also consumes those
`pp_renderer_gl` contracts, keeping desktop and VR UI rendering aligned while
the retained OpenVR app path is split incrementally.
Windows RenderDoc frame capture hooks now also dispatch through Windows RenderDoc frame capture hooks now also dispatch through
`PlatformServices`, keeping capture integration in the platform service while `PlatformServices`, keeping capture integration in the platform service while
leaving non-Windows adapters as no-ops. leaving non-Windows adapters as no-ops.

View File

@@ -24,6 +24,44 @@ void unbind_texture_2d()
glBindTexture(pp::renderer::gl::texture_2d_target(), 0); glBindTexture(pp::renderer::gl::texture_2d_target(), 0);
} }
void enable_opengl_state(std::uint32_t state) noexcept
{
glEnable(static_cast<GLenum>(state));
}
void disable_opengl_state(std::uint32_t state) noexcept
{
glDisable(static_cast<GLenum>(state));
}
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_vr_ui_viewport(pp::renderer::gl::OpenGlViewportRect viewport)
{
const auto status = pp::renderer::gl::apply_opengl_viewport(
viewport,
pp::renderer::gl::OpenGlViewportDispatch {
.viewport = set_opengl_viewport,
});
if (!status.ok())
LOG("OpenGL VR UI viewport failed: %s", status.message);
}
void apply_vr_ui_scissor_test(bool enabled)
{
const auto status = pp::renderer::gl::apply_opengl_scissor_test(
enabled,
pp::renderer::gl::OpenGlScissorTestDispatch {
.enable = enable_opengl_state,
.disable = disable_opengl_state,
});
if (!status.ok())
LOG("OpenGL VR UI scissor test failed: %s", status.message);
}
} }
bool trigger_down = false; bool trigger_down = false;
@@ -55,13 +93,16 @@ void App::vr_draw_ui()
{ {
uirtt.bindFramebuffer(); uirtt.bindFramebuffer();
uirtt.clear(); uirtt.clear();
glViewport(0, 0, uirtt.getWidth(), uirtt.getHeight()); apply_vr_ui_viewport(pp::renderer::gl::OpenGlViewportRect {
glEnable(pp::renderer::gl::scissor_test_state()); .width = static_cast<std::int32_t>(uirtt.getWidth()),
.height = static_cast<std::int32_t>(uirtt.getHeight()),
});
apply_vr_ui_scissor_test(true);
auto observer = std::bind(&App::update_ui_observer, this, std::placeholders::_1); auto observer = std::bind(&App::update_ui_observer, this, std::placeholders::_1);
for (int i = 1; i < layout[main_id]->m_children.size(); i++) for (int i = 1; i < layout[main_id]->m_children.size(); i++)
layout[main_id]->m_children[i]->watch(observer); layout[main_id]->m_children[i]->watch(observer);
//msgbox->watch(observer); //msgbox->watch(observer);
glDisable(pp::renderer::gl::scissor_test_state()); apply_vr_ui_scissor_test(false);
uirtt.unbindFramebuffer(); uirtt.unbindFramebuffer();
} }