[Mesa-dev] [PATCH 07/21] swr/rast: Add support for TexelMask evaluation

George Kyriazis george.kyriazis at intel.com
Wed Apr 25 19:21:46 UTC 2018


---
 .../drivers/swr/rasterizer/jitter/builder.cpp      | 42 ++++++++++++++++++++++
 .../drivers/swr/rasterizer/jitter/builder.h        |  2 ++
 2 files changed, 44 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp
index bd81560..3248735 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp
@@ -128,4 +128,46 @@ namespace SwrJit
 
         return (pAlloca->getMetadata("is_temp_alloca") != nullptr);
     }
+
+    // Returns true if able to find an intrinsic to mark
+    bool Builder::SetTexelMaskEvaluate(Instruction* inst)
+    {
+        CallInst* pGenIntrin = dyn_cast<CallInst>(inst);
+        if (pGenIntrin)
+        {
+            MDNode* N = MDNode::get(JM()->mContext, MDString::get(JM()->mContext, "is_evaluate"));
+            pGenIntrin->setMetadata("is_evaluate", N);
+            return true;
+        }
+        else
+        {
+            // Follow use def chain back up
+            for (Use& u : inst->operands())
+            {
+                Instruction* srcInst = dyn_cast<Instruction>(u.get());
+                if (srcInst)
+                {
+                    if (SetTexelMaskEvaluate(srcInst))
+                    {
+                        return true;
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
+
+    bool Builder::IsTexelMaskEvaluate(Instruction* genSampleOrLoadIntrinsic)
+    {
+        CallInst* pGenIntrin = dyn_cast<CallInst>(genSampleOrLoadIntrinsic);
+
+        if (!pGenIntrin)
+        {
+            return false;
+        }
+
+        return (pGenIntrin->getMetadata("is_evaluate") != nullptr);
+    }
+
 }
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder.h b/src/gallium/drivers/swr/rasterizer/jitter/builder.h
index e2ad1e8..82c5f8c 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder.h
@@ -121,6 +121,8 @@ namespace SwrJit
         void SetTargetWidth(uint32_t width);
         void SetTempAlloca(Value* inst);
         bool IsTempAlloca(Value* inst);
+        bool SetTexelMaskEvaluate(Instruction* inst);
+        bool IsTexelMaskEvaluate(Instruction* inst);
 
 #include "gen_builder.hpp"
 #include "gen_builder_meta.hpp"
-- 
2.7.4



More information about the mesa-dev mailing list