Merge lp:~mc-return/compiz/compiz.merge-opengl-cleanup into lp:compiz/0.9.11

Proposed by MC Return
Status: Work in progress
Proposed branch: lp:~mc-return/compiz/compiz.merge-opengl-cleanup
Merge into: lp:compiz/0.9.11
Diff against target: 6177 lines (+1581/-1449)
26 files modified
plugins/opengl/include/opengl/doublebuffer.h (+14/-8)
plugins/opengl/include/opengl/opengl.h (+136/-133)
plugins/opengl/include/opengl/program.h (+38/-16)
plugins/opengl/include/opengl/programcache.h (+2/-1)
plugins/opengl/include/opengl/texture.h (+11/-5)
plugins/opengl/include/opengl/vector.h (+6/-2)
plugins/opengl/src/blacklist/blacklist.cpp (+8/-6)
plugins/opengl/src/blacklist/blacklist.h (+4/-2)
plugins/opengl/src/doublebuffer/src/double-buffer.cpp (+2/-4)
plugins/opengl/src/framebufferobject.cpp (+26/-21)
plugins/opengl/src/fsregion/fsregion.cpp (+9/-11)
plugins/opengl/src/fsregion/fsregion.h (+10/-4)
plugins/opengl/src/matrix.cpp (+24/-22)
plugins/opengl/src/opengl.cpp (+12/-10)
plugins/opengl/src/paint.cpp (+242/-260)
plugins/opengl/src/privates.h (+99/-85)
plugins/opengl/src/privatetexture.h (+17/-6)
plugins/opengl/src/privatevertexbuffer.h (+47/-39)
plugins/opengl/src/program.cpp (+46/-36)
plugins/opengl/src/programcache.cpp (+29/-34)
plugins/opengl/src/screen.cpp (+484/-453)
plugins/opengl/src/shadercache.cpp (+53/-47)
plugins/opengl/src/texture.cpp (+70/-61)
plugins/opengl/src/vector.cpp (+35/-33)
plugins/opengl/src/vertexbuffer.cpp (+108/-106)
plugins/opengl/src/window.cpp (+49/-44)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-opengl-cleanup
Reviewer Review Type Date Requested Status
Compiz Maintainers Pending
Review via email: mp+176724@code.launchpad.net

Commit message

*OpenGL plugin, cleanup:

Bail out of functions ASAP, do not calculate stuff you might not need.
Merged if condition checks.
Use pre- instead of postfix de- and increments.
Declare variables outside of loops.
Declarations and assignment of local variables in one line.
Removed redundant brackets.
Removed and added newlines for better readability.
Fixed indentation.
Fixed a few typos in comments and debug-messages.
Added TODO comment.

*OpenGL plugin, fixes:

framebufferobject.cpp:
Also initialize the non-static struct member "rbStencilId" in the
PrivateGLFramebufferObject::PrivateGLFramebufferObject () constructor
(LP: #1101410)

screen.cpp:
Initialize all the non-static class member fields (glxPixmapFBConfigs,
lastViewport) and members (filter, saveWindow) in the PrivateGLScreen::
PrivateGLScreen (GLScreen *) constructor.
(LP: #1101408)

texture.cpp:
Also initialize the non-static class members "x11Pixmap" and "source" in
the TfpTexture::TfpTexture () ctor.
(LP: #1101594)

vertexbuffer.cpp:
Also initialize the non-static class members "color", "primitiveType" and
"usage" in the PrivateVertexBuffer::PrivateVertexBuffer () constructor
(LP: #1101493)

To post a comment you must log in.

Unmerged revisions

3688. By MC Return

Merged latest lp:compiz

3687. By MC Return

Merged latest lp:compiz and fixed conflict in plugins/opengl/src/paint.cpp

3686. By MC Return

framebufferobject.cpp:
Also initialize the non-static struct member "rbStencilId" in the
PrivateGLFramebufferObject::PrivateGLFramebufferObject () constructor
(LP: #1101410)

Removed alignment in the ctor

3685. By MC Return

screen.cpp:
Initialize all the non-static class member fields (glxPixmapFBConfigs,
lastViewport) and members (filter, saveWindow) in the PrivateGLScreen::
PrivateGLScreen (GLScreen *) constructor
(LP: #1101408)

Reverted alignment in the constructor

3684. By MC Return

Also initialize the non-static class members "color", "primitiveType" and
"usage" in the PrivateVertexBuffer::PrivateVertexBuffer () constructor
(LP: #1101493)

3683. By MC Return

texture.cpp:
Also initialize the non-static class members "x11Pixmap" and "source" in
the TfpTexture::TfpTexture () ctor (LP: #1101594)

3682. By MC Return

Indentation fixes
Re-added "lost" code in paint.cpp

3681. By MC Return

Removed bracket (typo)

3680. By MC Return

Merged latest lp:compiz and fixed conflict in plugins/opengl/src/window.cpp

3679. By MC Return

Added missing " | NoOcclusionDetection"

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/opengl/include/opengl/doublebuffer.h'
2--- plugins/opengl/include/opengl/doublebuffer.h 2012-11-08 09:17:39 +0000
3+++ plugins/opengl/include/opengl/doublebuffer.h 2013-07-24 16:05:45 +0000
4@@ -18,16 +18,17 @@
5 class DoubleBuffer
6 {
7 public:
8+
9 DoubleBuffer (const impl::GLXSwapIntervalEXTFunc &swapIntervalFunc,
10 const impl::GLXWaitVideoSyncSGIFunc &waitVideoSyncFunc);
11 virtual ~DoubleBuffer ();
12
13- virtual void swap () const = 0;
14- virtual bool blitAvailable () const = 0;
15- virtual void blit (const CompRegion &region) const = 0;
16- virtual bool fallbackBlitAvailable () const = 0;
17+ virtual void swap () const = 0;
18+ virtual bool blitAvailable () const = 0;
19+ virtual void blit (const CompRegion &region) const = 0;
20+ virtual bool fallbackBlitAvailable () const = 0;
21 virtual void fallbackBlit (const CompRegion &region) const = 0;
22- virtual void copyFrontToBack () const = 0;
23+ virtual void copyFrontToBack () const = 0;
24
25 typedef enum
26 {
27@@ -56,13 +57,18 @@
28 FrameThrottledInternally
29 } FrameThrottleState;
30
31- void set (Setting name, bool value);
32- void render (const CompRegion &region, bool fullscreen);
33+ void set (Setting name,
34+ bool value);
35+
36+ void render (const CompRegion &region,
37+ bool fullscreen);
38+
39 void vsync (FrontbufferRedrawType redrawType);
40
41 bool hardwareVSyncFunctional ();
42
43 protected:
44+
45 bool setting[_NSETTINGS];
46
47 private:
48@@ -72,7 +78,7 @@
49 virtual bool enableBlockingVideoSync (FrontbufferRedrawType, FrameThrottleState &);
50 virtual void disableBlockingVideoSync ();
51
52- SyncType syncType;
53+ SyncType syncType;
54
55 FrameThrottleState bufferFrameThrottleState;
56 unsigned int blockingVSyncUnthrottledFrames;
57
58=== modified file 'plugins/opengl/include/opengl/opengl.h'
59--- plugins/opengl/include/opengl/opengl.h 2013-04-27 05:54:57 +0000
60+++ plugins/opengl/include/opengl/opengl.h 2013-07-24 16:05:45 +0000
61@@ -87,77 +87,79 @@
62 class PrivateGLScreen;
63 class PrivateGLWindow;
64
65-extern GLushort defaultColor[4];
66+extern GLushort defaultColor[4];
67
68 #ifndef GLX_EXT_texture_from_pixmap
69-#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
70-#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
71-#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
72-#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
73-#define GLX_Y_INVERTED_EXT 0x20D4
74-#define GLX_TEXTURE_FORMAT_EXT 0x20D5
75-#define GLX_TEXTURE_TARGET_EXT 0x20D6
76-#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
77-#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
78-#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
79-#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
80-#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
81-#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
82-#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
83-#define GLX_TEXTURE_1D_EXT 0x20DB
84-#define GLX_TEXTURE_2D_EXT 0x20DC
85-#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
86-#define GLX_FRONT_LEFT_EXT 0x20DE
87+#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
88+#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
89+#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
90+#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
91+#define GLX_Y_INVERTED_EXT 0x20D4
92+#define GLX_TEXTURE_FORMAT_EXT 0x20D5
93+#define GLX_TEXTURE_TARGET_EXT 0x20D6
94+#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
95+#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
96+#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
97+#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
98+#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
99+#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
100+#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
101+#define GLX_TEXTURE_1D_EXT 0x20DB
102+#define GLX_TEXTURE_2D_EXT 0x20DC
103+#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
104+#define GLX_FRONT_LEFT_EXT 0x20DE
105 #endif
106
107-namespace GL {
108+namespace GL
109+{
110 #ifdef USE_GLES
111- typedef EGLImageKHR (*EGLCreateImageKHRProc) (EGLDisplay dpy,
112- EGLContext ctx,
113- EGLenum target,
114- EGLClientBuffer buffer,
115- const EGLint *attrib_list);
116- typedef EGLBoolean (*EGLDestroyImageKHRProc) (EGLDisplay dpy,
117- EGLImageKHR image);
118-
119- typedef void (*GLEGLImageTargetTexture2DOESProc) (GLenum target,
120- GLeglImageOES image);
121-
122- typedef EGLBoolean (*EGLPostSubBufferNVProc) (EGLDisplay dpy,
123- EGLSurface surface,
124- EGLint x, EGLint y,
125- EGLint width, EGLint height);
126-
127+typedef EGLImageKHR (*EGLCreateImageKHRProc) (EGLDisplay dpy,
128+ EGLContext ctx,
129+ EGLenum target,
130+ EGLClientBuffer buffer,
131+ const EGLint *attrib_list);
132+
133+typedef EGLBoolean (*EGLDestroyImageKHRProc) (EGLDisplay dpy,
134+ EGLImageKHR image);
135+
136+typedef void (*GLEGLImageTargetTexture2DOESProc) (GLenum target,
137+ GLeglImageOES image);
138+
139+typedef EGLBoolean (*EGLPostSubBufferNVProc) (EGLDisplay dpy,
140+ EGLSurface surface,
141+ EGLint x,
142+ EGLint y,
143+ EGLint width,
144+ EGLint height);
145 #else
146 typedef void (*FuncPtr) (void);
147
148 typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName);
149
150- typedef void (*GLXBindTexImageProc) (Display *display,
151- GLXDrawable drawable,
152- int buffer,
153- int *attribList);
154- typedef void (*GLXReleaseTexImageProc) (Display *display,
155- GLXDrawable drawable,
156- int buffer);
157- typedef void (*GLXQueryDrawableProc) (Display *display,
158- GLXDrawable drawable,
159- int attribute,
160- unsigned int *value);
161-
162- typedef void (*GLXCopySubBufferProc) (Display *display,
163- GLXDrawable drawable,
164- int x,
165- int y,
166- int width,
167- int height);
168-
169- typedef int (*GLXGetVideoSyncProc) (unsigned int *count);
170- typedef int (*GLXWaitVideoSyncProc) (int divisor,
171- int remainder,
172- unsigned int *count);
173- typedef int (*GLXSwapIntervalProc) (int interval);
174-
175+typedef void (*GLXBindTexImageProc) (Display *display,
176+ GLXDrawable drawable,
177+ int buffer,
178+ int *attribList);
179+typedef void (*GLXReleaseTexImageProc) (Display *display,
180+ GLXDrawable drawable,
181+ int buffer);
182+typedef void (*GLXQueryDrawableProc) (Display *display,
183+ GLXDrawable drawable,
184+ int attribute,
185+ unsigned int *value);
186+
187+typedef void (*GLXCopySubBufferProc) (Display *display,
188+ GLXDrawable drawable,
189+ int x,
190+ int y,
191+ int width,
192+ int height);
193+
194+typedef int (*GLXGetVideoSyncProc) (unsigned int *count);
195+typedef int (*GLXWaitVideoSyncProc) (int divisor,
196+ int remainder,
197+ unsigned int *count);
198+typedef int (*GLXSwapIntervalProc) (int interval);
199
200 #ifndef GLX_VERSION_1_3
201 typedef struct __GLXFBConfigRec *GLXFBConfig;
202@@ -413,102 +415,102 @@
203 extern GLDisableVertexAttribArrayProc disableVertexAttribArray;
204 extern GLVertexAttribPointerProc vertexAttribPointer;
205
206- extern GLGenRenderbuffersProc genRenderbuffers;
207- extern GLDeleteRenderbuffersProc deleteRenderbuffers;
208- extern GLBindRenderbufferProc bindRenderbuffer;
209+ extern GLGenRenderbuffersProc genRenderbuffers;
210+ extern GLDeleteRenderbuffersProc deleteRenderbuffers;
211+ extern GLBindRenderbufferProc bindRenderbuffer;
212 extern GLFramebufferRenderbufferProc framebufferRenderbuffer;
213- extern GLRenderbufferStorageProc renderbufferStorage;
214+ extern GLRenderbufferStorageProc renderbufferStorage;
215
216 #ifndef USE_GLES
217- extern GLCreateShaderObjectARBProc createShaderObjectARB;
218+ extern GLCreateShaderObjectARBProc createShaderObjectARB;
219 extern GLCreateProgramObjectARBProc createProgramObjectARB;
220- extern GLShaderSourceARBProc shaderSourceARB;
221- extern GLCompileShaderARBProc compileShaderARB;
222- extern GLValidateProgramARBProc validateProgramARB;
223- extern GLDeleteObjectARBProc deleteObjectARB;
224- extern GLAttachObjectARBProc attachObjectARB;
225- extern GLLinkProgramARBProc linkProgramARB;
226- extern GLUseProgramObjectARBProc useProgramObjectARB;
227- extern GLGetUniformLocationARBProc getUniformLocationARB;
228- extern GLGetAttribLocationARBProc getAttribLocationARB;
229+ extern GLShaderSourceARBProc shaderSourceARB;
230+ extern GLCompileShaderARBProc compileShaderARB;
231+ extern GLValidateProgramARBProc validateProgramARB;
232+ extern GLDeleteObjectARBProc deleteObjectARB;
233+ extern GLAttachObjectARBProc attachObjectARB;
234+ extern GLLinkProgramARBProc linkProgramARB;
235+ extern GLUseProgramObjectARBProc useProgramObjectARB;
236+ extern GLGetUniformLocationARBProc getUniformLocationARB;
237+ extern GLGetAttribLocationARBProc getAttribLocationARB;
238
239 extern GLGetObjectParameterivProc getObjectParameteriv;
240- extern GLGetInfoLogProc getInfoLog;
241+ extern GLGetInfoLogProc getInfoLog;
242 #endif
243
244 #ifdef USE_GLES
245
246 static const GLenum FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING;
247- static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER;
248- static const GLenum RENDERBUFFER = GL_RENDERBUFFER;
249- static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0;
250- static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT;
251- static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT;
252- static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_OES;
253+ static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER;
254+ static const GLenum RENDERBUFFER = GL_RENDERBUFFER;
255+ static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0;
256+ static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT;
257+ static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT;
258+ static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_OES;
259
260 /* OpenGL|ES does not support different draw/read framebuffers */
261- static const GLenum DRAW_FRAMEBUFFER = GL_FRAMEBUFFER;
262- static const GLenum READ_FRAMEBUFFER = GL_FRAMEBUFFER;
263- static const GLenum DRAW_FRAMEBUFFER_BINDING = FRAMEBUFFER_BINDING;
264- static const GLenum READ_FRAMEBUFFER_BINDING = FRAMEBUFFER_BINDING;
265+ static const GLenum DRAW_FRAMEBUFFER = GL_FRAMEBUFFER;
266+ static const GLenum READ_FRAMEBUFFER = GL_FRAMEBUFFER;
267+ static const GLenum DRAW_FRAMEBUFFER_BINDING = FRAMEBUFFER_BINDING;
268+ static const GLenum READ_FRAMEBUFFER_BINDING = FRAMEBUFFER_BINDING;
269
270- static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE;
271- static const GLenum FRAMEBUFFER_UNDEFINED = 0;
272- static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
273+ static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE;
274+ static const GLenum FRAMEBUFFER_UNDEFINED = 0;
275+ static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
276 static const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
277- static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0;
278- static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0;
279- static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED;
280- static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0;
281- static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0;
282- static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
283+ static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0;
284+ static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0;
285+ static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED;
286+ static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0;
287+ static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0;
288+ static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
289
290 static const GLenum ARRAY_BUFFER = GL_ARRAY_BUFFER;
291- static const GLenum STATIC_DRAW = GL_STATIC_DRAW;
292- static const GLenum STREAM_DRAW = GL_STREAM_DRAW;
293+ static const GLenum STATIC_DRAW = GL_STATIC_DRAW;
294+ static const GLenum STREAM_DRAW = GL_STREAM_DRAW;
295 static const GLenum DYNAMIC_DRAW = GL_DYNAMIC_DRAW;
296
297 static const GLenum INFO_LOG_LENGTH = GL_INFO_LOG_LENGTH;
298- static const GLenum COMPILE_STATUS = GL_COMPILE_STATUS;
299- static const GLenum LINK_STATUS = GL_LINK_STATUS;
300+ static const GLenum COMPILE_STATUS = GL_COMPILE_STATUS;
301+ static const GLenum LINK_STATUS = GL_LINK_STATUS;
302 static const GLenum FRAGMENT_SHADER = GL_FRAGMENT_SHADER;
303- static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER;
304+ static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER;
305
306 #else
307
308 static const GLenum FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING_EXT;
309- static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER_EXT;
310- static const GLenum RENDERBUFFER = GL_RENDERBUFFER;
311- static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0_EXT;
312- static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT_EXT;
313- static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT_EXT;
314- static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_EXT;
315+ static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER_EXT;
316+ static const GLenum RENDERBUFFER = GL_RENDERBUFFER;
317+ static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0_EXT;
318+ static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT_EXT;
319+ static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT_EXT;
320+ static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_EXT;
321
322- static const GLenum DRAW_FRAMEBUFFER = GL_DRAW_FRAMEBUFFER_EXT;
323- static const GLenum READ_FRAMEBUFFER = GL_READ_FRAMEBUFFER_EXT;
324- static const GLenum DRAW_FRAMEBUFFER_BINDING = GL_DRAW_FRAMEBUFFER_BINDING_EXT;
325- static const GLenum READ_FRAMEBUFFER_BINDING = GL_READ_FRAMEBUFFER_BINDING_EXT;
326- static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE_EXT;
327- static const GLenum FRAMEBUFFER_UNDEFINED = GL_FRAMEBUFFER_UNDEFINED;
328- static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
329+ static const GLenum DRAW_FRAMEBUFFER = GL_DRAW_FRAMEBUFFER_EXT;
330+ static const GLenum READ_FRAMEBUFFER = GL_READ_FRAMEBUFFER_EXT;
331+ static const GLenum DRAW_FRAMEBUFFER_BINDING = GL_DRAW_FRAMEBUFFER_BINDING_EXT;
332+ static const GLenum READ_FRAMEBUFFER_BINDING = GL_READ_FRAMEBUFFER_BINDING_EXT;
333+ static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE_EXT;
334+ static const GLenum FRAMEBUFFER_UNDEFINED = GL_FRAMEBUFFER_UNDEFINED;
335+ static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
336 static const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
337- static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT;
338- static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT;
339- static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
340- static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT;
341- static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT;
342- static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0;
343+ static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT;
344+ static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT;
345+ static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
346+ static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT;
347+ static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT;
348+ static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0;
349
350 static const GLenum ARRAY_BUFFER = GL_ARRAY_BUFFER_ARB;
351- static const GLenum STATIC_DRAW = GL_STATIC_DRAW_ARB;
352- static const GLenum STREAM_DRAW = GL_STREAM_DRAW_ARB;
353+ static const GLenum STATIC_DRAW = GL_STATIC_DRAW_ARB;
354+ static const GLenum STREAM_DRAW = GL_STREAM_DRAW_ARB;
355 static const GLenum DYNAMIC_DRAW = GL_DYNAMIC_DRAW_ARB;
356
357 static const GLenum INFO_LOG_LENGTH = GL_OBJECT_INFO_LOG_LENGTH_ARB;
358- static const GLenum COMPILE_STATUS = GL_OBJECT_COMPILE_STATUS_ARB;
359- static const GLenum LINK_STATUS = GL_OBJECT_LINK_STATUS_ARB;
360+ static const GLenum COMPILE_STATUS = GL_OBJECT_COMPILE_STATUS_ARB;
361+ static const GLenum LINK_STATUS = GL_OBJECT_LINK_STATUS_ARB;
362 static const GLenum FRAGMENT_SHADER = GL_FRAGMENT_SHADER_ARB;
363- static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER_ARB;
364+ static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER_ARB;
365
366 #endif
367
368@@ -553,7 +555,8 @@
369 #endif
370 };
371
372-struct GLScreenPaintAttrib {
373+struct GLScreenPaintAttrib
374+{
375 GLfloat xRotate;
376 GLfloat yRotate;
377 GLfloat vRotate;
378@@ -566,7 +569,8 @@
379 #define MAX_DEPTH 32
380
381 #ifndef USE_GLES
382-struct GLFBConfig {
383+struct GLFBConfig
384+{
385 GLXFBConfig fbConfig;
386 int yInverted;
387 int mipmap;
388@@ -647,9 +651,9 @@
389 CompOutput *output,
390 GLMatrix *mask);
391
392- virtual void glEnableOutputClipping (const GLMatrix &,
393+ virtual void glEnableOutputClipping (const GLMatrix &,
394 const CompRegion &,
395- CompOutput *);
396+ CompOutput *);
397 virtual void glDisableOutputClipping ();
398
399 virtual GLMatrix *projectionMatrix ();
400@@ -669,9 +673,9 @@
401 /**
402 * Hookable function used by plugins to determine stenciling mask
403 */
404- virtual void glBufferStencil (const GLMatrix &matrix,
405- GLVertexBuffer &vertexBuffer,
406- CompOutput *output);
407+ virtual void glBufferStencil (const GLMatrix &matrix,
408+ GLVertexBuffer &vertexBuffer,
409+ CompOutput *output);
410
411 };
412
413@@ -925,7 +929,7 @@
414 const GLTexture::List & textures () const;
415
416 /**
417- * Returns the matrices for the tiled textures for this windwo
418+ * Returns the matrices for the tiled textures for this window
419 */
420 const GLTexture::MatrixList & matrices () const;
421
422@@ -971,4 +975,3 @@
423 };
424
425 #endif
426-
427
428=== modified file 'plugins/opengl/include/opengl/program.h'
429--- plugins/opengl/include/opengl/program.h 2012-05-17 10:41:21 +0000
430+++ plugins/opengl/include/opengl/program.h 2013-07-24 16:05:45 +0000
431@@ -40,6 +40,7 @@
432 class GLProgram
433 {
434 public:
435+
436 GLProgram (CompString &vertexShader, CompString &fragmentShader);
437 ~GLProgram ();
438
439@@ -47,29 +48,50 @@
440 void bind ();
441 void unbind ();
442
443- bool setUniform (const char *name, GLfloat value);
444- bool setUniform (const char *name, GLint value);
445- bool setUniform (const char *name, const GLMatrix &value);
446- bool setUniform2f (const char *name, GLfloat x, GLfloat y);
447- bool setUniform3f (const char *name, GLfloat x, GLfloat y, GLfloat z);
448+ bool setUniform (const char *name,
449+ GLfloat value);
450+
451+ bool setUniform (const char *name,
452+ GLint value);
453+
454+ bool setUniform (const char *name,
455+ const GLMatrix &value);
456+
457+ bool setUniform2f (const char *name,
458+ GLfloat x,
459+ GLfloat y);
460+
461+ bool setUniform3f (const char *name,
462+ GLfloat x,
463+ GLfloat y,
464+ GLfloat z);
465+
466 bool setUniform4f (const char *name,
467- GLfloat x,
468- GLfloat y,
469- GLfloat z,
470- GLfloat w);
471- bool setUniform2i (const char *name, GLint x, GLint y);
472- bool setUniform3i (const char *name, GLint x, GLint y, GLint z);
473+ GLfloat x,
474+ GLfloat y,
475+ GLfloat z,
476+ GLfloat w);
477+
478+ bool setUniform2i (const char *name,
479+ GLint x,
480+ GLint y);
481+
482+ bool setUniform3i (const char *name,
483+ GLint x,
484+ GLint y,
485+ GLint z);
486+
487 bool setUniform4i (const char *name,
488- GLint x,
489- GLint y,
490- GLint z,
491- GLint w);
492+ GLint x,
493+ GLint y,
494+ GLint z,
495+ GLint w);
496
497 GLuint attributeLocation (const char *name);
498
499 private:
500+
501 PrivateProgram *priv;
502 };
503
504 #endif // _COMPIZ_GLPROGRAM_H
505-
506
507=== modified file 'plugins/opengl/include/opengl/programcache.h'
508--- plugins/opengl/include/opengl/programcache.h 2012-05-17 10:41:21 +0000
509+++ plugins/opengl/include/opengl/programcache.h 2013-07-24 16:05:45 +0000
510@@ -38,9 +38,11 @@
511 class GLProgramCache
512 {
513 private:
514+
515 PrivateProgramCache *priv;
516
517 public:
518+
519 GLProgramCache (size_t);
520 ~GLProgramCache ();
521
522@@ -48,4 +50,3 @@
523 };
524
525 #endif // _COMPIZ_GLPROGRAMCACHE_H
526-
527
528=== modified file 'plugins/opengl/include/opengl/texture.h'
529--- plugins/opengl/include/opengl/texture.h 2012-09-18 11:32:20 +0000
530+++ plugins/opengl/include/opengl/texture.h 2013-07-24 16:05:45 +0000
531@@ -73,15 +73,18 @@
532 /**
533 * Class which represents an openGL texture
534 */
535-class GLTexture : public CompRect {
536+class GLTexture : public CompRect
537+{
538 public:
539
540- typedef enum {
541+ typedef enum
542+ {
543 Fast,
544 Good
545 } Filter;
546
547- typedef struct {
548+ typedef struct
549+ {
550 float xx; float yx;
551 float xy; float yy;
552 float x0; float y0;
553@@ -93,9 +96,10 @@
554 * Class which represents a list of openGL textures,
555 * usually used for texture tiling
556 */
557- class List : public std::vector <GLTexture *> {
558-
559+ class List : public std::vector <GLTexture *>
560+ {
561 public:
562+
563 List ();
564 List (unsigned int);
565 List (const List &);
566@@ -224,12 +228,14 @@
567 friend class PrivateTexture;
568
569 protected:
570+
571 GLTexture ();
572 virtual ~GLTexture ();
573
574 void setData (GLenum target, Matrix &m, bool mipmap);
575
576 private:
577+
578 PrivateTexture *priv;
579 };
580
581
582=== modified file 'plugins/opengl/include/opengl/vector.h'
583--- plugins/opengl/include/opengl/vector.h 2012-05-17 10:41:21 +0000
584+++ plugins/opengl/include/opengl/vector.h 2013-07-24 16:05:45 +0000
585@@ -30,9 +30,12 @@
586 * Class which describes a point or vector
587 * in 3D space
588 */
589-class GLVector {
590+class GLVector
591+{
592 public:
593- typedef enum {
594+
595+ typedef enum
596+ {
597 x,
598 y,
599 z,
600@@ -105,6 +108,7 @@
601 GLVector& homogenize ();
602
603 private:
604+
605 friend GLVector operator+ (const GLVector& lhs,
606 const GLVector& rhs);
607 friend GLVector operator- (const GLVector& lhs,
608
609=== modified file 'plugins/opengl/src/blacklist/blacklist.cpp'
610--- plugins/opengl/src/blacklist/blacklist.cpp 2012-12-12 07:24:34 +0000
611+++ plugins/opengl/src/blacklist/blacklist.cpp 2013-07-24 16:05:45 +0000
612@@ -30,8 +30,10 @@
613 namespace compiz {
614 namespace opengl {
615
616-bool blacklisted (const char *blacklistRegex, const char *glVendor,
617- const char *glRenderer, const char *glVersion)
618+bool blacklisted (const char *blacklistRegex,
619+ const char *glVendor,
620+ const char *glRenderer,
621+ const char *glVersion)
622 {
623 bool matches = false;
624
625@@ -42,16 +44,16 @@
626 // Ensure the regex contains something other than spaces, or ignore.
627 const char *p = blacklistRegex;
628 while (*p == ' ')
629- p++;
630+ ++p;
631
632 if (*p && !regcomp (&re, blacklistRegex, REG_EXTENDED))
633 {
634 char driver[1024];
635
636 snprintf (driver, sizeof driver, "%s\n%s\n%s",
637- glVendor ? glVendor : "",
638- glRenderer ? glRenderer : "",
639- glVersion ? glVersion : "");
640+ glVendor ? glVendor : "",
641+ glRenderer ? glRenderer : "",
642+ glVersion ? glVersion : "");
643
644 if (!regexec (&re, driver, 0, NULL, 0))
645 matches = true;
646
647=== modified file 'plugins/opengl/src/blacklist/blacklist.h'
648--- plugins/opengl/src/blacklist/blacklist.h 2012-12-12 07:24:34 +0000
649+++ plugins/opengl/src/blacklist/blacklist.h 2013-07-24 16:05:45 +0000
650@@ -29,8 +29,10 @@
651 namespace compiz {
652 namespace opengl {
653
654-bool blacklisted (const char *blacklistRegex, const char *glVendor,
655- const char *glRenderer, const char *glVersion);
656+bool blacklisted (const char *blacklistRegex,
657+ const char *glVendor,
658+ const char *glRenderer,
659+ const char *glVersion);
660
661 } // namespace opengl
662 } // namespace compiz
663
664=== modified file 'plugins/opengl/src/doublebuffer/src/double-buffer.cpp'
665--- plugins/opengl/src/doublebuffer/src/double-buffer.cpp 2012-11-09 06:13:00 +0000
666+++ plugins/opengl/src/doublebuffer/src/double-buffer.cpp 2013-07-24 16:05:45 +0000
667@@ -66,7 +66,7 @@
668
669 void
670 DoubleBuffer::render (const CompRegion &region,
671- bool fullscreen)
672+ bool fullscreen)
673 {
674 if (fullscreen)
675 {
676@@ -77,9 +77,7 @@
677
678 if (setting[NEED_PERSISTENT_BACK_BUFFER] &&
679 !setting[HAVE_PERSISTENT_BACK_BUFFER])
680- {
681 copyFrontToBack ();
682- }
683 }
684 else
685 {
686@@ -124,7 +122,7 @@
687
688 /* Accumulate throttle */
689 if (throttleState == ExternalFrameThrottlingRequired)
690- blockingVSyncUnthrottledFrames++;
691+ ++blockingVSyncUnthrottledFrames;
692 else
693 blockingVSyncUnthrottledFrames = 0;
694
695
696=== modified file 'plugins/opengl/src/framebufferobject.cpp'
697--- plugins/opengl/src/framebufferobject.cpp 2012-08-06 09:44:49 +0000
698+++ plugins/opengl/src/framebufferobject.cpp 2013-07-24 16:05:45 +0000
699@@ -32,6 +32,7 @@
700 PrivateGLFramebufferObject () :
701 fboId (0),
702 pushedId (0),
703+ rbStencilId (0),
704 glTex (NULL),
705 status (-1)
706 {
707@@ -40,14 +41,14 @@
708 void pushFBO ();
709 void popFBO ();
710
711- GLuint fboId;
712- GLuint pushedId;
713- GLuint rbStencilId;
714- GLTexture *glTex;
715-
716- GLint status;
717-
718- static GLuint boundId;
719+ GLuint fboId;
720+ GLuint pushedId;
721+ GLuint rbStencilId;
722+ GLTexture *glTex;
723+
724+ GLint status;
725+
726+ static GLuint boundId;
727 static std::map<GLuint, GLFramebufferObject *> idMap;
728 };
729
730@@ -58,6 +59,7 @@
731 PrivateGLFramebufferObject::pushFBO ()
732 {
733 pushedId = boundId;
734+
735 if (boundId != fboId)
736 {
737 (*GL::bindFramebuffer) (GL::FRAMEBUFFER, fboId);
738@@ -94,22 +96,24 @@
739 (*GL::deleteFramebuffers) (1, &priv->fboId);
740 (*GL::deleteRenderbuffers) (1, &priv->rbStencilId);
741
742-
743 delete priv;
744 }
745
746 bool
747-GLFramebufferObject::allocate (const CompSize &size, const char *image,
748- GLenum format, GLenum type)
749+GLFramebufferObject::allocate (const CompSize &size,
750+ const char *image,
751+ GLenum format,
752+ GLenum type)
753 {
754 priv->status = -1;
755
756- if (!priv->glTex ||
757- size.width () != priv->glTex->width () ||
758- size.height () != priv->glTex->height ())
759+ if (!priv->glTex ||
760+ size.width () != priv->glTex->width () ||
761+ size.height () != priv->glTex->height ())
762 {
763 if (priv->glTex)
764 GLTexture::decRef (priv->glTex);
765+
766 priv->glTex = NULL;
767
768 GLTexture::List list = GLTexture::imageDataToTexture (image, size,
769@@ -130,12 +134,12 @@
770 priv->pushFBO ();
771
772 (*GL::framebufferTexture2D) (GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0,
773- priv->glTex->target (),
774- priv->glTex->name (), 0);
775+ priv->glTex->target (),
776+ priv->glTex->name (), 0);
777
778 priv->status = (*GL::checkFramebufferStatus) (GL::DRAW_FRAMEBUFFER);
779+ priv->popFBO ();
780
781- priv->popFBO ();
782 return true;
783 }
784
785@@ -146,8 +150,8 @@
786
787 if (priv->boundId != 0)
788 {
789- std::map<GLuint, GLFramebufferObject *>::iterator it;
790- it = PrivateGLFramebufferObject::idMap.find (priv->boundId);
791+ std::map<GLuint, GLFramebufferObject *>::iterator it =
792+ PrivateGLFramebufferObject::idMap.find (priv->boundId);
793
794 if (it != PrivateGLFramebufferObject::idMap.end ())
795 old = it->second;
796@@ -209,8 +213,9 @@
797 return true;
798
799 compLogMessage ("opengl", CompLogLevelError,
800- "FBO is incomplete: %s (0x%04x)",
801- getFboErrorString (priv->status), priv->status);
802+ "FBO is incomplete: %s (0x%04x)",
803+ getFboErrorString (priv->status), priv->status);
804+
805 return false;
806 }
807
808
809=== modified file 'plugins/opengl/src/fsregion/fsregion.cpp'
810--- plugins/opengl/src/fsregion/fsregion.cpp 2013-05-08 15:04:46 +0000
811+++ plugins/opengl/src/fsregion/fsregion.cpp 2013-07-24 16:05:45 +0000
812@@ -29,16 +29,16 @@
813 namespace opengl {
814
815 FullscreenRegion::FullscreenRegion (const CompRect &output) :
816- untouched (output),
817- orig (output),
818+ untouched (output),
819+ orig (output),
820 allOutputs (output)
821 {
822 }
823
824-FullscreenRegion::FullscreenRegion (const CompRect &output,
825- const CompRegion &all) :
826- untouched (output),
827- orig (output),
828+FullscreenRegion::FullscreenRegion (const CompRect &output,
829+ const CompRegion &all) :
830+ untouched (output),
831+ orig (output),
832 allOutputs (all)
833 {
834 }
835@@ -48,12 +48,10 @@
836 {
837 bool fullscreen = false;
838
839- if (!(flags & (Desktop | Alpha | NoOcclusionDetection)) &&
840- region == untouched &&
841- region == orig)
842- {
843+ if (!(flags & (Desktop | Alpha | NoOcclusionDetection)) &&
844+ region == untouched &&
845+ region == orig)
846 fullscreen = true;
847- }
848
849 untouched -= region;
850
851
852=== modified file 'plugins/opengl/src/fsregion/fsregion.h'
853--- plugins/opengl/src/fsregion/fsregion.h 2013-05-08 15:04:46 +0000
854+++ plugins/opengl/src/fsregion/fsregion.h 2013-07-24 16:05:45 +0000
855@@ -34,23 +34,29 @@
856 class FullscreenRegion
857 {
858 public:
859+
860 typedef enum
861 {
862- Desktop = 1,
863- Alpha = 2,
864+ Desktop = 1,
865+ Alpha = 2,
866 NoOcclusionDetection = 3
867 } WinFlag;
868
869 typedef unsigned int WinFlags;
870
871 FullscreenRegion (const CompRect &output);
872- FullscreenRegion (const CompRect &output, const CompRegion &all);
873+
874+ FullscreenRegion (const CompRect &output,
875+ const CompRegion &all);
876
877 // isCoveredBy is called for windows from TOP to BOTTOM
878- bool isCoveredBy (const CompRegion &region, WinFlags flags = 0);
879+ bool isCoveredBy (const CompRegion &region,
880+ WinFlags flags = 0);
881+
882 bool allowRedirection (const CompRegion &region);
883
884 private:
885+
886 CompRegion untouched;
887 CompRegion orig;
888 CompRegion allOutputs;
889
890=== modified file 'plugins/opengl/src/matrix.cpp'
891--- plugins/opengl/src/matrix.cpp 2012-12-04 15:28:56 +0000
892+++ plugins/opengl/src/matrix.cpp 2013-07-24 16:05:45 +0000
893@@ -59,7 +59,8 @@
894 /**
895 * Identity matrix.
896 */
897-static const float identity[16] = {
898+static const float identity[16] =
899+{
900 1.0, 0.0, 0.0, 0.0,
901 0.0, 1.0, 0.0, 0.0,
902 0.0, 0.0, 1.0, 0.0,
903@@ -88,7 +89,7 @@
904 const float *a,
905 const float *b)
906 {
907- for (int i = 0; i < 4; i++)
908+ for (int i = 0; i < 4; ++i)
909 {
910 const float ai0 = A(i,0), ai1 = A(i,1), ai2 = A(i,2), ai3 = A(i,3);
911
912@@ -144,10 +145,10 @@
913 operator* (const GLMatrix& lhs,
914 const GLVector& rhs)
915 {
916- GLVector result;
917+ GLVector result;
918 const float *a = lhs.m;
919
920- for (int i = 0; i < 4; i++)
921+ for (int i = 0; i < 4; ++i)
922 {
923 result[i] = A(i,0) * rhs[0] + A(i,1) * rhs[1] +
924 A(i,2) * rhs[2] + A(i,3) * rhs[3];
925@@ -202,13 +203,14 @@
926 + m[4]*m[2]*m[9] + m[8]*m[1]*m[6] - m[8]*m[2]*m[5];
927
928 det = m[0]*inv[0] + m[1]*inv[4] + m[2]*inv[8] + m[3]*inv[12];
929+
930 if (det == 0)
931- return false;
932+ return false;
933
934 det = 1.0f / det;
935
936- for (int i = 0; i < 16; i++)
937- m[i] = inv[i] * det;
938+ for (int i = 0; i < 16; ++i)
939+ m[i] = inv[i] * det;
940
941 return true;
942 }
943@@ -223,20 +225,18 @@
944 */
945 void
946 GLMatrix::rotate (const float angle,
947- const float xRot,
948- const float yRot,
949- const float zRot)
950+ const float xRot,
951+ const float yRot,
952+ const float zRot)
953 {
954 float x = xRot, y = yRot, z = zRot;
955- float s, c;
956 float matrix[16];
957- bool optimized;
958
959- s = (float) sin (angle * DEG2RAD);
960- c = (float) cos (angle * DEG2RAD);
961+ float s = (float) sin (angle * DEG2RAD);
962+ float c = (float) cos (angle * DEG2RAD);
963
964 memcpy (matrix, identity, sizeof (matrix));
965- optimized = false;
966+ bool optimized = false;
967
968 #define M(row, col) matrix[col * 4 + row]
969
970@@ -250,6 +250,7 @@
971 /* rotate only around z-axis */
972 M(0,0) = c;
973 M(1,1) = c;
974+
975 if (z < 0.0f)
976 {
977 M(0,1) = s;
978@@ -268,6 +269,7 @@
979 /* rotate only around y-axis */
980 M(0,0) = c;
981 M(2,2) = c;
982+
983 if (y < 0.0f)
984 {
985 M(0,2) = -s;
986@@ -288,6 +290,7 @@
987 /* rotate only around x-axis */
988 M(1,1) = c;
989 M(2,2) = c;
990+
991 if (x < 0.0f)
992 {
993 M(1,2) = s;
994@@ -316,7 +319,6 @@
995 y /= mag;
996 z /= mag;
997
998-
999 /*
1000 * Arbitrary axis rotation matrix.
1001 *
1002@@ -410,8 +412,8 @@
1003 }
1004
1005 void
1006-GLMatrix::rotate (const float angle,
1007- const GLVector& vector)
1008+GLMatrix::rotate (const float angle,
1009+ const GLVector& vector)
1010 {
1011 rotate (angle,
1012 vector[GLVector::x],
1013@@ -431,8 +433,8 @@
1014 */
1015 void
1016 GLMatrix::scale (const float x,
1017- const float y,
1018- const float z)
1019+ const float y,
1020+ const float z)
1021 {
1022 m[0] *= x; m[4] *= y; m[8] *= z;
1023 m[1] *= x; m[5] *= y; m[9] *= z;
1024@@ -460,8 +462,8 @@
1025 */
1026 void
1027 GLMatrix::translate (const float x,
1028- const float y,
1029- const float z)
1030+ const float y,
1031+ const float z)
1032 {
1033 m[12] = m[0] * x + m[4] * y + m[8] * z + m[12];
1034 m[13] = m[1] * x + m[5] * y + m[9] * z + m[13];
1035
1036=== modified file 'plugins/opengl/src/opengl.cpp'
1037--- plugins/opengl/src/opengl.cpp 2013-05-26 06:15:47 +0000
1038+++ plugins/opengl/src/opengl.cpp 2013-07-24 16:05:45 +0000
1039@@ -28,15 +28,15 @@
1040 #include <core/pluginclasshandler.h>
1041 #include "privates.h"
1042
1043-const float DEFAULT_Z_CAMERA = 0.866025404f;
1044-
1045-const float RED_SATURATION_WEIGHT = 0.30f;
1046-const float GREEN_SATURATION_WEIGHT = 0.59f;
1047-const float BLUE_SATURATION_WEIGHT = 0.11f;
1048-
1049-const unsigned short NOTHING_TRANS_FILTER = 0;
1050-const unsigned short SCREEN_TRANS_FILTER = 1;
1051-const unsigned short WINDOW_TRANS_FILTER = 2;
1052+const float DEFAULT_Z_CAMERA = 0.866025404f;
1053+
1054+const float RED_SATURATION_WEIGHT = 0.30f;
1055+const float GREEN_SATURATION_WEIGHT = 0.59f;
1056+const float BLUE_SATURATION_WEIGHT = 0.11f;
1057+
1058+const unsigned short NOTHING_TRANS_FILTER = 0;
1059+const unsigned short SCREEN_TRANS_FILTER = 1;
1060+const unsigned short WINDOW_TRANS_FILTER = 2;
1061
1062 CompOption::Vector &
1063 GLScreen::getOptions ()
1064@@ -62,7 +62,8 @@
1065 if (!rv || !CompOption::findOption (getOptions (), name, &index))
1066 return false;
1067
1068- switch (index) {
1069+ switch (index)
1070+ {
1071 case OpenglOptions::TextureFilter:
1072 cScreen->damageScreen ();
1073
1074@@ -71,6 +72,7 @@
1075 else
1076 textureFilter = GL_LINEAR;
1077 break;
1078+
1079 default:
1080 break;
1081 }
1082
1083=== modified file 'plugins/opengl/src/paint.cpp'
1084--- plugins/opengl/src/paint.cpp 2013-06-28 01:10:57 +0000
1085+++ plugins/opengl/src/paint.cpp 2013-07-24 16:05:45 +0000
1086@@ -45,11 +45,13 @@
1087
1088 using namespace compiz::opengl;
1089
1090-GLScreenPaintAttrib defaultScreenPaintAttrib = {
1091+GLScreenPaintAttrib defaultScreenPaintAttrib =
1092+{
1093 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -DEFAULT_Z_CAMERA
1094 };
1095
1096-GLWindowPaintAttrib GLWindow::defaultPaintAttrib = {
1097+GLWindowPaintAttrib GLWindow::defaultPaintAttrib =
1098+{
1099 OPAQUE, BRIGHT, COLOR, 1.0f, 1.0f, 0.0f, 0.0f
1100 };
1101
1102@@ -76,12 +78,7 @@
1103 const CompRegion &region,
1104 bool transformed)
1105 {
1106- GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
1107- GLfloat vertexData[18];
1108- GLushort colorData[4];
1109-
1110- BoxPtr pBox = const_cast <Region> (region.handle ())->rects;
1111- int n, nBox = const_cast <Region> (region.handle ())->numRects;
1112+ int nBox = const_cast <Region> (region.handle ())->numRects;
1113
1114 if (!nBox)
1115 return;
1116@@ -89,9 +86,7 @@
1117 if (screen->desktopWindowCount ())
1118 {
1119 if (!backgroundTextures.empty ())
1120- {
1121 backgroundTextures.clear ();
1122- }
1123
1124 backgroundLoaded = false;
1125
1126@@ -105,10 +100,15 @@
1127 backgroundLoaded = true;
1128 }
1129
1130+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
1131+ GLfloat vertexData[18];
1132+ GLushort colorData[4];
1133+ BoxPtr pBox = const_cast <Region> (region.handle ())->rects;
1134+ int n = nBox;
1135+
1136 if (backgroundTextures.empty ())
1137 {
1138 streamingBuffer->begin (GL_TRIANGLES);
1139- n = nBox;
1140
1141 while (n--)
1142 {
1143@@ -134,7 +134,7 @@
1144
1145 streamingBuffer->addVertices (6, vertexData);
1146
1147- pBox++;
1148+ ++pBox;
1149 }
1150
1151 colorData[0] = colorData[1] = colorData[2] = 0;
1152@@ -146,9 +146,7 @@
1153 }
1154 else
1155 {
1156- n = nBox;
1157-
1158- for (unsigned int i = 0; i < backgroundTextures.size (); i++)
1159+ for (unsigned int i = 0; i < backgroundTextures.size (); ++i)
1160 {
1161 GLfloat textureData[12];
1162 GLTexture *bg = backgroundTextures[i];
1163@@ -208,7 +206,7 @@
1164 streamingBuffer->addVertices (6, vertexData);
1165 streamingBuffer->addTexCoords (0, 6, textureData);
1166
1167- pBox++;
1168+ ++pBox;
1169 }
1170
1171 streamingBuffer->end ();
1172@@ -230,10 +228,10 @@
1173
1174
1175 /* This function currently always performs occlusion detection to
1176- minimize paint regions. OpenGL precision requirements are no good
1177- enough to guarantee that the results from using occlusion detection
1178+ minimize paint regions. OpenGL precision requirements are not good
1179+ enough to guarantee that the result from using occlusion detection
1180 is the same as without. It's likely not possible to see any
1181- difference with most hardware but occlusion detection in the
1182+ difference with most hardware, but occlusion detection in the
1183 transformed screen case should be made optional for those who do
1184 see a difference. */
1185 void
1186@@ -242,19 +240,17 @@
1187 CompOutput *output,
1188 unsigned int mask)
1189 {
1190- CompRegion tmpRegion (region);
1191- CompWindow *w;
1192- GLWindow *gw;
1193- int windowMask, odMask;
1194- bool status, unredirectFS;
1195- bool withOffset = false;
1196- GLMatrix vTransform;
1197- CompPoint offXY;
1198+ CompRegion tmpRegion (region);
1199+ CompWindow *w;
1200+ GLWindow *gw;
1201+ int odMask;
1202+ int windowMask = 0;
1203+ bool status, unredirectFS;
1204+ bool withOffset = false;
1205+ GLMatrix vTransform;
1206+ CompPoint offXY;
1207 std::set<CompWindow*> unredirected;
1208
1209- CompWindowList pl;
1210- CompWindowList::reverse_iterator rit;
1211-
1212 unredirectFS = CompositeScreen::get (screen)->
1213 getOption ("unredirect_fullscreen_windows")->value ().b ();
1214
1215@@ -267,29 +263,24 @@
1216 bool blacklisted = driverIsBlacklisted (blacklist.c_str ());
1217
1218 if (mask & PAINT_SCREEN_TRANSFORMED_MASK)
1219- {
1220- windowMask = PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK;
1221- }
1222- else
1223- {
1224- windowMask = 0;
1225- }
1226+ windowMask = PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK;
1227
1228 /*
1229 * We need to COPY the PaintList for now because there seem to be some
1230 * odd cases where the master list might change during the below loops.
1231 * (LP: #958540)
1232 */
1233- pl = cScreen->getWindowPaintList ();
1234+ CompWindowList pl = cScreen->getWindowPaintList ();
1235
1236 if (!(mask & PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK))
1237 {
1238 FullscreenRegion fs (*output, screen->region ());
1239
1240 /* detect occlusions */
1241- for (rit = pl.rbegin (); rit != pl.rend (); ++rit)
1242+ for (CompWindowList::reverse_iterator rit = pl.rbegin ();
1243+ rit != pl.rend (); ++rit)
1244 {
1245- w = (*rit);
1246+ w = (*rit);
1247 gw = GLWindow::get (w);
1248
1249 if (w->destroyed ())
1250@@ -305,6 +296,7 @@
1251 gw->priv->clip = region;
1252 continue;
1253 }
1254+
1255 if (!w->isViewable ())
1256 continue;
1257 }
1258@@ -319,8 +311,7 @@
1259 !w->onAllViewports ())
1260 {
1261 withOffset = true;
1262-
1263- offXY = w->getMovementForOffset (cScreen->windowPaintOffset ());
1264+ offXY = w->getMovementForOffset (cScreen->windowPaintOffset ());
1265
1266 vTransform = transform;
1267 vTransform.translate (offXY.x (), offXY.y (), 0);
1268@@ -328,32 +319,32 @@
1269 gw->priv->clip.translate (-offXY.x (), -offXY. y ());
1270
1271 odMask |= PAINT_WINDOW_WITH_OFFSET_MASK;
1272- status = gw->glPaint (gw->paintAttrib (), vTransform,
1273- tmpRegion, odMask);
1274+ status = gw->glPaint (gw->paintAttrib (), vTransform,
1275+ tmpRegion, odMask);
1276 }
1277 else
1278 {
1279 withOffset = false;
1280- status = gw->glPaint (gw->paintAttrib (), transform, tmpRegion,
1281- odMask);
1282+ status = gw->glPaint (gw->paintAttrib (), transform, tmpRegion,
1283+ odMask);
1284 }
1285
1286 if (status)
1287 {
1288 if (withOffset)
1289- {
1290 tmpRegion -= w->region ().translated (offXY);
1291- }
1292 else
1293 tmpRegion -= w->region ();
1294 }
1295
1296 FullscreenRegion::WinFlags flags = 0;
1297+
1298 if (w->type () & CompWindowTypeDesktopMask)
1299- flags |= FullscreenRegion::Desktop;
1300+ flags |= FullscreenRegion::Desktop;
1301+
1302 if (w->alpha ())
1303 flags |= FullscreenRegion::Alpha;
1304-
1305+
1306 /* Anything which was not occlusion detected is not a suitable
1307 * candidate for unredirection either */
1308 if (!status)
1309@@ -373,37 +364,31 @@
1310 * take effect until it is un-fullscreened again. But that's better
1311 * than the high price of regex matching on every frame.
1312 */
1313- if (unredirectFS &&
1314- !blacklisted &&
1315- !(mask & PAINT_SCREEN_TRANSFORMED_MASK) &&
1316- !(mask & PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK) &&
1317- fs.isCoveredBy (w->region (), flags) &&
1318+ if (unredirectFS &&
1319+ !blacklisted &&
1320+ !(mask & PAINT_SCREEN_TRANSFORMED_MASK) &&
1321+ !(mask & PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK) &&
1322+ fs.isCoveredBy (w->region (), flags) &&
1323 (!cw->redirected () || unredirectable.evaluate (w)))
1324- {
1325 unredirected.insert (w);
1326- }
1327- else
1328+
1329+ else if (!cw->redirected ())
1330 {
1331- if (!cw->redirected ())
1332+ if (fs.allowRedirection (w->region ()))
1333 {
1334- if (fs.allowRedirection (w->region ()))
1335- {
1336- // 1. GLWindow::release to force gw->priv->needsRebind
1337- gw->release ();
1338-
1339- // 2. GLWindow::bind, which redirects the window,
1340- // rebinds the pixmap, and then rebinds the pixmap
1341- // to a texture.
1342- gw->bind ();
1343-
1344- // 3. Your window is now redirected again with the
1345- // latest pixmap contents.
1346- }
1347- else
1348- {
1349- unredirected.insert (w);
1350- }
1351+ // 1. GLWindow::release to force gw->priv->needsRebind
1352+ gw->release ();
1353+
1354+ // 2. GLWindow::bind, which redirects the window,
1355+ // rebinds the pixmap, and then rebinds the pixmap
1356+ // to a texture.
1357+ gw->bind ();
1358+
1359+ // 3. Your window is now redirected again with the
1360+ // latest pixmap contents.
1361 }
1362+ else
1363+ unredirected.insert (w);
1364 }
1365 }
1366 }
1367@@ -414,8 +399,8 @@
1368
1369 if (!(mask & PAINT_SCREEN_NO_BACKGROUND_MASK))
1370 paintBackground (transform,
1371- tmpRegion,
1372- (mask & PAINT_SCREEN_TRANSFORMED_MASK));
1373+ tmpRegion,
1374+ (mask & PAINT_SCREEN_TRANSFORMED_MASK));
1375
1376 /* paint all windows from bottom to top */
1377 foreach (w, pl)
1378@@ -423,26 +408,25 @@
1379 if (w->destroyed ())
1380 continue;
1381
1382- gw = GLWindow::get (w);
1383-
1384- /* Release any queued ConfigureWindow requests now */
1385+ gw = GLWindow::get (w);
1386+
1387+ /* Release any queued ConfigureWindow requests now */
1388+
1389 gw->priv->configureLock->release ();
1390
1391 if (unredirected.find (w) != unredirected.end ())
1392 continue;
1393
1394- if (!w->shaded ())
1395- {
1396- if (!w->isViewable ())
1397- continue;
1398- }
1399+ if (!w->shaded () &&
1400+ !w->isViewable ())
1401+ continue;
1402
1403 const CompRegion &clip =
1404 (!(mask & PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK)) ?
1405 gw->clip () : region;
1406
1407 if ((cScreen->windowPaintOffset ().x () != 0 ||
1408- cScreen->windowPaintOffset ().y () != 0) &&
1409+ cScreen->windowPaintOffset ().y () != 0 ) &&
1410 !w->onAllViewports ())
1411 {
1412 offXY = w->getMovementForOffset (cScreen->windowPaintOffset ());
1413@@ -450,12 +434,10 @@
1414 vTransform = transform;
1415 vTransform.translate (offXY.x (), offXY.y (), 0);
1416 gw->glPaint (gw->paintAttrib (), vTransform, clip,
1417- windowMask | PAINT_WINDOW_WITH_OFFSET_MASK);
1418+ windowMask | PAINT_WINDOW_WITH_OFFSET_MASK);
1419 }
1420 else
1421- {
1422 gw->glPaint (gw->paintAttrib (), transform, clip, windowMask);
1423- }
1424 }
1425 }
1426
1427@@ -488,20 +470,20 @@
1428 WRAPABLE_HND_FUNCTN (glEnableOutputClipping, transform, region, output)
1429
1430 // Bottom-left corner of the output:
1431- const GLint x = output->x1 ();
1432- const GLint y = screen->height () - output->y2 ();
1433- const GLsizei w = output->width ();
1434- const GLsizei h = output->height ();
1435+ const GLint x = output->x1 ();
1436+ const GLint y = screen->height () - output->y2 ();
1437+ const GLsizei w = output->width ();
1438+ const GLsizei h = output->height ();
1439
1440 // Transformed (only scale and translation is supported!)
1441- const float *t = transform.getMatrix ();
1442- const GLfloat scalex = t[0], scaley = t[5], transx = t[12], transy = t[13];
1443+ const float *t = transform.getMatrix ();
1444+ const GLfloat scalex = t[0], scaley = t[5], transx = t[12], transy = t[13];
1445 const GLfloat centrex = x + w / 2.0f;
1446 const GLfloat centrey = y + h / 2.0f;
1447- GLfloat scaledw = fabs (w * scalex);
1448- GLfloat scaledh = fabs (h * scaley);
1449- GLfloat tx = centrex - (scaledw / 2.0f) + transx * w;
1450- GLfloat ty = centrey - (scaledh / 2.0f) + transy * h;
1451+ GLfloat scaledw = fabs (w * scalex);
1452+ GLfloat scaledh = fabs (h * scaley);
1453+ GLfloat tx = centrex - (scaledw / 2.0f) + transx * w;
1454+ GLfloat ty = centrey - (scaledh / 2.0f) + transy * h;
1455
1456 glScissor (tx, ty, roundf (scaledw), roundf (scaledh));
1457 glEnable (GL_SCISSOR_TEST);
1458@@ -516,22 +498,22 @@
1459 }
1460
1461 void
1462-GLScreen::glBufferStencil (const GLMatrix &matrix,
1463- GLVertexBuffer &vertexBuffer,
1464- CompOutput *output)
1465+GLScreen::glBufferStencil (const GLMatrix &matrix,
1466+ GLVertexBuffer &vertexBuffer,
1467+ CompOutput *output)
1468 {
1469 WRAPABLE_HND_FUNCTN (glBufferStencil, matrix, vertexBuffer, output);
1470
1471- GLfloat x = output->x ();
1472- GLfloat y = screen->height () - output->y2 ();
1473+ GLfloat x = output->x ();
1474+ GLfloat y = screen->height () - output->y2 ();
1475 GLfloat x2 = output->x () + output->width ();
1476 GLfloat y2 = screen->height () - output->y2 () + output->height ();
1477
1478 GLfloat vertices[] =
1479 {
1480- x, y, 0,
1481- x, y2, 0,
1482- x2, y, 0,
1483+ x, y, 0,
1484+ x, y2, 0,
1485+ x2, y, 0,
1486 x2, y2, 0
1487 };
1488
1489@@ -576,8 +558,8 @@
1490 priv->paintOutputRegion (sTransform, region, output, mask);
1491 glDisableOutputClipping ();
1492 }
1493- else if ( (GL::fboEnabled && GL::fboStencilSupported) ||
1494- GL::stencilBuffer )
1495+ else if ((GL::fboEnabled && GL::fboStencilSupported) ||
1496+ GL::stencilBuffer )
1497 {
1498 sTransform.toScreenSpace (output, -sAttrib.zTranslate);
1499
1500@@ -656,7 +638,7 @@
1501 * windows are getting transformed (and so the unredirected window
1502 * needs to be redirected again).
1503 */
1504- if (!region.isEmpty () ||
1505+ if (!region.isEmpty () ||
1506 (mask & PAINT_SCREEN_FULL_MASK) ||
1507 (mask & PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK))
1508 priv->paintOutputRegion (sTransform, region, output, mask);
1509@@ -671,9 +653,7 @@
1510 return true;
1511 }
1512 else
1513- {
1514 return false;
1515- }
1516 }
1517
1518 void
1519@@ -683,9 +663,9 @@
1520 {
1521 WRAPABLE_HND_FUNCTN (glPaintCompositedOutput, region, fbo, mask)
1522
1523- GLMatrix sTransform;
1524- const GLTexture::Matrix & texmatrix = fbo->tex ()->matrix ();
1525- GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
1526+ GLMatrix sTransform;
1527+ const GLTexture::Matrix &texmatrix = fbo->tex ()->matrix ();
1528+ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
1529
1530 streamingBuffer->begin (GL_TRIANGLES);
1531
1532@@ -696,7 +676,8 @@
1533 GLfloat ty1 = 1.0 - COMP_TEX_COORD_Y (texmatrix, 0.0f);
1534 GLfloat ty2 = 1.0 - COMP_TEX_COORD_Y (texmatrix, screen->height ());
1535
1536- const GLfloat vertexData[] = {
1537+ const GLfloat vertexData[] =
1538+ {
1539 0.0f, 0.0f, 0.0f,
1540 0.0f, (float)screen->height (), 0.0f,
1541 (float)screen->width (), 0.0f, 0.0f,
1542@@ -706,7 +687,8 @@
1543 (float)screen->width (), 0.0f, 0.0f,
1544 };
1545
1546- const GLfloat textureData[] = {
1547+ const GLfloat textureData[] =
1548+ {
1549 tx1, ty1,
1550 tx1, ty2,
1551 tx2, ty1,
1552@@ -721,7 +703,7 @@
1553 else
1554 {
1555 BoxPtr pBox = const_cast <Region> (region.handle ())->rects;
1556- int nBox = const_cast <Region> (region.handle ())->numRects;
1557+ int nBox = const_cast <Region> (region.handle ())->numRects;
1558
1559 while (nBox--)
1560 {
1561@@ -730,7 +712,8 @@
1562 GLfloat ty1 = 1.0 - COMP_TEX_COORD_Y (texmatrix, pBox->y1);
1563 GLfloat ty2 = 1.0 - COMP_TEX_COORD_Y (texmatrix, pBox->y2);
1564
1565- const GLfloat vertexData[] = {
1566+ const GLfloat vertexData[] =
1567+ {
1568 (float)pBox->x1, (float)pBox->y1, 0.0f,
1569 (float)pBox->x1, (float)pBox->y2, 0.0f,
1570 (float)pBox->x2, (float)pBox->y1, 0.0f,
1571@@ -740,7 +723,8 @@
1572 (float)pBox->x2, (float)pBox->y1, 0.0f,
1573 };
1574
1575- const GLfloat textureData[] = {
1576+ const GLfloat textureData[] =
1577+ {
1578 tx1, ty1,
1579 tx1, ty2,
1580 tx2, ty1,
1581@@ -751,7 +735,8 @@
1582
1583 streamingBuffer->addVertices (6, &vertexData[0]);
1584 streamingBuffer->addTexCoords (0, 6, &textureData[0]);
1585- pBox++;
1586+
1587+ ++pBox;
1588 }
1589 }
1590
1591@@ -763,16 +748,17 @@
1592 }
1593
1594 static void
1595-addSingleQuad (GLVertexBuffer *vertexBuffer,
1596- const GLTexture::MatrixList &matrix,
1597- unsigned int nMatrix,
1598- int x1,
1599- int y1,
1600- int x2,
1601- int y2,
1602- bool rect)
1603+addSingleQuad (GLVertexBuffer *vertexBuffer,
1604+ const GLTexture::MatrixList &matrix,
1605+ unsigned int nMatrix,
1606+ int x1,
1607+ int y1,
1608+ int x2,
1609+ int y2,
1610+ bool rect)
1611 {
1612- GLfloat vertexData[18] = {
1613+ GLfloat vertexData[18] =
1614+ {
1615 (float)x1, (float)y1, 0.0,
1616 (float)x1, (float)y2, 0.0,
1617 (float)x2, (float)y1, 0.0,
1618@@ -780,52 +766,58 @@
1619 (float)x1, (float)y2, 0.0,
1620 (float)x2, (float)y2, 0.0
1621 };
1622+
1623 vertexBuffer->addVertices (6, vertexData);
1624+ unsigned int it;
1625
1626 if (rect)
1627 {
1628- unsigned int it;
1629- for (it = 0; it < nMatrix; it++)
1630- {
1631- GLfloat data[2];
1632- const GLTexture::Matrix &mat = matrix[it];
1633- data[0] = COMP_TEX_COORD_X (mat, x1);
1634- data[1] = COMP_TEX_COORD_Y (mat, y1);
1635- vertexBuffer->addTexCoords (it, 1, data);
1636- }
1637- for (it = 0; it < nMatrix; it++)
1638- {
1639- GLfloat data[2];
1640- const GLTexture::Matrix &mat = matrix[it];
1641- data[0] = COMP_TEX_COORD_X (mat, x1);
1642- data[1] = COMP_TEX_COORD_Y (mat, y2);
1643- vertexBuffer->addTexCoords (it, 1, data);
1644- }
1645- for (it = 0; it < nMatrix; it++)
1646- {
1647- GLfloat data[2];
1648- const GLTexture::Matrix &mat = matrix[it];
1649- data[0] = COMP_TEX_COORD_X (mat, x2);
1650- data[1] = COMP_TEX_COORD_Y (mat, y1);
1651- vertexBuffer->addTexCoords (it, 1, data);
1652- }
1653- for (it = 0; it < nMatrix; it++)
1654- {
1655- GLfloat data[2];
1656- const GLTexture::Matrix &mat = matrix[it];
1657- data[0] = COMP_TEX_COORD_X (mat, x2);
1658- data[1] = COMP_TEX_COORD_Y (mat, y1);
1659- vertexBuffer->addTexCoords (it, 1, data);
1660- }
1661- for (it = 0; it < nMatrix; it++)
1662- {
1663- GLfloat data[2];
1664- const GLTexture::Matrix &mat = matrix[it];
1665- data[0] = COMP_TEX_COORD_X (mat, x1);
1666- data[1] = COMP_TEX_COORD_Y (mat, y2);
1667- vertexBuffer->addTexCoords (it, 1, data);
1668- }
1669- for (it = 0; it < nMatrix; it++)
1670+ for (it = 0; it < nMatrix; ++it)
1671+ {
1672+ GLfloat data[2];
1673+ const GLTexture::Matrix &mat = matrix[it];
1674+ data[0] = COMP_TEX_COORD_X (mat, x1);
1675+ data[1] = COMP_TEX_COORD_Y (mat, y1);
1676+ vertexBuffer->addTexCoords (it, 1, data);
1677+ }
1678+
1679+ for (it = 0; it < nMatrix; ++it)
1680+ {
1681+ GLfloat data[2];
1682+ const GLTexture::Matrix &mat = matrix[it];
1683+ data[0] = COMP_TEX_COORD_X (mat, x1);
1684+ data[1] = COMP_TEX_COORD_Y (mat, y2);
1685+ vertexBuffer->addTexCoords (it, 1, data);
1686+ }
1687+
1688+ for (it = 0; it < nMatrix; ++it)
1689+ {
1690+ GLfloat data[2];
1691+ const GLTexture::Matrix &mat = matrix[it];
1692+ data[0] = COMP_TEX_COORD_X (mat, x2);
1693+ data[1] = COMP_TEX_COORD_Y (mat, y1);
1694+ vertexBuffer->addTexCoords (it, 1, data);
1695+ }
1696+
1697+ for (it = 0; it < nMatrix; ++it)
1698+ {
1699+ GLfloat data[2];
1700+ const GLTexture::Matrix &mat = matrix[it];
1701+ data[0] = COMP_TEX_COORD_X (mat, x2);
1702+ data[1] = COMP_TEX_COORD_Y (mat, y1);
1703+ vertexBuffer->addTexCoords (it, 1, data);
1704+ }
1705+
1706+ for (it = 0; it < nMatrix; ++it)
1707+ {
1708+ GLfloat data[2];
1709+ const GLTexture::Matrix &mat = matrix[it];
1710+ data[0] = COMP_TEX_COORD_X (mat, x1);
1711+ data[1] = COMP_TEX_COORD_Y (mat, y2);
1712+ vertexBuffer->addTexCoords (it, 1, data);
1713+ }
1714+
1715+ for (it = 0; it < nMatrix; ++it)
1716 {
1717 GLfloat data[2];
1718 const GLTexture::Matrix &mat = matrix[it];
1719@@ -836,8 +828,7 @@
1720 }
1721 else
1722 {
1723- unsigned int it;
1724- for (it = 0; it < nMatrix; it++)
1725+ for (it = 0; it < nMatrix; ++it)
1726 {
1727 GLfloat data[2];
1728 const GLTexture::Matrix &mat = matrix[it];
1729@@ -845,39 +836,44 @@
1730 data[1] = COMP_TEX_COORD_YX (mat, x1, y1);
1731 vertexBuffer->addTexCoords (it, 1, data);
1732 }
1733- for (it = 0; it < nMatrix; it++)
1734- {
1735- GLfloat data[2];
1736- const GLTexture::Matrix &mat = matrix[it];
1737- data[0] = COMP_TEX_COORD_XY (mat, x1, y2);
1738- data[1] = COMP_TEX_COORD_YX (mat, x1, y2);
1739- vertexBuffer->addTexCoords (it, 1, data);
1740- }
1741- for (it = 0; it < nMatrix; it++)
1742- {
1743- GLfloat data[2];
1744- const GLTexture::Matrix &mat = matrix[it];
1745- data[0] = COMP_TEX_COORD_XY (mat, x2, y1);
1746- data[1] = COMP_TEX_COORD_YX (mat, x2, y1);
1747- vertexBuffer->addTexCoords (it, 1, data);
1748- }
1749- for (it = 0; it < nMatrix; it++)
1750- {
1751- GLfloat data[2];
1752- const GLTexture::Matrix &mat = matrix[it];
1753- data[0] = COMP_TEX_COORD_XY (mat, x2, y1);
1754- data[1] = COMP_TEX_COORD_YX (mat, x2, y1);
1755- vertexBuffer->addTexCoords (it, 1, data);
1756- }
1757- for (it = 0; it < nMatrix; it++)
1758- {
1759- GLfloat data[2];
1760- const GLTexture::Matrix &mat = matrix[it];
1761- data[0] = COMP_TEX_COORD_XY (mat, x1, y2);
1762- data[1] = COMP_TEX_COORD_YX (mat, x1, y2);
1763- vertexBuffer->addTexCoords (it, 1, data);
1764- }
1765- for (it = 0; it < nMatrix; it++)
1766+
1767+ for (it = 0; it < nMatrix; ++it)
1768+ {
1769+ GLfloat data[2];
1770+ const GLTexture::Matrix &mat = matrix[it];
1771+ data[0] = COMP_TEX_COORD_XY (mat, x1, y2);
1772+ data[1] = COMP_TEX_COORD_YX (mat, x1, y2);
1773+ vertexBuffer->addTexCoords (it, 1, data);
1774+ }
1775+
1776+ for (it = 0; it < nMatrix; ++it)
1777+ {
1778+ GLfloat data[2];
1779+ const GLTexture::Matrix &mat = matrix[it];
1780+ data[0] = COMP_TEX_COORD_XY (mat, x2, y1);
1781+ data[1] = COMP_TEX_COORD_YX (mat, x2, y1);
1782+ vertexBuffer->addTexCoords (it, 1, data);
1783+ }
1784+
1785+ for (it = 0; it < nMatrix; ++it)
1786+ {
1787+ GLfloat data[2];
1788+ const GLTexture::Matrix &mat = matrix[it];
1789+ data[0] = COMP_TEX_COORD_XY (mat, x2, y1);
1790+ data[1] = COMP_TEX_COORD_YX (mat, x2, y1);
1791+ vertexBuffer->addTexCoords (it, 1, data);
1792+ }
1793+
1794+ for (it = 0; it < nMatrix; ++it)
1795+ {
1796+ GLfloat data[2];
1797+ const GLTexture::Matrix &mat = matrix[it];
1798+ data[0] = COMP_TEX_COORD_XY (mat, x1, y2);
1799+ data[1] = COMP_TEX_COORD_YX (mat, x1, y2);
1800+ vertexBuffer->addTexCoords (it, 1, data);
1801+ }
1802+
1803+ for (it = 0; it < nMatrix; ++it)
1804 {
1805 GLfloat data[2];
1806 const GLTexture::Matrix &mat = matrix[it];
1807@@ -889,16 +885,16 @@
1808 }
1809
1810 static void
1811-addQuads (GLVertexBuffer *vertexBuffer,
1812- const GLTexture::MatrixList &matrix,
1813- unsigned int nMatrix,
1814- int x1,
1815- int y1,
1816- int x2,
1817- int y2,
1818- bool rect,
1819- unsigned int maxGridWidth,
1820- unsigned int maxGridHeight)
1821+addQuads (GLVertexBuffer *vertexBuffer,
1822+ const GLTexture::MatrixList &matrix,
1823+ unsigned int nMatrix,
1824+ int x1,
1825+ int y1,
1826+ int x2,
1827+ int y2,
1828+ bool rect,
1829+ unsigned int maxGridWidth,
1830+ unsigned int maxGridHeight)
1831 {
1832 if (maxGridWidth == 0 || maxGridHeight == 0)
1833 return;
1834@@ -909,9 +905,7 @@
1835 1 + (y2 - y1 - 1) / (int) maxGridHeight;
1836
1837 if (nQuadsX == 1 && nQuadsY == 1)
1838- {
1839 addSingleQuad (vertexBuffer, matrix, nMatrix, x1, y1, x2, y2, rect);
1840- }
1841 else
1842 {
1843 int quadWidth = 1 + (x2 - x1 - 1) / nQuadsX; // ceil. division
1844@@ -942,30 +936,30 @@
1845 {
1846 WRAPABLE_HND_FUNCTN (glAddGeometry, matrix, region, clip)
1847
1848- BoxRec full;
1849 int nMatrix = matrix.size ();
1850+ BoxRec full = clip.handle ()->extents;
1851
1852- full = clip.handle ()->extents;
1853 if (region.handle ()->extents.x1 > full.x1)
1854 full.x1 = region.handle ()->extents.x1;
1855+
1856 if (region.handle ()->extents.y1 > full.y1)
1857 full.y1 = region.handle ()->extents.y1;
1858+
1859 if (region.handle ()->extents.x2 < full.x2)
1860 full.x2 = region.handle ()->extents.x2;
1861+
1862 if (region.handle ()->extents.y2 < full.y2)
1863 full.y2 = region.handle ()->extents.y2;
1864
1865 if (full.x1 < full.x2 && full.y1 < full.y2)
1866 {
1867- BoxPtr pBox;
1868- int nBox;
1869 BoxPtr pClip;
1870 int nClip;
1871 BoxRec cbox;
1872 int it, x1, y1, x2, y2;
1873 bool rect = true;
1874
1875- for (it = 0; it < nMatrix; it++)
1876+ for (it = 0; it < nMatrix; ++it)
1877 {
1878 if (matrix[it].xy != 0.0f || matrix[it].yx != 0.0f)
1879 {
1880@@ -974,8 +968,8 @@
1881 }
1882 }
1883
1884- pBox = const_cast <Region> (region.handle ())->rects;
1885- nBox = const_cast <Region> (region.handle ())->numRects;
1886+ BoxPtr pBox = const_cast <Region> (region.handle ())->rects;
1887+ int nBox = const_cast <Region> (region.handle ())->numRects;
1888
1889 while (nBox--)
1890 {
1891@@ -984,7 +978,7 @@
1892 x2 = pBox->x2;
1893 y2 = pBox->y2;
1894
1895- pBox++;
1896+ ++pBox;
1897
1898 if (x1 < full.x1)
1899 x1 = full.x1;
1900@@ -1014,14 +1008,17 @@
1901 {
1902 cbox = *pClip;
1903
1904- pClip++;
1905+ ++pClip;
1906
1907 if (cbox.x1 < x1)
1908 cbox.x1 = x1;
1909+
1910 if (cbox.y1 < y1)
1911 cbox.y1 = y1;
1912+
1913 if (cbox.x2 > x2)
1914 cbox.x2 = x2;
1915+
1916 if (cbox.y2 > y2)
1917 cbox.y2 = y2;
1918
1919@@ -1157,9 +1154,7 @@
1920 GL::activeTexture (GL_TEXTURE2_ARB);
1921 }
1922 else
1923- {
1924 w->vertexBuffer ()->render (transform, attrib);
1925- }
1926
1927 texture->disable ();
1928
1929@@ -1221,9 +1216,7 @@
1930 gs->setTexEnvMode (GL_REPLACE);
1931 }
1932 else
1933- {
1934 w->vertexBuffer ()->render (transform, attrib);
1935- }
1936 }
1937 else if (attrib.brightness != BRIGHT)
1938 {
1939@@ -1237,9 +1230,7 @@
1940 gs->setTexEnvMode (GL_REPLACE);
1941 }
1942 else
1943- {
1944 w->vertexBuffer ()->render (transform, attrib);
1945- }
1946
1947 texture->disable ();
1948 }
1949@@ -1247,10 +1238,10 @@
1950 #endif
1951
1952 void
1953-GLWindow::glDrawTexture (GLTexture *texture,
1954+GLWindow::glDrawTexture (GLTexture *texture,
1955 const GLMatrix &transform,
1956 const GLWindowPaintAttrib &attrib,
1957- unsigned int mask)
1958+ unsigned int mask)
1959 {
1960 WRAPABLE_HND_FUNCTN (glDrawTexture, texture, transform, attrib, mask)
1961
1962@@ -1287,21 +1278,19 @@
1963 }
1964
1965 bool
1966-GLWindow::glDraw (const GLMatrix &transform,
1967+GLWindow::glDraw (const GLMatrix &transform,
1968 const GLWindowPaintAttrib &attrib,
1969- const CompRegion &region,
1970- unsigned int mask)
1971+ const CompRegion &region,
1972+ unsigned int mask)
1973 {
1974 WRAPABLE_HND_FUNCTN_RETURN (bool, glDraw, transform,
1975 attrib, region, mask)
1976
1977 const CompRegion &reg = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ?
1978- infiniteRegion : region;
1979-
1980- if (reg.isEmpty ())
1981- return true;
1982-
1983- if (!priv->window->isViewable () ||
1984+ infiniteRegion : region;
1985+
1986+ if (reg.isEmpty () ||
1987+ !priv->window->isViewable () ||
1988 !priv->cWindow->damaged ())
1989 return true;
1990
1991@@ -1327,11 +1316,12 @@
1992 if (priv->updateState & PrivateGLWindow::UpdateRegion)
1993 priv->updateWindowRegions ();
1994
1995- for (unsigned int i = 0; i < priv->textures.size (); i++)
1996+ for (unsigned int i = 0; i < priv->textures.size (); ++i)
1997 {
1998 ml[0] = priv->matrices[i];
1999 priv->vertexBuffer->begin ();
2000 glAddGeometry (ml, priv->regions[i], reg);
2001+
2002 if (priv->vertexBuffer->end ())
2003 glDrawTexture (priv->textures[i], transform, attrib, mask);
2004 }
2005@@ -1347,8 +1337,6 @@
2006 {
2007 WRAPABLE_HND_FUNCTN_RETURN (bool, glPaint, attrib, transform, region, mask)
2008
2009- bool status;
2010-
2011 priv->lastPaint = attrib;
2012
2013 if (priv->window->alpha () || attrib.opacity != OPAQUE)
2014@@ -1358,16 +1346,10 @@
2015
2016 if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
2017 {
2018- if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
2019- return false;
2020-
2021- if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK)
2022- return false;
2023-
2024- if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
2025- return false;
2026-
2027- if (priv->window->shaded ())
2028+ if (mask & PAINT_WINDOW_TRANSFORMED_MASK ||
2029+ mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK ||
2030+ mask & PAINT_WINDOW_TRANSLUCENT_MASK ||
2031+ priv->window->shaded ())
2032 return false;
2033
2034 return true;
2035@@ -1376,7 +1358,7 @@
2036 if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK)
2037 return true;
2038
2039- status = glDraw (transform, attrib, region, mask);
2040+ bool status = glDraw (transform, attrib, region, mask);
2041
2042 return status;
2043 }
2044
2045=== modified file 'plugins/opengl/src/privates.h'
2046--- plugins/opengl/src/privates.h 2013-01-03 16:05:26 +0000
2047+++ plugins/opengl/src/privates.h 2013-07-24 16:05:45 +0000
2048@@ -59,7 +59,7 @@
2049
2050 protected:
2051
2052- Display *mDpy;
2053+ Display *mDpy;
2054 const CompSize &mSize;
2055 };
2056
2057@@ -70,9 +70,9 @@
2058 {
2059 public:
2060
2061- GLXDoubleBuffer (Display *,
2062- const CompSize &,
2063- Window);
2064+ GLXDoubleBuffer (Display *,
2065+ const CompSize &,
2066+ Window );
2067
2068 void swap () const;
2069 bool blitAvailable () const;
2070@@ -93,9 +93,9 @@
2071 {
2072 public:
2073
2074- EGLDoubleBuffer (Display *,
2075- const CompSize &,
2076- EGLSurface const &);
2077+ EGLDoubleBuffer (Display *,
2078+ const CompSize &,
2079+ EGLSurface const &);
2080
2081 void swap () const;
2082 bool blitAvailable () const;
2083@@ -106,7 +106,7 @@
2084
2085 private:
2086
2087- EGLSurface const & mSurface;
2088+ EGLSurface const &mSurface;
2089 };
2090
2091 #endif
2092@@ -114,6 +114,7 @@
2093 class GLIcon
2094 {
2095 public:
2096+
2097 GLIcon () : icon (NULL) {}
2098
2099 CompIcon *icon;
2100@@ -126,10 +127,12 @@
2101 public OpenglOptions
2102 {
2103 public:
2104+
2105 PrivateGLScreen (GLScreen *gs);
2106 ~PrivateGLScreen ();
2107
2108- bool setOption (const CompString &name, CompOption::Value &value);
2109+ bool setOption (const CompString &name,
2110+ CompOption::Value &value);
2111
2112 void handleEvent (XEvent *event);
2113
2114@@ -149,7 +152,7 @@
2115 bool compositingActive ();
2116
2117 void paintBackground (const GLMatrix &transform,
2118- const CompRegion &region,
2119+ const CompRegion &region,
2120 bool transformed);
2121
2122 void paintOutputRegion (const GLMatrix &transform,
2123@@ -165,67 +168,69 @@
2124
2125 public:
2126
2127- GLScreen *gScreen;
2128- CompositeScreen *cScreen;
2129+ GLScreen *gScreen;
2130+ CompositeScreen *cScreen;
2131
2132- GLenum textureFilter;
2133+ GLenum textureFilter;
2134
2135 #ifndef USE_GLES
2136- GLFBConfig glxPixmapFBConfigs[MAX_DEPTH + 1];
2137+ GLFBConfig glxPixmapFBConfigs[MAX_DEPTH + 1];
2138 #endif
2139
2140- GLTexture::List backgroundTextures;
2141- bool backgroundLoaded;
2142-
2143- GLTexture::Filter filter[3];
2144-
2145- CompPoint rasterPos;
2146-
2147- GLMatrix *projection;
2148-
2149- bool clearBuffers;
2150- bool lighting;
2151+ GLTexture::List backgroundTextures;
2152+ bool backgroundLoaded;
2153+
2154+ GLTexture::Filter filter[3];
2155+
2156+ CompPoint rasterPos;
2157+
2158+ GLMatrix *projection;
2159+
2160+ bool clearBuffers;
2161+ bool lighting;
2162
2163 #ifdef USE_GLES
2164- EGLContext ctx;
2165- EGLSurface surface;
2166- EGLDoubleBuffer doubleBuffer;
2167+ EGLContext ctx;
2168+ EGLSurface surface;
2169+ EGLDoubleBuffer doubleBuffer;
2170 #else
2171- GLXContext ctx;
2172+ GLXContext ctx;
2173
2174- GL::GLXGetProcAddressProc getProcAddress;
2175- GLXDoubleBuffer doubleBuffer;
2176+ GL::GLXGetProcAddressProc getProcAddress;
2177+ GLXDoubleBuffer doubleBuffer;
2178 #endif
2179
2180- GLFramebufferObject *scratchFbo;
2181- CompRegion outputRegion;
2182+ GLFramebufferObject *scratchFbo;
2183+ CompRegion outputRegion;
2184
2185- XRectangle lastViewport;
2186- bool refreshSubBuffer;
2187- unsigned int lastMask;
2188+ XRectangle lastViewport;
2189+ bool refreshSubBuffer;
2190+ unsigned int lastMask;
2191
2192 std::vector<GLTexture::BindPixmapProc> bindPixmap;
2193- bool hasCompositing;
2194- bool commonFrontbuffer;
2195- bool incorrectRefreshRate; // hack for NVIDIA specifying an incorrect
2196- // refresh rate, causing us to miss vblanks
2197+ bool hasCompositing;
2198+ bool commonFrontbuffer;
2199+ bool incorrectRefreshRate; // hack for NVIDIA specifying an incorrect
2200+ // refresh rate, causing us to miss vblanks
2201
2202 GLIcon defaultIcon;
2203
2204- Window saveWindow; // hack for broken applications, see:
2205- // https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/807487
2206-
2207- GLProgramCache *programCache;
2208- GLShaderCache shaderCache;
2209- GLVertexBuffer::AutoProgram *autoProgram;
2210-
2211- Pixmap rootPixmapCopy;
2212- CompSize rootPixmapSize;
2213-
2214- const char *glVendor, *glRenderer, *glVersion;
2215-
2216- mutable CompString prevRegex;
2217- mutable bool prevBlacklisted;
2218+ Window saveWindow; // hack for broken applications, see:
2219+ // https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/807487
2220+
2221+ GLProgramCache *programCache;
2222+ GLShaderCache shaderCache;
2223+ GLVertexBuffer::AutoProgram *autoProgram;
2224+
2225+ Pixmap rootPixmapCopy;
2226+ CompSize rootPixmapSize;
2227+
2228+ const char *glVendor;
2229+ const char *glRenderer;
2230+ const char *glVersion;
2231+
2232+ mutable CompString prevRegex;
2233+ mutable bool prevBlacklisted;
2234 };
2235
2236 class PrivateGLWindow :
2237@@ -238,55 +243,64 @@
2238 static const unsigned int UpdateMatrix = 1 << 1;
2239
2240 public:
2241+
2242 PrivateGLWindow (CompWindow *w, GLWindow *gw);
2243 ~PrivateGLWindow ();
2244
2245 void windowNotify (CompWindowNotify n);
2246- void resizeNotify (int dx, int dy, int dwidth, int dheight);
2247- void moveNotify (int dx, int dy, bool now);
2248+
2249+ void resizeNotify (int dx,
2250+ int dy,
2251+ int dwidth,
2252+ int dheight);
2253+
2254+ void moveNotify (int dx,
2255+ int dy,
2256+ bool now);
2257+
2258 void updateFrameRegion (CompRegion &region);
2259
2260 void setWindowMatrix ();
2261+
2262 void updateWindowRegions ();
2263
2264 void clearTextures ();
2265
2266- CompWindow *window;
2267- GLWindow *gWindow;
2268- CompositeWindow *cWindow;
2269- GLScreen *gScreen;
2270-
2271- GLTexture::List textures;
2272- GLTexture::MatrixList matrices;
2273- CompRegion::Vector regions;
2274- unsigned int updateState;
2275- bool needsRebind;
2276-
2277- CompRegion clip;
2278-
2279- bool bindFailed;
2280- bool overlayWindow;
2281-
2282- GLushort opacity;
2283- GLushort brightness;
2284- GLushort saturation;
2285-
2286- GLWindowPaintAttrib paint;
2287- GLWindowPaintAttrib lastPaint;
2288-
2289- unsigned int lastMask;
2290-
2291- GLVertexBuffer *vertexBuffer;
2292+ CompWindow *window;
2293+ GLWindow *gWindow;
2294+ CompositeWindow *cWindow;
2295+ GLScreen *gScreen;
2296+
2297+ GLTexture::List textures;
2298+ GLTexture::MatrixList matrices;
2299+ CompRegion::Vector regions;
2300+ unsigned int updateState;
2301+ bool needsRebind;
2302+
2303+ CompRegion clip;
2304+
2305+ bool bindFailed;
2306+ bool overlayWindow;
2307+
2308+ GLushort opacity;
2309+ GLushort brightness;
2310+ GLushort saturation;
2311+
2312+ GLWindowPaintAttrib paint;
2313+ GLWindowPaintAttrib lastPaint;
2314+
2315+ unsigned int lastMask;
2316+
2317+ GLVertexBuffer *vertexBuffer;
2318
2319 // map of shaders, plugin name is key, pair of vertex and fragment
2320 // shader source code is value
2321 std::list<const GLShaderData*> shaders;
2322- GLVertexBuffer::AutoProgram *autoProgram;
2323+ GLVertexBuffer::AutoProgram *autoProgram;
2324
2325- std::list<GLIcon> icons;
2326+ std::list<GLIcon> icons;
2327
2328 compiz::window::configure_buffers::Releasable::Ptr configureLock;
2329 };
2330
2331 #endif
2332-
2333
2334=== modified file 'plugins/opengl/src/privatetexture.h'
2335--- plugins/opengl/src/privatetexture.h 2012-09-18 11:32:20 +0000
2336+++ plugins/opengl/src/privatetexture.h 2013-07-24 16:05:45 +0000
2337@@ -47,8 +47,10 @@
2338 class GLScreen;
2339 class GLDisplay;
2340
2341-class PrivateTexture {
2342+class PrivateTexture
2343+{
2344 public:
2345+
2346 PrivateTexture (GLTexture *);
2347 ~PrivateTexture ();
2348
2349@@ -59,6 +61,7 @@
2350 GLenum type);
2351
2352 public:
2353+
2354 GLTexture *texture;
2355 GLuint name;
2356 GLenum target;
2357@@ -72,8 +75,10 @@
2358 };
2359
2360 #ifdef USE_GLES
2361-class EglTexture : public GLTexture {
2362+class EglTexture : public GLTexture
2363+{
2364 public:
2365+
2366 EglTexture ();
2367 ~EglTexture ();
2368
2369@@ -86,21 +91,26 @@
2370 compiz::opengl::PixmapSource source);
2371
2372 public:
2373- bool damaged;
2374- Damage damage;
2375- bool updateMipMap;
2376+
2377+ bool damaged;
2378+ Damage damage;
2379+ bool updateMipMap;
2380 };
2381
2382 extern std::map<Damage, EglTexture*> boundPixmapTex;
2383 #else
2384
2385-class TfpTexture : public GLTexture {
2386+class TfpTexture : public GLTexture
2387+{
2388 public:
2389+
2390 TfpTexture ();
2391 ~TfpTexture ();
2392
2393 void enable (Filter filter);
2394+
2395 bool bindTexImage (const GLXPixmap &);
2396+
2397 void releaseTexImage ();
2398
2399 static List bindPixmapToTexture (Pixmap pixmap,
2400@@ -110,6 +120,7 @@
2401 compiz::opengl::PixmapSource source);
2402
2403 public:
2404+
2405 Pixmap x11Pixmap;
2406 GLXPixmap pixmap;
2407 bool damaged;
2408
2409=== modified file 'plugins/opengl/src/privatevertexbuffer.h'
2410--- plugins/opengl/src/privatevertexbuffer.h 2012-07-25 09:46:54 +0000
2411+++ plugins/opengl/src/privatevertexbuffer.h 2013-07-24 16:05:45 +0000
2412@@ -41,17 +41,20 @@
2413 class AbstractUniform
2414 {
2415 public:
2416- void virtual set(GLProgram* program) = 0;
2417+
2418+ void virtual set (GLProgram *program) = 0;
2419 };
2420
2421 template < typename T, int C >
2422 class Uniform: public AbstractUniform
2423 {
2424 public:
2425- Uniform(const char *_name, ... );
2426- void set(GLProgram* program);
2427+
2428+ Uniform (const char *_name, ... );
2429+ void set (GLProgram* program);
2430
2431 public:
2432+
2433 T a[C];
2434 std::string name;
2435 };
2436@@ -60,15 +63,17 @@
2437 Uniform< T, C >::Uniform(const char *_name, ... )
2438 {
2439 va_list arg_list;
2440- va_start( arg_list, _name );
2441+ va_start (arg_list, _name);
2442 name = _name;
2443- for( int i = 0; i < C; i++ )
2444+
2445+ for (int i = 0; i < C; ++i)
2446 a[i] = va_arg( arg_list, T );
2447+
2448 va_end( arg_list );
2449 }
2450
2451 template < typename T, int C >
2452-void Uniform< T, C >::set(GLProgram* prog)
2453+void Uniform< T, C >::set (GLProgram *prog)
2454 {
2455 const char* n = name.c_str();
2456
2457@@ -78,24 +83,24 @@
2458 {
2459 switch (C)
2460 {
2461- case 1: prog->setUniform (n, (GLfloat) a[0]); break;
2462- case 2: prog->setUniform2f (n, a[0], a[1]); break;
2463- case 3: prog->setUniform3f (n, a[0], a[1], a[2]); break;
2464+ case 1: prog->setUniform (n, (GLfloat) a[0]); break;
2465+ case 2: prog->setUniform2f (n, a[0], a[1]); break;
2466+ case 3: prog->setUniform3f (n, a[0], a[1], a[2]); break;
2467 case 4: prog->setUniform4f (n, a[0], a[1], a[2], a[3]); break;
2468 }
2469- } else if (typeid(a[0]) == typeid(int))
2470+ }
2471+ else if (typeid(a[0]) == typeid(int))
2472 {
2473 switch (C)
2474 {
2475- case 1: prog->setUniform (n, (GLint) a[0]); break;
2476- case 2: prog->setUniform2i (n, a[0], a[1]); break;
2477- case 3: prog->setUniform3i (n, a[0], a[1], a[2]); break;
2478+ case 1: prog->setUniform (n, (GLint) a[0]); break;
2479+ case 2: prog->setUniform2i (n, a[0], a[1]); break;
2480+ case 3: prog->setUniform3i (n, a[0], a[1], a[2]); break;
2481 case 4: prog->setUniform4i (n, a[0], a[1], a[2], a[3]); break;
2482 }
2483- } else
2484- {
2485+ }
2486+ else
2487 compLogMessage ("opengl", CompLogLevelError, "Unknown uniform type!");
2488- }
2489 }
2490
2491 class GLVertexBuffer;
2492@@ -103,47 +108,50 @@
2493 class PrivateVertexBuffer
2494 {
2495 public:
2496+
2497 PrivateVertexBuffer ();
2498 ~PrivateVertexBuffer ();
2499
2500 int render (const GLMatrix *projection,
2501 const GLMatrix *modelview,
2502 const GLWindowPaintAttrib *attrib);
2503+
2504 int legacyRender (const GLMatrix &projection,
2505 const GLMatrix &modelview,
2506 const GLWindowPaintAttrib &attrib);
2507
2508 public:
2509- static GLVertexBuffer *streamingBuffer;
2510-
2511- std::vector<GLfloat> vertexData;
2512- std::vector<GLfloat> normalData;
2513- std::vector<GLfloat> colorData;
2514+
2515+ static GLVertexBuffer *streamingBuffer;
2516+
2517+ std::vector<GLfloat> vertexData;
2518+ std::vector<GLfloat> normalData;
2519+ std::vector<GLfloat> colorData;
2520
2521 enum
2522 {
2523 MAX_TEXTURES = 4
2524 };
2525- std::vector<GLfloat> textureData[MAX_TEXTURES];
2526- GLuint nTextures;
2527-
2528- GLfloat color[4];
2529-
2530- GLuint vertexOffset;
2531- GLint maxVertices;
2532-
2533- GLProgram *program;
2534- GLenum primitiveType;
2535- GLenum usage;
2536-
2537- GLuint vertexBuffer;
2538- GLuint normalBuffer;
2539- GLuint colorBuffer;
2540- GLuint textureBuffers[4];
2541+
2542+ std::vector<GLfloat> textureData[MAX_TEXTURES];
2543+ GLuint nTextures;
2544+
2545+ GLfloat color[4];
2546+
2547+ GLuint vertexOffset;
2548+ GLint maxVertices;
2549+
2550+ GLProgram *program;
2551+ GLenum primitiveType;
2552+ GLenum usage;
2553+
2554+ GLuint vertexBuffer;
2555+ GLuint normalBuffer;
2556+ GLuint colorBuffer;
2557+ GLuint textureBuffers[4];
2558 std::vector<AbstractUniform*> uniforms;
2559
2560- GLVertexBuffer::AutoProgram *autoProgram;
2561+ GLVertexBuffer::AutoProgram *autoProgram;
2562 };
2563
2564 #endif //_VERTEXBUFFER_PRIVATE_H
2565-
2566
2567=== modified file 'plugins/opengl/src/program.cpp'
2568--- plugins/opengl/src/program.cpp 2012-12-04 12:15:34 +0000
2569+++ plugins/opengl/src/program.cpp 2013-07-24 16:05:45 +0000
2570@@ -37,15 +37,14 @@
2571
2572 void printShaderInfoLog (GLuint shader)
2573 {
2574- GLint length = 0;
2575- GLint chars = 0;
2576+ GLint length = 0;
2577+ GLint chars = 0;
2578
2579 (*GL::getShaderiv) (shader, GL::INFO_LOG_LENGTH, &length);
2580
2581 if (length > 0)
2582 {
2583- GLchar *infoLog;
2584- infoLog = new GLchar[length];
2585+ GLchar *infoLog = new GLchar[length];
2586 (*GL::getShaderInfoLog) (shader, length, &chars, infoLog);
2587 std::cout << infoLog << std::endl;
2588 delete[] infoLog;
2589@@ -54,27 +53,26 @@
2590
2591 void printProgramInfoLog(GLuint program)
2592 {
2593- GLint length = 0;
2594- GLint chars = 0;
2595+ GLint length = 0;
2596+ GLint chars = 0;
2597
2598 (*GL::getProgramiv) (program, GL::INFO_LOG_LENGTH, &length);
2599
2600 if (length > 0)
2601 {
2602- GLchar *infoLog;
2603- infoLog = new GLchar[length];
2604+ GLchar *infoLog = new GLchar[length];
2605 (*GL::getProgramInfoLog) (program, length, &chars, infoLog);
2606 std::cout << infoLog << std::endl;
2607 delete[] infoLog;
2608 }
2609 }
2610
2611-static bool compileShader (GLuint *shader, GLenum type, CompString &source)
2612+static bool compileShader (GLuint *shader,
2613+ GLenum type,
2614+ CompString &source)
2615 {
2616- const GLchar *data;
2617 GLint status;
2618-
2619- data = (GLchar *)source.c_str ();
2620+ const GLchar *data = (GLchar *)source.c_str ();
2621
2622 *shader = (*GL::createShader) (type);
2623 (*GL::shaderSource) (*shader, 1, &data, NULL);
2624@@ -88,9 +86,9 @@
2625 priv (new PrivateProgram ())
2626 {
2627 GLuint vertex, fragment;
2628- GLint status;
2629+ GLint status;
2630
2631- priv->valid = false;
2632+ priv->valid = false;
2633 priv->program = (*GL::createProgram) ();
2634
2635 if (!compileShader (&vertex, GL::VERTEX_SHADER, vertexShader))
2636@@ -114,6 +112,7 @@
2637 (*GL::validateProgram) (priv->program);
2638
2639 (*GL::getProgramiv) (priv->program, GL::LINK_STATUS, &status);
2640+
2641 if (status == GL_FALSE)
2642 {
2643 printProgramInfoLog (priv->program);
2644@@ -147,9 +146,11 @@
2645 (*GL::useProgram) (0);
2646 }
2647
2648-bool GLProgram::setUniform (const char *name, GLfloat value)
2649+bool GLProgram::setUniform (const char *name,
2650+ GLfloat value)
2651 {
2652 GLint location = (*GL::getUniformLocation) (priv->program, name);
2653+
2654 if (location == -1)
2655 return false;
2656
2657@@ -157,9 +158,11 @@
2658 return true;
2659 }
2660
2661-bool GLProgram::setUniform (const char *name, GLint value)
2662+bool GLProgram::setUniform (const char *name,
2663+ GLint value)
2664 {
2665 GLint location = (*GL::getUniformLocation) (priv->program, name);
2666+
2667 if (location == -1)
2668 return false;
2669
2670@@ -167,9 +170,11 @@
2671 return true;
2672 }
2673
2674-bool GLProgram::setUniform (const char *name, const GLMatrix &value)
2675+bool GLProgram::setUniform (const char *name,
2676+ const GLMatrix &value)
2677 {
2678 GLint location = (*GL::getUniformLocation) (priv->program, name);
2679+
2680 if (location == -1)
2681 return false;
2682
2683@@ -178,10 +183,11 @@
2684 }
2685
2686 bool GLProgram::setUniform2f (const char *name,
2687- GLfloat x,
2688- GLfloat y)
2689+ GLfloat x,
2690+ GLfloat y)
2691 {
2692 GLint location = (*GL::getUniformLocation) (priv->program, name);
2693+
2694 if (location == -1)
2695 return false;
2696
2697@@ -190,11 +196,12 @@
2698 }
2699
2700 bool GLProgram::setUniform3f (const char *name,
2701- GLfloat x,
2702- GLfloat y,
2703- GLfloat z)
2704+ GLfloat x,
2705+ GLfloat y,
2706+ GLfloat z)
2707 {
2708 GLint location = (*GL::getUniformLocation) (priv->program, name);
2709+
2710 if (location == -1)
2711 return false;
2712
2713@@ -203,12 +210,13 @@
2714 }
2715
2716 bool GLProgram::setUniform4f (const char *name,
2717- GLfloat x,
2718- GLfloat y,
2719- GLfloat z,
2720- GLfloat w)
2721+ GLfloat x,
2722+ GLfloat y,
2723+ GLfloat z,
2724+ GLfloat w)
2725 {
2726 GLint location = (*GL::getUniformLocation) (priv->program, name);
2727+
2728 if (location == -1)
2729 return false;
2730
2731@@ -217,10 +225,11 @@
2732 }
2733
2734 bool GLProgram::setUniform2i (const char *name,
2735- GLint x,
2736- GLint y)
2737+ GLint x,
2738+ GLint y)
2739 {
2740 GLint location = (*GL::getUniformLocation) (priv->program, name);
2741+
2742 if (location == -1)
2743 return false;
2744
2745@@ -229,11 +238,12 @@
2746 }
2747
2748 bool GLProgram::setUniform3i (const char *name,
2749- GLint x,
2750- GLint y,
2751- GLint z)
2752+ GLint x,
2753+ GLint y,
2754+ GLint z)
2755 {
2756 GLint location = (*GL::getUniformLocation) (priv->program, name);
2757+
2758 if (location == -1)
2759 return false;
2760
2761@@ -242,12 +252,13 @@
2762 }
2763
2764 bool GLProgram::setUniform4i (const char *name,
2765- GLint x,
2766- GLint y,
2767- GLint z,
2768- GLint w)
2769+ GLint x,
2770+ GLint y,
2771+ GLint z,
2772+ GLint w)
2773 {
2774 GLint location = (*GL::getUniformLocation) (priv->program, name);
2775+
2776 if (location == -1)
2777 return false;
2778
2779@@ -259,4 +270,3 @@
2780 {
2781 return (*GL::getAttribLocation) (priv->program, name);
2782 }
2783-
2784
2785=== modified file 'plugins/opengl/src/programcache.cpp'
2786--- plugins/opengl/src/programcache.cpp 2013-01-10 08:19:56 +0000
2787+++ plugins/opengl/src/programcache.cpp 2013-07-24 16:05:45 +0000
2788@@ -31,58 +31,50 @@
2789 typedef std::pair<boost::shared_ptr<GLProgram>, access_history_t::iterator> value;
2790
2791 static GLProgram *
2792-compileProgram (std::string name, std::list<const GLShaderData*> shaders)
2793+compileProgram (std::string name,
2794+ std::list<const GLShaderData*> shaders)
2795 {
2796- std::list<const GLShaderData*>::const_iterator it;
2797 std::string vertex_shader;
2798 std::string fragment_shader;
2799- std::string vertex_functions = "";
2800- std::string vertex_function_calls = "";
2801- std::string fragment_functions = "";
2802+ std::string vertex_functions = "";
2803+ std::string vertex_function_calls = "";
2804+ std::string fragment_functions = "";
2805 std::string fragment_function_calls = "";
2806- int vpos, vcallpos, fpos, fcallpos;
2807
2808- for (it = shaders.begin (); it != shaders.end (); ++it)
2809+ for (std::list<const GLShaderData*>::const_iterator it = shaders.begin ();
2810+ it != shaders.end (); ++it)
2811 {
2812 //find the special shaders to put the rest in
2813 if ((*it)->vertexShader.find ("@VERTEX_FUNCTIONS@") != std::string::npos)
2814- {
2815 vertex_shader = (*it)->vertexShader;
2816- }
2817- else
2818+
2819+ else if ((*it)->vertexShader.length ())
2820 {
2821- if ((*it)->vertexShader.length ())
2822- {
2823- vertex_functions += (*it)->vertexShader;
2824- vertex_function_calls += (*it)->name + "_vertex();\n";
2825- }
2826+ vertex_functions += (*it)->vertexShader;
2827+ vertex_function_calls += (*it)->name + "_vertex();\n";
2828 }
2829
2830 if ((*it)->fragmentShader.find ("@FRAGMENT_FUNCTIONS@") != std::string::npos)
2831- {
2832 fragment_shader = (*it)->fragmentShader;
2833- }
2834- else
2835+
2836+ else if ((*it)->fragmentShader.length ())
2837 {
2838- if ((*it)->fragmentShader.length ())
2839- {
2840- fragment_functions += (*it)->fragmentShader;
2841- fragment_function_calls += (*it)->name + "_fragment();\n";
2842- }
2843+ fragment_functions += (*it)->fragmentShader;
2844+ fragment_function_calls += (*it)->name + "_fragment();\n";
2845 }
2846 }
2847
2848 // put shader functions and function calls into the main shader
2849- vpos = vertex_shader.find ("@VERTEX_FUNCTIONS@");
2850+ int vpos = vertex_shader.find ("@VERTEX_FUNCTIONS@");
2851 vertex_shader.replace (vpos, 18, vertex_functions);
2852
2853- vcallpos = vertex_shader.find ("@VERTEX_FUNCTION_CALLS@");
2854+ int vcallpos = vertex_shader.find ("@VERTEX_FUNCTION_CALLS@");
2855 vertex_shader.replace (vcallpos, 23, vertex_function_calls);
2856
2857- fpos = fragment_shader.find ("@FRAGMENT_FUNCTIONS@");
2858+ int fpos = fragment_shader.find ("@FRAGMENT_FUNCTIONS@");
2859 fragment_shader.replace (fpos, 20, fragment_functions);
2860
2861- fcallpos = fragment_shader.find ("@FRAGMENT_FUNCTION_CALLS@");
2862+ int fcallpos = fragment_shader.find ("@FRAGMENT_FUNCTION_CALLS@");
2863 fragment_shader.replace (fcallpos, 25, fragment_function_calls);
2864
2865 return new GLProgram (vertex_shader, fragment_shader);
2866@@ -91,13 +83,16 @@
2867 class PrivateProgramCache
2868 {
2869 public:
2870+
2871 PrivateProgramCache (size_t);
2872
2873 const size_t capacity;
2874 access_history_t access_history;
2875 std::map<std::string, value> cache;
2876
2877- void insert (std::string, GLProgram *);
2878+ void insert (std::string ,
2879+ GLProgram *);
2880+
2881 void evict ();
2882 };
2883
2884@@ -114,10 +109,10 @@
2885
2886 GLProgram* GLProgramCache::operator () (std::list<const GLShaderData*> shaders)
2887 {
2888- std::list<const GLShaderData*>::const_iterator name_it;
2889 std::string name;
2890
2891- for (name_it = shaders.begin(); name_it != shaders.end(); ++name_it)
2892+ for (std::list<const GLShaderData*>::const_iterator name_it = shaders.begin();
2893+ name_it != shaders.end(); ++name_it)
2894 {
2895 if (name.length () == 0)
2896 name += (*name_it)->name;
2897@@ -136,8 +131,8 @@
2898 else
2899 {
2900 priv->access_history.splice (priv->access_history.end (),
2901- priv->access_history,
2902- (*it).second.second);
2903+ priv->access_history,
2904+ (*it).second.second);
2905 (*it).second.second = priv->access_history.rbegin ().base ();
2906
2907 return (*it).second.first.get ();
2908@@ -149,7 +144,8 @@
2909 {
2910 }
2911
2912-void PrivateProgramCache::insert (std::string name, GLProgram *program)
2913+void PrivateProgramCache::insert (std::string name,
2914+ GLProgram *program)
2915 {
2916 assert (cache.find (name) == cache.end ());
2917
2918@@ -173,4 +169,3 @@
2919 cache.erase (it);
2920 access_history.pop_front ();
2921 }
2922-
2923
2924=== modified file 'plugins/opengl/src/screen.cpp'
2925--- plugins/opengl/src/screen.cpp 2013-05-15 10:47:42 +0000
2926+++ plugins/opengl/src/screen.cpp 2013-07-24 16:05:45 +0000
2927@@ -54,18 +54,18 @@
2928 class DetectionWorkaround
2929 {
2930 public:
2931- DetectionWorkaround ()
2932- {
2933- program_invocation_short_name[0] = 'C';
2934- }
2935- ~DetectionWorkaround ()
2936- {
2937- program_invocation_short_name[0] = 'c';
2938- }
2939+
2940+ DetectionWorkaround ()
2941+ {
2942+ program_invocation_short_name[0] = 'C';
2943+ }
2944+ ~DetectionWorkaround ()
2945+ {
2946+ program_invocation_short_name[0] = 'c';
2947+ }
2948 };
2949 #endif
2950
2951-
2952 using namespace compiz::opengl;
2953
2954 namespace GL {
2955@@ -75,124 +75,124 @@
2956
2957 GLEGLImageTargetTexture2DOESProc eglImageTargetTexture;
2958
2959- EGLPostSubBufferNVProc postSubBuffer = NULL;
2960+ EGLPostSubBufferNVProc postSubBuffer = NULL;
2961 #else
2962
2963 typedef int (*GLXSwapIntervalProc) (int interval);
2964
2965- GLXBindTexImageProc bindTexImage = NULL;
2966- GLXReleaseTexImageProc releaseTexImage = NULL;
2967- GLXQueryDrawableProc queryDrawable = NULL;
2968- GLXCopySubBufferProc copySubBuffer = NULL;
2969- GLXGetVideoSyncProc getVideoSync = NULL;
2970- GLXWaitVideoSyncProc waitVideoSync = NULL;
2971- GLXSwapIntervalProc swapInterval = NULL;
2972- GLXGetFBConfigsProc getFBConfigs = NULL;
2973- GLXGetFBConfigAttribProc getFBConfigAttrib = NULL;
2974- GLXCreatePixmapProc createPixmap = NULL;
2975- GLXDestroyPixmapProc destroyPixmap = NULL;
2976- GLGenProgramsProc genPrograms = NULL;
2977- GLDeleteProgramsProc deletePrograms = NULL;
2978- GLBindProgramProc bindProgram = NULL;
2979- GLProgramStringProc programString = NULL;
2980- GLProgramParameter4fProc programEnvParameter4f = NULL;
2981- GLProgramParameter4fProc programLocalParameter4f = NULL;
2982+ GLXBindTexImageProc bindTexImage = NULL;
2983+ GLXReleaseTexImageProc releaseTexImage = NULL;
2984+ GLXQueryDrawableProc queryDrawable = NULL;
2985+ GLXCopySubBufferProc copySubBuffer = NULL;
2986+ GLXGetVideoSyncProc getVideoSync = NULL;
2987+ GLXWaitVideoSyncProc waitVideoSync = NULL;
2988+ GLXSwapIntervalProc swapInterval = NULL;
2989+ GLXGetFBConfigsProc getFBConfigs = NULL;
2990+ GLXGetFBConfigAttribProc getFBConfigAttrib = NULL;
2991+ GLXCreatePixmapProc createPixmap = NULL;
2992+ GLXDestroyPixmapProc destroyPixmap = NULL;
2993+ GLGenProgramsProc genPrograms = NULL;
2994+ GLDeleteProgramsProc deletePrograms = NULL;
2995+ GLBindProgramProc bindProgram = NULL;
2996+ GLProgramStringProc programString = NULL;
2997+ GLProgramParameter4fProc programEnvParameter4f = NULL;
2998+ GLProgramParameter4fProc programLocalParameter4f = NULL;
2999 #endif
3000
3001- GLActiveTextureProc activeTexture = NULL;
3002- GLClientActiveTextureProc clientActiveTexture = NULL;
3003- GLMultiTexCoord2fProc multiTexCoord2f = NULL;
3004-
3005- GLGenFramebuffersProc genFramebuffers = NULL;
3006- GLDeleteFramebuffersProc deleteFramebuffers = NULL;
3007- GLBindFramebufferProc bindFramebuffer = NULL;
3008- GLCheckFramebufferStatusProc checkFramebufferStatus = NULL;
3009- GLFramebufferTexture2DProc framebufferTexture2D = NULL;
3010- GLGenerateMipmapProc generateMipmap = NULL;
3011-
3012- GLBindBufferProc bindBuffer = NULL;
3013- GLDeleteBuffersProc deleteBuffers = NULL;
3014- GLGenBuffersProc genBuffers = NULL;
3015- GLBufferDataProc bufferData = NULL;
3016- GLBufferSubDataProc bufferSubData = NULL;
3017-
3018- GLGetShaderivProc getShaderiv = NULL;
3019- GLGetShaderInfoLogProc getShaderInfoLog = NULL;
3020- GLGetProgramivProc getProgramiv = NULL;
3021- GLGetProgramInfoLogProc getProgramInfoLog = NULL;
3022- GLCreateShaderProc createShader = NULL;
3023- GLShaderSourceProc shaderSource = NULL;
3024- GLCompileShaderProc compileShader = NULL;
3025- GLCreateProgramProc createProgram = NULL;
3026- GLAttachShaderProc attachShader = NULL;
3027- GLLinkProgramProc linkProgram = NULL;
3028- GLValidateProgramProc validateProgram = NULL;
3029- GLDeleteShaderProc deleteShader = NULL;
3030- GLDeleteProgramProc deleteProgram = NULL;
3031- GLUseProgramProc useProgram = NULL;
3032- GLGetUniformLocationProc getUniformLocation = NULL;
3033- GLUniform1fProc uniform1f = NULL;
3034- GLUniform1iProc uniform1i = NULL;
3035- GLUniform2fProc uniform2f = NULL;
3036- GLUniform2iProc uniform2i = NULL;
3037- GLUniform3fProc uniform3f = NULL;
3038- GLUniform3iProc uniform3i = NULL;
3039- GLUniform4fProc uniform4f = NULL;
3040- GLUniform4iProc uniform4i = NULL;
3041- GLUniformMatrix4fvProc uniformMatrix4fv = NULL;
3042- GLGetAttribLocationProc getAttribLocation = NULL;
3043+ GLActiveTextureProc activeTexture = NULL;
3044+ GLClientActiveTextureProc clientActiveTexture = NULL;
3045+ GLMultiTexCoord2fProc multiTexCoord2f = NULL;
3046+
3047+ GLGenFramebuffersProc genFramebuffers = NULL;
3048+ GLDeleteFramebuffersProc deleteFramebuffers = NULL;
3049+ GLBindFramebufferProc bindFramebuffer = NULL;
3050+ GLCheckFramebufferStatusProc checkFramebufferStatus = NULL;
3051+ GLFramebufferTexture2DProc framebufferTexture2D = NULL;
3052+ GLGenerateMipmapProc generateMipmap = NULL;
3053+
3054+ GLBindBufferProc bindBuffer = NULL;
3055+ GLDeleteBuffersProc deleteBuffers = NULL;
3056+ GLGenBuffersProc genBuffers = NULL;
3057+ GLBufferDataProc bufferData = NULL;
3058+ GLBufferSubDataProc bufferSubData = NULL;
3059+
3060+ GLGetShaderivProc getShaderiv = NULL;
3061+ GLGetShaderInfoLogProc getShaderInfoLog = NULL;
3062+ GLGetProgramivProc getProgramiv = NULL;
3063+ GLGetProgramInfoLogProc getProgramInfoLog = NULL;
3064+ GLCreateShaderProc createShader = NULL;
3065+ GLShaderSourceProc shaderSource = NULL;
3066+ GLCompileShaderProc compileShader = NULL;
3067+ GLCreateProgramProc createProgram = NULL;
3068+ GLAttachShaderProc attachShader = NULL;
3069+ GLLinkProgramProc linkProgram = NULL;
3070+ GLValidateProgramProc validateProgram = NULL;
3071+ GLDeleteShaderProc deleteShader = NULL;
3072+ GLDeleteProgramProc deleteProgram = NULL;
3073+ GLUseProgramProc useProgram = NULL;
3074+ GLGetUniformLocationProc getUniformLocation = NULL;
3075+ GLUniform1fProc uniform1f = NULL;
3076+ GLUniform1iProc uniform1i = NULL;
3077+ GLUniform2fProc uniform2f = NULL;
3078+ GLUniform2iProc uniform2i = NULL;
3079+ GLUniform3fProc uniform3f = NULL;
3080+ GLUniform3iProc uniform3i = NULL;
3081+ GLUniform4fProc uniform4f = NULL;
3082+ GLUniform4iProc uniform4i = NULL;
3083+ GLUniformMatrix4fvProc uniformMatrix4fv = NULL;
3084+ GLGetAttribLocationProc getAttribLocation = NULL;
3085
3086 #ifndef USE_GLES
3087
3088- GLCreateShaderObjectARBProc createShaderObjectARB = NULL;
3089- GLCreateProgramObjectARBProc createProgramObjectARB = NULL;
3090- GLCompileShaderARBProc compileShaderARB = NULL;
3091- GLShaderSourceARBProc shaderSourceARB = NULL;
3092- GLValidateProgramARBProc validateProgramARB = NULL;
3093- GLDeleteObjectARBProc deleteObjectARB = NULL;
3094- GLAttachObjectARBProc attachObjectARB = NULL;
3095- GLLinkProgramARBProc linkProgramARB = NULL;
3096- GLUseProgramObjectARBProc useProgramObjectARB = NULL;
3097- GLGetUniformLocationARBProc getUniformLocationARB = NULL;
3098- GLGetAttribLocationARBProc getAttribLocationARB = NULL;
3099- GLGetObjectParameterivProc getObjectParameteriv = NULL;
3100- GLGetInfoLogProc getInfoLog = NULL;
3101+ GLCreateShaderObjectARBProc createShaderObjectARB = NULL;
3102+ GLCreateProgramObjectARBProc createProgramObjectARB = NULL;
3103+ GLCompileShaderARBProc compileShaderARB = NULL;
3104+ GLShaderSourceARBProc shaderSourceARB = NULL;
3105+ GLValidateProgramARBProc validateProgramARB = NULL;
3106+ GLDeleteObjectARBProc deleteObjectARB = NULL;
3107+ GLAttachObjectARBProc attachObjectARB = NULL;
3108+ GLLinkProgramARBProc linkProgramARB = NULL;
3109+ GLUseProgramObjectARBProc useProgramObjectARB = NULL;
3110+ GLGetUniformLocationARBProc getUniformLocationARB = NULL;
3111+ GLGetAttribLocationARBProc getAttribLocationARB = NULL;
3112+ GLGetObjectParameterivProc getObjectParameteriv = NULL;
3113+ GLGetInfoLogProc getInfoLog = NULL;
3114
3115 #endif
3116
3117- GLEnableVertexAttribArrayProc enableVertexAttribArray = NULL;
3118+ GLEnableVertexAttribArrayProc enableVertexAttribArray = NULL;
3119 GLDisableVertexAttribArrayProc disableVertexAttribArray = NULL;
3120- GLVertexAttribPointerProc vertexAttribPointer = NULL;
3121-
3122- GLGenRenderbuffersProc genRenderbuffers = NULL;
3123- GLDeleteRenderbuffersProc deleteRenderbuffers = NULL;
3124- GLFramebufferRenderbufferProc framebufferRenderbuffer = NULL;
3125- GLBindRenderbufferProc bindRenderbuffer = NULL;
3126- GLRenderbufferStorageProc renderbufferStorage = NULL;
3127-
3128- bool textureFromPixmap = true;
3129- bool textureRectangle = false;
3130- bool textureNonPowerOfTwo = false;
3131- bool textureNonPowerOfTwoMipmap = false;
3132- bool textureEnvCombine = false;
3133- bool textureEnvCrossbar = false;
3134- bool textureBorderClamp = false;
3135- bool textureCompression = false;
3136- GLint maxTextureSize = 0;
3137- bool fboSupported = false;
3138- bool fboEnabled = false;
3139- bool fboStencilSupported = false;
3140- bool vboSupported = false;
3141- bool vboEnabled = false;
3142- bool shaders = false;
3143- GLint maxTextureUnits = 1;
3144-
3145- bool canDoSaturated = false;
3146- bool canDoSlightlySaturated = false;
3147-
3148- unsigned int vsyncCount = 0;
3149-
3150- bool stencilBuffer = false;
3151+ GLVertexAttribPointerProc vertexAttribPointer = NULL;
3152+
3153+ GLGenRenderbuffersProc genRenderbuffers = NULL;
3154+ GLDeleteRenderbuffersProc deleteRenderbuffers = NULL;
3155+ GLFramebufferRenderbufferProc framebufferRenderbuffer = NULL;
3156+ GLBindRenderbufferProc bindRenderbuffer = NULL;
3157+ GLRenderbufferStorageProc renderbufferStorage = NULL;
3158+
3159+ bool textureFromPixmap = true;
3160+ bool textureRectangle = false;
3161+ bool textureNonPowerOfTwo = false;
3162+ bool textureNonPowerOfTwoMipmap = false;
3163+ bool textureEnvCombine = false;
3164+ bool textureEnvCrossbar = false;
3165+ bool textureBorderClamp = false;
3166+ bool textureCompression = false;
3167+ GLint maxTextureSize = 0;
3168+ bool fboSupported = false;
3169+ bool fboEnabled = false;
3170+ bool fboStencilSupported = false;
3171+ bool vboSupported = false;
3172+ bool vboEnabled = false;
3173+ bool shaders = false;
3174+ GLint maxTextureUnits = 1;
3175+
3176+ bool canDoSaturated = false;
3177+ bool canDoSlightlySaturated = false;
3178+
3179+ unsigned int vsyncCount = 0;
3180+
3181+ bool stencilBuffer = false;
3182 #ifndef USE_GLES
3183
3184 GLuint createShaderARBWrapper (GLenum type)
3185@@ -205,7 +205,10 @@
3186 return static_cast <GLuint> ((GL::createProgramObjectARB) ());
3187 }
3188
3189- void shaderSourceARBWrapper (GLuint shader, GLsizei count, const GLchar **string, const GLint *length)
3190+ void shaderSourceARBWrapper (GLuint shader,
3191+ GLsizei count,
3192+ const GLchar **string,
3193+ const GLint *length)
3194 {
3195 (GL::shaderSourceARB) (static_cast <GLhandleARB> (shader), count, string, length);
3196 }
3197@@ -230,7 +233,8 @@
3198 (GL::deleteObjectARB) (static_cast <GLhandleARB> (program));
3199 }
3200
3201- void attachShaderARBWrapper (GLuint program, GLuint shader)
3202+ void attachShaderARBWrapper (GLuint program,
3203+ GLuint shader)
3204 {
3205 (GL::attachObjectARB) (static_cast <GLhandleARB> (program), static_cast <GLhandleARB> (shader));
3206 }
3207@@ -245,32 +249,44 @@
3208 (GL::useProgramObjectARB) (static_cast <GLhandleARB> (program));
3209 }
3210
3211- int getUniformLocationARBWrapper (GLuint program, const GLchar *name)
3212+ int getUniformLocationARBWrapper (GLuint program,
3213+ const GLchar *name)
3214 {
3215 return (GL::getUniformLocationARB) (static_cast <GLhandleARB> (program), name);
3216 }
3217
3218- int getAttribLocationARBWrapper (GLuint program, const GLchar *name)
3219+ int getAttribLocationARBWrapper (GLuint program,
3220+ const GLchar *name)
3221 {
3222 return (GL::getAttribLocationARB) (static_cast <GLhandleARB> (program), name);
3223 }
3224
3225- void getProgramInfoLogARBWrapper (GLuint object, int maxLen, int *len, char *log)
3226- {
3227- (GL::getInfoLog) (static_cast <GLhandleARB> (object), maxLen, len, log);
3228- }
3229-
3230- void getShaderInfoLogARBWrapper (GLuint object, int maxLen, int *len, char *log)
3231- {
3232- (GL::getInfoLog) (static_cast <GLhandleARB> (object), maxLen, len, log);
3233- }
3234-
3235- void getShaderivARBWrapper (GLuint object, GLenum type, int *param)
3236+ void getProgramInfoLogARBWrapper (GLuint object,
3237+ int maxLen,
3238+ int *len,
3239+ char *log)
3240+ {
3241+ (GL::getInfoLog) (static_cast <GLhandleARB> (object), maxLen, len, log);
3242+ }
3243+
3244+ void getShaderInfoLogARBWrapper (GLuint object,
3245+ int maxLen,
3246+ int *len,
3247+ char *log)
3248+ {
3249+ (GL::getInfoLog) (static_cast <GLhandleARB> (object), maxLen, len, log);
3250+ }
3251+
3252+ void getShaderivARBWrapper (GLuint object,
3253+ GLenum type,
3254+ int *param)
3255 {
3256 (GL::getObjectParameteriv) (static_cast <GLhandleARB> (object), type, param);
3257 }
3258
3259- void getProgramivARBWrapper (GLuint object, GLenum type, int *param)
3260+ void getProgramivARBWrapper (GLuint object,
3261+ GLenum type,
3262+ int *param)
3263 {
3264 (GL::getObjectParameteriv) (static_cast <GLhandleARB> (object), type, param);
3265 }
3266@@ -286,14 +302,15 @@
3267 class GLScreenAutoProgram : public GLVertexBuffer::AutoProgram
3268 {
3269 public:
3270+
3271 GLScreenAutoProgram (GLScreen *gScreen) : gScreen(gScreen) {}
3272
3273 GLProgram *getProgram (GLShaderParameters &params)
3274 {
3275- const GLShaderData *shaderData = gScreen->getShaderData (params);
3276- std::list<const GLShaderData *> tempShaders;
3277- tempShaders.push_back (shaderData);
3278- return gScreen->getProgram (tempShaders);
3279+ const GLShaderData *shaderData = gScreen->getShaderData (params);
3280+ std::list<const GLShaderData *> tempShaders;
3281+ tempShaders.push_back (shaderData);
3282+ return gScreen->getProgram (tempShaders);
3283 }
3284
3285 GLScreen *gScreen;
3286@@ -341,13 +358,14 @@
3287 {
3288 namespace opengl
3289 {
3290-void swapIntervalEGL (Display *display, int interval)
3291+void swapIntervalEGL (Display *display,
3292+ int interval)
3293 {
3294 eglSwapInterval (eglGetDisplay (display), interval);
3295 }
3296
3297-int waitVSyncEGL (int wait,
3298- int remainder,
3299+int waitVSyncEGL (int wait,
3300+ int remainder,
3301 unsigned int *count)
3302 {
3303 /* not supported */
3304@@ -365,37 +383,37 @@
3305 DetectionWorkaround workaround;
3306 #endif
3307
3308- #ifdef USE_GLES
3309- Display *xdpy;
3310- Window overlay;
3311- EGLDisplay dpy;
3312- EGLConfig config;
3313- EGLint major, minor;
3314- const char *eglExtensions, *glExtensions;
3315- XWindowAttributes attr;
3316- EGLint count, visualid;
3317- EGLConfig configs[1024];
3318- CompOption::Vector o (0);
3319-
3320- const EGLint config_attribs[] = {
3321- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
3322- EGL_RED_SIZE, 1,
3323- EGL_GREEN_SIZE, 1,
3324- EGL_BLUE_SIZE, 1,
3325- EGL_ALPHA_SIZE, 0,
3326- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
3327- EGL_CONFIG_CAVEAT, EGL_NONE,
3328- EGL_STENCIL_SIZE, 1,
3329- EGL_NONE
3330- };
3331-
3332- const EGLint context_attribs[] = {
3333- EGL_CONTEXT_CLIENT_VERSION, 2,
3334- EGL_NONE
3335- };
3336-
3337- xdpy = screen->dpy ();
3338- dpy = eglGetDisplay ((EGLNativeDisplayType)xdpy);
3339+#ifdef USE_GLES
3340+ Window overlay;
3341+ EGLint major, minor;
3342+ const char *eglExtensions, *glExtensions;
3343+ XWindowAttributes attr;
3344+ EGLint count;
3345+ EGLConfig configs[1024];
3346+ CompOption::Vector o (0);
3347+
3348+ const EGLint config_attribs[] =
3349+ {
3350+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
3351+ EGL_RED_SIZE, 1,
3352+ EGL_GREEN_SIZE, 1,
3353+ EGL_BLUE_SIZE, 1,
3354+ EGL_ALPHA_SIZE, 0,
3355+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
3356+ EGL_CONFIG_CAVEAT, EGL_NONE,
3357+ EGL_STENCIL_SIZE, 1,
3358+ EGL_NONE
3359+ };
3360+
3361+ const EGLint context_attribs[] =
3362+ {
3363+ EGL_CONTEXT_CLIENT_VERSION, 2,
3364+ EGL_NONE
3365+ };
3366+
3367+ Display *xdpy = screen->dpy ();
3368+ EGLDisplay dpy = eglGetDisplay ((EGLNativeDisplayType)xdpy);
3369+
3370 if (!eglInitialize (dpy, &major, &minor))
3371 {
3372 screen->handleCompizEvent ("opengl", "fatal_fallback", o);
3373@@ -416,27 +434,30 @@
3374 return false;
3375 }
3376
3377- EGLint val;
3378- int msaaBuffers = MAXSHORT;
3379- int msaaSamples = MAXSHORT;
3380- visualid = XVisualIDFromVisual (attr.visual);
3381- config = configs[0];
3382+ EGLint val;
3383+ int msaaBuffers = MAXSHORT;
3384+ int msaaSamples = MAXSHORT;
3385+ EGLint visualid = XVisualIDFromVisual (attr.visual);
3386+ EGLConfig config = configs[0];
3387
3388 for (int i = 0; i < count; ++i)
3389 {
3390 eglGetConfigAttrib (dpy, configs[i], EGL_SAMPLE_BUFFERS, &val);
3391+
3392 if (val > msaaBuffers)
3393- continue;
3394+ continue;
3395
3396 msaaBuffers = val;
3397
3398 eglGetConfigAttrib (dpy, configs[i], EGL_SAMPLES, &val);
3399+
3400 if (val > msaaSamples)
3401 continue;
3402
3403 msaaSamples = val;
3404
3405 eglGetConfigAttrib (dpy, configs[i], EGL_NATIVE_VISUAL_ID, &val);
3406+
3407 if (val != visualid)
3408 continue;
3409
3410@@ -446,10 +467,11 @@
3411
3412 overlay = CompositeScreen::get (screen)->overlay ();
3413 priv->surface = eglCreateWindowSurface (dpy, config, overlay, 0);
3414+
3415 if (priv->surface == EGL_NO_SURFACE)
3416 {
3417 compLogMessage ("opengl", CompLogLevelFatal,
3418- "eglCreateWindowSurface failed");
3419+ "eglCreateWindowSurface failed");
3420 screen->handleCompizEvent ("opengl", "fatal_fallback", o);
3421 return false;
3422 }
3423@@ -458,6 +480,7 @@
3424 eglSurfaceAttrib (dpy, priv->surface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED);
3425
3426 priv->ctx = eglCreateContext (dpy, config, EGL_NO_CONTEXT, context_attribs);
3427+
3428 if (priv->ctx == EGL_NO_CONTEXT)
3429 {
3430 compLogMessage ("opengl", CompLogLevelFatal, "eglCreateContext failed");
3431@@ -474,7 +497,7 @@
3432 }
3433
3434 eglExtensions = (const char *) eglQueryString (dpy, EGL_EXTENSIONS);
3435- glExtensions = (const char *) glGetString (GL_EXTENSIONS);
3436+ glExtensions = (const char *) glGetString (GL_EXTENSIONS);
3437
3438 if (!glExtensions || !eglExtensions)
3439 {
3440@@ -484,15 +507,15 @@
3441 return false;
3442 }
3443
3444- GL::textureFromPixmap = true;
3445+ GL::textureFromPixmap = true;
3446 GL::textureNonPowerOfTwo = true;
3447- GL::fboSupported = true;
3448- GL::fboEnabled = true;
3449- GL::vboSupported = true;
3450- GL::vboEnabled = true;
3451- GL::shaders = true;
3452- GL::stencilBuffer = true;
3453- GL::maxTextureUnits = 4;
3454+ GL::fboSupported = true;
3455+ GL::fboEnabled = true;
3456+ GL::vboSupported = true;
3457+ GL::vboEnabled = true;
3458+ GL::shaders = true;
3459+ GL::stencilBuffer = true;
3460+ GL::maxTextureUnits = 4;
3461 glGetIntegerv (GL_MAX_TEXTURE_SIZE, &GL::maxTextureSize);
3462
3463 GL::createImage = (GL::EGLCreateImageKHRProc)
3464@@ -503,7 +526,7 @@
3465 eglGetProcAddress ("glEGLImageTargetTexture2DOES");
3466
3467 if (!strstr (eglExtensions, "EGL_KHR_image_pixmap") ||
3468- !strstr (glExtensions, "GL_OES_EGL_image") ||
3469+ !strstr (glExtensions, "GL_OES_EGL_image") ||
3470 !GL::createImage || !GL::destroyImage || !GL::eglImageTargetTexture)
3471 {
3472 compLogMessage ("opengl", CompLogLevelFatal,
3473@@ -531,7 +554,7 @@
3474 eglGetProcAddress ("eglPostSubBufferNV");
3475
3476 GL::fboStencilSupported = GL::fboSupported &&
3477- strstr (glExtensions, "GL_OES_packed_depth_stencil");
3478+ strstr (glExtensions, "GL_OES_packed_depth_stencil");
3479
3480 if (!GL::fboSupported &&
3481 !GL::postSubBuffer)
3482@@ -542,59 +565,64 @@
3483 return false;
3484 }
3485
3486- GL::activeTexture = glActiveTexture;
3487- GL::genFramebuffers = glGenFramebuffers;
3488- GL::deleteFramebuffers = glDeleteFramebuffers;
3489- GL::bindFramebuffer = glBindFramebuffer;
3490- GL::checkFramebufferStatus = glCheckFramebufferStatus;
3491- GL::framebufferTexture2D = glFramebufferTexture2D;
3492- GL::generateMipmap = glGenerateMipmap;
3493-
3494- GL::bindBuffer = glBindBuffer;
3495- GL::deleteBuffers = glDeleteBuffers;
3496- GL::genBuffers = glGenBuffers;
3497- GL::bufferData = glBufferData;
3498- GL::bufferSubData = glBufferSubData;
3499-
3500- GL::getShaderiv = glGetShaderiv;
3501- GL::getShaderInfoLog = glGetShaderInfoLog;
3502- GL::getProgramiv = glGetProgramiv;
3503- GL::getProgramInfoLog = glGetProgramInfoLog;
3504- GL::createShader = glCreateShader;
3505- GL::shaderSource = (GL::GLShaderSourceProc) glShaderSource;
3506- GL::compileShader = glCompileShader;
3507- GL::createProgram = glCreateProgram;
3508- GL::attachShader = glAttachShader;
3509- GL::linkProgram = glLinkProgram;
3510- GL::validateProgram = glValidateProgram;
3511- GL::deleteShader = glDeleteShader;
3512- GL::deleteProgram = glDeleteProgram;
3513- GL::useProgram = glUseProgram;
3514- GL::getUniformLocation = glGetUniformLocation;
3515- GL::uniform1f = glUniform1f;
3516- GL::uniform1i = glUniform1i;
3517- GL::uniform2f = glUniform2f;
3518- GL::uniform2i = glUniform2i;
3519- GL::uniform3f = glUniform3f;
3520- GL::uniform3i = glUniform3i;
3521- GL::uniform4f = glUniform4f;
3522- GL::uniform4i = glUniform4i;
3523- GL::uniformMatrix4fv = glUniformMatrix4fv;
3524- GL::getAttribLocation = glGetAttribLocation;
3525-
3526- GL::enableVertexAttribArray = glEnableVertexAttribArray;
3527+ GL::activeTexture = glActiveTexture;
3528+ GL::genFramebuffers = glGenFramebuffers;
3529+ GL::deleteFramebuffers = glDeleteFramebuffers;
3530+ GL::bindFramebuffer = glBindFramebuffer;
3531+ GL::checkFramebufferStatus = glCheckFramebufferStatus;
3532+ GL::framebufferTexture2D = glFramebufferTexture2D;
3533+ GL::generateMipmap = glGenerateMipmap;
3534+
3535+ GL::bindBuffer = glBindBuffer;
3536+ GL::deleteBuffers = glDeleteBuffers;
3537+ GL::genBuffers = glGenBuffers;
3538+ GL::bufferData = glBufferData;
3539+ GL::bufferSubData = glBufferSubData;
3540+
3541+ GL::getShaderiv = glGetShaderiv;
3542+ GL::getShaderInfoLog = glGetShaderInfoLog;
3543+ GL::getProgramiv = glGetProgramiv;
3544+ GL::getProgramInfoLog = glGetProgramInfoLog;
3545+ GL::createShader = glCreateShader;
3546+ GL::shaderSource = (GL::GLShaderSourceProc) glShaderSource;
3547+ GL::compileShader = glCompileShader;
3548+ GL::createProgram = glCreateProgram;
3549+ GL::attachShader = glAttachShader;
3550+ GL::linkProgram = glLinkProgram;
3551+ GL::validateProgram = glValidateProgram;
3552+ GL::deleteShader = glDeleteShader;
3553+ GL::deleteProgram = glDeleteProgram;
3554+ GL::useProgram = glUseProgram;
3555+ GL::getUniformLocation = glGetUniformLocation;
3556+ GL::uniform1f = glUniform1f;
3557+ GL::uniform1i = glUniform1i;
3558+ GL::uniform2f = glUniform2f;
3559+ GL::uniform2i = glUniform2i;
3560+ GL::uniform3f = glUniform3f;
3561+ GL::uniform3i = glUniform3i;
3562+ GL::uniform4f = glUniform4f;
3563+ GL::uniform4i = glUniform4i;
3564+ GL::uniformMatrix4fv = glUniformMatrix4fv;
3565+ GL::getAttribLocation = glGetAttribLocation;
3566+
3567+ GL::enableVertexAttribArray = glEnableVertexAttribArray;
3568 GL::disableVertexAttribArray = glDisableVertexAttribArray;
3569- GL::vertexAttribPointer = glVertexAttribPointer;
3570+ GL::vertexAttribPointer = glVertexAttribPointer;
3571
3572- GL::genRenderbuffers = glGenRenderbuffers;
3573- GL::deleteRenderbuffers = glDeleteRenderbuffers;
3574- GL::bindRenderbuffer = glBindRenderbuffer;
3575- GL::framebufferRenderbuffer = glFramebufferRenderbuffer;
3576- GL::renderbufferStorage = glRenderbufferStorage;
3577+ GL::genRenderbuffers = glGenRenderbuffers;
3578+ GL::deleteRenderbuffers = glDeleteRenderbuffers;
3579+ GL::bindRenderbuffer = glBindRenderbuffer;
3580+ GL::framebufferRenderbuffer = glFramebufferRenderbuffer;
3581+ GL::renderbufferStorage = glRenderbufferStorage;
3582
3583 glClearColor (0.0, 0.0, 0.0, 1.0);
3584 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
3585- glEnable (GL_BLEND);
3586+
3587+ GLboolean glBlendEnabled = glIsEnabled (GL_BLEND);
3588+
3589+ if (!glBlendEnabled)
3590+ glEnable (GL_BLEND);
3591+
3592 glEnable (GL_CULL_FACE);
3593
3594 priv->updateView ();
3595@@ -612,15 +640,16 @@
3596
3597 #else
3598
3599- Display *dpy = screen->dpy ();
3600- const char *glExtensions;
3601- GLfloat globalAmbient[] = { 0.1f, 0.1f, 0.1f, 0.1f };
3602- GLfloat ambientLight[] = { 0.0f, 0.0f, 0.0f, 0.0f };
3603- GLfloat diffuseLight[] = { 0.9f, 0.9f, 0.9f, 0.9f };
3604- GLfloat light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f };
3605+ Display *dpy = screen->dpy ();
3606+ const char *glExtensions;
3607+ GLfloat globalAmbient[] = { 0.1f, 0.1f, 0.1f, 0.1f };
3608+ GLfloat ambientLight[] = { 0.0f, 0.0f, 0.0f, 0.0f };
3609+ GLfloat diffuseLight[] = { 0.9f, 0.9f, 0.9f, 0.9f };
3610+ GLfloat light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f };
3611 CompOption::Vector o (0);
3612
3613 priv->ctx = glXCreateContext (dpy, visinfo, NULL, True);
3614+
3615 if (!priv->ctx)
3616 {
3617 compLogMessage ("opengl", CompLogLevelWarn,
3618@@ -648,6 +677,7 @@
3619 glXMakeCurrent (dpy, CompositeScreen::get (screen)->output (), priv->ctx);
3620
3621 glExtensions = (const char *) glGetString (GL_EXTENSIONS);
3622+
3623 if (!glExtensions)
3624 {
3625 compLogMessage ("opengl", CompLogLevelFatal,
3626@@ -656,13 +686,13 @@
3627 return false;
3628 }
3629
3630- const char *glVendor = (const char *) glGetString (GL_VENDOR);
3631+ const char *glVendor = (const char *) glGetString (GL_VENDOR);
3632 const char *glRenderer = (const char *) glGetString (GL_RENDERER);
3633- const char *glVersion = (const char *) glGetString (GL_VERSION);
3634+ const char *glVersion = (const char *) glGetString (GL_VERSION);
3635
3636- priv->glVendor = glVendor;
3637+ priv->glVendor = glVendor;
3638 priv->glRenderer = glRenderer;
3639- priv->glVersion = glVersion;
3640+ priv->glVersion = glVersion;
3641
3642 if (glRenderer != NULL &&
3643 (strcmp (glRenderer, "Software Rasterizer") == 0 ||
3644@@ -675,8 +705,9 @@
3645 return false;
3646 }
3647
3648- priv->commonFrontbuffer = true;
3649+ priv->commonFrontbuffer = true;
3650 priv->incorrectRefreshRate = false;
3651+
3652 if (glRenderer != NULL && strstr (glRenderer, "on llvmpipe"))
3653 {
3654 /*
3655@@ -691,7 +722,7 @@
3656
3657 if (glVendor != NULL && strstr (glVendor, "NVIDIA"))
3658 {
3659- /*
3660+ /* TODO: Check if this is still necessary:
3661 * NVIDIA provides an incorrect refresh rate, we need to
3662 * force 60Hz */
3663 priv->incorrectRefreshRate = true;
3664@@ -699,6 +730,7 @@
3665
3666 if (strstr (glExtensions, "GL_ARB_texture_non_power_of_two"))
3667 GL::textureNonPowerOfTwo = true;
3668+
3669 GL::textureNonPowerOfTwoMipmap = GL::textureNonPowerOfTwo;
3670
3671 glGetIntegerv (GL_MAX_TEXTURE_SIZE, &GL::maxTextureSize);
3672@@ -714,6 +746,7 @@
3673 GLint maxTextureSize;
3674
3675 glGetIntegerv (GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, &maxTextureSize);
3676+
3677 if (maxTextureSize > GL::maxTextureSize)
3678 GL::maxTextureSize = maxTextureSize;
3679 }
3680@@ -731,7 +764,7 @@
3681 {
3682 GL::textureEnvCombine = true;
3683
3684- /* XXX: GL_NV_texture_env_combine4 need special code but it seams to
3685+ /* XXX: GL_NV_texture_env_combine4 need special code but it seems to
3686 be working anyway for now... */
3687 if (strstr (glExtensions, "GL_ARB_texture_env_crossbar") ||
3688 strstr (glExtensions, "GL_NV_texture_env_combine4"))
3689@@ -743,6 +776,7 @@
3690 GL::textureBorderClamp = true;
3691
3692 GL::maxTextureUnits = 1;
3693+
3694 if (strstr (glExtensions, "GL_ARB_multitexture"))
3695 {
3696 GL::activeTexture = (GL::GLActiveTextureProc)
3697@@ -781,18 +815,17 @@
3698 GL::renderbufferStorage = (GL::GLRenderbufferStorageProc)
3699 getProcAddress ("glRenderbufferStorageEXT");
3700
3701- if (GL::genFramebuffers &&
3702- GL::deleteFramebuffers &&
3703- GL::bindFramebuffer &&
3704- GL::checkFramebufferStatus &&
3705- GL::framebufferTexture2D &&
3706- GL::generateMipmap &&
3707- GL::genRenderbuffers &&
3708- GL::deleteRenderbuffers &&
3709- GL::bindRenderbuffer &&
3710- GL::framebufferRenderbuffer &&
3711- GL::renderbufferStorage
3712- )
3713+ if (GL::genFramebuffers &&
3714+ GL::deleteFramebuffers &&
3715+ GL::bindFramebuffer &&
3716+ GL::checkFramebufferStatus &&
3717+ GL::framebufferTexture2D &&
3718+ GL::generateMipmap &&
3719+ GL::genRenderbuffers &&
3720+ GL::deleteRenderbuffers &&
3721+ GL::bindRenderbuffer &&
3722+ GL::framebufferRenderbuffer &&
3723+ GL::renderbufferStorage)
3724 GL::fboSupported = true;
3725 }
3726
3727@@ -822,53 +855,53 @@
3728
3729 priv->updateRenderMode ();
3730
3731- if (strstr (glExtensions, "GL_ARB_fragment_shader") &&
3732- strstr (glExtensions, "GL_ARB_vertex_shader") &&
3733- strstr (glExtensions, "GL_ARB_shader_objects") &&
3734+ if (strstr (glExtensions, "GL_ARB_fragment_shader") &&
3735+ strstr (glExtensions, "GL_ARB_vertex_shader") &&
3736+ strstr (glExtensions, "GL_ARB_shader_objects") &&
3737 strstr (glExtensions, "GL_ARB_shading_language_100"))
3738 {
3739- GL::getShaderiv = (GL::GLGetShaderivProc) GL::getShaderivARBWrapper;
3740- GL::getShaderInfoLog = (GL::GLGetShaderInfoLogProc) GL::getShaderInfoLogARBWrapper;
3741- GL::getProgramiv = (GL::GLGetProgramivProc) GL::getProgramivARBWrapper;
3742- GL::getProgramInfoLog = (GL::GLGetProgramInfoLogProc) GL::getProgramInfoLogARBWrapper;
3743- GL::getObjectParameteriv = (GL::GLGetObjectParameterivProc) getProcAddress ("glGetObjectParameterivARB");
3744- GL::getInfoLog = (GL::GLGetInfoLogProc) getProcAddress ("glGetInfoLogARB");
3745- GL::createShader = (GL::GLCreateShaderProc) GL::createShaderARBWrapper;
3746- GL::createShaderObjectARB = (GL::GLCreateShaderObjectARBProc) getProcAddress ("glCreateShaderObjectARB");
3747- GL::shaderSource = (GL::GLShaderSourceProc) GL::shaderSourceARBWrapper;
3748- GL::shaderSourceARB = (GL::GLShaderSourceARBProc) getProcAddress ("glShaderSourceARB");
3749- GL::compileShader = (GL::GLCompileShaderProc) GL::compileShaderARBWrapper;
3750- GL::compileShaderARB = (GL::GLCompileShaderARBProc) getProcAddress ("glCompileShaderARB");
3751- GL::createProgram = (GL::GLCreateProgramProc) GL::createProgramARBWrapper;
3752- GL::createProgramObjectARB = (GL::GLCreateProgramObjectARBProc) getProcAddress ("glCreateProgramObjectARB");
3753- GL::attachShader = GL::attachShaderARBWrapper;
3754- GL::attachObjectARB = (GL::GLAttachObjectARBProc) getProcAddress ("glAttachObjectARB");
3755- GL::linkProgram = GL::linkProgramARBWrapper;
3756- GL::linkProgramARB = (GL::GLLinkProgramARBProc) getProcAddress ("glLinkProgramARB");
3757- GL::validateProgram = GL::validateProgramARBWrapper;
3758- GL::validateProgramARB = (GL::GLValidateProgramARBProc) getProcAddress ("glValidateProgramARB");
3759- GL::deleteShader = GL::deleteShaderARBWrapper;
3760- GL::deleteProgram = GL::deleteProgramARBWrapper;
3761- GL::deleteObjectARB = (GL::GLDeleteObjectARBProc) getProcAddress ("glDeleteObjectARB");
3762- GL::useProgram = GL::useProgramARBWrapper;
3763- GL::useProgramObjectARB = (GL::GLUseProgramObjectARBProc) getProcAddress ("glUseProgramObjectARB");
3764- GL::getUniformLocation = GL::getUniformLocationARBWrapper;
3765- GL::getUniformLocationARB = (GL::GLGetUniformLocationARBProc) getProcAddress ("glGetUniformLocationARB");
3766- GL::uniform1f = (GL::GLUniform1fProc) getProcAddress ("glUniform1fARB");
3767- GL::uniform1i = (GL::GLUniform1iProc) getProcAddress ("glUniform1iARB");
3768- GL::uniform2f = (GL::GLUniform2fProc) getProcAddress ("glUniform2fARB");
3769- GL::uniform2i = (GL::GLUniform2iProc) getProcAddress ("glUniform2iARB");
3770- GL::uniform3f = (GL::GLUniform3fProc) getProcAddress ("glUniform3fARB");
3771- GL::uniform3i = (GL::GLUniform3iProc) getProcAddress ("glUniform3iARB");
3772- GL::uniform4f = (GL::GLUniform4fProc) getProcAddress ("glUniform4fARB");
3773- GL::uniform4i = (GL::GLUniform4iProc) getProcAddress ("glUniform4iARB");
3774- GL::uniformMatrix4fv = (GL::GLUniformMatrix4fvProc) getProcAddress ("glUniformMatrix4fvARB");
3775- GL::getAttribLocation = (GL::GLGetAttribLocationProc) GL::getAttribLocationARBWrapper;
3776- GL::getAttribLocationARB = (GL::GLGetAttribLocationARBProc) getProcAddress ("glGetAttribLocationARB");
3777+ GL::getShaderiv = (GL::GLGetShaderivProc) GL::getShaderivARBWrapper;
3778+ GL::getShaderInfoLog = (GL::GLGetShaderInfoLogProc) GL::getShaderInfoLogARBWrapper;
3779+ GL::getProgramiv = (GL::GLGetProgramivProc) GL::getProgramivARBWrapper;
3780+ GL::getProgramInfoLog = (GL::GLGetProgramInfoLogProc) GL::getProgramInfoLogARBWrapper;
3781+ GL::getObjectParameteriv = (GL::GLGetObjectParameterivProc) getProcAddress ("glGetObjectParameterivARB");
3782+ GL::getInfoLog = (GL::GLGetInfoLogProc) getProcAddress ("glGetInfoLogARB");
3783+ GL::createShader = (GL::GLCreateShaderProc) GL::createShaderARBWrapper;
3784+ GL::createShaderObjectARB = (GL::GLCreateShaderObjectARBProc) getProcAddress ("glCreateShaderObjectARB");
3785+ GL::shaderSource = (GL::GLShaderSourceProc) GL::shaderSourceARBWrapper;
3786+ GL::shaderSourceARB = (GL::GLShaderSourceARBProc) getProcAddress ("glShaderSourceARB");
3787+ GL::compileShader = (GL::GLCompileShaderProc) GL::compileShaderARBWrapper;
3788+ GL::compileShaderARB = (GL::GLCompileShaderARBProc) getProcAddress ("glCompileShaderARB");
3789+ GL::createProgram = (GL::GLCreateProgramProc) GL::createProgramARBWrapper;
3790+ GL::createProgramObjectARB = (GL::GLCreateProgramObjectARBProc) getProcAddress ("glCreateProgramObjectARB");
3791+ GL::attachShader = GL::attachShaderARBWrapper;
3792+ GL::attachObjectARB = (GL::GLAttachObjectARBProc) getProcAddress ("glAttachObjectARB");
3793+ GL::linkProgram = GL::linkProgramARBWrapper;
3794+ GL::linkProgramARB = (GL::GLLinkProgramARBProc) getProcAddress ("glLinkProgramARB");
3795+ GL::validateProgram = GL::validateProgramARBWrapper;
3796+ GL::validateProgramARB = (GL::GLValidateProgramARBProc) getProcAddress ("glValidateProgramARB");
3797+ GL::deleteShader = GL::deleteShaderARBWrapper;
3798+ GL::deleteProgram = GL::deleteProgramARBWrapper;
3799+ GL::deleteObjectARB = (GL::GLDeleteObjectARBProc) getProcAddress ("glDeleteObjectARB");
3800+ GL::useProgram = GL::useProgramARBWrapper;
3801+ GL::useProgramObjectARB = (GL::GLUseProgramObjectARBProc) getProcAddress ("glUseProgramObjectARB");
3802+ GL::getUniformLocation = GL::getUniformLocationARBWrapper;
3803+ GL::getUniformLocationARB = (GL::GLGetUniformLocationARBProc) getProcAddress ("glGetUniformLocationARB");
3804+ GL::uniform1f = (GL::GLUniform1fProc) getProcAddress ("glUniform1fARB");
3805+ GL::uniform1i = (GL::GLUniform1iProc) getProcAddress ("glUniform1iARB");
3806+ GL::uniform2f = (GL::GLUniform2fProc) getProcAddress ("glUniform2fARB");
3807+ GL::uniform2i = (GL::GLUniform2iProc) getProcAddress ("glUniform2iARB");
3808+ GL::uniform3f = (GL::GLUniform3fProc) getProcAddress ("glUniform3fARB");
3809+ GL::uniform3i = (GL::GLUniform3iProc) getProcAddress ("glUniform3iARB");
3810+ GL::uniform4f = (GL::GLUniform4fProc) getProcAddress ("glUniform4fARB");
3811+ GL::uniform4i = (GL::GLUniform4iProc) getProcAddress ("glUniform4iARB");
3812+ GL::uniformMatrix4fv = (GL::GLUniformMatrix4fvProc) getProcAddress ("glUniformMatrix4fvARB");
3813+ GL::getAttribLocation = (GL::GLGetAttribLocationProc) GL::getAttribLocationARBWrapper;
3814+ GL::getAttribLocationARB = (GL::GLGetAttribLocationARBProc) getProcAddress ("glGetAttribLocationARB");
3815
3816- GL::enableVertexAttribArray = (GL::GLEnableVertexAttribArrayProc) getProcAddress ("glEnableVertexAttribArrayARB");
3817+ GL::enableVertexAttribArray = (GL::GLEnableVertexAttribArrayProc) getProcAddress ("glEnableVertexAttribArrayARB");
3818 GL::disableVertexAttribArray = (GL::GLDisableVertexAttribArrayProc) getProcAddress ("glDisableVertexAttribArrayARB");
3819- GL::vertexAttribPointer = (GL::GLVertexAttribPointerProc) getProcAddress ("glVertexAttribPointerARB");
3820+ GL::vertexAttribPointer = (GL::GLVertexAttribPointerProc) getProcAddress ("glVertexAttribPointerARB");
3821
3822 GL::shaders = true;
3823 }
3824@@ -886,6 +919,7 @@
3825 if (GL::textureEnvCombine && GL::maxTextureUnits >= 2)
3826 {
3827 GL::canDoSaturated = true;
3828+
3829 if (GL::textureEnvCrossbar && GL::maxTextureUnits >= 4)
3830 GL::canDoSlightlySaturated = true;
3831 }
3832@@ -905,7 +939,6 @@
3833
3834 priv->lighting = false;
3835
3836-
3837 priv->filter[NOTHING_TRANS_FILTER] = GLTexture::Fast;
3838 priv->filter[SCREEN_TRANS_FILTER] = GLTexture::Good;
3839 priv->filter[WINDOW_TRANS_FILTER] = GLTexture::Good;
3840@@ -936,13 +969,13 @@
3841 DetectionWorkaround workaround;
3842 #endif
3843
3844- XVisualInfo *visinfo = NULL;
3845+ XVisualInfo *visinfo = NULL;
3846 #ifndef USE_GLES
3847- Display *dpy = s->dpy ();
3848- XVisualInfo templ;
3849- GLXFBConfig *fbConfigs;
3850- int defaultDepth, nvisinfo, nElements, value, i;
3851- const char *glxExtensions;
3852+ Display *dpy = s->dpy ();
3853+ XVisualInfo templ;
3854+ GLXFBConfig *fbConfigs;
3855+ int defaultDepth, nvisinfo, nElements, value;
3856+ const char *glxExtensions;
3857 XWindowAttributes attr;
3858 CompOption::Vector o (0);
3859
3860@@ -956,6 +989,7 @@
3861 templ.visualid = XVisualIDFromVisual (attr.visual);
3862
3863 visinfo = XGetVisualInfo (dpy, VisualIDMask, &templ, &nvisinfo);
3864+
3865 if (!nvisinfo)
3866 {
3867 compLogMessage ("opengl", CompLogLevelFatal,
3868@@ -968,6 +1002,7 @@
3869 defaultDepth = visinfo->depth;
3870
3871 glXGetConfig (dpy, visinfo, GLX_USE_GL, &value);
3872+
3873 if (!value)
3874 {
3875 compLogMessage ("opengl", CompLogLevelFatal,
3876@@ -979,6 +1014,7 @@
3877 }
3878
3879 glXGetConfig (dpy, visinfo, GLX_DOUBLEBUFFER, &value);
3880+
3881 if (!value)
3882 {
3883 compLogMessage ("opengl", CompLogLevelFatal,
3884@@ -994,8 +1030,8 @@
3885 if (glxExtensions == NULL)
3886 {
3887 compLogMessage ("opengl", CompLogLevelFatal,
3888- "glXQueryExtensionsString is NULL for screen %d",
3889- s->screenNum ());
3890+ "glXQueryExtensionsString is NULL for screen %d",
3891+ s->screenNum ());
3892 screen->handleCompizEvent ("opengl", "fatal_fallback", o);
3893 setFailed ();
3894 return;
3895@@ -1010,25 +1046,17 @@
3896 return;
3897 }
3898
3899- priv->getProcAddress = (GL::GLXGetProcAddressProc)
3900- getProcAddress ("glXGetProcAddressARB");
3901- GL::bindTexImage = (GL::GLXBindTexImageProc)
3902- getProcAddress ("glXBindTexImageEXT");
3903- GL::releaseTexImage = (GL::GLXReleaseTexImageProc)
3904- getProcAddress ("glXReleaseTexImageEXT");
3905- GL::queryDrawable = (GL::GLXQueryDrawableProc)
3906- getProcAddress ("glXQueryDrawable");
3907- GL::getFBConfigs = (GL::GLXGetFBConfigsProc)
3908- getProcAddress ("glXGetFBConfigs");
3909- GL::getFBConfigAttrib = (GL::GLXGetFBConfigAttribProc)
3910- getProcAddress ("glXGetFBConfigAttrib");
3911- GL::createPixmap = (GL::GLXCreatePixmapProc)
3912- getProcAddress ("glXCreatePixmap");
3913- GL::destroyPixmap = (GL::GLXDestroyPixmapProc)
3914- getProcAddress ("glXDestroyPixmap");
3915+ priv->getProcAddress = (GL::GLXGetProcAddressProc) getProcAddress ("glXGetProcAddressARB");
3916+ GL::bindTexImage = (GL::GLXBindTexImageProc) getProcAddress ("glXBindTexImageEXT");
3917+ GL::releaseTexImage = (GL::GLXReleaseTexImageProc) getProcAddress ("glXReleaseTexImageEXT");
3918+ GL::queryDrawable = (GL::GLXQueryDrawableProc) getProcAddress ("glXQueryDrawable");
3919+ GL::getFBConfigs = (GL::GLXGetFBConfigsProc) getProcAddress ("glXGetFBConfigs");
3920+ GL::getFBConfigAttrib = (GL::GLXGetFBConfigAttribProc) getProcAddress ("glXGetFBConfigAttrib");
3921+ GL::createPixmap = (GL::GLXCreatePixmapProc) getProcAddress ("glXCreatePixmap");
3922+ GL::destroyPixmap = (GL::GLXDestroyPixmapProc) getProcAddress ("glXDestroyPixmap");
3923
3924 if (!strstr (glxExtensions, "GLX_EXT_texture_from_pixmap") ||
3925- !GL::bindTexImage || !GL::releaseTexImage)
3926+ !GL::bindTexImage || !GL::releaseTexImage)
3927 {
3928 compLogMessage ("opengl", CompLogLevelFatal,
3929 "GLX_EXT_texture_from_pixmap is missing");
3930@@ -1051,52 +1079,46 @@
3931 }
3932
3933 if (strstr (glxExtensions, "GLX_MESA_copy_sub_buffer"))
3934- GL::copySubBuffer = (GL::GLXCopySubBufferProc)
3935- getProcAddress ("glXCopySubBufferMESA");
3936+ GL::copySubBuffer = (GL::GLXCopySubBufferProc) getProcAddress ("glXCopySubBufferMESA");
3937
3938 if (strstr (glxExtensions, "GLX_SGI_video_sync"))
3939 {
3940- GL::getVideoSync = (GL::GLXGetVideoSyncProc)
3941- getProcAddress ("glXGetVideoSyncSGI");
3942-
3943- GL::waitVideoSync = (GL::GLXWaitVideoSyncProc)
3944- getProcAddress ("glXWaitVideoSyncSGI");
3945+ GL::getVideoSync = (GL::GLXGetVideoSyncProc) getProcAddress ("glXGetVideoSyncSGI");
3946+ GL::waitVideoSync = (GL::GLXWaitVideoSyncProc) getProcAddress ("glXWaitVideoSyncSGI");
3947 }
3948
3949 if (strstr (glxExtensions, "GLX_SGI_swap_control"))
3950 {
3951- GL::swapInterval = (GL::GLXSwapIntervalProc)
3952- getProcAddress ("glXSwapIntervalSGI");
3953+ GL::swapInterval = (GL::GLXSwapIntervalProc) getProcAddress ("glXSwapIntervalSGI");
3954 }
3955
3956 fbConfigs = (*GL::getFBConfigs) (dpy, s->screenNum (), &nElements);
3957
3958 GL::stencilBuffer = false;
3959
3960- for (i = 0; i <= MAX_DEPTH; i++)
3961+ int alpha;
3962+ int db = MAXSHORT;
3963+ int stencil = MAXSHORT;
3964+ int depth = MAXSHORT;
3965+ int msaaBuffers = MAXSHORT;
3966+ int msaaSamples = MAXSHORT;
3967+ int mipmap = 0;
3968+ int rgba = 0;
3969+ int visualDepth;
3970+ XVisualInfo *vi;
3971+
3972+ for (int i = 0; i <= MAX_DEPTH; ++i)
3973 {
3974- int j, db, stencil, depth, alpha, mipmap, msaaBuffers, msaaSamples, rgba;
3975-
3976 priv->glxPixmapFBConfigs[i].fbConfig = NULL;
3977 priv->glxPixmapFBConfigs[i].mipmap = 0;
3978 priv->glxPixmapFBConfigs[i].yInverted = 0;
3979 priv->glxPixmapFBConfigs[i].textureFormat = 0;
3980 priv->glxPixmapFBConfigs[i].textureTargets = 0;
3981
3982- db = MAXSHORT;
3983- stencil = MAXSHORT;
3984- depth = MAXSHORT;
3985- msaaBuffers = MAXSHORT;
3986- msaaSamples = MAXSHORT;
3987- mipmap = 0;
3988- rgba = 0;
3989-
3990- for (j = 0; j < nElements; j++)
3991+ for (int j = 0; j < nElements; ++j)
3992 {
3993- XVisualInfo *vi;
3994- int visualDepth;
3995-
3996 vi = glXGetVisualFromFBConfig (dpy, fbConfigs[j]);
3997+
3998 if (vi == NULL)
3999 continue;
4000
4001@@ -1107,14 +1129,14 @@
4002 if (visualDepth != i)
4003 continue;
4004
4005- (*GL::getFBConfigAttrib) (dpy, fbConfigs[j],
4006- GLX_ALPHA_SIZE, &alpha);
4007- (*GL::getFBConfigAttrib) (dpy, fbConfigs[j],
4008- GLX_BUFFER_SIZE, &value);
4009+ (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], GLX_ALPHA_SIZE, &alpha);
4010+ (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], GLX_BUFFER_SIZE, &value);
4011+
4012 if (value != i && (value - alpha) != i)
4013 continue;
4014
4015 value = 0;
4016+
4017 if (i == 32)
4018 {
4019 (*GL::getFBConfigAttrib) (dpy, fbConfigs[j],
4020@@ -1167,14 +1189,14 @@
4021 (*GL::getFBConfigAttrib) (dpy, fbConfigs[j],
4022 GLX_SAMPLE_BUFFERS, &value);
4023 if (value > msaaBuffers)
4024- continue;
4025+ continue;
4026
4027 msaaBuffers = value;
4028
4029 (*GL::getFBConfigAttrib) (dpy, fbConfigs[j],
4030 GLX_SAMPLES, &value);
4031 if (value > msaaSamples)
4032- continue;
4033+ continue;
4034
4035 msaaSamples = value;
4036
4037@@ -1194,14 +1216,12 @@
4038 GLX_BIND_TO_TEXTURE_TARGETS_EXT, &value);
4039
4040 priv->glxPixmapFBConfigs[i].textureTargets = value;
4041-
4042- priv->glxPixmapFBConfigs[i].fbConfig = fbConfigs[j];
4043- priv->glxPixmapFBConfigs[i].mipmap = mipmap;
4044+ priv->glxPixmapFBConfigs[i].fbConfig = fbConfigs[j];
4045+ priv->glxPixmapFBConfigs[i].mipmap = mipmap;
4046 }
4047
4048- if (i == defaultDepth)
4049- if (stencil != MAXSHORT)
4050- GL::stencilBuffer = true;
4051+ if (i == defaultDepth && stencil != MAXSHORT)
4052+ GL::stencilBuffer = true;
4053 }
4054
4055 if (nElements)
4056@@ -1227,12 +1247,14 @@
4057 CompositeScreen::get (screen)->unregisterPaintHandler ();
4058
4059 #ifdef USE_GLES
4060- Display *xdpy = screen->dpy ();
4061- EGLDisplay dpy = eglGetDisplay (xdpy);
4062+ Display *xdpy = screen->dpy ();
4063+ EGLDisplay dpy = eglGetDisplay (xdpy);
4064
4065 eglMakeCurrent (dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
4066+
4067 if (priv->ctx != EGL_NO_CONTEXT)
4068 eglDestroyContext (dpy, priv->ctx);
4069+
4070 eglDestroySurface (dpy, priv->surface);
4071 eglTerminate (dpy);
4072 eglReleaseThread ();
4073@@ -1248,12 +1270,14 @@
4074 delete priv;
4075 }
4076
4077-PrivateGLScreen::PrivateGLScreen (GLScreen *gs) :
4078+PrivateGLScreen::PrivateGLScreen (GLScreen *gs) :
4079 gScreen (gs),
4080 cScreen (CompositeScreen::get (screen)),
4081 textureFilter (GL_LINEAR),
4082+ glxPixmapFBConfigs (),
4083 backgroundTextures (),
4084 backgroundLoaded (false),
4085+ filter (),
4086 rasterPos (0, 0),
4087 projection (NULL),
4088 clearBuffers (true),
4089@@ -1268,15 +1292,17 @@
4090 #endif
4091 scratchFbo (NULL),
4092 outputRegion (),
4093+ lastViewport (),
4094 refreshSubBuffer (false),
4095 lastMask (0),
4096 bindPixmap (),
4097 hasCompositing (false),
4098 commonFrontbuffer (true),
4099 incorrectRefreshRate (false),
4100+ saveWindow (),
4101 programCache (new GLProgramCache (30)),
4102 shaderCache (),
4103- autoProgram (new GLScreenAutoProgram(gs)),
4104+ autoProgram (new GLScreenAutoProgram (gs)),
4105 rootPixmapCopy (None),
4106 rootPixmapSize (),
4107 glVendor (NULL),
4108@@ -1293,15 +1319,13 @@
4109 delete projection;
4110 delete programCache;
4111 delete autoProgram;
4112+
4113 if (rootPixmapCopy)
4114 XFreePixmap (screen->dpy (), rootPixmapCopy);
4115-
4116 }
4117
4118 GLushort defaultColor[4] = { 0xffff, 0xffff, 0xffff, 0xffff };
4119
4120-
4121-
4122 GLenum
4123 GLScreen::textureFilter ()
4124 {
4125@@ -1321,11 +1345,14 @@
4126
4127 screen->handleEvent (event);
4128
4129- switch (event->type) {
4130+ switch (event->type)
4131+ {
4132 case ConfigureNotify:
4133 if (event->xconfigure.window == screen->root ())
4134 updateScreenBackground ();
4135+
4136 break;
4137+
4138 case PropertyNotify:
4139 if (event->xproperty.atom == Atoms::xBackground[0] ||
4140 event->xproperty.atom == Atoms::xBackground[1])
4141@@ -1338,15 +1365,18 @@
4142 event->xproperty.atom == Atoms::winSaturation)
4143 {
4144 w = screen->findWindow (event->xproperty.window);
4145+
4146 if (w)
4147 GLWindow::get (w)->updatePaintAttribs ();
4148 }
4149 else if (event->xproperty.atom == Atoms::wmIcon)
4150 {
4151 w = screen->findWindow (event->xproperty.window);
4152+
4153 if (w)
4154 GLWindow::get (w)->priv->icons.clear ();
4155 }
4156+
4157 break;
4158
4159 default:
4160@@ -1362,9 +1392,7 @@
4161 boundPixmapTex.find (de->damage);
4162 #endif
4163 if (it != boundPixmapTex.end ())
4164- {
4165 it->second->damaged = true;
4166- }
4167
4168 /* XXX: It would be nice if we could also update
4169 * the background of the root window when the root
4170@@ -1374,6 +1402,7 @@
4171 * be recopying the root window pixmap all the time
4172 * which is no good, so don't do that */
4173 }
4174+
4175 break;
4176 }
4177 }
4178@@ -1384,7 +1413,6 @@
4179 clearOutput (targetOutput, mask);
4180 }
4181
4182-
4183 static void
4184 frustum (GLfloat *m,
4185 GLfloat left,
4186@@ -1394,14 +1422,12 @@
4187 GLfloat nearval,
4188 GLfloat farval)
4189 {
4190- GLfloat x, y, a, b, c, d;
4191-
4192- x = (2.0 * nearval) / (right - left);
4193- y = (2.0 * nearval) / (top - bottom);
4194- a = (right + left) / (right - left);
4195- b = (top + bottom) / (top - bottom);
4196- c = -(farval + nearval) / ( farval - nearval);
4197- d = -(2.0 * farval * nearval) / (farval - nearval);
4198+ GLfloat x = (2.0 * nearval) / (right - left);
4199+ GLfloat y = (2.0 * nearval) / (top - bottom);
4200+ GLfloat a = (right + left) / (right - left);
4201+ GLfloat b = (top + bottom) / (top - bottom);
4202+ GLfloat c = -(farval + nearval) / (farval - nearval);
4203+ GLfloat d = -(2.0 * farval * nearval) / (farval - nearval);
4204
4205 #define M(row,col) m[col * 4 + row]
4206 M(0,0) = x; M(0,1) = 0.0f; M(0,2) = a; M(0,3) = 0.0f;
4207@@ -1419,12 +1445,10 @@
4208 GLfloat zNear,
4209 GLfloat zFar)
4210 {
4211- GLfloat xmin, xmax, ymin, ymax;
4212-
4213- ymax = zNear * tan (fovy * M_PI / 360.0);
4214- ymin = -ymax;
4215- xmin = ymin * aspect;
4216- xmax = ymax * aspect;
4217+ GLfloat ymax = zNear * tan (fovy * M_PI / 360.0);
4218+ GLfloat ymin = -ymax;
4219+ GLfloat xmin = ymin * aspect;
4220+ GLfloat xmax = ymax * aspect;
4221
4222 frustum (m, xmin, xmax, ymin, ymax, zNear, zFar);
4223 }
4224@@ -1450,6 +1474,7 @@
4225
4226 if (projection != NULL)
4227 delete projection;
4228+
4229 projection = new GLMatrix (projection_array);
4230
4231 #ifndef USE_GLES
4232@@ -1478,6 +1503,7 @@
4233
4234 if (scratchFbo)
4235 scratchFbo->allocate (*screen, NULL, GL_BGRA);
4236+
4237 updateView ();
4238 }
4239
4240@@ -1500,6 +1526,7 @@
4241 {
4242 dlerror ();
4243 funcPtr = (GL::FuncPtr) dlsym (dlhand, name);
4244+
4245 if (dlerror () != NULL)
4246 funcPtr = NULL;
4247 }
4248@@ -1512,18 +1539,18 @@
4249 void
4250 PrivateGLScreen::updateScreenBackground ()
4251 {
4252- Display *dpy = screen->dpy ();
4253- Atom pixmapAtom, actualType;
4254- int actualFormat, i, status;
4255+ Display *dpy = screen->dpy ();
4256+ Atom actualType;
4257+ int actualFormat, status;
4258 unsigned int width = 1, height = 1, depth = 0;
4259 unsigned long nItems;
4260 unsigned long bytesAfter;
4261 unsigned char *prop;
4262- Pixmap pixmap = None;
4263-
4264- pixmapAtom = XInternAtom (dpy, "PIXMAP", false);
4265-
4266- for (i = 0; pixmap == 0 && i < 2; i++)
4267+ Pixmap pixmap = None;
4268+
4269+ Atom pixmapAtom = XInternAtom (dpy, "PIXMAP", false);
4270+
4271+ for (int i = 0; pixmap == 0 && i < 2; ++i)
4272 {
4273 status = XGetWindowProperty (dpy, screen->root (),
4274 Atoms::xBackground[i],
4275@@ -1544,15 +1571,13 @@
4276 if (p)
4277 {
4278 unsigned int ui;
4279- int i;
4280- Window w;
4281+ int i;
4282+ Window w;
4283
4284 if (XGetGeometry (dpy, p, &w, &i, &i,
4285- &width, &height, &ui, &depth))
4286- {
4287- if ((int) depth == screen->attrib ().depth)
4288- pixmap = p;
4289- }
4290+ &width, &height, &ui, &depth) &&
4291+ (int) depth == screen->attrib ().depth)
4292+ pixmap = p;
4293 }
4294 }
4295
4296@@ -1564,17 +1589,14 @@
4297 {
4298 backgroundTextures =
4299 GLTexture::bindPixmapToTexture (pixmap, width, height, depth);
4300+
4301 if (backgroundTextures.empty ())
4302- {
4303 compLogMessage ("core", CompLogLevelWarn,
4304 "Couldn't bind background pixmap 0x%x to "
4305 "texture", (int) pixmap);
4306- }
4307 }
4308 else
4309- {
4310 backgroundTextures.clear ();
4311- }
4312
4313 if (backgroundTextures.empty ())
4314 {
4315@@ -1584,7 +1606,7 @@
4316 GC gc;
4317
4318 gcv.graphics_exposures = false;
4319- gcv.subwindow_mode = IncludeInferiors;
4320+ gcv.subwindow_mode = IncludeInferiors;
4321 gc = XCreateGC (screen->dpy (), screen->root (),
4322 GCGraphicsExposures | GCSubwindowMode, &gcv);
4323
4324@@ -1605,11 +1627,9 @@
4325 DefaultDepth (screen->dpy (), DefaultScreen (screen->dpy ())));
4326
4327 if (backgroundTextures.empty ())
4328- {
4329 compLogMessage ("core", CompLogLevelWarn,
4330 "Couldn't bind background pixmap 0x%x to "
4331 "texture", (int) screen->width ());
4332- }
4333 }
4334
4335 if (rootPixmapCopy)
4336@@ -1619,9 +1639,7 @@
4337 XSync (screen->dpy (), false);
4338 }
4339 else
4340- {
4341 backgroundTextures.clear ();
4342- }
4343
4344 XFreeGC(dpy, gc);
4345 }
4346@@ -1711,7 +1729,7 @@
4347 void
4348 GLScreenInterface::glBufferStencil(const GLMatrix &matrix,
4349 GLVertexBuffer &vertexBuffer,
4350- CompOutput *output)
4351+ CompOutput *output)
4352 WRAPABLE_DEF (glBufferStencil, matrix, vertexBuffer, output)
4353
4354 GLMatrix *
4355@@ -1747,7 +1765,8 @@
4356 }
4357
4358 void
4359-GLScreen::setFilter (int num, GLTexture::Filter filter)
4360+GLScreen::setFilter (int num,
4361+ GLTexture::Filter filter)
4362 {
4363 priv->filter[num] = filter;
4364 }
4365@@ -1766,9 +1785,9 @@
4366 {
4367 BoxPtr pBox = &output->region ()->extents;
4368
4369- if (pBox->x1 != 0 ||
4370- pBox->y1 != 0 ||
4371- pBox->x2 != (int) screen->width () ||
4372+ if (pBox->x1 != 0 ||
4373+ pBox->y1 != 0 ||
4374+ pBox->x2 != (int) screen->width () ||
4375 pBox->y2 != (int) screen->height ())
4376 {
4377 glEnable (GL_SCISSOR_TEST);
4378@@ -1780,9 +1799,7 @@
4379 glDisable (GL_SCISSOR_TEST);
4380 }
4381 else
4382- {
4383 glClear (mask);
4384- }
4385 }
4386
4387 void
4388@@ -1825,7 +1842,7 @@
4389 const compiz::opengl::impl::GLXSwapIntervalEXTFunc &swapIntervalFunc,
4390 const compiz::opengl::impl::GLXWaitVideoSyncSGIFunc &waitVideoSyncFunc) :
4391 compiz::opengl::DoubleBuffer (swapIntervalFunc, waitVideoSyncFunc),
4392- mDpy (d),
4393+ mDpy (d),
4394 mSize (s)
4395 {
4396 }
4397@@ -1914,6 +1931,7 @@
4398 glLoadIdentity ();
4399
4400 glDrawBuffer (GL_FRONT);
4401+
4402 foreach (const CompRect &r, blitRects)
4403 {
4404 int x = r.x1 ();
4405@@ -1921,6 +1939,7 @@
4406 glRasterPos2i (x, y);
4407 glCopyPixels (x, y, w, h, GL_COLOR);
4408 }
4409+
4410 glDrawBuffer (GL_BACK);
4411
4412 glPopMatrix ();
4413@@ -1929,7 +1948,6 @@
4414 glMatrixMode (GL_MODELVIEW);
4415
4416 glFlush ();
4417-
4418 }
4419
4420 #else
4421@@ -1960,7 +1978,7 @@
4422 EGLDoubleBuffer::blit (const CompRegion &region) const
4423 {
4424 CompRect::vector blitRects (region.rects ());
4425- int y = 0;
4426+ int y = 0;
4427
4428 foreach (const CompRect &r, blitRects)
4429 {
4430@@ -1997,35 +2015,45 @@
4431 unsigned int mask,
4432 const CompRegion &region)
4433 {
4434- if (clearBuffers)
4435- {
4436- if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
4437- glClear (GL_COLOR_BUFFER_BIT);
4438- }
4439+ if (clearBuffers &&
4440+ mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
4441+ glClear (GL_COLOR_BUFFER_BIT);
4442
4443 // Disable everything that we don't usually need and could slow us down
4444- glDisable (GL_BLEND);
4445- glDisable (GL_STENCIL_TEST);
4446- glDisable (GL_DEPTH_TEST);
4447+ GLboolean glBlendEnabled = glIsEnabled (GL_BLEND);
4448+ GLboolean glStencilEnabled = glIsEnabled (GL_STENCIL_TEST);
4449+ GLboolean glDepthEnabled = glIsEnabled (GL_DEPTH_TEST);
4450+
4451+ // just disable global states if they are enabled
4452+ if (glBlendEnabled)
4453+ glDisable (GL_BLEND);
4454+
4455+ if (glStencilEnabled)
4456+ glDisable (GL_STENCIL_TEST);
4457+
4458+ if (glDepthEnabled)
4459+ glDisable (GL_DEPTH_TEST);
4460+
4461 glDepthMask (GL_FALSE);
4462 glStencilMask (0);
4463
4464 GLFramebufferObject *oldFbo = NULL;
4465- bool useFbo = false;
4466+ bool useFbo = false;
4467
4468 /* Clear the color buffer where appropriate */
4469 if (GL::fboEnabled && scratchFbo)
4470 {
4471 oldFbo = scratchFbo->bind ();
4472 useFbo = scratchFbo->checkStatus () && scratchFbo->tex ();
4473+
4474 if (!useFbo)
4475 GLFramebufferObject::rebind (oldFbo);
4476 }
4477
4478 #ifdef UNSAFE_ARM_SGX_FIXME
4479- refreshSubBuffer = ((lastMask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) &&
4480- !(mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) &&
4481- (mask & COMPOSITE_SCREEN_DAMAGE_REGION_MASK));
4482+ refreshSubBuffer = ((lastMask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) &&
4483+ !(mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) &&
4484+ (mask & COMPOSITE_SCREEN_DAMAGE_REGION_MASK));
4485
4486 if (refreshSubBuffer)
4487 {
4488@@ -2035,16 +2063,18 @@
4489 // Posting a fullscreen damage region to the SGX seems to reset the
4490 // framebuffer, causing the screen to blackout.
4491 cScreen->damageRegion (CompRegion (screen->fullscreenOutput ()) -
4492- CompRegion (CompRect(0, 0, 1, 1)));
4493+ CompRegion (CompRect(0, 0, 1, 1)));
4494 }
4495 #endif
4496
4497 CompRegion tmpRegion = (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) ?
4498- screen->region () : region;
4499+ screen->region () : region;
4500+
4501+ XRectangle r;
4502+ GLMatrix identity;
4503
4504 foreach (CompOutput *output, outputs)
4505 {
4506- XRectangle r;
4507 targetOutput = output;
4508
4509 r.x = output->x1 ();
4510@@ -2063,8 +2093,6 @@
4511
4512 if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK)
4513 {
4514- GLMatrix identity;
4515-
4516 gScreen->glPaintOutput (defaultScreenPaintAttrib,
4517 identity,
4518 CompRegion (*output), output,
4519@@ -2073,8 +2101,6 @@
4520 }
4521 else if (mask & COMPOSITE_SCREEN_DAMAGE_REGION_MASK)
4522 {
4523- GLMatrix identity;
4524-
4525 #ifdef UNSAFE_ARM_SGX_FIXME
4526 /*
4527 * FIXME:
4528@@ -2134,10 +2160,10 @@
4529 }
4530
4531 bool alwaysSwap = optionGetAlwaysSwapBuffers ();
4532- bool fullscreen = useFbo ||
4533- alwaysSwap ||
4534- ((mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) &&
4535- commonFrontbuffer);
4536+ bool fullscreen = useFbo ||
4537+ alwaysSwap ||
4538+ ((mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) &&
4539+ commonFrontbuffer);
4540
4541 doubleBuffer.set (DoubleBuffer::VSYNC, optionGetSyncToVblank ());
4542 doubleBuffer.set (DoubleBuffer::HAVE_PERSISTENT_BACK_BUFFER, useFbo);
4543@@ -2184,6 +2210,7 @@
4544 {
4545 bool wasFboEnabled = GL::fboEnabled;
4546 updateRenderMode ();
4547+
4548 if (wasFboEnabled != GL::fboEnabled)
4549 CompositeScreen::get (screen)->damageScreen ();
4550 }
4551@@ -2198,8 +2225,9 @@
4552 if (prevRegex != regex)
4553 {
4554 prevBlacklisted = blacklisted (regex, glVendor, glRenderer, glVersion);
4555- prevRegex = regex;
4556+ prevRegex = regex;
4557 }
4558+
4559 return prevBlacklisted;
4560 }
4561
4562@@ -2207,9 +2235,11 @@
4563 GLScreen::registerBindPixmap (GLTexture::BindPixmapProc proc)
4564 {
4565 priv->bindPixmap.push_back (proc);
4566+
4567 if (!priv->hasCompositing &&
4568 CompositeScreen::get (screen)->registerPaintHandler (priv))
4569 priv->hasCompositing = true;
4570+
4571 return priv->bindPixmap.size () - 1;
4572 }
4573
4574@@ -2217,10 +2247,13 @@
4575 GLScreen::unregisterBindPixmap (GLTexture::BindPixmapHandle hnd)
4576 {
4577 bool hasBP = false;
4578+
4579 priv->bindPixmap[hnd].clear ();
4580- for (unsigned int i = 0; i < priv->bindPixmap.size (); i++)
4581+
4582+ for (unsigned int i = 0; i < priv->bindPixmap.size (); ++i)
4583 if (!priv->bindPixmap[i].empty ())
4584 hasBP = true;
4585+
4586 if (!hasBP && priv->hasCompositing)
4587 {
4588 CompositeScreen::get (screen)->unregisterPaintHandler ();
4589@@ -2240,10 +2273,9 @@
4590 CompIcon *i = screen->defaultIcon ();
4591 CompSize size;
4592
4593- if (!i)
4594- return NULL;
4595-
4596- if (!i->width () || !i->height ())
4597+ if (!i ||
4598+ !i->width () ||
4599+ !i->height ())
4600 return NULL;
4601
4602 if (priv->defaultIcon.icon == i)
4603@@ -2272,4 +2304,3 @@
4604 priv->rasterPos.setX (0);
4605 priv->rasterPos.setY (0);
4606 }
4607-
4608
4609=== modified file 'plugins/opengl/src/shadercache.cpp'
4610--- plugins/opengl/src/shadercache.cpp 2013-01-09 10:45:16 +0000
4611+++ plugins/opengl/src/shadercache.cpp 2013-07-24 16:05:45 +0000
4612@@ -33,9 +33,10 @@
4613 class GLShaderParametersComparer
4614 {
4615 public:
4616+
4617 bool operator()(const GLShaderParameters &left, const GLShaderParameters &right) const
4618 {
4619- return left.hash() < right.hash();
4620+ return left.hash() < right.hash();
4621 }
4622
4623 };
4624@@ -48,6 +49,7 @@
4625 class PrivateShaderCache
4626 {
4627 public:
4628+
4629 PrivateShaderCache() {}
4630
4631 ShaderMapType::const_iterator addShaderData(const GLShaderParameters &params);
4632@@ -65,12 +67,12 @@
4633 int
4634 GLShaderParameters::hash() const
4635 {
4636- return static_cast<int>(opacity) |
4637- (static_cast<int>(brightness) << 1) |
4638- (static_cast<int>(saturation) << 2) |
4639- (static_cast<int>(color) << 3) |
4640- (static_cast<int>(normal) << 5) |
4641- (static_cast<int>(numTextures) << 8);
4642+ return static_cast<int>(opacity) |
4643+ (static_cast<int>(brightness) << 1) |
4644+ (static_cast<int>(saturation) << 2) |
4645+ (static_cast<int>(color) << 3) |
4646+ (static_cast<int>(normal) << 5) |
4647+ (static_cast<int>(numTextures) << 8);
4648 }
4649
4650 std::string
4651@@ -78,14 +80,15 @@
4652 {
4653 std::stringstream ss;
4654
4655- ss << (opacity ? "t" : "f");
4656+ ss << (opacity ? "t" : "f");
4657 ss << (brightness ? "t" : "f");
4658 ss << (saturation ? "t" : "f");
4659- ss << (color == GLShaderVariableNone ? "n" :
4660- color == GLShaderVariableUniform ? "u" : "v");
4661-
4662- ss << (normal == GLShaderVariableNone ? "n" :
4663- normal == GLShaderVariableUniform ? "u" : "v");
4664+ ss << (color == GLShaderVariableNone ?
4665+ "n" : color == GLShaderVariableUniform ? "u" : "v");
4666+
4667+ ss << (normal == GLShaderVariableNone ?
4668+ "n" : normal == GLShaderVariableUniform ? "u" : "v");
4669+
4670 ss << numTextures;
4671
4672 return ss.str();
4673@@ -113,7 +116,7 @@
4674 // Try to find a cached shader pair that matches the parameters.
4675 // If we don't have it cached, create it.
4676 if ((iter = priv->shaderMap.find (params)) == priv->shaderMap.end ())
4677- iter = priv->addShaderData (params);
4678+ iter = priv->addShaderData (params);
4679
4680 return iter->second;
4681 }
4682@@ -127,12 +130,13 @@
4683 {
4684 GLShaderData shaderData;
4685
4686- shaderData.name = params.id ();
4687+ shaderData.name = params.id ();
4688 shaderData.fragmentShader = createFragmentShader (params);
4689- shaderData.vertexShader = createVertexShader (params);
4690+ shaderData.vertexShader = createVertexShader (params);
4691
4692 std::pair<ShaderMapType::iterator, bool> ret =
4693- shaderMap.insert(std::pair<GLShaderParameters, GLShaderData>(params,shaderData));
4694+ shaderMap.insert(std::pair<GLShaderParameters,
4695+ GLShaderData>(params,shaderData));
4696
4697 return ret.first;
4698 }
4699@@ -150,35 +154,35 @@
4700 std::stringstream ss;
4701
4702 ss << "#ifdef GL_ES\n" <<
4703- "precision mediump float;\n" <<
4704- "#endif\n";
4705+ "precision mediump float;\n" <<
4706+ "#endif\n";
4707
4708 ss << "uniform mat4 modelview;\n" <<
4709- "uniform mat4 projection;\n";
4710+ "uniform mat4 projection;\n";
4711
4712 ss << "attribute vec3 position;\n" <<
4713- "attribute vec3 normal;\n" <<
4714- "attribute vec4 color;\n" <<
4715- "attribute vec2 texCoord0;\n" <<
4716- "attribute vec2 texCoord1;\n" <<
4717- "attribute vec2 texCoord2;\n" <<
4718- "attribute vec2 texCoord3;\n";
4719+ "attribute vec3 normal;\n" <<
4720+ "attribute vec4 color;\n" <<
4721+ "attribute vec2 texCoord0;\n" <<
4722+ "attribute vec2 texCoord1;\n" <<
4723+ "attribute vec2 texCoord2;\n" <<
4724+ "attribute vec2 texCoord3;\n";
4725
4726 ss << "@VERTEX_FUNCTIONS@\n";
4727
4728 if (params.color == GLShaderVariableVarying)
4729- ss << "varying vec4 vColor;\n";
4730+ ss << "varying vec4 vColor;\n";
4731
4732- for (int i = 0; i < params.numTextures; i++)
4733- ss << "varying vec2 vTexCoord" << i << ";\n";
4734+ for (int i = 0; i < params.numTextures; ++i)
4735+ ss << "varying vec2 vTexCoord" << i << ";\n";
4736
4737 ss << "void main() {\n";
4738
4739- for (int i = 0; i < params.numTextures; i++)
4740- ss << "vTexCoord" << i << " = texCoord" << i <<";\n";
4741+ for (int i = 0; i < params.numTextures; ++i)
4742+ ss << "vTexCoord" << i << " = texCoord" << i <<";\n";
4743
4744 if (params.color == GLShaderVariableVarying)
4745- ss << "vColor = color;\n";
4746+ ss << "vColor = color;\n";
4747
4748 ss << "gl_Position = projection * modelview * vec4(position, 1.0);\n";
4749
4750@@ -199,50 +203,52 @@
4751 {
4752 std::stringstream ss;
4753 ss << "#ifdef GL_ES\n" <<
4754- "precision mediump float;\n" <<
4755- "#endif\n";
4756+ "precision mediump float;\n" <<
4757+ "#endif\n";
4758
4759 ss << "uniform vec3 paintAttrib;\n";
4760
4761- for (int i = 0; i < params.numTextures; i++) {
4762- ss << "uniform sampler2D texture" << i << ";\n";
4763- ss << "varying vec2 vTexCoord" << i << ";\n";
4764+ for (int i = 0; i < params.numTextures; ++i)
4765+ {
4766+ ss << "uniform sampler2D texture" << i << ";\n";
4767+ ss << "varying vec2 vTexCoord" << i << ";\n";
4768 }
4769
4770 if (params.color == GLShaderVariableUniform)
4771- ss << "uniform vec4 singleColor;\n";
4772+ ss << "uniform vec4 singleColor;\n";
4773 else if (params.color == GLShaderVariableVarying)
4774- ss << "varying vec4 vColor;\n";
4775+ ss << "varying vec4 vColor;\n";
4776
4777 ss << "@FRAGMENT_FUNCTIONS@\n";
4778
4779 ss << "void main() {\n vec4 color = ";
4780
4781 if (params.color == GLShaderVariableUniform)
4782- ss << "singleColor *";
4783+ ss << "singleColor *";
4784 else if (params.color == GLShaderVariableVarying)
4785- ss << "vColor *";
4786+ ss << "vColor *";
4787
4788- for (int i = 0; i < params.numTextures; i++)
4789- ss << " texture2D(texture" << i << ", vTexCoord" << i << ") *";
4790+ for (int i = 0; i < params.numTextures; ++i)
4791+ ss << " texture2D(texture" << i << ", vTexCoord" << i << ") *";
4792
4793 ss << " 1.0;\n";
4794
4795- if (params.saturation) {
4796+ if (params.saturation)
4797+ {
4798 ss << "vec3 desaturated = color.rgb * vec3 (0.30, 0.59, 0.11);\n" <<
4799 "desaturated = vec3 (dot (desaturated, color.rgb));\n" <<
4800 "color.rgb = color.rgb * vec3 (paintAttrib.z) + desaturated *\n" <<
4801 " vec3 (1.0 - paintAttrib.z);\n";
4802 }
4803
4804- if (params.brightness) {
4805+ if (params.brightness)
4806+ {
4807 ss << "color.rgb = color.rgb * paintAttrib.y" <<
4808 (params.opacity ? " * paintAttrib.x;\n" : ";\n") <<
4809 (params.opacity ? "color.a = color.a * paintAttrib.x;\n" : "");
4810 }
4811- else if (params.opacity) {
4812+ else if (params.opacity)
4813 ss << "color = color * paintAttrib.x;\n";
4814- }
4815
4816 ss << "gl_FragColor = color;\n";
4817 ss << "@FRAGMENT_FUNCTION_CALLS@\n}";
4818
4819=== modified file 'plugins/opengl/src/texture.cpp'
4820--- plugins/opengl/src/texture.cpp 2012-09-19 12:18:34 +0000
4821+++ plugins/opengl/src/texture.cpp 2013-07-24 16:05:45 +0000
4822@@ -48,7 +48,8 @@
4823 std::map<Damage, TfpTexture*> boundPixmapTex;
4824 #endif
4825
4826-static GLTexture::Matrix _identity_matrix = {
4827+static GLTexture::Matrix _identity_matrix =
4828+{
4829 1.0f, 0.0f,
4830 0.0f, 1.0f,
4831 0.0f, 0.0f
4832@@ -62,14 +63,14 @@
4833 GLTexture::List::List (unsigned int size) :
4834 std::vector<GLTexture *> (size)
4835 {
4836- for (unsigned int i = 0; i < size; i++)
4837+ for (unsigned int i = 0; i < size; ++i)
4838 at (i) = NULL;
4839 }
4840
4841 GLTexture::List::List (const GLTexture::List &c) :
4842 std::vector<GLTexture *> (c.size ())
4843 {
4844- for (unsigned int i = 0; i < c.size (); i++)
4845+ for (unsigned int i = 0; i < c.size (); ++i)
4846 {
4847 at (i) = c[i];
4848 GLTexture::incRef (c[i]);
4849@@ -88,11 +89,13 @@
4850 {
4851 this->clear ();
4852 resize (c.size ());
4853- for (unsigned int i = 0; i < c.size (); i++)
4854+
4855+ for (unsigned int i = 0; i < c.size (); ++i)
4856 {
4857 at (i) = c[i];
4858 GLTexture::incRef (c[i]);
4859 }
4860+
4861 return *this;
4862 }
4863
4864@@ -102,6 +105,7 @@
4865 foreach (GLTexture *t, *this)
4866 if (t)
4867 GLTexture::decRef (t);
4868+
4869 std::vector <GLTexture *>::clear ();
4870 }
4871
4872@@ -119,15 +123,15 @@
4873
4874 PrivateTexture::PrivateTexture (GLTexture *texture) :
4875 texture (texture),
4876- name (0),
4877- target (GL_TEXTURE_2D),
4878- filter (GL_NEAREST),
4879- wrap (GL_CLAMP_TO_EDGE),
4880- matrix (_identity_matrix),
4881- mipmap (true),
4882+ name (0),
4883+ target (GL_TEXTURE_2D),
4884+ filter (GL_NEAREST),
4885+ wrap (GL_CLAMP_TO_EDGE),
4886+ matrix (_identity_matrix),
4887+ mipmap (true),
4888 mipmapSupport (false),
4889- initial (true),
4890- refCount (1)
4891+ initial (true),
4892+ refCount (1)
4893 {
4894 glGenTextures (1, &name);
4895 }
4896@@ -135,9 +139,7 @@
4897 PrivateTexture::~PrivateTexture ()
4898 {
4899 if (name)
4900- {
4901 glDeleteTextures (1, &name);
4902- }
4903 }
4904
4905 GLuint
4906@@ -235,13 +237,11 @@
4907 }
4908 }
4909
4910- if (priv->filter == GL_LINEAR_MIPMAP_LINEAR)
4911+ if (priv->filter == GL_LINEAR_MIPMAP_LINEAR &&
4912+ priv->initial)
4913 {
4914- if (priv->initial)
4915- {
4916- GL::generateMipmap (priv->target);
4917- priv->initial = false;
4918- }
4919+ GL::generateMipmap (priv->target);
4920+ priv->initial = false;
4921 }
4922 }
4923
4924@@ -255,10 +255,12 @@
4925 }
4926
4927 void
4928-GLTexture::setData (GLenum target, Matrix &m, bool mipmap)
4929+GLTexture::setData (GLenum target,
4930+ Matrix &m,
4931+ bool mipmap)
4932 {
4933- priv->target = target;
4934- priv->matrix = m;
4935+ priv->target = target;
4936+ priv->matrix = m;
4937 priv->mipmapSupport = mipmap;
4938 }
4939
4940@@ -307,37 +309,36 @@
4941
4942 GLTexture::List rv (1);
4943 GLTexture *t = new GLTexture ();
4944- rv[0] = t;
4945+ rv[0] = t;
4946
4947 GLTexture::Matrix matrix = _identity_matrix;
4948- GLint internalFormat;
4949 GLenum target;
4950 bool mipmap;
4951 bool pot = POWER_OF_TWO (width) && POWER_OF_TWO (height);
4952
4953 #ifdef USE_GLES
4954- target = GL_TEXTURE_2D;
4955+ target = GL_TEXTURE_2D;
4956 matrix.xx = 1.0f / width;
4957 matrix.yy = 1.0f / height;
4958 matrix.y0 = 0.0f;
4959- mipmap = GL::textureNonPowerOfTwoMipmap || pot;
4960+ mipmap = GL::textureNonPowerOfTwoMipmap || pot;
4961 #else
4962
4963 if (GL::textureNonPowerOfTwo || pot)
4964 {
4965- target = GL_TEXTURE_2D;
4966+ target = GL_TEXTURE_2D;
4967 matrix.xx = 1.0f / width;
4968 matrix.yy = 1.0f / height;
4969 matrix.y0 = 0.0f;
4970- mipmap = GL::generateMipmap && (GL::textureNonPowerOfTwoMipmap || pot);
4971+ mipmap = GL::generateMipmap && (GL::textureNonPowerOfTwoMipmap || pot);
4972 }
4973 else
4974 {
4975- target = GL_TEXTURE_RECTANGLE_NV;
4976+ target = GL_TEXTURE_RECTANGLE_NV;
4977 matrix.xx = 1.0f;
4978 matrix.yy = 1.0f;
4979 matrix.y0 = 0.0f;
4980- mipmap = false;
4981+ mipmap = false;
4982 }
4983 #endif
4984
4985@@ -348,22 +349,21 @@
4986
4987 #ifdef USE_GLES
4988 // For GLES2 no format conversion is allowed, i.e., format must equal internalFormat
4989- internalFormat = format;
4990+ GLint internalFormat = format;
4991 #else
4992- internalFormat = GL_RGBA;
4993+ GLint internalFormat = GL_RGBA;
4994 #endif
4995
4996 #ifndef USE_GLES
4997- CompOption *opt;
4998- opt = GLScreen::get (screen)->getOption ("texture_compression");
4999+ CompOption *opt = GLScreen::get (screen)->getOption ("texture_compression");
5000+
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: