Fix blackscreen on start + some other changes
move a few things around in HWR_Startup so they only get called on startup
This commit is contained in:
1 parent
fc2a0846cb
commit
9725a9d9a5
5 files changed
+52
-52
No files matched your search
@@ -1521,9 +1521,7 @@ void D_SRB2Main(void)
|
||||
// Has to be done before the configuration file loads,
|
||||
// but after the OpenGL library loads.
|
||||
HWR_AddCommands();
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
|
||||
+36
-41
@@ -163,31 +163,31 @@ consvar_t cv_grslopecontrast = {"gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NU
|
||||
|
||||
consvar_t cv_grhorizonlines = {"gr_horizonlines", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#define ONLY_IF_GL_LOADED if (vid.glstate != VID_GL_LIBRARY_LOADED) return;
|
||||
|
||||
static void CV_filtermode_ONChange(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_grfiltermode.value);
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_grfiltermode.value);
|
||||
}
|
||||
|
||||
static void CV_anisotropic_ONChange(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_granisotropicmode.value);
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_granisotropicmode.value);
|
||||
}
|
||||
|
||||
static void CV_screentextures_ONChange(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWD.pfnSetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_grscreentextures.value);
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_grscreentextures.value);
|
||||
}
|
||||
|
||||
static void CV_grshaders_OnChange(void)
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
HWR_SetShaderState();
|
||||
|
||||
if ((rendermode == render_opengl) && (cv_grpaletterendering.value))
|
||||
ONLY_IF_GL_LOADED
|
||||
HWR_SetShaderState();
|
||||
if ((cv_grpaletterendering.value))
|
||||
{
|
||||
// can't do palette rendering without shaders, so update the state if needed
|
||||
HWR_TogglePaletteRendering();
|
||||
@@ -196,22 +196,22 @@ static void CV_grshaders_OnChange(void)
|
||||
|
||||
static void CV_useCustomShaders_ONChange(void) // should we do a call to HWR_TogglePaletteRendering here aswell in pal rendering mode?
|
||||
{
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
if (HWR_UseShader())
|
||||
HWD.pfnInitCustomShaders();
|
||||
}
|
||||
ONLY_IF_GL_LOADED
|
||||
if (HWR_UseShader())
|
||||
HWD.pfnInitCustomShaders();
|
||||
}
|
||||
|
||||
static void CV_grpaletterendering_OnChange(void)
|
||||
{
|
||||
if ((rendermode == render_opengl) && (gr_shadersavailable))
|
||||
ONLY_IF_GL_LOADED
|
||||
if (gr_shadersavailable)
|
||||
HWR_TogglePaletteRendering();
|
||||
}
|
||||
|
||||
static void CV_grpalettedepth_OnChange(void)
|
||||
{
|
||||
if ((rendermode == render_opengl) && (HWR_ShouldUsePaletteRendering()))
|
||||
ONLY_IF_GL_LOADED
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
HWR_SetPalette(pLocalPalette);
|
||||
}
|
||||
|
||||
@@ -220,10 +220,7 @@ static void CV_grpalettedepth_OnChange(void)
|
||||
//
|
||||
void HWR_SetShaderState(void)
|
||||
{
|
||||
INT32 state = cv_grshaders.value;
|
||||
|
||||
HWD.pfnSetSpecialState(HWD_SET_SHADERS, (INT32)state);
|
||||
HWD.pfnSetShader(0);
|
||||
HWD.pfnSetSpecialState(HWD_SET_SHADERS, HWR_UseShader());
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -6273,8 +6270,8 @@ void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
HWR_ClearClipper();
|
||||
|
||||
// Reset the shader state.
|
||||
HWD.pfnSetSpecialState(HWD_SET_SHADERS, cv_grshaders.value);
|
||||
HWD.pfnSetShader(0);
|
||||
//HWD.pfnSetSpecialState(HWD_SET_SHADERS, cv_grshaders.value);
|
||||
//HWD.pfnSetShader(0);
|
||||
|
||||
validcount++;
|
||||
|
||||
@@ -6447,26 +6444,24 @@ void HWR_Startup(void)
|
||||
HWR_InitMD2();
|
||||
|
||||
HWD.pfnSetupGLInfo();
|
||||
}
|
||||
|
||||
// jimita
|
||||
HWD.pfnKillShaders();
|
||||
if (!HWD.pfnLoadShaders())
|
||||
gr_shadersavailable = false;
|
||||
|
||||
HWR_SetShaderState();
|
||||
HWR_TogglePaletteRendering();
|
||||
|
||||
if (msaa)
|
||||
{
|
||||
if (a2c)
|
||||
HWD.pfnSetSpecialState(HWD_SET_MSAA, 2);
|
||||
else
|
||||
HWD.pfnSetSpecialState(HWD_SET_MSAA, 1);
|
||||
}
|
||||
}
|
||||
startupdone = true;
|
||||
|
||||
// jimita
|
||||
HWD.pfnKillShaders();
|
||||
if (!HWD.pfnLoadShaders())
|
||||
gr_shadersavailable = false;
|
||||
|
||||
HWR_SetShaderState();
|
||||
|
||||
HWR_TogglePaletteRendering();
|
||||
|
||||
if (msaa)
|
||||
{
|
||||
if (a2c)
|
||||
HWD.pfnSetSpecialState(HWD_SET_MSAA, 2);
|
||||
else
|
||||
HWD.pfnSetSpecialState(HWD_SET_MSAA, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@@ -3411,8 +3411,6 @@ EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD pol
|
||||
if (!surf)
|
||||
pglColor4ubv(white);
|
||||
|
||||
pglColor4ubv(white);
|
||||
|
||||
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
||||
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
@@ -72,11 +72,18 @@ typedef struct viddef_s
|
||||
#ifdef HWRENDER
|
||||
INT32/*fixed_t*/ fsmalldupx, fsmalldupy;
|
||||
INT32/*fixed_t*/ fmeddupx, fmeddupy;
|
||||
INT32 glstate;
|
||||
#endif
|
||||
} viddef_t;
|
||||
#define VIDWIDTH vid.width
|
||||
#define VIDHEIGHT vid.height
|
||||
|
||||
enum
|
||||
{
|
||||
VID_GL_LIBRARY_LOADED = 1,
|
||||
VID_GL_LIBRARY_ERROR = -1,
|
||||
};
|
||||
|
||||
// internal additional info for vesa modes only
|
||||
typedef struct
|
||||
{
|
||||
|
||||
+9
-7
@@ -1787,10 +1787,8 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
|
||||
flags |= SDL_WINDOW_BORDERLESS;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
if (vid.glstate == VID_GL_LIBRARY_LOADED)
|
||||
flags |= SDL_WINDOW_OPENGL;
|
||||
}
|
||||
|
||||
if (msaa)
|
||||
{
|
||||
@@ -1802,12 +1800,12 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
|
||||
// Some GPU drivers may give us a 16-bit depth buffer since the
|
||||
// default value for SDL_GL_DEPTH_SIZE is 16.
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||
#endif
|
||||
|
||||
|
||||
// request stencil buffer. If there are problems on weaker hw the bit count could be reduced
|
||||
// If only something like 1-bit or 2-bit stencil is available on some gpus then should implement limit for maxportals based on that.
|
||||
// 4 bits would be enough for current limit in maxportals (12)
|
||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 4);
|
||||
#endif
|
||||
|
||||
// Create a window
|
||||
window = SDL_CreateWindow("SRB2Kart "VERSIONSTRING, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
@@ -1821,7 +1819,8 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
|
||||
|
||||
// Renderer-specific stuff
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
if ((rendermode == render_opengl)
|
||||
&& (vid.glstate != VID_GL_LIBRARY_ERROR))
|
||||
{
|
||||
sdlglcontext = SDL_GL_CreateContext(window);
|
||||
if (sdlglcontext == NULL)
|
||||
@@ -2151,8 +2150,11 @@ void I_StartupGraphics(void)
|
||||
HWD.pfnClearLightTables = hwSym("ClearLightTables",NULL);
|
||||
HWD.pfnSetScreenPalette = hwSym("SetScreenPalette",NULL);
|
||||
|
||||
if (!HWD.pfnInit()) // load the OpenGL library
|
||||
vid.glstate = HWD.pfnInit() ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR; // let load the OpenGL library
|
||||
if (vid.glstate == VID_GL_LIBRARY_ERROR)
|
||||
{
|
||||
rendermode = render_soft;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user