Mesa (master): glsl: Make interlock builtins follow same compiler rules as barriers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 10 22:01:13 UTC 2019


Module: Mesa
Branch: master
Commit: b7c9fc72fddd76679ca3248dfd0540c69f1790da
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7c9fc72fddd76679ca3248dfd0540c69f1790da

Author: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Date:   Wed Jun  5 00:59:11 2019 -0700

glsl: Make interlock builtins follow same compiler rules as barriers

Generalize the barrier code to provide correct error messages for
other builtins.

Fixes most of piglit compilation tests for
ARB_fragment_shader_interlock.

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Plamena Manolova <plamena.manolova at intel.com>

---

 src/compiler/glsl/ast_function.cpp | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index 6bd8987cd9b..a35bd63fa41 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -2387,22 +2387,27 @@ ast_function_expression::hir(exec_list *instructions,
                                         new(ctx) ir_dereference_variable(mvp),
                                         new(ctx) ir_dereference_variable(vtx));
       } else {
-         if (state->stage == MESA_SHADER_TESS_CTRL &&
-             sig->is_builtin() && strcmp(func_name, "barrier") == 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)))) {
             if (state->current_function == NULL ||
                 strcmp(state->current_function->function_name(), "main") != 0) {
                _mesa_glsl_error(&loc, state,
-                                "barrier() may only be used in main()");
+                                "%s() may only be used in main()", func_name);
             }
 
             if (state->found_return) {
                _mesa_glsl_error(&loc, state,
-                                "barrier() may not be used after return");
+                                "%s() may not be used after return", func_name);
             }
 
             if (instructions != &state->current_function->body) {
                _mesa_glsl_error(&loc, state,
-                                "barrier() may not be used in control flow");
+                                "%s() may not be used in control flow", func_name);
             }
          }
 




More information about the mesa-commit mailing list