From d4372f4aa1f00073f4d67dd8923153b4fa1755d7 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 14 May 2012 13:21:00 +0200 Subject: [PATCH] Changed: #1275 Use of NLDRIVERGL or NLDRIVERGLES namespaces with NL_STATIC to avoid duplicated symbols --- .../src/3d/driver/opengl/driver_opengl.cpp | 62 +++++++++++++------ code/nel/src/3d/driver/opengl/driver_opengl.h | 19 ++++-- .../driver/opengl/driver_opengl_extension.cpp | 17 ++++- .../driver/opengl/driver_opengl_extension.h | 17 ++++- .../3d/driver/opengl/driver_opengl_inputs.cpp | 15 ++++- .../3d/driver/opengl/driver_opengl_light.cpp | 13 +++- .../driver/opengl/driver_opengl_material.cpp | 12 ++++ .../3d/driver/opengl/driver_opengl_matrix.cpp | 11 ++++ .../3d/driver/opengl/driver_opengl_states.cpp | 15 ++++- .../3d/driver/opengl/driver_opengl_states.h | 14 ++++- .../driver/opengl/driver_opengl_texture.cpp | 14 ++++- .../3d/driver/opengl/driver_opengl_vertex.cpp | 18 ++++-- .../driver_opengl_vertex_buffer_hard.cpp | 18 ++++-- .../opengl/driver_opengl_vertex_buffer_hard.h | 36 ++++------- .../opengl/driver_opengl_vertex_program.cpp | 14 ++++- .../3d/driver/opengl/driver_opengl_window.cpp | 15 ++++- 16 files changed, 228 insertions(+), 82 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index ddbd25a6c..a4c9e012d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -65,30 +65,27 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) #endif /* NL_OS_WINDOWS */ +#ifdef USE_OPENGLES + +class CDriverGLEsNelLibrary : public INelLibrary { + void onLibraryLoaded(bool firstTime) { } + void onLibraryUnloaded(bool lastTime) { } +}; +NLMISC_DECL_PURE_LIB(CDriverGLEsNelLibrary) + +#else + class CDriverGLNelLibrary : public INelLibrary { void onLibraryLoaded(bool firstTime) { } void onLibraryUnloaded(bool lastTime) { } }; NLMISC_DECL_PURE_LIB(CDriverGLNelLibrary) +#endif + #endif /* #ifndef NL_STATIC */ - -namespace NL3D -{ - -CMaterial::CTexEnv CDriverGL::_TexEnvReplace; - - -#ifdef NL_OS_WINDOWS -uint CDriverGL::_Registered=0; -#endif // NL_OS_WINDOWS - -// Version of the driver. Not the interface version!! Increment when implementation of the driver change. -const uint32 CDriverGL::ReleaseVersion = 0x11; - -// Number of register to allocate for the EXTVertexShader extension -const uint CDriverGL::_EVSNumConstant = 97; +namespace NL3D { #ifdef NL_STATIC @@ -96,14 +93,14 @@ const uint CDriverGL::_EVSNumConstant = 97; IDriver* createGlEsDriverInstance () { - return new CDriverGL; + return new NLDRIVERGLES::CDriverGL; } #else IDriver* createGlDriverInstance () { - return new CDriverGL; + return new NLDRIVERGL::CDriverGL; } #endif @@ -141,6 +138,27 @@ extern "C" #endif // NL_STATIC +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif + +CMaterial::CTexEnv CDriverGL::_TexEnvReplace; + + +#ifdef NL_OS_WINDOWS +uint CDriverGL::_Registered=0; +#endif // NL_OS_WINDOWS + +// Version of the driver. Not the interface version!! Increment when implementation of the driver change. +const uint32 CDriverGL::ReleaseVersion = 0x11; + +// Number of register to allocate for the EXTVertexShader extension +const uint CDriverGL::_EVSNumConstant = 97; + GLenum CDriverGL::NLCubeFaceToGLCubeFace[6] = { #ifdef USE_OPENGLES @@ -2916,8 +2934,6 @@ void CDriverGL::endDialogMode() { } -} // NL3D - // *************************************************************************** void displayGLError(GLenum error) { @@ -2935,3 +2951,9 @@ void displayGLError(GLenum error) break; } } + +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + +} // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index bbbb4dbad..3890e1b69 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -76,8 +76,6 @@ #define NL3D_DRV_MAX_LIGHTMAP 256 -void displayGLError(GLenum error); - /* #define CHECK_GL_ERROR { \ GLenum error = glGetError(); \ @@ -91,17 +89,26 @@ void displayGLError(GLenum error); #define UNSUPPORTED_INDEX_OFFSET_MSG "Unsupported by driver, check IDriver::supportIndexOffset." -namespace NL3D { - using NLMISC::CMatrix; using NLMISC::CVector; +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif class CDriverGL; class IVertexArrayRange; class IVertexBufferHardGL; class COcclusionQueryGL; +void displayGLError(GLenum error); + #ifdef NL_OS_WINDOWS bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); @@ -1510,6 +1517,10 @@ public: CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it); }; +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + } // NL3D #endif // NL_DRIVER_OPENGL_H diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index 91d9bb1d4..75f249b4c 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -519,8 +519,15 @@ NEL_PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA; // *************************************************************************** -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif #define CHECK_EXT(ext_str) \ if(strstr(glext, ext_str)==NULL) { nlwarning("3D: OpengGL extension '%s' was not found", ext_str); return false; } else { nldebug("3D: OpengGL Extension '%s' found", ext_str); } @@ -1843,4 +1850,8 @@ bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen) } #endif // USE_OPENGLES -} +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + +} // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h index c6adc6b96..253f702a6 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h @@ -23,8 +23,15 @@ #include "driver_opengl_extension_def.h" -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** /// The extensions used by NL3D. @@ -262,7 +269,11 @@ bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen); /// This function test and register the extensions for the current GL context. void registerGlExtensions(CGlExtensions &ext); -} +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + +} // NL3D // *************************************************************************** // The exported function names diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp index fe4428f9c..e3921d5d4 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp @@ -35,8 +35,15 @@ using namespace std; using namespace NLMISC; -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // ************************************************************************************* CDriverGL::CCursor::CCursor() : ColorDepth(CDriverGL::ColorDepth32), @@ -1006,4 +1013,8 @@ bool CDriverGL::convertBitmapToCursor(const NLMISC::CBitmap &bitmap, nlCursor &c #endif } +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp index 2fc25f94a..3d3a6b273 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp @@ -19,9 +19,15 @@ #include "driver_opengl.h" #include "nel/3d/light.h" -namespace NL3D -{ +namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** uint CDriverGL::getMaxLight () const @@ -357,5 +363,8 @@ void CDriverGL::setupLightMapDynamicLighting(bool enable) refreshRenderSetup(); } +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp index 2299f48fe..6e3780444 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -23,6 +23,14 @@ namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif + static void convBlend(CMaterial::TBlend blend, GLenum& glenum) { H_AUTO_OGL(convBlend) @@ -2472,4 +2480,8 @@ void CDriverGL::endWaterMultiPass() #endif } +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp index 4106c38f2..7136e615e 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp @@ -19,6 +19,14 @@ namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif + // *************************************************************************** void CDriverGL::setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective) { @@ -204,5 +212,8 @@ void CDriverGL::doRefreshRenderSetup() _RenderSetupDirty= false; } +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp index 5d052349e..d8c9ae106 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp @@ -22,8 +22,15 @@ // define it For Debug purpose only. Normal use is to hide this line //#define NL3D_GLSTATE_DISABLE_CACHE -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** CDriverGLStates::CDriverGLStates() @@ -1147,6 +1154,8 @@ CDriverGLStates::TCullMode CDriverGLStates::getCullMode() const return _CullMode; } - +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.h b/code/nel/src/3d/driver/opengl/driver_opengl_states.h index adaf66492..6d92a8080 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.h @@ -20,8 +20,15 @@ #include "nel/misc/types_nl.h" #include "nel/3d/vertex_buffer.h" -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** /** @@ -243,6 +250,9 @@ private: bool _CurLight[MaxLight]; }; +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp index 91e2a49f8..bb89f5ee0 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp @@ -41,9 +41,15 @@ using namespace std; #define NEL_MEASURE_UPLOAD_TIME_END #endif -namespace NL3D -{ +namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** CTextureDrvInfosGL::CTextureDrvInfosGL(IDriver *drv, ItTexDrvInfoPtrMap it, CDriverGL *drvGl, bool isRectangleTexture) : ITextureDrvInfos(drv, it) @@ -2411,4 +2417,8 @@ bool CDriverGL::getRenderTargetSize (uint32 &width, uint32 &height) // *************************************************************************** +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp index 2e0226e91..06cfdf71f 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp @@ -46,13 +46,15 @@ using namespace NLMISC; -namespace NL3D -{ - - - - +namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** @@ -1858,4 +1860,8 @@ void CIndexBufferInfo::setupIndexBuffer(CIndexBuffer &ib) // *************************************************************************** +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp index 5845d3805..8f9551248 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp @@ -24,11 +24,15 @@ using namespace std; using namespace NLMISC; -namespace NL3D -{ - - +namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** // *************************************************************************** @@ -1662,6 +1666,8 @@ void CVertexBufferHardARB::invalidate() } #endif +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif -} - +} // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h index da454c558..6821392b5 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h @@ -20,9 +20,15 @@ #include "nel/misc/types_nl.h" -namespace NL3D -{ +namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif class CDriverGL; class IVertexBufferHardGL; @@ -30,8 +36,6 @@ class CVertexBufferInfo; class CVertexBufferHardGLMapObjectATI; class CVertexBufferHardARB; - - // *************************************************************************** // *************************************************************************** // VBHard interface for both NVidia / ATI extension. @@ -573,6 +577,9 @@ public: #endif }; +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif } // NL3D @@ -580,24 +587,3 @@ public: #endif // NL_DRIVER_OPENGL_VERTEX_BUFFER_HARD_H /* End of driver_opengl_vertex_buffer_hard.h */ - - - - - - - - - - - - - - - - - - - - - diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp index 1559bf33e..dbeede7e5 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp @@ -30,8 +30,15 @@ using namespace NLMISC; //#define DEBUG_SETUP_EXT_VERTEX_SHADER -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it) : IVertexProgramDrvInfos (drv, it) @@ -1982,5 +1989,8 @@ bool CDriverGL::supportVertexProgramDoubleSidedColor() const return _Extensions.NVVertexProgram || _Extensions.ARBVertexProgram; } +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 6ed911b85..ea8be02e9 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -46,8 +46,15 @@ using namespace std; using namespace NLMISC; -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif #ifdef NL_OS_WINDOWS @@ -3015,4 +3022,8 @@ bool CDriverGL::convertBitmapToIcon(const NLMISC::CBitmap &bitmap, std::vector