Share retained app UI GL dispatch
This commit is contained in:
@@ -619,7 +619,11 @@ powershell -ExecutionPolicy Bypass -File scripts\automation\apple-remote-build.p
|
||||
blend/depth state query-restore, depth clear masks, active texture unit
|
||||
dispatch, and fallback 2D texture unbind dispatch; VR SDK start/stop now dispatches
|
||||
through `PlatformServices` while retaining the existing Windows OpenVR bridge
|
||||
shape.
|
||||
shape. Its retained callback endpoints now share `legacy_ui_gl_dispatch`
|
||||
with app startup, app clear, app UI viewport/scissor, and command-convert
|
||||
renderer state callbacks, so those files no longer duplicate local raw GL
|
||||
adapter clusters for capability, blend, clear, viewport, scissor, active
|
||||
texture, or 2D texture-unbind execution.
|
||||
Canvas mode overlay, mask, and transform paths also consume backend-owned
|
||||
blend/depth state execution, active texture unit dispatch, transform/cut
|
||||
viewport execution, 2D texture copy targets, and RGBA8 readback format tokens;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -883,7 +883,8 @@ debug-output/debug-output-synchronous state enable sequence is now a tested
|
||||
Initial PanoPainter OpenGL depth/blend startup state is now represented and
|
||||
applied by tested `pp_renderer_gl` startup-state contracts; `App::init`
|
||||
delegates to the backend dispatch path instead of hard-coding the policy or
|
||||
operation order.
|
||||
operation order, and its retained callback endpoints now reuse the shared UI
|
||||
GL bridge instead of a local raw callback cluster.
|
||||
OpenGL runtime version/vendor/renderer/GLSL string queries now also use a
|
||||
tested `pp_renderer_gl` dispatch contract, leaving `App::init` to log the
|
||||
result while the backend owns the query set and order. The Windows entrypoint
|
||||
@@ -891,19 +892,24 @@ also uses that contract for early context logging and renderer-name window
|
||||
title construction before replacing the temporary WGL context.
|
||||
The default app clear color and color-buffer clear operation now dispatch
|
||||
through `pp_renderer_gl` as well, moving another direct OpenGL operation out
|
||||
of `App::clear` while preserving the current gray clear behavior.
|
||||
of `App::clear` while preserving the current gray clear behavior; the live
|
||||
callback endpoints now share `legacy_ui_gl_dispatch`.
|
||||
Main app UI viewport and scissor execution now dispatch through tested
|
||||
`pp_renderer_gl` viewport/scissor contracts, leaving `App::draw` and UI node
|
||||
clipping to provide rectangles while the backend owns scissor-state tokens and
|
||||
the live OpenGL call sequence.
|
||||
the live OpenGL call sequence. The retained viewport/scissor callback endpoints
|
||||
now share `legacy_ui_gl_dispatch`.
|
||||
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.
|
||||
the retained OpenVR app path is split incrementally; its retained callback
|
||||
endpoints now reuse the shared UI GL bridge.
|
||||
VR draw blend/depth state snapshots, transitions, restore, and depth-buffer
|
||||
clears, active texture unit switches, and fallback 2D texture unbinds now use
|
||||
generic tested `pp_renderer_gl` capability query/apply, clear, active-texture,
|
||||
and texture-bind dispatch contracts, reducing direct OpenGL execution in the
|
||||
retained VR app path without changing state restore behavior.
|
||||
retained VR app path without changing state restore behavior. The remaining
|
||||
retained VR draw adapter endpoints for these calls now share
|
||||
`legacy_ui_gl_dispatch`.
|
||||
The retained `gl_state` save/restore utility now snapshots and restores through
|
||||
tested `pp_renderer_gl` saved-state dispatch contracts, covering capability
|
||||
state, viewport, clear color, framebuffer/program bindings, active texture,
|
||||
@@ -2592,6 +2598,13 @@ Results:
|
||||
`legacy_gl_shader_dispatch`, and `legacy_gl_sampler_dispatch`, removing the
|
||||
local raw state/copy callback cluster from `src/util.cpp` while renderer
|
||||
state and framebuffer-copy execution remain retained under DEBT-0036.
|
||||
- Retained app startup, app clear, app UI viewport/scissor, command-convert
|
||||
renderer state, and desktop VR draw-state endpoints now share
|
||||
`legacy_ui_gl_dispatch` for capability, blend equation, clear, viewport,
|
||||
scissor, active-texture, and 2D texture-unbind callbacks, removing duplicated
|
||||
local raw callback clusters from `src/app.cpp`, `src/app_commands.cpp`, and
|
||||
`src/app_vr.cpp` while app/VR renderer execution remains retained under
|
||||
DEBT-0036.
|
||||
- Canvas draw-merge shader-blend selection now consumes the extracted
|
||||
`pp_paint_renderer` stroke composite planner for current layer and primary
|
||||
brush blend modes, while preserving legacy OpenGL compositing execution under
|
||||
|
||||
65
src/app.cpp
65
src/app.cpp
@@ -19,6 +19,7 @@
|
||||
#include "legacy_document_open_services.h"
|
||||
#include "legacy_document_session_services.h"
|
||||
#include "legacy_recording_services.h"
|
||||
#include "legacy_ui_gl_dispatch.h"
|
||||
#include "platform_api/platform_services.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
|
||||
@@ -41,11 +42,6 @@ namespace {
|
||||
return reinterpret_cast<const char*>(glGetString(static_cast<GLenum>(name)));
|
||||
}
|
||||
|
||||
void enable_opengl_state(std::uint32_t state) noexcept
|
||||
{
|
||||
glEnable(static_cast<GLenum>(state));
|
||||
}
|
||||
|
||||
pp::app::CanvasToolMode canvas_tool_mode_from_canvas_mode(kCanvasMode mode) noexcept
|
||||
{
|
||||
switch (mode) {
|
||||
@@ -76,47 +72,12 @@ pp::app::CanvasToolMode canvas_tool_mode_from_canvas_mode(kCanvasMode mode) noex
|
||||
}
|
||||
}
|
||||
|
||||
void disable_opengl_state(std::uint32_t state) noexcept
|
||||
{
|
||||
glDisable(static_cast<GLenum>(state));
|
||||
}
|
||||
|
||||
void set_opengl_blend_func(std::uint32_t source_factor, std::uint32_t destination_factor) noexcept
|
||||
{
|
||||
glBlendFunc(static_cast<GLenum>(source_factor), static_cast<GLenum>(destination_factor));
|
||||
}
|
||||
|
||||
void set_opengl_blend_equation_separate(std::uint32_t color_equation, std::uint32_t alpha_equation) noexcept
|
||||
{
|
||||
glBlendEquationSeparate(static_cast<GLenum>(color_equation), static_cast<GLenum>(alpha_equation));
|
||||
}
|
||||
|
||||
void clear_opengl_color(float r, float g, float b, float a) noexcept
|
||||
{
|
||||
glClearColor(r, g, b, a);
|
||||
}
|
||||
|
||||
void clear_opengl_buffers(std::uint32_t mask) noexcept
|
||||
{
|
||||
glClear(static_cast<GLbitfield>(mask));
|
||||
}
|
||||
|
||||
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 set_opengl_scissor(std::int32_t x, std::int32_t y, std::int32_t width, std::int32_t height) noexcept
|
||||
{
|
||||
glScissor(static_cast<GLint>(x), static_cast<GLint>(y), static_cast<GLsizei>(width), static_cast<GLsizei>(height));
|
||||
}
|
||||
|
||||
void apply_app_viewport(pp::renderer::gl::OpenGlViewportRect viewport)
|
||||
{
|
||||
const auto status = pp::renderer::gl::apply_opengl_viewport(
|
||||
viewport,
|
||||
pp::renderer::gl::OpenGlViewportDispatch {
|
||||
.viewport = set_opengl_viewport,
|
||||
.viewport = pp::legacy::ui_gl::set_opengl_viewport,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("OpenGL viewport failed: %s", status.message);
|
||||
@@ -127,9 +88,9 @@ void apply_app_scissor(pp::renderer::gl::OpenGlScissorRect scissor)
|
||||
const auto status = pp::renderer::gl::apply_opengl_scissor_rect(
|
||||
scissor,
|
||||
pp::renderer::gl::OpenGlScissorDispatch {
|
||||
.enable = enable_opengl_state,
|
||||
.disable = disable_opengl_state,
|
||||
.scissor = set_opengl_scissor,
|
||||
.enable = pp::legacy::ui_gl::enable_opengl_state,
|
||||
.disable = pp::legacy::ui_gl::disable_opengl_state,
|
||||
.scissor = pp::legacy::ui_gl::set_opengl_scissor,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("OpenGL scissor failed: %s", status.message);
|
||||
@@ -140,8 +101,8 @@ void apply_app_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,
|
||||
.enable = pp::legacy::ui_gl::enable_opengl_state,
|
||||
.disable = pp::legacy::ui_gl::disable_opengl_state,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("OpenGL scissor test failed: %s", status.message);
|
||||
@@ -225,8 +186,8 @@ void App::clear()
|
||||
{
|
||||
const auto status = pp::renderer::gl::clear_panopainter_default_target(
|
||||
pp::renderer::gl::OpenGlClearDispatch {
|
||||
.clear_color = clear_opengl_color,
|
||||
.clear = clear_opengl_buffers,
|
||||
.clear_color = pp::legacy::ui_gl::set_opengl_clear_color,
|
||||
.clear = pp::legacy::ui_gl::clear_opengl_buffer,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("OpenGL clear failed: %s", status.message);
|
||||
@@ -462,10 +423,10 @@ void App::init()
|
||||
App::I->apply_render_platform_hints();
|
||||
const auto startup_state_status = pp::renderer::gl::apply_panopainter_initial_state(
|
||||
pp::renderer::gl::OpenGlStateDispatch {
|
||||
.enable = enable_opengl_state,
|
||||
.disable = disable_opengl_state,
|
||||
.blend_func = set_opengl_blend_func,
|
||||
.blend_equation_separate = set_opengl_blend_equation_separate,
|
||||
.enable = pp::legacy::ui_gl::enable_opengl_state,
|
||||
.disable = pp::legacy::ui_gl::disable_opengl_state,
|
||||
.blend_func = pp::legacy::ui_gl::set_opengl_blend_func,
|
||||
.blend_equation_separate = pp::legacy::ui_gl::set_opengl_blend_equation_separate,
|
||||
});
|
||||
if (!startup_state_status.ok())
|
||||
LOG("OpenGL startup state failed: %s", startup_state_status.message);
|
||||
|
||||
@@ -2,39 +2,20 @@
|
||||
#include "app_core/command_convert.h"
|
||||
#include "app.h"
|
||||
#include "canvas.h"
|
||||
#include "legacy_ui_gl_dispatch.h"
|
||||
#include "log.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
|
||||
namespace {
|
||||
|
||||
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_blend_func(std::uint32_t source_factor, std::uint32_t destination_factor) noexcept
|
||||
{
|
||||
glBlendFunc(static_cast<GLenum>(source_factor), static_cast<GLenum>(destination_factor));
|
||||
}
|
||||
|
||||
void set_opengl_blend_equation(std::uint32_t equation) noexcept
|
||||
{
|
||||
glBlendEquation(static_cast<GLenum>(equation));
|
||||
}
|
||||
|
||||
void apply_convert_command_state()
|
||||
{
|
||||
const auto status = pp::renderer::gl::apply_panopainter_convert_command_state(
|
||||
pp::renderer::gl::OpenGlConvertCommandStateDispatch {
|
||||
.enable = enable_opengl_state,
|
||||
.disable = disable_opengl_state,
|
||||
.blend_func = set_opengl_blend_func,
|
||||
.blend_equation = set_opengl_blend_equation,
|
||||
.enable = pp::legacy::ui_gl::enable_opengl_state,
|
||||
.disable = pp::legacy::ui_gl::disable_opengl_state,
|
||||
.blend_func = pp::legacy::ui_gl::set_opengl_blend_func,
|
||||
.blend_equation = pp::legacy::ui_gl::set_opengl_blend_equation,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("OpenGL convert command state failed: %s", status.message);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "app.h"
|
||||
#include "legacy_ui_gl_dispatch.h"
|
||||
#include "node_panel_grid.h"
|
||||
#include "util.h"
|
||||
#include "shape.h"
|
||||
@@ -12,55 +13,12 @@ namespace {
|
||||
|
||||
void set_active_texture_unit(std::uint32_t 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);
|
||||
pp::legacy::ui_gl::activate_texture_unit(unit_index, "OpenGL VR");
|
||||
}
|
||||
|
||||
void unbind_texture_2d()
|
||||
{
|
||||
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
|
||||
{
|
||||
glEnable(static_cast<GLenum>(state));
|
||||
}
|
||||
|
||||
void disable_opengl_state(std::uint32_t state) noexcept
|
||||
{
|
||||
glDisable(static_cast<GLenum>(state));
|
||||
}
|
||||
|
||||
std::uint8_t is_opengl_state_enabled(std::uint32_t state) noexcept
|
||||
{
|
||||
return static_cast<std::uint8_t>(glIsEnabled(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 clear_opengl_mask(std::uint32_t mask) noexcept
|
||||
{
|
||||
glClear(static_cast<GLbitfield>(mask));
|
||||
pp::legacy::ui_gl::unbind_texture_2d("OpenGL VR");
|
||||
}
|
||||
|
||||
void apply_vr_ui_viewport(pp::renderer::gl::OpenGlViewportRect viewport)
|
||||
@@ -68,7 +26,7 @@ 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,
|
||||
.viewport = pp::legacy::ui_gl::set_opengl_viewport,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("OpenGL VR UI viewport failed: %s", status.message);
|
||||
@@ -79,8 +37,8 @@ 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,
|
||||
.enable = pp::legacy::ui_gl::enable_opengl_state,
|
||||
.disable = pp::legacy::ui_gl::disable_opengl_state,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("OpenGL VR UI scissor test failed: %s", status.message);
|
||||
@@ -92,8 +50,8 @@ void apply_vr_render_capability(std::uint32_t state, bool enabled)
|
||||
state,
|
||||
enabled,
|
||||
pp::renderer::gl::OpenGlCapabilityDispatch {
|
||||
.enable = enable_opengl_state,
|
||||
.disable = disable_opengl_state,
|
||||
.enable = pp::legacy::ui_gl::enable_opengl_state,
|
||||
.disable = pp::legacy::ui_gl::disable_opengl_state,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("OpenGL VR render state failed: %s", status.message);
|
||||
@@ -104,7 +62,7 @@ bool query_vr_render_capability(std::uint32_t state)
|
||||
const auto result = pp::renderer::gl::query_opengl_capability_state(
|
||||
state,
|
||||
pp::renderer::gl::OpenGlCapabilityStateQueryDispatch {
|
||||
.is_enabled = is_opengl_state_enabled,
|
||||
.is_enabled = pp::legacy::ui_gl::is_opengl_state_enabled,
|
||||
});
|
||||
if (!result.ok()) {
|
||||
LOG("OpenGL VR render state query failed: %s", result.status().message);
|
||||
@@ -118,7 +76,7 @@ void clear_vr_depth_buffer()
|
||||
const auto status = pp::renderer::gl::clear_opengl_buffers(
|
||||
pp::renderer::gl::framebuffer_depth_buffer_mask(),
|
||||
pp::renderer::gl::OpenGlBufferClearDispatch {
|
||||
.clear = clear_opengl_mask,
|
||||
.clear = pp::legacy::ui_gl::clear_opengl_buffer,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("OpenGL VR depth clear failed: %s", status.message);
|
||||
|
||||
@@ -43,6 +43,21 @@ inline void set_opengl_clear_color(float r, float g, float b, float a) noexcept
|
||||
glClearColor(r, g, b, a);
|
||||
}
|
||||
|
||||
inline void set_opengl_blend_func(std::uint32_t source_factor, std::uint32_t destination_factor) noexcept
|
||||
{
|
||||
glBlendFunc(static_cast<GLenum>(source_factor), static_cast<GLenum>(destination_factor));
|
||||
}
|
||||
|
||||
inline void set_opengl_blend_equation(std::uint32_t equation) noexcept
|
||||
{
|
||||
glBlendEquation(static_cast<GLenum>(equation));
|
||||
}
|
||||
|
||||
inline void set_opengl_blend_equation_separate(std::uint32_t color_equation, std::uint32_t alpha_equation) noexcept
|
||||
{
|
||||
glBlendEquationSeparate(static_cast<GLenum>(color_equation), static_cast<GLenum>(alpha_equation));
|
||||
}
|
||||
|
||||
inline 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));
|
||||
|
||||
Reference in New Issue
Block a user