materialsystem: set allocator alignment 16( fixes crash in release build )

This commit is contained in:
nillerusr 2023-04-26 23:42:49 +03:00
parent e3edbc2d96
commit 657f59ada3
2 changed files with 7 additions and 41 deletions

View File

@ -31,9 +31,9 @@ public:
{
MEM_ALLOC_CREDIT_( "CMatCallQueue.m_Allocator" );
#ifdef SWDS
m_Allocator.Init( 2*1024, 0, 0, 4 );
m_Allocator.Init( 2*1024, 0, 0, 16 );
#else
m_Allocator.Init( IsX360() ? 2*1024*1024 : 8*1024*1024, 64*1024, 256*1024, 4 );
m_Allocator.Init( IsX360() ? 2*1024*1024 : 8*1024*1024, 64*1024, 256*1024, 16 );
#endif
m_FunctorFactory.SetAllocator( &m_Allocator );
m_pHead = m_pTail = NULL;

View File

@ -30,7 +30,6 @@
// FP exception clean so this not a turnkey operation.
//#define FP_EXCEPTIONS_ENABLED
#ifdef FP_EXCEPTIONS_ENABLED
#include <float.h> // For _clearfp and _controlfp_s
#endif
@ -93,37 +92,11 @@ private:
FPExceptionEnabler& operator=(const FPExceptionEnabler&);
};
#ifdef DEBUG // stop crashing edit-and-continue
FORCEINLINE float clamp( float val, float minVal, float maxVal )
inline float clamp( const float val, const float minVal, const float maxVal )
{
if ( maxVal < minVal )
return maxVal;
else if( val < minVal )
return minVal;
else if( val > maxVal )
return maxVal;
else
return val;
const float t = val < minVal ? minVal : val;
return t > maxVal ? maxVal : t;
}
#else // DEBUG
FORCEINLINE float clamp( float val, float minVal, float maxVal )
{
#if defined(__i386__) || defined(_M_IX86)
_mm_store_ss( &val,
_mm_min_ss(
_mm_max_ss(
_mm_load_ss(&val),
_mm_load_ss(&minVal) ),
_mm_load_ss(&maxVal) ) );
#else
val = fpmax(minVal, val);
val = fpmin(maxVal, val);
#endif
return val;
}
#endif // DEBUG
//
// Returns a clamped value in the range [min, max].
@ -131,17 +104,10 @@ FORCEINLINE float clamp( float val, float minVal, float maxVal )
template< class T >
inline T clamp( T const &val, T const &minVal, T const &maxVal )
{
if ( maxVal < minVal )
return maxVal;
else if( val < minVal )
return minVal;
else if( val > maxVal )
return maxVal;
else
return val;
const T t = val< minVal ? minVal : val;
return t > maxVal ? maxVal : t;
}
// plane_t structure
// !!! if this is changed, it must be changed in asm code too !!!
// FIXME: does the asm code even exist anymore?