Utils.cpp 917 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <RHI.Profiler/Utils.h>
  9. #include <AzFramework/API/ApplicationAPI.h>
  10. #include <AzFramework/CommandLine/CommandLine.h>
  11. #include <AzFramework/StringFunc/StringFunc.h>
  12. namespace AZ::RHI
  13. {
  14. bool ShouldLoadProfiler(const AZStd::string_view name)
  15. {
  16. const char* profilerOption = "rhi-gpu-profiler";
  17. const AzFramework::CommandLine* commandLine = nullptr;
  18. AzFramework::ApplicationRequests::Bus::BroadcastResult(commandLine, &AzFramework::ApplicationRequests::GetApplicationCommandLine);
  19. if (commandLine)
  20. {
  21. return AzFramework::StringFunc::Equal(commandLine->GetSwitchValue(profilerOption), name);
  22. }
  23. return false;
  24. }
  25. }