Changeset View
Changeset View
Standalone View
Standalone View
libkwineffects/kwinglutils.cpp
Show First 20 Lines • Show All 1123 Lines • ▼ Show 20 Line(s) | 1118 | { | |||
---|---|---|---|---|---|
1124 | return shader; | 1124 | return shader; | ||
1125 | } | 1125 | } | ||
1126 | 1126 | | |||
1127 | /*** GLRenderTarget ***/ | 1127 | /*** GLRenderTarget ***/ | ||
1128 | bool GLRenderTarget::sSupported = false; | 1128 | bool GLRenderTarget::sSupported = false; | ||
1129 | bool GLRenderTarget::s_blitSupported = false; | 1129 | bool GLRenderTarget::s_blitSupported = false; | ||
1130 | QStack<GLRenderTarget*> GLRenderTarget::s_renderTargets = QStack<GLRenderTarget*>(); | 1130 | QStack<GLRenderTarget*> GLRenderTarget::s_renderTargets = QStack<GLRenderTarget*>(); | ||
1131 | QSize GLRenderTarget::s_virtualScreenSize; | 1131 | QSize GLRenderTarget::s_virtualScreenSize; | ||
1132 | QRect GLRenderTarget::s_virtualScreenGeometry; | ||||
1132 | 1133 | | |||
1133 | void GLRenderTarget::initStatic() | 1134 | void GLRenderTarget::initStatic() | ||
1134 | { | 1135 | { | ||
1135 | if (GLPlatform::instance()->isGLES()) { | 1136 | if (GLPlatform::instance()->isGLES()) { | ||
1136 | sSupported = true; | 1137 | sSupported = true; | ||
1137 | s_blitSupported = hasGLVersion(3, 0); | 1138 | s_blitSupported = hasGLVersion(3, 0); | ||
1138 | } else { | 1139 | } else { | ||
1139 | sSupported = hasGLVersion(3, 0) || | 1140 | sSupported = hasGLVersion(3, 0) || | ||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Line(s) | |||||
1322 | void GLRenderTarget::blitFromFramebuffer(const QRect &source, const QRect &destination, GLenum filter) | 1323 | void GLRenderTarget::blitFromFramebuffer(const QRect &source, const QRect &destination, GLenum filter) | ||
1323 | { | 1324 | { | ||
1324 | if (!GLRenderTarget::blitSupported()) { | 1325 | if (!GLRenderTarget::blitSupported()) { | ||
1325 | return; | 1326 | return; | ||
1326 | } | 1327 | } | ||
1327 | GLRenderTarget::pushRenderTarget(this); | 1328 | GLRenderTarget::pushRenderTarget(this); | ||
1328 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFramebuffer); | 1329 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFramebuffer); | ||
1329 | glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); | 1330 | glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); | ||
1330 | const QRect s = source.isNull() ? QRect(0, 0, s_virtualScreenSize.width(), s_virtualScreenSize.height()) : source; | 1331 | const QRect s = source.isNull() ? s_virtualScreenGeometry : source; | ||
1331 | const QRect d = destination.isNull() ? QRect(0, 0, mTexture.width(), mTexture.height()) : destination; | 1332 | const QRect d = destination.isNull() ? QRect(0, 0, mTexture.width(), mTexture.height()) : destination; | ||
1332 | 1333 | | |||
1333 | glBlitFramebuffer(s.x(), s_virtualScreenSize.height() - s.y() - s.height(), s.x() + s.width(), s_virtualScreenSize.height() - s.y(), | 1334 | glBlitFramebuffer(s.x() - s_virtualScreenGeometry.x(), s_virtualScreenGeometry.height() - s_virtualScreenGeometry.y() - s.y() - s.height(), | ||
1335 | s.x() - s_virtualScreenGeometry.x() + s.width(), s_virtualScreenGeometry.height() - s_virtualScreenGeometry.y() - s.y(), | ||||
1334 | d.x(), mTexture.height() - d.y() - d.height(), d.x() + d.width(), mTexture.height() - d.y(), | 1336 | d.x(), mTexture.height() - d.y() - d.height(), d.x() + d.width(), mTexture.height() - d.y(), | ||
1335 | GL_COLOR_BUFFER_BIT, filter); | 1337 | GL_COLOR_BUFFER_BIT, filter); | ||
1336 | GLRenderTarget::popRenderTarget(); | 1338 | GLRenderTarget::popRenderTarget(); | ||
1337 | } | 1339 | } | ||
1338 | 1340 | | |||
1339 | void GLRenderTarget::attachTexture(const GLTexture& target) | 1341 | void GLRenderTarget::attachTexture(const GLTexture& target) | ||
1340 | { | 1342 | { | ||
1341 | if (!mValid || mTexture.texture() == target.texture()) { | 1343 | if (!mValid || mTexture.texture() == target.texture()) { | ||
▲ Show 20 Lines • Show All 995 Lines • Show Last 20 Lines |