mesa: Drop bitfield "enums" from the enum-to-string table.

Asking the table for bitfield names doesn't make any sense.  For 0x10, do
you want GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV or
GL_COLOR_BUFFER_BIT4_QCOM or GL_POLYGON_STIPPLE_BIT or
GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV?  Giving a useful answer would
depend on a whole lot of context.

This also fixes a bad enum table entry, where we chose GL_HINT_BIT instead
of GL_ABGR_EXT for 0x8000, so we can now fix its entry in the enum_strings
test.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Eric Anholt 2015-11-25 17:00:00 -08:00
parent cbabf5f9dc
commit 710762b64a
2 changed files with 23 additions and 21 deletions

View file

@ -272,8 +272,17 @@ _mesa_lookup_prim_by_nr(GLuint nr)
if value > 0xffffffff:
return
if name.endswith('_BIT'):
priority += 100
# We don't want bitfields in the enum-to-string table --
# individual bits have so many names, it's pointless. Note
# that we check for power-of-two, since some getters have
# "_BITS" in their name, but none have a power-of-two enum
# number.
if not (value & (value - 1)) and '_BIT' in name:
return
# Also drop the GL_*_ATTRIB_BITS bitmasks.
if value == 0xffffffff:
return
if value in self.enum_table:
(n, p) = self.enum_table[value]
@ -489,12 +498,6 @@ _mesa_lookup_prim_by_nr(GLuint nr)
name = enum.get('name')
value = int(enum.get('value'), base=16)
if name == 'GL_ALL_ATTRIB_BITS':
# Khronos XML defines this one as 0xffffffff, but Mesa
# has always had the original definition of
# 0x000fffff.
value = 0x000fffff
# If the same name ever maps to multiple values, that can
# confuse us. GL_ACTIVE_PROGRAM_EXT is OK to lose because
# we choose GL_ACTIVE PROGRAM instead.

View file

@ -58,6 +58,11 @@ const struct enum_info everything[] = {
/* A core enum, that should take precedence over a _BIT. */
{ 0x0100, "GL_ACCUM" },
/* An enum with "_BIT" that shouldn't get stripped out when we drop most
* "*_BIT" enums.
*/
{ 0x0d55, "GL_ALPHA_BITS" },
/* An EXT-only extension that we never expect to see show up in ARB/core.
*/
{ 0x8062, "GL_REPLACE_EXT" },
@ -78,23 +83,17 @@ const struct enum_info everything[] = {
*/
{ 0x850a, "GL_MODELVIEW1_ARB" },
/* This should be included, but it's value collides with GL_HINT_BIT. The
* generator script picks GL_HINT_BIT because it prefers names that lack an
* extension suffix.
*/
/* { 0x8000, "GL_ABGR_EXT" }, */
{ 0x8000, "GL_HINT_BIT" },
/* An EXT-only enum that should take precedence over a _BIT. */
{ 0x8000, "GL_ABGR_EXT" },
/* An unusually-large enum */
{ 0x19262, "GL_RASTER_POSITION_UNCLIPPED_IBM" },
/* A bitmask masquerading as an enum */
{ 0x00080000, "GL_SCISSOR_BIT" },
/* A bitfield where Mesa uses a different value from Khronos. */
{ 0x000fffff, "GL_ALL_ATTRIB_BITS" },
/* A bitfield in the table, where we fail to return its string anyway! */
/* Bitfields like GL_SCISSOR_BIT and GL_ALL_ATTRIB_BITS should not appear
* in the table.
*/
{ 0x00080000, "0x80000" },
{ 0x000fffff, "0xfffff" },
{ (int)0xffffffff, "0xffffffff" },
{ 0, NULL }