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

Function parseGLSLCompilerError

docs/tests/v2/es6/js/sanddance.js:3142–3179  ·  view source on GitHub ↗
(errLog, src, shaderType, shaderName)

Source from the content-addressed store, hash-verified

3140
3141/* eslint-disable no-continue, max-statements */
3142function parseGLSLCompilerError(errLog, src, shaderType, shaderName) {
3143 var errorStrings = errLog.split(/\r?\n/);
3144 var errors = {};
3145 var warnings = {}; // Patch the shader name
3146
3147 var name = shaderName || (0, _getShaderName.default)(src) || '(unnamed)';
3148 var shaderDescription = "".concat((0, _getShaderName.getShaderTypeName)(shaderType), " shader ").concat(name); // Parse the error - note: browser and driver dependent
3149
3150 for (var i = 0; i < errorStrings.length; i++) {
3151 var errorString = errorStrings[i];
3152
3153 if (errorString.length <= 1) {
3154 continue;
3155 }
3156
3157 var segments = errorString.split(':');
3158 var type = segments[0];
3159 var line = parseInt(segments[2], 10);
3160
3161 if (isNaN(line)) {
3162 throw new Error("GLSL compilation error in ".concat(shaderDescription, ": ").concat(errLog));
3163 }
3164
3165 if (type !== 'WARNING') {
3166 errors[line] = errorString;
3167 } else {
3168 warnings[line] = errorString;
3169 }
3170 } // Format the error inline with the code
3171
3172
3173 var lines = addLineNumbers(src);
3174 return {
3175 shaderName: shaderDescription,
3176 errors: formatErrors(errors, lines),
3177 warnings: formatErrors(warnings, lines)
3178 };
3179} // Formats GLSL compiler error log into single string
3180
3181
3182function formatGLSLCompilerError(errLog, src, shaderType) {

Callers 1

formatGLSLCompilerErrorFunction · 0.70

Calls 2

addLineNumbersFunction · 0.70
formatErrorsFunction · 0.70

Tested by

no test coverage detected