Compare commits

..

34 Commits

Author SHA1 Message Date
ad3bb04b64 LightState_t fix 2024-10-19 22:23:33 +03:00
nillerusr
29985681a1 Merge pull request #312 from AruMoon/add-master-server
Add new master server
2023-12-30 11:44:00 +03:00
nillerusr
53cb673849 Merge pull request #328 from er2off/restrictfix
public/tier0/platform.h: Remove __restrict not only for linux
2023-12-30 11:43:48 +03:00
Er2
f72cf388aa public/tier0/platform.h: Remove __restrict not only for linux 2023-12-30 10:34:50 +03:00
nillerusr
87150cc028 ivp: update submodule 2023-12-24 04:24:44 +03:00
nillerusr
704b8aa98e Merge pull request #323 from coderamen666/patch-1
Allow compilation on Raspberry Pi OS 32 bit
2023-12-13 22:57:38 +03:00
coderamen
c4f13f04a8 Allow compilation on Raspberry Pi OS 32 bit 2023-12-13 13:55:05 -06:00
nillerusr
f402495b24 wscript: make bzip2 mandatory #321 2023-12-13 21:38:18 +03:00
nillerusr
b45295ef7c dedicated(win32): fix crashes( now it works #310 #225 ) 2023-12-13 21:28:17 +03:00
nillerusr
327ea9dee7 Merge pull request #322 from dimhotepus/fix-dedicated-build
[Windows] Fix dedicated server build
2023-12-13 20:24:52 +03:00
nillerusr
ade05ab153 dedicated(win32): fix build issues #322 2023-12-13 20:18:31 +03:00
nillerusr
bfe1baf323 wscript(dedicated): try to fix windows build 2023-12-13 18:19:17 +03:00
nillerusr
a84ee9062c wscript(dedicated): fix indentation 2023-12-13 18:10:34 +03:00
nillerusr
7c863a351b wscript(win32): restore FORCE parameter for multiple references #322
This is using to override debug crt functions.
Does anyone actually use this?
2023-12-13 17:38:02 +03:00
nillerusr
8fcac9c164 wscript(win32): disable /FORCE linker option added by accident #322 2023-12-13 17:25:20 +03:00
Dmitry Tsarevich
97f6cdfbe2 dedicated: Fix build on Windows 2023-12-02 23:59:49 +03:00
nillerusr
7a3b3cd96f return accidentally commented out engine module( fixes #315 ) 2023-11-28 06:47:35 +03:00
nillerusr
90e2937b32 update waf, enable gccdeps and msvcdeps 2023-11-24 11:28:25 +03:00
nillerusr
23204fcc73 wscipt: fix cant find env cache togl 2023-11-08 22:06:10 +03:00
nillerusr
abb470a471 fix build scripts for workflow 2023-11-08 21:58:33 +03:00
nillerusr
ab527be41a wscript: target 64bit architecture by default 2023-11-08 21:44:30 +03:00
nillerusr
cd1c5bd397 fix build for latest musl 2023-11-08 13:26:46 +00:00
AruMoon
8f8c2556b7 Add new master server 2023-10-25 05:18:51 +05:00
nillerusr
b8558de63e fix crash in some cases 2023-10-23 19:52:35 +03:00
nillerusr
047f8b1185 gameui: fix disconnect in video settings for multiplayer games 2023-10-08 02:40:43 +03:00
nillerusr
035861bf52 disable new/mallloc override on non-windows platforms( #299 ) 2023-10-08 00:50:14 +03:00
nillerusr
a7096679aa Merge pull request #301 from tyabus/vguidrawtree
engine: Fixed vgui_drawtree on 64 bit engine
2023-10-07 22:09:19 +03:00
tyabus
1f3f05d14a engine: Fixed vgui_drawtree on 64 bit engine 2023-10-07 20:23:37 +06:00
nillerusr
c444095293 fix macOS build again 2023-10-07 04:40:28 +03:00
nillerusr
57f6bf6eea fix some undefined/unspecified behaviours in multiplayer games( may help with #299 ) 2023-10-07 05:04:46 +03:00
nillerusr
2636f1a66d fix macos build( maybe? #296 ) 2023-10-06 03:33:45 +03:00
nillerusr
e7addfc9ad materialsystem: fix color correction on non-windows systems( fixes #137 , #295 related ) 2023-10-06 04:19:51 +03:00
nillerusr
6447101546 Restore tslist for trace info( fix #295 ) 2023-10-05 19:36:24 +03:00
nillerusr
efeda62add fix crash on game close when demo recording 2023-10-04 22:22:31 +03:00
62 changed files with 1436 additions and 342 deletions

View File

@@ -38,7 +38,7 @@ jobs:
- name: Build windows-i386
run: |
git submodule init && git submodule update
./waf.bat configure -T debug
./waf.bat configure -T debug --32bits
./waf.bat build
build-windows-amd64:
@@ -49,7 +49,7 @@ jobs:
- name: Build windows-amd64
run: |
git submodule init && git submodule update
./waf.bat configure -T debug -8
./waf.bat configure -T debug
./waf.bat build
build-dedicated-windows-i386:
@@ -71,7 +71,7 @@ jobs:
- name: Build dedicated windows-amd64
run: |
git submodule init && git submodule update
./waf.bat configure -T debug -d -8
./waf.bat configure -T debug -d
./waf.bat build
build-dedicated-linux-i386:

View File

@@ -38,7 +38,7 @@ jobs:
- name: Run tests windows-i386
run: |
git submodule init && git submodule update
./waf.bat configure -T release --tests --prefix=out/
./waf.bat configure -T release --tests --prefix=out/ --32bits
./waf.bat install
cd out
$env:Path = "bin";
@@ -52,7 +52,7 @@ jobs:
- name: Run tests windows-amd64
run: |
git submodule init && git submodule update
./waf.bat configure -T release --tests --prefix=out/ -8
./waf.bat configure -T release --tests --prefix=out/
./waf.bat install
cd out
$env:Path = "bin";

View File

@@ -65,9 +65,12 @@ extern void longjmp( jmp_buf, int ) __attribute__((noreturn));
#define JPEGLIB_USE_STDIO
#if ANDROID
#include "android/jpeglib/jpeglib.h"
#else
#elif defined WIN32
#include "jpeglib/jpeglib.h"
#else
#include <jpeglib.h>
#endif
#undef JPEGLIB_USE_STDIO

View File

@@ -278,7 +278,7 @@ bool CDedicatedAppSystemGroup::PreInit( )
return false;
#ifdef _WIN32
g_bVGui = !CommandLine()->CheckParm( "-console" );
g_bVGui = CommandLine()->CheckParm( "-vgui" );
#endif
CreateInterfaceFn factory = GetFactory();

View File

@@ -38,7 +38,12 @@ def build(bld):
if bld.env.DEST_OS == 'win32':
source += [
'sys_windows.cpp'
'sys_windows.cpp',
'vgui/CreateMultiplayerGameServerPage.cpp',
'vgui/MainPanel.cpp',
'../public/vgui_controls/vgui_controls.cpp',
'vgui/vguihelpers.cpp',
'console/TextConsoleWin32.cpp'
]
else:
source += [
@@ -59,6 +64,9 @@ def build(bld):
libs = ['tier0','vpklib','tier1','tier2','tier3','vstdlib','steam_api','appframework','mathlib', 'EDIT']
if bld.env.DEST_OS == 'win32':
libs += ['vgui_controls', 'USER32', 'SHELL32']
install_path = bld.env.LIBDIR
bld.shlib(

View File

@@ -7,7 +7,7 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

View File

@@ -199,7 +199,7 @@ bool CNetworkStringTableItem::SetUserData( int tick, int length, const void *use
if ( length > 0 )
{
m_pUserData = new unsigned char[ length ];
m_pUserData = new unsigned char[ALIGN_VALUE( length, 4 )];
Q_memcpy( m_pUserData, userData, length );
}
else

View File

@@ -706,11 +706,13 @@ bool CBaseClient::SendServerInfo( void )
serverinfo.WriteToBuffer( msg );
if ( IsX360() && serverinfo.m_nMaxClients > 1 )
#ifdef _X360
if ( serverinfo.m_nMaxClients > 1 )
{
Msg( "Telling clients to connect" );
g_pMatchmaking->TellClientsToConnect();
}
#endif
// send first tick
m_nSignonTick = m_Server->m_nTickCount;

View File

@@ -686,7 +686,7 @@ void CDemoRecorder::CloseDemoFile()
m_DemoFile.Close();
g_ClientDLL->OnDemoRecordStop();
if( g_ClientDLL ) g_ClientDLL->OnDemoRecordStop();
}
m_bCloseDemoFile = false;

View File

@@ -6,6 +6,7 @@
#include "client_pch.h"
#ifdef SWDS
#include "igame.h"
#include "hltvclientstate.h"
#include "convar.h"
#include "enginestats.h"
@@ -37,9 +38,9 @@ bool CL_IsPortalDemo()
bool HandleRedirectAndDebugLog( const char *msg );
void BeginLoadingUpdates( MaterialNonInteractiveMode_t mode ) {}
//void BeginLoadingUpdates( MaterialNonInteractiveMode_t mode ) {}
//void EndLoadingUpdates() {}
void RefreshScreenIfNecessary() {}
void EndLoadingUpdates() {}
void Con_ColorPrintf( const Color& clr, const char *fmt, ... )

View File

@@ -97,22 +97,19 @@ COM_ExplainDisconnection
*/
void COM_ExplainDisconnection( bool bPrint, const char *fmt, ... )
{
if ( IsX360() )
{
g_pMatchmaking->SessionNotification( SESSION_NOTIFY_LOST_SERVER );
}
else
{
va_list argptr;
char string[1024];
#ifdef _X360
g_pMatchmaking->SessionNotification( SESSION_NOTIFY_LOST_SERVER );
#else
va_list argptr;
char string[1024];
va_start (argptr, fmt);
Q_vsnprintf(string, sizeof( string ), fmt,argptr);
va_end (argptr);
va_start (argptr, fmt);
Q_vsnprintf(string, sizeof( string ), fmt,argptr);
va_end (argptr);
Q_strncpy( gszDisconnectReason, string, 256 );
gfExtendedError = true;
}
Q_strncpy( gszDisconnectReason, string, 256 );
gfExtendedError = true;
#endif
if ( bPrint )
{
@@ -146,21 +143,18 @@ COM_ExtendedExplainDisconnection
*/
void COM_ExtendedExplainDisconnection( bool bPrint, const char *fmt, ... )
{
if ( IsX360() )
{
g_pMatchmaking->SessionNotification( SESSION_NOTIFY_LOST_SERVER );
}
else
{
va_list argptr;
char string[1024];
va_start (argptr, fmt);
Q_vsnprintf(string, sizeof( string ), fmt,argptr);
va_end (argptr);
#ifdef _X360
g_pMatchmaking->SessionNotification( SESSION_NOTIFY_LOST_SERVER );
#else
va_list argptr;
char string[1024];
Q_strncpy( gszExtendedDisconnectReason, string, 256 );
}
va_start (argptr, fmt);
Q_vsnprintf(string, sizeof( string ), fmt,argptr);
va_end (argptr);
Q_strncpy( gszExtendedDisconnectReason, string, 256 );
#endif
if ( bPrint )
{

View File

@@ -921,7 +921,7 @@ void DownloadThread( void *voidPtr )
// Delete rc.data, which was allocated in this thread
if ( rc.data != NULL )
{
delete[] rc.data;
free(rc.data);
rc.data = NULL;
}

View File

@@ -4934,7 +4934,7 @@ static bool EnumerateLeafInBox_R(mnode_t * RESTRICT node, const EnumLeafBoxInfo_
*/
// take advantage of high throughput/high latency
fltx4 planeNormal = LoadAlignedSIMD( plane->normal.Base() );
fltx4 planeNormal = LoadUnaligned3SIMD( plane->normal.Base() );
fltx4 vecBoxMin = LoadAlignedSIMD(pInfo->m_vecBoxMin);
fltx4 vecBoxMax = LoadAlignedSIMD(pInfo->m_vecBoxMax);
fltx4 cornermin, cornermax;

View File

@@ -3500,10 +3500,12 @@ void _Host_RunFrame (float time)
//-------------------
_Host_RunFrame_Sound();
#ifndef DEDICATED
if ( g_bVCRSingleStep )
{
VCR_EnterPausedState();
}
#endif
}
else
{

View File

@@ -4353,20 +4353,20 @@ ModelInstanceHandle_t CModelRender::CreateInstance( IClientRenderable *pRenderab
// validate static color meshes once, now at load/create time
ValidateStaticPropColorData( handle );
// 360 persists the color meshes across same map loads
if ( !IsX360() || instance.m_ColorMeshHandle == DC_INVALID_HANDLE )
#ifdef _X360
if ( r_decalstaticprops.GetBool() && instance.m_LightCacheHandle )
instance.m_AmbientLightingState = *(LightcacheGetStatic( *pCache, NULL, LIGHTCACHEFLAGS_STATIC ));
#else
if ( instance.m_ColorMeshHandle == DC_INVALID_HANDLE )
{
// builds out color meshes or loads disk colors, now at load/create time
RecomputeStaticLighting( handle );
}
else
if ( r_decalstaticprops.GetBool() && instance.m_LightCacheHandle )
{
instance.m_AmbientLightingState = *(LightcacheGetStatic( *pCache, NULL, LIGHTCACHEFLAGS_STATIC ));
}
#endif
}
return handle;
}

View File

@@ -31,7 +31,8 @@ extern ConVar sv_lan;
static char g_MasterServers[][64] =
{
"185.192.97.130:27010",
"168.138.92.21:27016"
"168.138.92.21:27016",
"135.125.188.162:27010"
};
#ifdef DEDICATED

View File

@@ -226,7 +226,7 @@ bool CPureServerWhitelist::LoadCommandsFromKeyValues( KeyValues *kv )
else
Warning( "Unknown modifier in whitelist file: %s.\n", mods[i] );
}
mods.PurgeAndDeleteElements();
mods.PurgeAndDeleteElementsArray();
if (
( bFromTrustedSource && ( bAllowFromDisk || bCheckCRC || bAny ) )
|| ( bAny && bCheckCRC ) )

View File

@@ -1227,7 +1227,7 @@ void SV_DetermineMulticastRecipients( bool usepas, const Vector& origin, CBitVec
serverGameClients->ClientEarPosition( pClient->edict, &vecEarPosition );
int iBitNumber = CM_LeafCluster( CM_PointLeafnum( vecEarPosition ) );
if ( !(pMask[iBitNumber>>3] & (1<<(iBitNumber&7)) ) )
if ( iBitNumber < 0 || !(pMask[iBitNumber>>3] & (1<<(iBitNumber&7)) ) )
continue;
playerbits.Set( i );

View File

@@ -1534,7 +1534,7 @@ void Sys_NoCrashDialog()
void Sys_TestSendKey( const char *pKey )
{
#if defined(_WIN32) && !defined(USE_SDL) && !defined(_XBOX)
#if defined(_WIN32) && !defined(USE_SDL) && !defined(_XBOX) && !defined(DEDICATED)
int key = pKey[0];
if ( pKey[0] == '\\' && pKey[1] == 'r' )
{

View File

@@ -1842,7 +1842,7 @@ void CVEngineServer::PlaybackTempEntity( IRecipientFilter& filter, float delay,
newEvent->bits = buffer.GetNumBitsWritten();
int size = Bits2Bytes( buffer.GetNumBitsWritten() );
newEvent->pData = new byte[size];
newEvent->pData = new byte[ALIGN_VALUE(size,4)];
Q_memcpy( newEvent->pData, data, size );
// add to list

View File

@@ -268,7 +268,7 @@ public:
if ( data )
{
g_DrawTreeSelectedPanel = (data) ? (vgui::VPANEL)data->GetInt( "PanelPtr", 0 ) : 0;
g_DrawTreeSelectedPanel = (data) ? (vgui::VPANEL)data->GetPtr( "PanelPtr", 0 ) : 0;
}
else
{
@@ -388,7 +388,7 @@ void VGui_RecursivePrintTree(
Q_snprintf( str, sizeof( str ), "%s", name );
pVal->SetString( "Text", str );
pVal->SetInt( "PanelPtr", current );
pVal->SetPtr( "PanelPtr", (void*)current );
pNewParent = pVal;
@@ -417,7 +417,7 @@ bool UpdateItemState(
vgui::IPanel *ipanel = vgui::ipanel();
KeyValues *pItemData = pTree->GetItemData( iChildItemId );
if ( pItemData->GetInt( "PanelPtr" ) != pSub->GetInt( "PanelPtr" ) ||
if ( pItemData->GetPtr( "PanelPtr" ) != pSub->GetPtr( "PanelPtr" ) ||
Q_stricmp( pItemData->GetString( "Text" ), pSub->GetString( "Text" ) ) != 0 )
{
pTree->ModifyItem( iChildItemId, pSub );
@@ -425,7 +425,7 @@ bool UpdateItemState(
}
// Ok, this is a new panel.
vgui::VPANEL vPanel = pSub->GetInt( "PanelPtr" );
vgui::VPANEL vPanel = (vgui::VPANEL)pSub->GetPtr( "PanelPtr" );
int iBaseColor[3] = { 255, 255, 255 };
if ( ipanel->IsPopup( vPanel ) )
@@ -433,7 +433,7 @@ bool UpdateItemState(
iBaseColor[0] = 255; iBaseColor[1] = 255; iBaseColor[2] = 0;
}
if ( g_FocusPanelList.Find( vPanel ) != -1 )
if ( g_FocusPanelList.Find( vPanel ) != vgui::INVALID_PANEL )
{
iBaseColor[0] = 0; iBaseColor[1] = 255; iBaseColor[2] = 0;
pTree->ExpandItem( iChildItemId, true );

View File

@@ -212,25 +212,24 @@ def build(bld):
]
if bld.env.DEST_OS != "darwin":
source += ['audio/snd_dev_sdl.cpp']
source_win = [
'audio/snd_dev_direct.cpp',
'audio/snd_dev_wave.cpp',
'audio/voice_mixer_controls.cpp',
'audio/voice_record_dsound.cpp'
]
if bld.env.DEST_OS == 'win32':
source += [
'../public/tier0/memoverride.cpp',
'audio/snd_dev_direct.cpp',
'audio/snd_dev_wave.cpp',
'audio/voice_mixer_controls.cpp',
'audio/voice_record_dsound.cpp',
]
source += ['../public/tier0/memoverride.cpp']
else:
source += [
'sys_linuxwind.cpp',
'audio/snd_posix.cpp',
]
source += ['audio/snd_posix.cpp']
if bld.env.DEDICATED:
source += ['cl_null.cpp']
source += ['cl_null.cpp', 'sys_stubwind.cpp']
else:
source += source_win if bld.env.DEST_OS == 'win32' else ['sys_stubwind.cpp']
source += [
'client_pch.cpp',
'cl_rcon.cpp',

View File

@@ -4203,7 +4203,7 @@ bool CBaseFileSystem::FindNextFileInVPKOrPakHelper( FindData_t *pFindData )
{
V_strncpy( pFindData->findData.cFileName, V_UnqualifiedFileName( pFindData->m_fileMatchesFromVPKOrPak[0] ), sizeof( pFindData->findData.cFileName ) );
pFindData->findData.dwFileAttributes = 0;
delete pFindData->m_fileMatchesFromVPKOrPak.Head();
delete[] pFindData->m_fileMatchesFromVPKOrPak.Head();
pFindData->m_fileMatchesFromVPKOrPak.RemoveMultipleFromHead( 1 );
return true;

View File

@@ -115,7 +115,7 @@ void CTeamMenu::ApplySchemeSettings(IScheme *pScheme)
if ( *m_szMapName )
{
LoadMapPage( m_szMapName ); // reload the map description to pick up the color
LoadMapPage( NULL ); // reload the map description to pick up the color
}
}
@@ -185,22 +185,23 @@ void CTeamMenu::Update()
void CTeamMenu::LoadMapPage( const char *mapName )
{
// Save off the map name so we can re-load the page in ApplySchemeSettings().
Q_strncpy( m_szMapName, mapName, strlen( mapName ) + 1 );
if( mapName )
Q_strncpy( m_szMapName, mapName, strlen( mapName ) + 1 );
char mapRES[ MAX_PATH ];
char uilanguage[ 64 ];
uilanguage[0] = 0;
engine->GetUILanguage( uilanguage, sizeof( uilanguage ) );
Q_snprintf( mapRES, sizeof( mapRES ), "resource/maphtml/%s_%s.html", mapName, uilanguage );
Q_snprintf( mapRES, sizeof( mapRES ), "resource/maphtml/%s_%s.html", m_szMapName, uilanguage );
bool bFoundHTML = false;
if ( !g_pFullFileSystem->FileExists( mapRES ) )
{
// try english
Q_snprintf( mapRES, sizeof( mapRES ), "resource/maphtml/%s_english.html", mapName );
Q_snprintf( mapRES, sizeof( mapRES ), "resource/maphtml/%s_english.html", m_szMapName );
}
else
{
@@ -240,7 +241,7 @@ void CTeamMenu::LoadMapPage( const char *mapName )
#endif
}
Q_snprintf( mapRES, sizeof( mapRES ), "maps/%s.txt", mapName);
Q_snprintf( mapRES, sizeof( mapRES ), "maps/%s.txt", m_szMapName);
// if no map specific description exists, load default text
if( !g_pFullFileSystem->FileExists( mapRES ) )

View File

@@ -508,7 +508,7 @@ public:
if ( panel == m_pDXLevel && RequiresRestart() )
{
// notify the user that this will require a disconnect
QueryBox *box = new QueryBox("#GameUI_SettingRequiresDisconnect_Title", "#GameUI_SettingRequiresDisconnect_Info");
QueryBox *box = new QueryBox("#GameUI_SettingRequiresDisconnect_Title", "#GameUI_SettingRequiresDisconnect_Info", this);
box->AddActionSignalTarget( this );
box->SetCancelCommand(new KeyValues("ResetDXLevelCombo"));
box->DoModal();

2
ivp

Submodule ivp updated: 4098acbbe3...47533475e0

View File

@@ -82,7 +82,12 @@ void ColorCorrectionLookup_t::AllocTexture()
sprintf( name, "ColorCorrection - %p", m_Handle );
m_pColorCorrectionTexture = ITextureInternal::CreateProceduralTexture( name, TEXTURE_GROUP_OTHER,
COLOR_CORRECTION_TEXTURE_SIZE, COLOR_CORRECTION_TEXTURE_SIZE, COLOR_CORRECTION_TEXTURE_SIZE, IMAGE_FORMAT_BGRX8888,
COLOR_CORRECTION_TEXTURE_SIZE, COLOR_CORRECTION_TEXTURE_SIZE, COLOR_CORRECTION_TEXTURE_SIZE,
#ifdef DX_TO_GL_ABSTRACTION
IMAGE_FORMAT_RGBA8888,
#else
IMAGE_FORMAT_BGRX8888,
#endif
TEXTUREFLAGS_NOMIP | TEXTUREFLAGS_NOLOD | TEXTUREFLAGS_SINGLECOPY | TEXTUREFLAGS_CLAMPS |
TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_CLAMPU | TEXTUREFLAGS_NODEBUGOVERRIDE );

View File

@@ -501,7 +501,6 @@ public:
DELEGATE_TO_OBJECT_0( bool, OnFlushBufferedPrimitives, GetRenderContextInternal() );
void OnThreadEvent( uint32 threadEvent );
ShaderAPITextureHandle_t GetShaderAPITextureBindHandle( ITexture *pTexture, int nFrame, int nTextureChannel ); // JasonM ????
uint32_t GetShaderAPIGLTexture( ITexture *pTexture, int nFrame, int nTextureChannel ); // fuck

View File

@@ -1,53 +0,0 @@
#include "pch_materialsystem.h"
#include "togl/rendermechanism.h"
#define MATSYS_INTERNAL
#include "cmaterialsystem.h"
//-----------------------------------------------------------------------------
// The Base implementation of the shader rendering interface
//-----------------------------------------------------------------------------
class CShaderAPIBase : public IShaderAPI
{
public:
// constructor, destructor
CShaderAPIBase();
virtual ~CShaderAPIBase();
// Called when the device is initializing or shutting down
virtual bool OnDeviceInit() = 0;
virtual void OnDeviceShutdown() = 0;
// Pix events
virtual void BeginPIXEvent( unsigned long color, const char *szName ) = 0;
virtual void EndPIXEvent() = 0;
virtual void AdvancePIXFrame() = 0;
// Release, reacquire objects
virtual void ReleaseShaderObjects() = 0;
virtual void RestoreShaderObjects() = 0;
// Resets the render state to its well defined initial value
virtual void ResetRenderState( bool bFullReset = true ) = 0;
// Returns a d3d texture associated with a texture handle
virtual IDirect3DBaseTexture9* GetD3DTexture( ShaderAPITextureHandle_t hTexture ) = 0;
// Queues a non-full reset of render state next BeginFrame.
virtual void QueueResetRenderState() = 0;
// Methods of IShaderDynamicAPI
public:
virtual void GetCurrentColorCorrection( ShaderColorCorrectionInfo_t* pInfo );
protected:
};
uint32_t CMaterialSystem::GetShaderAPIGLTexture( ITexture *pTexture, int nFrame, int nTextureChannel )
{
ShaderAPITextureHandle_t handle = ShaderSystem()->GetShaderAPITextureBindHandle( pTexture, nFrame, nTextureChannel );
IDirect3DTexture9* pTex = ((CShaderAPIBase*)g_pShaderAPI)->GetD3DTexture(handle);
IDirect3DSurface9* surf = pTex->m_surfZero;
CGLMTex *tex = surf->m_tex;
return tex->GetTexName();
}

View File

@@ -2276,7 +2276,7 @@ public:
{
return false;
}
virtual uint32_t GetShaderAPIGLTexture(ITexture*, int, int) {return 0;}
};

View File

@@ -222,7 +222,7 @@ void DrawFleshInteriorBlendedPass( CBaseVSShader *pShader, IMaterialVar** params
bool bUseStaticControlFlow = g_pHardwareConfig->SupportsStaticControlFlow();
// Set Vertex Shader Combos
LightState_t lightState = { 0, false, false };
LightState_t lightState = { 0, false, false, false };
pShaderAPI->GetDX9LightState( &lightState );
DECLARE_DYNAMIC_VERTEX_SHADER( flesh_interior_blended_pass_vs20 );
SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z );

View File

@@ -234,7 +234,7 @@ void DrawParticleLitGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params,
pShader->BindTexture( SHADER_SAMPLER7, info.m_nFlashlightTexture, info.m_nFlashlightTextureFrame );
}
LightState_t lightState = { 0, false, false };
LightState_t lightState = { 0, false, false, false };
if( !hasFlashlight )
pShaderAPI->GetDX9LightState( &lightState );

View File

@@ -638,7 +638,7 @@ BEGIN_VS_SHADER( pyro_vision, "Help for pyro vision" )
DynamicCmdsOut.SetPixelShaderConstant( 12, vParms.Base() );
int numBones = pShaderAPI->GetCurrentNumBones();
LightState_t lightState = { 0, false, false };
LightState_t lightState = { 0, false, false, false };
if ( bVertexLit && !bFullBright )
{
pShaderAPI->GetDX9LightState( &lightState );

View File

@@ -611,7 +611,7 @@ void DrawSkin_DX9_Internal( CBaseVSShader *pShader, IMaterialVar** params, IShad
}
}
LightState_t lightState = { 0, false, false };
LightState_t lightState = { 0, false, false, false };
bool bFlashlightShadows = false;
if( bHasFlashlight )
{

View File

@@ -1188,7 +1188,7 @@ static void DrawVertexLitGeneric_DX9_Internal( CBaseVSShader *pShader, IMaterial
// Set up light combo state
LightState_t lightState = {0, false, false};
LightState_t lightState = {0, false, false, false};
if ( bVertexLitGeneric && (!bHasFlashlight || IsX360() ) )
{
pShaderAPI->GetDX9LightState( &lightState );

View File

@@ -310,7 +310,7 @@ void DrawVortWarp_DX9( CBaseVSShader *pShader, IMaterialVar** params, IShaderDyn
}
// Set up light combo state
LightState_t lightState = {0, false, false};
LightState_t lightState = {0, false, false, false};
if ( bVertexLitGeneric && !hasFlashlight )
{
pShaderAPI->GetDX9LightState( &lightState );

View File

@@ -45,7 +45,6 @@ def build(bld):
'cmatrendercontext.cpp',
'cmatqueuedrendercontext.cpp',
'ctexturecompositor.cpp',
'gltexturehack.cpp',
'../public/tier0/memoverride.cpp'
]

View File

@@ -1093,7 +1093,6 @@ public:
// Performs final verification of all compositor templates (after they've all been initially loaded).
virtual bool VerifyTextureCompositorTemplates( ) = 0;
virtual uint32_t GetShaderAPIGLTexture( ITexture *pTexture, int nFrame, int nTextureChannel ) = 0;
};

View File

@@ -114,7 +114,7 @@ inline T clamp( T const &val, T const &minVal, T const &maxVal )
// FIXME: this should move to a different file
struct cplane_t
{
VectorAligned normal;
Vector normal;
float dist;
byte type; // for fast side tests
byte signbits; // signx + (signy<<1) + (signz<<1)

View File

@@ -1787,14 +1787,14 @@ FORCEINLINE fltx4 LoadAlignedSIMD( const VectorAligned & pSIMD )
return SetWToZeroSIMD( LoadAlignedSIMD(pSIMD.Base()) );
}
#ifdef __SANITIZE_ADDRESS__
static __attribute__((no_sanitize("address"))) fltx4 LoadUnalignedSIMD( const void *pSIMD )
#ifdef USING_ASAN
static NO_ASAN fltx4 LoadUnalignedSIMD( const void *pSIMD )
{
return _mm_loadu_ps( reinterpret_cast<const float *>( pSIMD ) );
}
static __attribute__((no_sanitize("address"))) fltx4 LoadUnaligned3SIMD( const void *pSIMD )
static NO_ASAN fltx4 LoadUnaligned3SIMD( const void *pSIMD )
{
return _mm_loadu_ps( reinterpret_cast<const float *>( pSIMD ) );
}

1095
public/openvr/openvr.h Normal file

File diff suppressed because it is too large Load Diff

130
public/openvr/openvr_capi.h Normal file
View File

@@ -0,0 +1,130 @@
//====== Copyright (c) 1996-2014, Valve Corporation, All rights reserved. =======
//
// Purpose: Header for flatted SteamAPI. Use this for binding to other languages.
// This file is auto-generated, do not edit it.
//
//=============================================================================
#ifndef __OPENVR_API_FLAT_H__
#define __OPENVR_API_FLAT_H__
#ifdef _WIN32
#pragma once
#endif
// OPENVR API export macro
#if defined( _WIN32 ) && !defined( _X360 )
#if defined( OPENVR_API_EXPORTS )
#define S_API extern "C" __declspec( dllexport )
#elif defined( OPENVR_API_NODLL )
#define S_API extern "C"
#else
#define S_API extern "C" __declspec( dllimport )
#endif // OPENVR_API_EXPORTS
#elif defined( GNUC )
#if defined( OPENVR_API_EXPORTS )
#define S_API extern "C" __attribute__ ((visibility("default")))
#else
#define S_API extern "C"
#endif // OPENVR_API_EXPORTS
#else // !WIN32
#if defined( OPENVR_API_EXPORTS )
#define S_API extern "C"
#else
#define S_API extern "C"
#endif // OPENVR_API_EXPORTS
#endif
#include <stdint.h>
#include "openvr.h"
#include "ivrsystem.h"
#include "ivrcameraaccess.h"
#include "ivrchaperone.h"
#include "ivrchaperonesetup.h"
#include "ivrcompositor.h"
S_API void VR_IVRSystem_GetWindowBounds(intptr_t instancePtr, int32_t * pnX, int32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight);
S_API void VR_IVRSystem_GetRecommendedRenderTargetSize(intptr_t instancePtr, uint32_t * pnWidth, uint32_t * pnHeight);
S_API void VR_IVRSystem_GetEyeOutputViewport(intptr_t instancePtr, vr::Hmd_Eye eEye, uint32_t * pnX, uint32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight);
S_API struct vr::HmdMatrix44_t VR_IVRSystem_GetProjectionMatrix(intptr_t instancePtr, vr::Hmd_Eye eEye, float fNearZ, float fFarZ, vr::GraphicsAPIConvention eProjType);
S_API void VR_IVRSystem_GetProjectionRaw(intptr_t instancePtr, vr::Hmd_Eye eEye, float * pfLeft, float * pfRight, float * pfTop, float * pfBottom);
S_API struct vr::DistortionCoordinates_t VR_IVRSystem_ComputeDistortion(intptr_t instancePtr, vr::Hmd_Eye eEye, float fU, float fV);
S_API struct vr::HmdMatrix34_t VR_IVRSystem_GetEyeToHeadTransform(intptr_t instancePtr, vr::Hmd_Eye eEye);
S_API bool VR_IVRSystem_GetTimeSinceLastVsync(intptr_t instancePtr, float * pfSecondsSinceLastVsync, uint64_t * pulFrameCounter);
S_API int32_t VR_IVRSystem_GetD3D9AdapterIndex(intptr_t instancePtr);
S_API void VR_IVRSystem_GetDXGIOutputInfo(intptr_t instancePtr, int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex);
S_API bool VR_IVRSystem_AttachToWindow(intptr_t instancePtr, void * hWnd);
S_API void VR_IVRSystem_GetDeviceToAbsoluteTrackingPose(intptr_t instancePtr, vr::TrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, struct vr::TrackedDevicePose_t * pTrackedDevicePoseArray, uint32_t unTrackedDevicePoseArrayCount);
S_API void VR_IVRSystem_ResetSeatedZeroPose(intptr_t instancePtr);
S_API struct vr::HmdMatrix34_t VR_IVRSystem_GetSeatedZeroPoseToStandingAbsoluteTrackingPose(intptr_t instancePtr);
S_API bool VR_IVRSystem_LoadRenderModel(intptr_t instancePtr, const char * pchRenderModelName, struct vr::RenderModel_t * pRenderModel);
S_API void VR_IVRSystem_FreeRenderModel(intptr_t instancePtr, struct vr::RenderModel_t * pRenderModel);
S_API vr::TrackedDeviceClass VR_IVRSystem_GetTrackedDeviceClass(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex);
S_API bool VR_IVRSystem_IsTrackedDeviceConnected(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex);
S_API bool VR_IVRSystem_GetBoolTrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
S_API float VR_IVRSystem_GetFloatTrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
S_API int32_t VR_IVRSystem_GetInt32TrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
S_API uint64_t VR_IVRSystem_GetUint64TrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
S_API struct vr::HmdMatrix34_t VR_IVRSystem_GetMatrix34TrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
S_API uint32_t VR_IVRSystem_GetStringTrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, char * pchValue, uint32_t unBufferSize, vr::TrackedPropertyError * pError);
S_API const char * VR_IVRSystem_GetPropErrorNameFromEnum(intptr_t instancePtr, vr::TrackedPropertyError error);
S_API bool VR_IVRSystem_PollNextEvent(intptr_t instancePtr, struct vr::VREvent_t * pEvent);
S_API bool VR_IVRSystem_PollNextEventWithPose(intptr_t instancePtr, vr::TrackingUniverseOrigin eOrigin, vr::VREvent_t * pEvent, vr::TrackedDevicePose_t * pTrackedDevicePose);
S_API const char * VR_IVRSystem_GetEventTypeNameFromEnum(intptr_t instancePtr, vr::EVREventType eType);
S_API struct vr::HiddenAreaMesh_t VR_IVRSystem_GetHiddenAreaMesh(intptr_t instancePtr, vr::Hmd_Eye eEye);
S_API bool VR_IVRSystem_GetControllerState(intptr_t instancePtr, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t * pControllerState);
S_API bool VR_IVRSystem_GetControllerStateWithPose(intptr_t instancePtr, vr::TrackingUniverseOrigin eOrigin, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t * pControllerState, struct vr::TrackedDevicePose_t * pTrackedDevicePose);
S_API void VR_IVRSystem_TriggerHapticPulse(intptr_t instancePtr, vr::TrackedDeviceIndex_t unControllerDeviceIndex, uint32_t unAxisId, unsigned short usDurationMicroSec);
S_API const char * VR_IVRSystem_GetButtonIdNameFromEnum(intptr_t instancePtr, vr::EVRButtonId eButtonId);
S_API const char * VR_IVRSystem_GetControllerAxisTypeNameFromEnum(intptr_t instancePtr, vr::EVRControllerAxisType eAxisType);
S_API bool VR_IVRSystem_HandleControllerOverlayInteractionAsMouse(intptr_t instancePtr, const vr::Compositor_OverlaySettings & overlaySettings, vr::HmdVector2_t vecWindowClientPositionOnScreen, vr::HmdVector2_t vecWindowClientSize, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::EVRControllerEventOutputType eOutputType);
S_API bool VR_IVRSystem_CaptureInputFocus(intptr_t instancePtr);
S_API void VR_IVRSystem_ReleaseInputFocus(intptr_t instancePtr);
S_API bool VR_IVRSystem_IsInputFocusCapturedByAnotherProcess(intptr_t instancePtr);
S_API uint32_t VR_IVRCameraAccess_GetCameraCount(intptr_t instancePtr);
S_API uint32_t VR_IVRCameraAccess_GetCameraId(intptr_t instancePtr, uint32_t unCameraIndex, char * pchBuffer, uint32_t unBufferLen);
S_API bool VR_IVRCameraAccess_EnableCamera(intptr_t instancePtr, uint32_t unCameraIndex, bool bEnabled);
S_API bool VR_IVRCameraAccess_GetCameraInfo(intptr_t instancePtr, uint32_t unCameraIndex, struct vr::CameraInfo_t * pCameraInfo);
S_API bool VR_IVRCameraAccess_GetCameraImage(intptr_t instancePtr, uint32_t unCameraIndex, struct vr::CameraImage_t * pCameraImage);
S_API vr::ChaperoneCalibrationState VR_IVRChaperone_GetCalibrationState(intptr_t instancePtr);
S_API bool VR_IVRChaperone_GetSoftBoundsInfo(intptr_t instancePtr, struct vr::ChaperoneSoftBoundsInfo_t * pInfo);
S_API bool VR_IVRChaperone_GetHardBoundsInfo(intptr_t instancePtr, struct vr::HmdQuad_t * pQuadsBuffer, uint32_t * punQuadsCount);
S_API bool VR_IVRChaperone_GetSeatedBoundsInfo(intptr_t instancePtr, struct vr::ChaperoneSeatedBoundsInfo_t * pInfo);
S_API bool VR_IVRChaperoneSetup_CommitWorkingCopy(intptr_t instancePtr, const char * pchCalibrationName);
S_API void VR_IVRChaperoneSetup_RevertWorkingCopy(intptr_t instancePtr);
S_API bool VR_IVRChaperoneSetup_GetWorkingSoftBoundsInfo(intptr_t instancePtr, struct vr::ChaperoneSoftBoundsInfo_t * pInfo);
S_API bool VR_IVRChaperoneSetup_GetWorkingHardBoundsInfo(intptr_t instancePtr, struct vr::HmdQuad_t * pQuadsBuffer, uint32_t * punQuadsCount);
S_API bool VR_IVRChaperoneSetup_GetWorkingSeatedZeroPoseToRawTrackingPose(intptr_t instancePtr, struct vr::HmdMatrix34_t * pmatSeatedZeroPoseToRawTrackingPose);
S_API bool VR_IVRChaperoneSetup_GetWorkingStandingZeroPoseToRawTrackingPose(intptr_t instancePtr, struct vr::HmdMatrix34_t * pmatStandingZeroPoseToRawTrackingPose);
S_API void VR_IVRChaperoneSetup_SetWorkingSoftBoundsInfo(intptr_t instancePtr, const struct vr::ChaperoneSoftBoundsInfo_t * pInfo);
S_API void VR_IVRChaperoneSetup_SetWorkingHardBoundsInfo(intptr_t instancePtr, struct vr::HmdQuad_t * pQuadsBuffer, uint32_t unQuadsCount);
S_API void VR_IVRChaperoneSetup_SetWorkingSeatedZeroPoseToRawTrackingPose(intptr_t instancePtr, const struct vr::HmdMatrix34_t & matSeatedZeroPoseToRawTrackingPose);
S_API void VR_IVRChaperoneSetup_SetWorkingStandingZeroPoseToRawTrackingPose(intptr_t instancePtr, const struct vr::HmdMatrix34_t & matStandingZeroPoseToRawTrackingPose);
S_API uint32_t VR_IVRCompositor_GetLastError(intptr_t instancePtr, char * pchBuffer, uint32_t unBufferSize);
S_API void VR_IVRCompositor_SetVSync(intptr_t instancePtr, bool bVSync);
S_API bool VR_IVRCompositor_GetVSync(intptr_t instancePtr);
S_API void VR_IVRCompositor_SetGamma(intptr_t instancePtr, float fGamma);
S_API float VR_IVRCompositor_GetGamma(intptr_t instancePtr);
S_API void VR_IVRCompositor_SetGraphicsDevice(intptr_t instancePtr, vr::Compositor_DeviceType eType, void * pDevice);
S_API void VR_IVRCompositor_WaitGetPoses(intptr_t instancePtr, struct vr::TrackedDevicePose_t * pPoseArray, uint32_t unPoseArrayCount);
S_API void VR_IVRCompositor_Submit(intptr_t instancePtr, vr::Hmd_Eye eEye, void * pTexture, struct vr::Compositor_TextureBounds * pBounds);
S_API void VR_IVRCompositor_ClearLastSubmittedFrame(intptr_t instancePtr);
S_API void VR_IVRCompositor_GetOverlayDefaults(intptr_t instancePtr, struct vr::Compositor_OverlaySettings * pSettings);
S_API void VR_IVRCompositor_SetOverlay(intptr_t instancePtr, void * pTexture, struct vr::Compositor_OverlaySettings * pSettings);
S_API void VR_IVRCompositor_SetOverlayRaw(intptr_t instancePtr, void * buffer, uint32_t width, uint32_t height, uint32_t depth, struct vr::Compositor_OverlaySettings * pSettings);
S_API void VR_IVRCompositor_SetOverlayFromFile(intptr_t instancePtr, const char * pchFilePath, struct vr::Compositor_OverlaySettings * pSettings);
S_API void VR_IVRCompositor_ClearOverlay(intptr_t instancePtr);
S_API bool VR_IVRCompositor_GetFrameTiming(intptr_t instancePtr, struct vr::Compositor_FrameTiming * pTiming, uint32_t unFramesAgo);
S_API void VR_IVRCompositor_FadeToColor(intptr_t instancePtr, float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground);
S_API void VR_IVRCompositor_FadeGrid(intptr_t instancePtr, float fSeconds, bool bFadeIn);
S_API void VR_IVRCompositor_CompositorBringToFront(intptr_t instancePtr);
S_API void VR_IVRCompositor_CompositorGoToBack(intptr_t instancePtr);
S_API void VR_IVRCompositor_CompositorQuit(intptr_t instancePtr);
S_API bool VR_IVRCompositor_IsFullscreen(intptr_t instancePtr);
S_API bool VR_IVRCompositor_ComputeOverlayIntersection(intptr_t instancePtr, const struct vr::Compositor_OverlaySettings * pSettings, float fAspectRatio, vr::TrackingUniverseOrigin eOrigin, vr::HmdVector3_t vSource, vr::HmdVector3_t vDirection, vr::HmdVector2_t * pvecIntersectionUV, vr::HmdVector3_t * pvecIntersectionTrackingSpace);
S_API void VR_IVRCompositor_SetTrackingSpace(intptr_t instancePtr, vr::TrackingUniverseOrigin eOrigin);
S_API vr::TrackingUniverseOrigin VR_IVRCompositor_GetTrackingSpace(intptr_t instancePtr);
#endif // __OPENVR_API_FLAT_H__

View File

@@ -345,10 +345,6 @@ unsigned int CPhonemeTag::ComputeDataCheckSum()
//-----------------------------------------------------------------------------
// Purpose: Simple language to string and string to language lookup dictionary
//-----------------------------------------------------------------------------
#if defined(__i386__) || defined(__x86_64__)
#pragma pack(1)
#endif
struct CCLanguage
{
int type;
@@ -371,9 +367,6 @@ static CCLanguage g_CCLanguageLookup[] =
{ CC_THAI, "thai", 0 , 150, 250 },
{ CC_PORTUGUESE,"portuguese", 0 , 0, 150 },
};
#if defined(__i386__) || defined(__x86_64__)
#pragma pack()
#endif
void CSentence::ColorForLanguage( int language, unsigned char& r, unsigned char& g, unsigned char& b )
{
@@ -1767,4 +1760,4 @@ void CSentence::CreateEventWordDistribution( char const *pszText, float flSenten
}
#endif // !_STATIC_LINKED || _SHARED_LIB
#endif // !_STATIC_LINKED || _SHARED_LIB

View File

@@ -95,6 +95,7 @@ enum soundlevel_t
// NOTE: Valid soundlevel_t values are 0-255.
// 256-511 are reserved for sounds using goldsrc compatibility attenuation.
SNDLVBL_MAX = 511
};
#define MAX_SNDLVL_BITS 9 // Used to encode 0-255 for regular soundlevel_t's and 256-511 for goldsrc-compatible ones.

View File

@@ -594,7 +594,7 @@ typedef void * HINSTANCE;
#define FMTFUNCTION( a, b )
#elif defined(GNUC)
#define SELECTANY __attribute__((weak))
#if defined(LINUX) && !defined(DEDICATED)
#ifndef DEDICATED
#define RESTRICT
#else
#define RESTRICT __restrict

View File

@@ -25,9 +25,7 @@
#define GLMDEBUG_H
#include "tier0/platform.h"
#if defined( OSX )
#include <stdarg.h>
#endif
// include this anywhere you need to be able to compile-out code related specifically to GLM debugging.

View File

@@ -25,9 +25,7 @@
#define GLMDEBUG_H
#include "tier0/platform.h"
#if defined( OSX )
#include <stdarg.h>
#endif
// include this anywhere you need to be able to compile-out code related specifically to GLM debugging.

View File

@@ -4,5 +4,5 @@ git submodule init && git submodule update
brew install sdl2
./waf configure -T debug --64bits --disable-warns $* &&
./waf configure -T debug --disable-warns $* &&
./waf build

View File

@@ -4,5 +4,5 @@ git submodule init && git submodule update
sudo apt-get update
sudo apt-get install -f -y libopenal-dev g++-multilib gcc-multilib libpng-dev libjpeg-dev libfreetype6-dev libfontconfig1-dev libcurl4-gnutls-dev libsdl2-dev zlib1g-dev libbz2-dev libedit-dev
./waf configure -T debug --64bits --disable-warns $* &&
./waf configure -T debug --disable-warns $* &&
./waf build

View File

@@ -6,5 +6,5 @@ sudo apt-get update
sudo apt-get install -y aptitude
sudo aptitude install -y libopenal-dev:i386 g++-multilib gcc-multilib libpng-dev:i386 libjpeg-dev:i386 libfreetype6-dev:i386 libfontconfig1-dev:i386 libcurl4-gnutls-dev:i386 libsdl2-dev:i386 zlib1g-dev:i386 libbz2-dev:i386 libedit-dev:i386
PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T debug --disable-warns $* &&
PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T debug --disable-warns --32bits $* &&
./waf build

View File

@@ -1,7 +1,7 @@
#!/bin/sh
git submodule init && git submodule update
./waf configure -T release --sanitize=address,undefined --disable-warns --tests -8 --prefix=out/ $* &&
./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* &&
./waf install &&
cd out &&
DYLD_LIBRARY_PATH=bin/ ./unittest || exit 1

View File

@@ -4,7 +4,7 @@ git submodule init && git submodule update
sudo apt-get update
sudo apt-get install -y libbz2-dev
./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ --64bits $* &&
./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* &&
./waf install &&
cd out &&
LD_LIBRARY_PATH=bin/ ./unittest

View File

@@ -5,7 +5,7 @@ sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y g++-multilib gcc-multilib libbz2-dev:i386
PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T release --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* &&
PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T release --32bits --sanitize=address,undefined --disable-warns --tests --prefix=out/ $* &&
./waf install &&
cd out &&
LD_LIBRARY_PATH=bin/ ./unittest

View File

@@ -80,7 +80,7 @@ CSourceVirtualReality::CSourceVirtualReality()
m_textureGeneratorRight( vr::Eye_Right )
{
m_bActive = false;
m_bUsingOffscreenRenderTarget = true;
m_bUsingOffscreenRenderTarget = false;
m_pHmd = NULL;
}
@@ -207,11 +207,7 @@ void CDistortionTextureRegen::RegenerateTextureBits( ITexture *pTexture, IVTFTex
float u = ( (float)x + 0.5f) / fWidth;
float v = ( (float)y + 0.5f) / fHeight;
DistortionCoordinates_t coords;
if(!g_SourceVirtualReality.GetHmd()->ComputeDistortion( m_eEye, u, v, &coords ))
{
Warning("ComputeDistortion failed");
}
DistortionCoordinates_t coords = g_SourceVirtualReality.GetHmd()->ComputeDistortion( m_eEye, u, v );
coords.rfRed[0] = Clamp( coords.rfRed[0], 0.f, 1.f ) * fUScale + fUOffset;
coords.rfGreen[0] = Clamp( coords.rfGreen[0], 0.f, 1.f ) * fUScale + fUOffset;
@@ -281,9 +277,9 @@ bool CSourceVirtualReality::GetDisplayBounds( VRRect_t *pRect )
{
if( m_pHmd )
{
int32_t x = 0, y = 0;
uint32_t width = 1024, height = 1024;
m_pExtDisplay->GetWindowBounds( &x, &y, &width, &height );
int32_t x, y;
uint32_t width, height;
m_pHmd->GetWindowBounds( &x, &y, &width, &height );
pRect->nX = x;
pRect->nY = y;
pRect->nWidth = width;
@@ -424,9 +420,8 @@ void CSourceVirtualReality::GetViewportBounds( VREye eEye, int *pnX, int *pnY, i
}
else
{
uint32_t x = 0, y = 0, w = 640, h = 480;
// m_pHmd->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
m_pExtDisplay->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
uint32_t x, y, w, h;
m_pHmd->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
if( pnX && pnY )
{
*pnX = x;
@@ -451,14 +446,14 @@ VMatrix CSourceVirtualReality::GetMideyePose()
// ----------------------------------------------------------------------
inline static void ComposeProjectionTransform(float fLeft, float fRight, float fTop, float fBottom, float zNear, float zFar, float fovScale, VMatrix *pmProj )
{
/*if( fovScale != 1.0f && fovScale > 0.f )
if( fovScale != 1.0f && fovScale > 0.f )
{
float fFovScaleAdjusted = tan( atan( fTop ) / fovScale ) / fTop;
fRight *= fFovScaleAdjusted;
fLeft *= fFovScaleAdjusted;
fTop *= fFovScaleAdjusted;
fBottom *= fFovScaleAdjusted;
}*/
}
float idx = 1.0f / (fRight - fLeft);
float idy = 1.0f / (fBottom - fTop);
@@ -535,21 +530,15 @@ bool CSourceVirtualReality::WillDriftInYaw()
void CSourceVirtualReality::AcquireNewZeroPose()
{
// just let the next tracker update re-zero us
if( m_pChap )
m_pChap->ResetZeroPose(TrackingUniverseSeated);
if( m_pHmd )
m_pHmd->ResetSeatedZeroPose();
}
bool CSourceVirtualReality::SampleTrackingState ( float PlayerGameFov, float fPredictionSeconds )
{
if( !m_pHmd || !m_bActive )
return false;
vr::VREvent_t event;
while( m_pHmd->PollNextEvent( &event, sizeof( event ) ) )
{
//ProcessVREvent( event );
}
vr::TrackedDevicePose_t m_rTrackedDevicePose[ vr::k_unMaxTrackedDeviceCount ];
vr::VRCompositor()->WaitGetPoses(m_rTrackedDevicePose, vr::k_unMaxTrackedDeviceCount, NULL, 0 );
// If tracker can't return a pose (it's possibly recalibrating itself)
// then we will freeze tracking at its current state, rather than
// snapping it back to the zero position
@@ -583,7 +572,6 @@ bool CSourceVirtualReality::SampleTrackingState ( float PlayerGameFov, float fPr
return true;
}
#include "togl/rendermechanism.h"
// ----------------------------------------------------------------------
@@ -601,16 +589,10 @@ bool CSourceVirtualReality::DoDistortionProcessing ( VREye eEye )
CMatRenderContextPtr pRenderContext( materials );
IMaterial *pDistortMaterial;
ITexture *pDistortTexture;
if( eEye == VREye_Left )
pDistortMaterial = m_DistortLeftMaterial;
else
pDistortMaterial = m_DistortRightMaterial;
if( eEye == VREye_Left )
pDistortTexture = m_pDistortionTextureLeft;
else
pDistortTexture = m_pDistortionTextureRight;
if( !UsingOffscreenRenderTarget() )
{
@@ -620,48 +602,17 @@ bool CSourceVirtualReality::DoDistortionProcessing ( VREye eEye )
return false;
Rect_t r;
r.x = !eEye?0:640;
r.y = 0;
r.width = 640;
r.height = 480;
this->GetViewportBounds( eEye, &r.x, &r.y, &r.width, &r.height );
pRenderContext->CopyRenderTargetToTextureEx( pFullFrameFB1, 0, &r, &r );
}
// This is where we are rendering to
uint32_t x, y, w, h;
x = !eEye?0:640;
y = 0;
w = 640;
h = 480;
//m_pExtDisplay->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
m_pHmd->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
// pRenderContext->DrawScreenSpaceRectangle ( pDistortMaterial,
// x, y, w, h,
// 0, 0, distortionTextureSize-1,distortionTextureSize-1,distortionTextureSize,distortionTextureSize);
static int id = -1;
//static CDynamicFunctionOpenGL< true, GLvoid ( APIENTRY *)(GLenum pname, GLint *params), GLvoid > glGetIntegerv("glGetIntegerv");
// pRenderContext->Bind(pDistortMaterial);
// pRenderContext->Flush( true );
// ShaderAPITextureHandle_t hndl = materials->GetShaderAPITextureBindHandle(pDistortTexture,0,0);
//if(id < 0)
id = materials->GetShaderAPIGLTexture(m_pPredistortRT,0,0);
static int last_tex[2] = {-1, -1};
// glGetIntegerv(GL_TEXTURE_BINDING_2D, &id);
if(id > 0)
last_tex[eEye != VREye_Left] = id;
// Msg("tex %d\n", id);
const vr::VRTextureBounds_t bounds = { 0.0f, 1.0f, 1.0f, 0.0f };
vr::Texture_t eyeTexture = {(void*)(uintptr_t)last_tex[eEye != VREye_Left], vr::TextureType_OpenGL, vr::ColorSpace_Gamma };
if(last_tex[eEye != VREye_Left] <= 0)
return true;
materials->Flush();
// if(eEye != VREye_Left)
// return 0;
glFinish();
vr::VRCompositor()->Submit(SourceEyeToHmdEye( eEye ), &eyeTexture, &bounds );
pRenderContext->DrawScreenSpaceRectangle ( pDistortMaterial,
x, y, w, h,
0, 0, distortionTextureSize-1,distortionTextureSize-1,distortionTextureSize,distortionTextureSize);
return true;
}
@@ -731,20 +682,11 @@ bool CSourceVirtualReality::CompositeHud ( VREye eEye, float ndcHudBounds[4], bo
CMatRenderContextPtr pRenderContext( materials );
uint32_t x, y, w, h;
x = !eEye?0:640;
y = 0;
w = 640;
h = 480;
m_pExtDisplay->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
int id = materials->GetShaderAPIGLTexture(g_StereoGuiTexture,0,0);
vr::Texture_t guiTexture = {(void*)(uintptr_t)id, vr::TextureType_OpenGL, vr::ColorSpace_Gamma };
const vr::VRTextureBounds_t bounds = { 0.0f, 1.0f, 1.0f, 0.0f };
vr::VROverlay()->SetOverlayTextureBounds(m_GuiOverlay, &bounds);
vr::VROverlay()->SetOverlayTexture(m_GuiOverlay, &guiTexture);
m_pHmd->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
// pRenderContext->DrawScreenSpaceRectangle ( pDistortHUDMaterial,
// x, y, w, h,
// 0, 0, distortionTextureSize-1,distortionTextureSize-1,distortionTextureSize,distortionTextureSize);
pRenderContext->DrawScreenSpaceRectangle ( pDistortHUDMaterial,
x, y, w, h,
0, 0, distortionTextureSize-1,distortionTextureSize-1,distortionTextureSize,distortionTextureSize);
return true;
}
@@ -764,22 +706,14 @@ bool CSourceVirtualReality::StartTracker()
// Initialize SteamVR
vr::HmdError err;
m_pHmd = vr::VR_Init( &err, vr::VRApplication_Scene );
m_pExtDisplay = vr::VRExtendedDisplay();
m_pChap = vr::VRChaperone();
if( err != vr::VRInitError_None )
m_pHmd = vr::VR_Init( &err );
if( err != HmdError_None )
{
Msg( "Unable to initialize HMD tracker. Error code %d\n", err );
return false;
}
if( !vr::VRCompositor() )
{
Msg("Compositor initialization failed. See log file for details");
}
vr::VROverlay()->CreateOverlay("GuiOverlayKey", "GuiOverlay", &m_GuiOverlay);
vr::VROverlay()->ShowOverlay(m_GuiOverlay);
m_pChap->ResetZeroPose(TrackingUniverseSeated);
m_pHmd->ResetSeatedZeroPose();
m_bHaveValidPose = false;
m_ZeroFromHeadPose.Identity();

View File

@@ -124,8 +124,6 @@ private:
CMaterialReference m_blackMaterial;
vr::IVRSystem *m_pHmd;
vr::IVRExtendedDisplay *m_pExtDisplay;
vr::IVRChaperone *m_pChap;
bool m_bHaveValidPose;
VMatrix m_ZeroFromHeadPose;

View File

@@ -1,50 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'sourcevr'
def options(opt):
# stub
return
def configure(conf):
conf.env.append_unique('DEFINES',['strncpy=use_Q_strncpy_instead',
'_snprintf=use_Q_snprintf_instead','SOURCEVR_DLL'])
conf.check_cfg(package='openvr', uselib_store='OPENVR', args=['--cflags', '--libs'])
conf.check(lib='GL', uselib_store='GL')
def build(bld):
source = [
"sourcevirtualreality.cpp"
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1'
] + bld.env.INCLUDES_SDL2
defines = []
libs = ['tier0','tier1','tier2', 'tier3','vstdlib','mathlib','OPENVR', 'GL']
install_path = bld.env.LIBDIR
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

View File

@@ -1010,7 +1010,7 @@ CUtlString D3DToGL::FixGLSLSwizzle( const char *pDestRegisterName, const char *p
{
bool bAbsWrapper = false; // Parameter wrapped in an abs()
bool bAbsNegative = false; // -abs()
char szSrcRegister[128];
static char szSrcRegister[128];
V_strncpy( szSrcRegister, pSrcRegisterName, sizeof(szSrcRegister) );
// Check for abs() or -abs() wrapper and strip it off during the fixup

View File

@@ -32,6 +32,7 @@
#include <sys/param.h>
#include <sys/mount.h>
#elif defined(LINUX)
#define _LARGEFILE64_SOURCE
#include <sys/vfs.h>
#endif
#ifdef OSX

View File

@@ -1500,6 +1500,9 @@ void FileOpenDialog::OnOpen()
char pFileName[MAX_PATH];
GetSelectedFileName( pFileName, sizeof( pFileName ) );
if( !pFileName[0] )
return;
int nLen = Q_strlen( pFileName );
bool bSpecifiedDirectory = ( pFileName[nLen-1] == '/' || pFileName[nLen-1] == '\\' ) && (!IsOSX() || ( IsOSX() && !Q_stristr( pFileName, ".app" ) ) );
Q_StripTrailingSlash( pFileName );

14
waf vendored

File diff suppressed because one or more lines are too long

77
wscript
View File

@@ -26,6 +26,21 @@ FC_CHECK='''extern "C" {
int main() { return (int)FcInit(); }
'''
CPP_64BIT_CHECK='''
#define TEST(a) (sizeof(void*) == a ? 1 : -1)
int g_Test[TEST(8)];
int main () { return 0; }
'''
CPP_32BIT_CHECK='''
#define TEST(a) (sizeof(void*) == a ? 1 : -1)
int g_Test[TEST(4)];
int main () { return 0; }
'''
Context.Context.line_just = 55 # should fit for everything on 80x26
projects={
@@ -79,7 +94,6 @@ projects={
'utils/vtex',
'unicode',
'video',
'sourcevr'
],
'tests': [
'appframework',
@@ -126,6 +140,7 @@ projects={
'tier1',
'tier2',
'tier3',
'vgui2/vgui_controls',
'vphysics',
'vpklib',
'vstdlib',
@@ -156,6 +171,11 @@ def get_taskgen_count(self):
except: idx = 0 # don't set tg_idx_count to not increase counter
return idx
@Configure.conf
def run_test(self, fragment, msg):
result = self.check_cxx(fragment=fragment, msg=msg, mandatory = False)
return False if result == None else True
def define_platform(conf):
conf.env.DEDICATED = conf.options.DEDICATED
conf.env.TESTS = conf.options.TESTS
@@ -163,6 +183,12 @@ def define_platform(conf):
conf.env.GL = conf.options.GL and not conf.options.TESTS and not conf.options.DEDICATED
conf.env.OPUS = conf.options.OPUS
arch32 = conf.run_test(CPP_32BIT_CHECK, 'Testing 32bit support')
arch64 = conf.run_test(CPP_64BIT_CHECK, 'Testing 64bit support')
if not (arch32 ^ arch64):
conf.fatal('Your compiler sucks')
if conf.options.DEDICATED:
conf.options.SDL = False
conf.define('DEDICATED', 1)
@@ -187,7 +213,7 @@ def define_platform(conf):
conf.env.SDL = 1
conf.define('USE_SDL', 1)
if conf.options.ALLOW64:
if arch64:
conf.define('PLATFORM_64BITS', 1)
if conf.env.DEST_OS == 'linux':
@@ -240,6 +266,10 @@ def define_platform(conf):
'_DLL_EXT=.so'
])
if conf.env.DEST_OS != 'win32':
conf.define('NO_MEMOVERRIDE_NEW_DELETE', 1)
# conf.define('NO_MALLOC_OVERRIDE', 1)
if conf.options.DEBUG_ENGINE:
conf.env.append_unique('DEFINES', [
'DEBUG', '_DEBUG'
@@ -249,11 +279,14 @@ def define_platform(conf):
'NDEBUG'
])
conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
def options(opt):
grp = opt.add_option_group('Common options')
grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False,
help = 'allow targetting 64-bit engine(Linux/Windows/OSX x86 only) [default: %default]')
grp.add_option('-4', '--32bits', action = 'store_true', dest = 'TARGET32', default = False,
help = 'allow targetting 32-bit engine(Linux/Windows/OSX x86 only) [default: %default]')
grp.add_option('-d', '--dedicated', action = 'store_true', dest = 'DEDICATED', default = False,
help = 'build dedicated server [default: %default]')
@@ -299,7 +332,7 @@ def options(opt):
def check_deps(conf):
if conf.env.DEST_OS != 'win32':
conf.check_cc(lib='dl', mandatory=False)
conf.check_cc(lib='bz2', mandatory=False)
conf.check_cc(lib='bz2', mandatory=True)
conf.check_cc(lib='rt', mandatory=False)
if not conf.env.LIB_M: # HACK: already added in xcompile!
@@ -359,10 +392,10 @@ def check_deps(conf):
else:
conf.check_pkg('freetype2', 'FT2', FT2_CHECK)
conf.check_pkg('fontconfig', 'FC', FC_CHECK)
# if conf.env.DEST_OS == "darwin":
# conf.env.FRAMEWORK_OPENAL = "OpenAL"
# else:
# conf.check_cfg(package='openal', uselib_store='OPENAL', args=['--cflags', '--libs'])
if conf.env.DEST_OS == "darwin":
conf.env.FRAMEWORK_OPENAL = "OpenAL"
else:
conf.check_cfg(package='openal', uselib_store='OPENAL', args=['--cflags', '--libs'])
conf.check_cfg(package='libjpeg', uselib_store='JPEG', args=['--cflags', '--libs'])
conf.check_cfg(package='libpng', uselib_store='PNG', args=['--cflags', '--libs'])
conf.check_cfg(package='libcurl', uselib_store='CURL', args=['--cflags', '--libs'])
@@ -407,19 +440,24 @@ def configure(conf):
# subsystem=bld.env.MSVC_SUBSYSTEM
# TODO: wrapper around bld.stlib, bld.shlib and so on?
conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01'
conf.env.MSVC_TARGETS = ['x86'] # explicitly request x86 target for MSVC
if conf.options.ALLOW64:
conf.env.MSVC_TARGETS = ['x64']
conf.env.MSVC_TARGETS = ['x64'] # explicitly request x86 target for MSVC
if conf.options.TARGET32:
conf.env.MSVC_TARGETS = ['x86']
if sys.platform == 'win32':
conf.load('msvc_pdb_ext msdev msvs')
conf.load('subproject xcompile compiler_c compiler_cxx gitversion clang_compilation_database strip_on_install_v2 waf_unit_test enforce_pic')
conf.load('msvc_pdb_ext msdev msvs msvcdeps')
conf.load('subproject xcompile compiler_c compiler_cxx gccdeps gitversion clang_compilation_database strip_on_install_v2 waf_unit_test enforce_pic')
if conf.env.DEST_OS == 'win32' and conf.env.DEST_CPU == 'amd64':
conf.load('masm')
elif conf.env.DEST_OS == 'darwin':
conf.load('mm_hook')
conf.env.BIT32_MANDATORY = conf.options.TARGET32
if conf.env.BIT32_MANDATORY:
Logs.info('WARNING: will build engine for 32-bit target')
conf.load('force_32bit')
define_platform(conf)
conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
if conf.env.TOGLES:
projects['game'] += ['togles']
@@ -432,11 +470,6 @@ def configure(conf):
if conf.options.OPUS or conf.env.DEST_OS == 'android':
projects['game'] += ['engine/voice_codecs/opus']
conf.env.BIT32_MANDATORY = not conf.options.ALLOW64
if conf.env.BIT32_MANDATORY:
Logs.info('WARNING: will build engine for 32-bit target')
conf.load('force_32bit')
if conf.options.DISABLE_WARNS:
compiler_optional_flags = ['-w']
else:
@@ -494,7 +527,7 @@ def configure(conf):
flags += ['-fsigned-char']
if conf.env.DEST_CPU == 'arm':
flags += ['-mfpu=neon-vfpv4']
flags += ['-march=armv7-a', '-mfpu=neon-vfpv4']
if conf.env.DEST_OS == 'freebsd':
linkflags += ['-lexecinfo']
@@ -518,11 +551,11 @@ def configure(conf):
if conf.options.BUILD_TYPE == 'debug':
linkflags += [
'/FORCE:MULTIPLE',
'/INCREMENTAL:NO',
'/NODEFAULTLIB:libc',
'/NODEFAULTLIB:libcd',
'/NODEFAULTLIB:libcmt',
'/FORCE',
'/LARGEADDRESSAWARE'
]
else: