mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-09 20:10:06 +00:00
Use our own SPIRV-Tools message stringifier
Stop including an internal SPIRV-Tools header. It has been deleted. Fixes #1477
This commit is contained in:
parent
93dbbdee36
commit
9fd2a8cdfc
@ -56,7 +56,6 @@ namespace spv {
|
||||
|
||||
#if ENABLE_OPT
|
||||
#include "spirv-tools/optimizer.hpp"
|
||||
#include "message.h"
|
||||
#endif
|
||||
|
||||
#if ENABLE_OPT
|
||||
@ -7032,12 +7031,36 @@ void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsign
|
||||
spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2;
|
||||
|
||||
spvtools::Optimizer optimizer(target_env);
|
||||
optimizer.SetMessageConsumer([](spv_message_level_t level,
|
||||
const char* source,
|
||||
const spv_position_t& position,
|
||||
const char* message) {
|
||||
std::cerr << StringifyMessage(level, source, position, message)
|
||||
<< std::endl;
|
||||
optimizer.SetMessageConsumer(
|
||||
[](spv_message_level_t level, const char *source, const spv_position_t &position, const char *message) {
|
||||
auto &out = std::cerr;
|
||||
switch (level)
|
||||
{
|
||||
case SPV_MSG_FATAL:
|
||||
case SPV_MSG_INTERNAL_ERROR:
|
||||
case SPV_MSG_ERROR:
|
||||
out << "error: ";
|
||||
break;
|
||||
case SPV_MSG_WARNING:
|
||||
out << "warning: ";
|
||||
break;
|
||||
case SPV_MSG_INFO:
|
||||
case SPV_MSG_DEBUG:
|
||||
out << "info: ";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (source)
|
||||
{
|
||||
out << source << ":";
|
||||
}
|
||||
out << position.line << ":" << position.column << ":" << position.index << ":";
|
||||
if (message)
|
||||
{
|
||||
out << " " << message;
|
||||
}
|
||||
out << std::endl;
|
||||
});
|
||||
|
||||
optimizer.RegisterPass(CreateMergeReturnPass());
|
||||
|
Loading…
Reference in New Issue
Block a user