mirror of
https://github.com/mpv-player/mpv
synced 2025-01-24 16:43:28 +00:00
vo_opengl: hardcode rquested GL version in backends
The requested version field didn't make much sense anymore, and was even partially ignored by some backends.
This commit is contained in:
parent
fa39dadb05
commit
bad932e8ed
@ -592,7 +592,6 @@ static MPGLContext *init_backend(struct vo *vo, const struct backend *backend,
|
||||
.gl = talloc_zero(ctx, GL),
|
||||
.vo = vo,
|
||||
.driver = backend->driver,
|
||||
.requested_gl_version = 300,
|
||||
};
|
||||
bool old_probing = vo->probing;
|
||||
vo->probing = probing; // hack; kill it once backends are separate
|
||||
|
@ -86,16 +86,12 @@ struct mpgl_driver {
|
||||
int priv_size;
|
||||
|
||||
// Init the GL context and possibly the underlying VO backend.
|
||||
// The created context should be compatible to GL 3.2 core profile, but
|
||||
// some other GL versions are supported as well (e.g. GL 2.1 or GLES 2).
|
||||
// Return 0 on success, negative value (-1) on error.
|
||||
int (*init)(struct MPGLContext *ctx, int vo_flags);
|
||||
|
||||
// Resize the window, or create a new window if there isn't one yet.
|
||||
// On the first call, it creates a GL context according to what's specified
|
||||
// in MPGLContext.requested_gl_version. This is just a hint, and if the
|
||||
// requested version is not available, it may return a completely different
|
||||
// GL context. (The caller must check if the created GL version is ok. The
|
||||
// callee must try to fall back to an older version if the requested
|
||||
// version is not available, and newer versions are incompatible.)
|
||||
// Currently, there is an unfortunate interaction with ctx->vo, and
|
||||
// display size etc. are determined by it.
|
||||
// Return 0 on success, negative value (-1) on error.
|
||||
@ -119,10 +115,6 @@ typedef struct MPGLContext {
|
||||
// Bit size of each component in the created framebuffer. 0 if unknown.
|
||||
int depth_r, depth_g, depth_b;
|
||||
|
||||
// GL version requested from config_window_gl3 backend (MPGL_VER mangled).
|
||||
// (Might be different from the actual version in gl->version.)
|
||||
int requested_gl_version;
|
||||
|
||||
// For free use by the mpgl_driver.
|
||||
void *priv;
|
||||
|
||||
@ -142,12 +134,7 @@ typedef struct MPGLContext {
|
||||
|
||||
|
||||
// Resize the window, or create a new window if there isn't one yet.
|
||||
// On the first call, it creates a GL context according to what's specified
|
||||
// in MPGLContext.requested_gl_version. This is just a hint, and if the
|
||||
// requested version is not available, it may return a completely different
|
||||
// GL context. (The caller must check if the created GL version is ok. The
|
||||
// callee must try to fall back to an older version if the requested
|
||||
// version is not available, and newer versions are incompatible.)
|
||||
// On the first call, it creates a GL context.
|
||||
bool (*config_window)(struct MPGLContext *ctx, int flags);
|
||||
|
||||
// Optional callback on the beginning of a frame. The frame will be finished
|
||||
|
@ -150,10 +150,9 @@ static bool create_context_w32_gl3(struct MPGLContext *ctx)
|
||||
if (!wglCreateContextAttribsARB)
|
||||
goto unsupported;
|
||||
|
||||
int gl_version = ctx->requested_gl_version;
|
||||
int attribs[] = {
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, MPGL_VER_GET_MAJOR(gl_version),
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, MPGL_VER_GET_MINOR(gl_version),
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 0,
|
||||
WGL_CONTEXT_FLAGS_ARB, 0,
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
0
|
||||
|
@ -89,8 +89,7 @@ static bool egl_create_context(struct vo_wayland_state *wl,
|
||||
MP_VERBOSE(wl, "EGL version %d.%d\n", major, minor);
|
||||
|
||||
EGLint context_attribs[] = {
|
||||
EGL_CONTEXT_MAJOR_VERSION_KHR,
|
||||
MPGL_VER_GET_MAJOR(ctx->requested_gl_version),
|
||||
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
|
@ -242,10 +242,9 @@ static bool config_window_x11(struct MPGLContext *ctx, int flags)
|
||||
|
||||
vo_x11_config_vo_window(vo, glx_ctx->vinfo, flags | VOFLAG_HIDDEN, "gl");
|
||||
|
||||
int gl_version = ctx->requested_gl_version;
|
||||
bool success = false;
|
||||
if (!(flags & VOFLAG_GLES)) {
|
||||
success = create_context_x11_gl3(ctx, flags, gl_version, false);
|
||||
success = create_context_x11_gl3(ctx, flags, 300, false);
|
||||
if (!success)
|
||||
success = create_context_x11_old(ctx);
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ static bool create_context_egl(MPGLContext *ctx, EGLConfig config,
|
||||
struct priv *p = ctx->priv;
|
||||
|
||||
EGLint context_attributes[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, // aka EGL_CONTEXT_MAJOR_VERSION_KHR
|
||||
es ? 2 : MPGL_VER_GET_MAJOR(ctx->requested_gl_version),
|
||||
// aka EGL_CONTEXT_MAJOR_VERSION_KHR
|
||||
EGL_CONTEXT_CLIENT_VERSION, es ? 2 : 3,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user