[Mesa-dev] [PATCH 05/31] swr/rast: Cleanup of mpPrivateContext in Builder

George Kyriazis george.kyriazis at intel.com
Tue Feb 13 22:42:23 UTC 2018


Provide access functions for mpPrivateContext in Builder.
---
 src/gallium/drivers/swr/rasterizer/jitter/builder.cpp   |  3 ++-
 src/gallium/drivers/swr/rasterizer/jitter/builder.h     | 10 ++++++++++
 src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp |  5 +++--
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp
index 1b03d1c..9f9438d 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp
@@ -39,7 +39,8 @@ namespace SwrJit
     /// @brief Contructor for Builder.
     /// @param pJitMgr - JitManager which contains modules, function passes, etc.
     Builder::Builder(JitManager *pJitMgr)
-        : mpJitMgr(pJitMgr)
+        : mpJitMgr(pJitMgr),
+          mpPrivateContext(nullptr)
     {
         SWR_ASSERT(pJitMgr->mVWidth == 8);
 
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder.h b/src/gallium/drivers/swr/rasterizer/jitter/builder.h
index 788c5b2..763d29f 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder.h
@@ -97,6 +97,16 @@ namespace SwrJit
 #include "builder_mem.h"
 
     protected:
+
+        void SetPrivateContext(Value* pPrivateContext) 
+        { 
+            mpPrivateContext = pPrivateContext; 
+            NotifyPrivateContextSet();
+        }
+        virtual void NotifyPrivateContextSet() {}
+        inline Value* GetPrivateContext() { return mpPrivateContext; }
+
+    private: 
         Value* mpPrivateContext;
 
     };
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index 4f56bda..9bb6297 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -148,8 +148,9 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
     auto    argitr = fetch->arg_begin();
 
     // Fetch shader arguments
-    mpPrivateContext = &*argitr; ++argitr;
-    mpPrivateContext->setName("privateContext");
+    Value* privateContext = &*argitr; ++argitr;
+    privateContext->setName("privateContext");
+    SetPrivateContext(privateContext);
 
     mpFetchInfo = &*argitr; ++argitr;
     mpFetchInfo->setName("fetchInfo");
-- 
2.7.4



More information about the mesa-dev mailing list