Route canvas layer GL state through backend
This commit is contained in:
@@ -371,7 +371,8 @@ Known local toolchain state:
|
||||
paths also consume backend-owned blend-state tokens.
|
||||
Canvas layer cube/equirect generation, clear, restore, and snapshot paths
|
||||
also consume backend-owned cube/2D texture targets, active texture units,
|
||||
blend/clear state, and RGBA8 read/write pixel mapping.
|
||||
blend/clear state, viewport execution, target-aware framebuffer-to-texture
|
||||
copies, and RGBA8 read/write pixel mapping.
|
||||
`NodePanelGrid` heightmap preview and lightmap baking also consume
|
||||
backend-owned texture readback formats, sampler filters, depth/blend state,
|
||||
depth clears, viewport queries, color-mask booleans, active texture units,
|
||||
@@ -649,8 +650,9 @@ Known local toolchain state:
|
||||
NodeCanvas, NodeStrokePreview, and HMD render-state paths,
|
||||
tested pixel-buffer allocation/readback/map/unmap/delete dispatch
|
||||
consumed by retained `PBO` recording readbacks, tested framebuffer-to-texture
|
||||
2D copy dispatch consumed by retained canvas/UI paint paths, tested framebuffer
|
||||
bind/restore dispatch consumed by retained `RTT` render-target pass entry
|
||||
copy dispatch consumed by retained canvas/UI paint paths and CanvasLayer
|
||||
cube-face generation, tested framebuffer bind/restore dispatch consumed by
|
||||
retained `RTT` render-target pass entry
|
||||
and exit paths, tested depth renderbuffer allocation/delete and framebuffer
|
||||
depth attach/detach dispatch consumed by retained RTT and canvas object-drawing helpers,
|
||||
tested convert-command state dispatch consumed by
|
||||
|
||||
@@ -53,7 +53,7 @@ agent or engineer to remove them without reconstructing context from chat.
|
||||
| DEBT-0033 | Open | Modernization | Tools menu planning and direct command execution dispatch now consume pure `pp_app_core` through `App::init_menu_tools`, `pano_cli plan-tools-menu`, `pano_cli plan-tools-panel`, and the `ToolsMenuServices` boundary, and direct command execution is centralized in `src/legacy_app_shell_services.*`; SonarPen availability/startup now routes through `PlatformServices`, but live adapters still construct legacy `NodePanelFloating` panels, mutate legacy panel nodes, clear `CanvasModeGrid`, reset `NodeCanvas` camera state, open legacy shortcuts UI, and rely on the legacy platform adapter for the retained iOS SonarPen bridge | Preserve current Tools menu behavior while UI shell actions move toward app/UI/platform services | `pp_app_core_tools_menu_tests`; `pp_platform_api_tests`; `pano_cli plan-tools-menu --command shortcuts`; `pano_cli plan-tools-panel --panel layers`; `pano_cli plan-tools-panel --panel animation --already-visible`; `ctest --preset desktop-fast --build-config Debug` | Tools panel creation, submenu routing, grid clear, camera reset, shortcuts dialog, and SonarPen dispatch are owned by injected app/UI/platform services with `App::init_menu_tools` acting only as a UI adapter and no legacy Tools adapter |
|
||||
| DEBT-0034 | Open | Modernization | About menu command planning and execution dispatch now consume pure `pp_app_core` through `App::init_menu_about`, `pano_cli plan-about-menu`, and the `AboutMenuServices` boundary, and live execution is centralized in `src/legacy_app_shell_services.*`, but the bridge still opens legacy About/manual/what's-new dialogs, invokes the injected crash hook, and runs the legacy Canvas stroke performance test directly | Preserve About menu behavior while dialogs and diagnostics move toward app/UI/platform services | `pp_app_core_about_menu_tests`; `pano_cli plan-about-menu --command news --version-major 2 --version-minor 5 --version-fix 7`; `pano_cli plan-about-menu --command performance --no-canvas`; `ctest --preset desktop-fast --build-config Debug` | About/manual/what's-new dialog dispatch, crash-test dispatch, and performance-test execution are owned by injected app/UI/platform services with `App::init_menu_about` acting only as a UI adapter and no legacy About adapter |
|
||||
| DEBT-0035 | Open | Modernization | Main toolbar/status command planning and execution dispatch now consume pure `pp_app_core` through `App::init_toolbar_main`, `pano_cli plan-main-toolbar`, and the `MainToolbarServices` boundary, history/canvas commands now hand off through `HistoryUiServices` and `DocumentCanvasClearServices`, and live execution is centralized in `src/legacy_app_shell_services.*`, but the bridge still opens legacy open/save/settings/message-box dialogs and delegates to legacy history/canvas adapters | Preserve reachable toolbar/status behavior while app shell commands move toward app/document/UI services | `pp_app_core_main_toolbar_tests`; `pano_cli plan-main-toolbar --command undo --undo-count 2`; `pano_cli plan-main-toolbar --command clear-canvas --no-canvas`; `ctest --preset desktop-fast --build-config Debug` | Open/save/settings/message-box routing, undo/redo/clear-history execution, and canvas-clear execution are owned by injected app/document/UI services with `App::init_toolbar_main` acting only as a UI adapter and no legacy toolbar adapter |
|
||||
| DEBT-0036 | Open | Modernization | `pp_renderer_api`, `pp_paint_renderer`, `pano_cli plan-paint-feedback`, and `pano_cli plan-stroke-composite` can choose backend-neutral complex paint feedback strategies for fixed-function blending, framebuffer-fetch-capable renderers, or ping-pong render targets. OpenGL extension detection now stores `pp::renderer::RenderDeviceFeatures` through `ShaderManager`, using `pp_renderer_gl::query_opengl_capability_detection`, `detect_opengl_feature_state`, and `render_device_features` as the backend conversion point; that feature snapshot now includes float32-linear filtering, so canvas stroke texture format selection, renderer diagnostics, grid lightmap render planning, and grid bake target selection no longer read `ShaderManager::ext_*` flags directly. `pp_paint_renderer::plan_canvas_blend_gate` owns the compatibility mapping from persisted layer/brush blend indices to the extracted stroke-composite planner, and live `Canvas::draw_merge` plus `NodeCanvas` panorama rendering both call it with the stored renderer-neutral feature set for their existing shader-blend gates and destination-copy versus framebuffer-fetch decisions. `pp_paint_renderer::plan_canvas_stroke_feedback` also owns the current destination-feedback decision, and live `Canvas::stroke_draw`, thumbnail layer blending, and `NodeStrokePreview` brush-preview rendering use it for framebuffer-fetch versus destination-copy decisions. The retained `copy_framebuffer_to_texture_2d` utility bridge now routes 2D framebuffer-to-texture copies through tested `pp_renderer_gl` dispatch, retained `RTT::create`/`RTT::destroy` render-target texture parameter setup, optional depth renderbuffer allocation, framebuffer allocation/attachment/status checks, binding restore, and resource deletion now route through tested `pp_renderer_gl` dispatch, retained RTT clear, masked clear with color-write-mask restore, and texture bind/unbind now route through tested `pp_renderer_gl` dispatch, retained Canvas, NodeCanvas, and NodeStrokePreview texture-unit switches now route through tested active-texture dispatch, and retained Canvas, NodeCanvas, NodeStrokePreview, and desktop HMD viewport/scissor/capability execution now route through tested `pp_renderer_gl` dispatch adapters, but actual live stroke rasterization, dual-brush compositing, pattern feedback math, thumbnail layer compositing, brush-preview compositing, the retained cube-map framebuffer copy, and the retained `ShaderManager::ext_*` compatibility fields still use legacy OpenGL canvas/UI execution | Preserve current painting behavior while the renderer boundary matures for OpenGL parity and later Vulkan/Metal experiments | `pp_renderer_api_tests`; `pp_renderer_gl_capabilities_tests`; `pp_paint_renderer_compositor_tests`; `pano_cli plan-paint-feedback --framebuffer-fetch --explicit-transitions --render-only`; `pano_cli plan-paint-feedback --texture-copy`; `pano_cli plan-stroke-composite --stroke-blend 10 --framebuffer-fetch --explicit-transitions --render-only`; `pano_cli plan-stroke-composite --layer-blend 4 --dual-blend --texture-copy`; `ctest --preset desktop-fast --build-config Debug`; `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter` | Live stroke/layer compositing chooses its feedback path through `pp_paint_renderer` and renderer services, with OpenGL golden parity and Vulkan/Metal lab tests covering framebuffer-fetch and ping-pong behavior |
|
||||
| DEBT-0036 | Open | Modernization | `pp_renderer_api`, `pp_paint_renderer`, `pano_cli plan-paint-feedback`, and `pano_cli plan-stroke-composite` can choose backend-neutral complex paint feedback strategies for fixed-function blending, framebuffer-fetch-capable renderers, or ping-pong render targets. OpenGL extension detection now stores `pp::renderer::RenderDeviceFeatures` through `ShaderManager`, using `pp_renderer_gl::query_opengl_capability_detection`, `detect_opengl_feature_state`, and `render_device_features` as the backend conversion point; that feature snapshot now includes float32-linear filtering, so canvas stroke texture format selection, renderer diagnostics, grid lightmap render planning, and grid bake target selection no longer read `ShaderManager::ext_*` flags directly. `pp_paint_renderer::plan_canvas_blend_gate` owns the compatibility mapping from persisted layer/brush blend indices to the extracted stroke-composite planner, and live `Canvas::draw_merge` plus `NodeCanvas` panorama rendering both call it with the stored renderer-neutral feature set for their existing shader-blend gates and destination-copy versus framebuffer-fetch decisions. `pp_paint_renderer::plan_canvas_stroke_feedback` also owns the current destination-feedback decision, and live `Canvas::stroke_draw`, thumbnail layer blending, and `NodeStrokePreview` brush-preview rendering use it for framebuffer-fetch versus destination-copy decisions. The retained `copy_framebuffer_to_texture_2d` utility bridge now routes 2D framebuffer-to-texture copies through tested `pp_renderer_gl` dispatch, retained `RTT::create`/`RTT::destroy` render-target texture parameter setup, optional depth renderbuffer allocation, framebuffer allocation/attachment/status checks, binding restore, and resource deletion now route through tested `pp_renderer_gl` dispatch, retained RTT clear, masked clear with color-write-mask restore, and texture bind/unbind now route through tested `pp_renderer_gl` dispatch, retained Canvas, NodeCanvas, and NodeStrokePreview texture-unit switches now route through tested active-texture dispatch, retained Canvas, NodeCanvas, NodeStrokePreview, and desktop HMD viewport/scissor/capability execution now route through tested `pp_renderer_gl` dispatch adapters, and CanvasLayer cube/equirect generation plus frame clears now route blend state, active texture units, viewport execution, color clears, and cube-face framebuffer-to-texture copies through tested `pp_renderer_gl` dispatch adapters, but actual live stroke rasterization, dual-brush compositing, pattern feedback math, thumbnail layer compositing, brush-preview compositing, and the retained `ShaderManager::ext_*` compatibility fields still use legacy OpenGL canvas/UI execution | Preserve current painting behavior while the renderer boundary matures for OpenGL parity and later Vulkan/Metal experiments | `pp_renderer_api_tests`; `pp_renderer_gl_capabilities_tests`; `pp_paint_renderer_compositor_tests`; `pano_cli plan-paint-feedback --framebuffer-fetch --explicit-transitions --render-only`; `pano_cli plan-paint-feedback --texture-copy`; `pano_cli plan-stroke-composite --stroke-blend 10 --framebuffer-fetch --explicit-transitions --render-only`; `pano_cli plan-stroke-composite --layer-blend 4 --dual-blend --texture-copy`; `ctest --preset desktop-fast --build-config Debug`; `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter` | Live stroke/layer compositing chooses its feedback path through `pp_paint_renderer` and renderer services, with OpenGL golden parity and Vulkan/Metal lab tests covering framebuffer-fetch and ping-pong behavior |
|
||||
| DEBT-0037 | Open | Modernization | Recording lifecycle/export planning and execution dispatch now consume pure `pp_app_core` through `App::rec_start`, `App::rec_stop`, `App::rec_clear`, `App::rec_export`, `pano_cli plan-recording-session`, and the `RecordingServices` boundary; live execution is centralized in `src/legacy_recording_services.*`, and retained `PBO` allocation/readback/map/unmap/delete operations now route through tested `pp_renderer_gl` dispatch, but the bridge still owns legacy recording thread startup/shutdown, platform recorded-file cleanup, progress UI, retained `App::rec_loop` readback call sites, and `MP4Encoder::write_mp4` execution | Preserve current timelapse/MP4 behavior while recording moves toward app/document/renderer/video services | `pp_app_core_document_recording_tests`; `pp_renderer_gl_capabilities_tests`; `pano_cli plan-recording-session --running --frame-count 12`; `pano_cli plan-recording-session --platform-clears-files`; `ctest --preset desktop-fast --build-config Debug` | Recording thread lifecycle, frame readback scheduling, platform cleanup, progress reporting, and MP4 writing are owned by injected app/renderer/video services with `App` methods acting only as adapters |
|
||||
| DEBT-0038 | Open | Modernization | Cloud upload/browse/bulk planning and execution dispatch now consume pure `pp_app_core` through `App::cloud_upload`, `App::cloud_upload_all`, `App::cloud_browse`, `pano_cli plan-cloud-upload`, `pano_cli plan-cloud-upload-all`, `pano_cli plan-cloud-browse`, and the `CloudServices` boundary; live execution is centralized in `src/legacy_cloud_services.*`, the app-owned `upload`/`download`/license curl helpers now ask `PlatformServices` for the Android TLS-verification bypass policy, and retained `Asset::open_url`, `LogRemote::net_init`, and `NodeDialogCloud::load_thumbs_thread` curl sites consume the `pp_platform_api` default TLS policy helper instead of spelling Android branches locally, but the bridge still uses legacy save-before-upload, app-owned curl helpers instead of an injected network service, progress/message UI, OpenGL context guarding, `NodeDialogCloud`, `Canvas` project open, layer refresh, and `ActionManager` reset | Preserve current cloud behavior while cloud/network/document import flows move toward app/document/platform services | `pp_app_core_document_cloud_tests`; `pp_platform_api_tests`; `pano_cli plan-cloud-upload --new-document --unsaved`; `pano_cli plan-cloud-browse --selected-file demo.ppi`; `pano_cli plan-cloud-upload-all --file-count 3`; `ctest --preset desktop-fast --build-config Debug` | Cloud upload/download, TLS policy, save-before-upload, progress reporting, cloud browse dialog, downloaded project opening, layer refresh, OpenGL context ownership, and action-history reset are owned by injected app/document/network/platform/renderer services with `App` methods acting only as adapters |
|
||||
| DEBT-0039 | Open | Modernization | Document-open planning and execution dispatch now consume pure `pp_app_core` through `App::open_document`, `pano_cli plan-open-route`, `DocumentOpenServices`, and `src/legacy_document_open_services.*`, but the bridge still opens ABR/PPBR import prompts before delegating import execution to `src/legacy_brush_package_import_services.*`, applies unsaved-project discard prompts, calls legacy project-open execution, refreshes layer UI, updates the app title, and clears legacy history directly | Preserve current file-open/import behavior while document loading and brush import move toward app/document/asset/UI services | `pp_app_core_document_route_tests`; `pp_app_core_document_session_tests`; `pano_cli plan-open-route --path D:/Paint/Scenes/demo.ppi --unsaved`; `pano_cli plan-open-route --path D:/Paint/Brushes/clouds.ABR --unsaved`; `ctest --preset desktop-fast --build-config Debug` | Brush import prompting, project-open execution, unsaved-project discard prompting, layer refresh, title updates, and history clearing are owned by injected app/document/asset/UI services with `App::open_document` acting only as an adapter |
|
||||
|
||||
@@ -1095,7 +1095,8 @@ Simple UI text, text-input, border, scroll, and animation timeline draw paths
|
||||
now also delegate blend-state tokens to `pp_renderer_gl`.
|
||||
Canvas layer cube/equirect generation, clear, restore, and snapshot paths now
|
||||
also delegate cube/2D texture targets, active texture units, blend/clear state,
|
||||
and RGBA8 read/write pixel mapping to `pp_renderer_gl`.
|
||||
viewport execution, target-aware framebuffer-to-texture copies, and RGBA8
|
||||
read/write pixel mapping to `pp_renderer_gl`.
|
||||
`NodePanelGrid` heightmap preview and lightmap baking now delegate texture
|
||||
readback formats, sampler filters, depth/blend state, depth clears, viewport
|
||||
queries, color-mask booleans, active texture units, and float render-target
|
||||
@@ -2045,6 +2046,10 @@ Results:
|
||||
- Canvas layer merge rendering and explicit layer-merge compositing now route
|
||||
depth/blend state, active texture units, fallback 2D texture unbinds, and
|
||||
merge framebuffer copy targets through the renderer GL backend mapping.
|
||||
- Canvas layer cube/equirect generation and frame clears now route blend state,
|
||||
active texture units, viewport execution, color clears, and cube-face
|
||||
framebuffer-to-texture copies through tested renderer GL backend dispatch
|
||||
contracts.
|
||||
- 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
|
||||
|
||||
@@ -1,12 +1,154 @@
|
||||
#include "pch.h"
|
||||
#include "canvas_layer.h"
|
||||
#include "app.h"
|
||||
#include "log.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
#include "rtt.h"
|
||||
#include "util.h"
|
||||
|
||||
uint32_t Layer::s_count = 0;
|
||||
|
||||
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_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_active_texture(std::uint32_t texture_unit) noexcept
|
||||
{
|
||||
glActiveTexture(static_cast<GLenum>(texture_unit));
|
||||
}
|
||||
|
||||
void set_opengl_clear_color(float r, float g, float b, float a) noexcept
|
||||
{
|
||||
glClearColor(r, g, b, a);
|
||||
}
|
||||
|
||||
void clear_opengl_buffer(std::uint32_t mask) noexcept
|
||||
{
|
||||
glClear(static_cast<GLbitfield>(mask));
|
||||
}
|
||||
|
||||
void copy_opengl_tex_sub_image_2d(
|
||||
std::uint32_t target,
|
||||
std::int32_t level,
|
||||
std::int32_t destination_x,
|
||||
std::int32_t destination_y,
|
||||
std::int32_t source_x,
|
||||
std::int32_t source_y,
|
||||
std::int32_t width,
|
||||
std::int32_t height) noexcept
|
||||
{
|
||||
glCopyTexSubImage2D(
|
||||
static_cast<GLenum>(target),
|
||||
static_cast<GLint>(level),
|
||||
static_cast<GLint>(destination_x),
|
||||
static_cast<GLint>(destination_y),
|
||||
static_cast<GLint>(source_x),
|
||||
static_cast<GLint>(source_y),
|
||||
static_cast<GLsizei>(width),
|
||||
static_cast<GLsizei>(height));
|
||||
}
|
||||
|
||||
void apply_layer_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("Layer viewport dispatch failed because: %s", status.message);
|
||||
}
|
||||
|
||||
void apply_layer_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("Layer capability dispatch failed because: %s", status.message);
|
||||
}
|
||||
|
||||
void set_layer_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("Layer active texture dispatch failed because: %s", status.message);
|
||||
}
|
||||
|
||||
void copy_layer_framebuffer_to_texture(
|
||||
std::uint32_t texture_target,
|
||||
std::int32_t destination_x,
|
||||
std::int32_t destination_y,
|
||||
std::int32_t source_x,
|
||||
std::int32_t source_y,
|
||||
std::int32_t width,
|
||||
std::int32_t height)
|
||||
{
|
||||
const auto status = pp::renderer::gl::copy_opengl_framebuffer_to_texture_2d(
|
||||
pp::renderer::gl::OpenGlTexture2DFramebufferCopy {
|
||||
.texture_target = texture_target,
|
||||
.destination_x = destination_x,
|
||||
.destination_y = destination_y,
|
||||
.source_x = source_x,
|
||||
.source_y = source_y,
|
||||
.width = width,
|
||||
.height = height,
|
||||
},
|
||||
pp::renderer::gl::OpenGlTexture2DFramebufferCopyDispatch {
|
||||
.copy_tex_sub_image_2d = copy_opengl_tex_sub_image_2d,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("Layer framebuffer-to-texture copy dispatch failed because: %s", status.message);
|
||||
}
|
||||
|
||||
void clear_layer_color_buffer(const glm::vec4& color)
|
||||
{
|
||||
const auto status = pp::renderer::gl::clear_opengl_render_target(
|
||||
pp::renderer::gl::OpenGlDefaultClear {
|
||||
.color = { color.r, color.g, color.b, color.a },
|
||||
.mask = pp::renderer::gl::framebuffer_color_buffer_mask(),
|
||||
},
|
||||
pp::renderer::gl::OpenGlClearDispatch {
|
||||
.clear_color = set_opengl_clear_color,
|
||||
.clear = clear_opengl_buffer,
|
||||
});
|
||||
if (!status.ok())
|
||||
LOG("Layer clear dispatch failed because: %s", status.message);
|
||||
}
|
||||
|
||||
void restore_layer_clear_color(const GLfloat* color)
|
||||
{
|
||||
set_opengl_clear_color(color[0], color[1], color[2], color[3]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RTT& Layer::rtt(int i, int frame /*= -1*/)
|
||||
{
|
||||
if (frame == -1)
|
||||
@@ -46,7 +188,7 @@ TextureCube Layer::gen_cube()
|
||||
{
|
||||
ret.bind();
|
||||
rtt(i).bindFramebuffer();
|
||||
glCopyTexSubImage2D(pp::renderer::gl::cube_face_texture_target(i), 0, 0, 0, 0, 0, w, w);
|
||||
copy_layer_framebuffer_to_texture(pp::renderer::gl::cube_face_texture_target(i), 0, 0, 0, 0, w, w);
|
||||
rtt(i).unbindFramebuffer();
|
||||
});
|
||||
}
|
||||
@@ -72,15 +214,15 @@ Texture2D Layer::gen_equirect(glm::ivec2 size /*= { 0, 0 }*/)
|
||||
latlong.create(size.x * 4, size.y * 2);
|
||||
ret.create(size.x * 4, size.y * 2);
|
||||
|
||||
glDisable(pp::renderer::gl::blend_state());
|
||||
apply_layer_capability(pp::renderer::gl::blend_state(), false);
|
||||
|
||||
latlong.bindFramebuffer();
|
||||
|
||||
//latlong.clear({ 0, 1, 1, 1 });
|
||||
|
||||
glViewport(0, 0, latlong.getWidth(), latlong.getHeight());
|
||||
apply_layer_viewport(0, 0, latlong.getWidth(), latlong.getHeight());
|
||||
|
||||
glActiveTexture(pp::renderer::gl::active_texture_unit(0U));
|
||||
set_layer_active_texture_unit(0U);
|
||||
glBindTexture(pp::renderer::gl::texture_cube_map_target(), cube.m_cubetex_id);
|
||||
|
||||
ShaderManager::use(kShader::Equirect);
|
||||
@@ -117,12 +259,12 @@ PBO Layer::gen_equirect_pbo(glm::ivec2 size /*= { 0, 0 }*/)
|
||||
|
||||
App::I->render_task([&]
|
||||
{
|
||||
glDisable(pp::renderer::gl::blend_state());
|
||||
apply_layer_capability(pp::renderer::gl::blend_state(), false);
|
||||
|
||||
latlong.bindFramebuffer();
|
||||
|
||||
glViewport(0, 0, latlong.getWidth(), latlong.getHeight());
|
||||
glActiveTexture(pp::renderer::gl::active_texture_unit(0U));
|
||||
apply_layer_viewport(0, 0, latlong.getWidth(), latlong.getHeight());
|
||||
set_layer_active_texture_unit(0U);
|
||||
glBindTexture(pp::renderer::gl::texture_cube_map_target(), cube.m_cubetex_id);
|
||||
|
||||
ShaderManager::use(kShader::Equirect);
|
||||
@@ -461,14 +603,13 @@ void LayerFrame::clear(const glm::vec4& c)
|
||||
// push clear color state
|
||||
GLfloat cc[4];
|
||||
glGetFloatv(pp::renderer::gl::color_clear_value_query(), cc);
|
||||
glClearColor(c.r, c.g, c.b, c.a);
|
||||
|
||||
bool erase = (c.a == 0.f);
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
m_rtt[i].bindFramebuffer();
|
||||
glClear(pp::renderer::gl::framebuffer_color_buffer_mask());
|
||||
clear_layer_color_buffer(c);
|
||||
m_rtt[i].unbindFramebuffer();
|
||||
|
||||
if (erase)
|
||||
@@ -484,7 +625,7 @@ void LayerFrame::clear(const glm::vec4& c)
|
||||
}
|
||||
|
||||
// restore clear color state
|
||||
glClearColor(cc[0], cc[1], cc[2], cc[3]);
|
||||
restore_layer_clear_color(cc);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -844,8 +844,9 @@ pp::foundation::Status copy_opengl_framebuffer_to_texture_2d(
|
||||
return pp::foundation::Status::success();
|
||||
}
|
||||
|
||||
const auto texture_target = copy.texture_target == 0U ? texture_2d_target() : copy.texture_target;
|
||||
dispatch.copy_tex_sub_image_2d(
|
||||
texture_2d_target(),
|
||||
texture_target,
|
||||
copy.level,
|
||||
copy.destination_x,
|
||||
copy.destination_y,
|
||||
|
||||
@@ -150,6 +150,7 @@ struct OpenGlTexture2DUpdate {
|
||||
};
|
||||
|
||||
struct OpenGlTexture2DFramebufferCopy {
|
||||
std::uint32_t texture_target = 0;
|
||||
std::int32_t level = 0;
|
||||
std::int32_t destination_x = 0;
|
||||
std::int32_t destination_y = 0;
|
||||
|
||||
@@ -4293,6 +4293,25 @@ void copies_framebuffer_to_texture_2d_through_dispatch(pp::tests::Harness& h)
|
||||
PP_EXPECT(h, recorded_framebuffer_texture_copy_calls[0].height == 7);
|
||||
}
|
||||
|
||||
void copies_framebuffer_to_requested_texture_target(pp::tests::Harness& h)
|
||||
{
|
||||
recorded_framebuffer_texture_copy_calls.clear();
|
||||
|
||||
const auto status = pp::renderer::gl::copy_opengl_framebuffer_to_texture_2d(
|
||||
pp::renderer::gl::OpenGlTexture2DFramebufferCopy {
|
||||
.texture_target = pp::renderer::gl::cube_face_texture_target(2U),
|
||||
.width = 4,
|
||||
.height = 4,
|
||||
},
|
||||
pp::renderer::gl::OpenGlTexture2DFramebufferCopyDispatch {
|
||||
.copy_tex_sub_image_2d = record_copy_tex_sub_image_2d,
|
||||
});
|
||||
|
||||
PP_EXPECT(h, status.ok());
|
||||
PP_EXPECT(h, recorded_framebuffer_texture_copy_calls.size() == 1U);
|
||||
PP_EXPECT(h, recorded_framebuffer_texture_copy_calls[0].target == pp::renderer::gl::cube_face_texture_target(2U));
|
||||
}
|
||||
|
||||
void skips_zero_sized_framebuffer_to_texture_copies(pp::tests::Harness& h)
|
||||
{
|
||||
recorded_framebuffer_texture_copy_calls.clear();
|
||||
@@ -5339,6 +5358,7 @@ int main()
|
||||
harness.run("rejects_invalid_pixel_buffer_dispatch", rejects_invalid_pixel_buffer_dispatch);
|
||||
harness.run("updates_texture_2d_through_dispatch", updates_texture_2d_through_dispatch);
|
||||
harness.run("copies_framebuffer_to_texture_2d_through_dispatch", copies_framebuffer_to_texture_2d_through_dispatch);
|
||||
harness.run("copies_framebuffer_to_requested_texture_target", copies_framebuffer_to_requested_texture_target);
|
||||
harness.run("skips_zero_sized_framebuffer_to_texture_copies", skips_zero_sized_framebuffer_to_texture_copies);
|
||||
harness.run("rejects_invalid_framebuffer_to_texture_copies", rejects_invalid_framebuffer_to_texture_copies);
|
||||
harness.run("generates_texture_2d_mipmaps_through_dispatch", generates_texture_2d_mipmaps_through_dispatch);
|
||||
|
||||
Reference in New Issue
Block a user