Mesa (main): glsl: only validate xfb_buffer values when we have enhanced layouts

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 9 04:08:32 UTC 2022


Module: Mesa
Branch: main
Commit: 13c6f401ccbcf25eb5dbd93cb59f88555e3785b8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=13c6f401ccbcf25eb5dbd93cb59f88555e3785b8

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Thu Feb  3 20:42:40 2022 -0500

glsl: only validate xfb_buffer values when we have enhanced layouts

XFB might not be supported, and the shader wouldn't be setting this
flag. But validation would still fail, since the number of xfb buffers
would be 0. So only validate if an xfb_buffer is set in the qualifiers.

See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5415
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14869>

---

 src/compiler/glsl/ast_to_hir.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 5a6760b170e..9684203fb0d 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -8098,11 +8098,13 @@ ast_interface_block::hir(exec_list *instructions,
       return NULL;
    }
 
-   unsigned qual_xfb_buffer;
-   if (!process_qualifier_constant(state, &loc, "xfb_buffer",
-                                   layout.xfb_buffer, &qual_xfb_buffer) ||
-       !validate_xfb_buffer_qualifier(&loc, state, qual_xfb_buffer)) {
-      return NULL;
+   unsigned qual_xfb_buffer = 0;
+   if (layout.flags.q.xfb_buffer) {
+      if (!process_qualifier_constant(state, &loc, "xfb_buffer",
+                                      layout.xfb_buffer, &qual_xfb_buffer) ||
+          !validate_xfb_buffer_qualifier(&loc, state, qual_xfb_buffer)) {
+         return NULL;
+      }
    }
 
    unsigned qual_xfb_offset = 0;



More information about the mesa-commit mailing list