Make ir_function::signatures private
[mesa.git] / ir.cpp
diff --git a/ir.cpp b/ir.cpp
index c4c7584bcfab72d35adc74dce3267fb44c001746..90df67bbf1dcd8388d0186661b2ec790bd0bc0dd 100644 (file)
--- a/ir.cpp
+++ b/ir.cpp
@@ -57,9 +57,6 @@ ir_label::ir_label(const char *label)
 ir_constant::ir_constant(const struct glsl_type *type, const void *data)
    : ir_rvalue()
 {
-   const unsigned elements = 
-      ((type->vector_elements == 0) ? 1 : type->vector_elements)
-      * ((type->matrix_columns == 0) ? 1 : type->matrix_columns);
    unsigned size = 0;
 
    this->type = type;
@@ -74,7 +71,35 @@ ir_constant::ir_constant(const struct glsl_type *type, const void *data)
       break;
    }
 
-   memcpy(& this->value, data, size * elements);
+   memcpy(& this->value, data, size * type->components());
+}
+
+ir_constant::ir_constant(float f)
+   : ir_rvalue()
+{
+   this->type = glsl_type::float_type;
+   this->value.f[0] = f;
+}
+
+ir_constant::ir_constant(unsigned int u)
+   : ir_rvalue()
+{
+   this->type = glsl_type::uint_type;
+   this->value.u[0] = u;
+}
+
+ir_constant::ir_constant(int i)
+   : ir_rvalue()
+{
+   this->type = glsl_type::int_type;
+   this->value.i[0] = i;
+}
+
+ir_constant::ir_constant(bool b)
+   : ir_rvalue()
+{
+   this->type = glsl_type::bool_type;
+   this->value.b[0] = b;
 }
 
 
@@ -215,6 +240,9 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name)
 {
    this->type = type;
    this->name = name;
+
+   if (type && type->base_type == GLSL_TYPE_SAMPLER)
+      this->read_only = true;
 }