If we are discarding the whole resource in a synchronized way, we don't care about previous contents, and the resource storage is now unused, either because we have created new resource storage, or because we have waited for the existing resource storage to become unused. This commit marks the storage as uninitialized in the latter case but only if the resource is not host writable (in which case we can't clear the valid range, since that would result in missed readbacks in future transfers). The former case is already covered by our reallocation/rebinding code.
Essentially this changes allow us to infer the UNSYNCHRONIZED and INVALIDATE_RANGE flag for subsequent maps after a buffer invalidation, even if the invalidation didn't involve a reallocation.
Signed-off-by: Alexandros Frantzis email@example.com