Changeset 101137 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Sep 15, 2023 5:49:45 PM (16 months ago)
- Location:
- trunk/src/VBox/ValidationKit/utils/nt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/nt/Makefile.kmk
r100944 r101137 64 64 # 65 65 PROGRAMS.win += ntDisplay 66 ntDisplay_TEMPLATE = VBoxValidationKitR3 67 ntDisplay_SOURCES = ntDisplay.cpp 68 ntDisplay_VBOX_IMPORT_CHECKER.win.x86 = nt4 66 ntDisplay_TEMPLATE = VBoxValidationKitR3 67 ntDisplay_CXXFLAGS += -wd4668 68 ntDisplay_LIBS = d3d11.lib 69 ntDisplay_SOURCES = ntDisplay.cpp 70 ntDisplay_VBOX_IMPORT_CHECKER.win.amd64 = w8 71 ntDisplay_VBOX_IMPORT_CHECKER.win.x86 = w8 69 72 70 73 include $(FILE_KBUILD_SUB_FOOTER) -
trunk/src/VBox/ValidationKit/utils/nt/ntDisplay.cpp
r100947 r101137 39 39 * Header Files * 40 40 *********************************************************************************************************************************/ 41 #include <iprt/win/windows.h> 41 42 #include <d3d11.h> 43 42 44 #include <iprt/win/setupapi.h> 43 45 #include <devguid.h> … … 92 94 { 93 95 if (g_cVerbosity >= 1) 94 RT Printf("debug: device %s\n", bEnable ? "enabled" : "disabled");96 RTMsgInfo("debug: device %s\n", bEnable ? "enabled" : "disabled"); 95 97 } 96 98 else … … 112 114 } 113 115 116 bool CheckDXFeatureLevel() 117 { 118 IDXGIAdapter *pAdapter = NULL; /* Default adapter. */ 119 static const D3D_FEATURE_LEVEL aFeatureLevels[] = 120 { 121 D3D_FEATURE_LEVEL_11_1, 122 D3D_FEATURE_LEVEL_11_0, 123 D3D_FEATURE_LEVEL_10_1, 124 D3D_FEATURE_LEVEL_10_0, 125 D3D_FEATURE_LEVEL_9_3, 126 D3D_FEATURE_LEVEL_9_2, 127 D3D_FEATURE_LEVEL_9_1 128 }; 129 UINT Flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; 130 D3D_FEATURE_LEVEL FeatureLevel = D3D_FEATURE_LEVEL_9_1; 131 ID3D11Device *pDevice = NULL; 132 ID3D11DeviceContext *pImmediateContext = NULL; 133 bool fResult = false; 134 HRESULT hr = S_OK; 135 136 hr = D3D11CreateDevice(pAdapter, 137 D3D_DRIVER_TYPE_HARDWARE, 138 NULL, 139 Flags, 140 aFeatureLevels, 141 RT_ELEMENTS(aFeatureLevels), 142 D3D11_SDK_VERSION, 143 &pDevice, 144 &FeatureLevel, 145 &pImmediateContext); 146 147 if (FAILED(hr)) 148 { 149 RTMsgError("D3D11CreateDevice failed with 0x%X\n", hr); 150 return false; 151 } 152 153 if (FeatureLevel == D3D_FEATURE_LEVEL_11_1) 154 { 155 RTMsgInfo("D3D_FEATURE_LEVEL_11_1 is supported\n"); 156 fResult = true; 157 } 158 else 159 { 160 RTMsgError("D3D_FEATURE_LEVEL_11_1 is not supported, only 0x%X\n", FeatureLevel); 161 } 162 163 pDevice->Release(); 164 pImmediateContext->Release(); 165 166 return fResult; 167 } 168 114 169 int main(int argc, char **argv) 115 170 { … … 124 179 * Parse arguments. 125 180 */ 126 bool fEnable = true;127 128 181 static const RTGETOPTDEF s_aOptions[] = 129 182 { … … 141 194 switch (chOpt) 142 195 { 143 case 'e': fEnable = RT_BOOL(ValueUnion.u32); break;196 case 'e': SetDisplayDeviceState(RT_BOOL(ValueUnion.u32)); break; 144 197 case 'q': g_cVerbosity = 0; break; 145 198 case 'v': g_cVerbosity += 1; break; … … 153 206 } 154 207 155 NTSTATUS rcNt = SetDisplayDeviceState(fEnable); 156 157 return RTErrConvertFromNtStatus(rcNt); 208 return !CheckDXFeatureLevel(); 158 209 }
Note:
See TracChangeset
for help on using the changeset viewer.