<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 - glTexImage2D regression by texstore_rgba switch to _mesa_format_convert"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=89068">89068</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>glTexImage2D regression by texstore_rgba switch to _mesa_format_convert
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>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>Mesa core
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>brad.king@kitware.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>VTK's nightly testing regressed due to a mesa update that bisects to:

commit 8ec6534b266549cdc2798e2523bf6753924f6cde
Author: Iago Toral Quiroga <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>>
Date:   Wed Oct 15 13:42:11 2014 +0200

    mesa: Use _mesa_format_convert to implement texstore_rgba.

    Notice that _mesa_format_convert does not handle byte-swapping scenarios,
    GL_COLOR_INDEX or MESA_FORMAT_YCBCR(_REV), so these must be handled
    separately.

    Also, remove all the code that goes unused after using
_mesa_format_convert.

    Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>>

The call in question from VTK is:

           glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8,
                         imageMemorySize[0], imageMemorySize[1],
                         0, GL_RGBA, GL_UNSIGNED_SHORT,
                         static_cast<unsigned short *>(image) );

Unfortunately I do not have a deep understanding of the relevant code in VTK or
Mesa.  I will attach example test outputs from before and after the change. 
Somehow the background color tints the foreground image.

In texstore_rgba, the code path taken prior to this change was:

   } else if (_mesa_get_format_max_bits(dstFormat) <= 8 &&
              !_mesa_is_format_signed(dstFormat)) {
      return store_ubyte_texture(ctx, dims, baseInternalFormat,
                                 dstFormat,
                                 dstRowStride, dstSlices,
                                 srcWidth, srcHeight, srcDepth,
                                 srcFormat, srcType, srcAddr, srcPacking);

and later in _mesa_pack_ubyte_rgba_rect:

   if (srcRowStride == width * 4 * sizeof(GLubyte) &&
       dstRowStride == _mesa_format_row_stride(format, width)) {
      /* do whole image at once */
      _mesa_pack_ubyte_rgba_row(format, width * height,
                                (const GLubyte (*)[4]) src, dst);
   }

After the change, _mesa_format_convert is called but none of the coe paths
invoking _mesa_pack_ubyte_rgba_row is taken.  Instead the path using
compute_src2dst_component_mapping is taken and the result is different.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>