The unified implementation handles all the GLenum values expected by
either.

Signed-off-by: Josh Triplett <[email protected]>
---
 tests/util/piglit-util-gl-common.c | 26 ++++++++++++++++++++++++++
 tests/util/piglit-util-gl.c        | 26 --------------------------
 tests/util/piglit-util-gles.c      | 21 ---------------------
 3 files changed, 26 insertions(+), 47 deletions(-)

diff --git a/tests/util/piglit-util-gl-common.c 
b/tests/util/piglit-util-gl-common.c
index 609f6a9..f4b2192 100644
--- a/tests/util/piglit-util-gl-common.c
+++ b/tests/util/piglit-util-gl-common.c
@@ -807,3 +807,29 @@ piglit_draw_rect_tex(float x, float y, float w, float h,
 
        piglit_draw_rect_from_arrays(verts, tex);
 }
+
+unsigned
+piglit_num_components(GLenum base_format)
+{
+       switch (base_format) {
+       case GL_ALPHA:
+       case GL_DEPTH_COMPONENT:
+       case GL_INTENSITY:
+       case GL_LUMINANCE:
+       case GL_RED:
+               return 1;
+       case GL_DEPTH_STENCIL:
+       case GL_LUMINANCE_ALPHA:
+       case GL_RG:
+               return 2;
+       case GL_RGB:
+               return 3;
+       case GL_RGBA:
+               return 4;
+       default:
+               printf("Unknown num_components for %s\n",
+                      piglit_get_gl_enum_name(base_format));
+               piglit_report_result(PIGLIT_FAIL);
+               return 0;
+       }
+}
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index f6cc72c..ac3489d 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -38,32 +38,6 @@
 
 GLint piglit_ARBfp_pass_through = 0;
 
-unsigned
-piglit_num_components(GLenum base_format)
-{
-       switch (base_format) {
-       case GL_ALPHA:
-       case GL_DEPTH_COMPONENT:
-       case GL_INTENSITY:
-       case GL_LUMINANCE:
-       case GL_RED:
-               return 1;
-       case GL_DEPTH_STENCIL:
-       case GL_LUMINANCE_ALPHA:
-       case GL_RG:
-               return 2;
-       case GL_RGB:
-               return 3;
-       case GL_RGBA:
-               return 4;
-       default:
-               printf("Unknown num_components for %s\n",
-                      piglit_get_gl_enum_name(base_format));
-               piglit_report_result(PIGLIT_FAIL);
-               return 0;
-       }
-}
-
 /* This function only handles formats not supported by the OpenGL framebuffer
  * size queries, which only support querying the R,G,B,A sizes.
  *
diff --git a/tests/util/piglit-util-gles.c b/tests/util/piglit-util-gles.c
index c29feac..6789aeb 100644
--- a/tests/util/piglit-util-gles.c
+++ b/tests/util/piglit-util-gles.c
@@ -170,27 +170,6 @@ print_pixel(const GLubyte *pixel, unsigned components)
                printf(" %u", pixel[p]);
 }
 
-unsigned
-piglit_num_components(GLenum base_format)
-{
-       switch (base_format) {
-       case GL_ALPHA:
-       case GL_LUMINANCE:
-               return 1;
-       case GL_LUMINANCE_ALPHA:
-               return 2;
-       case GL_RGB:
-               return 3;
-       case GL_RGBA:
-               return 4;
-       default:
-               printf("Unknown num_components for %s\n",
-                      piglit_get_gl_enum_name(base_format));
-               piglit_report_result(PIGLIT_FAIL);
-               return 0;
-       }
-}
-
 int
 piglit_probe_image_ubyte(int x, int y, int w, int h, GLenum format,
                        const GLubyte *image)
-- 
2.0.1

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to