From: Tim Rowley Date: Fri, 29 Jul 2016 17:47:49 +0000 (-0600) Subject: swr: [rasterizer core] static analysis fixes for conservative rast X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b521083ffb351b7fe2521a47731a46cdbb614117;p=mesa.git swr: [rasterizer core] static analysis fixes for conservative rast Signed-off-by: Tim Rowley --- diff --git a/src/gallium/drivers/swr/rasterizer/core/backend.h b/src/gallium/drivers/swr/rasterizer/core/backend.h index c8824792891..486a6500a1c 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend.h +++ b/src/gallium/drivers/swr/rasterizer/core/backend.h @@ -302,13 +302,12 @@ struct generateInputCoverage INLINE generateInputCoverage(const uint64_t *const coverageMask, uint32_t (&inputMask)[KNOB_SIMD_WIDTH], const uint32_t sampleMask) { - unsigned long index; uint32_t simdCoverage = (coverageMask[0] & MASK); static const uint32_t FullCoverageMask = (1 << T::MultisampleT::numSamples) - 1; - while(_BitScanForward(&index, simdCoverage)) + for(int i = 0; i < KNOB_SIMD_WIDTH; i++) { - // set all samples to covered - inputMask[index] = FullCoverageMask; + // set all samples to covered if conservative coverage mask is set for that pixel + inputMask[i] = (((1 << i) & simdCoverage) > 0) ? FullCoverageMask : 0; } } }; diff --git a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp index 3c5d73466e2..88a483fd185 100644 --- a/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp @@ -123,8 +123,14 @@ INLINE uint64_t rasterizePartialTile(DRAW_CONTEXT *pDC, double startEdges[NumEdg UnrollerLMask<0, NumEdges, 1, EdgeMaskT::value>::step(eval_lambda); // update coverage mask + // if edge 0 is degenerate and will be skipped; init the mask #define UPDATE_MASK(bit) \ - mask = edgeMask[0]; \ + if(std::is_same::value || std::is_same::value){\ + mask = 0xf;\ + }\ + else{\ + mask = edgeMask[0]; \ + }\ UnrollerLMask<1, NumEdges, 1, EdgeMaskT::value>::step(update_lambda); \ coverageMask |= (mask << bit);