Skip to content
  • Adam Jackson's avatar
    glx: Demand success from CreateContext requests (v2) · 16f10230
    Adam Jackson authored
    
    
    GLXCreate{,New}Context, like most X resource creation requests, does not
    emit a reply and therefore is emitted into the X stream asynchronously.
    However, unlike most resource creation requests, the GLXContext we
    return is a handle to library state instead of an XID. So if context
    creation fails for any reason - say, the server doesn't support indirect
    contexts - then we will fail in strange places for strange reasons.
    
    We could make every GLX entrypoint robust against half-created contexts,
    or we could just verify that context creation worked. Reuse the
    __glXIsDirect code to do this, as a cheap way of verifying that the
    XID is real.
    
    glXCreateContextAttribsARB solves this by using the _checked version of
    the xcb command, so effectively this change makes the classic context
    creation paths as robust as CreateContextAttribs.
    
    v2: Better use of Bool, check that error != NULL first (Olivier Fourdan)
    
    Signed-off-by: default avatarAdam Jackson <ajax@redhat.com>
    Reviewed-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
    16f10230