swr: [rasterizer core] static analysis fixes for conservative rast
authorTim Rowley <timothy.o.rowley@intel.com>
Fri, 29 Jul 2016 17:47:49 +0000 (11:47 -0600)
committerTim Rowley <timothy.o.rowley@intel.com>
Thu, 4 Aug 2016 19:38:35 +0000 (14:38 -0500)
Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
src/gallium/drivers/swr/rasterizer/core/backend.h
src/gallium/drivers/swr/rasterizer/core/rasterizer.cpp

index c88247928911746aa770b9ad7627589be74d8768..486a6500a1cb48239f794163469c144880a30e95 100644 (file)
@@ -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;
         }
     }
 };
index 3c5d73466e206ea5657e8bf9ce2b544367219610..88a483fd185aff56a947bf28b4137f9242c74fd4 100644 (file)
@@ -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);