mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-04 12:50:57 +00:00
Fix building with MSVC
git-svn-id: https://svn.eduke32.com/eduke32@1590 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
80b6a96901
commit
11c9195317
3 changed files with 56 additions and 7 deletions
|
@ -43,7 +43,7 @@ CFLAGS= /MT /J /nologo $(flags_cl) \
|
||||||
/I$(INC) /I$(EINC)\msvc /I$(EINC)\ /I$(SRC)\jmact /I$(JAUDIOLIBDIR)\include /I$(ENETDIR)\include /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" \
|
/I$(INC) /I$(EINC)\msvc /I$(EINC)\ /I$(SRC)\jmact /I$(JAUDIOLIBDIR)\include /I$(ENETDIR)\include /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" \
|
||||||
/D "_CRT_SECURE_NO_DEPRECATE" /W2 $(ENGINEOPTS) \
|
/D "_CRT_SECURE_NO_DEPRECATE" /W2 $(ENGINEOPTS) \
|
||||||
/I$(DXROOT)\include" /DRENDERTYPEWIN=1
|
/I$(DXROOT)\include" /DRENDERTYPEWIN=1
|
||||||
LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib comctl32.lib \
|
LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib ws2_32.lib comctl32.lib \
|
||||||
/NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib
|
/NODEFAULTLIB:glu32.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib
|
||||||
|
|
||||||
LIBS=vorbisfile_static.lib vorbis_static.lib ogg_static.lib dsound.lib advapi32.lib $(LIBS)
|
LIBS=vorbisfile_static.lib vorbis_static.lib ogg_static.lib dsound.lib advapi32.lib $(LIBS)
|
||||||
|
|
|
@ -6589,6 +6589,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
|
||||||
}
|
}
|
||||||
|
|
||||||
globalpicnum = spr->picnum;
|
globalpicnum = spr->picnum;
|
||||||
|
globalpal = spr->pal; // GL needs this, software doesn't
|
||||||
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
|
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
|
||||||
setgotpic(globalpicnum);
|
setgotpic(globalpicnum);
|
||||||
if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue;
|
if ((tilesizx[globalpicnum] <= 0) || (tilesizy[globalpicnum] <= 0)) continue;
|
||||||
|
|
|
@ -50,8 +50,8 @@ DEALINGS IN THE SOFTWARE.
|
||||||
/*#define FULLSANITYCHECKS*/
|
/*#define FULLSANITYCHECKS*/
|
||||||
/* If link time code generation is on, don't force or prevent inlining */
|
/* If link time code generation is on, don't force or prevent inlining */
|
||||||
#if defined(_MSC_VER) && defined(NEDMALLOC_DLL_EXPORTS)
|
#if defined(_MSC_VER) && defined(NEDMALLOC_DLL_EXPORTS)
|
||||||
#define FORCEINLINE
|
// #define FORCEINLINE
|
||||||
#define NOINLINE
|
// #define NOINLINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "nedmalloc.h"
|
#include "nedmalloc.h"
|
||||||
|
@ -68,7 +68,19 @@ DEALINGS IN THE SOFTWARE.
|
||||||
#define USE_LOCKS 1
|
#define USE_LOCKS 1
|
||||||
#endif
|
#endif
|
||||||
#define FOOTERS 1 /* Need to enable footers so frees lock the right mspace */
|
#define FOOTERS 1 /* Need to enable footers so frees lock the right mspace */
|
||||||
#ifndef NEDMALLOC_DEBUG
#if defined(DEBUG) || defined(_DEBUG)
#define NEDMALLOC_DEBUG 1
#else
#define NEDMALLOC_DEBUG 0
#endif
#endif
/* We need to consistently define DEBUG=0|1, _DEBUG and NDEBUG for dlmalloc */
#undef DEBUG
#undef _DEBUG
#if NEDMALLOC_DEBUG
#define _DEBUG
#else
|
#ifndef NEDMALLOC_DEBUG
|
||||||
|
#if defined(DEBUG) || defined(_DEBUG)
|
||||||
|
#define NEDMALLOC_DEBUG 1
|
||||||
|
#else
|
||||||
|
#define NEDMALLOC_DEBUG 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
/* We need to consistently define DEBUG=0|1, _DEBUG and NDEBUG for dlmalloc */
|
||||||
|
#undef DEBUG
|
||||||
|
#undef _DEBUG
|
||||||
|
#if NEDMALLOC_DEBUG
|
||||||
|
#define _DEBUG
|
||||||
|
#else
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
#endif
|
#endif
|
||||||
#ifdef NDEBUG /* Disable assert checking on release builds */
|
#ifdef NDEBUG /* Disable assert checking on release builds */
|
||||||
|
@ -84,8 +96,19 @@ DEALINGS IN THE SOFTWARE.
|
||||||
#endif
|
#endif
|
||||||
/*#define USE_SPIN_LOCKS 0*/
|
/*#define USE_SPIN_LOCKS 0*/
|
||||||
|
|
||||||
#include "malloc.c.h"
#ifdef NDEBUG /* Disable assert checking on release builds */
#undef DEBUG
#elif !NEDMALLOC_DEBUG
#ifdef __GNUC__
#warning DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed.
#elif defined(_MSC_VER)
#pragma message(__FILE__ ": WARNING: DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed.")
#endif
#endif
|
#include "malloc.c.h"
|
||||||
/* The maximum concurrent threads in a pool possible */#ifndef MAXTHREADSINPOOL
|
#ifdef NDEBUG /* Disable assert checking on release builds */
|
||||||
|
#undef DEBUG
|
||||||
|
#elif !NEDMALLOC_DEBUG
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#warning DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed.
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#pragma message(__FILE__ ": WARNING: DEBUG is defined so allocator will run with assert checking! Define NDEBUG to run at full speed.")
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The maximum concurrent threads in a pool possible */
|
||||||
|
#ifndef MAXTHREADSINPOOL
|
||||||
#define MAXTHREADSINPOOL 16
|
#define MAXTHREADSINPOOL 16
|
||||||
#endif
|
#endif
|
||||||
/* The maximum number of threadcaches which can be allocated */
|
/* The maximum number of threadcaches which can be allocated */
|
||||||
|
@ -155,7 +178,32 @@ static void *RESTRICT leastusedaddress;
|
||||||
static size_t largestusedblock;
|
static size_t largestusedblock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static FORCEINLINE void *CallMalloc(void *RESTRICT mspace, size_t size, size_t alignment) THROWSPEC
{
void *RESTRICT ret=0;
size_t _alignment=alignment;
#if USE_MAGIC_HEADERS
size_t *_ret=0;
size+=alignment+3*sizeof(size_t);
_alignment=0;
#endif
#if USE_ALLOCATOR==0
ret=_alignment ?
#ifdef _MSC_VER
/* This is the MSVCRT equivalent */
_aligned_malloc(size, _alignment)
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
/* This is the glibc/ptmalloc2/dlmalloc/BSD libc equivalent. */
memalign(_alignment, size)
#else
#error Cannot aligned allocate with the memory allocator of an unknown system!
#endif
: malloc(size);
#elif USE_ALLOCATOR==1
ret=_alignment ? mspace_memalign((mstate) mspace, _alignment, size) : mspace_malloc((mstate) mspace, size);
#ifndef ENABLE_FAST_HEAP_DETECTION
if(ret)
{
|
static FORCEINLINE void *CallMalloc(void *RESTRICT mspace, size_t size, size_t alignment) THROWSPEC
|
||||||
|
{
|
||||||
|
void *RESTRICT ret=0;
|
||||||
|
size_t _alignment=alignment;
|
||||||
|
#if USE_MAGIC_HEADERS
|
||||||
|
size_t *_ret=0;
|
||||||
|
size+=alignment+3*sizeof(size_t);
|
||||||
|
_alignment=0;
|
||||||
|
#endif
|
||||||
|
#if USE_ALLOCATOR==0
|
||||||
|
ret=_alignment ?
|
||||||
|
#ifdef WIN32
|
||||||
|
/* This is the MSVCRT equivalent */
|
||||||
|
_aligned_malloc(size, _alignment)
|
||||||
|
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
|
||||||
|
/* This is the glibc/ptmalloc2/dlmalloc/BSD libc equivalent. */
|
||||||
|
memalign(_alignment, size)
|
||||||
|
#else
|
||||||
|
#error Cannot aligned allocate with the memory allocator of an unknown system!
|
||||||
|
#endif
|
||||||
|
: malloc(size);
|
||||||
|
#elif USE_ALLOCATOR==1
|
||||||
|
ret=_alignment ? mspace_memalign((mstate) mspace, _alignment, size) : mspace_malloc((mstate) mspace, size);
|
||||||
|
#ifndef ENABLE_FAST_HEAP_DETECTION
|
||||||
|
if(ret)
|
||||||
|
{
|
||||||
size_t truesize=chunksize(mem2chunk(ret));
|
size_t truesize=chunksize(mem2chunk(ret));
|
||||||
if(!leastusedaddress || (void *)((mstate) mspace)->least_addr<leastusedaddress) leastusedaddress=(void *)((mstate) mspace)->least_addr;
|
if(!leastusedaddress || (void *)((mstate) mspace)->least_addr<leastusedaddress) leastusedaddress=(void *)((mstate) mspace)->least_addr;
|
||||||
if(!largestusedblock || truesize>largestusedblock) largestusedblock=(truesize+mparams.page_size) & ~(mparams.page_size-1);
|
if(!largestusedblock || truesize>largestusedblock) largestusedblock=(truesize+mparams.page_size) & ~(mparams.page_size-1);
|
||||||
|
|
Loading…
Reference in a new issue