Support resource invalidation for buffers. This ensures that we correctly handle unsynchronized access to buffers after an invalidation, and could provide performance benefits in scenarios that involve explicit invalidation.
While working on this I noticed that when we are invalidating buffer storage with glBufferData(NULL), if the driver doesn't support invalidation, mesa provides a fallback, in the form of reallocating buffer storage itself. However, a similar fallback is not provided for glInvalidateBufferData() calls. This means that unless a driver supports invalidation, the following is possibly broken:
glInvalidateBufferData(buf) glMapBufferRange(buf, UNSYNCHRONIZED)
This MR fixes this for virgl, but I have also started experimented with a fallback in mesa core here: https://gitlab.freedesktop.org/afrantzis/mesa/tree/mesa-invalidate-buffer-fallback
Signed-off-by: Alexandros Frantzis email@example.com