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