From 26c549e69d12e44e2e36c09764ce2cceab262a1b Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Fri, 31 Jul 2015 10:26:36 -0700 Subject: mesa/formats: remove compressed formats from matching function All compressed formats return GL_FALSE and there isn't any evidence to support that this behaviour would change. Remove all switch cases for compressed formats. v2. Since the exhaustive switch is removed, add a gtest to ensure all formats are handled. v3. Ensure that GL_NO_ERROR is set before returning. v4. Fix an arg to _mesa_uncompressed_format_to_type_and_comps(); fix formatting and misc improvements (Chad). Reviewed-by: Chad Versace Signed-off-by: Nanley Chery --- src/mesa/main/tests/mesa_formats.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/mesa/main/tests') diff --git a/src/mesa/main/tests/mesa_formats.cpp b/src/mesa/main/tests/mesa_formats.cpp index bb59c5c6fb7..5356cd919a8 100644 --- a/src/mesa/main/tests/mesa_formats.cpp +++ b/src/mesa/main/tests/mesa_formats.cpp @@ -50,11 +50,18 @@ TEST(MesaFormatsTest, FormatTypeAndComps) */ if (!_mesa_is_format_compressed(f)) { GLenum datatype = 0; + GLenum error = 0; GLuint comps = 0; - _mesa_uncompressed_format_to_type_and_comps(f, &datatype, &comps); /* If the datatype is zero, the format was not handled */ + _mesa_uncompressed_format_to_type_and_comps(f, &datatype, &comps); EXPECT_NE(datatype, (GLenum)0); + + /* If the error isn't NO_ERROR, the format was not handled. + * Use an arbitrary GLenum format. */ + _mesa_format_matches_format_and_type(f, GL_RG, datatype, + GL_FALSE, &error); + EXPECT_EQ((GLenum)GL_NO_ERROR, error); } } -- cgit v1.2.3