Issues with D3D12CreateDevice

Started by
5 comments, last by Hodgman 5 years, 7 months ago

Hello. Basically I recently upgraded to Visual Studio 2017, and I wanted to experiment with DirectX12 for a change. But before I can even begin explaining the problem, I just wanna let you know ahead of time that I have the latest Windows 10 Home, the latest Visual Studio 2017 version 15.8.2, Game Development with C++ installed from Tools and Features, and according to my DirectX Diagnostic Tool, I have DirectX12 on my machine with Direct3D DDI: 11.2 and D3D Feature Levels 11_0, 10_1, 10_0, 9_3, 9_2, and 9_1.

Ok, now with that said, I made an extremely simple app with no overhead what-so-ever. It gets a list of adaptors, and displays them in the command prompt showing if it enabled directx or not.


#include <iostream>
#include <vector>
#include <string>

#include <d3d12.h>
#include <dxgi1_6.h>

using namespace std;

#include <wrl.h>
using namespace Microsoft::WRL;

#pragma comment(lib, "d3d12.lib")
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "d3dcompiler.lib")

void GetAdaptors() {
	HRESULT hr;
	UINT adaptorIndex = 0;
	ComPtr<IDXGIFactory4> dxgiFactory = nullptr;
	ComPtr<IDXGIAdapter1> adapter = nullptr;
	vector<ComPtr<IDXGIAdapter1>> adapterList;
	hr = CreateDXGIFactory1(IID_PPV_ARGS(&dxgiFactory));
	if FAILED(hr) {
		cout << "Failed to CreateDXGIFactory1" << endl;
		return;
	}
		
	while (dxgiFactory->EnumAdapters1(adaptorIndex, &adapter) != DXGI_ERROR_NOT_FOUND)
	{
		DXGI_ADAPTER_DESC1 desc;
		adapter->GetDesc1(&desc);
		wstring s = desc.Description;

		wcout << adaptorIndex << L": " << s.c_str() << endl;
		hr = D3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device), nullptr);
		if (SUCCEEDED(hr)){
			cout << "D3D12CreateDevice succeeded" << endl;
            adapterList.push_back(adapter);
            ++adaptorIndex;
  			return;
  		}
  		else
			cout << "D3D12CreateDevice failed" << endl;

		adapterList.push_back(adapter);
		++adaptorIndex;
	}
}

int main() {
	GetAdaptors();
	system("pause");
	return 0;
}

When I run the app, I get this:

0: AMD Mobility Radeon HD 5800 Series
D3D12CreateDevice failed
1: Microsoft Basic Render Driver
D3D12CreateDevice succeeded
Press any key to continue . . .

 

So basically my main gaming video card, the AMD Mobility Radeon HD 5800 Series, fails in creating directx12, but my software renderer only Microsoft Basic Render Driver succeeds? Could anyone explain how I might be able to get DirectX12 to successfully create using my AMD Mobility Radeon HD 5800 Series? There should be no reason for this to fail. Thanks in advance.

Advertisement

Why you pass nullptr to last argument of D3D12CreateDevice?

According to https://en.wikipedia.org/wiki/Feature_levels_in_Direct3D#Direct3D_12, AMD doesn't support the HD 5800 series for D3D12; it's a GPU architecture that's too old to support the GPU virtual addressing functionality required by D3D12 and WDDM2.0 in general.

Ah! So its a hardware issue then. Time for a new laptop... lol

14 hours ago, elgun said:

Why you pass nullptr to last argument of D3D12CreateDevice?

 

funny thing, microsoft did it off their own website:

https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/nf-d3d12-d3d12createdevice

There's a comment where they do that:

//Check to see if the adapter supports Direct3D 12, but don't create the actual device yet.

This topic is closed to new replies.

Advertisement