mirror of https://github.com/PCSX2/pcsx2.git
Frontend: Remove unused code
This commit is contained in:
parent
9655d28a23
commit
cad489480c
|
@ -217,11 +217,7 @@ bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view
|
|||
create_flags |= D3D11_CREATE_DEVICE_DEBUG;
|
||||
|
||||
ComPtr<IDXGIFactory> temp_dxgi_factory;
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
HRESULT hr = CreateDXGIFactory(IID_PPV_ARGS(temp_dxgi_factory.GetAddressOf()));
|
||||
#else
|
||||
HRESULT hr = CreateDXGIFactory2(0, IID_PPV_ARGS(temp_dxgi_factory.GetAddressOf()));
|
||||
#endif
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("Failed to create DXGI factory: 0x%08X", hr);
|
||||
|
@ -345,9 +341,6 @@ bool D3D11HostDisplay::DoneRenderContextCurrent()
|
|||
|
||||
bool D3D11HostDisplay::CreateSwapChain(const DXGI_MODE_DESC* fullscreen_mode)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
if (m_window_info.type != WindowInfo::Type::Win32)
|
||||
return false;
|
||||
|
||||
|
@ -385,7 +378,7 @@ bool D3D11HostDisplay::CreateSwapChain(const DXGI_MODE_DESC* fullscreen_mode)
|
|||
swap_chain_desc.BufferDesc.Height, m_using_flip_model_swap_chain ? "flip-discard" : "discard",
|
||||
swap_chain_desc.Windowed ? "windowed" : "full-screen");
|
||||
|
||||
hr = m_dxgi_factory->CreateSwapChain(m_device.Get(), &swap_chain_desc, m_swap_chain.GetAddressOf());
|
||||
HRESULT hr = m_dxgi_factory->CreateSwapChain(m_device.Get(), &swap_chain_desc, m_swap_chain.GetAddressOf());
|
||||
if (FAILED(hr) && m_using_flip_model_swap_chain)
|
||||
{
|
||||
Console.Warning("Failed to create a flip-discard swap chain, trying discard.");
|
||||
|
@ -410,42 +403,6 @@ bool D3D11HostDisplay::CreateSwapChain(const DXGI_MODE_DESC* fullscreen_mode)
|
|||
if (FAILED(hr))
|
||||
Console.Warning("MakeWindowAssociation() to disable ALT+ENTER failed");
|
||||
}
|
||||
#else
|
||||
if (m_window_info.type != WindowInfo::Type::WinRT)
|
||||
return false;
|
||||
|
||||
ComPtr<IDXGIFactory2> factory2;
|
||||
hr = m_dxgi_factory.As(&factory2);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("Failed to get DXGI factory: %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
DXGI_SWAP_CHAIN_DESC1 swap_chain_desc = {};
|
||||
swap_chain_desc.Width = m_window_info.surface_width;
|
||||
swap_chain_desc.Height = m_window_info.surface_height;
|
||||
swap_chain_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
swap_chain_desc.SampleDesc.Count = 1;
|
||||
swap_chain_desc.BufferCount = 3;
|
||||
swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
swap_chain_desc.SwapEffect = m_using_flip_model_swap_chain ? DXGI_SWAP_EFFECT_FLIP_DISCARD : DXGI_SWAP_EFFECT_DISCARD;
|
||||
|
||||
m_using_allow_tearing = (m_allow_tearing_supported && m_using_flip_model_swap_chain && !fullscreen_mode);
|
||||
if (m_using_allow_tearing)
|
||||
swap_chain_desc.Flags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
|
||||
|
||||
ComPtr<IDXGISwapChain1> swap_chain1;
|
||||
hr = factory2->CreateSwapChainForCoreWindow(m_device.Get(), static_cast<IUnknown*>(m_window_info.window_handle),
|
||||
&swap_chain_desc, nullptr, swap_chain1.GetAddressOf());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("CreateSwapChainForCoreWindow failed: 0x%08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_swap_chain = swap_chain1;
|
||||
#endif
|
||||
|
||||
return CreateSwapChainRTV();
|
||||
}
|
||||
|
@ -865,11 +822,7 @@ float D3D11HostDisplay::GetAndResetAccumulatedGPUTime()
|
|||
HostDisplay::AdapterAndModeList D3D11HostDisplay::StaticGetAdapterAndModeList()
|
||||
{
|
||||
ComPtr<IDXGIFactory> dxgi_factory;
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
HRESULT hr = CreateDXGIFactory(IID_PPV_ARGS(dxgi_factory.GetAddressOf()));
|
||||
#else
|
||||
HRESULT hr = CreateDXGIFactory2(0, IID_PPV_ARGS(dxgi_factory.GetAddressOf()));
|
||||
#endif
|
||||
const HRESULT hr = CreateDXGIFactory(IID_PPV_ARGS(dxgi_factory.GetAddressOf()));
|
||||
if (FAILED(hr))
|
||||
return {};
|
||||
|
||||
|
|
|
@ -139,12 +139,7 @@ void D3D12HostDisplay::SetVSync(VsyncMode mode)
|
|||
bool D3D12HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, VsyncMode vsync, bool threaded_presentation, bool debug_device)
|
||||
{
|
||||
ComPtr<IDXGIFactory> temp_dxgi_factory;
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
HRESULT hr = CreateDXGIFactory(IID_PPV_ARGS(temp_dxgi_factory.put()));
|
||||
#else
|
||||
HRESULT hr = CreateDXGIFactory2(0, IID_PPV_ARGS(temp_dxgi_factory.put()));
|
||||
#endif
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("Failed to create DXGI factory: 0x%08X", hr);
|
||||
|
@ -220,9 +215,6 @@ bool D3D12HostDisplay::DoneRenderContextCurrent()
|
|||
|
||||
bool D3D12HostDisplay::CreateSwapChain(const DXGI_MODE_DESC* fullscreen_mode)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
if (m_window_info.type != WindowInfo::Type::Win32)
|
||||
return false;
|
||||
|
||||
|
@ -257,7 +249,7 @@ bool D3D12HostDisplay::CreateSwapChain(const DXGI_MODE_DESC* fullscreen_mode)
|
|||
DevCon.WriteLn("Creating a %dx%d %s swap chain", swap_chain_desc.BufferDesc.Width, swap_chain_desc.BufferDesc.Height,
|
||||
swap_chain_desc.Windowed ? "windowed" : "full-screen");
|
||||
|
||||
hr =
|
||||
HRESULT hr =
|
||||
m_dxgi_factory->CreateSwapChain(g_d3d12_context->GetCommandQueue(), &swap_chain_desc, m_swap_chain.put());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -268,43 +260,6 @@ bool D3D12HostDisplay::CreateSwapChain(const DXGI_MODE_DESC* fullscreen_mode)
|
|||
hr = m_dxgi_factory->MakeWindowAssociation(swap_chain_desc.OutputWindow, DXGI_MWA_NO_WINDOW_CHANGES);
|
||||
if (FAILED(hr))
|
||||
Console.Warning("MakeWindowAssociation() to disable ALT+ENTER failed");
|
||||
#else
|
||||
if (m_window_info.type != WindowInfo::Type::WinRT)
|
||||
return false;
|
||||
|
||||
ComPtr<IDXGIFactory2> factory2;
|
||||
hr = m_dxgi_factory.As(&factory2);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("Failed to get DXGI factory: %08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
DXGI_SWAP_CHAIN_DESC1 swap_chain_desc = {};
|
||||
swap_chain_desc.Width = m_window_info.surface_width;
|
||||
swap_chain_desc.Height = m_window_info.surface_height;
|
||||
swap_chain_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
swap_chain_desc.SampleDesc.Count = 1;
|
||||
swap_chain_desc.BufferCount = 3;
|
||||
swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
||||
|
||||
m_using_allow_tearing = (m_allow_tearing_supported && !fullscreen_mode);
|
||||
if (m_using_allow_tearing)
|
||||
swap_chain_desc.Flags |= DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
|
||||
|
||||
ComPtr<IDXGISwapChain1> swap_chain1;
|
||||
hr = factory2->CreateSwapChainForCoreWindow(g_d3d12_context->GetCommandQueue(),
|
||||
static_cast<IUnknown*>(m_window_info.window_handle), &swap_chain_desc,
|
||||
nullptr, swap_chain1.GetAddressOf());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Error("CreateSwapChainForCoreWindow failed: 0x%08X", hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_swap_chain = swap_chain1;
|
||||
#endif
|
||||
|
||||
return CreateSwapChainRTV();
|
||||
}
|
||||
|
@ -654,11 +609,7 @@ float D3D12HostDisplay::GetAndResetAccumulatedGPUTime()
|
|||
HostDisplay::AdapterAndModeList D3D12HostDisplay::StaticGetAdapterAndModeList()
|
||||
{
|
||||
ComPtr<IDXGIFactory> dxgi_factory;
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
HRESULT hr = CreateDXGIFactory(IID_PPV_ARGS(dxgi_factory.put()));
|
||||
#else
|
||||
HRESULT hr = CreateDXGIFactory2(0, IID_PPV_ARGS(dxgi_factory.put()));
|
||||
#endif
|
||||
const HRESULT hr = CreateDXGIFactory(IID_PPV_ARGS(dxgi_factory.put()));
|
||||
if (FAILED(hr))
|
||||
return {};
|
||||
|
||||
|
|
|
@ -96,7 +96,6 @@ XInputSource::~XInputSource() = default;
|
|||
|
||||
bool XInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
||||
{
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
// xinput1_3.dll is flawed and obsolete, but it's also commonly used by wrappers.
|
||||
// For this reason, try to load it *only* from the application directory, and not system32.
|
||||
m_xinput_module = LoadLibraryExW(L"xinput1_3", nullptr, LOAD_LIBRARY_SEARCH_APPLICATION_DIR);
|
||||
|
@ -127,12 +126,6 @@ bool XInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mutex
|
|||
// SCP extension, only exists when the bridge xinput1_3.dll is in use
|
||||
m_xinput_get_extended =
|
||||
reinterpret_cast<decltype(m_xinput_get_extended)>(GetProcAddress(m_xinput_module, "XInputGetExtended"));
|
||||
#else
|
||||
m_xinput_get_state = XInputGetState;
|
||||
m_xinput_set_state = XInputSetState;
|
||||
m_xinput_get_capabilities = XInputGetCapabilities;
|
||||
m_xinput_get_extended = nullptr;
|
||||
#endif
|
||||
if (!m_xinput_get_state || !m_xinput_set_state || !m_xinput_get_capabilities)
|
||||
{
|
||||
Console.Error("Failed to get XInput function pointers.");
|
||||
|
@ -154,13 +147,11 @@ void XInputSource::Shutdown()
|
|||
HandleControllerDisconnection(i);
|
||||
}
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
if (m_xinput_module)
|
||||
{
|
||||
FreeLibrary(m_xinput_module);
|
||||
m_xinput_module = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_xinput_get_state = nullptr;
|
||||
m_xinput_set_state = nullptr;
|
||||
|
|
Loading…
Reference in New Issue