diff options
author | Eric Anholt <eric@anholt.net> | 2010-03-26 12:07:44 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-26 17:51:41 -0700 |
commit | 3c36b2df7c854d23b2be9580e416fb04079a1bef (patch) | |
tree | d951374859ea0698216028ee7ca57c03c56a4ba9 /ir.cpp | |
parent | 48a0e64b7d6a4308f9c691e5844165ec97f8282e (diff) |
Add constructors for immediate hir constants.
This will make ast_to_hir for inc/dec easier.
Diffstat (limited to 'ir.cpp')
-rw-r--r-- | ir.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -74,6 +74,34 @@ ir_constant::ir_constant(const struct glsl_type *type, const void *data) 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; +} + ir_dereference::ir_dereference(ir_instruction *var) : ir_rvalue() |