Move initial GL state policy into renderer GL
This commit is contained in:
@@ -459,6 +459,9 @@ Known local toolchain state:
|
||||
while non-Windows platforms still reach retained platform bridges through
|
||||
the debt-tracked adapter isolated in
|
||||
`src/platform_legacy/legacy_platform_services.*`.
|
||||
- `pp_renderer_gl` owns the tested `OpenGlInitialState` startup depth/blend
|
||||
policy consumed by `App::init`, plus renderer API to OpenGL token mapping
|
||||
and command-planning contracts used by the OpenGL parity work.
|
||||
- `pano_cli plan-cloud-upload` exposes `pp_app_core` cloud upload availability,
|
||||
new-document warning, publish prompt, and save-before-upload planning as JSON;
|
||||
the live cloud upload command consumes the same start contract before
|
||||
|
||||
@@ -36,6 +36,7 @@ agent or engineer to remove them without reconstructing context from chat.
|
||||
| DEBT-0015 | Open | Modernization | Cursor visibility requests now consume pure `pp_app_core` planning through `pano_cli plan-cursor-visibility`, `App::show_cursor`/`App::hide_cursor` dispatch through `PlatformServices` without platform guards, and Windows live execution uses injected `WindowsPlatformServices`, but macOS cursor execution still reaches the retained fallback adapter | Keep canvas cursor behavior stable while platform shells are extracted incrementally | `pp_app_core_document_platform_io_tests`; `pano_cli plan-cursor-visibility --visible`; `ctest --preset desktop-fast --build-config Debug` | Cursor visibility execution is owned by injected `pp_platform_*` services for every supported platform |
|
||||
| DEBT-0016 | Open | Modernization | Clipboard get/set requests now consume pure `pp_app_core` planning through `pano_cli plan-clipboard-read` and `pano_cli plan-clipboard-write`, and Windows live execution uses injected `WindowsPlatformServices`, but Apple/Android clipboard execution still reaches retained fallback adapter branches from `App::clipboard_get_text` and `App::clipboard_set_text` | Keep picker/color text clipboard behavior stable while platform shells are extracted incrementally | `pp_app_core_document_platform_io_tests`; `pano_cli plan-clipboard-write --text #ff00aa`; `ctest --preset desktop-fast --build-config Debug` | Clipboard execution is owned by injected `pp_platform_*` services for every supported platform |
|
||||
| DEBT-0017 | Open | Modernization | Startup storage path preparation, `App::clipboard_get_text`, `App::clipboard_set_text`, `App::show_cursor`, `App::hide_cursor`, `App::showKeyboard`, `App::hideKeyboard`, `App::display_file`, `App::share_file`, native app/window close, UI-thread lifecycle hooks, render-context acquire/release/present hooks, render-target binding hooks, render platform hint hooks, render debug callback hooks, render-capture frame hooks, recording cleanup, live asset/layout reload policy, diagnostic stacktrace/crash hooks, per-frame platform hooks, `App::pick_image`, `App::pick_file`, the non-writer `App::pick_file_save`, `App::pick_dir`, and prepared-file save/download handoff now call the SDK-free `pp::platform::PlatformServices` interface, and Windows injects `WindowsPlatformServices` from `src/platform_windows/windows_platform_services.*`; non-Windows live implementations still use `src/platform_legacy/legacy_platform_services.*`, a named fallback adapter that forwards to retained Apple/Android/Linux/Web bridge functions and retained no-op branches | Preserve behavior while moving platform execution behind a testable service boundary before platform shell implementations are injected | `pp_platform_api_tests`; `pp_app_core_document_platform_io_tests`; `ctest --preset desktop-fast --build-config Debug`; `powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -Preset windows-msvc-default -Configuration Debug` | Replace `src/platform_legacy/legacy_platform_services.*` with injected `pp_platform_*` service implementations owned by each non-Windows platform shell |
|
||||
| DEBT-0018 | Open | Modernization | `pp_renderer_gl` owns a tested `OpenGlInitialState` plan for PanoPainter startup depth/blend policy, but `App::init` still executes the plan through direct OpenGL calls | Preserve behavior while moving renderer policy into the backend boundary before a live `IRenderDevice`/command context owns startup execution | `pp_renderer_gl_capabilities_tests`; `ctest --preset desktop-fast --build-config Debug`; `powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -Preset windows-msvc-default -Configuration Debug` | Initial render state is applied by a renderer backend service/device rather than direct `App::init` OpenGL calls |
|
||||
|
||||
## Closed Debt
|
||||
|
||||
|
||||
@@ -514,6 +514,10 @@ Windows OpenGL debug callback setup now dispatches through `PlatformServices`,
|
||||
moving Win32 console coloring, debug-output enablement, and debug-break callback
|
||||
behavior into `WindowsPlatformServices` while keeping other platform adapters
|
||||
as no-ops.
|
||||
Initial PanoPainter OpenGL depth/blend startup state is now represented by a
|
||||
tested `pp_renderer_gl` `OpenGlInitialState` plan before the app applies it,
|
||||
so the policy is owned by the renderer backend boundary instead of being
|
||||
hard-coded inside `App::init`.
|
||||
Windows RenderDoc frame capture hooks now also dispatch through
|
||||
`PlatformServices`, keeping capture integration in the platform service while
|
||||
leaving non-Windows adapters as no-ops.
|
||||
|
||||
40
src/app.cpp
40
src/app.cpp
@@ -45,36 +45,11 @@ namespace {
|
||||
return static_cast<GLenum>(pp::renderer::gl::shading_language_version_string_name());
|
||||
}
|
||||
|
||||
[[nodiscard]] GLenum depth_test_state() noexcept
|
||||
{
|
||||
return static_cast<GLenum>(pp::renderer::gl::depth_test_state());
|
||||
}
|
||||
|
||||
[[nodiscard]] GLenum scissor_test_state() noexcept
|
||||
{
|
||||
return static_cast<GLenum>(pp::renderer::gl::scissor_test_state());
|
||||
}
|
||||
|
||||
[[nodiscard]] GLenum source_alpha_blend_factor() noexcept
|
||||
{
|
||||
return static_cast<GLenum>(pp::renderer::gl::source_alpha_blend_factor());
|
||||
}
|
||||
|
||||
[[nodiscard]] GLenum one_minus_source_alpha_blend_factor() noexcept
|
||||
{
|
||||
return static_cast<GLenum>(pp::renderer::gl::one_minus_source_alpha_blend_factor());
|
||||
}
|
||||
|
||||
[[nodiscard]] GLenum add_blend_equation() noexcept
|
||||
{
|
||||
return static_cast<GLenum>(pp::renderer::gl::add_blend_equation());
|
||||
}
|
||||
|
||||
[[nodiscard]] GLenum max_blend_equation() noexcept
|
||||
{
|
||||
return static_cast<GLenum>(pp::renderer::gl::max_blend_equation());
|
||||
}
|
||||
|
||||
[[nodiscard]] GLint rgba8_internal_format() noexcept
|
||||
{
|
||||
return static_cast<GLint>(pp::renderer::gl::rgba8_internal_format());
|
||||
@@ -414,10 +389,19 @@ void App::init()
|
||||
// }
|
||||
//}
|
||||
|
||||
glDisable(depth_test_state());
|
||||
const auto initial_state = pp::renderer::gl::panopainter_initial_state();
|
||||
if (initial_state.depth_test_enabled)
|
||||
glEnable(static_cast<GLenum>(initial_state.depth_test_state));
|
||||
else
|
||||
glDisable(static_cast<GLenum>(initial_state.depth_test_state));
|
||||
|
||||
App::I->apply_render_platform_hints();
|
||||
glBlendFunc(source_alpha_blend_factor(), one_minus_source_alpha_blend_factor());
|
||||
glBlendEquationSeparate(add_blend_equation(), max_blend_equation());
|
||||
glBlendFunc(
|
||||
static_cast<GLenum>(initial_state.source_color_factor),
|
||||
static_cast<GLenum>(initial_state.destination_color_factor));
|
||||
glBlendEquationSeparate(
|
||||
static_cast<GLenum>(initial_state.color_equation),
|
||||
static_cast<GLenum>(initial_state.alpha_equation));
|
||||
});
|
||||
|
||||
int run_counter = Settings::value<Serializer::Integer>("run_counter") + 1;
|
||||
|
||||
@@ -212,6 +212,18 @@ pp::renderer::RenderDeviceFeatures render_device_features(OpenGlCapabilities cap
|
||||
};
|
||||
}
|
||||
|
||||
OpenGlInitialState panopainter_initial_state() noexcept
|
||||
{
|
||||
return OpenGlInitialState {
|
||||
.depth_test_enabled = false,
|
||||
.depth_test_state = depth_test_state(),
|
||||
.source_color_factor = source_alpha_blend_factor(),
|
||||
.destination_color_factor = one_minus_source_alpha_blend_factor(),
|
||||
.color_equation = add_blend_equation(),
|
||||
.alpha_equation = max_blend_equation(),
|
||||
};
|
||||
}
|
||||
|
||||
std::uint32_t extension_count_query() noexcept
|
||||
{
|
||||
return gl_num_extensions;
|
||||
|
||||
@@ -115,11 +115,21 @@ struct OpenGlWindowsWglContextConfig {
|
||||
std::array<std::int32_t, 15> pixel_format_attributes {};
|
||||
};
|
||||
|
||||
struct OpenGlInitialState {
|
||||
bool depth_test_enabled = false;
|
||||
std::uint32_t depth_test_state = 0;
|
||||
std::uint32_t source_color_factor = 0;
|
||||
std::uint32_t destination_color_factor = 0;
|
||||
std::uint32_t color_equation = 0;
|
||||
std::uint32_t alpha_equation = 0;
|
||||
};
|
||||
|
||||
[[nodiscard]] OpenGlCapabilities detect_opengl_capabilities(
|
||||
std::span<const std::string_view> extensions,
|
||||
OpenGlRuntime runtime) noexcept;
|
||||
[[nodiscard]] pp::renderer::RenderDeviceFeatures render_device_features(
|
||||
OpenGlCapabilities capabilities) noexcept;
|
||||
[[nodiscard]] OpenGlInitialState panopainter_initial_state() noexcept;
|
||||
|
||||
[[nodiscard]] std::uint32_t extension_count_query() noexcept;
|
||||
[[nodiscard]] std::uint32_t extension_string_name() noexcept;
|
||||
|
||||
@@ -627,6 +627,15 @@ void maps_app_initialization_parameters(pp::tests::Harness& h)
|
||||
PP_EXPECT(h, pp::renderer::gl::one_minus_source_alpha_blend_factor() == 0x0303U);
|
||||
PP_EXPECT(h, pp::renderer::gl::add_blend_equation() == 0x8006U);
|
||||
PP_EXPECT(h, pp::renderer::gl::max_blend_equation() == 0x8008U);
|
||||
|
||||
const auto initial_state = pp::renderer::gl::panopainter_initial_state();
|
||||
PP_EXPECT(h, !initial_state.depth_test_enabled);
|
||||
PP_EXPECT(h, initial_state.depth_test_state == 0x0B71U);
|
||||
PP_EXPECT(h, initial_state.source_color_factor == 0x0302U);
|
||||
PP_EXPECT(h, initial_state.destination_color_factor == 0x0303U);
|
||||
PP_EXPECT(h, initial_state.color_equation == 0x8006U);
|
||||
PP_EXPECT(h, initial_state.alpha_equation == 0x8008U);
|
||||
|
||||
PP_EXPECT(h, pp::renderer::gl::rgba8_internal_format() == 0x8058U);
|
||||
PP_EXPECT(h, pp::renderer::gl::rgba16f_internal_format() == 0x881AU);
|
||||
PP_EXPECT(h, pp::renderer::gl::rgba32f_internal_format() == 0x8814U);
|
||||
|
||||
Reference in New Issue
Block a user