Skip to content

Commit

Permalink
OpenXR - First Attempt to add OpenXR to Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
MadDeCoDeR committed Dec 29, 2024
1 parent aaa3a7c commit f85852d
Show file tree
Hide file tree
Showing 49 changed files with 451 additions and 398 deletions.
25 changes: 12 additions & 13 deletions neo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -DNDEBUG -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -fno-strict-aliasing ${my_warn_flags}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -g -rdynamic -O3 -DID_RETAIL -DALLOW_DEV -D_GLDEBUG -DNDEBUG -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -fno-strict-aliasing -Werror -Wno-error=invalid-pch -Wno-error=invalid-offsetof ${my_warn_flags}")
#set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -Os -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -fno-strict-aliasing ${my_warn_flags}")
set(CMAKE_C_FLAGS_RETAIL "${CMAKE_C_FLAGS_RETAIL} -s -O3 -DID_RETAIL -DNDEBUG -ffast-math -fno-strict-aliasing -Werror -Wno-error=invalid-pch -Wno-error=invalid-offsetof ${my_warn_flags}" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RETAIL "${CMAKE_C_FLAGS_RETAIL} -s -O3 -DID_RETAIL -DNDEBUG -ffast-math -fno-strict-aliasing -Werror -Wno-error=invalid-pch -Wno-error=invalid-offsetof -Wno-error=uninitialized ${my_warn_flags}" CACHE STRING "" FORCE)



Expand Down Expand Up @@ -503,8 +503,8 @@ if (USE_OPENXR)
set(BUILD_API_LAYERS ON)
FetchContent_Declare(
OpenXR
URL_HASH MD5=927EE8D4699DFB4DDD9B0A16A37EDBFC
URL https://github.com/KhronosGroup/OpenXR-SDK-Source/archive/refs/tags/release-1.1.37.tar.gz
URL_HASH MD5=A8DE805EE5C34C180A5B630EBD816850
URL https://github.com/KhronosGroup/OpenXR-SDK-Source/archive/refs/tags/release-1.1.43.tar.gz
SOURCE_DIR
../neo/libs/openxr
)
Expand Down Expand Up @@ -1067,11 +1067,6 @@ if (USE_DXGI)
else()
list(APPEND WIN32_SOURCES sys/win32/win_glimp.cpp)
endif()

if (USE_OPENXR)
list(APPEND WIN32_SOURCES sys/win32/win_oxr.cpp)
list(APPEND WIN32_INCLUDES sys/win32/win_oxr.h)
endif()

if(MSVC)
list(APPEND WIN32_SOURCES sys/win32/win_cpu.cpp)
Expand Down Expand Up @@ -1437,6 +1432,12 @@ include_directories(
# ${CMAKE_CURRENT_SOURCE_DIR}/libs/curl/lib
# ${CMAKE_CURRENT_SOURCE_DIR}/libs/openal/lib)


if (USE_OPENXR)
list(APPEND RBDOOM3_INCLUDES ${RENDERER_OPENXR_INCLUDES})
list(APPEND RBDOOM3_SOURCES ${RENDERER_OPENXR_SOURCES})
endif()

if(MSVC)

# if(MSVC_VERSION EQUAL 1700)
Expand Down Expand Up @@ -1527,11 +1528,6 @@ if(MSVC)
glu32)
endif()

if (USE_OPENXR)
list(APPEND RBDOOM3_INCLUDES ${RENDERER_OPENXR_INCLUDES})
list(APPEND RBDOOM3_SOURCES ${RENDERER_OPENXR_SOURCES})
endif()


list(APPEND RBDOOM3_INCLUDES
${SOUND_COMMON_INCLUDES})
Expand Down Expand Up @@ -2071,6 +2067,9 @@ else()
${GLU_LIBRARY}
${CMAKE_DL_LIBS}
)
if (USE_OPENXR)
target_link_libraries(DoomBFA openxr-gfxwrapper openxr_loader)
endif()
endif()

endif()
28 changes: 26 additions & 2 deletions neo/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,15 @@
"generator": "Unix Makefiles",
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"USE_OPENXR": {
"type": "BOOL",
"value": "ON"
},
"CMAKE_DISABLE_FIND_PACKAGE_jsoncpp" : {
"type": "BOOL",
"value": "ON"
}
}
},
{
Expand Down Expand Up @@ -294,7 +302,15 @@
"generator": "Unix Makefiles",
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Retail"
"CMAKE_BUILD_TYPE": "Retail",
"USE_OPENXR": {
"type": "BOOL",
"value": "ON"
},
"CMAKE_DISABLE_FIND_PACKAGE_jsoncpp" : {
"type": "BOOL",
"value": "ON"
}
}
},
{
Expand All @@ -319,6 +335,14 @@
"INSIDE_PACKAGE": {
"type": "BOOL",
"value": "ON"
},
"USE_OPENXR": {
"type": "BOOL",
"value": "ON"
},
"CMAKE_DISABLE_FIND_PACKAGE_jsoncpp" : {
"type": "BOOL",
"value": "ON"
}
}
},
Expand Down
66 changes: 33 additions & 33 deletions neo/aas/AASFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,45 +41,45 @@ If you have questions concerning this license or the applicable additional terms
#define AAS_FILEVERSION "1.07"

// travel flags
#define TFL_INVALID BIT(0) // not valid
#define TFL_WALK BIT(1) // walking
#define TFL_CROUCH BIT(2) // crouching
#define TFL_WALKOFFLEDGE BIT(3) // walking of a ledge
#define TFL_BARRIERJUMP BIT(4) // jumping onto a barrier
#define TFL_JUMP BIT(5) // jumping
#define TFL_LADDER BIT(6) // climbing a ladder
#define TFL_SWIM BIT(7) // swimming
#define TFL_WATERJUMP BIT(8) // jump out of the water
#define TFL_TELEPORT BIT(9) // teleportation
#define TFL_ELEVATOR BIT(10) // travel by elevator
#define TFL_FLY BIT(11) // fly
#define TFL_SPECIAL BIT(12) // special
#define TFL_WATER BIT(21) // travel through water
#define TFL_AIR BIT(22) // travel through air
#define TFL_INVALID IDBIT(0) // not valid
#define TFL_WALK IDBIT(1) // walking
#define TFL_CROUCH IDBIT(2) // crouching
#define TFL_WALKOFFLEDGE IDBIT(3) // walking of a ledge
#define TFL_BARRIERJUMP IDBIT(4) // jumping onto a barrier
#define TFL_JUMP IDBIT(5) // jumping
#define TFL_LADDER IDBIT(6) // climbing a ladder
#define TFL_SWIM IDBIT(7) // swimming
#define TFL_WATERJUMP IDBIT(8) // jump out of the water
#define TFL_TELEPORT IDBIT(9) // teleportation
#define TFL_ELEVATOR IDBIT(10) // travel by elevator
#define TFL_FLY IDBIT(11) // fly
#define TFL_SPECIAL IDBIT(12) // special
#define TFL_WATER IDBIT(21) // travel through water
#define TFL_AIR IDBIT(22) // travel through air

// face flags
#define FACE_SOLID BIT(0) // solid at the other side
#define FACE_LADDER BIT(1) // ladder surface
#define FACE_FLOOR BIT(2) // standing on floor when on this face
#define FACE_LIQUID BIT(3) // face seperating two areas with liquid
#define FACE_LIQUIDSURFACE BIT(4) // face seperating liquid and air
#define FACE_SOLID IDBIT(0) // solid at the other side
#define FACE_LADDER IDBIT(1) // ladder surface
#define FACE_FLOOR IDBIT(2) // standing on floor when on this face
#define FACE_LIQUID IDBIT(3) // face seperating two areas with liquid
#define FACE_LIQUIDSURFACE IDBIT(4) // face seperating liquid and air

// area flags
#define AREA_FLOOR BIT(0) // AI can stand on the floor in this area
#define AREA_GAP BIT(1) // area has a gap
#define AREA_LEDGE BIT(2) // if entered the AI bbox partly floats above a ledge
#define AREA_LADDER BIT(3) // area contains one or more ladder faces
#define AREA_LIQUID BIT(4) // area contains a liquid
#define AREA_CROUCH BIT(5) // AI cannot walk but can only crouch in this area
#define AREA_REACHABLE_WALK BIT(6) // area is reachable by walking or swimming
#define AREA_REACHABLE_FLY BIT(7) // area is reachable by flying
#define AREA_FLOOR IDBIT(0) // AI can stand on the floor in this area
#define AREA_GAP IDBIT(1) // area has a gap
#define AREA_LEDGE IDBIT(2) // if entered the AI bbox partly floats above a ledge
#define AREA_LADDER IDBIT(3) // area contains one or more ladder faces
#define AREA_LIQUID IDBIT(4) // area contains a liquid
#define AREA_CROUCH IDBIT(5) // AI cannot walk but can only crouch in this area
#define AREA_REACHABLE_WALK IDBIT(6) // area is reachable by walking or swimming
#define AREA_REACHABLE_FLY IDBIT(7) // area is reachable by flying

// area contents flags
#define AREACONTENTS_SOLID BIT(0) // solid, not a valid area
#define AREACONTENTS_WATER BIT(1) // area contains water
#define AREACONTENTS_CLUSTERPORTAL BIT(2) // area is a cluster portal
#define AREACONTENTS_OBSTACLE BIT(3) // area contains (part of) a dynamic obstacle
#define AREACONTENTS_TELEPORTER BIT(4) // area contains (part of) a teleporter trigger
#define AREACONTENTS_SOLID IDBIT(0) // solid, not a valid area
#define AREACONTENTS_WATER IDBIT(1) // area contains water
#define AREACONTENTS_CLUSTERPORTAL IDBIT(2) // area is a cluster portal
#define AREACONTENTS_OBSTACLE IDBIT(3) // area contains (part of) a dynamic obstacle
#define AREACONTENTS_TELEPORTER IDBIT(4) // area contains (part of) a teleporter trigger

// bits for different bboxes
#define AREACONTENTS_BBOX_BIT 24
Expand Down
6 changes: 3 additions & 3 deletions neo/d3xp/Item.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ ITEM_GIVE_FEEDBACK | ITEM_GIVE_UPDATE_STATE.
*/
enum itemGiveFlags_t
{
ITEM_GIVE_FEEDBACK = BIT( 0 ),
ITEM_GIVE_UPDATE_STATE = BIT( 1 ),
ITEM_GIVE_FROM_WEAPON = BIT( 2 ), // indicates this was given via a weapon's launchPowerup (for bloodstone powerups)
ITEM_GIVE_FEEDBACK = IDBIT( 0 ),
ITEM_GIVE_UPDATE_STATE = IDBIT( 1 ),
ITEM_GIVE_FROM_WEAPON = IDBIT( 2 ), // indicates this was given via a weapon's launchPowerup (for bloodstone powerups)
};

class idItem : public idEntity
Expand Down
2 changes: 1 addition & 1 deletion neo/d3xp/Leaderboards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void LeaderboardLocal_Init()
{

// Check the supported modes on the map.
if( maps[ mapIdx ].supportedModes & BIT( modeIdx ) )
if( maps[ mapIdx ].supportedModes & IDBIT( modeIdx ) )
{

const columnGameMode_t gamemode = gameMode_columnDefs[ modeIdx ];
Expand Down
10 changes: 5 additions & 5 deletions neo/d3xp/ai/AI.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ typedef struct obstaclePath_s
// path prediction
typedef enum
{
SE_BLOCKED = BIT( 0 ),
SE_ENTER_LEDGE_AREA = BIT( 1 ),
SE_ENTER_OBSTACLE = BIT( 2 ),
SE_FALL = BIT( 3 ),
SE_LAND = BIT( 4 )
SE_BLOCKED = IDBIT( 0 ),
SE_ENTER_LEDGE_AREA = IDBIT( 1 ),
SE_ENTER_OBSTACLE = IDBIT( 2 ),
SE_FALL = IDBIT( 3 ),
SE_LAND = IDBIT( 4 )
} stopEvent_t;

typedef struct predictedPath_s
Expand Down
12 changes: 6 additions & 6 deletions neo/d3xp/anim/Anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ typedef struct
#define ANIM_BIT_QY 4
#define ANIM_BIT_QZ 5

#define ANIM_TX BIT( ANIM_BIT_TX )
#define ANIM_TY BIT( ANIM_BIT_TY )
#define ANIM_TZ BIT( ANIM_BIT_TZ )
#define ANIM_QX BIT( ANIM_BIT_QX )
#define ANIM_QY BIT( ANIM_BIT_QY )
#define ANIM_QZ BIT( ANIM_BIT_QZ )
#define ANIM_TX IDBIT( ANIM_BIT_TX )
#define ANIM_TY IDBIT( ANIM_BIT_TY )
#define ANIM_TZ IDBIT( ANIM_BIT_TZ )
#define ANIM_QX IDBIT( ANIM_BIT_QX )
#define ANIM_QY IDBIT( ANIM_BIT_QY )
#define ANIM_QZ IDBIT( ANIM_BIT_QZ )

typedef enum
{
Expand Down
2 changes: 1 addition & 1 deletion neo/d3xp/gamesys/SysCmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ void Cmd_Give_f( const idCmdArgs& args )

if( give_all || idStr::Icmp( name, "weapons" ) == 0 )
{
player->inventory.weapons = ( int )( BIT( MAX_WEAPONS ) - 1 );
player->inventory.weapons = ( int )( IDBIT( MAX_WEAPONS ) - 1 );
player->CacheWeapons();

if( !give_all )
Expand Down
2 changes: 1 addition & 1 deletion neo/d3xp/menus/MenuScreen_Shell_Leaderboards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void idMenuScreen_Shell_Leaderboards::Initialize( idMenuHandler* data )
for( int modeIndex = 0; modeIndex < numModes; ++modeIndex )
{
// Check the supported modes on the map.
if( maps[ mapIndex ].supportedModes & BIT( modeIndex ) )
if( maps[ mapIndex ].supportedModes & IDBIT( modeIndex ) )
{
#ifdef __MONOLITH__
int boardID = LeaderboardLocal_GetID( mapIndex, modeIndex );
Expand Down
6 changes: 3 additions & 3 deletions neo/d3xp/menus/MenuScreen_Shell_MatchSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ void idMenuScreen_Shell_MatchSettings::idMenuDataSource_MatchSettings::AdjustFie
}
matchParameters.gameMap %= maps.Num();
matchParameters.mapName = maps[ matchParameters.gameMap ].mapFile;
if( ( maps[matchParameters.gameMap].supportedModes & BIT( matchParameters.gameMode ) ) != 0 )
if( ( maps[matchParameters.gameMap].supportedModes & IDBIT( matchParameters.gameMode ) ) != 0 )
{
// This map supports this mode
break;
Expand All @@ -434,11 +434,11 @@ void idMenuScreen_Shell_MatchSettings::idMenuDataSource_MatchSettings::AdjustFie
}
matchParameters.gameMode %= modes.Num();
updateMap = false;
if( ( maps[matchParameters.gameMap].supportedModes & BIT( matchParameters.gameMode ) ) == 0 )
if( ( maps[matchParameters.gameMap].supportedModes & IDBIT( matchParameters.gameMode ) ) == 0 )
{
for( int i = 0; i < maps.Num(); ++i )
{
if( ( maps[i].supportedModes & BIT( matchParameters.gameMode ) ) != 0 )
if( ( maps[i].supportedModes & IDBIT( matchParameters.gameMode ) ) != 0 )
{
matchParameters.gameMap = i;
updateMap = true;
Expand Down
8 changes: 4 additions & 4 deletions neo/d3xp/menus/MenuScreen_Shell_Stereoscopics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,10 @@ void idMenuScreen_Shell_Stereoscopics::idMenuDataSource_StereoSettings::AdjustFi
if( fieldIndex == STEREO_FIELD_ENABLE )
{
int numOptions = NUM_STEREO_ENABLE;
if( !renderSystem->HasQuadBufferSupport() )
{
numOptions--;
}
// if( !renderSystem->HasQuadBufferSupport() )
// {
// numOptions--;
// }
#ifndef USE_OPENXR
numOptions--;
#endif
Expand Down
2 changes: 1 addition & 1 deletion neo/d3xp/physics/Clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static idList<trmCache_s*> traceModelCache;
static idList<trmCache_s*> traceModelCache_Unsaved;
static idHashIndex traceModelHash;
static idHashIndex traceModelHash_Unsaved;
const static int TRACE_MODEL_SAVED = BIT( 16 );
const static int TRACE_MODEL_SAVED = IDBIT( 16 );


/*
Expand Down
36 changes: 18 additions & 18 deletions neo/framework/CVarSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,25 @@ If you have questions concerning this license or the applicable additional terms
typedef enum
{
CVAR_ALL = -1, // all flags
CVAR_BOOL = BIT( 0 ), // variable is a boolean
CVAR_INTEGER = BIT( 1 ), // variable is an integer
CVAR_FLOAT = BIT( 2 ), // variable is a float
CVAR_SYSTEM = BIT( 3 ), // system variable
CVAR_RENDERER = BIT( 4 ), // renderer variable
CVAR_SOUND = BIT( 5 ), // sound variable
CVAR_GUI = BIT( 6 ), // gui variable
CVAR_GAME = BIT( 7 ), // game variable
CVAR_TOOL = BIT( 8 ), // tool variable
CVAR_BOOL = IDBIT( 0 ), // variable is a boolean
CVAR_INTEGER = IDBIT( 1 ), // variable is an integer
CVAR_FLOAT = IDBIT( 2 ), // variable is a float
CVAR_SYSTEM = IDBIT( 3 ), // system variable
CVAR_RENDERER = IDBIT( 4 ), // renderer variable
CVAR_SOUND = IDBIT( 5 ), // sound variable
CVAR_GUI = IDBIT( 6 ), // gui variable
CVAR_GAME = IDBIT( 7 ), // game variable
CVAR_TOOL = IDBIT( 8 ), // tool variable
// original doom3 used to have CVAR_USERINFO ("sent to servers, available to menu") here
CVAR_SERVERINFO = BIT( 10 ), // sent from servers, available to menu
CVAR_NETWORKSYNC = BIT( 11 ), // cvar is synced from the server to clients
CVAR_STATIC = BIT( 12 ), // statically declared, not user created
CVAR_CHEAT = BIT( 13 ), // variable is considered a cheat
CVAR_NOCHEAT = BIT( 14 ), // variable is not considered a cheat
CVAR_INIT = BIT( 15 ), // can only be set from the command-line
CVAR_ROM = BIT( 16 ), // display only, cannot be set by user at all
CVAR_ARCHIVE = BIT( 17 ), // set to cause it to be saved to a config file
CVAR_MODIFIED = BIT( 18 ) // set when the variable is modified
CVAR_SERVERINFO = IDBIT( 10 ), // sent from servers, available to menu
CVAR_NETWORKSYNC = IDBIT( 11 ), // cvar is synced from the server to clients
CVAR_STATIC = IDBIT( 12 ), // statically declared, not user created
CVAR_CHEAT = IDBIT( 13 ), // variable is considered a cheat
CVAR_NOCHEAT = IDBIT( 14 ), // variable is not considered a cheat
CVAR_INIT = IDBIT( 15 ), // can only be set from the command-line
CVAR_ROM = IDBIT( 16 ), // display only, cannot be set by user at all
CVAR_ARCHIVE = IDBIT( 17 ), // set to cause it to be saved to a config file
CVAR_MODIFIED = IDBIT( 18 ) // set when the variable is modified
} cvarFlags_t;


Expand Down
12 changes: 6 additions & 6 deletions neo/framework/CmdSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ If you have questions concerning this license or the applicable additional terms
typedef enum
{
CMD_FL_ALL = -1,
CMD_FL_CHEAT = BIT( 0 ), // command is considered a cheat
CMD_FL_SYSTEM = BIT( 1 ), // system command
CMD_FL_RENDERER = BIT( 2 ), // renderer command
CMD_FL_SOUND = BIT( 3 ), // sound command
CMD_FL_GAME = BIT( 4 ), // game command
CMD_FL_TOOL = BIT( 5 ) // tool command
CMD_FL_CHEAT = IDBIT( 0 ), // command is considered a cheat
CMD_FL_SYSTEM = IDBIT( 1 ), // system command
CMD_FL_RENDERER = IDBIT( 2 ), // renderer command
CMD_FL_SOUND = IDBIT( 3 ), // sound command
CMD_FL_GAME = IDBIT( 4 ), // game command
CMD_FL_TOOL = IDBIT( 5 ) // tool command
} cmdFlags_t;

// parameters for command buffer stuffing
Expand Down
Loading

0 comments on commit f85852d

Please sign in to comment.