+ unsigned bind, pipe_usage, pipe_flags = 0;
+
+ if (size && data && st_obj->buffer &&
+ st_obj->Base.Size == size &&
+ st_obj->Base.Usage == usage &&
+ st_obj->Base.StorageFlags == storageFlags) {
+ /* Just discard the old contents and write new data.
+ * This should be the same as creating a new buffer, but we avoid
+ * a lot of validation in Mesa.
+ */
+ struct pipe_box box;
+
+ u_box_1d(0, size, &box);
+ pipe->transfer_inline_write(pipe, st_obj->buffer, 0,
+ PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE,
+ &box, data, 0, 0);
+ return GL_TRUE;
+ }