mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-03 14:09:33 +03:00
Set swap interval explicitly.
The swap interval can be changed independent of the Surface config. Thus it makes more sense to set it explicitly in test setup. This simplifies the test config. Also updates some of the API for GLWindowBase. Return an explicit error from makeCurrent. Bug: angleproject:3393 Change-Id: Ic62b33018e872bc0e38f2848e2427ed898b60749 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1574672 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
@@ -116,7 +116,10 @@ bool WGLWindow::initializeGL(OSWindow *osWindow,
|
||||
return false;
|
||||
}
|
||||
|
||||
makeCurrent();
|
||||
if (!makeCurrent())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reload entry points to capture extensions.
|
||||
angle::LoadWGL(GetProcAddressWithFallback);
|
||||
@@ -164,21 +167,9 @@ bool WGLWindow::initializeGL(OSWindow *osWindow,
|
||||
return false;
|
||||
}
|
||||
|
||||
makeCurrent();
|
||||
|
||||
if (mConfigParams.swapInterval != -1)
|
||||
if (!makeCurrent())
|
||||
{
|
||||
if (_wglSwapIntervalEXT)
|
||||
{
|
||||
if (_wglSwapIntervalEXT(mConfigParams.swapInterval) == FALSE)
|
||||
{
|
||||
std::cerr << "Error setting swap interval." << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error setting swap interval." << std::endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
angle::LoadGLES(GetProcAddressWithFallback);
|
||||
@@ -205,19 +196,32 @@ bool WGLWindow::isGLInitialized() const
|
||||
return mWGLContext != nullptr;
|
||||
}
|
||||
|
||||
void WGLWindow::makeCurrent()
|
||||
bool WGLWindow::makeCurrent()
|
||||
{
|
||||
if (_wglMakeCurrent(mDeviceContext, mWGLContext) == FALSE)
|
||||
{
|
||||
std::cerr << "Error during wglMakeCurrent." << std::endl;
|
||||
std::cerr << "Error during wglMakeCurrent.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WGLWindow::setSwapInterval(EGLint swapInterval)
|
||||
{
|
||||
if (!_wglSwapIntervalEXT || _wglSwapIntervalEXT(swapInterval) == FALSE)
|
||||
{
|
||||
std::cerr << "Error during wglSwapIntervalEXT.\n";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void WGLWindow::swap()
|
||||
{
|
||||
if (SwapBuffers(mDeviceContext) == FALSE)
|
||||
{
|
||||
std::cerr << "Error during SwapBuffers." << std::endl;
|
||||
std::cerr << "Error during SwapBuffers.\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user