glsl-optimizer icon indicating copy to clipboard operation
glsl-optimizer copied to clipboard

Metal printer doesn't output gl_FragData correctly

Open bkaradzic opened this issue 8 years ago • 0 comments

I had to add this code to fix metal printer: https://github.com/bkaradzic/glsl-optimizer/commit/22be3e72c43a94eba4b9b5648e401298cd7d0440

        if (strstr(var->name, "gl_") == var->name)
        {
            if (NULL == strstr(var->name, "gl_FragData_") ) {
                if (!var->data.used && !var->data.assigned)
                    continue;
            }
        }

The problem is that there are vars gl_FragData, and gl_FragData_0/1/etc.. gl_FragData is used and assigned, but gl_FragData_0/1/etc are not. In that case xlatMtlShaderOutput structure is just left empty causing error when building with metal compiler.

bkaradzic avatar Oct 10 '15 05:10 bkaradzic