can i push this already?

This commit is contained in:
Jaime Passos 2019-09-08 22:25:18 -03:00
parent 725d0b4c44
commit dc93cafda9
11 changed files with 164 additions and 131 deletions

View File

@ -19,6 +19,7 @@ boolean allow_fullscreen = false;
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
void I_StartupGraphics(void){}
void I_StartupHardwareGraphics(void){}
void I_ShutdownGraphics(void){}

View File

@ -23,6 +23,7 @@
#include "g_input.h"
#include "hu_stuff.h"
#include "keys.h"
#include "r_main.h"
#include "r_defs.h"
#include "sounds.h"
#include "st_stuff.h"
@ -1584,10 +1585,7 @@ void CON_Drawer(void)
return;
if (needpatchrecache)
{
Z_FlushCachedPatches();
HU_LoadGraphics();
}
R_ReloadHUDGraphics();
if (con_recalc)
{

View File

@ -495,6 +495,9 @@ static void D_Display(void)
I_FinishUpdate(); // page flip or blit buffer
}
// in the occasion no functions
// that require patches to be cached
// have been called.
if (needpatchrecache)
R_ReloadHUDGraphics();

View File

@ -331,3 +331,8 @@ void I_StartupGraphics(void)
graphics_started = true;
}
void I_StartupHardwareGraphics(void)
{
// oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo y
}

View File

@ -11,6 +11,7 @@ boolean allow_fullscreen = false;
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
void I_StartupGraphics(void){}
void I_StartupHardwareGraphics(void){}
void I_ShutdownGraphics(void){}

View File

@ -44,6 +44,7 @@ extern boolean highcolor;
/** \brief setup video mode
*/
void I_StartupGraphics(void);
void I_StartupHardwareGraphics(void);
/** \brief restore old video mode
*/

View File

@ -42,24 +42,7 @@ void I_StartupGraphics(void)
vid.rowbytes = vid.width * vid.bpp;
vid.recalc = true;
HWD.pfnInit = NDS3D_Init;
HWD.pfnShutdown = NDS3D_Shutdown;
HWD.pfnFinishUpdate = NDS3D_FinishUpdate;
HWD.pfnDraw2DLine = NDS3D_Draw2DLine;
HWD.pfnDrawPolygon = NDS3D_DrawPolygon;
HWD.pfnSetBlend = NDS3D_SetBlend;
HWD.pfnClearBuffer = NDS3D_ClearBuffer;
HWD.pfnSetTexture = NDS3D_SetTexture;
HWD.pfnReadRect = NDS3D_ReadRect;
HWD.pfnGClipRect = NDS3D_GClipRect;
HWD.pfnClearMipMapCache = NDS3D_ClearMipMapCache;
HWD.pfnSetSpecialState = NDS3D_SetSpecialState;
HWD.pfnSetPalette = NDS3D_SetPalette;
HWD.pfnGetTextureUsed = NDS3D_GetTextureUsed;
HWD.pfnDrawMD2 = NDS3D_DrawMD2;
HWD.pfnDrawMD2i = NDS3D_DrawMD2i;
HWD.pfnSetTransform = NDS3D_SetTransform;
HWD.pfnGetRenderVersion = NDS3D_GetRenderVersion;
I_StartupGraphicsHardware();
videoSetMode(MODE_0_3D);
vramSetBankA(VRAM_A_TEXTURE);
@ -91,6 +74,28 @@ void I_StartupGraphics(void)
HWR_Startup();
}
void I_StartupHardwareGraphics(void)
{
HWD.pfnInit = NDS3D_Init;
HWD.pfnShutdown = NDS3D_Shutdown;
HWD.pfnFinishUpdate = NDS3D_FinishUpdate;
HWD.pfnDraw2DLine = NDS3D_Draw2DLine;
HWD.pfnDrawPolygon = NDS3D_DrawPolygon;
HWD.pfnSetBlend = NDS3D_SetBlend;
HWD.pfnClearBuffer = NDS3D_ClearBuffer;
HWD.pfnSetTexture = NDS3D_SetTexture;
HWD.pfnReadRect = NDS3D_ReadRect;
HWD.pfnGClipRect = NDS3D_GClipRect;
HWD.pfnClearMipMapCache = NDS3D_ClearMipMapCache;
HWD.pfnSetSpecialState = NDS3D_SetSpecialState;
HWD.pfnSetPalette = NDS3D_SetPalette;
HWD.pfnGetTextureUsed = NDS3D_GetTextureUsed;
HWD.pfnDrawMD2 = NDS3D_DrawMD2;
HWD.pfnDrawMD2i = NDS3D_DrawMD2i;
HWD.pfnSetTransform = NDS3D_SetTransform;
HWD.pfnGetRenderVersion = NDS3D_GetRenderVersion;
}
void I_ShutdownGraphics(void){}
void I_SetPalette(RGBA_t *palette)

View File

@ -171,7 +171,6 @@ static void Impl_VideoSetupBuffer(void);
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
//static void Impl_SetWindowName(const char *title);
static void Impl_SetWindowIcon(void);
static void I_StartupGraphicsGL(void);
static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
{
@ -1323,11 +1322,13 @@ void VID_CheckRenderer(void)
#endif
SCR_SetDrawFuncs();
}
#ifdef HWRENDER
else if (rendermode == render_opengl)
{
I_StartupGraphicsGL();
I_StartupHardwareGraphics();
R_InitHardwareMode();
}
#endif
}
INT32 VID_SetMode(INT32 modeNum)
@ -1367,10 +1368,9 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
if (borderlesswindow)
flags |= SDL_WINDOW_BORDERLESS;
//#ifdef HWRENDER
//if (rendermode == render_opengl)
flags |= SDL_WINDOW_OPENGL;
//#endif
#ifdef HWRENDER
flags |= SDL_WINDOW_OPENGL;
#endif
// Create a window
window = SDL_CreateWindow("SRB2 "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
@ -1451,51 +1451,6 @@ static void Impl_VideoSetupBuffer(void)
}
}
static void I_StartupGraphicsGL(void)
{
#ifdef HWRENDER
static boolean glstartup = false;
if (!glstartup)
{
HWD.pfnInit = hwSym("Init",NULL);
HWD.pfnFinishUpdate = NULL;
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
HWD.pfnReadRect = hwSym("ReadRect",NULL);
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
HWD.pfnSetPalette = hwSym("SetPalette",NULL);
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
HWD.pfnDrawMD2 = hwSym("DrawMD2",NULL);
HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL);
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
#ifdef SHUFFLE
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
#endif
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL);
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
// check gl renderer lib
if (HWD.pfnGetRenderVersion() != VERSION)
I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
if (!HWD.pfnInit(I_Error)) // let load the OpenGL library
rendermode = render_soft;
else
glstartup = true;
}
#endif
}
void I_StartupGraphics(void)
{
if (dedicated)
@ -1537,9 +1492,11 @@ void I_StartupGraphics(void)
framebuffer = SDL_TRUE;
}
#ifdef HWRENDER
if (M_CheckParm("-opengl"))
rendermode = render_opengl;
else if (M_CheckParm("software"))
#endif
rendermode = render_soft;
usesdl2soft = M_CheckParm("-softblit");
@ -1548,7 +1505,7 @@ void I_StartupGraphics(void)
//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2);
VID_Command_ModeList_f();
#ifdef HWRENDER
I_StartupGraphicsGL();
I_StartupHardwareGraphics();
#endif
// Fury: we do window initialization after GL setup to allow
@ -1608,6 +1565,51 @@ void I_StartupGraphics(void)
graphics_started = true;
}
void I_StartupHardwareGraphics(void)
{
#ifdef HWRENDER
static boolean glstartup = false;
if (!glstartup)
{
HWD.pfnInit = hwSym("Init",NULL);
HWD.pfnFinishUpdate = NULL;
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
HWD.pfnReadRect = hwSym("ReadRect",NULL);
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
HWD.pfnSetPalette = hwSym("SetPalette",NULL);
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
HWD.pfnDrawMD2 = hwSym("DrawMD2",NULL);
HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL);
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
#ifdef SHUFFLE
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
#endif
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL);
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
// check gl renderer lib
if (HWD.pfnGetRenderVersion() != VERSION)
I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
if (!HWD.pfnInit(I_Error)) // let load the OpenGL library
rendermode = render_soft;
else
glstartup = true;
}
#endif
}
void I_ShutdownGraphics(void)
{
const rendermode_t oldrendermode = rendermode;

View File

@ -1914,8 +1914,12 @@ void I_StartupGraphics(void)
if (strncasecmp(vd, "gcvideo", 8) == 0 || strncasecmp(vd, "fbcon", 6) == 0 || strncasecmp(vd, "wii", 4) == 0 || strncasecmp(vd, "psl1ght", 8) == 0)
framebuffer = SDL_TRUE;
}
if (M_CheckParm("-software"))
#ifdef HWRENDER
if (M_CheckParm("-opengl"))
rendermode = render_opengl;
else if (M_CheckParm("-software"))
rendermode = render_soft;
#endif
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2);
SDLESSet();
VID_Command_ModeList_f();
@ -1949,62 +1953,9 @@ void I_StartupGraphics(void)
#endif
#ifdef HWRENDER
if (M_CheckParm("-opengl") || rendermode == render_opengl)
{
rendermode = render_opengl;
HWD.pfnInit = hwSym("Init",NULL);
HWD.pfnFinishUpdate = NULL;
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
HWD.pfnReadRect = hwSym("ReadRect",NULL);
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
HWD.pfnSetPalette = hwSym("SetPalette",NULL);
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
HWD.pfnDrawMD2 = hwSym("DrawMD2",NULL);
HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL);
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
#ifdef SHUFFLE
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
#endif
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
// check gl renderer lib
if (HWD.pfnGetRenderVersion() != VERSION)
I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
#if 1 //#ifdef _WIN32_WCE
vid.width = BASEVIDWIDTH;
vid.height = BASEVIDHEIGHT;
#else
vid.width = 640; // hack to make voodoo cards work in 640x480
vid.height = 480;
#endif
if (HWD.pfnInit(I_Error)) // let load the OpenGL library
{
/*
* We want at least 1 bit R, G, and B,
* and at least 16 bpp. Why 1 bit? May be more?
*/
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 1);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 1);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
if (!OglSdlSurface(vid.width, vid.height, (USE_FULLSCREEN)))
if (!OglSdlSurface(vid.width, vid.height, !(USE_FULLSCREEN)))
rendermode = render_soft;
}
else
rendermode = render_soft;
}
I_StartupHardwareGraphics();
if (rendermode == render_opengl)
I_StartupHardwareGraphics();
#else
rendermode = render_soft; //force software mode when there no HWRENDER code
#endif
@ -2058,6 +2009,62 @@ void I_StartupGraphics(void)
graphics_started = true;
}
void I_StartupHardwareGraphics(void)
{
HWD.pfnInit = hwSym("Init",NULL);
HWD.pfnFinishUpdate = NULL;
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
HWD.pfnReadRect = hwSym("ReadRect",NULL);
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
HWD.pfnSetPalette = hwSym("SetPalette",NULL);
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
HWD.pfnDrawMD2 = hwSym("DrawMD2",NULL);
HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL);
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
#ifdef SHUFFLE
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
#endif
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
// check gl renderer lib
if (HWD.pfnGetRenderVersion() != VERSION)
I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
#if 1 //#ifdef _WIN32_WCE
vid.width = BASEVIDWIDTH;
vid.height = BASEVIDHEIGHT;
#else
vid.width = 640; // hack to make voodoo cards work in 640x480
vid.height = 480;
#endif
if (HWD.pfnInit(I_Error)) // let load the OpenGL library
{
/*
* We want at least 1 bit R, G, and B,
* and at least 16 bpp. Why 1 bit? May be more?
*/
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 1);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 1);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
if (!OglSdlSurface(vid.width, vid.height, (USE_FULLSCREEN)))
if (!OglSdlSurface(vid.width, vid.height, !(USE_FULLSCREEN)))
rendermode = render_soft;
}
else
rendermode = render_soft;
}
void I_ShutdownGraphics(void)
{
const rendermode_t oldrendermode = rendermode;

View File

@ -239,6 +239,11 @@ void I_StartupGraphics(void)
if (!dedicated) graphics_started = true;
}
void I_StartupHardwareGraphics(void)
{
// oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo y
}
// ------------------
// I_ShutdownGraphics
// Close the screen, restore previous video mode.

View File

@ -127,6 +127,11 @@ void I_StartupGraphics(void)
if (!dedicated) graphics_started = true;
}
void I_StartupHardwareGraphics(void)
{
// oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo y
}
// ------------------
// I_ShutdownGraphics
// Close the screen, restore previous video mode.