From: Tim Rowley Date: Mon, 8 May 2017 18:32:18 +0000 (-0500) Subject: swr/rast: SIMD16 FE - fix conservative rasterization X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a230af8b44244e5b78a8d879dddedfeb471f80c4;p=mesa.git swr/rast: SIMD16 FE - fix conservative rasterization Reviewed-by: Bruce Cherniak --- diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp b/src/gallium/drivers/swr/rasterizer/core/binner.cpp index f28981b6928..89a216703df 100644 --- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp @@ -204,6 +204,38 @@ INLINE void calcBoundingBoxIntVertical(const simdvector * c bbox.ymax = _simd_add_epi32(vMaxY, _simd_set1_epi32(CT::BoundingBoxOffsetT::value)); } +#if USE_SIMD16_FRONTEND +template <> +INLINE void calcBoundingBoxIntVertical(const simd16vector * const tri, simd16scalari(&vX)[3], simd16scalari(&vY)[3], simd16BBox &bbox) +{ + // FE conservative rast traits + typedef FEConservativeRastT CT; + + simd16scalari vMinX = vX[0]; + vMinX = _simd16_min_epi32(vMinX, vX[1]); + vMinX = _simd16_min_epi32(vMinX, vX[2]); + + simd16scalari vMaxX = vX[0]; + vMaxX = _simd16_max_epi32(vMaxX, vX[1]); + vMaxX = _simd16_max_epi32(vMaxX, vX[2]); + + simd16scalari vMinY = vY[0]; + vMinY = _simd16_min_epi32(vMinY, vY[1]); + vMinY = _simd16_min_epi32(vMinY, vY[2]); + + simd16scalari vMaxY = vY[0]; + vMaxY = _simd16_max_epi32(vMaxY, vY[1]); + vMaxY = _simd16_max_epi32(vMaxY, vY[2]); + + /// Bounding box needs to be expanded by 1/512 before snapping to 16.8 for conservative rasterization + /// expand bbox by 1/256; coverage will be correctly handled in the rasterizer. + bbox.xmin = _simd16_sub_epi32(vMinX, _simd16_set1_epi32(CT::BoundingBoxOffsetT::value)); + bbox.xmax = _simd16_add_epi32(vMaxX, _simd16_set1_epi32(CT::BoundingBoxOffsetT::value)); + bbox.ymin = _simd16_sub_epi32(vMinY, _simd16_set1_epi32(CT::BoundingBoxOffsetT::value)); + bbox.ymax = _simd16_add_epi32(vMaxY, _simd16_set1_epi32(CT::BoundingBoxOffsetT::value)); +} + +#endif ////////////////////////////////////////////////////////////////////////// /// @brief Processes attributes for the backend based on linkage mask and /// linkage map. Essentially just doing an SOA->AOS conversion and pack.