1 /**************************************************************************
3 * Copyright 2007 VMware, Inc.
4 * Copyright (c) 2008-2010 VMware, Inc.
5 * Copyright (c) 2019 Google, LLC
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
24 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 **************************************************************************/
30 #include "pipe/p_context.h"
31 #include "pipe/p_screen.h"
32 #include "state_tracker/st_context.h"
33 #include "state_tracker/st_format.h"
34 #include "state_tracker/st_texture.h"
35 #include "util/u_format.h"
39 is_format_supported(struct pipe_screen
*pscreen
,
40 enum pipe_format format
,
41 enum pipe_texture_target target
,
42 unsigned sample_count
,
43 unsigned storage_sample_count
,
49 int main(int argc
, char **argv
)
51 struct pipe_screen screen
= {
52 .is_format_supported
= is_format_supported
,
54 struct pipe_context pctx
= {
57 struct st_context local_st
= {
60 struct st_context
*st
= &local_st
;
64 /* test all Mesa formats */
65 for (i
= 1; i
< MESA_FORMAT_COUNT
; i
++) {
68 if (st_compressed_format_fallback(st
, i
))
71 pf
= st_mesa_format_to_pipe_format(st
, i
);
72 if (pf
!= PIPE_FORMAT_NONE
) {
73 mesa_format MAYBE_UNUSED mf
= st_pipe_format_to_mesa_format(pf
);
75 fprintf(stderr
, "Round-tripping %s -> %s -> %s failed\n",
76 _mesa_get_format_name(i
), util_format_short_name(pf
),
77 _mesa_get_format_name(mf
));
83 /* Test all Gallium formats */
84 for (i
= 1; i
< PIPE_FORMAT_COUNT
; i
++) {
85 mesa_format mf
= st_pipe_format_to_mesa_format(i
);
86 if (st_compressed_format_fallback(st
, mf
))
89 if (mf
!= MESA_FORMAT_NONE
) {
90 enum pipe_format MAYBE_UNUSED pf
=
91 st_mesa_format_to_pipe_format(st
, mf
);
93 fprintf(stderr
, "Round-tripping %s -> %s -> %s failed\n",
94 util_format_short_name(i
),
95 _mesa_get_format_name(pf
),
96 util_format_short_name(pf
));