* This fixes the case where no context is current on the thread starting and
ending the frame capture, but also all existing contexts are current on other
threads and can't be temporarily used.
* Mostly moving includes from common headers to cpp where possible, and removing
includes of the whole thing where only enums or rdcstr etc are needed.
* If the application used an unsized format like GL_DEPTH_COMPONENT to create
the texture with glTexImage2DMultisample then that's legal, but if we promote
it to glTextureStorage2DMultisampleEXT for DSA we can't continue to use that
unsized format so we need to convert to sized by picking a sensible default.
* Since GL requires a concrete texture format, we create the textures as UINT
format, and then cast to the right view on display once we know.
* The cast requires a copy - ARB_texture_view isn't always supported and even
when they are they require immutable textures (ARB_texture_storage) which we
don't want to require either.
* Previously we had "Frame X" and "Start of Frame" hardcoded in the event
browser, and the end of frame was in many cases assumed to be a present call.
However with the in-application API this is not necessarily true.
* Presents are now serialised separately in all APIs and displayed wherever they
happen in the frame, and if there is no present at the end of the frame an
"End of Capture" marker is inserted. Similarly API-defined captures are not
given a potentially misleading frame number.
* Instead of the buffer/source texture tracking all the views of itself and
checking to see if it should be force-included because any of its views were
included, we instead track the underlying resource for each view or buffer
texture.
* This means if e.g. a view or buffer texture gets dirtied, we can propagate
that through to the underlying data store which needs to get dirtied so that
we can fetch its initial states.
* When we replace a shader in GL there are a few knock-ons: we need to replace
the programs that use this shader, and then from there we need to replace the
pipelines that use the program. We also need to beware of programs created
with glCreateShaderProgramv which refer to themselves as both a program and a
shader.
* Previously we'd look at the edited shader, then recurse and look at programs,
then recurse and look at pipelines. We'd try to remember which one replaced
which so we could undo it again.
* Now we just do this in subsequent passes since there is only a one-way
dependency: First replace the shader as needed, then update any programs and
either replace or remove replacement as needed, and finally update any
pipelines.
* On Vulkan and D3D12 it's simpler as we just have shaders -> pipelines but the
same principle applies.
* If they're autogenerated then unfortunately the locations in a shader can
change over edits depending on what the shader is doing. We need to remap
across this as well as composing that onto any capture-replay remapping.
* This is only lightly tested and may break heavily. It is disabled by default
and must be explicitly enabled.
* In particular this is only known to work for Wayland use at capture time.
Wayland on replay is still unsupported. Known issues include: EGL pbuffer
surfaces are not implemented on Wayland, Wayland cannot get window dimensions,
and there are hangs/failures with GL and vulkan presentation with Wayland.
* On GL this is purely informational, but on D3D11 and D3D12 we use this to
select the closest available adapter on replay, as we already do on Vulkan.
* Technically if you create a context with *CreateContextAttribsARB and don't
specify a profile mask at all, the spec says the value of the profile bit is
CORE_PROFILE_BIT. In practice this means drivers may or may not give you a
core or compatibility profile.
* However what we're really looking for here is the chance that the user code
will use only modern GL or will use deprecated functionality, and in that case
the high likelihood is if they omit the PROFILE_BIT entirely they are probably
unaware of it, rather than letting it set its default value.
* We can't rely on the driver's reflection, since name information might be
stripped and the driver is within its rights to not reflect anything even if
we have names. Similarly queries by names etc will not work.
* Also we can't try to change bindings that are immutable on SPIR-V shaders -
UBO/SSBO bindings, transform feedback varyings, attrib and fragdata locations.
* Programs can't mix and match SPIR-V and GLSL, so when including our own
shaders in the overlay program make sure they match what the user's shaders
are.
* For mesh output, we need to patch the SPIR-V if it's a SPIR-V shader instead
of trying to use the GL XFB varyings set.
* We don't want to have glslang specific bits mixed in with general SPIR-V bits.
This is also preparing for moving some SPIR-V structs into common code that
can be re-used in new reflection/disassembly as well as editing.
* Now that the dirty list is only read once at the start of the frame we can
mark resources dirty mid-frame freely and don't have to defer that. The
internal resource manager locking prevents us from adding to the list while it
is being modified.
* Instead of passing the resource handle itself to GetSize_InitialState or
Serialise_InitialState, we pass the Id, ResourceRecord, and prepared initial
contents. All of these can survive past the destruction of the resource.
* Removes the need for AllowDeletedResource_InitialState() - it's always allowed
now.
* Need_InitialStateChunk is also refactored but it's only used on D3D11
currently and potentially will be removed in future.
* This was used for two things:
- UAVs on D3D11, which we can just mark dirty at creation as we do
with things on D3D12/Vulkan where we know we'll always want initial
states.
- Texture views/Texture buffers on GL, where we check if the texture
was referenced and force initial states for the underlying data
store. This requires a bit more work but can still be achieved by a
GL-specific force-inclusion pass on the frame references.