Commit c9664a24 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

GLX: drop support for GLX version 1.2

This is useless as we require OpenGL 1.4.
parent 9fc6fc4b
......@@ -68,7 +68,6 @@ struct vout_display_sys_t
xcb_window_t window; /* drawable X window */
xcb_window_t glwin; /* GLX window */
bool visible; /* whether to draw */
bool v1_3; /* whether GLX >= 1.3 is available */
GLXContext ctx;
vlc_gl_t gl;
......@@ -151,7 +150,7 @@ FindWindow (vout_display_t *vd, xcb_connection_t *conn,
return screen;
}
static bool CheckGLX (vout_display_t *vd, Display *dpy, bool *restrict pv13)
static bool CheckGLX (vout_display_t *vd, Display *dpy)
{
int major, minor;
bool ok = false;
......@@ -162,13 +161,12 @@ static bool CheckGLX (vout_display_t *vd, Display *dpy, bool *restrict pv13)
if (major != 1)
msg_Dbg (vd, "GLX extension version %d.%d unknown", major, minor);
else
if (minor < 2)
if (minor < 3)
msg_Dbg (vd, "GLX extension version %d.%d too old", major, minor);
else
{
msg_Dbg (vd, "using GLX extension version %d.%d", major, minor);
ok = true;
*pv13 = minor >= 3;
}
return ok;
}
......@@ -246,7 +244,7 @@ static int Open (vlc_object_t *obj)
sys->conn = conn;
sys->ctx = NULL;
if (!CheckGLX (vd, dpy, &sys->v1_3))
if (!CheckGLX (vd, dpy))
goto error;
RegisterMouseEvents (obj, conn, sys->embed->handle.xid);
......@@ -263,8 +261,6 @@ static int Open (vlc_object_t *obj)
sys->window = xcb_generate_id (conn);
/* Determine our pixel format */
if (sys->v1_3)
{ /* GLX 1.3 */
static const int attr[] = {
GLX_RED_SIZE, 5,
GLX_GREEN_SIZE, 5,
......@@ -272,12 +268,12 @@ static int Open (vlc_object_t *obj)
GLX_DOUBLEBUFFER, True,
GLX_X_RENDERABLE, True,
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
None };
None
};
xcb_get_window_attributes_reply_t *wa =
xcb_get_window_attributes_reply (conn,
xcb_get_window_attributes (conn, sys->embed->handle.xid),
NULL);
xcb_get_window_attributes (conn, sys->embed->handle.xid), NULL);
if (wa == NULL)
goto error;
xcb_visualid_t visual = wa->visual;
......@@ -324,8 +320,7 @@ static int Open (vlc_object_t *obj)
}
/* Create an OpenGL context */
sys->ctx = glXCreateNewContext (dpy, conf, GLX_RGBA_TYPE, NULL,
True);
sys->ctx = glXCreateNewContext (dpy, conf, GLX_RGBA_TYPE, NULL, True);
if (sys->ctx == NULL)
{
msg_Err (vd, "cannot create GLX context");
......@@ -334,38 +329,6 @@ static int Open (vlc_object_t *obj)
if (!glXMakeContextCurrent (dpy, sys->glwin, sys->glwin, sys->ctx))
goto error;
}
else
{ /* GLX 1.2 */
int attr[] = {
GLX_RGBA,
GLX_RED_SIZE, 5,
GLX_GREEN_SIZE, 5,
GLX_BLUE_SIZE, 5,
GLX_DOUBLEBUFFER,
None };
XVisualInfo *vi = glXChooseVisual (dpy, snum, attr);
if (vi == NULL)
{
msg_Err (vd, "cannot find GLX 1.2 visual" );
goto error;
}
msg_Dbg (vd, "using GLX visual ID 0x%"PRIx32, (uint32_t)vi->visualid);
if (CreateWindow (vd, conn, depth, 0 /* ??? */, width, height) == 0)
sys->ctx = glXCreateContext (dpy, vi, 0, True);
XFree (vi);
if (sys->ctx == NULL)
{
msg_Err (vd, "cannot create GLX context");
goto error;
}
if (glXMakeCurrent (dpy, sys->window, sys->ctx) == False)
goto error;
sys->glwin = sys->window;
}
const char *glx_extensions = glXQueryExtensionsString (dpy, snum);
......@@ -450,12 +413,8 @@ static void Close (vlc_object_t *obj)
if (sys->ctx != NULL)
{
if (sys->v1_3)
glXMakeContextCurrent (dpy, None, None, NULL);
else
glXMakeCurrent (dpy, None, NULL);
glXDestroyContext (dpy, sys->ctx);
if (sys->v1_3)
glXDestroyWindow (dpy, sys->glwin);
}
XCloseDisplay (dpy);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment