summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-11-10 16:33:10 -0800
committerIan Romanick <ian.d.romanick@intel.com>2010-11-19 15:00:25 -0800
commitfc92e87b9757eda01caf0bb3e2c31b1dbbd73aa0 (patch)
tree0166f7ad2f9b19794f8a65b0b050fe4dc4cd083a /src/mesa
parentf2616e56de8a48360cae8f269727b58490555f4d (diff)
glsl: Eliminate assumptions about size of ir_expression::operands
This may grow in the near future.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp3
-rw-r--r--src/mesa/program/ir_to_mesa.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 164f89eace..105327c7fe 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -708,6 +708,7 @@ fs_visitor::visit(ir_expression *ir)
fs_reg op[2], temp;
fs_inst *inst;
+ assert(ir->get_num_operands() <= 2);
for (operand = 0; operand < ir->get_num_operands(); operand++) {
ir->operands[operand]->accept(this);
if (this->result.file == BAD_FILE) {
@@ -1387,6 +1388,7 @@ fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir)
fs_reg op[2];
fs_inst *inst;
+ assert(expr->get_num_operands() <= 2);
for (unsigned int i = 0; i < expr->get_num_operands(); i++) {
assert(expr->operands[i]->type->is_scalar());
@@ -1494,6 +1496,7 @@ fs_visitor::emit_if_gen6(ir_if *ir)
fs_inst *inst;
fs_reg temp;
+ assert(expr->get_num_operands() <= 2);
for (unsigned int i = 0; i < expr->get_num_operands(); i++) {
assert(expr->operands[i]->type->is_scalar());
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index ef9f692f94..1b5337e92e 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -961,7 +961,7 @@ void
ir_to_mesa_visitor::visit(ir_expression *ir)
{
unsigned int operand;
- struct ir_to_mesa_src_reg op[2];
+ struct ir_to_mesa_src_reg op[Elements(ir->operands)];
struct ir_to_mesa_src_reg result_src;
struct ir_to_mesa_dst_reg result_dst;