Merge lp:~linaro-graphics-wg/glmark2/opaque-framebuffer-rendering into lp:glmark2/2011.11

Proposed by Alexandros Frantzis
Status: Merged
Merged at revision: 205
Proposed branch: lp:~linaro-graphics-wg/glmark2/opaque-framebuffer-rendering
Merge into: lp:glmark2/2011.11
Diff against target: 106 lines (+19/-8)
7 files modified
data/shaders/desktop-blur.frag (+1/-1)
data/shaders/effect-2d-convolution.frag (+1/-1)
data/shaders/light-advanced.frag (+1/-1)
data/shaders/light-basic.vert (+1/-1)
src/canvas-x11.cpp (+1/-1)
src/scene-desktop.cpp (+12/-2)
src/scene-pulsar.cpp (+2/-1)
To merge this branch: bzr merge lp:~linaro-graphics-wg/glmark2/opaque-framebuffer-rendering
Reviewer Review Type Date Requested Status
Jesse Barker Approve
Review via email: mp+104901@code.launchpad.net

Description of the change

Ensure that the framebuffer is drawn opaquely.

Some rendering operations draw translucent pixels to the framebuffer,
leading to inconsistent visual results on different platforms and
compositing managers. This commit ensures that pixels drawn to the
framebuffer by the various scenes are opaque.

To post a comment you must log in.
Revision history for this message
Jesse Barker (jesse-barker) wrote :

Code looks fine. Is it also worth not asking for a config with alpha?

review: Approve
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

My plan is to rethink our default visual parameters as part of
https://blueprints.launchpad.net/glmark2/+spec/glmark2-configurable-visual

Revision history for this message
Jesse Barker (jesse-barker) wrote :

> My plan is to rethink our default visual parameters as part of
> https://blueprints.launchpad.net/glmark2/+spec/glmark2-configurable-visual

Sounds good. Go ahead and merge.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/shaders/desktop-blur.frag'
2--- data/shaders/desktop-blur.frag 2011-09-14 16:53:37 +0000
3+++ data/shaders/desktop-blur.frag 2012-05-07 13:02:18 +0000
4@@ -8,6 +8,6 @@
5
6 $CONVOLUTION$
7
8- gl_FragColor = result;
9+ gl_FragColor = vec4(result.xyz, 1.0);
10 }
11
12
13=== modified file 'data/shaders/effect-2d-convolution.frag'
14--- data/shaders/effect-2d-convolution.frag 2011-09-14 16:53:37 +0000
15+++ data/shaders/effect-2d-convolution.frag 2012-05-07 13:02:18 +0000
16@@ -7,6 +7,6 @@
17
18 $CONVOLUTION$
19
20- gl_FragColor = result;
21+ gl_FragColor = vec4(result.xyz, 1.0);
22 }
23
24
25=== modified file 'data/shaders/light-advanced.frag'
26--- data/shaders/light-advanced.frag 2011-10-11 09:51:17 +0000
27+++ data/shaders/light-advanced.frag 2012-05-07 13:02:18 +0000
28@@ -29,5 +29,5 @@
29 pow(max(dot(N,H), 0.0), MaterialShininess);
30
31 // Calculate the final color
32- gl_FragColor = ambient + specular + diffuse;
33+ gl_FragColor = vec4((ambient + specular + diffuse).xyz, 1.0);
34 }
35
36=== modified file 'data/shaders/light-basic.vert'
37--- data/shaders/light-basic.vert 2011-10-11 09:51:17 +0000
38+++ data/shaders/light-basic.vert 2012-05-07 13:02:18 +0000
39@@ -19,7 +19,7 @@
40 // Multiply the diffuse value by the vertex color (which is fixed in this case)
41 // to get the actual color that we will use to draw this vertex with
42 float diffuse = max(dot(N, L), 0.0);
43- Color = diffuse * MaterialDiffuse;
44+ Color = vec4(diffuse * MaterialDiffuse.rgb, MaterialDiffuse.a);
45
46 // Set the texture coordinates as a varying
47 TextureCoord = texcoord;
48
49=== modified file 'src/canvas-x11.cpp'
50--- src/canvas-x11.cpp 2012-03-20 12:55:49 +0000
51+++ src/canvas-x11.cpp 2012-05-07 13:02:18 +0000
52@@ -87,7 +87,7 @@
53 void
54 CanvasX11::clear()
55 {
56- glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
57+ glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
58 #if USE_GL
59 glClearDepth(1.0f);
60 #elif USE_GLESv2
61
62=== modified file 'src/scene-desktop.cpp'
63--- src/scene-desktop.cpp 2012-03-12 15:32:07 +0000
64+++ src/scene-desktop.cpp 2012-05-07 13:02:18 +0000
65@@ -494,7 +494,12 @@
66 */
67 if (draw_contents_) {
68 glEnable(GL_BLEND);
69- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
70+ /*
71+ * Blend the colors normally, but don't change the
72+ * destination alpha value.
73+ */
74+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
75+ GL_ZERO, GL_ONE);
76 window_contents_.position(position());
77 window_contents_.render_to(target);
78 glDisable(GL_BLEND);
79@@ -658,7 +663,12 @@
80 virtual void render_to(RenderObject& target)
81 {
82 glEnable(GL_BLEND);
83- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
84+ /*
85+ * Blend the colors normally, but don't change the
86+ * destination alpha value.
87+ */
88+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
89+ GL_ZERO, GL_ONE);
90
91 /* Bottom shadow */
92 shadow_h_.rotation(0.0);
93
94=== modified file 'src/scene-pulsar.cpp'
95--- src/scene-pulsar.cpp 2011-12-08 11:09:09 +0000
96+++ src/scene-pulsar.cpp 2012-05-07 13:02:18 +0000
97@@ -79,7 +79,8 @@
98 glDisable(GL_CULL_FACE);
99 // Enable alpha blending
100 glEnable(GL_BLEND);
101- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
102+ // Blend the colors normally, but don't change the destination alpha value.
103+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE);
104
105 // Create a rotation for each quad.
106 numQuads_ = Util::fromString<int>(options_["quads"].value);

Subscribers

People subscribed via source and target branches