xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/zink/zink_format_test.c (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 #include "zink_format.h"
2 #include "vk_format.h"
3 
4 int
main(int argc,char * argv[])5 main(int argc, char *argv[])
6 {
7    int ret = 0;
8    for (int i = 0; i < PIPE_FORMAT_COUNT; ++i) {
9       enum pipe_format pipe_fmt = i;
10       VkFormat vk_fmt = vk_format_from_pipe_format(i);
11 
12       /* skip unsupported formats */
13       if (vk_fmt == VK_FORMAT_UNDEFINED)
14          continue;
15 
16       enum pipe_format roundtrip = vk_format_to_pipe_format(vk_fmt);
17 
18       /* This one gets aliased to ETC2 rather than round tripping. */
19       if (pipe_fmt == PIPE_FORMAT_ETC1_RGB8 && roundtrip == PIPE_FORMAT_ETC2_RGB8)
20          continue;
21 
22       if (roundtrip != pipe_fmt) {
23          fprintf(stderr, "Format does not roundtrip\n"
24                          "\tgot: %s\n"
25                          "\texpected: %s\n",
26                          util_format_name(roundtrip),
27                          util_format_name(pipe_fmt));
28          ret = 1;
29       }
30    }
31    return ret;
32 }
33