Route VR texture state through GL dispatch

This commit is contained in:
2026-06-04 23:54:15 +02:00
parent 3cd1d46025
commit c514ac99aa
4 changed files with 30 additions and 9 deletions

View File

@@ -437,8 +437,8 @@ Known local toolchain state:
counts so automation can assert backend interpretation without an OpenGL counts so automation can assert backend interpretation without an OpenGL
context. context.
Desktop VR drawing also consumes backend-owned scissor/depth/blend state, Desktop VR drawing also consumes backend-owned scissor/depth/blend state,
blend/depth state query-restore, depth clear masks, active texture units, blend/depth state query-restore, depth clear masks, active texture unit
and fallback 2D texture unbind targets; VR SDK start/stop now dispatches dispatch, and fallback 2D texture unbind dispatch; VR SDK start/stop now dispatches
through `PlatformServices` while retaining the existing Windows OpenVR bridge through `PlatformServices` while retaining the existing Windows OpenVR bridge
shape. shape.
Canvas mode overlay, mask, and transform paths also consume backend-owned Canvas mode overlay, mask, and transform paths also consume backend-owned

View File

@@ -23,7 +23,9 @@ agent or engineer to remove them without reconstructing context from chat.
tested `pp_renderer_gl` capability-state dispatch; CanvasLayer equirect tested `pp_renderer_gl` capability-state dispatch; CanvasLayer equirect
export now binds cube textures through tested `pp_renderer_gl` dispatch; and export now binds cube textures through tested `pp_renderer_gl` dispatch; and
`Font` text drawing now activates texture units through tested `Font` text drawing now activates texture units through tested
`pp_renderer_gl` dispatch. The debt remains open for live stroke `pp_renderer_gl` dispatch. Desktop VR drawing also now routes active texture
unit switches and fallback 2D texture unbinds through tested `pp_renderer_gl`
dispatch. The debt remains open for live stroke
rasterization, dual-brush compositing, pattern feedback math, thumbnail layer rasterization, dual-brush compositing, pattern feedback math, thumbnail layer
compositing, brush-preview compositing, and retained `ShaderManager::ext_*` compositing, brush-preview compositing, and retained `ShaderManager::ext_*`
compatibility fields. compatibility fields.

View File

@@ -798,9 +798,10 @@ VR UI framebuffer viewport and scissor-test setup now also consumes those
`pp_renderer_gl` contracts, keeping desktop and VR UI rendering aligned while `pp_renderer_gl` contracts, keeping desktop and VR UI rendering aligned while
the retained OpenVR app path is split incrementally. the retained OpenVR app path is split incrementally.
VR draw blend/depth state snapshots, transitions, restore, and depth-buffer VR draw blend/depth state snapshots, transitions, restore, and depth-buffer
clears now use generic tested `pp_renderer_gl` capability query/apply and clear clears, active texture unit switches, and fallback 2D texture unbinds now use
dispatch contracts, reducing direct OpenGL execution in the retained VR app generic tested `pp_renderer_gl` capability query/apply, clear, active-texture,
path without changing state restore behavior. and texture-bind dispatch contracts, reducing direct OpenGL execution in the
retained VR app path without changing state restore behavior.
The retained `gl_state` save/restore utility now snapshots and restores through The retained `gl_state` save/restore utility now snapshots and restores through
tested `pp_renderer_gl` saved-state dispatch contracts, covering capability tested `pp_renderer_gl` saved-state dispatch contracts, covering capability
state, viewport, clear color, framebuffer/program bindings, active texture, state, viewport, clear color, framebuffer/program bindings, active texture,
@@ -2034,7 +2035,7 @@ Results:
wrapper and compiled headless foundation/tool/test targets. wrapper and compiled headless foundation/tool/test targets.
- Desktop VR drawing now routes generic OpenGL scissor/depth/blend state, - Desktop VR drawing now routes generic OpenGL scissor/depth/blend state,
blend/depth state snapshots and restores, depth clears, active texture units, blend/depth state snapshots and restores, depth clears, active texture units,
and fallback 2D texture unbinds through the renderer GL backend mapping; and fallback 2D texture unbinds through tested renderer GL backend dispatch;
platform VR SDK bridges remain isolated for later platform-shell extraction. platform VR SDK bridges remain isolated for later platform-shell extraction.
Eye framebuffer viewport execution in the retained HMD path also routes Eye framebuffer viewport execution in the retained HMD path also routes
through tested `pp_renderer_gl` viewport dispatch. through tested `pp_renderer_gl` viewport dispatch.

View File

@@ -11,12 +11,30 @@ namespace {
void set_active_texture_unit(std::uint32_t unit_index) void set_active_texture_unit(std::uint32_t unit_index)
{ {
glActiveTexture(pp::renderer::gl::active_texture_unit(unit_index)); const auto status = pp::renderer::gl::activate_opengl_texture_unit(
unit_index,
pp::renderer::gl::OpenGlActiveTextureDispatch {
.active_texture = [](std::uint32_t texture_unit) noexcept
{
glActiveTexture(static_cast<GLenum>(texture_unit));
},
});
if (!status.ok())
LOG("OpenGL VR active texture dispatch failed: %s", status.message);
} }
void unbind_texture_2d() void unbind_texture_2d()
{ {
glBindTexture(pp::renderer::gl::texture_2d_target(), 0); const auto status = pp::renderer::gl::bind_opengl_texture_2d(
0U,
pp::renderer::gl::OpenGlTexture2DBindDispatch {
.bind_texture = [](std::uint32_t target, std::uint32_t texture) noexcept
{
glBindTexture(static_cast<GLenum>(target), static_cast<GLuint>(texture));
},
});
if (!status.ok())
LOG("OpenGL VR texture unbind dispatch failed: %s", status.message);
} }
void enable_opengl_state(std::uint32_t state) noexcept void enable_opengl_state(std::uint32_t state) noexcept