<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Mesa software rasterizers - decompress textures on load to improve performance"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=77693">77693</a>
          </td>
        </tr>

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

        <tr>
          <th>Summary</th>
          <td>Mesa software rasterizers - decompress textures on load to improve performance
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>cosinusoidally@gmail.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

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

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

        <tr>
          <th>Component</th>
          <td>Mesa core
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I noticed that a couple of WebGL demos that use texture compression perform
poorly when using LLVMpipe. I patched mesa to decompress the textures during
load. This yielded about 4 times the performance of using libtxc_dxtn to sample
the compressed textures during rasterization. The patch intercepts calls to
glCompressedTexImage2D, decompresses the texture and then calls glTexImage2D
with the uncompressed data. The patch is hard coded to take
GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE textures and to convert them in to GL_RGBA
GL_UNSIGNED_BYTE textures. I've also basically pasted libtxc_dxtn in to
src/mesa/main/teximage.c . Obviously this patch isn't production ready but it
does illustrate the potential performance win at least in the case of s3tc
textures (at the expense of increased memory usage).

I used the following set up:

* Current mesa from git (ba6dcb3c2b8f516b120f591144bf6c3751f0e3f9)
* 64 bit Ubuntu 12.04
* LLVM 3.4 prebuilt binary from from <a href="http://llvm.org/releases/">http://llvm.org/releases/</a>
* LLVMpipe built with scons build=release llvmpipe libgl-xlib
* Core 2 Duo E8400

I tested on the following two pages in Firefox 28 (libtxc_dxtn vs my patch):

Simple cube with a compressed texture
<a href="http://media.tojicode.com/webgl-samples/dds.html">http://media.tojicode.com/webgl-samples/dds.html</a>
* 40fps 180% CPU without patch
* 60fps 80% CPU with patch

Mozilla Bananabread Arena demo level on
<a href="https://developer.cdn.mozilla.net/media/uploads/demos/a/z/azakai/3baf4ad7e600cbda06ec46efec5ec3b8/bananabread_1373485124_demo_package/game.html?setup=low&serve">https://developer.cdn.mozilla.net/media/uploads/demos/a/z/azakai/3baf4ad7e600cbda06ec46efec5ec3b8/bananabread_1373485124_demo_package/game.html?setup=low&serve</a>
(or  <a href="https://developer.mozilla.org/en/demos/detail/bananabread">https://developer.mozilla.org/en/demos/detail/bananabread</a>)
* 6fps without patch
* 20 fps with patch</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>