<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [SKL] Improper rendering in Europa Universalis IV"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=96958#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [SKL] Improper rendering in Europa Universalis IV"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=96958">bug 96958</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>There are two different bugs/issues here:

1) Artefacts looking like stretched textures (for example, between mountains
and plains)
2) Low detail of the terrain

1) Artefacts looking like stretched textures (for example, between mountains
and plains):
<a href="https://drive.google.com/open?id=0B1fY17pW39ZecW5DeWhnaGtrNHc">https://drive.google.com/open?id=0B1fY17pW39ZecW5DeWhnaGtrNHc</a>

These artefacts are visible only when anisotropic filtering is turned on (for
example, maxanisotropy=4 in ~/.local/share/Paradox Interactive/Europa
Universalis IV/settings.txt).

The reason is the same as in "95530 - Stellaris - colored overlay of sectors
doesn't render on i965" (see
<a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - Stellaris - colored overlay of sectors doesn't render on i965"
   href="show_bug.cgi?id=95530#c11">https://bugs.freedesktop.org/show_bug.cgi?id=95530#c11</a>): The shader needs exact
(unfiltered) values from a special texture with terrain type ids. But i965
driver disables GL_NEAREST filtering (and enables anisotropic) when
GL_TEXTURE_MAX_ANISOTROPY_EXT > 1.

The patch <a href="https://bugs.freedesktop.org/attachment.cgi?id=123400">https://bugs.freedesktop.org/attachment.cgi?id=123400</a> fixes this:
<a href="https://drive.google.com/open?id=0B1fY17pW39Zea1JfN09wa24xVEU">https://drive.google.com/open?id=0B1fY17pW39Zea1JfN09wa24xVEU</a>

It also improves UI rendering slightly, because it uses GL_NEAREST too.

2) Low detail of the terrain

First, we used a trace created using i965 driver (the "ugly" trace). This trace
works same for i965, radeonsi, llvmpipe: low details, artefacts between tiles
(vertical and horizontal lines).

Then we used the trace created using radeonsi (the "good" trace) and noticed
that it works same for i965, radeonsi, llvmpipe: high details, bump-mapping, no
artefacts.

Th only difference between "good" and "ugly" traces is in shaders code:

The "ugly" has: #define NO_SHADER_TEXTURE_LOD (texture2D is used in this case)
The "good" has: #extension GL_ARB_shader_texture_lod : enable (texture2DLod is
used)

For some reason the game does not enable texture_lod extension for Intel
driver. But GL_ARB_shader_texture_lod is supported by the i965  driver!

We "hacked" gfx/FX/defines_glsl.fxh by adding these code:

#undef NO_SHADER_TEXTURE_LOD
#extension GL_ARB_shader_texture_lod : enable

This forces the shader to use the "good" variant. Everything looks ok (high
details, bump-mapping, no artefacts):
<a href="https://drive.google.com/open?id=0B1fY17pW39ZeRWJlbWlXbXpyZFU">https://drive.google.com/open?id=0B1fY17pW39ZeRWJlbWlXbXpyZFU</a>

Perhaps the game developers encountered some issues with Intel drivers before
or there are issues in some other places of the game (but I can't see them).

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 assignee for the bug.</li>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>