new(ctx) ir_dereference_variable(mvp),
new(ctx) ir_dereference_variable(vtx));
} else {
+ bool is_begin_interlock = false;
+ bool is_end_interlock = false;
+ if (sig->is_builtin() &&
+ state->stage == MESA_SHADER_FRAGMENT &&
+ state->ARB_fragment_shader_interlock_enable) {
+ is_begin_interlock = strcmp(func_name, "beginInvocationInterlockARB") == 0;
+ is_end_interlock = strcmp(func_name, "endInvocationInterlockARB") == 0;
+ }
+
if (sig->is_builtin() &&
((state->stage == MESA_SHADER_TESS_CTRL &&
strcmp(func_name, "barrier") == 0) ||
- (state->stage == MESA_SHADER_FRAGMENT &&
- state->ARB_fragment_shader_interlock_enable &&
- (strcmp(func_name, "beginInvocationInterlockARB") == 0 ||
- strcmp(func_name, "endInvocationInterlockARB") == 0)))) {
+ is_begin_interlock || is_end_interlock)) {
if (state->current_function == NULL ||
strcmp(state->current_function->function_name(), "main") != 0) {
_mesa_glsl_error(&loc, state,
}
}
+ /* There can be only one begin/end interlock pair in the function. */
+ if (is_begin_interlock) {
+ if (state->found_begin_interlock)
+ _mesa_glsl_error(&loc, state,
+ "beginInvocationInterlockARB may not be used twice");
+ state->found_begin_interlock = true;
+ } else if (is_end_interlock) {
+ if (!state->found_begin_interlock)
+ _mesa_glsl_error(&loc, state,
+ "endInvocationInterlockARB may not be used "
+ "before beginInvocationInterlockARB");
+ if (state->found_end_interlock)
+ _mesa_glsl_error(&loc, state,
+ "endInvocationInterlockARB may not be used twice");
+ state->found_end_interlock = true;
+ }
+
value = generate_call(instructions, sig, &actual_parameters, sub_var,
array_idx, state);
if (!value) {