Fix sse alignment issues in linux.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4443 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
3099521350
commit
ab2351a18f
2 changed files with 14 additions and 3 deletions
|
@ -189,7 +189,14 @@ void *Z_MallocNamed(int size, char *file, int line)
|
||||||
#else
|
#else
|
||||||
void *ZF_Malloc(int size)
|
void *ZF_Malloc(int size)
|
||||||
{
|
{
|
||||||
|
#ifdef __linux__
|
||||||
|
void *ret = NULL;
|
||||||
|
if (!posix_memalign(&ret, max(sizeof(float)*4, sizeof(void*)), size))
|
||||||
|
memset(ret, 0, size);
|
||||||
|
return ret;
|
||||||
|
#else
|
||||||
return calloc(size, 1);
|
return calloc(size, 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void *Z_Malloc(int size)
|
void *Z_Malloc(int size)
|
||||||
{
|
{
|
||||||
|
@ -437,7 +444,11 @@ void BZ_Free(void *data)
|
||||||
|
|
||||||
typedef struct zonegroupblock_s
|
typedef struct zonegroupblock_s
|
||||||
{
|
{
|
||||||
struct zonegroupblock_s *next;
|
union
|
||||||
|
{
|
||||||
|
struct zonegroupblock_s *next;
|
||||||
|
vec4_t align16;
|
||||||
|
};
|
||||||
} zonegroupblock_t;
|
} zonegroupblock_t;
|
||||||
|
|
||||||
#ifdef USE_MSVCRT_DEBUG
|
#ifdef USE_MSVCRT_DEBUG
|
||||||
|
|
|
@ -2495,7 +2495,8 @@ static void Mod_Batches_BuildModelMeshes(model_t *mod, int maxverts, int maxindi
|
||||||
|
|
||||||
vbo.indicies.dummy = ZG_Malloc(&loadmodel->memgroup, sizeof(index_t) * maxindicies);
|
vbo.indicies.dummy = ZG_Malloc(&loadmodel->memgroup, sizeof(index_t) * maxindicies);
|
||||||
vbo.coord.dummy = ZG_Malloc(&loadmodel->memgroup, (sizeof(vecV_t)+sizeof(vec2_t)*(1+styles)+sizeof(vec3_t)*3+sizeof(vec4_t))* maxverts);
|
vbo.coord.dummy = ZG_Malloc(&loadmodel->memgroup, (sizeof(vecV_t)+sizeof(vec2_t)*(1+styles)+sizeof(vec3_t)*3+sizeof(vec4_t))* maxverts);
|
||||||
vbo.texcoord.dummy = (vecV_t*)vbo.coord.dummy + maxverts;
|
vbo.colours.dummy = (vecV_t*)vbo.coord.dummy + maxverts;
|
||||||
|
vbo.texcoord.dummy = (vec4_t*)vbo.colours.dummy + maxverts;
|
||||||
sty = 0;
|
sty = 0;
|
||||||
if (styles)
|
if (styles)
|
||||||
{
|
{
|
||||||
|
@ -2509,7 +2510,6 @@ static void Mod_Batches_BuildModelMeshes(model_t *mod, int maxverts, int maxindi
|
||||||
vbo.normals.dummy = styles?((vec2_t*)vbo.lmcoord[styles-1].dummy + maxverts):((vec2_t*)vbo.texcoord.dummy + maxverts);
|
vbo.normals.dummy = styles?((vec2_t*)vbo.lmcoord[styles-1].dummy + maxverts):((vec2_t*)vbo.texcoord.dummy + maxverts);
|
||||||
vbo.svector.dummy = (vec3_t*)vbo.normals.dummy + maxverts;
|
vbo.svector.dummy = (vec3_t*)vbo.normals.dummy + maxverts;
|
||||||
vbo.tvector.dummy = (vec3_t*)vbo.svector.dummy + maxverts;
|
vbo.tvector.dummy = (vec3_t*)vbo.svector.dummy + maxverts;
|
||||||
vbo.colours.dummy = (vec3_t*)vbo.tvector.dummy + maxverts;
|
|
||||||
|
|
||||||
numindicies = 0;
|
numindicies = 0;
|
||||||
numverts = 0;
|
numverts = 0;
|
||||||
|
|
Loading…
Reference in a new issue