On Mon, 2018-08-13 at 16:32 -0700, Kristian Høgsberg wrote:
> On Mon, Aug 13, 2018 at 3:53 AM Emil Velikov <[email protected]> wrote:
> > 
> > So if I understood you correctly [and the spec] there is no
> > requirement (nor ban) on rendering to pbuffers from X11.
> > It's an implementation decision to allow it.
> 
> You can't render to the underlying pixmaps, since the drawable ID is
> internal to the GLX implementation.

This might be a desirable property, but it's not what xserver
implements. req->pbuffer is the last argument (glxDrawableId) to
DoCreatePbuffer, which has:

    /* Assign the pixmap the same id as the pbuffer and add it as a
     * resource so it and the DRI2 drawable will be reclaimed when the
     * pbuffer is destroyed. */
    pPixmap->drawable.id = glxDrawableId;
    if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap))
        return BadAlloc;

See obviously bogus demo (attached), which succeeds instead of throwing
BadPixmap.

- ajax
#include <X11/Xlib.h>
#include <GL/glx.h>

int main(void) {
    Display *dpy;
    GLXFBConfig *cfg;
    GLXPbuffer pb;
    int junk;
    const int cfg_attr[] = {
        GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
        None,
    };
    const int pb_attr[] = {
        GLX_PBUFFER_WIDTH, 32,
        GLX_PBUFFER_HEIGHT, 32,
        None,
    };

    dpy = XOpenDisplay(NULL);
    cfg = glXChooseFBConfig(dpy, 0, cfg_attr, &junk);
    pb = glXCreatePbuffer(dpy, *cfg, pb_attr);

    XFreePixmap(dpy, pb);
    XSync(dpy, 0);

    XCloseDisplay(dpy);
    return 0;
}
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to