.[ ČeskéHry.cz ].

Laboratoř ČeskýchHer.cz - PasteBin

Vložit nový kód

ČeskéHry.cz - KOMUNITA HERNÍCH VÝVOJÁŘŮ

  1. 2025112623h13min00sec
    3 min
  2. 2025112623h01min20sec
    14 min
  3. 2025112622h49min12sec
    26 min
  4. 2025112622h37min19sec
    38 min
  5. 2025112622h25min14sec
    50 min
  6. 2025112622h13min12sec
    1 hod
  7. 2025112622h01min29sec
    1 hod
  8. 2025112621h49min51sec
    1 hod
  9. 2025112621h38min17sec
    1 hod
  10. 2025112621h26min44sec
    1 hod
Link: http://nopaste.ceske-hry.cz/subdom/nopaste222610
Zaslal: Eosie
Popis: Test Direct3D 11.
Jazyk: C++
Vloženo: 28.11.2008, 23:03
Stáhnout jako soubor
  1. void testDirect3D11FeatureLevel(const TCHAR *testName, D3D_DRIVER_TYPE driverType)
  2. {
  3. tcout << _T("\nTesting ") << testName << _T("...\n");
  4.  
  5. HWND hWnd = CreateWindowEx(0, _T("#32769"), _T("Dummy"), 0, 0, 0, 0, 0, 0, 0, GetModuleHandle(0), 0);
  6. if (!hWnd)
  7. {
  8. tcout << "Cannot create window.\n";
  9. return;
  10. }
  11.  
  12. ID3D11Device *device;
  13. D3D_FEATURE_LEVEL featureLevel;
  14. HRESULT hr = D3D11CreateDevice(0, driverType, 0, 0, 0, 0, D3D11_SDK_VERSION,
  15. &device, &featureLevel, 0);
  16. if (!SUCCEEDED(hr))
  17. {
  18. tcout << "D3D11 device creation failed.\n";
  19. CloseWindow(hWnd);
  20. return;
  21. }
  22.  
  23. tcout << _T("D3D11 device created.\n");
  24.  
  25. switch (featureLevel)
  26. {
  27. case D3D_FEATURE_LEVEL_9_1:
  28. tcout << _T("Feature level 9_1 supported, which means we have shaders 2.0.\n");
  29. break;
  30. case D3D_FEATURE_LEVEL_9_2:
  31. tcout << _T("Feature level 9_2 supported, which means we have shaders 2.0.\n");
  32. break;
  33. case D3D_FEATURE_LEVEL_9_3:
  34. tcout << _T("Feature level 9_3 supported, which means we have shaders 3.0.\n");
  35. break;
  36. case D3D_FEATURE_LEVEL_10_0:
  37. tcout << _T("Feature level 10_0 supported, which means we have shaders 4.0.\n");
  38. break;
  39. case D3D_FEATURE_LEVEL_10_1:
  40. tcout << _T("Feature level 10_1 supported, which means we have shaders 4.0.\n");
  41. break;
  42. case D3D_FEATURE_LEVEL_11_0:
  43. tcout << _T("Feature level 11_0 supported, which means we have shaders 5.0.\n");
  44. break;
  45. }
  46.  
  47. device->Release();
  48. CloseWindow(hWnd);
  49. }
  50.  
  51. int _tmain(int argc, _TCHAR* argv[])
  52. {
  53. testDirect3D11FeatureLevel(_T("HAL"), D3D_DRIVER_TYPE_HARDWARE);
  54. testDirect3D11FeatureLevel(_T("REF"), D3D_DRIVER_TYPE_REFERENCE);
  55. testDirect3D11FeatureLevel(_T("WARP"), D3D_DRIVER_TYPE_WARP);
  56. return 0;
  57. }
  58.