summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-07-29 11:47:49 -0600
committerTim Rowley <[email protected]>2016-08-04 14:38:35 -0500
commitb521083ffb351b7fe2521a47731a46cdbb614117 (patch)
tree2d8e293dc34790dbf211f80850bff0fd815f2de0
parent68dc54487903024b90177f9e9e372bcdfa1c6a1a (diff)
swr: [rasterizer core] static analysis fixes for conservative rast
Signed-off-by: Tim Rowley <[email protected]>
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/backend.h7
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp8
2 files changed, 10 insertions, 5 deletions
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<T, SWR_INPUT_COVERAGE_INNER_CONSERVATIVE>
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<EdgeMaskT, E1E2ValidT>::value || std::is_same<EdgeMaskT, NoEdgesValidT>::value){\
+ mask = 0xf;\
+ }\
+ else{\
+ mask = edgeMask[0]; \
+ }\
UnrollerLMask<1, NumEdges, 1, EdgeMaskT::value>::step(update_lambda); \
coverageMask |= (mask << bit);