Move canvas import export GL mappings to renderer gl

This commit is contained in:
2026-06-02 09:24:37 +02:00
parent 92338a0911
commit b7d9dfbf31
3 changed files with 15 additions and 10 deletions

View File

@@ -224,6 +224,8 @@ Known local toolchain state:
Canvas layer merge rendering and explicit layer-merge compositing also consume Canvas layer merge rendering and explicit layer-merge compositing also consume
backend-owned depth/blend state, active texture units, fallback 2D texture backend-owned depth/blend state, active texture units, fallback 2D texture
unbind targets, and merge framebuffer copy targets. unbind targets, and merge framebuffer copy targets.
Canvas equirectangular import drawing and depth export rendering also consume
backend-owned depth/blend state and active texture units.
- `windows-msvc-vcpkg-headless` validates manifest install/configure/build/test - `windows-msvc-vcpkg-headless` validates manifest install/configure/build/test
for the current headless component matrix; see DEBT-0007 for remaining app for the current headless component matrix; see DEBT-0007 for remaining app
and platform triplet migration. and platform triplet migration.

View File

@@ -768,6 +768,9 @@ Results:
- Canvas layer merge rendering and explicit layer-merge compositing now route - Canvas layer merge rendering and explicit layer-merge compositing now route
depth/blend state, active texture units, fallback 2D texture unbinds, and depth/blend state, active texture units, fallback 2D texture unbinds, and
merge framebuffer copy targets through the renderer GL backend mapping. merge framebuffer copy targets through the renderer GL backend mapping.
- Canvas equirectangular import drawing and depth export rendering now route
depth/blend state and active texture units through the renderer GL backend
mapping.
- Known remaining warnings: legacy project/vendor diagnostics, Visual Studio - Known remaining warnings: legacy project/vendor diagnostics, Visual Studio
vcpkg-manifest warning, `LNK4099` missing libyuv PDBs, and `LNK4098` runtime vcpkg-manifest warning, `LNK4099` missing libyuv PDBs, and `LNK4098` runtime
library conflict from retained vendor binaries. library conflict from retained vendor binaries.

View File

@@ -1854,10 +1854,10 @@ void Canvas::import_equirectangular_thread(std::string file_path, std::shared_pt
Plane plane; Plane plane;
plane.create<1>(2, 2); plane.create<1>(2, 2);
draw_objects([&](const glm::mat4& camera, const glm::mat4& proj, int i) { draw_objects([&](const glm::mat4& camera, const glm::mat4& proj, int i) {
glDisable(GL_DEPTH_TEST); glDisable(depth_test_state());
tex.update(img.m_data.get() + indices[i] * stride); tex.update(img.m_data.get() + indices[i] * stride);
m_sampler.bind(0); m_sampler.bind(0);
glActiveTexture(GL_TEXTURE0); set_active_texture_unit(0);
tex.bind(); tex.bind();
ShaderManager::use(kShader::Texture); ShaderManager::use(kShader::Texture);
ShaderManager::u_int(kShaderUniform::Tex, 0); ShaderManager::u_int(kShaderUniform::Tex, 0);
@@ -1875,9 +1875,9 @@ void Canvas::import_equirectangular_thread(std::string file_path, std::shared_pt
Sphere sphere; Sphere sphere;
sphere.create<64, 64>(2.f); sphere.create<64, 64>(2.f);
draw_objects([&](const glm::mat4& camera, const glm::mat4& proj, int i) { draw_objects([&](const glm::mat4& camera, const glm::mat4& proj, int i) {
glDisable(GL_DEPTH_TEST); glDisable(depth_test_state());
m_sampler.bind(0); m_sampler.bind(0);
glActiveTexture(GL_TEXTURE0); set_active_texture_unit(0);
tex.bind(); tex.bind();
ShaderManager::use(kShader::Texture); ShaderManager::use(kShader::Texture);
ShaderManager::u_int(kShaderUniform::Tex, 0); ShaderManager::u_int(kShaderUniform::Tex, 0);
@@ -2013,8 +2013,8 @@ void Canvas::export_depth_thread(std::string file_name)
rtt.bindFramebuffer(); rtt.bindFramebuffer();
rtt.clear({ 0, 0, 0, 1 }); rtt.clear({ 0, 0, 0, 1 });
glEnable(GL_BLEND); glEnable(blend_state());
glDisable(GL_DEPTH_TEST); glDisable(depth_test_state());
glViewport(0, 0, rtt.getWidth(), rtt.getHeight()); glViewport(0, 0, rtt.getWidth(), rtt.getHeight());
for (int plane_index = 0; plane_index < 6; plane_index++) for (int plane_index = 0; plane_index < 6; plane_index++)
{ {
@@ -2030,7 +2030,7 @@ void Canvas::export_depth_thread(std::string file_name)
ShaderManager::u_int(kShaderUniform::Highlight, false); ShaderManager::u_int(kShaderUniform::Highlight, false);
ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp_z); ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp_z);
glActiveTexture(GL_TEXTURE0); set_active_texture_unit(0);
m_layers_merge.rtt(plane_index).bindTexture(); m_layers_merge.rtt(plane_index).bindTexture();
m_plane.draw_fill(); m_plane.draw_fill();
m_layers_merge.rtt(plane_index).unbindTexture(); m_layers_merge.rtt(plane_index).unbindTexture();
@@ -2048,8 +2048,8 @@ void Canvas::export_depth_thread(std::string file_name)
{ {
rtt.bindFramebuffer(); rtt.bindFramebuffer();
rtt.clear({ 0, 0, 0, 1 }); rtt.clear({ 0, 0, 0, 1 });
glEnable(GL_BLEND); glEnable(blend_state());
glDisable(GL_DEPTH_TEST); glDisable(depth_test_state());
glViewport(0, 0, rtt.getWidth(), rtt.getHeight()); glViewport(0, 0, rtt.getWidth(), rtt.getHeight());
for (int layer_index = 0; layer_index < m_layers.size(); layer_index++) for (int layer_index = 0; layer_index < m_layers.size(); layer_index++)
{ {
@@ -2071,7 +2071,7 @@ void Canvas::export_depth_thread(std::string file_name)
ShaderManager::u_vec4(kShaderUniform::Col, { glm::vec3((float)(layer_index + 1) / (float)(m_layers.size() + 1)), 1.f }); ShaderManager::u_vec4(kShaderUniform::Col, { glm::vec3((float)(layer_index + 1) / (float)(m_layers.size() + 1)), 1.f });
ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp_z); ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp_z);
glActiveTexture(GL_TEXTURE0); set_active_texture_unit(0);
m_layers[layer_index]->rtt(plane_index).bindTexture(); m_layers[layer_index]->rtt(plane_index).bindTexture();
m_plane.draw_fill(); m_plane.draw_fill();
m_layers[layer_index]->rtt(plane_index).unbindTexture(); m_layers[layer_index]->rtt(plane_index).unbindTexture();