d3d12: Move adapter's description to settings.

This commit is contained in:
Vincent Lejeune 2015-10-04 17:35:15 +02:00
parent a5ecbd0b2b
commit 2f211e4e5a
5 changed files with 25 additions and 31 deletions

View File

@ -159,20 +159,9 @@ D3D12GSRender::D3D12GSRender()
Microsoft::WRL::ComPtr<IDXGIFactory4> dxgiFactory;
ThrowIfFailed(CreateDXGIFactory(IID_PPV_ARGS(&dxgiFactory)));
// Create adapter
IDXGIAdapter* adaptater = nullptr;
switch (Ini.GSD3DAdaptater.GetValue())
{
case 0: // WARP
ThrowIfFailed(dxgiFactory->EnumWarpAdapter(IID_PPV_ARGS(&adaptater)));
break;
case 1: // Default
dxgiFactory->EnumAdapters(0, &adaptater);
break;
default: // Adaptater 0, 1, ...
dxgiFactory->EnumAdapters(Ini.GSD3DAdaptater.GetValue() - 2,&adaptater);
break;
}
ThrowIfFailed(wrapD3D12CreateDevice(adaptater, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device)));
ComPtr<IDXGIAdapter> adaptater = nullptr;
ThrowIfFailed(dxgiFactory->EnumAdapters(Ini.GSD3DAdaptater.GetValue(), adaptater.GetAddressOf()));
ThrowIfFailed(wrapD3D12CreateDevice(adaptater.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device)));
// Queues
D3D12_COMMAND_QUEUE_DESC copyQueueDesc = {}, graphicQueueDesc = {};
@ -186,9 +175,6 @@ D3D12GSRender::D3D12GSRender()
g_descriptorStrideSamplers = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
m_frame = GetGSFrame();
DXGI_ADAPTER_DESC adaptaterDesc;
adaptater->GetDesc(&adaptaterDesc);
m_frame->SetAdaptaterName(adaptaterDesc.Description);
// Create swap chain and put them in a descriptor heap as rendertarget
DXGI_SWAP_CHAIN_DESC swapChain = {};

View File

@ -57,7 +57,6 @@ public:
virtual void DeleteContext(void* ctx) = 0;
virtual void Flip(void* ctx) = 0;
virtual HWND getHandle() const = 0;
virtual void SetAdaptaterName(const wchar_t *) = 0;
};
typedef GSFrameBase2*(*GetGSFrameCb2)();

View File

@ -20,11 +20,6 @@ D3DGSFrame::~D3DGSFrame()
{
}
void D3DGSFrame::SetAdaptaterName(const wchar_t *name)
{
AdaptaterName = name;
}
void D3DGSFrame::Close()
{
GSFrame::Close();
@ -69,7 +64,7 @@ void D3DGSFrame::Flip(void* context)
// canvas->SwapBuffers();
m_frames++;
const std::string sub_title = Emu.GetTitle() + (Emu.GetTitleID().length() ? " [" + Emu.GetTitleID() + "] | " : " | ") + AdaptaterName.ToStdString() + " | ";
const std::string sub_title = Emu.GetTitle() + (Emu.GetTitleID().length() ? " [" + Emu.GetTitleID() + "] | " : " | ") + " | ";
if (fps_t.GetElapsedTimeInSec() >= 0.5)
{

View File

@ -9,7 +9,6 @@ struct D3DGSFrame : public GSFrame, public GSFrameBase2
{
wxWindow* canvas;
u32 m_frames;
wxString AdaptaterName;
D3DGSFrame();
~D3DGSFrame();
@ -29,7 +28,6 @@ struct D3DGSFrame : public GSFrame, public GSFrameBase2
virtual void SetViewport(int x, int y, u32 w, u32 h) override;
virtual HWND getHandle() const override;
virtual void SetAdaptaterName(const wchar_t *) override;
private:
virtual void OnSize(wxSizeEvent& event);

View File

@ -7,6 +7,13 @@
#include "Utilities/Log.h"
#include <wx/radiobox.h>
#if defined(DX12_SUPPORT)
#undef GetHwnd
#include <d3d12.h>
#include <wrl/client.h>
#include <dxgi1_4.h>
#endif
SettingsDialog::SettingsDialog(wxWindow *parent)
: wxDialog(parent, wxID_ANY, "Settings", wxDefaultPosition)
{
@ -159,11 +166,20 @@ SettingsDialog::SettingsDialog(wxWindow *parent)
cbox_gs_render->Append("DirectX 12");
#endif
cbox_gs_d3d_adaptater->Append("WARP");
cbox_gs_d3d_adaptater->Append("Default");
cbox_gs_d3d_adaptater->Append("Renderer 0");
cbox_gs_d3d_adaptater->Append("Renderer 1");
cbox_gs_d3d_adaptater->Append("Renderer 2");
#if defined(DX12_SUPPORT)
unsigned id = 0;
Microsoft::WRL::ComPtr<IDXGIFactory4> dxgiFactory;
CreateDXGIFactory(IID_PPV_ARGS(&dxgiFactory));
Microsoft::WRL::ComPtr<IDXGIAdapter> adapter;
while (dxgiFactory->EnumAdapters(id, adapter.GetAddressOf()) != DXGI_ERROR_NOT_FOUND)
{
DXGI_ADAPTER_DESC adapterDesc;
adapter->GetDesc(&adapterDesc);
cbox_gs_d3d_adaptater->Append(adapterDesc.Description);
id++;
}
#endif
#if !defined(DX12_SUPPORT)
cbox_gs_d3d_adaptater->Enable(false);