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

Function parseGLSLCompilerError

docs/tests/v3/es6/js/sanddance-test-es6.js:12288–12310  ·  view source on GitHub ↗
(errLog, src, shaderType, shaderName)

Source from the content-addressed store, hash-verified

12286}
12287exports.default = formatGLSLCompilerError;
12288function parseGLSLCompilerError(errLog, src, shaderType, shaderName) {
12289 var errorStrings = errLog.split(/\r?\n/);
12290 var errors = {};
12291 var warnings = {};
12292 var name = shaderName || (0, _getShaderNameDefault.default)(src) || "(unnamed)";
12293 var shaderDescription = "".concat((0, _getShaderTypeNameDefault.default)(shaderType), " shader ").concat(name);
12294 for(var i = 0; i < errorStrings.length; i++){
12295 var errorString = errorStrings[i];
12296 if (errorString.length <= 1) continue;
12297 var segments = errorString.split(":");
12298 var type = segments[0];
12299 var line = parseInt(segments[2], 10);
12300 if (isNaN(line)) throw new Error("GLSL compilation error in ".concat(shaderDescription, ": ").concat(errLog));
12301 if (type !== "WARNING") errors[line] = errorString;
12302 else warnings[line] = errorString;
12303 }
12304 var lines = addLineNumbers(src);
12305 return {
12306 shaderName: shaderDescription,
12307 errors: formatErrors(errors, lines),
12308 warnings: formatErrors(warnings, lines)
12309 };
12310}
12311function formatErrors(errors, lines) {
12312 var message = "";
12313 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