<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 - Meta mipmap generation can corrupt texture state"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=93717">93717</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Meta mipmap generation can corrupt texture state
          </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>Drivers/DRI/i965
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>idr@freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>idr@freedesktop.org
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>At the end of _mesa_meta_GenerateMipmap, is the following sequence:

   _mesa_meta_end(ctx);

   _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
   if (genMipmapSave)
      _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
   if (swizzleSaved)
      _mesa_TexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, swizzle);

maxLevelSave, genMipmapSave, and swizzle all came from the texture object
passed into the function.  This may not be the texture bound to
ctx->Texture.CurrentUnit when the function is called!

We need a simple test case to verify this bug.

1. Create two textures, A and B, and fill each with some data.

2. Bind A and set GL_TEXTURE_MAX_LEVEL, GL_GENERATE_MIPMAP, and
GL_TEXTURE_SWIZZLE_RGBA (assuming either GL_EXT_texture_swizzle or
GL_ARB_texture_swizzle is supported).

3. While A is bound (but B is not bound), call glGenerateMipmaps on B.

4. Verify the GL_TEXTURE_MAX_LEVEL, GL_GENERATE_MIPMAP, and
GL_TEXTURE_SWIZZLE_RGBA state of A.

It may be worth making this test generic so that other meta operations (and
other texture state) could be tested in the future.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>