Fix validating the current context on eglSwapInterval.

Change-Id: I7f62eae32d2122ec14f400841eaefa3712cf582d
Reviewed-on: https://swiftshader-review.googlesource.com/5291
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/libEGL/libEGL.cpp b/src/OpenGL/libEGL/libEGL.cpp
index e54c60f..b626562 100644
--- a/src/OpenGL/libEGL/libEGL.cpp
+++ b/src/OpenGL/libEGL/libEGL.cpp
@@ -565,7 +565,7 @@
 		return error(EGL_BAD_MATCH, EGL_FALSE);

 	}

 

-	egl::Context *context = static_cast<egl::Context*>(egl::getCurrentContext());

+	egl::Context *context = egl::getCurrentContext();

 

 	if(context)

 	{

@@ -617,15 +617,16 @@
 	TRACE("(EGLDisplay dpy = %p, EGLint interval = %d)", dpy, interval);

 

 	egl::Display *display = egl::Display::get(dpy);

+	egl::Context *context = egl::getCurrentContext();

 

-	if(!validateDisplay(display))

+	if(!validateContext(display, context))

 	{

 		return EGL_FALSE;

 	}

 

 	egl::Surface *draw_surface = static_cast<egl::Surface*>(egl::getCurrentDrawSurface());

 

-	if(draw_surface == NULL)

+	if(!draw_surface)

 	{

 		return error(EGL_BAD_SURFACE, EGL_FALSE);

 	}

@@ -1038,7 +1039,7 @@
 		return error(EGL_BAD_ATTRIBUTE, EGL_NO_SYNC_KHR);

 	}

 

-	egl::Context *context = static_cast<egl::Context*>(egl::getCurrentContext());

+	egl::Context *context = egl::getCurrentContext();

 

 	if(!validateContext(display, context))

 	{