Changeset View
Changeset View
Standalone View
Standalone View
libkwineffects/kwinglutils.cpp
Show First 20 Lines • Show All 1219 Lines • ▼ Show 20 Line(s) | 1219 | #if DEBUG_GLRENDERTARGET | |||
---|---|---|---|---|---|
1220 | GLenum err = glGetError(); | 1220 | GLenum err = glGetError(); | ||
1221 | if (err != GL_NO_ERROR) | 1221 | if (err != GL_NO_ERROR) | ||
1222 | qCCritical(LIBKWINGLUTILS) << "Error status when entering GLRenderTarget::initFBO: " << formatGLError(err); | 1222 | qCCritical(LIBKWINGLUTILS) << "Error status when entering GLRenderTarget::initFBO: " << formatGLError(err); | ||
1223 | #endif | 1223 | #endif | ||
1224 | 1224 | | |||
1225 | glGenFramebuffers(1, &mFramebuffer); | 1225 | glGenFramebuffers(1, &mFramebuffer); | ||
1226 | 1226 | | |||
1227 | #if DEBUG_GLRENDERTARGET | 1227 | #if DEBUG_GLRENDERTARGET | ||
1228 | if ((err = glGetError()) != GL_NO_ERROR) { | 1228 | if ((err = glGetError()) != GL_NO_ERROR) { | ||
1229 | qCCritical(LIBKWINGLUTILS) << "glGenFramebuffers failed: " << formatGLError(err); | 1229 | qCCritical(LIBKWINGLUTILS) << "glGenFramebuffers failed: " << formatGLError(err); | ||
1230 | return; | 1230 | return; | ||
1231 | } | 1231 | } | ||
1232 | #endif | 1232 | #endif | ||
1233 | 1233 | | |||
1234 | glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer); | 1234 | glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer); | ||
1235 | 1235 | | |||
1236 | #if DEBUG_GLRENDERTARGET | 1236 | #if DEBUG_GLRENDERTARGET | ||
Show All 28 Lines | 1264 | else | |||
1265 | qCCritical(LIBKWINGLUTILS) << "Invalid framebuffer status: " << formatFramebufferStatus(status); | 1265 | qCCritical(LIBKWINGLUTILS) << "Invalid framebuffer status: " << formatFramebufferStatus(status); | ||
1266 | glDeleteFramebuffers(1, &mFramebuffer); | 1266 | glDeleteFramebuffers(1, &mFramebuffer); | ||
1267 | return; | 1267 | return; | ||
1268 | } | 1268 | } | ||
1269 | 1269 | | |||
1270 | mValid = true; | 1270 | mValid = true; | ||
1271 | } | 1271 | } | ||
1272 | 1272 | | |||
1273 | void GLRenderTarget::blitFromFramebuffer(const QRect &source, const QRect &destination, GLenum filter) | 1273 | void GLRenderTarget::blitFromFramebuffer(const QRect &source, const QRect &destination, GLenum filter, bool transpose) | ||
1274 | { | 1274 | { | ||
1275 | if (!GLRenderTarget::blitSupported()) { | 1275 | if (!GLRenderTarget::blitSupported()) { | ||
1276 | return; | 1276 | return; | ||
1277 | } | 1277 | } | ||
1278 | 1278 | | |||
1279 | if (!mValid) { | 1279 | if (!mValid) { | ||
1280 | initFBO(); | 1280 | initFBO(); | ||
1281 | } | 1281 | } | ||
1282 | 1282 | | |||
1283 | GLRenderTarget::pushRenderTarget(this); | 1283 | GLRenderTarget::pushRenderTarget(this); | ||
1284 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFramebuffer); | 1284 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFramebuffer); | ||
1285 | glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); | 1285 | glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); | ||
1286 | const QRect s = source.isNull() ? s_virtualScreenGeometry : source; | 1286 | const auto vsg = transpose ? s_virtualScreenGeometry.transposed() : s_virtualScreenGeometry; | ||
1287 | const QRect s = source.isNull() ? vsg : source; | ||||
1287 | const QRect d = destination.isNull() ? QRect(0, 0, mTexture.width(), mTexture.height()) : destination; | 1288 | const QRect d = destination.isNull() ? QRect(0, 0, mTexture.width(), mTexture.height()) : destination; | ||
1288 | 1289 | | |||
1289 | glBlitFramebuffer((s.x() - s_virtualScreenGeometry.x()) * s_virtualScreenScale, | 1290 | glBlitFramebuffer((s.x() - vsg.x()) * s_virtualScreenScale, | ||
1290 | (s_virtualScreenGeometry.height() - (s.y() - s_virtualScreenGeometry.y() + s.height())) * s_virtualScreenScale, | 1291 | (vsg.height() - (s.y() - vsg.y() + s.height())) * s_virtualScreenScale, | ||
1291 | (s.x() - s_virtualScreenGeometry.x() + s.width()) * s_virtualScreenScale, | 1292 | (s.x() - vsg.x() + s.width()) * s_virtualScreenScale, | ||
1292 | (s_virtualScreenGeometry.height() - (s.y() - s_virtualScreenGeometry.y())) * s_virtualScreenScale, | 1293 | (vsg.height() - (s.y() - vsg.y())) * s_virtualScreenScale, | ||
1293 | d.x(), mTexture.height() - d.y() - d.height(), d.x() + d.width(), mTexture.height() - d.y(), | 1294 | d.x(), mTexture.height() - d.y() - d.height(), d.x() + d.width(), mTexture.height() - d.y(), | ||
1294 | GL_COLOR_BUFFER_BIT, filter); | 1295 | GL_COLOR_BUFFER_BIT, filter); | ||
1295 | GLRenderTarget::popRenderTarget(); | 1296 | GLRenderTarget::popRenderTarget(); | ||
1296 | } | 1297 | } | ||
1297 | 1298 | | |||
1298 | void GLRenderTarget::attachTexture(const GLTexture& target) | 1299 | void GLRenderTarget::attachTexture(const GLTexture& target) | ||
1299 | { | 1300 | { | ||
1300 | if (!mValid) { | 1301 | if (!mValid) { | ||
▲ Show 20 Lines • Show All 1019 Lines • Show Last 20 Lines |