mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
This commit is contained in:
commit
c8d0a478d8
4 changed files with 34 additions and 9 deletions
|
@ -176,12 +176,12 @@ void GLPortal::DrawPortalStencil()
|
|||
bool GLPortal::Start(bool usestencil, bool doquery)
|
||||
{
|
||||
rendered_portals++;
|
||||
PortalAll.Clock();
|
||||
// PortalAll.Clock();
|
||||
if (usestencil)
|
||||
{
|
||||
if (!gl_portals)
|
||||
{
|
||||
PortalAll.Unclock();
|
||||
// PortalAll.Unclock();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
|||
GLRenderer->mCurrentPortal = this;
|
||||
|
||||
if (PrevPortal != NULL) PrevPortal->PushState();
|
||||
PortalAll.Unclock();
|
||||
// PortalAll.Unclock();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -209,13 +209,13 @@ void OpenGLFrameBuffer::Swap()
|
|||
{
|
||||
Finish.Reset();
|
||||
Finish.Clock();
|
||||
glFinish();
|
||||
if (needsetgamma)
|
||||
{
|
||||
//DoSetGamma();
|
||||
needsetgamma = false;
|
||||
}
|
||||
SwapBuffers();
|
||||
glFinish();
|
||||
Finish.Unclock();
|
||||
swapped = true;
|
||||
FHardwareTexture::UnbindAll();
|
||||
|
|
|
@ -37,7 +37,9 @@ extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
|||
// these get used before GLEW is initialized so we have to use separate pointers with different names
|
||||
PFNWGLCHOOSEPIXELFORMATARBPROC myWglChoosePixelFormatARB; // = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
||||
PFNWGLCREATECONTEXTATTRIBSARBPROC myWglCreateContextAttribsARB;
|
||||
PFNWGLSWAPINTERVALEXTPROC vsyncfunc;
|
||||
PFNWGLSWAPINTERVALEXTPROC myWglSwapIntervalExtProc;
|
||||
|
||||
|
||||
|
||||
|
||||
CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
|
@ -934,10 +936,32 @@ Win32GLFrameBuffer::Win32GLFrameBuffer(void *hMonitor, int width, int height, in
|
|||
vid_renderer = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
vsyncfunc = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
|
||||
|
||||
HDC hDC = GetDC(Window);
|
||||
const char *wglext = nullptr;
|
||||
|
||||
myWglSwapIntervalExtProc = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
|
||||
auto myWglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||
if (myWglGetExtensionsStringARB)
|
||||
{
|
||||
wglext = myWglGetExtensionsStringARB(hDC);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto myWglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)wglGetProcAddress("wglGetExtensionsStringEXT");
|
||||
if (myWglGetExtensionsStringEXT)
|
||||
{
|
||||
wglext = myWglGetExtensionsStringEXT();
|
||||
}
|
||||
}
|
||||
SwapInterval = 1;
|
||||
if (wglext != nullptr)
|
||||
{
|
||||
if (strstr(wglext, "WGL_EXT_swap_control_tear"))
|
||||
{
|
||||
SwapInterval = -1;
|
||||
}
|
||||
}
|
||||
|
||||
m_supportsGamma = !!GetDeviceGammaRamp(hDC, (void *)m_origGamma);
|
||||
ReleaseDC(Window, hDC);
|
||||
}
|
||||
|
@ -1092,7 +1116,7 @@ void Win32GLFrameBuffer::ReleaseResources ()
|
|||
|
||||
void Win32GLFrameBuffer::SetVSync (bool vsync)
|
||||
{
|
||||
if (vsyncfunc != NULL) vsyncfunc(vsync ? 1 : 0);
|
||||
if (myWglSwapIntervalExtProc != NULL) myWglSwapIntervalExtProc(vsync ? SwapInterval : 0);
|
||||
}
|
||||
|
||||
void Win32GLFrameBuffer::SwapBuffers()
|
||||
|
|
|
@ -148,6 +148,7 @@ protected:
|
|||
int m_Lock;
|
||||
char m_displayDeviceNameBuffer[CCHDEVICENAME];
|
||||
char *m_displayDeviceName;
|
||||
int SwapInterval;
|
||||
|
||||
friend class Win32GLVideo;
|
||||
|
||||
|
|
Loading…
Reference in a new issue