Share grid GL dispatch adapters
This commit is contained in:
@@ -558,6 +558,9 @@ powershell -ExecutionPolicy Bypass -File scripts\automation\apple-remote-build.p
|
||||
`CanvasMode` overlay, mask, transform, and canvas-tip pick paths now also
|
||||
share that bridge for active texture, capability query/apply, viewport,
|
||||
read-framebuffer query, and RGBA8 pixel-readback adapter endpoints.
|
||||
`NodePanelGrid` heightmap draw and bake setup also shares it for active
|
||||
texture, depth/blend capability query/apply, viewport query/execution, depth
|
||||
clears, and color-write-mask adapter endpoints.
|
||||
Retained desktop HMD eye rendering also routes viewport
|
||||
execution through tested backend dispatch.
|
||||
Legacy `Texture2D`, `TextureManager`, `Sampler`, and `RTT` public headers no
|
||||
@@ -866,6 +869,9 @@ powershell -ExecutionPolicy Bypass -File scripts\automation\apple-remote-build.p
|
||||
capability query/apply draw-state adapter endpoints,
|
||||
plus retained `CanvasMode` active-texture, capability query/apply, viewport,
|
||||
read-framebuffer query, and RGBA8 pixel-readback adapter endpoints,
|
||||
plus retained `NodePanelGrid` active-texture, depth/blend capability
|
||||
query/apply, viewport query/execution, depth-clear, and color-write-mask
|
||||
adapter endpoints,
|
||||
tested convert-command state dispatch consumed by
|
||||
`App::cmd_convert`, tested render platform hint dispatch consumed by
|
||||
`WindowsPlatformServices` and the retained macOS legacy fallback, tested
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1271,6 +1271,9 @@ Retained `CanvasMode` overlay, mask, transform, and canvas-tip pick paths now
|
||||
also use the same bridge for active-texture, capability query/apply, viewport,
|
||||
read-framebuffer query, and RGBA8 pixel readback adapter endpoints while their
|
||||
mode logic remains in the legacy UI implementation.
|
||||
`NodePanelGrid` heightmap draw and bake setup now also share that bridge for
|
||||
active-texture selection, depth/blend capability query/apply, viewport
|
||||
query/execution, depth clears, and color-write-mask adapter endpoints.
|
||||
Desktop HMD eye rendering now routes eye framebuffer viewport changes through
|
||||
the tested `pp_renderer_gl` viewport dispatch while platform VR SDK bridges
|
||||
remain isolated for later platform-shell extraction.
|
||||
@@ -2557,7 +2560,10 @@ Results:
|
||||
paths now also consume the shared retained UI GL dispatch for active-texture,
|
||||
capability query/apply, viewport, read-framebuffer query, and RGBA8 pixel
|
||||
readback adapter endpoints, removing another local raw-GL adapter cluster
|
||||
from `src/canvas_modes.cpp`.
|
||||
from `src/canvas_modes.cpp`. `NodePanelGrid` heightmap draw and bake setup
|
||||
now uses the same bridge for active-texture, depth/blend capability
|
||||
query/apply, viewport query/execution, depth clears, and color-write-mask
|
||||
adapter endpoints instead of owning another local dispatch cluster.
|
||||
- Windows desktop OpenGL context creation now consumes a tested
|
||||
`windows_wgl_core_context_3_3_config()` catalog from `pp_renderer_gl`, moving
|
||||
the active WGL context/pixel-format attribute literals out of the platform
|
||||
|
||||
@@ -33,6 +33,11 @@ inline void clear_opengl_buffer(std::uint32_t mask) noexcept
|
||||
glClear(static_cast<GLbitfield>(mask));
|
||||
}
|
||||
|
||||
inline void set_opengl_color_mask(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a) noexcept
|
||||
{
|
||||
glColorMask(r, g, b, a);
|
||||
}
|
||||
|
||||
inline void set_opengl_clear_color(float r, float g, float b, float a) noexcept
|
||||
{
|
||||
glClearColor(r, g, b, a);
|
||||
@@ -222,6 +227,38 @@ inline void apply_scissor_rect(
|
||||
LOG("%s scissor dispatch failed because: %s", context, status.message);
|
||||
}
|
||||
|
||||
inline void clear_depth_buffer(const char* context)
|
||||
{
|
||||
const auto status = pp::renderer::gl::clear_opengl_buffers(
|
||||
pp::renderer::gl::framebuffer_depth_buffer_mask(),
|
||||
pp::renderer::gl::OpenGlBufferClearDispatch {
|
||||
.clear = clear_opengl_buffer,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("%s depth clear dispatch failed because: %s", context, status.message);
|
||||
}
|
||||
|
||||
inline void set_color_write_mask(
|
||||
std::uint8_t r,
|
||||
std::uint8_t g,
|
||||
std::uint8_t b,
|
||||
std::uint8_t a,
|
||||
const char* context)
|
||||
{
|
||||
const auto status = pp::renderer::gl::apply_opengl_color_write_mask(
|
||||
pp::renderer::gl::OpenGlColorWriteMask {
|
||||
.r = r,
|
||||
.g = g,
|
||||
.b = b,
|
||||
.a = a,
|
||||
},
|
||||
pp::renderer::gl::OpenGlColorWriteMaskDispatch {
|
||||
.color_mask = set_opengl_color_mask,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("%s color mask dispatch failed because: %s", context, status.message);
|
||||
}
|
||||
|
||||
inline void read_framebuffer_rgba8_pixel(
|
||||
std::uint32_t framebuffer,
|
||||
std::int32_t x,
|
||||
|
||||
@@ -6,143 +6,45 @@
|
||||
#include "canvas.h"
|
||||
#include "app.h"
|
||||
#include "image.h"
|
||||
#include "legacy_ui_gl_dispatch.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
#include "util.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));
|
||||
}
|
||||
|
||||
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_active_texture(std::uint32_t texture_unit) noexcept
|
||||
{
|
||||
glActiveTexture(static_cast<GLenum>(texture_unit));
|
||||
}
|
||||
|
||||
void get_opengl_integer(std::uint32_t name, std::int32_t* values) noexcept
|
||||
{
|
||||
static_assert(sizeof(GLint) == sizeof(std::int32_t));
|
||||
glGetIntegerv(static_cast<GLenum>(name), reinterpret_cast<GLint*>(values));
|
||||
}
|
||||
|
||||
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_buffer(std::uint32_t mask) noexcept
|
||||
{
|
||||
glClear(static_cast<GLbitfield>(mask));
|
||||
}
|
||||
|
||||
void set_opengl_color_mask(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a) noexcept
|
||||
{
|
||||
glColorMask(r, g, b, a);
|
||||
}
|
||||
|
||||
void apply_grid_capability(std::uint32_t state, bool enabled)
|
||||
{
|
||||
const auto status = pp::renderer::gl::apply_opengl_capability(
|
||||
state,
|
||||
enabled,
|
||||
pp::renderer::gl::OpenGlCapabilityDispatch {
|
||||
.enable = enable_opengl_state,
|
||||
.disable = disable_opengl_state,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("Grid capability dispatch failed because: %s", status.message);
|
||||
pp::legacy::ui_gl::set_capability(state, enabled, "Grid");
|
||||
}
|
||||
|
||||
bool query_grid_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,
|
||||
});
|
||||
if (!result.ok()) {
|
||||
LOG("Grid capability query failed because: %s", result.status().message);
|
||||
return false;
|
||||
}
|
||||
return result.value();
|
||||
return pp::legacy::ui_gl::query_capability(state, "Grid");
|
||||
}
|
||||
|
||||
void set_grid_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 = set_opengl_active_texture,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("Grid active texture dispatch failed because: %s", status.message);
|
||||
pp::legacy::ui_gl::activate_texture_unit(unit_index, "Grid");
|
||||
}
|
||||
|
||||
void apply_grid_viewport(std::int32_t x, std::int32_t y, std::int32_t width, std::int32_t height)
|
||||
{
|
||||
const auto status = pp::renderer::gl::apply_opengl_viewport(
|
||||
pp::renderer::gl::OpenGlViewportRect {
|
||||
.x = x,
|
||||
.y = y,
|
||||
.width = width,
|
||||
.height = height,
|
||||
},
|
||||
pp::renderer::gl::OpenGlViewportDispatch {
|
||||
.viewport = set_opengl_viewport,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("Grid viewport dispatch failed because: %s", status.message);
|
||||
pp::legacy::ui_gl::apply_viewport(x, y, width, height, "Grid");
|
||||
}
|
||||
|
||||
pp::renderer::gl::OpenGlViewportRect query_grid_viewport()
|
||||
{
|
||||
const auto result = pp::renderer::gl::query_opengl_viewport(
|
||||
pp::renderer::gl::OpenGlViewportQueryDispatch {
|
||||
.get_integer = get_opengl_integer,
|
||||
});
|
||||
if (!result.ok()) {
|
||||
LOG("Grid viewport query failed because: %s", result.status().message);
|
||||
}
|
||||
return result.value();
|
||||
return pp::legacy::ui_gl::query_viewport_rect("Grid");
|
||||
}
|
||||
|
||||
void clear_grid_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_buffer,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("Grid depth clear dispatch failed because: %s", status.message);
|
||||
pp::legacy::ui_gl::clear_depth_buffer("Grid");
|
||||
}
|
||||
|
||||
void apply_grid_color_mask(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a)
|
||||
{
|
||||
const auto status = pp::renderer::gl::apply_opengl_color_write_mask(
|
||||
pp::renderer::gl::OpenGlColorWriteMask {
|
||||
.r = r,
|
||||
.g = g,
|
||||
.b = b,
|
||||
.a = a,
|
||||
},
|
||||
pp::renderer::gl::OpenGlColorWriteMaskDispatch {
|
||||
.color_mask = set_opengl_color_mask,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("Grid color mask dispatch failed because: %s", status.message);
|
||||
pp::legacy::ui_gl::set_color_write_mask(r, g, b, a, "Grid");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user