6#include "Misc/AssertionMacros.h"
7#include "Containers/Array.h"
8#include "Math/UnrealMathUtility.h"
9#include "Containers/UnrealString.h"
10#include "Misc/DateTime.h"
11#include "Misc/Parse.h"
12#include "Misc/ConfigCacheIni.h"
115 return !(*
this >
rhs) && !(
rhs > *
this);
127 return !(*
this ==
rhs);
133 return (*
this ==
rhs) || (*
this >
rhs);
139 return (*
this ==
rhs) || (*
this <
rhs);
142 static constexpr uint32
Size = TSize;
171 if(In[0] ==
'=' && In[1] ==
'=')
176 if(In[0] ==
'!' && In[1] ==
'=')
210 case ECO_Equal:
return A == B;
211 case ECO_NotEqual:
return A != B;
212 case ECO_Larger:
return A > B;
213 case ECO_LargerThan:
return A >= B;
214 case ECO_Smaller:
return A < B;
215 case ECO_SmallerThan:
return A <= B;
224inline bool CompareStringOp(
const TCHAR* InOpWithMultiInt,
const TCHAR* CurrentMultiInt)
226 const TCHAR* p = InOpWithMultiInt;
238 A.GetValue(CurrentMultiInt);
241 return Compare(A, Op, B);
274 return !DeviceDescription.IsEmpty()
276 && (InternalDriverVersion !=
TEXT(
"Unknown"))
277 && (InternalDriverVersion !=
TEXT(
""));
297 const TCHAR* p = InOpWithMultiInt;
304 A.GetValue(*DriverVersion);
309 if (!((A.Value[4] >= 100) ^ (B.Value[4] >= 100)))
336 RightPart
= RightPart.Replace(
TEXT(
"."),
TEXT(
""));
344 const FString& FullVersion = InternalDriverVersion;
346 if(IsNVIDIA() && (InternalDriverVersion != UserDriverVersion))
389 FParse::Value(In,
TEXT(
"DriverVersion="), DriverVersionString);
390 FParse::Value(In,
TEXT(
"DriverDate="), DriverDateString);
391 ensure(!DriverVersionString.IsEmpty() || !DriverDateString.IsEmpty());
393 FParse::Value(In,
TEXT(
"RHI="), RHIName);
401 FParse::Value(In,
TEXT(
"Reason="), Reason);
402 ensure(!Reason.IsEmpty());
412 if (!RHIName.IsEmpty() && RHIName != Info.RHIName)
417 if (!DriverVersionString.IsEmpty())
419 if (Info.IsSameDriverVersionGeneration(*DriverVersionString))
421 return CompareStringOp(*DriverVersionString, *Info.GetUnifiedDriverVersion());
430 FString TempDay, TempMonth, TempMonthDay, TempYear;
433 int32 OpLength = FChar::IsDigit((*DriverDateString)[1]) ? 1 : 2;
435 const TCHAR* DriverDateStringChars = *DriverDateString;
442 FString DriverDateComparisonOp = DriverDateString.Left(OpLength);
443 FString TrimmedDriverDateString = DriverDateString.RightChop(OpLength);
447 FDateTime TestDate(FCString::Atoi(*TempYear), FCString::Atoi(*TempMonth), FCString::Atoi(*TempDay));
452 FDateTime InfoDate(FCString::Atoi(*TempYear), FCString::Atoi(*TempMonth), FCString::Atoi(*TempDay));
454 return Compare(InfoDate, Op, TestDate);
463 return DriverVersionString.Len() > 1 || DriverDateString.Len() > 1;
467
468
469
472 bool bLatestDenied =
false;
475 const TCHAR* DriverVersionTchar = !DriverVersionString.IsEmpty() ? *DriverVersionString : *DriverDateString;
479 return bLatestDenied;
496 check(A.Value[0] == 0 && A.Value[1] == 0 && A.Size == 2);
497 A.GetValue(TEXT(
"18.98"));
498 check(A.Value[0] == 18 && A.Value[1] == 98);
499 A.GetValue(TEXT(
""));
500 check(A.Value[0] == 0 && A.Value[1] == 0);
501 A.GetValue(TEXT(
"98"));
502 check(A.Value[0] == 0 && A.Value[1] == 98);
503 A.GetValue(TEXT(
"98.34.56"));
504 check(A.Value[0] == 98 && A.Value[1] == 34);
505 A.GetValue(TEXT(
" 98 . 034 "));
506 check(A.Value[0] == 98 && A.Value[1] == 34);
507 A.GetValue(TEXT(
"\t 98\t.\t34\t"));
508 check(A.Value[0] == 98 && A.Value[1] == 34);
510 check(FMultiInt<2>(TEXT(
"3.07")) == FMultiInt<2>(TEXT(
"3.07")));
511 check(FMultiInt<2>(TEXT(
"3.05")) < FMultiInt<2>(TEXT(
"3.07")));
512 check(FMultiInt<2>(TEXT(
"3.05")) <= FMultiInt<2>(TEXT(
"3.07")));
513 check(FMultiInt<2>(TEXT(
"3.07")) <= FMultiInt<2>(TEXT(
"3.07")));
514 check(FMultiInt<2>(TEXT(
"3.08")) > FMultiInt<2>(TEXT(
"3.07")));
515 check(FMultiInt<2>(TEXT(
"3.08")) >= FMultiInt<2>(TEXT(
"3.07")));
516 check(FMultiInt<2>(TEXT(
"3.07")) >= FMultiInt<2>(TEXT(
"3.07")));
517 check(FMultiInt<2>(TEXT(
"3.05")) != FMultiInt<2>(TEXT(
"3.07")));
518 check(FMultiInt<2>(TEXT(
"4.05")) > FMultiInt<2>(TEXT(
"3.07")));
519 check(FMultiInt<2>(TEXT(
"4.05")) >= FMultiInt<2>(TEXT(
"3.07")));
520 check(FMultiInt<2>(TEXT(
"2.05")) < FMultiInt<2>(TEXT(
"3.07")));
521 check(FMultiInt<2>(TEXT(
"2.05")) <= FMultiInt<2>(TEXT(
"3.07")));
523 check(Compare(10, ECO_Equal, 10));
524 check(Compare(10, ECO_NotEqual, 20));
525 check(Compare(20, ECO_Larger, 10));
526 check(Compare(20, ECO_LargerThan, 10));
527 check(Compare(10, ECO_LargerThan, 10));
528 check(Compare(10, ECO_Smaller, 20));
529 check(Compare(10, ECO_SmallerThan, 10));
531 check(CompareStringOp(TEXT(
"<20.10"), TEXT(
"19.12")));
532 check(CompareStringOp(TEXT(
"<=20.10"), TEXT(
"19.12")));
533 check(CompareStringOp(TEXT(
"<=19.12"), TEXT(
"19.12")));
534 check(CompareStringOp(TEXT(
"==19.12"), TEXT(
"19.12")));
535 check(CompareStringOp(TEXT(
">=19.12"), TEXT(
"19.12")));
536 check(CompareStringOp(TEXT(
">=10.12"), TEXT(
"19.12")));
537 check(CompareStringOp(TEXT(
"!=20.12"), TEXT(
"19.12")));
538 check(CompareStringOp(TEXT(
">10.12"), TEXT(
"19.12")));
541 FGPUDriverInfo Version;
543 check(Version.IsNVIDIA());
544 check(!Version.IsAMD());
545 check(!Version.IsIntel());
546 Version.InternalDriverVersion = TEXT(
"10.18.13.4788");
547 check(Version.GetUnifiedDriverVersion() == TEXT(
"347.88"));
550 FGPUDriverInfo Version;
552 check(Version.IsAMD());
553 check(!Version.IsNVIDIA());
554 check(!Version.IsIntel());
555 Version.InternalDriverVersion = TEXT(
"15.200.1062.1004");
556 check(Version.GetUnifiedDriverVersion() == TEXT(
"15.200.1062.1004"));
559 FGPUDriverInfo Version;
561 check(Version.IsIntel());
562 check(!Version.IsAMD());
563 check(!Version.IsNVIDIA());
564 Version.DeviceDescription = TEXT(
"Intel(R) HD Graphics 4600");
565 Version.InternalDriverVersion = TEXT(
"9.18.10.3310");
566 Version.DriverDate = TEXT(
"9-17-2013");
567 check(Version.GetUnifiedDriverVersion() == TEXT(
"10.3310"));
582 TArray<FString> SuggestedDriverVersions;
583 GConfig->GetArray(*Section,
TEXT(
"SuggestedDriverVersion"), SuggestedDriverVersions, GHardwareIni);
588 for (
const FString& SuggestedVersion : SuggestedDriverVersions)
590 int32 Found = SuggestedVersion.Find(InRHIName);
591 if (Found != INDEX_NONE && Found > 0 && SuggestedVersion[Found - 1] ==
';')
593 Ret = SuggestedVersion.Left(Found - 1);
600 for (
const FString& SuggestedVersion : SuggestedDriverVersions)
603 if (!SuggestedVersion.FindChar(
TEXT(
';'), Found))
605 return SuggestedVersion;
620 TArray<FString> DenyListStrings;
621 GConfig->GetArray(*Section,
TEXT(
"DriverDenyList"), DenyListStrings, GHardwareIni);
623 for(int32 i = 0; i < DenyListStrings.Num(); ++i)
625 FDriverDenyListEntry Entry;
627 const TCHAR* Line = *DenyListStrings[i];
629 ensure(Line[0] == TCHAR(
'('));
631 Entry.LoadFromINIString(&Line[1]);
633 if(Entry.Test(DriverInfo))
644
645
648 bool bLatestDenied =
false;
653 TArray<FString> DenyListStrings;
654 GConfig->GetArray(*Section,
TEXT(
"DriverDenyList"), DenyListStrings, GHardwareIni);
656 for(int32 i = 0; !bLatestDenied && i < DenyListStrings.Num(); ++i)
658 FDriverDenyListEntry Entry;
660 const TCHAR* Line = *DenyListStrings[i];
662 ensure(Line[0] == TCHAR(
'('));
664 Entry.LoadFromINIString(&Line[1]);
666 bLatestDenied |= Entry.IsLatestDenied();
669 return bLatestDenied;
676 const TCHAR* Section =
nullptr;
678 if(DriverInfo.IsNVIDIA())
680 Section =
TEXT(
"GPU_NVIDIA");
682 if(DriverInfo.IsAMD())
684 Section =
TEXT(
"GPU_AMD");
686 else if(DriverInfo.IsIntel())
688 Section =
TEXT(
"GPU_Intel");
696 return FString::Printf(
TEXT(
"%s %s"), Section,
ANSI_TO_TCHAR(FPlatformProperties::IniPlatformName()));
#define ensure( InExpression)
#define UE_BUILD_SHIPPING
#define ANSI_TO_TCHAR(str)
bool operator<(const FMultiInt< TSize > &rhs) const
bool IsSeparator(const TCHAR c)
FMultiInt(const TCHAR *In)
bool operator!=(const FMultiInt< TSize > &rhs) const
void Parse(const TCHAR *&In)
bool operator>(const FMultiInt< TSize > &rhs) const
bool operator>=(const FMultiInt< TSize > &rhs) const
static constexpr uint32 Size
void GetValue(const TCHAR *In)
bool operator<=(const FMultiInt< TSize > &rhs) const
bool operator==(const FMultiInt< TSize > &rhs) const
UE_NODISCARD FORCEINLINE FString Right(int32 Count) const &
UE_NODISCARD FString RightChop(int32 Count) const &
FString & operator=(FString &&)=default
UE_NODISCARD FORCEINLINE int32 Len() const
bool Split(const FString &InS, FString *LeftS, FString *RightS, ESearchCase::Type SearchCase, ESearchDir::Type SearchDir=ESearchDir::FromStart) const
UE_NODISCARD FORCEINLINE bool IsEmpty() const
UE_NODISCARD int32 Find(const FString &SubStr, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase, ESearchDir::Type SearchDir=ESearchDir::FromStart, int32 StartPosition=INDEX_NONE) const
void InsertAt(int32 Index, const FString &Characters)
bool Test(const FGPUDriverInfo &Info) const
bool IsLatestDenied() const
void LoadFromINIString(const TCHAR *In)
FString DriverVersionString
FString GetUnifiedDriverVersion() const
FString DeviceDescription
FString InternalDriverVersion
static FString TrimNVIDIAInternalVersion(const FString &InternalVersion)
bool IsSameDriverVersionGeneration(const TCHAR *InOpWithMultiInt) const
FString UserDriverVersion
FString GetVendorSectionName() const
FDriverDenyListEntry FindDriverDenyListEntry() const
FGPUHardware(const FGPUDriverInfo InDriverInfo)
const FGPUDriverInfo DriverInfo
bool IsLatestDenied() const
FString GetSuggestedDriverVersion(const FString &InRHIName) const