@@ -432,20 +432,6 @@ ComPtr<IDevice> createTestingDevice(
432
432
433
433
REQUIRE_CALL (getRHI ()->createDevice (deviceDesc, device.writeRef ()));
434
434
435
- #if SLANG_RHI_DEBUG
436
- const char * features[128 ];
437
- uint32_t featureCount;
438
- REQUIRE_CALL (device->getFeatures (features, SLANG_COUNT_OF (features), &featureCount));
439
- std::string featureStr;
440
- for (uint32_t i = 0 ; i < featureCount; i++)
441
- {
442
- featureStr += features[i];
443
- if (i < featureCount - 1 )
444
- featureStr += " " ;
445
- }
446
- INFO (" Device features: " , featureStr);
447
- #endif
448
-
449
435
if (useCachedDevice)
450
436
{
451
437
gCachedDevices [deviceType] = device;
@@ -554,9 +540,47 @@ inline bool checkDeviceTypeAvailable(DeviceType deviceType, bool verbose = true)
554
540
desc.debugCallback = &sDebugCallback ;
555
541
#endif
556
542
543
+ #if SLANG_RHI_DEBUG
544
+
557
545
if (!SLANG_SUCCEEDED (rhi::getRHI ()->createDevice (desc, device.writeRef ())))
558
546
RETURN_NOT_AVAILABLE (" failed to create device" );
559
547
548
+ std::string deviceInfo;
549
+ deviceInfo += " Device type: " ;
550
+ deviceInfo += deviceTypeToString (deviceType);
551
+ deviceInfo += " \n " ;
552
+ deviceInfo += " Adapter name: " ;
553
+ deviceInfo += device->getInfo ().adapterName ;
554
+ deviceInfo += " \n " ;
555
+ {
556
+ uint32_t featureCount;
557
+ SLANG_RETURN_ON_FAIL (device->getFeatures (&featureCount, nullptr ));
558
+ std::vector<Feature> features (featureCount);
559
+ SLANG_RETURN_ON_FAIL (device->getFeatures (&featureCount, features.data ()));
560
+ deviceInfo += " Device features:" ;
561
+ for (uint32_t i = 0 ; i < featureCount; i++)
562
+ {
563
+ deviceInfo += " " ;
564
+ deviceInfo += rhi::getRHI ()->getFeatureName (features[i]);
565
+ }
566
+ deviceInfo += " \n " ;
567
+ }
568
+ {
569
+ uint32_t capabilityCount;
570
+ SLANG_RETURN_ON_FAIL (device->getCapabilities (&capabilityCount, nullptr ));
571
+ std::vector<Capability> capabilities (capabilityCount);
572
+ SLANG_RETURN_ON_FAIL (device->getCapabilities (&capabilityCount, capabilities.data ()));
573
+ deviceInfo += " Device capabilities:" ;
574
+ for (uint32_t i = 0 ; i < capabilityCount; i++)
575
+ {
576
+ deviceInfo += " " ;
577
+ deviceInfo += rhi::getRHI ()->getCapabilityName (capabilities[i]);
578
+ }
579
+ deviceInfo += " \n " ;
580
+ }
581
+ MESSAGE (" Device info:\n " , doctest::String (deviceInfo.c_str ()));
582
+ #endif
583
+
560
584
// Try compiling a trivial shader.
561
585
ComPtr<slang::ISession> session = device->getSlangSession ();
562
586
if (!session)
@@ -660,7 +684,7 @@ bool isSwiftShaderDevice(IDevice* device)
660
684
return adapterName.find (" swiftshader" ) != std::string::npos;
661
685
}
662
686
663
- static slang::IGlobalSession* getSlangGlobalSession ()
687
+ slang::IGlobalSession* getSlangGlobalSession ()
664
688
{
665
689
static slang::IGlobalSession* slangGlobalSession = []()
666
690
{
0 commit comments