Merge branch 'Saturn-Next' into Saturn-Testing

This commit is contained in:
Alug committed 2025-08-16 22:21:13 +02:00
commit 2d1c876e0d
16 files changed
+141 -124

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ struct SourceLocation {
class IErrorAssertHandler {
public:
static void handle(const SourceLocation& source_location, const char* expression) {
[[ noreturn ]] static void handle(const SourceLocation& source_location, const char* expression) {
I_Error("Assertion failed at %s:%u: %s != true",
source_location.file_name,
source_location.line_number,
+1 -1
View File
@@ -933,7 +933,6 @@ void D_SRB2Loop(void)
Discord_RunCallbacks();
}
#endif
// Fully completed frame made.
finishprecise = I_GetPreciseTime();
@@ -971,6 +970,7 @@ void D_SRB2Loop(void)
I_SleepDuration(capbudget - elapsed);
}
}
// Capture the time once more to get the real delta time.
finishprecise = I_GetPreciseTime();
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
+1
View File
@@ -937,6 +937,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_consolechat);
CV_RegisterVar(&cv_chatnotifications);
CV_RegisterVar(&cv_chatbacktint);
CV_RegisterVar(&cv_chatcentertext);
CV_RegisterVar(&cv_songcredits);
CV_RegisterVar(&cv_showfreeplay);
CV_RegisterVar(&cv_skinselectspin);
+4 -2
View File
@@ -310,6 +310,8 @@ consvar_t cv_chatbacktint = {"chatbacktint", "On", CV_SAVE, CV_OnOff, NULL, 0, N
static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {2, "Window (Hidden)"}, {0, NULL}};
consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_chatcentertext = {"chatcentertext", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// Pause game upon window losing focus
consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -1842,11 +1844,11 @@ void G_Ticker(boolean run)
{
for (i = 0; i < MAXPLAYERS; i++) // read/write demo and check turbo cheat
{
cmd = &players[i].cmd;
if (!playeringame[i])
continue;
cmd = &players[i].cmd;
//@TODO all this throwdir stuff shouldn't be here! But it stays for now to maintain 1.0.4 compat...
// Remove for 1.1!
+1 -1
View File
@@ -49,7 +49,7 @@ extern tic_t timeinmap; // Ticker for time spent in level (used for levelcard di
extern INT16 rw_maximums[NUM_WEAPONS];
// used in game menu
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection/*, cv_compactscoreboard*/;
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_chatcentertext/*, cv_compactscoreboard*/;
extern consvar_t cv_songcredits;
extern consvar_t cv_showfreeplay;
extern consvar_t cv_growmusic, cv_supermusic;
+1 -1
View File
@@ -1658,7 +1658,7 @@ static void HU_drawMiniChat(void)
if (cv_chatbacktint.value) // on request of wolfy
V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
V_DrawChatCharacter(x + dx + 2, y+dy, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, !cv_allcaps.value, colormap);
V_DrawChatCharacter(x + dx + 2, y+dy+cv_chatcentertext.value, msg[j++] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, !cv_allcaps.value, colormap);
}
dx += charwidth;
+11 -9
View File
@@ -1404,18 +1404,19 @@ static menuitem_t OP_ChatOptionsMenu[] =
NULL, "Chat Box Width", &cv_chatwidth, 20},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
NULL, "Chat Box Height", &cv_chatheight, 30},
{IT_STRING | IT_CVAR, NULL, "Center Text in Chat", &cv_chatcentertext, 40},
{IT_STRING | IT_CVAR, NULL, "Chat Background Tint", &cv_chatbacktint, 45},
{IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 55},
{IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 65},
{IT_STRING | IT_CVAR, NULL, "Max Chat Messages", &cv_chatlogsize, 75},
{IT_STRING | IT_CVAR, NULL, "Chat Background Tint", &cv_chatbacktint, 55},
{IT_STRING | IT_CVAR, NULL, "Message Fadeout Time", &cv_chattime, 65},
{IT_STRING | IT_CVAR, NULL, "Spam Protection", &cv_chatspamprotection, 75},
{IT_STRING | IT_CVAR, NULL, "Max Chat Messages", &cv_chatlogsize, 85},
{IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 95}, // shows ping above the framerate if we want to.
{IT_STRING | IT_CVAR, NULL, "Ping display style", &cv_pingstyle, 105},
{IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 115},
{IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 125},
{IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 105}, // shows ping above the framerate if we want to.
{IT_STRING | IT_CVAR, NULL, "Ping display style", &cv_pingstyle, 115},
{IT_STRING | IT_CVAR, NULL, "Ping measurement", &cv_pingmeasurement, 125},
{IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 135},
{IT_STRING | IT_CVAR, NULL, "Show IP address in playerlist", &cv_shownodeip, 135},
{IT_STRING | IT_CVAR, NULL, "Show IP address in playerlist", &cv_shownodeip, 145},
};
static const char* OP_ChatOptionsTooltips[] =
@@ -1423,6 +1424,7 @@ static const char* OP_ChatOptionsTooltips[] =
"Chat mode used for in-game chat.",
"Width of chat box.",
"Height of chat box.",
"Center text in the chat message pop ups.",
"Chatbox background.",
"Fadeout time for new chat message.",
"Spam protection for in-game chat.",
+1 -1
View File
@@ -96,7 +96,7 @@ ATTRINLINE static fixed_t FUNCINLINE __internal_prng__(void)
randomseed ^= randomseed >> 13;
randomseed ^= randomseed >> 11;
randomseed ^= randomseed << 21;
return ( (randomseed*36548569) >> 4) & (FRACUNIT-1);
return ((randomseed*36548569) >> 4) & (FRACUNIT-1);
}
/** Provides a random fixed point number. Distribution is uniform.
+26 -26
View File
@@ -442,7 +442,7 @@ void P_UpdateSegLightOffset(seg_t *li)
extralight = -contrastFixed + FixedMul(light, contrastFixed * 2);
// Between -2 and 2 for software, -8 and 8 for hardware
// Between -1 and 1 for software, -8 and 8 for hardware
li->lightOffset = FixedFloor((extralight / 8) + (FRACUNIT / 2)) / FRACUNIT;
#ifdef HWRENDER
li->hwLightOffset = FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT;
@@ -1747,33 +1747,33 @@ static void P_CreateBlockMap(void)
// Now we simply iterate block-by-block until we reach the end block.
for (curblockx = bxstart; curblockx <= bxend; curblockx++)
for (curblocky = bystart; curblocky <= byend; curblocky++)
{
size_t b = curblocky * bmapwidth + curblockx;
if (b >= tot)
continue;
if (!straight && !(LineInBlock((fixed_t)x, (fixed_t)y, (fixed_t)v2x, (fixed_t)v2y, (fixed_t)(curblockx << MAPBTOFRAC), (fixed_t)(curblocky << MAPBTOFRAC))))
continue;
// Increase size of allocated list if necessary
if (bmap[b].n >= bmap[b].nalloc)
for (curblocky = bystart; curblocky <= byend; curblocky++)
{
// Graue 02-29-2004: make code more readable, don't realloc a null pointer
// (because it crashes for me, and because the comp.lang.c FAQ says so)
if (bmap[b].nalloc == 0)
bmap[b].nalloc = 8;
else
bmap[b].nalloc *= 2;
bmap[b].list = Z_Realloc(bmap[b].list, bmap[b].nalloc * sizeof (*bmap->list), PU_CACHE, &bmap[b].list);
if (!bmap[b].list)
I_Error("Out of Memory in P_CreateBlockMap");
}
size_t b = curblocky * bmapwidth + curblockx;
// Add linedef to end of list
bmap[b].list[bmap[b].n++] = (INT32)i;
}
if (b >= tot)
continue;
if (!straight && !(LineInBlock((fixed_t)x, (fixed_t)y, (fixed_t)v2x, (fixed_t)v2y, (fixed_t)(curblockx << MAPBTOFRAC), (fixed_t)(curblocky << MAPBTOFRAC))))
continue;
// Increase size of allocated list if necessary
if (bmap[b].n >= bmap[b].nalloc)
{
// Graue 02-29-2004: make code more readable, don't realloc a null pointer
// (because it crashes for me, and because the comp.lang.c FAQ says so)
if (bmap[b].nalloc == 0)
bmap[b].nalloc = 8;
else
bmap[b].nalloc *= 2;
bmap[b].list = Z_Realloc(bmap[b].list, bmap[b].nalloc * sizeof (*bmap->list), PU_CACHE, &bmap[b].list);
if (!bmap[b].list)
I_Error("Out of Memory in P_CreateBlockMap");
}
// Add linedef to end of list
bmap[b].list[bmap[b].n++] = (INT32)i;
}
}
// Compute the total size of the blockmap.
+4 -2
View File
@@ -16,6 +16,7 @@
#endif
#include "doomstat.h"
#include "dehacked.h"
#include "g_game.h"
#include "g_input.h"
#include "p_local.h"
@@ -647,7 +648,8 @@ static inline void P_ResetSpriteStuff(void)
mo = (mobj_t *)th;
if (!mo || (mo->sprite == SPR_NULL) || (mo->flags2 & MF2_DONTDRAW) || (mo->type == MT_SHADOW))
if (!mo || (mo->sprite == SPR_NULL)
|| (mo->flags2 & MF2_DONTDRAW) || (mo->type == MT_SHADOW))
continue;
mo->spritexscale = mo->realxscale;
@@ -724,9 +726,9 @@ void P_Ticker(boolean run)
if (playeringame[i])
G_WriteDemoTiccmd(&players[i].cmd, i);
}
if (demo.playback)
{
#ifdef DEMO_COMPAT_100
if (demo.version == 0x0001)
{
+20
View File
@@ -492,6 +492,7 @@ void R_CreateInterpolator_Polyobj(thinker_t *thinker, polyobj_t *polyobj)
interp->polyobj.oldcx = interp->polyobj.bakcx = polyobj->centerPt.x;
interp->polyobj.oldcy = interp->polyobj.bakcy = polyobj->centerPt.y;
interp->polyobj.oldangle = interp->polyobj.bakangle = polyobj->angle;
}
/*void R_CreateInterpolator_DynSlope(thinker_t *thinker, pslope_t *slope)
@@ -515,6 +516,15 @@ void R_InitializeLevelInterpolators(void)
levelinterpolators = NULL;
}
static void RecalculatePolyobjectSegAngles(polyobj_t *polyobj)
{
for (size_t i = 0; i < polyobj->segCount; i++)
{
seg_t *seg = polyobj->segs[i];
seg->angle = R_PointToAngle2(seg->v1->x, seg->v1->y, seg->v2->x, seg->v2->y);
}
}
static void UpdateLevelInterpolatorState(levelinterpolator_t *interp)
{
size_t i;
@@ -545,10 +555,14 @@ static void UpdateLevelInterpolatorState(levelinterpolator_t *interp)
interp->polyobj.bakvertices[i * 2 ] = interp->polyobj.polyobj->vertices[i]->x;
interp->polyobj.bakvertices[i * 2 + 1] = interp->polyobj.polyobj->vertices[i]->y;
}
RecalculatePolyobjectSegAngles(interp->polyobj.polyobj);
interp->polyobj.oldcx = interp->polyobj.bakcx;
interp->polyobj.oldcy = interp->polyobj.bakcy;
interp->polyobj.oldangle = interp->polyobj.bakangle;
interp->polyobj.bakcx = interp->polyobj.polyobj->centerPt.x;
interp->polyobj.bakcy = interp->polyobj.polyobj->centerPt.y;
interp->polyobj.bakangle = interp->polyobj.polyobj->angle;
break;
/*case LVLINTERP_DynSlope:
FV3_Copy(&interp->dynslope.oldo, &interp->dynslope.bako);
@@ -630,8 +644,11 @@ void R_ApplyLevelInterpolators(fixed_t frac)
interp->polyobj.polyobj->vertices[ii]->x = R_LerpFixed(interp->polyobj.oldvertices[ii * 2 ], interp->polyobj.bakvertices[ii * 2 ], frac);
interp->polyobj.polyobj->vertices[ii]->y = R_LerpFixed(interp->polyobj.oldvertices[ii * 2 + 1], interp->polyobj.bakvertices[ii * 2 + 1], frac);
}
RecalculatePolyobjectSegAngles(interp->polyobj.polyobj);
interp->polyobj.polyobj->centerPt.x = R_LerpFixed(interp->polyobj.oldcx, interp->polyobj.bakcx, frac);
interp->polyobj.polyobj->centerPt.y = R_LerpFixed(interp->polyobj.oldcy, interp->polyobj.bakcy, frac);
interp->polyobj.polyobj->angle = R_LerpAngle(interp->polyobj.oldangle, interp->polyobj.bakangle, frac);
break;
/*case LVLINTERP_DynSlope:
R_LerpVector3(&interp->dynslope.oldo, &interp->dynslope.bako, frac, &interp->dynslope.slope->o);
@@ -685,8 +702,11 @@ void R_RestoreLevelInterpolators(void)
interp->polyobj.polyobj->vertices[ii]->x = interp->polyobj.bakvertices[ii * 2 ];
interp->polyobj.polyobj->vertices[ii]->y = interp->polyobj.bakvertices[ii * 2 + 1];
}
RecalculatePolyobjectSegAngles(interp->polyobj.polyobj);
interp->polyobj.polyobj->centerPt.x = interp->polyobj.bakcx;
interp->polyobj.polyobj->centerPt.y = interp->polyobj.bakcy;
interp->polyobj.polyobj->angle = interp->polyobj.bakangle;
break;
/*case LVLINTERP_DynSlope:
FV3_Copy(&interp->dynslope.slope->o, &interp->dynslope.bako);
+1
View File
@@ -119,6 +119,7 @@ typedef struct levelinterpolator_s {
fixed_t *bakvertices;
size_t vertices_size;
fixed_t oldcx, oldcy, bakcx, bakcy;
angle_t oldangle, bakangle;
} polyobj;
struct {
pslope_t *slope;
+2 -2
View File
@@ -108,7 +108,7 @@ FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSide(fixed_t x, fixed_t y,
// This is not as accurate
// SHOULD NOT BE USED FOR ANYTHING GAMEPLAY RELATED!!
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSideFast(fixed_t x, fixed_t y, const node_t *node)
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSideFast(fixed_t x, fixed_t y, const node_t* restrict node)
{
// use cross product to determine side quickly
INT64 v = ((INT64)y - node->y) * node->dx - ((INT64)x - node->x) * node->dy;
@@ -201,7 +201,7 @@ extern consvar_t cv_secbright;
extern consvar_t cv_randomdirlight;
static inline INT32 R_GetSoftLightlevel(INT32 llevel)
FUNCINLINE static ATTRINLINE INT32 R_GetSoftLightlevel(INT32 llevel)
{
return CLAMP(llevel, cv_secbright.value, 255) >> LIGHTSEGSHIFT;
}
+22 -73
View File
@@ -168,13 +168,8 @@ static INT32 mousemovex = 0, mousemovey = 0;
// SDL vars
static SDL_Surface *vidSurface = NULL;
static SDL_Surface *bufSurface = NULL;
static SDL_Surface *icoSurface = NULL;
static SDL_Color localPalette[256];
#if 0
static SDL_Rect **modeList = NULL;
static Uint8 BitsPerPixel = 16;
#endif
static UINT32 localPalette[256];
Uint16 realwidth = BASEVIDWIDTH;
Uint16 realheight = BASEVIDHEIGHT;
static SDL_bool mousegrabok = SDL_TRUE;
@@ -223,7 +218,6 @@ static INT32 windowedModes[MAXWINMODES][2] =
static INT32 custom_width = 0;
static INT32 custom_height = 0;
static void Impl_VideoSetupSDLBuffer(void);
static void Impl_VideoSetupBuffer(void);
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
static void Impl_SetWindowIcon(void);
@@ -520,7 +514,6 @@ static void VID_Command_Info_f (void)
if (!M_CheckParm("-noblit"))
videoblitok = SDL_TRUE;
SurfaceInfo(bufSurface, M_GetText("Current Engine Mode"));
SurfaceInfo(vidSurface, M_GetText("Current Video Mode"));
}
@@ -1347,7 +1340,7 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
{
static SDL_bool wasfullscreen = SDL_FALSE;
Uint32 rmask, gmask, bmask, amask;
int bpp = 16;
int bpp;
int sw_texture_format = SDL_PIXELFORMAT_ABGR8888;
realwidth = vid.width;
@@ -1416,16 +1409,6 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
SDL_DestroyTexture(texture);
}
if (!usesdl2soft)
{
sw_texture_format = SDL_PIXELFORMAT_RGB565;
}
else
{
bpp = 32;
sw_texture_format = SDL_PIXELFORMAT_RGBA8888;
}
texture = SDL_CreateTexture(renderer, sw_texture_format, SDL_TEXTUREACCESS_STREAMING, width, height);
// Set up SW surface
@@ -1500,19 +1483,18 @@ void I_FinishUpdate(void)
if (rendermode == render_soft && vid.screens[0])
{
if (!bufSurface) //Double-Check
{
Impl_VideoSetupSDLBuffer();
}
if (bufSurface)
{
SDL_BlitSurface(bufSurface, &src_rect, vidSurface, &src_rect);
// Fury -- there's no way around UpdateTexture, the GL backend uses it anyway
SDL_LockSurface(vidSurface);
SDL_UpdateTexture(texture, &src_rect, vidSurface->pixels, vidSurface->pitch);
SDL_UnlockSurface(vidSurface);
}
SDL_LockSurface(vidSurface);
// copy pixels ourselves to the video surface (prevents a crash in libsdl)
UINT32 *dst = vidSurface->pixels;
UINT8 *src = vid.screens[0];
for (int32_t i = 0; i < vid.width * vid.height; i++)
*dst++ = localPalette[*src++];
SDL_UnlockSurface(vidSurface);
// Fury -- there's no way around UpdateTexture, the GL backend uses it anyway
SDL_LockSurface(vidSurface);
SDL_UpdateTexture(texture, &src_rect, vidSurface->pixels, vidSurface->pitch);
SDL_UnlockSurface(vidSurface);
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, texture, &src_rect, NULL);
@@ -1559,14 +1541,11 @@ void I_SetPalette(RGBA_t *palette)
for (i = 0; i < 256; i++)
{
localPalette[i].r = palette[i].s.red;
localPalette[i].g = palette[i].s.green;
localPalette[i].b = palette[i].s.blue;
localPalette[i] = 0xff000000;
localPalette[i] |= palette[i].s.red << 0;
localPalette[i] |= palette[i].s.green << 8;
localPalette[i] |= palette[i].s.blue << 16;
}
//if (vidSurface) SDL_SetPaletteColors(vidSurface->format->palette, localPalette, 0, 256);
// Fury -- SDL2 vidSurface is a 32-bit surface buffer copied to the texture. It's not palletized, like bufSurface.
if (bufSurface) SDL_SetPaletteColors(bufSurface->format->palette, localPalette, 0, 256);
}
// return number of fullscreen + X11 modes
@@ -1688,15 +1667,6 @@ INT32 VID_SetMode(INT32 modeNum)
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
Impl_VideoSetupBuffer();
if (rendermode == render_soft)
{
if (bufSurface)
{
SDL_FreeSurface(bufSurface);
bufSurface = NULL;
}
}
src_rect.w = vid.width;
src_rect.h = vid.height;
@@ -1824,36 +1794,19 @@ static void Impl_SetWindowIcon(void)
SDL_SetWindowIcon(window, icoSurface);
}
static void Impl_VideoSetupSDLBuffer(void)
{
if (bufSurface != NULL)
{
SDL_FreeSurface(bufSurface);
bufSurface = NULL;
}
// Set up the SDL palletized buffer (copied to vidbuffer before being rendered to texture)
bufSurface = SDL_CreateRGBSurfaceFrom(vid.screens[0], vid.width, vid.height, 8,
(int)vid.rowbytes, 0x00000000, 0x00000000, 0x00000000, 0x00000000); // 256 mode
if (bufSurface)
{
SDL_SetPaletteColors(bufSurface->format->palette, localPalette, 0, 256);
}
else
{
I_Error("%s", M_GetText("No system memory for SDL buffer surface\n"));
}
}
static void Impl_VideoSetupBuffer(void)
{
// Set up game's software render buffer
size_t size;
vid.rowbytes = vid.width;
if (vid.buffer)
free(vid.buffer);
vid.buffer = calloc(vid.rowbytes*vid.height, NUMSCREENS);
size = vid.rowbytes*vid.height * NUMSCREENS;
vid.buffer = calloc(size, NUMSCREENS);
if (!vid.buffer)
{
@@ -2114,10 +2067,6 @@ void I_ShutdownGraphics(void)
if (vid.buffer)
free(vid.buffer);
vid.buffer = NULL;
if (bufSurface)
SDL_FreeSurface(bufSurface);
bufSurface = NULL;
}
I_OutputMsg("I_ShutdownGraphics(): ");
+33 -5
View File
@@ -615,8 +615,21 @@ static void CV_constextsize_OnChange(void)
void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT32 height, size_t srcrowbytes,
size_t destrowbytes)
{
if ((srcrowbytes == destrowbytes) && (srcrowbytes == (size_t)width))
M_Memcpy(destptr, srcptr, srcrowbytes * height);
if (srcrowbytes == destrowbytes)
{
size_t i = srcrowbytes * height;
#if defined(__SSE__)
while (i >= 16)
{
// TODO: find where the buffer is misaligned at times and align it
_mm_storeu_ps((float *)destptr, _mm_loadu_ps((const float *)srcptr));
srcptr += 16;
destptr += 16;
i -= 16;
}
#endif
M_Memcpy(destptr, srcptr, i);
}
else
{
while (height--)
@@ -3775,17 +3788,32 @@ UINT8 GetColorLUTDirect(colorlookup_t *lut, UINT8 r, UINT8 g, UINT8 b)
void V_Init(void)
{
INT32 i;
UINT8 *base = vid.buffer;
const INT32 screensize = vid.rowbytes * vid.height;
for (i = 0; i < NUMSCREENS; i++)
{
#if defined(__SSE__)
aligned_free(vid.screens[i]);
#else
free(vid.screens[i]);
#endif
vid.screens[i] = NULL;
}
// start address of NUMSCREENS * width*height vidbuffers
if (base)
if (screensize > 0)
{
for (i = 0; i < NUMSCREENS; i++)
vid.screens[i] = base + i*screensize;
{
// we need to allocate these relative to their cpu restrictions to not trigger segfaults
// TODO: add support for sve and neon
#if defined(__SSE__)
vid.screens[i] = aligned_alloc(128, screensize);
#else
vid.screens[i] = malloc(screensize);
#endif
memset(vid.screens[i], 0, screensize);
}
}
#ifdef DEBUG
+12
View File
@@ -23,6 +23,18 @@ extern "C" {
#include "r_defs.h"
#include "r_main.h"
#if defined(__SSE__)
#ifdef _WIN32
#include <malloc.h>
#define aligned_alloc(align, size) _aligned_malloc(size, align)
#define aligned_free(ptr) _aligned_free(ptr)
#else
#define aligned_free(ptr) free(ptr)
#endif
#include <immintrin.h>
#endif
//
// VIDEO
//