396 {
397
399 VkResult err;
400
401
402
403 uint32_t gpuCount = 0;
404
405 VK_CHECK_RESULT(vkEnumeratePhysicalDevices(
instance, &gpuCount,
nullptr));
406 assert(gpuCount > 0);
407
408
409
410 std::vector<VkPhysicalDevice> devicePhysicals(gpuCount);
411 err = vkEnumeratePhysicalDevices(
instance, &gpuCount, devicePhysicals.data());
412 if (err) {
413 log_vkabad(err,
"Could not enumerate physical devices \n");
414 return false;
415 }
416
417
418 VkPhysicalDeviceIDPropertiesKHR pyid{};
419 pyid.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES;
420 VkPhysicalDeviceProperties prop{};
421
422 VkPhysicalDeviceProperties2 prop2{};
423 prop2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
424 prop2.properties = prop;
425
426 uint32_t selectedDevice = static_cast<uint32_t>(std::stoul(GPU_DEVICE_ID));
427
428 for (uint32_t d = 0; d < gpuCount; d++) {
429
430 vkGetPhysicalDeviceProperties2(devicePhysicals[d], &prop2);
431
432 log_ctx(
"device Name :: %s \n", prop2.properties.deviceName);
433
434
435
436
437
438
439 uint32_t low = 0;
441 log_ctx(
"luid :: VALID %s \n", (pyid.deviceLUIDValid == VK_TRUE) ?
"true" :
"false");
442 for (int i = 0; i < 4; i++) {
443 uint32_t fl = pyid.deviceLUID[i];
444 fl = fl << (i * 8);
445 low = low | fl;
446 }
447 log_ctx(
" lowpart %u \n", low);
448
449 }
450
451 physical = devicePhysicals[selectedDevice];
453
454 VkPhysicalDeviceShaderSMBuiltinsFeaturesNV Vkpdss = {};
455 Vkpdss.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV;
456 Vkpdss.pNext = NULL;
457
458 VkPhysicalDeviceFeatures fet={};
459 VkPhysicalDeviceFeatures2 fet2={};
460 fet2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
461 fet2.pNext = &Vkpdss;
462 fet2.features = fet;
463 vkGetPhysicalDeviceFeatures2(
physical, &fet2);
464
465
466
467 VkPhysicalDeviceShaderSMBuiltinsPropertiesNV Vkpdssp = {};
468 Vkpdssp.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV;
469 Vkpdssp.pNext = NULL;
470
471 prop2.pNext = &Vkpdssp;
472
473
474 vkGetPhysicalDeviceProperties2(
physical, &prop2);
475
476 VkPhysicalDeviceFeatures2 features2_;
477 VkPhysicalDeviceProperties2 properties2{};
479
480
481
482
483 ASSERT_PRINT(Vkpdss.shaderSMBuiltins,
"Configure failed. shaderSMBuiltins is False.");
485 ASSERT_PRINT(Vkpdssp.shaderSMCount == 40,
"Configure failed. shaderSMCount == 40.");
486 ASSERT_PRINT(Vkpdssp.shaderWarpsPerSM >= 32,
"Configure failed.shaderWarpsPerSM >= 32.");
487
488
490
491
492
493
494
495
496
497
498
499
500
501
502
505
506 uint32_t extCount = 0;
507 vkEnumerateDeviceExtensionProperties(
physical,
nullptr, &extCount,
nullptr);
508 if (extCount > 0)
509 {
510 std::vector<VkExtensionProperties> extensions(extCount);
511 if (vkEnumerateDeviceExtensionProperties(
physical,
nullptr, &extCount, &extensions.front()) == VK_SUCCESS)
512 {
513 for (auto ext : extensions)
514 {
516 }
517 }
518 }
519
520
521 uint32_t queueFamilyCount;
522 vkGetPhysicalDeviceQueueFamilyProperties(
physical, &queueFamilyCount,
nullptr);
523 assert(queueFamilyCount > 0);
525
527
528
529 int idx = 0;
531 {
535 log_ctx(
"Queue number: %d Queue flags: %s \n", q_family.queueCount, std::to_string(q_family.queueFlags).c_str());
536 idx++;
537 }
538
540 assert(validDepthFormat);
541 return true;
542
543 };
#define ASSERT_PRINT(condition,...)
struct DeviceMasterVk::_ShaderProp ShaderProp
VkPhysicalDeviceMemoryProperties memoryProperties
VkPhysicalDeviceProperties properties
VkPhysicalDeviceFeatures features
VkPhysicalDeviceVulkan11Properties properties11