Skip to content

Commit

Permalink
profiles: Fix generated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ziga-lunarg committed Sep 30, 2024
1 parent baf06ff commit ab56156
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
39 changes: 22 additions & 17 deletions scripts/gen_profiles_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,6 @@ class JsonLoader {
}
int GetArray(const char* device_name, const Json::Value &parent, const std::string &member, const char *name, uint8_t *dest, bool not_modifiable) {
(void)not_modifiable;
(void)device_name;
if (member != name) {
Expand All @@ -934,14 +933,15 @@ class JsonLoader {
return -1;
}
const int count = static_cast<int>(value.size());
for (int i = 0; i < count; ++i) {
dest[i] = static_cast<uint8_t>(value[i].asUInt());
if (!not_modifiable) {
for (int i = 0; i < count; ++i) {
dest[i] = static_cast<uint8_t>(value[i].asUInt());
}
}
return count;
}
int GetArray(const char* device_name, const Json::Value &parent, const std::string &member, const char *name, uint32_t *dest, bool not_modifiable) {
(void)not_modifiable;
(void)device_name;
if (member != name) {
Expand All @@ -953,14 +953,15 @@ class JsonLoader {
return -1;
}
const int count = static_cast<int>(value.size());
for (int i = 0; i < count; ++i) {
dest[i] = static_cast<uint32_t>(value[i].asUInt());
if (!not_modifiable) {
for (int i = 0; i < count; ++i) {
dest[i] = static_cast<uint32_t>(value[i].asUInt());
}
}
return count;
}
int GetArray(const char* device_name, const Json::Value &parent, const std::string &member, const char *name, float *dest, bool not_modifiable) {
(void)not_modifiable;
(void)device_name;
if (member != name) {
Expand All @@ -972,14 +973,15 @@ class JsonLoader {
return -1;
}
const int count = static_cast<int>(value.size());
for (int i = 0; i < count; ++i) {
dest[i] = value[i].asFloat();
if (!not_modifiable) {
for (int i = 0; i < count; ++i) {
dest[i] = value[i].asFloat();
}
}
return count;
}
int GetArray(const char* device_name, const Json::Value &parent, const std::string &member, const char *name, char *dest, bool not_modifiable) {
(void)not_modifiable;
(void)device_name;
if (member != name) {
Expand All @@ -992,16 +994,17 @@ class JsonLoader {
}
const char *new_value = value.asCString();
int count = 0;
dest[0] = '\\0';
if (new_value) {
count = static_cast<int>(strlen(new_value));
strcpy(dest, new_value);
if (!not_modifiable) {
dest[0] = '\\0';
if (new_value) {
count = static_cast<int>(strlen(new_value));
strcpy(dest, new_value);
}
}
return count;
}
int GetArray(const char* device_name, const Json::Value &parent, const std::string &member, const char *name, VkImageLayout *dest, bool not_modifiable) {
(void)not_modifiable;
(void)device_name;
if (member != name) {
Expand All @@ -1013,8 +1016,10 @@ class JsonLoader {
return -1;
}
const int count = static_cast<int>(value.size());
for (int i = 0; i < count; ++i) {
dest[i] = StringToImageLayout(value[i].asCString());
if (!not_modifiable) {
for (int i = 0; i < count; ++i) {
dest[i] = StringToImageLayout(value[i].asCString());
}
}
return count;
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/gen_profiles_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def gen_properties_test(self, registry, name, value):
for ext in value.definedByExtensions:
gen += '#ifdef ' + registry.extensions[ext].name + '\n'

gen += ' bool supported = false;\n'
gen += ' bool supported = true;\n'
for ext in value.definedByExtensions:
gen += ' supported = supported && IsSupported(gpu_profile, "' + registry.extensions[ext].name + '");\n\n'

Expand Down Expand Up @@ -655,7 +655,7 @@ def gen_properties_test(self, registry, name, value):
if 'VkConformanceVersion' in member_type:
continue

gen += ' if (supported) {\n'
gen += ' if (!supported) {\n'
if type(property_value) is list:
if (len(property_value) > 1):
for i in range(len(property_value)):
Expand Down

0 comments on commit ab56156

Please sign in to comment.