mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-04-24 02:32:18 +00:00
Merge branch 'master' into PBR2
This commit is contained in:
commit
eeff8100e0
11 changed files with 84 additions and 14 deletions
|
@ -62,7 +62,9 @@ option(USE_SYSTEM_RAPIDJSON
|
|||
|
||||
set(CPU_TYPE "" CACHE STRING "When set, passes this string as CPU-ID which will be embedded into the binary.")
|
||||
|
||||
set(CPU_OPTIMIZATION "-mmmx -msse -msse2" CACHE STRING "Which CPU specific optimitations should be used beside the compiler's default?")
|
||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
|
||||
set(CPU_OPTIMIZATION "-mmmx -msse -msse2" CACHE STRING "Which CPU specific optimitations should be used beside the compiler's default?")
|
||||
endif()
|
||||
|
||||
option(USE_INTRINSICS "Compile using intrinsics (e.g mmx, sse, msse2)" ON)
|
||||
|
||||
|
@ -114,18 +116,17 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|||
#add_definitions(-Wall)
|
||||
add_definitions(-Werror=format-security)
|
||||
add_definitions(-Werror=format)
|
||||
|
||||
# Compiler check (needs -std=c++11 flag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
elseif(COMPILER_SUPPORTS_CXX0X)
|
||||
set(CMAKE_CXX_STANDARD 0x)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
else()
|
||||
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
if(CPU_TYPE)
|
||||
add_definitions(-DCPUSTRING="${CPU_TYPE}")
|
||||
|
|
0
neo/cmake-linux-debug-nosimd.sh
Normal file → Executable file
0
neo/cmake-linux-debug-nosimd.sh
Normal file → Executable file
5
neo/cmake-linux-nvidia-jetson-vulkan-release.sh
Executable file
5
neo/cmake-linux-nvidia-jetson-vulkan-release.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
cd ..
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DSDL2=ON -DONATIVE=ON -DUSE_INTRINSICS=OFF -DUSE_VULKAN=ON -DSPIRV_SHADERC=OFF ../neo
|
0
neo/cmake-linux-release-nosimd.sh
Normal file → Executable file
0
neo/cmake-linux-release-nosimd.sh
Normal file → Executable file
|
@ -115,6 +115,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define CPUSTRING "x86_64"
|
||||
#elif defined(__e2k__)
|
||||
#define CPUSTRING "e2k"
|
||||
#elif defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
|
||||
#define CPUSTRING "aarch64"
|
||||
#else
|
||||
#error unknown CPU
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#ifndef NEO_IMGUI_BFGIMGUI_H_
|
||||
#define NEO_IMGUI_BFGIMGUI_H_
|
||||
|
||||
#include "../../libs/imgui/imgui.h"
|
||||
#include "libs/imgui/imgui.h"
|
||||
|
||||
#include "../idlib/math/Vector.h"
|
||||
|
||||
|
|
|
@ -621,6 +621,7 @@ PNG LOADING
|
|||
|
||||
extern "C"
|
||||
{
|
||||
#include <string.h>
|
||||
#include <png.h>
|
||||
|
||||
|
||||
|
@ -636,9 +637,16 @@ extern "C"
|
|||
|
||||
static void png_ReadData( png_structp pngPtr, png_bytep data, png_size_t length )
|
||||
{
|
||||
#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR <= 4
|
||||
memcpy( data, ( byte* )pngPtr->io_ptr, length );
|
||||
|
||||
pngPtr->io_ptr = ( ( byte* ) pngPtr->io_ptr ) + length;
|
||||
#else
|
||||
// There is a get_io_ptr but not a set_io_ptr.. Therefore we need some tmp storage here.
|
||||
byte **ioptr = (byte **)png_get_io_ptr(pngPtr);
|
||||
memcpy( data, *ioptr, length );
|
||||
*ioptr += length;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -651,6 +659,9 @@ LoadPNG
|
|||
static void LoadPNG( const char* filename, unsigned char** pic, int* width, int* height, ID_TIME_T* timestamp )
|
||||
{
|
||||
byte* fbuffer;
|
||||
#if PNG_LIBPNG_VER_MAJOR > 1 || PNG_LIBPNG_VER_MINOR > 4
|
||||
byte* readptr;
|
||||
#endif
|
||||
|
||||
if( !pic )
|
||||
{
|
||||
|
@ -683,7 +694,12 @@ static void LoadPNG( const char* filename, unsigned char** pic, int* width, int*
|
|||
common->Error( "LoadPNG( %s ): png_create_info_struct failed", filename );
|
||||
}
|
||||
|
||||
#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR <= 4
|
||||
png_set_read_fn( pngPtr, fbuffer, png_ReadData );
|
||||
#else
|
||||
readptr = fbuffer;
|
||||
png_set_read_fn( pngPtr, &readptr, png_ReadData );
|
||||
#endif
|
||||
|
||||
png_set_sig_bytes( pngPtr, 0 );
|
||||
|
||||
|
@ -774,10 +790,14 @@ extern "C"
|
|||
static int png_compressedSize = 0;
|
||||
static void png_WriteData( png_structp pngPtr, png_bytep data, png_size_t length )
|
||||
{
|
||||
#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR <= 4
|
||||
memcpy( ( byte* )pngPtr->io_ptr, data, length );
|
||||
|
||||
pngPtr->io_ptr = ( ( byte* ) pngPtr->io_ptr ) + length;
|
||||
|
||||
#else
|
||||
byte **ioptr = (byte**)png_get_io_ptr(pngPtr);
|
||||
memcpy( *ioptr, data, length );
|
||||
*ioptr += length;
|
||||
#endif
|
||||
png_compressedSize += length;
|
||||
}
|
||||
|
||||
|
@ -806,7 +826,12 @@ void R_WritePNG( const char* filename, const byte* data, int bytesPerPixel, int
|
|||
|
||||
png_compressedSize = 0;
|
||||
byte* buffer = ( byte* ) Mem_Alloc( width * height * bytesPerPixel, TAG_TEMP );
|
||||
#if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR <= 4
|
||||
png_set_write_fn( pngPtr, buffer, png_WriteData, png_FlushData );
|
||||
#else
|
||||
byte* ioptr = buffer;
|
||||
png_set_write_fn( pngPtr, &ioptr, png_WriteData, png_FlushData );
|
||||
#endif
|
||||
|
||||
if( bytesPerPixel == 4 )
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "../../libs/imgui/imgui.h"
|
||||
#include "libs/imgui/imgui.h"
|
||||
|
||||
#include "RenderCommon.h"
|
||||
#include "SMAA/AreaTex.h"
|
||||
|
|
|
@ -2211,7 +2211,7 @@ IMGUI RENDERING
|
|||
*/
|
||||
#if !IMGUI_BFGUI
|
||||
|
||||
#include "../../libs/imgui/imgui.h"
|
||||
#include "libs/imgui/imgui.h"
|
||||
|
||||
int g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
|
||||
int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0;
|
||||
|
|
|
@ -45,6 +45,11 @@ static const char** cmdargv = NULL;
|
|||
static int cmdargc = 0;
|
||||
// DG end
|
||||
|
||||
// RB begin
|
||||
#include <stdio.h> // needed for sysconf()
|
||||
#include <cstring>
|
||||
// RB end
|
||||
|
||||
#ifdef ID_MCHECK
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
|
@ -164,8 +169,8 @@ double Sys_ClockTicksPerSecond()
|
|||
========================
|
||||
Sys_CPUCount
|
||||
|
||||
numLogicalCPUCores - the number of logical CPU per core
|
||||
numPhysicalCPUCores - the total number of cores per package
|
||||
numLogicalCPUCores - the total number of logical CPU cores (equal to the total number of threads from all CPU)
|
||||
numPhysicalCPUCores - the total number of physical CPU cores
|
||||
numCPUPackages - the total number of packages (physical processors)
|
||||
========================
|
||||
*/
|
||||
|
@ -173,6 +178,8 @@ numCPUPackages - the total number of packages (physical processors)
|
|||
void Sys_CPUCount( int& numLogicalCPUCores, int& numPhysicalCPUCores, int& numCPUPackages )
|
||||
{
|
||||
static bool init = false;
|
||||
static bool CPUCoresIsFound = false; // needed for sysconf()
|
||||
static bool SiblingsIsFound = false; // needed for sysconf()
|
||||
static double ret;
|
||||
|
||||
static int s_numLogicalCPUCores;
|
||||
|
@ -217,11 +224,13 @@ void Sys_CPUCount( int& numLogicalCPUCores, int& numPhysicalCPUCores, int& numCP
|
|||
if( ( processor ) > s_numPhysicalCPUCores )
|
||||
{
|
||||
s_numPhysicalCPUCores = processor;
|
||||
CPUCoresIsFound = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
common->Printf( "failed parsing /proc/cpuinfo\n" );
|
||||
CPUCoresIsFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -240,17 +249,37 @@ void Sys_CPUCount( int& numLogicalCPUCores, int& numPhysicalCPUCores, int& numCP
|
|||
if( ( coreId ) > s_numLogicalCPUCores )
|
||||
{
|
||||
s_numLogicalCPUCores = coreId;
|
||||
SiblingsIsFound = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
common->Printf( "failed parsing /proc/cpuinfo\n" );
|
||||
SiblingsIsFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pos = strchr( buf + pos, '\n' ) - buf + 1;
|
||||
}
|
||||
if( CPUCoresIsFound == false && SiblingsIsFound == false)
|
||||
{
|
||||
common->Printf( "failed parsing /proc/cpuinfo\n" );
|
||||
common->Printf( "alternative method used\n" );
|
||||
s_numPhysicalCPUCores = sysconf(_SC_NPROCESSORS_CONF); // _SC_NPROCESSORS_ONLN may not be reliable on Android
|
||||
s_numLogicalCPUCores = s_numPhysicalCPUCores; // hack for CPU without Hyper-Threading (HT) technology
|
||||
}
|
||||
else if( CPUCoresIsFound == true && SiblingsIsFound == false)
|
||||
{
|
||||
s_numLogicalCPUCores = s_numPhysicalCPUCores; // hack for CPU without Hyper-Threading (HT) technology
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
common->Printf( "failed to read /proc/cpuinfo\n" );
|
||||
common->Printf( "alternative method used\n" );
|
||||
s_numPhysicalCPUCores = sysconf(_SC_NPROCESSORS_CONF); // _SC_NPROCESSORS_ONLN may not be reliable on Android
|
||||
s_numLogicalCPUCores = s_numPhysicalCPUCores; // hack for CPU without Hyper-Threading (HT) technology
|
||||
}
|
||||
|
||||
common->Printf( "/proc/cpuinfo CPU processors: %d\n", s_numPhysicalCPUCores );
|
||||
|
|
|
@ -104,7 +104,15 @@ const char* Sys_DefaultSavePath()
|
|||
SDL_free( base_path );
|
||||
}
|
||||
#else
|
||||
sprintf( savepath, "%s/.rbdoom3bfg", getenv( "HOME" ) );
|
||||
const char* xdg_data_home = getenv( "XDG_DATA_HOME" );
|
||||
if( xdg_data_home != NULL )
|
||||
{
|
||||
sprintf( savepath, "%s/rbdoom3bfg", xdg_data_home );
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( savepath, "%s/.local/share/rbdoom3bfg", getenv( "HOME" ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
return savepath.c_str();
|
||||
|
|
Loading…
Reference in a new issue