1/*
2 * Copyright © Microsoft Corporation
3 *
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:
10 *
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.
14 *
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 DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24#ifndef D3D12_FORMATS_H
25#define D3D12_FORMATS_H
26
27#include "d3d12_common.h"
28
29#include <directx/dxgiformat.h>
30#include <directx/dxgicommon.h>
31
32#include "pipe/p_format.h"
33#include "pipe/p_defines.h"
34#include "pipe/p_video_enums.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40DXGI_FORMAT
41d3d12_get_format(enum pipe_format format);
42
43DXGI_FORMAT
44d3d12_get_typeless_format(enum pipe_format format);
45
46/* These two are only used for importing external resources without a provided template */
47enum pipe_format
48d3d12_get_pipe_format(DXGI_FORMAT format);
49
50enum pipe_format
51d3d12_get_default_pipe_format(DXGI_FORMAT format);
52
53DXGI_FORMAT
54d3d12_get_resource_srv_format(enum pipe_format f, enum pipe_texture_target target);
55
56DXGI_FORMAT
57d3d12_get_resource_rt_format(enum pipe_format f);
58
59unsigned
60d3d12_non_opaque_plane_count(DXGI_FORMAT f);
61
62struct d3d12_format_info {
63   const enum pipe_swizzle *swizzle;
64   int plane_slice;
65};
66
67struct d3d12_format_info
68d3d12_get_format_info(enum pipe_format resource_format, enum pipe_format format, enum pipe_texture_target);
69
70enum pipe_format
71d3d12_emulated_vtx_format(enum pipe_format fmt);
72
73unsigned
74d3d12_get_format_start_plane(enum pipe_format fmt);
75
76unsigned
77d3d12_get_format_num_planes(enum pipe_format fmt);
78
79DXGI_FORMAT
80d3d12_convert_pipe_video_profile_to_dxgi_format(enum pipe_video_profile profile);
81
82DXGI_COLOR_SPACE_TYPE
83d3d12_convert_from_legacy_color_space(bool rgb, uint32_t bits_per_element, bool studio_rgb, bool p709, bool studio_yuv);
84
85#ifdef __cplusplus
86}
87#endif
88
89#endif
90