Subject: Bug#922162: mesa: Assertion triggered in texcompress_etc.c: _mesa_texstore_etc2_rgba8_eac from glGenerateMipmap()

From: ccaccb <[email-masked]>
Date: Tue, 12 Feb 2019 20:57:15 +0100

Source: mesa
Version: 18.3.2-1
Severity: normal

Dear Maintainer,

    After updating my bgfx-based renderer throws assertions.

    src/mesa/main/texcompress_etc.c:1130: _mesa_texstore_etc2_rgba8_eac:
Assertion `0' failed.

    from glGenerateMipmap() for any of the following texture formats:
    GL_ETC1_RGB8_OES
    GL_COMPRESSED_RGB8_ETC2
    GL_COMPRESSED_RGBA8_ETC2_EAC
    GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2

    Code roughly, look at (or better execute)
https://github.com/bkaradzic/bgfx/blob/7464fd16ab689a3bd736b6808a3ce9fbbeae3412/src/renderer_gl.cpp#L1461
    ```cpp
    glGenTextures(1, &id);
    glBindTexture(target, id);
    glTexStorage3D(target, ...);
    glCompressedTexImage3D(target, ...);
    glGenerateMipmap(target); /* ASSERT TRIGGERED */
    ```

    [bgfx]: https://github.com/bkaradzic/bgfx

    I guess the simplest way to replicate is to check out and run any of
    the bgfx examples.

    Might this be related to the change of the used assert macro in

https://gitlab.freedesktop.org/mesa/mesa/commit/bfcdb843830bba0190e00e35e3c5c18c4bdb5de1
    (although that is 3 years old)

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled