Convert is_glsl_type_vector to glsl_type::is_vector
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 9 Mar 2010 23:55:16 +0000 (15:55 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 9 Mar 2010 23:55:16 +0000 (15:55 -0800)
ast_to_hir.cpp
glsl_types.h
hir_field_selection.cpp

index 8feeab6..1de5824 100644 (file)
@@ -136,7 +136,7 @@ arithmetic_result_type(const struct glsl_type *type_a,
     *      operation is done component-wise resulting in the same size
     *      vector."
     */
-   if (is_glsl_type_vector(type_a) && is_glsl_type_vector(type_b)) {
+   if (type_a->is_vector() && type_b->is_vector()) {
       if (type_a->vector_elements == type_b->vector_elements)
         return type_a;
       else
@@ -261,8 +261,8 @@ modulus_result_type(const struct glsl_type *type_a,
     *    wise to the vector, resulting in the same type as the vector. If both
     *    are vectors of the same size, the result is computed component-wise."
     */
-   if (is_glsl_type_vector(type_a)) {
-      if (!is_glsl_type_vector(type_b)
+   if (type_a->is_vector()) {
+      if (!type_b->is_vector()
          || (type_a->vector_elements == type_b->vector_elements))
         return type_a;
    } else
index 0375934..2b66016 100644 (file)
@@ -145,13 +145,18 @@ struct glsl_type {
         && (base_type >= GLSL_TYPE_UINT)
         && (base_type <= GLSL_TYPE_BOOL);
    }
-};
 
-#define is_glsl_type_vector(t)                 \
-   (((t)->vector_elements > 0)                 \
-    && ((t)->matrix_rows == 0)                 \
-    && ((t)->base_type >= GLSL_TYPE_UINT)      \
-    && ((t)->base_type <= GLSL_TYPE_BOOL))
+   /**
+    * Query whether or not a type is a vector
+    */
+   bool is_vector() const
+   {
+      return (vector_elements > 0)
+        && (matrix_rows == 0)
+        && (base_type >= GLSL_TYPE_UINT)
+        && (base_type <= GLSL_TYPE_BOOL);
+   }
+};
 
 #define is_glsl_type_matrix(t)                 \
    (((t)->matrix_rows > 0)                     \
index 326a105..8bef094 100644 (file)
@@ -156,7 +156,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
     * being applied.
     */
    loc = expr->get_location();
-   if (is_glsl_type_vector(op->type)) {
+   if (op->type->is_vector()) {
       if (generate_swizzle(expr->primary_expression.identifier, 
                           & deref->selector.swizzle,
                           op->type->vector_elements)) {