From 92338a0911b637ebdbefb02095623242f009d0fa Mon Sep 17 00:00:00 2001 From: omigamedev Date: Tue, 2 Jun 2026 09:22:35 +0200 Subject: [PATCH] Move canvas layer merge GL mappings to renderer gl --- docs/modernization/build-inventory.md | 6 +++--- docs/modernization/roadmap.md | 6 +++--- src/canvas.cpp | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/modernization/build-inventory.md b/docs/modernization/build-inventory.md index bd1360e..d89a50f 100644 --- a/docs/modernization/build-inventory.md +++ b/docs/modernization/build-inventory.md @@ -221,9 +221,9 @@ Known local toolchain state: Canvas stroke commit also consumes backend-owned saved viewport/clear/blend state, history readback format/type, active texture units, fallback 2D texture unbind targets, and layer compositing copy targets. - Canvas layer merge rendering also consumes backend-owned depth/blend state, - active texture units, fallback 2D texture unbind targets, and merge - framebuffer copy targets. + Canvas layer merge rendering and explicit layer-merge compositing also consume + backend-owned depth/blend state, active texture units, fallback 2D texture + unbind targets, and merge framebuffer copy targets. - `windows-msvc-vcpkg-headless` validates manifest install/configure/build/test for the current headless component matrix; see DEBT-0007 for remaining app and platform triplet migration. diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 86d1908..baf642e 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -765,9 +765,9 @@ Results: - Canvas stroke commit now routes saved viewport/clear/blend state, history readbacks, active texture units, fallback 2D texture unbinds, and layer compositing copy targets through the renderer GL backend mapping. -- Canvas layer merge rendering now routes depth/blend state, active texture - units, fallback 2D texture unbinds, and merge framebuffer copy targets through - the renderer GL backend mapping. +- 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. - Known remaining warnings: legacy project/vendor diagnostics, Visual Studio vcpkg-manifest warning, `LNK4099` missing libyuv PDBs, and `LNK4098` runtime library conflict from retained vendor binaries. diff --git a/src/canvas.cpp b/src/canvas.cpp index f720a3b..6b345ae 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -1433,7 +1433,7 @@ void Canvas::layer_merge(int source_idx, int dest_idx) // m_layer index { // prepare common states glViewport(0, 0, m_width, m_height); - glDisable(GL_BLEND); + glDisable(blend_state()); for (int i = 0; i < 6; i++) { @@ -1450,9 +1450,9 @@ void Canvas::layer_merge(int source_idx, int dest_idx) // m_layer index m_layers[dest_idx]->face(i) = true; // copy to tmp2 for layer blending - glActiveTexture(GL_TEXTURE0); + set_active_texture_unit(0); m_tex2[i].bind(); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, m_width, m_height); + glCopyTexSubImage2D(texture_2d_target(), 0, 0, 0, 0, 0, m_width, m_height); m_tex2[i].unbind(); m_sampler.bind(0); @@ -1470,13 +1470,13 @@ void Canvas::layer_merge(int source_idx, int dest_idx) // m_layer index ShaderManager::u_int(kShaderUniform::UseDual, false); ShaderManager::u_int(kShaderUniform::UsePattern, false); - glActiveTexture(GL_TEXTURE0); + set_active_texture_unit(0); m_tex2[i].bind(); - glActiveTexture(GL_TEXTURE1); + set_active_texture_unit(1); m_layers[source_idx]->rtt(i).bindTexture(); m_plane.draw_fill(); m_layers[source_idx]->rtt(i).unbindTexture(); - glActiveTexture(GL_TEXTURE0); + set_active_texture_unit(0); m_tex2[i].unbind(); }