Shader compile failure (Ubuntu 14.04 + MacBook Air 5,2)

Issue #64 closed
Former user created an issue

I'm trying to open an MLV file produced with a Canon 7D and MagiLantern nightly build from 2014 April 30.

Here is the traceback produced right after selecting the MLV file in the "open" dialog box:

kevin /Desktop/7D/mlrawviewer(master@d772151) $ ./mlrawviewer.py 
MlRawViewer v1.1.5
(c) Andrew Baldwin & contributors 2013-2014
pyAudio not available. Cannot play audio
Using GLFW
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated. please move it to /home/kevin/.config/fontconfig/fonts.conf manually
wavnames []
wavfilename /home/kevin/Desktop/7D/M01-1950.WAV
Opening MLV file /home/kevin/Desktop/7D/M01-1950.MLV
Black level: 2048 White level: 15000
FPS: 23.976 (24000/1001)
Audio frame count 0
Traceback (most recent call last):
  File "/home/kevin/Desktop/7D/mlrawviewer/GLComputeGLFW.py", line 304, in __draw
    self.onDraw(w,h)
  File "./mlrawviewer.py", line 909, in onDraw
    self.init()
  File "./mlrawviewer.py", line 892, in init
    self.demosaic = DemosaicScene(self.raw,self,self,self,size=(self.raw.width(),self.raw.height()))
  File "./mlrawviewer.py", line 278, in __init__
    self.demosaicer = Demosaicer(settings,encoder,frames)
  File "./mlrawviewer.py", line 113, in __init__
    self.shaderPatternNoise = ShaderPatternNoise()
  File "/home/kevin/Desktop/7D/mlrawviewer/ShaderPatternNoise.py", line 138, in __init__
    super(ShaderPatternNoise,self).__init__(myclass.vertex_src,myclass.fragment_src,["rawtex","rawres","orientation","blackwhite"],**kwds)
  File "/home/kevin/Desktop/7D/mlrawviewer/GLCompute.py", line 73, in __init__
    fragmentShaderHandle = compileShader(fs,GL_FRAGMENT_SHADER)
  File "/usr/lib/python2.7/dist-packages/OpenGL/GL/shaders.py", line 231, in compileShader
    shaderType,
RuntimeError:
("Shader compile failure (0): 0:28(25): error: could not implicitly convert operands to relational operator
0:28(25): error: loop condition must be scalar boolean
0:29(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:30(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:31(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:32(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:33(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:34(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:35(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:36(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:37(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:38(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:39(29): error: no matching function for call to `step(vec4, float)'; candidates are:
0:39(29): error:    vec4 step(float, vec4)
0:39(29): error:    float step(float, float)
0:39(29): error:    vec2 step(float, vec2)
0:39(29): error:    vec3 step(float, vec3)
0:39(29): error:    vec4 step(float, vec4)
0:39(29): error:    vec2 step(vec2, vec2)
0:39(29): error:    vec3 step(vec3, vec3)
0:39(29): error:    vec4 step(vec4, vec4)
0:40(52): error: no matching function for call to `step(vec4, float)'; candidates are:
0:40(52): error:    vec4 step(float, vec4)
0:40(52): error:    float step(float, float)
0:40(52): error:    vec2 step(float, vec2)
0:40(52): error:    vec3 step(float, vec3)
0:40(52): error:    vec4 step(float, vec4)
0:40(52): error:    vec2 step(vec2, vec2)
0:40(52): error:    vec3 step(vec3, vec3)
0:40(52): error:    vec4 step(vec4, vec4)
0:42(7): error: value of type vec4 cannot be assigned to variable of type float
0:44(7): error: value of type vec4 cannot be assigned to variable of type float
0:68(25): error: could not implicitly convert operands to relational operator
0:68(25): error: loop condition must be scalar boolean
0:69(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:70(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:71(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:72(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:73(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:74(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:75(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:76(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:77(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:78(8): error: initializer of type vec4 cannot be assigned to variable of type float
0:79(29): error: no matching function for call to `step(vec4, float)'; candidates are:
0:79(29): error:    vec4 step(float, vec4)
0:79(29): error:    float step(float, float)
0:79(29): error:    vec2 step(float, vec2)
0:79(29): error:    vec3 step(float, vec3)
0:79(29): error:    vec4 step(float, vec4)
0:79(29): error:    vec2 step(vec2, vec2)
0:79(29): error:    vec3 step(vec3, vec3)
0:79(29): error:    vec4 step(vec4, vec4)
0:80(52): error: no matching function for call to `step(vec4, float)'; candidates are:
0:80(52): error:    vec4 step(float, vec4)
0:80(52): error:    float step(float, float)
0:80(52): error:    vec2 step(float, vec2)
0:80(52): error:    vec3 step(float, vec3)
0:80(52): error:    vec4 step(float, vec4)
0:80(52): error:    vec2 step(vec2, vec2)
0:80(52): error:    vec3 step(vec3, vec3)
0:80(52): error:    vec4 step(vec4, vec4)
0:82(7): error: value of type vec4 cannot be assigned to variable of type float
0:84(7): error: value of type vec4 cannot be assigned to variable of type float",
['varying vec2 texcoord;
uniform vec4 rawres;
uniform float orientation;
uniform sampler2D rawtex;
uniform vec2 blackwhite;

void main() {
    float coll = 0.0;
    float colh = 0.0;
    float countl = 0.0;
    float counth = 0.0;
    if (orientation==1.0) {
        // Vertical
        float up4 = -4.0 * rawres.w;
        float up2 = -2.0 * rawres.w;
        float down2 = 2.0 * rawres.w;
        float down4 = 4.0 * rawres.w;
        if (texcoord.y<rawres.w*4.0) {
            up4 = down4;
            up2 = down2;
        }
        if (texcoord.y>(1.0-rawres.w*4.0)) {
            down4 = up4;
            down2 = up2;
        }
        float x=rawres.z*0.5;
        for (int i=0;i<rawres.x;i++) {
            float up1 = texture2D(rawtex,texcoord+vec2(x,up4));
            float up = texture2D(rawtex,texcoord+vec2(x,up2));
            float mid = texture2D(rawtex,texcoord+vec2(x,0.0));
            float down = texture2D(rawtex,texcoord+vec2(x,down2));
            float down1 = texture2D(rawtex,texcoord+vec2(x,down4));
            float lmd = mix(up,up1,step(0.0,up1-up));
            float rmd = mix(down,down1,step(0.0,down1-down));
            float med = mix(lmd,rmd,step(0.0,rmd-lmd));
            float mul = mid/med;
            float mulz = abs(mul-1.0);
            float incr = step(mulz,0.01);   
            float loh = step((mid-blackwhite.x),(64.0/65536.0));
            float nloh = 1.0 - loh;
            coll += loh * incr * mul;
            countl += loh * incr;
            colh += nloh * incr * mul;
            counth += nloh * incr;
            x=x+rawres.z;
        }
        if (countl<5.0) coll = 1.0;
        else coll = coll/countl;
        if (counth<5.0) colh = 1.0;
        else colh = colh/counth;
    }
    else {
        // Horizontal
        float left4 = -4.0 * rawres.z;
        float left2 = -2.0 * rawres.z;
        float right2 = 2.0 * rawres.z;
        float right4 = 4.0 * rawres.z;
        if (texcoord.x<rawres.z*4.0) {
            left4 = right4;
            left2 = right2;
        }
        if (texcoord.x>(1.0-rawres.z*4.0)) {
            right4 = left4;
            right2 = left2;
        }
        float y=rawres.w*0.5;
        for (int i=0;i<rawres.y;i++) {
            float lleft = texture2D(rawtex,texcoord+vec2(left4,y));
            float left = texture2D(rawtex,texcoord+vec2(left2,y));
            float mid = texture2D(rawtex,texcoord+vec2(0.0,y));
            float right = texture2D(rawtex,texcoord+vec2(right2,y));
            float rright = texture2D(rawtex,texcoord+vec2(right4,y));
            float lmd = mix(left,lleft,step(0.0,lleft-left));
            float rmd = mix(right,rright,step(0.0,rright-right));
            float med = mix(lmd,rmd,step(0.0,rmd-lmd));
            float mul = mid/med;
            float mulz = abs(mul-1.0);
            float incr = step(mulz,0.01);
            float loh = step((mid-blackwhite.x),(64.0/65536.0));
            float nloh = 1.0-loh;
            coll += loh * incr * mul;
            countl += loh * incr;
            colh += nloh * incr * mul;
            counth += nloh * incr;
            y=y+rawres.w;
        }
        if (countl<5.0) coll = 1.0;
        else coll = coll/countl;
        if (counth<5.0) colh = 1.0;
        else colh = colh/counth;
    }
    gl_FragColor = vec4(coll,colh,0.0,0.0);
}'], GL_FRAGMENT_SHADER)
Traceback (most recent call last):
  File "./mlrawviewer.py", line 1846, in <module>
    sys.exit(main())
  File "./mlrawviewer.py", line 1840, in main
    ret = rmc.run()
  File "/home/kevin/Desktop/7D/mlrawviewer/GLComputeGLFW.py", line 247, in run
    self.__idle()
  File "/home/kevin/Desktop/7D/mlrawviewer/GLComputeGLFW.py", line 336, in __idle
    self.onIdle()
  File "./mlrawviewer.py", line 1216, in onIdle
    if self.display.isDirty():
AttributeError: 'NoneType' object has no attribute 'isDirty'
kevin /Desktop/7D/mlrawviewer(master@d772151) $

If the last issue can be naively bypassed with a patch like:

diff --git a/mlrawviewer.py b/mlrawviewer.py
index fbfcf27..625b9b0 100755
--- a/mlrawviewer.py
+++ b/mlrawviewer.py
         if self.userIdleTime()>5.0 and self.userIdleTime()<7.0:
             self.refresh()

-        if self.display.isDirty():
+        if self.display and self.display.isDirty():
             self.refresh()

         self.handleIndexing()
         self.checkForLoadedFrames()

The first traceback persist.

I'm trying to running the latest MlRawViewer under an Ubuntu 14.04 on a MacBook Air 5,2 (Intel HD Graphics 4000).

Comments (12)

  1. Former user Account Deleted

    And because Ubuntu 14.04 ships with libglfw v2.7.2, I tried in the mean time to compile latest GLFW3 from sources. Here are my notes:

    $ sudo apt-get build-dep glfw
    $ sudo aptitude install cmake libx11-dev libxi-dev libxcursor-dev
    $ git clone https://github.com/glfw/glfw.git
    $ cd glfw
    $ cmake -G "Unix Makefiles"
    $ make
    $ sudo make install
    $ sudo ldconfig
    

    If the installation looks successful:

    $ python
    Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
    [GCC 4.8.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    Persistent session history and tab completion are enabled.
    >>> import glfw
    >>> glfw.glfwGetVersion()
    (3, 1, 0)
    >>>
    

    I still get the same RuntimeError traceback I reported above.

  2. Andrew Baldwin repo owner

    Looks like the intel compiler is being very strict. I have a good idea where the problems are and they should be easy to fix.

  3. Former user Account Deleted

    By the nature of the issue, I was afraid that my bug report would not have been of any help. Thanks for your quick answer ! Now if you need me to try some patch, please tell me.

  4. Andrew Baldwin repo owner

    Please try the latest code to see if you still have any shader errors or if these are now resolved.

  5. Former user Account Deleted

    Just tried the latest revision. Now I get this traceback after I load a file:

    kevin …/Desktop/7D/mlrawviewer(master@eb8cd8c) ✔ ./mlrawviewer.py 
    MlRawViewer v1.1.5
    (c) Andrew Baldwin & contributors 2013-2014
    pyAudio not available. Cannot play audio
    Using GLFW
    Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated. please move it to /home/kevin/.config/fontconfig/fonts.conf manually
    wavnames []
    wavfilename /home/Dropbox/Desktop/7D/M01-1950.WAV
    Opening MLV file /home/Dropbox/Desktop/7D/M01-1950.MLV
    Black level: 2048 White level: 15000
    FPS: 23.976 (24000/1001)
    Audio frame count 0
    Traceback (most recent call last):
      File "/home/Dropbox/Desktop/7D/mlrawviewer/GLComputeGLFW.py", line 304, in __draw
        self.onDraw(w,h)
      File "./mlrawviewer.py", line 949, in onDraw
        self.renderScenes()
      File "/home/Dropbox/Desktop/7D/mlrawviewer/GLComputeGLFW.py", line 258, in renderScenes
        s.render()
      File "/home/Dropbox/Desktop/7D/mlrawviewer/GLComputeUI.py", line 181, in render
        d.render(self,self.matrix,1.0)
      File "./mlrawviewer.py", line 231, in render
        self.shaderPatternNoise.draw(scene.size[0],scene.size[1],self.rawUploadTex,0,frameData.black/65536.0,frameData.white/65536.0)
      File "/home/Dropbox/Desktop/7D/mlrawviewer/ShaderPatternNoise.py", line 170, in draw
        glDrawArrays(GL_TRIANGLE_STRIP, 0, 4)
      File "/usr/lib/python2.7/dist-packages/OpenGL/error.py", line 208, in glCheckError
        baseOperation = baseOperation,
    GLError: GLError(
            err = 1286,
            description = 'invalid framebuffer operation',
            baseOperation = glDrawArrays,
            cArguments = (GL_TRIANGLE_STRIP, 0, 4)
    )
    
  6. Andrew Baldwin repo owner

    That looks like a version of a known issue (which also contains a workaround):

    https://bitbucket.org/baldand/mlrawviewer/issue/23/black-window-with-progressbar-on-linux

    Has an earlier version of the program (e.g. before the ShaderPattern was introduced) worked for you correctly previously, or has it never worked?

    The general problem here is lack of full support for floating point textures on Intel integrated GPUs. Since we're trying to do image processing we really need those for intermediate buffers between stages.

  7. Former user Account Deleted

    Only tried mlrawviewer for the first time a day before I opened this bug report. So no, I never had an earlier working version of the program.

    I think you're right and it's just that I don't have the appropriate hardware. In which case we can close this ticket as invalid.

    Still, a nice comprehensive error message here, pointing the lack of floating point texture support by hardware, would be nice. And might save you time by eliminating these kind of false-alarm tickets ! ;)

  8. Andrew Baldwin repo owner

    Ok, thanks for the info.

    It would be good if the program would first profile the current GPU capabilities, e.g. trying to open textures with different formats (32bit float, 16bit integer). Then it could give a useful message at the start if these are not available.

    Contributions welcome :-)

  9. Andrew Baldwin repo owner

    FYI, Issue #23 should now be resolved. Latest code should be working properly on recent Intel GPUs on Linux.

  10. Former user Account Deleted

    Forgot to confirm but, yes, latest mlrawviewer is working great now on that machine (and an updated Ubuntu 14.10).

  11. Log in to comment