MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / CreateMessageText

Method CreateMessageText

layers/error_message/logging.cpp:265–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265std::string DebugReport::CreateMessageText(const Location& loc, std::string_view vuid_text, const std::string& main_message,
266 bool at_message_limit) {
267 std::ostringstream oss;
268
269#if defined(BUILD_SELF_VVL)
270 oss << "[Self Validation] "; // How we know if the error is from Self Validation when debugging GPU-AV
271#endif
272
273 if (message_format_settings.display_application_name && !message_format_settings.application_name.empty()) {
274 oss << "[AppName: " << message_format_settings.application_name << "] ";
275 }
276
277 if (at_message_limit) {
278 oss << "(Warning - This VUID has now been reported " << duplicate_message_limit
279 << " times, which is the duplicate_message_limit value, this will be the last time reporting it).\n";
280 }
281
282 oss << loc.Message() << " " << main_message;
283
284 // Append the spec error text to the error message, unless it contains a word treated as special
285 if ((vuid_text.find("VUID-") != std::string::npos)) {
286 const char* spec_text = nullptr;
287 // Only the Antora site will make use of the sections
288 const char* spec_url_section = nullptr;
289 const auto found_vuid = GetVuidMap().find(vuid_text);
290 if (found_vuid != GetVuidMap().end()) {
291 spec_text = found_vuid->second.spec_text.data();
292 spec_url_section = found_vuid->second.url_id.data();
293 }
294
295 // Construct and append the specification text and link to the appropriate version of the spec
296 if (spec_text && spec_url_section) {
297#ifdef ANNOTATED_SPEC_LINK
298 const char* spec_url_base = ANNOTATED_SPEC_LINK;
299#else
300 const char* spec_url_base = "https://docs.vulkan.org/spec/latest/";
301#endif
302
303 const auto last_char = main_message.back();
304 // Add period at end if forgotten
305 // This provides better seperation between error message and spec text
306 // (Don't add if end with a number, otherwise it looks like a floating point number)
307 if (last_char != '.' && last_char != '\n' && (last_char < '0' || last_char > '9')) {
308 oss << '.';
309 }
310
311 // Start Vulkan spec text with a new line to make it easier visually
312 if (last_char != '\n') {
313 oss << '\n';
314 }
315
316 oss << "The Vulkan spec states: " << spec_text << " (" << spec_url_base << spec_url_section << "#" << vuid_text << ")";
317 }
318 }
319
320 return oss.str();
321}
322

Callers

nothing calls this directly

Calls 6

MessageMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected