Skip to content

Commit af53811

Browse files
Removed misplaced context == EGL_NO_CONTEXT check in EAGL driver implementation.
Added explicit check/skip for case eglMakeCurrent(aDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT). Fixed EGL_BAD_CONTEXT unit test when context is invalid and surfaces are valid.
1 parent cfc39ab commit af53811

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

README-Dev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ TODO Bug Priority List:
44
- [self setupVideoFrameIntervalUpdates:0]; -> Sample1[85592:3303] *** -[__EAGLSurface setupVideoFrameIntervalUpdates:]: message sent to deallocated instance 0x8bab670
55
- Memory Leak: App starts with 8.5Mb without EGL. Running the demo consumes more 16Mb. When the demo stops, the memory consumption is higher than 8.5Mb
66
- eglMakeCurrent(EGLDisplay dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) -> impact on ressource count
7+
-- are FB/CB etc clear ??? Should they ?
78
- contentScaleFactor == 1 ? IN EAGL_eglCreateWindowSurface
89

910

src/EGL/drivers/eagl/egl_eagl.m

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,7 @@ static EGLBoolean _checkSurfaceAttribMatchConfigAttrib(_EGLSurface* surf, _EGLCo
281281
EGLBoolean ret = EGL_FALSE;
282282

283283
_EGL_CHECK_CONTEXTLOST(disp, EAGL_ctx, EGL_FALSE);
284-
285-
if (!ctx) {
286-
_eglError(EGL_BAD_CONTEXT, "eglMakeCurrent");
287-
return EGL_FALSE;
288-
}
289-
284+
290285
/* make new bindings */
291286
if (!_eglBindContext(ctx, dsurf, rsurf, &old_ctx, &old_dsurf, &old_rsurf)) {
292287
// TODO: Anything to do here ?

src/EGL/eglapi.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,11 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
483483

484484
if (!context && ctx != EGL_NO_CONTEXT)
485485
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
486-
if (!draw_surf || !read_surf) {
486+
if (draw_surf == EGL_NO_SURFACE && read_surf == EGL_NO_SURFACE &&
487+
context == EGL_NO_CONTEXT) {
488+
/* release the current context without assigning a new one */
489+
}
490+
else if (!draw_surf || !read_surf) {
487491
/* surfaces may be NULL if surfaceless */
488492
if (!disp->Extensions.KHR_surfaceless_context)
489493
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);

test/include/eglMakeCurrentTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void eglMakeCurrent_6(TestPlatform* p) {
116116
//If ctx is not a valid context, an EGL_BAD_CONTEXT error is generated.
117117
EGLSurface surf;
118118
EGLDisplay dpy;
119-
EGLContext ctx = NULL;
119+
EGLContext ctx = 0x1;
120120
EGLint cattrib_list[5] = {EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
121121
EGL_RED_SIZE, 1,
122122
EGL_NONE};

0 commit comments

Comments
 (0)