summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-06-09 17:11:50 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-06-11 13:51:42 -0700
commit7f1ab834d7aa901ce0e12f40db23d7d9891eae59 (patch)
tree30a99c3c4804bc7005ec27a0904c56fbfa220ca1
parent93073551f9fff0df5ad1f65e0f483e6699474b91 (diff)
ir_constant: Add storage for multiple constants for arrays and records
-rw-r--r--ir.cpp20
-rw-r--r--ir.h2
2 files changed, 20 insertions, 2 deletions
diff --git a/ir.cpp b/ir.cpp
index 759bf9f804..b60d1b468a 100644
--- a/ir.cpp
+++ b/ir.cpp
@@ -244,8 +244,24 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list)
{
this->type = type;
- /* FINISHME: Support structure and array types. */
- assert(type->is_scalar() || type->is_vector() || type->is_matrix());
+ /* FINISHME: Support array types. */
+ assert(type->is_scalar() || type->is_vector() || type->is_matrix()
+ || type->is_record());
+
+ /* If the constant is a record, the types of each of the entries in
+ * value_list must be a 1-for-1 match with the structure components. Each
+ * entry must also be a constant. Just move the nodes from the value_list
+ * to the list in the ir_constant.
+ */
+ /* FINISHME: Should there be some type checking and / or assertions here? */
+ /* FINISHME: Should the new constant take ownership of the nodes from
+ * FINISHME: value_list, or should it make copies?
+ */
+ if (type->is_record()) {
+ value_list->move_nodes_to(& this->components);
+ return;
+ }
+
ir_constant *value = (ir_constant *) (value_list->head);
diff --git a/ir.h b/ir.h
index 60164a5ab1..8fd823db09 100644
--- a/ir.h
+++ b/ir.h
@@ -1087,6 +1087,8 @@ public:
float f[16];
bool b[16];
} value;
+
+ exec_list components;
};
void