MCPcopy Create free account
hub / github.com/microsoft/SandDance / parseGLSLCompilerError

Function parseGLSLCompilerError

docs/app/js/sanddance-app.js:64357–64379  ·  view source on GitHub ↗
(errLog, src, shaderType, shaderName)

Source from the content-addressed store, hash-verified

64355}
64356exports.default = formatGLSLCompilerError;
64357function parseGLSLCompilerError(errLog, src, shaderType, shaderName) {
64358 var errorStrings = errLog.split(/\r?\n/);
64359 var errors = {};
64360 var warnings = {};
64361 var name = shaderName || (0, _getShaderNameDefault.default)(src) || "(unnamed)";
64362 var shaderDescription = "".concat((0, _getShaderTypeNameDefault.default)(shaderType), " shader ").concat(name);
64363 for(var i = 0; i < errorStrings.length; i++){
64364 var errorString = errorStrings[i];
64365 if (errorString.length <= 1) continue;
64366 var segments = errorString.split(":");
64367 var type = segments[0];
64368 var line = parseInt(segments[2], 10);
64369 if (isNaN(line)) throw new Error("GLSL compilation error in ".concat(shaderDescription, ": ").concat(errLog));
64370 if (type !== "WARNING") errors[line] = errorString;
64371 else warnings[line] = errorString;
64372 }
64373 var lines = addLineNumbers(src);
64374 return {
64375 shaderName: shaderDescription,
64376 errors: formatErrors(errors, lines),
64377 warnings: formatErrors(warnings, lines)
64378 };
64379}
64380function formatErrors(errors, lines) {
64381 var message = "";
64382 for(var i = 0; i < lines.length; i++){

Callers 1

formatGLSLCompilerErrorFunction · 0.70

Calls 2

addLineNumbersFunction · 0.70
formatErrorsFunction · 0.70

Tested by

no test coverage detected