From: Alok Hota Date: Mon, 25 Jun 2018 14:52:16 +0000 (-0500) Subject: swr/rast: Adding Read/Write specifier to TranslateGfxAddress stack X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4509cdbb3731cf71cbf44e29a2fe1e6148dc9b4e;p=mesa.git swr/rast: Adding Read/Write specifier to TranslateGfxAddress stack - Removing unused generic translate function - Requiring read/write specifier in builder_gfx_mem Reviewed-by: Bruce Cherniak --- diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp index 3f4b090cfc8..8706bfa66bf 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp @@ -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 diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h index ab6f78ee817..a552ff9b260 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h @@ -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 - Value *TranslateGfxAddress(Value * xpGfxBaseAddress, - const std::initializer_list &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