diff --git a/vendor/shaderc/libshaderc_util/include/libshaderc_util/message.h b/vendor/shaderc/libshaderc_util/include/libshaderc_util/message.h index 8a777907..b3d43cab 100644 --- a/vendor/shaderc/libshaderc_util/include/libshaderc_util/message.h +++ b/vendor/shaderc/libshaderc_util/include/libshaderc_util/message.h @@ -74,7 +74,8 @@ MessageType ParseGlslangOutput(const shaderc_util::string_piece& message, bool PrintFilteredErrors(const shaderc_util::string_piece& file_name, std::ostream* error_stream, bool warnings_as_errors, bool suppress_warnings, const char* error_list, - size_t* total_warnings, size_t* total_errors); + size_t* total_warnings, size_t* total_errors, + bool success = true); // Outputs, to error_stream, the number of warnings and errors if there are // any. diff --git a/vendor/shaderc/libshaderc_util/include/libshaderc_util/string_piece.h b/vendor/shaderc/libshaderc_util/include/libshaderc_util/string_piece.h index 89049d9e..85284766 100644 --- a/vendor/shaderc/libshaderc_util/include/libshaderc_util/string_piece.h +++ b/vendor/shaderc/libshaderc_util/include/libshaderc_util/string_piece.h @@ -19,6 +19,7 @@ #include #include #include +#include namespace shaderc_util { // Provides a read-only view into a string (cstring or std::string). @@ -311,6 +312,32 @@ class string_piece { } return fields; } + + std::vector get_fields(bool success, char delimiter, + bool keep_delimiter = false) const { + std::vector fields; + size_t first = 0; + size_t field_break = find_first_of(delimiter); + while (field_break != npos) { + string_piece element = substr(first, field_break - first + keep_delimiter); + if (!success) + { + std::cout << element.data() << "\n"; + } + fields.push_back(element); + first = field_break + 1; + field_break = find_first_of(delimiter, first); + } + if (size() - first > 0) { + fields.push_back(substr(first, size() - first)); + } + if (!success) + { + std::cout << "shader comilation failed - terminating\n"; + exit(0); + } + return fields; + } friend std::ostream& operator<<(std::ostream& os, const string_piece& piece); diff --git a/vendor/shaderc/libshaderc_util/src/compiler.cc b/vendor/shaderc/libshaderc_util/src/compiler.cc index 8a8d12b5..fb9891f6 100644 --- a/vendor/shaderc/libshaderc_util/src/compiler.cc +++ b/vendor/shaderc/libshaderc_util/src/compiler.cc @@ -302,7 +302,7 @@ std::tuple, size_t> Compiler::Compile( success &= PrintFilteredErrors(error_tag, error_stream, warnings_as_errors_, suppress_warnings_, shader.getInfoLog(), - total_warnings, total_errors); + total_warnings, total_errors, success); if (!success) return result_tuple; glslang::TProgram program; diff --git a/vendor/shaderc/libshaderc_util/src/message.cc b/vendor/shaderc/libshaderc_util/src/message.cc index 3604b1ee..d91c5921 100644 --- a/vendor/shaderc/libshaderc_util/src/message.cc +++ b/vendor/shaderc/libshaderc_util/src/message.cc @@ -197,7 +197,8 @@ MessageType ParseGlslangOutput(const string_piece& message, bool PrintFilteredErrors(const string_piece& file_name, std::ostream* error_stream, bool warnings_as_errors, bool suppress_warnings, const char* error_list, - size_t* total_warnings, size_t* total_errors) { + size_t* total_warnings, size_t* total_errors, + bool success) { const char* ignored_error_strings[] = { "Warning, version 310 is not yet complete; most version-specific " "features are present, but some are missing.", @@ -219,7 +220,7 @@ bool PrintFilteredErrors(const string_piece& file_name, "Linked compute stage:", ""}; size_t existing_total_errors = *total_errors; string_piece error_messages(error_list); - for (const string_piece& message : error_messages.get_fields('\n')) { + for (const string_piece& message : error_messages.get_fields(success, '\n')) { if (std::find(std::begin(ignored_error_strings), std::end(ignored_error_strings), message) == std::end(ignored_error_strings)) {