ast->set_is_lhs(true);
ir_rvalue *result = ast->hir(instructions, state);
+ /* Error happened processing function parameter */
+ if (!result) {
+ actual_parameters->push_tail(ir_rvalue::error_value(mem_ctx));
+ count++;
+ continue;
+ }
+
ir_constant *const constant =
result->constant_expression_value(mem_ctx);
const ast_expression *const actual_ast =
exec_node_data(ast_expression, actual_ast_node, link);
- /* FIXME: 'loc' is incorrect (as of 2011-01-21). It is always
- * FIXME: 0:0(0).
- */
YYLTYPE loc = actual_ast->get_location();
/* Verify that 'const_in' parameters are ir_constants. */
ir_call *call = new(ctx) ir_call(sig, deref,
actual_parameters, sub_var, array_idx);
instructions->push_tail(call);
- if (sig->is_builtin()) {
- /* inline immediately */
- call->generate_inline(call);
- call->remove();
- }
/* Also emit any necessary out-parameter conversions. */
instructions->append_list(&post_call_conversions);
}
/* Local shader has no exact candidates; check the built-ins. */
- _mesa_glsl_initialize_builtin_functions();
sig = _mesa_glsl_find_builtin_function(state, name, actual_parameters);
/* if _mesa_glsl_find_builtin_function failed, fall back to the result
}
}
+static bool
+function_exists(_mesa_glsl_parse_state *state,
+ struct glsl_symbol_table *symbols, const char *name)
+{
+ ir_function *f = symbols->get_function(name);
+ if (f != NULL) {
+ foreach_in_list(ir_function_signature, sig, &f->signatures) {
+ if (sig->is_builtin() && !sig->is_builtin_available(state))
+ continue;
+ return true;
+ }
+ }
+ return false;
+}
+
static void
print_function_prototypes(_mesa_glsl_parse_state *state, YYLTYPE *loc,
ir_function *f)
{
gl_shader *sh = _mesa_glsl_get_builtin_function_shader();
- if (state->symbols->get_function(name) == NULL
+ if (!function_exists(state, state->symbols, name)
&& (!state->uses_builtin_functions
- || sh->symbols->get_function(name) == NULL)) {
+ || !function_exists(state, sh->symbols, name))) {
_mesa_glsl_error(loc, state, "no function with name '%s'", name);
} else {
char *str = prototype_string(NULL, name, actual_parameters);
}
if (constructor_type->is_array()) {
- if (!state->check_version(120, 300, &loc,
- "array constructors forbidden")) {
+ if (!state->check_version(state->allow_glsl_120_subset_in_110 ? 110 : 120,
+ 300, &loc, "array constructors forbidden")) {
return ir_rvalue::error_value(ctx);
}