diff --git a/base/sources/backends/direct3d12_gpu.c b/base/sources/backends/direct3d12_gpu.c index 1f67a4fd..eaad4ee4 100644 --- a/base/sources/backends/direct3d12_gpu.c +++ b/base/sources/backends/direct3d12_gpu.c @@ -414,6 +414,9 @@ void gpu_init_internal(int depth_buffer_bits, bool vsync) { device->lpVtbl->CreateCommandAllocator(device, D3D12_COMMAND_LIST_TYPE_DIRECT, &IID_ID3D12CommandAllocator, &command_allocator); device->lpVtbl->CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT, command_allocator, NULL, &IID_ID3D12CommandList, &command_list); + + ID3D12DescriptorHeap *_heaps[] = {gpu_srv_heap, gpu_sampler_heap}; + command_list->lpVtbl->SetDescriptorHeaps(command_list, 2, _heaps); } void gpu_begin_internal(gpu_clear_t flags, unsigned color, float depth) { @@ -463,6 +466,9 @@ void gpu_execute_and_wait() { command_allocator->lpVtbl->Reset(command_allocator); command_list->lpVtbl->Reset(command_list, command_allocator, NULL); + ID3D12DescriptorHeap *_heaps[] = {gpu_srv_heap, gpu_sampler_heap}; + command_list->lpVtbl->SetDescriptorHeaps(command_list, 2, _heaps); + if (gpu_in_use) { command_list->lpVtbl->OMSetRenderTargets(command_list, current_render_targets_count, &target_descriptors[0], false, current_depth_handle); command_list->lpVtbl->SetPipelineState(command_list, current_pipeline->impl.pipeline); @@ -553,8 +559,6 @@ void gpu_internal_set_textures() { } } - ID3D12DescriptorHeap *heaps[] = {gpu_srv_heap, gpu_sampler_heap}; - command_list->lpVtbl->SetDescriptorHeaps(command_list, 2, heaps); command_list->lpVtbl->SetGraphicsRootDescriptorTable(command_list, 0, gpu_base); D3D12_GPU_DESCRIPTOR_HANDLE sampler_gpu_base; @@ -1829,4 +1833,7 @@ void gpu_raytrace_dispatch_rays() { command_list->lpVtbl->Dispatch(command_list, (dxr_output->width + 15) / 16, (dxr_output->height + 15) / 16, 1); _gpu_barrier(dxr_output->impl.image, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + + ID3D12DescriptorHeap *_heaps[] = {gpu_srv_heap, gpu_sampler_heap}; + command_list->lpVtbl->SetDescriptorHeaps(command_list, 2, _heaps); }