[Mesa-dev] [PATCH] - main/ff_fragment_shader.cpp

Han Shen(沈涵) shenhan at google.com
Fri May 25 10:51:31 PDT 2012


Hi I am working on chromium, and while I was compiling mesa trunk
using gcc 4.7, I had to add explicit type cast for narrower conversion
inside the initialization list.

Could you take a look at the patch and upstream it if it is ok to you? Thanks,
-Han

diff --git a/src/mesa/main/ff_fragment_shader.cpp
b/src/mesa/main/ff_fragment_shader.cpp
index 0233f38..5a6041a 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -887,10 +887,10 @@ emit_texenv(struct texenv_fragment_program *p,
GLuint unit)
       }
       else {
  float const_data[4] = {
-    1 << rgb_shift,
-    1 << rgb_shift,
-    1 << rgb_shift,
-    1 << alpha_shift
+    static_cast<float>(1 << rgb_shift),
+    static_cast<float>(1 << rgb_shift),
+    static_cast<float>(1 << rgb_shift),
+    static_cast<float>(1 << alpha_shift)
  };
  shift = new(p->mem_ctx) ir_constant(glsl_type::vec4_type,
      (ir_constant_data *)const_data);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mesa-narrower-conversion.patch
Type: application/octet-stream
Size: 705 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120525/c73fbc49/attachment.obj>


More information about the mesa-dev mailing list