On Tue 11 Aug 2015, Nanley Chery wrote: > From: Nanley Chery <nanley.g.ch...@intel.com> > > Only uncompressed formats have a non-void type and actual components per > pixel. > Rename _mesa_format_to_type_and_comps to > _mesa_uncompressed_format_to_type_and_comps and require callers to check if > the format is not compressed. > > Cc: Jason Ekstrand <jason.ekstr...@intel.com> > Signed-off-by: Nanley Chery <nanley.g.ch...@intel.com> > --- > src/mesa/main/format_utils.c | 2 +- > src/mesa/main/formats.c | 55 > ++++++++------------------------------------ > src/mesa/main/formats.h | 2 +- > src/mesa/main/mipmap.c | 2 +- > 4 files changed, 12 insertions(+), 49 deletions(-)
I like several patches in this series, but I don't like this one. It produces a lot of compiler warnings. The problem is that the switch in _mesa_format_to_type_and_comps() is intended to be an exhaustive switch. Removing the compressed format cases causes a waterfall of compiler warnings like this: main/formats.c:1458:4: warning: enumeration value 'MESA_FORMAT_LA_LATC2_UNORM' not handled in switch [-Wswitch] main/formats.c:1458:4: warning: enumeration value 'MESA_FORMAT_LA_LATC2_SNORM' not handled in switch [-Wswitch] main/formats.c:1458:4: warning: enumeration value 'MESA_FORMAT_ETC1_RGB8' not handled in switch [-Wswitch] main/formats.c:1458:4: warning: enumeration value 'MESA_FORMAT_ETC2_RGB8' not handled in switch [-Wswitch] main/formats.c:1458:4: warning: enumeration value 'MESA_FORMAT_ETC2_SRGB8' not handled in switch [-Wswitch] main/formats.c:1458:4: warning: enumeration value 'MESA_FORMAT_ETC2_RGBA8_EAC' not handled in switch [-Wswitch] main/formats.c:1458:4: warning: enumeration value 'MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC' not handled in switch [-Wswitch] I think you can salvage the patch by following the hint in this deleted hunk... > - case MESA_FORMAT_RGB_FXT1: > - case MESA_FORMAT_RGBA_FXT1: > - case MESA_FORMAT_RGB_DXT1: > - case MESA_FORMAT_RGBA_DXT1: > - case MESA_FORMAT_RGBA_DXT3: > - case MESA_FORMAT_RGBA_DXT5: > - case MESA_FORMAT_SRGB_DXT1: > - case MESA_FORMAT_SRGBA_DXT1: > - case MESA_FORMAT_SRGBA_DXT3: > - case MESA_FORMAT_SRGBA_DXT5: > - case MESA_FORMAT_R_RGTC1_UNORM: > - case MESA_FORMAT_R_RGTC1_SNORM: > - case MESA_FORMAT_RG_RGTC2_UNORM: > - case MESA_FORMAT_RG_RGTC2_SNORM: > - case MESA_FORMAT_L_LATC1_UNORM: > - case MESA_FORMAT_L_LATC1_SNORM: > - case MESA_FORMAT_LA_LATC2_UNORM: > - case MESA_FORMAT_LA_LATC2_SNORM: > - case MESA_FORMAT_ETC1_RGB8: > - case MESA_FORMAT_ETC2_RGB8: > - case MESA_FORMAT_ETC2_SRGB8: > - case MESA_FORMAT_ETC2_RGBA8_EAC: > - case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC: > - case MESA_FORMAT_ETC2_R11_EAC: > - case MESA_FORMAT_ETC2_RG11_EAC: > - case MESA_FORMAT_ETC2_SIGNED_R11_EAC: > - case MESA_FORMAT_ETC2_SIGNED_RG11_EAC: > - case MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1: > - case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: > - case MESA_FORMAT_BPTC_RGBA_UNORM: > - case MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM: > - case MESA_FORMAT_BPTC_RGB_SIGNED_FLOAT: > - case MESA_FORMAT_BPTC_RGB_UNSIGNED_FLOAT: > - /* XXX generate error instead? */ > - *datatype = GL_UNSIGNED_BYTE; > - *comps = 0; > - return; > - In other words, rename the function to _mesa_uncompressed_format_to_type_and_comps(); keep all the format cases; and add an assertion or _mesa_problem() for the compressed cases. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev