@@ -372,15 +372,15 @@ bool AMDVulkanDemo::InitializeGpa()
372
372
gpu_perf_api_helper_.gpa_function_table_ ->GpaRegisterLoggingCallback (gpa_log_types, gpu_perf_api_helper_.gpaLoggingCallback );
373
373
if (status_register_callback != kGpaStatusOk )
374
374
{
375
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to register GPA logging callback. " );
375
+ LogStatus (status_register_callback, " ERROR: Failed to register GPA logging callback" );
376
376
return false ;
377
377
}
378
378
379
379
GpaStatus status_gpa_initialize = gpu_perf_api_helper_.gpa_function_table_ ->GpaInitialize (kGpaInitializeDefaultBit );
380
380
381
381
if (status_gpa_initialize != kGpaStatusOk )
382
382
{
383
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to initialize GPA. " );
383
+ LogStatus (status_gpa_initialize, " ERROR: Failed to initialize GPA" );
384
384
return false ;
385
385
}
386
386
@@ -421,7 +421,6 @@ bool AMDVulkanDemo::InitializeGpa()
421
421
if (kGpaStatusOk != status)
422
422
{
423
423
AMDVulkanDemoVkUtils::Log (" ERROR: GpaGetFuncTable failed with status %d" , status);
424
- delete gpa_function_table;
425
424
return false ;
426
425
}
427
426
@@ -440,7 +439,7 @@ bool AMDVulkanDemo::InitializeGpa()
440
439
status = gpu_perf_api_helper_.gpa_function_table_ ->GpaRegisterLoggingCallback (gpa_log_types, gpu_perf_api_helper_.gpaLoggingCallback );
441
440
if (status != kGpaStatusOk )
442
441
{
443
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to register GPA logging callback. " );
442
+ LogStatus (status, " ERROR: Failed to register GPA logging callback" );
444
443
return false ;
445
444
}
446
445
@@ -864,7 +863,7 @@ bool AMDVulkanDemo::InitializeVulkan()
864
863
865
864
if (gpa_open_context_status != kGpaStatusOk )
866
865
{
867
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to open GPA context. " );
866
+ LogStatus (gpa_open_context_status, " ERROR: Failed to open GPA context" );
868
867
return false ;
869
868
}
870
869
@@ -878,7 +877,7 @@ bool AMDVulkanDemo::InitializeVulkan()
878
877
GpaStatus get_sample_types_status = gpu_perf_api_helper_.gpa_function_table_ ->GpaGetSupportedSampleTypes (gpa_context_id_, &sample_types);
879
878
if (get_sample_types_status != kGpaStatusOk )
880
879
{
881
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to get supported GPA sample types. " );
880
+ LogStatus (get_sample_types_status, " ERROR: Failed to get supported GPA sample types" );
882
881
return false ;
883
882
}
884
883
@@ -887,7 +886,7 @@ bool AMDVulkanDemo::InitializeVulkan()
887
886
888
887
if (gpa_create_session_status != kGpaStatusOk )
889
888
{
890
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to create GPA session. " );
889
+ LogStatus (gpa_create_session_status, " ERROR: Failed to create GPA session" );
891
890
return false ;
892
891
}
893
892
@@ -914,6 +913,7 @@ bool AMDVulkanDemo::InitializeVulkan()
914
913
if (gpa_status != kGpaStatusOk )
915
914
{
916
915
AMDVulkanDemoVkUtils::Log (" Failed to enable counter: %s" , it->c_str ());
916
+ LogStatus (gpa_status);
917
917
}
918
918
success_enable_counter &= gpa_status == kGpaStatusOk ;
919
919
}
@@ -941,7 +941,7 @@ bool AMDVulkanDemo::InitializeVulkan()
941
941
942
942
if (gpa_enable_all_counters_status != kGpaStatusOk )
943
943
{
944
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to enable all GPA counters. " );
944
+ LogStatus (gpa_enable_all_counters_status, " ERROR: Failed to enable all GPA counters" );
945
945
return false ;
946
946
}
947
947
@@ -950,7 +950,7 @@ bool AMDVulkanDemo::InitializeVulkan()
950
950
GpaStatus gpa_get_pass_count_status = gpu_perf_api_helper_.gpa_function_table_ ->GpaGetPassCount (gpa_session_id_, &required_pass_count_);
951
951
if (gpa_get_pass_count_status != kGpaStatusOk )
952
952
{
953
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to get the number of required GPA passes. " );
953
+ LogStatus (gpa_get_pass_count_status, " ERROR: Failed to get the number of required GPA passes" );
954
954
return false ;
955
955
}
956
956
@@ -965,7 +965,7 @@ bool AMDVulkanDemo::InitializeVulkan()
965
965
966
966
if (gpa_begin_session_status != kGpaStatusOk )
967
967
{
968
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to begin GPA session. " );
968
+ LogStatus (gpa_begin_session_status, " ERROR: Failed to begin GPA session" );
969
969
return false ;
970
970
}
971
971
}
@@ -1654,7 +1654,7 @@ bool AMDVulkanDemo::InitializeVulkan()
1654
1654
1655
1655
if (gpa_end_session_status != kGpaStatusOk )
1656
1656
{
1657
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to end GPA session. " );
1657
+ LogStatus (gpa_end_session_status, " ERROR: Failed to end GPA session" );
1658
1658
}
1659
1659
}
1660
1660
@@ -1814,9 +1814,10 @@ void AMDVulkanDemo::DrawScene()
1814
1814
// This example only renders one set of profiles (aka, only the number of passes needed to generate one set of results).
1815
1815
unsigned int profile_set = 0 ;
1816
1816
1817
- gpu_perf_api_helper_.PrintGpaSampleResults (gpa_context_id_, gpa_session_id_, profile_set, AMDVulkanDemo::kGpaSampleIdCube , print_debug_output_, Verify (), ConfirmSuccess ());
1818
- gpu_perf_api_helper_.PrintGpaSampleResults (gpa_context_id_, gpa_session_id_, profile_set, AMDVulkanDemo::kGpaSampleIdWireframe , print_debug_output_, Verify (), ConfirmSuccess ());
1819
- gpu_perf_api_helper_.PrintGpaSampleResults (gpa_context_id_, gpa_session_id_, profile_set, AMDVulkanDemo::kGpaSampleIdCubeAndWireframe , print_debug_output_, Verify (), ConfirmSuccess ());
1817
+ // NOTE: we can't loop over these because it is not guaranteed that the sample_ids will be 0-based and monotonically increasing.
1818
+ gpu_perf_api_helper_.PrintGpaSampleResults (gpa_context_id_, gpa_session_id_, profile_set, 0 , print_debug_output_, Verify (), ConfirmSuccess ());
1819
+ gpu_perf_api_helper_.PrintGpaSampleResults (gpa_context_id_, gpa_session_id_, profile_set, 1 , print_debug_output_, Verify (), ConfirmSuccess ());
1820
+ gpu_perf_api_helper_.PrintGpaSampleResults (gpa_context_id_, gpa_session_id_, profile_set, 2 , print_debug_output_, Verify (), ConfirmSuccess ());
1820
1821
1821
1822
// Close the CSV file so that it actually gets saved out.
1822
1823
gpu_perf_api_helper_.CloseCSVFile ();
@@ -1842,7 +1843,7 @@ void AMDVulkanDemo::Destroy()
1842
1843
1843
1844
if (gpa_delete_session_status != kGpaStatusOk )
1844
1845
{
1845
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to delete GPA session. " );
1846
+ LogStatus (gpa_delete_session_status, " ERROR: Failed to delete GPA session" );
1846
1847
}
1847
1848
}
1848
1849
@@ -1852,7 +1853,7 @@ void AMDVulkanDemo::Destroy()
1852
1853
1853
1854
if (gpa_close_context_status != kGpaStatusOk )
1854
1855
{
1855
- AMDVulkanDemoVkUtils::Log ( " ERROR: Failed to close GPA Context. " );
1856
+ LogStatus (gpa_close_context_status, " ERROR: Failed to close GPA Context" );
1856
1857
}
1857
1858
}
1858
1859
}
@@ -2358,6 +2359,19 @@ void AMDVulkanDemo::PreBuildCommandBuffers(PrebuiltPerFrameResources* prebuilt_r
2358
2359
}
2359
2360
}
2360
2361
2362
+ void AMDVulkanDemo::LogStatus (GpaStatus status, const char * msg)
2363
+ {
2364
+ auto status_as_str = gpu_perf_api_helper_.gpa_function_table_ ->GpaGetStatusAsStr (status);
2365
+ if (msg != nullptr )
2366
+ {
2367
+ AMDVulkanDemoVkUtils::Log (" %s. %s" , msg, status_as_str);
2368
+ }
2369
+ else
2370
+ {
2371
+ AMDVulkanDemoVkUtils::Log (" %s" , status_as_str);
2372
+ }
2373
+ }
2374
+
2361
2375
#if defined(VK_USE_PLATFORM_WIN32_KHR)
2362
2376
2363
2377
// / Window message processing callback.
0 commit comments