Mesa (master): glsl: use new interfaces for 64-bit checks.

Dave Airlie airlied at kemper.freedesktop.org
Wed Jun 8 21:44:14 UTC 2016


Module: Mesa
Branch: master
Commit: 35616a9e0ef0511ebb77e7076c00f2eeb248933a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=35616a9e0ef0511ebb77e7076c00f2eeb248933a

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Jun  9 07:02:07 2016 +1000

glsl: use new interfaces for 64-bit checks.

This is just prep work for int64 support, changing
places where 64-bit matters no doubles.

Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/compiler/glsl/ast_to_hir.cpp                |  4 ++--
 src/compiler/glsl/link_uniform_initializers.cpp |  2 +-
 src/compiler/glsl/link_varyings.cpp             |  4 ++--
 src/compiler/glsl/lower_buffer_access.cpp       | 12 ++++++------
 src/compiler/glsl/lower_packed_varyings.cpp     |  6 +++---
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index b7192b2..1c751f6 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -3393,7 +3393,7 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual,
                 (qual_component + components - 1) > 3) {
                _mesa_glsl_error(loc, state, "component overflow (%u > 3)",
                                 (qual_component + components - 1));
-            } else if (qual_component == 1 && type->is_double()) {
+            } else if (qual_component == 1 && type->is_64bit()) {
                /* We don't bother checking for 3 as it should be caught by the
                 * overflow check above.
                 */
@@ -6843,7 +6843,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
             }
          } else {
             if (layout && layout->flags.q.explicit_xfb_offset) {
-               unsigned align = field_type->is_double() ? 8 : 4;
+               unsigned align = field_type->is_64bit() ? 8 : 4;
                fields[i].offset = glsl_align(block_xfb_offset, align);
                block_xfb_offset +=
                   MAX2(xfb_stride, (int) (4 * field_type->component_slots()));
diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp
index bf6d394..acf8222 100644
--- a/src/compiler/glsl/link_uniform_initializers.cpp
+++ b/src/compiler/glsl/link_uniform_initializers.cpp
@@ -222,7 +222,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
 	 val->array_elements[0]->type->base_type;
       const unsigned int elements = val->array_elements[0]->type->components();
       unsigned int idx = 0;
-      unsigned dmul = (base_type == GLSL_TYPE_DOUBLE) ? 2 : 1;
+      unsigned dmul = glsl_base_type_is_64bit(base_type) ? 2 : 1;
 
       assert(val->type->length >= storage->array_elements);
       for (unsigned int i = 0; i < storage->array_elements; i++) {
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 5a5adc0..99fb3fc 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -403,7 +403,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
              */
             last_comp = 4;
          } else {
-            unsigned dmul = var->type->is_double() ? 2 : 1;
+            unsigned dmul = var->type->is_64bit() ? 2 : 1;
             last_comp = var->data.location_frac +
                var->type->without_array()->vector_elements * dmul;
          }
@@ -708,7 +708,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
       + this->matched_candidate->toplevel_var->data.location_frac
       + this->matched_candidate->offset;
    const unsigned dmul =
-      this->matched_candidate->type->without_array()->is_double() ? 2 : 1;
+      this->matched_candidate->type->without_array()->is_64bit() ? 2 : 1;
 
    if (this->matched_candidate->type->is_array()) {
       /* Array variable */
diff --git a/src/compiler/glsl/lower_buffer_access.cpp b/src/compiler/glsl/lower_buffer_access.cpp
index bdfabab..69dc82b 100644
--- a/src/compiler/glsl/lower_buffer_access.cpp
+++ b/src/compiler/glsl/lower_buffer_access.cpp
@@ -114,7 +114,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
             /* For a row-major matrix, the next column starts at the next
              * element.
              */
-            int size_mul = deref->type->is_double() ? 8 : 4;
+            int size_mul = deref->type->is_64bit() ? 8 : 4;
             emit_access(mem_ctx, is_write, col_deref, base_offset,
                         deref_offset + i * size_mul,
                         row_major, deref->type->matrix_columns, packing,
@@ -125,7 +125,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
             /* std430 doesn't round up vec2 size to a vec4 size */
             if (packing == GLSL_INTERFACE_PACKING_STD430 &&
                 deref->type->vector_elements == 2 &&
-                !deref->type->is_double()) {
+                !deref->type->is_64bit()) {
                size_mul = 8;
             } else {
                /* std140 always rounds the stride of arrays (and matrices) to a
@@ -137,7 +137,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
                 * machine units, the base alignment is 4N. For vec4, base
                 * alignment is 4N.
                 */
-               size_mul = (deref->type->is_double() &&
+               size_mul = (deref->type->is_64bit() &&
                            deref->type->vector_elements > 2) ? 32 : 16;
             }
 
@@ -159,7 +159,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
          is_write ? write_mask : (1 << deref->type->vector_elements) - 1;
       insert_buffer_access(mem_ctx, deref, deref->type, offset, mask, -1);
    } else {
-      unsigned N = deref->type->is_double() ? 8 : 4;
+      unsigned N = deref->type->is_64bit() ? 8 : 4;
 
       /* We're dereffing a column out of a row-major matrix, so we
        * gather the vector from each stored row.
@@ -358,7 +358,7 @@ lower_buffer_access::setup_buffer_access(void *mem_ctx,
              * thread or SIMD channel is modifying the same vector.
              */
             array_stride = 4;
-            if (deref_array->array->type->is_double())
+            if (deref_array->array->type->is_64bit())
                array_stride *= 2;
          } else if (deref_array->array->type->is_matrix() && *row_major) {
             /* When loading a vector out of a row major matrix, the
@@ -367,7 +367,7 @@ lower_buffer_access::setup_buffer_access(void *mem_ctx,
              * vector) is handled below in emit_ubo_loads.
              */
             array_stride = 4;
-            if (deref_array->array->type->is_double())
+            if (deref_array->array->type->is_64bit())
                array_stride *= 2;
             *matrix_columns = deref_array->array->type->matrix_columns;
          } else if (deref_array->type->without_array()->is_interface()) {
diff --git a/src/compiler/glsl/lower_packed_varyings.cpp b/src/compiler/glsl/lower_packed_varyings.cpp
index 41edada..130b8f6 100644
--- a/src/compiler/glsl/lower_packed_varyings.cpp
+++ b/src/compiler/glsl/lower_packed_varyings.cpp
@@ -432,7 +432,7 @@ lower_packed_varyings_visitor::lower_rvalue(ir_rvalue *rvalue,
                                             bool gs_input_toplevel,
                                             unsigned vertex_index)
 {
-   unsigned dmul = rvalue->type->is_double() ? 2 : 1;
+   unsigned dmul = rvalue->type->is_64bit() ? 2 : 1;
    /* When gs_input_toplevel is set, we should be looking at a geometry shader
     * input array.
     */
@@ -480,7 +480,7 @@ lower_packed_varyings_visitor::lower_rvalue(ir_rvalue *rvalue,
       char right_swizzle_name[4] = { 0, 0, 0, 0 };
 
       left_components = 4 - fine_location % 4;
-      if (rvalue->type->is_double()) {
+      if (rvalue->type->is_64bit()) {
          /* We might actually end up with 0 left components! */
          left_components /= 2;
       }
@@ -676,7 +676,7 @@ lower_packed_varyings_visitor::needs_lowering(ir_variable *var)
       return false;
 
    type = type->without_array();
-   if (type->vector_elements == 4 && !type->is_double())
+   if (type->vector_elements == 4 && !type->is_64bit())
       return false;
    return true;
 }




More information about the mesa-commit mailing list