Fix glBlitFramebuffer for per-output rendering
Summary:
This is similar to ff6e042c7f
just for
GLRenderTarget instead of GLVertexBuffer. The reasoning is the same: on
Wayland KWin has one native window per screen and needs to adjust the
blit target depending on the area.
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D3056
This commit is contained in:
parent
05d21b6b25
commit
4e9a1eeb50
3 changed files with 17 additions and 2 deletions
|
@ -1129,6 +1129,7 @@ bool GLRenderTarget::sSupported = false;
|
|||
bool GLRenderTarget::s_blitSupported = false;
|
||||
QStack<GLRenderTarget*> GLRenderTarget::s_renderTargets = QStack<GLRenderTarget*>();
|
||||
QSize GLRenderTarget::s_virtualScreenSize;
|
||||
QRect GLRenderTarget::s_virtualScreenGeometry;
|
||||
|
||||
void GLRenderTarget::initStatic()
|
||||
{
|
||||
|
@ -1327,10 +1328,11 @@ void GLRenderTarget::blitFromFramebuffer(const QRect &source, const QRect &desti
|
|||
GLRenderTarget::pushRenderTarget(this);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFramebuffer);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
const QRect s = source.isNull() ? QRect(0, 0, s_virtualScreenSize.width(), s_virtualScreenSize.height()) : source;
|
||||
const QRect s = source.isNull() ? s_virtualScreenGeometry : source;
|
||||
const QRect d = destination.isNull() ? QRect(0, 0, mTexture.width(), mTexture.height()) : destination;
|
||||
|
||||
glBlitFramebuffer(s.x(), s_virtualScreenSize.height() - s.y() - s.height(), s.x() + s.width(), s_virtualScreenSize.height() - s.y(),
|
||||
glBlitFramebuffer(s.x() - s_virtualScreenGeometry.x(), s_virtualScreenGeometry.height() - s_virtualScreenGeometry.y() - s.y() - s.height(),
|
||||
s.x() - s_virtualScreenGeometry.x() + s.width(), s_virtualScreenGeometry.height() - s_virtualScreenGeometry.y() - s.y(),
|
||||
d.x(), mTexture.height() - d.y() - d.height(), d.x() + d.width(), mTexture.height() - d.y(),
|
||||
GL_COLOR_BUFFER_BIT, filter);
|
||||
GLRenderTarget::popRenderTarget();
|
||||
|
|
|
@ -511,6 +511,16 @@ public:
|
|||
s_virtualScreenSize = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the virtual screen geometry to @p g.
|
||||
* This is the geometry of the OpenGL window currently being rendered to
|
||||
* in the virtual geometry space the rendering geometries use.
|
||||
* @since 5.9
|
||||
**/
|
||||
static void setVirtualScreenGeometry(const QRect &g) {
|
||||
s_virtualScreenGeometry = g;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
void initFBO();
|
||||
|
@ -523,6 +533,7 @@ private:
|
|||
static bool s_blitSupported;
|
||||
static QStack<GLRenderTarget*> s_renderTargets;
|
||||
static QSize s_virtualScreenSize;
|
||||
static QRect s_virtualScreenGeometry;
|
||||
|
||||
GLTexture mTexture;
|
||||
bool mValid;
|
||||
|
|
|
@ -700,6 +700,7 @@ qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
|
|||
// prepare rendering makes context current on the output
|
||||
QRegion repaint = m_backend->prepareRenderingForScreen(i);
|
||||
GLVertexBuffer::setVirtualScreenGeometry(geo);
|
||||
GLRenderTarget::setVirtualScreenGeometry(geo);
|
||||
|
||||
const GLenum status = glGetGraphicsResetStatus();
|
||||
if (status != GL_NO_ERROR) {
|
||||
|
@ -727,6 +728,7 @@ qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
|
|||
return 0;
|
||||
}
|
||||
GLVertexBuffer::setVirtualScreenGeometry(screens()->geometry());
|
||||
GLRenderTarget::setVirtualScreenGeometry(screens()->geometry());
|
||||
|
||||
int mask = 0;
|
||||
updateProjectionMatrix();
|
||||
|
|
Loading…
Reference in a new issue