Fix D3D driver compile under MinGW

This commit is contained in:
kaetemi 2014-06-18 16:29:02 +02:00
parent c539596231
commit a4c86ddf20
12 changed files with 33 additions and 23 deletions

View file

@ -1341,7 +1341,7 @@ public:
* NB: if implementation does not support it, 0 may be returned. OpenGL ones return the Texture ID.
* NB: unlike isTextureExist(), this method is not thread safe.
*/
virtual uint getTextureHandle(const ITexture&tex) = 0;
virtual uintptr_t getTextureHandle(const ITexture&tex) = 0;
// see if the Multiply-Add Tex Env operator is supported (see CMaterial::Mad)
virtual bool supportMADOperator() const = 0;

View file

@ -54,7 +54,7 @@ public:
// The index of the skin rdrPass
uint16 RdrPassIndex;
// The texture id of the specular texture. This is the sort Key.
uint32 SpecId;
uintptr_t SpecId;
bool operator<(const CSkinSpecularRdrPass &o) const
{

View file

@ -10,7 +10,7 @@ NL_DEFAULT_PROPS(nel_drv_direct3d_win "NeL, Driver, Video: Direct3D")
NL_ADD_RUNTIME_FLAGS(nel_drv_direct3d_win)
NL_ADD_LIB_SUFFIX(nel_drv_direct3d_win)
ADD_DEFINITIONS(/Ddriver_direct3d_EXPORTS)
ADD_DEFINITIONS(-DRIVER_DIRECT3D_EXPORTS)
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_direct3d_win ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.h ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.cpp)

View file

@ -110,6 +110,10 @@ IDriver* createD3DDriverInstance ()
#else
#ifdef NL_COMP_MINGW
extern "C"
{
#endif
__declspec(dllexport) IDriver* NL3D_createIDriverInstance ()
{
return new CDriverD3D;
@ -119,7 +123,9 @@ __declspec(dllexport) uint32 NL3D_interfaceVersion ()
{
return IDriver::InterfaceVersion;
}
#ifdef NL_COMP_MINGW
}
#endif
#endif
/*static*/ bool CDriverD3D::_CacheTest[CacheTest_Count] =
@ -379,7 +385,7 @@ void CDriverD3D::resetRenderVariables()
}
for (i=0; i<MaxTexture; i++)
{
if ((uint32)(_TexturePtrStateCache[i].Texture) != 0xcccccccc)
if ((uintptr_t)(_TexturePtrStateCache[i].Texture) != 0xcccccccc)
{
touchRenderVariable (&(_TexturePtrStateCache[i]));
// reset texture because it may reference an old render target
@ -419,7 +425,7 @@ void CDriverD3D::resetRenderVariables()
for (i=0; i<MaxLight; i++)
{
if (*(uint32*)(&(_LightCache[i].Light)) != 0xcccccccc)
if (*(uintptr_t*)(&(_LightCache[i].Light)) != 0xcccccccc)
{
_LightCache[i].EnabledTouched = true;
touchRenderVariable (&(_LightCache[i]));
@ -514,7 +520,7 @@ void CDriverD3D::initRenderVariables()
for (i=0; i<MaxTexture; i++)
{
_TexturePtrStateCache[i].StageID = i;
*(uint32*)&(_TexturePtrStateCache[i].Texture) = 0xcccccccc;
*(uintptr_t*)&(_TexturePtrStateCache[i].Texture) = 0xcccccccc;
_TexturePtrStateCache[i].Modified = false;
}
for (i=0; i<MaxSampler; i++)
@ -543,7 +549,7 @@ void CDriverD3D::initRenderVariables()
for (i=0; i<MaxLight; ++i)
{
_LightCache[i].LightIndex = uint8(i);
*(uint32*)&(_LightCache[i].Light) = 0xcccccccc;
*(uintptr_t*)&(_LightCache[i].Light) = 0xcccccccc;
_LightCache[i].Modified = false;
}
_VertexProgramCache.Modified = false;
@ -1063,7 +1069,7 @@ void CDriverD3D::updateRenderVariablesInternal()
// ***************************************************************************
static void D3DWndProc(CDriverD3D *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void D3DWndProc(CDriverD3D *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
H_AUTO_D3D(D3DWndProc);
@ -1481,7 +1487,7 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
break;
}
}
#endif WITH_PERFHUD
#endif /* WITH_PERFHUD */
// Create the D3D device
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE, &parameters, &_DeviceInterface);
if (result != D3D_OK)

View file

@ -1,2 +1,4 @@
EXPORTS NL3D_createIDriverInstance
EXPORTS NL3D_interfaceVersion
LIBRARY nel_drv_direct3d_win_r
EXPORTS
NL3D_createIDriverInstance
NL3D_interfaceVersion

View file

@ -953,7 +953,7 @@ public:
virtual void setSwapVBLInterval(uint interval);
virtual uint getSwapVBLInterval();
virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1);
virtual uint getTextureHandle(const ITexture&tex);
virtual uintptr_t getTextureHandle(const ITexture&tex);
// Matrix, viewport and frustum
virtual void setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective = true);
@ -1893,7 +1893,7 @@ public:
H_AUTO_D3D(CDriverD3D_setSamplerState);
nlassert (_DeviceInterface);
nlassert (sampler<MaxSampler);
nlassert (samplerState<MaxSamplerState);
nlassert ((int)samplerState<(int)MaxSamplerState);
// Ref on the state
CSamplerState &_samplerState = _SamplerStateCache[sampler][samplerState];
@ -2025,7 +2025,7 @@ public:
// Remap high matrices indexes
type = (D3DTRANSFORMSTATETYPE)remapMatrixIndex (type);
nlassert (type<MaxMatrixState);
nlassert ((int)type<(int)MaxMatrixState);
CMatrixState &theMatrix = _MatrixCache[type];
#ifdef NL_D3D_USE_RENDER_STATE_CACHE

View file

@ -46,7 +46,7 @@ CIBDrvInfosD3D::CIBDrvInfosD3D(CDriverD3D *drv, ItIBDrvInfoPtrList it, CIndexBuf
// ***************************************************************************
extern uint indexCount=0;
uint indexCount=0;
CIBDrvInfosD3D::~CIBDrvInfosD3D()
{

View file

@ -1091,7 +1091,7 @@ void CDriverD3D::swapTextureHandle(ITexture &tex0, ITexture &tex1)
// ***************************************************************************
uint CDriverD3D::getTextureHandle(const ITexture &tex)
uintptr_t CDriverD3D::getTextureHandle(const ITexture &tex)
{
H_AUTO_D3D(CDriverD3D_getTextureHandle)
// If DrvShare not setuped
@ -1104,7 +1104,7 @@ uint CDriverD3D::getTextureHandle(const ITexture &tex)
if(!d3dtext)
return 0;
return (uint)(d3dtext->Texture);
return (uintptr_t)(d3dtext->Texture);
}
// ***************************************************************************

View file

@ -59,7 +59,7 @@ CVBDrvInfosD3D::CVBDrvInfosD3D(CDriverD3D *drv, ItVBDrvInfoPtrList it, CVertexBu
// ***************************************************************************
extern uint vertexCount=0;
uint vertexCount=0;
CVBDrvInfosD3D::~CVBDrvInfosD3D()
{
@ -173,7 +173,7 @@ uint8 *CVBDrvInfosD3D::lock (uint begin, uint end, bool readOnly)
void *pbData;
if (VertexBuffer->Lock ( begin, end-begin, &pbData, readOnly?D3DLOCK_READONLY:0) != D3D_OK)
return false;
return NULL;
// Lock Profile?
if(driver->_VBHardProfiling /*&& Hardware*/)

View file

@ -19,7 +19,9 @@
#ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN
# define NOMINMAX
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h>
#endif

View file

@ -632,7 +632,7 @@ public:
virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1);
virtual uint getTextureHandle(const ITexture&tex);
virtual uintptr_t getTextureHandle(const ITexture&tex);
/// \name Material multipass.
/** NB: setupMaterial() must be called before thoses methods.

View file

@ -2269,7 +2269,7 @@ void CDriverGL::swapTextureHandle(ITexture &tex0, ITexture &tex1)
// ***************************************************************************
uint CDriverGL::getTextureHandle(const ITexture &tex)
uintptr_t CDriverGL::getTextureHandle(const ITexture &tex)
{
H_AUTO_OGL(CDriverGL_getTextureHandle)
// If DrvShare not setuped