Skip to content

Commit

Permalink
Dx12/Vulk: Fix KernelBase.dll crash (RPCS3#2870)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarveson authored and kd-11 committed Jun 13, 2017
1 parent 25823a1 commit 23d1ddb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
4 changes: 3 additions & 1 deletion rpcs3/Emu/RSX/VK/VKHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,9 @@ namespace vk
return gpus;

uint32_t num_gpus;
CHECK_RESULT(vkEnumeratePhysicalDevices(m_instance, &num_gpus, nullptr));
// This may fail on unsupported drivers, so just assume no devices
if (vkEnumeratePhysicalDevices(m_instance, &num_gpus, nullptr) != VK_SUCCESS)
return gpus;

if (gpus.size() != num_gpus)
{
Expand Down
33 changes: 18 additions & 15 deletions rpcs3/rpcs3qt/emu_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,30 @@ Render_Creator::Render_Creator()
{
// check for dx12 adapters
#ifdef _MSC_VER
Microsoft::WRL::ComPtr<IDXGIFactory4> dxgi_factory;
supportsD3D12 = SUCCEEDED(CreateDXGIFactory(IID_PPV_ARGS(&dxgi_factory)));
HMODULE D3D12Module = LoadLibrary(L"d3d12.dll");

if (supportsD3D12)
if (D3D12Module != NULL)
{
supportsD3D12 = false;
IDXGIAdapter1* pAdapter = nullptr;

for (UINT adapterIndex = 0; DXGI_ERROR_NOT_FOUND != dxgi_factory->EnumAdapters1(adapterIndex, &pAdapter); ++adapterIndex)
Microsoft::WRL::ComPtr<IDXGIAdapter1> pAdapter;
Microsoft::WRL::ComPtr<IDXGIFactory1> dxgi_factory;
if (SUCCEEDED(CreateDXGIFactory1(IID_PPV_ARGS(&dxgi_factory))))
{
HMODULE D3D12Module = verify("d3d12.dll", LoadLibrary(L"d3d12.dll"));
PFN_D3D12_CREATE_DEVICE wrapD3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)GetProcAddress(D3D12Module, "D3D12CreateDevice");

if (SUCCEEDED(wrapD3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device), nullptr)))
if (wrapD3D12CreateDevice != nullptr)
{
//A device with D3D12 support found. Init data
supportsD3D12 = true;
for (UINT adapterIndex = 0; DXGI_ERROR_NOT_FOUND != dxgi_factory->EnumAdapters1(adapterIndex, pAdapter.ReleaseAndGetAddressOf()); ++adapterIndex)
{
if (SUCCEEDED(wrapD3D12CreateDevice(pAdapter.Get(), D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device), nullptr)))
{
//A device with D3D12 support found. Init data
supportsD3D12 = true;

DXGI_ADAPTER_DESC desc;
pAdapter->GetDesc(&desc);
D3D12Adapters.append(QString::fromWCharArray(desc.Description));
DXGI_ADAPTER_DESC desc;
if (SUCCEEDED(pAdapter->GetDesc(&desc)))
D3D12Adapters.append(QString::fromWCharArray(desc.Description));
}
}

}
}
}
Expand Down
3 changes: 0 additions & 3 deletions rpcs3/rpcs3qt/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ main_window::main_window(QWidget *parent) : QMainWindow(parent), m_sys_menu_open

setDockNestingEnabled(true);

// Get Render Adapters
m_Render_Creator = Render_Creator();

//Load Icons: This needs to happen before any actions or buttons are created
icon_play = QIcon(":/Icons/play.png");
icon_pause = QIcon(":/Icons/pause.png");
Expand Down

0 comments on commit 23d1ddb

Please sign in to comment.