Multiple jit.gl.pix could't be compiled on Max 6.1.8.

mirrorboy's icon

When i use three jit.gl.pix and load same .jitgen.
Max window says "jit.gl.shader: GLSL program failed to compile." twice.

-- START GLSL INFO LOG: fp --
ERROR: 0:130: Use of undeclared identifier 'dim_549'
ERROR: 0:135: Use of undeclared identifier 'length_539'
ERROR: 0:141: Use of undeclared identifier 'rdiv_537'
ERROR: 0:142: Use of undeclared identifier 'mul_538'
ERROR: 0:143: Use of undeclared identifier 'sub_543'
ERROR: 0:144: Use of undeclared identifier 'smoothstep_542'
ERROR: 0:145: Use of undeclared identifier 'mix_544'
-- END GLSL INFO LOG: fp --
jit.gl.shader: GLSL program failed to compile.

Max Patch
Copy patch and select New From Clipboard in Max.

Maybe Max6.1.8 new feature "Gen: Compilation optimizations" is a point of this problem.
Captured image of Max window and sample program is attached on this topic.

-2014-08-10-5.10.03.jpeg
jpeg
-2014-08-10-05.14.02.jpeg
jpeg
2014-08-10-05.14.02.jpeg
jpeg
2014-08-10-5.10.03.jpeg
jpeg
mirrorboy's icon

I found that variable dim_68 have no declaration on my exported fragment shader code from jit.gl.pix.
and when I read exported jxs on jit.gl.slab. same problem occurred.

#define hypot(x, y) sqrt(x*x+y*y)
#define xor(x, y)    ((!(x&&y))&&(x||y))
#define sinh(x)        (0.5*(exp(x) - exp(-x)))
#define cosh(x)        (0.5*(exp(x) + exp(-x)))
#define tanh(x)        ((sinh(x))/(cosh(x)))
#define asinh(x)    (log(x) + sqrt(x*x+1.))
#define acosh(x)    (log(x) + sqrt(x*x-1.))
#define atanh(x)    (0.5*log((1.+x)/(1.-x)))

vec2 jit_wrap1(vec2 v) {
    return mod(v, 1.);
}

vec2 jit_clamp1(vec2 v) {
    return clamp(v, 0., 1.);
}

vec2 jit_mirror1(vec2 v) {
    return 1.-abs((mod(v, 2.)-1.));
}

uniform float fade;
uniform samplerJit0 tin1;
uniform samplerJit1 tin2;

varying vec2 texcoord1;
varying vec2 texcoord2;
varying vec2 flip1;
varying vec2 flip1_offset;
varying vec2 flip2;
varying vec2 flip2_offset;
varying vec2 texdim1;
varying vec2 texdim2;
varying vec2 texcoord;

varying vec2 dim;

float lt_float(float v1, float v2);
float switch_float_float(float v1, float v2, float v3);
float lt_float(float v1, float v2) {
    return float(v1 < v2);
}

float switch_float_float(float v1, float v2, float v3) {
    return bool(v1) ? v2 : v3;
}

void main() {
    vec4 in1 = textureJit0(tin1, texcoord1);
    vec4 in2 = textureJit1(tin2, texcoord2);
    
    vec2 snorm = texcoord*2.-1.;
    
    
    float clamp_55 = (((clamp(fade, 0.0, 1.0))));
    float sub1 = (clamp_55 - 0.0);
    float scale_74 = (pow(sub1 / 1.0, 1.0) * 1.005 + -0.005);
    float swiz_71 = (snorm.g);
    float length_58 = (((length(dim_68))));
    float swiz_66 = (dim.g);
    float swiz_65 = (dim.r);
    float lt_52 = (((lt_float(swiz_66, swiz_65))));
    float switch_53 = (((switch_float_float(lt_52, swiz_66, swiz_65))));
    float rdiv_56 = (switch_53 / length_58);
    float switch_51 = (((switch_float_float(lt_52, swiz_65, swiz_66))));
    float rdiv_67 = (switch_51 / switch_53);
    vec2 mul_64 = (snorm * rdiv_67);
    float swiz_72 = (mul_64.r);
    float cartopol_76 = (((sqrt(swiz_72 * swiz_72 + swiz_71 * swiz_71))));
    float mul_57 = (cartopol_76 * rdiv_56);
    float sub_62 = (mul_57 - scale_74);
    float smoothstep_61 = (((smoothstep(0.0, 0.005, sub_62))));
    vec4 mix_63 = (((mix(in1, in2, smoothstep_61))));
    gl_FragData[0] = mix_63;
}

Rob Ramirez's icon