src/gl/debug.cpp

changeset 291
42b4953dff85
parent 290
0fd926ebb03b
child 292
f071ec94c022
--- a/src/gl/debug.cpp	Tue Jun 28 17:35:56 2022 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-#include "src/gl/debug.h"
-
-QString sourceToString(const QOpenGLDebugMessage::Source source)
-{
-	switch (source) {
-	case QOpenGLDebugMessage::InvalidSource:
-		return QObject::tr("invalid");
-	case QOpenGLDebugMessage::APISource:
-		return QObject::tr("API");
-	case QOpenGLDebugMessage::WindowSystemSource:
-		return QObject::tr("window system");
-	case QOpenGLDebugMessage::ShaderCompilerSource:
-		return QObject::tr("shader compiler");
-	case QOpenGLDebugMessage::ThirdPartySource:
-		return QObject::tr("third party");
-	case QOpenGLDebugMessage::ApplicationSource:
-		return QObject::tr("application");
-	case QOpenGLDebugMessage::OtherSource:
-		return QObject::tr("other");
-	case QOpenGLDebugMessage::AnySource:
-		return QObject::tr("any");
-	}
-	return "";
-}
-
-QString typeToString(const QOpenGLDebugMessage::Type type)
-{
-	switch (type) {
-	case QOpenGLDebugMessage::ErrorType:
-		return QObject::tr("error");
-	case QOpenGLDebugMessage::DeprecatedBehaviorType:
-		return QObject::tr("deprecated behavior");
-	case QOpenGLDebugMessage::UndefinedBehaviorType:
-		return QObject::tr("undefined behavior");
-	case QOpenGLDebugMessage::PortabilityType:
-		return QObject::tr("portability");
-	case QOpenGLDebugMessage::PerformanceType:
-		return QObject::tr("performance");
-	case QOpenGLDebugMessage::MarkerType:
-		return QObject::tr("marker");
-	case QOpenGLDebugMessage::GroupPushType:
-		return QObject::tr("push group");
-	case QOpenGLDebugMessage::GroupPopType:
-		return QObject::tr("pop group");
-	case QOpenGLDebugMessage::OtherType:
-		return QObject::tr("other");
-	case QOpenGLDebugMessage::InvalidType:
-		return QObject::tr("invalid");
-	case QOpenGLDebugMessage::AnyType:
-		return QObject::tr("any");
-	}
-	return "";
-}
-
-QString severityToString(const QOpenGLDebugMessage::Severity severity)
-{
-	switch (severity) {
-	case QOpenGLDebugMessage::HighSeverity:
-		return QObject::tr("high");
-	case QOpenGLDebugMessage::MediumSeverity:
-		return QObject::tr("medium");
-	case QOpenGLDebugMessage::LowSeverity:
-		return QObject::tr("low");
-	case QOpenGLDebugMessage::NotificationSeverity:
-		return QObject::tr("notification");
-	case QOpenGLDebugMessage::InvalidSeverity:
-		return QObject::tr("invalid");
-	case QOpenGLDebugMessage::AnySeverity:
-		return QObject::tr("any");
-	}
-	return "";
-}
-
-constexpr Message::Type severityToMessageType(const QOpenGLDebugMessage::Severity severity)
-{
-	switch (severity) {
-	case QOpenGLDebugMessage::HighSeverity:
-		return Message::Error;
-	case QOpenGLDebugMessage::MediumSeverity:
-		return Message::Warning;
-	default:
-		return Message::Info;
-	}
-}
-
-Message debugMessageToString(const QOpenGLDebugMessage& glmessage)
-{
-	QString text;
-	QTextStream stream{&text};
-	stream << QObject::tr("OpenGL debug message [%1]").arg(glmessage.id()) << "\n";
-	stream << QObject::tr("Source: %1, ").arg(sourceToString(glmessage.source()));
-	stream << QObject::tr("type: %1, ").arg(typeToString(glmessage.type()));
-	stream << QObject::tr("severity: %1\n").arg(severityToString(glmessage.severity()));
-	stream << glmessage.message();
-	return Message{
-		.time = QDateTime::currentDateTime(),
-		.type = severityToMessageType(glmessage.severity()),
-		.text = text,
-	};
-}

mercurial