X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fswr%2Frasterizer%2Fjitter%2Ffetch_jit.cpp;h=72704e94e4ccc47a87e98f5120b89056fac715ae;hb=207026d29e20223676ea587bb5bdba00b406b354;hp=fe5b48e584bd86f1afe2a3d3d24fc9b399eb7f40;hpb=387599a66181958e28483b8819e647d60b7158e8;p=mesa.git diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp index fe5b48e584b..72704e94e4c 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp @@ -1103,6 +1103,63 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState, } } + +typedef void* (*PFN_TRANSLATEGFXADDRESS_FUNC)(void* pdc, gfxptr_t va, bool* out_pbNullTileAccessed, void* pWorkerData); + +template +void GetSimdValidIndicesGfx(gfxptr_t indices, + gfxptr_t lastIndex, + uint32_t vWidth, + PFN_TRANSLATEGFXADDRESS_FUNC pfnTranslate, + void* pdc, + uint32_t* outIndices, + void* pWorkerData) +{ + SWR_ASSERT(outIndices != nullptr); + + gfxptr_t indexPtr = indices; + for (int64_t lane = 0; lane < vWidth; lane++) + { + uint32_t index = 0; + + if (indexPtr < lastIndex) + { + // translate indexPtr and load from it + T* addr = (T*)pfnTranslate(pdc, indexPtr, nullptr, pWorkerData); + SWR_ASSERT(addr != nullptr); + index = *addr; + } + + // index to 32 bits and insert into the correct simd lane + outIndices[lane] = index; + + indexPtr += sizeof(T); + } +} + +void GetSimdValid8bitIndicesGfx(gfxptr_t indices, + gfxptr_t lastIndex, + uint32_t vWidth, + PFN_TRANSLATEGFXADDRESS_FUNC pfnTranslate, + void* pdc, + uint32_t* outIndices, + void* pWorkerData) +{ + GetSimdValidIndicesGfx(indices, lastIndex, vWidth, pfnTranslate, pdc, outIndices, pWorkerData); +} + +void GetSimdValid16bitIndicesGfx(gfxptr_t indices, + gfxptr_t lastIndex, + uint32_t vWidth, + PFN_TRANSLATEGFXADDRESS_FUNC pfnTranslate, + void* pdc, + uint32_t* outIndices, + void* pWorkerData) +{ + GetSimdValidIndicesGfx(indices, lastIndex, vWidth, pfnTranslate, pdc, outIndices, pWorkerData); +} + + template Value* FetchJit::GetSimdValidIndicesHelper(Value* pIndices, Value* pLastIndex) {