* DEALINGS IN THE SOFTWARE.
*/
#include <string.h>
-#include "main/imports.h"
-#include "main/macros.h"
+#include "main/core.h" /* for MAX2 */
#include "ir.h"
#include "ir_visitor.h"
#include "glsl_types.h"
1, /* ir_unop_i2b */
1, /* ir_unop_b2i */
1, /* ir_unop_u2f */
+ 1, /* ir_unop_any */
1, /* ir_unop_trunc */
1, /* ir_unop_ceil */
"i2b",
"b2i",
"u2f",
+ "any",
"trunc",
"ceil",
"floor",
this->ir_type = ir_type_constant;
this->type = glsl_type::float_type;
this->value.f[0] = f;
+ for (int i = 1; i < 16; i++) {
+ this->value.f[i] = 0;
+ }
}
ir_constant::ir_constant(unsigned int u)
this->ir_type = ir_type_constant;
this->type = glsl_type::uint_type;
this->value.u[0] = u;
+ for (int i = 1; i < 16; i++) {
+ this->value.u[i] = 0;
+ }
}
ir_constant::ir_constant(int i)
this->ir_type = ir_type_constant;
this->type = glsl_type::int_type;
this->value.i[0] = i;
+ for (int i = 1; i < 16; i++) {
+ this->value.i[i] = 0;
+ }
}
ir_constant::ir_constant(bool b)
this->ir_type = ir_type_constant;
this->type = glsl_type::bool_type;
this->value.b[0] = b;
+ for (int i = 1; i < 16; i++) {
+ this->value.b[i] = false;
+ }
}
ir_constant::ir_constant(const ir_constant *c, unsigned i)
return;
}
+ for (unsigned i = 0; i < 16; i++) {
+ this->value.u[i] = 0;
+ }
ir_constant *value = (ir_constant *) (value_list->head);
? this->record->type->field_type(field) : glsl_type::error_type;
}
+bool type_contains_sampler(const glsl_type *type)
+{
+ if (type->is_array()) {
+ return type_contains_sampler(type->fields.array);
+ } else if (type->is_record()) {
+ for (unsigned int i = 0; i < type->length; i++) {
+ if (type_contains_sampler(type->fields.structure[i].type))
+ return true;
+ }
+ return false;
+ } else {
+ return type->is_sampler();
+ }
+}
bool
ir_dereference::is_lvalue()
if (this->type->is_array() && !var->array_lvalue)
return false;
+ /* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
+ *
+ * "Samplers cannot be treated as l-values; hence cannot be used
+ * as out or inout function parameters, nor can they be
+ * assigned into."
+ */
+ if (type_contains_sampler(this->type))
+ return false;
+
return true;
}
: return_type(return_type), is_defined(false), _function(NULL)
{
this->ir_type = ir_type_function_signature;
- this->is_built_in = false;
}
{
this->ir_type = ir_type_function;
this->name = talloc_strdup(this, name);
+ this->is_builtin = false;
}