Linux: make it build

master
Zi Ree 2023-04-16 18:19:07 +02:00
parent 51d1cf67e0
commit d61d70e19d
9 changed files with 112 additions and 7 deletions

View File

@ -2350,6 +2350,18 @@
<key>name</key>
<string>darwin64</string>
</map>
<key>linux64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>5b719b8d3602f8dc9401cc92d606b34e</string>
<key>url</key>
<string>https://3p.firestormviewer.org/mikktspace-1-linux64-223421209.tar.bz2</string>
</map>
<key>name</key>
<string>linux64</string>
</map>
<key>windows</key>
<map>
<key>archive</key>

View File

@ -90,6 +90,10 @@ endif (BUILD_HEADLESS)
add_library (llrender ${llrender_SOURCE_FILES})
target_include_directories( llrender INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
if (SDL_FOUND)
set_property(TARGET llrender PROPERTY COMPILE_DEFINITIONS LL_SDL=1)
endif (SDL_FOUND)
# Libraries on which this library depends, needed for Linux builds
# Sort by high-level to low-level
target_link_libraries(llrender

View File

@ -183,7 +183,8 @@ LLMatrix4 gGLObliqueProjectionInverse;
std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
// <FS:Zi> Linux support
// #if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
#if LL_WINDOWS
// WGL_ARB_create_context
@ -204,7 +205,8 @@ PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC wglBlitContextFramebufferAMD = n
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = nullptr;
PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = nullptr;
#endif
// <FS:Zi> Linux support
// #endif
// GL_VERSION_1_2
//PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = nullptr;
@ -1356,6 +1358,12 @@ void LLGLManager::shutdownGL()
void LLGLManager::initExtensions()
{
// <FS:Zi> Linux support
#if LL_LINUX
glh_init_extensions("");
#endif
// </FS:Zi>
#if LL_DARWIN
GLint num_extensions = 0;
std::string all_extensions{""};
@ -1386,10 +1394,14 @@ void LLGLManager::initExtensions()
mInited = TRUE;
#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL;
// <FS:Zi> Linux support
//#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
#if LL_WINDOWS
// </FS:Zi>
LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL;
// <FS:Zi> Linux support
// #if LL_WINDOWS
// WGL_AMD_gpu_association
wglGetGPUIDsAMD = (PFNWGLGETGPUIDSAMDPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetGPUIDsAMD");
wglGetGPUInfoAMD = (PFNWGLGETGPUINFOAMDPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetGPUInfoAMD");
@ -1407,8 +1419,8 @@ void LLGLManager::initExtensions()
// WGL_ARB_create_context
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglCreateContextAttribsARB");
#endif
// <FS:Zi>
// #endif
// Load entire OpenGL API through GetProcAddress, leaving sections beyond mGLVersion unloaded

View File

@ -1035,6 +1035,27 @@ extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *);
#include <OpenGL/gl.h>
// <FS:Zi> Linux support
#elif LL_LINUX
#define GL_GLEXT_PROTOTYPES
#define GLX_GLEXT_PROTOTYPES
#include "GL/gl.h"
#include "GL/glu.h"
#include "GL/glext.h"
#include "GL/glx.h"
// The __APPLE__ kludge is to make glh_extensions.h not symbol-clash horribly
# define __APPLE__
# include "GL/glh_extensions.h"
# undef __APPLE__
// #include <X11/Xlib.h>
// #include <X11/Xutil.h>
#include "GL/glh_extensions.h"
// </FS:Zi>
#endif // LL_MESA / LL_WINDOWS / LL_DARWIN
// Even when GL_ARB_depth_clamp is available in the driver, the (correct)

View File

@ -2681,6 +2681,16 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
return rtns;
}
// <FS:Zi> Implement available VRAM estimation like MacOSX
U32 LLWindowSDL::getAvailableVRAMMegabytes()
{
static const U32 mb = 1024*1024;
// We're asked for total available gpu memory, but we only have allocation info on texture usage. So estimate by doubling that.
static const U32 total_factor = 2; // estimated total/textures
return gGLManager.mVRAM - (LLImageGL::getTextureBytesAllocated() * total_factor/mb);
}
// </FS:Zi>
// <FS:Zi> Make shared context work on Linux for multithreaded OpenGL
class sharedContext
{

View File

@ -120,6 +120,8 @@ public:
/*virtual*/ F32 getPixelAspectRatio();
/*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; }
U32 getAvailableVRAMMegabytes() override;
/*virtual*/ void beforeDialog();
/*virtual*/ void afterDialog();

View File

@ -1870,7 +1870,18 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
LLVector4a t;
tangent_to_object.rotate(binormal_dir, t);
LLVector4a binormal;
// <FS:Zi> GCC12 warning: maybe-uninitialized - probably bogus
#if defined(__GNUC__) && (__GNUC__ >= 12)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
// </FS:Zi>
mat_normal.rotate(t, binormal);
// <FS:Zi> GCC12 warning: maybe-uninitialized - probably bogus
#if defined(__GNUC__) && (__GNUC__ >= 12)
#pragma GCC diagnostic pop
#endif
// </FS:Zi>
//VECTORIZE THIS
if (mDrawablep->isActive())

View File

@ -1678,6 +1678,13 @@ bool LLFilePicker::openFileDialog( int32_t filter, bool blocking, EType aType )
file_dialog_filter = "*.wav";
break;
// <FS:Zi> Handle all enums in a switch, or you make GCC unhappy
case FFSAVE_GLTF:
file_type = "gltf_files";
file_dialog_filter = "*.gltf";
break;
// </FS:Zi>
// Firestorm additions
case FFSAVE_BEAM:
file_type = "xml_file";
@ -1756,6 +1763,21 @@ bool LLFilePicker::openFileDialog( int32_t filter, bool blocking, EType aType )
file_type = "executable_files";
break;
// <FS:Zi> Handle all enums in a switch, or you make GCC unhappy
case FFLOAD_GLTF:
file_type = "gltf_files";
file_dialog_filter = "*.gltf";
break;
case FFLOAD_MATERIAL:
file_type = "material_files";
file_dialog_filter = "*";
break;
case FFLOAD_MATERIAL_TEXTURE:
file_type = "material_texture_files";
file_dialog_filter = "*";
break;
// </FS:Zi>
// Firestorm additions
case FFLOAD_IMPORT:
file_type = "backup_files";

View File

@ -2354,6 +2354,12 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const ti
}
}
// <FS:Zi> GCC12 warning: maybe-uninitialized - probably bogus
#if defined(__GNUC__) && (__GNUC__ >= 12)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
// </FS:Zi>
void LLMaterialEditor::importMaterial()
{
LLFilePickerReplyThread::startPicker(
@ -2371,6 +2377,11 @@ void LLMaterialEditor::importMaterial()
LLFilePicker::FFLOAD_MATERIAL,
true);
}
// <FS:Zi> GCC12 warning: maybe-uninitialized - probably bogus
#if defined(__GNUC__) && (__GNUC__ >= 12)
#pragma GCC diagnostic pop
#endif
// </FS:Zi>
class LLRenderMaterialFunctor : public LLSelectedTEFunctor
{