swr: [rasterizer] Fix run-time check asserts
authorTim Rowley <timothy.o.rowley@intel.com>
Thu, 17 Mar 2016 18:22:43 +0000 (12:22 -0600)
committerTim Rowley <timothy.o.rowley@intel.com>
Fri, 25 Mar 2016 19:45:39 +0000 (14:45 -0500)
One innocuous (uninitialized variable), and one not so innocuous
(stack corruption).

src/gallium/drivers/swr/rasterizer/core/frontend.cpp
src/gallium/drivers/swr/rasterizer/core/frontend.h

index 27afc9640c7b3065a5631be9507f077c8e832a2b..e780ffbf175bb256b8c24f81afd5ac71b5e3ce42 100644 (file)
@@ -243,8 +243,8 @@ void ProcessDiscardInvalidateTiles(
         macroTileEndY = (rect.bottom + macroHeight - 1) / macroHeight;
     }
 
-    SWR_ASSERT(macroTileEndX < KNOB_NUM_HOT_TILES_X);
-    SWR_ASSERT(macroTileEndY < KNOB_NUM_HOT_TILES_Y);
+    SWR_ASSERT(macroTileEndX <= KNOB_NUM_HOT_TILES_X);
+    SWR_ASSERT(macroTileEndY <= KNOB_NUM_HOT_TILES_Y);
 
     macroTileEndX = std::min<uint32_t>(macroTileEndX, KNOB_NUM_HOT_TILES_X);
     macroTileEndY = std::min<uint32_t>(macroTileEndY, KNOB_NUM_HOT_TILES_Y);
index d11de79b01ffc99c82972d39ae95c7dc8b90d7ad..f92f88c3226f0a28ac41140692fe76447ecad644 100644 (file)
@@ -146,14 +146,13 @@ float calcDeterminantInt(const __m128i vA, const __m128i vB)
     //vMul = [A1*B2 - B1*A2]
     vMul = _mm_sub_epi64(vMul, vMul2);
 
-    // According to emmintrin.h __mm_store1_pd(), address must be 16-byte aligned
-    OSALIGN(int64_t, 16) result;
-    _mm_store1_pd((double*)&result, _mm_castsi128_pd(vMul));
+    int64_t result;
+    _mm_store_sd((double*)&result, _mm_castsi128_pd(vMul));
 
-    double fResult = (double)result;
-    fResult = fResult * (1.0 / FIXED_POINT16_SCALE);
+    double dResult = (double)result;
+    dResult = dResult * (1.0 / FIXED_POINT16_SCALE);
 
-    return (float)fResult;
+    return (float)dResult;
 }
 
 INLINE