Commit Graph

319 Commits (395ff72555ddcf785005499f8e21833cb6d2ccdb)

Author SHA1 Message Date
Fredrik Höglund 395ff72555 kwin: Change the way attrib formats are stored in GLVertexBuffer
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.
2013-05-28 16:35:35 +02:00
Fredrik Höglund 1de20a39a0 kwin: Add convenience classes for working with bitfields 2013-05-28 16:35:35 +02:00
Fredrik Höglund 5782d5307e kwin: Add a Color uniform in GLShader
And use it in GLVertexBufferPrivate::bindArrays(). Also store the color
as a QVector4D in GLVertexBufferPrivate.
2013-05-28 16:35:35 +02:00
Fredrik Höglund c41d05d36c kwin: Do some more refactoring in GLVertexBuffer
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.
2013-05-28 16:35:35 +02:00
Martin Gräßlin 769c746a06 Use GLSL 1.40 shaders as GLSL 300 es shaders
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
2013-05-23 09:06:21 +02:00
Martin Gräßlin ad1203e3b2 Add defines from EXT_robustness
Seem to be missing in the headers used on build.kde.org.
2013-05-23 08:38:16 +02:00
Fredrik Höglund 19796b8263 kwin: Use the robust access functions
Use glReadnPixels() instead of glReadPixels(), and glGetnUniformfv()
instead of glGetUniformfv().
2013-05-21 00:22:57 +02:00
Fredrik Höglund 2f87b7542f kwin/es: Resolve functions for GL_EXT_robustness 2013-05-21 00:22:57 +02:00
Fredrik Höglund adc581d2ab kwin: Resolve functions for GL_ARB_robustness
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.
2013-05-21 00:22:55 +02:00
Montel Laurent dd8cf0b678 normalize signal/slot 2013-05-11 14:09:15 +02:00
Fredrik Höglund 2f11f71930 kwin: Bind attributes to the same indices in all shaders
This saves us from having to look up the attribute locations each
time we update the vertex array state.
2013-05-08 18:37:39 +02:00
Fredrik Höglund 87ad8789f1 kwin: Update the GL1 code in GLVertexBuffer to match the VBO code
This saves two memory allocations in the GL1 path in setData().
2013-05-08 18:37:27 +02:00
Fredrik Höglund e1a33cec44 kwin: Don't reallocate the vertex buffer on every setData() call
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.
2013-05-08 18:37:12 +02:00
Fredrik Höglund 0475559120 kwin: Use one buffer object in GLVertexBuffer
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.
2013-05-08 18:37:02 +02:00
Fredrik Höglund e65f717b47 kwin/es: Resolve functions for GL_EXT_map_buffer_range 2013-05-08 18:36:50 +02:00
Fredrik Höglund b6585c2d8b kwin/es: Resolve functions for GL_OES_mapbuffer 2013-05-08 18:36:45 +02:00
Fredrik Höglund 11b9323f3d kwin: Resolve functions for GL_ARB_map_buffer_range 2013-05-08 18:36:38 +02:00
Fredrik Höglund 08d3b6cc3a kwin: Resolve more functions from ARB_vertex_buffer_object
This patch resolves:
    glMapBuffer()
    glUnmapBuffer()
    glBufferSubData()
    glGetBufferSubData()
2013-05-08 18:36:04 +02:00
Fredrik Höglund b7f1856a35 kwin: Fix color correction with GLSL 1.40 2013-05-08 18:33:03 +02:00
Fredrik Höglund 54308889f0 kwin: Bind fragdata locations in ShaderManager
Fragment shaders are expected to declare a vec4 fragColor output,
which will be bound to the first draw buffer.
2013-05-08 18:33:03 +02:00
Fredrik Höglund 54b63a85a6 kwin: Add GLSL 1.40 versions of the scene shaders
Adjust ShaderManager to load the 1.40 versions when GLSL 1.40
is supported.
2013-05-08 18:33:03 +02:00
Fredrik Höglund 79db2fc98a kwin: Move the scene shaders into shaders/1.10 2013-05-08 18:33:03 +02:00
Fredrik Höglund fe559c2f2c kwin: Refactor the ShaderManager code
This patch reduces code duplication and simplifies the code in general.
2013-05-08 18:33:03 +02:00
Fredrik Höglund 85a87bfcd1 kwin: Refactor GLShader to allow explicit linking
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.
2013-05-08 18:33:02 +02:00
Fredrik Höglund e0003db385 kwin: Resolve functions for GL_EXT_gpu_shader4 2013-05-08 18:33:02 +02:00
Fredrik Höglund 2bcad53bbb kwin: Resolve functions for GL_ARB_vertex_array_object 2013-05-08 18:33:02 +02:00
Fredrik Höglund 2b00beecd2 kwin: Don't require GL_ARB_shading_language_100
This version of GLSL is not supported in a core context.
2013-05-08 18:33:02 +02:00
Fredrik Höglund 5b80d8d513 kwin: Fix shader function resolution for core contexts 2013-05-08 18:33:02 +02:00
Fredrik Höglund cb81e11375 kwin: Fix FBO function resolution for core contexts 2013-05-08 18:33:02 +02:00
Fredrik Höglund 855a7cc897 kwin: Fix glActiveTexture() resolution for core contexts 2013-05-08 18:33:02 +02:00
Fredrik Höglund 1bcf95f3f9 kwin: Fix VBO function resolution for core contexts
Mesa doesn't advertise extensions that were core in 1.5 in an OpenGL
context that uses the core profile.
2013-05-08 18:33:02 +02:00
Fredrik Höglund 63e0d32706 kwin: Fix extension list query for core contexts
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.
2013-05-08 18:33:01 +02:00
Fredrik Höglund d116ef6655 kwin/egl: Add defines for EGL_KHR_create_context 2013-05-08 18:33:01 +02:00
Fredrik Höglund aab026af93 kwin: Resolve functions for GLX_ARB_create_context 2013-05-08 18:12:43 +02:00
Martin Gräßlin 49e734f743 Change the way how effects can get mouse events
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
2013-05-03 08:15:42 +02:00
Jaime Torres 4ec0f64ea3 initialize a member and initialize a boolean
one less valgrind warning and one cppcheck warning less

REVIEW: 107603
2013-04-29 18:14:50 +02:00
Martin Gräßlin 1a3bc3f60c Split Outline in a composited and non-composited part
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.
2013-04-25 09:04:02 +02:00
Martin Gräßlin 0fb27fd12e Defines to create the boilerplate code for KWin's singleton classes
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
2013-04-15 09:57:25 +02:00
Thomas Lübking ee1d6d568d add effect debug interface and dbus export
allows for effect specific debugging details

REVIEW: 107063
2013-03-28 20:31:02 +01:00
Thomas Lübking 6fb5353cab remove moveResizeMaximized option
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.
2013-03-24 22:26:48 +01:00
Thomas Lübking a5cce085af catch geometry updates of moving clients
and bind geometry change signals dynamically

REVIEW: 109570
2013-03-20 22:23:43 +01:00
Thomas Lübking 5299f728fe catch geometry updates of moving clients
and bind geometry change signals dynamically

REVIEW: 109570
(cherry picked from commit eb2db41304f1ec1e597e9bd282a9c4f0b7dd1e54)

Conflicts:
	kwin/libkwineffects/kwinanimationeffect.cpp
2013-03-20 22:23:41 +01:00
Martin Gräßlin 98a04893a6 Use mgraesslin@kde.org for my mail address in Copyright and AboutData 2013-03-12 13:17:53 +01:00
Martin Gräßlin fbc11aad13 Temporarily revert to XDisplayWidth/Height
We don't like broken master. Proper fix coming later on.

BUG: 316040
2013-03-11 15:14:21 +01:00
Martin Gräßlin 7ab5df9de8 Define GL_UNPACK_* for gles if not defined
Should fix build error in build.kde.org.
2013-03-11 12:36:40 +01:00
Martin Gräßlin 9206f530ce Adding support for GL_EXT_texture_format_BGRA8888 in GLES
If extension is present texture format BGRA_EXT is used for loading
textures from QImages.

REVIEW: 109090
2013-03-11 11:21:14 +01:00
Martin Gräßlin aa549f45d5 OpenGLPaintRedirector updates textures directly
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.
2013-03-11 11:21:11 +01:00
Martin Gräßlin 6424a44632 Add some missing includes with Qt5/KF5 2013-03-07 13:59:16 +01:00
Martin Gräßlin 544b772e42 Use non obsoleted ctor for KXMessages 2013-03-07 13:59:16 +01:00
Martin Gräßlin 32b6ef42b9 Strip module path from all Qt #include <>
Done with:
fixqt4headers.pl --strip-modules

REVIEW: 109176
2013-03-06 10:26:56 +01:00