From 49caededb4bf5beb8b87ebee034c1d969968af4d Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Wed, 19 Sep 2012 17:05:56 +0000 Subject: BUILDFIX: enabling the building of the viewer/appearance backend with headless mesa --- indra/cmake/LLRender.cmake | 6 +++--- indra/cmake/LLWindow.cmake | 14 ++++++++++---- indra/llrender/CMakeLists.txt | 28 ++++++++++++++++++++-------- indra/llrender/llfontregistry.cpp | 2 +- indra/llrender/llgl.cpp | 3 --- indra/llrender/llrender.cpp | 2 -- indra/llrender/llrendertarget.cpp | 2 ++ indra/llrender/llrendertarget.h | 3 --- indra/llrender/llvertexbuffer.cpp | 8 ++++++++ indra/llwindow/CMakeLists.txt | 9 +++++---- indra/llwindow/llwindow.cpp | 2 ++ indra/llwindow/llwindowmesaheadless.h | 1 + indra/lscript/lscript_compile/CMakeLists.txt | 2 ++ indra/lscript/lscript_compile/indra.l | 23 +++++++++++++++++++++++ indra/newview/lldirpicker.cpp | 4 ++++ indra/newview/llfilepicker.cpp | 8 ++++++-- 16 files changed, 87 insertions(+), 30 deletions(-) (limited to 'indra') diff --git a/indra/cmake/LLRender.cmake b/indra/cmake/LLRender.cmake index 8427928151..6695ed6bd9 100644 --- a/indra/cmake/LLRender.cmake +++ b/indra/cmake/LLRender.cmake @@ -8,15 +8,15 @@ set(LLRENDER_INCLUDE_DIRS ${GLH_INCLUDE_DIR} ) -if (SERVER AND LINUX) +if ((SERVER OR BAKING) AND LINUX) set(LLRENDER_LIBRARIES llrenderheadless ) -else (SERVER AND LINUX) +else ((SERVER OR BAKING) AND LINUX) set(LLRENDER_LIBRARIES llrender ) -endif (SERVER AND LINUX) +endif ((SERVER OR BAKING) AND LINUX) # mapserver requires certain files to be copied so LL_MESA_HEADLESS can be set # differently for different object files. diff --git a/indra/cmake/LLWindow.cmake b/indra/cmake/LLWindow.cmake index b4bb9a078a..1ee4ca0aac 100644 --- a/indra/cmake/LLWindow.cmake +++ b/indra/cmake/LLWindow.cmake @@ -22,22 +22,28 @@ else (STANDALONE) endif (LINUX AND VIEWER) endif (STANDALONE) -if (SDL_FOUND) +if (SDL_FOUND AND NOT BAKING) add_definitions(-DLL_SDL=1) include_directories(${SDL_INCLUDE_DIR}) -endif (SDL_FOUND) +endif (SDL_FOUND AND NOT BAKING) + +if (BAKING) + use_prebuilt_binary(mesa) + add_definitions(-DLL_MESA_HEADLESS=1) +endif (BAKING) set(LLWINDOW_INCLUDE_DIRS ${GLEXT_INCLUDE_DIR} ${LIBS_OPEN_DIR}/llwindow ) -if (SERVER AND LINUX) +if ((SERVER AND LINUX) OR (BAKING AND LINUX)) set(LLWINDOW_LIBRARIES llwindowheadless ) + MESSAGE( STATUS "using headless libraries") else (SERVER AND LINUX) set(LLWINDOW_LIBRARIES llwindow ) -endif (SERVER AND LINUX) +endif ((SERVER AND LINUX) OR (BAKING AND LINUX)) diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index fc38f56957..638ab23bd6 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -78,7 +78,12 @@ set_source_files_properties(${llrender_HEADER_FILES} list(APPEND llrender_SOURCE_FILES ${llrender_HEADER_FILES}) -if (SERVER AND NOT WINDOWS AND NOT DARWIN) +list(APPEND llrender_SOURCE_FILES + llgl.cpp + llrender.cpp + llrendertarget.cpp + ) +if ((SERVER OR BAKING) AND NOT WINDOWS AND NOT DARWIN) copy_server_sources( llgl llrender @@ -94,13 +99,8 @@ if (SERVER AND NOT WINDOWS AND NOT DARWIN) ${llrender_SOURCE_FILES} ${server_SOURCE_FILES} ) -else (SERVER AND NOT WINDOWS AND NOT DARWIN) - list(APPEND llrender_SOURCE_FILES - llgl.cpp - llrender.cpp - llrendertarget.cpp - ) -endif (SERVER AND NOT WINDOWS AND NOT DARWIN) +endif ((SERVER OR BAKING) AND NOT WINDOWS AND NOT DARWIN) + add_library (llrender ${llrender_SOURCE_FILES}) # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level @@ -115,3 +115,15 @@ target_link_libraries(llrender ${LLWINDOW_LIBRARIES} ${FREETYPE_LIBRARIES} ${OPENGL_LIBRARIES}) + +target_link_libraries(llrenderheadless + ${LLCOMMON_LIBRARIES} + ${LLIMAGE_LIBRARIES} + ${LLMATH_LIBRARIES} + ${LLRENDER_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLXML_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLWINDOW_LIBRARIES} + ${OPENGL_LIBRARIES}) + diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index 4d22eba3d9..d0637f2546 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -225,7 +225,7 @@ std::string currentOsName() return "Windows"; #elif LL_DARWIN return "Mac"; -#elif LL_SDL +#elif LL_SDL || LL_MESA_HEADLESS return "Linux"; #else return ""; diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 0b56b3889c..27d8056ea2 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -188,9 +188,6 @@ PFNGLWAITSYNCPROC glWaitSync = NULL; PFNGLGETINTEGER64VPROC glGetInteger64v = NULL; PFNGLGETSYNCIVPROC glGetSynciv = NULL; -// GL_APPLE_flush_buffer_range -PFNGLBUFFERPARAMETERIAPPLEPROC glBufferParameteriAPPLE = NULL; -PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC glFlushMappedBufferRangeAPPLE = NULL; // vertex object prototypes PFNGLNEWOBJECTBUFFERATIPROC glNewObjectBufferATI = NULL; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 4597d06260..c60eb8d9d9 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -357,7 +357,6 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) } // LLRenderTarget is unavailible on the mapserver since it uses FBOs. -#if !LL_MESA_HEADLESS bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) { if (mIndex < 0) return false; @@ -380,7 +379,6 @@ bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) return true; } -#endif // LL_MESA_HEADLESS bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips) { diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index cc5c232380..d87255f6ce 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -570,3 +570,5 @@ void LLRenderTarget::getViewport(S32* viewport) viewport[3] = mResY; } + + diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index e1a51304f1..b9ef666206 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -28,7 +28,6 @@ #define LL_LLRENDERTARGET_H // LLRenderTarget is unavailible on the mapserver since it uses FBOs. -#if !LL_MESA_HEADLESS #include "llgl.h" #include "llrender.h" @@ -157,7 +156,5 @@ protected: static LLRenderTarget* sBoundTarget; }; -#endif //!LL_MESA_HEADLESS - #endif diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 28a14b23b9..37a4649cb6 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1574,8 +1574,10 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo { if (map_range) { +#ifndef LL_MESA_HEADLESS glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); +#endif src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } else @@ -1752,8 +1754,10 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range { if (map_range) { +#ifndef LL_MESA_HEADLESS glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); +#endif src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } else @@ -1881,7 +1885,9 @@ void LLVertexBuffer::unmapBuffer() } else if (gGLManager.mHasFlushBufferRange) { +#ifndef LL_MESA_HEADLESS glFlushMappedBufferRangeAPPLE(GL_ARRAY_BUFFER_ARB, offset, length); +#endif } stop_glerror(); } @@ -1947,7 +1953,9 @@ void LLVertexBuffer::unmapBuffer() else if (gGLManager.mHasFlushBufferRange) { #ifdef GL_APPLE_flush_buffer_range +#ifndef LL_MESA_HEADLESS glFlushMappedBufferRangeAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length); +#endif #endif } stop_glerror(); diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 652d5cae5a..4db58be776 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -140,18 +140,19 @@ endif (SOLARIS) set_source_files_properties(${llwindow_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) -if (SERVER AND NOT WINDOWS AND NOT DARWIN) +if ((SERVER OR BAKING) AND NOT WINDOWS AND NOT DARWIN) set(server_SOURCE_FILES llwindowmesaheadless.cpp + llmousehandler.cpp ) set(server_HEADER_FILES llwindowmesaheadless.h + llmousehandler.h ) copy_server_sources( llwindow ) - set_source_files_properties( ${server_SOURCE_FILES} PROPERTIES @@ -161,8 +162,8 @@ if (SERVER AND NOT WINDOWS AND NOT DARWIN) ${llwindow_SOURCE_FILES} ${server_SOURCE_FILES} ) - target_link_libraries (llwindowheadless ${llwindow_LINK_LIBRARIES}) -endif (SERVER AND NOT WINDOWS AND NOT DARWIN) + target_link_libraries (llwindowheadless ${llwindow_LINK_LIBRARIES} OSMesa16 dl) +endif ((SERVER OR BAKING) AND NOT WINDOWS AND NOT DARWIN) if (llwindow_HEADER_FILES) list(APPEND llwindow_SOURCE_FILES ${llwindow_HEADER_FILES}) diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 5b7424acbb..d83278d875 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -256,6 +256,8 @@ std::vector LLWindow::getDynamicFallbackFontList() return LLWindowWin32::getDynamicFallbackFontList(); #elif LL_DARWIN return LLWindowMacOSX::getDynamicFallbackFontList(); +#elif LL_MESA_HEADLESS + return std::vector(); #elif LL_SDL return LLWindowSDL::getDynamicFallbackFontList(); #else diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h index 8f70aee4f6..bc8e25ec44 100644 --- a/indra/llwindow/llwindowmesaheadless.h +++ b/indra/llwindow/llwindowmesaheadless.h @@ -51,6 +51,7 @@ public: /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;}; /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;}; /*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;}; + /*virtual*/ BOOL setSizeImpl(LLCoordWindow size) {return FALSE;}; /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;}; /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;}; /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;}; diff --git a/indra/lscript/lscript_compile/CMakeLists.txt b/indra/lscript/lscript_compile/CMakeLists.txt index 3ed2892e0e..134703eed3 100644 --- a/indra/lscript/lscript_compile/CMakeLists.txt +++ b/indra/lscript/lscript_compile/CMakeLists.txt @@ -95,6 +95,7 @@ add_custom_command( ${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp COMMAND ${FLEX} ARGS + -P indra_ -o${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp ${CMAKE_CURRENT_SOURCE_DIR}/indra.l DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/indra.l @@ -128,6 +129,7 @@ else (WINDOWS) COMMAND ${BISON} ARGS + -p indra_ -d -o ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp ${CMAKE_CURRENT_SOURCE_DIR}/indra.y DEPENDS diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index 96b7e57e97..b2c49083cb 100644 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -56,6 +56,29 @@ void parse_string(); #define ECHO do { } while (0) +#define yyparse indra_parse +#define yyerror indra_error +#define yylval indra_lval +#define yy_create_buffer indra__create_buffer +#define yy_delete_buffer indra__delete_buffer +#define yy_flex_debug indra__flex_debug +#define yy_init_buffer indra__init_buffer +#define yy_flush_buffer indra__flush_buffer +#define yy_load_buffer_state indra__load_buffer_state +#define yy_switch_to_buffer indra__switch_to_buffer +#define yyin indra_in +#define yyleng indra_leng +#define yylex indra_lex +#define yylineno indra_lineno +#define yyout indra_out +#define yyrestart indra_restart +#define yytext indra_text +#define yywrap indra_wrap +#define yyalloc indra_alloc +#define yyrealloc indra_realloc +#define yyfree indra_free + + #if defined(__cplusplus) extern "C" { int yylex( void ); } extern "C" { int yyparse( void ); } diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp index 1e03582a29..d7d9f82910 100644 --- a/indra/newview/lldirpicker.cpp +++ b/indra/newview/lldirpicker.cpp @@ -327,6 +327,8 @@ BOOL LLDirPicker::getDir(std::string* filename) return FALSE; } +#if !LL_MESA_HEADLESS + if (mFilePicker) { GtkWindow* picker = mFilePicker->buildFilePicker(false, true, @@ -340,6 +342,8 @@ BOOL LLDirPicker::getDir(std::string* filename) return (!mFilePicker->getFirstFile().empty()); } } +#endif // !LL_MESA_HEADLESS + return FALSE; } diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 4bf5b26b3b..d13f85baa2 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -1103,6 +1103,7 @@ void LLFilePicker::chooser_responder(GtkWidget *widget, gint response, gpointer GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, std::string context) { +#ifndef LL_MESA_HEADLESS if (LLWindowSDL::ll_try_gtk_init()) { GtkWidget *win = NULL; @@ -1174,6 +1175,9 @@ GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, std::stri { return NULL; } +#else + return NULL; +#endif //LL_MESA_HEADLESS } static void add_common_filters_to_gtkchooser(GtkFileFilter *gfilter, @@ -1473,7 +1477,7 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename return FALSE; } -BOOL LLFilePicker::getOpenFile( ELoadFilter filter ) +BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) { // if local file browsing is turned off, return without opening dialog // (Even though this is a stub, I think we still should not return anything at all) @@ -1494,7 +1498,7 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter ) default: break; } mFiles.push_back(filename); - llinfos << "getOpenFile: Will try to open file: " << hackyfilename << llendl; + llinfos << "getOpenFile: Will try to open file: " << filename << llendl; return TRUE; } -- cgit v1.2.3