Fuzz atomic and msaa PLS modes Diffs= 3191f5e38 Fuzz atomic and msaa PLS modes (#7236) Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
diff --git a/.rive_head b/.rive_head index 89472af..89189b0 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -cd35e613d258ba2e0e8698ce7a1b826977a13ec7 +3191f5e384df0016a4e82bf113b70b253a06ec35
diff --git a/renderer/intersection_board.cpp b/renderer/intersection_board.cpp index 4d62dce..a58318b 100644 --- a/renderer/intersection_board.cpp +++ b/renderer/intersection_board.cpp
@@ -211,6 +211,10 @@ return 0; } + // Clamp ltrb to the viewport to avoid integer overflows. + ltrb.xy = simd::max(ltrb.xy, int2(0)); + ltrb.zw = simd::min(ltrb.zw, m_viewportSize); + // Find the tiled row and column that each corner of the rectangle falls on. int4 span = (ltrb - int4{0, 0, 1, 1}) / 255; span = simd::clamp(span, int4(0), int4{m_cols, m_rows, m_cols, m_rows} - 1);
diff --git a/renderer/pls_render_context.cpp b/renderer/pls_render_context.cpp index b5a4a1f..9f17286 100644 --- a/renderer/pls_render_context.cpp +++ b/renderer/pls_render_context.cpp
@@ -880,10 +880,15 @@ { PLSDraw* draw = m_plsDraws[i].get(); + int4 drawBounds = simd::load4i(&m_plsDraws[i]->pixelBounds()); + // Add one extra pixel of padding to the draw bounds to make absolutely certain we get // no overlapping pixels, which destroy the atomic shader. - int4 drawBounds = simd::load4i(&m_plsDraws[i]->pixelBounds()); - drawBounds += int4{-1, -1, 1, 1}; + const int32_t kMax32i = std::numeric_limits<int32_t>::max(); + const int32_t kMin32i = std::numeric_limits<int32_t>::min(); + drawBounds = simd::if_then_else(drawBounds != int4{kMin32i, kMin32i, kMax32i, kMax32i}, + drawBounds + int4{-1, -1, 1, 1}, + drawBounds); // Our top priority in re-ordering is to group non-overlapping draws together, in order // to maximize batching while preserving correctness.