g3dvl: Use sobel filter for chroma interpolation
[mesa/nouveau-pmpeg.git] / src / glsl / test.cpp
blobb1ff92ed1d46d89c7b43a4ea7ca62fdfa57e01d2
1 /*
2 * Copyright © 2011 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 /**
25 * \file test.cpp
27 * Standalone tests for the GLSL compiler.
29 * This file provides a standalone executable which can be used to
30 * test components of the GLSL.
32 * Each test is a function with the same signature as main(). The
33 * main function interprets its first argument as the name of the test
34 * to run, strips out that argument, and then calls the test function.
37 #include <stdio.h>
38 #include <stdlib.h>
39 #include <string.h>
41 #include "test_optpass.h"
43 /**
44 * Print proper usage and exit with failure.
46 static void
47 usage_fail(const char *name)
49 printf("*** usage: %s <command> <options>\n", name);
50 printf("\n");
51 printf("Possible commands are:\n");
52 printf(" optpass: test an optimization pass in isolation\n");
53 exit(EXIT_FAILURE);
56 static const char *extract_command_from_argv(int *argc, char **argv)
58 if (*argc < 2) {
59 usage_fail(argv[0]);
61 const char *command = argv[1];
62 --*argc;
63 memmove(&argv[1], &argv[2], (*argc) * sizeof(argv[1]));
64 return command;
67 int main(int argc, char **argv)
69 const char *command = extract_command_from_argv(&argc, argv);
70 if (strcmp(command, "optpass") == 0) {
71 return test_optpass(argc, argv);
72 } else {
73 usage_fail(argv[0]);
76 /* Execution should never reach here. */
77 return EXIT_FAILURE;