17ec681f3Smrg#include <stdio.h>
27ec681f3Smrg#include <stdlib.h>
37ec681f3Smrg
47ec681f3Smrg#include "util/macros.h"
57ec681f3Smrg#include "util/format/u_format.h"
67ec681f3Smrg#include "pipe/p_format.h"
77ec681f3Smrg
87ec681f3Smrgint main(void)
97ec681f3Smrg{
107ec681f3Smrg   for (enum pipe_format format = 0; format < PIPE_FORMAT_COUNT; format++)
117ec681f3Smrg   {
127ec681f3Smrg      if (!util_format_is_srgb(format)) {
137ec681f3Smrg         const enum pipe_format linear = util_format_linear(format);
147ec681f3Smrg         if (format != linear) {
157ec681f3Smrg            fprintf(stderr, "%s converted to linear is %s\n",
167ec681f3Smrg                    util_format_name(format),
177ec681f3Smrg                    util_format_name(linear));
187ec681f3Smrg            return EXIT_FAILURE;
197ec681f3Smrg         }
207ec681f3Smrg         continue;
217ec681f3Smrg      }
227ec681f3Smrg
237ec681f3Smrg      const enum pipe_format linear = util_format_linear(format);
247ec681f3Smrg      if (format == linear) {
257ec681f3Smrg         fprintf(stderr, "%s can't be converted to a linear equivalent\n",
267ec681f3Smrg                 util_format_name(format));
277ec681f3Smrg         return EXIT_FAILURE;
287ec681f3Smrg      }
297ec681f3Smrg
307ec681f3Smrg      const enum pipe_format srgb = util_format_srgb(linear);
317ec681f3Smrg      if (format != srgb) {
327ec681f3Smrg         fprintf(stderr, "%s converted to linear and back to srgb becomes %s\n",
337ec681f3Smrg                 util_format_name(format),
347ec681f3Smrg                 util_format_name(srgb));
357ec681f3Smrg         return EXIT_FAILURE;
367ec681f3Smrg      }
377ec681f3Smrg   }
387ec681f3Smrg
397ec681f3Smrg   return EXIT_SUCCESS;
407ec681f3Smrg}
41