From ccff92dfbd8c3175fb2420a658377727ef5e7fc0 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 27 Sep 2025 16:26:32 +0200 Subject: [PATCH] delet vid.buffer unused memory allocation --- src/android/i_video.c | 1 - src/screen.h | 1 - src/sdl/i_video.c | 39 ++------------------------------------- 3 files changed, 2 insertions(+), 39 deletions(-) diff --git a/src/android/i_video.c b/src/android/i_video.c index 23c06dfb2..f3054038e 100644 --- a/src/android/i_video.c +++ b/src/android/i_video.c @@ -42,7 +42,6 @@ INT32 VID_SetMode(INT32 modenum) vid.modenum = 0; vid.width = 320; vid.height = 240; - vid.buffer = android_surface; return 0; } diff --git a/src/screen.h b/src/screen.h index e860be6fa..ce72e168e 100644 --- a/src/screen.h +++ b/src/screen.h @@ -57,7 +57,6 @@ typedef struct viddef_s // screens[3] = fade screen start // screens[4] = fade screen end, postimage tempoarary buffer - UINT8 *buffer; // invisible screens buffer INT32 width; // PIXELS per scanline INT32 height; boolean recalc; // if true, recalc vid-based stuff diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 23fb1db94..0bb4d2a66 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -200,7 +200,6 @@ static INT32 windowedModes[MAXWINMODES][2] = static INT32 custom_width = 0; static INT32 custom_height = 0; -static void Impl_VideoSetupBuffer(void); static SDL_bool Impl_CreateWindow(SDL_bool fullscreen); static void Impl_SetWindowIcon(void); @@ -1315,12 +1314,6 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) } texture = SDL_CreateTexture(renderer, sw_texture_format, SDL_TEXTUREACCESS_STREAMING, width, height); - - if (vid.buffer) - { - free(vid.buffer); - vid.buffer = NULL; - } } } @@ -1426,7 +1419,7 @@ void I_UpdateNoVsync(void) void I_ReadScreen(UINT8 * restrict scr, INT32 scale) { if (rendermode != render_soft) - I_Error ("I_ReadScreen: called while in non-software mode"); + I_Error("I_ReadScreen: called while in non-software mode"); else if (scale == 1) VID_BlitLinearScreen(vid.screens[0], scr, vid.width, vid.height, vid.width, vid.width); else @@ -1575,7 +1568,6 @@ INT32 VID_SetMode(INT32 modeNum) } SDLSetMode(vid.width, vid.height, USE_FULLSCREEN); - Impl_VideoSetupBuffer(); src_rect.w = vid.width; src_rect.h = vid.height; @@ -1706,24 +1698,6 @@ static void Impl_SetWindowIcon(void) SDL_SetWindowIcon(window, icoSurface); } -static void Impl_VideoSetupBuffer(void) -{ - // Set up game's software render buffer - size_t size; - - if (vid.buffer) - free(vid.buffer); - - size = vid.width*vid.height * NUMSCREENS; - - vid.buffer = calloc(size, NUMSCREENS); - - if (!vid.buffer) - { - I_Error("%s", M_GetText("Not enough memory for video buffer\n")); - } -} - static FILE * OpenRendererFile(const char * mode) { char * path = va(pandf,srb2home,"renderer.txt"); @@ -1884,7 +1858,6 @@ void I_StartupGraphics(void) if (a2c) fputs("a2c\n", file); #endif - fclose(file); } else @@ -1943,21 +1916,12 @@ void I_StartupGraphics(void) void I_ShutdownGraphics(void) { - const rendermode_t oldrendermode = rendermode; - rendermode = render_none; if (icoSurface) SDL_FreeSurface(icoSurface); icoSurface = NULL; - if (oldrendermode == render_soft) - { - if (vid.buffer) - free(vid.buffer); - vid.buffer = NULL; - } - I_OutputMsg("I_ShutdownGraphics(): "); // was graphics initialized anyway? @@ -1976,6 +1940,7 @@ void I_ShutdownGraphics(void) SDL_GL_DeleteContext(sdlglcontext); } #endif + SDL_QuitSubSystem(SDL_INIT_VIDEO); framebuffer = SDL_FALSE; }