Skip to content

Commit 6c86864

Browse files
committed
pending: assorted experimented changes yet to be added to patch set
1 parent 068db7f commit 6c86864

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1148
-301
lines changed

src/datacache/mdlcache.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ namespace {
7878
#define MdlCacheMsg if ( !LogMdlCache() ) ; else Msg
7979
#define MdlCacheWarning if ( !LogMdlCache() ) ; else Warning
8080

81-
#if defined( _X360 )
82-
#define AsyncMdlCache() 0 // Explicitly OFF for 360 (incompatible)
83-
#else
84-
#define AsyncMdlCache() 0
85-
#endif
86-
8781
#define ERROR_MODEL "models/error.mdl"
8882
#define IDSTUDIOHEADER (('T'<<24)+('S'<<16)+('D'<<8)+'I')
8983

@@ -184,7 +178,7 @@ class CTempAllocHelper
184178
// ConVars
185179
//-----------------------------------------------------------------------------
186180
static ConVar r_rootlod( "r_rootlod", "0", FCVAR_ARCHIVE );
187-
static ConVar mod_forcedata( "mod_forcedata", ( AsyncMdlCache() ) ? "0" : "1", 0, "Forces all model file data into cache on model load." );
181+
static ConVar mod_forcedata( "mod_forcedata", "1", 0, "Forces all model file data into cache on model load." );
188182
static ConVar mod_test_not_available( "mod_test_not_available", "0", FCVAR_CHEAT );
189183
static ConVar mod_test_mesh_not_available( "mod_test_mesh_not_available", "0", FCVAR_CHEAT );
190184
static ConVar mod_test_verts_not_available( "mod_test_verts_not_available", "0", FCVAR_CHEAT );

src/engine/audio/private/snd_dma.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extern IVideoServices *g_pVideo;
7070
#define DIST_MULT_TO_SNDLVL( dist_mult ) (soundlevel_t)(int)( dist_mult ? ( 20 * log10( pow( 10.0f, snd_refdb.GetFloat() / 20 ) / (dist_mult * snd_refdist.GetFloat()) ) ) : 0 )
7171

7272
#if !defined( _X360 )
73-
#define THREADED_MIX_TIME 0.015
73+
#define THREADED_MIX_TIME 0.005
7474
#else
7575
#define THREADED_MIX_TIME XMA_POLL_RATE * 0.001
7676
#endif
@@ -470,7 +470,7 @@ static ConVar volume( "volume", "1.0", FCVAR_ARCHIVE | FCVAR_ARCHIVE_XBOX, "Soun
470470
// user configurable music volume
471471
ConVar snd_musicvolume( "snd_musicvolume", "1.0", FCVAR_ARCHIVE | FCVAR_ARCHIVE_XBOX, "Music volume", true, 0.0f, true, 1.0f );
472472

473-
ConVar snd_mixahead( "snd_mixahead", "0.1", FCVAR_DEVELOPMENTONLY ); //
473+
ConVar snd_mixahead( "snd_threaded_mixahead", "0.1", 0 );
474474
#ifdef THREADED_SOUND_UPDATE
475475
ConVar snd_mix_async( "snd_mix_async", "1" );
476476
#else

src/engine/cmd.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ void Cmd_Exec_f( const CCommand &args )
685685
}
686686
}
687687
// force any queued convar changes to flush before reading/writing them
688-
UpdateMaterialSystemConfig();
688+
//UpdateMaterialSystemConfig();
689689
}
690690

691691

src/engine/dt_encode.cpp

+16-21
Original file line numberDiff line numberDiff line change
@@ -222,52 +222,47 @@ void DecodeInfo::CopyVars( const DecodeInfo *pOther )
222222

223223
void Int_Encode( const unsigned char *pStruct, DVariant *pVar, const SendProp *pProp, bf_write *pOut, int objectID )
224224
{
225-
int nValue = pVar->m_Int;
226-
227225
if ( pProp->GetFlags() & SPROP_VARINT)
228226
{
229227
if ( pProp->GetFlags() & SPROP_UNSIGNED )
230228
{
231-
pOut->WriteVarInt32( nValue );
229+
pOut->WriteVarInt32( pVar->m_Int );
232230
}
233231
else
234232
{
235-
pOut->WriteSignedVarInt32( nValue );
233+
pOut->WriteSignedVarInt32( pVar->m_Int );
236234
}
237235
}
238236
else
239237
{
240-
// If signed, preserve lower bits and then re-extend sign if nValue < 0;
241-
// if unsigned, preserve all 32 bits no matter what. Bonus: branchless.
242-
int nPreserveBits = ( 0x7FFFFFFF >> ( 32 - pProp->m_nBits ) );
243-
nPreserveBits |= ( pProp->GetFlags() & SPROP_UNSIGNED ) ? 0xFFFFFFFF : 0;
244-
int nSignExtension = ( nValue >> 31 ) & ~nPreserveBits;
245-
246-
nValue &= nPreserveBits;
247-
nValue |= nSignExtension;
248-
249238
#ifdef DBGFLAG_ASSERT
250239
// Assert that either the property is unsigned and in valid range,
251240
// or signed with a consistent sign extension in the high bits
252241
if ( pProp->m_nBits < 32 )
253242
{
254243
if ( pProp->GetFlags() & SPROP_UNSIGNED )
255244
{
256-
AssertMsg3( nValue == pVar->m_Int, "Unsigned prop %s needs more bits? Expected %i == %i", pProp->GetName(), nValue, pVar->m_Int );
245+
int32 nMaskedValue = pVar->m_Int;
246+
nMaskedValue &= (1u << pProp->m_nBits) - 1;
247+
Assert(nMaskedValue == pVar->m_Int);
257248
}
258249
else
259250
{
260-
AssertMsg3( nValue == pVar->m_Int, "Signed prop %s needs more bits? Expected %i == %i", pProp->GetName(), nValue, pVar->m_Int );
251+
int32 nSignExtendedValue = pVar->m_Int;
252+
nSignExtendedValue <<= 32 - pProp->m_nBits;
253+
nSignExtendedValue >>= 32 - pProp->m_nBits;
254+
Assert(nSignExtendedValue == pVar->m_Int);
261255
}
262256
}
257+
#endif
258+
if (pProp->IsSigned())
259+
{
260+
pOut->WriteSBitLong(pVar->m_Int, pProp->m_nBits);
261+
}
263262
else
264263
{
265-
// This should never trigger, but I'm leaving it in for old-time's sake.
266-
Assert( nValue == pVar->m_Int );
264+
pOut->WriteUBitLong((unsigned int)pVar->m_Int, pProp->m_nBits);
267265
}
268-
#endif
269-
270-
pOut->WriteUBitLong( nValue, pProp->m_nBits, false );
271266
}
272267
}
273268

@@ -322,7 +317,7 @@ int Int_CompareDeltas( const SendProp *pProp, bf_read *p1, bf_read *p2 )
322317
return p1->ReadSignedVarInt32() != p2->ReadSignedVarInt32();
323318
}
324319

325-
return p1->CompareBits(p2, pProp->m_nBits);
320+
return p1->ReadUBitLong(pProp->m_nBits) != p2->ReadUBitLong(pProp->m_nBits);
326321
}
327322

328323
const char* Int_GetTypeNameString()

src/engine/enginetrace.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ abstract_class CEngineTrace : public IEngineTrace
7373
CEngineTrace() { m_pRootMoveParent = NULL; }
7474
// Returns the contents mask at a particular world-space position
7575
virtual int GetPointContents( const Vector &vecAbsPosition, IHandleEntity** ppEntity );
76-
76+
virtual int GetPointContents_WorldOnly( const Vector &vecAbsPosition );
7777
virtual int GetPointContents_Collideable( ICollideable *pCollide, const Vector &vecAbsPosition );
7878

7979
// Traces a ray against a particular edict
@@ -376,6 +376,16 @@ class CPointContentsEnum : public IPartitionEnumerator
376376
};
377377

378378

379+
//-----------------------------------------------------------------------------
380+
// Returns the world contents
381+
//-----------------------------------------------------------------------------
382+
int CEngineTrace::GetPointContents_WorldOnly( const Vector &vecAbsPosition )
383+
{
384+
int nContents = CM_PointContents( vecAbsPosition, 0 );
385+
386+
return nContents;
387+
}
388+
379389
//-----------------------------------------------------------------------------
380390
// Returns the contents mask at a particular world-space position
381391
//-----------------------------------------------------------------------------

src/engine/l_studio.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -3179,15 +3179,18 @@ int CModelRender::DrawStaticPropArrayFast( StaticPropRenderInfo_t *pProps, int c
31793179
#endif // SWDS
31803180
}
31813181

3182+
#ifndef SWDS
3183+
static ConVar r_shadowlod("r_shadowlod", "-1");
3184+
static ConVar r_shadowlodbias("r_shadowlodbias", "2");
3185+
#endif
3186+
31823187
//-----------------------------------------------------------------------------
31833188
// Shadow rendering
31843189
//-----------------------------------------------------------------------------
31853190
matrix3x4_t* CModelRender::DrawModelShadowSetup( IClientRenderable *pRenderable, int body, int skin, DrawModelInfo_t *pInfo, matrix3x4_t *pCustomBoneToWorld )
31863191
{
31873192
#ifndef SWDS
31883193
DrawModelInfo_t &info = *pInfo;
3189-
static ConVar r_shadowlod("r_shadowlod", "-1");
3190-
static ConVar r_shadowlodbias("r_shadowlodbias", "2");
31913194

31923195
model_t const* pModel = pRenderable->GetModel();
31933196
if ( !pModel )

src/engine/modelloader.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5022,7 +5022,7 @@ void CModelLoader::Studio_LoadModel( model_t *pModel, bool bTouchAllData )
50225022
if ( bLoadPhysics && !bPreLoaded )
50235023
{
50245024
// load the collision data now
5025-
bool bSynchronous = bTouchAllData;
5025+
bool bSynchronous = bTouchAllData && !AsyncMdlCache();
50265026
double t1 = Plat_FloatTime();
50275027
g_pMDLCache->GetVCollideEx( pModel->studio, bSynchronous );
50285028

src/engine/shadowmgr.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,8 @@ void CShadowMgr::ApplyShadowToLeaf( const Shadow_t &shadow, mleaf_t* RESTRICT pL
17461746
// computation and at that point we'll remove surfaces that don't
17471747
// actually hit the surface
17481748
SurfaceHandle_t *pHandle = &host_state.worldbrush->marksurfaces[pLeaf->firstmarksurface];
1749-
for ( int i = 0; i < pLeaf->nummarksurfaces; i++ )
1749+
const int nMarkSurfaces = pLeaf->nummarksurfaces;
1750+
for ( int i = 0; i < nMarkSurfaces; i++ )
17501751
{
17511752
SurfaceHandleRestrict_t surfID = pHandle[i];
17521753

src/engine/sv_client.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extern CNetworkStringTableContainer *networkStringTableContainerServer;
3939

4040
static ConVar sv_timeout( "sv_timeout", "65", 0, "After this many seconds without a message from a client, the client is dropped" );
4141
static ConVar sv_maxrate( "sv_maxrate", "0", FCVAR_REPLICATED, "Max bandwidth rate allowed on server, 0 == unlimited" );
42-
static ConVar sv_minrate( "sv_minrate", "3500", FCVAR_REPLICATED, "Min bandwidth rate allowed on server, 0 == unlimited" );
42+
static ConVar sv_minrate( "sv_minrate", V_STRINGIFY( DEFAULT_RATE ), FCVAR_REPLICATED, "Min bandwidth rate allowed on server, 0 == unlimited" );
4343

4444
ConVar sv_maxupdaterate( "sv_maxupdaterate", "66", FCVAR_REPLICATED, "Maximum updates per second that the server will allow" );
4545
ConVar sv_minupdaterate( "sv_minupdaterate", "10", FCVAR_REPLICATED, "Minimum updates per second that the server will allow" );

src/engine/sys_engine.cpp

+3-9
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
#include "vgui_baseui_interface.h"
3636
#endif
3737
#include "tier0/etwprof.h"
38-
#ifdef IS_WINDOWS_PC
39-
#include <windows.h>
40-
#endif
4138

4239
// memdbgon must be the last include file in a .cpp file!!!
4340
#include "tier0/memdbgon.h"
@@ -367,12 +364,9 @@ void CEngine::Frame( void )
367364
while ( Plat_FloatTime() < fWaitEnd )
368365
{
369366
ThreadPause();
370-
// Yield the CPU to other threads.
371-
#ifdef IS_WINDOWS_PC
372-
SwitchToThread();
373-
#elif defined( POSIX )
374-
sched_yield();
375-
#endif
367+
// Yield the CPU to other threads so we don't spin too tightly
368+
// ThreadSleep(0) is not tight enough.
369+
ThreadYield();
376370
}
377371

378372
// Go back to the top of the loop and see if it is time yet.

src/filesystem/basefilesystem.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ CBaseFileSystem *BaseFileSystem()
120120
return g_pBaseFileSystem;
121121
}
122122

123-
ConVar filesystem_buffer_size( "filesystem_buffer_size", "0", 0, "Size of per file buffers. 0 for none" );
123+
ConVar filesystem_buffer_size( "filesystem_buffer_size", "32768", 0, "Size of per file buffers. 0 for none" );
124124

125125
#if defined( TRACK_BLOCKING_IO )
126126

src/filesystem/filesystem_async.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ class CFileAsyncReadJob : public CFileAsyncJob,
342342
else
343343
{
344344
int iPrevPriority = ThreadGetPriority();
345-
ThreadSetPriority( 2 );
345+
ThreadSetPriority( TP_PRIORITY_HIGHEST );
346346
retval = BaseFileSystem()->SyncRead( *this );
347347
ThreadSetPriority( iPrevPriority );
348348
}
@@ -666,7 +666,7 @@ void CBaseFileSystem::InitAsync()
666666
m_pThreadPool = CreateThreadPool();
667667

668668
ThreadPoolStartParams_t params;
669-
params.iThreadPriority = 0;
669+
params.iThreadPriority = TP_PRIORITY_LOW;
670670
params.bIOThreads = true;
671671
params.nThreadsMax = 4; // Limit count of IO threads to a maximum of 4.
672672
if ( IsX360() )
@@ -682,6 +682,7 @@ void CBaseFileSystem::InitAsync()
682682
{
683683
// override defaults
684684
// maximum # of async I/O thread on PC is 2
685+
params.nStackSize = 256 * 1024;
685686
params.nThreads = 1;
686687
}
687688

src/game/client/c_baseanimating.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,7 @@ CStudioHdr *C_BaseAnimating::OnNewModel()
10961096
}
10971097
}
10981098
m_BoneAccessor.Init( this, m_CachedBoneData.Base() ); // Always call this in case the studiohdr_t has changed.
1099+
m_iAccumulatedBoneMask = 0; // Reset the accumulated bone mask.
10991100

11001101
// Free any IK data
11011102
if (m_pIk)
@@ -2904,7 +2905,10 @@ bool C_BaseAnimating::SetupBones( matrix3x4_t *pBoneToWorldOut, int nMaxBones, i
29042905
m_flLastBoneSetupTime = currentTime;
29052906
}
29062907
m_iPrevBoneMask = m_iAccumulatedBoneMask;
2907-
m_iAccumulatedBoneMask = 0;
2908+
// UNDONE: don't fully reset this so we can accumulate all usage of this entity over time for setting up all dependencies on the first call.
2909+
// Basically, if we know this model will be used for attachments, set those up so we don't have an additional evaluation at that time
2910+
m_iAccumulatedBoneMask = m_iAccumulatedBoneMask & BONE_USED_BY_ATTACHMENT;
2911+
29082912

29092913
#ifdef STUDIO_ENABLE_PERF_COUNTERS
29102914
CStudioHdr *hdr = GetModelPtr();
@@ -2923,7 +2927,7 @@ bool C_BaseAnimating::SetupBones( matrix3x4_t *pBoneToWorldOut, int nMaxBones, i
29232927
g_PreviousBoneSetups.AddToTail( this );
29242928
}
29252929

2926-
// Keep track of everthing asked for over the entire frame
2930+
// Keep track of everything asked for over the entire frame
29272931
m_iAccumulatedBoneMask |= boneMask;
29282932

29292933
// Make sure that we know that we've already calculated some bone stuff this time around.

src/game/client/c_baseanimating.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ class C_BaseAnimating : public C_BaseEntity, private IModelLoadCallback
265265
// Attachments.
266266
bool GetAttachment( const char *szName, Vector &absOrigin );
267267
bool GetAttachment( const char *szName, Vector &absOrigin, QAngle &absAngles );
268-
virtual bool GetAttachmentDeferred( int number, matrix3x4_t &matrix );
268+
virtual bool GetAttachmentDeferred( int number, matrix3x4_t &matrix );
269269

270270
// Inherited from C_BaseEntity
271271
virtual bool GetAttachment( int number, Vector &origin );

src/game/client/c_baseplayer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ bool C_BasePlayer::AudioStateIsUnderwater( Vector vecMainViewOrigin )
499499
if ( IsObserver() )
500500
{
501501
// Just check the view position
502-
int cont = enginetrace->GetPointContents ( vecMainViewOrigin );
502+
int cont = enginetrace->GetPointContents_WorldOnly ( vecMainViewOrigin );
503503
return (cont & MASK_WATER);
504504
}
505505

src/game/client/cdll_client_int.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include "datacache/imdlcache.h"
6161
#include "kbutton.h"
6262
#include "tier0/icommandline.h"
63+
#include "vstdlib/jobthread.h"
6364
#include "gamerules_register.h"
6465
#include "vgui_controls/AnimationController.h"
6566
#include "bitmap/tgawriter.h"
@@ -838,6 +839,14 @@ bool IsEngineThreaded()
838839
return false;
839840
}
840841

842+
bool InitParticleManager()
843+
{
844+
if (!ParticleMgr()->Init(MAX_TOTAL_PARTICLES, materials))
845+
return false;
846+
847+
return true;
848+
}
849+
841850
//-----------------------------------------------------------------------------
842851
// Constructor
843852
//-----------------------------------------------------------------------------
@@ -991,9 +1000,8 @@ int CHLClient::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physi
9911000
if (!Initializer::InitializeAllObjects())
9921001
return false;
9931002

994-
if (!ParticleMgr()->Init(MAX_TOTAL_PARTICLES, materials))
995-
return false;
996-
1003+
CFunctorJob *pGameJob = new CFunctorJob( CreateFunctor( InitParticleManager ) );
1004+
g_pThreadPool->AddJob( pGameJob );
9971005

9981006
if (!VGui_Startup( appSystemFactory ))
9991007
return false;
@@ -1035,6 +1043,8 @@ int CHLClient::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physi
10351043

10361044
modemanager->Init( );
10371045

1046+
pGameJob->WaitForFinishAndRelease();
1047+
10381048
g_pClientMode->InitViewport();
10391049

10401050
gHUD.Init();

src/game/client/prediction.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1708,8 +1708,10 @@ void CPrediction::_Update( bool received_new_world_update, bool validframe,
17081708
Assert( C_BaseEntity::IsAbsQueriesValid() );
17091709

17101710
// FIXME: What about hierarchy here?!?
1711+
#if 0 // Where is this ever used?
17111712
SetIdealPitch( localPlayer, localPlayer->GetLocalOrigin(), localPlayer->GetLocalAngles(), localPlayer->m_vecViewOffset );
17121713
#endif
1714+
#endif
17131715
}
17141716

17151717

src/game/client/tf/tf_hud_tournament.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ void CHudTournament::PreparePanel( void )
270270
if ( TFGameRules()->IsInPreMatch() )
271271
{
272272
bool bCountdownVisible = false;
273-
bool bAutoReady = false;
273+
bool bAutoReady = true;
274274
const IMatchGroupDescription* pMatchDesc = GetMatchGroupDescription( TFGameRules()->GetCurrentMatchGroup() );
275275
if ( pMatchDesc )
276276
{
@@ -598,7 +598,7 @@ void CHudTournament::OnTick( void )
598598
InvalidateLayout( false, true );
599599
}
600600

601-
if ( TFGameRules()->IsCompetitiveMode() )
601+
if ( TFGameRules()->IsCompetitiveMode() || true )
602602
{
603603
if ( !m_bCompetitiveMode )
604604
{
@@ -620,7 +620,7 @@ void CHudTournament::OnTick( void )
620620
if ( m_bReadyStatusMode )
621621
{
622622
const IMatchGroupDescription* pMatchDesc = GetMatchGroupDescription( TFGameRules()->GetCurrentMatchGroup() );
623-
if ( !pMatchDesc || !pMatchDesc->m_params.m_bAutoReady )
623+
if ( false && (!pMatchDesc || !pMatchDesc->m_params.m_bAutoReady) )
624624
{
625625
RecalculatePlayerPanels();
626626

src/game/client/tf/vgui/tf_match_summary.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ void CTFMatchSummary::ApplySchemeSettings( vgui::IScheme *pScheme )
190190
const IMatchGroupDescription* pMatch = GetMatchGroupDescription( TFGameRules()->GetCurrentMatchGroup() );
191191
if ( pMatch )
192192
{
193-
if ( pMatch->m_params.m_pmm_match_group_size->GetInt() > 12 )
193+
if ( true || pMatch->m_params.m_pmm_match_group_size->GetInt() > 12 )
194194
{
195195
pConditions = new KeyValues( "conditions" );
196196
AddSubKeyNamed( pConditions, "if_large" );

0 commit comments

Comments
 (0)