vrend: Check whether certain resources are backed by an OpenGL resources
First rename id
to gl_id
to make sure what kind of ID we have in the resource.
This makes it also clearer that a value of 0 means that a resource is not backed
by a GL resource.
With that, consider that it is possible to create a resource with PIPE_BIND_CUSTOM and this this case they are only backed by host memory, but not by and OpenGL resource. Trying to bind such a resource may later lead to crashes, because the host OpenGL implementation will assume that data is not provided by a GL resource and will interpret the value that is an offset into the GL resource as a host pointer. Make sure that we don't try to use a resource created with PIPE_BIND_CUSTOM in these cases.
Closes: https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/494