From 94922dbe4bc5bbe77124f435607641abe4e8c114 Mon Sep 17 00:00:00 2001 From: George Kyriazis Date: Tue, 23 Jan 2018 01:51:00 -0600 Subject: [PATCH] swr/rast: Add extra (optional) parameter in GATHERPS Now also takes in an additional parameter (draw context) for future expansion. Reviewed-by: Bruce Cherniak --- src/gallium/drivers/swr/rasterizer/jitter/builder.h | 2 ++ .../drivers/swr/rasterizer/jitter/builder_misc.cpp | 2 +- src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h | 2 +- src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp | 9 ++++++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder.h b/src/gallium/drivers/swr/rasterizer/jitter/builder.h index 288c5d9ecd4..2e714f97380 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder.h @@ -38,6 +38,8 @@ namespace SwrJit struct Builder { Builder(JitManager *pJitMgr); + virtual ~Builder() {} + IRBuilder<> *IRB() { return mpIRBuilder; }; JitManager *JM() { return mpJitMgr; } diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp index 142007eb341..10a5979d864 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp @@ -589,7 +589,7 @@ namespace SwrJit /// @param vIndices - SIMD wide value of VB byte offsets /// @param vMask - SIMD wide mask that controls whether to access memory or the src values /// @param scale - value to scale indices by - Value *Builder::GATHERPS(Value *vSrc, Value *pBase, Value *vIndices, Value *vMask, uint8_t scale) + Value *Builder::GATHERPS(Value *vSrc, Value *pBase, Value *vIndices, Value *vMask, uint8_t scale, Value *pDrawContext) { Value *vGather; diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h index c7f7f1aea93..891b31d3201 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h @@ -134,7 +134,7 @@ Value *MASKLOADD(Value* src, Value* mask); void Gather4(const SWR_FORMAT format, Value* pSrcBase, Value* byteOffsets, Value* mask, Value* vGatherComponents[], bool bPackedOutput); -Value *GATHERPS(Value *src, Value *pBase, Value *indices, Value *mask, uint8_t scale = 1); +virtual Value *GATHERPS(Value *src, Value *pBase, Value *indices, Value *mask, uint8_t scale = 1, Value *pDrawContext = nullptr); Value *GATHERPS_16(Value *src, Value *pBase, Value *indices, Value *mask, uint8_t scale = 1); void GATHER4PS(const SWR_FORMAT_INFO &info, Value* pSrcBase, Value* byteOffsets, diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp index 091db2449c1..c6b3e841f62 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp @@ -55,9 +55,12 @@ enum ConversionType ////////////////////////////////////////////////////////////////////////// /// Interface to Jitting a fetch shader ////////////////////////////////////////////////////////////////////////// -struct FetchJit : public Builder +struct FetchJit : + public Builder { - FetchJit(JitManager* pJitMgr) : Builder(pJitMgr){}; + FetchJit(JitManager* pJitMgr) : + Builder(pJitMgr) + {} Function* Create(const FETCH_COMPILE_STATE& fetchState); @@ -1361,7 +1364,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE &fetchState, // But, we know that elements must be aligned for FETCH. :) // Right shift the offset by a bit and then scale by 2 to remove the sign extension. Value *vShiftedOffsets = LSHR(vOffsets, 1); - vVertexElements[currentVertexElement++] = GATHERPS(gatherSrc, pStreamBase, vShiftedOffsets, vGatherMask, 2); + vVertexElements[currentVertexElement++] = GATHERPS(gatherSrc, pStreamBase, vShiftedOffsets, vGatherMask, 2, mpPrivateContext); } else { -- 2.30.2