From c328c5d0f45e4ab7b0bc15fed2b45ff8f0f9ab11 Mon Sep 17 00:00:00 2001 From: George Kyriazis Date: Mon, 23 Apr 2018 18:00:10 -0500 Subject: swr/rast: Add TranslateGfxAddress for shader Also add GFX_MEM_CLIENT_SHADER Reviewed-by: Bruce Cherniak --- .../drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp | 2 +- .../drivers/swr/rasterizer/jitter/builder_gfx_mem.h | 17 ++++++++++++++++- src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src/gallium/drivers') 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: -- cgit v1.2.3