summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2018-04-15 11:57:47 -0500
committerGeorge Kyriazis <[email protected]>2018-04-27 14:36:41 -0500
commite6daa62a48c62071d9fda8000f9d58b86a8b037d (patch)
treeb82827ad62def563e5c84eaf26184e160412bfa6 /src
parentcec1b52cace685e26b3ab065c320328355df9eeb (diff)
swr/rast: Add support for TexelMask evaluation
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/builder.cpp42
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/builder.h2
2 files changed, 44 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp
index bd815606fba..32487353f86 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 e2ad1e8b035..82c5f8cde2a 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"