* The reason being that the actual recorded events are interleaved with
others (either on the queue or the cmd buffer), so we have to skip
over those. The events are duplicated where they are inserted by EID
and refer to the original offsets.
* Any uses of this for replaying subsections of the frame are to be
implemented under the replay driver level, as it's too onerous to
require that the replay driver be able to replay arbitrary subsections
or to communicate granularity up to the above layer.
* For non-image mappings (image opaque and buffer) we unbind the whole
resource then bind the initial mapping. This means two batches though
so needs to be synchronised.
* For those types that I think it's valid for them to be duplicated, we
look up if an existing wrapper is present and if so use that - and
just use ReplaceResource.
* If it turns out some other types are duplicated, the handling can be
added easily.
* If we don't add objects into the real->wrapper map, then duplicate
objects returned from the driver are fine. We will naturally create a
unique handle for each and we don't have to worry about clashes, as
the application will see each unique handle and free them separately
since it's not allowed to *rely* on duplicate handles. Then when they
destroy the unique handles, we'll end up destroying the duplicates
multiple times.
* Particularly using the offsets gained from GetImageSubresourceLayout
could cause problems, so instead we pack the slices and mips into the
buffer ourselves just using the per-subresource size.
* When the final header is ready we'll roll it into the source directly
rather than assuming the SDK is installed anywhere, and apply a local
change to get type-safety on 32-bit (which only works on C++). Similar
to the GL header's modification for a typed GLenum.
* I'm not entirely convinced this validation is correct, but this is
being conservative by adding more access bits (I ignore the message
that complains about extra bits being set). Worst case, more access
bits are set than necessary and the barriers are overly strict.