Route UI leaf render state through GL dispatch

This commit is contained in:
2026-06-04 22:53:07 +02:00
parent 7ade927beb
commit b65db6f617
13 changed files with 213 additions and 45 deletions

View File

@@ -1,7 +1,7 @@
#include "pch.h"
#include "log.h"
#include "legacy_ui_gl_dispatch.h"
#include "node_image_texture.h"
#include "renderer_gl/opengl_capabilities.h"
#include "shader.h"
#include "node_image.h"
@@ -19,14 +19,14 @@ void NodeImageTexture::clone_copy(Node* dest) const
void NodeImageTexture::draw()
{
tex ? tex->bind() : glBindTexture(pp::renderer::gl::texture_2d_target(), 0);
tex ? tex->bind() : pp::legacy::ui_gl::unbind_texture_2d("NodeImageTexture");
auto& sampler = tex && tex->has_mips ? NodeImage::m_sampler_mips : NodeImage::m_sampler;
sampler.bind(0);
glEnable(pp::renderer::gl::blend_state());
pp::legacy::ui_gl::set_blend_enabled(true, "NodeImageTexture");
ShaderManager::use(kShader::Texture);
ShaderManager::u_int(kShaderUniform::Tex, 0);
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
NodeImage::m_plane.draw_fill();
sampler.unbind();
glDisable(pp::renderer::gl::blend_state());
pp::legacy::ui_gl::set_blend_enabled(false, "NodeImageTexture");
}