all: warn on unsafe-op-in-unsafe-fn
This commit is contained in:
parent
ce7488aa86
commit
73a6e0d5c2
25 changed files with 435 additions and 340 deletions
|
|
@ -76,24 +76,30 @@ impl EglContext {
|
|||
&self,
|
||||
f: F,
|
||||
) -> Result<T, RenderError> {
|
||||
if (self.dpy.egl.eglMakeCurrent)(
|
||||
self.dpy.dpy,
|
||||
EGLSurface::none(),
|
||||
EGLSurface::none(),
|
||||
self.ctx,
|
||||
) == EGL_FALSE
|
||||
{
|
||||
return Err(RenderError::MakeCurrent);
|
||||
unsafe {
|
||||
if (self.dpy.egl.eglMakeCurrent)(
|
||||
self.dpy.dpy,
|
||||
EGLSurface::none(),
|
||||
EGLSurface::none(),
|
||||
self.ctx,
|
||||
) == EGL_FALSE
|
||||
{
|
||||
return Err(RenderError::MakeCurrent);
|
||||
}
|
||||
let prev = CURRENT.get();
|
||||
CURRENT.set(self.ctx);
|
||||
let res = f();
|
||||
if (self.dpy.egl.eglMakeCurrent)(
|
||||
self.dpy.dpy,
|
||||
EGLSurface::none(),
|
||||
EGLSurface::none(),
|
||||
prev,
|
||||
) == EGL_FALSE
|
||||
{
|
||||
panic!("Could not restore EGLContext");
|
||||
}
|
||||
CURRENT.set(prev);
|
||||
res
|
||||
}
|
||||
let prev = CURRENT.get();
|
||||
CURRENT.set(self.ctx);
|
||||
let res = f();
|
||||
if (self.dpy.egl.eglMakeCurrent)(self.dpy.dpy, EGLSurface::none(), EGLSurface::none(), prev)
|
||||
== EGL_FALSE
|
||||
{
|
||||
panic!("Could not restore EGLContext");
|
||||
}
|
||||
CURRENT.set(prev);
|
||||
res
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue