From 8417e21e8d496c13a30a1e300ff6b651947d0ede Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Mon, 28 Dec 2015 22:39:12 +0100 Subject: [PATCH] d3d12: Set command heap only when necessary. --- rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp | 6 ------ rpcs3/Emu/RSX/D3D12/D3D12MemoryHelpers.cpp | 7 +++++++ rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp | 7 +++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index 488f35d058..034bac2027 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -301,12 +301,6 @@ void D3D12GSRender::end() { upload_and_bind_textures(get_current_resource_storage().command_list.Get(), currentDescriptorIndex + 3, std::get<2>(*m_current_pso) > 0); - ID3D12DescriptorHeap *descriptors[] = - { - get_current_resource_storage().descriptors_heap.Get(), - get_current_resource_storage().sampler_descriptor_heap[get_current_resource_storage().sampler_descriptors_heap_index].Get(), - }; - get_current_resource_storage().command_list->SetDescriptorHeaps(2, descriptors); get_current_resource_storage().command_list->SetGraphicsRootDescriptorTable(0, CD3DX12_GPU_DESCRIPTOR_HANDLE(get_current_resource_storage().descriptors_heap->GetGPUDescriptorHandleForHeapStart()) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12MemoryHelpers.cpp b/rpcs3/Emu/RSX/D3D12/D3D12MemoryHelpers.cpp index a85bc8fb58..a07e09fd73 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12MemoryHelpers.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12MemoryHelpers.cpp @@ -85,6 +85,13 @@ void resource_storage::reset() void resource_storage::set_new_command_list() { CHECK_HRESULT(command_list->Reset(command_allocator.Get(), nullptr)); + + ID3D12DescriptorHeap *descriptors[] = + { + descriptors_heap.Get(), + sampler_descriptor_heap[sampler_descriptors_heap_index].Get(), + }; + command_list->SetDescriptorHeaps(2, descriptors); } void resource_storage::init(ID3D12Device *device) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp index 7a8d55eddd..09eb91b5ac 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp @@ -335,6 +335,13 @@ void D3D12GSRender::upload_and_bind_textures(ID3D12GraphicsCommandList *command_ { get_current_resource_storage().sampler_descriptors_heap_index = 1; get_current_resource_storage().current_sampler_index = 0; + + ID3D12DescriptorHeap *descriptors[] = + { + get_current_resource_storage().descriptors_heap.Get(), + get_current_resource_storage().sampler_descriptor_heap[get_current_resource_storage().sampler_descriptors_heap_index].Get(), + }; + command_list->SetDescriptorHeaps(2, descriptors); } m_device->CreateSampler(&get_sampler_desc(textures[i]), CD3DX12_CPU_DESCRIPTOR_HANDLE(get_current_resource_storage().sampler_descriptor_heap[get_current_resource_storage().sampler_descriptors_heap_index]->GetCPUDescriptorHandleForHeapStart())