Merge pull request #4423 from aws-lumberyard-dev/MakeUserAdapterNameMatchPartialNames

Allow user to specify a partial gpu name to the forceAdaptor commandline argument
monroegm-disable-blank-issue-2
Jeremy Ong 4 years ago committed by GitHub
commit 91925d0f65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,6 +18,7 @@
#include <AzFramework/CommandLine/CommandLine.h>
#include <Atom/RHI.Reflect/PlatformLimitsDescriptor.h>
#include <AzCore/Settings/SettingsRegistryImpl.h>
#include <AzCore/std/string/conversions.h>
AZ_DEFINE_BUDGET(RHI);
@ -101,6 +102,8 @@ namespace AZ
}
AZStd::string preferredUserAdapterName = RHI::GetCommandLineValue("forceAdapter");
AZStd::to_lower(preferredUserAdapterName.begin(), preferredUserAdapterName.end());
bool findPreferredUserDevice = preferredUserAdapterName.size() > 0;
RHI::PhysicalDevice* preferredUserDevice{};
RHI::PhysicalDevice* preferredVendorDevice{};
@ -110,12 +113,15 @@ namespace AZ
const RHI::PhysicalDeviceDescriptor& descriptor = physicalDevice->GetDescriptor();
AZ_Printf("RHISystem", "\tEnumerated physical device: %s\n", descriptor.m_description.c_str());
if (!preferredUserDevice && descriptor.m_description == preferredUserAdapterName)
if (findPreferredUserDevice)
{
AZStd::string descriptorLowerCase = descriptor.m_description;
AZStd::to_lower( descriptorLowerCase.begin(), descriptorLowerCase.end());
if (!preferredUserDevice && descriptorLowerCase.contains(preferredUserAdapterName))
{
preferredUserDevice = physicalDevice.get();
}
}
// Record the first nVidia or AMD device we find.
if (!preferredVendorDevice && (descriptor.m_vendorId == RHI::VendorId::AMD || descriptor.m_vendorId == RHI::VendorId::nVidia))
{

Loading…
Cancel
Save