Move simple UI blend mapping to renderer gl

This commit is contained in:
2026-06-02 08:31:31 +02:00
parent d8e958769b
commit b7c087617b
7 changed files with 21 additions and 11 deletions

View File

@@ -177,6 +177,8 @@ Known local toolchain state:
`NodeColorWheel` triangle-buffer setup and draw-state handling also consume `NodeColorWheel` triangle-buffer setup and draw-state handling also consume
backend-owned array-buffer, static-upload, vertex-attribute, primitive-mode, backend-owned array-buffer, static-upload, vertex-attribute, primitive-mode,
and blend-state tokens. and blend-state tokens.
Simple UI text, text-input, border, scroll, and animation timeline draw
paths also consume backend-owned blend-state tokens.
- `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

@@ -444,6 +444,8 @@ sampler filters, blend-state tokens, and RGBA8/RGBA texture format mapping to
`NodeColorWheel` triangle-buffer setup and draw-state handling now delegate `NodeColorWheel` triangle-buffer setup and draw-state handling now delegate
array-buffer, static-upload, vertex-attribute, primitive-mode, and blend-state array-buffer, static-upload, vertex-attribute, primitive-mode, and blend-state
tokens to `pp_renderer_gl`. tokens to `pp_renderer_gl`.
Simple UI text, text-input, border, scroll, and animation timeline draw paths
now also delegate blend-state tokens to `pp_renderer_gl`.
The existing renderer classes are not yet fully The existing renderer classes are not yet fully
behind the renderer interfaces. behind the renderer interfaces.

View File

@@ -1,6 +1,7 @@
#include "pch.h" #include "pch.h"
#include "log.h" #include "log.h"
#include "node_border.h" #include "node_border.h"
#include "renderer_gl/opengl_capabilities.h"
#include "shader.h" #include "shader.h"
Plane NodeBorder::m_plane; Plane NodeBorder::m_plane;
@@ -62,21 +63,22 @@ void NodeBorder::draw()
{ {
ShaderManager::use(kShader::Color); ShaderManager::use(kShader::Color);
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp); ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
const auto blend_state = pp::renderer::gl::blend_state();
if (m_color.a > 0.f) if (m_color.a > 0.f)
{ {
m_color.a < 1.f ? glEnable(GL_BLEND) : glDisable(GL_BLEND); m_color.a < 1.f ? glEnable(blend_state) : glDisable(blend_state);
ShaderManager::u_vec4(kShaderUniform::Col, m_color); ShaderManager::u_vec4(kShaderUniform::Col, m_color);
m_plane.draw_fill(); m_plane.draw_fill();
glDisable(GL_BLEND); glDisable(blend_state);
} }
if (m_thinkness > 0 && m_border_color.a > 0.f) if (m_thinkness > 0 && m_border_color.a > 0.f)
{ {
//glLineWidth(m_thinkness); //glLineWidth(m_thinkness);
ShaderManager::u_vec4(kShaderUniform::Col, m_border_color); ShaderManager::u_vec4(kShaderUniform::Col, m_border_color);
m_border_color.a < 1.f ? glEnable(GL_BLEND) : glDisable(GL_BLEND); m_border_color.a < 1.f ? glEnable(blend_state) : glDisable(blend_state);
m_plane.draw_stroke(); m_plane.draw_stroke();
glDisable(GL_BLEND); glDisable(blend_state);
} }
} }

View File

@@ -2,6 +2,7 @@
#include "node_panel_animation.h" #include "node_panel_animation.h"
#include "node_button.h" #include "node_button.h"
#include "node_button_custom.h" #include "node_button_custom.h"
#include "renderer_gl/opengl_capabilities.h"
#include "canvas.h" #include "canvas.h"
#include "app.h" #include "app.h"
@@ -236,7 +237,7 @@ void NodeAnimationTimeline::draw()
{ {
parent::draw(); parent::draw();
ShaderManager::use(kShader::Color); ShaderManager::use(kShader::Color);
glDisable(GL_BLEND); glDisable(pp::renderer::gl::blend_state());
float step = 35.f; float step = 35.f;
glm::vec2 cur_pos = { glm::vec2 cur_pos = {

View File

@@ -1,6 +1,7 @@
#include "pch.h" #include "pch.h"
#include "log.h" #include "log.h"
#include "node_scroll.h" #include "node_scroll.h"
#include "renderer_gl/opengl_capabilities.h"
#include "event.h" #include "event.h"
#include "shader.h" #include "shader.h"
@@ -110,7 +111,7 @@ void NodeScroll::draw()
if (rect.w > 0 && rect.z > 0) if (rect.w > 0 && rect.z > 0)
{ {
glDisable(GL_BLEND); glDisable(pp::renderer::gl::blend_state());
ShaderManager::use(kShader::Color); ShaderManager::use(kShader::Color);
if (m_direction == kScrollDirection::Vertical) if (m_direction == kScrollDirection::Vertical)

View File

@@ -1,6 +1,7 @@
#include "pch.h" #include "pch.h"
#include "log.h" #include "log.h"
#include "node_text.h" #include "node_text.h"
#include "renderer_gl/opengl_capabilities.h"
#include "shader.h" #include "shader.h"
Node* NodeText::clone_instantiate() const Node* NodeText::clone_instantiate() const
@@ -173,9 +174,9 @@ void NodeText::draw()
ShaderManager::u_int(kShaderUniform::Tex, 0); ShaderManager::u_int(kShaderUniform::Tex, 0);
ShaderManager::u_mat4(kShaderUniform::MVP, m_proj * pos); ShaderManager::u_mat4(kShaderUniform::MVP, m_proj * pos);
ShaderManager::u_vec4(kShaderUniform::Col, m_color); ShaderManager::u_vec4(kShaderUniform::Col, m_color);
glEnable(GL_BLEND); glEnable(pp::renderer::gl::blend_state());
m_text_mesh.draw(); m_text_mesh.draw();
glDisable(GL_BLEND); glDisable(pp::renderer::gl::blend_state());
} }
void NodeText::handle_resize(glm::vec2 old_size, glm::vec2 new_size, float zoom) void NodeText::handle_resize(glm::vec2 old_size, glm::vec2 new_size, float zoom)

View File

@@ -2,6 +2,7 @@
#include "app.h" #include "app.h"
#include "log.h" #include "log.h"
#include "node_text_input.h" #include "node_text_input.h"
#include "renderer_gl/opengl_capabilities.h"
#include "node_border.h" #include "node_border.h"
Node* NodeTextInput::clone_instantiate() const Node* NodeTextInput::clone_instantiate() const
@@ -219,13 +220,13 @@ void NodeTextInput::draw()
ShaderManager::u_int(kShaderUniform::Tex, 0); ShaderManager::u_int(kShaderUniform::Tex, 0);
ShaderManager::u_mat4(kShaderUniform::MVP, m_proj * pos); ShaderManager::u_mat4(kShaderUniform::MVP, m_proj * pos);
ShaderManager::u_vec4(kShaderUniform::Col, m_color); ShaderManager::u_vec4(kShaderUniform::Col, m_color);
glEnable(GL_BLEND); glEnable(pp::renderer::gl::blend_state());
m_text_mesh.draw(); m_text_mesh.draw();
glDisable(GL_BLEND); glDisable(pp::renderer::gl::blend_state());
if (m_cursor_visible) if (m_cursor_visible)
{ {
glDisable(GL_BLEND); glDisable(pp::renderer::gl::blend_state());
glm::mat4 cur_pos = glm::translate(glm::vec3(m_pos + m_off + xy(m_text_mesh.cur_box), 0)); glm::mat4 cur_pos = glm::translate(glm::vec3(m_pos + m_off + xy(m_text_mesh.cur_box), 0));
glm::mat4 cur_scale = glm::scale(glm::vec3(zw(m_text_mesh.cur_box), 1)); glm::mat4 cur_scale = glm::scale(glm::vec3(zw(m_text_mesh.cur_box), 1));
glm::mat4 cur_pivot = glm::translate(glm::vec3(0.5, 0.5, 0)); glm::mat4 cur_pivot = glm::translate(glm::vec3(0.5, 0.5, 0));