1bf215546Sopenharmony_ci#include <stdio.h>
2bf215546Sopenharmony_ci#include <stdlib.h>
3bf215546Sopenharmony_ci
4bf215546Sopenharmony_ci#include "util/macros.h"
5bf215546Sopenharmony_ci#include "util/format/u_format.h"
6bf215546Sopenharmony_ci#include "pipe/p_format.h"
7bf215546Sopenharmony_ci
8bf215546Sopenharmony_ciint main(void)
9bf215546Sopenharmony_ci{
10bf215546Sopenharmony_ci   for (enum pipe_format format = 0; format < PIPE_FORMAT_COUNT; format++)
11bf215546Sopenharmony_ci   {
12bf215546Sopenharmony_ci      if (!util_format_is_srgb(format)) {
13bf215546Sopenharmony_ci         const enum pipe_format linear = util_format_linear(format);
14bf215546Sopenharmony_ci         if (format != linear) {
15bf215546Sopenharmony_ci            fprintf(stderr, "%s converted to linear is %s\n",
16bf215546Sopenharmony_ci                    util_format_name(format),
17bf215546Sopenharmony_ci                    util_format_name(linear));
18bf215546Sopenharmony_ci            return EXIT_FAILURE;
19bf215546Sopenharmony_ci         }
20bf215546Sopenharmony_ci         continue;
21bf215546Sopenharmony_ci      }
22bf215546Sopenharmony_ci
23bf215546Sopenharmony_ci      const enum pipe_format linear = util_format_linear(format);
24bf215546Sopenharmony_ci      if (format == linear) {
25bf215546Sopenharmony_ci         fprintf(stderr, "%s can't be converted to a linear equivalent\n",
26bf215546Sopenharmony_ci                 util_format_name(format));
27bf215546Sopenharmony_ci         return EXIT_FAILURE;
28bf215546Sopenharmony_ci      }
29bf215546Sopenharmony_ci
30bf215546Sopenharmony_ci      const enum pipe_format srgb = util_format_srgb(linear);
31bf215546Sopenharmony_ci      if (format != srgb) {
32bf215546Sopenharmony_ci         fprintf(stderr, "%s converted to linear and back to srgb becomes %s\n",
33bf215546Sopenharmony_ci                 util_format_name(format),
34bf215546Sopenharmony_ci                 util_format_name(srgb));
35bf215546Sopenharmony_ci         return EXIT_FAILURE;
36bf215546Sopenharmony_ci      }
37bf215546Sopenharmony_ci   }
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ci   return EXIT_SUCCESS;
40bf215546Sopenharmony_ci}
41