glsl/ir_reader: Make sure constants have the right number of components.

The list of numbers in (constant type (<numbers>)) needs to contain
exactly type->components() numbers (16 for a mat4, 3 for a vec3, etc.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Kenneth Graunke 2011-09-05 12:03:29 -07:00
parent 6afce988a9
commit 8ceb235c9c

View file

@ -820,6 +820,11 @@ ir_reader::read_constant(s_expression *expr)
}
++k;
}
if (k != type->components()) {
ir_read_error(values, "expected %d constant values, found %d",
type->components(), k);
return NULL;
}
return new(mem_ctx) ir_constant(type, &data);
}