diff options
author | Tim Rowley <[email protected]> | 2017-05-08 13:32:18 -0500 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2017-05-30 17:21:02 -0500 |
commit | a230af8b44244e5b78a8d879dddedfeb471f80c4 (patch) | |
tree | 3bf6991d402f1d9524e5eaaceb0f97510673f805 | |
parent | f64aea0959af955841bbde96885aebacb44b4aaf (diff) |
swr/rast: SIMD16 FE - fix conservative rasterization
Reviewed-by: Bruce Cherniak <[email protected]>
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/binner.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
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<FEConservativeRastT>(const simdvector * c bbox.ymax = _simd_add_epi32(vMaxY, _simd_set1_epi32(CT::BoundingBoxOffsetT::value)); } +#if USE_SIMD16_FRONTEND +template <> +INLINE void calcBoundingBoxIntVertical<FEConservativeRastT>(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. |