├── .gitignore ├── DeviceId.cpp ├── DeviceId.h ├── GPUDetect.cpp ├── GPUDetect.h ├── GPUDetect.sln ├── GPUDetect.vcxproj ├── ID3D10Extensions.h ├── IntelGfx.cfg ├── TestMain.cpp ├── license.txt └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | [Bb]uild/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | 38 | # Visual Studio 2017 auto generated files 39 | Generated\ Files/ 40 | 41 | # MSTest test Results 42 | [Tt]est[Rr]esult*/ 43 | [Bb]uild[Ll]og.* 44 | 45 | # NUnit 46 | *.VisualState.xml 47 | TestResult.xml 48 | nunit-*.xml 49 | 50 | # Build Results of an ATL Project 51 | [Dd]ebugPS/ 52 | [Rr]eleasePS/ 53 | dlldata.c 54 | 55 | # Benchmark Results 56 | BenchmarkDotNet.Artifacts/ 57 | 58 | # .NET Core 59 | project.lock.json 60 | project.fragment.lock.json 61 | artifacts/ 62 | 63 | # StyleCop 64 | StyleCopReport.xml 65 | 66 | # Files built by Visual Studio 67 | *_i.c 68 | *_p.c 69 | *_h.h 70 | *.ilk 71 | *.meta 72 | *.obj 73 | *.iobj 74 | *.pch 75 | *.pdb 76 | *.ipdb 77 | *.pgc 78 | *.pgd 79 | *.rsp 80 | *.sbr 81 | *.tlb 82 | *.tli 83 | *.tlh 84 | *.tmp 85 | *.tmp_proj 86 | *_wpftmp.csproj 87 | *.log 88 | *.vspscc 89 | *.vssscc 90 | .builds 91 | *.pidb 92 | *.svclog 93 | *.scc 94 | 95 | # Chutzpah Test files 96 | _Chutzpah* 97 | 98 | # Visual C++ cache files 99 | ipch/ 100 | *.aps 101 | *.ncb 102 | *.opendb 103 | *.opensdf 104 | *.sdf 105 | *.cachefile 106 | *.VC.db 107 | *.VC.VC.opendb 108 | 109 | # Visual Studio profiler 110 | *.psess 111 | *.vsp 112 | *.vspx 113 | *.sap 114 | 115 | # Visual Studio Trace Files 116 | *.e2e 117 | 118 | # TFS 2012 Local Workspace 119 | $tf/ 120 | 121 | # Guidance Automation Toolkit 122 | *.gpState 123 | 124 | # ReSharper is a .NET coding add-in 125 | _ReSharper*/ 126 | *.[Rr]e[Ss]harper 127 | *.DotSettings.user 128 | 129 | # JustCode is a .NET coding add-in 130 | .JustCode 131 | 132 | # TeamCity is a build add-in 133 | _TeamCity* 134 | 135 | # DotCover is a Code Coverage Tool 136 | *.dotCover 137 | 138 | # AxoCover is a Code Coverage Tool 139 | .axoCover/* 140 | !.axoCover/settings.json 141 | 142 | # Visual Studio code coverage results 143 | *.coverage 144 | *.coveragexml 145 | 146 | # NCrunch 147 | _NCrunch_* 148 | .*crunch*.local.xml 149 | nCrunchTemp_* 150 | 151 | # MightyMoose 152 | *.mm.* 153 | AutoTest.Net/ 154 | 155 | # Web workbench (sass) 156 | .sass-cache/ 157 | 158 | # Installshield output folder 159 | [Ee]xpress/ 160 | 161 | # DocProject is a documentation generator add-in 162 | DocProject/buildhelp/ 163 | DocProject/Help/*.HxT 164 | DocProject/Help/*.HxC 165 | DocProject/Help/*.hhc 166 | DocProject/Help/*.hhk 167 | DocProject/Help/*.hhp 168 | DocProject/Help/Html2 169 | DocProject/Help/html 170 | 171 | # Click-Once directory 172 | publish/ 173 | 174 | # Publish Web Output 175 | *.[Pp]ublish.xml 176 | *.azurePubxml 177 | # Note: Comment the next line if you want to checkin your web deploy settings, 178 | # but database connection strings (with potential passwords) will be unencrypted 179 | *.pubxml 180 | *.publishproj 181 | 182 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 183 | # checkin your Azure Web App publish settings, but sensitive information contained 184 | # in these scripts will be unencrypted 185 | PublishScripts/ 186 | 187 | # NuGet Packages 188 | *.nupkg 189 | # NuGet Symbol Packages 190 | *.snupkg 191 | # The packages folder can be ignored because of Package Restore 192 | **/[Pp]ackages/* 193 | # except build/, which is used as an MSBuild target. 194 | !**/[Pp]ackages/build/ 195 | # Uncomment if necessary however generally it will be regenerated when needed 196 | #!**/[Pp]ackages/repositories.config 197 | # NuGet v3's project.json files produces more ignorable files 198 | *.nuget.props 199 | *.nuget.targets 200 | 201 | # Microsoft Azure Build Output 202 | csx/ 203 | *.build.csdef 204 | 205 | # Microsoft Azure Emulator 206 | ecf/ 207 | rcf/ 208 | 209 | # Windows Store app package directories and files 210 | AppPackages/ 211 | BundleArtifacts/ 212 | Package.StoreAssociation.xml 213 | _pkginfo.txt 214 | *.appx 215 | *.appxbundle 216 | *.appxupload 217 | 218 | # Visual Studio cache files 219 | # files ending in .cache can be ignored 220 | *.[Cc]ache 221 | # but keep track of directories ending in .cache 222 | !?*.[Cc]ache/ 223 | 224 | # Others 225 | ClientBin/ 226 | ~$* 227 | *~ 228 | *.dbmdl 229 | *.dbproj.schemaview 230 | *.jfm 231 | *.pfx 232 | *.publishsettings 233 | orleans.codegen.cs 234 | 235 | # Including strong name files can present a security risk 236 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 237 | #*.snk 238 | 239 | # Since there are multiple workflows, uncomment next line to ignore bower_components 240 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 241 | #bower_components/ 242 | 243 | # RIA/Silverlight projects 244 | Generated_Code/ 245 | 246 | # Backup & report files from converting an old project file 247 | # to a newer Visual Studio version. Backup files are not needed, 248 | # because we have git ;-) 249 | _UpgradeReport_Files/ 250 | Backup*/ 251 | UpgradeLog*.XML 252 | UpgradeLog*.htm 253 | ServiceFabricBackup/ 254 | *.rptproj.bak 255 | 256 | # SQL Server files 257 | *.mdf 258 | *.ldf 259 | *.ndf 260 | 261 | # Business Intelligence projects 262 | *.rdl.data 263 | *.bim.layout 264 | *.bim_*.settings 265 | *.rptproj.rsuser 266 | *- [Bb]ackup.rdl 267 | *- [Bb]ackup ([0-9]).rdl 268 | *- [Bb]ackup ([0-9][0-9]).rdl 269 | 270 | # Microsoft Fakes 271 | FakesAssemblies/ 272 | 273 | # GhostDoc plugin setting file 274 | *.GhostDoc.xml 275 | 276 | # Node.js Tools for Visual Studio 277 | .ntvs_analysis.dat 278 | node_modules/ 279 | 280 | # Visual Studio 6 build log 281 | *.plg 282 | 283 | # Visual Studio 6 workspace options file 284 | *.opt 285 | 286 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 287 | *.vbw 288 | 289 | # Visual Studio LightSwitch build output 290 | **/*.HTMLClient/GeneratedArtifacts 291 | **/*.DesktopClient/GeneratedArtifacts 292 | **/*.DesktopClient/ModelManifest.xml 293 | **/*.Server/GeneratedArtifacts 294 | **/*.Server/ModelManifest.xml 295 | _Pvt_Extensions 296 | 297 | # Paket dependency manager 298 | .paket/paket.exe 299 | paket-files/ 300 | 301 | # FAKE - F# Make 302 | .fake/ 303 | 304 | # CodeRush personal settings 305 | .cr/personal 306 | 307 | # Python Tools for Visual Studio (PTVS) 308 | __pycache__/ 309 | *.pyc 310 | 311 | # Cake - Uncomment if you are using it 312 | # tools/** 313 | # !tools/packages.config 314 | 315 | # Tabs Studio 316 | *.tss 317 | 318 | # Telerik's JustMock configuration file 319 | *.jmconfig 320 | 321 | # BizTalk build output 322 | *.btp.cs 323 | *.btm.cs 324 | *.odx.cs 325 | *.xsd.cs 326 | 327 | # OpenCover UI analysis results 328 | OpenCover/ 329 | 330 | # Azure Stream Analytics local run output 331 | ASALocalRun/ 332 | 333 | # MSBuild Binary and Structured Log 334 | *.binlog 335 | 336 | # NVidia Nsight GPU debugger configuration file 337 | *.nvuser 338 | 339 | # MFractors (Xamarin productivity tool) working folder 340 | .mfractor/ 341 | 342 | # Local History for Visual Studio 343 | .localhistory/ 344 | 345 | # BeatPulse healthcheck temp database 346 | healthchecksdb 347 | 348 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 349 | MigrationBackup/ 350 | 351 | # Ionide (cross platform F# VS Code tools) working folder 352 | .ionide/ -------------------------------------------------------------------------------- /DeviceId.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // Copyright 2017-2018 Intel Corporation 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //////////////////////////////////////////////////////////////////////////////// 16 | 17 | #include 18 | #include "DeviceId.h" 19 | 20 | 21 | namespace GPUDetect 22 | { 23 | 24 | char const* GetIntelGPUArchitectureString( INTEL_GPU_ARCHITECTURE arch ) 25 | { 26 | switch( arch ) 27 | { 28 | case IGFX_SANDYBRIDGE: return "Sandy Bridge"; 29 | case IGFX_IVYBRIDGE: return "Ivy Bridge"; 30 | case IGFX_HASWELL: return "Haswell"; 31 | case IGFX_VALLEYVIEW: return "ValleyView"; 32 | case IGFX_BROADWELL: return "Broadwell"; 33 | case IGFX_CHERRYVIEW: return "Cherryview"; 34 | case IGFX_SKYLAKE: return "Skylake"; 35 | case IGFX_KABYLAKE: return "Kabylake"; 36 | case IGFX_COFFEELAKE: return "Coffeelake"; 37 | case IGFX_WILLOWVIEW: return "Willowview"; 38 | case IGFX_BROXTON: return "Broxton"; 39 | case IGFX_GEMINILAKE: return "Geminilake"; 40 | 41 | case IGFX_CANNONLAKE: return "Cannonlake"; 42 | 43 | case IGFX_ICELAKE: return "Icelake"; 44 | case IGFX_ICELAKE_LP: return "Icelake LP"; 45 | case IGFX_LAKEFIELD: return "Lakefield"; 46 | 47 | case IGFX_TIGERLAKE_LP: return "Tigerlake LP"; 48 | 49 | case IGFX_ROCKETLAKE: return "Rocketlake"; 50 | 51 | case IGFX_DG1: return "DG1"; 52 | 53 | case IGFX_ADL: return "Alderlake"; 54 | 55 | case DGFX_ACM: return "Alchemist"; 56 | 57 | // Architectures with no unique enum value, but that still can be determined from DeviceID 58 | case IGFX_WHISKEYLAKE: return "Whiskeylake"; 59 | case IGFX_COMETLAKE: return "Cometlake"; 60 | 61 | case IGFX_UNKNOWN: 62 | case IGFX_MAX_PRODUCT: 63 | default: 64 | assert(false); 65 | return "Unknown"; 66 | } 67 | } 68 | 69 | INTEL_GPU_ARCHITECTURE GetIntelGPUArchitecture( unsigned int deviceId ) 70 | { 71 | const unsigned int idhi = deviceId & 0xFF00; 72 | const unsigned int idlo = deviceId & 0x00FF; 73 | 74 | if( idhi == 0x0100 ) 75 | { 76 | if( ( idlo & 0xFFF0 ) == 0x0050 || ( idlo & 0xFFF0 ) == 0x0060 ) 77 | { 78 | return IGFX_IVYBRIDGE; 79 | } 80 | return IGFX_SANDYBRIDGE; 81 | } 82 | 83 | if( idhi == 0x0400 || idhi == 0x0A00 || idhi == 0x0D00 || idhi == 0x0C00 ) 84 | { 85 | return IGFX_HASWELL; 86 | } 87 | 88 | if( idhi == 0x1600 || idhi == 0x0B00 ) 89 | { 90 | return IGFX_BROADWELL; 91 | } 92 | 93 | if( idhi == 0x1900 || idhi == 0x0900 ) 94 | { 95 | return IGFX_SKYLAKE; 96 | } 97 | 98 | if( idhi == 0x5900 ) 99 | { 100 | return IGFX_KABYLAKE; 101 | } 102 | 103 | if( idhi == 0x3100 ) 104 | { 105 | return IGFX_GEMINILAKE; 106 | } 107 | 108 | if( idhi == 0x5A00 ) 109 | { 110 | return IGFX_CANNONLAKE; 111 | } 112 | 113 | if( idhi == 0x3E00 ) 114 | { 115 | if( idlo == 0x00A0 || idlo == 0x00A1 ) 116 | { 117 | return IGFX_WHISKEYLAKE; 118 | } 119 | return IGFX_COFFEELAKE; 120 | } 121 | 122 | if ( idhi == 0x8A00 ) 123 | { 124 | return IGFX_ICELAKE_LP; 125 | } 126 | 127 | if( idhi == 0x9A00 ) 128 | { 129 | return IGFX_TIGERLAKE_LP; 130 | } 131 | 132 | if( idhi == 0x4900 ) 133 | { 134 | return IGFX_DG1; 135 | } 136 | 137 | if (idhi == 0x4C00) 138 | { 139 | return IGFX_ROCKETLAKE; 140 | } 141 | 142 | if (idhi == 0x9B00) 143 | { 144 | return IGFX_COMETLAKE; 145 | } 146 | 147 | if (idhi == 0x4600) 148 | { 149 | return IGFX_ADL; 150 | } 151 | 152 | if (idhi == 0x5600) 153 | { 154 | return DGFX_ACM; 155 | } 156 | 157 | assert(false); 158 | return IGFX_UNKNOWN; 159 | } 160 | 161 | } 162 | -------------------------------------------------------------------------------- /DeviceId.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////////////////////// 2 | // Copyright 2017-2018 Intel Corporation 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | ///////////////////////////////////////////////////////////////////////////////////////////// 16 | 17 | 18 | #pragma once 19 | 20 | 21 | namespace GPUDetect 22 | { 23 | enum INTEL_GPU_ARCHITECTURE 24 | { 25 | IGFX_UNKNOWN = 0x00, 26 | 27 | IGFX_SANDYBRIDGE = 0x0c, 28 | IGFX_IVYBRIDGE, 29 | IGFX_HASWELL, 30 | IGFX_VALLEYVIEW, 31 | IGFX_BROADWELL, 32 | IGFX_CHERRYVIEW, 33 | IGFX_SKYLAKE, 34 | IGFX_KABYLAKE, 35 | IGFX_COFFEELAKE, 36 | IGFX_WILLOWVIEW, 37 | IGFX_BROXTON, 38 | IGFX_GEMINILAKE, 39 | 40 | IGFX_CANNONLAKE = 0x1a, 41 | 42 | IGFX_ICELAKE = 0x1c, 43 | IGFX_ICELAKE_LP, 44 | 45 | IGFX_LAKEFIELD = 0x1e, 46 | 47 | IGFX_TIGERLAKE_LP = 0x21, 48 | 49 | IGFX_ROCKETLAKE = 0x23, 50 | 51 | IGFX_ADL = 0x24, 52 | IGFX_ADL_LP = 0X25, 53 | 54 | // Alchemist 55 | DGFX_ACM = 1270, 56 | 57 | IGFX_DG1 = 0x4ba, 58 | 59 | IGFX_MAX_PRODUCT, 60 | 61 | // Architectures with no enum value 62 | IGFX_WHISKEYLAKE, 63 | IGFX_COMETLAKE, 64 | 65 | }; 66 | 67 | /******************************************************************************* 68 | * getIntelGPUArchitecture 69 | * 70 | * Returns the architecture of an Intel GPU by parsing the device id. It 71 | * assumes that it is indeed an Intel GPU device ID (i.e., that VendorID 72 | * was INTEL_VENDOR_ID). 73 | * 74 | * You cannot generally compare device IDs to compare architectures; for 75 | * example, a newer architecture may have an lower deviceID. 76 | * 77 | ******************************************************************************/ 78 | INTEL_GPU_ARCHITECTURE GetIntelGPUArchitecture(unsigned int deviceId); 79 | 80 | /******************************************************************************* 81 | * getIntelGPUArchitectureString 82 | * 83 | * Convert A INTEL_GPU_ARCHITECTURE to a string. 84 | * 85 | ******************************************************************************/ 86 | char const* GetIntelGPUArchitectureString(INTEL_GPU_ARCHITECTURE arch); 87 | } 88 | -------------------------------------------------------------------------------- /GPUDetect.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // Copyright 2017-2020 Intel Corporation 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //////////////////////////////////////////////////////////////////////////////// 16 | 17 | 18 | #ifndef STRICT 19 | #define STRICT 20 | #endif 21 | 22 | #ifndef NOMINMAX 23 | #define NOMINMAX 24 | #endif 25 | 26 | #ifndef WIN32_LEAN_AND_MEAN 27 | #define WIN32_LEAN_AND_MEAN 28 | #endif 29 | 30 | #ifndef VC_EXTRALEAN 31 | #define VC_EXTRALEAN 32 | #endif 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #ifdef _WIN32_WINNT_WIN10 39 | #include 40 | #endif 41 | 42 | #include "ID3D10Extensions.h" 43 | 44 | #include 45 | #include 46 | 47 | #include 48 | #include 49 | #include 50 | 51 | #include "GPUDetect.h" 52 | 53 | 54 | // These should only be needed for reading data from the counter 55 | struct IntelDeviceInfo1 56 | { 57 | DWORD GPUMaxFreq; 58 | DWORD GPUMinFreq; 59 | }; 60 | static_assert( sizeof(IntelDeviceInfo1) == 8, "struct size mismatch" ); 61 | 62 | struct IntelDeviceInfo2 : public IntelDeviceInfo1 63 | { 64 | DWORD GPUArchitecture; // should match INTEL_GPU_ARCHITECTURE 65 | DWORD EUCount; 66 | DWORD PackageTDP; 67 | DWORD MaxFillRate; 68 | }; 69 | static_assert( sizeof(IntelDeviceInfo2) == 24, "struct size mismatch" ); 70 | 71 | 72 | namespace GPUDetect 73 | { 74 | 75 | // Returns EXIT_SUCCESS if successfully initialized 76 | int GetIntelDeviceInfo( IntelDeviceInfo2* deviceInfo, ID3D11Device* device ); 77 | 78 | 79 | int InitAll( GPUData* const gpuData, int adapterIndex ) 80 | { 81 | if( gpuData == nullptr || adapterIndex < 0 ) 82 | { 83 | return GPUDETECT_ERROR_BAD_DATA; 84 | } 85 | 86 | IDXGIAdapter* adapter = nullptr; 87 | int returnCode = InitAdapter( &adapter, adapterIndex ); 88 | if( returnCode != EXIT_SUCCESS ) 89 | { 90 | return returnCode; 91 | } 92 | 93 | ID3D11Device* device = nullptr; 94 | returnCode = InitDevice( adapter, &device ); 95 | if( returnCode != EXIT_SUCCESS ) 96 | { 97 | adapter->Release(); 98 | return returnCode; 99 | } 100 | 101 | returnCode = InitAll( gpuData, adapter, device ); 102 | 103 | adapter->Release(); 104 | device->Release(); 105 | return returnCode; 106 | } 107 | 108 | int InitAll( GPUData* const gpuData, IDXGIAdapter* adapter, ID3D11Device* device ) 109 | { 110 | int returnCode = InitExtensionInfo( gpuData, adapter, device ); 111 | if( returnCode != EXIT_SUCCESS ) 112 | { 113 | return returnCode; 114 | } 115 | 116 | returnCode = InitDxDriverVersion( gpuData ); 117 | if( returnCode != EXIT_SUCCESS ) 118 | { 119 | return returnCode; 120 | } 121 | 122 | returnCode = InitCounterInfo( gpuData, device ); 123 | 124 | return returnCode; 125 | } 126 | 127 | int InitExtensionInfo( GPUData* const gpuData, int adapterIndex ) 128 | { 129 | if( gpuData == nullptr || adapterIndex < 0 ) 130 | { 131 | return GPUDETECT_ERROR_BAD_DATA; 132 | } 133 | 134 | IDXGIAdapter* adapter = nullptr; 135 | int returnCode = InitAdapter( &adapter, adapterIndex ); 136 | if( returnCode != EXIT_SUCCESS ) 137 | { 138 | return returnCode; 139 | } 140 | 141 | ID3D11Device* device = nullptr; 142 | returnCode = InitDevice( adapter, &device ); 143 | if( returnCode != EXIT_SUCCESS ) 144 | { 145 | adapter->Release(); 146 | return returnCode; 147 | } 148 | 149 | returnCode = InitExtensionInfo( gpuData, adapter, device ); 150 | 151 | adapter->Release(); 152 | device->Release(); 153 | return returnCode; 154 | } 155 | 156 | int InitExtensionInfo( GPUData* const gpuData, IDXGIAdapter* adapter, ID3D11Device* device ) 157 | { 158 | if ( gpuData == nullptr || adapter == nullptr || device == nullptr ) 159 | { 160 | return GPUDETECT_ERROR_BAD_DATA; 161 | } 162 | 163 | // basic DXGI information 164 | DXGI_ADAPTER_DESC AdapterDesc = {}; 165 | if( FAILED( adapter->GetDesc( &AdapterDesc ) ) ) 166 | { 167 | return GPUDETECT_ERROR_DXGI_ADAPTER_CREATION; 168 | } 169 | 170 | gpuData->dxAdapterAvailability = true; 171 | 172 | gpuData->vendorID = AdapterDesc.VendorId; 173 | gpuData->deviceID = AdapterDesc.DeviceId; 174 | gpuData->adapterLUID = AdapterDesc.AdapterLuid; 175 | 176 | wcscpy_s( gpuData->description, _countof( GPUData::description ), AdapterDesc.Description ); 177 | 178 | if( AdapterDesc.VendorId == INTEL_VENDOR_ID && AdapterDesc.DedicatedVideoMemory <= 512 * 1024 * 1024 ) 179 | { 180 | gpuData->isUMAArchitecture = true; 181 | } 182 | 183 | #ifdef _WIN32_WINNT_WIN10 184 | ID3D11Device3* pDevice3 = nullptr; 185 | if( SUCCEEDED( device->QueryInterface( __uuidof( ID3D11Device3 ), (void**) &pDevice3 ) ) ) 186 | { 187 | D3D11_FEATURE_DATA_D3D11_OPTIONS2 FeatureData = {}; 188 | if( SUCCEEDED( pDevice3->CheckFeatureSupport( D3D11_FEATURE_D3D11_OPTIONS2, &FeatureData, sizeof( FeatureData ) ) ) ) 189 | { 190 | gpuData->isUMAArchitecture = FeatureData.UnifiedMemoryArchitecture == TRUE; 191 | } 192 | pDevice3->Release(); 193 | } 194 | #endif // _WIN32_WINNT_WIN10 195 | 196 | if( gpuData->isUMAArchitecture ) 197 | { 198 | gpuData->videoMemory = AdapterDesc.SharedSystemMemory; 199 | } 200 | else 201 | { 202 | gpuData->videoMemory = AdapterDesc.DedicatedVideoMemory; 203 | } 204 | 205 | // Intel specific information 206 | if( AdapterDesc.VendorId == INTEL_VENDOR_ID ) 207 | { 208 | gpuData->architecture = GetIntelGPUArchitecture(gpuData->deviceID); 209 | 210 | ID3D10::CAPS_EXTENSION intelExtCaps = {}; 211 | if (S_OK == GetExtensionCaps(device, &intelExtCaps)) 212 | { 213 | gpuData->extensionVersion = intelExtCaps.DriverVersion; 214 | gpuData->intelExtensionAvailability = (gpuData->extensionVersion >= ID3D10::EXTENSION_INTERFACE_VERSION_1_0); 215 | } 216 | } 217 | 218 | return EXIT_SUCCESS; 219 | } 220 | 221 | int InitCounterInfo( GPUData* const gpuData, int adapterIndex ) 222 | { 223 | if( gpuData == nullptr || adapterIndex < 0 ) 224 | { 225 | return GPUDETECT_ERROR_BAD_DATA; 226 | } 227 | 228 | IDXGIAdapter* adapter = nullptr; 229 | int returnCode = InitAdapter( &adapter, adapterIndex ); 230 | if( returnCode != EXIT_SUCCESS ) 231 | { 232 | return returnCode; 233 | } 234 | 235 | ID3D11Device* device = nullptr; 236 | returnCode = InitDevice( adapter, &device ); 237 | if( returnCode != EXIT_SUCCESS ) 238 | { 239 | adapter->Release(); 240 | return returnCode; 241 | } 242 | 243 | returnCode = InitCounterInfo( gpuData, device ); 244 | 245 | adapter->Release(); 246 | return returnCode; 247 | } 248 | 249 | int InitCounterInfo( GPUData* const gpuData, ID3D11Device* device ) 250 | { 251 | if( gpuData == nullptr || device == nullptr || gpuData->vendorID == 0 || gpuData->deviceID == 0 ) 252 | { 253 | return GPUDETECT_ERROR_BAD_DATA; 254 | } 255 | 256 | // 257 | // In DirectX, Intel exposes additional information through the driver that can be obtained 258 | // querying a special DX counter 259 | // 260 | gpuData->counterAvailability = gpuData->vendorID == INTEL_VENDOR_ID; 261 | if( !gpuData->counterAvailability ) 262 | { 263 | return GPUDETECT_ERROR_NOT_SUPPORTED; 264 | } 265 | 266 | IntelDeviceInfo2 info = {}; 267 | const int deviceInfoReturnCode = GetIntelDeviceInfo( &info, device ); 268 | if (deviceInfoReturnCode != EXIT_SUCCESS) 269 | { 270 | return deviceInfoReturnCode; 271 | } 272 | else 273 | { 274 | gpuData->maxFrequency = info.GPUMaxFreq; 275 | gpuData->minFrequency = info.GPUMinFreq; 276 | 277 | // 278 | // Older versions of the IntelDeviceInfo query only return 279 | // GPUMaxFreq and GPUMinFreq, all other members will be zero. 280 | // 281 | if (info.GPUArchitecture != IGFX_UNKNOWN) 282 | { 283 | gpuData->advancedCounterDataAvailability = true; 284 | 285 | gpuData->architecture = (INTEL_GPU_ARCHITECTURE)info.GPUArchitecture; 286 | assert(gpuData->architecture == GetIntelGPUArchitecture(gpuData->deviceID)); 287 | 288 | gpuData->euCount = info.EUCount; 289 | gpuData->packageTDP = info.PackageTDP; 290 | gpuData->maxFillRate = info.MaxFillRate; 291 | } 292 | } 293 | 294 | return EXIT_SUCCESS; 295 | } 296 | 297 | PresetLevel GetDefaultFidelityPreset( const GPUData* const gpuData ) 298 | { 299 | // Return if prerequisite info is not met 300 | if( !gpuData->dxAdapterAvailability ) 301 | { 302 | return PresetLevel::Undefined; 303 | } 304 | 305 | // 306 | // Look for a config file that qualifies devices from any vendor 307 | // The code here looks for a file with one line per recognized graphics 308 | // device in the following format: 309 | // 310 | // VendorIDHex, DeviceIDHex, CapabilityEnum ;Commented name of card 311 | // 312 | 313 | const char* cfgFileName = nullptr; 314 | 315 | switch( gpuData->vendorID ) 316 | { 317 | case INTEL_VENDOR_ID: 318 | cfgFileName = "IntelGfx.cfg"; 319 | break; 320 | 321 | // Add other cases in this fashion to allow for additional cfg files 322 | //case SOME_VENDOR_ID: 323 | // cfgFileName = "OtherBrandGfx.cfg"; 324 | // break; 325 | 326 | default: 327 | return PresetLevel::Undefined;; 328 | } 329 | 330 | PresetLevel presets = Undefined; 331 | 332 | FILE* fp = nullptr; 333 | fopen_s( &fp, cfgFileName, "r" ); 334 | 335 | if( fp ) 336 | { 337 | char line[ 100 ]; 338 | 339 | // 340 | // read one line at a time till EOF 341 | // 342 | while( fgets( line, _countof( line ), fp ) ) 343 | { 344 | // 345 | // Parse and remove the comment part of any line 346 | // 347 | unsigned int i = 0; 348 | for( ; i < _countof( line ) - 1 && line[ i ] && line[ i ] != ';'; i++ ) 349 | {} 350 | line[ i ] = '\0'; 351 | 352 | // 353 | // Try to extract GPUVendorId, GPUDeviceId and recommended Default Preset Level 354 | // 355 | char* context = nullptr; 356 | const char* const szVendorId = strtok_s( line, ",\n", &context ); 357 | const char* const szDeviceId = strtok_s( nullptr, ",\n", &context ); 358 | const char* const szPresetLevel = strtok_s( nullptr, ",\n", &context ); 359 | 360 | if( ( szVendorId == nullptr ) || 361 | ( szDeviceId == nullptr ) || 362 | ( szPresetLevel == nullptr ) ) 363 | { 364 | continue; // blank or improper line in cfg file - skip to next line 365 | } 366 | 367 | unsigned int vId = 0; 368 | int rv = sscanf_s( szVendorId, "%x", &vId ); 369 | assert( rv == 1 ); 370 | 371 | unsigned int dId = 0; 372 | rv = sscanf_s( szDeviceId, "%x", &dId ); 373 | assert( rv == 1 ); 374 | 375 | // 376 | // If current graphics device is found in the cfg file, use the 377 | // pre-configured default Graphics Presets setting. 378 | // 379 | if( ( vId == gpuData->vendorID ) && ( dId == gpuData->deviceID ) ) 380 | { 381 | char s[ 10 ] = {}; 382 | sscanf_s( szPresetLevel, "%s", s, (unsigned int) _countof( s ) ); 383 | 384 | if( !_stricmp( s, "Low" ) ) 385 | presets = Low; 386 | else if( !_stricmp( s, "Medium" ) ) 387 | presets = Medium; 388 | else if( !_stricmp( s, "Medium+" ) ) 389 | presets = MediumPlus; 390 | else if( !_stricmp( s, "High" ) ) 391 | presets = High; 392 | else 393 | presets = NotCompatible; 394 | 395 | break; 396 | } 397 | } 398 | 399 | fclose( fp ); 400 | } 401 | else 402 | { 403 | fprintf( stderr, "Error: %s not found! Fallback to default presets.\n", cfgFileName ); 404 | } 405 | 406 | // 407 | // If the current graphics device was not listed in any of the config 408 | // files, or if config file not found, use Low settings as default. 409 | // This should be changed to reflect the desired behavior for unknown 410 | // graphics devices. 411 | // 412 | if( presets == Undefined ) 413 | { 414 | presets = Low; 415 | } 416 | 417 | return presets; 418 | } 419 | 420 | int InitDxDriverVersion( GPUData* const gpuData ) 421 | { 422 | if( gpuData == nullptr || !( gpuData->dxAdapterAvailability == true ) ) 423 | { 424 | return GPUDETECT_ERROR_BAD_DATA; 425 | } 426 | 427 | if( gpuData->adapterLUID.HighPart == 0 && gpuData->adapterLUID.LowPart == 0 ) 428 | { 429 | // This should not happen with an active/current adapter. 430 | // But the registry can contain old leftover driver entries with LUID == 0. 431 | return GPUDETECT_ERROR_BAD_DATA; 432 | } 433 | 434 | // Fetch registry data 435 | HKEY dxKeyHandle = nullptr; 436 | DWORD numOfAdapters = 0; 437 | 438 | LSTATUS returnCode = ::RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\DirectX"), 0, KEY_READ, &dxKeyHandle ); 439 | 440 | if( returnCode != ERROR_SUCCESS ) 441 | { 442 | return GPUDETECT_ERROR_REG_NO_D3D_KEY; 443 | } 444 | 445 | // Find all subkeys 446 | 447 | DWORD subKeyMaxLength = 0; 448 | 449 | returnCode = ::RegQueryInfoKey( 450 | dxKeyHandle, 451 | nullptr, 452 | nullptr, 453 | nullptr, 454 | &numOfAdapters, 455 | &subKeyMaxLength, 456 | nullptr, 457 | nullptr, 458 | nullptr, 459 | nullptr, 460 | nullptr, 461 | nullptr 462 | ); 463 | 464 | if( returnCode != ERROR_SUCCESS ) 465 | { 466 | return GPUDETECT_ERROR_REG_GENERAL_FAILURE; 467 | } 468 | 469 | subKeyMaxLength += 1; // include the null character 470 | 471 | uint64_t driverVersionRaw = 0; 472 | 473 | bool foundSubkey = false; 474 | TCHAR* subKeyName = new TCHAR[subKeyMaxLength]; 475 | 476 | for( DWORD i = 0; i < numOfAdapters; ++i ) 477 | { 478 | DWORD subKeyLength = subKeyMaxLength; 479 | 480 | returnCode = ::RegEnumKeyEx( 481 | dxKeyHandle, 482 | i, 483 | subKeyName, 484 | &subKeyLength, 485 | nullptr, 486 | nullptr, 487 | nullptr, 488 | nullptr 489 | ); 490 | 491 | if( returnCode == ERROR_SUCCESS ) 492 | { 493 | LUID adapterLUID = {}; 494 | DWORD qwordSize = sizeof( uint64_t ); 495 | 496 | returnCode = ::RegGetValue( 497 | dxKeyHandle, 498 | subKeyName, 499 | _T("AdapterLuid"), 500 | RRF_RT_QWORD, 501 | nullptr, 502 | &adapterLUID, 503 | &qwordSize 504 | ); 505 | 506 | if( returnCode == ERROR_SUCCESS // If we were able to retrieve the registry values 507 | && adapterLUID.HighPart == gpuData->adapterLUID.HighPart && adapterLUID.LowPart == gpuData->adapterLUID.LowPart ) // and if the vendor ID and device ID match 508 | { 509 | // We have our registry key! Let's get the driver version num now 510 | 511 | returnCode = ::RegGetValue( 512 | dxKeyHandle, 513 | subKeyName, 514 | _T("DriverVersion"), 515 | RRF_RT_QWORD, 516 | nullptr, 517 | &driverVersionRaw, 518 | &qwordSize 519 | ); 520 | 521 | if( returnCode == ERROR_SUCCESS ) 522 | { 523 | foundSubkey = true; 524 | break; 525 | } 526 | } 527 | } 528 | } 529 | 530 | returnCode = ::RegCloseKey( dxKeyHandle ); 531 | assert( returnCode == ERROR_SUCCESS ); 532 | delete[] subKeyName; 533 | 534 | if( !foundSubkey ) 535 | { 536 | return GPUDETECT_ERROR_REG_MISSING_DRIVER_INFO; 537 | } 538 | 539 | // Now that we have our driver version as a DWORD, let's process that into something readable 540 | gpuData->dxDriverVersion[ 0 ] = (unsigned int) ( ( driverVersionRaw & 0xFFFF000000000000 ) >> 16 * 3 ); 541 | gpuData->dxDriverVersion[ 1 ] = (unsigned int) ( ( driverVersionRaw & 0x0000FFFF00000000 ) >> 16 * 2 ); 542 | gpuData->dxDriverVersion[ 2 ] = (unsigned int) ( ( driverVersionRaw & 0x00000000FFFF0000 ) >> 16 * 1 ); 543 | gpuData->dxDriverVersion[ 3 ] = (unsigned int) ( ( driverVersionRaw & 0x000000000000FFFF ) ); 544 | 545 | gpuData->driverInfo.driverReleaseRevision = gpuData->dxDriverVersion[2]; 546 | gpuData->driverInfo.driverBuildNumber = gpuData->dxDriverVersion[3]; 547 | 548 | gpuData->d3dRegistryDataAvailability = true; 549 | 550 | return EXIT_SUCCESS; 551 | } 552 | 553 | void GetDriverVersionAsCString( const GPUData* const gpuData, char* const outBuffer, size_t outBufferSize ) 554 | { 555 | // let's assume 4 digits max per segment 556 | const size_t kMaxBufferSize = (4 * 4) + 3; 557 | if( gpuData != nullptr && outBuffer != nullptr && outBufferSize <= kMaxBufferSize) 558 | { 559 | sprintf_s( outBuffer, outBufferSize, "%u.%u.%u.%u", gpuData->dxDriverVersion[ 0 ], gpuData->dxDriverVersion[ 1 ], gpuData->dxDriverVersion[ 2 ], gpuData->dxDriverVersion[ 3 ] ); 560 | } 561 | } 562 | 563 | GPUDetect::IntelGraphicsGeneration GetIntelGraphicsGeneration( INTEL_GPU_ARCHITECTURE architecture ) 564 | { 565 | switch( architecture ) 566 | { 567 | case IGFX_SANDYBRIDGE: 568 | return INTEL_GFX_GEN6; 569 | 570 | case IGFX_IVYBRIDGE: 571 | case IGFX_VALLEYVIEW: 572 | return INTEL_GFX_GEN7; 573 | 574 | case IGFX_HASWELL: 575 | return INTEL_GFX_GEN7_5; 576 | 577 | case IGFX_BROADWELL: 578 | case IGFX_CHERRYVIEW: 579 | return INTEL_GFX_GEN8; 580 | 581 | case IGFX_SKYLAKE: 582 | return INTEL_GFX_GEN9; 583 | 584 | case IGFX_GEMINILAKE: 585 | case IGFX_KABYLAKE: 586 | case IGFX_WHISKEYLAKE: 587 | case IGFX_COFFEELAKE: 588 | case IGFX_COMETLAKE: 589 | return INTEL_GFX_GEN9_5; 590 | 591 | case IGFX_CANNONLAKE: 592 | return INTEL_GFX_GEN10; 593 | 594 | case IGFX_LAKEFIELD: 595 | case IGFX_ICELAKE: 596 | case IGFX_ICELAKE_LP: 597 | return INTEL_GFX_GEN11; 598 | 599 | case IGFX_TIGERLAKE_LP: 600 | case IGFX_DG1: 601 | case IGFX_ROCKETLAKE: 602 | case IGFX_ADL: 603 | return INTEL_GFX_GEN12; 604 | 605 | case DGFX_ACM: 606 | return INTEL_DGFX_ACM; 607 | 608 | default: 609 | return INTEL_GFX_GEN_UNKNOWN; 610 | } 611 | } 612 | 613 | const char * GetIntelGraphicsGenerationString( const IntelGraphicsGeneration generation) 614 | { 615 | switch( generation ) 616 | { 617 | case INTEL_GFX_GEN6: return "Gen6"; 618 | case INTEL_GFX_GEN7: return "Gen7"; 619 | case INTEL_GFX_GEN7_5: return "Gen7.5"; 620 | case INTEL_GFX_GEN8: return "Gen8"; 621 | case INTEL_GFX_GEN9: return "Gen9"; 622 | case INTEL_GFX_GEN9_5: return "Gen9.5"; 623 | case INTEL_GFX_GEN10: return "Gen10"; 624 | case INTEL_GFX_GEN11: return "Gen11"; 625 | case INTEL_GFX_GEN12: return "Gen12 / Xe"; 626 | case INTEL_DGFX_ACM: return "Xe High Performance Graphics"; 627 | 628 | case INTEL_GFX_GEN_UNKNOWN: 629 | default: return "Unkown"; 630 | } 631 | } 632 | 633 | int InitAdapter( IDXGIAdapter** adapter, int adapterIndex ) 634 | { 635 | if( adapter == nullptr || adapterIndex < 0 ) 636 | { 637 | return GPUDETECT_ERROR_BAD_DATA; 638 | } 639 | 640 | // 641 | // We are relying on DXGI (supported on Windows Vista and later) to query 642 | // the adapter, so fail if it is not available. 643 | // 644 | // DXGIFactory1 is required by Windows Store Apps so try that first. 645 | // 646 | const HMODULE hDXGI = ::LoadLibrary( _T("dxgi.dll") ); 647 | if( hDXGI == nullptr ) 648 | { 649 | return GPUDETECT_ERROR_DXGI_LOAD; 650 | } 651 | 652 | typedef HRESULT( WINAPI*LPCREATEDXGIFACTORY )( REFIID riid, void** ppFactory ); 653 | 654 | LPCREATEDXGIFACTORY pCreateDXGIFactory = (LPCREATEDXGIFACTORY) ::GetProcAddress( hDXGI, "CreateDXGIFactory1" ); 655 | if( pCreateDXGIFactory == nullptr ) 656 | { 657 | pCreateDXGIFactory = (LPCREATEDXGIFACTORY) ::GetProcAddress( hDXGI, "CreateDXGIFactory" ); 658 | if( pCreateDXGIFactory == nullptr ) 659 | { 660 | ::FreeLibrary( hDXGI ); 661 | return GPUDETECT_ERROR_DXGI_FACTORY_CREATION; 662 | } 663 | } 664 | 665 | // 666 | // We have the CreateDXGIFactory function so use it to actually create the factory and enumerate 667 | // through the adapters. Here, we are specifically looking for the Intel gfx adapter. 668 | // 669 | IDXGIFactory* pFactory = nullptr; 670 | if( FAILED( pCreateDXGIFactory( __uuidof( IDXGIFactory ), (void**) ( &pFactory ) ) ) ) 671 | { 672 | ::FreeLibrary( hDXGI ); 673 | return GPUDETECT_ERROR_DXGI_FACTORY_CREATION; 674 | } 675 | 676 | if( FAILED( pFactory->EnumAdapters( adapterIndex, (IDXGIAdapter**) adapter ) ) ) 677 | { 678 | pFactory->Release(); 679 | ::FreeLibrary( hDXGI ); 680 | return GPUDETECT_ERROR_DXGI_ADAPTER_CREATION; 681 | } 682 | 683 | pFactory->Release(); 684 | ::FreeLibrary( hDXGI ); 685 | return EXIT_SUCCESS; 686 | } 687 | 688 | int InitDevice( IDXGIAdapter* adapter, ID3D11Device** device ) 689 | { 690 | if ( device == nullptr ) 691 | { 692 | return GPUDETECT_ERROR_BAD_DATA; 693 | } 694 | 695 | if( FAILED( ::D3D11CreateDevice( adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, 0, nullptr, 0, D3D11_SDK_VERSION, device, nullptr, nullptr ) ) ) 696 | { 697 | return GPUDETECT_ERROR_DXGI_DEVICE_CREATION; 698 | } 699 | 700 | return EXIT_SUCCESS; 701 | } 702 | 703 | int GetIntelDeviceInfo( IntelDeviceInfo2* deviceInfo, ID3D11Device* device ) 704 | { 705 | assert( deviceInfo != nullptr ); 706 | assert( device != nullptr ); 707 | 708 | // 709 | // Grab the device context from the device. 710 | // 711 | ID3D11DeviceContext* deviceContext = nullptr; 712 | device->GetImmediateContext( &deviceContext ); 713 | 714 | // 715 | // Query the device to find the number of device dependent counters. 716 | // 717 | D3D11_COUNTER_INFO counterInfo = {}; 718 | device->CheckCounterInfo( &counterInfo ); 719 | if( counterInfo.LastDeviceDependentCounter == 0 ) 720 | { 721 | deviceContext->Release(); 722 | return GPUDETECT_ERROR_DXGI_BAD_COUNTER; 723 | } 724 | 725 | // 726 | // Search for the "Intel Device Information" counter and, if found, parse 727 | // it's description to determine the supported version. 728 | // 729 | D3D11_COUNTER_DESC counterDesc = {}; 730 | int intelDeviceInfoVersion = 0; 731 | bool intelDeviceInfo = false; 732 | 733 | for( int i = D3D11_COUNTER_DEVICE_DEPENDENT_0; i <= counterInfo.LastDeviceDependentCounter; ++i ) 734 | { 735 | counterDesc.Counter = static_cast( i ); 736 | 737 | D3D11_COUNTER_TYPE counterType = {}; 738 | UINT uiSlotsRequired = 0; 739 | UINT uiNameLength = 0; 740 | UINT uiUnitsLength = 0; 741 | UINT uiDescLength = 0; 742 | 743 | if( FAILED( device->CheckCounter( &counterDesc, &counterType, &uiSlotsRequired, nullptr, &uiNameLength, nullptr, &uiUnitsLength, nullptr, &uiDescLength ) ) ) 744 | { 745 | continue; 746 | } 747 | 748 | LPSTR sName = new char[ uiNameLength ]; 749 | LPSTR sUnits = new char[ uiUnitsLength ]; 750 | LPSTR sDesc = new char[ uiDescLength ]; 751 | 752 | intelDeviceInfo = 753 | SUCCEEDED( device->CheckCounter( &counterDesc, &counterType, &uiSlotsRequired, sName, &uiNameLength, sUnits, &uiUnitsLength, sDesc, &uiDescLength ) ) && 754 | ( strcmp( sName, "Intel Device Information" ) == 0 ); 755 | 756 | if( intelDeviceInfo ) 757 | { 758 | sscanf_s( sDesc, "Version %d", &intelDeviceInfoVersion ); 759 | } 760 | 761 | delete[] sName; 762 | delete[] sUnits; 763 | delete[] sDesc; 764 | 765 | if( intelDeviceInfo ) 766 | { 767 | break; 768 | } 769 | } 770 | 771 | // 772 | // Create the information counter, and query it to get the data. GetData() 773 | // returns a pointer to the data, not the actual data. 774 | // 775 | ID3D11Counter* counter = nullptr; 776 | if( !intelDeviceInfo || FAILED( device->CreateCounter( &counterDesc, &counter ) ) ) 777 | { 778 | deviceContext->Release(); 779 | return GPUDETECT_ERROR_DXGI_COUNTER_CREATION; 780 | } 781 | 782 | deviceContext->Begin( counter ); 783 | deviceContext->End( counter ); 784 | 785 | uintptr_t dataAddress = 0; 786 | if( deviceContext->GetData( counter, reinterpret_cast(&dataAddress), sizeof( dataAddress ), 0 ) != S_OK ) 787 | { 788 | counter->Release(); 789 | deviceContext->Release(); 790 | return GPUDETECT_ERROR_DXGI_COUNTER_GET_DATA; 791 | } 792 | 793 | // 794 | // Copy the information into the user's structure 795 | // 796 | assert( intelDeviceInfoVersion == 1 || intelDeviceInfoVersion == 2 ); 797 | const size_t infoSize = intelDeviceInfoVersion == 1 798 | ? sizeof( IntelDeviceInfo1 ) 799 | : sizeof( IntelDeviceInfo2 ); 800 | assert( infoSize <= sizeof( *deviceInfo ) ); 801 | memset( deviceInfo, 0, sizeof( *deviceInfo ) ); 802 | memcpy( deviceInfo, reinterpret_cast( dataAddress ), infoSize ); 803 | 804 | counter->Release(); 805 | deviceContext->Release(); 806 | return EXIT_SUCCESS; 807 | } 808 | 809 | } 810 | -------------------------------------------------------------------------------- /GPUDetect.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // Copyright 2017-2020 Intel Corporation 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //////////////////////////////////////////////////////////////////////////////// 16 | 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | #include "DeviceId.h" 23 | 24 | 25 | // forward decls 26 | struct IDXGIAdapter; 27 | struct ID3D11Device; 28 | 29 | 30 | // Error return codes for GPUDetect 31 | // These codes are set up so that (ERROR_CODE % GENERAL_ERROR_CODE) == 0 if 32 | // ERROR_CODE is a subset of GENERAL_ERROR_CODE. 33 | // e.g. GPUDETECT_ERROR_DXGI_LOAD % GPUDETECT_ERROR_DXGI_LOAD == 0 34 | #define GPUDETECT_ERROR_GENERIC 1 35 | 36 | /// General DXGI Errors 37 | #define GPUDETECT_ERROR_GENERAL_DXGI 2 38 | #define GPUDETECT_ERROR_DXGI_LOAD GPUDETECT_ERROR_GENERAL_DXGI * 3 39 | #define GPUDETECT_ERROR_DXGI_ADAPTER_CREATION GPUDETECT_ERROR_GENERAL_DXGI * 5 40 | #define GPUDETECT_ERROR_DXGI_FACTORY_CREATION GPUDETECT_ERROR_GENERAL_DXGI * 7 41 | #define GPUDETECT_ERROR_DXGI_DEVICE_CREATION GPUDETECT_ERROR_GENERAL_DXGI * 11 42 | #define GPUDETECT_ERROR_DXGI_GET_ADAPTER_DESC GPUDETECT_ERROR_GENERAL_DXGI * 13 43 | 44 | /// DXGI Counter Errors 45 | #define GPUDETECT_ERROR_GENERAL_DXGI_COUNTER 17 46 | #define GPUDETECT_ERROR_DXGI_BAD_COUNTER GPUDETECT_ERROR_GENERAL_DXGI_COUNTER * 19 47 | #define GPUDETECT_ERROR_DXGI_COUNTER_CREATION GPUDETECT_ERROR_GENERAL_DXGI_COUNTER * 23 48 | #define GPUDETECT_ERROR_DXGI_COUNTER_GET_DATA GPUDETECT_ERROR_GENERAL_DXGI_COUNTER * 29 49 | 50 | /// Windows Registry Errors 51 | #define GPUDETECT_ERROR_REG_GENERAL_FAILURE 31 52 | #define GPUDETECT_ERROR_REG_NO_D3D_KEY GPUDETECT_ERROR_REG_GENERAL_FAILURE * 37 // A DirectX key was not found in the registry in the expected location 53 | #define GPUDETECT_ERROR_REG_MISSING_DRIVER_INFO GPUDETECT_ERROR_REG_GENERAL_FAILURE * 41 // Driver info is missing from the registry 54 | 55 | /// Precondition Errors 56 | #define GPUDETECT_ERROR_BAD_DATA 47 57 | 58 | #define GPUDETECT_ERROR_NOT_SUPPORTED 55 59 | 60 | 61 | namespace GPUDetect 62 | { 63 | enum 64 | { 65 | INTEL_VENDOR_ID = 0x8086, 66 | }; 67 | 68 | // Define settings to reflect Fidelity abstraction levels you need 69 | enum PresetLevel 70 | { 71 | NotCompatible, // Found GPU is not compatible with the app 72 | Low, 73 | Medium, 74 | MediumPlus, 75 | High, 76 | Undefined // No predefined setting found in cfg file. 77 | // Use a default level for unknown video cards. 78 | }; 79 | 80 | // An enum that identifies the generation of Graphics 81 | enum IntelGraphicsGeneration 82 | { 83 | INTEL_GFX_GEN_UNKNOWN = 0, 84 | INTEL_GFX_GEN6, 85 | INTEL_GFX_GEN7, 86 | INTEL_GFX_GEN7_5, 87 | INTEL_GFX_GEN8, 88 | INTEL_GFX_GEN9, 89 | INTEL_GFX_GEN9_5, 90 | INTEL_GFX_GEN10, 91 | INTEL_GFX_GEN11, 92 | INTEL_GFX_GEN12, 93 | INTEL_DGFX_ACM 94 | }; 95 | 96 | struct GPUData 97 | { 98 | ///////////////////////// 99 | // DX11 Extension Data // 100 | ///////////////////////// 101 | 102 | /******************************************************************************* 103 | * dxAdapterAvailability 104 | * 105 | * Is true if Intel driver extension data is populated. 106 | * If this value is false, all other extension data will be null. 107 | * 108 | * This value is initialized by the InitExtensionInfo function. 109 | * 110 | ******************************************************************************/ 111 | bool dxAdapterAvailability; 112 | 113 | /******************************************************************************* 114 | * vendorID 115 | * 116 | * The vendorID of the GPU. 117 | * 118 | * This value is initialized by the InitExtensionInfo function. 119 | * 120 | ******************************************************************************/ 121 | unsigned int vendorID; 122 | 123 | /******************************************************************************* 124 | * deviceID 125 | * 126 | * The DeviceID of the GPU. 127 | * 128 | * This value is initialized by the InitExtensionInfo function. 129 | * 130 | ******************************************************************************/ 131 | unsigned int deviceID; 132 | 133 | /******************************************************************************* 134 | * adapterLUID 135 | * 136 | * The LUID of the d3d adapter. 137 | * 138 | * This value is initialized by the InitExtensionInfo function. 139 | * 140 | ******************************************************************************/ 141 | LUID adapterLUID; 142 | 143 | /******************************************************************************* 144 | * architectureCounter 145 | * 146 | * The architecture of the GPU. 147 | * 148 | * This value is initialized by the InitExtensionInfo function. 149 | * 150 | ******************************************************************************/ 151 | INTEL_GPU_ARCHITECTURE architecture; 152 | 153 | /******************************************************************************* 154 | * isUMAArchitecture 155 | * 156 | * Is true if the GPU uses a uniform memory access architecture. 157 | * On GPUs with a Unified Memory Architecture (UMA) like Intel integrated 158 | * GPUs, the CPU system memory is also used for graphics and there is no 159 | * dedicated VRAM. Any memory reported as "dedicated" is really a small 160 | * pool of system memory reserved by the BIOS for internal use. All normal 161 | * application allocations (buffers, textures, etc.) are allocated from 162 | * general system "shared" memory. For this reason, do not use the 163 | * dedicated memory size as an indication of UMA GPU capability (either 164 | * performance, nor memory capacity). 165 | * 166 | * This value is initialized by the InitExtensionInfo function. 167 | * 168 | ******************************************************************************/ 169 | bool isUMAArchitecture; 170 | 171 | /******************************************************************************* 172 | * videoMemory 173 | * 174 | * The amount of Video memory in bytes. 175 | * 176 | * This value is initialized by the InitExtensionInfo function. 177 | * 178 | ******************************************************************************/ 179 | uint64_t videoMemory; 180 | 181 | /******************************************************************************* 182 | * description 183 | * 184 | * The driver-provided description of the GPU. 185 | * 186 | * This value is initialized by the InitExtensionInfo function. 187 | * 188 | ******************************************************************************/ 189 | WCHAR description[ _countof( DXGI_ADAPTER_DESC::Description ) ]; 190 | 191 | /******************************************************************************* 192 | * extensionVersion 193 | * 194 | * Version number for D3D driver extensions. 195 | * 196 | * This value is initialized by the InitExtensionInfo function. 197 | * 198 | ******************************************************************************/ 199 | unsigned int extensionVersion; 200 | 201 | /******************************************************************************* 202 | * intelExtensionAvailability 203 | * 204 | * True if Intel driver extensions are available on the GPU. 205 | * 206 | * This value is initialized by the InitExtensionInfo function. 207 | * 208 | ******************************************************************************/ 209 | bool intelExtensionAvailability; 210 | 211 | ///////////////////////////////// 212 | // DX11 Hardware Counters Data // 213 | ///////////////////////////////// 214 | 215 | /******************************************************************************* 216 | * counterAvailability 217 | * 218 | * Returns true if Intel driver extensions are available to gather data from. 219 | * If this value is false, all other extension data will be null. 220 | * 221 | * This value is initialized by the InitCounterInfo function. 222 | * 223 | ******************************************************************************/ 224 | bool counterAvailability; 225 | 226 | /******************************************************************************* 227 | * maxFrequency 228 | * 229 | * Returns the maximum frequency of the GPU in MHz. 230 | * 231 | * This value is initialized by the InitCounterInfo function. 232 | * 233 | ******************************************************************************/ 234 | unsigned int maxFrequency; 235 | 236 | /******************************************************************************* 237 | * minFrequency 238 | * 239 | * Returns the minimum frequency of the GPU in MHz. 240 | * 241 | * This value is initialized by the InitCounterInfo function. 242 | * 243 | ******************************************************************************/ 244 | unsigned int minFrequency; 245 | 246 | /// Advanced counter info 247 | 248 | /******************************************************************************* 249 | * advancedCounterDataAvailability 250 | * 251 | * Returns true if advanced counter data is available from this GPU. 252 | * Older Intel products only provide the maximum and minimum GPU frequency 253 | * via the hardware counters. 254 | * 255 | * This value is initialized by the InitCounterInfo function. 256 | * 257 | ******************************************************************************/ 258 | bool advancedCounterDataAvailability; 259 | 260 | /******************************************************************************* 261 | * euCount 262 | * 263 | * Returns the number of execution units (EUs) on the GPU. 264 | * 265 | * This value is initialized by the InitCounterInfo function. 266 | * 267 | ******************************************************************************/ 268 | unsigned int euCount; 269 | 270 | /******************************************************************************* 271 | * packageTDP 272 | * 273 | * Returns the thermal design power (TDP) of the GPU in watts. 274 | * 275 | * This value is initialized by the InitCounterInfo function. 276 | * 277 | ******************************************************************************/ 278 | unsigned int packageTDP; 279 | 280 | /******************************************************************************* 281 | * maxFillRate 282 | * 283 | * Returns the maximum fill rate of the GPU in pixels/clock. 284 | * 285 | * This value is initialized by the InitCounterInfo function. 286 | * 287 | ******************************************************************************/ 288 | unsigned int maxFillRate; 289 | 290 | /////////////////////// 291 | // D3D Registry Data // 292 | /////////////////////// 293 | 294 | /******************************************************************************* 295 | * dxDriverVersion 296 | * 297 | * The version number for the adapter's driver. This is stored in a 4 part 298 | * version number that should be displayed in the format: "0.1.2.4" 299 | * 300 | * This value is initialized by the InitDxDriverVersion function. 301 | * 302 | ******************************************************************************/ 303 | unsigned int dxDriverVersion[ 4 ]; 304 | 305 | /******************************************************************************* 306 | * d3dRegistryDataAvailability 307 | * 308 | * Is true if d3d registry data is populated. If this value is true and 309 | * vendorID == INTEL_VENDOR_ID, then the driverInfo and dxDriverVersion 310 | * fields will be populated. If this value is false, all other registry data 311 | * will be null. 312 | * 313 | * This value is initialized by the InitDxDriverVersion function. 314 | * 315 | ******************************************************************************/ 316 | bool d3dRegistryDataAvailability; 317 | 318 | struct DriverVersionInfo 319 | { 320 | /******************************************************************************* 321 | * driverReleaseRevision 322 | * 323 | * The release revision for this device's driver. This is the third 324 | * section of the driver version number as illustrated by the 'X's below: 325 | * 00.00.XXX.0000 326 | * 327 | * This value is initialized by the InitDxDriverVersion function. 328 | * 329 | ******************************************************************************/ 330 | unsigned int driverReleaseRevision; 331 | 332 | /******************************************************************************* 333 | * buildNumber 334 | * 335 | * The build number for this device's driver. This is the last 336 | * section of the driver version number as shown below: 337 | * 00.00.000.XXXX 338 | * 339 | * For example, for the driver version 12.34.56.7890, buildNumber 340 | * would be 7890. 341 | * 342 | * This value is initialized by the InitDxDriverVersion function. 343 | * 344 | ******************************************************************************/ 345 | unsigned int driverBuildNumber; 346 | } driverInfo; 347 | }; 348 | 349 | /******************************************************************************* 350 | * InitAll 351 | * 352 | * Loads all available info from this GPUDetect into gpuData. Returns 353 | * EXIT_SUCCESS if no error was encountered, otherwise returns an error code. 354 | * 355 | * gpuData 356 | * The struct in which the information will be stored. 357 | * 358 | * adapterIndex 359 | * The index of the adapter to get the information from. 360 | * 361 | ******************************************************************************/ 362 | int InitAll( GPUData* const gpuData, int adapterIndex ); 363 | 364 | /******************************************************************************* 365 | * InitAll 366 | * 367 | * Loads all available info from this GPUDetect into gpuData. Returns 368 | * EXIT_SUCCESS if no error was encountered, otherwise returns an error code. 369 | * 370 | * gpuData 371 | * The struct in which the information will be stored. 372 | * 373 | * adapter 374 | * A pointer to the adapter to draw info from. 375 | * 376 | * device 377 | * A pointer to the device to draw info from. 378 | * 379 | ******************************************************************************/ 380 | int InitAll( GPUData* const gpuData, IDXGIAdapter* adapter, ID3D11Device* device ); 381 | 382 | /******************************************************************************* 383 | * InitExtensionInfo 384 | * 385 | * Loads available info from the DX11 extension interface. Returns 386 | * EXIT_SUCCESS if no error was encountered, otherwise returns an error code. 387 | * 388 | * gpuData 389 | * The struct in which the information will be stored. 390 | * 391 | * adapterIndex 392 | * The index of the adapter to get the information from. 393 | * 394 | ******************************************************************************/ 395 | int InitExtensionInfo( GPUData* const gpuData, int adapterIndex ); 396 | 397 | /******************************************************************************* 398 | * InitExtensionInfo 399 | * 400 | * Loads available info from the DX11 extension interface. Returns 401 | * EXIT_SUCCESS if no error was encountered, otherwise returns an error code. 402 | * 403 | * gpuData 404 | * The struct in which the information will be stored. 405 | * 406 | * adapter 407 | * A pointer to the adapter to draw info from. 408 | * 409 | * device 410 | * A pointer to the device to draw info from. 411 | * 412 | ******************************************************************************/ 413 | int InitExtensionInfo( GPUData* const gpuData, IDXGIAdapter* adapter, ID3D11Device* device ); 414 | 415 | /******************************************************************************* 416 | * InitCounterInfo 417 | * 418 | * Loads available info from DX11 hardware counters. Returns EXIT_SUCCESS 419 | * if no error was encountered, otherwise returns an error code. Requires 420 | * that InitExtensionInfo be run on gpuData before this is called. 421 | * 422 | * gpuData 423 | * The struct in which the information will be stored. 424 | * 425 | * adapterIndex 426 | * The index of the adapter to get the information from. 427 | * 428 | ******************************************************************************/ 429 | int InitCounterInfo( GPUData* const gpuData, int adapterIndex ); 430 | 431 | /******************************************************************************* 432 | * InitCounterInfo 433 | * 434 | * Intel exposes additional information through the DX driver 435 | * that can be obtained querying a special counter. This loads the 436 | * available info. It returns EXIT_SUCCESS if no error was encountered, 437 | * otherwise returns an error code. 438 | * 439 | * Requires that InitExtensionInfo be run on gpuData before this is called. 440 | * 441 | * gpuData 442 | * The struct in which the information will be stored. 443 | * 444 | * device 445 | * A pointer to the device to draw info from. 446 | * 447 | ******************************************************************************/ 448 | int InitCounterInfo( GPUData* const gpuData, ID3D11Device* device ); 449 | 450 | /******************************************************************************* 451 | * GetDefaultFidelityPreset 452 | * 453 | * Function to find the default fidelity preset level, based on the type of 454 | * graphics adapter present. 455 | * 456 | * The guidelines for graphics preset levels for Intel devices is a generic 457 | * one based on our observations with various contemporary games. You would 458 | * have to change it if your game already plays well on the older hardware 459 | * even at high settings. 460 | * 461 | * Presets for Intel are expected in a file named "IntelGFX.cfg". This 462 | * method can also be easily modified to also read similar .cfg files 463 | * detailing presets for other manufacturers. 464 | * 465 | * gpuData 466 | * The data for the GPU in question. 467 | * 468 | ******************************************************************************/ 469 | PresetLevel GetDefaultFidelityPreset( const GPUData* const gpuData ); 470 | 471 | /******************************************************************************* 472 | * InitDxDriverVersion 473 | * 474 | * Loads the DX driver version for the given adapter from the windows 475 | * registry. Returns EXIT_SUCCESS if no error was encountered, otherwise 476 | * returns an error code. Requires that InitExtensionInfo be run on gpuData 477 | * before this is called. 478 | * 479 | * gpuData 480 | * The struct in which the information will be stored. 481 | * 482 | ******************************************************************************/ 483 | int InitDxDriverVersion( GPUData* const gpuData ); 484 | 485 | /******************************************************************************* 486 | * GetDriverVersionAsCString 487 | * 488 | * Stores the driver version as a string in the 00.00.000.0000 format. 489 | * 490 | * gpuData 491 | * The struct that contains the driver version. 492 | * 493 | * outBuffer 494 | * Buffer to store the resulting c string. 495 | * 496 | * outBufferSize 497 | * Size of buffer to store the resulting c string. 498 | * 499 | ******************************************************************************/ 500 | void GetDriverVersionAsCString( const GPUData* const gpuData, char* const outBuffer, size_t outBufferSize ); 501 | 502 | /******************************************************************************* 503 | * GetIntelGraphicsGeneration 504 | * 505 | * Returns the generation of Intel(tm) Graphics, given the architecture. 506 | * 507 | * architecture 508 | * The architecture to identify. 509 | * 510 | ******************************************************************************/ 511 | IntelGraphicsGeneration GetIntelGraphicsGeneration( INTEL_GPU_ARCHITECTURE architecture ); 512 | 513 | /******************************************************************************* 514 | * GetIntelGraphicsGenerationString 515 | * 516 | * Returns the generation of Intel(tm) Graphics, given the architecture. 517 | * 518 | * generation 519 | * The generation to identify. 520 | * 521 | ******************************************************************************/ 522 | const char * GetIntelGraphicsGenerationString( const IntelGraphicsGeneration genneration ); 523 | 524 | /******************************************************************************* 525 | * InitAdapter 526 | * 527 | * Initializes a adapter of the given index. Returns EXIT_SUCCESS if no 528 | * error was encountered, otherwise returns an error code. 529 | * 530 | * adapter 531 | * The address of the pointer that this function will point to 532 | * the created adapter. 533 | * 534 | * adapterIndex 535 | * If adapterIndex >= 0 this will be used as as the index of the 536 | * adapter to create. 537 | * 538 | ******************************************************************************/ 539 | int InitAdapter( IDXGIAdapter** adapter, int adapterIndex ); 540 | 541 | /******************************************************************************* 542 | * InitDevice 543 | * 544 | * Initializes a DX11 device of the given index. Returns EXIT_SUCCESS if no 545 | * error was encountered, otherwise returns an error code. 546 | * 547 | * adapter 548 | * The adapter to create the device from. 549 | * 550 | * device 551 | * The address of the pointer that this function will point to the 552 | * created device. 553 | * 554 | ******************************************************************************/ 555 | int InitDevice( IDXGIAdapter* adapter, ID3D11Device** device ); 556 | 557 | } 558 | -------------------------------------------------------------------------------- /GPUDetect.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2046 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GPUDetect", "GPUDetect.vcxproj", "{D10D10ED-77A8-4A00-8ACA-5A091BE96497}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {D10D10ED-77A8-4A00-8ACA-5A091BE96497}.Debug|x64.ActiveCfg = Debug|x64 17 | {D10D10ED-77A8-4A00-8ACA-5A091BE96497}.Debug|x64.Build.0 = Debug|x64 18 | {D10D10ED-77A8-4A00-8ACA-5A091BE96497}.Debug|x86.ActiveCfg = Debug|Win32 19 | {D10D10ED-77A8-4A00-8ACA-5A091BE96497}.Debug|x86.Build.0 = Debug|Win32 20 | {D10D10ED-77A8-4A00-8ACA-5A091BE96497}.Release|x64.ActiveCfg = Release|x64 21 | {D10D10ED-77A8-4A00-8ACA-5A091BE96497}.Release|x64.Build.0 = Release|x64 22 | {D10D10ED-77A8-4A00-8ACA-5A091BE96497}.Release|x86.ActiveCfg = Release|Win32 23 | {D10D10ED-77A8-4A00-8ACA-5A091BE96497}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {940D28D5-4CD9-48E3-A052-F6ADA689D3E5} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /GPUDetect.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 15.0 23 | {D10D10ED-77A8-4A00-8ACA-5A091BE96497} 24 | GPUDetect 25 | 26 | 27 | 28 | Application 29 | true 30 | v142 31 | Unicode 32 | 33 | 34 | Application 35 | false 36 | v142 37 | true 38 | Unicode 39 | 40 | 41 | Application 42 | true 43 | v142 44 | Unicode 45 | 46 | 47 | Application 48 | false 49 | v142 50 | true 51 | Unicode 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | $(ProjectDir)build\ 75 | GPUDetect_$(Configuration)_$(Platform) 76 | .exe 77 | $(ProjectDir)build\$(Configuration)\$(Platform)\ 78 | 79 | 80 | 81 | 82 | $(ProjectDir)build\ 83 | GPUDetect_$(Configuration)_$(Platform) 84 | .exe 85 | $(ProjectDir)build\$(Configuration)\$(Platform)\ 86 | 87 | 88 | 89 | 90 | $(ProjectDir)build\ 91 | GPUDetect_$(Configuration)_$(Platform) 92 | .exe 93 | $(ProjectDir)build\$(Configuration)\$(Platform)\ 94 | 95 | 96 | 97 | 98 | $(ProjectDir)build\ 99 | GPUDetect_$(Configuration)_$(Platform) 100 | .exe 101 | $(ProjectDir)build\$(Configuration)\$(Platform)\ 102 | 103 | 104 | 105 | NotUsing 106 | Level4 107 | EditAndContinue 108 | Disabled 109 | false 110 | false 111 | false 112 | true 113 | true 114 | false 115 | true 116 | _DEBUG;DEBUG;STRICT;NOMINMAX;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_HAS_EXCEPTIONS=0;_HAS_ITERATOR_DEBUGGING=1;_ITERATOR_DEBUG_LEVEL=2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) 117 | 118 | 119 | Console 120 | true 121 | d3d11.lib;%(AdditionalDependencies) 122 | true 123 | 124 | 125 | copy /y IntelGfx.cfg "$(OutDir)" 126 | 127 | 128 | 129 | 130 | NotUsing 131 | Level4 132 | EditAndContinue 133 | Disabled 134 | false 135 | false 136 | false 137 | true 138 | true 139 | false 140 | true 141 | _DEBUG;DEBUG;STRICT;NOMINMAX;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_HAS_EXCEPTIONS=0;_HAS_ITERATOR_DEBUGGING=1;_ITERATOR_DEBUG_LEVEL=2;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) 142 | 143 | 144 | Console 145 | true 146 | d3d11.lib;%(AdditionalDependencies) 147 | true 148 | 149 | 150 | copy /y IntelGfx.cfg "$(OutDir)" 151 | 152 | 153 | 154 | 155 | NotUsing 156 | Level4 157 | ProgramDatabase 158 | Full 159 | true 160 | true 161 | false 162 | true 163 | true 164 | false 165 | false 166 | true 167 | true 168 | false 169 | true 170 | NDEBUG;STRICT;NOMINMAX;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_NO_DEBUG_HEAP=1;_HAS_EXCEPTIONS=0;_HAS_ITERATOR_DEBUGGING=0;_ITERATOR_DEBUG_LEVEL=0;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) 171 | 172 | 173 | Console 174 | true 175 | true 176 | true 177 | true 178 | d3d11.lib;%(AdditionalDependencies) 179 | 180 | 181 | copy /y IntelGfx.cfg "$(OutDir)" 182 | 183 | 184 | 185 | 186 | NotUsing 187 | Level4 188 | ProgramDatabase 189 | Full 190 | true 191 | true 192 | false 193 | true 194 | true 195 | false 196 | false 197 | true 198 | true 199 | false 200 | true 201 | NDEBUG;STRICT;NOMINMAX;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_NO_DEBUG_HEAP=1;_HAS_EXCEPTIONS=0;_HAS_ITERATOR_DEBUGGING=0;_ITERATOR_DEBUG_LEVEL=0;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions) 202 | 203 | 204 | Console 205 | true 206 | true 207 | true 208 | true 209 | d3d11.lib;%(AdditionalDependencies) 210 | 211 | 212 | copy /y IntelGfx.cfg "$(OutDir)" 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | -------------------------------------------------------------------------------- /ID3D10Extensions.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // Copyright 2011,2012,2013 Intel Corporation 3 | // All Rights Reserved 4 | // 5 | // Permission is granted to use, copy, distribute and prepare derivative works of this 6 | // software for any purpose and without fee, provided, that the above copyright notice 7 | // and this statement appear in all copies. Intel makes no representations about the 8 | // suitability of this software for any purpose. THIS SOFTWARE IS PROVIDED "AS IS." 9 | // INTEL SPECIFICALLY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, AND ALL LIABILITY, 10 | // INCLUDING CONSEQUENTIAL AND OTHER INDIRECT DAMAGES, FOR THE USE OF THIS SOFTWARE, 11 | // INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PROPRIETARY RIGHTS, AND INCLUDING THE 12 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Intel does not 13 | // assume any responsibility for any errors which may appear in this software nor any 14 | // responsibility to update it. 15 | //-------------------------------------------------------------------------------------- 16 | #pragma once 17 | 18 | namespace ID3D10 19 | { 20 | 21 | /*****************************************************************************\ 22 | CONST: EXTENSION_INTERFACE_VERSION 23 | PURPOSE: Version of this header file 24 | \*****************************************************************************/ 25 | const UINT EXTENSION_INTERFACE_VERSION_1_0 = 0x00010000; 26 | const UINT EXTENSION_INTERFACE_VERSION = EXTENSION_INTERFACE_VERSION_1_0; 27 | 28 | /*****************************************************************************\ 29 | CONST: CAPS_EXTENSION_KEY 30 | PURPOSE: KEY to pass to UMD 31 | \*****************************************************************************/ 32 | const char CAPS_EXTENSION_KEY[ 16 ] = { 33 | 'I','N','T','C', 34 | 'E','X','T','N', 35 | 'C','A','P','S', 36 | 'F','U','N','C' }; 37 | 38 | /*****************************************************************************\ 39 | TYPEDEF: PFND3D10UMDEXT_CHECKEXTENSIONSUPPORT 40 | PURPOSE: Function pointer for shader flag extensions 41 | \*****************************************************************************/ 42 | typedef BOOL( APIENTRY* PFND3D10UMDEXT_CHECKEXTENSIONSUPPORT )( UINT ); 43 | 44 | /*****************************************************************************\ 45 | STRUCT: EXTENSION_BASE 46 | PURPOSE: Base data structure for extension initialization data 47 | \*****************************************************************************/ 48 | struct EXTENSION_BASE 49 | { 50 | // Input: 51 | char Key[ 16 ]; // CAPS_EXTENSION_KEY 52 | UINT ApplicationVersion; // EXTENSION_INTERFACE_VERSION 53 | }; 54 | 55 | /*****************************************************************************\ 56 | STRUCT: CAPS_EXTENSION_1_0 57 | PURPOSE: Caps data structure 58 | \*****************************************************************************/ 59 | struct CAPS_EXTENSION_1_0 : EXTENSION_BASE 60 | { 61 | // Output: 62 | UINT DriverVersion; // EXTENSION_INTERFACE_VERSION 63 | UINT DriverBuildNumber; // BUILD_NUMBER 64 | }; 65 | 66 | typedef CAPS_EXTENSION_1_0 CAPS_EXTENSION; 67 | 68 | #ifndef D3D10_UMD 69 | /*****************************************************************************\ 70 | FUNCTION: GetExtensionCaps 71 | PURPOSE: Gets extension caps table from Intel graphics driver 72 | \*****************************************************************************/ 73 | inline HRESULT GetExtensionCaps( 74 | ID3D11Device* pd3dDevice, 75 | CAPS_EXTENSION* pCaps ) 76 | { 77 | D3D11_BUFFER_DESC desc; 78 | ZeroMemory( &desc, sizeof( desc ) ); 79 | desc.ByteWidth = sizeof( CAPS_EXTENSION ); 80 | desc.Usage = D3D11_USAGE_STAGING; 81 | desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; 82 | 83 | D3D11_SUBRESOURCE_DATA initData; 84 | initData.pSysMem = pCaps; 85 | initData.SysMemPitch = sizeof( CAPS_EXTENSION ); 86 | initData.SysMemSlicePitch = 0; 87 | 88 | ZeroMemory( pCaps, sizeof( CAPS_EXTENSION ) ); 89 | memcpy( pCaps->Key, CAPS_EXTENSION_KEY, 90 | sizeof( pCaps->Key ) ); 91 | pCaps->ApplicationVersion = EXTENSION_INTERFACE_VERSION; 92 | 93 | ID3D11Buffer* pBuffer = NULL; 94 | HRESULT result = pd3dDevice->CreateBuffer( 95 | &desc, 96 | &initData, 97 | &pBuffer ); 98 | 99 | if( pBuffer ) 100 | pBuffer->Release(); 101 | 102 | if( S_OK == result ) 103 | { 104 | result = ( pCaps->ApplicationVersion <= pCaps->DriverVersion ) ? S_OK : S_FALSE; 105 | } 106 | return result; 107 | }; 108 | #endif 109 | 110 | /*****************************************************************************\ 111 | CONST: RESOURCE_EXTENSION_KEY 112 | PURPOSE: KEY to pass to UMD 113 | \*****************************************************************************/ 114 | const char RESOURCE_EXTENSION_KEY[ 16 ] = { 115 | 'I','N','T','C', 116 | 'E','X','T','N', 117 | 'R','E','S','O', 118 | 'U','R','C','E' }; 119 | 120 | /*****************************************************************************\ 121 | ENUM: RESOURCE_EXTENSION_TYPE 122 | PURPOSE: Enumeration of supported resource extensions 123 | \*****************************************************************************/ 124 | enum RESOURCE_EXTENSION_TYPE 125 | { 126 | RESOURCE_EXTENSION_RESERVED = 0, 127 | 128 | // Version 1_0 129 | RESOURCE_EXTENSION_DIRECT_ACCESS = 1, 130 | }; 131 | 132 | /*****************************************************************************\ 133 | ENUM: RESOURCE_EXTENSION_FLAGS 134 | PURPOSE: Enumeration for extra information 135 | \*****************************************************************************/ 136 | enum RESOURCE_EXTENSION_FLAGS 137 | { 138 | RESOURCE_EXTENSION_DIRECT_ACCESS_LINEAR_ALLOCATION = 0x1, 139 | }; 140 | 141 | /*****************************************************************************\ 142 | STRUCT: RESOURCE_EXTENSION_1_0 143 | PURPOSE: Resource extension interface structure 144 | \*****************************************************************************/ 145 | struct RESOURCE_EXTENSION_1_0 : EXTENSION_BASE 146 | { 147 | // Input: 148 | 149 | // Enumeration of the extension 150 | UINT Type; // RESOURCE_EXTENSION_TYPE 151 | 152 | // Extension data 153 | UINT Data[ 16 ]; 154 | }; 155 | 156 | typedef RESOURCE_EXTENSION_1_0 RESOURCE_EXTENSION; 157 | 158 | /*****************************************************************************\ 159 | STRUCT: RESOURCE_DIRECT_ACCESS_MAP_DATA 160 | PURPOSE: Direct Access Resource extension Map structure 161 | \*****************************************************************************/ 162 | struct RESOURCE_DIRECT_ACCESS_MAP_DATA 163 | { 164 | void* pBaseAddress; 165 | UINT XOffset; 166 | UINT YOffset; 167 | 168 | UINT TileFormat; 169 | UINT Pitch; 170 | UINT Size; 171 | }; 172 | 173 | #ifndef D3D10_UMD 174 | /*****************************************************************************\ 175 | FUNCTION: SetResouceExtension 176 | PURPOSE: Resource extension interface 177 | \*****************************************************************************/ 178 | inline HRESULT SetResouceExtension( 179 | ID3D11Device* pd3dDevice, 180 | const RESOURCE_EXTENSION* pExtnDesc ) 181 | { 182 | D3D11_BUFFER_DESC desc; 183 | ZeroMemory( &desc, sizeof( desc ) ); 184 | desc.ByteWidth = sizeof( RESOURCE_EXTENSION ); 185 | desc.Usage = D3D11_USAGE_STAGING; 186 | desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; 187 | 188 | D3D11_SUBRESOURCE_DATA initData; 189 | ZeroMemory( &initData, sizeof( initData ) ); 190 | initData.pSysMem = pExtnDesc; 191 | initData.SysMemPitch = sizeof( RESOURCE_EXTENSION ); 192 | initData.SysMemSlicePitch = 0; 193 | 194 | ID3D11Buffer* pBuffer = NULL; 195 | HRESULT result = pd3dDevice->CreateBuffer( 196 | &desc, 197 | &initData, 198 | &pBuffer ); 199 | 200 | if( pBuffer ) 201 | pBuffer->Release(); 202 | 203 | return result; 204 | } 205 | 206 | /*****************************************************************************\ 207 | FUNCTION: SetDirectAccessResouceExtension 208 | PURPOSE: Direct Access Resource extension interface 209 | \*****************************************************************************/ 210 | inline HRESULT SetDirectAccessResouceExtension( 211 | ID3D11Device* pd3dDevice, 212 | const UINT flags ) 213 | { 214 | RESOURCE_EXTENSION extnDesc; 215 | ZeroMemory( &extnDesc, sizeof( extnDesc ) ); 216 | memcpy( &extnDesc.Key[ 0 ], RESOURCE_EXTENSION_KEY, 217 | sizeof( extnDesc.Key ) ); 218 | extnDesc.ApplicationVersion = EXTENSION_INTERFACE_VERSION; 219 | extnDesc.Type = RESOURCE_EXTENSION_DIRECT_ACCESS; 220 | extnDesc.Data[ 0 ] = flags; 221 | 222 | return SetResouceExtension( pd3dDevice, &extnDesc ); 223 | } 224 | #endif 225 | 226 | /*****************************************************************************\ 227 | CONST: STATE_EXTENSION_KEY 228 | PURPOSE: KEY to pass to UMD 229 | \*****************************************************************************/ 230 | const char STATE_EXTENSION_KEY[ 16 ] = { 231 | 'I','N','T','C', 232 | 'E','X','T','N', 233 | 'S','T','A','T', 234 | 'E','O','B','J' }; 235 | 236 | /*****************************************************************************\ 237 | ENUM: STATE_EXTENSION_TYPE 238 | PURPOSE: Enumeration of supported state extensions 239 | \*****************************************************************************/ 240 | enum STATE_EXTENSION_TYPE 241 | { 242 | STATE_EXTENSION_RESERVED = 0, 243 | 244 | // Version 1_0 245 | }; 246 | 247 | /*****************************************************************************\ 248 | STRUCT: STATE_EXTENSION_1_0 249 | PURPOSE: UMD extension interface structure 250 | \*****************************************************************************/ 251 | struct STATE_EXTENSION_1_0 : EXTENSION_BASE 252 | { 253 | // Input: 254 | 255 | // Enumeration of the extension 256 | UINT Type; // STATE_EXTENSION_TYPE 257 | 258 | // Extension data 259 | UINT Data[ 16 ]; 260 | }; 261 | 262 | typedef STATE_EXTENSION_1_0 STATE_EXTENSION; 263 | 264 | #ifndef D3D10_UMD 265 | /*****************************************************************************\ 266 | FUNCTION: SetStateExtension 267 | PURPOSE: State extension interface 268 | \*****************************************************************************/ 269 | inline HRESULT SetStateExtension( 270 | ID3D11Device* pd3dDevice, 271 | const STATE_EXTENSION* pExtnDesc ) 272 | { 273 | D3D11_BUFFER_DESC desc; 274 | ZeroMemory( &desc, sizeof( desc ) ); 275 | desc.ByteWidth = sizeof( STATE_EXTENSION ); 276 | desc.Usage = D3D11_USAGE_STAGING; 277 | desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; 278 | 279 | D3D11_SUBRESOURCE_DATA initData; 280 | ZeroMemory( &initData, sizeof( initData ) ); 281 | initData.pSysMem = pExtnDesc; 282 | initData.SysMemPitch = sizeof( STATE_EXTENSION ); 283 | initData.SysMemSlicePitch = 0; 284 | 285 | ID3D11Buffer* pBuffer = NULL; 286 | HRESULT result = pd3dDevice->CreateBuffer( 287 | &desc, 288 | &initData, 289 | &pBuffer ); 290 | 291 | if( pBuffer ) 292 | pBuffer->Release(); 293 | 294 | return result; 295 | } 296 | #endif 297 | 298 | /*****************************************************************************\ 299 | ENUM: SHADER_EXTENSION_TYPE 300 | PURPOSE: Enumeration of supported shader extensions 301 | \*****************************************************************************/ 302 | enum SHADER_EXTENSION_TYPE 303 | { 304 | SHADER_EXTENSION_RESERVED = 0, 305 | 306 | // Version 1_0 307 | SHADER_EXTENSION_PIXEL_SHADER_ORDERING = 1, 308 | }; 309 | 310 | } // namespace ID3D10 311 | -------------------------------------------------------------------------------- /IntelGfx.cfg: -------------------------------------------------------------------------------- 1 | ; 2 | ; Intel Graphics Preset Levels 3 | ; 4 | ; Format: 5 | ; VendorIDHex, DeviceIDHex, Example Out of the Box Settings; Commented name of cards 6 | ; 7 | 8 | ; Other 9 | 0x8086, 0x2982, Low; Intel(R) G35 Express Chipset Family 10 | 0x8086, 0x2983, Low; Intel(R) G35 Express Chipset Family 11 | 0x8086, 0x2A02, Low; Mobile Intel(R) 965 Express Chipset Family 12 | 0x8086, 0x2A03, Low; Mobile Intel(R) 965 Express Chipset Family 13 | 0x8086, 0x2A12, Low; Mobile Intel(R) 965 Express Chipset Family 14 | 0x8086, 0x2A13, Low; Mobile Intel(R) 965 Express Chipset Family 15 | 0x8086, 0x2A42, Low; Mobile Intel(R) 4 Series Express Chipset Family 16 | 0x8086, 0x2A43, Low; Mobile Intel(R) 4 Series Express Chipset Family 17 | 0x8086, 0x2E02, Low; Intel(R) 4 Series Express Chipset 18 | 0x8086, 0x2E03, Low; Intel(R) 4 Series Express Chipset 19 | 0x8086, 0x2E22, Low; Intel(R) G45/G43 Express Chipset 20 | 0x8086, 0x2E23, Low; Intel(R) G45/G43 Express Chipset 21 | 0x8086, 0x2E12, Low; Intel(R) Q45/Q43 Express Chipset 22 | 0x8086, 0x2E13, Low; Intel(R) Q45/Q43 Express Chipset 23 | 0x8086, 0x2E32, Low; Intel(R) G41 Express Chipset 24 | 0x8086, 0x2E33, Low; Intel(R) G41 Express Chipset 25 | 0x8086, 0x2E42, Low; Intel(R) B43 Express Chipset 26 | 0x8086, 0x2E43, Low; Intel(R) B43 Express Chipset 27 | 0x8086, 0x2E92, Low; Intel(R) B43 Express Chipset 28 | 0x8086, 0x2E93, Low; Intel(R) B43 Express Chipset 29 | 0x8086, 0x0046, Low; Intel(R) HD Graphics - Core i3/i5/i7 Mobile Processors 30 | 0x8086, 0x0042, Low; Intel(R) HD Graphics - Core i3/i5 + Pentium G9650 Processors 31 | 32 | ; Sandybridge 33 | 0x8086, 0x0102, Low; Intel(R) HD Graphics 2000 34 | 0x8086, 0x0106, Low; Intel(R) HD Graphics 2000 35 | 0x8086, 0x0112, Low; Intel(R) HD Graphics 3000 36 | 0x8086, 0x0116, Low; Intel(R) HD Graphics 3000 37 | 0x8086, 0x0122, Low; Intel(R) HD Graphics 3000 38 | 0x8086, 0x0126, Low; Intel(R) HD Graphics 3000 39 | 0x8086, 0x010A, Low; Intel(R) HD Graphics 40 | 41 | ; Ivybridge 42 | 0x8086, 0x0152, Low; Intel(R) HD Graphics 2500 43 | 0x8086, 0x0156, Low; Intel(R) HD Graphics 2500 44 | 0x8086, 0x015A, Low; Intel(R) HD Graphics 2500 45 | 0x8086, 0x0162, Low; Intel(R) HD Graphics 4000 46 | 0x8086, 0x0166, Low; Intel(R) HD Graphics 4000 47 | 0x8086, 0x016A, Low; Intel(R) HD Graphics 4000 48 | 49 | ; Haswell 50 | 0x8086, 0x0402, Low; Intel(R) HD Graphics 51 | 0x8086, 0x0412, Low; Intel(R) HD Graphics 4600 52 | 0x8086, 0x0422, Low; Intel(R) HD Graphics 5000 53 | 0x8086, 0x0406, Low; Intel(R) HD Graphics 54 | 0x8086, 0x0416, Low; Intel(R) HD Graphics 4600 55 | 0x8086, 0x0426, Low; Intel(R) HD Graphics 5000 56 | 0x8086, 0x040A, Low; Intel(R) HD Graphics 57 | 0x8086, 0x041A, Low; Intel(R) HD Graphics P4600/P4700 58 | 0x8086, 0x042A, Low; Intel(R) HD Graphics 5000 59 | 0x8086, 0x040B, Low; Intel(R) HD Graphics 60 | 0x8086, 0x041B, Low; Intel(R) HD Graphics 61 | 0x8086, 0x042B, Low; Intel(R) HD Graphics 62 | 0x8086, 0x040E, Low; Intel(R) HD Graphics 63 | 0x8086, 0x041E, Low; Intel(R) HD Graphics 64 | 0x8086, 0x042E, Low; Intel(R) HD Graphics 65 | 0x8086, 0x0A02, Low; Intel(R) HD Graphics 66 | 0x8086, 0x0A12, Low; Intel(R) HD Graphics 67 | 0x8086, 0x0A22, Low; Intel(R) Iris(TM) Graphics 5100 68 | 0x8086, 0x0A06, Low; Intel(R) HD Graphics 69 | 0x8086, 0x0A16, Low; Intel(R) HD Graphics 4400 70 | 0x8086, 0x0A26, Low; Intel(R) HD Graphics 5000 71 | 0x8086, 0x0A0A, Low; Intel(R) HD Graphics 72 | 0x8086, 0x0A1A, Low; Intel(R) HD Graphics 73 | 0x8086, 0x0A2A, Low; Intel(R) Iris(TM) Graphics 5100 74 | 0x8086, 0x0A0B, Low; Intel(R) HD Graphics 75 | 0x8086, 0x0A1B, Low; Intel(R) HD Graphics 76 | 0x8086, 0x0A2B, Low; Intel(R) Iris(TM) Graphics 5100 77 | 0x8086, 0x0A0E, Low; Intel(R) HD Graphics 78 | 0x8086, 0x0A1E, Low; Intel(R) HD Graphics 4200 79 | 0x8086, 0x0A2E, Low; Intel(R) Iris(TM) Graphics 5100 80 | 0x8086, 0x0D02, Low; Intel(R) HD Graphics 81 | 0x8086, 0x0D12, Low; Intel(R) HD Graphics 4600 82 | 0x8086, 0x0D22, Low; Intel(R) Iris(TM) Pro Graphics 5200 83 | 0x8086, 0x0D06, Low; Intel(R) HD Graphics 84 | 0x8086, 0x0D16, Low; Intel(R) HD Graphics 4600 85 | 0x8086, 0x0D26, Low; Intel(R) Iris(TM) Pro Graphics 5200 86 | 0x8086, 0x0D0A, Low; Intel(R) HD Graphics 87 | 0x8086, 0x0D1A, Low; Intel(R) HD Graphics 88 | 0x8086, 0x0D2A, Low; Intel(R) Iris(TM) Pro Graphics 5200 89 | 0x8086, 0x0D0B, Low; Intel(R) HD Graphics 90 | 0x8086, 0x0D1B, Low; Intel(R) HD Graphics 91 | 0x8086, 0x0D2B, Low; Intel(R) Iris(TM) Pro Graphics 5200 92 | 0x8086, 0x0D0E, Low; Intel(R) HD Graphics 93 | 0x8086, 0x0D1E, Low; Intel(R) HD Graphics 94 | 0x8086, 0x0D2E, Low; Intel(R) Iris(TM) Pro Graphics 5200 95 | 0x8086, 0x0C02, Low; Intel(R) HD Graphics 96 | 0x8086, 0x0C12, Low; Intel(R) HD Graphics 97 | 0x8086, 0x0C22, Low; Intel(R) HD Graphics 98 | 0x8086, 0x0C06, Low; Intel(R) HD Graphics 99 | 0x8086, 0x0C16, Low; Intel(R) HD Graphics 100 | 0x8086, 0x0C26, Low; Intel(R) HD Graphics 101 | 0x8086, 0x0C0A, Low; Intel(R) HD Graphics 102 | 0x8086, 0x0C1A, Low; Intel(R) HD Graphics 103 | 0x8086, 0x0C2A, Low; Intel(R) HD Graphics 104 | 105 | ; Valleyview 106 | 0x8086, 0x0F30, Low; Intel(R) Vallyview Graphics 107 | 0x8086, 0x0F31, Low; Intel(R) Vallyview Graphics 108 | 109 | ; Broadwell 110 | 0x8086, 0x0BD0, Low; Intel(R) HD Graphics 111 | 0x8086, 0x0BD1, Low; Intel(R) HD Graphics 112 | 0x8086, 0x0BD2, Low; Intel(R) HD Graphics 113 | 0x8086, 0x0BD3, Low; Intel(R) HD Graphics 114 | 0x8086, 0x0BD4, Low; Intel(R) HD Graphics 115 | 0x8086, 0x1602, Low; Intel(R) HD Graphics 116 | 0x8086, 0x1606, Low; Intel(R) HD Graphics 117 | 0x8086, 0x160B, Low; Intel(R) HD Graphics 118 | 0x8086, 0x160A, Low; Intel(R) HD Graphics 119 | 0x8086, 0x160D, Low; Intel(R) HD Graphics 120 | 0x8086, 0x160E, Low; Intel(R) HD Graphics 121 | 0x8086, 0x1612, Low; Intel(R) HD Graphics 5600 122 | 0x8086, 0x1616, Low; Intel(R) HD Graphics 5500 123 | 0x8086, 0x161B, Low; Intel(R) HD Graphics 124 | 0x8086, 0x161A, Low; Intel(R) HD Graphics 125 | 0x8086, 0x161D, Low; Intel(R) HD Graphics 126 | 0x8086, 0x161E, Low; Intel(R) HD Graphics 5300 127 | 0x8086, 0x1622, Low; Intel(R) Iris(TM) Pro Graphics 6200 128 | 0x8086, 0x1626, Low; Intel(R) HD Graphics 6000 129 | 0x8086, 0x162B, Low; Intel(R) Iris(TM) Graphics 6100 130 | 0x8086, 0x162A, Low; Intel(R) Iris(TM) Pro Graphics P6300 131 | 0x8086, 0x162D, Low; Intel(R) HD Graphics 132 | 0x8086, 0x162E, Low; Intel(R) HD Graphics 133 | 0x8086, 0x1632, Low; Intel(R) HD Graphics 134 | 0x8086, 0x1636, Low; Intel(R) HD Graphics 135 | 0x8086, 0x163B, Low; Intel(R) HD Graphics 136 | 0x8086, 0x163A, Low; Intel(R) HD Graphics 137 | 0x8086, 0x163D, Low; Intel(R) HD Graphics 138 | 0x8086, 0x163E, Low; Intel(R) HD Graphics 139 | 140 | ; Skylake 141 | 0x8086, 0x0900, Medium; Intel(R) HD Graphics 142 | 0x8086, 0x0901, Medium; Intel(R) HD Graphics 143 | 0x8086, 0x0902, Medium; Intel(R) HD Graphics 144 | 0x8086, 0x0903, Medium; Intel(R) HD Graphics 145 | 0x8086, 0x0904, Medium; Intel(R) HD Graphics 146 | 0x8086, 0x192D, Medium; Intel(R) HD Graphics 147 | 0x8086, 0x1913, Medium; Intel(R) HD Graphics 148 | 0x8086, 0x1923, Medium; Intel(R) HD Graphics 149 | 0x8086, 0x193A, Medium; Intel(R) HD Graphics 150 | 0x8086, 0x1902, Medium; Intel(R) HD Graphics 510 151 | 0x8086, 0x1906, Medium; Intel(R) HD Graphics 510 152 | 0x8086, 0x190A, Medium; Intel(R) HD Graphics 153 | 0x8086, 0x190B, Medium; Intel(R) HD Graphics 154 | 0x8086, 0x190E, Medium; Intel(R) HD Graphics 155 | 0x8086, 0x1912, Medium; Intel(R) HD Graphics 530 156 | 0x8086, 0x1916, Medium; Intel(R) HD Graphics 520 157 | 0x8086, 0x191A, Medium; Intel(R) HD Graphics 158 | 0x8086, 0x191B, Medium; Intel(R) HD Graphics 530 159 | 0x8086, 0x191D, Medium; Intel(R) HD Graphics P530 160 | 0x8086, 0x191E, Medium; Intel(R) HD Graphics 515 161 | 0x8086, 0x1921, Medium; Intel(R) HD Graphics 162 | 0x8086, 0x1926, Medium; Intel(R) Iris Graphics 540 163 | 0x8086, 0x1927, Medium; Intel(R) Iris Graphics 540 164 | 0x8086, 0x192A, Medium; Intel(R) HD Graphics 165 | 0x8086, 0x192B, Medium; Intel(R) HD Graphics 166 | 0x8086, 0x193B, High; Intel(R) Iris Pro Graphics 580 167 | 0x8086, 0x193D, High; Intel(R) Iris Pro Graphics P580 168 | 169 | ; CherryTrail and Braswell 170 | 0x8086, 0x22B0, Low; Intel(R) HD Graphics 171 | 0x8086, 0x22B1, Low; Intel(R) HD Graphics 172 | 0x8086, 0x22B2, Low; Intel(R) HD Graphics 173 | 0x8086, 0x22B3, Low; Intel(R) HD Graphics 174 | 175 | ; Kabylake 176 | 0x8086, 0x590E, Low; Intel(R) HD Graphics 177 | 0x8086, 0x5915, Low; Intel(R) HD Graphics 178 | 0x8086, 0x5908, Low; Intel(R) HD Graphics 179 | 0x8086, 0x593B, Low; Intel(R) HD Graphics 180 | 0x8086, 0x590A, Low; Intel(R) HD Graphics 181 | 0x8086, 0x591A, Low; Intel(R) HD Graphics 182 | 0x8086, 0x5923, Low; Intel(R) HD Graphics 183 | 0x8086, 0x5932, Low; Intel(R) HD Graphics 184 | 0x8086, 0x592B, Low; Intel(R) HD Graphics 185 | 0x8086, 0x592A, Low; Intel(R) HD Graphics 186 | 0x8086, 0x593A, Low; Intel(R) HD Graphics 187 | 0x8086, 0x593D, Low; Intel(R) HD Graphics 188 | 0x8086, 0x87C0, Low; Intel(R) HD Graphics 189 | 0x8086, 0x5913, Low; Intel(R) HD Graphics 190 | 0x8086, 0x591C, Low; Intel(R) HD Graphics 191 | 0x8086, 0x5902, Low; Intel(R) HD Graphics 610 192 | 0x8086, 0x5906, Low; Intel(R) HD Graphics 610 193 | 0x8086, 0x590B, Low; Intel(R) HD Graphics P610 194 | 0x8086, 0x5912, Medium; Intel(R) HD Graphics 630 195 | 0x8086, 0x5916, Medium; Intel(R) HD Graphics 620 196 | 0x8086, 0x5917, Medium; Intel(R) UHD Graphics 620 197 | 0x8086, 0x591B, Medium; Intel(R) HD Graphics 630 198 | 0x8086, 0x591D, Medium; Intel(R) HD Graphics P630 199 | 0x8086, 0x591E, Low; Intel(R) HD Graphics 615 200 | 0x8086, 0x5921, Medium; Intel(R) HD Graphics 620 201 | 0x8086, 0x5926, High; Intel(R) Iris Plus Graphics 640 202 | 0x8086, 0x5927, High; Intel(R) Iris Plus Graphics 650 203 | 204 | ; Coffeelake 205 | 0x8086, 0x3E91, Medium; Intel(R) UHD Graphics 206 | 0x8086, 0x3E92, Medium; Intel(R) UHD Graphics 207 | 0x8086, 0x3E96, Medium; Intel(R) UHD Graphics 208 | 0x8086, 0x3E9B, Medium; Intel(R) UHD Graphics 209 | 0x8086, 0x3E9A, Medium; Intel(R) UHD Graphics 210 | 0x8086, 0x3EA5, High; Intel(R) Iris Plus Graphics 211 | 0x8086, 0x3EA6, High; Intel(R) Iris Plus Graphics 212 | 0x8086, 0x3EA7, High; Intel(R) Iris Plus Graphics 213 | 0x8086, 0x3EA8, High; Intel(R) Iris Plus Graphics 214 | 0x8086, 0x3E90, Low; Intel(R) UHD Graphics 215 | 0x8086, 0x3E93, Low; Intel(R) UHD Graphics 216 | 0x8086, 0x3E99, Low; Intel(R) UHD Graphics 217 | 0x8086, 0x3E94, Low; Intel(R) UHD Graphics 218 | 0x8086, 0x3E98, Low; Intel(R) UHD Graphics 219 | 0x8086, 0x3EA9, Low; Intel(R) UHD Graphics 220 | 0x8086, 0x3E9C, Low; Intel(R) UHD Graphics 221 | 0x8086, 0x9BC6, Low; Intel(R) UHD Graphics 222 | 0x8086, 0x9BE6, Low; Intel(R) UHD Graphics 223 | 0x8086, 0x9BF6, Low; Intel(R) UHD Graphics 224 | 225 | ; CannonLake 226 | 0x8086, 0x5A51, Low; Intel(R) HD Graphics 227 | 0x8086, 0x5A59, Low; Intel(R) HD Graphics 228 | 0x8086, 0x5A41, Low; Intel(R) HD Graphics 229 | 0x8086, 0x5A49, Low; Intel(R) HD Graphics 230 | 0x8086, 0x5A52, Low; Intel(R) HD Graphics 231 | 0x8086, 0x5A5A, Low; Intel(R) HD Graphics 232 | 0x8086, 0x5A42, Low; Intel(R) HD Graphics 233 | 0x8086, 0x5A4A, Low; Intel(R) HD Graphics 234 | 0x8086, 0x5A50, Low; Intel(R) HD Graphics 235 | 0x8086, 0x5A40, Low; Intel(R) HD Graphics 236 | 0x8086, 0x5A54, Low; Intel(R) HD Graphics 237 | 0x8086, 0x5A5C, Low; Intel(R) HD Graphics 238 | 0x8086, 0x5A44, Low; Intel(R) HD Graphics 239 | 0x8086, 0x5A4C, Low; Intel(R) HD Graphics 240 | 241 | ; Amberlake 242 | 0x8086, 0x87CA, Low; Intel(R) UHD Graphics 243 | 244 | ; WhiskeyLake 245 | 0x8086, 0x3EA1, Low; Intel(R) UHD Graphics 246 | 0x8086, 0x3EA4, Low; Intel(R) UHD Graphics 247 | 0x8086, 0x3EA0, Medium; Intel(R) UHD Graphics 248 | 0x8086, 0x3EA3, Medium; Intel(R) UHD Graphics 249 | 0x8086, 0x3EA2, High; Intel(R) Iris Plus Graphics 250 | 251 | ; CometLake GT1 252 | 0x8086, 0x9B21, Low; Intel(R) UHD Graphics 253 | 0x8086, 0x9BAA, Low; Intel(R) UHD Graphics 254 | 0x8086, 0x9BAB, Low; Intel(R) UHD Graphics 255 | 0x8086, 0x9BAC, Low; Intel(R) UHD Graphics 256 | 0x8086, 0x9BA0, Low; Intel(R) UHD Graphics 257 | 0x8086, 0x9BA5, Low; Intel(R) UHD Graphics 258 | 0x8086, 0x9BA8, Low; Intel(R) UHD Graphics 259 | 0x8086, 0x9BA4, Low; Intel(R) UHD Graphics 260 | 0x8086, 0x9BA2, Low; Intel(R) UHD Graphics 261 | 262 | ; CometLake GT2 263 | 0x8086, 0x9B41, Medium; Intel(R) UHD Graphics 264 | 0x8086, 0x9BCA, Medium; Intel(R) UHD Graphics 265 | 0x8086, 0x9BCB, Medium; Intel(R) UHD Graphics 266 | 0x8086, 0x9BCC, Medium; Intel(R) UHD Graphics 267 | 0x8086, 0x9BC0, Medium; Intel(R) UHD Graphics 268 | 0x8086, 0x9BC5, Medium; Intel(R) UHD Graphics 269 | 0x8086, 0x9BC8, Medium; Intel(R) UHD Graphics 270 | 0x8086, 0x9BC4, Medium; Intel(R) UHD Graphics 271 | 0x8086, 0x9BC2, Medium; Intel(R) UHD Graphics 272 | 273 | ; Geminilake 274 | 0x8086, 0x3184, Medium; Intel(R) UHD Graphics 275 | 0x8086, 0x3185, Medium; Intel(R) UHD Graphics 276 | 277 | ; Icelake 278 | 0x8086, 0x8A50, Medium; Intel(R) Iris Plus Graphics (64 EUs) 279 | 0x8086, 0x8A51, Medium; Intel(R) Iris Plus Graphics (64 EUs) 280 | 0x8086, 0x8A52, Medium; Intel(R) Iris Plus Graphics (64 EUs) 281 | 0x8086, 0x8A53, Medium; Intel(R) Iris Plus Graphics (64 EUs) 282 | 0x8086, 0x8A5C, Medium; Intel(R) Iris Plus Graphics (48 EUs) 283 | 0x8086, 0x8A59, Medium; Intel(R) Iris Plus Graphics (48 EUs) 284 | 0x8086, 0x8A5A, Medium; Intel(R) Iris Plus Graphics (48 EUs) 285 | 0x8086, 0x8A57, Medium; Intel(R) Iris Plus Graphics (48 EUs) 286 | 0x8086, 0x8A56, Medium; Intel(R) Iris Plus Graphics (48 EUs) 287 | 0x8086, 0x8A54, Medium; Intel(R) Iris Plus Graphics (48 EUs) 288 | 0x8086, 0x8A5D, Medium; Intel(R) Iris Plus Graphics (32 EUs) 289 | 0x8086, 0x8A58, Medium; Intel(R) Iris Plus Graphics (32 EUs) 290 | 0x8086, 0x8A5B, Medium; Intel(R) Iris Plus Graphics (32 EUs) 291 | 0x8086, 0x8A71, Medium; Intel(R) Iris Plus Graphics (8 EUs) 292 | 293 | ; Tigerlake 294 | 0x8086, 0x9A49, Medium; Intel(R) Iris(R) Xe Graphics 295 | 0x8086, 0x9A40, Medium; Intel(R) Iris(R) Xe Graphics 296 | 0x8086, 0x9A59, Medium; Intel(R) Iris(R) Xe Graphics 297 | 0x8086, 0x9A60, Medium; Intel(R) Iris(R) Xe Graphics 298 | 0x8086, 0x9A68, Medium; Intel(R) Iris(R) Xe Graphics 299 | 0x8086, 0x9A70, Medium; Intel(R) Iris(R) Xe Graphics 300 | 0x8086, 0x9A78, Medium; Intel(R) Iris(R) Xe Graphics 301 | 0x8086, 0x9A7F, Medium; Intel(R) Iris(R) Xe Graphics 302 | 0x8086, 0x9AC9, Medium; Intel(R) Iris(R) Xe Graphics 303 | 0x8086, 0x9AF8, Medium; Intel(R) Iris(R) Xe Graphics 304 | 0x8086, 0x9AC0, Medium; Intel(R) Iris(R) Xe Graphics 305 | 0x8086, 0x9AD9, Medium; Intel(R) Iris(R) Xe Graphics 306 | 307 | ; DG1 308 | 0x8086, 0x4905, Medium; Intel(R) Iris(R) Xe MAX Graphics 309 | 0x8086, 0x4906, Medium; Intel(R) Iris(R) Xe MAX Graphics 310 | 0x8086, 0x4907, Medium; Intel(R) Iris(R) Xe MAX Graphics 311 | 312 | ; ROCKETLAKE 313 | 0x8086, 0x4C90, Medium; Intel(R) UHD Graphics 314 | 0x8086, 0x4C8A, Medium; Intel(R) UHD Graphics 315 | 0x8086, 0x4C8B, Medium; Intel(R) UHD Graphics 316 | 317 | ; ALDERLAKE 318 | 0x8086, 0x4626, Medium, Intel(R) Xe Graphics 319 | 0x8086, 0x46A3, Medium, Intel(R) Xe Graphics 320 | 0x8086, 0x46A6, Medium; Intel(R) Xe Graphics 321 | 0x8086, 0x4680, High; Intel(R) Xe Graphics 322 | 0x8086, 0x4682, High; Intel(R) Xe Graphics 323 | 0x8086, 0x4688, High; Intel(R) Xe Graphics 324 | 0x8086, 0x468A, High; Intel(R) Xe Graphics 325 | 0x8086, 0x468B, High; Intel(R) Xe Graphics 326 | 0x8086, 0x4690, High; Intel(R) Xe Graphics 327 | 0x8086, 0x4692, High; Intel(R) Xe Graphics 328 | 0x8086, 0x4693, High; Intel(R) Xe Graphics 329 | 330 | ; Alchemist/DG2 331 | 0x8086, 0x5693, High; Intel(R) Arc(TM) A370M Graphics 332 | 0x8086, 0x5690, High; Intel(R) Arc(TM) A770M Graphics 333 | 0x8086, 0x56A0, High; Intel(R) Arc(TM) A770 Graphics 334 | 0x8086, 0x56A1, High; Intel(R) Arc(TM) A750 Graphics 335 | 0x8086, 0x56A5, High; Intel(R) Arc(TM) A380 Graphics 336 | 337 | ; RAPTORLAKE 338 | 0x8086, 0xA780, High; Intel(R) Xe Graphics 339 | 0x8086, 0xA788, High; Intel(R) Xe Graphics 340 | -------------------------------------------------------------------------------- /TestMain.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // Copyright 2017-2018 Intel Corporation 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | //////////////////////////////////////////////////////////////////////////////// 16 | 17 | #ifndef STRICT 18 | #define STRICT 19 | #endif 20 | 21 | #ifndef NOMINMAX 22 | #define NOMINMAX 23 | #endif 24 | 25 | #ifndef WIN32_LEAN_AND_MEAN 26 | #define WIN32_LEAN_AND_MEAN 27 | #endif 28 | 29 | #ifndef VC_EXTRALEAN 30 | #define VC_EXTRALEAN 31 | #endif 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | #ifdef _WIN32_WINNT_WIN10 38 | #include 39 | #endif 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #include "GPUDetect.h" 47 | 48 | 49 | // For parsing arguments 50 | bool isnumber( char* s ) 51 | { 52 | for( ; *s != '\0'; ++s ) 53 | { 54 | if( !isdigit( *s ) ) 55 | { 56 | return false; 57 | } 58 | } 59 | return true; 60 | } 61 | 62 | /******************************************************************************* 63 | * printError 64 | * 65 | * Prints the error on screen in a nice format. 66 | * 67 | ******************************************************************************/ 68 | void printError( int errorCode ) 69 | { 70 | fprintf( stderr, "Error: " ); 71 | 72 | if( errorCode % GPUDETECT_ERROR_GENERAL_DXGI == 0 ) 73 | { 74 | fprintf( stderr, "DXGI: " ); 75 | } 76 | 77 | if( errorCode % GPUDETECT_ERROR_GENERAL_DXGI_COUNTER == 0 ) 78 | { 79 | fprintf( stderr, "DXGI Counter: " ); 80 | } 81 | 82 | if( errorCode % GPUDETECT_ERROR_REG_GENERAL_FAILURE == 0 ) 83 | { 84 | fprintf( stderr, "Registry: " ); 85 | } 86 | 87 | switch( errorCode ) 88 | { 89 | case GPUDETECT_ERROR_DXGI_LOAD: 90 | fprintf( stderr, "Could not load DXGI Library\n" ); 91 | break; 92 | 93 | case GPUDETECT_ERROR_DXGI_ADAPTER_CREATION: 94 | fprintf( stderr, "Could not create DXGI adapter\n" ); 95 | break; 96 | 97 | case GPUDETECT_ERROR_DXGI_FACTORY_CREATION: 98 | fprintf( stderr, "Could not create DXGI factory\n" ); 99 | break; 100 | 101 | case GPUDETECT_ERROR_DXGI_DEVICE_CREATION: 102 | fprintf( stderr, "Could not create DXGI device\n" ); 103 | break; 104 | 105 | case GPUDETECT_ERROR_DXGI_GET_ADAPTER_DESC: 106 | fprintf( stderr, "Could not get DXGI adapter\n" ); 107 | break; 108 | 109 | case GPUDETECT_ERROR_DXGI_BAD_COUNTER: 110 | fprintf( stderr, "Invalid DXGI counter data\n" ); 111 | break; 112 | 113 | case GPUDETECT_ERROR_DXGI_COUNTER_CREATION: 114 | fprintf( stderr, "Could not create DXGI counter\n" ); 115 | break; 116 | 117 | case GPUDETECT_ERROR_DXGI_COUNTER_GET_DATA: 118 | fprintf( stderr, "Could not get DXGI counter data\n" ); 119 | break; 120 | 121 | case GPUDETECT_ERROR_REG_NO_D3D_KEY: 122 | fprintf( stderr, "D3D driver info was not located in the expected location in the registry\n" ); 123 | break; 124 | 125 | case GPUDETECT_ERROR_REG_MISSING_DRIVER_INFO: 126 | fprintf( stderr, "Could not find a D3D driver matching the device ID and vendor ID of this adapter\n" ); 127 | break; 128 | 129 | case GPUDETECT_ERROR_BAD_DATA: 130 | fprintf( stderr, "Bad input data for function or precondition not met\n" ); 131 | break; 132 | 133 | case GPUDETECT_ERROR_NOT_SUPPORTED: 134 | fprintf( stderr, "Not supported\n" ); 135 | break; 136 | 137 | default: 138 | fprintf( stderr, "Unknown error\n" ); 139 | break; 140 | } 141 | } 142 | 143 | /******************************************************************************* 144 | * main 145 | * 146 | * Function represents the game or application. The application checks for 147 | * graphics capabilities here and makes whatever decisions it needs to 148 | * based on the results. 149 | * 150 | ******************************************************************************/ 151 | int main( int argc, char** argv ) 152 | { 153 | fprintf( stdout, "\n\n[ Intel GPUDetect ]\n" ); 154 | fprintf( stdout, "Build Info: %s, %s\n", __DATE__, __TIME__ ); 155 | 156 | int adapterIndex = 0; 157 | 158 | if( argc == 1 ) 159 | { 160 | fprintf( stdout, "Usage: GPUDetect adapter_index\n" ); 161 | fprintf( stdout, "Defaulting to adapter_index = %d\n", adapterIndex ); 162 | } 163 | else if( argc == 2 && isnumber( argv[ 1 ] )) 164 | { 165 | adapterIndex = atoi( argv[ 1 ] ); 166 | fprintf( stdout, "Choosing adapter_index = %d\n", adapterIndex ); 167 | } 168 | else 169 | { 170 | fprintf( stdout, "Usage: GPUDetect adapter_index\n" ); 171 | fprintf( stderr, "Error: unexpected arguments.\n" ); 172 | return EXIT_FAILURE; 173 | } 174 | fprintf( stdout, "\n" ); 175 | 176 | 177 | IDXGIAdapter* adapter = nullptr; 178 | int initReturnCode = GPUDetect::InitAdapter( &adapter, adapterIndex ); 179 | if( initReturnCode != EXIT_SUCCESS ) 180 | { 181 | printError( initReturnCode ); 182 | return EXIT_FAILURE; 183 | }; 184 | 185 | ID3D11Device* device = nullptr; 186 | initReturnCode = GPUDetect::InitDevice( adapter, &device ); 187 | if( initReturnCode != EXIT_SUCCESS ) 188 | { 189 | printError( initReturnCode ); 190 | adapter->Release(); 191 | return EXIT_FAILURE; 192 | }; 193 | 194 | GPUDetect::GPUData gpuData = {}; 195 | initReturnCode = GPUDetect::InitExtensionInfo( &gpuData, adapter, device ); 196 | if( initReturnCode != EXIT_SUCCESS ) 197 | { 198 | printError( initReturnCode ); 199 | } 200 | else 201 | { 202 | fprintf( stdout, "Adapter #%d\n", adapterIndex ); 203 | fprintf( stdout, "-----------------------\n" ); 204 | fprintf( stdout, "VendorID: 0x%x\n", gpuData.vendorID ); 205 | fprintf( stdout, "DeviceID: 0x%x\n", gpuData.deviceID ); 206 | fprintf( stdout, "Video Memory: %I64u MB\n", gpuData.videoMemory / ( 1024 * 1024 ) ); 207 | fprintf( stdout, "Description: %S\n", gpuData.description ); 208 | fprintf( stdout, "\n" ); 209 | 210 | // 211 | // Find and print driver version information 212 | // 213 | initReturnCode = GPUDetect::InitDxDriverVersion( &gpuData ); 214 | if( gpuData.d3dRegistryDataAvailability ) 215 | { 216 | fprintf( stdout, "\nDriver Information\n" ); 217 | fprintf( stdout, "-----------------------\n" ); 218 | 219 | char driverVersion[ 19 ] = {}; 220 | GPUDetect::GetDriverVersionAsCString( &gpuData, driverVersion, _countof(driverVersion) ); 221 | fprintf( stdout, "Driver Version: %s\n", driverVersion ); 222 | 223 | // Print out decoded data 224 | fprintf( stdout, "Release Revision: %u\n", gpuData.driverInfo.driverReleaseRevision ); 225 | fprintf( stdout, "Build Number: %u\n", gpuData.driverInfo.driverBuildNumber ); 226 | fprintf( stdout, "\n" ); 227 | } 228 | 229 | if( gpuData.vendorID == GPUDetect::INTEL_VENDOR_ID ) 230 | { 231 | 232 | # if 0 233 | // 234 | // This sample includes a .cfg file that maps known vendor and device IDs 235 | // to example quality presets. This looks up the preset for the IDs 236 | // queried above. 237 | // 238 | const GPUDetect::PresetLevel defPresets = GPUDetect::GetDefaultFidelityPreset( &gpuData ); 239 | switch( defPresets ) 240 | { 241 | case GPUDetect::PresetLevel::NotCompatible: fprintf( stdout, "Default Fidelity Preset Level: NotCompatible\n" ); break; 242 | case GPUDetect::PresetLevel::Low: fprintf( stdout, "Default Fidelity Preset Level: Low\n" ); break; 243 | case GPUDetect::PresetLevel::Medium: fprintf( stdout, "Default Fidelity Preset Level: Medium\n" ); break; 244 | case GPUDetect::PresetLevel::MediumPlus: fprintf( stdout, "Default Fidelity Preset Level: Medium+\n" ); break; 245 | case GPUDetect::PresetLevel::High: fprintf( stdout, "Default Fidelity Preset Level: High\n" ); break; 246 | case GPUDetect::PresetLevel::Undefined: fprintf( stdout, "Default Fidelity Preset Level: Undefined\n" ); break; 247 | } 248 | 249 | fprintf( stdout, "\n" ); 250 | #endif 251 | 252 | 253 | // 254 | // Check if Intel DirectX extensions are available on this system. 255 | // 256 | if( gpuData.intelExtensionAvailability ) 257 | { 258 | fprintf( stdout, "Supports Intel Iris Graphics extensions:\n" ); 259 | fprintf( stdout, "\tpixel synchronization\n" ); 260 | fprintf( stdout, "\tinstant access of graphics memory\n" ); 261 | } 262 | else 263 | { 264 | fprintf( stdout, "Does not support Intel Iris Graphics extensions\n" ); 265 | } 266 | 267 | fprintf( stdout, "\n" ); 268 | 269 | 270 | // 271 | // In DirectX, Intel exposes additional information through the driver that can be obtained 272 | // querying a special DX counter 273 | // 274 | 275 | // Populate the GPU architecture data with info from the counter, otherwise gpuDetect will use the value we got from the Dx11 extension 276 | initReturnCode = GPUDetect::InitCounterInfo( &gpuData, device ); 277 | if( initReturnCode != EXIT_SUCCESS ) 278 | { 279 | printError( initReturnCode ); 280 | } 281 | else 282 | { 283 | fprintf( stdout, "Architecture (from DeviceID): %s\n", GPUDetect::GetIntelGPUArchitectureString( gpuData.architecture )); 284 | fprintf( stdout, "using %s graphics\n", GPUDetect::GetIntelGraphicsGenerationString( GPUDetect::GetIntelGraphicsGeneration( gpuData.architecture )) ); 285 | 286 | // 287 | // Older versions of the IntelDeviceInfo query only return 288 | // GPUMaxFreq and GPUMinFreq, all other members will be zero. 289 | // 290 | if( gpuData.advancedCounterDataAvailability ) 291 | { 292 | fprintf( stdout, "EU Count: %u\n", gpuData.euCount ); 293 | fprintf( stdout, "Package TDP: %u W\n", gpuData.packageTDP ); 294 | fprintf( stdout, "Max Fill Rate: %u pixels/clock\n", gpuData.maxFillRate ); 295 | } 296 | 297 | fprintf( stdout, "GPU Max Frequency: %u MHz\n", gpuData.maxFrequency ); 298 | fprintf( stdout, "GPU Min Frequency: %u MHz\n", gpuData.minFrequency ); 299 | } 300 | 301 | fprintf( stdout, "\n" ); 302 | } 303 | } 304 | 305 | device->Release(); 306 | adapter->Release(); 307 | 308 | fprintf( stdout, "\n" ); 309 | 310 | return 0; 311 | } 312 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | 5 | http://www.apache.org/licenses/ 6 | 7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 8 | 9 | 1. Definitions. 10 | 11 | "License" shall mean the terms and conditions for use, reproduction, and 12 | distribution as defined by Sections 1 through 9 of this document. 13 | 14 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 15 | owner that is granting the License. 16 | 17 | "Legal Entity" shall mean the union of the acting entity and all other entities 18 | that control, are controlled by, or are under common control with that entity. 19 | For the purposes of this definition, "control" means (i) the power, direct or 20 | indirect, to cause the direction or management of such entity, whether by 21 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity exercising 25 | permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, including 28 | but not limited to software source code, documentation source, and configuration 29 | files. 30 | 31 | "Object" form shall mean any form resulting from mechanical transformation or 32 | translation of a Source form, including but not limited to compiled object code, 33 | generated documentation, and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or Object form, made 36 | available under the License, as indicated by a copyright notice that is included 37 | in or attached to the work (an example is provided in the Appendix below). 38 | 39 | "Derivative Works" shall mean any work, whether in Source or Object form, that 40 | is based on (or derived from) the Work and for which the editorial revisions, 41 | annotations, elaborations, or other modifications represent, as a whole, an 42 | original work of authorship. For the purposes of this License, Derivative Works 43 | shall not include works that remain separable from, or merely link (or bind by 44 | name) to the interfaces of, the Work and Derivative Works thereof. 45 | 46 | "Contribution" shall mean any work of authorship, including the original version 47 | of the Work and any modifications or additions to that Work or Derivative Works 48 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 49 | by the copyright owner or by an individual or Legal Entity authorized to submit 50 | on behalf of the copyright owner. For the purposes of this definition, 51 | "submitted" means any form of electronic, verbal, or written communication sent 52 | to the Licensor or its representatives, including but not limited to 53 | communication on electronic mailing lists, source code control systems, and 54 | issue tracking systems that are managed by, or on behalf of, the Licensor for 55 | the purpose of discussing and improving the Work, but excluding communication 56 | that is conspicuously marked or otherwise designated in writing by the copyright 57 | owner as "Not a Contribution." 58 | 59 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 60 | of whom a Contribution has been received by Licensor and subsequently 61 | incorporated within the Work. 62 | 63 | 2. Grant of Copyright License. Subject to the terms and conditions of this 64 | License, each Contributor hereby grants to You a perpetual, worldwide, 65 | non-exclusive, no-charge, royalty-free, irrevocable copyright license to 66 | reproduce, prepare Derivative Works of, publicly display, publicly perform, 67 | sublicense, and distribute the Work and such Derivative Works in Source or 68 | Object form. 69 | 70 | 3. Grant of Patent License. Subject to the terms and conditions of this License, 71 | each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, 72 | no-charge, royalty-free, irrevocable (except as stated in this section) patent 73 | license to make, have made, use, offer to sell, sell, import, and otherwise 74 | transfer the Work, where such license applies only to those patent claims 75 | licensable by such Contributor that are necessarily infringed by their 76 | Contribution(s) alone or by combination of their Contribution(s) with the Work 77 | to which such Contribution(s) was submitted. If You institute patent litigation 78 | against any entity (including a cross-claim or counterclaim in a lawsuit) 79 | alleging that the Work or a Contribution incorporated within the Work 80 | constitutes direct or contributory patent infringement, then any patent licenses 81 | granted to You under this License for that Work shall terminate as of the date 82 | such litigation is filed. 83 | 84 | 4. Redistribution. You may reproduce and distribute copies of the Work or 85 | Derivative Works thereof in any medium, with or without modifications, and in 86 | Source or Object form, provided that You meet the following conditions: 87 | You must give any other recipients of the Work or Derivative Works a copy of 88 | this License; and 89 | 90 | 91 | You must cause any modified files to carry prominent notices stating that You 92 | changed the files; and 93 | 94 | 95 | You must retain, in the Source form of any Derivative Works that You 96 | distribute, all copyright, patent, trademark, and attribution notices from the 97 | Source form of the Work, excluding those notices that do not pertain to any 98 | part of the Derivative Works; and 99 | 100 | 101 | If the Work includes a "NOTICE" text file as part of its distribution, then 102 | any Derivative Works that You distribute must include a readable copy of the 103 | attribution notices contained within such NOTICE file, excluding those notices 104 | that do not pertain to any part of the Derivative Works, in at least one of 105 | the following places: within a NOTICE text file distributed as part of the 106 | Derivative Works; within the Source form or documentation, if provided along 107 | with the Derivative Works; or, within a display generated by the Derivative 108 | Works, if and wherever such third-party notices normally appear. The contents 109 | of the NOTICE file are for informational purposes only and do not modify the 110 | License. You may add Your own attribution notices within Derivative Works that 111 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 112 | provided that such additional attribution notices cannot be construed as 113 | modifying the License. 114 | You may add Your own copyright statement to Your modifications and may provide 115 | additional or different license terms and conditions for use, reproduction, or 116 | distribution of Your modifications, or for any such Derivative Works as a whole, 117 | provided Your use, reproduction, and distribution of the Work otherwise complies 118 | with the conditions stated in this License. 119 | 120 | 5. Submission of Contributions. Unless You explicitly state otherwise, any 121 | Contribution intentionally submitted for inclusion in the Work by You to the 122 | Licensor shall be under the terms and conditions of this License, without any 123 | additional terms or conditions. Notwithstanding the above, nothing herein shall 124 | supersede or modify the terms of any separate license agreement you may have 125 | executed with Licensor regarding such Contributions. 126 | 127 | 6. Trademarks. This License does not grant permission to use the trade names, 128 | trademarks, service marks, or product names of the Licensor, except as required 129 | for reasonable and customary use in describing the origin of the Work and 130 | reproducing the content of the NOTICE file. 131 | 132 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in 133 | writing, Licensor provides the Work (and each Contributor provides its 134 | Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 135 | KIND, either express or implied, including, without limitation, any warranties 136 | or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 137 | PARTICULAR PURPOSE. You are solely responsible for determining the 138 | appropriateness of using or redistributing the Work and assume any risks 139 | associated with Your exercise of permissions under this License. 140 | 141 | 8. Limitation of Liability. In no event and under no legal theory, whether in 142 | tort (including negligence), contract, or otherwise, unless required by 143 | applicable law (such as deliberate and grossly negligent acts) or agreed to in 144 | writing, shall any Contributor be liable to You for damages, including any 145 | direct, indirect, special, incidental, or consequential damages of any character 146 | arising as a result of this License or out of the use or inability to use the 147 | Work (including but not limited to damages for loss of goodwill, work stoppage, 148 | computer failure or malfunction, or any and all other commercial damages or 149 | losses), even if such Contributor has been advised of the possibility of such 150 | damages. 151 | 152 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or 153 | Derivative Works thereof, You may choose to offer, and charge a fee for, 154 | acceptance of support, warranty, indemnity, or other liability obligations 155 | and/or rights consistent with this License. However, in accepting such 156 | obligations, You may act only on Your own behalf and on Your sole 157 | responsibility, not on behalf of any other Contributor, and only if You agree to 158 | indemnify, defend, and hold each Contributor harmless for any liability incurred 159 | by, or claims asserted against, such Contributor by reason of your accepting any 160 | such warranty or additional liability. 161 | 162 | END OF TERMS AND CONDITIONS 163 | 164 | APPENDIX: How to apply the Apache License to your work 165 | 166 | To apply the Apache License to your work, attach the following boilerplate 167 | notice, with the fields enclosed by brackets "[]" replaced with your own 168 | identifying information. (Don't include the brackets!) The text should be 169 | enclosed in the appropriate comment syntax for the file format. We also 170 | recommend that a file or class name and description of purpose be included on 171 | the same "printed page" as the copyright notice for easier identification within 172 | third-party archives. 173 | 174 | Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, 175 | Version 2.0 (the "License"); you may not use this file except in compliance with 176 | the License. You may obtain a copy of the License at 177 | http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or 178 | agreed to in writing, software distributed under the License is distributed on 179 | an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 180 | or implied. See the License for the specific language governing permissions and 181 | limitations under the License. 182 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # PROJECT NOT UNDER ACTIVE MANAGEMENT # 2 | This project will no longer be maintained by Intel. 3 | Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project. 4 | Intel no longer accepts patches to this project. 5 | If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the open source software community, please create your own fork of this project. 6 | 7 | # GPU Detect 8 | 9 | ## Overview 10 | This short sample demonstrates a way to detect the primary graphics hardware present in a system, and to initialize a game's default fidelity presets based on the found graphics device. The code and accompanying data is meant to be used as a guideline, and should be adapted to the game's specific needs. The sample is specific to Microsoft Windows although some of the information will be applicable on other operating systems. 11 | 12 | The API can be used to obtain a default quality setting for the device from the data provided in the vendor specific configuration files. Additionally, the Vendor ID and Device ID of the primary graphics device can be queried. The API works by using the DXGI interface. If the Vendor ID is recognized, the code then looks for a configuration file specific to that vendor. In the example, the configuration file is used to list the expected performance levels (Low / Medium / High) of all relevant devices from that vendor. If the device is not recognized the API returns the lowest quality level as a safe fall-back. 13 | 14 | This sample is intended for customers developing graphical applications who wish to target Intel(tm) graphics devices. 15 | ## File List 16 | * DeviceId.h -> Header file for device ID code. 17 | * DeviceId.cpp -> Implementation of functions to convert the device ID into more useful information. 18 | * GPUDetect.h -> Header file for GPU detection code. 19 | * GPUDetect.cpp -> Implementation of functions to obtain information about graphics devices. 20 | * IntelGfx.cfg -> Sample configuration file with list of known Intel GPU devices, their device IDs, and example expected graphics performance levels with regards to the calling game / application. 21 | * TestMain.cpp -> Simple console based test utility that calls the above functions, and displays the result. 22 | 23 | ## Configuration File 24 | The configuration file is an example of what could be done using information from GPU Detect. It has one line each for a known GPU device. The Vendor ID is repeated for clarity here. In this example file, each graphics device has been categorized as Low, Medium, or High based on the applications tested performance on each of these parts. 25 | ``` 26 | ; 27 | ; Intel Graphics Preset Levels 28 | ; 29 | ; Format: 30 | ; VendorIDHex, DeviceIDHex, Out of the Box Settings ; Commented name of cards 31 | ; 32 | 0x8086, 0x1612, Medium; Intel(R) HD Graphics 5600 33 | 0x8086, 0x1616, Medium; Intel(R) HD Graphics 5500 34 | 0x8086, 0x161E, Low; Intel(R) HD Graphics 5300 35 | 0x8086, 0x1622, High; Intel(R) Iris Pro Graphics 6200 36 | ``` 37 | 38 | ## Building 39 | This project requires the latest Windows SDK. 40 | 41 | ## Links 42 | * [Intel(tm) Graphics Developer's Guides](https://software.intel.com/en-us/articles/intel-hd-graphics-developers-guides) - For more information on developing for Intel(tm) graphics. 43 | * [Intel(tm) Developer Zone Games & Graphics Forum](https://software.intel.com/en-us/forums/developing-games-and-graphics-on-intel) - Forum for answers on software issues. 44 | * [Intel(tm) GameDev Developer Zone](https://software.intel.com/en-us/gamedev) - Articles and samples related to developing games 45 | * [Intel(tm) Graphics Performance Analyzer](https://software.intel.com/en-us/gpa) -Must have tool for any graphics developer. 46 | 47 | 48 | --------------------------------------------------------------------------------