Skip to content

Commit ef23459

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

Some content is hidden

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

62 files changed

+398
-186
lines changed

src/engine/cmodel.cpp

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

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

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

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

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

src/engine/host.h

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

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

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

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

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

0 commit comments

Comments
 (0)