On 9 September 2016 at 22:03, Axel Davy <axel.d...@ens.fr> wrote:
> I'm not sure calling queryImage with an unsupported attribute is legal, thus
> I think a small check doesn't hurt.
>
> It'd give
>
> if (offsets) {
>    offsets[0] = 0;
>    if (dri2_dpy->image->base.version >= 13) {
>       EGLint img_offset = 0;
>       bool ret = dri2_dpy->image->queryImage(dri2_img->dri_image,
>                                      __DRI_IMAGE_ATTRIB_OFFSET,
> &img_offset);
>       if (ret)
>          offsets[0] = img_offset;
>    }
> }
> return EGL_TRUE;
>
As said - with or w/o the version check things will be just fine.

> or alternatively, if you think not being able to give the offset indicates
> an error,
>
> if (offsets) {
>    offsets[0] = 0;
>    if (dri2_dpy->image->base.version >= 13) {
>       EGLint img_offset = 0;
>       bool ret = dri2_dpy->image->queryImage(dri2_img->dri_image,
>                                      __DRI_IMAGE_ATTRIB_OFFSET,
> &img_offset);
>       if (!ret)
>          return EGL_FALSE;
>       offsets[0] = img_offset;
>    }
> }
> return EGL_TRUE;
>
Unless you/Chuanbo/others volunteer to write/implement the query for
all the drivers, don't do this !!!
It will break as driver X uses a v13+ vfunc, yet does not handle the
offset query.

That said, queryImage() returns GLboolean - let's use that.

Thanks
Emil
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to