diff options
author | George Kyriazis <[email protected]> | 2018-04-23 18:00:10 -0500 |
---|---|---|
committer | George Kyriazis <[email protected]> | 2018-04-27 14:36:41 -0500 |
commit | c328c5d0f45e4ab7b0bc15fed2b45ff8f0f9ab11 (patch) | |
tree | e9d5bbae6c38782cb1ee926080acc6d14e850ea0 | |
parent | edc41f73b88b046598630eafceba6496d974f6c2 (diff) |
swr/rast: Add TranslateGfxAddress for shader
Also add GFX_MEM_CLIENT_SHADER
Reviewed-by: Bruce Cherniak <[email protected]>
3 files changed, 19 insertions, 3 deletions
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 <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); + } 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: |