[Mesa-dev] [PATCH 12/20] i965/fs: Handle explicit flag sources in flags_read()

Matt Turner mattst88 at gmail.com
Thu Jul 6 23:48:22 UTC 2017


The implementations of the ARB_shader_ballot intrinsics will explicitly
read the flag as a source register.
---
 src/intel/compiler/brw_fs.cpp | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 97908a4563..de3aafafb1 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -862,9 +862,6 @@ namespace {
 unsigned
 fs_inst::flags_read(const gen_device_info *devinfo) const
 {
-   /* XXX - This doesn't consider explicit uses of the flag register as source
-    *       region.
-    */
    if (predicate == BRW_PREDICATE_ALIGN1_ANYV ||
        predicate == BRW_PREDICATE_ALIGN1_ALLV) {
       /* The vertical predication modes combine corresponding bits from
@@ -875,7 +872,20 @@ fs_inst::flags_read(const gen_device_info *devinfo) const
    } else if (predicate) {
       return flag_mask(this);
    } else {
-      return 0;
+      unsigned mask = 0;
+      for (int i = 0; i < sources; i++) {
+         if (src[i].file == ARF) {
+            if (src[i].nr == BRW_ARF_FLAG + 0 && src[i].subnr == 0)
+               mask |= 0b0001;
+            if (src[i].nr == BRW_ARF_FLAG + 0 && src[i].subnr == 1)
+               mask |= 0b0010;
+            if (src[i].nr == BRW_ARF_FLAG + 1 && src[i].subnr == 0)
+               mask |= 0b0100;
+            if (src[i].nr == BRW_ARF_FLAG + 1 && src[i].subnr == 1)
+               mask |= 0b1000;
+         }
+      }
+      return mask;
    }
 }
 
-- 
2.13.0



More information about the mesa-dev mailing list