Share retained runtime GL dispatch
This commit is contained in:
@@ -592,6 +592,9 @@ powershell -ExecutionPolicy Bypass -File scripts\automation\apple-remote-build.p
|
|||||||
Retained RTT clear and masked-clear endpoints also share it for color-mask
|
Retained RTT clear and masked-clear endpoints also share it for color-mask
|
||||||
query/apply, clear-color, and buffer-clear callbacks instead of owning a
|
query/apply, clear-color, and buffer-clear callbacks instead of owning a
|
||||||
local raw clear callback cluster.
|
local raw clear callback cluster.
|
||||||
|
App startup logging, Windows early context logging/window-title detection,
|
||||||
|
and shader capability detection now share `legacy_gl_runtime_dispatch` for
|
||||||
|
runtime string and extension enumeration callbacks.
|
||||||
Retained desktop HMD eye rendering also routes viewport
|
Retained desktop HMD eye rendering also routes viewport
|
||||||
execution through tested backend dispatch.
|
execution through tested backend dispatch.
|
||||||
Legacy `Texture2D`, `TextureManager`, `Sampler`, and `RTT` public headers no
|
Legacy `Texture2D`, `TextureManager`, `Sampler`, and `RTT` public headers no
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -889,7 +889,9 @@ OpenGL runtime version/vendor/renderer/GLSL string queries now also use a
|
|||||||
tested `pp_renderer_gl` dispatch contract, leaving `App::init` to log the
|
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
|
result while the backend owns the query set and order. The Windows entrypoint
|
||||||
also uses that contract for early context logging and renderer-name window
|
also uses that contract for early context logging and renderer-name window
|
||||||
title construction before replacing the temporary WGL context.
|
title construction before replacing the temporary WGL context. Retained runtime
|
||||||
|
info and extension query callback endpoints now share
|
||||||
|
`legacy_gl_runtime_dispatch`.
|
||||||
The default app clear color and color-buffer clear operation now dispatch
|
The default app clear color and color-buffer clear operation now dispatch
|
||||||
through `pp_renderer_gl` as well, moving another direct OpenGL operation out
|
through `pp_renderer_gl` as well, moving another direct OpenGL operation out
|
||||||
of `App::clear` while preserving the current gray clear behavior; the live
|
of `App::clear` while preserving the current gray clear behavior; the live
|
||||||
@@ -2611,6 +2613,12 @@ Results:
|
|||||||
clear-color, and buffer-clear callbacks, removing the local raw clear
|
clear-color, and buffer-clear callbacks, removing the local raw clear
|
||||||
callback cluster from `src/rtt.cpp` while RTT render-target execution remains
|
callback cluster from `src/rtt.cpp` while RTT render-target execution remains
|
||||||
retained under DEBT-0036.
|
retained under DEBT-0036.
|
||||||
|
- Retained app startup logging, Windows early context logging/window-title
|
||||||
|
detection, and shader capability detection now share
|
||||||
|
`legacy_gl_runtime_dispatch` for runtime string and extension enumeration
|
||||||
|
callbacks, removing duplicated raw runtime-query clusters from `src/app.cpp`,
|
||||||
|
`src/main.cpp`, and `src/app_shaders.cpp` while runtime/capability probing
|
||||||
|
remains retained under DEBT-0036.
|
||||||
- Canvas draw-merge shader-blend selection now consumes the extracted
|
- Canvas draw-merge shader-blend selection now consumes the extracted
|
||||||
`pp_paint_renderer` stroke composite planner for current layer and primary
|
`pp_paint_renderer` stroke composite planner for current layer and primary
|
||||||
brush blend modes, while preserving legacy OpenGL compositing execution under
|
brush blend modes, while preserving legacy OpenGL compositing execution under
|
||||||
|
|||||||
10
src/app.cpp
10
src/app.cpp
@@ -18,6 +18,7 @@
|
|||||||
#include "legacy_app_startup_services.h"
|
#include "legacy_app_startup_services.h"
|
||||||
#include "legacy_document_open_services.h"
|
#include "legacy_document_open_services.h"
|
||||||
#include "legacy_document_session_services.h"
|
#include "legacy_document_session_services.h"
|
||||||
|
#include "legacy_gl_runtime_dispatch.h"
|
||||||
#include "legacy_recording_services.h"
|
#include "legacy_recording_services.h"
|
||||||
#include "legacy_ui_gl_dispatch.h"
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "platform_api/platform_services.h"
|
#include "platform_api/platform_services.h"
|
||||||
@@ -37,11 +38,6 @@ std::condition_variable App::render_cv;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
[[nodiscard]] const char* query_opengl_string(std::uint32_t name) noexcept
|
|
||||||
{
|
|
||||||
return reinterpret_cast<const char*>(glGetString(static_cast<GLenum>(name)));
|
|
||||||
}
|
|
||||||
|
|
||||||
pp::app::CanvasToolMode canvas_tool_mode_from_canvas_mode(kCanvasMode mode) noexcept
|
pp::app::CanvasToolMode canvas_tool_mode_from_canvas_mode(kCanvasMode mode) noexcept
|
||||||
{
|
{
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
@@ -393,9 +389,7 @@ void App::init()
|
|||||||
{
|
{
|
||||||
App::I->install_render_debug_callback();
|
App::I->install_render_debug_callback();
|
||||||
const auto runtime_info_result = pp::renderer::gl::query_opengl_runtime_info(
|
const auto runtime_info_result = pp::renderer::gl::query_opengl_runtime_info(
|
||||||
pp::renderer::gl::OpenGlRuntimeInfoDispatch {
|
pp::legacy::gl_runtime::runtime_info_dispatch());
|
||||||
.get_string = query_opengl_string,
|
|
||||||
});
|
|
||||||
if (runtime_info_result.ok())
|
if (runtime_info_result.ok())
|
||||||
{
|
{
|
||||||
const auto& runtime_info = runtime_info_result.value();
|
const auto& runtime_info = runtime_info_result.value();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
#include "legacy_gl_runtime_dispatch.h"
|
||||||
#include "renderer_api/shader_catalog.h"
|
#include "renderer_api/shader_catalog.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
#include "renderer_gl/opengl_capabilities.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
@@ -16,19 +17,6 @@ void apply_shader_manager_feature_state(pp::renderer::gl::OpenGlFeatureState fea
|
|||||||
ShaderManager::set_render_device_features(feature_state.features);
|
ShaderManager::set_render_device_features(feature_state.features);
|
||||||
}
|
}
|
||||||
|
|
||||||
void query_gl_integer(std::uint32_t name, std::int32_t* value) noexcept
|
|
||||||
{
|
|
||||||
GLint queried_value = 0;
|
|
||||||
glGetIntegerv(static_cast<GLenum>(name), &queried_value);
|
|
||||||
*value = static_cast<std::int32_t>(queried_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* query_gl_string_indexed(std::uint32_t name, std::uint32_t index) noexcept
|
|
||||||
{
|
|
||||||
return reinterpret_cast<const char*>(
|
|
||||||
glGetStringi(static_cast<GLenum>(name), static_cast<GLuint>(index)));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::initShaders()
|
void App::initShaders()
|
||||||
@@ -40,10 +28,7 @@ void App::initShaders()
|
|||||||
|
|
||||||
render_task([] {
|
render_task([] {
|
||||||
const auto detection_result = pp::renderer::gl::query_opengl_capability_detection(
|
const auto detection_result = pp::renderer::gl::query_opengl_capability_detection(
|
||||||
pp::renderer::gl::OpenGlExtensionQueryDispatch {
|
pp::legacy::gl_runtime::extension_query_dispatch(),
|
||||||
.get_integer = query_gl_integer,
|
|
||||||
.get_string_indexed = query_gl_string_indexed,
|
|
||||||
},
|
|
||||||
pp::renderer::gl::opengl_runtime_for_current_build());
|
pp::renderer::gl::opengl_runtime_for_current_build());
|
||||||
if (!detection_result.ok()) {
|
if (!detection_result.ok()) {
|
||||||
LOG("OpenGL capability detection failed: %s", detection_result.status().message);
|
LOG("OpenGL capability detection failed: %s", detection_result.status().message);
|
||||||
|
|||||||
42
src/legacy_gl_runtime_dispatch.h
Normal file
42
src/legacy_gl_runtime_dispatch.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "renderer_gl/opengl_capabilities.h"
|
||||||
|
|
||||||
|
namespace pp::legacy::gl_runtime {
|
||||||
|
|
||||||
|
inline const char* query_opengl_string(std::uint32_t name) noexcept
|
||||||
|
{
|
||||||
|
return reinterpret_cast<const char*>(glGetString(static_cast<GLenum>(name)));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void query_opengl_integer_scalar(std::uint32_t name, std::int32_t* value) noexcept
|
||||||
|
{
|
||||||
|
GLint queried_value = 0;
|
||||||
|
glGetIntegerv(static_cast<GLenum>(name), &queried_value);
|
||||||
|
*value = static_cast<std::int32_t>(queried_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char* query_opengl_indexed_string(std::uint32_t name, std::uint32_t index) noexcept
|
||||||
|
{
|
||||||
|
return reinterpret_cast<const char*>(
|
||||||
|
glGetStringi(static_cast<GLenum>(name), static_cast<GLuint>(index)));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline pp::renderer::gl::OpenGlRuntimeInfoDispatch runtime_info_dispatch() noexcept
|
||||||
|
{
|
||||||
|
return pp::renderer::gl::OpenGlRuntimeInfoDispatch {
|
||||||
|
.get_string = query_opengl_string,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
inline pp::renderer::gl::OpenGlExtensionQueryDispatch extension_query_dispatch() noexcept
|
||||||
|
{
|
||||||
|
return pp::renderer::gl::OpenGlExtensionQueryDispatch {
|
||||||
|
.get_integer = query_opengl_integer_scalar,
|
||||||
|
.get_string_indexed = query_opengl_indexed_string,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace pp::legacy::gl_runtime
|
||||||
10
src/main.cpp
10
src/main.cpp
@@ -8,6 +8,7 @@
|
|||||||
#include "canvas.h"
|
#include "canvas.h"
|
||||||
#include "keymap.h"
|
#include "keymap.h"
|
||||||
#include "hmd.h"
|
#include "hmd.h"
|
||||||
|
#include "legacy_gl_runtime_dispatch.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
#include "renderer_gl/opengl_capabilities.h"
|
||||||
#include "platform_windows/windows_platform_services.h"
|
#include "platform_windows/windows_platform_services.h"
|
||||||
#include "../resource.h"
|
#include "../resource.h"
|
||||||
@@ -89,11 +90,6 @@ void win32_renderdoc_frame_start() { }
|
|||||||
void win32_renderdoc_frame_end() { }
|
void win32_renderdoc_frame_end() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char* query_opengl_string(std::uint32_t name) noexcept
|
|
||||||
{
|
|
||||||
return reinterpret_cast<const char*>(glGetString(static_cast<GLenum>(name)));
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT(*GetDpiForMonitor_fn)(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT* dpiX, UINT* dpiY);
|
HRESULT(*GetDpiForMonitor_fn)(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT* dpiX, UINT* dpiY);
|
||||||
HRESULT(*SetProcessDpiAwareness_fn)(PROCESS_DPI_AWARENESS value);
|
HRESULT(*SetProcessDpiAwareness_fn)(PROCESS_DPI_AWARENESS value);
|
||||||
void init_shcore_API()
|
void init_shcore_API()
|
||||||
@@ -860,9 +856,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
auto runtime_info = pp::renderer::gl::OpenGlRuntimeInfo {};
|
auto runtime_info = pp::renderer::gl::OpenGlRuntimeInfo {};
|
||||||
const auto runtime_info_result = pp::renderer::gl::query_opengl_runtime_info(
|
const auto runtime_info_result = pp::renderer::gl::query_opengl_runtime_info(
|
||||||
pp::renderer::gl::OpenGlRuntimeInfoDispatch {
|
pp::legacy::gl_runtime::runtime_info_dispatch());
|
||||||
.get_string = query_opengl_string,
|
|
||||||
});
|
|
||||||
if (runtime_info_result.ok()) {
|
if (runtime_info_result.ok()) {
|
||||||
runtime_info = runtime_info_result.value();
|
runtime_info = runtime_info_result.value();
|
||||||
LOG("GL version: %s", runtime_info.version);
|
LOG("GL version: %s", runtime_info.version);
|
||||||
|
|||||||
Reference in New Issue
Block a user