<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 --- - glGenerateMipmap crashes when using GL_TEXTURE_2D_ARRAY with compressed internal format"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=66850">66850</a>
          </td>
        </tr>

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

        <tr>
          <th>Summary</th>
          <td>glGenerateMipmap crashes when using GL_TEXTURE_2D_ARRAY with compressed internal format
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

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

        <tr>
          <th>Reporter</th>
          <td>mikjuo@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>Created <span class=""><a href="attachment.cgi?id=82363" name="attach_82363" title="Test program, using GLUT, to reproduce the crash">attachment 82363</a> <a href="attachment.cgi?id=82363&action=edit" title="Test program, using GLUT, to reproduce the crash">[details]</a></span>
Test program, using GLUT, to reproduce the crash

At least happens on Mesa commit id 1681bd7f2b392d0b379cb0ff43a4fac33da74762 and
also on Mesa 9.1.4 that is in Debian testing repositories at the moment.

I have attached a short test program to reproduce the crash.

The crash occurs if you create and put data to a GL_TEXTURE_2D_ARRAY, using a
compressed texture format, while the number of textures in the array is greater
than 1 and then call glGenerateMipmap.

I'm not entirely sure if you are supposed to be able to generate mipmaps with
glGenerateMipmap if the zero layer texture is in compressed format but I'd
think it should at least fail gracefully, if this is the case.



This is what I could get out of GDB:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff452bd38 in do_row (datatype=5121, comps=3, srcWidth=128,
srcRowA=0x7fffffffee90, srcRowB=0x7ffffffff010, dstWidth=64, dstRow=0x90ffc0)
at ../../../src/mesa/main/mipmap.c:183
183             dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0])
/ 4;
(gdb) bt
#0  0x00007ffff452bd38 in do_row (datatype=5121, comps=3, srcWidth=128,
srcRowA=0x7fffffffee90, srcRowB=0x7ffffffff010, dstWidth=64, dstRow=0x90ffc0)
at ../../../src/mesa/main/mipmap.c:183
#1  0x00007ffff453992b in make_2d_mipmap (datatype=5121, comps=3, border=0,
srcWidth=128, srcHeight=128, srcPtr=0x7fffffffe590 "", srcRowStride=384,
dstWidth=64, dstHeight=64, 
    dstPtr=0x90fd80 "Sz_\002\023\225_37#", dstRowStride=192) at
../../../src/mesa/main/mipmap.c:1475
#2  0x00007ffff453a7f2 in _mesa_generate_mipmap_level (target=35866,
datatype=5121, comps=3, border=0, srcWidth=128, srcHeight=128, srcDepth=2,
srcData=0x7fffffffe570, srcRowStride=384, 
    dstWidth=64, dstHeight=64, dstDepth=2, dstData=0x7fffffffe568,
dstRowStride=192) at ../../../src/mesa/main/mipmap.c:1750
#3  0x00007ffff453b39f in generate_mipmap_compressed (ctx=0x621170,
target=35866, texObj=0x8c1780, srcImage=0x8ede50, maxLevel=13) at
../../../src/mesa/main/mipmap.c:2121
#4  0x00007ffff453b55b in _mesa_generate_mipmap (ctx=0x621170, target=35866,
texObj=0x8c1780) at ../../../src/mesa/main/mipmap.c:2180
#5  0x00007ffff46aa33c in _mesa_meta_GenerateMipmap (ctx=0x621170,
target=35866, texObj=0x8c1780) at ../../../src/mesa/drivers/common/meta.c:3527
#6  0x00007ffff44f08e2 in _mesa_GenerateMipmap (target=35866) at
../../../src/mesa/main/fbobject.c:2889
#7  0x00007ffff796c527 in glGenerateMipmap (target=35866) at
../../../src/mapi/glapi/glapi_mapi_tmp.h:8178
#8  0x0000000000400954 in main (argc=1, argv=0x7fffffffe8b8) at
test_program.c:31</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>