- initialize the GL backend in the proper place.

As long as there are still video mode switches this needs to be in the video mode switching function.
This commit is contained in:
Christoph Oelckers 2019-09-23 23:33:59 +02:00
parent a5441061e9
commit ad4527c8be
6 changed files with 17 additions and 4 deletions

View file

@ -67,7 +67,6 @@ bool glsurface_initialize(vec2_t bufferResolution)
bufferTexture = GLInterface.NewTexture();
bufferTexture->CreateTexture(bufferRes.x, bufferRes.y, true, false);
GLInterface.Init();
glsurface_setPalette(curpalettefaded);
const char* const VERTEX_SHADER_CODE =

View file

@ -794,8 +794,6 @@ void polymost_glinit()
//glEnable(GL_LINE_SMOOTH);
globalflags |= GLOBAL_NO_GL_TILESHADES; // This re-enables the old fading logic without re-adding the r_usetileshades variable. The entire thing will have to be done on a more abstract level anyway.
GLInterface.Init();
GLInterface.mSamplers->SetTextureFilterMode(gltexfiltermode, glanisotropy);
#ifdef USE_GLEXT

View file

@ -17,6 +17,7 @@
#include "sdl_inc.h"
#include "softsurface.h"
#include "m_argv.h"
#include "../../glbackend/glbackend.h"
#ifdef USE_OPENGL
# include "glad/glad.h"
@ -569,11 +570,13 @@ int32_t videoSetVsync(int32_t newSync)
else
#endif
{
/*
vsync_renderlayer = newSync;
videoResetMode();
if (videoSetGameMode(fullscreen, xres, yres, bpp, upscalefactor))
OSD_Printf("restartvid: Reset failed...\n");
*/
}
return newSync;
@ -1395,6 +1398,11 @@ void sdlayer_setvideomode_opengl(void)
glinfo.dumped = 1;
bpp = oldbpp;
}
GLInterface.Deinit();
GLInterface.Init();
GLInterface.mSamplers->SetTextureFilterMode(gltexfiltermode, glanisotropy);
}
#endif // defined USE_OPENGL
@ -1508,10 +1516,15 @@ void setrefreshrate(void)
refreshfreq = error ? -1 : newmode.refresh_rate;
}
int called = 0;
int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs)
{
int32_t regrab = 0, ret;
if (called++)
{
assert(0);
}
ret = setvideomode_sdlcommon(&x, &y, c, fs, &regrab);
if (ret != 1)
{

View file

@ -75,7 +75,7 @@ FSamplerManager::~FSamplerManager()
void FSamplerManager::UnbindAll()
{
for (int i = 0; i < 8 /* fixme */; i++)
for (int i = 0; i < 16 /* fixme */; i++)
{
glBindSampler(i, 0);
}

View file

@ -25,6 +25,7 @@ class FSamplerManager
unsigned int mSamplers[NumSamplers];
void UnbindAll();
void CreateSamplers();
public:

View file

@ -2,6 +2,7 @@
#include "glad/glad.h"
#include "gl_samplers.h"
GLInstance GLInterface;
void GLInstance::Init()
@ -16,6 +17,7 @@ void GLInstance::Init()
void GLInstance::Deinit()
{
if (mSamplers) delete mSamplers;
mSamplers = nullptr;
}
std::pair<size_t, BaseVertex *> GLInstance::AllocVertices(size_t num)