Added enhanced cl_clock_correction & misc
- Added vprof - Fixed few issues again with cl_showhitboxes - Fixed some shader compilation - Fixed few issues with bitbuf
This commit is contained in:
parent
a2e8d9e9d4
commit
6691968046
22 changed files with 158 additions and 242 deletions
|
@ -1032,8 +1032,10 @@ const char *SVC_VoiceData::ToString(void) const
|
||||||
|
|
||||||
bool NET_Tick::WriteToBuffer( bf_write &buffer )
|
bool NET_Tick::WriteToBuffer( bf_write &buffer )
|
||||||
{
|
{
|
||||||
|
VPROF( "NET_Tick::WriteToBuffer" );
|
||||||
buffer.WriteUBitLong( GetType(), NETMSG_TYPE_BITS );
|
buffer.WriteUBitLong( GetType(), NETMSG_TYPE_BITS );
|
||||||
buffer.WriteLong( m_nTick );
|
buffer.WriteLong( m_nTick );
|
||||||
|
buffer.WriteLong( m_nLagTick );
|
||||||
#if PROTOCOL_VERSION > 10
|
#if PROTOCOL_VERSION > 10
|
||||||
buffer.WriteUBitLong( clamp( (int)( NET_TICK_SCALEUP * m_flHostFrameTime ), 0, 65535 ), 16 );
|
buffer.WriteUBitLong( clamp( (int)( NET_TICK_SCALEUP * m_flHostFrameTime ), 0, 65535 ), 16 );
|
||||||
buffer.WriteUBitLong( clamp( (int)( NET_TICK_SCALEUP * m_flHostFrameTimeStdDeviation ), 0, 65535 ), 16 );
|
buffer.WriteUBitLong( clamp( (int)( NET_TICK_SCALEUP * m_flHostFrameTimeStdDeviation ), 0, 65535 ), 16 );
|
||||||
|
@ -1046,6 +1048,7 @@ bool NET_Tick::ReadFromBuffer( bf_read &buffer )
|
||||||
VPROF( "NET_Tick::ReadFromBuffer" );
|
VPROF( "NET_Tick::ReadFromBuffer" );
|
||||||
|
|
||||||
m_nTick = buffer.ReadLong();
|
m_nTick = buffer.ReadLong();
|
||||||
|
m_nLagTick = buffer.ReadLong();
|
||||||
#if PROTOCOL_VERSION > 10
|
#if PROTOCOL_VERSION > 10
|
||||||
m_flHostFrameTime = (float)buffer.ReadUBitLong( 16 ) / NET_TICK_SCALEUP;
|
m_flHostFrameTime = (float)buffer.ReadUBitLong( 16 ) / NET_TICK_SCALEUP;
|
||||||
m_flHostFrameTimeStdDeviation = (float)buffer.ReadUBitLong( 16 ) / NET_TICK_SCALEUP;
|
m_flHostFrameTimeStdDeviation = (float)buffer.ReadUBitLong( 16 ) / NET_TICK_SCALEUP;
|
||||||
|
@ -1055,7 +1058,7 @@ bool NET_Tick::ReadFromBuffer( bf_read &buffer )
|
||||||
|
|
||||||
const char *NET_Tick::ToString(void) const
|
const char *NET_Tick::ToString(void) const
|
||||||
{
|
{
|
||||||
Q_snprintf(s_text, sizeof(s_text), "%s: tick %i", GetName(), m_nTick );
|
Q_snprintf(s_text, sizeof(s_text), "%s: tick %i, lagtick %i", GetName(), m_nTick, m_nLagTick );
|
||||||
return s_text;
|
return s_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,16 +146,19 @@ class NET_Tick : public CNetMessage
|
||||||
NET_Tick()
|
NET_Tick()
|
||||||
{
|
{
|
||||||
m_bReliable = false;
|
m_bReliable = false;
|
||||||
|
m_nTick = 0;
|
||||||
|
m_nLagTick = 0;
|
||||||
#if PROTOCOL_VERSION > 10
|
#if PROTOCOL_VERSION > 10
|
||||||
m_flHostFrameTime = 0;
|
m_flHostFrameTime = 0;
|
||||||
m_flHostFrameTimeStdDeviation = 0;
|
m_flHostFrameTimeStdDeviation = 0;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
NET_Tick( int tick, float hostFrametime, float hostFrametime_stddeviation )
|
NET_Tick( int tick, int lagTick, float hostFrametime, float hostFrametime_stddeviation )
|
||||||
{
|
{
|
||||||
m_bReliable = false;
|
m_bReliable = false;
|
||||||
m_nTick = tick;
|
m_nTick = tick;
|
||||||
|
m_nLagTick = lagTick;
|
||||||
#if PROTOCOL_VERSION > 10
|
#if PROTOCOL_VERSION > 10
|
||||||
m_flHostFrameTime = hostFrametime;
|
m_flHostFrameTime = hostFrametime;
|
||||||
m_flHostFrameTimeStdDeviation = hostFrametime_stddeviation;
|
m_flHostFrameTimeStdDeviation = hostFrametime_stddeviation;
|
||||||
|
@ -167,6 +170,7 @@ class NET_Tick : public CNetMessage
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int m_nTick;
|
int m_nTick;
|
||||||
|
int m_nLagTick;
|
||||||
#if PROTOCOL_VERSION > 10
|
#if PROTOCOL_VERSION > 10
|
||||||
float m_flHostFrameTime;
|
float m_flHostFrameTime;
|
||||||
float m_flHostFrameTimeStdDeviation;
|
float m_flHostFrameTimeStdDeviation;
|
||||||
|
|
|
@ -529,7 +529,7 @@ void CBaseClient::SpawnPlayer( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set client clock to match server's
|
// Set client clock to match server's
|
||||||
NET_Tick tick( m_Server->GetTick(), host_frametime_unbounded, host_frametime_stddeviation );
|
NET_Tick tick( m_Server->GetTick(), m_nClientTick, host_frametime_unbounded, host_frametime_stddeviation );
|
||||||
SendNetMsg( tick, true );
|
SendNetMsg( tick, true );
|
||||||
|
|
||||||
// Spawned into server, not fully active, though
|
// Spawned into server, not fully active, though
|
||||||
|
@ -717,7 +717,7 @@ bool CBaseClient::SendServerInfo( void )
|
||||||
// send first tick
|
// send first tick
|
||||||
m_nSignonTick = m_Server->m_nTickCount;
|
m_nSignonTick = m_Server->m_nTickCount;
|
||||||
|
|
||||||
NET_Tick signonTick( m_nSignonTick, 0, 0 );
|
NET_Tick signonTick( m_nSignonTick, m_nClientTick, 0, 0 );
|
||||||
signonTick.WriteToBuffer( msg );
|
signonTick.WriteToBuffer( msg );
|
||||||
|
|
||||||
// write stringtable baselines
|
// write stringtable baselines
|
||||||
|
@ -794,6 +794,7 @@ void CBaseClient::ConnectionStart(INetChannel *chan)
|
||||||
bool CBaseClient::ProcessTick( NET_Tick *msg )
|
bool CBaseClient::ProcessTick( NET_Tick *msg )
|
||||||
{
|
{
|
||||||
m_NetChannel->SetRemoteFramerate( msg->m_flHostFrameTime, msg->m_flHostFrameTimeStdDeviation );
|
m_NetChannel->SetRemoteFramerate( msg->m_flHostFrameTime, msg->m_flHostFrameTimeStdDeviation );
|
||||||
|
m_nClientTick = msg->m_nLagTick;
|
||||||
return UpdateAcknowledgedFramecount( msg->m_nTick );
|
return UpdateAcknowledgedFramecount( msg->m_nTick );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1179,7 +1180,7 @@ write_again:
|
||||||
}
|
}
|
||||||
|
|
||||||
// send tick time
|
// send tick time
|
||||||
NET_Tick tickmsg( pFrame->tick_count, host_frametime_unbounded, host_frametime_stddeviation );
|
NET_Tick tickmsg( pFrame->tick_count, m_nClientTick, host_frametime_unbounded, host_frametime_stddeviation );
|
||||||
|
|
||||||
StartTrace( msg );
|
StartTrace( msg );
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,7 @@ public:
|
||||||
int m_nSignonState; // connection state
|
int m_nSignonState; // connection state
|
||||||
int m_nDeltaTick; // -1 = no compression. This is where the server is creating the
|
int m_nDeltaTick; // -1 = no compression. This is where the server is creating the
|
||||||
// compressed info from.
|
// compressed info from.
|
||||||
|
int m_nClientTick;
|
||||||
int m_nStringTableAckTick; // Highest tick acked for string tables (usually m_nDeltaTick, except when it's -1)
|
int m_nStringTableAckTick; // Highest tick acked for string tables (usually m_nDeltaTick, except when it's -1)
|
||||||
int m_nSignonTick; // tick the client got his signon data
|
int m_nSignonTick; // tick the client got his signon data
|
||||||
CSmartPtr<CFrameSnapshot,CRefCountAccessorLongName> m_pLastSnapshot; // last send snapshot
|
CSmartPtr<CFrameSnapshot,CRefCountAccessorLongName> m_pLastSnapshot; // last send snapshot
|
||||||
|
|
|
@ -1012,6 +1012,7 @@ bool CBaseClientState::ProcessTick( NET_Tick *msg )
|
||||||
// the client's clock to match the server's, but right here, we keep the two clocks in sync.
|
// the client's clock to match the server's, but right here, we keep the two clocks in sync.
|
||||||
SetClientTickCount( msg->m_nTick );
|
SetClientTickCount( msg->m_nTick );
|
||||||
SetServerTickCount( msg->m_nTick );
|
SetServerTickCount( msg->m_nTick );
|
||||||
|
m_ClockDriftMgr.m_nLaggedClientTick = msg->m_nLagTick;
|
||||||
|
|
||||||
if ( m_StringTableContainer )
|
if ( m_StringTableContainer )
|
||||||
{
|
{
|
||||||
|
|
|
@ -518,19 +518,6 @@ void CL_ReadPackets ( bool bFinalTick )
|
||||||
// update client times/tick
|
// update client times/tick
|
||||||
|
|
||||||
cl.oldtickcount = cl.GetServerTickCount();
|
cl.oldtickcount = cl.GetServerTickCount();
|
||||||
if ( !cl.IsPaused() )
|
|
||||||
{
|
|
||||||
cl.SetClientTickCount( cl.GetClientTickCount() + 1 );
|
|
||||||
|
|
||||||
// While clock correction is off, we have the old behavior of matching the client and server clocks.
|
|
||||||
if ( !CClockDriftMgr::IsClockCorrectionEnabled() )
|
|
||||||
cl.SetServerTickCount( cl.GetClientTickCount() );
|
|
||||||
|
|
||||||
g_ClientGlobalVariables.tickcount = cl.GetClientTickCount();
|
|
||||||
g_ClientGlobalVariables.curtime = cl.GetTime();
|
|
||||||
}
|
|
||||||
// 0 or tick_rate if simulating
|
|
||||||
g_ClientGlobalVariables.frametime = cl.GetFrameTime();
|
|
||||||
|
|
||||||
// read packets, if any in queue
|
// read packets, if any in queue
|
||||||
if ( demoplayer->IsPlayingBack() && cl.m_NetChannel )
|
if ( demoplayer->IsPlayingBack() && cl.m_NetChannel )
|
||||||
|
@ -574,6 +561,26 @@ void CL_ReadPackets ( bool bFinalTick )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Moved after process socket so we can receive the lastest updates.
|
||||||
|
if ( !cl.IsPaused() )
|
||||||
|
{
|
||||||
|
// While clock correction is off, we have the old behavior of matching the client and server clocks.
|
||||||
|
if (!CClockDriftMgr::IsClockCorrectionEnabled())
|
||||||
|
{
|
||||||
|
cl.SetClientTickCount(cl.GetClientTickCount() + 1);
|
||||||
|
cl.SetServerTickCount(cl.GetClientTickCount());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cl.m_ClockDriftMgr.ApplyClockCorrection(bFinalTick);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_ClientGlobalVariables.tickcount = cl.GetClientTickCount();
|
||||||
|
g_ClientGlobalVariables.curtime = cl.GetTime();
|
||||||
|
}
|
||||||
|
// 0 or tick_rate if simulating
|
||||||
|
g_ClientGlobalVariables.frametime = cl.GetFrameTime();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -2128,8 +2135,6 @@ void CL_SendMove( void )
|
||||||
|
|
||||||
void CL_Move(float accumulated_extra_samples, bool bFinalTick )
|
void CL_Move(float accumulated_extra_samples, bool bFinalTick )
|
||||||
{
|
{
|
||||||
CL_ReadPackets(bFinalTick);
|
|
||||||
|
|
||||||
if ( !cl.IsConnected() )
|
if ( !cl.IsConnected() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2229,7 +2234,7 @@ void CL_Move(float accumulated_extra_samples, bool bFinalTick )
|
||||||
|
|
||||||
if ( cl.IsActive() )
|
if ( cl.IsActive() )
|
||||||
{
|
{
|
||||||
NET_Tick mymsg( cl.m_nDeltaTick, host_frametime_unbounded, host_frametime_stddeviation );
|
NET_Tick mymsg( cl.m_nDeltaTick, cl.m_ClockDriftMgr.m_nCachedRealClientTick, host_frametime_unbounded, host_frametime_stddeviation );
|
||||||
cl.m_NetChannel->SendNetMsg( mymsg );
|
cl.m_NetChannel->SendNetMsg( mymsg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,33 +20,6 @@ ConVar cl_clock_showdebuginfo( "cl_clock_showdebuginfo", "0", FCVAR_CHEAT, "Show
|
||||||
|
|
||||||
ConVar cl_clock_correction_force_server_tick( "cl_clock_correction_force_server_tick", "999", FCVAR_CHEAT, "Force clock correction to match the server tick + this offset (-999 disables it)." );
|
ConVar cl_clock_correction_force_server_tick( "cl_clock_correction_force_server_tick", "999", FCVAR_CHEAT, "Force clock correction to match the server tick + this offset (-999 disables it)." );
|
||||||
|
|
||||||
ConVar cl_clock_correction_adjustment_max_amount( "cl_clock_correction_adjustment_max_amount", "200", FCVAR_CHEAT,
|
|
||||||
"Sets the maximum number of milliseconds per second it is allowed to correct the client clock. "
|
|
||||||
"It will only correct this amount if the difference between the client and server clock is equal to or larger than cl_clock_correction_adjustment_max_offset." );
|
|
||||||
|
|
||||||
ConVar cl_clock_correction_adjustment_min_offset( "cl_clock_correction_adjustment_min_offset", "10", FCVAR_CHEAT,
|
|
||||||
"If the clock offset is less than this amount (in milliseconds), then no clock correction is applied." );
|
|
||||||
|
|
||||||
ConVar cl_clock_correction_adjustment_max_offset( "cl_clock_correction_adjustment_max_offset", "90", FCVAR_CHEAT,
|
|
||||||
"As the clock offset goes from cl_clock_correction_adjustment_min_offset to this value (in milliseconds), "
|
|
||||||
"it moves towards applying cl_clock_correction_adjustment_max_amount of adjustment. That way, the response "
|
|
||||||
"is small when the offset is small." );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Given the offset (in milliseconds) of the client clock from the server clock,
|
|
||||||
// returns how much correction we'd like to apply per second (in seconds).
|
|
||||||
static float GetClockAdjustmentAmount( float flCurDiffInMS )
|
|
||||||
{
|
|
||||||
flCurDiffInMS = clamp( flCurDiffInMS, cl_clock_correction_adjustment_min_offset.GetFloat(), cl_clock_correction_adjustment_max_offset.GetFloat() );
|
|
||||||
|
|
||||||
float flReturnValue = RemapVal( flCurDiffInMS,
|
|
||||||
cl_clock_correction_adjustment_min_offset.GetFloat(), cl_clock_correction_adjustment_max_offset.GetFloat(),
|
|
||||||
0, cl_clock_correction_adjustment_max_amount.GetFloat() / 1000.0f );
|
|
||||||
|
|
||||||
return flReturnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------- /
|
// -------------------------------------------------------------------------------------------------- /
|
||||||
// CClockDriftMgr implementation.
|
// CClockDriftMgr implementation.
|
||||||
|
@ -62,8 +35,10 @@ void CClockDriftMgr::Clear()
|
||||||
{
|
{
|
||||||
m_nClientTick = 0;
|
m_nClientTick = 0;
|
||||||
m_nServerTick = 0;
|
m_nServerTick = 0;
|
||||||
m_iCurClockOffset = 0;
|
m_nOldServerTick = 0;
|
||||||
memset( m_ClockOffsets, 0, sizeof( m_ClockOffsets ) );
|
m_nLaggedClientTick = 0;
|
||||||
|
m_flServerHostFrametime = 0.0f;
|
||||||
|
m_flServerHostFrametimeStdDeviation = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,137 +51,76 @@ void CClockDriftMgr::Clear()
|
||||||
// NOTE: or decrementing the client tick after receiving pause
|
// NOTE: or decrementing the client tick after receiving pause
|
||||||
// NOTE: This is due to the fact that currently pause is applied at frame start on the server
|
// NOTE: This is due to the fact that currently pause is applied at frame start on the server
|
||||||
// NOTE: and frame end on the client
|
// NOTE: and frame end on the client
|
||||||
void CClockDriftMgr::SetServerTick( int nTick )
|
void CClockDriftMgr::SetServerTick( int nTick, int nLaggedTick, float flServerHostFrametime, float flServerHostFrametimeStdDeviation )
|
||||||
{
|
{
|
||||||
#if !defined( SWDS )
|
#if !defined( SWDS )
|
||||||
m_nServerTick = nTick;
|
m_nServerTick = nTick;
|
||||||
|
m_nLaggedClientTick = nLaggedTick;
|
||||||
|
m_flServerHostFrametime = flServerHostFrametime;
|
||||||
|
m_flServerHostFrametimeStdDeviation = flServerHostFrametimeStdDeviation;
|
||||||
|
|
||||||
int nMaxDriftTicks = IsEngineThreaded() ?
|
int clientTick = m_nClientTick + g_ClientGlobalVariables.simTicksThisFrame - 1;
|
||||||
TIME_TO_TICKS( (cl_clockdrift_max_ms_threadmode.GetFloat() / 1000.0) ) :
|
int nMaxDriftTicks = IsEngineThreaded() ? TIME_TO_TICKS((cl_clockdrift_max_ms_threadmode.GetFloat() / 1000.0)) :
|
||||||
TIME_TO_TICKS( (cl_clockdrift_max_ms.GetFloat() / 1000.0) );
|
TIME_TO_TICKS((cl_clockdrift_max_ms.GetFloat() / 1000.0));
|
||||||
|
|
||||||
int clientTick = cl.GetClientTickCount() + g_ClientGlobalVariables.simTicksThisFrame - 1;
|
|
||||||
if ( cl_clock_correction_force_server_tick.GetInt() == 999 )
|
if (cl_clock_correction_force_server_tick.GetInt() == 999)
|
||||||
{
|
{
|
||||||
|
if (IsClockCorrectionEnabled())
|
||||||
|
{
|
||||||
|
// Take the difference between last sent client tick and server tick
|
||||||
|
// This will give how much we are shifted from the server perfectly
|
||||||
|
// If server fps is higher than tickrate.
|
||||||
|
m_nLagDiff = m_nServerTick - m_nLaggedClientTick;
|
||||||
|
}
|
||||||
// If this is the first tick from the server, or if we get further than cl_clockdrift_max_ticks off, then
|
// If this is the first tick from the server, or if we get further than cl_clockdrift_max_ticks off, then
|
||||||
// use the old behavior and slam the server's tick into the client tick.
|
// use the old behavior and slam the server's tick into the client tick.
|
||||||
if ( !IsClockCorrectionEnabled() ||
|
else if (!IsClockCorrectionEnabled() || clientTick == 0 || abs(nTick - clientTick) > nMaxDriftTicks)
|
||||||
clientTick == 0 ||
|
|
||||||
abs(nTick - clientTick) > nMaxDriftTicks
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
cl.SetClientTickCount( nTick - (g_ClientGlobalVariables.simTicksThisFrame - 1) );
|
m_nClientTick = (nTick - (g_ClientGlobalVariables.simTicksThisFrame - 1));
|
||||||
if ( cl.GetClientTickCount() < cl.oldtickcount )
|
if (m_nClientTick < cl.oldtickcount)
|
||||||
{
|
{
|
||||||
cl.oldtickcount = cl.GetClientTickCount();
|
cl.oldtickcount = m_nClientTick;
|
||||||
}
|
}
|
||||||
memset( m_ClockOffsets, 0, sizeof( m_ClockOffsets ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Used for testing..
|
// Used for testing..
|
||||||
cl.SetClientTickCount( nTick + cl_clock_correction_force_server_tick.GetInt() );
|
m_nClientTick = (nTick + cl_clock_correction_force_server_tick.GetInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust the clock offset by the clock with thread mode compensation
|
ShowDebugInfo();
|
||||||
m_ClockOffsets[m_iCurClockOffset] = clientTick - m_nServerTick;
|
m_nOldServerTick = m_nServerTick;
|
||||||
m_iCurClockOffset = (m_iCurClockOffset + 1) % NUM_CLOCKDRIFT_SAMPLES;
|
|
||||||
#endif // SWDS
|
#endif // SWDS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CClockDriftMgr::ApplyClockCorrection(bool bFinalTick)
|
||||||
float CClockDriftMgr::AdjustFrameTime( float inputFrameTime )
|
|
||||||
{
|
{
|
||||||
float flAdjustmentThisFrame = 0;
|
if (bFinalTick)
|
||||||
float flAdjustmentPerSec = 0;
|
|
||||||
if ( IsClockCorrectionEnabled()
|
|
||||||
#if !defined( _XBOX ) && !defined( SWDS )
|
|
||||||
&& !demoplayer->IsPlayingBack()
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// Get the clock difference in seconds.
|
m_nCachedRealClientTick++;
|
||||||
float flCurDiffInSeconds = GetCurrentClockDifference() * host_state.interval_per_tick;
|
|
||||||
float flCurDiffInMS = flCurDiffInSeconds * 1000.0f;
|
|
||||||
|
|
||||||
// Is the server ahead or behind us?
|
|
||||||
if ( flCurDiffInMS > cl_clock_correction_adjustment_min_offset.GetFloat() )
|
|
||||||
{
|
|
||||||
flAdjustmentPerSec = -GetClockAdjustmentAmount( flCurDiffInMS );
|
|
||||||
flAdjustmentThisFrame = inputFrameTime * flAdjustmentPerSec;
|
|
||||||
flAdjustmentThisFrame = max( flAdjustmentThisFrame, -flCurDiffInSeconds );
|
|
||||||
}
|
}
|
||||||
else if ( flCurDiffInMS < -cl_clock_correction_adjustment_min_offset.GetFloat() )
|
m_nClientTick = m_nCachedRealClientTick + m_nLagDiff + g_ClientGlobalVariables.simTicksThisFrame - 1;
|
||||||
{
|
|
||||||
flAdjustmentPerSec = GetClockAdjustmentAmount( -flCurDiffInMS );
|
|
||||||
flAdjustmentThisFrame = inputFrameTime * flAdjustmentPerSec;
|
|
||||||
flAdjustmentThisFrame = min( flAdjustmentThisFrame, -flCurDiffInSeconds );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( IsEngineThreaded() )
|
|
||||||
{
|
|
||||||
flAdjustmentThisFrame = -flCurDiffInSeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
AdjustAverageDifferenceBy( flAdjustmentThisFrame );
|
|
||||||
}
|
|
||||||
|
|
||||||
ShowDebugInfo( flAdjustmentPerSec );
|
|
||||||
return inputFrameTime + flAdjustmentThisFrame;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CClockDriftMgr::ShowDebugInfo()
|
||||||
float CClockDriftMgr::GetCurrentClockDifference() const
|
|
||||||
{
|
|
||||||
// Note: this could be optimized a little by updating it each time we add
|
|
||||||
// a sample (subtract the old value from the total and add the new one in).
|
|
||||||
float total = 0;
|
|
||||||
for ( int i=0; i < NUM_CLOCKDRIFT_SAMPLES; i++ )
|
|
||||||
total += m_ClockOffsets[i];
|
|
||||||
|
|
||||||
return total / NUM_CLOCKDRIFT_SAMPLES;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CClockDriftMgr::ShowDebugInfo( float flAdjustment )
|
|
||||||
{
|
{
|
||||||
|
#if !defined( SWDS )
|
||||||
if ( !cl_clock_showdebuginfo.GetInt() )
|
if ( !cl_clock_showdebuginfo.GetInt() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( IsClockCorrectionEnabled() )
|
if ( IsClockCorrectionEnabled() )
|
||||||
{
|
{
|
||||||
int high=-999, low=999;
|
int clientTick = m_nClientTick + g_ClientGlobalVariables.simTicksThisFrame - 1;
|
||||||
int exactDiff = cl.GetClientTickCount() - m_nServerTick;
|
|
||||||
for ( int i=0; i < NUM_CLOCKDRIFT_SAMPLES; i++ )
|
|
||||||
{
|
|
||||||
high = max( (float)high, m_ClockOffsets[i] );
|
|
||||||
low = min( (float)low, m_ClockOffsets[i] );
|
|
||||||
}
|
|
||||||
|
|
||||||
Msg( "Clock drift: adjustment (per sec): %.2fms, avg: %.3f, lo: %d, hi: %d, ex: %d\n", flAdjustment*1000.0f, GetCurrentClockDifference(), low, high, exactDiff );
|
ConMsg( "Clock drift: client sim tick: %i, client tick: %i, server tick: %i, lagged tick: %i, cached server tick: %i\n", clientTick, m_nClientTick, m_nServerTick, m_nLaggedClientTick, m_nCachedRealClientTick);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Msg( "Clock drift disabled.\n" );
|
ConMsg( "Clock drift disabled.\n" );
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void CClockDriftMgr::AdjustAverageDifferenceBy( float flAmountInSeconds )
|
|
||||||
{
|
|
||||||
// Don't adjust the average if it's already tiny.
|
|
||||||
float c = GetCurrentClockDifference();
|
|
||||||
if ( c < 0.05f )
|
|
||||||
return;
|
|
||||||
|
|
||||||
float flAmountInTicks = flAmountInSeconds / host_state.interval_per_tick;
|
|
||||||
float factor = 1 + flAmountInTicks / c;
|
|
||||||
|
|
||||||
for ( int i=0; i < NUM_CLOCKDRIFT_SAMPLES; i++ )
|
|
||||||
m_ClockOffsets[i] *= factor;
|
|
||||||
|
|
||||||
Assert( fabs( GetCurrentClockDifference() - (c + flAmountInTicks) ) < 0.001f );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern float NET_GetFakeLag();
|
extern float NET_GetFakeLag();
|
||||||
|
|
|
@ -26,42 +26,24 @@ public:
|
||||||
|
|
||||||
// This is called each time a server packet comes in. It is used to correlate
|
// This is called each time a server packet comes in. It is used to correlate
|
||||||
// where the server is in time compared to us.
|
// where the server is in time compared to us.
|
||||||
void SetServerTick( int iServerTick );
|
void SetServerTick( int iServerTick, int nLaggedTick, float flServerHostFrametime, float flServerHostFrametimeStdDeviation);
|
||||||
|
void ApplyClockCorrection(bool bFinalTick);
|
||||||
// Pass in the frametime you would use, and it will drift it towards the server clock.
|
|
||||||
float AdjustFrameTime( float inputFrameTime );
|
|
||||||
|
|
||||||
// Returns how many ticks ahead of the server the client is.
|
|
||||||
float GetCurrentClockDifference() const;
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void ShowDebugInfo( float flAdjustment );
|
void ShowDebugInfo();
|
||||||
|
|
||||||
// This scales the offsets so the average produced is equal to the
|
|
||||||
// current average + flAmount. This way, as we add corrections,
|
|
||||||
// we lower the average accordingly so we don't keep responding
|
|
||||||
// as much as we need to after we'd adjusted it a couple times.
|
|
||||||
void AdjustAverageDifferenceBy( float flAmountInSeconds );
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
public:
|
||||||
|
int m_nLagDiff;
|
||||||
enum
|
int m_nOldServerTick;
|
||||||
{
|
|
||||||
// This controls how much it smoothes out the samples from the server.
|
|
||||||
NUM_CLOCKDRIFT_SAMPLES=16
|
|
||||||
};
|
|
||||||
|
|
||||||
// This holds how many ticks the client is ahead each time we get a server tick.
|
|
||||||
// We average these together to get our estimate of how far ahead we are.
|
|
||||||
float m_ClockOffsets[NUM_CLOCKDRIFT_SAMPLES];
|
|
||||||
int m_iCurClockOffset;
|
|
||||||
|
|
||||||
int m_nServerTick; // Last-received tick from the server.
|
int m_nServerTick; // Last-received tick from the server.
|
||||||
int m_nClientTick; // The client's own tick counter (specifically, for interpolation during rendering).
|
int m_nClientTick;
|
||||||
|
int m_nCachedRealClientTick; // The client's own tick counter (specifically, for interpolation during rendering).
|
||||||
// The server may be on a slightly different tick and the client will drift towards it.
|
// The server may be on a slightly different tick and the client will drift towards it.
|
||||||
|
int m_nLaggedClientTick;
|
||||||
|
float m_flServerHostFrametime;
|
||||||
|
float m_flServerHostFrametimeStdDeviation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -473,7 +473,7 @@ void CHLTVClient::SendSnapshot( CClientFrame * pFrame )
|
||||||
// now create client snapshot packet
|
// now create client snapshot packet
|
||||||
|
|
||||||
// send tick time
|
// send tick time
|
||||||
NET_Tick tickmsg( pFrame->tick_count, host_frametime_unbounded, host_frametime_stddeviation );
|
NET_Tick tickmsg( pFrame->tick_count, m_nClientTick, host_frametime_unbounded, host_frametime_stddeviation );
|
||||||
tickmsg.WriteToBuffer( msg );
|
tickmsg.WriteToBuffer( msg );
|
||||||
|
|
||||||
// Update shared client/server string tables. Must be done before sending entities
|
// Update shared client/server string tables. Must be done before sending entities
|
||||||
|
|
|
@ -292,7 +292,7 @@ void CHLTVClientState::SendPacket()
|
||||||
|
|
||||||
if ( IsActive() )
|
if ( IsActive() )
|
||||||
{
|
{
|
||||||
NET_Tick tick( m_nDeltaTick, host_frametime_unbounded, host_frametime_stddeviation );
|
NET_Tick tick( m_nDeltaTick, host_tickcount, host_frametime_unbounded, host_frametime_stddeviation );
|
||||||
m_NetChannel->SendNetMsg( tick );
|
m_NetChannel->SendNetMsg( tick );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@ void CHLTVDemoRecorder::StartRecording( const char *filename, bool bContinuously
|
||||||
m_nFrameCount = 0;
|
m_nFrameCount = 0;
|
||||||
|
|
||||||
m_nStartTick = host_tickcount;
|
m_nStartTick = host_tickcount;
|
||||||
|
m_nClientTick = host_tickcount;
|
||||||
|
|
||||||
// Demo playback should read this as an incoming message.
|
// Demo playback should read this as an incoming message.
|
||||||
// Write the client's realtime value out so we can synchronize the reads.
|
// Write the client's realtime value out so we can synchronize the reads.
|
||||||
|
@ -173,7 +174,7 @@ void CHLTVDemoRecorder::WriteServerInfo()
|
||||||
serverinfo.WriteToBuffer( msg );
|
serverinfo.WriteToBuffer( msg );
|
||||||
|
|
||||||
// send first tick
|
// send first tick
|
||||||
NET_Tick signonTick( m_nSignonTick, 0, 0 );
|
NET_Tick signonTick( m_nSignonTick, m_nClientTick, 0, 0 );
|
||||||
signonTick.WriteToBuffer( msg );
|
signonTick.WriteToBuffer( msg );
|
||||||
|
|
||||||
// write stringtable baselines
|
// write stringtable baselines
|
||||||
|
@ -345,7 +346,7 @@ void CHLTVDemoRecorder::WriteFrame( CHLTVFrame *pFrame )
|
||||||
//now send snapshot data
|
//now send snapshot data
|
||||||
|
|
||||||
// send tick time
|
// send tick time
|
||||||
NET_Tick tickmsg( pFrame->tick_count, host_frametime_unbounded, host_frametime_stddeviation );
|
NET_Tick tickmsg( pFrame->tick_count, m_nClientTick, host_frametime_unbounded, host_frametime_stddeviation );
|
||||||
tickmsg.WriteToBuffer( msg );
|
tickmsg.WriteToBuffer( msg );
|
||||||
|
|
||||||
|
|
||||||
|
@ -381,6 +382,7 @@ void CHLTVDemoRecorder::WriteFrame( CHLTVFrame *pFrame )
|
||||||
|
|
||||||
// update delta tick just like fakeclients do
|
// update delta tick just like fakeclients do
|
||||||
m_nDeltaTick = pFrame->tick_count;
|
m_nDeltaTick = pFrame->tick_count;
|
||||||
|
m_nClientTick = pFrame->tick_count;
|
||||||
|
|
||||||
// write packet to demo file
|
// write packet to demo file
|
||||||
WriteMessages( dem_packet, msg );
|
WriteMessages( dem_packet, msg );
|
||||||
|
|
|
@ -61,6 +61,7 @@ public:
|
||||||
float m_nStartTick;
|
float m_nStartTick;
|
||||||
int m_SequenceInfo;
|
int m_SequenceInfo;
|
||||||
int m_nDeltaTick;
|
int m_nDeltaTick;
|
||||||
|
int m_nClientTick;
|
||||||
int m_nSignonTick;
|
int m_nSignonTick;
|
||||||
bf_write m_MessageData; // temp buffer for all network messages
|
bf_write m_MessageData; // temp buffer for all network messages
|
||||||
};
|
};
|
||||||
|
|
|
@ -1943,11 +1943,6 @@ void Host_AccumulateTime( float dt )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Adjust the client clock very slightly to keep it in line with the server clock.
|
|
||||||
float adj = cl.GetClockDriftMgr().AdjustFrameTime( host_frametime ) - host_frametime;
|
|
||||||
host_frametime += adj;
|
|
||||||
host_frametime_unbounded += adj;
|
|
||||||
|
|
||||||
if ( g_pSoundServices ) // not present on linux server
|
if ( g_pSoundServices ) // not present on linux server
|
||||||
g_pSoundServices->SetSoundFrametime(dt, host_frametime);
|
g_pSoundServices->SetSoundFrametime(dt, host_frametime);
|
||||||
|
|
||||||
|
|
|
@ -289,9 +289,9 @@ bool CClientState::ProcessTick( NET_Tick *msg )
|
||||||
{
|
{
|
||||||
int tick = msg->m_nTick;
|
int tick = msg->m_nTick;
|
||||||
|
|
||||||
m_NetChannel->SetRemoteFramerate( msg->m_flHostFrameTime, msg->m_flHostFrameTimeStdDeviation );
|
m_NetChannel->SetRemoteFramerate(msg->m_flHostFrameTime, msg->m_flHostFrameTimeStdDeviation);
|
||||||
|
|
||||||
m_ClockDriftMgr.SetServerTick( tick );
|
m_ClockDriftMgr.SetServerTick(tick, msg->m_nLagTick, msg->m_flHostFrameTime, msg->m_flHostFrameTimeStdDeviation);
|
||||||
|
|
||||||
// Remember this for GetLastTimeStamp().
|
// Remember this for GetLastTimeStamp().
|
||||||
m_flLastServerTickTime = tick * host_state.interval_per_tick;
|
m_flLastServerTickTime = tick * host_state.interval_per_tick;
|
||||||
|
|
|
@ -567,6 +567,16 @@ DEFERRED_CON_COMMAND(vprof_reset_peaks, "Reset just the peak time in VProf profi
|
||||||
g_VProfCurrentProfile.ResetPeaks();
|
g_VProfCurrentProfile.ResetPeaks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFERRED_CON_COMMAND(vprof_generate_report_full, "Generate a report to the console.")
|
||||||
|
{
|
||||||
|
g_VProfCurrentProfile.Pause();
|
||||||
|
ConsoleLogger consoleLog;
|
||||||
|
// This used to generate six different reports, which is expensive and hard to read. Default to
|
||||||
|
// two to save time and space.
|
||||||
|
g_VProfCurrentProfile.OutputReport( VPRT_FULL );
|
||||||
|
g_VProfCurrentProfile.Resume();
|
||||||
|
}
|
||||||
|
|
||||||
DEFERRED_CON_COMMAND(vprof_generate_report, "Generate a report to the console.")
|
DEFERRED_CON_COMMAND(vprof_generate_report, "Generate a report to the console.")
|
||||||
{
|
{
|
||||||
g_VProfCurrentProfile.Pause();
|
g_VProfCurrentProfile.Pause();
|
||||||
|
|
|
@ -2179,7 +2179,7 @@ void C_BasePlayer::Simulate()
|
||||||
{
|
{
|
||||||
auto player = UTIL_PlayerByIndex(i);
|
auto player = UTIL_PlayerByIndex(i);
|
||||||
|
|
||||||
if (player && player != GetLocalPlayer())
|
if (player)
|
||||||
{
|
{
|
||||||
player->DrawServerHitboxes(60.0f, true);
|
player->DrawServerHitboxes(60.0f, true);
|
||||||
}
|
}
|
||||||
|
@ -2191,7 +2191,7 @@ void C_BasePlayer::Simulate()
|
||||||
{
|
{
|
||||||
auto player = UTIL_PlayerByIndex(entityIndex);
|
auto player = UTIL_PlayerByIndex(entityIndex);
|
||||||
|
|
||||||
if (player && player != GetLocalPlayer())
|
if (player)
|
||||||
{
|
{
|
||||||
player->DrawServerHitboxes(60.0f, true);
|
player->DrawServerHitboxes(60.0f, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -607,10 +607,11 @@ void CCSPlayer::PlayerRunCommand( CUserCmd *ucmd, IMoveHelper *moveHelper )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// don't run commands in the future
|
// don't run commands in the future
|
||||||
if ( !IsEngineThreaded() &&
|
if (!IsEngineThreaded()
|
||||||
( ucmd->tick_count > (gpGlobals->tickcount + sv_max_usercmd_future_ticks.GetInt()) ) )
|
&& ((ucmd->tick_count > (gpGlobals->tickcount + sv_max_usercmd_future_ticks.GetInt()))
|
||||||
|
|| ( ucmd->tick_count < (gpGlobals->tickcount - sv_max_usercmd_future_ticks.GetInt()) )))
|
||||||
{
|
{
|
||||||
DevMsg( "Client cmd out of sync (delta %i).\n", ucmd->tick_count - gpGlobals->tickcount );
|
DevMsg( "Client cmd out of sync (delta: %i, client: %i != server: %i).\n", ucmd->tick_count - gpGlobals->tickcount, ucmd->tick_count, gpGlobals->tickcount);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ BEGIN_VS_SHADER( Cable_DX8,
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the light direction [0,1,0,0] * A * 0.5
|
// This is the light direction [0,1,0,0] * A * 0.5
|
||||||
float lightDir[4] = {0, A*0.5, 0, 0};
|
float lightDir[4] = {0, A*0.5f, 0, 0};
|
||||||
if( g_pHardwareConfig->GetDXSupportLevel() >= 90)
|
if( g_pHardwareConfig->GetDXSupportLevel() >= 90)
|
||||||
{
|
{
|
||||||
SetVertexShaderConstantGammaToLinear( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, lightDir );
|
SetVertexShaderConstantGammaToLinear( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, lightDir );
|
||||||
|
|
|
@ -161,7 +161,7 @@ BEGIN_VS_SHADER( VortWarp_dx8,
|
||||||
pShaderAPI->SetPixelShaderConstant( 5, c5, 1 );
|
pShaderAPI->SetPixelShaderConstant( 5, c5, 1 );
|
||||||
|
|
||||||
float curTime = pShaderAPI->CurrentTime();
|
float curTime = pShaderAPI->CurrentTime();
|
||||||
float selfIllumScroll[4] = { .11f * curTime, .124 * curTime, 0.0f, 0.0f };
|
float selfIllumScroll[4] = { .11f * curTime, .124f * curTime, 0.0f, 0.0f };
|
||||||
pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4, selfIllumScroll, 1 );
|
pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_4, selfIllumScroll, 1 );
|
||||||
|
|
||||||
vortwarp_vs11_Dynamic_Index vshIndex;
|
vortwarp_vs11_Dynamic_Index vshIndex;
|
||||||
|
|
|
@ -61,6 +61,10 @@
|
||||||
|
|
||||||
#ifdef VPROF_ENABLED
|
#ifdef VPROF_ENABLED
|
||||||
|
|
||||||
|
#ifndef VPROF_LEVEL
|
||||||
|
#define VPROF_LEVEL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#define VPROF_VTUNE_GROUP
|
#define VPROF_VTUNE_GROUP
|
||||||
|
|
||||||
#define VPROF( name ) VPROF_(name, 1, VPROF_BUDGETGROUP_OTHER_UNACCOUNTED, false, 0)
|
#define VPROF( name ) VPROF_(name, 1, VPROF_BUDGETGROUP_OTHER_UNACCOUNTED, false, 0)
|
||||||
|
@ -68,7 +72,7 @@
|
||||||
#define VPROF_( name, detail, group, bAssertAccounted, budgetFlags ) VPROF_##detail(name,group, bAssertAccounted, budgetFlags)
|
#define VPROF_( name, detail, group, bAssertAccounted, budgetFlags ) VPROF_##detail(name,group, bAssertAccounted, budgetFlags)
|
||||||
|
|
||||||
#define VPROF_BUDGET( name, group ) VPROF_BUDGET_FLAGS(name, group, BUDGETFLAG_OTHER)
|
#define VPROF_BUDGET( name, group ) VPROF_BUDGET_FLAGS(name, group, BUDGETFLAG_OTHER)
|
||||||
#define VPROF_BUDGET_FLAGS( name, group, flags ) VPROF_(name, 0, group, false, flags)
|
#define VPROF_BUDGET_FLAGS( name, group, flags ) VPROF_(name, 1, group, false, flags)
|
||||||
|
|
||||||
#define VPROF_SCOPE_BEGIN( tag ) do { VPROF( tag )
|
#define VPROF_SCOPE_BEGIN( tag ) do { VPROF( tag )
|
||||||
#define VPROF_SCOPE_END() } while (0)
|
#define VPROF_SCOPE_END() } while (0)
|
||||||
|
@ -152,10 +156,6 @@
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
#ifndef VPROF_LEVEL
|
|
||||||
#define VPROF_LEVEL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//these macros exist to create VProf_<line number> variables. This is important because it avoids /analyze warnings about variable aliasing when VPROF's are nested within each other, and allows
|
//these macros exist to create VProf_<line number> variables. This is important because it avoids /analyze warnings about variable aliasing when VPROF's are nested within each other, and allows
|
||||||
//for multiple VPROF's to exist within the same scope. Three macros must be used to force the __LINE__ to be resolved prior to the token concatenation, but just ignore the _INTERNAL macros and use
|
//for multiple VPROF's to exist within the same scope. Three macros must be used to force the __LINE__ to be resolved prior to the token concatenation, but just ignore the _INTERNAL macros and use
|
||||||
//the VPROF_VAR_NAME
|
//the VPROF_VAR_NAME
|
||||||
|
|
|
@ -418,15 +418,16 @@ BITBUF_INLINE void bf_write::WriteUBitLong( unsigned int curData, int numbits, b
|
||||||
uint32 * RESTRICT pOut = &m_pData[iDWord];
|
uint32 * RESTRICT pOut = &m_pData[iDWord];
|
||||||
|
|
||||||
// Rotate data into dword alignment
|
// Rotate data into dword alignment
|
||||||
curData = (curData << iCurBitMasked) | (curData >> (32 - iCurBitMasked));
|
uint32 dwordCurData = LoadLittleDWord(&curData, 0);
|
||||||
|
curData = (dwordCurData << iCurBitMasked) | (dwordCurData >> (32 - iCurBitMasked));
|
||||||
|
|
||||||
// Calculate bitmasks for first and second word
|
// Calculate bitmasks for first and second word
|
||||||
unsigned int temp = 1 << (numbits-1);
|
unsigned int bitmask = numbits == 32 ? 0xFFFFFFFF : (1 << numbits) - 1;
|
||||||
unsigned int mask1 = (temp*2-1) << iCurBitMasked;
|
unsigned int mask1 = bitmask << iCurBitMasked;
|
||||||
unsigned int mask2 = (temp-1) >> (31 - iCurBitMasked);
|
unsigned int mask2 = ((1 << (numbits - 1))-1) >> (31 - iCurBitMasked);
|
||||||
|
|
||||||
// Only look beyond current word if necessary (avoid access violation)
|
// Only look beyond current word if necessary (avoid access violation)
|
||||||
int i = mask2 & 1;
|
unsigned int i = mask2 & 1;
|
||||||
uint32 dword1 = LoadLittleDWord( pOut, 0 );
|
uint32 dword1 = LoadLittleDWord( pOut, 0 );
|
||||||
uint32 dword2 = LoadLittleDWord( pOut, i );
|
uint32 dword2 = LoadLittleDWord( pOut, i );
|
||||||
|
|
||||||
|
@ -784,12 +785,7 @@ BITBUF_INLINE unsigned int bf_read::ReadUBitLong( int numbits ) RESTRICT
|
||||||
unsigned int iWordOffset2 = iLastBit >> 5;
|
unsigned int iWordOffset2 = iLastBit >> 5;
|
||||||
m_iCurBit += numbits;
|
m_iCurBit += numbits;
|
||||||
|
|
||||||
#if __i386__
|
unsigned int bitmask = numbits == 32 ? 0xFFFFFFFF : (1 << numbits) - 1;
|
||||||
unsigned int bitmask = (2 << (numbits-1)) - 1;
|
|
||||||
#else
|
|
||||||
extern uint32 g_ExtraMasks[33];
|
|
||||||
unsigned int bitmask = g_ExtraMasks[numbits];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned int dw1 = LoadLittleDWord( (uint32* RESTRICT)m_pData, iWordOffset1 ) >> iStartBit;
|
unsigned int dw1 = LoadLittleDWord( (uint32* RESTRICT)m_pData, iWordOffset1 ) >> iStartBit;
|
||||||
unsigned int dw2 = LoadLittleDWord( (uint32* RESTRICT)m_pData, iWordOffset2 ) << (32 - iStartBit);
|
unsigned int dw2 = LoadLittleDWord( (uint32* RESTRICT)m_pData, iWordOffset2 ) << (32 - iStartBit);
|
||||||
|
|
2
wscript
2
wscript
|
@ -280,7 +280,7 @@ def define_platform(conf):
|
||||||
])
|
])
|
||||||
|
|
||||||
conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
|
conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
|
||||||
|
conf.define('VPROF_LEVEL', 1)
|
||||||
|
|
||||||
def options(opt):
|
def options(opt):
|
||||||
grp = opt.add_option_group('Common options')
|
grp = opt.add_option_group('Common options')
|
||||||
|
|
Loading…
Reference in a new issue