MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/FleX / AppGraphCtxCreate

Function AppGraphCtxCreate

demo/d3d11/appD3D11Ctx.cpp:64–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64AppGraphCtx* AppGraphCtxCreate(int deviceID)
65{
66 AppGraphCtx* context = new AppGraphCtx;
67
68 HRESULT hr = S_OK;
69
70 // enumerate devices
71 IDXGIFactory1* pFactory = NULL;
72 CreateDXGIFactory1(IID_PPV_ARGS(&pFactory));
73 IDXGIAdapter1* pAdapterTemp = NULL;
74 IDXGIAdapter1* pAdapter = NULL;
75 DXGI_ADAPTER_DESC1 adapterDesc;
76 int adapterIdx = 0;
77 while (S_OK == pFactory->EnumAdapters1(adapterIdx, &pAdapterTemp))
78 {
79 pAdapterTemp->GetDesc1(&adapterDesc);
80
81 context->m_dedicatedVideoMemory = (size_t)adapterDesc.DedicatedVideoMemory;
82
83 if (deviceID == adapterIdx)
84 {
85 pAdapter = pAdapterTemp;
86 break;
87 }
88 else
89 {
90 pAdapterTemp->Release();
91 }
92 adapterIdx++;
93 }
94
95 D3D_DRIVER_TYPE driverTypes[] =
96 {
97 D3D_DRIVER_TYPE_UNKNOWN,
98 D3D_DRIVER_TYPE_HARDWARE,
99 D3D_DRIVER_TYPE_WARP,
100 D3D_DRIVER_TYPE_REFERENCE,
101 };
102 UINT numDriverTypes = 4;
103
104 D3D_FEATURE_LEVEL featureLevels[] =
105 {
106 D3D_FEATURE_LEVEL_11_1,
107 D3D_FEATURE_LEVEL_11_0,
108 D3D_FEATURE_LEVEL_10_1,
109 D3D_FEATURE_LEVEL_10_0,
110 };
111 UINT numFeatureLevels = 4;
112
113 UINT createDeviceFlags = 0;
114#ifdef _DEBUG
115 createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
116#endif
117
118 for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++)
119 {
120 D3D_FEATURE_LEVEL featureLevel;
121 D3D_DRIVER_TYPE driverType = driverTypes[driverTypeIndex];

Callers 1

InitRenderFunction · 0.85

Calls 2

ReleaseMethod · 0.80
COMReleaseFunction · 0.70

Tested by

no test coverage detected