[Mesa-dev] [PATCH 17/21] swr/rast: Add TranslateGfxAddress for shader

George Kyriazis george.kyriazis at intel.com
Wed Apr 25 19:21:56 UTC 2018


Also add GFX_MEM_CLIENT_SHADER
---
 .../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(-)

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 9b70716..03e34db 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 effbe05..d1a25c4 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 9ccac4f..3823a13 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:
-- 
2.7.4



More information about the mesa-dev mailing list