• Zhiyi Zhang's avatar
    winemac.drv: Update OpenGL context immediately after the window content view is visible. · ceefcca7
    Zhiyi Zhang authored
    Fix errors such as GL_FRAMEBUFFER_UNDEFINED and GL_INVALID_FRAMEBUFFER_OPERATION for OpenGL
    functions when the default framebuffer 0 is bound on macOS.
    
    These errors happen because the NSOpenGLContext doesn't have a view bound at the time of an
    OpenGL call. The view could not be set for the NSOpenGLContext because the window or view can
    still be invisible. Setting an invisible view for the NSOpenGLContext can generate invalid
    drawable messages as 682ed910 has shown. Thus setting the view could be deferred because
    the NSOpenGLContext needs a visible view.
    
    However, right after the window becomes visible, an OpenGL function that involves the default
    framebuffer can be called. And when the view is still not set at the time of the OpenGL call,
    errors such as GL_FRAMEBUFFER_UNDEFINED and GL_INVALID_FRAMEBUFFER_OPERATION could happen and
    result in rendering errors such as black screen. So we need to set the view for the NSOpenGLContext
    as soon as the view becomes visible.
    
    It's possible that the window and view are still invisible when OpenGL functions involving the
    default framebuffer get called. In such cases, I think errors like GL_FRAMEBUFFER_UNDEFINED are
    justified on macOS.
    
    Fix Active Trader Pro black screen at launch on macOS. The application creates a d3d9 device with
    an invisible window. And then it shows the window before calling d3d9_swapchain_Present(). So all
    the [NSOpenGLContext setView] opportunities are missed and no view is set. Then when glBlitFramebuffer()
    gets called, GL_FRAMEBUFFER_UNDEFINED happens and so nothing is rendered. The application only
    renders one frame before login so the window remains black.
    ceefcca7
Name
Last commit
Last update
..
.gitattributes Loading commit data...
Makefile.in Loading commit data...
clipboard.c Loading commit data...
cocoa_app.h Loading commit data...
cocoa_app.m Loading commit data...
cocoa_clipboard.m Loading commit data...
cocoa_cursorclipping.h Loading commit data...
cocoa_cursorclipping.m Loading commit data...
cocoa_display.m Loading commit data...
cocoa_event.h Loading commit data...
cocoa_event.m Loading commit data...
cocoa_main.m Loading commit data...
cocoa_opengl.h Loading commit data...
cocoa_opengl.m Loading commit data...
cocoa_status_item.m Loading commit data...
cocoa_window.h Loading commit data...
cocoa_window.m Loading commit data...
display.c Loading commit data...
dllmain.c Loading commit data...
dragdrop.c Loading commit data...
event.c Loading commit data...
gdi.c Loading commit data...
image.c Loading commit data...
keyboard.c Loading commit data...
macdrv.h Loading commit data...
macdrv_cocoa.h Loading commit data...
macdrv_dll.h Loading commit data...
macdrv_main.c Loading commit data...
macdrv_res.h Loading commit data...
mouse.c Loading commit data...
opengl.c Loading commit data...
surface.c Loading commit data...
systray.c Loading commit data...
unixlib.h Loading commit data...
vulkan.c Loading commit data...
window.c Loading commit data...
winemac.drv.spec Loading commit data...
winemac.rc Loading commit data...