scenes/opengl: Remove half-pixel correction workaround
It was needed to work around visual glitches in the wobbly windows effect. Since the wobbly windows effect renders the animated window into an offscreen texture, we don't need this workaround anymore. Furthermore, rather than using half-pixel correction, it is more desirable to use an offscreen texture as it results in simpler design. Performance-wise, it's not that bad that we need to start looking for other ways to get rid of the seams between window contents and deco.
This commit is contained in:
parent
8d378cd4cd
commit
048c732a4e
3 changed files with 0 additions and 37 deletions
|
@ -333,7 +333,6 @@ void GLShader::resolveLocations()
|
|||
mFloatLocation[Saturation] = uniformLocation("saturation");
|
||||
|
||||
mColorLocation[Color] = uniformLocation("geometryColor");
|
||||
mVec4Location[TextureClamp] = uniformLocation("textureClamp");
|
||||
|
||||
mLocationsResolved = true;
|
||||
}
|
||||
|
@ -856,10 +855,6 @@ QByteArray ShaderManager::generateFragmentSource(ShaderTraits traits) const
|
|||
} else if (traits & ShaderTrait::UniformColor)
|
||||
stream << "uniform vec4 geometryColor;\n";
|
||||
|
||||
if (traits & ShaderTrait::ClampTexture) {
|
||||
stream << "uniform vec4 textureClamp;\n";
|
||||
}
|
||||
|
||||
if (output != QByteArrayLiteral("gl_FragColor"))
|
||||
stream << "\nout vec4 " << output << ";\n";
|
||||
|
||||
|
@ -867,11 +862,6 @@ QByteArray ShaderManager::generateFragmentSource(ShaderTraits traits) const
|
|||
if (traits & ShaderTrait::MapTexture) {
|
||||
stream << "vec2 texcoordC = texcoord0;\n";
|
||||
|
||||
if (traits & ShaderTrait::ClampTexture) {
|
||||
stream << "texcoordC.x = clamp(texcoordC.x, textureClamp.x, textureClamp.z);\n";
|
||||
stream << "texcoordC.y = clamp(texcoordC.y, textureClamp.y, textureClamp.w);\n";
|
||||
}
|
||||
|
||||
if (traits & (ShaderTrait::Modulate | ShaderTrait::AdjustSaturation)) {
|
||||
stream << " vec4 texel = " << textureLookup << "(sampler, texcoordC);\n";
|
||||
if (traits & ShaderTrait::Modulate)
|
||||
|
|
|
@ -118,7 +118,6 @@ public:
|
|||
|
||||
enum Vec4Uniform {
|
||||
ModulationConstant,
|
||||
TextureClamp,
|
||||
Vec4UniformCount
|
||||
};
|
||||
|
||||
|
@ -176,7 +175,6 @@ enum class ShaderTrait {
|
|||
UniformColor = (1 << 1),
|
||||
Modulate = (1 << 2),
|
||||
AdjustSaturation = (1 << 3),
|
||||
ClampTexture = (1 << 4),
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(ShaderTraits, ShaderTrait)
|
||||
|
|
|
@ -1464,8 +1464,6 @@ void OpenGLWindow::performPaint(int mask, const QRegion ®ion, const WindowPai
|
|||
const QMatrix4x4 modelViewProjection = modelViewProjectionMatrix(mask, data);
|
||||
const QMatrix4x4 mvpMatrix = modelViewProjection * windowMatrix;
|
||||
|
||||
bool useX11TextureClamp = false;
|
||||
|
||||
GLShader *shader = data.shader;
|
||||
GLenum filter;
|
||||
|
||||
|
@ -1474,7 +1472,6 @@ void OpenGLWindow::performPaint(int mask, const QRegion ®ion, const WindowPai
|
|||
} else {
|
||||
const bool isTransformed = mask & (Effect::PAINT_WINDOW_TRANSFORMED |
|
||||
Effect::PAINT_SCREEN_TRANSFORMED);
|
||||
useX11TextureClamp = isTransformed;
|
||||
if (isTransformed && options->glSmoothScale() != 0) {
|
||||
filter = GL_LINEAR;
|
||||
} else {
|
||||
|
@ -1484,9 +1481,6 @@ void OpenGLWindow::performPaint(int mask, const QRegion ®ion, const WindowPai
|
|||
|
||||
if (!shader) {
|
||||
ShaderTraits traits = ShaderTrait::MapTexture;
|
||||
if (useX11TextureClamp) {
|
||||
traits |= ShaderTrait::ClampTexture;
|
||||
}
|
||||
|
||||
if (data.opacity() != 1.0 || data.brightness() != 1.0 || data.crossFadeProgress() != 1.0)
|
||||
traits |= ShaderTrait::Modulate;
|
||||
|
@ -1551,25 +1545,6 @@ void OpenGLWindow::performPaint(int mask, const QRegion ®ion, const WindowPai
|
|||
renderNode.texture->setWrapMode(GL_CLAMP_TO_EDGE);
|
||||
renderNode.texture->bind();
|
||||
|
||||
if (renderNode.leafType == ContentLeaf && useX11TextureClamp) {
|
||||
// X11 windows are reparented to have their buffer in the middle of a larger texture
|
||||
// holding the frame window.
|
||||
// This code passes the texture geometry to the fragment shader
|
||||
// any samples near the edge of the texture will be constrained to be
|
||||
// at least half a pixel in bounds, meaning we don't bleed the transparent border
|
||||
QRectF bufferContentRect = surfaceItem()->shape().boundingRect();
|
||||
bufferContentRect.adjust(0.5, 0.5, -0.5, -0.5);
|
||||
const QRect bufferGeometry = toplevel->bufferGeometry();
|
||||
|
||||
float leftClamp = bufferContentRect.left() / bufferGeometry.width();
|
||||
float topClamp = bufferContentRect.top() / bufferGeometry.height();
|
||||
float rightClamp = bufferContentRect.right() / bufferGeometry.width();
|
||||
float bottomClamp = bufferContentRect.bottom() / bufferGeometry.height();
|
||||
shader->setUniform(GLShader::TextureClamp, QVector4D({leftClamp, topClamp, rightClamp, bottomClamp}));
|
||||
} else {
|
||||
shader->setUniform(GLShader::TextureClamp, QVector4D({0, 0, 1, 1}));
|
||||
}
|
||||
|
||||
vbo->draw(region, primitiveType, renderNode.firstVertex,
|
||||
renderNode.vertexCount, m_hardwareClipping);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue