Skip to content

Commit 75f4224

Browse files
committed
pending: experimental changes
1 parent 94fdfd4 commit 75f4224

Some content is hidden

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

65 files changed

+411
-195
lines changed

src/engine/cmodel.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ void FASTCALL CM_TraceToLeaf( TraceInfo_t * RESTRICT pTraceInfo, int ndxLeaf, fl
15701570
pCounters = pTraceInfo->GetDispCounters();
15711571
count = pTraceInfo->GetCount();
15721572

1573-
if (IsX360())
1573+
if (IsX360() || 1)
15741574
{
15751575
// set up some relatively constant variables we'll use in the loop below
15761576
fltx4 traceStart = LoadUnaligned3SIMD(pTraceInfo->m_start.Base());

src/engine/engine.vpc

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ $Configuration
3131

3232
$Compiler [$WIN32]
3333
{
34-
$EnableEnhancedInstructionSet "Streaming SIMD Extensions (/arch:SSE)"
34+
$EnableEnhancedInstructionSet "Streaming SIMD Extensions 2 (/arch:SSE2)"
3535
}
3636

3737
$Linker

src/engine/enginetool.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ void CEngineTool::SetGamePaused( bool paused )
444444

445445
float CEngineTool::GetTimescale()
446446
{
447-
return host_timescale.GetFloat();
447+
return host_timescale.GetFloat() ? host_timescale.GetFloat() : 1.0f;
448448
}
449449

450450
void CEngineTool::SetTimescale( float scale )

src/engine/gl_rsurf.cpp

+33-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "materialsystem/imaterialvar.h"
4848
#include "coordsize.h"
4949
#include "mempool.h"
50+
#include "mathlib/ssemath.h"
5051
#ifndef SWDS
5152
#include "Overlay.h"
5253
#endif
@@ -4839,10 +4840,12 @@ static bool EnumerateLeafInBox_R(mnode_t *node, EnumLeafBoxInfo_t& info )
48394840
}
48404841
}
48414842

4842-
#ifdef _X360
48434843

4844+
#if defined(_X360) || USE_DXMATH
4845+
#ifdef _DEBUG
48444846
static fltx4 AlignThatVector(const Vector &vc)
48454847
{
4848+
#ifdef _X360
48464849
fltx4 out = __loadunalignedvector(vc.Base());
48474850

48484851
/*
@@ -4853,7 +4856,12 @@ static fltx4 AlignThatVector(const Vector &vc)
48534856

48544857
// squelch the w component
48554858
return __vrlimi( out, __vzero(), 1, 0 );
4859+
#elif USE_DXMATH
4860+
fltx4 out = LoadUnaligned3SIMD(vc.Base());
4861+
return DirectX::XMVectorSetW(out, 0);
4862+
#endif
48564863
}
4864+
#endif
48574865

48584866
//-----------------------------------------------------------------------------
48594867
// Finds all leaves of the BSP tree within a particular volume
@@ -4864,9 +4872,11 @@ static bool EnumerateLeafInBox_R(mnode_t * RESTRICT node, const EnumLeafBoxInfo_
48644872
if (node->contents == CONTENTS_SOLID)
48654873
return true; // solid
48664874

4875+
#ifdef _X360
48674876
// speculatively get the children into the cache
48684877
__dcbt(0,node->children[0]);
48694878
__dcbt(0,node->children[1]);
4879+
#endif
48704880

48714881
// constructing these here prevents LHS if we spill.
48724882
// it's not quite a quick enough operation to do extemporaneously.
@@ -4937,6 +4947,7 @@ static bool EnumerateLeafInBox_R(mnode_t * RESTRICT node, const EnumLeafBoxInfo_
49374947
fltx4 vecBoxMax = LoadAlignedSIMD(pInfo->m_vecBoxMax);
49384948
fltx4 cornermin, cornermax;
49394949
// by now planeNormal is ready...
4950+
#ifdef _X360
49404951
fltx4 control = XMVectorGreaterOrEqual( planeNormal, __vzero() );
49414952
// now control[i] = planeNormal[i] > 0 ? 0xFF : 0x00
49424953
cornermin = XMVectorSelect( vecBoxMax, vecBoxMin, control); // cornermin[i] = control[i] ? vecBoxMin[i] : vecBoxMax[i]
@@ -4945,6 +4956,7 @@ static bool EnumerateLeafInBox_R(mnode_t * RESTRICT node, const EnumLeafBoxInfo_
49454956
// compute dot products
49464957
fltx4 dotCornerMax = __vmsum3fp(planeNormal, cornermax); // vsumfp ignores w component
49474958
fltx4 dotCornerMin = __vmsum3fp(planeNormal, cornermin);
4959+
49484960
fltx4 vPlaneDist = ReplicateX4(plane->dist);
49494961
UINT conditionRegister;
49504962
XMVectorGreaterR(&conditionRegister,vPlaneDist,dotCornerMax);
@@ -4954,6 +4966,25 @@ static bool EnumerateLeafInBox_R(mnode_t * RESTRICT node, const EnumLeafBoxInfo_
49544966
XMVectorGreaterOrEqualR(&conditionRegister,dotCornerMin,vPlaneDist);
49554967
if ( XMComparisonAllTrue(conditionRegister) )
49564968
return EnumerateLeafInBox_R( node->children[0], pInfo );
4969+
#elif USE_DXMATH
4970+
fltx4 control = DirectX::XMVectorGreaterOrEqual( planeNormal, LoadZeroSIMD() );
4971+
// now control[i] = planeNormal[i] > 0 ? 0xFF : 0x00
4972+
cornermin = DirectX::XMVectorSelect( vecBoxMax, vecBoxMin, control); // cornermin[i] = control[i] ? vecBoxMin[i] : vecBoxMax[i]
4973+
cornermax = DirectX::XMVectorSelect( vecBoxMin, vecBoxMax, control);
4974+
// compute dot products
4975+
fltx4 dotCornerMax = DirectX::XMVector3Dot(planeNormal, cornermax); // vsumfp ignores w component
4976+
fltx4 dotCornerMin = DirectX::XMVector3Dot(planeNormal, cornermin);
4977+
4978+
fltx4 vPlaneDist = ReplicateX4(plane->dist);
4979+
uint conditionRegister;
4980+
DirectX::XMVectorGreaterR(&conditionRegister,vPlaneDist,dotCornerMax);
4981+
if (DirectX::XMComparisonAllTrue(conditionRegister)) // plane->normal . cornermax <= plane->dist
4982+
return EnumerateLeafInBox_R( node->children[1], pInfo );
4983+
4984+
DirectX::XMVectorGreaterOrEqualR(&conditionRegister,dotCornerMin,vPlaneDist);
4985+
if ( DirectX::XMComparisonAllTrue(conditionRegister) )
4986+
return EnumerateLeafInBox_R( node->children[0], pInfo );
4987+
#endif
49574988

49584989
return EnumerateLeafInBox_R( node->children[0], pInfo ) &&
49594990
EnumerateLeafInBox_R( node->children[1], pInfo );
@@ -5326,7 +5357,7 @@ bool CEngineBSPTree::EnumerateLeavesInBox( const Vector& mins, const Vector& max
53265357
info.m_nContext = context;
53275358
info.m_vecBoxMax = maxs;
53285359
info.m_vecBoxMin = mins;
5329-
#ifdef _X360
5360+
#if defined(_X360) || USE_DXMATH
53305361
if (opt_EnumerateLeavesFastAlgorithm.GetBool())
53315362
return EnumerateLeafInBox_R( host_state.worldbrush->nodes, &info );
53325363
else

src/engine/host.cpp

+14-7
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ static ConVar host_profile( "host_profile","0" );
585585

586586
ConVar host_limitlocal( "host_limitlocal", "0", 0, "Apply cl_cmdrate and cl_updaterate to loopback connection" );
587587
ConVar host_framerate( "host_framerate","0", 0, "Set to lock per-frame time elapse." );
588-
ConVar host_timescale( "host_timescale","1.0", FCVAR_REPLICATED, "Prescale the clock by this amount." );
588+
ConVar host_timescale( "host_timescale","0.0", FCVAR_REPLICATED, "Prescale the clock by this amount." );
589589
ConVar host_speeds( "host_speeds","0", 0, "Show general system running times." ); // set for running times
590590

591591
ConVar host_flush_threshold( "host_flush_threshold", "20", 0, "Memory threshold below which the host should flush caches between server instances" );
@@ -1758,7 +1758,10 @@ void Host_ReadPreStartupConfiguration()
17581758
{
17591759
"sv_unlockedchapters", // needed to display the startup graphic while loading
17601760
"snd_legacy_surround", // needed to init the sound system
1761+
#if defined( _X360 ) || defined( STAGING_ONLY )
17611762
"gameui_xbox", // needed to initialize the correct UI
1763+
#endif
1764+
"cl_hud_minmode", // needed to initialize the correct UI
17621765
"save_in_memory" // needed to preread data from the correct location in UI
17631766
};
17641767

@@ -1867,10 +1870,13 @@ void Host_AccumulateTime( float dt )
18671870
host_frametime = host_state.interval_per_tick;
18681871
}
18691872

1873+
const bool bIsPlayingDemo = demoplayer->IsPlayingBack();
1874+
const float flDemoTimescale = bIsPlayingDemo ? demoplayer->GetPlaybackTimeScale() : 1.0f;
1875+
18701876
#if 1
18711877
if ( host_framerate.GetFloat() > 0
18721878
#if !defined(SWDS)
1873-
&& ( CanCheat() || demoplayer->IsPlayingBack() )
1879+
&& ( CanCheat() || bIsPlayingDemo )
18741880
#endif
18751881
)
18761882
{
@@ -1883,28 +1889,29 @@ void Host_AccumulateTime( float dt )
18831889

18841890
#if !defined(SWDS) && defined( REPLAY_ENABLED )
18851891
extern IDemoPlayer *g_pReplayDemoPlayer;
1886-
if ( demoplayer->IsPlayingBack() && demoplayer == g_pReplayDemoPlayer )
1892+
if ( bIsPlayingDemo && demoplayer == g_pReplayDemoPlayer )
18871893
{
18881894
// adjust time scale if playing back demo
1889-
host_frametime *= demoplayer->GetPlaybackTimeScale();
1895+
host_frametime *= flDemoTimescale;
18901896
}
18911897
#endif
18921898

18931899
host_frametime_unbounded = host_frametime;
18941900
}
18951901
else if (host_timescale.GetFloat() > 0
18961902
#if !defined(SWDS)
1897-
&& ( CanCheat() || demoplayer->IsPlayingBack() )
1903+
&& ( CanCheat() || bIsPlayingDemo )
1904+
|| ( bIsPlayingDemo && flDemoTimescale != 1.0f )
18981905
#endif
18991906
)
19001907
{
19011908
float fullscale = host_timescale.GetFloat();
19021909

19031910
#if !defined(SWDS)
1904-
if ( demoplayer->IsPlayingBack() )
1911+
if ( bIsPlayingDemo )
19051912
{
19061913
// adjust time scale if playing back demo
1907-
fullscale *= demoplayer->GetPlaybackTimeScale();
1914+
fullscale *= flDemoTimescale;
19081915
}
19091916
#endif
19101917

src/engine/host.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ extern int host_currentframetick;
149149

150150
// PERFORMANCE INFO
151151
#define MIN_FPS 0.1 // Host minimum fps value for maxfps.
152-
#define MAX_FPS 1000.0 // Upper limit for maxfps.
152+
#define MAX_FPS 10000.0 // Upper limit for maxfps.
153153

154154
#define MAX_FRAMETIME 0.1
155-
#define MIN_FRAMETIME 0.001
155+
#define MIN_FRAMETIME 0.0001
156156

157157
#define TIME_TO_TICKS( dt ) ( (int)( 0.5f + (float)(dt) / host_state.interval_per_tick ) )
158158
#define TICKS_TO_TIME( dt ) ( host_state.interval_per_tick * (float)(dt) )

src/engine/l_studio.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -2785,11 +2785,11 @@ struct rbatch_t
27852785
// ----------------------------------------
27862786
*/
27872787

2788-
inline int FindModel( const CUtlVector<rmodel_t> &list, const model_t *pModel )
2788+
inline int FindModel( const rmodel_t* pList, int listCount, const model_t* pModel )
27892789
{
2790-
for ( int j = list.Count(); --j >= 0 ; )
2790+
for ( int j = listCount; --j >= 0 ; )
27912791
{
2792-
if ( list[j].pModel == pModel )
2792+
if ( pList[j].pModel == pModel )
27932793
return j;
27942794
}
27952795
return -1;
@@ -2806,13 +2806,13 @@ int CModelRender::DrawStaticPropArrayFast( StaticPropRenderInfo_t *pProps, int c
28062806
#ifndef SWDS
28072807
MDLCACHE_CRITICAL_SECTION_( g_pMDLCache );
28082808
CMatRenderContextPtr pRenderContext( materials );
2809-
const int MAX_OBJECTS = 1024;
2809+
const int MAX_OBJECTS = 2048;
28102810
CUtlSortVector<robject_t, CRobjectLess> objectList(0, MAX_OBJECTS);
2811-
CUtlVector<rmodel_t> modelList(0,256);
2812-
CUtlVector<short> lightObjects(0,256);
2813-
CUtlVector<short> shadowObjects(0,64);
2814-
CUtlVector<rdecalmodel_t> decalObjects(0,64);
2815-
CUtlVector<LightingState_t> lightStates(0,256);
2811+
CUtlVectorFixedGrowable<rmodel_t, 256> modelList;
2812+
CUtlVectorFixedGrowable<short, 256> lightObjects;
2813+
CUtlVectorFixedGrowable<short, 64> shadowObjects;
2814+
CUtlVectorFixedGrowable<rdecalmodel_t, 64> decalObjects;
2815+
CUtlVectorFixedGrowable<LightingState_t, 256> lightStates;
28162816
bool bForceCubemap = r_showenvcubemap.GetBool();
28172817
int drawnCount = 0;
28182818
int forcedLodSetting = r_lod.GetInt();
@@ -2826,7 +2826,7 @@ int CModelRender::DrawStaticPropArrayFast( StaticPropRenderInfo_t *pProps, int c
28262826
{
28272827
drawnCount++;
28282828
// UNDONE: This is a perf hit in some scenes! Use a hash?
2829-
int modelIndex = FindModel( modelList, pProps[i].pModel );
2829+
int modelIndex = FindModel( modelList.Base(), modelList.Count(), pProps[i].pModel );
28302830
if ( modelIndex < 0 )
28312831
{
28322832
modelIndex = modelList.AddToTail();

src/engine/modelloader.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,7 @@
6262

6363
ConVar mat_loadtextures( "mat_loadtextures", "1", FCVAR_CHEAT );
6464

65-
// OS X and Linux are blowing up right now due to this. Benefits vs possible regressions on DX less clear.
66-
#if defined( DX_TO_GL_ABSTRACTION ) || defined( STAGING_ONLY )
67-
#define CONVAR_DEFAULT_MOD_OFFLINE_HDR_SWITCH "1"
68-
#else
69-
#define CONVAR_DEFAULT_MOD_OFFLINE_HDR_SWITCH "0"
70-
#endif
71-
static ConVar mod_offline_hdr_switch( "mod_offline_hdr_switch", CONVAR_DEFAULT_MOD_OFFLINE_HDR_SWITCH, FCVAR_INTERNAL_USE,
65+
static ConVar mod_offline_hdr_switch( "mod_offline_hdr_switch", "1", FCVAR_INTERNAL_USE,
7266
"Re-order the HDR/LDR mode switch to do most of the material system "
7367
"reloading with the device offline. This reduces unnecessary device "
7468
"resource uploads and may drastically reduce load time and memory pressure "

src/engine/net_ws.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -2960,7 +2960,15 @@ void NET_SetTime( double flRealtime )
29602960
}
29612961

29622962
// adjust network time so fakelag works with host_timescale
2963-
net_time += frametime * host_timescale.GetFloat();
2963+
const float timescale = host_timescale.GetFloat();
2964+
if (timescale > 0)
2965+
{
2966+
net_time += frametime * timescale;
2967+
}
2968+
else
2969+
{
2970+
net_time += frametime;
2971+
}
29642972
}
29652973

29662974
/*

src/engine/vgui_baseui_interface.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ IGameConsole *staticGameConsole = NULL;
124124
bool s_bWindowsInputEnabled = true;
125125

126126
ConVar r_drawvgui( "r_drawvgui", "1", FCVAR_CHEAT, "Enable the rendering of vgui panels" );
127+
#if defined( _X360 ) || defined( STAGING_ONLY )
127128
ConVar gameui_xbox( "gameui_xbox", "0", 0 );
129+
#endif
128130

129131
void Con_CreateConsolePanel( vgui::Panel *parent );
130132
void CL_CreateEntityReportPanel( vgui::Panel *parent );
@@ -2142,11 +2144,11 @@ void VGui_FindNamedPanels( CUtlVector< vgui::VPANEL >& panelList, char const *pa
21422144
VGui_RecursiveFindPanels( panelList, embedded, panelname );
21432145
}
21442146

2145-
CON_COMMAND( vgui_togglepanel, "show/hide vgui panel by name." )
2147+
CON_COMMAND_F( vgui_togglepanel, "show/hide vgui panel by name.", FCVAR_CHEAT )
21462148
{
21472149
if ( args.ArgC() < 2 )
21482150
{
2149-
ConMsg( "Usage: vgui_showpanel panelname\n" );
2151+
ConMsg( "Usage: vgui_togglepanel panelname\n" );
21502152
return;
21512153
}
21522154

src/game/client/c_vguiscreen.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,8 @@ C_BaseEntity *FindNearbyVguiScreen( const Vector &viewPosition, const QAngle &vi
650650
// X360TBD: Turn this on if feature actually used
651651
return NULL;
652652
}
653+
// Feature not used, causes crashes if entity exists anyway...
654+
return NULL;
653655

654656
C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
655657

src/game/client/game_controls/MapOverview.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ void CMapOverview::SetMode(int mode)
10191019
{
10201020
ShowPanel( false );
10211021

1022-
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "MapOff" );
1022+
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "MapOff", true, true );
10231023
}
10241024
else if ( mode == MAP_MODE_INSET )
10251025
{
@@ -1041,7 +1041,7 @@ void CMapOverview::SetMode(int mode)
10411041

10421042
if ( mode != m_nMode && RunHudAnimations() )
10431043
{
1044-
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "MapZoomToSmall" );
1044+
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "MapZoomToSmall", true, true );
10451045
}
10461046
}
10471047
else if ( mode == MAP_MODE_FULL )
@@ -1061,7 +1061,7 @@ void CMapOverview::SetMode(int mode)
10611061

10621062
if ( mode != m_nMode && RunHudAnimations() )
10631063
{
1064-
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "MapZoomToLarge" );
1064+
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "MapZoomToLarge", true, true );
10651065
}
10661066
}
10671067

src/game/client/game_controls/baseviewport.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void hud_autoreloadscript_callback( IConVar *var, const char *pOldValue, float f
7979

8080
static ConVar cl_leveloverviewmarker( "cl_leveloverviewmarker", "0", FCVAR_CHEAT );
8181

82-
CON_COMMAND( showpanel, "Shows a viewport panel <name>" )
82+
CON_COMMAND_F( showpanel, "Shows a viewport panel <name>", FCVAR_CHEAT )
8383
{
8484
if ( !gViewPortInterface )
8585
return;
@@ -90,7 +90,7 @@ CON_COMMAND( showpanel, "Shows a viewport panel <name>" )
9090
gViewPortInterface->ShowPanel( args[ 1 ], true );
9191
}
9292

93-
CON_COMMAND( hidepanel, "Hides a viewport panel <name>" )
93+
CON_COMMAND_F( hidepanel, "Hides a viewport panel <name>", FCVAR_CHEAT )
9494
{
9595
if ( !gViewPortInterface )
9696
return;

src/game/client/hud_base_account.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void CHudBaseAccount::LevelInit( void )
2828
m_pszLastAnimationName = NULL;
2929
m_pszQueuedAnimationName = NULL;
3030

31-
GetAnimationController()->StartAnimationSequence("AccountMoneyInvisible");
31+
GetAnimationController()->StartAnimationSequence(this, "AccountMoneyInvisible", true, true);
3232
}
3333

3434
void CHudBaseAccount::ApplySchemeSettings(vgui::IScheme *pScheme)
@@ -91,14 +91,14 @@ void CHudBaseAccount::Paint()
9191
{
9292
m_pszLastAnimationName = "AccountMoneyAdded";
9393
}
94-
GetAnimationController()->StartAnimationSequence( m_pszLastAnimationName );
94+
GetAnimationController()->StartAnimationSequence( this, m_pszLastAnimationName, true, true );
9595
m_flLastAnimationEnd = gpGlobals->curtime + GetAnimationController()->GetAnimationSequenceLength( m_pszLastAnimationName );
9696

9797
m_iPreviousAccount = account;
9898
}
9999
else if ( m_pszQueuedAnimationName )
100100
{
101-
GetAnimationController()->StartAnimationSequence( m_pszQueuedAnimationName );
101+
GetAnimationController()->StartAnimationSequence( this, m_pszQueuedAnimationName, true, true );
102102
m_pszQueuedAnimationName = NULL;
103103
}
104104

src/game/client/hud_controlpointicons.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ void CControlPointIcon::PerformLayout( void )
551551
if ( m_pCapNumPlayers )
552552
{
553553
m_pCapNumPlayers->SetVisible( (iPlayers>1) );
554-
SetDialogVariable( "numcappers", iPlayers );
554+
SetDialogVariable( "numcappers", iPlayers, false );
555555

556556
m_pCapNumPlayers->SetFgColor( Color(0,0,0,255) );
557557
}

0 commit comments

Comments
 (0)