{"record":{"id":"32b88de25bc8382f","repo":"BabylonJS/Babylon.js","slug":"unsupported-uniform-type-uniformtypestring","errorCode":null,"errorMessage":"`Unsupported uniform type: '${uniformTypeString}'`","messagePattern":"`Unsupported uniform type: '(.+?)'`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/smartFilters/src/utils/buildTools/shaderConverter.ts","lineNumber":173,"sourceCode":"                type = ConnectionPointType.Float;\r\n                break;\r\n            case \"sampler2D\":\r\n                type = ConnectionPointType.Texture;\r\n                break;\r\n            case \"vec3\":\r\n                type = ConnectionPointType.Color3;\r\n                break;\r\n            case \"vec4\":\r\n                type = ConnectionPointType.Color4;\r\n                break;\r\n            case \"bool\":\r\n                type = ConnectionPointType.Boolean;\r\n                break;\r\n            case \"vec2\":\r\n                type = ConnectionPointType.Vector2;\r\n                break;\r\n            default:\r\n                throw new Error(`Unsupported uniform type: '${uniformTypeString}'`);\r\n        }\r\n\r\n        uniforms.push({\r\n            name: uniformName,\r\n            type,\r\n            properties: annotationJSON ? JSON.parse(annotationJSON.replace(\"//\", \"\").trim()) : undefined,\r\n        });\r\n\r\n        if (annotationJSON) {\r\n            // Strip out any annotation so it isn't mistaken for function bodies\r\n            fragmentShader = fragmentShader.replace(annotationJSON, \"\");\r\n        }\r\n    }\r\n\r\n    // Read the property consts (consts to be exposed as properties)\r\n    const fragmentConstProperties: ConstPropertyMetadata[] = [];\r\n    const constRegExp = new RegExp(/(\\/\\/\\s*\\{.*\\}\\s*(?:\\r\\n|\\r|\\n)+)?(const .*)/gm);\r\n    const constGroups = fragmentShader.matchAll(constRegExp);\r","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/smartFilters/src/utils/buildTools/shaderConverter.ts#L155-L191","documentation":"ParseFragmentShader converts the uniform's GLSL type to a ConnectionPointType via a switch over a fixed set of supported types (float, vec2, etc.). Any type outside that list hits the default branch and throws, listing the offending type.","triggerScenarios":"Declaring a uniform with an unsupported GLSL type — e.g. int, mat4, vec4 (if unsupported in this version), sampler2D, or any non-scalar/vector type in the supported switch.","commonSituations":"Using standard GLSL types the smart filter binding layer does not model; porting general-purpose shaders into blocks; version differences where a type was added later.","solutions":["Change the uniform to a supported type (float, Boolean, vec2, or whatever the version's switch supports).","Split unsupported types (mat4, arrays) into multiple supported uniforms.","Check the source switch statement in shaderConverter.ts for the exact list of supported types in your version."],"exampleFix":"// before\nuniform mat4 transform;\n// after\nuniform vec4 transformRow0;\nuniform vec4 transformRow1;","handlingStrategy":"validation","validationCode":"const supported = new Set(['float', 'vec2']); // check shaderConverter.ts switch for your version\nsrc.split('\\n').forEach((l, i) => { const m = l.trim().match(/^uniform\\s+(\\w+)\\s+(\\w+)\\s*;?$/); if (m && !supported.has(m[1])) console.error(`Unsupported uniform type '${m[1]}' at line ${i+1}`); });","typeGuard":"const hasSupportedUniformType = (line: string): boolean => { const m = line.trim().match(/^uniform\\s+(\\w+)\\s+\\w+\\s*;?$/); return !!m && ['float','vec2'].includes(m[1]); };","tryCatchPattern":"try { await ConvertShader(path, ...); } catch (e) { const m = e.message.match(/Unsupported uniform type: '(\\w+)'/); if (m) { replaceUnsupportedType(m[1]); } else { throw e; } }","preventionTips":["Check the supported-type switch in shaderConverter.ts before using exotic types.","Split mat/array uniforms into supported scalar/vector uniforms.","Document supported uniform types for block authors."],"tags":["glsl","uniform-parsing","unsupported-type"],"backgroundTag":"unsupported-uniform-type","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}