diff options
author | George Kyriazis <[email protected]> | 2018-02-07 12:24:23 -0600 |
---|---|---|
committer | George Kyriazis <[email protected]> | 2018-02-28 11:42:46 -0600 |
commit | 7e813f62149b9141d2f8970d35ab7ffbd0e0637c (patch) | |
tree | c598b4e4afc9234efc0a5f8ca05c5709dd9ead69 /src/gallium | |
parent | 1c73f42e6e55de0be21221979882f6e42b3c2747 (diff) |
swr/rast: Faster frustum prim culling
Fix clipper validMask setting. We don't need to run frustum rejected
primitives through the clipper. Perform frustum culling with only
frustum clip codes. Guardband clip codes cannot be used because they
overlap frustum codes.
Reviewed-By: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/core/clip.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/clip.h b/src/gallium/drivers/swr/rasterizer/core/clip.h index 8d2590a4981..0f8399c742c 100644 --- a/src/gallium/drivers/swr/rasterizer/core/clip.h +++ b/src/gallium/drivers/swr/rasterizer/core/clip.h @@ -60,6 +60,7 @@ enum SWR_CLIPCODES }; #define GUARDBAND_CLIP_MASK (FRUSTUM_NEAR|FRUSTUM_FAR|GUARDBAND_LEFT|GUARDBAND_TOP|GUARDBAND_RIGHT|GUARDBAND_BOTTOM|NEGW) +#define FRUSTUM_CLIP_MASK (FRUSTUM_NEAR|FRUSTUM_FAR|FRUSTUM_LEFT|FRUSTUM_RIGHT|FRUSTUM_TOP|FRUSTUM_BOTTOM) template<typename SIMD_T> void ComputeClipCodes(const API_STATE &state, const Vec4<SIMD_T> &vertex, Float<SIMD_T> &clipCodes, Integer<SIMD_T> const &viewportIndexes) @@ -708,15 +709,18 @@ public: primMask &= ~ComputeUserClipCullMask(pa, prim); } - // cull prims outside view frustum Float<SIMD_T> clipIntersection = ComputeClipCodeIntersection(); + // Mask out non-frustum codes + clipIntersection = SIMD_T::and_ps(clipIntersection, SIMD_T::castsi_ps(SIMD_T::set1_epi32(FRUSTUM_CLIP_MASK))); + + // cull prims outside view frustum int validMask = primMask & SimdHelper<SIMD_T>::cmpeq_ps_mask(clipIntersection, SIMD_T::setzero_ps()); // skip clipping for points uint32_t clipMask = 0; if (NumVertsPerPrim != 1) { - clipMask = primMask & ComputeClipMask(); + clipMask = validMask & ComputeClipMask(); } AR_EVENT(ClipInfoEvent(numInvoc, validMask, clipMask)); @@ -726,7 +730,7 @@ public: RDTSC_BEGIN(FEGuardbandClip, pa.pDC->drawId); // we have to clip tris, execute the clipper, which will also // call the binner - ClipSimd(prim, SIMD_T::vmask_ps(primMask), SIMD_T::vmask_ps(clipMask), pa, primId, viewportIdx, rtIdx); + ClipSimd(prim, SIMD_T::vmask_ps(validMask), SIMD_T::vmask_ps(clipMask), pa, primId, viewportIdx, rtIdx); RDTSC_END(FEGuardbandClip, 1); } else if (validMask) |