From e719a8de0ff83bc0bb806e3d33e2c0327549c592 Mon Sep 17 00:00:00 2001 From: Dan McGoo Date: Tue, 7 Oct 2014 23:12:42 +0900 Subject: [PATCH 1/2] Add native arch compilation option. --- neo/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index e8662216..062a9fa5 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -18,6 +18,9 @@ option(OPENAL option(FFMPEG "Use FMPEG to render Bink videos" ON) +option(ONATIVE + "Optimize for the host CPU" OFF) + if(UNIX) set(OPENAL TRUE) endif() @@ -68,6 +71,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") set(my_warn_flags "${my_warn_flags} -Wno-local-type-template-args -Wno-unknown-warning-option -Wno-inline-new-delete") endif() + if(NOT CMAKE_CROSSCOMPILING AND ONATIVE) + add_definitions(-march=native) + endif() + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O0 -ggdb -fno-strict-aliasing ${my_warn_flags}") #set(CMAKE_C_FLAGS_DEBUGALL "${CMAKE_C_FLAGS_DEBUGALL} -g -ggdb -D_DEBUG -fno-strict-aliasing ${my_warn_flags}") #set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} -g -ggdb -D_DEBUG -O1 -fno-omit-frame-pointer -fno-strict-aliasing ${my_warn_flags}") From 8b28e50cd42b94389c5866f8022265f343b21cec Mon Sep 17 00:00:00 2001 From: Dan McGoo Date: Tue, 7 Oct 2014 23:20:20 +0900 Subject: [PATCH 2/2] Write the renderprogs under the savepath. Because under *nix systems, the basepath may be write protected for the user. --- neo/framework/FileSystem.cpp | 6 +++--- neo/renderer/RenderProgs_GLSL.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/neo/framework/FileSystem.cpp b/neo/framework/FileSystem.cpp index 792e3dba..13a3cfd8 100644 --- a/neo/framework/FileSystem.cpp +++ b/neo/framework/FileSystem.cpp @@ -846,14 +846,14 @@ void idFileSystemLocal::AddRenderProgs( idStrList& files ) idStrList work; // grab all the renderprogs - idStr path = RelativePathToOSPath( "renderprogs/cgb", "fs_basepath" ); + idStr path = RelativePathToOSPath( "renderprogs/cgb", "fs_savepath" ); ListOSFiles( path, "*.cgb", work ); for( int i = 0; i < work.Num(); i++ ) { files.Append( idStr( "renderprogs/cgb/" ) + work[i] ); } - path = RelativePathToOSPath( "renderprogs/hlsl", "fs_basepath" ); + path = RelativePathToOSPath( "renderprogs/hlsl", "fs_savepath" ); ListOSFiles( path, "*.v360", work ); for( int i = 0; i < work.Num(); i++ ) { @@ -865,7 +865,7 @@ void idFileSystemLocal::AddRenderProgs( idStrList& files ) files.Append( idStr( "renderprogs/hlsl/" ) + work[i] ); } - path = RelativePathToOSPath( "renderprogs/gl", "fs_basepath" ); + path = RelativePathToOSPath( "renderprogs/gl", "fs_savepath" ); ListOSFiles( path, "*.*", work ); for( int i = 0; i < work.Num(); i++ ) { diff --git a/neo/renderer/RenderProgs_GLSL.cpp b/neo/renderer/RenderProgs_GLSL.cpp index 59ec177e..0b4ad2a3 100644 --- a/neo/renderer/RenderProgs_GLSL.cpp +++ b/neo/renderer/RenderProgs_GLSL.cpp @@ -1772,11 +1772,11 @@ GLuint idRenderProgManager::LoadGLSLShader( GLenum target, const char* name, con idStr programHLSL = StripDeadCode( hlslCode, inFile, compileMacros, builtin ); programGLSL = ConvertCG2GLSL( programHLSL, inFile, target == GL_VERTEX_SHADER, programUniforms ); - fileSystem->WriteFile( outFileHLSL, programHLSL.c_str(), programHLSL.Length(), "fs_basepath" ); - fileSystem->WriteFile( outFileGLSL, programGLSL.c_str(), programGLSL.Length(), "fs_basepath" ); + fileSystem->WriteFile( outFileHLSL, programHLSL.c_str(), programHLSL.Length(), "fs_savepath" ); + fileSystem->WriteFile( outFileGLSL, programGLSL.c_str(), programGLSL.Length(), "fs_savepath" ); if( r_useUniformArrays.GetBool() ) { - fileSystem->WriteFile( outFileUniforms, programUniforms.c_str(), programUniforms.Length(), "fs_basepath" ); + fileSystem->WriteFile( outFileUniforms, programUniforms.c_str(), programUniforms.Length(), "fs_savepath" ); } } else