g-truc/ogl-samples

external/gli/gli/./core/load_dds.inl:411: gli::storage gli::load_dds(std::istream&): Assertion `0' failed.

jrfonseca opened this issue · 0 comments

This happens when CMAKE_BUILD_TYPE=Debug, for all compressed textures.

The assertion seems bogus to me.

This patch fixes it:

diff --git a/external/gli/gli/core/load_dds.inl b/external/gli/gli/core/load_dds.inl
index 6d4270e..770c66e 100644
--- a/external/gli/gli/core/load_dds.inl
+++ b/external/gli/gli/core/load_dds.inl
@@ -407,8 +407,11 @@ inline storage load_dds(std::istream& FileIn)
            break;
        }
    }
-   else
+
+   if (Format == gli::FORMAT_INVALID)
+   {
        assert(0);
+   }

    std::streamoff Curr = FileIn.tellg();
    FileIn.seekg(0, std::ios_base::end);