Merge lp:~bitzesmichail/compiz/splash-gles into lp:compiz/0.9.9

Proposed by Michail Bitzes
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3597
Merged at revision: 3604
Proposed branch: lp:~bitzesmichail/compiz/splash-gles
Merge into: lp:compiz/0.9.9
Diff against target: 264 lines (+114/-51)
4 files modified
debian/compiz-plugins.install.armel (+2/-0)
debian/compiz-plugins.install.armhf (+2/-0)
plugins/CMakeLists.txt (+0/-1)
plugins/splash/src/splash.cpp (+110/-50)
To merge this branch: bzr merge lp:~bitzesmichail/compiz/splash-gles
Reviewer Review Type Date Requested Status
Sam Spilsbury Approve
MC Return Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+146391@code.launchpad.net

Commit message

Plugin splash ported to OpenGL|ES.

Use GLVertexBuffer.
Enable building for GLES. Enable architectures armel and armhf.

To post a comment you must log in.
Revision history for this message
MC Return (mc-return) wrote :

Compiles without any warnings, works and code also looks good. :)
Just tested the GL desktop build though, but I am sure GLES works as well...

Top job (as always), Michail, I would say. Thanks a lot.

review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

This all looks great, all according to how it should work. My only two general comments:

262 + stream->colorDefault ();

That is probably not necessary (the new shader based rendering model isn't stateful, I believe the active color is reset on GLVertexBuffer::begin ()

2. Generally speaking, its a lot easier to port old code that uses GL_QUADS to use GL_TRIANGLE_STRIP instead of GL_TRIANGLES as the primitive type, since the vertices are often arranged to wind in right-angled triangles (eg, x1y1, x1y2, x2y1, x2y2), and then you can just generate the first triangle and only take the fourth-point for every other triangle after that.

Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve
Revision history for this message
Michail Bitzes (bitzesmichail) wrote :

> This all looks great, all according to how it should work. My only two general
> comments:
>
> 262 + stream->colorDefault ();
>
> That is probably not necessary (the new shader based rendering model isn't
> stateful, I believe the active color is reset on GLVertexBuffer::begin ()

Weird. In my code, I used color4f () before begin () and it works. Is this wrong?

As an experiment, I changed color4f(1.0,1.0,1.0,alpha) to color4f(1.0,0.0,0.0,alpha). Without colorDefault (), the red color is leaked outside the splash logo, and when the animation finishes, the screen is left a red mess.

>
> 2. Generally speaking, its a lot easier to port old code that uses GL_QUADS to
> use GL_TRIANGLE_STRIP instead of GL_TRIANGLES as the primitive type, since the
> vertices are often arranged to wind in right-angled triangles (eg, x1y1, x1y2,
> x2y1, x2y2), and then you can just generate the first triangle and only take
> the fourth-point for every other triangle after that.

Thanks, I'll consider this approach next time.

Revision history for this message
MC Return (mc-return) wrote :

Michail, 3 questions:

1. During testing I found that the option Main->"Show on first start" does not work correctly. If disabled Splash will still show on Compiz start, no matter if first or second. Could you try to fix that also, when you are on it ?

2. We introduced some minor indentation problems in the Firepaint GL|ES merge and optimized the if statements in Showmouse, do you want to propose a MP with the Firepaint fixes (indentation and better readability for the if statements), or should I do it ?

3. Unfortunately the Wizard is still a bit unstable when you start to customize the particles, while working stable with the defaults, did you make progress/are you still working on it and the GL|ES version ?

Revision history for this message
Michail Bitzes (bitzesmichail) wrote :

 > 1. During testing I found that the option Main->"Show on first start" does not
> work correctly. If disabled Splash will still show on Compiz start, no matter
> if first or second. Could you try to fix that also, when you are on it ?

I can look at it tomorrow.

> 2. We introduced some minor indentation problems in the Firepaint GL|ES merge
> and optimized the if statements in Showmouse, do you want to propose a MP with
> the Firepaint fixes (indentation and better readability for the if
> statements), or should I do it ?

You can do it.

> 3. Unfortunately the Wizard is still a bit unstable when you start to
> customize the particles, while working stable with the defaults, did you make
> progress/are you still working on it and the GL|ES version ?

Unstable = slow or crash?
I made a branch with the GLES port, I haven't proposed it yet.

Revision history for this message
MC Return (mc-return) wrote :

> I can look at it tomorrow.
>
Thanks.

> You can do it.
>
+1

> Unstable = slow or crash?
> I made a branch with the GLES port, I haven't proposed it yet.

Unfortunately crash, when messing with the individual particles, but
I noticed caching works a bit different, so it might have to do with
that and so it might already be fixed in your port...

Great to hear you're making progress on that front :)

Revision history for this message
Michail Bitzes (bitzesmichail) wrote :

> 1. During testing I found that the option Main->"Show on first start" does not
> work correctly. If disabled Splash will still show on Compiz start, no matter
> if first or second. Could you try to fix that also, when you are on it ?

I worked on this: optionGetFirststart () always returns true (the default value) when called in the constructor of SplashScreen.

I don't know enough yet to find a solution, so this branch should proceed without a fix for this.

Revision history for this message
MC Return (mc-return) wrote :

>
> I worked on this: optionGetFirststart () always returns true (the default
> value) when called in the constructor of SplashScreen.
>
> I don't know enough yet to find a solution, so this branch should proceed
> without a fix for this.

Ok, not a big problem, and not related to this MP - we'll fix that later then.

review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

> > This all looks great, all according to how it should work. My only two
> general
> > comments:
> >
> > 262 + stream->colorDefault ();
> >
> > That is probably not necessary (the new shader based rendering model isn't
> > stateful, I believe the active color is reset on GLVertexBuffer::begin ()
>
> Weird. In my code, I used color4f () before begin () and it works. Is this
> wrong?
>
> As an experiment, I changed color4f(1.0,1.0,1.0,alpha) to
> color4f(1.0,0.0,0.0,alpha). Without colorDefault (), the red color is leaked
> outside the splash logo, and when the animation finishes, the screen is left a
> red mess.

This should probably be fixed in the GLVertexBuffer implementation.

>
> >
> > 2. Generally speaking, its a lot easier to port old code that uses GL_QUADS
> to
> > use GL_TRIANGLE_STRIP instead of GL_TRIANGLES as the primitive type, since
> the
> > vertices are often arranged to wind in right-angled triangles (eg, x1y1,
> x1y2,
> > x2y1, x2y2), and then you can just generate the first triangle and only take
> > the fourth-point for every other triangle after that.
>
> Thanks, I'll consider this approach next time.

Revision history for this message
Michail Bitzes (bitzesmichail) wrote :

Changed the code to work if GLVertexBuffer is changed/fixed.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Dunno why this wasn't marked for merging earlier. Thanks!

review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Apologies for the delay, marking for merging again.

See https://lists.launchpad.net/unity-dev/msg00598.html

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/compiz-plugins.install.armel'
--- debian/compiz-plugins.install.armel 2013-01-26 19:08:07 +0000
+++ debian/compiz-plugins.install.armel 2013-02-07 10:29:22 +0000
@@ -35,6 +35,8 @@
35debian/tmp/usr/*/compiz/*showdesktop.*35debian/tmp/usr/*/compiz/*showdesktop.*
36debian/tmp/usr/*/compiz/*showmouse.*36debian/tmp/usr/*/compiz/*showmouse.*
37debian/tmp/usr/share/compiz/showmouse37debian/tmp/usr/share/compiz/showmouse
38debian/tmp/usr/*/compiz/*splash.*
39debian/tmp/usr/share/compiz/splash
38debian/tmp/usr/*/compiz/*switcher.*40debian/tmp/usr/*/compiz/*switcher.*
39debian/tmp/usr/*/compiz/*text.*41debian/tmp/usr/*/compiz/*text.*
40debian/tmp/usr/*/compiz/*titleinfo.*42debian/tmp/usr/*/compiz/*titleinfo.*
4143
=== modified file 'debian/compiz-plugins.install.armhf'
--- debian/compiz-plugins.install.armhf 2013-01-27 00:29:34 +0000
+++ debian/compiz-plugins.install.armhf 2013-02-07 10:29:22 +0000
@@ -35,6 +35,8 @@
35debian/tmp/usr/*/compiz/*showdesktop.*35debian/tmp/usr/*/compiz/*showdesktop.*
36debian/tmp/usr/*/compiz/*showmouse.*36debian/tmp/usr/*/compiz/*showmouse.*
37debian/tmp/usr/share/compiz/showmouse37debian/tmp/usr/share/compiz/showmouse
38debian/tmp/usr/*/compiz/*splash.*
39debian/tmp/usr/share/compiz/splash
38debian/tmp/usr/*/compiz/*switcher.*40debian/tmp/usr/*/compiz/*switcher.*
39debian/tmp/usr/*/compiz/*text.*41debian/tmp/usr/*/compiz/*text.*
40debian/tmp/usr/*/compiz/*titleinfo.*42debian/tmp/usr/*/compiz/*titleinfo.*
4143
=== modified file 'plugins/CMakeLists.txt'
--- plugins/CMakeLists.txt 2013-02-02 23:01:02 +0000
+++ plugins/CMakeLists.txt 2013-02-07 10:29:22 +0000
@@ -46,7 +46,6 @@
46 set (COMPIZ_DISABLE_PLUGIN_BENCH ON)46 set (COMPIZ_DISABLE_PLUGIN_BENCH ON)
47 set (COMPIZ_DISABLE_PLUGIN_SHOWREPAINT ON)47 set (COMPIZ_DISABLE_PLUGIN_SHOWREPAINT ON)
48 set (COMPIZ_DISABLE_PLUGIN_WIDGET ON)48 set (COMPIZ_DISABLE_PLUGIN_WIDGET ON)
49 set (COMPIZ_DISABLE_PLUGIN_SPLASH ON)
50 set (COMPIZ_DISABLE_PLUGIN_THUMBNAIL ON)49 set (COMPIZ_DISABLE_PLUGIN_THUMBNAIL ON)
51 set (COMPIZ_DISABLE_PLUGIN_WIZARD ON)50 set (COMPIZ_DISABLE_PLUGIN_WIZARD ON)
5251
5352
=== modified file 'plugins/splash/src/splash.cpp'
--- plugins/splash/src/splash.cpp 2012-09-07 23:29:42 +0000
+++ plugins/splash/src/splash.cpp 2013-02-07 10:29:22 +0000
@@ -186,6 +186,7 @@
186 unsigned int mask)186 unsigned int mask)
187{187{
188 GLMatrix sTransform = transform;188 GLMatrix sTransform = transform;
189 GLVertexBuffer *stream = GLVertexBuffer::streamingBuffer ();
189190
190 bool status = true;191 bool status = true;
191192
@@ -208,12 +209,8 @@
208209
209 sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);210 sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
210211
211 glPushMatrix ();
212 glLoadMatrixf (sTransform.getMatrix ());
213 glEnable (GL_BLEND);212 glEnable (GL_BLEND);
214 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);213 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
215 glColor4f (1.0, 1.0, 1.0, alpha);
216 glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
217214
218 if (back_img.size ())215 if (back_img.size ())
219 {216 {
@@ -229,7 +226,6 @@
229 mesh[x][y][1] =226 mesh[x][y][1] =
230 (y / (MESH_H - 1.0) ) +227 (y / (MESH_H - 1.0) ) +
231 (0.02 * sin ( (mesh[x][y][0] * 8) + mMove) );228 (0.02 * sin ( (mesh[x][y][0] * 8) + mMove) );
232 ;
233 }229 }
234 }230 }
235231
@@ -256,11 +252,15 @@
256252
257 GLTexture::Matrix mat = tex->matrix ();253 GLTexture::Matrix mat = tex->matrix ();
258254
259 glTranslatef (x, y, 0);255 sTransform.translate (x, y, 0);
260256
261 float cx1, cx2, cy1, cy2;257 float cx1, cx2, cy1, cy2;
262258
263 glBegin (GL_QUADS);259 std::vector<GLfloat> coords;
260 std::vector<GLfloat> vertices;
261
262 coords.reserve (12 * (MESH_W - 1) * (MESH_H - 1));
263 vertices.reserve (18 * (MESH_W - 1) * (MESH_H - 1));
264264
265 for (x = 0; x < MESH_W - 1; x++)265 for (x = 0; x < MESH_W - 1; x++)
266 {266 {
@@ -271,30 +271,56 @@
271 cy1 = (y / (MESH_H - 1.0) ) * backSize.height ();271 cy1 = (y / (MESH_H - 1.0) ) * backSize.height ();
272 cy2 = ( (y + 1) / (MESH_H - 1.0) ) * backSize.height ();272 cy2 = ( (y + 1) / (MESH_H - 1.0) ) * backSize.height ();
273273
274 glTexCoord2f (COMP_TEX_COORD_X (mat, cx1),274 coords.push_back (COMP_TEX_COORD_X (mat, cx1));
275 COMP_TEX_COORD_Y (mat, cy1) );275 coords.push_back (COMP_TEX_COORD_Y (mat, cy1));
276 glVertex2f (mesh[x][y][0] *276
277 backSize.width (),277 coords.push_back (COMP_TEX_COORD_X (mat, cx1));
278 mesh[x][y][1] * backSize.height ());278 coords.push_back (COMP_TEX_COORD_Y (mat, cy2));
279 glTexCoord2f (COMP_TEX_COORD_X (mat, cx1),279
280 COMP_TEX_COORD_Y (mat, cy2) );280 coords.push_back (COMP_TEX_COORD_X (mat, cx2));
281 glVertex2f (mesh[x][y + 1][0] *281 coords.push_back (COMP_TEX_COORD_Y (mat, cy2));
282 backSize.width (),282
283 mesh[x][y + 1][1] * backSize.height ());283 coords.push_back (COMP_TEX_COORD_X (mat, cx2));
284 glTexCoord2f (COMP_TEX_COORD_X (mat, cx2),284 coords.push_back (COMP_TEX_COORD_Y (mat, cy2));
285 COMP_TEX_COORD_Y (mat, cy2) );285
286 glVertex2f (mesh[x + 1][y + 1][0] *286 coords.push_back (COMP_TEX_COORD_X (mat, cx2));
287 backSize.width (),287 coords.push_back (COMP_TEX_COORD_Y (mat, cy1));
288 mesh[x + 1][y + 1][1] * backSize.height ());288
289 glTexCoord2f (COMP_TEX_COORD_X (mat, cx2),289 coords.push_back (COMP_TEX_COORD_X (mat, cx1));
290 COMP_TEX_COORD_Y (mat, cy1) );290 coords.push_back (COMP_TEX_COORD_Y (mat, cy1));
291 glVertex2f (mesh[x + 1][y][0] *291
292 backSize.width (),292 vertices.push_back (mesh[x][y][0] * backSize.width ());
293 mesh[x + 1][y][1] * backSize.height ());293 vertices.push_back (mesh[x][y][1] * backSize.height ());
294 vertices.push_back (0.0f);
295
296 vertices.push_back (mesh[x][y + 1][0] * backSize.width ());
297 vertices.push_back (mesh[x][y + 1][1] * backSize.height ());
298 vertices.push_back (0.0f);
299
300 vertices.push_back (mesh[x + 1][y + 1][0] * backSize.width ());
301 vertices.push_back (mesh[x + 1][y + 1][1] * backSize.height ());
302 vertices.push_back (0.0f);
303
304 vertices.push_back (mesh[x + 1][y + 1][0] * backSize.width ());
305 vertices.push_back (mesh[x + 1][y + 1][1] * backSize.height ());
306 vertices.push_back (0.0f);
307
308 vertices.push_back (mesh[x + 1][y][0] * backSize.width ());
309 vertices.push_back (mesh[x + 1][y][1] * backSize.height ());
310 vertices.push_back (0.0f);
311
312 vertices.push_back (mesh[x][y][0] * backSize.width ());
313 vertices.push_back (mesh[x][y][1] * backSize.height ());
314 vertices.push_back (0.0f);
294 }315 }
295 }316 }
296317
297 glEnd ();318 stream->begin (GL_TRIANGLES);
319 stream->color4f (1.0, 1.0, 1.0, alpha);
320 stream->addVertices (vertices.size () / 3, &vertices[0]);
321 stream->addTexCoords (0, coords.size () / 2, &coords[0]);
322 if (stream->end ())
323 stream->render (sTransform);
298324
299 if (screen->outputDevs ().size () > 1)325 if (screen->outputDevs ().size () > 1)
300 {326 {
@@ -313,7 +339,7 @@
313 y = (screen->height () - backSize.height ()) / 2;339 y = (screen->height () - backSize.height ()) / 2;
314 }340 }
315341
316 glTranslatef (-x, -y, 0);342 sTransform.translate (-x, -y, 0);
317343
318 tex->disable ();344 tex->disable ();
319345
@@ -346,34 +372,68 @@
346372
347 GLTexture::Matrix mat = tex->matrix ();373 GLTexture::Matrix mat = tex->matrix ();
348374
349 glTranslatef (x, y, 0);375 sTransform.translate (x, y, 0);
350376
351 glBegin (GL_QUADS);377 GLfloat coords[12];
352 glTexCoord2f (COMP_TEX_COORD_X (mat, 0), COMP_TEX_COORD_Y (mat, 0) );378 GLfloat vertices[18];
353 glVertex2f (0, 0);379
354 glTexCoord2f (COMP_TEX_COORD_X (mat, 0),380 coords[0] = COMP_TEX_COORD_X (mat, 0);
355 COMP_TEX_COORD_Y (mat, logoSize.height ()) );381 coords[1] = COMP_TEX_COORD_Y (mat, 0);
356 glVertex2f (0, logoSize.height ());382
357 glTexCoord2f (COMP_TEX_COORD_X (mat, logoSize.width ()),383 coords[2] = COMP_TEX_COORD_X (mat, 0);
358 COMP_TEX_COORD_Y (mat, logoSize.height ()) );384 coords[3] = COMP_TEX_COORD_Y (mat, logoSize.height ());
359 glVertex2f (logoSize.width (), logoSize.height ());385
360 glTexCoord2f (COMP_TEX_COORD_X (mat, logoSize.width ()),386 coords[4] = COMP_TEX_COORD_X (mat, logoSize.width ());
361 COMP_TEX_COORD_Y (mat, 0) );387 coords[5] = COMP_TEX_COORD_Y (mat, logoSize.height ());
362 glVertex2f (logoSize.width (), 0);388
363 glEnd ();389 coords[6] = COMP_TEX_COORD_X (mat, logoSize.width ());
364390 coords[7] = COMP_TEX_COORD_Y (mat, logoSize.height ());
365 glTranslatef (-x, -y, 0);391
392 coords[8] = COMP_TEX_COORD_X (mat, logoSize.width ());
393 coords[9] = COMP_TEX_COORD_Y (mat, 0);
394
395 coords[10] = COMP_TEX_COORD_X (mat, 0);
396 coords[11] = COMP_TEX_COORD_Y (mat, 0);
397
398 vertices[0] = 0;
399 vertices[1] = 0;
400 vertices[2] = 0;
401
402 vertices[3] = 0;
403 vertices[4] = logoSize.height ();
404 vertices[5] = 0;
405
406 vertices[6] = logoSize.width ();
407 vertices[7] = logoSize.height ();
408 vertices[8] = 0;
409
410 vertices[9] = logoSize.width ();
411 vertices[10] = logoSize.height ();
412 vertices[11] = 0;
413
414 vertices[12] = logoSize.width ();
415 vertices[13] = 0;
416 vertices[14] = 0;
417
418 vertices[15] = 0;
419 vertices[16] = 0;
420 vertices[17] = 0;
421
422 stream->begin (GL_TRIANGLES);
423 stream->color4f (1.0, 1.0, 1.0, alpha);
424 stream->addVertices (6, vertices);
425 stream->addTexCoords (0, 6, coords);
426 if (stream->end ())
427 stream->render (sTransform);
428
429 sTransform.translate (-x, -y, 0);
366430
367 tex->disable ();431 tex->disable ();
368 }432 }
369 }433 }
370434
371 glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
372
373 glDisable (GL_BLEND);435 glDisable (GL_BLEND);
374 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);436 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
375 glColor4usv (defaultColor);
376 glPopMatrix ();
377 return status;437 return status;
378}438}
379439

Subscribers

People subscribed via source and target branches