int vrend_renderer_resource_unmap(struct pipe_resource *pres)
{
   struct vrend_resource *res = (struct vrend_resource *)pres;
   if (!has_bits(res->storage_bits, VREND_STORAGE_GL_BUFFER | VREND_STORAGE_GL_IMMUTABLE))
      return -EINVAL;

   glBindBufferARB(res->target, res->id);
   glUnmapBuffer(res->target);
   glBindBufferARB(res->target, 0);
   return 0;
}
int vrend_renderer_resource_unmap(struct pipe_resource *pres)
{
   struct vrend_resource *res = (struct vrend_resource *)pres;
   if (!has_bits(res->storage_bits, VREND_STORAGE_GL_BUFFER | VREND_STORAGE_GL_IMMUTABLE))
      return -EINVAL;

   glBindBufferARB(res->target, res->id);
   glUnmapBuffer(res->target);
   glBindBufferARB(res->target, 0);
   return 0;
}