diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 205: Ensure that the framebuffer is drawn opaquely.

Message ID 20120508103309.26779.84403.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org May 8, 2012, 10:33 a.m. UTC
------------------------------------------------------------
revno: 205
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
branch nick: opaque-framebuffer
timestamp: Mon 2012-05-07 15:45:34 +0300
message:
  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.
modified:
  data/shaders/desktop-blur.frag
  data/shaders/effect-2d-convolution.frag
  data/shaders/light-advanced.frag
  data/shaders/light-basic.vert
  src/canvas-x11.cpp
  src/scene-desktop.cpp
  src/scene-pulsar.cpp


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'data/shaders/desktop-blur.frag'
--- data/shaders/desktop-blur.frag	2011-09-14 16:53:37 +0000
+++ data/shaders/desktop-blur.frag	2012-05-07 12:45:34 +0000
@@ -8,6 +8,6 @@ 
 
     $CONVOLUTION$
 
-    gl_FragColor = result;
+    gl_FragColor = vec4(result.xyz, 1.0);
 }
 

=== modified file 'data/shaders/effect-2d-convolution.frag'
--- data/shaders/effect-2d-convolution.frag	2011-09-14 16:53:37 +0000
+++ data/shaders/effect-2d-convolution.frag	2012-05-07 12:45:34 +0000
@@ -7,6 +7,6 @@ 
 
     $CONVOLUTION$
 
-    gl_FragColor = result;
+    gl_FragColor = vec4(result.xyz, 1.0);
 }
 

=== modified file 'data/shaders/light-advanced.frag'
--- data/shaders/light-advanced.frag	2011-10-11 09:51:17 +0000
+++ data/shaders/light-advanced.frag	2012-05-07 12:45:34 +0000
@@ -29,5 +29,5 @@ 
                     pow(max(dot(N,H), 0.0), MaterialShininess);
 
     // Calculate the final color
-    gl_FragColor = ambient + specular + diffuse;
+    gl_FragColor = vec4((ambient + specular + diffuse).xyz, 1.0);
 }

=== modified file 'data/shaders/light-basic.vert'
--- data/shaders/light-basic.vert	2011-10-11 09:51:17 +0000
+++ data/shaders/light-basic.vert	2012-05-07 12:45:34 +0000
@@ -19,7 +19,7 @@ 
     // Multiply the diffuse value by the vertex color (which is fixed in this case)
     // to get the actual color that we will use to draw this vertex with
     float diffuse = max(dot(N, L), 0.0);
-    Color = diffuse * MaterialDiffuse;
+    Color = vec4(diffuse * MaterialDiffuse.rgb, MaterialDiffuse.a);
 
     // Set the texture coordinates as a varying
     TextureCoord = texcoord;

=== modified file 'src/canvas-x11.cpp'
--- src/canvas-x11.cpp	2012-03-20 12:55:49 +0000
+++ src/canvas-x11.cpp	2012-05-07 12:45:34 +0000
@@ -87,7 +87,7 @@ 
 void
 CanvasX11::clear()
 {
-    glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
+    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
 #if USE_GL
     glClearDepth(1.0f);
 #elif USE_GLESv2

=== modified file 'src/scene-desktop.cpp'
--- src/scene-desktop.cpp	2012-03-12 15:32:07 +0000
+++ src/scene-desktop.cpp	2012-05-07 12:45:34 +0000
@@ -494,7 +494,12 @@ 
          */
         if (draw_contents_) {
             glEnable(GL_BLEND);
-            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+            /*
+             * Blend the colors normally, but don't change the
+             * destination alpha value.
+             */
+            glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
+                                GL_ZERO, GL_ONE);
             window_contents_.position(position());
             window_contents_.render_to(target);
             glDisable(GL_BLEND);
@@ -658,7 +663,12 @@ 
     virtual void render_to(RenderObject& target)
     {
         glEnable(GL_BLEND);
-        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+        /*
+         * Blend the colors normally, but don't change the
+         * destination alpha value.
+         */
+        glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
+                            GL_ZERO, GL_ONE);
 
         /* Bottom shadow */
         shadow_h_.rotation(0.0);

=== modified file 'src/scene-pulsar.cpp'
--- src/scene-pulsar.cpp	2011-12-08 11:09:09 +0000
+++ src/scene-pulsar.cpp	2012-05-07 12:45:34 +0000
@@ -79,7 +79,8 @@ 
     glDisable(GL_CULL_FACE);
     // Enable alpha blending
     glEnable(GL_BLEND);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    // Blend the colors normally, but don't change the destination alpha value.
+    glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE);
 
     // Create a rotation for each quad.
     numQuads_ = Util::fromString<int>(options_["quads"].value);