<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - Stellaris - colored overlay of sectors doesn't render on i965"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=95530#c11">Comment # 11</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - Stellaris - colored overlay of sectors doesn't render on i965"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=95530">bug 95530</a>
              from <span class="vcard"><a class="email" href="mailto:jakub+mesa@streamcomputing.eu" title="Jakub Szuppe <jakub+mesa@streamcomputing.eu>"> <span class="fn">Jakub Szuppe</span></a>
</span></b>
        <pre>Sectors have "noisy" borders and very low transparency on i965 driver (Mesa
17.1.0-devel (git-d5ee55f)). Other Mesa drivers (llvmpipe and radeonsi) work
correctly.

How it looks like on i965:
<a href="https://drive.google.com/open?id=0B1fY17pW39ZeWUoxVXJWUU42dFk">https://drive.google.com/open?id=0B1fY17pW39ZeWUoxVXJWUU42dFk</a>

How it should:
<a href="https://drive.google.com/open?id=0B1fY17pW39ZeUGhQdmRTUS1UVWc">https://drive.google.com/open?id=0B1fY17pW39ZeUGhQdmRTUS1UVWc</a>

These overlays are rendered using render-to-texture in the call 2149486:
<a href="https://drive.google.com/open?id=0B1fY17pW39ZedlFDREwwSFB6Nzg">https://drive.google.com/open?id=0B1fY17pW39ZedlFDREwwSFB6Nzg</a>

The program 706 (a fragment shader 708, created in 911931) uses two textures
with

glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MIN_FILTER, param =
GL_NEAREST)
glTexParameteri(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MAG_FILTER, param =
GL_NEAREST)

These textures also have GL_TEXTURE_MAX_ANISOTROPY_EXT set to 16:

glTexParameterf(target = GL_TEXTURE_2D, pname = GL_TEXTURE_MAX_ANISOTROPY_EXT,
param = 16)

Setting GL_TEXTURE_MAX_ANISOTROPY_EXT to 1 for both textures fixes the issue:
<a href="https://drive.google.com/open?id=0B1fY17pW39Zec2pMa3dIN0Nobjg">https://drive.google.com/open?id=0B1fY17pW39Zec2pMa3dIN0Nobjg</a>

I.e., GL_TEXTURE_MAX_ANISOTROPY_EXT disables GL_NEAREST, and because the shader
highly depends on exact texel values (it calculates sums, maximum of values of
the first texture, uses the second texture as a look-up table), the results
have such a big difference.

Here the code that disables GL_NEAREST in this case:
<a href="https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_sampler_state.c#n454">https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/brw_sampler_state.c#n454</a>

We've found one issue with a proposed patch here:
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - setting texture filtering to nearest has no effect when anisotropy is greater than 1"
   href="show_bug.cgi?id=91786">https://bugs.freedesktop.org/show_bug.cgi?id=91786</a>

The patched driver produces correct results for both traces.

Kind regards,
Stream HPC Team
<a href="https://streamhpc.com/">https://streamhpc.com/</a></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>