Skip to content

Commit 9f269ec

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

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

+1138
-300
lines changed

src/datacache/mdlcache.cpp

Lines changed: 1 addition & 7 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 16 additions & 21 deletions
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

Lines changed: 11 additions & 1 deletion
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

Lines changed: 5 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 9 deletions
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.

0 commit comments

Comments
 (0)