swr/rast: Cleanup of mpPrivateContext in Builder
authorGeorge Kyriazis <george.kyriazis@intel.com>
Mon, 29 Jan 2018 18:41:20 +0000 (12:41 -0600)
committerGeorge Kyriazis <george.kyriazis@intel.com>
Fri, 16 Feb 2018 16:53:58 +0000 (10:53 -0600)
Provide access functions for mpPrivateContext in Builder.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/rasterizer/jitter/builder.cpp
src/gallium/drivers/swr/rasterizer/jitter/builder.h
src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp

index 1b03d1c07090fe896f20bf1bf25e4e16ddb77c30..9f9438de1d878aff03cbff47f988fc9f3012ba49 100644 (file)
@@ -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);
 
index 788c5b23aa61b9160cb1e014a070d5bca5e3722e..763d29fdf653cd408fd821121e02bc4a1e8383f4 100644 (file)
@@ -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;
 
     };
index 4f56bda83dfc40a5acbfff2ff5d0756fcdddf831..9bb62976f60ba6dd5d7b8f15c498a17f588bc87c 100644 (file)
@@ -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");