wayland_egl: Reuse the texture we already have for textureForOutput
This commit is contained in:
parent
c24a5f0395
commit
1be2b8868c
2 changed files with 14 additions and 6 deletions
|
@ -88,6 +88,7 @@ WaylandEglLayerBuffer::WaylandEglLayerBuffer(const QSize &size, uint32_t format,
|
|||
zwp_linux_buffer_params_v1_destroy(params);
|
||||
|
||||
m_texture = backend->importDmaBufAsTexture(std::move(attributes));
|
||||
m_texture->setYInverted(false);
|
||||
m_framebuffer = std::make_unique<GLFramebuffer>(m_texture.get());
|
||||
}
|
||||
|
||||
|
@ -114,6 +115,11 @@ GLFramebuffer *WaylandEglLayerBuffer::framebuffer() const
|
|||
return m_framebuffer.get();
|
||||
}
|
||||
|
||||
std::shared_ptr<GLTexture> WaylandEglLayerBuffer::texture() const
|
||||
{
|
||||
return m_texture;
|
||||
}
|
||||
|
||||
int WaylandEglLayerBuffer::age() const
|
||||
{
|
||||
return m_age;
|
||||
|
@ -171,6 +177,11 @@ GLFramebuffer *WaylandEglPrimaryLayer::fbo() const
|
|||
return m_buffer->framebuffer();
|
||||
}
|
||||
|
||||
std::shared_ptr<GLTexture> WaylandEglPrimaryLayer::texture() const
|
||||
{
|
||||
return m_buffer->texture();
|
||||
}
|
||||
|
||||
std::optional<OutputLayerBeginFrameInfo> WaylandEglPrimaryLayer::beginFrame()
|
||||
{
|
||||
if (eglMakeCurrent(m_backend->eglDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, m_backend->context()) == EGL_FALSE) {
|
||||
|
@ -387,12 +398,7 @@ bool WaylandEglBackend::initRenderingContext()
|
|||
|
||||
std::shared_ptr<KWin::GLTexture> WaylandEglBackend::textureForOutput(KWin::Output *output) const
|
||||
{
|
||||
auto texture = std::make_unique<GLTexture>(GL_RGBA8, output->pixelSize());
|
||||
GLFramebuffer::pushFramebuffer(m_outputs.at(output).primaryLayer->fbo());
|
||||
GLFramebuffer renderTarget(texture.get());
|
||||
renderTarget.blitFromFramebuffer(QRect(0, texture->height(), texture->width(), -texture->height()));
|
||||
GLFramebuffer::popFramebuffer();
|
||||
return texture;
|
||||
return m_outputs.at(output).primaryLayer->texture();
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> WaylandEglBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
|
||||
wl_buffer *buffer() const;
|
||||
GLFramebuffer *framebuffer() const;
|
||||
std::shared_ptr<GLTexture> texture() const;
|
||||
int age() const;
|
||||
|
||||
private:
|
||||
|
@ -77,6 +78,7 @@ public:
|
|||
~WaylandEglPrimaryLayer() override;
|
||||
|
||||
GLFramebuffer *fbo() const;
|
||||
std::shared_ptr<GLTexture> texture() const;
|
||||
void present();
|
||||
|
||||
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
|
||||
|
|
Loading…
Reference in a new issue