diff --git a/Source/Core/DolphinQt2/DolphinQt2.vcxproj b/Source/Core/DolphinQt2/DolphinQt2.vcxproj
index a0f7cc3842..8790aa27e0 100644
--- a/Source/Core/DolphinQt2/DolphinQt2.vcxproj
+++ b/Source/Core/DolphinQt2/DolphinQt2.vcxproj
@@ -1,4 +1,4 @@
-
+
@@ -218,9 +218,6 @@
{0e033be3-2e08-428e-9ae9-bc673efa12b5}
-
- {570215b7-e32f-4438-95ae-c8d955f9fca3}
-
{29f29a19-f141-45ad-9679-5a2923b49da3}
diff --git a/Source/Core/DolphinWX/DolphinWX.vcxproj b/Source/Core/DolphinWX/DolphinWX.vcxproj
index 56d7423597..d5dc307c6b 100644
--- a/Source/Core/DolphinWX/DolphinWX.vcxproj
+++ b/Source/Core/DolphinWX/DolphinWX.vcxproj
@@ -1,4 +1,4 @@
-
+
@@ -284,9 +284,6 @@
{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}
-
- {570215b7-e32f-4438-95ae-c8d955f9fca3}
-
@@ -308,4 +305,4 @@
-
+
\ No newline at end of file
diff --git a/Source/Core/VideoBackends/D3D12/BoundingBox.cpp b/Source/Core/VideoBackends/D3D12/BoundingBox.cpp
deleted file mode 100644
index 5ff7d7a3f1..0000000000
--- a/Source/Core/VideoBackends/D3D12/BoundingBox.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright 2014 Dolphin Emulator Project
-// Licensed under GPLv2+
-// Refer to the license.txt file included.
-
-#include
-
-#include "Common/CommonTypes.h"
-#include "Common/MsgHandler.h"
-#include "VideoBackends/D3D12/BoundingBox.h"
-#include "VideoBackends/D3D12/D3DBase.h"
-#include "VideoBackends/D3D12/D3DCommandListManager.h"
-#include "VideoBackends/D3D12/D3DDescriptorHeapManager.h"
-#include "VideoBackends/D3D12/D3DStreamBuffer.h"
-#include "VideoBackends/D3D12/D3DUtil.h"
-#include "VideoBackends/D3D12/FramebufferManager.h"
-#include "VideoBackends/D3D12/Render.h"
-#include "VideoCommon/VideoConfig.h"
-
-namespace DX12
-{
-constexpr size_t BBOX_BUFFER_SIZE = sizeof(int) * 4;
-constexpr size_t BBOX_STREAM_BUFFER_SIZE = BBOX_BUFFER_SIZE * 128;
-
-static ID3D12Resource* s_bbox_buffer;
-static ID3D12Resource* s_bbox_staging_buffer;
-static void* s_bbox_staging_buffer_map;
-static std::unique_ptr s_bbox_stream_buffer;
-static D3D12_GPU_DESCRIPTOR_HANDLE s_bbox_descriptor_handle;
-
-void BBox::Init()
-{
- CD3DX12_RESOURCE_DESC buffer_desc(CD3DX12_RESOURCE_DESC::Buffer(
- BBOX_BUFFER_SIZE, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, 0));
- CD3DX12_RESOURCE_DESC staging_buffer_desc(
- CD3DX12_RESOURCE_DESC::Buffer(BBOX_BUFFER_SIZE, D3D12_RESOURCE_FLAG_NONE, 0));
-
- CheckHR(D3D::device12->CreateCommittedResource(
- &CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_NONE, &buffer_desc,
- D3D12_RESOURCE_STATE_UNORDERED_ACCESS, nullptr, IID_PPV_ARGS(&s_bbox_buffer)));
-
- CheckHR(D3D::device12->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_READBACK),
- D3D12_HEAP_FLAG_NONE, &staging_buffer_desc,
- D3D12_RESOURCE_STATE_COPY_DEST, nullptr,
- IID_PPV_ARGS(&s_bbox_staging_buffer)));
-
- s_bbox_stream_buffer =
- std::make_unique(BBOX_STREAM_BUFFER_SIZE, BBOX_STREAM_BUFFER_SIZE, nullptr);
-
- // D3D12 root signature UAV must be raw or structured buffers, not typed. Since we used a typed
- // buffer,
- // we have to use a descriptor table. Luckily, we only have to allocate this once, and it never
- // changes.
- D3D12_CPU_DESCRIPTOR_HANDLE cpu_descriptor_handle;
- if (!D3D::gpu_descriptor_heap_mgr->Allocate(&cpu_descriptor_handle, &s_bbox_descriptor_handle,
- nullptr, false))
- PanicAlert("Failed to create bounding box UAV descriptor");
-
- D3D12_UNORDERED_ACCESS_VIEW_DESC view_desc = {DXGI_FORMAT_R32_SINT, D3D12_UAV_DIMENSION_BUFFER};
- view_desc.Buffer.FirstElement = 0;
- view_desc.Buffer.NumElements = 4;
- view_desc.Buffer.StructureByteStride = 0;
- view_desc.Buffer.CounterOffsetInBytes = 0;
- view_desc.Buffer.Flags = D3D12_BUFFER_UAV_FLAG_NONE;
- D3D::device12->CreateUnorderedAccessView(s_bbox_buffer, nullptr, &view_desc,
- cpu_descriptor_handle);
-
- Bind();
-}
-
-void BBox::Bind()
-{
- D3D::current_command_list->SetGraphicsRootDescriptorTable(DESCRIPTOR_TABLE_PS_UAV,
- s_bbox_descriptor_handle);
-}
-
-void BBox::Invalidate()
-{
- if (!s_bbox_staging_buffer_map)
- return;
-
- D3D12_RANGE write_range = {};
- s_bbox_staging_buffer->Unmap(0, &write_range);
- s_bbox_staging_buffer_map = nullptr;
-}
-
-void BBox::Shutdown()
-{
- Invalidate();
-
- if (s_bbox_buffer)
- {
- D3D::command_list_mgr->DestroyResourceAfterCurrentCommandListExecuted(s_bbox_buffer);
- s_bbox_buffer = nullptr;
- }
-
- if (s_bbox_staging_buffer)
- {
- D3D::command_list_mgr->DestroyResourceAfterCurrentCommandListExecuted(s_bbox_staging_buffer);
- s_bbox_staging_buffer = nullptr;
- }
-
- s_bbox_stream_buffer.reset();
-}
-
-void BBox::Set(int index, int value)
-{
- // If the buffer is currently mapped, compare the value, and update the staging buffer.
- if (s_bbox_staging_buffer_map)
- {
- int current_value;
- memcpy(¤t_value, reinterpret_cast(s_bbox_staging_buffer_map) + (index * sizeof(int)),
- sizeof(int));
- if (current_value == value)
- {
- // Value hasn't changed. So skip updating completely.
- return;
- }
-
- memcpy(reinterpret_cast(s_bbox_staging_buffer_map) + (index * sizeof(int)), &value,
- sizeof(int));
- }
-
- s_bbox_stream_buffer->AllocateSpaceInBuffer(sizeof(int), sizeof(int));
-
- // Allocate temporary bytes in upload buffer, then copy to real buffer.
- memcpy(s_bbox_stream_buffer->GetCPUAddressOfCurrentAllocation(), &value, sizeof(int));
- D3D::ResourceBarrier(D3D::current_command_list, s_bbox_buffer,
- D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_DEST, 0);
- D3D::current_command_list->CopyBufferRegion(
- s_bbox_buffer, index * sizeof(int), s_bbox_stream_buffer->GetBuffer(),
- s_bbox_stream_buffer->GetOffsetOfCurrentAllocation(), sizeof(int));
- D3D::ResourceBarrier(D3D::current_command_list, s_bbox_buffer, D3D12_RESOURCE_STATE_COPY_DEST,
- D3D12_RESOURCE_STATE_UNORDERED_ACCESS, 0);
-}
-
-int BBox::Get(int index)
-{
- if (!s_bbox_staging_buffer_map)
- {
- D3D::command_list_mgr->CPUAccessNotify();
-
- // Copy from real buffer to staging buffer, then block until we have the results.
- D3D::ResourceBarrier(D3D::current_command_list, s_bbox_buffer,
- D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE,
- 0);
- D3D::current_command_list->CopyBufferRegion(s_bbox_staging_buffer, 0, s_bbox_buffer, 0,
- BBOX_BUFFER_SIZE);
- D3D::ResourceBarrier(D3D::current_command_list, s_bbox_buffer, D3D12_RESOURCE_STATE_COPY_SOURCE,
- D3D12_RESOURCE_STATE_UNORDERED_ACCESS, 0);
-
- D3D::command_list_mgr->ExecuteQueuedWork(true);
-
- D3D12_RANGE read_range = {0, BBOX_BUFFER_SIZE};
- CheckHR(s_bbox_staging_buffer->Map(0, &read_range, &s_bbox_staging_buffer_map));
- }
-
- int value;
- memcpy(&value, &reinterpret_cast(s_bbox_staging_buffer_map)[index], sizeof(int));
- return value;
-}
-};
diff --git a/Source/Core/VideoBackends/D3D12/BoundingBox.h b/Source/Core/VideoBackends/D3D12/BoundingBox.h
deleted file mode 100644
index e326d781f5..0000000000
--- a/Source/Core/VideoBackends/D3D12/BoundingBox.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2014 Dolphin Emulator Project
-// Licensed under GPLv2+
-// Refer to the license.txt file included.
-
-#pragma once
-#include "VideoBackends/D3D12/D3DBase.h"
-
-namespace DX12
-{
-class BBox
-{
-public:
- static void Init();
- static void Bind();
- static void Invalidate();
- static void Shutdown();
-
- static void Set(int index, int value);
- static int Get(int index);
-};
-};
diff --git a/Source/Core/VideoBackends/D3D12/CMakeLists.txt b/Source/Core/VideoBackends/D3D12/CMakeLists.txt
deleted file mode 100644
index 984e84a8b6..0000000000
--- a/Source/Core/VideoBackends/D3D12/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-set(SRCS
- BoundingBox.cpp
- BoundingBox.h
- D3DBase.cpp
- D3DBase.h
- D3DCommandListManager.cpp
- D3DCommandListManager.h
- D3DDescriptorHeapManager.cpp
- D3DDescriptorHeapManager.h
- D3DQueuedCommandList.cpp
- D3DQueuedCommandList.h
- D3DShader.cpp
- D3DShader.h
- D3DState.cpp
- D3DState.h
- D3DStreamBuffer.cpp
- D3DStreamBuffer.h
- D3DTexture.cpp
- D3DTexture.h
- D3DUtil.cpp
- D3DUtil.h
- FramebufferManager.cpp
- FramebufferManager.h
- main.cpp
- NativeVertexFormat.cpp
- NativeVertexFormat.h
- PerfQuery.cpp
- PerfQuery.h
- PSTextureEncoder.cpp
- PSTextureEncoder.h
- Render.cpp
- Render.h
- ShaderCache.cpp
- ShaderCache.h
- ShaderConstantsManager.cpp
- ShaderConstantsManager.h
- StaticShaderCache.cpp
- StaticShaderCache.h
- TextureCache.cpp
- TextureCache.h
- VertexManager.cpp
- VertexManager.h
- VideoBackend.h
- XFBEncoder.cpp
- XFBEncoder.h
-)
-
-set(LIBS
- videocommon
- SOIL
- common
-)
-
-add_dolphin_library(videod3d12 "${SRCS}" "${LIBS}")
diff --git a/Source/Core/VideoBackends/D3D12/D3D12.vcxproj b/Source/Core/VideoBackends/D3D12/D3D12.vcxproj
deleted file mode 100644
index 401fa20df1..0000000000
--- a/Source/Core/VideoBackends/D3D12/D3D12.vcxproj
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- {570215B7-E32F-4438-95AE-C8D955F9FCA3}
- 10.0.10586.0
-
-
-
- StaticLibrary
- v140
- Unicode
-
-
- true
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
- NotUsing
-
-
-
-
-
- NotUsing
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {3de9ee35-3e91-4f27-a014-2866ad8c3fe3}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Source/Core/VideoBackends/D3D12/D3D12.vcxproj.filters b/Source/Core/VideoBackends/D3D12/D3D12.vcxproj.filters
deleted file mode 100644
index ff2922fbd1..0000000000
--- a/Source/Core/VideoBackends/D3D12/D3D12.vcxproj.filters
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
-
-
- {3683d29b-19f6-4e7a-803f-4ac70b1d49fd}
-
-
- {ae700f7e-33c8-45b5-b7ee-a0ded3630549}
-
-
-
-
- D3D12
-
-
- D3D12
-
-
- D3D12
-
-
- D3D12
-
-
- D3D12
-
-
- Render
-
-
- Render
-
-
- Render
-
-
- Render
-
-
- Render
-
-
- Render
-
-
- Render
-
-
- Render
-
-
-
- Render
-
-
- D3D12
-
-
- D3D12
-
-
- D3D12
-
-
- Render
-
-
- Render
-
-
- Render
-
-
- D3D12
-
-
-
-
- D3D12
-
-
- D3D12
-
-
- D3D12
-
-
- D3D12
-
-
- D3D12
-
-
- Render
-
-
- Render
-
-
- Render
-
-
- Render
-
-
- Render
-
-
- Render
-
-
- Render
-
-
-
- Render
-
-
- D3D12
-
-
- D3D12
-
-
- Render
-
-
- D3D12
-
-
- Render
-
-
- Render
-
-
- Render
-
-
- D3D12
-
-
-
\ No newline at end of file
diff --git a/Source/Core/VideoBackends/D3D12/D3DBase.cpp b/Source/Core/VideoBackends/D3D12/D3DBase.cpp
deleted file mode 100644
index 56c5bc6534..0000000000
--- a/Source/Core/VideoBackends/D3D12/D3DBase.cpp
+++ /dev/null
@@ -1,900 +0,0 @@
-// Copyright 2010 Dolphin Emulator Project
-// Licensed under GPLv2+
-// Refer to the license.txt file included.
-
-#include
-#include
-
-#include "Common/CommonTypes.h"
-#include "Common/Logging/Log.h"
-#include "Common/MsgHandler.h"
-#include "Common/StringUtil.h"
-#include "VideoBackends/D3D12/D3DBase.h"
-#include "VideoBackends/D3D12/D3DCommandListManager.h"
-#include "VideoBackends/D3D12/D3DDescriptorHeapManager.h"
-#include "VideoBackends/D3D12/D3DState.h"
-#include "VideoBackends/D3D12/D3DTexture.h"
-#include "VideoCommon/OnScreenDisplay.h"
-#include "VideoCommon/VideoConfig.h"
-
-static const unsigned int SWAP_CHAIN_BUFFER_COUNT = 4;
-
-namespace DX12
-{
-// d3dcompiler_*.dll exports
-static HINSTANCE s_d3d_compiler_dll = nullptr;
-static int s_d3d_compiler_dll_ref = 0;
-D3DREFLECT d3d_reflect = nullptr;
-D3DCREATEBLOB d3d_create_blob = nullptr;
-pD3DCompile d3d_compile = nullptr;
-
-// dxgi.dll exports
-static HINSTANCE s_dxgi_dll = nullptr;
-static int s_dxgi_dll_ref = 0;
-CREATEDXGIFACTORY create_dxgi_factory = nullptr;
-
-// d3d12.dll exports
-static HINSTANCE s_d3d12_dll = nullptr;
-static int s_d3d12_dll_ref = 0;
-D3D12CREATEDEVICE d3d12_create_device = nullptr;
-D3D12SERIALIZEROOTSIGNATURE d3d12_serialize_root_signature = nullptr;
-D3D12GETDEBUGINTERFACE d3d12_get_debug_interface = nullptr;
-
-namespace D3D
-{
-// Begin extern'd variables.
-ID3D12Device* device12 = nullptr;
-
-ID3D12CommandQueue* command_queue = nullptr;
-std::unique_ptr command_list_mgr;
-ID3D12GraphicsCommandList* current_command_list = nullptr;
-ID3D12RootSignature* default_root_signature = nullptr;
-
-D3D12_CPU_DESCRIPTOR_HANDLE null_srv_cpu = {};
-D3D12_CPU_DESCRIPTOR_HANDLE null_srv_cpu_shadow = {};
-
-unsigned int resource_descriptor_size = 0;
-unsigned int sampler_descriptor_size = 0;
-std::unique_ptr gpu_descriptor_heap_mgr;
-std::unique_ptr sampler_descriptor_heap_mgr;
-std::unique_ptr dsv_descriptor_heap_mgr;
-std::unique_ptr rtv_descriptor_heap_mgr;
-std::array gpu_descriptor_heaps;
-
-HWND hWnd;
-// End extern'd variables.
-
-static IDXGISwapChain* s_swap_chain = nullptr;
-static unsigned int s_monitor_refresh_rate = 0;
-
-static LARGE_INTEGER s_qpc_frequency;
-
-static ID3D12DebugDevice* s_debug_device12 = nullptr;
-
-static D3DTexture2D* s_backbuf[SWAP_CHAIN_BUFFER_COUNT];
-static unsigned int s_current_back_buf = 0;
-static unsigned int s_xres = 0;
-static unsigned int s_yres = 0;
-static bool s_frame_in_progress = false;
-
-HRESULT LoadDXGI()
-{
- if (s_dxgi_dll_ref++ > 0)
- return S_OK;
-
- if (s_dxgi_dll)
- return S_OK;
-
- s_dxgi_dll = LoadLibraryA("dxgi.dll");
- if (!s_dxgi_dll)
- {
- MessageBoxA(nullptr, "Failed to load dxgi.dll", "Critical error", MB_OK | MB_ICONERROR);
- --s_dxgi_dll_ref;
- return E_FAIL;
- }
- create_dxgi_factory = (CREATEDXGIFACTORY)GetProcAddress(s_dxgi_dll, "CreateDXGIFactory");
-
- if (create_dxgi_factory == nullptr)
- MessageBoxA(nullptr, "GetProcAddress failed for CreateDXGIFactory!", "Critical error",
- MB_OK | MB_ICONERROR);
-
- return S_OK;
-}
-
-HRESULT LoadD3D()
-{
- if (s_d3d12_dll_ref++ > 0)
- return S_OK;
-
- s_d3d12_dll = LoadLibraryA("d3d12.dll");
- if (!s_d3d12_dll)
- {
- MessageBoxA(nullptr, "Failed to load d3d12.dll", "Critical error", MB_OK | MB_ICONERROR);
- --s_d3d12_dll_ref;
- return E_FAIL;
- }
-
- d3d12_create_device = (D3D12CREATEDEVICE)GetProcAddress(s_d3d12_dll, "D3D12CreateDevice");
- if (d3d12_create_device == nullptr)
- {
- MessageBoxA(nullptr, "GetProcAddress failed for D3D12CreateDevice!", "Critical error",
- MB_OK | MB_ICONERROR);
- return E_FAIL;
- }
-
- d3d12_serialize_root_signature =
- (D3D12SERIALIZEROOTSIGNATURE)GetProcAddress(s_d3d12_dll, "D3D12SerializeRootSignature");
- if (d3d12_serialize_root_signature == nullptr)
- {
- MessageBoxA(nullptr, "GetProcAddress failed for D3D12SerializeRootSignature!", "Critical error",
- MB_OK | MB_ICONERROR);
- return E_FAIL;
- }
-
- d3d12_get_debug_interface =
- (D3D12GETDEBUGINTERFACE)GetProcAddress(s_d3d12_dll, "D3D12GetDebugInterface");
- if (d3d12_get_debug_interface == nullptr)
- {
- MessageBoxA(nullptr, "GetProcAddress failed for D3D12GetDebugInterface!", "Critical error",
- MB_OK | MB_ICONERROR);
- return E_FAIL;
- }
-
- return S_OK;
-}
-
-HRESULT LoadD3DCompiler()
-{
- if (s_d3d_compiler_dll_ref++ > 0)
- return S_OK;
-
- if (s_d3d_compiler_dll)
- return S_OK;
-
- // try to load D3DCompiler first to check whether we have proper runtime support
- // try to use the dll the backend was compiled against first - don't bother about debug runtimes
- s_d3d_compiler_dll = LoadLibraryA(D3DCOMPILER_DLL_A);
- if (!s_d3d_compiler_dll)
- {
- // if that fails, use the dll which should be available in every SDK which officially supports
- // DX12.
- s_d3d_compiler_dll = LoadLibraryA("D3DCompiler_42.dll");
- if (!s_d3d_compiler_dll)
- {
- MessageBoxA(nullptr, "Failed to load D3DCompiler_42.dll, update your DX12 runtime, please",
- "Critical error", MB_OK | MB_ICONERROR);
- return E_FAIL;
- }
- else
- {
- NOTICE_LOG(VIDEO, "Successfully loaded D3DCompiler_42.dll. If you're having trouble, try "
- "updating your DX runtime first.");
- }
- }
-
- d3d_reflect = (D3DREFLECT)GetProcAddress(s_d3d_compiler_dll, "D3DReflect");
- if (d3d_reflect == nullptr)
- MessageBoxA(nullptr, "GetProcAddress failed for D3DReflect!", "Critical error",
- MB_OK | MB_ICONERROR);
-
- d3d_create_blob = (D3DCREATEBLOB)GetProcAddress(s_d3d_compiler_dll, "D3DCreateBlob");
- if (d3d_create_blob == nullptr)
- MessageBoxA(nullptr, "GetProcAddress failed for D3DCreateBlob!", "Critical error",
- MB_OK | MB_ICONERROR);
-
- d3d_compile = (pD3DCompile)GetProcAddress(s_d3d_compiler_dll, "D3DCompile");
- if (d3d_compile == nullptr)
- MessageBoxA(nullptr, "GetProcAddress failed for D3DCompile!", "Critical error",
- MB_OK | MB_ICONERROR);
-
- return S_OK;
-}
-
-void UnloadDXGI()
-{
- if (!s_dxgi_dll_ref)
- return;
-
- if (--s_dxgi_dll_ref != 0)
- return;
-
- if (s_dxgi_dll)
- FreeLibrary(s_dxgi_dll);
-
- s_dxgi_dll = nullptr;
- create_dxgi_factory = nullptr;
-}
-
-void UnloadD3D()
-{
- if (!s_d3d12_dll_ref)
- return;
-
- if (--s_d3d12_dll_ref != 0)
- return;
-
- if (s_d3d12_dll)
- FreeLibrary(s_d3d12_dll);
-
- s_d3d12_dll = nullptr;
- d3d12_create_device = nullptr;
- d3d12_serialize_root_signature = nullptr;
-}
-
-void UnloadD3DCompiler()
-{
- if (!s_d3d_compiler_dll_ref)
- return;
-
- if (--s_d3d_compiler_dll_ref != 0)
- return;
-
- if (s_d3d_compiler_dll)
- FreeLibrary(s_d3d_compiler_dll);
-
- s_d3d_compiler_dll = nullptr;
- d3d_compile = nullptr;
- d3d_create_blob = nullptr;
- d3d_reflect = nullptr;
-}
-
-std::vector EnumAAModes(ID3D12Device* device)
-{
- std::vector aa_modes;
-
- for (int samples = 0; samples < D3D12_MAX_MULTISAMPLE_SAMPLE_COUNT; ++samples)
- {
- D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS multisample_quality_levels = {};
- multisample_quality_levels.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- multisample_quality_levels.SampleCount = samples;
-
- device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS,
- &multisample_quality_levels, sizeof(multisample_quality_levels));
-
- DXGI_SAMPLE_DESC desc;
- desc.Count = samples;
- desc.Quality = 0;
-
- if (multisample_quality_levels.NumQualityLevels > 0)
- aa_modes.push_back(desc);
- }
-
- return aa_modes;
-}
-
-static bool SupportsS3TCTextures(ID3D12Device* device)
-{
- auto CheckForFormat = [](ID3D12Device* device, DXGI_FORMAT format) {
- D3D12_FEATURE_DATA_FORMAT_SUPPORT data = {format};
- if (FAILED(device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &data, sizeof(data))))
- return false;
-
- return (data.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURE2D) != 0;
- };
-
- return CheckForFormat(device, DXGI_FORMAT_BC1_UNORM) &&
- CheckForFormat(device, DXGI_FORMAT_BC2_UNORM) &&
- CheckForFormat(device, DXGI_FORMAT_BC3_UNORM);
-}
-
-HRESULT Create(HWND wnd)
-{
- hWnd = wnd;
- HRESULT hr;
-
- RECT client;
- GetClientRect(hWnd, &client);
- s_xres = client.right - client.left;
- s_yres = client.bottom - client.top;
-
- hr = LoadDXGI();
- if (FAILED(hr))
- return hr;
-
- hr = LoadD3D();
- if (FAILED(hr))
- {
- UnloadDXGI();
- return hr;
- }
-
- hr = LoadD3DCompiler();
- if (FAILED(hr))
- {
- UnloadD3D();
- UnloadDXGI();
- return hr;
- }
-
- IDXGIFactory* factory;
- IDXGIAdapter* adapter;
- hr = create_dxgi_factory(__uuidof(IDXGIFactory), (void**)&factory);
- if (FAILED(hr))
- {
- MessageBox(wnd, _T("Failed to create IDXGIFactory object"), _T("Dolphin Direct3D 12 backend"),
- MB_OK | MB_ICONERROR);
- UnloadD3DCompiler();
- UnloadD3D();
- UnloadDXGI();
- return hr;
- }
-
- hr = factory->EnumAdapters(g_ActiveConfig.iAdapter, &adapter);
- if (FAILED(hr))
- {
- // try using the first one
- hr = factory->EnumAdapters(0, &adapter);
- if (FAILED(hr))
- {
- MessageBox(wnd, _T("Failed to enumerate adapters"), _T("Dolphin Direct3D 12 backend"),
- MB_OK | MB_ICONERROR);
- UnloadD3DCompiler();
- UnloadD3D();
- UnloadDXGI();
- return hr;
- }
- }
-
- DXGI_SWAP_CHAIN_DESC swap_chain_desc = {};
- swap_chain_desc.BufferCount = SWAP_CHAIN_BUFFER_COUNT;
- swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- swap_chain_desc.OutputWindow = wnd;
- swap_chain_desc.SampleDesc.Count = 1;
- swap_chain_desc.SampleDesc.Quality = 0;
- swap_chain_desc.Windowed = true;
- swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
- swap_chain_desc.Flags = 0;
-
- swap_chain_desc.BufferDesc.Width = s_xres;
- swap_chain_desc.BufferDesc.Height = s_yres;
- swap_chain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- swap_chain_desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
-
-#if defined(_DEBUG) || defined(DEBUGFAST) || defined(USE_D3D12_DEBUG_LAYER)
- // Enabling the debug layer will fail if the Graphics Tools feature is not installed.
- ID3D12Debug* debug_controller;
- hr = d3d12_get_debug_interface(IID_PPV_ARGS(&debug_controller));
- if (SUCCEEDED(hr))
- {
- debug_controller->EnableDebugLayer();
- debug_controller->Release();
- }
- else
- {
- MessageBox(wnd, _T("WARNING: Failed to enable D3D12 debug layer, please ensure the Graphics ")
- _T("Tools feature is installed."),
- _T("Dolphin Direct3D 12 backend"), MB_OK | MB_ICONERROR);
- }
-
-#endif
-
- hr = d3d12_create_device(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device12));
- if (FAILED(hr))
- {
- MessageBox(wnd, _T("Failed to initialize Direct3D.\nMake sure your video card supports ")
- _T("Direct3D 12 and your drivers are up-to-date."),
- _T("Dolphin Direct3D 12 backend"), MB_OK | MB_ICONERROR);
- adapter->Release();
- UnloadD3DCompiler();
- UnloadD3D();
- UnloadDXGI();
- return hr;
- }
-
- // Ensure that the chosen AA mode is supported by the device.
- std::vector aa_modes = EnumAAModes(device12);
- if (std::find_if(aa_modes.begin(), aa_modes.end(), [](const DXGI_SAMPLE_DESC& desc) {
- return desc.Count == g_Config.iMultisamples;
- }) == aa_modes.end())
- {
- g_Config.iMultisamples = 1;
- UpdateActiveConfig();
- }
-
- D3D12_COMMAND_QUEUE_DESC command_queue_desc = {
- D3D12_COMMAND_LIST_TYPE_DIRECT, // D3D12_COMMAND_LIST_TYPE Type;
- 0, // INT Priority;
- D3D12_COMMAND_QUEUE_FLAG_NONE, // D3D12_COMMAND_QUEUE_FLAG Flags;
- 0 // UINT NodeMask;
- };
-
- CheckHR(device12->CreateCommandQueue(&command_queue_desc, IID_PPV_ARGS(&command_queue)));
-
- CheckHR(factory->CreateSwapChain(command_queue, &swap_chain_desc, &s_swap_chain));
-
- s_current_back_buf = 0;
-
- // Query the monitor refresh rate, to ensure proper Present throttling behavior.
- DEVMODE dev_mode;
- memset(&dev_mode, 0, sizeof(DEVMODE));
- dev_mode.dmSize = sizeof(DEVMODE);
- dev_mode.dmDriverExtra = 0;
-
- if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode) == 0)
- {
- // If EnumDisplaySettings fails, assume monitor refresh rate of 60 Hz.
- s_monitor_refresh_rate = 60;
- }
- else
- {
- s_monitor_refresh_rate = dev_mode.dmDisplayFrequency;
- }
-
- ID3D12InfoQueue* info_queue = nullptr;
- if (SUCCEEDED(device12->QueryInterface(&info_queue)))
- {
- CheckHR(info_queue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_ERROR, TRUE));
- CheckHR(info_queue->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY_WARNING, TRUE));
-
- D3D12_INFO_QUEUE_FILTER filter = {};
- D3D12_MESSAGE_ID id_list[] = {
- D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_DEPTHSTENCILVIEW_NOT_SET, // Benign.
- D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RENDERTARGETVIEW_NOT_SET, // Benign.
- D3D12_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH // Benign.
- };
- filter.DenyList.NumIDs = ARRAYSIZE(id_list);
- filter.DenyList.pIDList = id_list;
- info_queue->PushStorageFilter(&filter);
-
- info_queue->Release();
-
- // Used at Close time to report live objects.
- CheckHR(device12->QueryInterface(&s_debug_device12));
- }
-
- // prevent DXGI from responding to Alt+Enter, unfortunately DXGI_MWA_NO_ALT_ENTER
- // does not work so we disable all monitoring of window messages. However this
- // may make it more difficult for DXGI to handle display mode changes.
- hr = factory->MakeWindowAssociation(wnd, DXGI_MWA_NO_WINDOW_CHANGES);
- if (FAILED(hr))
- MessageBox(wnd, _T("Failed to associate the window"), _T("Dolphin Direct3D 12 backend"),
- MB_OK | MB_ICONERROR);
-
- CreateDescriptorHeaps();
- CreateRootSignatures();
-
- command_list_mgr = std::make_unique(D3D12_COMMAND_LIST_TYPE_DIRECT,
- device12, command_queue);
-
- command_list_mgr->GetCommandList(¤t_command_list);
- command_list_mgr->SetInitialCommandListState();
-
- for (UINT i = 0; i < SWAP_CHAIN_BUFFER_COUNT; i++)
- {
- ID3D12Resource* buf12 = nullptr;
- hr = s_swap_chain->GetBuffer(i, IID_PPV_ARGS(&buf12));
-
- CHECK(SUCCEEDED(hr), "Retrieve back buffer texture");
-
- s_backbuf[i] =
- new D3DTexture2D(buf12, TEXTURE_BIND_FLAG_RENDER_TARGET, DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, false,
- D3D12_RESOURCE_STATE_PRESENT // Swap Chain back buffers start out in
- // D3D12_RESOURCE_STATE_PRESENT.
- );
-
- SAFE_RELEASE(buf12);
- SetDebugObjectName12(s_backbuf[i]->GetTex12(), "backbuffer texture");
- }
-
- s_backbuf[s_current_back_buf]->TransitionToResourceState(current_command_list,
- D3D12_RESOURCE_STATE_RENDER_TARGET);
- current_command_list->OMSetRenderTargets(1, &s_backbuf[s_current_back_buf]->GetRTV12(), FALSE,
- nullptr);
-
- QueryPerformanceFrequency(&s_qpc_frequency);
-
- // Render the device name.
- DXGI_ADAPTER_DESC adapter_desc;
- CheckHR(adapter->GetDesc(&adapter_desc));
- OSD::AddMessage(
- StringFromFormat("Using D3D Adapter: %s.", UTF16ToUTF8(adapter_desc.Description).c_str()));
-
- SAFE_RELEASE(factory);
- SAFE_RELEASE(adapter);
-
- g_Config.backend_info.bSupportsST3CTextures = SupportsS3TCTextures(device12);
-
- return S_OK;
-}
-
-void CreateDescriptorHeaps()
-{
- // Create D3D12 GPU and CPU descriptor heaps.
-
- {
- D3D12_DESCRIPTOR_HEAP_DESC gpu_descriptor_heap_desc = {};
- gpu_descriptor_heap_desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
- gpu_descriptor_heap_desc.NumDescriptors = 500000;
- gpu_descriptor_heap_desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
-
- gpu_descriptor_heap_mgr =
- std::make_unique(&gpu_descriptor_heap_desc, device12, 50000);
-
- gpu_descriptor_heaps[0] = gpu_descriptor_heap_mgr->GetDescriptorHeap();
-
- D3D12_CPU_DESCRIPTOR_HANDLE descriptor_heap_cpu_base =
- gpu_descriptor_heap_mgr->GetDescriptorHeap()->GetCPUDescriptorHandleForHeapStart();
-
- resource_descriptor_size =
- device12->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
- sampler_descriptor_size =
- device12->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
-
- D3D12_GPU_DESCRIPTOR_HANDLE null_srv_gpu = {};
- gpu_descriptor_heap_mgr->Allocate(&null_srv_cpu, &null_srv_gpu, &null_srv_cpu_shadow);
-
- D3D12_SHADER_RESOURCE_VIEW_DESC null_srv_desc = {};
- null_srv_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- null_srv_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
- null_srv_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
-
- device12->CreateShaderResourceView(NULL, &null_srv_desc, null_srv_cpu);
-
- for (UINT i = 0; i < 500000; i++)
- {
- // D3D12TODO: Make paving of descriptor heap optional.
-
- D3D12_CPU_DESCRIPTOR_HANDLE destination_descriptor = {};
- destination_descriptor.ptr = descriptor_heap_cpu_base.ptr + i * resource_descriptor_size;
-
- device12->CreateShaderResourceView(NULL, &null_srv_desc, destination_descriptor);
- }
- }
-
- {
- D3D12_DESCRIPTOR_HEAP_DESC sampler_descriptor_heap_desc = {};
- sampler_descriptor_heap_desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
- sampler_descriptor_heap_desc.NumDescriptors = 2000;
- sampler_descriptor_heap_desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER;
-
- sampler_descriptor_heap_mgr =
- std::make_unique(&sampler_descriptor_heap_desc, device12);
-
- gpu_descriptor_heaps[1] = sampler_descriptor_heap_mgr->GetDescriptorHeap();
- }
-
- {
- D3D12_DESCRIPTOR_HEAP_DESC dsv_descriptor_heap_desc = {};
- dsv_descriptor_heap_desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
- dsv_descriptor_heap_desc.NumDescriptors = 2000;
- dsv_descriptor_heap_desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV;
-
- dsv_descriptor_heap_mgr =
- std::make_unique(&dsv_descriptor_heap_desc, device12);
- }
-
- {
- // D3D12TODO: Temporary workaround.. really need to properly suballocate out of render target
- // heap.
- D3D12_DESCRIPTOR_HEAP_DESC rtv_descriptor_heap_desc = {};
- rtv_descriptor_heap_desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
- rtv_descriptor_heap_desc.NumDescriptors = 1000000;
- rtv_descriptor_heap_desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
-
- rtv_descriptor_heap_mgr =
- std::make_unique(&rtv_descriptor_heap_desc, device12);
- }
-}
-
-void CreateRootSignatures()
-{
- D3D12_DESCRIPTOR_RANGE desc_range_srv = {
- D3D12_DESCRIPTOR_RANGE_TYPE_SRV, // D3D12_DESCRIPTOR_RANGE_TYPE RangeType;
- 8, // UINT NumDescriptors;
- 0, // UINT BaseShaderRegister;
- 0, // UINT RegisterSpace;
- D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND // UINT OffsetInDescriptorsFromTableStart;
- };
-
- D3D12_DESCRIPTOR_RANGE desc_range_sampler = {
- D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, // D3D12_DESCRIPTOR_RANGE_TYPE RangeType;
- 8, // UINT NumDescriptors;
- 0, // UINT BaseShaderRegister;
- 0, // UINT RegisterSpace;
- D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND // UINT OffsetInDescriptorsFromTableStart;
- };
-
- D3D12_DESCRIPTOR_RANGE desc_range_uav = {
- D3D12_DESCRIPTOR_RANGE_TYPE_UAV, // D3D12_DESCRIPTOR_RANGE_TYPE RangeType;
- 1, // UINT NumDescriptors;
- 2, // UINT BaseShaderRegister;
- 0, // UINT RegisterSpace;
- D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND // UINT OffsetInDescriptorsFromTableStart;
- };
-
- D3D12_ROOT_PARAMETER root_parameters[NUM_GRAPHICS_ROOT_PARAMETERS];
-
- root_parameters[DESCRIPTOR_TABLE_PS_SRV].ParameterType =
- D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
- root_parameters[DESCRIPTOR_TABLE_PS_SRV].DescriptorTable.NumDescriptorRanges = 1;
- root_parameters[DESCRIPTOR_TABLE_PS_SRV].DescriptorTable.pDescriptorRanges = &desc_range_srv;
- root_parameters[DESCRIPTOR_TABLE_PS_SRV].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
-
- root_parameters[DESCRIPTOR_TABLE_PS_SAMPLER].ParameterType =
- D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
- root_parameters[DESCRIPTOR_TABLE_PS_SAMPLER].DescriptorTable.NumDescriptorRanges = 1;
- root_parameters[DESCRIPTOR_TABLE_PS_SAMPLER].DescriptorTable.pDescriptorRanges =
- &desc_range_sampler;
- root_parameters[DESCRIPTOR_TABLE_PS_SAMPLER].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
-
- root_parameters[DESCRIPTOR_TABLE_GS_CBV].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
- root_parameters[DESCRIPTOR_TABLE_GS_CBV].Descriptor.RegisterSpace = 0;
- root_parameters[DESCRIPTOR_TABLE_GS_CBV].Descriptor.ShaderRegister = 0;
- root_parameters[DESCRIPTOR_TABLE_GS_CBV].ShaderVisibility = D3D12_SHADER_VISIBILITY_GEOMETRY;
-
- root_parameters[DESCRIPTOR_TABLE_VS_CBV].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
- root_parameters[DESCRIPTOR_TABLE_VS_CBV].Descriptor.RegisterSpace = 0;
- root_parameters[DESCRIPTOR_TABLE_VS_CBV].Descriptor.ShaderRegister = 0;
- root_parameters[DESCRIPTOR_TABLE_VS_CBV].ShaderVisibility = D3D12_SHADER_VISIBILITY_VERTEX;
-
- root_parameters[DESCRIPTOR_TABLE_PS_CBVONE].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
- root_parameters[DESCRIPTOR_TABLE_PS_CBVONE].Descriptor.RegisterSpace = 0;
- root_parameters[DESCRIPTOR_TABLE_PS_CBVONE].Descriptor.ShaderRegister = 0;
- root_parameters[DESCRIPTOR_TABLE_PS_CBVONE].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
-
- root_parameters[DESCRIPTOR_TABLE_PS_CBVTWO].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
- root_parameters[DESCRIPTOR_TABLE_PS_CBVTWO].Descriptor.RegisterSpace = 0;
- root_parameters[DESCRIPTOR_TABLE_PS_CBVTWO].Descriptor.ShaderRegister = 1;
- root_parameters[DESCRIPTOR_TABLE_PS_CBVTWO].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
-
- root_parameters[DESCRIPTOR_TABLE_PS_UAV].ParameterType =
- D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
- root_parameters[DESCRIPTOR_TABLE_PS_UAV].DescriptorTable.NumDescriptorRanges = 1;
- root_parameters[DESCRIPTOR_TABLE_PS_UAV].DescriptorTable.pDescriptorRanges = &desc_range_uav;
- root_parameters[DESCRIPTOR_TABLE_PS_UAV].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
-
- D3D12_ROOT_SIGNATURE_DESC root_signature_desc = {};
- root_signature_desc.pParameters = root_parameters;
- root_signature_desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |
- D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS |
- D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS;
-
- root_signature_desc.NumParameters = ARRAYSIZE(root_parameters);
-
- ID3DBlob* text_root_signature_blob;
- ID3DBlob* text_root_signature_error_blob;
-
- CheckHR(d3d12_serialize_root_signature(&root_signature_desc, D3D_ROOT_SIGNATURE_VERSION_1,
- &text_root_signature_blob,
- &text_root_signature_error_blob));
-
- CheckHR(D3D::device12->CreateRootSignature(0, text_root_signature_blob->GetBufferPointer(),
- text_root_signature_blob->GetBufferSize(),
- IID_PPV_ARGS(&default_root_signature)));
-}
-
-void WaitForOutstandingRenderingToComplete()
-{
- command_list_mgr->ExecuteQueuedWork(true);
-}
-
-void Close()
-{
- // we can't release the swapchain while in fullscreen.
- s_swap_chain->SetFullscreenState(false, nullptr);
-
- // Release all back buffer references
- for (UINT i = 0; i < ARRAYSIZE(s_backbuf); i++)
- {
- SAFE_RELEASE(s_backbuf[i]);
- }
-
- D3D::CleanupPersistentD3DTextureResources();
-
- SAFE_RELEASE(s_swap_chain);
-
- command_list_mgr.reset();
- command_queue->Release();
-
- default_root_signature->Release();
-
- gpu_descriptor_heap_mgr.reset();
- sampler_descriptor_heap_mgr.reset();
- rtv_descriptor_heap_mgr.reset();
- dsv_descriptor_heap_mgr.reset();
-
- ULONG remaining_references = device12->Release();
- if ((!s_debug_device12 && remaining_references) || (s_debug_device12 && remaining_references > 1))
- {
- ERROR_LOG(VIDEO, "Unreleased D3D12 references: %i.", remaining_references);
- }
- else
- {
- NOTICE_LOG(VIDEO, "Successfully released all D3D12 device references!");
- }
-
-#if defined(_DEBUG) || defined(DEBUGFAST)
- if (s_debug_device12)
- {
- --remaining_references; // the debug interface increases the refcount of the device, subtract
- // that.
- if (remaining_references)
- {
- // print out alive objects, but only if we actually have pending references
- // note this will also print out internal live objects to the debug console
- s_debug_device12->ReportLiveDeviceObjects(D3D12_RLDO_DETAIL);
- }
- SAFE_RELEASE(s_debug_device12);
- }
-#endif
-
- device12 = nullptr;
- current_command_list = nullptr;
-
- // unload DLLs
- UnloadD3DCompiler();
- UnloadD3D();
- UnloadDXGI();
-}
-
-const std::string VertexShaderVersionString()
-{
- return "vs_5_0";
-}
-
-const std::string GeometryShaderVersionString()
-{
- return "gs_5_0";
-}
-
-const std::string PixelShaderVersionString()
-{
- return "ps_5_0";
-}
-
-D3DTexture2D*& GetBackBuffer()
-{
- return s_backbuf[s_current_back_buf];
-}
-
-unsigned int GetBackBufferWidth()
-{
- return s_xres;
-}
-
-unsigned int GetBackBufferHeight()
-{
- return s_yres;
-}
-
-// Returns the maximum width/height of a texture.
-unsigned int GetMaxTextureSize()
-{
- return D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION;
-}
-
-void Reset()
-{
- // release all back buffer references
- for (UINT i = 0; i < ARRAYSIZE(s_backbuf); i++)
- {
- SAFE_RELEASE(s_backbuf[i]);
- }
-
- // Block until all commands have finished.
- // This will also final-release all pending resources (including the backbuffer above)
- command_list_mgr->ExecuteQueuedWork(true);
-
- // resize swapchain buffers
- RECT client;
- GetClientRect(hWnd, &client);
- s_xres = client.right - client.left;
- s_yres = client.bottom - client.top;
-
- CheckHR(s_swap_chain->ResizeBuffers(SWAP_CHAIN_BUFFER_COUNT, s_xres, s_yres,
- DXGI_FORMAT_R8G8B8A8_UNORM, 0));
-
- // recreate back buffer textures
-
- HRESULT hr = S_OK;
-
- for (UINT i = 0; i < SWAP_CHAIN_BUFFER_COUNT; i++)
- {
- ID3D12Resource* buf12 = nullptr;
- hr = s_swap_chain->GetBuffer(i, IID_PPV_ARGS(&buf12));
-
- CHECK(SUCCEEDED(hr), "Retrieve back buffer texture");
-
- s_backbuf[i] = new D3DTexture2D(buf12, TEXTURE_BIND_FLAG_RENDER_TARGET, DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, false,
- D3D12_RESOURCE_STATE_PRESENT);
-
- SAFE_RELEASE(buf12);
- SetDebugObjectName12(s_backbuf[i]->GetTex12(), "backbuffer texture");
- }
-
- // The 'about-to-be-presented' back buffer index is always set back to '0' upon ResizeBuffers,
- // just like
- // creating a new swap chain.
- s_current_back_buf = 0;
-
- s_backbuf[s_current_back_buf]->TransitionToResourceState(current_command_list,
- D3D12_RESOURCE_STATE_RENDER_TARGET);
-}
-
-bool BeginFrame()
-{
- if (s_frame_in_progress)
- {
- PanicAlert("BeginFrame called although a frame is already in progress");
- return false;
- }
- s_frame_in_progress = true;
- return (device12 != nullptr);
-}
-
-void EndFrame()
-{
- if (!s_frame_in_progress)
- {
- PanicAlert("EndFrame called although no frame is in progress");
- return;
- }
- s_frame_in_progress = false;
-}
-
-void Present()
-{
- // The Present function contains logic to ensure we never Present faster than Windows can
- // send to the monitor. If we Present too fast, the Present call will start to block, and we'll be
- // throttled - obviously not desired if vsync is disabled and the emulated CPU speed is > 100%.
-
- // The throttling logic ensures that we don't Present more than twice in a given monitor vsync.
- // This is accomplished through timing data - there is a programmatic way to determine if a
- // Present call will block, however after investigation that is not feasible here (without
- // invasive
- // workarounds), due to the fact this method does not actually call Present - we just queue a
- // Present
- // command for the background thread to dispatch.
-
- // The monitor refresh rate is determined in Create().
-
- static LARGE_INTEGER s_last_present_qpc;
-
- LARGE_INTEGER current_qpc;
- QueryPerformanceCounter(¤t_qpc);
-
- const double time_elapsed_since_last_present =
- static_cast(current_qpc.QuadPart - s_last_present_qpc.QuadPart) /
- s_qpc_frequency.QuadPart;
-
- unsigned int present_flags = 0;
-
- if (g_ActiveConfig.IsVSync() == false &&
- time_elapsed_since_last_present < (1.0 / static_cast(s_monitor_refresh_rate)) / 2.0)
- {
- present_flags = DXGI_PRESENT_TEST; // Causes Present to be a no-op.
- }
- else
- {
- s_last_present_qpc = current_qpc;
-
- s_backbuf[s_current_back_buf]->TransitionToResourceState(current_command_list,
- D3D12_RESOURCE_STATE_PRESENT);
- s_current_back_buf = (s_current_back_buf + 1) % SWAP_CHAIN_BUFFER_COUNT;
- }
-
- command_list_mgr->ExecuteQueuedWorkAndPresent(s_swap_chain, g_ActiveConfig.IsVSync() ? 1 : 0,
- present_flags);
-
- command_list_mgr->m_cpu_access_last_frame = command_list_mgr->m_cpu_access_this_frame;
- command_list_mgr->m_cpu_access_this_frame = false;
- command_list_mgr->m_draws_since_last_execution = 0;
-}
-
-HRESULT SetFullscreenState(bool enable_fullscreen)
-{
- return S_OK;
-}
-
-bool GetFullscreenState()
-{
- // Fullscreen exclusive intentionally not supported in DX12 backend. No performance
- // difference between it and windowed full-screen due to usage of a FLIP swap chain.
- return false;
-}
-
-} // namespace D3D
-
-} // namespace DX12
diff --git a/Source/Core/VideoBackends/D3D12/D3DBase.h b/Source/Core/VideoBackends/D3D12/D3DBase.h
deleted file mode 100644
index 3690603693..0000000000
--- a/Source/Core/VideoBackends/D3D12/D3DBase.h
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright 2010 Dolphin Emulator Project
-// Licensed under GPLv2+
-// Refer to the license.txt file included.
-
-#define USE_D3D12_QUEUED_COMMAND_LISTS
-
-// D3D12TODO: Support this from Graphics Settings, not require a recompile to enable.
-//#define USE_D3D12_DEBUG_LAYER
-
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-
-#include "../../Externals/d3dx12/d3dx12.h"
-
-#include "Common/Common.h"
-#include "Common/CommonTypes.h"
-#include "Common/MsgHandler.h"
-
-namespace DX12
-{
-#define SAFE_RELEASE(x) \
- { \
- if (x) \
- (x)->Release(); \
- (x) = nullptr; \
- }
-#define CHECK(cond, Message, ...) \
- if (!(cond)) \
- { \
- __debugbreak(); \
- PanicAlert(__FUNCTION__ " failed in %s at line %d: " Message, __FILE__, __LINE__, \
- __VA_ARGS__); \
- }
-
-// DEBUGCHECK is for high-frequency functions that we only want to check on debug builds.
-#if defined(_DEBUG) || defined(DEBUGFAST)
-#define DEBUGCHECK(cond, Message, ...) \
- if (!(cond)) \
- { \
- PanicAlert(__FUNCTION__ " failed in %s at line %d: " Message, __FILE__, __LINE__, \
- __VA_ARGS__); \
- }
-#else
-#define DEBUGCHECK(cond, Message, ...)
-#endif
-
-inline void CheckHR(HRESULT hr)
-{
- CHECK(SUCCEEDED(hr), "Failed HRESULT.");
-}
-
-class D3DCommandListManager;
-class D3DDescriptorHeapManager;
-class D3DTexture2D;
-
-enum GRAPHICS_ROOT_PARAMETER : u32
-{
- DESCRIPTOR_TABLE_PS_SRV,
- DESCRIPTOR_TABLE_PS_SAMPLER,
- DESCRIPTOR_TABLE_GS_CBV,
- DESCRIPTOR_TABLE_VS_CBV,
- DESCRIPTOR_TABLE_PS_CBVONE,
- DESCRIPTOR_TABLE_PS_CBVTWO,
- DESCRIPTOR_TABLE_PS_UAV,
- NUM_GRAPHICS_ROOT_PARAMETERS
-};
-
-namespace D3D
-{
-HRESULT LoadDXGI();
-HRESULT LoadD3D();
-HRESULT LoadD3DCompiler();
-void UnloadDXGI();
-void UnloadD3D();
-void UnloadD3DCompiler();
-
-std::vector EnumAAModes(ID3D12Device* device);
-
-HRESULT Create(HWND wnd);
-
-void CreateDescriptorHeaps();
-void CreateRootSignatures();
-
-void WaitForOutstandingRenderingToComplete();
-void Close();
-
-extern ID3D12Device* device12;
-
-extern unsigned int resource_descriptor_size;
-extern unsigned int sampler_descriptor_size;
-extern std::unique_ptr gpu_descriptor_heap_mgr;
-extern std::unique_ptr sampler_descriptor_heap_mgr;
-extern std::unique_ptr dsv_descriptor_heap_mgr;
-extern std::unique_ptr rtv_descriptor_heap_mgr;
-extern std::array gpu_descriptor_heaps;
-
-extern D3D12_CPU_DESCRIPTOR_HANDLE null_srv_cpu;
-extern D3D12_CPU_DESCRIPTOR_HANDLE null_srv_cpu_shadow;
-
-extern std::unique_ptr command_list_mgr;
-extern ID3D12GraphicsCommandList* current_command_list;
-
-extern ID3D12RootSignature* default_root_signature;
-
-extern HWND hWnd;
-
-void Reset();
-bool BeginFrame();
-void EndFrame();
-void Present();
-
-unsigned int GetBackBufferWidth();
-unsigned int GetBackBufferHeight();
-D3DTexture2D*& GetBackBuffer();
-const std::string PixelShaderVersionString();
-const std::string GeometryShaderVersionString();
-const std::string VertexShaderVersionString();
-
-HRESULT SetFullscreenState(bool enable_fullscreen);
-bool GetFullscreenState();
-
-// This function will assign a name to the given resource.
-// The DirectX debug layer will make it easier to identify resources that way,
-// e.g. when listing up all resources who have unreleased references.
-static void SetDebugObjectName12(ID3D12Resource* resource, LPCSTR name)
-{
- HRESULT hr =
- resource->SetPrivateData(WKPDID_D3DDebugObjectName, (UINT)(name ? strlen(name) : 0), name);
- if (FAILED(hr))
- {
- throw std::exception("Failure setting name for D3D12 object");
- }
-}
-
-static std::string GetDebugObjectName12(ID3D12Resource* resource)
-{
- std::string name;
-
- if (resource)
- {
- UINT size = 0;
- resource->GetPrivateData(WKPDID_D3DDebugObjectName, &size, nullptr); // get required size
- name.resize(size);
- resource->GetPrivateData(WKPDID_D3DDebugObjectName, &size, const_cast(name.data()));
- }
-
- return name;
-}
-
-} // namespace D3D
-
-using CREATEDXGIFACTORY = HRESULT(WINAPI*)(REFIID, void**);
-extern CREATEDXGIFACTORY create_dxgi_factory;
-
-using D3D12CREATEDEVICE = HRESULT(WINAPI*)(IUnknown*, D3D_FEATURE_LEVEL, REFIID, void**);
-extern D3D12CREATEDEVICE d3d12_create_device;
-
-using D3D12SERIALIZEROOTSIGNATURE =
- HRESULT(WINAPI*)(const D3D12_ROOT_SIGNATURE_DESC* pRootSignature,
- D3D_ROOT_SIGNATURE_VERSION Version, ID3DBlob** ppBlob, ID3DBlob** ppErrorBlob);
-using D3D12GETDEBUGINTERFACE = HRESULT(WINAPI*)(REFIID riid, void** ppvDebug);
-
-using D3DREFLECT = HRESULT(WINAPI*)(LPCVOID, SIZE_T, REFIID, void**);
-extern D3DREFLECT d3d_reflect;
-
-using D3DCREATEBLOB = HRESULT(WINAPI*)(SIZE_T, ID3DBlob**);
-extern D3DCREATEBLOB d3d_create_blob;
-
-extern pD3DCompile d3d_compile;
-
-} // namespace DX12
diff --git a/Source/Core/VideoBackends/D3D12/D3DCommandListManager.cpp b/Source/Core/VideoBackends/D3D12/D3DCommandListManager.cpp
deleted file mode 100644
index 5a8f0bc106..0000000000
--- a/Source/Core/VideoBackends/D3D12/D3DCommandListManager.cpp
+++ /dev/null
@@ -1,389 +0,0 @@
-// Copyright 2015 Dolphin Emulator Project
-// Licensed under GPLv2+
-// Refer to the license.txt file included.
-
-#include
-#include
-#include
-
-#include "VideoBackends/D3D12/D3DBase.h"
-#include "VideoBackends/D3D12/D3DCommandListManager.h"
-#include "VideoBackends/D3D12/D3DDescriptorHeapManager.h"
-#include "VideoBackends/D3D12/D3DQueuedCommandList.h"
-#include "VideoBackends/D3D12/D3DState.h"
-#include "VideoBackends/D3D12/D3DTexture.h"
-
-#include "VideoBackends/D3D12/Render.h"
-#include "VideoBackends/D3D12/ShaderConstantsManager.h"
-#include "VideoBackends/D3D12/VertexManager.h"
-
-static constexpr unsigned int COMMAND_ALLOCATORS_PER_LIST = 2;
-
-namespace DX12
-{
-extern StateCache gx_state_cache;
-
-D3DCommandListManager::D3DCommandListManager(D3D12_COMMAND_LIST_TYPE command_list_type,
- ID3D12Device* device,
- ID3D12CommandQueue* command_queue)
- : m_device(device), m_command_queue(command_queue)
-{
- // Create two lists, with two command allocators each. This corresponds to up to two frames in
- // flight at once.
- m_current_command_allocator = 0;
- m_current_command_allocator_list = 0;
- for (UINT i = 0; i < COMMAND_ALLOCATORS_PER_LIST; i++)
- {
- for (UINT j = 0; j < m_command_allocator_lists.size(); j++)
- {
- ID3D12CommandAllocator* command_allocator = nullptr;
-
- CheckHR(
- m_device->CreateCommandAllocator(command_list_type, IID_PPV_ARGS(&command_allocator)));
- m_command_allocator_lists[j].push_back(command_allocator);
- }
- }
-
- // Create backing command list.
- CheckHR(m_device->CreateCommandList(
- 0, command_list_type, m_command_allocator_lists[m_current_command_allocator_list][0], nullptr,
- IID_PPV_ARGS(&m_backing_command_list)));
-
-#ifdef USE_D3D12_QUEUED_COMMAND_LISTS
- m_queued_command_list = new ID3D12QueuedCommandList(m_backing_command_list, m_command_queue);
-#endif
-
- // Create fence that will be used to measure GPU progress of app rendering requests (e.g. CPU
- // readback of GPU data).
- m_queue_fence_value = 0;
- CheckHR(m_device->CreateFence(m_queue_fence_value, D3D12_FENCE_FLAG_NONE,
- IID_PPV_ARGS(&m_queue_fence)));
-
- // Create fence that will be used internally by D3DCommandListManager for frame-level resource
- // tracking.
- m_queue_frame_fence_value = 0;
- CheckHR(m_device->CreateFence(m_queue_frame_fence_value, D3D12_FENCE_FLAG_NONE,
- IID_PPV_ARGS(&m_queue_frame_fence)));
-
- // Create event that will be used for waiting on CPU until a fence is signaled by GPU.
- m_wait_on_cpu_fence_event = CreateEvent(nullptr, FALSE, FALSE, nullptr);
-
- // Pre-size the deferred destruction lists.
- for (UINT i = 0; i < m_deferred_destruction_lists.size(); i++)
- {
- m_deferred_destruction_lists[i].reserve(200);
- }
-
- m_current_deferred_destruction_list = 0;
-
- std::fill(m_command_allocator_list_fences.begin(), m_command_allocator_list_fences.end(), 0);
- std::fill(m_deferred_destruction_list_fences.begin(), m_deferred_destruction_list_fences.end(),
- 0);
-}
-
-void D3DCommandListManager::SetInitialCommandListState()
-{
- ID3D12GraphicsCommandList* command_list = nullptr;
- GetCommandList(&command_list);
-
- command_list->SetDescriptorHeaps(static_cast(D3D::gpu_descriptor_heaps.size()),
- D3D::gpu_descriptor_heaps.data());
- command_list->SetGraphicsRootSignature(D3D::default_root_signature);
-
- if (g_renderer)
- {
- // It is possible that we change command lists in the middle of the frame. In that case, restore
- // the viewport/scissor to the current console GPU state.
- g_renderer->RestoreAPIState();
- }
-
- m_command_list_dirty_state = UINT_MAX;
-
- command_list->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
- m_command_list_current_topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
-
- if (g_vertex_manager)
- reinterpret_cast(g_vertex_manager.get())->SetIndexBuffer();
-}
-
-void D3DCommandListManager::GetCommandList(ID3D12GraphicsCommandList** command_list) const
-{
-#ifdef USE_D3D12_QUEUED_COMMAND_LISTS
- *command_list = this->m_queued_command_list;
-#else
- *command_list = this->m_backing_command_list;
-#endif
-}
-
-void D3DCommandListManager::ExecuteQueuedWork(bool wait_for_gpu_completion)
-{
- m_queue_fence_value++;
-
-#ifdef USE_D3D12_QUEUED_COMMAND_LISTS
- m_queued_command_list->Close();
- m_queued_command_list->QueueExecute();
- m_queued_command_list->QueueFenceGpuSignal(m_queue_fence, m_queue_fence_value);
- m_queued_command_list->ProcessQueuedItems(wait_for_gpu_completion, wait_for_gpu_completion);
-#else
- CheckHR(m_backing_command_list->Close());
-
- ID3D12CommandList* const execute_list[1] = {m_backing_command_list};
- m_command_queue->ExecuteCommandLists(1, execute_list);
-
- CheckHR(m_command_queue->Signal(m_queue_fence, m_queue_fence_value));
-#endif
-
- // Notify observers of the fence value for the current work to finish.
- for (auto it : m_queue_fence_callbacks)
- it.second(it.first, m_queue_fence_value);
-
- if (wait_for_gpu_completion)
- WaitForGPUCompletion();
-
- // Re-open the command list, using the current allocator.
- ResetCommandList();
- SetInitialCommandListState();
-}
-
-void D3DCommandListManager::ExecuteQueuedWorkAndPresent(IDXGISwapChain* swap_chain,
- UINT sync_interval, UINT flags)
-{
- m_queue_fence_value++;
-
-#ifdef USE_D3D12_QUEUED_COMMAND_LISTS
- m_queued_command_list->Close();
- m_queued_command_list->QueueExecute();
- m_queued_command_list->QueuePresent(swap_chain, sync_interval, flags);
- m_queued_command_list->QueueFenceGpuSignal(m_queue_fence, m_queue_fence_value);
- m_queued_command_list->ProcessQueuedItems(true);
-#else
- CheckHR(m_backing_command_list->Close());
-
- ID3D12CommandList* const execute_list[1] = {m_backing_command_list};
- m_command_queue->ExecuteCommandLists(1, execute_list);
-
- CheckHR(swap_chain->Present(sync_interval, flags));
- CheckHR(m_command_queue->Signal(m_queue_fence, m_queue_fence_value));
-#endif
-
- // Notify observers of the fence value for the current work to finish.
- for (auto it : m_queue_fence_callbacks)
- it.second(it.first, m_queue_fence_value);
-
- // Move to the next command allocator, this may mean switching allocator lists.
- MoveToNextCommandAllocator();
- ResetCommandList();
- SetInitialCommandListState();
-}
-
-void D3DCommandListManager::DestroyAllPendingResources()
-{
- for (auto& destruction_list : m_deferred_destruction_lists)
- {
- for (auto& resource : destruction_list)
- resource->Release();
-
- destruction_list.clear();
- }
-}
-
-void D3DCommandListManager::ResetAllCommandAllocators()
-{
- for (auto& allocator_list : m_command_allocator_lists)
- {
- for (auto& allocator : allocator_list)
- allocator->Reset();
- }
-
- // Move back to the start, using the first allocator of first list.
- m_current_command_allocator = 0;
- m_current_command_allocator_list = 0;
- m_current_deferred_destruction_list = 0;
-}
-
-void D3DCommandListManager::WaitForGPUCompletion()
-{
- // Wait for GPU to finish all outstanding work.
- // This method assumes that no command lists are open.
- m_queue_frame_fence_value++;
-
-#ifdef USE_D3D12_QUEUED_COMMAND_LISTS
- m_queued_command_list->QueueFenceGpuSignal(m_queue_frame_fence, m_queue_frame_fence_value);
- m_queued_command_list->ProcessQueuedItems(true);
-#else
- CheckHR(m_command_queue->Signal(m_queue_frame_fence, m_queue_frame_fence_value));
-#endif
-
- WaitOnCPUForFence(m_queue_frame_fence, m_queue_frame_fence_value);
-
- // GPU is up to date with us. Therefore, it has finished with any pending resources.
- DestroyAllPendingResources();
-
- // Command allocators are also up-to-date, so reset these.
- ResetAllCommandAllocators();
-}
-
-void D3DCommandListManager::PerformGPURolloverChecks()
-{
- m_queue_frame_fence_value++;
-
-#ifdef USE_D3D12_QUEUED_COMMAND_LISTS
- m_queued_command_list->QueueFenceGpuSignal(m_queue_frame_fence, m_queue_frame_fence_value);
-#else
- CheckHR(m_command_queue->Signal(m_queue_frame_fence, m_queue_frame_fence_value));
-#endif
-
- // We now know that the previous 'set' of command lists has completed on GPU, and it is safe to
- // release resources / start back at beginning of command allocator list.
-
- // Begin Deferred Resource Destruction
- UINT safe_to_delete_deferred_destruction_list =
- (m_current_deferred_destruction_list - 1) % m_deferred_destruction_lists.size();
- WaitOnCPUForFence(m_queue_frame_fence,
- m_deferred_destruction_list_fences[safe_to_delete_deferred_destruction_list]);
-
- for (UINT i = 0;
- i < m_deferred_destruction_lists[safe_to_delete_deferred_destruction_list].size(); i++)
- {
- CHECK(m_deferred_destruction_lists[safe_to_delete_deferred_destruction_list][i]->Release() == 0,
- "Resource leak.");
- }
-
- m_deferred_destruction_lists[safe_to_delete_deferred_destruction_list].clear();
-
- m_deferred_destruction_list_fences[m_current_deferred_destruction_list] =
- m_queue_frame_fence_value;
- m_current_deferred_destruction_list =
- (m_current_deferred_destruction_list + 1) % m_deferred_destruction_lists.size();
- // End Deferred Resource Destruction
-
- // Begin Command Allocator Resets
- UINT safe_to_reset_command_allocator_list =
- (m_current_command_allocator_list - 1) % m_command_allocator_lists.size();
- WaitOnCPUForFence(m_queue_frame_fence,
- m_command_allocator_list_fences[safe_to_reset_command_allocator_list]);
-
- for (UINT i = 0; i < m_command_allocator_lists[safe_to_reset_command_allocator_list].size(); i++)
- {
- CheckHR(m_command_allocator_lists[safe_to_reset_command_allocator_list][i]->Reset());
- }
-
- m_command_allocator_list_fences[m_current_command_allocator_list] = m_queue_frame_fence_value;
- m_current_command_allocator_list =
- (m_current_command_allocator_list + 1) % m_command_allocator_lists.size();
- m_current_command_allocator = 0;
- // End Command Allocator Resets
-}
-
-void D3DCommandListManager::MoveToNextCommandAllocator()
-{
- // Move to the next allocator in the current allocator list.
- m_current_command_allocator = (m_current_command_allocator + 1) %
- m_command_allocator_lists[m_current_command_allocator_list].size();
-
- // Did we wrap around? Move to the next set of allocators.
- if (m_current_command_allocator == 0)
- PerformGPURolloverChecks();
-}
-
-void D3DCommandListManager::ResetCommandList()
-{
-#ifdef USE_D3D12_QUEUED_COMMAND_LISTS
- ID3D12QueuedCommandList* command_list = m_queued_command_list;
-#else
- ID3D12GraphicsCommandList* command_list = m_backing_command_list;
-#endif
-
- CheckHR(command_list->Reset(m_command_allocator_lists[m_current_command_allocator_list]
- [m_current_command_allocator],
- nullptr));
-}
-
-void D3DCommandListManager::DestroyResourceAfterCurrentCommandListExecuted(ID3D12Resource* resource)
-{
- CHECK(resource, "Null resource being inserted!");
-
- m_deferred_destruction_lists[m_current_deferred_destruction_list].push_back(resource);
-}
-
-D3DCommandListManager::~D3DCommandListManager()
-{
-#ifdef USE_D3D12_QUEUED_COMMAND_LISTS
- // Wait for background thread to exit.
- m_queued_command_list->Release();
-#endif
-
- // The command list will still be open, close it before destroying.
- m_backing_command_list->Close();
-
- DestroyAllPendingResources();
-
- m_backing_command_list->Release();
-
- for (auto& allocator_list : m_command_allocator_lists)
- {
- for (auto& resource : allocator_list)
- resource->Release();
- }
-
- m_queue_fence->Release();
- m_queue_frame_fence->Release();
-
- CloseHandle(m_wait_on_cpu_fence_event);
-}
-
-void D3DCommandListManager::WaitOnCPUForFence(ID3D12Fence* fence, UINT64 fence_value)
-{
- if (fence->GetCompletedValue() >= fence_value)
- return;
-
- CheckHR(fence->SetEventOnCompletion(fence_value, m_wait_on_cpu_fence_event));
- WaitForSingleObject(m_wait_on_cpu_fence_event, INFINITE);
-}
-
-void D3DCommandListManager::SetCommandListDirtyState(unsigned int command_list_state, bool dirty)
-{
- if (dirty)
- m_command_list_dirty_state |= command_list_state;
- else
- m_command_list_dirty_state &= ~command_list_state;
-}
-
-bool D3DCommandListManager::GetCommandListDirtyState(COMMAND_LIST_STATE command_list_state) const
-{
- return ((m_command_list_dirty_state & command_list_state) != 0);
-}
-
-void D3DCommandListManager::SetCommandListPrimitiveTopology(
- D3D_PRIMITIVE_TOPOLOGY primitive_topology)
-{
- m_command_list_current_topology = primitive_topology;
-}
-
-D3D_PRIMITIVE_TOPOLOGY D3DCommandListManager::GetCommandListPrimitiveTopology() const
-{
- return m_command_list_current_topology;
-}
-
-void D3DCommandListManager::CPUAccessNotify()
-{
- m_cpu_access_last_frame = true;
- m_cpu_access_this_frame = true;
- m_draws_since_last_execution = 0;
-};
-
-ID3D12Fence*
-D3DCommandListManager::RegisterQueueFenceCallback(void* owning_object,
- PFN_QUEUE_FENCE_CALLBACK* callback_function)
-{
- m_queue_fence_callbacks[owning_object] = callback_function;
-
- return m_queue_fence;
-}
-
-void D3DCommandListManager::RemoveQueueFenceCallback(void* owning_object)
-{
- m_queue_fence_callbacks.erase(owning_object);
-}
-
-} // namespace DX12
\ No newline at end of file
diff --git a/Source/Core/VideoBackends/D3D12/D3DCommandListManager.h b/Source/Core/VideoBackends/D3D12/D3DCommandListManager.h
deleted file mode 100644
index 0c8fd1a474..0000000000
--- a/Source/Core/VideoBackends/D3D12/D3DCommandListManager.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2015 Dolphin Emulator Project
-// Licensed under GPLv2+
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include
-#include