From: George Kyriazis Date: Mon, 23 Apr 2018 23:00:10 +0000 (-0500) Subject: swr/rast: Add TranslateGfxAddress for shader X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c328c5d0f45e4ab7b0bc15fed2b45ff8f0f9ab11;p=mesa.git swr/rast: Add TranslateGfxAddress for shader Also add GFX_MEM_CLIENT_SHADER 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 9b707162b3f..03e34db3181 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp @@ -201,7 +201,7 @@ namespace SwrJit return Builder::MASKED_LOAD(Ptr, Align, Mask, PassThru, Name, Ty, usage); } - Value* BuilderGfxMem::TranslateGfxAddress(Value* xpGfxAddress, Type* PtrTy, const Twine &Name) + Value* BuilderGfxMem::TranslateGfxAddress(Value* xpGfxAddress, Type* PtrTy, const Twine &Name, JIT_MEM_CLIENT /* usage */) { if (PtrTy == nullptr) { 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 effbe05da13..d1a25c42acc 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h @@ -57,7 +57,22 @@ namespace SwrJit virtual Value *GATHERDD(Value* src, Value* pBase, Value* indices, Value* mask, uint8_t scale = 1, JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL); - Value* TranslateGfxAddress(Value* xpGfxAddress, Type* PtrTy = nullptr, const Twine &Name = ""); + 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); + } protected: diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h index 9ccac4f8002..3823a136bb8 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h @@ -35,7 +35,8 @@ typedef enum _JIT_MEM_CLIENT { MEM_CLIENT_INTERNAL, GFX_MEM_CLIENT_FETCH, - GFX_MEM_CLIENT_SAMPLER + GFX_MEM_CLIENT_SAMPLER, + GFX_MEM_CLIENT_SHADER, } JIT_MEM_CLIENT; protected: