Merge lp:~jaytaoko/unity/unity-linaro-merge into lp:unity
- unity-linaro-merge
- Merge into trunk
Proposed by
Jay Taoko
Status: | Work in progress |
---|---|
Proposed branch: | lp:~jaytaoko/unity/unity-linaro-merge |
Merge into: | lp:unity |
Diff against target: |
961 lines (+269/-148) (has conflicts) 9 files modified
CMakeLists.txt (+4/-0) plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp (+18/-20) plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h (+1/-1) plugins/unitydialog/src/unitydialog.cpp (+54/-50) plugins/unitydialog/src/unitydialog.h (+12/-7) plugins/unityshell/src/IconRenderer.cpp (+24/-9) plugins/unityshell/src/unityshell.cpp (+143/-58) plugins/unityshell/src/unityshell.h (+12/-3) tests/CMakeLists.txt (+1/-0) Text conflict in plugins/unityshell/src/unityshell.cpp Text conflict in plugins/unityshell/src/unityshell.h |
To merge this branch: | bzr merge lp:~jaytaoko/unity/unity-linaro-merge |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity Team | Pending | ||
Review via email: mp+87926@code.launchpad.net |
Commit message
Description of the change
Test the difference with Unity trunk
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2011-12-14 17:17:34 +0000 |
3 | +++ CMakeLists.txt 2012-01-09 12:10:36 +0000 |
4 | @@ -136,6 +136,10 @@ |
5 | add_subdirectory(guides) |
6 | add_subdirectory(standalone-clients EXCLUDE_FROM_ALL) |
7 | |
8 | +if (USE_GLES) |
9 | + SET (MAINTAINER_CFLAGS ${MAINTAINER_CFLAGS} " -DNUX_OPENGLES_20 -DUSE_GLES") |
10 | +endif (USE_GLES) |
11 | + |
12 | # |
13 | # GSettings Schema |
14 | # |
15 | |
16 | === modified file 'plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp' |
17 | --- plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp 2011-12-23 07:19:07 +0000 |
18 | +++ plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp 2012-01-09 12:10:36 +0000 |
19 | @@ -438,13 +438,13 @@ |
20 | |
21 | bool |
22 | UnityMTGrabHandlesWindow::glDraw(const GLMatrix& transform, |
23 | - GLFragment::Attrib& fragment, |
24 | + const GLWindowPaintAttrib& attrib, |
25 | const CompRegion& region, |
26 | - unsigned int mask) |
27 | + unsigned int mask) |
28 | { |
29 | /* Draw the window on the bottom, we will be drawing the |
30 | * handles on top */ |
31 | - bool status = gWindow->glDraw(transform, fragment, region, mask); |
32 | + bool status = gWindow->glDraw(transform, attrib, region, mask); |
33 | |
34 | if (mHandles && mHandles->visible()) |
35 | { |
36 | @@ -467,7 +467,7 @@ |
37 | |
38 | /* We can reset the window geometry since it will be |
39 | * re-added later */ |
40 | - gWindow->geometry().reset(); |
41 | + gWindow->vertexBuffer()->begin(); |
42 | |
43 | /* Not sure what this does, but it is necessary |
44 | * (adjusts for scale?) */ |
45 | @@ -483,23 +483,21 @@ |
46 | * dim (so we get a nice render for things like |
47 | * wobbly etc etc */ |
48 | gWindow->glAddGeometry(matl, reg, paintRegion); |
49 | + gWindow->vertexBuffer()->end(); |
50 | |
51 | - /* Did it succeed? */ |
52 | - if (gWindow->geometry().vertices) |
53 | - { |
54 | - fragment.setOpacity(mHandles->opacity()); |
55 | - /* Texture rendering set-up */ |
56 | - us->gScreen->setTexEnvMode(GL_MODULATE); |
57 | - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
58 | - /* Draw the dim texture with all of it's modified |
59 | - * geometry glory */ |
60 | - gWindow->glDrawTexture(tex, fragment, mask | PAINT_WINDOW_BLEND_MASK |
61 | - | PAINT_WINDOW_TRANSLUCENT_MASK | |
62 | - PAINT_WINDOW_TRANSFORMED_MASK); |
63 | - /* Texture rendering tear-down */ |
64 | - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
65 | - us->gScreen->setTexEnvMode(GL_REPLACE); |
66 | - } |
67 | + wAttrib.opacity = mHandles->opacity(); |
68 | + /* Texture rendering set-up */ |
69 | +// us->gScreen->setTexEnvMode(GL_MODULATE); |
70 | + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
71 | + /* Draw the dim texture with all of it's modified |
72 | + * geometry glory */ |
73 | + gWindow->glDrawTexture(tex, transform, wAttrib, mask |
74 | + | PAINT_WINDOW_BLEND_MASK |
75 | + | PAINT_WINDOW_TRANSLUCENT_MASK |
76 | + | PAINT_WINDOW_TRANSFORMED_MASK); |
77 | + /* Texture rendering tear-down */ |
78 | + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
79 | + us->gScreen->setTexEnvMode(GL_REPLACE); |
80 | } |
81 | |
82 | handle++; |
83 | |
84 | === modified file 'plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h' |
85 | --- plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h 2011-12-22 12:55:41 +0000 |
86 | +++ plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h 2012-01-09 12:10:36 +0000 |
87 | @@ -229,7 +229,7 @@ |
88 | void moveNotify(int dx, int dy, bool immediate); |
89 | |
90 | bool glDraw(const GLMatrix&, |
91 | - GLFragment::Attrib&, |
92 | + const GLWindowPaintAttrib&, |
93 | const CompRegion&, |
94 | unsigned int); |
95 | |
96 | |
97 | === modified file 'plugins/unitydialog/src/unitydialog.cpp' |
98 | --- plugins/unitydialog/src/unitydialog.cpp 2011-08-29 04:19:10 +0000 |
99 | +++ plugins/unitydialog/src/unitydialog.cpp 2012-01-09 12:10:36 +0000 |
100 | @@ -419,9 +419,10 @@ |
101 | |
102 | /* Collect textures */ |
103 | void |
104 | -UnityDialogWindow::glDrawTexture(GLTexture* texture, |
105 | - GLFragment::Attrib& fa, |
106 | - unsigned int mask) |
107 | +UnityDialogWindow::glDrawTexture(GLTexture *texture, |
108 | + const GLMatrix &transform, |
109 | + const GLWindowPaintAttrib &attrib, |
110 | + unsigned int mask) |
111 | { |
112 | unity::PaintInfoCollector::Active ()->processTexture (texture); |
113 | } |
114 | @@ -448,7 +449,7 @@ |
115 | { |
116 | /* We can reset the window geometry since it will be |
117 | * re-added later */ |
118 | - GLWindow::get (w)->geometry().reset(); |
119 | + GLWindow::get (w)->vertexBuffer()->begin(); |
120 | |
121 | for (unsigned int i = 0; i < collectedMatrixLists.size (); i++) |
122 | { |
123 | @@ -462,6 +463,8 @@ |
124 | * wobbly etc etc */ |
125 | GLWindow::get (w)->glAddGeometry(matl, reg, paintRegion, min, max); |
126 | } |
127 | + |
128 | + GLWindow::get (w)->vertexBuffer()->end(); |
129 | } |
130 | |
131 | void |
132 | @@ -497,7 +500,9 @@ |
133 | } |
134 | |
135 | void |
136 | -unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w, unsigned int mask) |
137 | +unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w, |
138 | + const GLMatrix &transform, |
139 | + unsigned int mask) |
140 | { |
141 | if (mTexture && mGeometries.status ()) |
142 | { |
143 | @@ -509,25 +514,23 @@ |
144 | |
145 | mGeometries.addGeometryForWindow (w, paintRegion); |
146 | |
147 | - if (gWindow->geometry().vertices) |
148 | - { |
149 | - UnityDialogScreen *uds = UnityDialogScreen::get (screen); |
150 | - GLFragment::Attrib fa (gWindow->lastPaintAttrib()); |
151 | - unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex(); |
152 | - /* Texture rendering set-up */ |
153 | - uds->gScreen->setTexEnvMode(GL_MODULATE); |
154 | - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
155 | - /* Draw the dim texture with all of it's modified |
156 | - * geometry glory */ |
157 | - gWindow->glDrawTextureSetCurrentIndex(MAXSHORT); |
158 | - gWindow->glDrawTexture(mTexture, fa, mask | PAINT_WINDOW_BLEND_MASK |
159 | - | PAINT_WINDOW_TRANSLUCENT_MASK | |
160 | - PAINT_WINDOW_TRANSFORMED_MASK); |
161 | - gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex); |
162 | - /* Texture rendering tear-down */ |
163 | - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
164 | - uds->gScreen->setTexEnvMode(GL_REPLACE); |
165 | - } |
166 | + UnityDialogScreen *uds = UnityDialogScreen::get (screen); |
167 | + GLWindowPaintAttrib attrib (gWindow->lastPaintAttrib()); |
168 | + unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex(); |
169 | + /* Texture rendering set-up */ |
170 | +// uds->gScreen->setTexEnvMode(GL_MODULATE); |
171 | + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
172 | + /* Draw the dim texture with all of it's modified |
173 | + * geometry glory */ |
174 | + gWindow->glDrawTextureSetCurrentIndex(MAXSHORT); |
175 | + gWindow->glDrawTexture(mTexture, transform, attrib, mask |
176 | + | PAINT_WINDOW_BLEND_MASK |
177 | + | PAINT_WINDOW_TRANSLUCENT_MASK |
178 | + | PAINT_WINDOW_TRANSFORMED_MASK); |
179 | + gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex); |
180 | + /* Texture rendering tear-down */ |
181 | + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
182 | + uds->gScreen->setTexEnvMode(GL_REPLACE); |
183 | } |
184 | } |
185 | |
186 | @@ -581,10 +584,12 @@ |
187 | } |
188 | |
189 | void |
190 | -unity::PaintInfoCollector::drawGeometriesForWindow(CompWindow *w, unsigned int pm) |
191 | +unity::PaintInfoCollector::drawGeometriesForWindow(CompWindow *w, |
192 | + const GLMatrix &transform, |
193 | + unsigned int pm) |
194 | { |
195 | for (unity::TexGeometryCollection &tcg : mCollection) |
196 | - tcg.addGeometriesAndDrawTextureForWindow (w, pm); |
197 | + tcg.addGeometriesAndDrawTextureForWindow (w, transform, pm); |
198 | } |
199 | |
200 | unity::PaintInfoCollector * unity::PaintInfoCollector::active_collector = NULL; |
201 | @@ -599,18 +604,18 @@ |
202 | |
203 | bool |
204 | UnityDialogWindow::glDraw(const GLMatrix& transform, |
205 | - GLFragment::Attrib& fragment, |
206 | + const GLWindowPaintAttrib& attrib, |
207 | const CompRegion& region, |
208 | unsigned int mask) |
209 | { |
210 | /* We want to set the geometry of the dim to the window |
211 | * region */ |
212 | CompRegion reg = CompRegion(window->x(), window->y(), window->width(), window->height()); |
213 | - CompRegion paintRegion(region); |
214 | + CompRegion paintRegion(region); |
215 | |
216 | /* Draw the window on the bottom, we will be drawing the |
217 | * dim render on top */ |
218 | - bool status = gWindow->glDraw(transform, fragment, region, mask); |
219 | + bool status = gWindow->glDraw(transform, attrib, region, mask); |
220 | |
221 | UNITY_DIALOG_SCREEN(screen); |
222 | |
223 | @@ -618,10 +623,11 @@ |
224 | { |
225 | GLTexture::MatrixList matl; |
226 | GLTexture::Matrix mat = tex->matrix(); |
227 | + GLWindowPaintAttrib wAttrib(attrib); |
228 | |
229 | /* We can reset the window geometry since it will be |
230 | * re-added later */ |
231 | - gWindow->geometry().reset(); |
232 | + gWindow->vertexBuffer()->begin(); |
233 | |
234 | /* Scale the dim render by the ratio of dim size |
235 | * to window size */ |
236 | @@ -642,26 +648,24 @@ |
237 | * dim (so we get a nice render for things like |
238 | * wobbly etc etc */ |
239 | gWindow->glAddGeometry(matl, reg, paintRegion); |
240 | + gWindow->vertexBuffer()->end(); |
241 | |
242 | - /* Did it succeed? */ |
243 | - if (gWindow->geometry().vertices) |
244 | - { |
245 | - unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex(); |
246 | - fragment.setOpacity(mShadeProgress); |
247 | - /* Texture rendering set-up */ |
248 | - uds->gScreen->setTexEnvMode(GL_MODULATE); |
249 | - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
250 | - /* Draw the dim texture with all of it's modified |
251 | - * geometry glory */ |
252 | - gWindow->glDrawTextureSetCurrentIndex(MAXSHORT); |
253 | - gWindow->glDrawTexture(tex, fragment, mask | PAINT_WINDOW_BLEND_MASK |
254 | - | PAINT_WINDOW_TRANSLUCENT_MASK | |
255 | - PAINT_WINDOW_TRANSFORMED_MASK); |
256 | - gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex); |
257 | - /* Texture rendering tear-down */ |
258 | - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
259 | - uds->gScreen->setTexEnvMode(GL_REPLACE); |
260 | - } |
261 | + unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex(); |
262 | + wAttrib.opacity = mShadeProgress; |
263 | + /* Texture rendering set-up */ |
264 | +// uds->gScreen->setTexEnvMode(GL_MODULATE); |
265 | + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
266 | + /* Draw the dim texture with all of it's modified |
267 | + * geometry glory */ |
268 | + gWindow->glDrawTextureSetCurrentIndex(MAXSHORT); |
269 | + gWindow->glDrawTexture(tex, transform, attrib, mask |
270 | + | PAINT_WINDOW_BLEND_MASK |
271 | + | PAINT_WINDOW_TRANSLUCENT_MASK |
272 | + | PAINT_WINDOW_TRANSFORMED_MASK); |
273 | + gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex); |
274 | + /* Texture rendering tear-down */ |
275 | + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
276 | + uds->gScreen->setTexEnvMode(GL_REPLACE); |
277 | } |
278 | |
279 | for (CompWindow* w : mTransients) |
280 | @@ -674,7 +678,7 @@ |
281 | unity::PaintInfoCollector pc (w); |
282 | |
283 | pc.collect(); |
284 | - pc.drawGeometriesForWindow (window, mask); |
285 | + pc.drawGeometriesForWindow (window, transform, mask); |
286 | } |
287 | } |
288 | |
289 | |
290 | === modified file 'plugins/unitydialog/src/unitydialog.h' |
291 | --- plugins/unitydialog/src/unitydialog.h 2011-08-29 04:19:10 +0000 |
292 | +++ plugins/unitydialog/src/unitydialog.h 2012-01-09 12:10:36 +0000 |
293 | @@ -64,7 +64,9 @@ |
294 | int max); |
295 | void setTexture (GLTexture *); |
296 | |
297 | - void addGeometriesAndDrawTextureForWindow (CompWindow *, unsigned int pm); |
298 | + void addGeometriesAndDrawTextureForWindow (CompWindow *w, |
299 | + const GLMatrix &transform, |
300 | + unsigned int mask); |
301 | |
302 | private: |
303 | GLTexture* mTexture; |
304 | @@ -78,7 +80,9 @@ |
305 | PaintInfoCollector (CompWindow *w); |
306 | |
307 | void collect (); |
308 | - void drawGeometriesForWindow (CompWindow *w, unsigned int pm); |
309 | + void drawGeometriesForWindow (CompWindow *w, |
310 | + const GLMatrix &transform, |
311 | + unsigned int pm); |
312 | |
313 | void processGeometry (const GLTexture::MatrixList &ml, |
314 | const CompRegion &r, |
315 | @@ -242,7 +246,7 @@ |
316 | public: |
317 | |
318 | bool |
319 | - glDraw(const GLMatrix&, GLFragment::Attrib&, |
320 | + glDraw(const GLMatrix&, const GLWindowPaintAttrib&, |
321 | const CompRegion&, unsigned int); |
322 | |
323 | bool |
324 | @@ -258,7 +262,8 @@ |
325 | |
326 | void |
327 | glDrawTexture(GLTexture* texture, |
328 | - GLFragment::Attrib& attrib, |
329 | + const GLMatrix& transform, |
330 | + const GLWindowPaintAttrib& attrib, |
331 | unsigned int mask); |
332 | |
333 | |
334 | @@ -303,17 +308,17 @@ |
335 | void moveTransientsToRect(CompWindow* skip, CompRect rect, bool); |
336 | void moveParentToRect(CompWindow* requestor, CompRect rect, bool); |
337 | |
338 | - void moveToRect(CompRect currentRect, bool sync); |
339 | + void moveToRect(CompRect currentRect, bool sync); |
340 | |
341 | void grabTransients(CompWindow* skip, int x, int y, |
342 | unsigned int state, unsigned int mask, bool); |
343 | void grabParent(CompWindow* requestor, int x, int y, |
344 | unsigned int state, unsigned int mask, bool); |
345 | |
346 | - void animateTransients(CompWindow* skip, CompPoint& orig, CompPoint& dest, bool cont); |
347 | + void animateTransients(CompWindow* skip, CompPoint& orig, CompPoint& dest, bool cont); |
348 | void animateParent(CompWindow* requestor, CompPoint& orig, CompPoint& dest); |
349 | |
350 | - void setMaxConstrainingAreas(); |
351 | + void setMaxConstrainingAreas(); |
352 | |
353 | CompWindow* transientParent(); |
354 | |
355 | |
356 | === modified file 'plugins/unityshell/src/IconRenderer.cpp' |
357 | --- plugins/unityshell/src/IconRenderer.cpp 2012-01-04 01:43:15 +0000 |
358 | +++ plugins/unityshell/src/IconRenderer.cpp 2012-01-09 12:10:36 +0000 |
359 | @@ -38,6 +38,17 @@ |
360 | { |
361 | namespace ui |
362 | { |
363 | +#ifndef NUX_OPENGLES_20 |
364 | + #define VertexShaderHeader "#version 110 \n" |
365 | +#else |
366 | + #define VertexShaderHeader "#version 100 \n" |
367 | +#endif |
368 | + |
369 | +#ifndef NUX_OPENGLES_20 |
370 | + #define FragmentShaderHeader "#version 110 \n" |
371 | +#else |
372 | + #define FragmentShaderHeader "#version 100\n precision mediump float;\n" |
373 | +#endif |
374 | |
375 | /* |
376 | Use this shader to pass vertices in screen coordinates in the C++ code and compute use |
377 | @@ -60,9 +71,9 @@ |
378 | #define LUMIN_BLUE "0.055" |
379 | |
380 | nux::NString gPerspectiveCorrectShader = TEXT( |
381 | -"[Vertex Shader] \n\ |
382 | -#version 120 \n\ |
383 | -uniform mat4 ViewProjectionMatrix; \n\ |
384 | +"[Vertex Shader] \n" |
385 | +VertexShaderHeader |
386 | +"uniform mat4 ViewProjectionMatrix; \n\ |
387 | \n\ |
388 | attribute vec4 iTexCoord0; \n\ |
389 | attribute vec4 iVertex; \n\ |
390 | @@ -75,9 +86,9 @@ |
391 | gl_Position = ViewProjectionMatrix * iVertex; \n\ |
392 | } \n\ |
393 | \n\ |
394 | -[Fragment Shader] \n\ |
395 | -#version 110 \n\ |
396 | - \n\ |
397 | +[Fragment Shader] \n" |
398 | +FragmentShaderHeader |
399 | +" \n\ |
400 | varying vec4 varyTexCoord0; \n\ |
401 | \n\ |
402 | uniform sampler2D TextureObject0; \n\ |
403 | @@ -649,8 +660,8 @@ |
404 | // Perspective correct |
405 | v0.x, v0.y, 0.0f, 1.0f, s0 / v0.w, t0 / v0.w, 0.0f, 1.0f / v0.w, |
406 | v1.x, v1.y, 0.0f, 1.0f, s1 / v1.w, t1 / v1.w, 0.0f, 1.0f / v1.w, |
407 | + v3.x, v3.y, 0.0f, 1.0f, s3 / v3.w, t3 / v3.w, 0.0f, 1.0f / v3.w, |
408 | v2.x, v2.y, 0.0f, 1.0f, s2 / v2.w, t2 / v2.w, 0.0f, 1.0f / v2.w, |
409 | - v3.x, v3.y, 0.0f, 1.0f, s3 / v3.w, t3 / v3.w, 0.0f, 1.0f / v3.w, |
410 | }; |
411 | |
412 | CHECKGL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0)); |
413 | @@ -683,6 +694,7 @@ |
414 | } |
415 | else |
416 | { |
417 | +#ifndef USE_GLES |
418 | local::asm_shader->Begin(); |
419 | |
420 | VertexLocation = nux::VTXATTRIB_POSITION; |
421 | @@ -697,6 +709,7 @@ |
422 | // Set the projection matrix |
423 | CHECKGL(glMatrixMode(GL_PROJECTION)); |
424 | CHECKGL(glLoadMatrixf((float*) GfxContext.GetOpenGLProjectionMatrix().m)); |
425 | +#endif |
426 | } |
427 | |
428 | CHECKGL(glEnableVertexAttribArrayARB(VertexLocation)); |
429 | @@ -716,15 +729,17 @@ |
430 | CHECKGL(glUniform4fARB(DesatFactor, arg.saturation, arg.saturation, arg.saturation, arg.saturation)); |
431 | |
432 | nux::GetWindowThread()->GetGraphicsEngine().SetTexture(GL_TEXTURE0, icon); |
433 | - CHECKGL(glDrawArrays(GL_QUADS, 0, 4)); |
434 | + CHECKGL(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4)); |
435 | } |
436 | else |
437 | { |
438 | +#ifndef USE_GLES |
439 | CHECKGL(glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, bg_color.red, bg_color.green, bg_color.blue, bg_color.alpha)); |
440 | CHECKGL(glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, arg.saturation, arg.saturation, arg.saturation, arg.saturation)); |
441 | |
442 | nux::GetWindowThread()->GetGraphicsEngine().SetTexture(GL_TEXTURE0, icon); |
443 | - CHECKGL(glDrawArrays(GL_QUADS, 0, 4)); |
444 | + CHECKGL(glDrawArrays(GL_TRIANGLE_STRIP, 0, 4)); |
445 | +#endif |
446 | } |
447 | |
448 | if (VertexLocation != -1) |
449 | |
450 | === modified file 'plugins/unityshell/src/unityshell.cpp' |
451 | --- plugins/unityshell/src/unityshell.cpp 2012-01-06 04:53:09 +0000 |
452 | +++ plugins/unityshell/src/unityshell.cpp 2012-01-09 12:10:36 +0000 |
453 | @@ -113,20 +113,25 @@ |
454 | , damaged(false) |
455 | , _key_nav_mode_requested(false) |
456 | , _last_output(nullptr) |
457 | +<<<<<<< TREE |
458 | , _active_fbo (0) |
459 | +======= |
460 | +>>>>>>> MERGE-SOURCE |
461 | , dash_is_open_ (false) |
462 | , grab_index_ (0) |
463 | , painting_tray_ (false) |
464 | { |
465 | Timer timer; |
466 | - gfloat version; |
467 | - gchar* extensions; |
468 | bool failed = false; |
469 | configure_logging(); |
470 | LOG_DEBUG(logger) << __PRETTY_FUNCTION__; |
471 | int (*old_handler)(Display*, XErrorEvent*); |
472 | old_handler = XSetErrorHandler(NULL); |
473 | |
474 | +#ifndef USE_GLES |
475 | + gfloat version; |
476 | + gchar* extensions; |
477 | + |
478 | /* Ensure OpenGL version is 1.4+. */ |
479 | version = get_opengl_version_f32((const gchar*) glGetString(GL_VERSION)); |
480 | if (version < 1.4f) |
481 | @@ -182,6 +187,7 @@ |
482 | failed = true; |
483 | } |
484 | } |
485 | +#endif |
486 | |
487 | if (!failed) |
488 | { |
489 | @@ -199,16 +205,25 @@ |
490 | CompositeScreenInterface::setHandler(cScreen); |
491 | GLScreenInterface::setHandler(gScreen); |
492 | |
493 | + gScreen->glPaintCompositedOutputSetEnabled (this, true); |
494 | + |
495 | PluginAdapter::Initialize(screen); |
496 | WindowManager::SetDefault(PluginAdapter::Default()); |
497 | |
498 | StartupNotifyService::Default()->SetSnDisplay(screen->snDisplay(), screen->screenNum()); |
499 | |
500 | nux::NuxInitialize(0); |
501 | + #ifdef USE_GLES |
502 | + wt = nux::CreateFromForeignWindow(cScreen->output(), |
503 | + eglGetCurrentContext(), |
504 | + &UnityScreen::initUnity, |
505 | + this); |
506 | + #else |
507 | wt = nux::CreateFromForeignWindow(cScreen->output(), |
508 | glXGetCurrentContext(), |
509 | &UnityScreen::initUnity, |
510 | this); |
511 | + #endif |
512 | |
513 | wt->RedrawRequested.connect(sigc::mem_fun(this, &UnityScreen::onRedrawRequested)); |
514 | |
515 | @@ -226,6 +241,7 @@ |
516 | _edge_timeout = optionGetLauncherRevealEdgeTimeout (); |
517 | _in_paint = false; |
518 | |
519 | +<<<<<<< TREE |
520 | void *dlhand = dlopen ("libunityshell.so", RTLD_LAZY); |
521 | |
522 | if (dlhand) |
523 | @@ -243,6 +259,8 @@ |
524 | uScreen->_fbo->onScreenSizeChanged (geometry); |
525 | } |
526 | |
527 | +======= |
528 | +>>>>>>> MERGE-SOURCE |
529 | optionSetBackgroundColorNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
530 | optionSetLauncherHideModeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
531 | optionSetBacklightModeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
532 | @@ -312,8 +330,8 @@ |
533 | g_idle_add_full (G_PRIORITY_DEFAULT, &UnityScreen::initPluginActions, this, NULL); |
534 | super_keypressed_ = false; |
535 | |
536 | - GeisAdapter::Default()->Run(); |
537 | - gestureEngine = new GestureEngine(screen); |
538 | +// GeisAdapter::Default()->Run(); |
539 | +// gestureEngine = new GestureEngine(screen); |
540 | |
541 | CompString name(PKGDATADIR"/panel-shadow.png"); |
542 | CompString pname("unityshell"); |
543 | @@ -437,6 +455,7 @@ |
544 | |
545 | void UnityScreen::nuxPrologue() |
546 | { |
547 | + #ifndef USE_GLES |
548 | /* Vertex lighting isn't used in Unity, we disable that state as it could have |
549 | * been leaked by another plugin. That should theoretically be switched off |
550 | * right after PushAttrib since ENABLE_BIT is meant to restore the LIGHTING |
551 | @@ -453,34 +472,40 @@ |
552 | |
553 | glMatrixMode(GL_MODELVIEW); |
554 | glPushMatrix(); |
555 | + #endif |
556 | |
557 | glGetError(); |
558 | } |
559 | |
560 | void UnityScreen::nuxEpilogue() |
561 | { |
562 | +<<<<<<< TREE |
563 | (*GL::bindFramebuffer)(GL_FRAMEBUFFER_EXT, _active_fbo); |
564 | +======= |
565 | +// (*GL::bindFramebuffer)(GL_FRAMEBUFFER_EXT, 0); |
566 | +>>>>>>> MERGE-SOURCE |
567 | |
568 | + #ifdef USE_GLES |
569 | + glDepthRangef(0, 1); |
570 | + #else |
571 | glMatrixMode(GL_PROJECTION); |
572 | glLoadIdentity(); |
573 | glMatrixMode(GL_MODELVIEW); |
574 | glLoadIdentity(); |
575 | glDepthRange(0, 1); |
576 | - glViewport(-1, -1, 2, 2); |
577 | glRasterPos2f(0, 0); |
578 | |
579 | + glMatrixMode(GL_PROJECTION); |
580 | + glPopMatrix(); |
581 | + glMatrixMode(GL_MODELVIEW); |
582 | + glPopMatrix(); |
583 | + |
584 | + glPopAttrib(); |
585 | + #endif |
586 | + |
587 | + //glViewport(-1, -1, 2, 2); |
588 | gScreen->resetRasterPos(); |
589 | |
590 | - glMatrixMode(GL_PROJECTION); |
591 | - glPopMatrix(); |
592 | - glMatrixMode(GL_MODELVIEW); |
593 | - glPopMatrix(); |
594 | - |
595 | - glDrawBuffer(GL_BACK); |
596 | - glReadBuffer(GL_BACK); |
597 | - |
598 | - glPopAttrib(); |
599 | - |
600 | glDisable(GL_SCISSOR_TEST); |
601 | } |
602 | |
603 | @@ -494,6 +519,8 @@ |
604 | |
605 | void UnityScreen::paintPanelShadow(const GLMatrix& matrix) |
606 | { |
607 | + return; |
608 | + |
609 | if (relayoutSourceId > 0) |
610 | return; |
611 | |
612 | @@ -523,33 +550,50 @@ |
613 | { |
614 | foreach(GLTexture * tex, _shadow_texture) |
615 | { |
616 | - glEnable(GL_BLEND); |
617 | - glColor4f(1.0f, 1.0f, 1.0f, panel_controller_->opacity()); |
618 | - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
619 | - |
620 | - GL::activeTexture(GL_TEXTURE0_ARB); |
621 | + std::vector<GLfloat> vertexData; |
622 | + std::vector<GLfloat> textureData; |
623 | + std::vector<GLushort> colorData; |
624 | + GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer(); |
625 | + bool wasBlend = glIsEnabled(GL_BLEND); |
626 | + |
627 | + if (!wasBlend) |
628 | + glEnable(GL_BLEND); |
629 | + |
630 | + GL::activeTexture(GL_TEXTURE0); |
631 | tex->enable(GLTexture::Fast); |
632 | |
633 | glTexParameteri(tex->target(), GL_TEXTURE_WRAP_S, GL_REPEAT); |
634 | |
635 | - glBegin(GL_QUADS); |
636 | - { |
637 | - glTexCoord2f(COMP_TEX_COORD_X(tex->matrix(), 0), COMP_TEX_COORD_Y(tex->matrix(), 0)); |
638 | - glVertex2f(vc[0], vc[2]); |
639 | - |
640 | - glTexCoord2f(COMP_TEX_COORD_X(tex->matrix(), 0), COMP_TEX_COORD_Y(tex->matrix(), h)); |
641 | - glVertex2f(vc[0], vc[3]); |
642 | - |
643 | - glTexCoord2f(COMP_TEX_COORD_X(tex->matrix(), w), COMP_TEX_COORD_Y(tex->matrix(), h)); |
644 | - glVertex2f(vc[1], vc[3]); |
645 | - |
646 | - glTexCoord2f(COMP_TEX_COORD_X(tex->matrix(), w), COMP_TEX_COORD_Y(tex->matrix(), 0)); |
647 | - glVertex2f(vc[1], vc[2]); |
648 | - } |
649 | - glEnd(); |
650 | + colorData = { 0xFFFF, 0xFFFF, 0xFFFF, |
651 | + (GLushort)(panel_controller_->opacity() * 0xFFFF) |
652 | + }; |
653 | + |
654 | + vertexData = { |
655 | + vc[0], vc[2], 0, |
656 | + vc[0], vc[3], 0, |
657 | + vc[1], vc[2], 0, |
658 | + vc[1], vc[3], 0, |
659 | + }; |
660 | + |
661 | + textureData = { |
662 | + COMP_TEX_COORD_X(tex->matrix(), 0), COMP_TEX_COORD_Y(tex->matrix(), 0), |
663 | + COMP_TEX_COORD_X(tex->matrix(), 0), COMP_TEX_COORD_Y(tex->matrix(), h), |
664 | + COMP_TEX_COORD_X(tex->matrix(), w), COMP_TEX_COORD_Y(tex->matrix(), 0), |
665 | + COMP_TEX_COORD_X(tex->matrix(), w), COMP_TEX_COORD_Y(tex->matrix(), h), |
666 | + }; |
667 | + |
668 | + streamingBuffer->begin(GL_TRIANGLE_STRIP); |
669 | + |
670 | + streamingBuffer->addColors(1, &colorData[0]); |
671 | + streamingBuffer->addVertices(4, &vertexData[0]); |
672 | + streamingBuffer->addTexCoords(0, 4, &textureData[0]); |
673 | + |
674 | + streamingBuffer->end(); |
675 | + streamingBuffer->render(matrix); |
676 | |
677 | tex->disable(); |
678 | - glDisable(GL_BLEND); |
679 | + if (!wasBlend) |
680 | + glDisable(GL_BLEND); |
681 | } |
682 | } |
683 | } |
684 | @@ -566,10 +610,12 @@ |
685 | wy = y + (last_bound.height - height) / 2; |
686 | } |
687 | |
688 | -void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transform, unsigned int mask) |
689 | +void UnityScreen::paintDisplay() |
690 | { |
691 | + GLint fboID; |
692 | CompOutput *output = _last_output; |
693 | Window tray_xid = panel_controller_->GetTrayXid (); |
694 | +<<<<<<< TREE |
695 | |
696 | bool was_bound = _fbo->bound (); |
697 | _fbo->unbind (); |
698 | @@ -585,18 +631,40 @@ |
699 | _fbo->paint (nux::Geometry (output->x (), output->y (), output->width (), output->height ())); |
700 | glPopMatrix (); |
701 | } |
702 | +======= |
703 | +>>>>>>> MERGE-SOURCE |
704 | |
705 | +<<<<<<< TREE |
706 | nux::ObjectPtr<nux::IOpenGLTexture2D> device_texture = |
707 | nux::GetGraphicsDisplay()->GetGpuDevice()->CreateTexture2DFromID(_fbo->texture(), |
708 | screen->width (), screen->height(), 1, nux::BITFMT_R8G8B8A8); |
709 | |
710 | +======= |
711 | + nuxPrologue(); |
712 | + |
713 | + nux::ObjectPtr<nux::IOpenGLTexture2D> device_texture = |
714 | + nux::GetGraphicsDisplay()->GetGpuDevice()->CreateTexture2DFromID(gScreen->fbo ()->tex ()->name (), |
715 | + output->width(), output->height(), 1, nux::BITFMT_R8G8B8A8); |
716 | +>>>>>>> MERGE-SOURCE |
717 | nux::GetGraphicsDisplay()->GetGpuDevice()->backup_texture0_ = device_texture; |
718 | |
719 | +<<<<<<< TREE |
720 | nux::Geometry geo = nux::Geometry (0, 0, screen->width (), screen->height ()); |
721 | nux::Geometry oGeo = nux::Geometry (output->x (), output->y (), output->width (), output->height ()); |
722 | +======= |
723 | + nux::Geometry geo = nux::Geometry (output->x (), output->y (), |
724 | + output->width (), output->height ()); |
725 | +>>>>>>> MERGE-SOURCE |
726 | BackgroundEffectHelper::monitor_rect_ = geo; |
727 | |
728 | +<<<<<<< TREE |
729 | nuxPrologue(); |
730 | +======= |
731 | + // Nux renders to the referenceFramebuffer when it's embedded. |
732 | + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fboID); |
733 | + wt->GetWindowCompositor().SetReferenceFramebuffer(fboID, geo); |
734 | + |
735 | +>>>>>>> MERGE-SOURCE |
736 | _in_paint = true; |
737 | wt->RenderInterfaceFromForeignCmd (&oGeo); |
738 | _in_paint = false; |
739 | @@ -610,36 +678,28 @@ |
740 | { |
741 | GLMatrix oTransform; |
742 | UnityWindow *uTrayWindow = UnityWindow::get (tray); |
743 | - GLFragment::Attrib attrib (uTrayWindow->gWindow->lastPaintAttrib()); |
744 | + GLWindowPaintAttrib attrib (uTrayWindow->gWindow->lastPaintAttrib()); |
745 | unsigned int oldGlAddGeometryIndex = uTrayWindow->gWindow->glAddGeometryGetCurrentIndex (); |
746 | unsigned int oldGlDrawIndex = uTrayWindow->gWindow->glDrawGetCurrentIndex (); |
747 | - unsigned int oldGlDrawGeometryIndex = uTrayWindow->gWindow->glDrawGeometryGetCurrentIndex (); |
748 | |
749 | - attrib.setOpacity (OPAQUE); |
750 | - attrib.setBrightness (BRIGHT); |
751 | - attrib.setSaturation (COLOR); |
752 | + attrib.opacity = OPAQUE; |
753 | + attrib.brightness = BRIGHT; |
754 | + attrib.saturation = COLOR; |
755 | |
756 | oTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); |
757 | |
758 | - glPushMatrix (); |
759 | - glLoadMatrixf (oTransform.getMatrix ()); |
760 | - |
761 | painting_tray_ = true; |
762 | |
763 | /* force the use of the core functions */ |
764 | uTrayWindow->gWindow->glDrawSetCurrentIndex (MAXSHORT); |
765 | - uTrayWindow->gWindow->glAddGeometrySetCurrentIndex ( MAXSHORT); |
766 | - uTrayWindow->gWindow->glDrawGeometrySetCurrentIndex (MAXSHORT); |
767 | + uTrayWindow->gWindow->glAddGeometrySetCurrentIndex (MAXSHORT); |
768 | uTrayWindow->gWindow->glDraw (oTransform, attrib, infiniteRegion, |
769 | PAINT_WINDOW_TRANSFORMED_MASK | |
770 | PAINT_WINDOW_BLEND_MASK | |
771 | PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK); |
772 | - uTrayWindow->gWindow->glDrawGeometrySetCurrentIndex (oldGlDrawGeometryIndex); |
773 | uTrayWindow->gWindow->glAddGeometrySetCurrentIndex (oldGlAddGeometryIndex); |
774 | uTrayWindow->gWindow->glDrawSetCurrentIndex (oldGlDrawIndex); |
775 | painting_tray_ = false; |
776 | - |
777 | - glPopMatrix (); |
778 | } |
779 | } |
780 | |
781 | @@ -998,6 +1058,7 @@ |
782 | { |
783 | bool ret; |
784 | |
785 | +<<<<<<< TREE |
786 | doShellRepaint = true; |
787 | allowWindowPaint = true; |
788 | _last_output = output; |
789 | @@ -1013,19 +1074,41 @@ |
790 | * its bind reference so make sure that |
791 | * you always unbind as much as you bind */ |
792 | _fbo->bind (nux::Geometry (output->x (), output->y (), output->width (), output->height ())); |
793 | +======= |
794 | + doShellRepaint = true; |
795 | + allowWindowPaint = true; |
796 | + _last_output = output; |
797 | +>>>>>>> MERGE-SOURCE |
798 | |
799 | - /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */ |
800 | ret = gScreen->glPaintOutput(attrib, transform, region, output, mask); |
801 | |
802 | + return ret; |
803 | +} |
804 | + |
805 | +void UnityScreen::glPaintCompositedOutput (const CompRegion ®ion, |
806 | + GLFramebufferObject *fbo, |
807 | + unsigned int mask) |
808 | +{ |
809 | + bool useFbo = false; |
810 | + |
811 | if (doShellRepaint) |
812 | - paintDisplay(region, transform, mask); |
813 | + { |
814 | + oldFbo = fbo->bind (); |
815 | + useFbo = fbo->checkStatus () && fbo->tex (); |
816 | + if (!useFbo) { |
817 | + printf ("bailing from UnityScreen::glPaintCompositedOutput"); |
818 | + GLFramebufferObject::rebind (oldFbo); |
819 | + return; |
820 | + } |
821 | + paintDisplay(); |
822 | + GLFramebufferObject::rebind (oldFbo); |
823 | + } |
824 | |
825 | - return ret; |
826 | + gScreen->glPaintCompositedOutput(region, fbo, mask); |
827 | } |
828 | |
829 | /* called whenever a plugin needs to paint the entire scene |
830 | * transformed */ |
831 | - |
832 | void UnityScreen::glPaintTransformedOutput(const GLScreenPaintAttrib& attrib, |
833 | const GLMatrix& transform, |
834 | const CompRegion& region, |
835 | @@ -1034,7 +1117,6 @@ |
836 | { |
837 | allowWindowPaint = false; |
838 | gScreen->glPaintTransformedOutput(attrib, transform, region, output, mask); |
839 | - |
840 | } |
841 | |
842 | void UnityScreen::preparePaint(int ms) |
843 | @@ -1104,7 +1186,7 @@ |
844 | PluginAdapter::Default()->OnScreenGrabbed(); |
845 | else if (event->xfocus.mode == NotifyUngrab) |
846 | PluginAdapter::Default()->OnScreenUngrabbed(); |
847 | - cScreen->damageScreen(); // evil hack |
848 | +// cScreen->damageScreen(); // evil hack |
849 | if (_key_nav_mode_requested) |
850 | launcher.startKeyNavMode(); |
851 | _key_nav_mode_requested = false; |
852 | @@ -1711,7 +1793,7 @@ |
853 | * and if so paint nux and stop us from painting |
854 | * other windows or on top of the whole screen */ |
855 | bool UnityWindow::glDraw(const GLMatrix& matrix, |
856 | - GLFragment::Attrib& attrib, |
857 | + const GLWindowPaintAttrib& attrib, |
858 | const CompRegion& region, |
859 | unsigned int mask) |
860 | { |
861 | @@ -1727,7 +1809,7 @@ |
862 | { |
863 | if (xwns[i] == id) |
864 | { |
865 | - uScreen->paintDisplay(region, matrix, mask); |
866 | + uScreen->paintDisplay(); |
867 | break; |
868 | } |
869 | } |
870 | @@ -2203,12 +2285,15 @@ |
871 | if (!needsRelayout) |
872 | return; |
873 | |
874 | +<<<<<<< TREE |
875 | if (GL::fbo) |
876 | { |
877 | uScreen->_fbo = ScreenEffectFramebufferObject::Ptr (new ScreenEffectFramebufferObject (glXGetProcAddressP, geometry)); |
878 | uScreen->_fbo->onScreenSizeChanged (geometry); |
879 | } |
880 | |
881 | +======= |
882 | +>>>>>>> MERGE-SOURCE |
883 | UScreen *uscreen = UScreen::GetDefault(); |
884 | int primary_monitor = uscreen->GetPrimaryMonitor(); |
885 | auto geo = uscreen->GetMonitorGeometry(primary_monitor); |
886 | |
887 | === modified file 'plugins/unityshell/src/unityshell.h' |
888 | --- plugins/unityshell/src/unityshell.h 2012-01-06 04:53:09 +0000 |
889 | +++ plugins/unityshell/src/unityshell.h 2012-01-09 12:10:36 +0000 |
890 | @@ -56,7 +56,10 @@ |
891 | |
892 | namespace unity |
893 | { |
894 | +<<<<<<< TREE |
895 | |
896 | +======= |
897 | +>>>>>>> MERGE-SOURCE |
898 | class UnityShowdesktopHandler |
899 | { |
900 | public: |
901 | @@ -128,7 +131,7 @@ |
902 | void nuxEpilogue(); |
903 | |
904 | /* nux draw wrapper */ |
905 | - void paintDisplay(const CompRegion& region, const GLMatrix& transform, unsigned int mask); |
906 | + void paintDisplay(); |
907 | void paintPanelShadow(const GLMatrix& matrix); |
908 | |
909 | void preparePaint (int ms); |
910 | @@ -141,7 +144,6 @@ |
911 | const char *eventName, |
912 | CompOption::Vector &o); |
913 | |
914 | - |
915 | /* paint on top of all windows if we could not find a window |
916 | * to paint underneath */ |
917 | bool glPaintOutput(const GLScreenPaintAttrib&, |
918 | @@ -149,6 +151,9 @@ |
919 | const CompRegion&, |
920 | CompOutput*, |
921 | unsigned int); |
922 | + void glPaintCompositedOutput (const CompRegion ®ion, |
923 | + GLFramebufferObject *fbo, |
924 | + unsigned int mask); |
925 | |
926 | /* paint in the special case that the output is transformed */ |
927 | void glPaintTransformedOutput(const GLScreenPaintAttrib&, |
928 | @@ -290,8 +295,12 @@ |
929 | |
930 | unity::BGHash _bghash; |
931 | |
932 | +<<<<<<< TREE |
933 | ScreenEffectFramebufferObject::Ptr _fbo; |
934 | GLuint _active_fbo; |
935 | +======= |
936 | + GLFramebufferObject *oldFbo; |
937 | +>>>>>>> MERGE-SOURCE |
938 | |
939 | bool queryForShader (); |
940 | |
941 | @@ -339,7 +348,7 @@ |
942 | |
943 | /* basic window draw function */ |
944 | bool glDraw(const GLMatrix& matrix, |
945 | - GLFragment::Attrib& attrib, |
946 | + const GLWindowPaintAttrib& attrib, |
947 | const CompRegion& region, |
948 | unsigned intmask); |
949 | |
950 | |
951 | === modified file 'tests/CMakeLists.txt' |
952 | --- tests/CMakeLists.txt 2011-12-22 06:27:26 +0000 |
953 | +++ tests/CMakeLists.txt 2012-01-09 12:10:36 +0000 |
954 | @@ -88,6 +88,7 @@ |
955 | COMMENT "Generating marshallers") |
956 | |
957 | enable_testing() |
958 | + |
959 | find_package(GTest) |
960 | # :( |
961 | find_library (GMOCK_LIB gmock) |