mirror of https://github.com/mpv-player/mpv
egl_helpers: mpegl_cb can now signal an error condition
This can be used by client code that needs to fail when it cannot find a suitable EGLConfig.
This commit is contained in:
parent
4d6601924a
commit
bb07b22d42
|
@ -108,6 +108,11 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display,
|
|||
int chosen = 0;
|
||||
if (cb.refine_config)
|
||||
chosen = cb.refine_config(cb.user_data, configs, num_configs);
|
||||
if (chosen < 0) {
|
||||
talloc_free(configs);
|
||||
MP_MSG(ctx, msgl, "Could not choose EGLConfig!\n");
|
||||
return false;
|
||||
}
|
||||
EGLConfig config = configs[chosen];
|
||||
|
||||
talloc_free(configs);
|
||||
|
|
|
@ -15,7 +15,9 @@ bool mpegl_create_context(struct ra_ctx *ctx, EGLDisplay display,
|
|||
|
||||
struct mpegl_cb {
|
||||
// if set, pick the desired config from the given list and return its index
|
||||
// defaults to 0 (they are sorted by eglChooseConfig)
|
||||
// defaults to 0 (they are sorted by eglChooseConfig). return a negative
|
||||
// number to indicate an error condition or that no suitable configs could
|
||||
// be found.
|
||||
int (*refine_config)(void *user_data, EGLConfig *configs, int num_configs);
|
||||
void *user_data;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue