Changeset View
Standalone View
plugins/scenes/opengl/scene_opengl.cpp
Show First 20 Lines • Show All 1154 Lines • ▼ Show 20 Line(s) | 1154 | if (!bindTexture() || !s_frameTexture) { | |||
---|---|---|---|---|---|
1155 | return false; | 1155 | return false; | ||
1156 | } | 1156 | } | ||
1157 | 1157 | | |||
1158 | if (m_hardwareClipping) { | 1158 | if (m_hardwareClipping) { | ||
1159 | glEnable(GL_SCISSOR_TEST); | 1159 | glEnable(GL_SCISSOR_TEST); | ||
1160 | } | 1160 | } | ||
1161 | 1161 | | |||
1162 | // Update the texture filter | 1162 | // Update the texture filter | ||
1163 | if (waylandServer()) { | ||||
davidedmundson: This needs some work, but I understand what you're doing.
Logically we should have some sort… | |||||
Good that you mention it. I forgot to talk about it in the description. Indeed this stuff was one of the worse problems and I don't yet fully understand it. Without these changes including the generateMipmaps call the XWayland texture of a HiDPI client looked blurry on the LoDPI display. This makes in some way sense since mip-maps are used for down-scaling. But why do we not have the same problem with Wayland native buffers of larger scale factor and parts of them being shown on LoDPI screens? There everything looks crisp although it also needs to be downscaled. Maybe does the glViewport call in our EGl GBM backend do this automatically? But if yes, why not for the XWayland buffers. They should behave in this aspect exactly the same. romangg: Good that you mention it. I forgot to talk about it in the description.
Indeed this stuff was… | |||||
1164 | filter = ImageFilterGood; | ||||
1165 | s_frameTexture->setFilter(GL_LINEAR); | ||||
1166 | } else { | ||||
1163 | if (options->glSmoothScale() != 0 && | 1167 | if (options->glSmoothScale() != 0 && | ||
1164 | (mask & (PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED))) | 1168 | (mask & (PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED))) { | ||
1165 | filter = ImageFilterGood; | 1169 | filter = ImageFilterGood; | ||
1166 | else | 1170 | } else { | ||
1167 | filter = ImageFilterFast; | 1171 | filter = ImageFilterFast; | ||
1168 | 1172 | } | |||
1169 | s_frameTexture->setFilter(filter == ImageFilterGood ? GL_LINEAR : GL_NEAREST); | 1173 | s_frameTexture->setFilter(filter == ImageFilterGood ? GL_LINEAR : GL_NEAREST); | ||
1174 | } | ||||
1170 | 1175 | | |||
1171 | const GLVertexAttrib attribs[] = { | 1176 | const GLVertexAttrib attribs[] = { | ||
1172 | { VA_Position, 2, GL_FLOAT, offsetof(GLVertex2D, position) }, | 1177 | { VA_Position, 2, GL_FLOAT, offsetof(GLVertex2D, position) }, | ||
1173 | { VA_TexCoord, 2, GL_FLOAT, offsetof(GLVertex2D, texcoord) }, | 1178 | { VA_TexCoord, 2, GL_FLOAT, offsetof(GLVertex2D, texcoord) }, | ||
1174 | }; | 1179 | }; | ||
1175 | 1180 | | |||
1176 | GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); | 1181 | GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); | ||
1177 | vbo->reset(); | 1182 | vbo->reset(); | ||
▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Line(s) | 1363 | if (data.saturation() != 1.0) | |||
1359 | traits |= ShaderTrait::AdjustSaturation; | 1364 | traits |= ShaderTrait::AdjustSaturation; | ||
1360 | 1365 | | |||
1361 | shader = ShaderManager::instance()->pushShader(traits); | 1366 | shader = ShaderManager::instance()->pushShader(traits); | ||
1362 | } | 1367 | } | ||
1363 | shader->setUniform(GLShader::ModelViewProjectionMatrix, mvpMatrix); | 1368 | shader->setUniform(GLShader::ModelViewProjectionMatrix, mvpMatrix); | ||
1364 | 1369 | | |||
1365 | shader->setUniform(GLShader::Saturation, data.saturation()); | 1370 | shader->setUniform(GLShader::Saturation, data.saturation()); | ||
1366 | 1371 | | |||
1367 | const GLenum filter = (mask & (Effect::PAINT_WINDOW_TRANSFORMED | Effect::PAINT_SCREEN_TRANSFORMED)) | 1372 | GLenum textureFilter; | ||
1368 | && options->glSmoothScale() != 0 ? GL_LINEAR : GL_NEAREST; | 1373 | if (waylandServer()) { | ||
1374 | textureFilter = GL_LINEAR; | ||||
1375 | } else { | ||||
1376 | const bool isTransformed = mask & (Effect::PAINT_WINDOW_TRANSFORMED | | ||||
1377 | Effect::PAINT_SCREEN_TRANSFORMED); | ||||
1378 | if (isTransformed && options->glSmoothScale() != 0) { | ||||
1379 | textureFilter = GL_LINEAR; | ||||
1380 | } else { | ||||
1381 | textureFilter = GL_NEAREST; | ||||
1382 | } | ||||
1383 | } | ||||
1369 | 1384 | | |||
1370 | WindowQuadList quads[LeafCount]; | 1385 | WindowQuadList quads[LeafCount]; | ||
1371 | 1386 | | |||
1372 | // Split the quads into separate lists for each type | 1387 | // Split the quads into separate lists for each type | ||
1373 | foreach (const WindowQuad &quad, data.quads) { | 1388 | foreach (const WindowQuad &quad, data.quads) { | ||
1374 | switch (quad.type()) { | 1389 | switch (quad.type()) { | ||
1375 | case WindowQuadDecoration: | 1390 | case WindowQuadDecoration: | ||
1376 | quads[DecorationLeaf].append(quad); | 1391 | quads[DecorationLeaf].append(quad); | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 1465 | for (int i = 0; i < LeafCount; i++) { | |||
1454 | setBlendEnabled(nodes[i].hasAlpha || nodes[i].opacity < 1.0); | 1469 | setBlendEnabled(nodes[i].hasAlpha || nodes[i].opacity < 1.0); | ||
1455 | 1470 | | |||
1456 | if (opacity != nodes[i].opacity) { | 1471 | if (opacity != nodes[i].opacity) { | ||
1457 | shader->setUniform(GLShader::ModulationConstant, | 1472 | shader->setUniform(GLShader::ModulationConstant, | ||
1458 | modulate(nodes[i].opacity, data.brightness())); | 1473 | modulate(nodes[i].opacity, data.brightness())); | ||
1459 | opacity = nodes[i].opacity; | 1474 | opacity = nodes[i].opacity; | ||
1460 | } | 1475 | } | ||
1461 | 1476 | | |||
1462 | nodes[i].texture->setFilter(filter); | 1477 | nodes[i].texture->setFilter(textureFilter); | ||
1463 | nodes[i].texture->setWrapMode(GL_CLAMP_TO_EDGE); | 1478 | nodes[i].texture->setWrapMode(GL_CLAMP_TO_EDGE); | ||
1464 | nodes[i].texture->bind(); | 1479 | nodes[i].texture->bind(); | ||
1465 | 1480 | | |||
1466 | vbo->draw(region, primitiveType, nodes[i].firstVertex, nodes[i].vertexCount, m_hardwareClipping); | 1481 | vbo->draw(region, primitiveType, nodes[i].firstVertex, nodes[i].vertexCount, m_hardwareClipping); | ||
1467 | } | 1482 | } | ||
1468 | 1483 | | |||
1469 | vbo->unbindArrays(); | 1484 | vbo->unbindArrays(); | ||
1470 | 1485 | | |||
1486 | if (textureFilter = GL_LINEAR) { | ||||
1487 | s_frameTexture->generateMipmaps(); | ||||
1488 | } | ||||
I think GL_LINEAR shouldn't be used in this case. Why mipmaps anyway? I don't see where the number of levels is set. zzag: I think GL_LINEAR shouldn't be used in this case. Why mipmaps anyway? I don't see where the… | |||||
From my research the number of levels is not something to be set, but it's determined by the size of the texture to be mip-mapped. A 2x2 texture has 2 mip-maps (2x2, 1x1), a 4x4 texture has 3 (4x4, 2x2, 1x1). Don't know why our code tries to set levels. romangg: From my research the number of levels is not something to be set, but it's determined by the… | |||||
1489 | | ||||
1471 | // render sub-surfaces | 1490 | // render sub-surfaces | ||
1472 | auto wp = windowPixmap<OpenGLWindowPixmap>(); | 1491 | auto wp = windowPixmap<OpenGLWindowPixmap>(); | ||
1473 | const auto &children = wp ? wp->children() : QVector<WindowPixmap*>(); | 1492 | const auto &children = wp ? wp->children() : QVector<WindowPixmap*>(); | ||
1474 | windowMatrix.translate(toplevel->clientPos().x(), toplevel->clientPos().y()); | 1493 | windowMatrix.translate(toplevel->clientPos().x(), toplevel->clientPos().y()); | ||
1475 | for (auto pixmap : children) { | 1494 | for (auto pixmap : children) { | ||
1476 | if (pixmap->subSurface().isNull() || pixmap->subSurface()->surface().isNull() || !pixmap->subSurface()->surface()->isMapped()) { | 1495 | if (pixmap->subSurface().isNull() || pixmap->subSurface()->surface().isNull() || !pixmap->subSurface()->surface()->isMapped()) { | ||
1477 | continue; | 1496 | continue; | ||
1478 | } | 1497 | } | ||
▲ Show 20 Lines • Show All 1086 Lines • Show Last 20 Lines |
This needs some work, but I understand what you're doing.
Logically we should have some sort of:
if (bufferSize != windowLogicalSize * outputScale) {
}
Though I remember trying it and couldn't see a difference.
We can split that out this patch and ship that.