[Mesa-dev] [PATCH] glsl: add support for doubles in GL 4.4+

Timothy Arceri timothy.arceri at collabora.com
Mon May 23 02:41:03 UTC 2016


We disable varying packing in GL 4.4+ as we can no longer assume
varying have the same interpolation qualifiers. However doubles used
as fs inputs must always be qualified as "flat" and backends expect
doubles to have been packed as floats so we enable packing for them.
---
 src/compiler/glsl/lower_packed_varyings.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/lower_packed_varyings.cpp b/src/compiler/glsl/lower_packed_varyings.cpp
index 41edada..ab4028a 100644
--- a/src/compiler/glsl/lower_packed_varyings.cpp
+++ b/src/compiler/glsl/lower_packed_varyings.cpp
@@ -667,10 +667,14 @@ lower_packed_varyings_visitor::needs_lowering(ir_variable *var)
    /* Override disable_varying_packing if the var is only used by transform
     * feedback. Also override it if transform feedback is enabled and the
     * variable is an array, struct or matrix as the elements of these types
-    * will always has the same interpolation and therefore asre safe to pack.
+    * will always has the same interpolation and therefore are safe to pack.
+    *
+    * We also override disable_varying_packing for doubles used as fs inputs
+    * must always be qualified as "flat".
     */
    const glsl_type *type = var->type;
    if (disable_varying_packing && !var->data.is_xfb_only &&
+       !type->without_array()->is_double() &&
        !((type->is_array() || type->is_record() || type->is_matrix()) &&
          xfb_enabled))
       return false;
-- 
2.5.5



More information about the mesa-dev mailing list