Add constructors for immediate hir constants.
This will make ast_to_hir for inc/dec easier.
This commit is contained in:

committed by
Ian Romanick

parent
48a0e64b7d
commit
3c36b2df7c
28
ir.cpp
28
ir.cpp
@@ -74,6 +74,34 @@ ir_constant::ir_constant(const struct glsl_type *type, const void *data)
|
|||||||
memcpy(& this->value, data, size * type->components());
|
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_dereference::ir_dereference(ir_instruction *var)
|
||||||
: ir_rvalue()
|
: ir_rvalue()
|
||||||
|
4
ir.h
4
ir.h
@@ -481,6 +481,10 @@ public:
|
|||||||
class ir_constant : public ir_rvalue {
|
class ir_constant : public ir_rvalue {
|
||||||
public:
|
public:
|
||||||
ir_constant(const struct glsl_type *type, const void *data);
|
ir_constant(const struct glsl_type *type, const void *data);
|
||||||
|
ir_constant(bool b);
|
||||||
|
ir_constant(unsigned int u);
|
||||||
|
ir_constant(int i);
|
||||||
|
ir_constant(float f);
|
||||||
|
|
||||||
virtual void accept(ir_visitor *v)
|
virtual void accept(ir_visitor *v)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user