Changed: #1275 Use of NLDRIVERGL or NLDRIVERGLES namespaces with NL_STATIC to avoid duplicated symbols

This commit is contained in:
kervala 2012-05-14 13:21:00 +02:00
parent ec2011ece5
commit 7db67187ef
16 changed files with 228 additions and 82 deletions

View file

@ -65,30 +65,27 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
#endif /* NL_OS_WINDOWS */ #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 { class CDriverGLNelLibrary : public INelLibrary {
void onLibraryLoaded(bool firstTime) { } void onLibraryLoaded(bool firstTime) { }
void onLibraryUnloaded(bool lastTime) { } void onLibraryUnloaded(bool lastTime) { }
}; };
NLMISC_DECL_PURE_LIB(CDriverGLNelLibrary) NLMISC_DECL_PURE_LIB(CDriverGLNelLibrary)
#endif
#endif /* #ifndef NL_STATIC */ #endif /* #ifndef NL_STATIC */
namespace NL3D {
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;
#ifdef NL_STATIC #ifdef NL_STATIC
@ -96,14 +93,14 @@ const uint CDriverGL::_EVSNumConstant = 97;
IDriver* createGlEsDriverInstance () IDriver* createGlEsDriverInstance ()
{ {
return new CDriverGL; return new NLDRIVERGLES::CDriverGL;
} }
#else #else
IDriver* createGlDriverInstance () IDriver* createGlDriverInstance ()
{ {
return new CDriverGL; return new NLDRIVERGL::CDriverGL;
} }
#endif #endif
@ -141,6 +138,27 @@ extern "C"
#endif // NL_STATIC #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] = GLenum CDriverGL::NLCubeFaceToGLCubeFace[6] =
{ {
#ifdef USE_OPENGLES #ifdef USE_OPENGLES
@ -2916,8 +2934,6 @@ void CDriverGL::endDialogMode()
{ {
} }
} // NL3D
// *************************************************************************** // ***************************************************************************
void displayGLError(GLenum error) void displayGLError(GLenum error)
{ {
@ -2935,3 +2951,9 @@ void displayGLError(GLenum error)
break; break;
} }
} }
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -76,8 +76,6 @@
#define NL3D_DRV_MAX_LIGHTMAP 256 #define NL3D_DRV_MAX_LIGHTMAP 256
void displayGLError(GLenum error);
/* /*
#define CHECK_GL_ERROR { \ #define CHECK_GL_ERROR { \
GLenum error = glGetError(); \ GLenum error = glGetError(); \
@ -91,17 +89,26 @@ void displayGLError(GLenum error);
#define UNSUPPORTED_INDEX_OFFSET_MSG "Unsupported by driver, check IDriver::supportIndexOffset." #define UNSUPPORTED_INDEX_OFFSET_MSG "Unsupported by driver, check IDriver::supportIndexOffset."
namespace NL3D {
using NLMISC::CMatrix; using NLMISC::CMatrix;
using NLMISC::CVector; using NLMISC::CVector;
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
class CDriverGL; class CDriverGL;
class IVertexArrayRange; class IVertexArrayRange;
class IVertexBufferHardGL; class IVertexBufferHardGL;
class COcclusionQueryGL; class COcclusionQueryGL;
void displayGLError(GLenum error);
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
@ -1510,6 +1517,10 @@ public:
CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it); CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it);
}; };
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D } // NL3D
#endif // NL_DRIVER_OPENGL_H #endif // NL_DRIVER_OPENGL_H

View file

@ -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) \ #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); } 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 #endif // USE_OPENGLES
} #ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -23,8 +23,15 @@
#include "driver_opengl_extension_def.h" #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. /// 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. /// This function test and register the extensions for the current GL context.
void registerGlExtensions(CGlExtensions &ext); void registerGlExtensions(CGlExtensions &ext);
} #ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D
// *************************************************************************** // ***************************************************************************
// The exported function names // The exported function names

View file

@ -35,8 +35,15 @@
using namespace std; using namespace std;
using namespace NLMISC; 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), CDriverGL::CCursor::CCursor() : ColorDepth(CDriverGL::ColorDepth32),
@ -1006,4 +1013,8 @@ bool CDriverGL::convertBitmapToCursor(const NLMISC::CBitmap &bitmap, nlCursor &c
#endif #endif
} }
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D } // NL3D

View file

@ -19,9 +19,15 @@
#include "driver_opengl.h" #include "driver_opengl.h"
#include "nel/3d/light.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 uint CDriverGL::getMaxLight () const
@ -357,5 +363,8 @@ void CDriverGL::setupLightMapDynamicLighting(bool enable)
refreshRenderSetup(); refreshRenderSetup();
} }
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D } // NL3D

View file

@ -23,6 +23,14 @@
namespace NL3D { namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
static void convBlend(CMaterial::TBlend blend, GLenum& glenum) static void convBlend(CMaterial::TBlend blend, GLenum& glenum)
{ {
H_AUTO_OGL(convBlend) H_AUTO_OGL(convBlend)
@ -2472,4 +2480,8 @@ void CDriverGL::endWaterMultiPass()
#endif #endif
} }
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D } // NL3D

View file

@ -19,6 +19,14 @@
namespace NL3D { 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) 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; _RenderSetupDirty= false;
} }
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D } // NL3D

View file

@ -22,8 +22,15 @@
// define it For Debug purpose only. Normal use is to hide this line // define it For Debug purpose only. Normal use is to hide this line
//#define NL3D_GLSTATE_DISABLE_CACHE //#define NL3D_GLSTATE_DISABLE_CACHE
namespace NL3D namespace NL3D {
{
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
// *************************************************************************** // ***************************************************************************
CDriverGLStates::CDriverGLStates() CDriverGLStates::CDriverGLStates()
@ -1147,6 +1154,8 @@ CDriverGLStates::TCullMode CDriverGLStates::getCullMode() const
return _CullMode; return _CullMode;
} }
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D } // NL3D

View file

@ -20,8 +20,15 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/3d/vertex_buffer.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]; bool _CurLight[MaxLight];
}; };
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D } // NL3D

View file

@ -41,9 +41,15 @@ using namespace std;
#define NEL_MEASURE_UPLOAD_TIME_END #define NEL_MEASURE_UPLOAD_TIME_END
#endif #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) 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 } // NL3D

View file

@ -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 } // NL3D

View file

@ -24,11 +24,15 @@
using namespace std; using namespace std;
using namespace NLMISC; 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 #endif
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} } // NL3D

View file

@ -20,9 +20,15 @@
#include "nel/misc/types_nl.h" #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 CDriverGL;
class IVertexBufferHardGL; class IVertexBufferHardGL;
@ -30,8 +36,6 @@ class CVertexBufferInfo;
class CVertexBufferHardGLMapObjectATI; class CVertexBufferHardGLMapObjectATI;
class CVertexBufferHardARB; class CVertexBufferHardARB;
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
// VBHard interface for both NVidia / ATI extension. // VBHard interface for both NVidia / ATI extension.
@ -573,6 +577,9 @@ public:
#endif #endif
}; };
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D } // NL3D
@ -580,24 +587,3 @@ public:
#endif // NL_DRIVER_OPENGL_VERTEX_BUFFER_HARD_H #endif // NL_DRIVER_OPENGL_VERTEX_BUFFER_HARD_H
/* End of driver_opengl_vertex_buffer_hard.h */ /* End of driver_opengl_vertex_buffer_hard.h */

View file

@ -30,8 +30,15 @@ using namespace NLMISC;
//#define DEBUG_SETUP_EXT_VERTEX_SHADER //#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) CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it) : IVertexProgramDrvInfos (drv, it)
@ -1982,5 +1989,8 @@ bool CDriverGL::supportVertexProgramDoubleSidedColor() const
return _Extensions.NVVertexProgram || _Extensions.ARBVertexProgram; return _Extensions.NVVertexProgram || _Extensions.ARBVertexProgram;
} }
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D } // NL3D

View file

@ -46,8 +46,15 @@
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
namespace NL3D namespace NL3D {
{
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
@ -3015,4 +3022,8 @@ bool CDriverGL::convertBitmapToIcon(const NLMISC::CBitmap &bitmap, std::vector<l
#endif #endif
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D } // NL3D