Refactor shader editing to more reliable approach

* 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.
This commit is contained in:
baldurk
2019-09-05 20:36:12 +01:00
parent 9627332667
commit 190cba427c
9 changed files with 499 additions and 371 deletions
@@ -30,6 +30,7 @@
GPUAddressRangeTracker WrappedID3D12Resource1::m_Addresses;
std::map<ResourceId, WrappedID3D12Resource1 *> *WrappedID3D12Resource1::m_List = NULL;
std::vector<WrappedID3D12PipelineState *> *WrappedID3D12PipelineState::m_List = NULL;
std::map<WrappedID3D12PipelineState::DXBCKey, WrappedID3D12Shader *> WrappedID3D12Shader::m_Shaders;
bool WrappedID3D12Shader::m_InternalResources = false;