Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/opengl/scene_opengl.cpp
Show First 20 Lines • Show All 1376 Lines • ▼ Show 20 Line(s) | 1376 | if (!beginRenderWindow(mask, region, data)) | |||
---|---|---|---|---|---|
1377 | return; | 1377 | return; | ||
1378 | 1378 | | |||
1379 | QMatrix4x4 windowMatrix = transformation(mask, data); | 1379 | QMatrix4x4 windowMatrix = transformation(mask, data); | ||
1380 | const QMatrix4x4 modelViewProjection = modelViewProjectionMatrix(mask, data); | 1380 | const QMatrix4x4 modelViewProjection = modelViewProjectionMatrix(mask, data); | ||
1381 | const QMatrix4x4 mvpMatrix = modelViewProjection * windowMatrix; | 1381 | const QMatrix4x4 mvpMatrix = modelViewProjection * windowMatrix; | ||
1382 | 1382 | | |||
1383 | GLShader *shader = data.shader; | 1383 | GLShader *shader = data.shader; | ||
1384 | if (!shader) { | 1384 | if (!shader) { | ||
1385 | ShaderTraits traits = ShaderTrait::MapTexture; | 1385 | ShaderTraits traits = ShaderTrait::MapTexture | ShaderTrait::ClampTexture; | ||
1386 | 1386 | | |||
1387 | if (data.opacity() != 1.0 || data.brightness() != 1.0 || data.crossFadeProgress() != 1.0) | 1387 | if (data.opacity() != 1.0 || data.brightness() != 1.0 || data.crossFadeProgress() != 1.0) | ||
1388 | traits |= ShaderTrait::Modulate; | 1388 | traits |= ShaderTrait::Modulate; | ||
zzag: stray semicolon | |||||
1389 | 1389 | | |||
1390 | if (data.saturation() != 1.0) | 1390 | if (data.saturation() != 1.0) | ||
1391 | traits |= ShaderTrait::AdjustSaturation; | 1391 | traits |= ShaderTrait::AdjustSaturation; | ||
1392 | 1392 | | |||
1393 | shader = ShaderManager::instance()->pushShader(traits); | 1393 | shader = ShaderManager::instance()->pushShader(traits); | ||
1394 | } | 1394 | } | ||
1395 | shader->setUniform(GLShader::ModelViewProjectionMatrix, mvpMatrix); | 1395 | shader->setUniform(GLShader::ModelViewProjectionMatrix, mvpMatrix); | ||
1396 | 1396 | | |||
1397 | shader->setUniform(GLShader::Saturation, data.saturation()); | 1397 | shader->setUniform(GLShader::Saturation, data.saturation()); | ||
1398 | 1398 | | |||
1399 | GLenum filter; | 1399 | GLenum filter; | ||
1400 | if (waylandServer()) { | 1400 | if (waylandServer()) { | ||
1401 | filter = GL_LINEAR; | 1401 | filter = GL_LINEAR; | ||
1402 | } else { | 1402 | } else { | ||
1403 | const bool isTransformed = mask & (Effect::PAINT_WINDOW_TRANSFORMED | | 1403 | const bool isTransformed = mask & (Effect::PAINT_WINDOW_TRANSFORMED | | ||
1404 | Effect::PAINT_SCREEN_TRANSFORMED); | 1404 | Effect::PAINT_SCREEN_TRANSFORMED); | ||
1405 | if (isTransformed && options->glSmoothScale() != 0) { | 1405 | if (isTransformed && options->glSmoothScale() != 0) { | ||
1406 | filter = GL_LINEAR; | 1406 | filter = GL_LINEAR; | ||
1407 | } else { | 1407 | } else { | ||
1408 | filter = GL_NEAREST; | 1408 | filter = GL_NEAREST; | ||
1409 | } | 1409 | } | ||
1410 | } | 1410 | } | ||
zzag: stray whitespace | |||||
1411 | 1411 | | |||
1412 | WindowQuadList quads[LeafCount]; | 1412 | WindowQuadList quads[LeafCount]; | ||
1413 | 1413 | | |||
1414 | // Split the quads into separate lists for each type | 1414 | // Split the quads into separate lists for each type | ||
1415 | foreach (const WindowQuad &quad, data.quads) { | 1415 | foreach (const WindowQuad &quad, data.quads) { | ||
1416 | switch (quad.type()) { | 1416 | switch (quad.type()) { | ||
1417 | case WindowQuadDecoration: | 1417 | case WindowQuadDecoration: | ||
1418 | quads[DecorationLeaf].append(quad); | 1418 | quads[DecorationLeaf].append(quad); | ||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | 1499 | shader->setUniform(GLShader::ModulationConstant, | |||
1500 | modulate(nodes[i].opacity, data.brightness())); | 1500 | modulate(nodes[i].opacity, data.brightness())); | ||
1501 | opacity = nodes[i].opacity; | 1501 | opacity = nodes[i].opacity; | ||
1502 | } | 1502 | } | ||
1503 | 1503 | | |||
1504 | nodes[i].texture->setFilter(filter); | 1504 | nodes[i].texture->setFilter(filter); | ||
1505 | nodes[i].texture->setWrapMode(GL_CLAMP_TO_EDGE); | 1505 | nodes[i].texture->setWrapMode(GL_CLAMP_TO_EDGE); | ||
1506 | nodes[i].texture->bind(); | 1506 | nodes[i].texture->bind(); | ||
1507 | 1507 | | |||
1508 | if (i == ContentLeaf) { | ||||
1509 | // X11 windows are reparented to have their buffer in the middle of a larger texture | ||||
1510 | // holding the frame window. | ||||
1511 | // This code passes the texture geometry to the fragment shader | ||||
1512 | // any samples near the edge of the texture will be constrained to be | ||||
1513 | // at least half a pixel in bounds, meaning we don't bleed the transparent border | ||||
1514 | QRectF bufferRect = clientShape().boundingRect(); | ||||
1515 | bufferRect.adjust(0.5, 0.5, -0.5, -0.5); | ||||
1516 | float u1Clamp = bufferRect.left() / geometry().width(); | ||||
1517 | float v1Clamp = bufferRect.top() / geometry().height(); | ||||
1518 | float u2Clamp = bufferRect.right() / geometry().width(); | ||||
1519 | float v2Clamp = bufferRect.bottom() / geometry().height(); | ||||
1520 | shader->setUniform(GLShader::TextureClamp, QVector4D({u1Clamp, v1Clamp, u2Clamp, v2Clamp})); | ||||
1521 | } else { | ||||
1522 | shader->setUniform(GLShader::TextureClamp, QVector4D({0, 0, 1, 1})); | ||||
1523 | } | ||||
1524 | | ||||
1508 | vbo->draw(region, primitiveType, nodes[i].firstVertex, nodes[i].vertexCount, m_hardwareClipping); | 1525 | vbo->draw(region, primitiveType, nodes[i].firstVertex, nodes[i].vertexCount, m_hardwareClipping); | ||
1509 | } | 1526 | } | ||
1510 | 1527 | | |||
1511 | vbo->unbindArrays(); | 1528 | vbo->unbindArrays(); | ||
1512 | 1529 | | |||
1513 | // render sub-surfaces | 1530 | // render sub-surfaces | ||
1514 | auto wp = windowPixmap<OpenGLWindowPixmap>(); | 1531 | auto wp = windowPixmap<OpenGLWindowPixmap>(); | ||
1515 | const auto &children = wp ? wp->children() : QVector<WindowPixmap*>(); | 1532 | const auto &children = wp ? wp->children() : QVector<WindowPixmap*>(); | ||
▲ Show 20 Lines • Show All 1215 Lines • Show Last 20 Lines |
stray semicolon