* In principle the fake SV_ inputs should be able to come in any order, but it
seems if SV_IsFrontFace is last it can get undefined/wrong results (e.g.
returning 1 when front-face culling is enabled or vice-versa). Moving it to
the first seems to fix the issue, and at least shouldn't make anything any
worse.
* This is mostly relevant for D3D12, where the desc comes from the user and so
may not be normalised and contain values like 0xffffffff to indicate 'all
mips' or 'all slices' in the view.
* Previously we would only process ranges we were interested in when looking for
a descriptor, but we need to process all ranges in a table to properly track
the offset for APPEND.
* This works around an obtuse GL requirement that explicit locations on one side
will cause a break in compatibility with the other side, even if dropping the
location would work otherwise.
* Doing this lets us more consistently reference the color attachments in the
correct indices and makes it easier to match for blends. It also allows the
user to show unused/empty attachments
* On APIs like OpenGL texture formats (like vertex buffer formats) can be
tightly packed even in cases that apparently are otherwise not allowed - e.g.
with fake RGB formats where the stride looks misaligned due to alpha being
hidden.
* This prevents a use-after-free issue when pointers are stored and the backing
storage is deallocated, if the function is entered again we try to get the
previous value to show a variable change an dereference it.
* We only need to force on actual D3D12 resources (buffers and textures) -
enabling the Ref All Resources also would include all pipelines and other
objects which do not need to be included and could be quite wasteful.
* If a resource has usage indicating it's used for any kind of direct
modifications (copies, resolves, rendering, CPU writes) then we know it's
modified. Any resource which has UAV capability may also be modified - since
we don't necessarily track all bindings for bindless, and SM6.6 blows that up.
But any resource that can't be a UAV can only be modified in ways we detect
directly.
* This is a short-term fix, to improve re-applying redundant data to read-only
resources. long term we need to rethink how initial states are handled since
on vulkan and D3D12 initial states are no longer strongly correlated with
resources that need to be reset every replay.