d3d12: Set command heap only when necessary.

This commit is contained in:
Vincent Lejeune 2015-12-28 22:39:12 +01:00
parent 404b15b3c3
commit 8417e21e8d
3 changed files with 14 additions and 6 deletions

View File

@ -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())

View File

@ -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)

View File

@ -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())