<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Broken packDouble2x32 at llvmpipe"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107524">107524</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Broken packDouble2x32 at llvmpipe
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/Gallium/llvmpipe
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>matwey.kornilov@gmail.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I've tested Mesa llvmpipe from recent master (e02f061b690d) and found the
following behavior.

The following fragment shader works as expected on Intel GPU (Intel HD Graphics
620 (Kaby Lake GT2)) and shows black screen at llvmpipe.

        #version 330
        #extension GL_ARB_gpu_shader_fp64 : require
        in vec2 UV;
        out vec4 color;
        uniform usampler2D image_texture;
        uniform sampler1D colormap;
        uniform float c;
        uniform float z;

        void main() {
                double raw_value = packDouble2x32(texture(image_texture,
UV).gr);
                double value = c * (raw_value - z);
                color = texture(colormap, float(clamp(value, 0.0, 1.0)));
        }

At the same time, the following tiny modification fixes the shader at llvmpipe:

        #version 330
        #extension GL_ARB_gpu_shader_fp64 : require
        in vec2 UV;
        out vec4 color;
        uniform usampler2D image_texture;
        uniform sampler1D colormap;
        uniform float c;
        uniform float z;

        void main() {
                double raw_value = packDouble2x32(uvec2(texture(image_texture,
UV).g, texture(image_texture, UV).r));
                double value = c * (raw_value - z);
                color = texture(colormap, float(clamp(value, 0.0, 1.0)));
        }

I've compared TGSI output from both of them and found the following difference:
In broken case DADD tries to operate on .yxyx

  5: DADD TEMP[1].xy, TEMP[1].yxyx, TEMP[2].xyxy

I am not sure that DADD knows what to do with swapped yx.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>