Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
KWin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
17
Issues
17
List
Boards
Labels
Service Desk
Milestones
Merge Requests
40
Merge Requests
40
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Plasma
KWin
Commits
78ac6aaf
Commit
78ac6aaf
authored
Oct 30, 2015
by
Martin Flöser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[effects] Runtime checks for GLES instead of compile time checks
parent
fc2805d2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
48 additions
and
75 deletions
+48
-75
effects/backgroundcontrast/contrastshader.cpp
effects/backgroundcontrast/contrastshader.cpp
+1
-6
effects/blur/blurshader.cpp
effects/blur/blurshader.cpp
+13
-17
effects/coverswitch/coverswitch.cpp
effects/coverswitch/coverswitch.cpp
+1
-5
effects/cube/cube.cpp
effects/cube/cube.cpp
+17
-21
effects/invert/invert.cpp
effects/invert/invert.cpp
+1
-5
effects/logout/logout.cpp
effects/logout/logout.cpp
+1
-5
effects/lookingglass/lookingglass.cpp
effects/lookingglass/lookingglass.cpp
+1
-5
effects/mousemark/mousemark.cpp
effects/mousemark/mousemark.cpp
+7
-6
effects/screenshot/screenshot.cpp
effects/screenshot/screenshot.cpp
+6
-5
No files found.
effects/backgroundcontrast/contrastshader.cpp
View file @
78ac6aaf
...
...
@@ -113,12 +113,7 @@ void ContrastShader::init()
{
reset
();
#ifdef KWIN_HAVE_OPENGLES
const
bool
glsl_140
=
false
;
#else
const
bool
glsl_140
=
GLPlatform
::
instance
()
->
glslVersion
()
>=
kVersionNumber
(
1
,
40
);
#endif
const
bool
glsl_140
=
!
GLPlatform
::
instance
()
->
isGLES
()
&&
GLPlatform
::
instance
()
->
glslVersion
()
>=
kVersionNumber
(
1
,
40
);
QByteArray
vertexSource
;
QByteArray
fragmentSource
;
...
...
effects/blur/blurshader.cpp
View file @
78ac6aaf
...
...
@@ -173,18 +173,18 @@ void GLSLBlurShader::unbind()
int
GLSLBlurShader
::
maxKernelSize
()
const
{
#ifdef KWIN_HAVE_OPENGLES
// GL_MAX_VARYING_FLOATS not available in GLES
// querying for GL_MAX_VARYING_VECTORS crashes on nouveau
// using the minimum value of 8
return
8
*
2
;
#else
int
value
;
glGetIntegerv
(
GL_MAX_VARYING_FLOATS
,
&
value
);
// Maximum number of vec4 varyings * 2
// The code generator will pack two vec2's into each vec4.
return
value
/
2
;
#endif
if
(
GLPlatform
::
instance
()
->
isGLES
())
{
// GL_MAX_VARYING_FLOATS not available in GLES
// querying for GL_MAX_VARYING_VECTORS crashes on nouveau
// using the minimum value of 8
return
8
*
2
;
}
else
{
int
value
;
glGetIntegerv
(
GL_MAX_VARYING_FLOATS
,
&
value
);
// Maximum number of vec4 varyings * 2
// The code generator will pack two vec2's into each vec4.
return
value
/
2
;
}
}
void
GLSLBlurShader
::
init
()
...
...
@@ -208,11 +208,7 @@ void GLSLBlurShader::init()
offsets
<<
vec4
;
}
#ifdef KWIN_HAVE_OPENGLES
const
bool
glsl_140
=
false
;
#else
const
bool
glsl_140
=
GLPlatform
::
instance
()
->
glslVersion
()
>=
kVersionNumber
(
1
,
40
);
#endif
const
bool
glsl_140
=
!
GLPlatform
::
instance
()
->
isGLES
()
&&
GLPlatform
::
instance
()
->
glslVersion
()
>=
kVersionNumber
(
1
,
40
);
QByteArray
vertexSource
;
QByteArray
fragmentSource
;
...
...
effects/coverswitch/coverswitch.cpp
View file @
78ac6aaf
...
...
@@ -61,11 +61,7 @@ CoverSwitchEffect::CoverSwitchEffect()
if
(
effects
->
compositingType
()
==
OpenGL2Compositing
)
{
QString
shadersDir
=
QStringLiteral
(
"kwin/shaders/1.10/"
);
#ifdef KWIN_HAVE_OPENGLES
const
qint64
coreVersionNumber
=
kVersionNumber
(
3
,
0
);
#else
const
qint64
coreVersionNumber
=
kVersionNumber
(
1
,
40
);
#endif
const
qint64
coreVersionNumber
=
GLPlatform
::
instance
()
->
isGLES
()
?
kVersionNumber
(
3
,
0
)
:
kVersionNumber
(
1
,
40
);
if
(
GLPlatform
::
instance
()
->
glslVersion
()
>=
coreVersionNumber
)
shadersDir
=
QStringLiteral
(
"kwin/shaders/1.40/"
);
const
QString
fragmentshader
=
QStandardPaths
::
locate
(
QStandardPaths
::
GenericDataLocation
,
shadersDir
+
QStringLiteral
(
"coverswitch-reflection.glsl"
));
...
...
effects/cube/cube.cpp
View file @
78ac6aaf
...
...
@@ -96,11 +96,7 @@ CubeEffect::CubeEffect()
desktopNameFont
.
setBold
(
true
);
desktopNameFont
.
setPointSize
(
14
);
#ifdef KWIN_HAVE_OPENGLES
const
qint64
coreVersionNumber
=
kVersionNumber
(
3
,
0
);
#else
const
qint64
coreVersionNumber
=
kVersionNumber
(
1
,
40
);
#endif
const
qint64
coreVersionNumber
=
GLPlatform
::
instance
()
->
isGLES
()
?
kVersionNumber
(
3
,
0
)
:
kVersionNumber
(
1
,
40
);
if
(
GLPlatform
::
instance
()
->
glslVersion
()
>=
coreVersionNumber
)
m_shadersDir
=
QStringLiteral
(
"kwin/shaders/1.40/"
);
...
...
@@ -262,9 +258,9 @@ void CubeEffect::slotCubeCapLoaded()
effects
->
makeOpenGLContextCurrent
();
capTexture
=
new
GLTexture
(
img
);
capTexture
->
setFilter
(
GL_LINEAR
);
#ifndef KWIN_HAVE_OPENGLES
capTexture
->
setWrapMode
(
GL_CLAMP_TO_BORDER
);
#endif
if
(
!
GLPlatform
::
instance
()
->
isGLES
())
{
capTexture
->
setWrapMode
(
GL_CLAMP_TO_BORDER
);
}
// need to recreate the VBO for the cube cap
delete
m_cubeCapBuffer
;
m_cubeCapBuffer
=
NULL
;
...
...
@@ -445,10 +441,10 @@ void CubeEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
m_reflectionMatrix
.
translate
(
0.0
,
sin
(
fabs
(
manualAngle
)
*
M_PI
/
360.0
f
*
float
(
effects
->
numberOfDesktops
()))
*
addedHeight2
+
addedHeight1
-
float
(
rect
.
height
()),
0.0
);
}
#ifndef KWIN_HAVE_OPENGLES
// TODO: find a solution for GLES
glEnable
(
GL_CLIP_PLANE0
);
#endif
if
(
!
GLPlatform
::
instance
()
->
isGLES
())
{
glEnable
(
GL_CLIP_PLANE0
);
}
reflectionPainting
=
true
;
glEnable
(
GL_CULL_FACE
);
paintCap
(
true
,
-
point
-
zTranslate
);
...
...
@@ -463,10 +459,10 @@ void CubeEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
paintCap
(
false
,
-
point
-
zTranslate
);
glDisable
(
GL_CULL_FACE
);
reflectionPainting
=
false
;
#ifndef KWIN_HAVE_OPENGLES
// TODO: find a solution for GLES
glDisable
(
GL_CLIP_PLANE0
);
#endif
if
(
!
GLPlatform
::
instance
()
->
isGLES
())
{
glDisable
(
GL_CLIP_PLANE0
);
}
const
float
width
=
rect
.
width
();
const
float
height
=
rect
.
height
();
...
...
@@ -1784,14 +1780,14 @@ void CubeEffect::setActive(bool active)
desktopChangedWhileRotating
=
false
;
if
(
reflection
)
{
QRect
rect
=
effects
->
clientArea
(
FullArea
,
activeScreen
,
effects
->
currentDesktop
());
#ifndef KWIN_HAVE_OPENGLES
// clip parts above the reflection area
double
eqn
[
4
]
=
{
0.0
,
1.0
,
0.0
,
0.0
};
glPushMatrix
();
glTranslatef
(
0.0
,
rect
.
height
(),
0.0
);
glClipPlane
(
GL_CLIP_PLANE0
,
eqn
);
glPopMatrix
();
#endif
if
(
!
GLPlatform
::
instance
()
->
isGLES
())
{
double
eqn
[
4
]
=
{
0.0
,
1.0
,
0.0
,
0.0
};
glPushMatrix
();
glTranslatef
(
0.0
,
rect
.
height
(),
0.0
);
glClipPlane
(
GL_CLIP_PLANE0
,
eqn
);
glPopMatrix
();
}
float
temporaryCoeff
=
float
(
rect
.
width
())
/
tan
(
M_PI
/
float
(
effects
->
numberOfDesktops
()));
mAddedHeightCoeff1
=
sqrt
(
float
(
rect
.
height
())
*
float
(
rect
.
height
())
+
temporaryCoeff
*
temporaryCoeff
);
mAddedHeightCoeff2
=
sqrt
(
float
(
rect
.
height
())
*
float
(
rect
.
height
())
+
float
(
rect
.
width
())
*
float
(
rect
.
width
())
+
temporaryCoeff
*
temporaryCoeff
);
...
...
effects/invert/invert.cpp
View file @
78ac6aaf
...
...
@@ -74,11 +74,7 @@ bool InvertEffect::loadData()
m_inited
=
true
;
QString
shadersDir
=
QStringLiteral
(
"kwin/shaders/1.10/"
);
#ifdef KWIN_HAVE_OPENGLES
const
qint64
coreVersionNumber
=
kVersionNumber
(
3
,
0
);
#else
const
qint64
coreVersionNumber
=
kVersionNumber
(
1
,
40
);
#endif
const
qint64
coreVersionNumber
=
GLPlatform
::
instance
()
->
isGLES
()
?
kVersionNumber
(
3
,
0
)
:
kVersionNumber
(
1
,
40
);
if
(
GLPlatform
::
instance
()
->
glslVersion
()
>=
coreVersionNumber
)
shadersDir
=
QStringLiteral
(
"kwin/shaders/1.40/"
);
const
QString
fragmentshader
=
QStandardPaths
::
locate
(
QStandardPaths
::
GenericDataLocation
,
shadersDir
+
QStringLiteral
(
"invert.frag"
));
...
...
effects/logout/logout.cpp
View file @
78ac6aaf
...
...
@@ -62,11 +62,7 @@ LogoutEffect::LogoutEffect()
connect
(
effects
,
SIGNAL
(
propertyNotify
(
KWin
::
EffectWindow
*
,
long
)),
this
,
SLOT
(
slotPropertyNotify
(
KWin
::
EffectWindow
*
,
long
)));
if
(
effects
->
isOpenGLCompositing
())
{
#ifdef KWIN_HAVE_OPENGLES
const
qint64
coreVersionNumber
=
kVersionNumber
(
3
,
0
);
#else
const
qint64
coreVersionNumber
=
kVersionNumber
(
1
,
40
);
#endif
const
qint64
coreVersionNumber
=
GLPlatform
::
instance
()
->
isGLES
()
?
kVersionNumber
(
3
,
0
)
:
kVersionNumber
(
1
,
40
);
if
(
GLPlatform
::
instance
()
->
glslVersion
()
>=
coreVersionNumber
)
m_shadersDir
=
QStringLiteral
(
"kwin/shaders/1.40/"
);
}
...
...
effects/lookingglass/lookingglass.cpp
View file @
78ac6aaf
...
...
@@ -112,11 +112,7 @@ bool LookingGlassEffect::loadData()
}
QString
shadersDir
=
QStringLiteral
(
"kwin/shaders/1.10/"
);
#ifdef KWIN_HAVE_OPENGLES
const
qint64
coreVersionNumber
=
kVersionNumber
(
3
,
0
);
#else
const
qint64
coreVersionNumber
=
kVersionNumber
(
1
,
40
);
#endif
const
qint64
coreVersionNumber
=
GLPlatform
::
instance
()
->
isGLES
()
?
kVersionNumber
(
3
,
0
)
:
kVersionNumber
(
1
,
40
);
if
(
GLPlatform
::
instance
()
->
glslVersion
()
>=
coreVersionNumber
)
shadersDir
=
QStringLiteral
(
"kwin/shaders/1.40/"
);
const
QString
fragmentshader
=
QStandardPaths
::
locate
(
QStandardPaths
::
GenericDataLocation
,
shadersDir
+
QStringLiteral
(
"lookingglass.frag"
));
...
...
effects/mousemark/mousemark.cpp
View file @
78ac6aaf
...
...
@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QAction>
#include <kwinconfig.h>
#include <kwinglplatform.h>
#include <kwinglutils.h>
#include <KGlobalAccel>
#include <KLocalizedString>
...
...
@@ -116,9 +117,9 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
if
(
marks
.
isEmpty
()
&&
drawing
.
isEmpty
())
return
;
if
(
effects
->
isOpenGLCompositing
())
{
#ifndef KWIN_HAVE_OPENGLES
glEnable
(
GL_LINE_SMOOTH
);
#endif
if
(
!
GLPlatform
::
instance
()
->
isGLES
())
{
glEnable
(
GL_LINE_SMOOTH
);
}
glLineWidth
(
width
);
GLVertexBuffer
*
vbo
=
GLVertexBuffer
::
streamingBuffer
();
vbo
->
reset
();
...
...
@@ -145,9 +146,9 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
vbo
->
render
(
GL_LINE_STRIP
);
}
glLineWidth
(
1.0
);
#ifndef KWIN_HAVE_OPENGLES
glDisable
(
GL_LINE_SMOOTH
);
#endif
if
(
!
GLPlatform
::
instance
()
->
isGLES
())
{
glDisable
(
GL_LINE_SMOOTH
);
}
}
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if
(
effects
->
compositingType
()
==
XRenderCompositing
)
{
...
...
effects/screenshot/screenshot.cpp
View file @
78ac6aaf
...
...
@@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "screenshot.h"
#include <kwinglplatform.h>
#include <kwinglutils.h>
#include <kwinxrenderutils.h>
#include <QtCore/QTemporaryFile>
...
...
@@ -237,11 +238,11 @@ QString ScreenShotEffect::blitScreenshot(const QRect &geometry)
// copy content from framebuffer into image
tex
.
bind
();
img
=
QImage
(
geometry
.
size
(),
QImage
::
Format_ARGB32
);
#ifdef KWIN_HAVE_OPENGLES
glReadPixels
(
0
,
0
,
img
.
width
(),
img
.
height
(),
GL_RGBA
,
GL_UNSIGNED_BYTE
,
(
GLvoid
*
)
img
.
bits
());
#else
glGetTexImage
(
GL_TEXTURE_2D
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
(
GLvoid
*
)
img
.
bits
());
#endif
if
(
GLPlatform
::
instance
()
->
isGLES
())
{
glReadPixels
(
0
,
0
,
img
.
width
(),
img
.
height
(),
GL_RGBA
,
GL_UNSIGNED_BYTE
,
(
GLvoid
*
)
img
.
bits
());
}
else
{
glGetTexImage
(
GL_TEXTURE_2D
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
(
GLvoid
*
)
img
.
bits
());
}
tex
.
unbind
();
ScreenShotEffect
::
convertFromGLImage
(
img
,
geometry
.
width
(),
geometry
.
height
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment