mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-22 17:08:43 +00:00
Merged default.
This commit is contained in:
parent
e2ab3dc0c6
commit
a9a4f4eaa3
3553 changed files with 2582 additions and 2824 deletions
|
@ -159,6 +159,7 @@ code/build/*
|
||||||
code/build-2010/*
|
code/build-2010/*
|
||||||
build/*
|
build/*
|
||||||
install/*
|
install/*
|
||||||
|
build_vc*
|
||||||
code/nel/tools/build_gamedata/configuration/buildsite.py
|
code/nel/tools/build_gamedata/configuration/buildsite.py
|
||||||
|
|
||||||
# Linux nel compile
|
# Linux nel compile
|
||||||
|
|
|
@ -131,6 +131,13 @@ IF(FINAL_VERSION)
|
||||||
ADD_DEFINITIONS(-DFINAL_VERSION=1)
|
ADD_DEFINITIONS(-DFINAL_VERSION=1)
|
||||||
ENDIF(FINAL_VERSION)
|
ENDIF(FINAL_VERSION)
|
||||||
|
|
||||||
|
IF(WITH_SSE2)
|
||||||
|
ADD_DEFINITIONS(-DNL_HAS_SSE2)
|
||||||
|
IF(WITH_SSE3)
|
||||||
|
ADD_DEFINITIONS(-DNL_HAS_SSE3)
|
||||||
|
ENDIF(WITH_SSE3)
|
||||||
|
ENDIF(WITH_SSE2)
|
||||||
|
|
||||||
IF(WITH_QT)
|
IF(WITH_QT)
|
||||||
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
|
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
|
||||||
ENDIF(WITH_QT)
|
ENDIF(WITH_QT)
|
||||||
|
|
|
@ -1,46 +1,52 @@
|
||||||
# - Find DirectInput
|
# - Find DirectInput
|
||||||
# Find the DirectSound includes and libraries
|
# Find the DirectSound includes and libraries
|
||||||
#
|
#
|
||||||
|
# MAXSDK_DIR - 3DSMAX SDK root directory
|
||||||
# MAXSDK_INCLUDE_DIR - where to find baseinterface.h
|
# MAXSDK_INCLUDE_DIR - where to find baseinterface.h
|
||||||
# MAXSDK_LIBRARIES - List of libraries when using 3DSMAX.
|
# MAXSDK_LIBRARIES - List of libraries when using 3DSMAX.
|
||||||
# MAXSDK_FOUND - True if MAX SDK found.
|
# MAXSDK_FOUND - True if MAX SDK found.
|
||||||
|
|
||||||
if(MAXSDK_INCLUDE_DIR)
|
if(MAXSDK_INCLUDE_DIR)
|
||||||
# Already in cache, be silent
|
# Already in cache, be silent
|
||||||
set(MAXSDK_FIND_QUIETLY TRUE)
|
SET(MAXSDK_FIND_QUIETLY TRUE)
|
||||||
endif(MAXSDK_INCLUDE_DIR)
|
endif(MAXSDK_INCLUDE_DIR)
|
||||||
|
|
||||||
find_path(MAXSDK_INCLUDE_DIR max.h
|
FIND_PATH(MAXSDK_DIR
|
||||||
|
"include/maxversion.h"
|
||||||
|
HINTS
|
||||||
|
"$ENV{MAXSDK_DIR}"
|
||||||
PATHS
|
PATHS
|
||||||
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/include"
|
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk"
|
||||||
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include"
|
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk"
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include"
|
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk"
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include"
|
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk"
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include"
|
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk"
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include"
|
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk"
|
||||||
)
|
|
||||||
|
|
||||||
find_path(MAXSDK_CS_INCLUDE_DIR bipexp.h
|
|
||||||
PATHS
|
|
||||||
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/include/CS"
|
|
||||||
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include/CS"
|
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include/CS"
|
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include/CS"
|
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include/CS"
|
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include/CS"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
FIND_PATH(MAXSDK_INCLUDE_DIR
|
||||||
|
max.h
|
||||||
|
HINTS
|
||||||
|
${MAXSDK_DIR}/include
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
|
||||||
|
HINTS
|
||||||
|
${MAXSDK_DIR}/include/CS
|
||||||
|
)
|
||||||
|
|
||||||
|
IF(TARGET_X64)
|
||||||
|
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib)
|
||||||
|
ELSE(TARGET_X64)
|
||||||
|
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
|
||||||
|
ENDIF(TARGET_X64)
|
||||||
|
|
||||||
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||||
FIND_LIBRARY(${MYLIBRARY}
|
FIND_LIBRARY(${MYLIBRARY}
|
||||||
NAMES ${MYLIBRARYNAME}
|
NAMES ${MYLIBRARYNAME}
|
||||||
PATHS
|
HINTS
|
||||||
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/lib"
|
${MAXSDK_LIBRARY_DIRS}
|
||||||
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/lib"
|
)
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/lib"
|
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/lib"
|
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/lib"
|
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/lib"
|
|
||||||
)
|
|
||||||
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||||
|
|
||||||
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
|
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)
|
||||||
|
|
|
@ -23,8 +23,15 @@ FIND_PATH(FMOD_INCLUDE_DIR
|
||||||
PATH_SUFFIXES fmod fmod3
|
PATH_SUFFIXES fmod fmod3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IF(TARGET_X64)
|
||||||
|
SET(FMOD_LIBRARY_NAMES fmod64 fmod)
|
||||||
|
ELSE(TARGET_X64)
|
||||||
|
SET(FMOD_LIBRARY_NAMES fmodvc fmod)
|
||||||
|
ENDIF(TARGET_X64)
|
||||||
|
|
||||||
FIND_LIBRARY(FMOD_LIBRARY
|
FIND_LIBRARY(FMOD_LIBRARY
|
||||||
NAMES fmod fmodvc libfmod fmod64
|
NAMES
|
||||||
|
${FMOD_LIBRARY_NAMES}
|
||||||
PATHS
|
PATHS
|
||||||
$ENV{FMOD_DIR}/lib
|
$ENV{FMOD_DIR}/lib
|
||||||
/usr/local/lib
|
/usr/local/lib
|
||||||
|
|
|
@ -118,13 +118,13 @@ MACRO(NL_DEFAULT_PROPS name label)
|
||||||
ENDIF(NL_LIB_PREFIX)
|
ENDIF(NL_LIB_PREFIX)
|
||||||
ENDIF(${type} STREQUAL SHARED_LIBRARY)
|
ENDIF(${type} STREQUAL SHARED_LIBRARY)
|
||||||
|
|
||||||
IF(${type} STREQUAL EXECUTABLE AND WIN32)
|
IF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW)
|
||||||
SET_TARGET_PROPERTIES(${name} PROPERTIES
|
SET_TARGET_PROPERTIES(${name} PROPERTIES
|
||||||
VERSION ${NL_VERSION}
|
VERSION ${NL_VERSION}
|
||||||
SOVERSION ${NL_VERSION_MAJOR}
|
SOVERSION ${NL_VERSION_MAJOR}
|
||||||
COMPILE_FLAGS "/GA"
|
COMPILE_FLAGS "/GA"
|
||||||
LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}")
|
LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}")
|
||||||
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32)
|
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW)
|
||||||
ENDMACRO(NL_DEFAULT_PROPS)
|
ENDMACRO(NL_DEFAULT_PROPS)
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -328,6 +328,13 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
|
||||||
OPTION(WITH_LIBOVR "With LibOVR support" OFF)
|
OPTION(WITH_LIBOVR "With LibOVR support" OFF)
|
||||||
OPTION(WITH_LIBVR "With LibVR support" OFF)
|
OPTION(WITH_LIBVR "With LibVR support" OFF)
|
||||||
OPTION(WITH_PERFHUD "With NVIDIA PerfHUD support" OFF)
|
OPTION(WITH_PERFHUD "With NVIDIA PerfHUD support" OFF)
|
||||||
|
|
||||||
|
OPTION(WITH_SSE2 "With SSE2" ON )
|
||||||
|
OPTION(WITH_SSE3 "With SSE3" ON )
|
||||||
|
|
||||||
|
IF(NOT MSVC)
|
||||||
|
OPTION(WITH_GCC_FPMATH_BOTH "With GCC -mfpmath=both" OFF)
|
||||||
|
ENDIF(NOT MSVC)
|
||||||
ENDMACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
|
ENDMACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
|
||||||
|
|
||||||
MACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS)
|
MACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS)
|
||||||
|
@ -618,6 +625,14 @@ MACRO(NL_SETUP_BUILD)
|
||||||
ENDIF(CLANG)
|
ENDIF(CLANG)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
IF(WITH_SSE3)
|
||||||
|
ADD_PLATFORM_FLAGS("-msse3")
|
||||||
|
ENDIF(WITH_SSE3)
|
||||||
|
|
||||||
|
IF(WITH_GCC_FPMATH_BOTH)
|
||||||
|
ADD_PLATFORM_FLAGS("-mfpmath=both")
|
||||||
|
ENDIF(WITH_GCC_FPMATH_BOTH)
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
IF(NOT XCODE)
|
IF(NOT XCODE)
|
||||||
IF(CMAKE_OSX_ARCHITECTURES)
|
IF(CMAKE_OSX_ARCHITECTURES)
|
||||||
|
@ -879,9 +894,9 @@ MACRO(NL_SETUP_BUILD)
|
||||||
ENDIF(APPLE)
|
ENDIF(APPLE)
|
||||||
|
|
||||||
# Fix "relocation R_X86_64_32 against.." error on x64 platforms
|
# Fix "relocation R_X86_64_32 against.." error on x64 platforms
|
||||||
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
|
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW)
|
||||||
ADD_PLATFORM_FLAGS("-fPIC")
|
ADD_PLATFORM_FLAGS("-fPIC")
|
||||||
ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
|
ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW)
|
||||||
|
|
||||||
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48")
|
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48")
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ public:
|
||||||
* \param matrix transformation matrix
|
* \param matrix transformation matrix
|
||||||
* \param hotspot position of string origine
|
* \param hotspot position of string origine
|
||||||
*/
|
*/
|
||||||
void render3D (IDriver& driver,CMatrix matrix,THotSpot hotspot = MiddleMiddle);
|
void render3D (IDriver& driver, const CMatrix &matrix, THotSpot hotspot = MiddleMiddle);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ public:
|
||||||
IDriver();
|
IDriver();
|
||||||
virtual ~IDriver();
|
virtual ~IDriver();
|
||||||
|
|
||||||
virtual bool init(uint windowIcon = 0, emptyProc exitFunc = 0) = 0;
|
virtual bool init(uintptr_t windowIcon = 0, emptyProc exitFunc = 0) = 0;
|
||||||
|
|
||||||
/// Deriver should calls IDriver::release() first, to destroy all driver components (textures, shaders, VBuffers).
|
/// Deriver should calls IDriver::release() first, to destroy all driver components (textures, shaders, VBuffers).
|
||||||
virtual bool release();
|
virtual bool release();
|
||||||
|
@ -1341,7 +1341,7 @@ public:
|
||||||
* NB: if implementation does not support it, 0 may be returned. OpenGL ones return the Texture ID.
|
* 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.
|
* 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)
|
// see if the Multiply-Add Tex Env operator is supported (see CMaterial::Mad)
|
||||||
virtual bool supportMADOperator() const = 0;
|
virtual bool supportMADOperator() const = 0;
|
||||||
|
|
|
@ -123,7 +123,7 @@ public:
|
||||||
|
|
||||||
/// \name Object
|
/// \name Object
|
||||||
// @{
|
// @{
|
||||||
CDriverUser (uint windowIcon, UDriver::TDriver driver, emptyProc exitFunc = 0);
|
CDriverUser (uintptr_t windowIcon, UDriver::TDriver driver, emptyProc exitFunc = 0);
|
||||||
virtual ~CDriverUser();
|
virtual ~CDriverUser();
|
||||||
// @}
|
// @}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,11 @@
|
||||||
#include "nel/misc/geom_ext.h"
|
#include "nel/misc/geom_ext.h"
|
||||||
#include "nel/misc/line.h"
|
#include "nel/misc/line.h"
|
||||||
|
|
||||||
|
#if defined (NL_COMP_MINGW)
|
||||||
#ifdef NL_OS_WINDOWS
|
# define NL3D_GL_DLL_NAME "libnel_drv_opengl_win"
|
||||||
|
# define NL3D_GLES_DLL_NAME "libnel_drv_opengles_win"
|
||||||
|
# define NL3D_D3D_DLL_NAME "libnel_drv_direct3d_win"
|
||||||
|
#elif defined (NL_OS_WINDOWS)
|
||||||
# define NL3D_GL_DLL_NAME "nel_drv_opengl_win"
|
# define NL3D_GL_DLL_NAME "nel_drv_opengl_win"
|
||||||
# define NL3D_GLES_DLL_NAME "nel_drv_opengles_win"
|
# define NL3D_GLES_DLL_NAME "nel_drv_opengles_win"
|
||||||
# define NL3D_D3D_DLL_NAME "nel_drv_direct3d_win"
|
# define NL3D_D3D_DLL_NAME "nel_drv_direct3d_win"
|
||||||
|
|
|
@ -108,281 +108,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
// ***************************************************************************
|
|
||||||
// SSE Matrix
|
|
||||||
// ***************************************************************************
|
|
||||||
// ***************************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
|
|
||||||
|
|
||||||
|
|
||||||
/** For fast vector/point multiplication. Special usage for Skinning.
|
|
||||||
* NB: SSE is no more used (no speed gain, some memory problem), but keep it for possible future usage.
|
|
||||||
*/
|
|
||||||
class CMatrix3x4SSE
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Order them in memory column first, for SSE column multiplication.
|
|
||||||
float a11, a21, a31, a41;
|
|
||||||
float a12, a22, a32, a42;
|
|
||||||
float a13, a23, a33, a43;
|
|
||||||
float a14, a24, a34, a44;
|
|
||||||
|
|
||||||
// Copy from a matrix.
|
|
||||||
void set(const CMatrix &mat)
|
|
||||||
{
|
|
||||||
const float *m =mat.get();
|
|
||||||
a11= m[0]; a12= m[4]; a13= m[8] ; a14= m[12];
|
|
||||||
a21= m[1]; a22= m[5]; a23= m[9] ; a24= m[13];
|
|
||||||
a31= m[2]; a32= m[6]; a33= m[10]; a34= m[14];
|
|
||||||
// not used.
|
|
||||||
a41= 0 ; a42= 0 ; a43= 0 ; a44= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// mulSetvector. NB: in should be different as v!! (else don't work).
|
|
||||||
void mulSetVector(const CVector &vin, CVector &vout)
|
|
||||||
{
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
mov eax, vin
|
|
||||||
mov ebx, this
|
|
||||||
mov edi, vout
|
|
||||||
// Load in vector in op[0]
|
|
||||||
movss xmm0, [eax]vin.x
|
|
||||||
movss xmm1, [eax]vin.y
|
|
||||||
movss xmm2, [eax]vin.z
|
|
||||||
// Expand op[0] to op[1], op[2], op[3]
|
|
||||||
shufps xmm0, xmm0, 0
|
|
||||||
shufps xmm1, xmm1, 0
|
|
||||||
shufps xmm2, xmm2, 0
|
|
||||||
// Mul each vector with 3 Matrix column
|
|
||||||
mulps xmm0, [ebx]this.a11
|
|
||||||
mulps xmm1, [ebx]this.a12
|
|
||||||
mulps xmm2, [ebx]this.a13
|
|
||||||
// Add each column vector.
|
|
||||||
addps xmm0, xmm1
|
|
||||||
addps xmm0, xmm2
|
|
||||||
|
|
||||||
// write the result.
|
|
||||||
movss [edi]vout.x, xmm0
|
|
||||||
shufps xmm0, xmm0, 33
|
|
||||||
movss [edi]vout.y, xmm0
|
|
||||||
movhlps xmm0, xmm0
|
|
||||||
movss [edi]vout.z, xmm0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// mulSetpoint. NB: in should be different as v!! (else don't work).
|
|
||||||
void mulSetPoint(const CVector &vin, CVector &vout)
|
|
||||||
{
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
mov eax, vin
|
|
||||||
mov ebx, this
|
|
||||||
mov edi, vout
|
|
||||||
// Load in vector in op[0]
|
|
||||||
movss xmm0, [eax]vin.x
|
|
||||||
movss xmm1, [eax]vin.y
|
|
||||||
movss xmm2, [eax]vin.z
|
|
||||||
// Expand op[0] to op[1], op[2], op[3]
|
|
||||||
shufps xmm0, xmm0, 0
|
|
||||||
shufps xmm1, xmm1, 0
|
|
||||||
shufps xmm2, xmm2, 0
|
|
||||||
// Mul each vector with 3 Matrix column
|
|
||||||
mulps xmm0, [ebx]this.a11
|
|
||||||
mulps xmm1, [ebx]this.a12
|
|
||||||
mulps xmm2, [ebx]this.a13
|
|
||||||
// Add each column vector.
|
|
||||||
addps xmm0, xmm1
|
|
||||||
addps xmm0, xmm2
|
|
||||||
// Add Matrix translate column vector
|
|
||||||
addps xmm0, [ebx]this.a14
|
|
||||||
|
|
||||||
// write the result.
|
|
||||||
movss [edi]vout.x, xmm0
|
|
||||||
shufps xmm0, xmm0, 33
|
|
||||||
movss [edi]vout.y, xmm0
|
|
||||||
movhlps xmm0, xmm0
|
|
||||||
movss [edi]vout.z, xmm0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// mulSetvector. NB: vin should be different as v!! (else don't work).
|
|
||||||
void mulSetVector(const CVector &vin, float scale, CVector &vout)
|
|
||||||
{
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
mov eax, vin
|
|
||||||
mov ebx, this
|
|
||||||
mov edi, vout
|
|
||||||
// Load in vector in op[0]
|
|
||||||
movss xmm0, [eax]vin.x
|
|
||||||
movss xmm1, [eax]vin.y
|
|
||||||
movss xmm2, [eax]vin.z
|
|
||||||
// Load scale in op[0]
|
|
||||||
movss xmm3, scale
|
|
||||||
// Expand op[0] to op[1], op[2], op[3]
|
|
||||||
shufps xmm0, xmm0, 0
|
|
||||||
shufps xmm1, xmm1, 0
|
|
||||||
shufps xmm2, xmm2, 0
|
|
||||||
shufps xmm3, xmm3, 0
|
|
||||||
// Store vertex column in other regs.
|
|
||||||
movaps xmm5, xmm0
|
|
||||||
movaps xmm6, xmm1
|
|
||||||
movaps xmm7, xmm2
|
|
||||||
// Mul each vector with 3 Matrix column
|
|
||||||
mulps xmm0, [ebx]this.a11
|
|
||||||
mulps xmm1, [ebx]this.a12
|
|
||||||
mulps xmm2, [ebx]this.a13
|
|
||||||
// Add each column vector.
|
|
||||||
addps xmm0, xmm1
|
|
||||||
addps xmm0, xmm2
|
|
||||||
|
|
||||||
// mul final result with scale
|
|
||||||
mulps xmm0, xmm3
|
|
||||||
|
|
||||||
// store it in xmm4 for future use.
|
|
||||||
movaps xmm4, xmm0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// mulSetpoint. NB: vin should be different as v!! (else don't work).
|
|
||||||
void mulSetPoint(const CVector &vin, float scale, CVector &vout)
|
|
||||||
{
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
mov eax, vin
|
|
||||||
mov ebx, this
|
|
||||||
mov edi, vout
|
|
||||||
// Load in vector in op[0]
|
|
||||||
movss xmm0, [eax]vin.x
|
|
||||||
movss xmm1, [eax]vin.y
|
|
||||||
movss xmm2, [eax]vin.z
|
|
||||||
// Load scale in op[0]
|
|
||||||
movss xmm3, scale
|
|
||||||
// Expand op[0] to op[1], op[2], op[3]
|
|
||||||
shufps xmm0, xmm0, 0
|
|
||||||
shufps xmm1, xmm1, 0
|
|
||||||
shufps xmm2, xmm2, 0
|
|
||||||
shufps xmm3, xmm3, 0
|
|
||||||
// Store vertex column in other regs.
|
|
||||||
movaps xmm5, xmm0
|
|
||||||
movaps xmm6, xmm1
|
|
||||||
movaps xmm7, xmm2
|
|
||||||
// Mul each vector with 3 Matrix column
|
|
||||||
mulps xmm0, [ebx]this.a11
|
|
||||||
mulps xmm1, [ebx]this.a12
|
|
||||||
mulps xmm2, [ebx]this.a13
|
|
||||||
// Add each column vector.
|
|
||||||
addps xmm0, xmm1
|
|
||||||
addps xmm0, xmm2
|
|
||||||
// Add Matrix translate column vector
|
|
||||||
addps xmm0, [ebx]this.a14
|
|
||||||
|
|
||||||
// mul final result with scale
|
|
||||||
mulps xmm0, xmm3
|
|
||||||
|
|
||||||
// store it in xmm4 for future use.
|
|
||||||
movaps xmm4, xmm0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// mulAddvector. NB: vin should be different as v!! (else don't work).
|
|
||||||
void mulAddVector(const CVector &/* vin */, float scale, CVector &vout)
|
|
||||||
{
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
mov ebx, this
|
|
||||||
mov edi, vout
|
|
||||||
// Load vin vector loaded in mulSetVector
|
|
||||||
movaps xmm0, xmm5
|
|
||||||
movaps xmm1, xmm6
|
|
||||||
movaps xmm2, xmm7
|
|
||||||
// Load scale in op[0]
|
|
||||||
movss xmm3, scale
|
|
||||||
// Expand op[0] to op[1], op[2], op[3]
|
|
||||||
shufps xmm3, xmm3, 0
|
|
||||||
// Mul each vector with 3 Matrix column
|
|
||||||
mulps xmm0, [ebx]this.a11
|
|
||||||
mulps xmm1, [ebx]this.a12
|
|
||||||
mulps xmm2, [ebx]this.a13
|
|
||||||
// Add each column vector.
|
|
||||||
addps xmm0, xmm1
|
|
||||||
addps xmm0, xmm2
|
|
||||||
|
|
||||||
// mul final result with scale
|
|
||||||
mulps xmm0, xmm3
|
|
||||||
|
|
||||||
// Add result, with prec sum.
|
|
||||||
addps xmm0, xmm4
|
|
||||||
|
|
||||||
// store it in xmm4 for future use.
|
|
||||||
movaps xmm4, xmm0
|
|
||||||
|
|
||||||
// write the result.
|
|
||||||
movss [edi]vout.x, xmm0
|
|
||||||
shufps xmm0, xmm0, 33
|
|
||||||
movss [edi]vout.y, xmm0
|
|
||||||
movhlps xmm0, xmm0
|
|
||||||
movss [edi]vout.z, xmm0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// mulAddpoint. NB: vin should be different as v!! (else don't work).
|
|
||||||
void mulAddPoint(const CVector &/* vin */, float scale, CVector &vout)
|
|
||||||
{
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
mov ebx, this
|
|
||||||
mov edi, vout
|
|
||||||
// Load vin vector loaded in mulSetPoint
|
|
||||||
movaps xmm0, xmm5
|
|
||||||
movaps xmm1, xmm6
|
|
||||||
movaps xmm2, xmm7
|
|
||||||
// Load scale in op[0]
|
|
||||||
movss xmm3, scale
|
|
||||||
// Expand op[0] to op[1], op[2], op[3]
|
|
||||||
shufps xmm3, xmm3, 0
|
|
||||||
// Mul each vector with 3 Matrix column
|
|
||||||
mulps xmm0, [ebx]this.a11
|
|
||||||
mulps xmm1, [ebx]this.a12
|
|
||||||
mulps xmm2, [ebx]this.a13
|
|
||||||
// Add each column vector.
|
|
||||||
addps xmm0, xmm1
|
|
||||||
addps xmm0, xmm2
|
|
||||||
// Add Matrix translate column vector
|
|
||||||
addps xmm0, [ebx]this.a14
|
|
||||||
|
|
||||||
// mul final result with scale
|
|
||||||
mulps xmm0, xmm3
|
|
||||||
|
|
||||||
// Add result, with prec sum.
|
|
||||||
addps xmm0, xmm4
|
|
||||||
|
|
||||||
// store it in xmm4 for future use.
|
|
||||||
movaps xmm4, xmm0
|
|
||||||
|
|
||||||
// write the result.
|
|
||||||
movss [edi]vout.x, xmm0
|
|
||||||
shufps xmm0, xmm0, 33
|
|
||||||
movss [edi]vout.y, xmm0
|
|
||||||
movhlps xmm0, xmm0
|
|
||||||
movss [edi]vout.z, xmm0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#else // NL_OS_WINDOWS
|
|
||||||
/// dummy CMatrix3x4SSE for non windows platform
|
|
||||||
class CMatrix3x4SSE : public CMatrix3x4 { };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // NL3D
|
} // NL3D
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
// The index of the skin rdrPass
|
// The index of the skin rdrPass
|
||||||
uint16 RdrPassIndex;
|
uint16 RdrPassIndex;
|
||||||
// The texture id of the specular texture. This is the sort Key.
|
// The texture id of the specular texture. This is the sort Key.
|
||||||
uint32 SpecId;
|
uintptr_t SpecId;
|
||||||
|
|
||||||
bool operator<(const CSkinSpecularRdrPass &o) const
|
bool operator<(const CSkinSpecularRdrPass &o) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -845,8 +845,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* This is the static function which build a UDriver, the root for all 3D functions.
|
* This is the static function which build a UDriver, the root for all 3D functions.
|
||||||
*/
|
*/
|
||||||
static UDriver *createDriver(uint windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0);
|
static UDriver *createDriver(uintptr_t windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0);
|
||||||
static UDriver *createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc = 0);
|
static UDriver *createDriver(uintptr_t windowIcon, TDriver driver, emptyProc exitFunc = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge static memory
|
* Purge static memory
|
||||||
|
|
|
@ -53,12 +53,14 @@ namespace NLGUI
|
||||||
bool show() const {return _PointerVisible;}
|
bool show() const {return _PointerVisible;}
|
||||||
|
|
||||||
void draw(){}
|
void draw(){}
|
||||||
|
|
||||||
/// set button state
|
/// set button state
|
||||||
void setButtonState(NLMISC::TMouseButton state) { _Buttons = state; }
|
void setButtonState(NLMISC::TMouseButton state) { _Buttons = state; }
|
||||||
/// get buttons state
|
/// get buttons state
|
||||||
NLMISC::TMouseButton getButtonState() const { return _Buttons; }
|
NLMISC::TMouseButton getButtonState() const { return _Buttons; }
|
||||||
|
|
||||||
|
static const sint32 InvalidCoord = 0x80000000;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// (x,y) is from the TopLeft corner of the window
|
// (x,y) is from the TopLeft corner of the window
|
||||||
sint32 _PointerX; // Current pointer position (raw, before snapping)
|
sint32 _PointerX; // Current pointer position (raw, before snapping)
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include "rect.h"
|
#include "rect.h"
|
||||||
#include "game_device.h"
|
#include "game_device.h"
|
||||||
#define NOMINMAX
|
#ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <dinput.h>
|
#include <dinput.h>
|
||||||
|
|
||||||
|
@ -101,7 +103,7 @@ public:
|
||||||
* \param we A windows eventsemitter. Can be NULL. Needed if you want to mix WIN32 events and Direct Input events
|
* \param we A windows eventsemitter. Can be NULL. Needed if you want to mix WIN32 events and Direct Input events
|
||||||
* (for example, a Direct Input Mouse and a Win32 Keyboard)
|
* (for example, a Direct Input Mouse and a Win32 Keyboard)
|
||||||
*/
|
*/
|
||||||
static CDIEventEmitter *create(HINSTANCE hinst, HWND hwnd, CWinEventEmitter *we);
|
static CDIEventEmitter *create(HINSTANCE hinst, HWND hwnd, CWinEventEmitter *we) throw(EDirectInput);
|
||||||
~CDIEventEmitter();
|
~CDIEventEmitter();
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,8 @@ public:
|
||||||
uint getNumAllocatedBlocks() const { return _NumAlloc; }
|
uint getNumAllocatedBlocks() const { return _NumAlloc; }
|
||||||
private:
|
private:
|
||||||
class CChunk;
|
class CChunk;
|
||||||
class CNode
|
|
||||||
|
class NL_ALIGN(NL_DEFAULT_MEMORY_ALIGNMENT) CNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CChunk *Chunk; // the Chunk this node belongs to.
|
CChunk *Chunk; // the Chunk this node belongs to.
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_COMP_VC
|
||||||
// Visual C++ warning : ebp maybe modified
|
// Visual C++ warning : ebp maybe modified
|
||||||
# pragma warning(disable:4731)
|
# pragma warning(disable:4731)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -220,7 +220,7 @@ private:
|
||||||
|
|
||||||
static TOldWinProcMap _OldWinProcMap;
|
static TOldWinProcMap _OldWinProcMap;
|
||||||
|
|
||||||
bool initInternal(HINSTANCE hInstance, HWND ownerWindow, uint32 localId, uint32 foreignId = NULL);
|
bool initInternal(HINSTANCE hInstance, HWND ownerWindow, uint32 localId, uint32 foreignId = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static LRESULT CALLBACK listenerProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK listenerProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
|
@ -53,7 +53,8 @@ class CPlane;
|
||||||
* \author Nevrax France
|
* \author Nevrax France
|
||||||
* \date 2000
|
* \date 2000
|
||||||
*/
|
*/
|
||||||
class CMatrix
|
|
||||||
|
class NL_ALIGN_SSE2 CMatrix
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Rotation Order.
|
/// Rotation Order.
|
||||||
|
|
|
@ -29,6 +29,12 @@
|
||||||
# endif // NLMISC_HEAP_ALLOCATION_NDEBUG
|
# endif // NLMISC_HEAP_ALLOCATION_NDEBUG
|
||||||
#endif // NL_USE_DEFAULT_MEMORY_MANAGER
|
#endif // NL_USE_DEFAULT_MEMORY_MANAGER
|
||||||
|
|
||||||
|
#ifndef NL_OV_USE_NEW_ALLOCATOR
|
||||||
|
# ifdef NL_HAS_SSE2
|
||||||
|
# define NL_OV_USE_NEW_ALLOCATOR
|
||||||
|
# endif // NL_HAS_SSE2
|
||||||
|
#endif // NL_OV_USE_NEW_ALLOCATOR
|
||||||
|
|
||||||
namespace NLMISC {
|
namespace NLMISC {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,10 @@
|
||||||
# define NL_COMP_VC_VERSION 60
|
# define NL_COMP_VC_VERSION 60
|
||||||
# define NL_COMP_NEED_PARAM_ON_METHOD
|
# define NL_COMP_NEED_PARAM_ON_METHOD
|
||||||
# endif
|
# endif
|
||||||
|
# elif defined(__MINGW32__)
|
||||||
|
# define NL_COMP_MINGW
|
||||||
|
# define NL_COMP_GCC
|
||||||
|
# define NL_NO_ASM
|
||||||
# endif
|
# endif
|
||||||
# if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack or later
|
# if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack or later
|
||||||
# define NL_ISO_STDTR1_AVAILABLE
|
# define NL_ISO_STDTR1_AVAILABLE
|
||||||
|
@ -93,9 +97,13 @@
|
||||||
# define NL_ISO_STDTR1_NAMESPACE std::tr1
|
# define NL_ISO_STDTR1_NAMESPACE std::tr1
|
||||||
# endif
|
# endif
|
||||||
# ifdef _DEBUG
|
# ifdef _DEBUG
|
||||||
# define NL_DEBUG
|
# ifndef NL_DEBUG
|
||||||
|
# define NL_DEBUG
|
||||||
|
# endif
|
||||||
# elif defined (NDEBUG)
|
# elif defined (NDEBUG)
|
||||||
# define NL_RELEASE
|
# ifndef NL_RELEASE
|
||||||
|
# define NL_RELEASE
|
||||||
|
# endif
|
||||||
# else
|
# else
|
||||||
# error "Don't know the compilation mode"
|
# error "Don't know the compilation mode"
|
||||||
# endif
|
# endif
|
||||||
|
@ -109,7 +117,9 @@
|
||||||
# define _WIN32_WINNT 0x0600 // force VISTA minimal version in 64 bits
|
# define _WIN32_WINNT 0x0600 // force VISTA minimal version in 64 bits
|
||||||
# endif
|
# endif
|
||||||
// define NOMINMAX to be sure that windows includes will not define min max macros, but instead, use the stl template
|
// define NOMINMAX to be sure that windows includes will not define min max macros, but instead, use the stl template
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef __APPLE__
|
# ifdef __APPLE__
|
||||||
# define NL_OS_MAC
|
# define NL_OS_MAC
|
||||||
|
@ -142,7 +152,7 @@
|
||||||
//
|
//
|
||||||
// NL_ISO_TEMPLATE_SPEC can be used in front of an instanciated class-template member data definition,
|
// NL_ISO_TEMPLATE_SPEC can be used in front of an instanciated class-template member data definition,
|
||||||
// because sometimes MSVC++ 6 produces an error C2908 with a definition with template <>.
|
// because sometimes MSVC++ 6 produces an error C2908 with a definition with template <>.
|
||||||
#if defined(NL_OS_WINDOWS) || (defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)))
|
#if defined(NL_COMP_VC) || (defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)))
|
||||||
# define NL_ISO_SYNTAX 0
|
# define NL_ISO_SYNTAX 0
|
||||||
# define NL_ISO_TEMPLATE_SPEC
|
# define NL_ISO_TEMPLATE_SPEC
|
||||||
#else
|
#else
|
||||||
|
@ -328,6 +338,57 @@ typedef unsigned int uint; // at least 32bits (depend of processor)
|
||||||
|
|
||||||
#endif // NL_OS_UNIX
|
#endif // NL_OS_UNIX
|
||||||
|
|
||||||
|
|
||||||
|
// #ifdef NL_ENABLE_FORCE_INLINE
|
||||||
|
# ifdef NL_COMP_VC
|
||||||
|
# define NL_FORCE_INLINE __forceinline
|
||||||
|
# elif defined(NL_COMP_GCC)
|
||||||
|
# define NL_FORCE_INLINE inline __attribute__((always_inline))
|
||||||
|
# else
|
||||||
|
# define NL_FORCE_INLINE inline
|
||||||
|
# endif
|
||||||
|
// #else
|
||||||
|
// # define NL_FORCE_INLINE inline
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef NL_COMP_VC
|
||||||
|
#define NL_ALIGN(nb) __declspec(align(nb))
|
||||||
|
#else
|
||||||
|
#define NL_ALIGN(nb) __attribute__((aligned(nb)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NL_OS_WINDOWS
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <intrin.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
inline void *aligned_malloc(size_t size, size_t alignment) { return _aligned_malloc(size, alignment); }
|
||||||
|
inline void aligned_free(void *ptr) { _aligned_free(ptr); }
|
||||||
|
#else
|
||||||
|
#include <malloc.h>
|
||||||
|
inline void *aligned_malloc(size_t size, size_t alignment) { return memalign(alignment, size); }
|
||||||
|
inline void aligned_free(void *ptr) { free(ptr); }
|
||||||
|
#endif /* NL_COMP_ */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef NL_HAS_SSE2
|
||||||
|
|
||||||
|
#define NL_DEFAULT_MEMORY_ALIGNMENT 16
|
||||||
|
#define NL_ALIGN_SSE2 NL_ALIGN(NL_DEFAULT_MEMORY_ALIGNMENT)
|
||||||
|
|
||||||
|
extern void *operator new(size_t size) throw(std::bad_alloc);
|
||||||
|
extern void *operator new[](size_t size) throw(std::bad_alloc);
|
||||||
|
extern void operator delete(void *p) throw();
|
||||||
|
extern void operator delete[](void *p) throw();
|
||||||
|
|
||||||
|
#else /* NL_HAS_SSE2 */
|
||||||
|
|
||||||
|
#define NL_DEFAULT_MEMORY_ALIGNMENT 4
|
||||||
|
#define NL_ALIGN_SSE2
|
||||||
|
|
||||||
|
#endif /* NL_HAS_SSE2 */
|
||||||
|
|
||||||
|
|
||||||
// CHashMap, CHashSet and CHashMultiMap definitions
|
// CHashMap, CHashSet and CHashMultiMap definitions
|
||||||
#if defined(_STLPORT_VERSION) // STLport detected
|
#if defined(_STLPORT_VERSION) // STLport detected
|
||||||
# include <hash_map>
|
# include <hash_map>
|
||||||
|
@ -388,8 +449,8 @@ typedef uint16 ucchar;
|
||||||
|
|
||||||
|
|
||||||
// To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234)
|
// To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234)
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_COMP_VC
|
||||||
# if defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 80)
|
# if (NL_COMP_VC_VERSION >= 80)
|
||||||
# define INT64_CONSTANT(c) (c##LL)
|
# define INT64_CONSTANT(c) (c##LL)
|
||||||
# define SINT64_CONSTANT(c) (c##LL)
|
# define SINT64_CONSTANT(c) (c##LL)
|
||||||
# define UINT64_CONSTANT(c) (c##LL)
|
# define UINT64_CONSTANT(c) (c##LL)
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||||
#define NOMINMAX
|
#ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include "displayer.h"
|
#include "displayer.h"
|
||||||
|
|
|
@ -50,10 +50,10 @@ public:
|
||||||
virtual ~CBufSock();
|
virtual ~CBufSock();
|
||||||
|
|
||||||
/// Sets the application identifier
|
/// Sets the application identifier
|
||||||
void setAppId( uint64 id ) { _AppId = id; }
|
void setAppId( uintptr_t id ) { _AppId = id; }
|
||||||
|
|
||||||
/// Returns the application identifier
|
/// Returns the application identifier
|
||||||
uint64 appId() const { return _AppId; }
|
uintptr_t appId() const { return _AppId; }
|
||||||
|
|
||||||
/// Returns a string with the characteristics of the object
|
/// Returns a string with the characteristics of the object
|
||||||
std::string asString() const;
|
std::string asString() const;
|
||||||
|
@ -256,7 +256,7 @@ private:
|
||||||
NLMISC::CObjectVector<uint8> _ReadyToSendBuffer;
|
NLMISC::CObjectVector<uint8> _ReadyToSendBuffer;
|
||||||
TBlockSize _RTSBIndex;
|
TBlockSize _RTSBIndex;
|
||||||
|
|
||||||
uint64 _AppId;
|
uintptr_t _AppId;
|
||||||
|
|
||||||
// Connected state (from the user's point of view, i.e. changed when the connection/disconnection event is at the front of the receive queue)
|
// Connected state (from the user's point of view, i.e. changed when the connection/disconnection event is at the front of the receive queue)
|
||||||
bool _ConnectedState;
|
bool _ConnectedState;
|
||||||
|
|
|
@ -34,8 +34,8 @@ extern uint16 gScreenHeight;
|
||||||
|
|
||||||
class NeLDriver {
|
class NeLDriver {
|
||||||
public:
|
public:
|
||||||
NeLDriver(NL3D::UDriver *driver) { m_Driver=driver; }
|
NeLDriver(NL3D::UDriver *driver):m_Driver(driver), m_TextContext(NULL), m_Scene(NULL) { }
|
||||||
virtual ~NeLDriver() { ; }
|
virtual ~NeLDriver() { }
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void update();
|
void update();
|
||||||
|
|
|
@ -38,7 +38,9 @@
|
||||||
#include "nel/3d/event_mouse_listener.h"
|
#include "nel/3d/event_mouse_listener.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
@ -360,7 +362,7 @@ int main()
|
||||||
}
|
}
|
||||||
++itAcc;
|
++itAcc;
|
||||||
}
|
}
|
||||||
if ((vCluster.size() == 0) && (DispCS[0].pIG == pCurIG))
|
if (vCluster.empty() && (DispCS[0].pIG == pCurIG))
|
||||||
{
|
{
|
||||||
vCluster.push_back (pClipTrav->RootCluster);
|
vCluster.push_back (pClipTrav->RootCluster);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
#include "nel/3d/driver_user.h"
|
#include "nel/3d/driver_user.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
#define NOMINMAX
|
#ifndef NL_COMP_MINGW
|
||||||
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ CConfiguration::~CConfiguration()
|
||||||
void CConfiguration::init()
|
void CConfiguration::init()
|
||||||
{
|
{
|
||||||
// verify data
|
// verify data
|
||||||
nlassert(!m_ConfigCallbacks.size());
|
nlassert(m_ConfigCallbacks.empty());
|
||||||
|
|
||||||
// load config
|
// load config
|
||||||
m_ConfigFile.load(NLQT_CONFIG_FILE);
|
m_ConfigFile.load(NLQT_CONFIG_FILE);
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
#include <nel/3d/u_instance.h>
|
#include <nel/3d/u_instance.h>
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
#define NOMINMAX
|
#ifndef NL_COMP_MINGW
|
||||||
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,9 @@
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#include "nel/misc/types_nl.h"
|
||||||
|
|
||||||
|
#ifndef NL_OS_WINDOWS
|
||||||
#include "kbhit.h"
|
#include "kbhit.h"
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <unistd.h> // for read()
|
#include <unistd.h> // for read()
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
#include "nel/net/callback_server.h"
|
#include "nel/net/callback_server.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,9 @@
|
||||||
#include "nel/net/transport_class.h"
|
#include "nel/net/transport_class.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,9 @@
|
||||||
#include "nel/net/transport_class.h"
|
#include "nel/net/transport_class.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
#include "nel/net/login_server.h"
|
#include "nel/net/login_server.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,9 @@
|
||||||
#include "receive_task.h"
|
#include "receive_task.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
|
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#elif defined NL_OS_UNIX
|
#elif defined NL_OS_UNIX
|
||||||
|
|
||||||
|
|
|
@ -143,11 +143,13 @@ void CComputedString::render2D (IDriver& driver,
|
||||||
/*------------------------------------------------------------------*\
|
/*------------------------------------------------------------------*\
|
||||||
render3D()
|
render3D()
|
||||||
\*------------------------------------------------------------------*/
|
\*------------------------------------------------------------------*/
|
||||||
void CComputedString::render3D (IDriver& driver,CMatrix matrix,THotSpot hotspot)
|
void CComputedString::render3D (IDriver& driver, const CMatrix &matrixp, THotSpot hotspot)
|
||||||
{
|
{
|
||||||
if (Vertices.getNumVertices() == 0)
|
if (Vertices.getNumVertices() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CMatrix matrix = matrixp;
|
||||||
|
|
||||||
// get window size
|
// get window size
|
||||||
uint32 wndWidth, wndHeight;
|
uint32 wndWidth, wndHeight;
|
||||||
driver.getWindowSize(wndWidth, wndHeight);
|
driver.getWindowSize(wndWidth, wndHeight);
|
||||||
|
|
|
@ -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_RUNTIME_FLAGS(nel_drv_direct3d_win)
|
||||||
NL_ADD_LIB_SUFFIX(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)
|
IF(WITH_PCH)
|
||||||
ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_direct3d_win ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.h ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.cpp)
|
ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_direct3d_win ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.h ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.cpp)
|
||||||
|
|
|
@ -110,6 +110,10 @@ IDriver* createD3DDriverInstance ()
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#ifdef NL_COMP_MINGW
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
__declspec(dllexport) IDriver* NL3D_createIDriverInstance ()
|
__declspec(dllexport) IDriver* NL3D_createIDriverInstance ()
|
||||||
{
|
{
|
||||||
return new CDriverD3D;
|
return new CDriverD3D;
|
||||||
|
@ -119,7 +123,9 @@ __declspec(dllexport) uint32 NL3D_interfaceVersion ()
|
||||||
{
|
{
|
||||||
return IDriver::InterfaceVersion;
|
return IDriver::InterfaceVersion;
|
||||||
}
|
}
|
||||||
|
#ifdef NL_COMP_MINGW
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*static*/ bool CDriverD3D::_CacheTest[CacheTest_Count] =
|
/*static*/ bool CDriverD3D::_CacheTest[CacheTest_Count] =
|
||||||
|
@ -379,7 +385,7 @@ void CDriverD3D::resetRenderVariables()
|
||||||
}
|
}
|
||||||
for (i=0; i<MaxTexture; i++)
|
for (i=0; i<MaxTexture; i++)
|
||||||
{
|
{
|
||||||
if ((uint32)(_TexturePtrStateCache[i].Texture) != 0xcccccccc)
|
if ((uintptr_t)(_TexturePtrStateCache[i].Texture) != 0xcccccccc)
|
||||||
{
|
{
|
||||||
touchRenderVariable (&(_TexturePtrStateCache[i]));
|
touchRenderVariable (&(_TexturePtrStateCache[i]));
|
||||||
// reset texture because it may reference an old render target
|
// reset texture because it may reference an old render target
|
||||||
|
@ -419,7 +425,7 @@ void CDriverD3D::resetRenderVariables()
|
||||||
|
|
||||||
for (i=0; i<MaxLight; i++)
|
for (i=0; i<MaxLight; i++)
|
||||||
{
|
{
|
||||||
if (*(uint32*)(&(_LightCache[i].Light)) != 0xcccccccc)
|
if (*(uintptr_t*)(&(_LightCache[i].Light)) != 0xcccccccc)
|
||||||
{
|
{
|
||||||
_LightCache[i].EnabledTouched = true;
|
_LightCache[i].EnabledTouched = true;
|
||||||
touchRenderVariable (&(_LightCache[i]));
|
touchRenderVariable (&(_LightCache[i]));
|
||||||
|
@ -514,7 +520,7 @@ void CDriverD3D::initRenderVariables()
|
||||||
for (i=0; i<MaxTexture; i++)
|
for (i=0; i<MaxTexture; i++)
|
||||||
{
|
{
|
||||||
_TexturePtrStateCache[i].StageID = i;
|
_TexturePtrStateCache[i].StageID = i;
|
||||||
*(uint32*)&(_TexturePtrStateCache[i].Texture) = 0xcccccccc;
|
*(uintptr_t*)&(_TexturePtrStateCache[i].Texture) = 0xcccccccc;
|
||||||
_TexturePtrStateCache[i].Modified = false;
|
_TexturePtrStateCache[i].Modified = false;
|
||||||
}
|
}
|
||||||
for (i=0; i<MaxSampler; i++)
|
for (i=0; i<MaxSampler; i++)
|
||||||
|
@ -543,7 +549,7 @@ void CDriverD3D::initRenderVariables()
|
||||||
for (i=0; i<MaxLight; ++i)
|
for (i=0; i<MaxLight; ++i)
|
||||||
{
|
{
|
||||||
_LightCache[i].LightIndex = uint8(i);
|
_LightCache[i].LightIndex = uint8(i);
|
||||||
*(uint32*)&(_LightCache[i].Light) = 0xcccccccc;
|
*(uintptr_t*)&(_LightCache[i].Light) = 0xcccccccc;
|
||||||
_LightCache[i].Modified = false;
|
_LightCache[i].Modified = false;
|
||||||
}
|
}
|
||||||
_VertexProgramCache.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);
|
H_AUTO_D3D(D3DWndProc);
|
||||||
|
|
||||||
|
@ -1231,7 +1237,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
bool CDriverD3D::init (uint windowIcon, emptyProc exitFunc)
|
bool CDriverD3D::init (uintptr_t windowIcon, emptyProc exitFunc)
|
||||||
{
|
{
|
||||||
H_AUTO_D3D(CDriver3D_init );
|
H_AUTO_D3D(CDriver3D_init );
|
||||||
|
|
||||||
|
@ -1481,7 +1487,7 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif WITH_PERFHUD
|
#endif /* WITH_PERFHUD */
|
||||||
// Create the D3D device
|
// Create the D3D device
|
||||||
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE, ¶meters, &_DeviceInterface);
|
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE, ¶meters, &_DeviceInterface);
|
||||||
if (result != D3D_OK)
|
if (result != D3D_OK)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
EXPORTS NL3D_createIDriverInstance
|
LIBRARY nel_drv_direct3d_win_r
|
||||||
EXPORTS NL3D_interfaceVersion
|
EXPORTS
|
||||||
|
NL3D_createIDriverInstance
|
||||||
|
NL3D_interfaceVersion
|
|
@ -839,7 +839,7 @@ public:
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
// Mode initialisation, requests
|
// Mode initialisation, requests
|
||||||
virtual bool init (uint windowIcon = 0, emptyProc exitFunc = 0);
|
virtual bool init (uintptr_t windowIcon = 0, emptyProc exitFunc = 0);
|
||||||
virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay);
|
virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay);
|
||||||
virtual bool release();
|
virtual bool release();
|
||||||
virtual bool setMode(const GfxMode& mode);
|
virtual bool setMode(const GfxMode& mode);
|
||||||
|
@ -953,7 +953,7 @@ public:
|
||||||
virtual void setSwapVBLInterval(uint interval);
|
virtual void setSwapVBLInterval(uint interval);
|
||||||
virtual uint getSwapVBLInterval();
|
virtual uint getSwapVBLInterval();
|
||||||
virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1);
|
virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1);
|
||||||
virtual uint getTextureHandle(const ITexture&tex);
|
virtual uintptr_t getTextureHandle(const ITexture&tex);
|
||||||
|
|
||||||
// Matrix, viewport and frustum
|
// Matrix, viewport and frustum
|
||||||
virtual void setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective = true);
|
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);
|
H_AUTO_D3D(CDriverD3D_setSamplerState);
|
||||||
nlassert (_DeviceInterface);
|
nlassert (_DeviceInterface);
|
||||||
nlassert (sampler<MaxSampler);
|
nlassert (sampler<MaxSampler);
|
||||||
nlassert (samplerState<MaxSamplerState);
|
nlassert ((int)samplerState<(int)MaxSamplerState);
|
||||||
|
|
||||||
// Ref on the state
|
// Ref on the state
|
||||||
CSamplerState &_samplerState = _SamplerStateCache[sampler][samplerState];
|
CSamplerState &_samplerState = _SamplerStateCache[sampler][samplerState];
|
||||||
|
@ -2025,7 +2025,7 @@ public:
|
||||||
|
|
||||||
// Remap high matrices indexes
|
// Remap high matrices indexes
|
||||||
type = (D3DTRANSFORMSTATETYPE)remapMatrixIndex (type);
|
type = (D3DTRANSFORMSTATETYPE)remapMatrixIndex (type);
|
||||||
nlassert (type<MaxMatrixState);
|
nlassert ((int)type<(int)MaxMatrixState);
|
||||||
|
|
||||||
CMatrixState &theMatrix = _MatrixCache[type];
|
CMatrixState &theMatrix = _MatrixCache[type];
|
||||||
#ifdef NL_D3D_USE_RENDER_STATE_CACHE
|
#ifdef NL_D3D_USE_RENDER_STATE_CACHE
|
||||||
|
|
|
@ -46,7 +46,7 @@ CIBDrvInfosD3D::CIBDrvInfosD3D(CDriverD3D *drv, ItIBDrvInfoPtrList it, CIndexBuf
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
extern uint indexCount=0;
|
uint indexCount=0;
|
||||||
|
|
||||||
CIBDrvInfosD3D::~CIBDrvInfosD3D()
|
CIBDrvInfosD3D::~CIBDrvInfosD3D()
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
H_AUTO_D3D(CDriverD3D_getTextureHandle)
|
||||||
// If DrvShare not setuped
|
// If DrvShare not setuped
|
||||||
|
@ -1104,7 +1104,7 @@ uint CDriverD3D::getTextureHandle(const ITexture &tex)
|
||||||
if(!d3dtext)
|
if(!d3dtext)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (uint)(d3dtext->Texture);
|
return (uintptr_t)(d3dtext->Texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
|
@ -59,7 +59,7 @@ CVBDrvInfosD3D::CVBDrvInfosD3D(CDriverD3D *drv, ItVBDrvInfoPtrList it, CVertexBu
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
extern uint vertexCount=0;
|
uint vertexCount=0;
|
||||||
|
|
||||||
CVBDrvInfosD3D::~CVBDrvInfosD3D()
|
CVBDrvInfosD3D::~CVBDrvInfosD3D()
|
||||||
{
|
{
|
||||||
|
@ -173,7 +173,7 @@ uint8 *CVBDrvInfosD3D::lock (uint begin, uint end, bool readOnly)
|
||||||
|
|
||||||
void *pbData;
|
void *pbData;
|
||||||
if (VertexBuffer->Lock ( begin, end-begin, &pbData, readOnly?D3DLOCK_READONLY:0) != D3D_OK)
|
if (VertexBuffer->Lock ( begin, end-begin, &pbData, readOnly?D3DLOCK_READONLY:0) != D3D_OK)
|
||||||
return false;
|
return NULL;
|
||||||
|
|
||||||
// Lock Profile?
|
// Lock Profile?
|
||||||
if(driver->_VBHardProfiling /*&& Hardware*/)
|
if(driver->_VBHardProfiling /*&& Hardware*/)
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ NL_ADD_RUNTIME_FLAGS(${NLDRV_OGL_LIB})
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
|
||||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
|
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
|
||||||
ADD_DEFINITIONS(/DDRIVER_OPENGL_EXPORTS)
|
ADD_DEFINITIONS(-DDRIVER_OPENGL_EXPORTS)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
|
|
|
@ -108,7 +108,10 @@ IDriver* createGlDriverInstance ()
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
#ifdef NL_COMP_MINGW
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
__declspec(dllexport) IDriver* NL3D_createIDriverInstance ()
|
__declspec(dllexport) IDriver* NL3D_createIDriverInstance ()
|
||||||
{
|
{
|
||||||
return new CDriverGL;
|
return new CDriverGL;
|
||||||
|
@ -118,7 +121,9 @@ __declspec(dllexport) uint32 NL3D_interfaceVersion ()
|
||||||
{
|
{
|
||||||
return IDriver::InterfaceVersion;
|
return IDriver::InterfaceVersion;
|
||||||
}
|
}
|
||||||
|
#ifdef NL_COMP_MINGW
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#elif defined (NL_OS_UNIX)
|
#elif defined (NL_OS_UNIX)
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -478,6 +483,11 @@ bool CDriverGL::setupDisplay()
|
||||||
glLightModeli((GLenum)GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT);
|
glLightModeli((GLenum)GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_Extensions.ARBFragmentShader)
|
||||||
|
{
|
||||||
|
_ForceNativeFragmentPrograms = false;
|
||||||
|
}
|
||||||
|
|
||||||
_VertexProgramEnabled= false;
|
_VertexProgramEnabled= false;
|
||||||
_PixelProgramEnabled= false;
|
_PixelProgramEnabled= false;
|
||||||
|
@ -2652,7 +2662,7 @@ void CDriverGL::checkTextureOn() const
|
||||||
bool CDriverGL::supportOcclusionQuery() const
|
bool CDriverGL::supportOcclusionQuery() const
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CDriverGL_supportOcclusionQuery)
|
H_AUTO_OGL(CDriverGL_supportOcclusionQuery)
|
||||||
return _Extensions.NVOcclusionQuery;
|
return _Extensions.NVOcclusionQuery || _Extensions.ARBOcclusionQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -2683,11 +2693,14 @@ bool CDriverGL::supportFrameBufferObject() const
|
||||||
IOcclusionQuery *CDriverGL::createOcclusionQuery()
|
IOcclusionQuery *CDriverGL::createOcclusionQuery()
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CDriverGL_createOcclusionQuery)
|
H_AUTO_OGL(CDriverGL_createOcclusionQuery)
|
||||||
nlassert(_Extensions.NVOcclusionQuery);
|
nlassert(_Extensions.NVOcclusionQuery || _Extensions.ARBOcclusionQuery);
|
||||||
|
|
||||||
#ifndef USE_OPENGLES
|
#ifndef USE_OPENGLES
|
||||||
GLuint id;
|
GLuint id;
|
||||||
nglGenOcclusionQueriesNV(1, &id);
|
if (_Extensions.NVOcclusionQuery)
|
||||||
|
nglGenOcclusionQueriesNV(1, &id);
|
||||||
|
else
|
||||||
|
nglGenQueriesARB(1, &id);
|
||||||
if (id == 0) return NULL;
|
if (id == 0) return NULL;
|
||||||
COcclusionQueryGL *oqgl = new COcclusionQueryGL;
|
COcclusionQueryGL *oqgl = new COcclusionQueryGL;
|
||||||
oqgl->Driver = this;
|
oqgl->Driver = this;
|
||||||
|
@ -2714,7 +2727,10 @@ void CDriverGL::deleteOcclusionQuery(IOcclusionQuery *oq)
|
||||||
oqgl->Driver = NULL;
|
oqgl->Driver = NULL;
|
||||||
nlassert(oqgl->ID != 0);
|
nlassert(oqgl->ID != 0);
|
||||||
GLuint id = oqgl->ID;
|
GLuint id = oqgl->ID;
|
||||||
nglDeleteOcclusionQueriesNV(1, &id);
|
if (_Extensions.NVOcclusionQuery)
|
||||||
|
nglDeleteOcclusionQueriesNV(1, &id);
|
||||||
|
else
|
||||||
|
nglDeleteQueriesARB(1, &id);
|
||||||
_OcclusionQueryList.erase(oqgl->Iterator);
|
_OcclusionQueryList.erase(oqgl->Iterator);
|
||||||
if (oqgl == _CurrentOcclusionQuery)
|
if (oqgl == _CurrentOcclusionQuery)
|
||||||
{
|
{
|
||||||
|
@ -2733,7 +2749,10 @@ void COcclusionQueryGL::begin()
|
||||||
nlassert(Driver);
|
nlassert(Driver);
|
||||||
nlassert(Driver->_CurrentOcclusionQuery == NULL); // only one query at a time
|
nlassert(Driver->_CurrentOcclusionQuery == NULL); // only one query at a time
|
||||||
nlassert(ID);
|
nlassert(ID);
|
||||||
nglBeginOcclusionQueryNV(ID);
|
if (Driver->_Extensions.NVOcclusionQuery)
|
||||||
|
nglBeginOcclusionQueryNV(ID);
|
||||||
|
else
|
||||||
|
nglBeginQueryARB(GL_SAMPLES_PASSED, ID);
|
||||||
Driver->_CurrentOcclusionQuery = this;
|
Driver->_CurrentOcclusionQuery = this;
|
||||||
OcclusionType = NotAvailable;
|
OcclusionType = NotAvailable;
|
||||||
VisibleCount = 0;
|
VisibleCount = 0;
|
||||||
|
@ -2749,7 +2768,10 @@ void COcclusionQueryGL::end()
|
||||||
nlassert(Driver);
|
nlassert(Driver);
|
||||||
nlassert(Driver->_CurrentOcclusionQuery == this); // only one query at a time
|
nlassert(Driver->_CurrentOcclusionQuery == this); // only one query at a time
|
||||||
nlassert(ID);
|
nlassert(ID);
|
||||||
nglEndOcclusionQueryNV();
|
if (Driver->_Extensions.NVOcclusionQuery)
|
||||||
|
nglEndOcclusionQueryNV();
|
||||||
|
else
|
||||||
|
nglEndQueryARB(GL_SAMPLES_PASSED);
|
||||||
Driver->_CurrentOcclusionQuery = NULL;
|
Driver->_CurrentOcclusionQuery = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2765,15 +2787,25 @@ IOcclusionQuery::TOcclusionType COcclusionQueryGL::getOcclusionType()
|
||||||
nlassert(Driver->_CurrentOcclusionQuery != this); // can't query result between a begin/end pair!
|
nlassert(Driver->_CurrentOcclusionQuery != this); // can't query result between a begin/end pair!
|
||||||
if (OcclusionType == NotAvailable)
|
if (OcclusionType == NotAvailable)
|
||||||
{
|
{
|
||||||
GLuint result;
|
if (Driver->_Extensions.NVOcclusionQuery)
|
||||||
// retrieve result
|
|
||||||
nglGetOcclusionQueryuivNV(ID, GL_PIXEL_COUNT_AVAILABLE_NV, &result);
|
|
||||||
if (result != GL_FALSE)
|
|
||||||
{
|
{
|
||||||
nglGetOcclusionQueryuivNV(ID, GL_PIXEL_COUNT_NV, &result);
|
GLuint result;
|
||||||
|
// retrieve result
|
||||||
|
nglGetOcclusionQueryuivNV(ID, GL_PIXEL_COUNT_AVAILABLE_NV, &result);
|
||||||
|
if (result != GL_FALSE)
|
||||||
|
{
|
||||||
|
nglGetOcclusionQueryuivNV(ID, GL_PIXEL_COUNT_NV, &result);
|
||||||
|
OcclusionType = result != 0 ? NotOccluded : Occluded;
|
||||||
|
VisibleCount = (uint) result;
|
||||||
|
// Note : we could return the exact number of pixels that passed the z-test, but this value is not supported by all implementation (Direct3D ...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GLuint result;
|
||||||
|
nglGetQueryObjectuivARB(ID, GL_QUERY_RESULT, &result);
|
||||||
OcclusionType = result != 0 ? NotOccluded : Occluded;
|
OcclusionType = result != 0 ? NotOccluded : Occluded;
|
||||||
VisibleCount = (uint) result;
|
VisibleCount = (uint) result;
|
||||||
// Note : we could return the exact number of pixels that passed the z-test, but this value is not supported by all implementation (Direct3D ...)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
EXPORTS NL3D_createIDriverInstance
|
LIBRARY nel_drv_opengl_win_r
|
||||||
EXPORTS NL3D_interfaceVersion
|
EXPORTS
|
||||||
|
NL3D_createIDriverInstance
|
||||||
|
NL3D_interfaceVersion
|
|
@ -304,7 +304,7 @@ public:
|
||||||
|
|
||||||
virtual bool isLost() const { return false; } // there's no notion of 'lost device" in OpenGL
|
virtual bool isLost() const { return false; } // there's no notion of 'lost device" in OpenGL
|
||||||
|
|
||||||
virtual bool init (uint windowIcon = 0, emptyProc exitFunc = 0);
|
virtual bool init (uintptr_t windowIcon = 0, emptyProc exitFunc = 0);
|
||||||
|
|
||||||
virtual void disableHardwareVertexProgram();
|
virtual void disableHardwareVertexProgram();
|
||||||
virtual void disableHardwarePixelProgram();
|
virtual void disableHardwarePixelProgram();
|
||||||
|
@ -632,7 +632,7 @@ public:
|
||||||
|
|
||||||
virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1);
|
virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1);
|
||||||
|
|
||||||
virtual uint getTextureHandle(const ITexture&tex);
|
virtual uintptr_t getTextureHandle(const ITexture&tex);
|
||||||
|
|
||||||
/// \name Material multipass.
|
/// \name Material multipass.
|
||||||
/** NB: setupMaterial() must be called before thoses methods.
|
/** NB: setupMaterial() must be called before thoses methods.
|
||||||
|
@ -1591,6 +1591,7 @@ private:
|
||||||
// @}
|
// @}
|
||||||
// misc
|
// misc
|
||||||
public:
|
public:
|
||||||
|
friend class COcclusionQueryGL;
|
||||||
static GLenum NLCubeFaceToGLCubeFace[6];
|
static GLenum NLCubeFaceToGLCubeFace[6];
|
||||||
static CMaterial::CTexEnv _TexEnvReplace;
|
static CMaterial::CTexEnv _TexEnvReplace;
|
||||||
// occlusion query
|
// occlusion query
|
||||||
|
|
|
@ -372,6 +372,10 @@ PFNGLUNMAPBUFFERARBPROC nglUnmapBufferARB;
|
||||||
PFNGLGETBUFFERPARAMETERIVARBPROC nglGetBufferParameterivARB;
|
PFNGLGETBUFFERPARAMETERIVARBPROC nglGetBufferParameterivARB;
|
||||||
PFNGLGETBUFFERPOINTERVARBPROC nglGetBufferPointervARB;
|
PFNGLGETBUFFERPOINTERVARBPROC nglGetBufferPointervARB;
|
||||||
|
|
||||||
|
// GL_ARB_map_buffer_range
|
||||||
|
PFNGLMAPBUFFERRANGEPROC nglMapBufferRange;
|
||||||
|
PFNGLFLUSHMAPPEDBUFFERRANGEPROC nglFlushMappedBufferRange;
|
||||||
|
|
||||||
// GL_ARB_vertex_program
|
// GL_ARB_vertex_program
|
||||||
PFNGLVERTEXATTRIB1SARBPROC nglVertexAttrib1sARB;
|
PFNGLVERTEXATTRIB1SARBPROC nglVertexAttrib1sARB;
|
||||||
PFNGLVERTEXATTRIB1FARBPROC nglVertexAttrib1fARB;
|
PFNGLVERTEXATTRIB1FARBPROC nglVertexAttrib1fARB;
|
||||||
|
@ -445,6 +449,16 @@ PFNGLENDOCCLUSIONQUERYNVPROC nglEndOcclusionQueryNV;
|
||||||
PFNGLGETOCCLUSIONQUERYIVNVPROC nglGetOcclusionQueryivNV;
|
PFNGLGETOCCLUSIONQUERYIVNVPROC nglGetOcclusionQueryivNV;
|
||||||
PFNGLGETOCCLUSIONQUERYUIVNVPROC nglGetOcclusionQueryuivNV;
|
PFNGLGETOCCLUSIONQUERYUIVNVPROC nglGetOcclusionQueryuivNV;
|
||||||
|
|
||||||
|
// ARB_occlusion_query
|
||||||
|
PFNGLGENQUERIESPROC nglGenQueriesARB;
|
||||||
|
PFNGLDELETEQUERIESPROC nglDeleteQueriesARB;
|
||||||
|
PFNGLISQUERYPROC nglIsQueryARB;
|
||||||
|
PFNGLBEGINQUERYPROC nglBeginQueryARB;
|
||||||
|
PFNGLENDQUERYPROC nglEndQueryARB;
|
||||||
|
PFNGLGETQUERYIVPROC nglGetQueryivARB;
|
||||||
|
PFNGLGETQUERYOBJECTIVPROC nglGetQueryObjectivARB;
|
||||||
|
PFNGLGETQUERYOBJECTUIVPROC nglGetQueryObjectuivARB;
|
||||||
|
|
||||||
// GL_EXT_framebuffer_object
|
// GL_EXT_framebuffer_object
|
||||||
PFNGLISRENDERBUFFEREXTPROC nglIsRenderbufferEXT;
|
PFNGLISRENDERBUFFEREXTPROC nglIsRenderbufferEXT;
|
||||||
PFNGLISFRAMEBUFFEREXTPROC nglIsFramebufferEXT;
|
PFNGLISFRAMEBUFFEREXTPROC nglIsFramebufferEXT;
|
||||||
|
@ -1235,6 +1249,15 @@ static bool setupNVFragmentProgram2(const char *glext)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *********************************
|
||||||
|
static bool setupARBFragmentShader(const char *glext)
|
||||||
|
{
|
||||||
|
H_AUTO_OGL(setupNVFragmentProgram2);
|
||||||
|
CHECK_EXT("GL_ARB_fragment_shader");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
static bool setupARBVertexBufferObject(const char *glext)
|
static bool setupARBVertexBufferObject(const char *glext)
|
||||||
{
|
{
|
||||||
|
@ -1259,6 +1282,21 @@ static bool setupARBVertexBufferObject(const char *glext)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
static bool setupARBMapBufferRange(const char *glext)
|
||||||
|
{
|
||||||
|
H_AUTO_OGL(setupARBMapBufferRange);
|
||||||
|
|
||||||
|
#ifndef USE_OPENGLES
|
||||||
|
CHECK_EXT("GL_ARB_map_buffer_range");
|
||||||
|
|
||||||
|
CHECK_ADDRESS(PFNGLMAPBUFFERRANGEPROC, glMapBufferRange);
|
||||||
|
CHECK_ADDRESS(PFNGLFLUSHMAPPEDBUFFERRANGEPROC, glFlushMappedBufferRange);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
static bool setupARBVertexProgram(const char *glext)
|
static bool setupARBVertexProgram(const char *glext)
|
||||||
{
|
{
|
||||||
|
@ -1352,6 +1390,26 @@ static bool setupNVOcclusionQuery(const char *glext)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
static bool setupARBOcclusionQuery(const char *glext)
|
||||||
|
{
|
||||||
|
H_AUTO_OGL(setupARBOcclusionQuery);
|
||||||
|
CHECK_EXT("ARB_occlusion_query");
|
||||||
|
|
||||||
|
#ifndef USE_OPENGLES
|
||||||
|
CHECK_ADDRESS(PFNGLGENQUERIESPROC, glGenQueriesARB);
|
||||||
|
CHECK_ADDRESS(PFNGLDELETEQUERIESPROC, glDeleteQueriesARB);
|
||||||
|
CHECK_ADDRESS(PFNGLISQUERYPROC, glIsQueryARB);
|
||||||
|
CHECK_ADDRESS(PFNGLBEGINQUERYPROC, glBeginQueryARB);
|
||||||
|
CHECK_ADDRESS(PFNGLENDQUERYPROC, glEndQueryARB);
|
||||||
|
CHECK_ADDRESS(PFNGLGETQUERYIVPROC, glGetQueryivARB);
|
||||||
|
CHECK_ADDRESS(PFNGLGETQUERYOBJECTIVPROC, glGetQueryObjectivARB);
|
||||||
|
CHECK_ADDRESS(PFNGLGETQUERYOBJECTUIVPROC, glGetQueryObjectuivARB);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
static bool setupNVTextureRectangle(const char *glext)
|
static bool setupNVTextureRectangle(const char *glext)
|
||||||
|
@ -1578,7 +1636,7 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
{
|
{
|
||||||
ext.NVVertexProgram = setupNVVertexProgram(glext);
|
ext.NVVertexProgram = setupNVVertexProgram(glext);
|
||||||
ext.EXTVertexShader = setupEXTVertexShader(glext);
|
ext.EXTVertexShader = setupEXTVertexShader(glext);
|
||||||
ext.ARBVertexProgram= setupARBVertexProgram(glext);
|
ext.ARBVertexProgram = setupARBVertexProgram(glext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1593,6 +1651,7 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
{
|
{
|
||||||
ext.ARBFragmentProgram = setupARBFragmentProgram(glext);
|
ext.ARBFragmentProgram = setupARBFragmentProgram(glext);
|
||||||
ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext);
|
ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext);
|
||||||
|
ext.ARBFragmentShader = setupARBFragmentShader(glext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1644,6 +1703,9 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
// Check NV_occlusion_query
|
// Check NV_occlusion_query
|
||||||
ext.NVOcclusionQuery = setupNVOcclusionQuery(glext);
|
ext.NVOcclusionQuery = setupNVOcclusionQuery(glext);
|
||||||
|
|
||||||
|
// Check ARB_occlusion_query
|
||||||
|
ext.ARBOcclusionQuery = setupARBOcclusionQuery(glext);
|
||||||
|
|
||||||
// Check GL_NV_texture_rectangle
|
// Check GL_NV_texture_rectangle
|
||||||
ext.NVTextureRectangle = setupNVTextureRectangle(glext);
|
ext.NVTextureRectangle = setupNVTextureRectangle(glext);
|
||||||
|
|
||||||
|
@ -1692,9 +1754,13 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
|
|
||||||
// ARB extensions
|
// ARB extensions
|
||||||
// -------------
|
// -------------
|
||||||
if(!ext.DisableHardwareVertexArrayAGP)
|
if (!ext.DisableHardwareVertexArrayAGP)
|
||||||
{
|
{
|
||||||
ext.ARBVertexBufferObject = setupARBVertexBufferObject(glext);
|
ext.ARBVertexBufferObject = setupARBVertexBufferObject(glext);
|
||||||
|
if (ext.ARBVertexBufferObject)
|
||||||
|
{
|
||||||
|
ext.ARBMapBufferRange = setupARBMapBufferRange(glext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix for radeon 7200 -> disable agp
|
// fix for radeon 7200 -> disable agp
|
||||||
|
|
|
@ -58,6 +58,7 @@ struct CGlExtensions
|
||||||
bool EXTVertexShader;
|
bool EXTVertexShader;
|
||||||
bool NVTextureShader;
|
bool NVTextureShader;
|
||||||
bool NVOcclusionQuery;
|
bool NVOcclusionQuery;
|
||||||
|
bool ARBOcclusionQuery;
|
||||||
bool NVTextureRectangle;
|
bool NVTextureRectangle;
|
||||||
bool EXTTextureRectangle;
|
bool EXTTextureRectangle;
|
||||||
bool ARBTextureRectangle;
|
bool ARBTextureRectangle;
|
||||||
|
@ -99,9 +100,11 @@ struct CGlExtensions
|
||||||
bool ARBTextureCompression;
|
bool ARBTextureCompression;
|
||||||
bool ARBFragmentProgram;
|
bool ARBFragmentProgram;
|
||||||
bool ARBVertexBufferObject;
|
bool ARBVertexBufferObject;
|
||||||
|
bool ARBMapBufferRange;
|
||||||
bool ARBVertexProgram;
|
bool ARBVertexProgram;
|
||||||
bool ARBTextureNonPowerOfTwo;
|
bool ARBTextureNonPowerOfTwo;
|
||||||
bool ARBMultisample;
|
bool ARBMultisample;
|
||||||
|
bool ARBFragmentShader;
|
||||||
|
|
||||||
// NV Pixel Programs
|
// NV Pixel Programs
|
||||||
bool NVFragmentProgram2;
|
bool NVFragmentProgram2;
|
||||||
|
@ -167,6 +170,7 @@ public:
|
||||||
EXTVertexShader= false;
|
EXTVertexShader= false;
|
||||||
ARBFragmentProgram = false;
|
ARBFragmentProgram = false;
|
||||||
ARBVertexBufferObject = false;
|
ARBVertexBufferObject = false;
|
||||||
|
ARBMapBufferRange = false;
|
||||||
ARBVertexProgram = false;
|
ARBVertexProgram = false;
|
||||||
NVTextureRectangle = false;
|
NVTextureRectangle = false;
|
||||||
EXTTextureRectangle = false;
|
EXTTextureRectangle = false;
|
||||||
|
@ -175,7 +179,9 @@ public:
|
||||||
ARBTextureRectangle = false;
|
ARBTextureRectangle = false;
|
||||||
ARBTextureNonPowerOfTwo = false;
|
ARBTextureNonPowerOfTwo = false;
|
||||||
ARBMultisample = false;
|
ARBMultisample = false;
|
||||||
|
ARBFragmentShader = false;
|
||||||
NVOcclusionQuery = false;
|
NVOcclusionQuery = false;
|
||||||
|
ARBOcclusionQuery = false;
|
||||||
FrameBufferObject = false;
|
FrameBufferObject = false;
|
||||||
FrameBufferBlit = false;
|
FrameBufferBlit = false;
|
||||||
FrameBufferMultisample = false;
|
FrameBufferMultisample = false;
|
||||||
|
@ -237,6 +243,7 @@ public:
|
||||||
result += EXTSecondaryColor ? "EXTSecondaryColor " : "";
|
result += EXTSecondaryColor ? "EXTSecondaryColor " : "";
|
||||||
result += EXTBlendColor ? "EXTBlendColor " : "";
|
result += EXTBlendColor ? "EXTBlendColor " : "";
|
||||||
result += NVOcclusionQuery ? "NVOcclusionQuery " : "";
|
result += NVOcclusionQuery ? "NVOcclusionQuery " : "";
|
||||||
|
result += ARBOcclusionQuery ? "ARBOcclusionQuery " : "";
|
||||||
result += NVStateVARWithoutFlush ? "NVStateVARWithoutFlush " : "";
|
result += NVStateVARWithoutFlush ? "NVStateVARWithoutFlush " : "";
|
||||||
result += ARBMultisample ? "ARBMultisample " : "";
|
result += ARBMultisample ? "ARBMultisample " : "";
|
||||||
result += NVXGPUMemoryInfo ? "NVXGPUMemoryInfo " : "";
|
result += NVXGPUMemoryInfo ? "NVXGPUMemoryInfo " : "";
|
||||||
|
@ -262,6 +269,7 @@ public:
|
||||||
result += ATIVertexArrayObject ? "ATIVertexArrayObject " : "";
|
result += ATIVertexArrayObject ? "ATIVertexArrayObject " : "";
|
||||||
result += ATIVertexAttribArrayObject ? "ATIVertexAttribArrayObject " : "";
|
result += ATIVertexAttribArrayObject ? "ATIVertexAttribArrayObject " : "";
|
||||||
result += ARBVertexBufferObject ? "ARBVertexBufferObject " : "";
|
result += ARBVertexBufferObject ? "ARBVertexBufferObject " : "";
|
||||||
|
result += ARBMapBufferRange ? "ARBMapBufferRange " : "";
|
||||||
result += ATIMapObjectBuffer ? "ATIMapObjectBuffer " : "";
|
result += ATIMapObjectBuffer ? "ATIMapObjectBuffer " : "";
|
||||||
|
|
||||||
result += "\n FBO: ";
|
result += "\n FBO: ";
|
||||||
|
@ -654,7 +662,10 @@ extern PFNGLUNMAPBUFFERARBPROC nglUnmapBufferARB;
|
||||||
extern PFNGLGETBUFFERPARAMETERIVARBPROC nglGetBufferParameterivARB;
|
extern PFNGLGETBUFFERPARAMETERIVARBPROC nglGetBufferParameterivARB;
|
||||||
extern PFNGLGETBUFFERPOINTERVARBPROC nglGetBufferPointervARB;
|
extern PFNGLGETBUFFERPOINTERVARBPROC nglGetBufferPointervARB;
|
||||||
|
|
||||||
|
// GL_ARB_map_buffer_range
|
||||||
|
//==================================
|
||||||
|
extern PFNGLMAPBUFFERRANGEPROC nglMapBufferRange;
|
||||||
|
extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC nglFlushMappedBufferRange;
|
||||||
|
|
||||||
// GL_ARB_vertex_program
|
// GL_ARB_vertex_program
|
||||||
//==================================
|
//==================================
|
||||||
|
@ -731,7 +742,16 @@ extern PFNGLENDOCCLUSIONQUERYNVPROC nglEndOcclusionQueryNV;
|
||||||
extern PFNGLGETOCCLUSIONQUERYIVNVPROC nglGetOcclusionQueryivNV;
|
extern PFNGLGETOCCLUSIONQUERYIVNVPROC nglGetOcclusionQueryivNV;
|
||||||
extern PFNGLGETOCCLUSIONQUERYUIVNVPROC nglGetOcclusionQueryuivNV;
|
extern PFNGLGETOCCLUSIONQUERYUIVNVPROC nglGetOcclusionQueryuivNV;
|
||||||
|
|
||||||
|
// ARB_occlusion_query
|
||||||
|
//==================================
|
||||||
|
extern PFNGLGENQUERIESPROC nglGenQueriesARB;
|
||||||
|
extern PFNGLDELETEQUERIESPROC nglDeleteQueriesARB;
|
||||||
|
extern PFNGLISQUERYPROC nglIsQueryARB;
|
||||||
|
extern PFNGLBEGINQUERYPROC nglBeginQueryARB;
|
||||||
|
extern PFNGLENDQUERYPROC nglEndQueryARB;
|
||||||
|
extern PFNGLGETQUERYIVPROC nglGetQueryivARB;
|
||||||
|
extern PFNGLGETQUERYOBJECTIVPROC nglGetQueryObjectivARB;
|
||||||
|
extern PFNGLGETQUERYOBJECTUIVPROC nglGetQueryObjectuivARB;
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -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)
|
H_AUTO_OGL(CDriverGL_getTextureHandle)
|
||||||
// If DrvShare not setuped
|
// If DrvShare not setuped
|
||||||
|
|
|
@ -147,9 +147,9 @@ bool CDriverGL::setupVertexBuffer(CVertexBuffer& VB)
|
||||||
CVBDrvInfosGL *info = new CVBDrvInfosGL(this, it, &VB);
|
CVBDrvInfosGL *info = new CVBDrvInfosGL(this, it, &VB);
|
||||||
*it= VB.DrvInfos = info;
|
*it= VB.DrvInfos = info;
|
||||||
|
|
||||||
// Preferred memory
|
// Preferred memory, AGPVolatile only goes through when ARBMapBufferRange is available
|
||||||
CVertexBuffer::TPreferredMemory preferred = VB.getPreferredMemory ();
|
CVertexBuffer::TPreferredMemory preferred = VB.getPreferredMemory ();
|
||||||
if ((preferred == CVertexBuffer::RAMVolatile) || (preferred == CVertexBuffer::AGPVolatile))
|
if ((preferred == CVertexBuffer::RAMVolatile) || (preferred == CVertexBuffer::AGPVolatile && !_Extensions.ARBMapBufferRange))
|
||||||
preferred = CVertexBuffer::RAMPreferred;
|
preferred = CVertexBuffer::RAMPreferred;
|
||||||
const uint size = VB.capacity()*VB.getVertexSize();
|
const uint size = VB.capacity()*VB.getVertexSize();
|
||||||
uint preferredMemory = _Extensions.DisableHardwareVertexArrayAGP ? CVertexBuffer::RAMPreferred : preferred;
|
uint preferredMemory = _Extensions.DisableHardwareVertexArrayAGP ? CVertexBuffer::RAMPreferred : preferred;
|
||||||
|
@ -159,6 +159,12 @@ bool CDriverGL::setupVertexBuffer(CVertexBuffer& VB)
|
||||||
info->_VBHard = createVertexBufferHard(size, VB.capacity(), (CVertexBuffer::TPreferredMemory)preferredMemory, &VB);
|
info->_VBHard = createVertexBufferHard(size, VB.capacity(), (CVertexBuffer::TPreferredMemory)preferredMemory, &VB);
|
||||||
if (info->_VBHard)
|
if (info->_VBHard)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if ((CVertexBuffer::TPreferredMemory)preferredMemory == CVertexBuffer::AGPVolatile)
|
||||||
|
{
|
||||||
|
preferredMemory = CVertexBuffer::RAMPreferred;
|
||||||
|
break;
|
||||||
|
}
|
||||||
preferredMemory--;
|
preferredMemory--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +176,7 @@ bool CDriverGL::setupVertexBuffer(CVertexBuffer& VB)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upload the data
|
// Upload the data
|
||||||
VB.setLocation ((CVertexBuffer::TLocation)preferredMemory);
|
VB.setLocation(preferredMemory == CVertexBuffer::AGPVolatile ? CVertexBuffer::AGPResident : (CVertexBuffer::TLocation)preferredMemory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,7 +746,7 @@ bool CDriverGL::supportVertexBufferHard() const
|
||||||
bool CDriverGL::supportVolatileVertexBuffer() const
|
bool CDriverGL::supportVolatileVertexBuffer() const
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CDriverGL_supportVolatileVertexBuffer)
|
H_AUTO_OGL(CDriverGL_supportVolatileVertexBuffer)
|
||||||
return false;
|
return _Extensions.ARBMapBufferRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -769,6 +775,7 @@ IVertexBufferHardGL *CDriverGL::createVertexBufferHard(uint size, uint numVertic
|
||||||
IVertexArrayRange *vertexArrayRange= NULL;
|
IVertexArrayRange *vertexArrayRange= NULL;
|
||||||
switch(vbType)
|
switch(vbType)
|
||||||
{
|
{
|
||||||
|
case CVertexBuffer::AGPVolatile:
|
||||||
case CVertexBuffer::AGPPreferred:
|
case CVertexBuffer::AGPPreferred:
|
||||||
vertexArrayRange= _AGPVertexArrayRange;
|
vertexArrayRange= _AGPVertexArrayRange;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1174,6 +1174,9 @@ bool CVertexArrayRangeARB::allocate(uint32 size, CVertexBuffer::TPreferredMemory
|
||||||
|
|
||||||
switch(vbType)
|
switch(vbType)
|
||||||
{
|
{
|
||||||
|
case CVertexBuffer::AGPVolatile:
|
||||||
|
glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STREAM_DRAW_ARB);
|
||||||
|
break;
|
||||||
case CVertexBuffer::AGPPreferred:
|
case CVertexBuffer::AGPPreferred:
|
||||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
|
glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
|
||||||
break;
|
break;
|
||||||
|
@ -1221,13 +1224,14 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
|
||||||
|
|
||||||
if (glGetError() != GL_NO_ERROR) return NULL;
|
if (glGetError() != GL_NO_ERROR) return NULL;
|
||||||
_Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID);
|
_Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID);
|
||||||
switch(_VBType)
|
CVertexBuffer::TPreferredMemory preferred = vb->getPreferredMemory();
|
||||||
|
switch (preferred)
|
||||||
{
|
{
|
||||||
case CVertexBuffer::AGPPreferred:
|
case CVertexBuffer::AGPVolatile:
|
||||||
#ifdef USE_OPENGLES
|
#ifdef USE_OPENGLES
|
||||||
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STREAM_DRAW);
|
||||||
#else
|
#else
|
||||||
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
|
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STREAM_DRAW_ARB);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case CVertexBuffer::StaticPreferred:
|
case CVertexBuffer::StaticPreferred:
|
||||||
|
@ -1244,8 +1248,13 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
|
||||||
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
|
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
// case CVertexBuffer::AGPPreferred:
|
||||||
default:
|
default:
|
||||||
nlassert(0);
|
#ifdef USE_OPENGLES
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
|
||||||
|
#else
|
||||||
|
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (glGetError() != GL_NO_ERROR)
|
if (glGetError() != GL_NO_ERROR)
|
||||||
|
@ -1259,7 +1268,7 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
CVertexBufferHardARB *newVbHard= new CVertexBufferHardARB(_Driver, vb);
|
CVertexBufferHardARB *newVbHard= new CVertexBufferHardARB(_Driver, vb);
|
||||||
newVbHard->initGL(vertexBufferID, this, _VBType);
|
newVbHard->initGL(vertexBufferID, this, preferred);
|
||||||
_Driver->_DriverGLStates.forceBindARBVertexBuffer(0);
|
_Driver->_DriverGLStates.forceBindARBVertexBuffer(0);
|
||||||
return newVbHard;
|
return newVbHard;
|
||||||
}
|
}
|
||||||
|
@ -1393,6 +1402,7 @@ void *CVertexBufferHardARB::lock()
|
||||||
H_AUTO_OGL(CVertexBufferHardARB_lock);
|
H_AUTO_OGL(CVertexBufferHardARB_lock);
|
||||||
|
|
||||||
if (_VertexPtr) return _VertexPtr; // already locked
|
if (_VertexPtr) return _VertexPtr; // already locked
|
||||||
|
const uint size = VB->getNumVertices() * VB->getVertexSize();
|
||||||
if (_Invalid)
|
if (_Invalid)
|
||||||
{
|
{
|
||||||
if (VB->getLocation() != CVertexBuffer::NotResident)
|
if (VB->getLocation() != CVertexBuffer::NotResident)
|
||||||
|
@ -1414,15 +1424,14 @@ void *CVertexBufferHardARB::lock()
|
||||||
_Driver->incrementResetCounter();
|
_Driver->incrementResetCounter();
|
||||||
return &_DummyVB[0];
|
return &_DummyVB[0];
|
||||||
}
|
}
|
||||||
const uint size = VB->getNumVertices() * VB->getVertexSize();
|
|
||||||
_Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID);
|
_Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID);
|
||||||
switch(_MemType)
|
switch(_MemType)
|
||||||
{
|
{
|
||||||
case CVertexBuffer::AGPPreferred:
|
case CVertexBuffer::AGPVolatile:
|
||||||
#ifdef USE_OPENGLES
|
#ifdef USE_OPENGLES
|
||||||
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STREAM_DRAW);
|
||||||
#else
|
#else
|
||||||
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
|
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STREAM_DRAW_ARB);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case CVertexBuffer::StaticPreferred:
|
case CVertexBuffer::StaticPreferred:
|
||||||
|
@ -1439,8 +1448,13 @@ void *CVertexBufferHardARB::lock()
|
||||||
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
|
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
// case CVertexBuffer::AGPPreferred:
|
||||||
default:
|
default:
|
||||||
nlassert(0);
|
#ifdef USE_OPENGLES
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
|
||||||
|
#else
|
||||||
|
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (glGetError() != GL_NO_ERROR)
|
if (glGetError() != GL_NO_ERROR)
|
||||||
|
@ -1499,7 +1513,14 @@ void *CVertexBufferHardARB::lock()
|
||||||
_LastBufferSize = size;
|
_LastBufferSize = size;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
_VertexPtr = nglMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
if (_MemType == CVertexBuffer::AGPVolatile)
|
||||||
|
{
|
||||||
|
_VertexPtr = nglMapBufferRange(GL_ARRAY_BUFFER, 0, size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_VertexPtr = nglMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||||
|
}
|
||||||
if (!_VertexPtr)
|
if (!_VertexPtr)
|
||||||
{
|
{
|
||||||
nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||||
|
|
|
@ -296,7 +296,7 @@ bool GlWndProc(CDriverGL *driver, XEvent &e)
|
||||||
#endif // NL_OS_UNIX
|
#endif // NL_OS_UNIX
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
bool CDriverGL::init (uint windowIcon, emptyProc exitFunc)
|
bool CDriverGL::init (uintptr_t windowIcon, emptyProc exitFunc)
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CDriverGL_init)
|
H_AUTO_OGL(CDriverGL_init)
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,9 @@
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <windowsx.h>
|
# include <windowsx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -82,13 +82,13 @@ void UDriver::setMatrixMode2D43()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
UDriver *UDriver::createDriver(uint windowIcon, bool direct3d, emptyProc exitFunc)
|
UDriver *UDriver::createDriver(uintptr_t windowIcon, bool direct3d, emptyProc exitFunc)
|
||||||
{
|
{
|
||||||
return new CDriverUser (windowIcon, direct3d ? CDriverUser::Direct3d:CDriverUser::OpenGl, exitFunc);
|
return new CDriverUser (windowIcon, direct3d ? CDriverUser::Direct3d:CDriverUser::OpenGl, exitFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
UDriver *UDriver::createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc)
|
UDriver *UDriver::createDriver(uintptr_t windowIcon, TDriver driver, emptyProc exitFunc)
|
||||||
{
|
{
|
||||||
return new CDriverUser (windowIcon, (CDriverUser::TDriver)driver, exitFunc);
|
return new CDriverUser (windowIcon, (CDriverUser::TDriver)driver, exitFunc);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ bool CDriverUser::_StaticInit= false;
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
CDriverUser::CDriverUser (uint windowIcon, TDriver driver, emptyProc exitFunc)
|
CDriverUser::CDriverUser (uintptr_t windowIcon, TDriver driver, emptyProc exitFunc)
|
||||||
{
|
{
|
||||||
// The enum of IDriver and UDriver MUST be the same!!!
|
// The enum of IDriver and UDriver MUST be the same!!!
|
||||||
nlassert((uint)IDriver::idCount == (uint)UDriver::idCount);
|
nlassert((uint)IDriver::idCount == (uint)UDriver::idCount);
|
||||||
|
|
|
@ -35,7 +35,9 @@
|
||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#else // NL_OS_WINDOWS
|
#else // NL_OS_WINDOWS
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
|
@ -253,6 +255,7 @@ void CDRU::drawBitmap (float x, float y, float width, float height, ITexture& te
|
||||||
if (vb.getName().empty()) vb.setName("CDRU::drawBitmap");
|
if (vb.getName().empty()) vb.setName("CDRU::drawBitmap");
|
||||||
vb.setVertexFormat (CVertexBuffer::PositionFlag|CVertexBuffer::TexCoord0Flag);
|
vb.setVertexFormat (CVertexBuffer::PositionFlag|CVertexBuffer::TexCoord0Flag);
|
||||||
vb.setNumVertices (4);
|
vb.setNumVertices (4);
|
||||||
|
vb.setPreferredMemory (CVertexBuffer::RAMVolatile, false);
|
||||||
{
|
{
|
||||||
CVertexBufferReadWrite vba;
|
CVertexBufferReadWrite vba;
|
||||||
vb.lock (vba);
|
vb.lock (vba);
|
||||||
|
@ -271,6 +274,7 @@ void CDRU::drawBitmap (float x, float y, float width, float height, ITexture& te
|
||||||
if (pb.getName().empty()) NL_SET_IB_NAME(pb, "CDRU::drawBitmap");
|
if (pb.getName().empty()) NL_SET_IB_NAME(pb, "CDRU::drawBitmap");
|
||||||
pb.setFormat(NL_DEFAULT_INDEX_BUFFER_FORMAT);
|
pb.setFormat(NL_DEFAULT_INDEX_BUFFER_FORMAT);
|
||||||
pb.setNumIndexes (6);
|
pb.setNumIndexes (6);
|
||||||
|
pb.setPreferredMemory (CIndexBuffer::RAMVolatile, false);
|
||||||
{
|
{
|
||||||
CIndexBufferReadWrite iba;
|
CIndexBufferReadWrite iba;
|
||||||
pb.lock (iba);
|
pb.lock (iba);
|
||||||
|
@ -305,6 +309,7 @@ void CDRU::drawLine (float x0, float y0, float x1, float y1, IDriver& driver, CR
|
||||||
if (vb.getName().empty()) vb.setName("CDRU::drawLine");
|
if (vb.getName().empty()) vb.setName("CDRU::drawLine");
|
||||||
vb.setVertexFormat (CVertexBuffer::PositionFlag);
|
vb.setVertexFormat (CVertexBuffer::PositionFlag);
|
||||||
vb.setNumVertices (2);
|
vb.setNumVertices (2);
|
||||||
|
vb.setPreferredMemory (CVertexBuffer::RAMVolatile, false);
|
||||||
{
|
{
|
||||||
CVertexBufferReadWrite vba;
|
CVertexBufferReadWrite vba;
|
||||||
vb.lock (vba);
|
vb.lock (vba);
|
||||||
|
@ -317,6 +322,7 @@ void CDRU::drawLine (float x0, float y0, float x1, float y1, IDriver& driver, CR
|
||||||
if (pb.getName().empty()) NL_SET_IB_NAME(pb, "CDRU::drawLine");
|
if (pb.getName().empty()) NL_SET_IB_NAME(pb, "CDRU::drawLine");
|
||||||
pb.setFormat(NL_DEFAULT_INDEX_BUFFER_FORMAT);
|
pb.setFormat(NL_DEFAULT_INDEX_BUFFER_FORMAT);
|
||||||
pb.setNumIndexes (2);
|
pb.setNumIndexes (2);
|
||||||
|
pb.setPreferredMemory (CIndexBuffer::RAMVolatile, false);
|
||||||
{
|
{
|
||||||
CIndexBufferReadWrite iba;
|
CIndexBufferReadWrite iba;
|
||||||
pb.lock (iba);
|
pb.lock (iba);
|
||||||
|
@ -350,6 +356,7 @@ void CDRU::drawTriangle (float x0, float y0, float x1, float y1, float x2, float
|
||||||
if (vb.getName().empty()) vb.setName("CDRU::drawTriangle");
|
if (vb.getName().empty()) vb.setName("CDRU::drawTriangle");
|
||||||
vb.setVertexFormat (CVertexBuffer::PositionFlag);
|
vb.setVertexFormat (CVertexBuffer::PositionFlag);
|
||||||
vb.setNumVertices (3);
|
vb.setNumVertices (3);
|
||||||
|
vb.setPreferredMemory (CVertexBuffer::RAMVolatile, false);
|
||||||
{
|
{
|
||||||
CVertexBufferReadWrite vba;
|
CVertexBufferReadWrite vba;
|
||||||
vb.lock (vba);
|
vb.lock (vba);
|
||||||
|
@ -363,6 +370,7 @@ void CDRU::drawTriangle (float x0, float y0, float x1, float y1, float x2, float
|
||||||
if (pb.getName().empty()) NL_SET_IB_NAME(pb, "CDRU::drawTriangle");
|
if (pb.getName().empty()) NL_SET_IB_NAME(pb, "CDRU::drawTriangle");
|
||||||
pb.setFormat(NL_DEFAULT_INDEX_BUFFER_FORMAT);
|
pb.setFormat(NL_DEFAULT_INDEX_BUFFER_FORMAT);
|
||||||
pb.setNumIndexes (3);
|
pb.setNumIndexes (3);
|
||||||
|
pb.setPreferredMemory (CIndexBuffer::RAMVolatile, false);
|
||||||
{
|
{
|
||||||
CIndexBufferReadWrite iba;
|
CIndexBufferReadWrite iba;
|
||||||
pb.lock (iba);
|
pb.lock (iba);
|
||||||
|
@ -397,6 +405,7 @@ void CDRU::drawQuad (float x0, float y0, float x1, float y1, IDriver& driver, CR
|
||||||
if (vb.getName().empty()) vb.setName("CDRU::drawQuad");
|
if (vb.getName().empty()) vb.setName("CDRU::drawQuad");
|
||||||
vb.setVertexFormat (CVertexBuffer::PositionFlag);
|
vb.setVertexFormat (CVertexBuffer::PositionFlag);
|
||||||
vb.setNumVertices (4);
|
vb.setNumVertices (4);
|
||||||
|
vb.setPreferredMemory (CVertexBuffer::RAMVolatile, false);
|
||||||
{
|
{
|
||||||
CVertexBufferReadWrite vba;
|
CVertexBufferReadWrite vba;
|
||||||
vb.lock (vba);
|
vb.lock (vba);
|
||||||
|
@ -433,6 +442,7 @@ void CDRU::drawQuad (float xcenter, float ycenter, float radius, IDriver& driver
|
||||||
if (vb.getName().empty()) vb.setName("CDRU::drawQuad");
|
if (vb.getName().empty()) vb.setName("CDRU::drawQuad");
|
||||||
vb.setVertexFormat (CVertexBuffer::PositionFlag);
|
vb.setVertexFormat (CVertexBuffer::PositionFlag);
|
||||||
vb.setNumVertices (4);
|
vb.setNumVertices (4);
|
||||||
|
vb.setPreferredMemory (CVertexBuffer::RAMVolatile, false);
|
||||||
{
|
{
|
||||||
CVertexBufferReadWrite vba;
|
CVertexBufferReadWrite vba;
|
||||||
vb.lock (vba);
|
vb.lock (vba);
|
||||||
|
@ -482,10 +492,12 @@ void CDRU::drawTrianglesUnlit(const NLMISC::CTriangleUV *trilist, sint ntris,
|
||||||
if (vb.getName().empty()) vb.setName("CDRU::drawTrianglesUnlit");
|
if (vb.getName().empty()) vb.setName("CDRU::drawTrianglesUnlit");
|
||||||
vb.setVertexFormat (CVertexBuffer::PositionFlag | CVertexBuffer::TexCoord0Flag);
|
vb.setVertexFormat (CVertexBuffer::PositionFlag | CVertexBuffer::TexCoord0Flag);
|
||||||
vb.setNumVertices (ntris*3);
|
vb.setNumVertices (ntris*3);
|
||||||
|
vb.setPreferredMemory (CVertexBuffer::RAMVolatile, false);
|
||||||
|
|
||||||
static CIndexBuffer pb;
|
static CIndexBuffer pb;
|
||||||
pb.setFormat(NL_DEFAULT_INDEX_BUFFER_FORMAT);
|
pb.setFormat(NL_DEFAULT_INDEX_BUFFER_FORMAT);
|
||||||
pb.setNumIndexes(ntris*3);
|
pb.setNumIndexes(ntris*3);
|
||||||
|
pb.setPreferredMemory (CIndexBuffer::RAMVolatile, false);
|
||||||
if (pb.getFormat() == CIndexBuffer::Indices16)
|
if (pb.getFormat() == CIndexBuffer::Indices16)
|
||||||
{
|
{
|
||||||
nlassert(ntris * 3 <= 0xffff);
|
nlassert(ntris * 3 <= 0xffff);
|
||||||
|
@ -530,10 +542,12 @@ void CDRU::drawLinesUnlit(const NLMISC::CLine *linelist, sint nlines, CMateria
|
||||||
if (vb.getName().empty()) vb.setName("CDRU::drawLinesUnlit");
|
if (vb.getName().empty()) vb.setName("CDRU::drawLinesUnlit");
|
||||||
vb.setVertexFormat (CVertexBuffer::PositionFlag);
|
vb.setVertexFormat (CVertexBuffer::PositionFlag);
|
||||||
vb.setNumVertices (nlines*2);
|
vb.setNumVertices (nlines*2);
|
||||||
|
vb.setPreferredMemory (CVertexBuffer::RAMVolatile, false);
|
||||||
|
|
||||||
static CIndexBuffer pb;
|
static CIndexBuffer pb;
|
||||||
pb.setFormat(NL_DEFAULT_INDEX_BUFFER_FORMAT);
|
pb.setFormat(NL_DEFAULT_INDEX_BUFFER_FORMAT);
|
||||||
pb.setNumIndexes(nlines*2);
|
pb.setNumIndexes(nlines*2);
|
||||||
|
pb.setPreferredMemory (CIndexBuffer::RAMVolatile, false);
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -601,6 +615,7 @@ void CDRU::drawQuad (float x0, float y0, float x1, float y1, CRGBA col0, CRGBA
|
||||||
if (vb.getName().empty()) vb.setName("CDRU::drawQuad");
|
if (vb.getName().empty()) vb.setName("CDRU::drawQuad");
|
||||||
vb.setVertexFormat (CVertexBuffer::PositionFlag|CVertexBuffer::PrimaryColorFlag);
|
vb.setVertexFormat (CVertexBuffer::PositionFlag|CVertexBuffer::PrimaryColorFlag);
|
||||||
vb.setNumVertices (4);
|
vb.setNumVertices (4);
|
||||||
|
vb.setPreferredMemory (CVertexBuffer::RAMVolatile, false);
|
||||||
{
|
{
|
||||||
CVertexBufferReadWrite vba;
|
CVertexBufferReadWrite vba;
|
||||||
vb.lock (vba);
|
vb.lock (vba);
|
||||||
|
|
|
@ -109,7 +109,7 @@ CRGBA CFastHLSModifier::convert(uint H, uint L, uint S)
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 71
|
#if defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 71)
|
||||||
# pragma warning( push )
|
# pragma warning( push )
|
||||||
# pragma warning( disable : 4799 )
|
# pragma warning( disable : 4799 )
|
||||||
#endif
|
#endif
|
||||||
|
@ -124,7 +124,6 @@ uint16 CFastHLSModifier::applyHLSMod(uint16 colorIn, uint8 dHue, uint dLum, uin
|
||||||
static uint64 mmBlank = 0;
|
static uint64 mmBlank = 0;
|
||||||
static uint64 mmOne = INT64_CONSTANT(0x00FF00FF00FF00FF);
|
static uint64 mmOne = INT64_CONSTANT(0x00FF00FF00FF00FF);
|
||||||
static uint64 mmGray = INT64_CONSTANT(0x0080008000800080);
|
static uint64 mmGray = INT64_CONSTANT(0x0080008000800080);
|
||||||
static uint64 mmInterpBufer[4]= {0,0,0,INT64_CONSTANT(0x00FF00FF00FF00FF)};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
dLum is actually 0xFFFFFF00 + realDLum
|
dLum is actually 0xFFFFFF00 + realDLum
|
||||||
|
@ -136,6 +135,8 @@ uint16 CFastHLSModifier::applyHLSMod(uint16 colorIn, uint8 dHue, uint dLum, uin
|
||||||
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
|
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
|
||||||
if(CSystemInfo::hasMMX())
|
if(CSystemInfo::hasMMX())
|
||||||
{
|
{
|
||||||
|
static uint64 mmInterpBufer[4]= {0,0,0,INT64_CONSTANT(0x00FF00FF00FF00FF)};
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov edi, offset mmInterpBufer
|
mov edi, offset mmInterpBufer
|
||||||
|
@ -262,7 +263,7 @@ uint16 CFastHLSModifier::applyHLSMod(uint16 colorIn, uint8 dHue, uint dLum, uin
|
||||||
#pragma managed(pop)
|
#pragma managed(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 71
|
#if defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 71)
|
||||||
# pragma warning( pop )
|
# pragma warning( pop )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,7 @@ void CFlareModel::traverseRender()
|
||||||
float depthRangeNear, depthRangeFar;
|
float depthRangeNear, depthRangeFar;
|
||||||
drv->getDepthRange(depthRangeNear, depthRangeFar);
|
drv->getDepthRange(depthRangeNear, depthRangeFar);
|
||||||
z = (depthRangeFar - depthRangeNear) * z + depthRangeNear;
|
z = (depthRangeFar - depthRangeNear) * z + depthRangeNear;
|
||||||
if (!v.size() || z > v[0]) // test against z-buffer
|
if (v.empty() || z > v[0]) // test against z-buffer
|
||||||
{
|
{
|
||||||
visibilityRatio = 0.f;
|
visibilityRatio = 0.f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,7 +354,7 @@ void CLodCharacterShape::buildMesh(const std::string &name, const CLodCharacte
|
||||||
const vector<CVector> &normals= lodBuild.Normals;
|
const vector<CVector> &normals= lodBuild.Normals;
|
||||||
|
|
||||||
nlassert(numVertices>0);
|
nlassert(numVertices>0);
|
||||||
nlassert(triangleIndices.size()>0);
|
nlassert(!triangleIndices.empty());
|
||||||
nlassert((triangleIndices.size()%3)==0);
|
nlassert((triangleIndices.size()%3)==0);
|
||||||
nlassert(skinWeights.size() == numVertices);
|
nlassert(skinWeights.size() == numVertices);
|
||||||
nlassert(uvs.size() == numVertices);
|
nlassert(uvs.size() == numVertices);
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
|
|
||||||
#include "std3d.h"
|
#include "std3d.h"
|
||||||
|
|
||||||
|
#ifdef NL_HAS_SSE2
|
||||||
|
# include <xmmintrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "nel/misc/bsphere.h"
|
#include "nel/misc/bsphere.h"
|
||||||
#include "nel/misc/fast_mem.h"
|
#include "nel/misc/fast_mem.h"
|
||||||
#include "nel/misc/system_info.h"
|
#include "nel/misc/system_info.h"
|
||||||
|
@ -39,124 +43,6 @@ namespace NL3D
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
// ***************************************************************************
|
|
||||||
// CMatrix3x4SSE array correctly aligned
|
|
||||||
// ***************************************************************************
|
|
||||||
// ***************************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
#define NL3D_SSE_ALIGNEMENT 16
|
|
||||||
/**
|
|
||||||
* A CMatrix3x4SSE array correctly aligned
|
|
||||||
* NB: SSE is no more used (no speed gain, some memory problem), but keep it for possible future usage.
|
|
||||||
*/
|
|
||||||
class CMatrix3x4SSEArray
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
void *_AllocData;
|
|
||||||
void *_Data;
|
|
||||||
uint _Size;
|
|
||||||
uint _Capacity;
|
|
||||||
|
|
||||||
public:
|
|
||||||
CMatrix3x4SSEArray()
|
|
||||||
{
|
|
||||||
_AllocData= NULL;
|
|
||||||
_Data= NULL;
|
|
||||||
_Size= 0;
|
|
||||||
_Capacity= 0;
|
|
||||||
}
|
|
||||||
~CMatrix3x4SSEArray()
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
CMatrix3x4SSEArray(const CMatrix3x4SSEArray &other)
|
|
||||||
{
|
|
||||||
_AllocData= NULL;
|
|
||||||
_Data= NULL;
|
|
||||||
_Size= 0;
|
|
||||||
_Capacity= 0;
|
|
||||||
*this= other;
|
|
||||||
}
|
|
||||||
CMatrix3x4SSEArray &operator=(const CMatrix3x4SSEArray &other)
|
|
||||||
{
|
|
||||||
if( this == &other)
|
|
||||||
return *this;
|
|
||||||
resize(other.size());
|
|
||||||
// copy data from aligned pointers to aligned pointers.
|
|
||||||
memcpy(_Data, other._Data, size() * sizeof(CMatrix3x4SSE) );
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CMatrix3x4SSE *getPtr()
|
|
||||||
{
|
|
||||||
return (CMatrix3x4SSE*)_Data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void clear()
|
|
||||||
{
|
|
||||||
delete [] ((uint8 *)_AllocData);
|
|
||||||
_AllocData= NULL;
|
|
||||||
_Data= NULL;
|
|
||||||
_Size= 0;
|
|
||||||
_Capacity= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void resize(uint n)
|
|
||||||
{
|
|
||||||
// reserve ??
|
|
||||||
if(n>_Capacity)
|
|
||||||
reserve( max(2*_Capacity, n));
|
|
||||||
_Size= n;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reserve(uint n)
|
|
||||||
{
|
|
||||||
if(n==0)
|
|
||||||
clear();
|
|
||||||
else if(n>_Capacity)
|
|
||||||
{
|
|
||||||
// Alloc new data.
|
|
||||||
void *newAllocData;
|
|
||||||
void *newData;
|
|
||||||
|
|
||||||
// Alloc for alignement.
|
|
||||||
newAllocData= new uint8 [n * sizeof(CMatrix3x4SSE) + NL3D_SSE_ALIGNEMENT-1];
|
|
||||||
if(newAllocData==NULL)
|
|
||||||
throw Exception("SSE Allocation Failed");
|
|
||||||
|
|
||||||
// Align ptr
|
|
||||||
newData= (void*) ( ((ptrdiff_t)newAllocData+NL3D_SSE_ALIGNEMENT-1) & (~(NL3D_SSE_ALIGNEMENT-1)) );
|
|
||||||
|
|
||||||
// copy valid data from old to new.
|
|
||||||
memcpy(newData, _Data, size() * sizeof(CMatrix3x4SSE) );
|
|
||||||
|
|
||||||
// release old.
|
|
||||||
if(_AllocData)
|
|
||||||
delete [] ((uint8*)_AllocData);
|
|
||||||
|
|
||||||
// change ptrs and capacity.
|
|
||||||
_Data= newData;
|
|
||||||
_AllocData= newAllocData;
|
|
||||||
_Capacity= n;
|
|
||||||
|
|
||||||
// TestYoyo
|
|
||||||
//nlwarning("YOYO Tst SSE P4: %X, %d", _Data, n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint size() const {return _Size;}
|
|
||||||
|
|
||||||
|
|
||||||
CMatrix3x4SSE &operator[](uint i) {return ((CMatrix3x4SSE*)_Data)[i];}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
|
@ -39,7 +39,23 @@ static void applyArraySkinNormalT(uint numMatrixes, uint32 *infPtr, CMesh::CSkin
|
||||||
{
|
{
|
||||||
/* Prefetch all vertex/normal before, it is to be faster.
|
/* Prefetch all vertex/normal before, it is to be faster.
|
||||||
*/
|
*/
|
||||||
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
|
#ifdef NL_HAS_SSE2
|
||||||
|
{
|
||||||
|
uint nInfTmp= nInf;
|
||||||
|
uint32 *infTmpPtr= infPtr;
|
||||||
|
for(;nInfTmp>0;nInfTmp--, infTmpPtr++)
|
||||||
|
{
|
||||||
|
uint index= *infTmpPtr;
|
||||||
|
CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
|
||||||
|
CVector *srcVertex= srcVertexPtr + index;
|
||||||
|
CVector *srcNormal= srcNormalPtr + index;
|
||||||
|
|
||||||
|
_mm_prefetch((const char *)(void *)srcSkin, _MM_HINT_T1);
|
||||||
|
_mm_prefetch((const char *)(void *)srcVertex, _MM_HINT_T1);
|
||||||
|
_mm_prefetch((const char *)(void *)srcNormal, _MM_HINT_T1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#elif defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
|
||||||
{
|
{
|
||||||
uint nInfTmp= nInf;
|
uint nInfTmp= nInf;
|
||||||
uint32 *infTmpPtr= infPtr;
|
uint32 *infTmpPtr= infPtr;
|
||||||
|
@ -176,7 +192,25 @@ static void applyArraySkinTangentSpaceT(uint numMatrixes, uint32 *infPtr, CMesh:
|
||||||
{
|
{
|
||||||
/* Prefetch all vertex/normal/tgSpace before, it is faster.
|
/* Prefetch all vertex/normal/tgSpace before, it is faster.
|
||||||
*/
|
*/
|
||||||
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
|
#ifdef NL_HAS_SSE2
|
||||||
|
{
|
||||||
|
uint nInfTmp= nInf;
|
||||||
|
uint32 *infTmpPtr= infPtr;
|
||||||
|
for(;nInfTmp>0;nInfTmp--, infTmpPtr++)
|
||||||
|
{
|
||||||
|
uint index= *infTmpPtr;
|
||||||
|
CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
|
||||||
|
CVector *srcVertex= srcVertexPtr + index;
|
||||||
|
CVector *srcNormal= srcNormalPtr + index;
|
||||||
|
CVector *srcTgSpace= tgSpacePtr + index;
|
||||||
|
|
||||||
|
_mm_prefetch((const char *)(void *)srcSkin, _MM_HINT_T1);
|
||||||
|
_mm_prefetch((const char *)(void *)srcVertex, _MM_HINT_T1);
|
||||||
|
_mm_prefetch((const char *)(void *)srcNormal, _MM_HINT_T1);
|
||||||
|
_mm_prefetch((const char *)(void *)srcTgSpace, _MM_HINT_T1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#elif defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
|
||||||
{
|
{
|
||||||
uint nInfTmp= nInf;
|
uint nInfTmp= nInf;
|
||||||
uint32 *infTmpPtr= infPtr;
|
uint32 *infTmpPtr= infPtr;
|
||||||
|
|
|
@ -2247,123 +2247,6 @@ void CMeshMRMSkinnedGeom::getSkinWeights (std::vector<CMesh::CSkinWeight> &skinW
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
// ***************************************************************************
|
|
||||||
// CMatrix3x4SSE array correctly aligned
|
|
||||||
// ***************************************************************************
|
|
||||||
// ***************************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
|
||||||
#define NL3D_SSE_ALIGNEMENT 16
|
|
||||||
/**
|
|
||||||
* A CMatrix3x4SSEArray array correctly aligned
|
|
||||||
* NB: SSE is no more used (no speed gain, some memory problem), but keep it for possible future usage.
|
|
||||||
*/
|
|
||||||
class CMatrix3x4SSEArray
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
void *_AllocData;
|
|
||||||
void *_Data;
|
|
||||||
uint _Size;
|
|
||||||
uint _Capacity;
|
|
||||||
|
|
||||||
public:
|
|
||||||
CMatrix3x4SSEArray()
|
|
||||||
{
|
|
||||||
_AllocData= NULL;
|
|
||||||
_Data= NULL;
|
|
||||||
_Size= 0;
|
|
||||||
_Capacity= 0;
|
|
||||||
}
|
|
||||||
~CMatrix3x4SSEArray()
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
CMatrix3x4SSEArray(const CMatrix3x4SSEArray &other)
|
|
||||||
{
|
|
||||||
_AllocData= NULL;
|
|
||||||
_Data= NULL;
|
|
||||||
_Size= 0;
|
|
||||||
_Capacity= 0;
|
|
||||||
*this= other;
|
|
||||||
}
|
|
||||||
CMatrix3x4SSEArray &operator=(const CMatrix3x4SSEArray &other)
|
|
||||||
{
|
|
||||||
if( this == &other)
|
|
||||||
return *this;
|
|
||||||
resize(other.size());
|
|
||||||
// copy data from aligned pointers to aligned pointers.
|
|
||||||
memcpy(_Data, other._Data, size() * sizeof(CMatrix3x4SSE) );
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CMatrix3x4SSE *getPtr()
|
|
||||||
{
|
|
||||||
return (CMatrix3x4SSE*)_Data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void clear()
|
|
||||||
{
|
|
||||||
delete [] ((uint8 *) _AllocData);
|
|
||||||
_AllocData= NULL;
|
|
||||||
_Data= NULL;
|
|
||||||
_Size= 0;
|
|
||||||
_Capacity= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void resize(uint n)
|
|
||||||
{
|
|
||||||
// reserve ??
|
|
||||||
if(n>_Capacity)
|
|
||||||
reserve( max(2*_Capacity, n));
|
|
||||||
_Size= n;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reserve(uint n)
|
|
||||||
{
|
|
||||||
if(n==0)
|
|
||||||
clear();
|
|
||||||
else if(n>_Capacity)
|
|
||||||
{
|
|
||||||
// Alloc new data.
|
|
||||||
void *newAllocData;
|
|
||||||
void *newData;
|
|
||||||
|
|
||||||
// Alloc for alignement.
|
|
||||||
newAllocData= new uint8 [n * sizeof(CMatrix3x4SSE) + NL3D_SSE_ALIGNEMENT-1];
|
|
||||||
if(newAllocData==NULL)
|
|
||||||
throw Exception("SSE Allocation Failed");
|
|
||||||
|
|
||||||
// Align ptr
|
|
||||||
newData= (void*) ( ((ptrdiff_t)newAllocData+NL3D_SSE_ALIGNEMENT-1) & (~(NL3D_SSE_ALIGNEMENT-1)) );
|
|
||||||
|
|
||||||
// copy valid data from old to new.
|
|
||||||
memcpy(newData, _Data, size() * sizeof(CMatrix3x4SSE) );
|
|
||||||
|
|
||||||
// release old.
|
|
||||||
if(_AllocData)
|
|
||||||
delete [] ((uint8*)_AllocData);
|
|
||||||
|
|
||||||
// change ptrs and capacity.
|
|
||||||
_Data= newData;
|
|
||||||
_AllocData= newAllocData;
|
|
||||||
_Capacity= n;
|
|
||||||
|
|
||||||
// TestYoyo
|
|
||||||
//nlwarning("YOYO Tst SSE P4: %X, %d", _Data, n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint size() const {return _Size;}
|
|
||||||
|
|
||||||
|
|
||||||
CMatrix3x4SSE &operator[](uint i) {return ((CMatrix3x4SSE*)_Data)[i];}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
|
@ -37,7 +37,9 @@
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <winbase.h>
|
# include <winbase.h>
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
|
@ -647,8 +647,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
if(!parseLUAScript(root))
|
if(!parseLUAScript(root))
|
||||||
{
|
{
|
||||||
nlwarning ("could not parse 'lua'");
|
nlerror ("could not parse 'lua'");
|
||||||
exit( EXIT_FAILURE );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -362,7 +362,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
nlassert(key);
|
nlassert(key);
|
||||||
nlassert(isValid());
|
nlassert(isValid());
|
||||||
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a function value '%p' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename()));
|
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a function value '%p' at key %s on object '%s' of type %s (not a table).", (void *)value, key, getId().c_str(), getTypename()));
|
||||||
CLuaStackChecker lsc(_LuaState);
|
CLuaStackChecker lsc(_LuaState);
|
||||||
push();
|
push();
|
||||||
_LuaState->push(key);
|
_LuaState->push(key);
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
#include "nel/misc/hierarchical_timer.h"
|
#include "nel/misc/hierarchical_timer.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
#define NOMINMAX
|
#ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace NLGUI
|
||||||
CViewBase( param ),
|
CViewBase( param ),
|
||||||
_Buttons( NLMISC::noButton )
|
_Buttons( NLMISC::noButton )
|
||||||
{
|
{
|
||||||
_PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = 0;
|
_PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = InvalidCoord;
|
||||||
_PointerDown = false;
|
_PointerDown = false;
|
||||||
_PointerVisible = true;
|
_PointerVisible = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,8 @@
|
||||||
#include "nel/misc/file.h"
|
#include "nel/misc/file.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
#define NOMINMAX
|
#ifndef NL_COMP_MINGW
|
||||||
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
#include "nel/misc/o_xml.h"
|
#include "nel/misc/o_xml.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
#ifndef NL_COMP_MINGW
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ ENDIF(WITH_STATIC OR WIN32)
|
||||||
# For DirectInput (di_event_emitter)
|
# For DirectInput (di_event_emitter)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
|
||||||
TARGET_LINK_LIBRARIES(nelmisc ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
|
TARGET_LINK_LIBRARIES(nelmisc ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY} winmm dbghelp)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
|
@ -39,7 +39,7 @@ ENDIF(UNIX)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${PNG_INCLUDE_DIR} config_file)
|
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${PNG_INCLUDE_DIR} config_file)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(nelmisc ${CMAKE_THREAD_LIBS_INIT} ${LIBXML2_LIBRARIES})
|
TARGET_LINK_LIBRARIES(nelmisc ${CMAKE_THREAD_LIBS_INIT} ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARY})
|
||||||
SET_TARGET_PROPERTIES(nelmisc PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
SET_TARGET_PROPERTIES(nelmisc PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||||
NL_DEFAULT_PROPS(nelmisc "NeL, Library: NeL Misc")
|
NL_DEFAULT_PROPS(nelmisc "NeL, Library: NeL Misc")
|
||||||
NL_ADD_RUNTIME_FLAGS(nelmisc)
|
NL_ADD_RUNTIME_FLAGS(nelmisc)
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
#include <csetjmp>
|
#include <csetjmp>
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
#ifdef NL_COMP_MINGW
|
||||||
|
# define HAVE_BOOLEAN
|
||||||
|
#endif
|
||||||
#include <jpeglib.h>
|
#include <jpeglib.h>
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -53,7 +53,9 @@
|
||||||
# define _WIN32_WINNT 0x0400
|
# define _WIN32_WINNT 0x0400
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#elif defined (NL_OS_UNIX)
|
#elif defined (NL_OS_UNIX)
|
||||||
# define NL_WIN_CALLBACK
|
# define NL_WIN_CALLBACK
|
||||||
|
|
|
@ -20,7 +20,9 @@
|
||||||
#include "nel/misc/common.h"
|
#include "nel/misc/common.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
# include <tchar.h>
|
# include <tchar.h>
|
||||||
|
@ -37,6 +39,7 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#ifndef NL_COMP_MINGW
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# pragma message( " " )
|
# pragma message( " " )
|
||||||
|
|
||||||
|
@ -69,6 +72,36 @@ extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
|
||||||
|
|
||||||
|
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
#endif // !NL_COMP_MINGW
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef NL_HAS_SSE2
|
||||||
|
|
||||||
|
void *operator new(size_t size) throw(std::bad_alloc)
|
||||||
|
{
|
||||||
|
void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT);
|
||||||
|
if (p == NULL) throw std::bad_alloc();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *operator new[](size_t size) throw(std::bad_alloc)
|
||||||
|
{
|
||||||
|
void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT);
|
||||||
|
if (p == NULL) throw std::bad_alloc();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void *p) throw()
|
||||||
|
{
|
||||||
|
aligned_free(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete[](void *p) throw()
|
||||||
|
{
|
||||||
|
aligned_free(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* NL_HAS_SSE2 */
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_NEW
|
#ifdef DEBUG_NEW
|
||||||
|
@ -1040,7 +1073,7 @@ bool openDoc (const char *document)
|
||||||
HINSTANCE result = ShellExecuteA(NULL, "open", document, NULL,NULL, SW_SHOWDEFAULT);
|
HINSTANCE result = ShellExecuteA(NULL, "open", document, NULL,NULL, SW_SHOWDEFAULT);
|
||||||
|
|
||||||
// If it failed, get the .htm regkey and lookup the program
|
// If it failed, get the .htm regkey and lookup the program
|
||||||
if ((UINT)result <= HINSTANCE_ERROR)
|
if ((uintptr_t)result <= HINSTANCE_ERROR)
|
||||||
{
|
{
|
||||||
if (GetRegKey(HKEY_CLASSES_ROOT, ext.c_str(), key) == ERROR_SUCCESS)
|
if (GetRegKey(HKEY_CLASSES_ROOT, ext.c_str(), key) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,8 +34,10 @@
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define _WIN32_WINDOWS 0x0410
|
# define _WIN32_WINDOWS 0x0410
|
||||||
|
# ifndef NL_COMP_MINGW
|
||||||
# define WINVER 0x0400
|
# define WINVER 0x0400
|
||||||
# define NOMINMAX
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
# include <tchar.h>
|
# include <tchar.h>
|
||||||
|
@ -445,7 +447,7 @@ public:
|
||||||
|
|
||||||
EDebug() { _Reason = "Nothing about EDebug"; }
|
EDebug() { _Reason = "Nothing about EDebug"; }
|
||||||
|
|
||||||
~EDebug () { }
|
virtual ~EDebug() throw() {}
|
||||||
|
|
||||||
EDebug(EXCEPTION_POINTERS * pexp) : m_pexp(pexp) { nlassert(pexp != 0); createWhat(); }
|
EDebug(EXCEPTION_POINTERS * pexp) : m_pexp(pexp) { nlassert(pexp != 0); createWhat(); }
|
||||||
EDebug(const EDebug& se) : m_pexp(se.m_pexp) { createWhat(); }
|
EDebug(const EDebug& se) : m_pexp(se.m_pexp) { createWhat(); }
|
||||||
|
@ -755,7 +757,7 @@ public:
|
||||||
|
|
||||||
HANDLE getProcessHandle()
|
HANDLE getProcessHandle()
|
||||||
{
|
{
|
||||||
return CSystemInfo::isNT()?GetCurrentProcess():(HANDLE)GetCurrentProcessId();
|
return CSystemInfo::isNT()?GetCurrentProcess():(HANDLE)(uintptr_t)GetCurrentProcessId();
|
||||||
}
|
}
|
||||||
|
|
||||||
// return true if found
|
// return true if found
|
||||||
|
@ -797,7 +799,7 @@ public:
|
||||||
while (findAndErase(rawType, "classvector<char,class char_traits<char>,class allocator<char> >", "string")) ;
|
while (findAndErase(rawType, "classvector<char,class char_traits<char>,class allocator<char> >", "string")) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
string getFuncInfo (DWORD funcAddr, DWORD stackAddr)
|
string getFuncInfo (uintptr_t funcAddr, uintptr_t stackAddr)
|
||||||
{
|
{
|
||||||
string str ("NoSymbol");
|
string str ("NoSymbol");
|
||||||
|
|
||||||
|
@ -853,7 +855,7 @@ public:
|
||||||
|
|
||||||
if (stop==0 && (parse[i] == ',' || parse[i] == ')'))
|
if (stop==0 && (parse[i] == ',' || parse[i] == ')'))
|
||||||
{
|
{
|
||||||
ULONG *addr = (ULONG*)(stackAddr) + 2 + pos2++;
|
uintptr_t *addr = (uintptr_t*)(stackAddr) + 2 + pos2++;
|
||||||
|
|
||||||
string displayType = type;
|
string displayType = type;
|
||||||
cleanType (type, displayType);
|
cleanType (type, displayType);
|
||||||
|
@ -882,7 +884,7 @@ public:
|
||||||
}
|
}
|
||||||
else if (type == "char*")
|
else if (type == "char*")
|
||||||
{
|
{
|
||||||
if (!IsBadReadPtr(addr,sizeof(char*)) && *addr != NULL)
|
if (!IsBadReadPtr(addr,sizeof(char*)) && *addr != 0)
|
||||||
{
|
{
|
||||||
if (!IsBadStringPtrA((char*)*addr,32))
|
if (!IsBadStringPtrA((char*)*addr,32))
|
||||||
{
|
{
|
||||||
|
@ -920,7 +922,7 @@ public:
|
||||||
{
|
{
|
||||||
if (!IsBadReadPtr(addr,sizeof(string*)))
|
if (!IsBadReadPtr(addr,sizeof(string*)))
|
||||||
{
|
{
|
||||||
if (*addr != NULL)
|
if (*addr != 0)
|
||||||
{
|
{
|
||||||
if (!IsBadReadPtr((void*)*addr,sizeof(string)))
|
if (!IsBadReadPtr((void*)*addr,sizeof(string)))
|
||||||
sprintf (tmp, "\"%s\"", ((string*)*addr)->c_str());
|
sprintf (tmp, "\"%s\"", ((string*)*addr)->c_str());
|
||||||
|
@ -929,9 +931,9 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!IsBadReadPtr(addr,sizeof(ULONG*)))
|
if (!IsBadReadPtr(addr,sizeof(uintptr_t*)))
|
||||||
{
|
{
|
||||||
if(*addr == NULL)
|
if(*addr == 0)
|
||||||
sprintf (tmp, "<NULL>");
|
sprintf (tmp, "<NULL>");
|
||||||
else
|
else
|
||||||
sprintf (tmp, "0x%p", *addr);
|
sprintf (tmp, "0x%p", *addr);
|
||||||
|
@ -956,7 +958,7 @@ public:
|
||||||
if (disp != 0)
|
if (disp != 0)
|
||||||
{
|
{
|
||||||
str += " + ";
|
str += " + ";
|
||||||
str += toString ((uint32)disp);
|
str += toString ((uintptr_t)disp);
|
||||||
str += " bytes";
|
str += " bytes";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1166,7 +1168,8 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog)
|
||||||
initAcquireTimeMap();
|
initAcquireTimeMap();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifndef NL_COMP_MINGW
|
||||||
|
# ifdef NL_OS_WINDOWS
|
||||||
// if (!IsDebuggerPresent ())
|
// if (!IsDebuggerPresent ())
|
||||||
{
|
{
|
||||||
// Use an environment variable to share the value among the EXE and its child DLLs
|
// Use an environment variable to share the value among the EXE and its child DLLs
|
||||||
|
@ -1180,7 +1183,8 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog)
|
||||||
SetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, _T("1") );
|
SetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, _T("1") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // NL_OS_WINDOWS
|
# endif // NL_OS_WINDOWS
|
||||||
|
#endif //!NL_COMP_MINGW
|
||||||
|
|
||||||
INelContext::getInstance().setErrorLog(new CLog (CLog::LOG_ERROR));
|
INelContext::getInstance().setErrorLog(new CLog (CLog::LOG_ERROR));
|
||||||
INelContext::getInstance().setWarningLog(new CLog (CLog::LOG_WARNING));
|
INelContext::getInstance().setWarningLog(new CLog (CLog::LOG_WARNING));
|
||||||
|
|
|
@ -217,7 +217,7 @@ static void BuildCtrlName(LPCDIDEVICEOBJECTINSTANCE lpddoi,
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// A callback to enumerate the controls of a device
|
// A callback to enumerate the controls of a device
|
||||||
static BOOL CALLBACK DIEnumDeviceObjectsCallback
|
BOOL CALLBACK DIEnumDeviceObjectsCallback
|
||||||
(
|
(
|
||||||
LPCDIDEVICEOBJECTINSTANCE lpddoi,
|
LPCDIDEVICEOBJECTINSTANCE lpddoi,
|
||||||
LPVOID pvRef
|
LPVOID pvRef
|
||||||
|
|
|
@ -113,8 +113,8 @@ static const CKeyConv DIToNel[] =
|
||||||
{DIK_CONVERT, KeyCONVERT, "CONVERT", false},
|
{DIK_CONVERT, KeyCONVERT, "CONVERT", false},
|
||||||
{DIK_NOCONVERT, KeyNONCONVERT, "NOCONVERT", true},
|
{DIK_NOCONVERT, KeyNONCONVERT, "NOCONVERT", true},
|
||||||
//
|
//
|
||||||
{DIK_KANA, KeyKANA, false},
|
{DIK_KANA, KeyKANA, "KANA", false},
|
||||||
{DIK_KANJI, KeyKANJI, false},
|
{DIK_KANJI, KeyKANJI, "KANJI", false},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ CDIKeyboard::CDIKeyboard(CWinEventEmitter *we, HWND hwnd)
|
||||||
_RepeatPeriod = (uint) (1000.f / (keybSpeed * (27.5f / 31.f) + 2.5f));
|
_RepeatPeriod = (uint) (1000.f / (keybSpeed * (27.5f / 31.f) + 2.5f));
|
||||||
}
|
}
|
||||||
// get keyboard layout
|
// get keyboard layout
|
||||||
_KBLayout = ::GetKeyboardLayout(NULL);
|
_KBLayout = ::GetKeyboardLayout(0);
|
||||||
|
|
||||||
_RepetitionDisabled.resize(NumKeys);
|
_RepetitionDisabled.resize(NumKeys);
|
||||||
_RepetitionDisabled.clearAll();
|
_RepetitionDisabled.clearAll();
|
||||||
|
|
|
@ -27,6 +27,12 @@
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NL_COMP_MINGW
|
||||||
|
# undef FIELD_OFFSET
|
||||||
|
# define FIELD_OFFSET(t,f) offsetof(t,f)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -78,7 +84,7 @@ void CDIMouse::setMouseMode(TAxis axis, TAxisMode axisMode)
|
||||||
//======================================================
|
//======================================================
|
||||||
CDIMouse::TAxisMode CDIMouse::getMouseMode(TAxis axis) const
|
CDIMouse::TAxisMode CDIMouse::getMouseMode(TAxis axis) const
|
||||||
{
|
{
|
||||||
nlassert(axis < NumMouseAxis);
|
nlassert((int)axis < (int)NumMouseAxis);
|
||||||
return _MouseAxisMode[axis];
|
return _MouseAxisMode[axis];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,10 @@
|
||||||
// these defines is for IsDebuggerPresent(). it'll not compile on windows 95
|
// these defines is for IsDebuggerPresent(). it'll not compile on windows 95
|
||||||
// just comment this and the IsDebuggerPresent to compile on windows 95
|
// just comment this and the IsDebuggerPresent to compile on windows 95
|
||||||
# define _WIN32_WINDOWS 0x0410
|
# define _WIN32_WINDOWS 0x0410
|
||||||
# define WINVER 0x0400
|
# ifndef NL_COMP_MINGW
|
||||||
# define NOMINMAX
|
# define WINVER 0x0400
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#else
|
#else
|
||||||
# define IsDebuggerPresent() false
|
# define IsDebuggerPresent() false
|
||||||
|
|
|
@ -57,7 +57,7 @@ void *nlGetSymbolAddress(NL_LIB_HANDLE libHandle, const std::string &procName)
|
||||||
{
|
{
|
||||||
void *res = 0;
|
void *res = 0;
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
res = GetProcAddress(libHandle, procName.c_str());
|
res = (void *)GetProcAddress(libHandle, procName.c_str());
|
||||||
#elif defined(NL_OS_UNIX)
|
#elif defined(NL_OS_UNIX)
|
||||||
res = dlsym(libHandle, procName.c_str());
|
res = dlsym(libHandle, procName.c_str());
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -33,6 +33,9 @@ CFixedSizeAllocator::CFixedSizeAllocator(uint numBytesPerBlock, uint numBlockPer
|
||||||
_NumChunks = 0;
|
_NumChunks = 0;
|
||||||
nlassert(numBytesPerBlock > 1);
|
nlassert(numBytesPerBlock > 1);
|
||||||
_NumBytesPerBlock = numBytesPerBlock;
|
_NumBytesPerBlock = numBytesPerBlock;
|
||||||
|
const uint mask = NL_DEFAULT_MEMORY_ALIGNMENT - 1;
|
||||||
|
_NumBytesPerBlock = (_NumBytesPerBlock + mask) & ~mask;
|
||||||
|
nlassert(_NumBytesPerBlock >= numBytesPerBlock);
|
||||||
_NumBlockPerChunk = std::max(numBlockPerChunk, (uint) 3);
|
_NumBlockPerChunk = std::max(numBlockPerChunk, (uint) 3);
|
||||||
_NumAlloc = 0;
|
_NumAlloc = 0;
|
||||||
}
|
}
|
||||||
|
@ -67,12 +70,14 @@ void *CFixedSizeAllocator::alloc()
|
||||||
return _FreeSpace->unlink();
|
return _FreeSpace->unlink();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define aligned_offsetof(s, m) ((offsetof(s, m) + (NL_DEFAULT_MEMORY_ALIGNMENT - 1)) & ~(NL_DEFAULT_MEMORY_ALIGNMENT - 1))
|
||||||
|
|
||||||
// *****************************************************************************************************************
|
// *****************************************************************************************************************
|
||||||
void CFixedSizeAllocator::free(void *block)
|
void CFixedSizeAllocator::free(void *block)
|
||||||
{
|
{
|
||||||
if (!block) return;
|
if (!block) return;
|
||||||
/// get the node from the object
|
/// get the node from the object
|
||||||
CNode *node = (CNode *) ((uint8 *) block - offsetof(CNode, Next));
|
CNode *node = (CNode *) ((uint8 *) block - aligned_offsetof(CNode, Next));
|
||||||
//
|
//
|
||||||
nlassert(node->Chunk != NULL);
|
nlassert(node->Chunk != NULL);
|
||||||
nlassert(node->Chunk->Allocator == this);
|
nlassert(node->Chunk->Allocator == this);
|
||||||
|
@ -84,7 +89,9 @@ void CFixedSizeAllocator::free(void *block)
|
||||||
// *****************************************************************************************************************
|
// *****************************************************************************************************************
|
||||||
uint CFixedSizeAllocator::CChunk::getBlockSizeWithOverhead() const
|
uint CFixedSizeAllocator::CChunk::getBlockSizeWithOverhead() const
|
||||||
{
|
{
|
||||||
return std::max((uint)(sizeof(CNode) - offsetof(CNode, Next)),(uint)(Allocator->getNumBytesPerBlock())) + offsetof(CNode, Next);
|
nlctassert((sizeof(CNode) % NL_DEFAULT_MEMORY_ALIGNMENT) == 0);
|
||||||
|
return std::max((uint)(sizeof(CNode) - aligned_offsetof(CNode, Next)),
|
||||||
|
(uint)(Allocator->getNumBytesPerBlock())) + aligned_offsetof(CNode, Next);
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************************************************
|
// *****************************************************************************************************************
|
||||||
|
@ -105,7 +112,7 @@ CFixedSizeAllocator::CChunk::~CChunk()
|
||||||
nlassert(NumFreeObjs == 0);
|
nlassert(NumFreeObjs == 0);
|
||||||
nlassert(Allocator->_NumChunks > 0);
|
nlassert(Allocator->_NumChunks > 0);
|
||||||
-- (Allocator->_NumChunks);
|
-- (Allocator->_NumChunks);
|
||||||
delete[] Mem;
|
aligned_free(Mem); //delete[] Mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************************************************
|
// *****************************************************************************************************************
|
||||||
|
@ -115,7 +122,7 @@ void CFixedSizeAllocator::CChunk::init(CFixedSizeAllocator *alloc)
|
||||||
nlassert(alloc != NULL);
|
nlassert(alloc != NULL);
|
||||||
Allocator = alloc;
|
Allocator = alloc;
|
||||||
//
|
//
|
||||||
Mem = new uint8[getBlockSizeWithOverhead() * alloc->getNumBlockPerChunk()];
|
Mem = (uint8 *)aligned_malloc(getBlockSizeWithOverhead() * alloc->getNumBlockPerChunk(), NL_DEFAULT_MEMORY_ALIGNMENT); // new uint8[getBlockSizeWithOverhead() * alloc->getNumBlockPerChunk()];
|
||||||
//
|
//
|
||||||
getNode(0).Chunk = this;
|
getNode(0).Chunk = this;
|
||||||
getNode(0).Next = &getNode(1);
|
getNode(0).Next = &getNode(1);
|
||||||
|
@ -179,7 +186,7 @@ void *CFixedSizeAllocator::CNode::unlink()
|
||||||
*Prev = Next;
|
*Prev = Next;
|
||||||
nlassert(Chunk->NumFreeObjs > 0);
|
nlassert(Chunk->NumFreeObjs > 0);
|
||||||
Chunk->grab(); // tells the containing chunk that a node has been allocated
|
Chunk->grab(); // tells the containing chunk that a node has been allocated
|
||||||
return (void *) &Next;
|
return (void *)((uintptr_t)(this) + aligned_offsetof(CNode, Next)); //(void *) &Next;
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************************************************
|
// *****************************************************************************************************************
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
#include "nel/misc/log.h"
|
#include "nel/misc/log.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <process.h>
|
# include <process.h>
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -140,6 +140,7 @@ inline void CMatrix::testExpandRot() const
|
||||||
self->Scale33= 1;
|
self->Scale33= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CMatrix::testExpandProj() const
|
inline void CMatrix::testExpandProj() const
|
||||||
{
|
{
|
||||||
if(hasProj())
|
if(hasProj())
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
#include "nel/misc/debug.h"
|
#include "nel/misc/debug.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <imagehlp.h>
|
# include <imagehlp.h>
|
||||||
# pragma comment(lib, "imagehlp.lib")
|
# pragma comment(lib, "imagehlp.lib")
|
||||||
|
@ -148,7 +150,11 @@ static string getSourceInfo (DWORD_TYPE addr)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD_TYPE __stdcall GetModuleBase(HANDLE hProcess, DWORD_TYPE dwReturnAddress)
|
#ifdef NL_OS_WIN64
|
||||||
|
static DWORD64 __stdcall GetModuleBase(HANDLE hProcess, DWORD64 dwReturnAddress)
|
||||||
|
#else
|
||||||
|
static DWORD __stdcall GetModuleBase(HANDLE hProcess, DWORD dwReturnAddress)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
IMAGEHLP_MODULE moduleInfo;
|
IMAGEHLP_MODULE moduleInfo;
|
||||||
|
|
||||||
|
@ -169,9 +175,15 @@ static DWORD_TYPE __stdcall GetModuleBase(HANDLE hProcess, DWORD_TYPE dwReturnAd
|
||||||
|
|
||||||
if (cch && (lstrcmp(szFile, "DBFN")== 0))
|
if (cch && (lstrcmp(szFile, "DBFN")== 0))
|
||||||
{
|
{
|
||||||
if (!SymLoadModule(hProcess,
|
char mn[] = { 'M', 'N', 0x00 };
|
||||||
NULL, "MN",
|
#ifdef NL_OS_WIN64
|
||||||
NULL, (DWORD) memoryBasicInfo.AllocationBase, 0))
|
if (!SymLoadModule64(
|
||||||
|
#else
|
||||||
|
if (!SymLoadModule(
|
||||||
|
#endif
|
||||||
|
hProcess,
|
||||||
|
NULL, mn,
|
||||||
|
NULL, (uintptr_t)memoryBasicInfo.AllocationBase, 0))
|
||||||
{
|
{
|
||||||
// DWORD dwError = GetLastError();
|
// DWORD dwError = GetLastError();
|
||||||
// nlinfo("Error: %d", dwError);
|
// nlinfo("Error: %d", dwError);
|
||||||
|
@ -179,17 +191,23 @@ static DWORD_TYPE __stdcall GetModuleBase(HANDLE hProcess, DWORD_TYPE dwReturnAd
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!SymLoadModule(hProcess,
|
#ifdef NL_OS_WIN64
|
||||||
NULL, ((cch) ? szFile : NULL),
|
if (!SymLoadModule64(
|
||||||
NULL, (DWORD) memoryBasicInfo.AllocationBase, 0))
|
#else
|
||||||
|
if (!SymLoadModule(
|
||||||
|
#endif
|
||||||
|
hProcess,
|
||||||
|
NULL, ((cch) ? szFile : NULL),
|
||||||
|
NULL, (uintptr_t)memoryBasicInfo.AllocationBase, 0))
|
||||||
{
|
{
|
||||||
// DWORD dwError = GetLastError();
|
// DWORD dwError = GetLastError();
|
||||||
// nlinfo("Error: %d", dwError);
|
// nlinfo("Error: %d", dwError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (DWORD) memoryBasicInfo.AllocationBase;
|
return (uintptr_t)memoryBasicInfo.AllocationBase;
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// nlinfo("Error is %d", GetLastError());
|
// nlinfo("Error is %d", GetLastError());
|
||||||
|
@ -250,19 +268,13 @@ static void displayCallStack (CLog *log)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NL_OS_WIN64
|
// FIXME: Implement this for MinGW
|
||||||
WOW64_CONTEXT context;
|
#ifndef NL_COMP_MINGW
|
||||||
#else
|
|
||||||
CONTEXT context;
|
CONTEXT context;
|
||||||
#endif
|
|
||||||
::ZeroMemory (&context, sizeof(context));
|
::ZeroMemory (&context, sizeof(context));
|
||||||
context.ContextFlags = CONTEXT_FULL;
|
context.ContextFlags = CONTEXT_FULL;
|
||||||
|
|
||||||
#ifdef NL_OS_WIN64
|
|
||||||
if (Wow64GetThreadContext (GetCurrentThread(), &context) == FALSE)
|
|
||||||
#else
|
|
||||||
if (GetThreadContext (GetCurrentThread(), &context) == FALSE)
|
if (GetThreadContext (GetCurrentThread(), &context) == FALSE)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
nlwarning ("DISP: GetThreadContext(%p) failed", GetCurrentThread());
|
nlwarning ("DISP: GetThreadContext(%p) failed", GetCurrentThread());
|
||||||
return;
|
return;
|
||||||
|
@ -270,12 +282,20 @@ static void displayCallStack (CLog *log)
|
||||||
|
|
||||||
STACKFRAME callStack;
|
STACKFRAME callStack;
|
||||||
::ZeroMemory (&callStack, sizeof(callStack));
|
::ZeroMemory (&callStack, sizeof(callStack));
|
||||||
callStack.AddrPC.Mode = AddrModeFlat;
|
|
||||||
|
#ifdef NL_OS_WIN64
|
||||||
|
callStack.AddrPC.Offset = context.Rip;
|
||||||
|
callStack.AddrStack.Offset = context.Rsp;
|
||||||
|
callStack.AddrFrame.Offset = context.Rbp;
|
||||||
|
#else
|
||||||
callStack.AddrPC.Offset = context.Eip;
|
callStack.AddrPC.Offset = context.Eip;
|
||||||
callStack.AddrStack.Mode = AddrModeFlat;
|
|
||||||
callStack.AddrStack.Offset = context.Esp;
|
callStack.AddrStack.Offset = context.Esp;
|
||||||
callStack.AddrFrame.Mode = AddrModeFlat;
|
|
||||||
callStack.AddrFrame.Offset = context.Ebp;
|
callStack.AddrFrame.Offset = context.Ebp;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
callStack.AddrPC.Mode = AddrModeFlat;
|
||||||
|
callStack.AddrStack.Mode = AddrModeFlat;
|
||||||
|
callStack.AddrFrame.Mode = AddrModeFlat;
|
||||||
|
|
||||||
for (uint32 i = 0; ; i++)
|
for (uint32 i = 0; ; i++)
|
||||||
{
|
{
|
||||||
|
@ -283,12 +303,13 @@ static void displayCallStack (CLog *log)
|
||||||
|
|
||||||
#ifdef NL_OS_WIN64
|
#ifdef NL_OS_WIN64
|
||||||
MachineType = IMAGE_FILE_MACHINE_AMD64;
|
MachineType = IMAGE_FILE_MACHINE_AMD64;
|
||||||
|
BOOL res = StackWalk64(MachineType, GetCurrentProcess(), GetCurrentThread(), &callStack,
|
||||||
|
NULL, NULL, SymFunctionTableAccess, GetModuleBase, NULL);
|
||||||
#else
|
#else
|
||||||
MachineType = IMAGE_FILE_MACHINE_I386;
|
MachineType = IMAGE_FILE_MACHINE_I386;
|
||||||
#endif
|
BOOL res = StackWalk(MachineType, GetCurrentProcess(), GetCurrentThread(), &callStack,
|
||||||
|
|
||||||
BOOL res = StackWalk (MachineType, GetCurrentProcess(), GetCurrentThread(), &callStack,
|
|
||||||
NULL, NULL, SymFunctionTableAccess, GetModuleBase, NULL);
|
NULL, NULL, SymFunctionTableAccess, GetModuleBase, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* if (res == FALSE)
|
/* if (res == FALSE)
|
||||||
{
|
{
|
||||||
|
@ -309,6 +330,7 @@ static void displayCallStack (CLog *log)
|
||||||
|
|
||||||
log->displayNL (" %s : %s", srcInfo.c_str(), symInfo.c_str());
|
log->displayNL (" %s : %s", srcInfo.c_str(), symInfo.c_str());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // NL_OS_WINDOWS
|
#else // NL_OS_WINDOWS
|
||||||
|
|
|
@ -44,8 +44,10 @@ using namespace std;
|
||||||
// these defines are for IsDebuggerPresent(). It'll not compile on windows 95
|
// these defines are for IsDebuggerPresent(). It'll not compile on windows 95
|
||||||
// just comment this and the IsDebuggerPresent to compile on windows 95
|
// just comment this and the IsDebuggerPresent to compile on windows 95
|
||||||
#define _WIN32_WINDOWS 0x0410
|
#define _WIN32_WINDOWS 0x0410
|
||||||
#define WINVER 0x0400
|
#ifndef NL_COMP_MINGW
|
||||||
#define NOMINMAX
|
# define WINVER 0x0400
|
||||||
|
# define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#ifdef DEBUG_NEW
|
#ifdef DEBUG_NEW
|
||||||
|
|
|
@ -68,21 +68,23 @@ void *CObjectArenaAllocator::alloc(uint size)
|
||||||
if (size >= _MaxAllocSize)
|
if (size >= _MaxAllocSize)
|
||||||
{
|
{
|
||||||
// use standard allocator
|
// use standard allocator
|
||||||
uint8 *block = new uint8[size + sizeof(uint)]; // an additionnal uint is needed to store size of block
|
nlctassert(NL_DEFAULT_MEMORY_ALIGNMENT >= sizeof(uint));
|
||||||
|
uint8 *block = (uint8 *)aligned_malloc(NL_DEFAULT_MEMORY_ALIGNMENT + size, NL_DEFAULT_MEMORY_ALIGNMENT); //new uint8[size + sizeof(uint)]; // an additionnal uint is needed to store size of block
|
||||||
if (!block) return NULL;
|
if (!block) return NULL;
|
||||||
#ifdef NL_DEBUG
|
#ifdef NL_DEBUG
|
||||||
_MemBlockToAllocID[block] = _AllocID;
|
_MemBlockToAllocID[block] = _AllocID;
|
||||||
#endif
|
#endif
|
||||||
*(uint *) block = size;
|
*(uint *) block = size;
|
||||||
return block + sizeof(uint);
|
return block + NL_DEFAULT_MEMORY_ALIGNMENT;
|
||||||
}
|
}
|
||||||
uint entry = ((size + (_Granularity - 1)) / _Granularity) ;
|
uint entry = ((size + (_Granularity - 1)) / _Granularity) ;
|
||||||
nlassert(entry < _ObjectSizeToAllocator.size());
|
nlassert(entry < _ObjectSizeToAllocator.size());
|
||||||
if (!_ObjectSizeToAllocator[entry])
|
if (!_ObjectSizeToAllocator[entry])
|
||||||
{
|
{
|
||||||
_ObjectSizeToAllocator[entry] = new CFixedSizeAllocator(entry * _Granularity + sizeof(uint), _MaxAllocSize / size); // an additionnal uint is needed to store size of block
|
_ObjectSizeToAllocator[entry] = new CFixedSizeAllocator(entry * _Granularity + NL_DEFAULT_MEMORY_ALIGNMENT, _MaxAllocSize / size); // an additionnal uint is needed to store size of block
|
||||||
}
|
}
|
||||||
void *block = _ObjectSizeToAllocator[entry]->alloc();
|
void *block = _ObjectSizeToAllocator[entry]->alloc();
|
||||||
|
nlassert(((uintptr_t)block % NL_DEFAULT_MEMORY_ALIGNMENT) == 0);
|
||||||
#ifdef NL_DEBUG
|
#ifdef NL_DEBUG
|
||||||
if (block)
|
if (block)
|
||||||
{
|
{
|
||||||
|
@ -91,14 +93,14 @@ void *CObjectArenaAllocator::alloc(uint size)
|
||||||
++_AllocID;
|
++_AllocID;
|
||||||
#endif
|
#endif
|
||||||
*(uint *) block = size;
|
*(uint *) block = size;
|
||||||
return (void *) ((uint8 *) block + sizeof(uint));
|
return (void *) ((uint8 *) block + NL_DEFAULT_MEMORY_ALIGNMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************************************************
|
// *****************************************************************************************************************
|
||||||
void CObjectArenaAllocator::free(void *block)
|
void CObjectArenaAllocator::free(void *block)
|
||||||
{
|
{
|
||||||
if (!block) return;
|
if (!block) return;
|
||||||
uint8 *realBlock = (uint8 *) block - sizeof(uint); // a uint is used at start of block to give its size
|
uint8 *realBlock = (uint8 *) block - NL_DEFAULT_MEMORY_ALIGNMENT; // sizeof(uint); // a uint is used at start of block to give its size
|
||||||
uint size = *(uint *) realBlock;
|
uint size = *(uint *) realBlock;
|
||||||
if (size >= _MaxAllocSize)
|
if (size >= _MaxAllocSize)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +109,7 @@ void CObjectArenaAllocator::free(void *block)
|
||||||
nlassert(it != _MemBlockToAllocID.end());
|
nlassert(it != _MemBlockToAllocID.end());
|
||||||
_MemBlockToAllocID.erase(it);
|
_MemBlockToAllocID.erase(it);
|
||||||
#endif
|
#endif
|
||||||
delete realBlock;
|
aligned_free(realBlock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint entry = ((size + (_Granularity - 1)) / _Granularity);
|
uint entry = ((size + (_Granularity - 1)) / _Granularity);
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
#include "nel/misc/xml_pack.h"
|
#include "nel/misc/xml_pack.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
#include "nel/misc/path.h"
|
#include "nel/misc/path.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <windowsx.h>
|
# include <windowsx.h>
|
||||||
# include <winuser.h>
|
# include <winuser.h>
|
||||||
|
@ -157,8 +159,10 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM
|
||||||
// if the dtor call order is not good.
|
// if the dtor call order is not good.
|
||||||
//exit(EXIT_SUCCESS);
|
//exit(EXIT_SUCCESS);
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
#ifndef NL_COMP_MINGW
|
||||||
// disable the Windows popup telling that the application aborted and disable the dr watson report.
|
// disable the Windows popup telling that the application aborted and disable the dr watson report.
|
||||||
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
// quit without calling atexit or static object dtors.
|
// quit without calling atexit or static object dtors.
|
||||||
abort();
|
abort();
|
||||||
|
@ -232,7 +236,7 @@ TReportResult report (const std::string &title, const std::string &header, const
|
||||||
|
|
||||||
// create the edit control
|
// create the edit control
|
||||||
HWND edit = CreateWindowW (L"EDIT", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_LEFT | ES_MULTILINE, 7, 70, 429, 212, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
HWND edit = CreateWindowW (L"EDIT", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_LEFT | ES_MULTILINE, 7, 70, 429, 212, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
||||||
SendMessage (edit, WM_SETFONT, (LONG) font, TRUE);
|
SendMessage (edit, WM_SETFONT, (WPARAM) font, TRUE);
|
||||||
|
|
||||||
// set the edit text limit to lot of :)
|
// set the edit text limit to lot of :)
|
||||||
SendMessage (edit, EM_LIMITTEXT, ~0U, 0);
|
SendMessage (edit, EM_LIMITTEXT, ~0U, 0);
|
||||||
|
@ -246,7 +250,7 @@ TReportResult report (const std::string &title, const std::string &header, const
|
||||||
{
|
{
|
||||||
// create the combo box control
|
// create the combo box control
|
||||||
checkIgnore = CreateWindowW (L"BUTTON", L"Don't display this report again", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_CHECKBOX, 7, 290, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
checkIgnore = CreateWindowW (L"BUTTON", L"Don't display this report again", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_CHECKBOX, 7, 290, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
||||||
SendMessage (checkIgnore, WM_SETFONT, (LONG) font, TRUE);
|
SendMessage (checkIgnore, WM_SETFONT, (WPARAM) font, TRUE);
|
||||||
|
|
||||||
if(ignoreNextTime)
|
if(ignoreNextTime)
|
||||||
{
|
{
|
||||||
|
@ -256,28 +260,28 @@ TReportResult report (const std::string &title, const std::string &header, const
|
||||||
|
|
||||||
// create the debug button control
|
// create the debug button control
|
||||||
debug = CreateWindowW (L"BUTTON", L"Debug", WS_CHILD | WS_VISIBLE, 7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
debug = CreateWindowW (L"BUTTON", L"Debug", WS_CHILD | WS_VISIBLE, 7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
||||||
SendMessage (debug, WM_SETFONT, (LONG) font, TRUE);
|
SendMessage (debug, WM_SETFONT, (WPARAM) font, TRUE);
|
||||||
|
|
||||||
if (debugButton == 0)
|
if (debugButton == 0)
|
||||||
EnableWindow(debug, FALSE);
|
EnableWindow(debug, FALSE);
|
||||||
|
|
||||||
// create the ignore button control
|
// create the ignore button control
|
||||||
ignore = CreateWindowW (L"BUTTON", L"Ignore", WS_CHILD | WS_VISIBLE, 75+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
ignore = CreateWindowW (L"BUTTON", L"Ignore", WS_CHILD | WS_VISIBLE, 75+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
||||||
SendMessage (ignore, WM_SETFONT, (LONG) font, TRUE);
|
SendMessage (ignore, WM_SETFONT, (WPARAM) font, TRUE);
|
||||||
|
|
||||||
if (ignoreButton == 0)
|
if (ignoreButton == 0)
|
||||||
EnableWindow(ignore, FALSE);
|
EnableWindow(ignore, FALSE);
|
||||||
|
|
||||||
// create the quit button control
|
// create the quit button control
|
||||||
quit = CreateWindowW (L"BUTTON", L"Quit", WS_CHILD | WS_VISIBLE, 75+75+7+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
quit = CreateWindowW (L"BUTTON", L"Quit", WS_CHILD | WS_VISIBLE, 75+75+7+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
||||||
SendMessage (quit, WM_SETFONT, (LONG) font, TRUE);
|
SendMessage (quit, WM_SETFONT, (WPARAM) font, TRUE);
|
||||||
|
|
||||||
if (quitButton == 0)
|
if (quitButton == 0)
|
||||||
EnableWindow(quit, FALSE);
|
EnableWindow(quit, FALSE);
|
||||||
|
|
||||||
// create the debug button control
|
// create the debug button control
|
||||||
sendReport = CreateWindowW (L"BUTTON", L"Don't send the report", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 7, 315+32, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
sendReport = CreateWindowW (L"BUTTON", L"Don't send the report", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 7, 315+32, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
||||||
SendMessage (sendReport, WM_SETFONT, (LONG) font, TRUE);
|
SendMessage (sendReport, WM_SETFONT, (WPARAM) font, TRUE);
|
||||||
|
|
||||||
string formatedHeader;
|
string formatedHeader;
|
||||||
if (header.empty())
|
if (header.empty())
|
||||||
|
@ -302,7 +306,7 @@ TReportResult report (const std::string &title, const std::string &header, const
|
||||||
|
|
||||||
// create the label control
|
// create the label control
|
||||||
HWND label = CreateWindowW (L"STATIC", (LPCWSTR)uc.c_str(), WS_CHILD | WS_VISIBLE /*| SS_WHITERECT*/, 7, 7, 429, 51, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
HWND label = CreateWindowW (L"STATIC", (LPCWSTR)uc.c_str(), WS_CHILD | WS_VISIBLE /*| SS_WHITERECT*/, 7, 7, 429, 51, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
|
||||||
SendMessage (label, WM_SETFONT, (LONG) font, TRUE);
|
SendMessage (label, WM_SETFONT, (WPARAM) font, TRUE);
|
||||||
|
|
||||||
|
|
||||||
DebugDefaultBehavior = debugButton==1;
|
DebugDefaultBehavior = debugButton==1;
|
||||||
|
|
|
@ -20,7 +20,9 @@
|
||||||
#include "nel/misc/debug.h"
|
#include "nel/misc/debug.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#else
|
#else
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
|
|
|
@ -43,9 +43,11 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define NOMINMAX
|
# ifndef __MINGW32__
|
||||||
#include <WinSock2.h>
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
# endif
|
||||||
|
# include <WinSock2.h>
|
||||||
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // NL_STDMISC_H
|
#endif // NL_STDMISC_H
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
#include "nel/misc/system_info.h"
|
#include "nel/misc/system_info.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <WinNT.h>
|
# include <WinNT.h>
|
||||||
# include <tchar.h>
|
# include <tchar.h>
|
||||||
|
@ -1484,7 +1486,8 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion)
|
||||||
{
|
{
|
||||||
VS_FIXEDFILEINFO *info;
|
VS_FIXEDFILEINFO *info;
|
||||||
UINT len;
|
UINT len;
|
||||||
if (_VerQueryValue(&buffer[0], "\\", (VOID**)&info, &len))
|
char bslash[] = { '\\', 0x00 };
|
||||||
|
if (_VerQueryValue(&buffer[0], bslash, (VOID**)&info, &len))
|
||||||
{
|
{
|
||||||
driverVersion = (((uint64)info->dwFileVersionMS)<<32)|info->dwFileVersionLS;
|
driverVersion = (((uint64)info->dwFileVersionMS)<<32)|info->dwFileVersionLS;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
#include "nel/misc/system_utils.h"
|
#include "nel/misc/system_utils.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
#define NOMINMAX
|
#ifndef NL_COMP_MINGW
|
||||||
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#ifdef _WIN32_WINNT_WIN7
|
#ifdef _WIN32_WINNT_WIN7
|
||||||
|
@ -222,7 +224,7 @@ bool CSystemUtils::supportUnicode()
|
||||||
bool CSystemUtils::isAzertyKeyboard()
|
bool CSystemUtils::isAzertyKeyboard()
|
||||||
{
|
{
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
uint16 klId = uint16((uint32)GetKeyboardLayout(0) & 0xFFFF);
|
uint16 klId = uint16((uintptr_t)GetKeyboardLayout(0) & 0xFFFF);
|
||||||
// 0x040c is French, 0x080c is Belgian
|
// 0x040c is French, 0x080c is Belgian
|
||||||
if (klId == 0x040c || klId == 0x080c)
|
if (klId == 0x040c || klId == 0x080c)
|
||||||
return true;
|
return true;
|
||||||
|
@ -312,7 +314,8 @@ bool CSystemUtils::setRegKey(const string &ValueName, const string &Value)
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
DWORD dwDisp;
|
DWORD dwDisp;
|
||||||
|
|
||||||
if (RegCreateKeyExA(HKEY_CURRENT_USER, RootKey.c_str(), 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwDisp) == ERROR_SUCCESS)
|
char nstr[] = { 0x00 };
|
||||||
|
if (RegCreateKeyExA(HKEY_CURRENT_USER, RootKey.c_str(), 0, nstr, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwDisp) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (RegSetValueExA(hkey, ValueName.c_str(), 0L, REG_SZ, (const BYTE *)Value.c_str(), (DWORD)(Value.size())+1) == ERROR_SUCCESS)
|
if (RegSetValueExA(hkey, ValueName.c_str(), 0L, REG_SZ, (const BYTE *)Value.c_str(), (DWORD)(Value.size())+1) == ERROR_SUCCESS)
|
||||||
res = true;
|
res = true;
|
||||||
|
|
|
@ -20,7 +20,9 @@
|
||||||
#include "nel/misc/debug.h"
|
#include "nel/misc/debug.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,9 @@
|
||||||
#include "nel/misc/thread.h"
|
#include "nel/misc/thread.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#elif defined (NL_OS_UNIX)
|
#elif defined (NL_OS_UNIX)
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
|
|
|
@ -18,8 +18,9 @@
|
||||||
#include "nel/misc/win_displayer.h"
|
#include "nel/misc/win_displayer.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
#ifndef NL_COMP_MINGW
|
||||||
#define NOMINMAX
|
# define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <winuser.h>
|
#include <winuser.h>
|
||||||
|
@ -263,7 +264,7 @@ void CWinDisplayer::updateLabels ()
|
||||||
{
|
{
|
||||||
access.value()[i].Hwnd = CreateWindowW (L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_SIMPLE, 0, 0, 0, 0, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
|
access.value()[i].Hwnd = CreateWindowW (L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_SIMPLE, 0, 0, 0, 0, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
|
||||||
}
|
}
|
||||||
SendMessage ((HWND)access.value()[i].Hwnd, WM_SETFONT, (LONG) _HFont, TRUE);
|
SendMessage ((HWND)access.value()[i].Hwnd, WM_SETFONT, (WPARAM)_HFont, TRUE);
|
||||||
needResize = true;
|
needResize = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +286,7 @@ void CWinDisplayer::updateLabels ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage ((HWND)access.value()[i].Hwnd, WM_SETTEXT, 0, (LONG) n.c_str());
|
SendMessage ((HWND)access.value()[i].Hwnd, WM_SETTEXT, 0, (LPARAM) n.c_str());
|
||||||
access.value()[i].NeedUpdate = false;
|
access.value()[i].NeedUpdate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -422,7 +423,7 @@ void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint
|
||||||
dwStyle |= WS_HSCROLL;
|
dwStyle |= WS_HSCROLL;
|
||||||
|
|
||||||
_HEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", dwStyle, 0, _ToolBarHeight, w, h-_ToolBarHeight-_InputEditHeight, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
|
_HEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", dwStyle, 0, _ToolBarHeight, w, h-_ToolBarHeight-_InputEditHeight, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
|
||||||
SendMessage (_HEdit, WM_SETFONT, (LONG) _HFont, TRUE);
|
SendMessage (_HEdit, WM_SETFONT, (WPARAM)_HFont, TRUE);
|
||||||
|
|
||||||
// set the edit text limit to lot of :)
|
// set the edit text limit to lot of :)
|
||||||
SendMessage (_HEdit, EM_LIMITTEXT, -1, 0);
|
SendMessage (_HEdit, EM_LIMITTEXT, -1, 0);
|
||||||
|
@ -436,7 +437,7 @@ void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint
|
||||||
_HInputEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", WS_CHILD | WS_VISIBLE
|
_HInputEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", WS_CHILD | WS_VISIBLE
|
||||||
/*| ES_MULTILINE*/ | ES_WANTRETURN | ES_NOHIDESEL | ES_AUTOHSCROLL, 0, h-_InputEditHeight, w, _InputEditHeight,
|
/*| ES_MULTILINE*/ | ES_WANTRETURN | ES_NOHIDESEL | ES_AUTOHSCROLL, 0, h-_InputEditHeight, w, _InputEditHeight,
|
||||||
_HWnd, NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
|
_HWnd, NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
|
||||||
SendMessageW (_HInputEdit, WM_SETFONT, (LONG) _HFont, TRUE);
|
SendMessageW (_HInputEdit, WM_SETFONT, (WPARAM)_HFont, TRUE);
|
||||||
|
|
||||||
LRESULT dwEvent = SendMessageW(_HInputEdit, EM_GETEVENTMASK, (WPARAM)0, (LPARAM)0);
|
LRESULT dwEvent = SendMessageW(_HInputEdit, EM_GETEVENTMASK, (WPARAM)0, (LPARAM)0);
|
||||||
dwEvent |= ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE;
|
dwEvent |= ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE;
|
||||||
|
@ -486,7 +487,7 @@ void CWinDisplayer::clear ()
|
||||||
SendMessageW (_HEdit, EM_SETSEL, 0, nIndex);
|
SendMessageW (_HEdit, EM_SETSEL, 0, nIndex);
|
||||||
|
|
||||||
// clear all the text
|
// clear all the text
|
||||||
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LONG) "");
|
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) "");
|
||||||
|
|
||||||
SendMessageW(_HEdit,EM_SETMODIFY,(WPARAM)TRUE,(LPARAM)0);
|
SendMessageW(_HEdit,EM_SETMODIFY,(WPARAM)TRUE,(LPARAM)0);
|
||||||
|
|
||||||
|
@ -535,7 +536,7 @@ void CWinDisplayer::display_main ()
|
||||||
|
|
||||||
// store old selection
|
// store old selection
|
||||||
DWORD startSel, endSel;
|
DWORD startSel, endSel;
|
||||||
SendMessage (_HEdit, EM_GETSEL, (LONG)&startSel, (LONG)&endSel);
|
SendMessage (_HEdit, EM_GETSEL, (WPARAM)&startSel, (LPARAM)&endSel);
|
||||||
|
|
||||||
// find how many lines we have to remove in the current output to add new lines
|
// find how many lines we have to remove in the current output to add new lines
|
||||||
|
|
||||||
|
@ -549,7 +550,7 @@ void CWinDisplayer::display_main ()
|
||||||
|
|
||||||
if (nblineremove == _HistorySize)
|
if (nblineremove == _HistorySize)
|
||||||
{
|
{
|
||||||
SendMessage (_HEdit, WM_SETTEXT, 0, (LONG) "");
|
SendMessage (_HEdit, WM_SETTEXT, 0, (LPARAM) "");
|
||||||
startSel = endSel = -1;
|
startSel = endSel = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -559,7 +560,7 @@ void CWinDisplayer::display_main ()
|
||||||
LRESULT oldIndex2 = SendMessageW (_HEdit, EM_LINEINDEX, nblineremove, 0);
|
LRESULT oldIndex2 = SendMessageW (_HEdit, EM_LINEINDEX, nblineremove, 0);
|
||||||
//nlassert (oldIndex2 != -1);
|
//nlassert (oldIndex2 != -1);
|
||||||
SendMessageW (_HEdit, EM_SETSEL, oldIndex1, oldIndex2);
|
SendMessageW (_HEdit, EM_SETSEL, oldIndex1, oldIndex2);
|
||||||
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LONG) "");
|
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) "");
|
||||||
|
|
||||||
// update the selection due to the erasing
|
// update the selection due to the erasing
|
||||||
sint dt = (sint)(oldIndex2 - oldIndex1);
|
sint dt = (sint)(oldIndex2 - oldIndex1);
|
||||||
|
@ -599,7 +600,7 @@ void CWinDisplayer::display_main ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the string to the edit control
|
// add the string to the edit control
|
||||||
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LONG) str.c_str());
|
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore old selection
|
// restore old selection
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
#include "nel/misc/event_server.h"
|
#include "nel/misc/event_server.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
#ifndef NL_COMP_MINGW
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,9 @@
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
|
||||||
#include "nel/misc/path.h"
|
#include "nel/misc/path.h"
|
||||||
|
#ifndef NL_COMP_MINGW
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
#include "nel/net/net_log.h"
|
#include "nel/net/net_log.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#elif defined NL_OS_UNIX
|
#elif defined NL_OS_UNIX
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
#include "nel/net/net_log.h"
|
#include "nel/net/net_log.h"
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#elif defined NL_OS_UNIX
|
#elif defined NL_OS_UNIX
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
|
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
# define NOMINMAX
|
# ifndef NL_COMP_MINGW
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#elif defined NL_OS_UNIX
|
#elif defined NL_OS_UNIX
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
|
|
|
@ -53,7 +53,7 @@ CCallbackClient::~CCallbackClient()
|
||||||
* Recorded : YES
|
* Recorded : YES
|
||||||
* Replayed : MAYBE
|
* Replayed : MAYBE
|
||||||
*/
|
*/
|
||||||
void CCallbackClient::send (const CMessage &buffer, TSockId hostid, bool log)
|
void CCallbackClient::send (const CMessage &buffer, TSockId hostid, bool /* log */)
|
||||||
{
|
{
|
||||||
nlassert (hostid == InvalidSockId); // should always be InvalidSockId on client
|
nlassert (hostid == InvalidSockId); // should always be InvalidSockId on client
|
||||||
nlassert (connected ());
|
nlassert (connected ());
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue