11#include <d3d12sdklayers.h>
17void get_hardware_adapter(IDXGIFactory4* pFactory, IDXGIAdapter1** ppAdapter) {
19 for (
UINT adapterIndex = 0; ; ++adapterIndex) {
20 IDXGIAdapter1* pAdapter =
nullptr;
21 if (DXGI_ERROR_NOT_FOUND == pFactory->EnumAdapters1(adapterIndex, &pAdapter)) {
28 if (
SUCCEEDED(D3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device),
30 *ppAdapter = pAdapter;
39#if defined(SK_ENABLE_D3D_DEBUG_LAYER)
43 if (
SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&debugController))))
45 debugController->EnableDebugLayer();
51 if (!
SUCCEEDED(CreateDXGIFactory1(IID_PPV_ARGS(&factory)))) {
56 get_hardware_adapter(factory.
get(), &hardwareAdapter);
60 D3D_FEATURE_LEVEL_11_0,
67 D3D12_COMMAND_QUEUE_DESC queueDesc = {};
68 queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
69 queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
gr_cp< ID3D12Device > fDevice
gr_cp< IDXGIAdapter1 > fAdapter
gr_cp< ID3D12CommandQueue > fQueue
GrProtected fProtectedContext