Merge lp:~bitzesmichail/compiz/splash-gles into lp:compiz/0.9.9
- splash-gles
- Merge into 0.9.9
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 |
Related bugs: |
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.
Description of the change
Sam Spilsbury (smspillaz) wrote : | # |
This all looks great, all according to how it should work. My only two general comments:
262 + stream-
That is probably not necessary (the new shader based rendering model isn't stateful, I believe the active color is reset on GLVertexBuffer:
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.
Sam Spilsbury (smspillaz) : | # |
Michail Bitzes (bitzesmichail) wrote : | # |
> This all looks great, all according to how it should work. My only two general
> comments:
>
> 262 + stream-
>
> That is probably not necessary (the new shader based rendering model isn't
> stateful, I believe the active color is reset on GLVertexBuffer:
Weird. In my code, I used color4f () before begin () and it works. Is this wrong?
As an experiment, I changed color4f(
>
> 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.
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 ?
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.
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 :)
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.
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.
Sam Spilsbury (smspillaz) wrote : | # |
> > This all looks great, all according to how it should work. My only two
> general
> > comments:
> >
> > 262 + stream-
> >
> > That is probably not necessary (the new shader based rendering model isn't
> > stateful, I believe the active color is reset on GLVertexBuffer:
>
> Weird. In my code, I used color4f () before begin () and it works. Is this
> wrong?
>
> As an experiment, I changed color4f(
> color4f(
> 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.
Michail Bitzes (bitzesmichail) wrote : | # |
Changed the code to work if GLVertexBuffer is changed/fixed.
Sam Spilsbury (smspillaz) wrote : | # |
Dunno why this wasn't marked for merging earlier. Thanks!
Sam Spilsbury (smspillaz) wrote : | # |
Apologies for the delay, marking for merging again.
Preview Diff
1 | === modified file 'debian/compiz-plugins.install.armel' |
2 | --- debian/compiz-plugins.install.armel 2013-01-26 19:08:07 +0000 |
3 | +++ debian/compiz-plugins.install.armel 2013-02-07 10:29:22 +0000 |
4 | @@ -35,6 +35,8 @@ |
5 | debian/tmp/usr/*/compiz/*showdesktop.* |
6 | debian/tmp/usr/*/compiz/*showmouse.* |
7 | debian/tmp/usr/share/compiz/showmouse |
8 | +debian/tmp/usr/*/compiz/*splash.* |
9 | +debian/tmp/usr/share/compiz/splash |
10 | debian/tmp/usr/*/compiz/*switcher.* |
11 | debian/tmp/usr/*/compiz/*text.* |
12 | debian/tmp/usr/*/compiz/*titleinfo.* |
13 | |
14 | === modified file 'debian/compiz-plugins.install.armhf' |
15 | --- debian/compiz-plugins.install.armhf 2013-01-27 00:29:34 +0000 |
16 | +++ debian/compiz-plugins.install.armhf 2013-02-07 10:29:22 +0000 |
17 | @@ -35,6 +35,8 @@ |
18 | debian/tmp/usr/*/compiz/*showdesktop.* |
19 | debian/tmp/usr/*/compiz/*showmouse.* |
20 | debian/tmp/usr/share/compiz/showmouse |
21 | +debian/tmp/usr/*/compiz/*splash.* |
22 | +debian/tmp/usr/share/compiz/splash |
23 | debian/tmp/usr/*/compiz/*switcher.* |
24 | debian/tmp/usr/*/compiz/*text.* |
25 | debian/tmp/usr/*/compiz/*titleinfo.* |
26 | |
27 | === modified file 'plugins/CMakeLists.txt' |
28 | --- plugins/CMakeLists.txt 2013-02-02 23:01:02 +0000 |
29 | +++ plugins/CMakeLists.txt 2013-02-07 10:29:22 +0000 |
30 | @@ -46,7 +46,6 @@ |
31 | set (COMPIZ_DISABLE_PLUGIN_BENCH ON) |
32 | set (COMPIZ_DISABLE_PLUGIN_SHOWREPAINT ON) |
33 | set (COMPIZ_DISABLE_PLUGIN_WIDGET ON) |
34 | - set (COMPIZ_DISABLE_PLUGIN_SPLASH ON) |
35 | set (COMPIZ_DISABLE_PLUGIN_THUMBNAIL ON) |
36 | set (COMPIZ_DISABLE_PLUGIN_WIZARD ON) |
37 | |
38 | |
39 | === modified file 'plugins/splash/src/splash.cpp' |
40 | --- plugins/splash/src/splash.cpp 2012-09-07 23:29:42 +0000 |
41 | +++ plugins/splash/src/splash.cpp 2013-02-07 10:29:22 +0000 |
42 | @@ -186,6 +186,7 @@ |
43 | unsigned int mask) |
44 | { |
45 | GLMatrix sTransform = transform; |
46 | + GLVertexBuffer *stream = GLVertexBuffer::streamingBuffer (); |
47 | |
48 | bool status = true; |
49 | |
50 | @@ -208,12 +209,8 @@ |
51 | |
52 | sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA); |
53 | |
54 | - glPushMatrix (); |
55 | - glLoadMatrixf (sTransform.getMatrix ()); |
56 | glEnable (GL_BLEND); |
57 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
58 | - glColor4f (1.0, 1.0, 1.0, alpha); |
59 | - glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
60 | |
61 | if (back_img.size ()) |
62 | { |
63 | @@ -229,7 +226,6 @@ |
64 | mesh[x][y][1] = |
65 | (y / (MESH_H - 1.0) ) + |
66 | (0.02 * sin ( (mesh[x][y][0] * 8) + mMove) ); |
67 | - ; |
68 | } |
69 | } |
70 | |
71 | @@ -256,11 +252,15 @@ |
72 | |
73 | GLTexture::Matrix mat = tex->matrix (); |
74 | |
75 | - glTranslatef (x, y, 0); |
76 | + sTransform.translate (x, y, 0); |
77 | |
78 | float cx1, cx2, cy1, cy2; |
79 | |
80 | - glBegin (GL_QUADS); |
81 | + std::vector<GLfloat> coords; |
82 | + std::vector<GLfloat> vertices; |
83 | + |
84 | + coords.reserve (12 * (MESH_W - 1) * (MESH_H - 1)); |
85 | + vertices.reserve (18 * (MESH_W - 1) * (MESH_H - 1)); |
86 | |
87 | for (x = 0; x < MESH_W - 1; x++) |
88 | { |
89 | @@ -271,30 +271,56 @@ |
90 | cy1 = (y / (MESH_H - 1.0) ) * backSize.height (); |
91 | cy2 = ( (y + 1) / (MESH_H - 1.0) ) * backSize.height (); |
92 | |
93 | - glTexCoord2f (COMP_TEX_COORD_X (mat, cx1), |
94 | - COMP_TEX_COORD_Y (mat, cy1) ); |
95 | - glVertex2f (mesh[x][y][0] * |
96 | - backSize.width (), |
97 | - mesh[x][y][1] * backSize.height ()); |
98 | - glTexCoord2f (COMP_TEX_COORD_X (mat, cx1), |
99 | - COMP_TEX_COORD_Y (mat, cy2) ); |
100 | - glVertex2f (mesh[x][y + 1][0] * |
101 | - backSize.width (), |
102 | - mesh[x][y + 1][1] * backSize.height ()); |
103 | - glTexCoord2f (COMP_TEX_COORD_X (mat, cx2), |
104 | - COMP_TEX_COORD_Y (mat, cy2) ); |
105 | - glVertex2f (mesh[x + 1][y + 1][0] * |
106 | - backSize.width (), |
107 | - mesh[x + 1][y + 1][1] * backSize.height ()); |
108 | - glTexCoord2f (COMP_TEX_COORD_X (mat, cx2), |
109 | - COMP_TEX_COORD_Y (mat, cy1) ); |
110 | - glVertex2f (mesh[x + 1][y][0] * |
111 | - backSize.width (), |
112 | - mesh[x + 1][y][1] * backSize.height ()); |
113 | + coords.push_back (COMP_TEX_COORD_X (mat, cx1)); |
114 | + coords.push_back (COMP_TEX_COORD_Y (mat, cy1)); |
115 | + |
116 | + coords.push_back (COMP_TEX_COORD_X (mat, cx1)); |
117 | + coords.push_back (COMP_TEX_COORD_Y (mat, cy2)); |
118 | + |
119 | + coords.push_back (COMP_TEX_COORD_X (mat, cx2)); |
120 | + coords.push_back (COMP_TEX_COORD_Y (mat, cy2)); |
121 | + |
122 | + coords.push_back (COMP_TEX_COORD_X (mat, cx2)); |
123 | + coords.push_back (COMP_TEX_COORD_Y (mat, cy2)); |
124 | + |
125 | + coords.push_back (COMP_TEX_COORD_X (mat, cx2)); |
126 | + coords.push_back (COMP_TEX_COORD_Y (mat, cy1)); |
127 | + |
128 | + coords.push_back (COMP_TEX_COORD_X (mat, cx1)); |
129 | + coords.push_back (COMP_TEX_COORD_Y (mat, cy1)); |
130 | + |
131 | + vertices.push_back (mesh[x][y][0] * backSize.width ()); |
132 | + vertices.push_back (mesh[x][y][1] * backSize.height ()); |
133 | + vertices.push_back (0.0f); |
134 | + |
135 | + vertices.push_back (mesh[x][y + 1][0] * backSize.width ()); |
136 | + vertices.push_back (mesh[x][y + 1][1] * backSize.height ()); |
137 | + vertices.push_back (0.0f); |
138 | + |
139 | + vertices.push_back (mesh[x + 1][y + 1][0] * backSize.width ()); |
140 | + vertices.push_back (mesh[x + 1][y + 1][1] * backSize.height ()); |
141 | + vertices.push_back (0.0f); |
142 | + |
143 | + vertices.push_back (mesh[x + 1][y + 1][0] * backSize.width ()); |
144 | + vertices.push_back (mesh[x + 1][y + 1][1] * backSize.height ()); |
145 | + vertices.push_back (0.0f); |
146 | + |
147 | + vertices.push_back (mesh[x + 1][y][0] * backSize.width ()); |
148 | + vertices.push_back (mesh[x + 1][y][1] * backSize.height ()); |
149 | + vertices.push_back (0.0f); |
150 | + |
151 | + vertices.push_back (mesh[x][y][0] * backSize.width ()); |
152 | + vertices.push_back (mesh[x][y][1] * backSize.height ()); |
153 | + vertices.push_back (0.0f); |
154 | } |
155 | } |
156 | |
157 | - glEnd (); |
158 | + stream->begin (GL_TRIANGLES); |
159 | + stream->color4f (1.0, 1.0, 1.0, alpha); |
160 | + stream->addVertices (vertices.size () / 3, &vertices[0]); |
161 | + stream->addTexCoords (0, coords.size () / 2, &coords[0]); |
162 | + if (stream->end ()) |
163 | + stream->render (sTransform); |
164 | |
165 | if (screen->outputDevs ().size () > 1) |
166 | { |
167 | @@ -313,7 +339,7 @@ |
168 | y = (screen->height () - backSize.height ()) / 2; |
169 | } |
170 | |
171 | - glTranslatef (-x, -y, 0); |
172 | + sTransform.translate (-x, -y, 0); |
173 | |
174 | tex->disable (); |
175 | |
176 | @@ -346,34 +372,68 @@ |
177 | |
178 | GLTexture::Matrix mat = tex->matrix (); |
179 | |
180 | - glTranslatef (x, y, 0); |
181 | - |
182 | - glBegin (GL_QUADS); |
183 | - glTexCoord2f (COMP_TEX_COORD_X (mat, 0), COMP_TEX_COORD_Y (mat, 0) ); |
184 | - glVertex2f (0, 0); |
185 | - glTexCoord2f (COMP_TEX_COORD_X (mat, 0), |
186 | - COMP_TEX_COORD_Y (mat, logoSize.height ()) ); |
187 | - glVertex2f (0, logoSize.height ()); |
188 | - glTexCoord2f (COMP_TEX_COORD_X (mat, logoSize.width ()), |
189 | - COMP_TEX_COORD_Y (mat, logoSize.height ()) ); |
190 | - glVertex2f (logoSize.width (), logoSize.height ()); |
191 | - glTexCoord2f (COMP_TEX_COORD_X (mat, logoSize.width ()), |
192 | - COMP_TEX_COORD_Y (mat, 0) ); |
193 | - glVertex2f (logoSize.width (), 0); |
194 | - glEnd (); |
195 | - |
196 | - glTranslatef (-x, -y, 0); |
197 | + sTransform.translate (x, y, 0); |
198 | + |
199 | + GLfloat coords[12]; |
200 | + GLfloat vertices[18]; |
201 | + |
202 | + coords[0] = COMP_TEX_COORD_X (mat, 0); |
203 | + coords[1] = COMP_TEX_COORD_Y (mat, 0); |
204 | + |
205 | + coords[2] = COMP_TEX_COORD_X (mat, 0); |
206 | + coords[3] = COMP_TEX_COORD_Y (mat, logoSize.height ()); |
207 | + |
208 | + coords[4] = COMP_TEX_COORD_X (mat, logoSize.width ()); |
209 | + coords[5] = COMP_TEX_COORD_Y (mat, logoSize.height ()); |
210 | + |
211 | + coords[6] = COMP_TEX_COORD_X (mat, logoSize.width ()); |
212 | + coords[7] = COMP_TEX_COORD_Y (mat, logoSize.height ()); |
213 | + |
214 | + coords[8] = COMP_TEX_COORD_X (mat, logoSize.width ()); |
215 | + coords[9] = COMP_TEX_COORD_Y (mat, 0); |
216 | + |
217 | + coords[10] = COMP_TEX_COORD_X (mat, 0); |
218 | + coords[11] = COMP_TEX_COORD_Y (mat, 0); |
219 | + |
220 | + vertices[0] = 0; |
221 | + vertices[1] = 0; |
222 | + vertices[2] = 0; |
223 | + |
224 | + vertices[3] = 0; |
225 | + vertices[4] = logoSize.height (); |
226 | + vertices[5] = 0; |
227 | + |
228 | + vertices[6] = logoSize.width (); |
229 | + vertices[7] = logoSize.height (); |
230 | + vertices[8] = 0; |
231 | + |
232 | + vertices[9] = logoSize.width (); |
233 | + vertices[10] = logoSize.height (); |
234 | + vertices[11] = 0; |
235 | + |
236 | + vertices[12] = logoSize.width (); |
237 | + vertices[13] = 0; |
238 | + vertices[14] = 0; |
239 | + |
240 | + vertices[15] = 0; |
241 | + vertices[16] = 0; |
242 | + vertices[17] = 0; |
243 | + |
244 | + stream->begin (GL_TRIANGLES); |
245 | + stream->color4f (1.0, 1.0, 1.0, alpha); |
246 | + stream->addVertices (6, vertices); |
247 | + stream->addTexCoords (0, 6, coords); |
248 | + if (stream->end ()) |
249 | + stream->render (sTransform); |
250 | + |
251 | + sTransform.translate (-x, -y, 0); |
252 | |
253 | tex->disable (); |
254 | } |
255 | } |
256 | |
257 | - glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); |
258 | - |
259 | glDisable (GL_BLEND); |
260 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
261 | - glColor4usv (defaultColor); |
262 | - glPopMatrix (); |
263 | return status; |
264 | } |
265 |
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.