swr/rast: Adding Read/Write specifier to TranslateGfxAddress stack
authorAlok Hota <alok.hota@intel.com>
Mon, 25 Jun 2018 14:52:16 +0000 (09:52 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Thu, 28 Jun 2018 13:17:33 +0000 (08:17 -0500)
- Removing unused generic translate function
- Requiring read/write specifier in builder_gfx_mem

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

index 3f4b090cfc8d32523d58ebb0448005e1bd7cef34..8706bfa66bffe476c5d2494603060cf5d4ff40ac 100644 (file)
@@ -40,7 +40,8 @@ namespace SwrJit
     BuilderGfxMem::BuilderGfxMem(JitManager *pJitMgr) : Builder(pJitMgr)
     {
         mpTranslationFuncTy     = nullptr;
-        mpfnTranslateGfxAddress = nullptr;
+        mpfnTranslateGfxAddressForRead = nullptr;
+        mpfnTranslateGfxAddressForWrite = nullptr;
         mpParamSimDC            = nullptr;
 
     }
@@ -221,7 +222,7 @@ namespace SwrJit
         return Builder::MASKED_LOAD(Ptr, Align, Mask, PassThru, Name, Ty, usage);
     }
 
-    Value *BuilderGfxMem::TranslateGfxAddress(Value *      xpGfxAddress,
+    Value *BuilderGfxMem::TranslateGfxAddressForRead(Value *      xpGfxAddress,
                                               Type *       PtrTy,
                                               const Twine &Name,
                                               JIT_MEM_CLIENT /* usage */)
@@ -232,4 +233,17 @@ namespace SwrJit
         }
         return INT_TO_PTR(xpGfxAddress, PtrTy, Name);
     }
+
+    Value *BuilderGfxMem::TranslateGfxAddressForWrite(Value *      xpGfxAddress,
+                                                     Type *       PtrTy,
+                                                     const Twine &Name,
+                                                     JIT_MEM_CLIENT /* usage */)
+    {
+        if (PtrTy == nullptr)
+        {
+            PtrTy = mInt8PtrTy;
+        }
+        return INT_TO_PTR(xpGfxAddress, PtrTy, Name);
+    }
+
 } // namespace SwrJit
index ab6f78ee81768709d47e5d4bd7e2c5afb92d40ba..a552ff9b260800141179c56a0ca83255f6d9b983 100644 (file)
@@ -89,29 +89,14 @@ namespace SwrJit
                                 JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
 
 
-        Value *TranslateGfxAddress(Value *        xpGfxAddress,
-                                   Type *         PtrTy = nullptr,
-                                   const Twine &  Name  = "",
-                                   JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
-        template <typename T>
-        Value *TranslateGfxAddress(Value *                         xpGfxBaseAddress,
-                                   const std::initializer_list<T> &offset,
-                                   Type *                          PtrTy = nullptr,
-                                   const Twine &                   Name  = "",
-                                   JIT_MEM_CLIENT                  usage = GFX_MEM_CLIENT_SHADER)
-        {
-            AssertGFXMemoryParams(xpGfxBaseAddress, usage);
-            SWR_ASSERT(xpGfxBaseAddress->getType()->isPointerTy() == false);
-
-            if (!PtrTy)
-            {
-                PtrTy = mInt8PtrTy;
-            }
-
-            Value *ptr = INT_TO_PTR(xpGfxBaseAddress, PtrTy);
-            ptr        = GEP(ptr, offset);
-            return TranslateGfxAddress(PTR_TO_INT(ptr, mInt64Ty), PtrTy, Name, usage);
-        }
+        Value *TranslateGfxAddressForRead(Value *        xpGfxAddress,
+                                          Type *         PtrTy = nullptr,
+                                          const Twine &  Name  = "",
+                                          JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+        Value *TranslateGfxAddressForWrite(Value *        xpGfxAddress,
+                                           Type *         PtrTy = nullptr,
+                                           const Twine &  Name  = "",
+                                           JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
 
 
     protected:
@@ -124,13 +109,15 @@ namespace SwrJit
         Value *TranslationHelper(Value *Ptr, Type *Ty);
 
         FunctionType *GetTranslationFunctionType() { return mpTranslationFuncTy; }
-        Value *       GetTranslationFunction() { return mpfnTranslateGfxAddress; }
+        Value *       GetTranslationFunctionForRead() { return mpfnTranslateGfxAddressForRead; }
+        Value *       GetTranslationFunctionForWrite() { return mpfnTranslateGfxAddressForWrite; }
         Value *       GetParamSimDC() { return mpParamSimDC; }
 
 
     private:
         FunctionType *mpTranslationFuncTy;
-        Value *       mpfnTranslateGfxAddress;
+        Value *       mpfnTranslateGfxAddressForRead;
+        Value *       mpfnTranslateGfxAddressForWrite;
         Value *       mpParamSimDC;
     };
 } // namespace SwrJit