Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-24070

QtCreator freezes when adding a do/while loop in a fragment shader

    XMLWordPrintable

Details

    • All
    • d41502ebb0d9223704d2807407f4cdeb8446f2c9 (qt-creator/qt-creator/4.12)

    Description

      I'm experiencing a strange freeze in QtCreator.
      This happens both on Windows 10 1909 and an up to date archlinux.
      To reproduce, open the attached code as an .glsl file. No project needed. Then start adding a new do/while loop (right where the commented out one is). As soon as you type the bracket, QtCreator freezes.

      #version 410 core
      out vec4 colorOut;
      highp dvec2 center;
      highp double zoom = 1000.0;
      uniform vec2 winDimensions;
      uniform int itr;
      
      vec4 map_to_color(float t) {
          float r = 9.0 * (1.0 - t) * t * t * t;
          float g = 15.0 * (1.0 - t) * (1.0 - t) * t * t;
          float b = 8.5 * (1.0 - t) * (1.0 - t) * (1.0 - t) * t;
          return vec4(r, g, b, 1.0);
      }
      
      void main()
      {
          center.x = -1.75; 
          center.y = 0.01;     
          highp dvec2 z, c;
          z.x=0.0; z.y=0.0;
          
          double screenRatio = winDimensions.x / winDimensions.y;
          int cnt = 0;
          highp double dimx = 2.0;
          highp double dimy = 2.0;
          highp double distx = 2.0 * dimx;
          highp double disty = 2.0 * dimx;
          highp double tx = 0.0;
          highp double ty = 0.0;
          
          c.x = screenRatio * (-1.0 * dimx + gl_FragCoord.x * distx/winDimensions.x);
          c.y = dimy - gl_FragCoord.y * disty / winDimensions.y;
          c.x /= zoom;
          c.y /= zoom;
          c.x += center.x;
          c.y += center.y;
          
          /*do {
              tx = (z.x*z.x - z.y*z.y) + c.x;
              ty = (2*z.x*z.y) + c.y;
              z.x = tx;
              z.y = ty;
              cnt++;
          } while(tx*tx + ty*ty < 4.0 && cnt != itr); */
          
          cnt = 0;
          double t = double(cnt) / double(itr);
          colorOut = map_to_color(float(t));
      }
      
      

      Attachments

        Activity

          People

            davschul David Schulz
            guschtlswife Tom N
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: