Avionics
Dropship Simulator
Viewport.cpp
Go to the documentation of this file.
1 #include "Viewport.h"
2 
3 Viewport::Viewport(Bus* prmBus, Logger* prmLogger)
4 {
5  bus = prmBus;
6  logger = prmLogger;
7 }
8 
9 void Viewport::Initialize(HINSTANCE hInstance)
10 {
11  HRESULT hr;
12 
13  // Create the DXGI Factory
14  V(CreateDXGIFactory(IID_IDXGIFactory, reinterpret_cast<void**>(&g_pDXGIFactory)));
15 
16  // Enumerate Adapters
17  V(EnumerateAdapters());
18 
19  // Create the window class
20  V(CreateWindowClass(hInstance));
21 
22  // Create a window per monitor
24 
25  // Set DXGI Window association for the first monitor window
27 
28  // Create a device per adapter or device per output
29  V(CreateDevicePerAdapter(D3D10_DRIVER_TYPE_HARDWARE));
30 
31  // Create a swap chain for each output
33 
34  for (UINT i = 0; i < screens.size(); i++)
35  {
36  for (int o = 0; o < g_WindowObjects.GetSize(); o++)
37  {
38  WINDOW_OBJECT* pWindow = g_WindowObjects.GetAt(o);
39  if (screens.at(i).adapter == pWindow->AdapterOrdinal &&
40  screens.at(i).window == pWindow->WindowOrdinal)
41  {
42  screens.at(i).Initialize(logger, pWindow, fonts.at(0).pFont);
43  for (UINT j = 0; j < screens.at(i).pages.size(); j++)
44  {
45  Page* page = &screens.at(i).pages.at(j);
46  page->Initialize(bus, logger, pWindow->pDevice, pWindow->Width, pWindow->Height, &fonts, screens.at(i).flip);
47  }
48  }
49  }
50  }
51 
52  for (UINT i = 0; i < screens.size(); i++)
53  {
54  if (!screens.at(i).initialized)
55  {
56  char msg[99];
57  sprintf_s(msg, 99, "Viewport::Initialize Screen %s (%i) not associated with an active window, removing...", screens.at(i).name.c_str(), i);
58  logger->Log(msg, Logger::Error);
59  screens.erase(screens.begin() + i);
60  i--;
61  }
62  }
63 }
64 
65 void Viewport::Render(float fElapsed)
66 {
67  DXUT_BeginPerfEvent(DXUT_PERFEVENTCOLOR, L"Viewport Render Loop");
68  for (UINT i = 0; i < screens.size(); i++)
69  {
70  Screen* screen = &screens.at(i); // otherwise Doxygen doesn't see it!
71  screen->Render(fElapsed);
72  }
73  DXUT_EndPerfEvent();
74 
75  DXUT_BeginPerfEvent(DXUT_PERFEVENTCOLOR, L"Viewport Present Loop");
76  for (UINT i = 0; i < screens.size(); i++)
77  {
78  Screen* screen = &screens.at(i); // otherwise Doxygen doesn't see it!
79  screen->Present();
80  }
81  DXUT_EndPerfEvent();
82 }
83 
85 {
86 }
87 
88 //--------------------------------------------------------------------------------------
89 // Enumerate all D3D10 Adapters
90 //--------------------------------------------------------------------------------------
92 {
93  HRESULT hr;
94 
95  for (UINT i = 0;; i++)
96  {
98  ADAPTER_OBJECT* pAdapterObj = new ADAPTER_OBJECT;
99  if (!pAdapterObj)
100  {
101  return E_OUTOFMEMORY;
102  }
103 
104  pAdapterObj->pDXGIAdapter = nullptr;
105  hr = g_pDXGIFactory->EnumAdapters(i, &pAdapterObj->pDXGIAdapter);
106  if (DXGI_ERROR_NOT_FOUND == hr)
107  {
108  SAFE_DELETE(pAdapterObj);
109  hr = S_OK;
110  break;
111  }
112  if (FAILED(hr))
113  {
114  SAFE_DELETE(pAdapterObj);
115  return hr;
116  }
117 
118  // get the description of the adapter
119  DXGI_ADAPTER_DESC AdapterDesc;
120  hr = pAdapterObj->pDXGIAdapter->GetDesc(&AdapterDesc);
121  if (FAILED(hr))
122  {
123  SAFE_DELETE(pAdapterObj);
124  return hr;
125  }
126 
127  // Enumerate outputs for this adapter
128  hr = EnumerateOutputs(pAdapterObj);
129  if (FAILED(hr))
130  {
131  SAFE_DELETE(pAdapterObj);
132  return hr;
133  }
134 
135  size_t mbAvail = AdapterDesc.DedicatedVideoMemory / 1048576;
136  if (mbAvail == 0)
137  break;
138 
139  char msg[199];
140  sprintf_s(msg, 199, "Viewport::EnumerateAdapter %i GetAvailableTextureMem: %i MB", i, mbAvail);
141  logger->Log(msg);
142 
143  // add the adapter to the list
144  if (pAdapterObj->DXGIOutputArray.GetSize() > 0)
145  g_AdapterArray.Add(pAdapterObj);
146  }
147 
148  if (g_AdapterArray.GetSize() == 0)
149  return E_FAIL;
150 
151  return hr;
152 }
153 
154 //--------------------------------------------------------------------------------------
155 // Enumerate all D3D10 Outputs
156 //--------------------------------------------------------------------------------------
158 {
159  HRESULT hr;
160 
161  for (UINT i = 0;; i++)
162  {
163  IDXGIOutput* pOutput;
164  hr = pAdapterObj->pDXGIAdapter->EnumOutputs(i, &pOutput);
165  if (DXGI_ERROR_NOT_FOUND == hr)
166  {
167  hr = S_OK;
168  break;
169  }
170  if (FAILED(hr))
171  return hr;
172 
173  // get the description
174  DXGI_OUTPUT_DESC OutputDesc;
175  hr = pOutput->GetDesc(&OutputDesc);
176  if (FAILED(hr))
177  return hr;
178 
179  // only add outputs that are attached to the desktop
180  // TODO: AttachedToDesktop seems to be always 0
181  /*if( !OutputDesc.AttachedToDesktop )
182  {
183  pOutput->Release();
184  continue;
185  }*/
186 
187  pAdapterObj->DXGIOutputArray.Add(pOutput);
188  }
189 
190  return hr;
191 }
192 
193 //--------------------------------------------------------------------------------------
194 // Creates and register the window class
195 //--------------------------------------------------------------------------------------
196 HRESULT Viewport::CreateWindowClass(HINSTANCE hInstance)
197 {
198  WCHAR szExePath[MAX_PATH];
199  GetModuleFileName(nullptr, szExePath, MAX_PATH);
200  HICON hIcon = ExtractIcon(hInstance, szExePath, 0);
201 
202  ZeroMemory(&g_WindowClass, sizeof(WNDCLASS));
203  g_WindowClass.hCursor = nullptr;// LoadCursor(NULL, IDC_ARROW);
204  g_WindowClass.hIcon = hIcon;
205  g_WindowClass.hbrBackground = static_cast<HBRUSH>(GetStockObject(BLACK_BRUSH));
206  g_WindowClass.style = CS_DBLCLKS;
207  g_WindowClass.lpfnWndProc = DXUTStaticWndProc;
208  g_WindowClass.hInstance = hInstance;
209  g_WindowClass.lpszClassName = WindowClassStr;
210 
211  ATOM ClassAtom = RegisterClass(&g_WindowClass);
212  if (ClassAtom == 0)
213  {
214  DWORD error = GetLastError();
215 
216  if (ERROR_CLASS_ALREADY_EXISTS != error)
217  {
218  return E_FAIL;
219  }
220  }
221 
222  return S_OK;
223 }
224 
225 //--------------------------------------------------------------------------------------
226 // Creates windows for all monitors
227 //--------------------------------------------------------------------------------------
229 {
230  HRESULT hr = S_OK;
231 
232  for (int a = 0; a < g_AdapterArray.GetSize(); a++)
233  {
234  ADAPTER_OBJECT* pAdapter = g_AdapterArray.GetAt(a);
235  for (int o = 0; o < pAdapter->DXGIOutputArray.GetSize(); o++)
236  {
237  IDXGIOutput* pOutput = pAdapter->DXGIOutputArray.GetAt(o);
238  DXGI_OUTPUT_DESC OutputDesc;
239  pOutput->GetDesc(&OutputDesc);
240  int X = OutputDesc.DesktopCoordinates.left;
241  int Y = OutputDesc.DesktopCoordinates.top;
242  int Width = OutputDesc.DesktopCoordinates.right - X;
243  int Height = OutputDesc.DesktopCoordinates.bottom - Y;
244 
245  WINDOW_OBJECT* pWindow = new WINDOW_OBJECT;
246  ZeroMemory(pWindow, sizeof(WINDOW_OBJECT));
247  pWindow->AdapterOrdinal = a;
248  pWindow->WindowOrdinal = o;
249 
250  char msg[199];
251  sprintf_s(msg, 199, "Viewport::CreateMonitorWindows (adapter %i, window %i) %S (%ix%i)", a, o, OutputDesc.DeviceName, Width, Height);
252  logger->Log(msg);
253 
254  pWindow->hWnd = CreateWindow(WindowClassStr,
255  L"Avionics",
256  WS_POPUP,
257  X,
258  Y,
259  Width,
260  Height,
261  NULL,
262  NULL,
263  g_WindowClass.hInstance,
264  NULL);
265 
266  if (NULL == pWindow->hWnd)
267  {
268  SAFE_DELETE(pWindow);
269  return E_FAIL;
270  }
271 
272  // show the window
273  ShowWindow(pWindow->hWnd, SW_SHOWDEFAULT);
274  SetCursor(nullptr);
275 
276  // set width and height
277  pWindow->Width = Width;
278  pWindow->Height = Height;
279 
280  // add this to the window object array
281  g_WindowObjects.Add(pWindow);
282  }
283  }
284 
285  return hr;
286 }
287 
288 //--------------------------------------------------------------------------------------
289 // Set DXGI's window association
290 //--------------------------------------------------------------------------------------
292 {
293  if (g_WindowObjects.GetSize() == 0)
294  return E_FAIL;
295 
296  HWND hWnd = g_WindowObjects.GetAt(0)->hWnd;
297 
298  // set window association
299  return g_pDXGIFactory->MakeWindowAssociation(hWnd, 0);
300 }
301 
302 //--------------------------------------------------------------------------------------
303 // Creates a device per adapter
304 //--------------------------------------------------------------------------------------
305 HRESULT Viewport::CreateDevicePerAdapter(D3D10_DRIVER_TYPE DriverType)
306 {
307  HRESULT hr = S_OK;
308  int iWindowObj = 0;
309  for (int a = 0; a < g_AdapterArray.GetSize(); a++)
310  {
311  ADAPTER_OBJECT* pAdapterObj = g_AdapterArray.GetAt(a);
312 
313  IDXGIAdapter* pAdapter = nullptr;
314  if (D3D10_DRIVER_TYPE_HARDWARE == DriverType)
315  pAdapter = pAdapterObj->pDXGIAdapter;
316 
318  DEVICE_OBJECT* pDevice = new DEVICE_OBJECT;
319  ZeroMemory(pDevice, sizeof(DEVICE_OBJECT));
320 
321  UINT CreateFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE;
322 
323  // Create a device for this adapter
324  V_RETURN(D3D10CreateDevice(pAdapter, DriverType, NULL, CreateFlags, D3D10_SDK_VERSION, &pDevice->pd3dDevice));
325 
326  // add the device
327  pDevice->Ordinal = g_DeviceArray.GetSize();
328  g_DeviceArray.Add(pDevice);
329 
330  // Init stuff needed for the device
331  OnD3D10CreateDevice(pDevice);
332 
333  // go through the outputs and set the device, adapter, and output
334  for (int o = 0; o < pAdapterObj->DXGIOutputArray.GetSize(); o++)
335  {
336  IDXGIOutput* pOutput = pAdapterObj->DXGIOutputArray.GetAt(o);
337  WINDOW_OBJECT* pWindow = g_WindowObjects.GetAt(iWindowObj);
338 
339  pWindow->pDevice = pDevice;
340  pWindow->pAdapter = pAdapter;
341  pWindow->pOutput = pOutput;
342  iWindowObj++;
343  }
344  }
345 
346  return hr;
347 }
348 
349 //--------------------------------------------------------------------------------------
350 // Creates a swapchain per output
351 //--------------------------------------------------------------------------------------
353 {
354  HRESULT hr = S_OK;
355  for (int i = 0; i < g_WindowObjects.GetSize(); i++)
356  {
357  WINDOW_OBJECT* pWindow = g_WindowObjects.GetAt(i);
358 
359  // get the dxgi device
360  IDXGIDevice* pDXGIDevice = nullptr;
361  V_RETURN(pWindow->pDevice->pd3dDevice->QueryInterface(IID_IDXGIDevice, reinterpret_cast<void**>(&pDXGIDevice)));
362 
363  // create a swap chain
364  DXGI_SWAP_CHAIN_DESC SwapChainDesc;
365  ZeroMemory(&SwapChainDesc, sizeof(DXGI_SWAP_CHAIN_DESC));
366  SwapChainDesc.BufferDesc.Width = pWindow->Width;
367  SwapChainDesc.BufferDesc.Height = pWindow->Height;
368  SwapChainDesc.BufferDesc.RefreshRate.Numerator = 60;
369  SwapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
370  SwapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
371  SwapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
372  SwapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
373  SwapChainDesc.SampleDesc.Count = 1;
374  SwapChainDesc.SampleDesc.Quality = 0;
375  SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
376  SwapChainDesc.BufferCount = 3;
377  SwapChainDesc.OutputWindow = pWindow->hWnd;
378  SwapChainDesc.Windowed = !exclusiveMode;
379  SwapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
380  SwapChainDesc.Flags = 0;
381  V_RETURN(g_pDXGIFactory->CreateSwapChain(pDXGIDevice, &SwapChainDesc, &pWindow->pSwapChain));
382 
383  pDXGIDevice->Release();
384 
385  V_RETURN(CreateViewsForWindowObject(pWindow));
386  }
387 
388  return hr;
389 }
390 
391 //--------------------------------------------------------------------------------------
392 // Create any D3D10 resources that aren't dependant on the back buffer
393 //--------------------------------------------------------------------------------------
395 {
396  HRESULT hr;
397  logger->Log("Viewport::OnD3D10CreateDevice");
398 
399  for (UINT i = 0; i < fonts.size(); i++)
400  {
401  Font* font = &fonts.at(i);
402  font->OnD3D10CreateDevice(logger, pDevice->pd3dDevice);
403  }
404 
405  if (FAILED(hr = D3DX10CreateSprite(pDevice->pd3dDevice, 1, &pDevice->pSprite)))
406  {
407  logger->Log("Viewport::OnD3D10CreateDevice D3DX10CreateSprite failed!", Logger::Error, hr);
408  }
409 
410  return S_OK;
411 }
412 
413 //--------------------------------------------------------------------------------------
414 // Creates a render target view and depth stencil surface/view per swapchain
415 //--------------------------------------------------------------------------------------
417 {
418  HRESULT hr;
419 
420  // get the backbuffer
421  ID3D10Texture2D* pBackBuffer = nullptr;
422  hr = pWindow->pSwapChain->GetBuffer(0, IID_ID3D10Texture2D, reinterpret_cast<void**>(&pBackBuffer));
423  if (FAILED(hr))
424  return hr;
425 
426  // get the backbuffer desc
427  D3D10_TEXTURE2D_DESC BBDesc;
428  pBackBuffer->GetDesc(&BBDesc);
429 
430  // create the render target view
431  D3D10_RENDER_TARGET_VIEW_DESC RTVDesc;
432  RTVDesc.Format = BBDesc.Format;
433  RTVDesc.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
434  RTVDesc.Texture2D.MipSlice = 0;
435  hr = pWindow->pDevice->pd3dDevice->CreateRenderTargetView(pBackBuffer, &RTVDesc, &pWindow->pRenderTargetView);
436  pBackBuffer->Release();
437  pBackBuffer = nullptr;
438  if (FAILED(hr))
439  return hr;
440 
441  // Create depth stencil texture
442  ID3D10Texture2D* pDepthStencil = nullptr;
443  D3D10_TEXTURE2D_DESC descDepth;
444  descDepth.Width = pWindow->Width;
445  descDepth.Height = pWindow->Height;
446  descDepth.MipLevels = 1;
447  descDepth.ArraySize = 1;
448  descDepth.Format = DXGI_FORMAT_D16_UNORM;
449  descDepth.SampleDesc.Count = 1;
450  descDepth.SampleDesc.Quality = 0;
451  descDepth.Usage = D3D10_USAGE_DEFAULT;
452  descDepth.BindFlags = D3D10_BIND_DEPTH_STENCIL;
453  descDepth.CPUAccessFlags = 0;
454  descDepth.MiscFlags = 0;
455  hr = pWindow->pDevice->pd3dDevice->CreateTexture2D(&descDepth, nullptr, &pDepthStencil);
456  if (FAILED(hr))
457  return hr;
458 
459  // Create the depth stencil view
460  D3D10_DEPTH_STENCIL_VIEW_DESC descDSV;
461  descDSV.Format = descDepth.Format;
462  descDSV.ViewDimension = D3D10_DSV_DIMENSION_TEXTURE2D;
463  descDSV.Texture2D.MipSlice = 0;
464  hr = pWindow->pDevice->pd3dDevice->CreateDepthStencilView(pDepthStencil, &descDSV, &pWindow->pDepthStencilView);
465  SAFE_RELEASE(pDepthStencil);
466  if (FAILED(hr))
467  return hr;
468 
469  // get various information
470  if (pWindow->pAdapter)
471  pWindow->pAdapter->GetDesc(&pWindow->AdapterDesc);
472  if (pWindow->pOutput)
473  pWindow->pOutput->GetDesc(&pWindow->OutputDesc);
474 
475  return hr;
476 }
477 
478 //--------------------------------------------------------------------------------------
479 // Cleanup the device and window based objects
480 //--------------------------------------------------------------------------------------
482 {
483  logger->Log("Viewport::DeviceCleanup");
484 
485  // Make sure we're in windowed mode, since we cannot destroy a fullscreen swapchain
486  for (int w = 0; w < g_WindowObjects.GetSize(); w++)
487  {
488  WINDOW_OBJECT* pWindow = g_WindowObjects.GetAt(w);
489  pWindow->pSwapChain->SetFullscreenState(false, nullptr);
490  }
491 
492  // cleanup window objects
493  for (int w = 0; w < g_WindowObjects.GetSize(); w++)
494  {
495  WINDOW_OBJECT* pWindow = g_WindowObjects.GetAt(w);
496  DestroyWindow(pWindow->hWnd);
497  SAFE_RELEASE(pWindow->pRenderTargetView);
498  SAFE_RELEASE(pWindow->pDepthStencilView);
499  SAFE_RELEASE(pWindow->pSwapChain);
500  SAFE_DELETE(pWindow);
501  }
502  g_WindowObjects.RemoveAll();
503 
504  char msg[99];
505  sprintf_s(msg, 99, "Viewport::DeviceCleanup DeviceArray Size %i", g_DeviceArray.GetSize());
506  logger->Log(msg);
507 
508  // cleanup devices
509  for (int d = 0; d < g_DeviceArray.GetSize(); d++)
510  {
511  DEVICE_OBJECT* pDevice = g_DeviceArray.GetAt(d);
512 
513  sprintf_s(msg, 99, "Viewport::DeviceCleanup Calling Destroy: %i", d);
514  logger->Log(msg);
515 
516  pDevice->Destroy();
517 
518  SAFE_DELETE(pDevice);
519  }
520 
521  for (UINT i = 0; i < fonts.size(); i++)
522  {
523  fonts.at(i).DeviceCleanup();
524  }
525 
526  g_DeviceArray.RemoveAll();
527 }
528 
529 //--------------------------------------------------------------------------------------
530 // Cleanup everything
531 //--------------------------------------------------------------------------------------
533 {
534  logger->Log("Viewport::Destroy");
535 
536  for (unsigned i = 0; i < screens.size(); i++)
537  {
538  for (unsigned j = 0; j < screens.at(i).pages.size(); j++)
539  {
540  screens.at(i).pages.at(j).Destroy();
541  }
542  screens.at(i).DestroyDevice();
543  }
544 
545  // Destroy devices
546  DeviceCleanup();
547 
548  // Remove enumerated objects
549  for (int a = 0; a < g_AdapterArray.GetSize(); a++)
550  {
551  ADAPTER_OBJECT* pAdapterObj = g_AdapterArray.GetAt(a);
552 
553  // go through the outputs
554  for (int o = 0; o < pAdapterObj->DXGIOutputArray.GetSize(); o++)
555  {
556  IDXGIOutput* pOutput = pAdapterObj->DXGIOutputArray.GetAt(o);
557  SAFE_RELEASE(pOutput);
558  }
559  pAdapterObj->DXGIOutputArray.RemoveAll();
560 
561  SAFE_RELEASE(pAdapterObj->pDXGIAdapter);
562  SAFE_DELETE(pAdapterObj);
563  }
564 
565  SAFE_RELEASE(g_pDXGIFactory);
566 
567  g_AdapterArray.RemoveAll();
568 }
569 
570 std::vector<HWND> Viewport::GetWindowHandles() const
571 {
572  std::vector<HWND> hwnds;
573  for (int t = 0; t < g_WindowObjects.GetSize(); t++)
574  {
575  hwnds.push_back(g_WindowObjects.GetAt(t)->hWnd);
576  }
577  return hwnds;
578 }
CGrowableArray< WINDOW_OBJECT * > g_WindowObjects
Definition: Viewport.h:27
std::vector< HWND > GetWindowHandles() const
Definition: Viewport.cpp:570
ID3DX10Sprite * pSprite
Definition: DeviceObject.h:9
Viewport()=default
Definition: Font.h:5
Definition: Logger.h:5
~Viewport()
Definition: Viewport.cpp:84
CGrowableArray< ADAPTER_OBJECT * > g_AdapterArray
Definition: Viewport.h:26
void Render(float fElapsed)
Definition: Viewport.cpp:65
Definition: Screen.h:6
CGrowableArray< IDXGIOutput * > DXGIOutputArray
Definition: Viewport.h:22
ID3D10DepthStencilView * pDepthStencilView
Definition: WindowObject.h:17
HRESULT CreateSwapChainPerOutput() const
Definition: Viewport.cpp:352
IDXGIAdapter * pDXGIAdapter
Definition: Viewport.h:21
void Initialize(HINSTANCE)
Definition: Viewport.cpp:9
static HRESULT CreateViewsForWindowObject(WINDOW_OBJECT *pWindow)
Definition: Viewport.cpp:416
Logger * logger
Definition: Viewport.h:11
std::vector< Font > fonts
Definition: Viewport.h:41
void Destroy()
Definition: Viewport.cpp:532
ID3D10Device * pd3dDevice
Definition: DeviceObject.h:8
std::vector< Screen > screens
Definition: Viewport.h:40
DXGI_ADAPTER_DESC AdapterDesc
Definition: WindowObject.h:20
Definition: Bus.h:12
Bus * bus
Definition: Viewport.h:10
Definition: Page.h:6
HRESULT CreateMonitorWindows()
Definition: Viewport.cpp:228
void Render(float fElapsed)
Definition: Screen.cpp:52
IDXGISwapChain * pSwapChain
Definition: WindowObject.h:14
HRESULT CreateDevicePerAdapter(D3D10_DRIVER_TYPE DriverType)
Definition: Viewport.cpp:305
IDXGIOutput * pOutput
Definition: WindowObject.h:13
bool exclusiveMode
Definition: Viewport.h:39
void OnD3D10CreateDevice(Logger *pLogger, ID3D10Device *pDevice)
Definition: Font.h:16
void DeviceCleanup()
Definition: Viewport.cpp:481
HRESULT SetWindowAssociation() const
Definition: Viewport.cpp:291
#define WindowClassStr
Definition: Viewport.h:5
ID3D10RenderTargetView * pRenderTargetView
Definition: WindowObject.h:16
DEVICE_OBJECT * pDevice
Definition: WindowObject.h:15
void Log(const char *msg, Level level=Info, int errorCode=0)
These have to be in this order.
Definition: Logger.cpp:16
static HRESULT EnumerateOutputs(ADAPTER_OBJECT *pAdapterObj)
Definition: Viewport.cpp:157
WNDCLASS g_WindowClass
Definition: Viewport.h:15
void Destroy()
Definition: DeviceObject.h:40
void Initialize(Bus *prmBus, Logger *prmLogger, DEVICE_OBJECT *prmpDevice, int screenWidth, int screenHeight, std::vector< Font > *fonts, bool flip)
Definition: Page.cpp:3
HRESULT OnD3D10CreateDevice(DEVICE_OBJECT *pDevice)
Definition: Viewport.cpp:394
UINT WindowOrdinal
Definition: WindowObject.h:9
IDXGIFactory * g_pDXGIFactory
Definition: Viewport.h:16
DXGI_OUTPUT_DESC OutputDesc
Definition: WindowObject.h:21
IDXGIAdapter * pAdapter
Definition: WindowObject.h:12
HRESULT CreateWindowClass(HINSTANCE hInstance)
Definition: Viewport.cpp:196
void Present() const
Definition: Screen.h:30
CGrowableArray< DEVICE_OBJECT * > g_DeviceArray
Definition: Viewport.h:25
HRESULT EnumerateAdapters()
Definition: Viewport.cpp:91
UINT AdapterOrdinal
Definition: WindowObject.h:8