[Piglit] [PATCH 1/2] Add usage information to getteximage-targets
Anuj Phogat
anuj.phogat at gmail.com
Fri Apr 10 10:41:31 PDT 2015
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
tests/texturing/getteximage-targets.c | 43 ++++++++++++++++++++++++++++-------
1 file changed, 35 insertions(+), 8 deletions(-)
diff --git a/tests/texturing/getteximage-targets.c b/tests/texturing/getteximage-targets.c
index 03bb4f8..0e1c3f1 100644
--- a/tests/texturing/getteximage-targets.c
+++ b/tests/texturing/getteximage-targets.c
@@ -221,45 +221,69 @@ getTexImage(bool doPBO, GLenum target, GLubyte data[][IMAGE_SIZE],
return pass;
}
+NORETURN void
+print_usage_and_exit(char *prog_name)
+{
+ printf("Usage: %s <target>\n"
+ " where <target> is one of:\n"
+ " 1D\n"
+ " 2D\n"
+ " 3D\n"
+ " RECT\n"
+ " CUBE\n"
+ " 1D_ARRAY\n"
+ " 2D_ARRAY\n"
+ " CUBE_ARRAY\n"
+ " S3TC\n",
+ prog_name);
+ piglit_report_result(PIGLIT_FAIL);
+}
+
void
piglit_init(int argc, char **argv)
{
int i;
- GLenum target = GL_TEXTURE_2D;
+ GLenum target;
bool pass = true;
GLenum internalformat = GL_RGBA8;
GLubyte data[18][IMAGE_SIZE];
int tolerance = 0;
+ if (argc != 2)
+ print_usage_and_exit(argv[0]);
+
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "1D") == 0) {
target = GL_TEXTURE_1D;
}
- if (strcmp(argv[i], "3D") == 0) {
+ else if (strcmp(argv[i], "2D") == 0) {
+ target = GL_TEXTURE_2D;
+ }
+ else if (strcmp(argv[i], "3D") == 0) {
target = GL_TEXTURE_3D;
piglit_require_gl_version(12);
}
- if (strcmp(argv[i], "RECT") == 0) {
+ else if (strcmp(argv[i], "RECT") == 0) {
target = GL_TEXTURE_RECTANGLE;
piglit_require_extension("GL_ARB_texture_rectangle");
}
- if (strcmp(argv[i], "CUBE") == 0) {
+ else if (strcmp(argv[i], "CUBE") == 0) {
target = GL_TEXTURE_CUBE_MAP;
piglit_require_extension("GL_ARB_texture_cube_map");
}
- if (strcmp(argv[i], "1D_ARRAY") == 0) {
+ else if (strcmp(argv[i], "1D_ARRAY") == 0) {
target = GL_TEXTURE_1D_ARRAY;
piglit_require_extension("GL_EXT_texture_array");
}
- if (strcmp(argv[i], "2D_ARRAY") == 0) {
+ else if (strcmp(argv[i], "2D_ARRAY") == 0) {
target = GL_TEXTURE_2D_ARRAY;
piglit_require_extension("GL_EXT_texture_array");
}
- if (strcmp(argv[i], "CUBE_ARRAY") == 0) {
+ else if (strcmp(argv[i], "CUBE_ARRAY") == 0) {
target = GL_TEXTURE_CUBE_MAP_ARRAY;
piglit_require_extension("GL_ARB_texture_cube_map_array");
}
- if (strcmp(argv[i], "S3TC") == 0) {
+ else if (strcmp(argv[i], "S3TC") == 0) {
internalformat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
tolerance = 8;
if (!piglit_is_extension_supported("GL_EXT_texture_compression_s3tc")
@@ -273,6 +297,9 @@ piglit_init(int argc, char **argv)
}
puts("Testing S3TC.");
}
+ else {
+ print_usage_and_exit(argv[0]);
+ }
}
init_layer_data(data[0], 18);
--
1.9.3
More information about the Piglit
mailing list