Skip to content

Commit 13ab892

Browse files
GPU Testing Environment: replaced vk_compatibility with vulkan features parsing
1 parent a30f1b3 commit 13ab892

File tree

1 file changed

+47
-44
lines changed

1 file changed

+47
-44
lines changed

Tests/GPUTestFramework/src/GPUTestingEnvironment.cpp

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,20 @@ GPUTestingEnvironment::GPUTestingEnvironment(const CreateInfo& EnvCI, const Swap
210210

211211
{
212212
bool FeaturesPrinted = false;
213-
DeviceFeatures::Enumerate(EnvCI.Features,
214-
[&FeaturesPrinted](const char* FeatName, DEVICE_FEATURE_STATE State) //
215-
{
216-
if (State != DEVICE_FEATURE_STATE_OPTIONAL)
217-
{
218-
std::cout << "Features." << FeatName << " = " << (State == DEVICE_FEATURE_STATE_ENABLED ? "On" : "Off") << '\n';
219-
FeaturesPrinted = true;
220-
}
221-
return true;
222-
});
213+
auto PrintFeature = [&FeaturesPrinted](const char* FeatName, DEVICE_FEATURE_STATE State) //
214+
{
215+
if (State != DEVICE_FEATURE_STATE_OPTIONAL)
216+
{
217+
std::cout << "Features." << FeatName << " = " << (State == DEVICE_FEATURE_STATE_ENABLED ? "On" : "Off") << '\n';
218+
FeaturesPrinted = true;
219+
}
220+
return true;
221+
};
222+
DeviceFeatures::Enumerate(EnvCI.Features, PrintFeature);
223+
if (m_DeviceType == RENDER_DEVICE_TYPE_VULKAN)
224+
{
225+
DeviceFeaturesVk::Enumerate(EnvCI.FeaturesVk, PrintFeature);
226+
}
223227
if (FeaturesPrinted)
224228
std::cout << '\n';
225229
}
@@ -859,42 +863,45 @@ SHADER_COMPILER GPUTestingEnvironment::GetDefaultCompiler(SHADER_SOURCE_LANGUAGE
859863
return m_ShaderCompiler;
860864
}
861865

862-
static bool ParseFeatureState(const char* Arg, DeviceFeatures& Features)
866+
static bool ParseFeatureState(const char* Arg, DeviceFeatures& Features, DeviceFeaturesVk& FeaturesVk)
863867
{
864868
static const std::string ArgStart = "--Features.";
865869
if (ArgStart.compare(0, ArgStart.length(), Arg, ArgStart.length()) != 0)
866870
return false;
867871

868872
Arg += ArgStart.length();
869-
DeviceFeatures::Enumerate(Features,
870-
[Arg](const char* FeatName, DEVICE_FEATURE_STATE& State) //
871-
{
872-
const size_t NameLen = strlen(FeatName);
873-
if (strncmp(FeatName, Arg, NameLen) != 0)
874-
return true;
875-
876-
if (Arg[NameLen] != '=')
877-
return true; // Continue processing
878-
879-
const char* Value = Arg + NameLen + 1;
880-
881-
static const std::string Off = "Off";
882-
static const std::string On = "On";
883-
static const std::string Disabled = "Disabled";
884-
static const std::string Enabled = "Enabled";
885-
886-
if (StrCmpNoCase(Value, On.c_str()) == 0 || StrCmpNoCase(Value, Enabled.c_str()) == 0)
887-
State = DEVICE_FEATURE_STATE_ENABLED;
888-
else if (StrCmpNoCase(Value, Off.c_str()) == 0 || StrCmpNoCase(Value, Disabled.c_str()) == 0)
889-
State = DEVICE_FEATURE_STATE_DISABLED;
890-
else
891-
{
892-
LOG_ERROR_MESSAGE('\'', Value, "' is not a valid value for feature '", FeatName, "'. The following values are allowed: '",
893-
Off, "', '", Disabled, "', '", On, "', '", Enabled, "'.");
894-
}
895873

896-
return false;
897-
});
874+
auto ParseFeature = [Arg](const char* FeatName, DEVICE_FEATURE_STATE& State) //
875+
{
876+
const size_t NameLen = strlen(FeatName);
877+
if (strncmp(FeatName, Arg, NameLen) != 0)
878+
return true;
879+
880+
if (Arg[NameLen] != '=')
881+
return true; // Continue processing
882+
883+
const char* Value = Arg + NameLen + 1;
884+
885+
static const std::string Off = "Off";
886+
static const std::string On = "On";
887+
static const std::string Disabled = "Disabled";
888+
static const std::string Enabled = "Enabled";
889+
890+
if (StrCmpNoCase(Value, On.c_str()) == 0 || StrCmpNoCase(Value, Enabled.c_str()) == 0)
891+
State = DEVICE_FEATURE_STATE_ENABLED;
892+
else if (StrCmpNoCase(Value, Off.c_str()) == 0 || StrCmpNoCase(Value, Disabled.c_str()) == 0)
893+
State = DEVICE_FEATURE_STATE_DISABLED;
894+
else
895+
{
896+
LOG_ERROR_MESSAGE('\'', Value, "' is not a valid value for feature '", FeatName, "'. The following values are allowed: '",
897+
Off, "', '", Disabled, "', '", On, "', '", Enabled, "'.");
898+
}
899+
900+
return false;
901+
};
902+
903+
DeviceFeatures::Enumerate(Features, ParseFeature);
904+
DeviceFeaturesVk::Enumerate(FeaturesVk, ParseFeature);
898905

899906
return false;
900907
}
@@ -972,11 +979,7 @@ GPUTestingEnvironment* GPUTestingEnvironment::Initialize(int argc, char** argv)
972979
{
973980
TestEnvCI.EnableDeviceSimulation = true;
974981
}
975-
else if (strcmp(arg, "--vk_compatibility") == 0)
976-
{
977-
TestEnvCI.FeaturesVk = DeviceFeaturesVk{DEVICE_FEATURE_STATE_DISABLED};
978-
}
979-
else if (ParseFeatureState(arg, TestEnvCI.Features))
982+
else if (ParseFeatureState(arg, TestEnvCI.Features, TestEnvCI.FeaturesVk))
980983
{
981984
// Feature state has been updated by ParseFeatureState
982985
}

0 commit comments

Comments
 (0)