On GLES, check for OES_texture_3D extension for color correction
Remove a block of ugly hack code that was supposedly needed to build
with OpenGL ES.
Convert the lookup texture data to uint8 on OpenGL ES before sending it
via glTexImage3D, because uint16 is not supported.
Check if the shaders have been reinitialized successfuly when trying to
activate color correction, prevent black screens when there are issues
with the shaders.
BUG: 315419
REVIEW: 111225
(cherry picked from commit 68c68ee3c2b54f968c4d8275f1e8a2e0ccc90dd7)
* "" needs to be wrapped in QStringLiteral
* QString::fromUtf8 needed for const char* and QByteArray
* QByteArray::constData() needed to get to the const char*
Qt 5 only supports raster which means our pixmaps are always non native,
so we don't need the Extension information any more and can drop all
special code handling for mapping a native QPixmap to an X11 pixmap.
This method returns true when glMapBufferRange() is likely to perform
worse than glBufferSubData() when updating an unused range in a buffer
object.
This is the case with the NVIDIA driver, where glMapBufferRange()
will force thread serialization. The driver tracks which ranges of
the buffer are in use, so calls to glBufferSubData() should not
cause a pipeline stall.
Assume that the default framebuffer has the same dimensions as the screen.
By not quering the dimensions of the viewport we don't risk serialization
in drivers that use threaded dispatch.
This reverts commit 23dff966437bb664a2ffdb3f7957ef39978f5fad.
Using QVector is not a win when effects such as wobbly windows are
active, due to the realloc overhead. So revert this change for now.
Eg. gtk+ alters the modality after mapping and
before unmapping the window.
Therfore the former implementation ahd a wrong idea
about the modality until the window was activated and
again had a wrong idea when the dialog closed, keeping
the main client dimmed.
Modality changes at runtime are uncommon but legal and can
happen anytime.
BUG: 321340
FIXED-IN: 4.11
REVIEW: 111154
Prevents the possiblity of using shaders modified for color correction
without valid data from KolorManager. If that happened, everthing
blacked out.
Now the color correction shaders are enabled only after successfuly
contacting KolorManager.
The issue was highlighted after ab7e228d.
BUG: 321217
it seems an animation can be triggered and the resp.
window deleted in the first event cycle (before the deleted
signal is bound) - so we add an initialization flag to ensure
the binding happens before the first animation is added
BUG: 320562
FIXED-IN: 4.11
REVIEW: 110872
Just like Opacity for transforming only the decoration opacity.
It's an ABI break as the new enum value had to be included as anonther
non-float base value.
Cross fading with previous pixmap is achieved by referencing the old
window pixmap. WindowPaintData has a cross-fade-factor which interpolates
between 0.0 (completely old pixmap) to 1.0 (completely new pixmap).
If a cross fading factor is set and a previous pixmap is valid this one
is rendered on top of the current pixmap with opacity adjusted. This
results in a smoother fading.
To simplify the setup the AnimationEffect is extended and also takes care
about correctly (un)referencing the previous window pixmap. The maximize
effect is adjusted to make use of this new capabilities.
Unfortunately this setup has a huge problem with the case that the window
decoration gets smaller (e.g. from normal to maximized state). In this
situation it can happen that the old window is rendered with parts outside
the content resulting in video garbage being shown. To prevent this a set
of new WindowQuads is generated with normalized texture coordinates in
the safe area which contains real content.
For OpenGL2Window a PreviousContentLeaf is added which is only set up in
case the crass fading factor is set.
REVIEW: 110578
This avoids the overhead of allocating each WindowQuad on the heap
when appending items to the list, and also ensures that the quads
are continuous in memory.
This reduces the size of the geometry that needs to be uploaded by
one-third, and allows kwin to take advantage of the post-transform
cache in the GPU.
Expose bindArrays(), unbindArrays() and add a draw() method that takes
an offset and a count. This makes it possible to upload geometry, call
bindArrays(), and then call draw() multiple times to draw different
subsets of the uploaded geometry.
Split WindowQuadDecoration into WindowQuadDecorationLeftRight
and WindowQuadDecorationTopBottom.
This simplifies the code in SceneOpenGL::Window::paintDecoration().
Do not schedule repaints in AnimationEffect if there are no animations
going on. If an animation is waiting for starting or kept after ending
the visual appearance is no longer changed, so no repaint is needed.
REVIEW: 110795
Unlike makeArrays() this function writes into a pre-allocated array,
and takes a matrix that's used to transform the texture coordinates.
This allows this function to handle coordinates for rectangular
textures correctly.
Note that unlike the previous commit, this doesn't fix texture coordinates
for rectangular textures. That case cannot be handled correctly without
knowing the dimensions of the texture.
This method returns a matrix that transforms normalized or un-normalized
texture coordinates, taking the texture target and y-inversion flag into
account.
KWin always updates the array buffer binding before it calls GL functions
that reference it, so there is never any need to reset it.
This should eliminate half the calls to glBindBuffer() while painting
the scene.
These methods make it possible to write directly into the buffer object
when building vertex arrays.
If the buffer object cannot be mapped, the map() method will return
a pointer to local memory which will be submitted to the buffer object
with glBufferData() when unmap() is called.
This overload makes it possible to upload data of an arbitrary size and
type into the buffer object. The intent is for this method to be used
to upload interleaved vertex data.
This commit also adds setVertexCount() and setAttribLayout().
The rationale for decoupling attribute specification from data uploading
is that the attribute formats and layout change less frequently than
the vertex data.
The vertex count is also specified using a separate function to enable
the caller to upload data for multiple draw calls at the same time.
Store the formats as an array in GLVertexBufferPrivate.
This simplifies the code for enabling the generic vertex arrays,
and also makes it easier to add new arrays.
Consolidate the code for binding and unbinding the vertex arrays into
two new methods called bindArrays() and unbindArrays() respectively.
This patch also removes the three paint implementations, since the only
difference between them is the code that sets up the arrays. The actual
painting code is moved into GLVertexBuffer::render(), which uses the
new methods to bind and unbind the arrays.
In case OpenGL ES 3 is provided by the driver we can use the GLSL 1.40
shaders as GLSL 300 ES shaders. The #version declarative is rewritten in
such a case.
REVIEW: 110590
Only the subset of functions available in core contexts is resolved,
except for glGetnTexImageARB() and glGetnUniformivARB(), which are
not used by kwin.
Instead of setting the function pointers to NULL when the extension isn't
supported, kwin provides its own implementations that call the non-robust
versions of the functions. This is so callers don't have to check if the
extension is supported before calling the functions.
Allocate enough space to hold the geometry for multiple draw calls,
and use glMapBufferRange() to gradually fill the buffer. Once the
data store is full, it's orphaned and a new one is allocated.
Store the vertex positions and texture coordinates in the same buffer
object. This saves one buffer allocation in every setData() call.
The attributes are also interleaved as they are uploaded into the buffer
to maximize locality of reference.
This patch adds a link() function, along with bindAttributeLocation()
and bindFragDataLocation().
These functions must be called after creating the program, but before
linking it.
A new ExplicitLinking flag must be passed to the constructor to prevent
automatic linking. This is to keep existing code working without
modifications.
Use glGetStringi() to list the extensions when the GL version is 3.0
or greater. glGetString() does not accept the GL_EXTENSIONS token
in an OpenGL core context.
With the removal of BoxSwitch all effects which want mouse events use the
fullscreen input window. The available functionality is too complex both
in EffectsHandler and in the Effects.
With this change only fullscreen input windows are supported and all
effects share the input window. This means there is at maximum one input
window. This simplifies the code in the Effects as they don't have to
keep track of the window they created any more. In EffectsHandler it
means that only one window needs to be created, destroyed and raised.
Also it means that we can properly react on screen size changes which had
been ignored in the past. Also quite some roundtrips to X are no longer
needed as we do not need to query the window geometry when creating the
input window.
REVIEW: 110156
The non-composited part handles the showWithX case with the four small
windows. The composited part shows a translucent QWidget with the
FrameSvg as done by the selection effect frame.
Outline connects to the Compositor toggled signal to switch the mode if
compositing gets suspended/resumed. This works fine also in the case that
the switch happens while the outline is shown. To support this Outline
is now a QObject and created with Workspace as a parent.
Given that the Outline handles both cases by itself, the outline effect
is no longer needed and is dropped together with all the hooks into the
effect system.
The define KWIN_SINGLETON adds to a class definition:
public:
static Foo *create(QObject *parent = 0);
static Foo *self() { return s_self; }
protected:
explicit Foo(QObject *parent = 0);
private:
static Foo *s_self;
There is an additional define KWIN_SINGLETON_VARIABLE to set a different
name than s_self.
The define KWIN_SINGLETON_FACTORY can be used to generate the create
method. It expands to:
Foo *Foo::s_self = 0;
Foo *Foo::create(QObject *parent)
{
Q_ASSERT(!s_self);
s_self = new Foo(parent);
return s_self;
}
In addition there are defines to again set a different variable name and
to create an object of another inheriting class.
All the classes currently using this pattern are adjusted to use these
new defines. In a few places the name was adjusted. E.g. in Compositor
the factory method was called createCompositor instead of create.
REVIEW: 109865
REVIEW: 103948
BUG: 91703
BUG: 299245
FIXED-IN: 4.11
- The setting is ignored, the decoration always gets a "true" for it
- moving a maximized window requires breaking a "strong" snap (1/16 of screen height - unless you use quick maximization)
- all snapping is done towards the client, not the frame
- QuickTileMode is exported to the decoration (just as the maximizeMode) so that it can fix the bordersize alongside that.
Ownership of decoration textures is moved from SceneOpenGL::Window to
OpenGLPaintRedirector. The PaintRedirector is responsible for updating
the textures whenever they change. For this GLTexture is extended by an
update(QImage, QPoint) method which uses glTexSubImage2D to update only
the changed parts.
The big advantage compared to before is that if e.g. only a button is
animated only the button part is updated instead of the complete deco
part.