[Mesa-dev] [PATCH 1/7] swr/rast: Added in-place building to SCATTERPS

Cherniak, Bruce bruce.cherniak at intel.com
Thu May 24 16:13:13 UTC 2018


Patchset (1/7)
Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com> 

> On May 23, 2018, at 2:58 PM, Alok Hota <alok.hota at intel.com> wrote:
> 
> SCATTERPS previously assumed it was being used with an existing basic
> block
> ---
> .../drivers/swr/rasterizer/jitter/builder_mem.cpp  | 29 +++++++++++++++-------
> 1 file changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
> index 6e17888..77c2095 100644
> --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
> +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
> @@ -617,17 +617,28 @@ namespace SwrJit
> 
>         Value* pIsUndef = ICMP_EQ(pIndex, C(32));
> 
> -        // Split current block
> -        BasicBlock* pPostLoop = pCurBB->splitBasicBlock(cast<Instruction>(pIsUndef)->getNextNode());
> +        // Split current block or create new one if building inline
> +        BasicBlock* pPostLoop;
> +        if (pCurBB->getTerminator())
> +        {
> +            pPostLoop = pCurBB->splitBasicBlock(cast<Instruction>(pIsUndef)->getNextNode());
> 
> -        // Remove unconditional jump created by splitBasicBlock
> -        pCurBB->getTerminator()->eraseFromParent();
> +            // Remove unconditional jump created by splitBasicBlock
> +            pCurBB->getTerminator()->eraseFromParent();
> 
> -        // Add terminator to end of original block
> -        IRB()->SetInsertPoint(pCurBB);
> +            // Add terminator to end of original block
> +            IRB()->SetInsertPoint(pCurBB);
> 
> -        // Add conditional branch
> -        COND_BR(pIsUndef, pPostLoop, pLoop);
> +            // Add conditional branch
> +            COND_BR(pIsUndef, pPostLoop, pLoop);
> +        }
> +        else
> +        {
> +            pPostLoop = BasicBlock::Create(mpJitMgr->mContext, "PostScatter_Loop", pFunc);
> +
> +            // Add conditional branch
> +            COND_BR(pIsUndef, pPostLoop, pLoop);
> +        }
> 
>         // Add loop basic block contents
>         IRB()->SetInsertPoint(pLoop);
> @@ -642,7 +653,7 @@ namespace SwrJit
>         Value* pOffsetElem = LOADV(pOffsetsArrayPtr, { pIndexPhi });
> 
>         // GEP to this offset in dst
> -        Value* pCurDst = GEP(pDst, pOffsetElem);
> +        Value* pCurDst = GEP(pDst, pOffsetElem, mInt8PtrTy);
>         pCurDst = POINTER_CAST(pCurDst, PointerType::get(pSrcTy, 0));
>         STORE(pSrcElem, pCurDst);
> 
> -- 
> 2.7.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list