Skip to content

Commit

Permalink
Add "bind_descriptor_tables" event when D3D12 root signature is chang…
Browse files Browse the repository at this point in the history
…ed again

This reverts commit bc928d6, as applications may do things like "Set*RootSignature" -> "SetPipelineState" -> "Set*RootDescriptorTable" and without this event an add-on attempting to save and restore state in the "SetPipelineState" call would overwrite the root signature to a previous value
  • Loading branch information
crosire committed Oct 6, 2023
1 parent 5018887 commit cb14da4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions source/d3d12/d3d12_command_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,30 @@ void STDMETHODCALLTYPE D3D12GraphicsCommandList::SetComputeRootSignature(ID3D12R
_orig->SetComputeRootSignature(pRootSignature);

_current_root_signature[1] = pRootSignature;

#if RESHADE_ADDON >= 2
reshade::invoke_addon_event<reshade::addon_event::bind_descriptor_tables>(
this,
reshade::api::shader_stage::all_compute,
to_handle(_current_root_signature[1]),
0,
0, nullptr);
#endif
}
void STDMETHODCALLTYPE D3D12GraphicsCommandList::SetGraphicsRootSignature(ID3D12RootSignature *pRootSignature)
{
_orig->SetGraphicsRootSignature(pRootSignature);

_current_root_signature[0] = pRootSignature;

#if RESHADE_ADDON >= 2
reshade::invoke_addon_event<reshade::addon_event::bind_descriptor_tables>(
this,
reshade::api::shader_stage::all_graphics,
to_handle(_current_root_signature[0]),
0,
0, nullptr);
#endif
}
void STDMETHODCALLTYPE D3D12GraphicsCommandList::SetComputeRootDescriptorTable(UINT RootParameterIndex, D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor)
{
Expand Down

0 comments on commit cb14da4

Please sign in to comment.