const glsl_type *const glsl_type::bool_type = & builtin_core_types[0];
const glsl_type *const glsl_type::int_type = & builtin_core_types[4];
+const glsl_type *const glsl_type::ivec4_type = & builtin_core_types[7];
const glsl_type *const glsl_type::float_type = & builtin_core_types[8];
const glsl_type *const glsl_type::vec2_type = & builtin_core_types[9];
const glsl_type *const glsl_type::vec3_type = & builtin_core_types[10];
};
const glsl_type *const glsl_type::uint_type = & builtin_130_types[0];
+const glsl_type *const glsl_type::uvec4_type = & builtin_130_types[3];
/*@}*/
/** \name Sampler types added by GL_ARB_texture_rectangle
/*@{*/
static const glsl_type *const error_type;
static const glsl_type *const int_type;
+ static const glsl_type *const ivec4_type;
static const glsl_type *const uint_type;
+ static const glsl_type *const uvec4_type;
static const glsl_type *const float_type;
static const glsl_type *const vec2_type;
static const glsl_type *const vec3_type;
}
+void
+ir_texture::set_sampler(ir_dereference *sampler)
+{
+ assert(sampler != NULL);
+ this->sampler = sampler;
+
+ switch (sampler->type->sampler_type) {
+ case GLSL_TYPE_FLOAT:
+ this->type = glsl_type::vec4_type;
+ break;
+ case GLSL_TYPE_INT:
+ this->type = glsl_type::ivec4_type;
+ break;
+ case GLSL_TYPE_UINT:
+ this->type = glsl_type::uvec4_type;
+ break;
+ }
+}
+
+
ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z,
unsigned w, unsigned count)
: val(val)
*/
const char *opcode_string();
+ /** Set the sampler and infer the type. */
+ void set_sampler(ir_dereference *sampler);
+
/**
* Do a reverse-lookup to translate a string into an ir_texture_opcode.
*/
// Read sampler (must be a deref)
s_expression *sampler_expr = (s_expression *) tag->next;
- tex->sampler = read_dereference(st, sampler_expr);
- if (tex->sampler == NULL) {
+ ir_dereference *sampler = read_dereference(st, sampler_expr);
+ if (sampler == NULL) {
ir_read_error(st, NULL, "when reading sampler in (%s ...)", tag->value());
return NULL;
}
+ tex->set_sampler(sampler);
// Read coordinate (any rvalue)
s_expression *coordinate_expr = (s_expression *) sampler_expr->next;