name);
}
+ /* Get the precision for the return type */
+ unsigned return_precision;
+
+ if (state->es_shader) {
+ YYLTYPE loc = this->get_location();
+ return_precision =
+ select_gles_precision(this->return_type->qualifier.precision,
+ return_type,
+ state,
+ &loc);
+ } else {
+ return_precision = GLSL_PRECISION_NONE;
+ }
/* Create an ir_function if one doesn't already exist. */
f = state->symbols->get_function(name);
"match prototype", name);
}
+ if (sig->return_precision != return_precision) {
+ YYLTYPE loc = this->get_location();
+
+ _mesa_glsl_error(&loc, state, "function `%s' return type precision "
+ "doesn't match prototype", name);
+ }
+
if (sig->is_defined) {
if (is_definition) {
YYLTYPE loc = this->get_location();
*/
if (sig == NULL) {
sig = new(ctx) ir_function_signature(return_type);
+ sig->return_precision = return_precision;
f->add_signature(sig);
}
builtin_available_predicate b)
: ir_instruction(ir_type_function_signature),
return_type(return_type), is_defined(false),
+ return_precision(GLSL_PRECISION_NONE),
intrinsic_id(ir_intrinsic_invalid), builtin_avail(b), _function(NULL)
{
this->origin = NULL;
/**
* Function return type.
*
- * \note This discards the optional precision qualifier.
+ * \note The precision qualifier is stored separately in return_precision.
*/
const struct glsl_type *return_type;
/** Whether or not this function has a body (which may be empty). */
unsigned is_defined:1;
+ /*
+ * Precision qualifier for the return type.
+ *
+ * See the comment for ir_variable_data::precision for more details.
+ */
+ unsigned return_precision:2;
+
/** Whether or not this function signature is a built-in. */
bool is_builtin() const;