mirror of
https://github.com/celisej567/source-engine.git
synced 2026-09-06 20:13:51 +03:00
engine: optimize traces
This commit is contained in:
@@ -873,9 +873,9 @@ bool IntersectRayWithBoxBrush( TraceInfo_t *pTraceInfo, const cbrush_t *pBrush,
|
||||
FPExceptionDisabler hideExceptions;
|
||||
|
||||
// Load the unaligned ray/box parameters into SIMD registers
|
||||
fltx4 start = LoadUnaligned3SIMD(pTraceInfo->m_start.Base());
|
||||
fltx4 extents = LoadUnaligned3SIMD(pTraceInfo->m_extents.Base());
|
||||
fltx4 delta = LoadUnaligned3SIMD(pTraceInfo->m_delta.Base());
|
||||
fltx4 start = LoadAlignedSIMD(pTraceInfo->m_start.Base());
|
||||
fltx4 extents = LoadAlignedSIMD(pTraceInfo->m_extents.Base());
|
||||
fltx4 delta = LoadAlignedSIMD(pTraceInfo->m_delta.Base());
|
||||
fltx4 boxMins = LoadAlignedSIMD( pBox->mins.Base() );
|
||||
fltx4 boxMaxs = LoadAlignedSIMD( pBox->maxs.Base() );
|
||||
|
||||
@@ -899,7 +899,7 @@ bool IntersectRayWithBoxBrush( TraceInfo_t *pTraceInfo, const cbrush_t *pBrush,
|
||||
|
||||
fltx4 crossPlane = OrSIMD(XorSIMD(startOutMins,endOutMins), XorSIMD(startOutMaxs,endOutMaxs));
|
||||
// now build the per-axis interval of t for intersections
|
||||
fltx4 invDelta = LoadUnaligned3SIMD(pTraceInfo->m_invDelta.Base());
|
||||
fltx4 invDelta = LoadAlignedSIMD(pTraceInfo->m_invDelta.Base());
|
||||
fltx4 tmins = MulSIMD( offsetMinsExpanded, invDelta );
|
||||
fltx4 tmaxs = MulSIMD( offsetMaxsExpanded, invDelta );
|
||||
// now sort the interval per axis
|
||||
@@ -1037,9 +1037,9 @@ bool IntersectRayWithBox( const Ray_t &ray, const VectorAligned &inInvDelta, con
|
||||
pTrace->fraction = 1.0f;
|
||||
|
||||
// Load the unaligned ray/box parameters into SIMD registers
|
||||
fltx4 start = LoadUnaligned3SIMD(ray.m_Start.Base());
|
||||
fltx4 extents = LoadUnaligned3SIMD(ray.m_Extents.Base());
|
||||
fltx4 delta = LoadUnaligned3SIMD(ray.m_Delta.Base());
|
||||
fltx4 start = LoadAlignedSIMD(ray.m_Start.Base());
|
||||
fltx4 extents = LoadAlignedSIMD(ray.m_Extents.Base());
|
||||
fltx4 delta = LoadAlignedSIMD(ray.m_Delta.Base());
|
||||
fltx4 boxMins = LoadAlignedSIMD( inBoxMins.Base() );
|
||||
fltx4 boxMaxs = LoadAlignedSIMD( inBoxMaxs.Base() );
|
||||
|
||||
@@ -1372,9 +1372,9 @@ void FASTCALL CM_ClipBoxToBrush( TraceInfo_t * RESTRICT pTraceInfo, const cbrush
|
||||
|
||||
inline bool IsTraceBoxIntersectingBoxBrush( TraceInfo_t *pTraceInfo, cboxbrush_t *pBox )
|
||||
{
|
||||
fltx4 start = LoadUnaligned3SIMD(pTraceInfo->m_start.Base());
|
||||
fltx4 mins = LoadUnaligned3SIMD(pTraceInfo->m_mins.Base());
|
||||
fltx4 maxs = LoadUnaligned3SIMD(pTraceInfo->m_maxs.Base());
|
||||
fltx4 start = LoadAlignedSIMD(pTraceInfo->m_start.Base());
|
||||
fltx4 mins = LoadAlignedSIMD(pTraceInfo->m_mins.Base());
|
||||
fltx4 maxs = LoadAlignedSIMD(pTraceInfo->m_maxs.Base());
|
||||
|
||||
fltx4 boxMins = LoadAlignedSIMD( pBox->mins.Base() );
|
||||
fltx4 boxMaxs = LoadAlignedSIMD( pBox->maxs.Base() );
|
||||
@@ -1569,15 +1569,15 @@ void FASTCALL CM_TraceToLeaf( TraceInfo_t * RESTRICT pTraceInfo, int ndxLeaf, fl
|
||||
if (IsX360())
|
||||
{
|
||||
// set up some relatively constant variables we'll use in the loop below
|
||||
fltx4 traceStart = LoadUnaligned3SIMD(pTraceInfo->m_start.Base());
|
||||
fltx4 traceDelta = LoadUnaligned3SIMD(pTraceInfo->m_delta.Base());
|
||||
fltx4 traceInvDelta = LoadUnaligned3SIMD(pTraceInfo->m_invDelta.Base());
|
||||
fltx4 traceStart = LoadAlignedSIMD(pTraceInfo->m_start.Base());
|
||||
fltx4 traceDelta = LoadAlignedSIMD(pTraceInfo->m_delta.Base());
|
||||
fltx4 traceInvDelta = LoadAlignedSIMD(pTraceInfo->m_invDelta.Base());
|
||||
static const fltx4 vecEpsilon = {DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON};
|
||||
// only used in !IS_POINT version:
|
||||
fltx4 extents;
|
||||
if (!IS_POINT)
|
||||
{
|
||||
extents = LoadUnaligned3SIMD(pTraceInfo->m_extents.Base());
|
||||
extents = LoadAlignedSIMD(pTraceInfo->m_extents.Base());
|
||||
}
|
||||
|
||||
// TODO: this loop probably ought to be unrolled so that we can make a more efficient
|
||||
|
||||
Reference in New Issue
Block a user