On 04/22/2013 09:17 PM, Ian Romanick wrote:
On 04/23/2013 02:39 AM, Kenneth Graunke wrote:
Otherwise, the table could be full of uninitialized garbage.  That means
the NULL check at the bottom might not happen, so we wouldn't get the
_mesa_problem, and we'd then return garbage.

format_pack.c also has tables like this and memsets them.

This *CANNOT* be the right fix.  This just papers over things.  There
are a lot of entries in the table that are not initialized when several
similar entries are initialized.  For example, *ONE* of the ETC2 entries
is missing.  Many of the integer formats are present, but some are
missing.  Etc.

Fine.  I sent out patches to add/fix the rest of the unpack functions.

It still seems like we ought to memset() it so that if someone misses a new format in the future, they'll hit the _mesa_problem(). And then add an assertion...

Or perhaps just add a static assert in this code that MESA_FORMAT_COUNT is a particular value, so if people add a new format, they have to add unpack code.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to