// Map option strings to flag enum values VkFlags GetLayerOptionFlags(std::string _option, std::unordered_map<std::string, VkFlags> const &enum_data, uint32_t option_default) { VkDebugReportFlagsEXT flags = option_default; std::string option_list = g_configFileObj.getOption(_option.c_str()); while (option_list.length() != 0) { // Find length of option string std::size_t option_length = option_list.find(","); if (option_length == option_list.npos) { option_length = option_list.size(); } // Get first option in list const std::string option = option_list.substr(0, option_length); auto enum_value = enum_data.find(option); if (enum_value != enum_data.end()) { flags |= enum_value->second; } // Remove first option from option_list option_list.erase(0, option_length); // Remove possible comma separator std::size_t char_position = option_list.find(","); if (char_position == 0) { option_list.erase(char_position, 1); } // Remove possible space char_position = option_list.find(" "); if (char_position == 0) { option_list.erase(char_position, 1); } } return flags; }
bool getLayerOptionEnum(const char *_option, uint32_t *optionDefault) { bool res; const char *option = (g_configFileObj.getOption(_option)); if (option != NULL) { *optionDefault = convertStringEnumVal(option); res = false; } else { res = true; } return res; }
VkDebugReportFlagsEXT getLayerOptionFlags(const char *_option, uint32_t optionDefault) { VkDebugReportFlagsEXT flags = optionDefault; const char *option = (g_configFileObj.getOption(_option)); /* parse comma-separated options */ while (option) { const char *p = strchr(option, ','); size_t len; if (p) len = p - option; else len = strlen(option); if (len > 0) { if (strncmp(option, "warn", len) == 0) { flags |= VK_DEBUG_REPORT_WARNING_BIT_EXT; } else if (strncmp(option, "info", len) == 0) { flags |= VK_DEBUG_REPORT_INFORMATION_BIT_EXT; } else if (strncmp(option, "perf", len) == 0) { flags |= VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT; } else if (strncmp(option, "error", len) == 0) { flags |= VK_DEBUG_REPORT_ERROR_BIT_EXT; } else if (strncmp(option, "debug", len) == 0) { flags |= VK_DEBUG_REPORT_DEBUG_BIT_EXT; } } if (!p) break; option = p + 1; } return flags; }
const char *getLayerOption(const char *_option) { return g_configFileObj.getOption(_option); }