Share target-aware framebuffer copy bridge

This commit is contained in:
2026-06-05 14:07:46 +02:00
parent 2641db35ac
commit 65bf047d77
6 changed files with 69 additions and 55 deletions

View File

@@ -13,27 +13,6 @@ uint32_t Layer::s_count = 0;
namespace {
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)
{
pp::legacy::ui_gl::apply_viewport(x, y, width, height, "Layer");
@@ -63,21 +42,14 @@ void copy_layer_framebuffer_to_texture(
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);
copy_framebuffer_to_texture_target(
texture_target,
destination_x,
destination_y,
source_x,
source_y,
width,
height);
}
void clear_layer_color_buffer(const glm::vec4& color)