Merge pull request #26117 from notspiff/infoscanner_inforet_enum_class
[xbmc.git] / xbmc / rendering / dx / DirectXHelper.cpp
blob0636c763b7e011b683dc2f4e1afe9c75996db1eb
1 /*
2 * Copyright (C) 2023 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include <d3d11_4.h>
10 #include <dxgicommon.h>
11 #include <dxgiformat.h>
13 namespace DX
15 const std::string DXGIFormatToString(const DXGI_FORMAT format)
17 #define CASEDXGIFORMAT(format) \
18 case DXGI_FORMAT_##format: \
19 return #format;
21 switch (format)
23 CASEDXGIFORMAT(UNKNOWN)
24 CASEDXGIFORMAT(R32G32B32A32_TYPELESS)
25 CASEDXGIFORMAT(R32G32B32A32_FLOAT)
26 CASEDXGIFORMAT(R32G32B32A32_UINT)
27 CASEDXGIFORMAT(R32G32B32A32_SINT)
28 CASEDXGIFORMAT(R32G32B32_TYPELESS)
29 CASEDXGIFORMAT(R32G32B32_FLOAT)
30 CASEDXGIFORMAT(R32G32B32_UINT)
31 CASEDXGIFORMAT(R32G32B32_SINT)
32 CASEDXGIFORMAT(R16G16B16A16_TYPELESS)
33 CASEDXGIFORMAT(R16G16B16A16_FLOAT)
34 CASEDXGIFORMAT(R16G16B16A16_UNORM)
35 CASEDXGIFORMAT(R16G16B16A16_UINT)
36 CASEDXGIFORMAT(R16G16B16A16_SNORM)
37 CASEDXGIFORMAT(R16G16B16A16_SINT)
38 CASEDXGIFORMAT(R32G32_TYPELESS)
39 CASEDXGIFORMAT(R32G32_FLOAT)
40 CASEDXGIFORMAT(R32G32_UINT)
41 CASEDXGIFORMAT(R32G32_SINT)
42 CASEDXGIFORMAT(R32G8X24_TYPELESS)
43 CASEDXGIFORMAT(D32_FLOAT_S8X24_UINT)
44 CASEDXGIFORMAT(R32_FLOAT_X8X24_TYPELESS)
45 CASEDXGIFORMAT(X32_TYPELESS_G8X24_UINT)
46 CASEDXGIFORMAT(R10G10B10A2_TYPELESS)
47 CASEDXGIFORMAT(R10G10B10A2_UNORM)
48 CASEDXGIFORMAT(R10G10B10A2_UINT)
49 CASEDXGIFORMAT(R11G11B10_FLOAT)
50 CASEDXGIFORMAT(R8G8B8A8_TYPELESS)
51 CASEDXGIFORMAT(R8G8B8A8_UNORM)
52 CASEDXGIFORMAT(R8G8B8A8_UNORM_SRGB)
53 CASEDXGIFORMAT(R8G8B8A8_UINT)
54 CASEDXGIFORMAT(R8G8B8A8_SNORM)
55 CASEDXGIFORMAT(R8G8B8A8_SINT)
56 CASEDXGIFORMAT(R16G16_TYPELESS)
57 CASEDXGIFORMAT(R16G16_FLOAT)
58 CASEDXGIFORMAT(R16G16_UNORM)
59 CASEDXGIFORMAT(R16G16_UINT)
60 CASEDXGIFORMAT(R16G16_SNORM)
61 CASEDXGIFORMAT(R16G16_SINT)
62 CASEDXGIFORMAT(R32_TYPELESS)
63 CASEDXGIFORMAT(D32_FLOAT)
64 CASEDXGIFORMAT(R32_FLOAT)
65 CASEDXGIFORMAT(R32_UINT)
66 CASEDXGIFORMAT(R32_SINT)
67 CASEDXGIFORMAT(R24G8_TYPELESS)
68 CASEDXGIFORMAT(D24_UNORM_S8_UINT)
69 CASEDXGIFORMAT(R24_UNORM_X8_TYPELESS)
70 CASEDXGIFORMAT(X24_TYPELESS_G8_UINT)
71 CASEDXGIFORMAT(R8G8_TYPELESS)
72 CASEDXGIFORMAT(R8G8_UNORM)
73 CASEDXGIFORMAT(R8G8_UINT)
74 CASEDXGIFORMAT(R8G8_SNORM)
75 CASEDXGIFORMAT(R8G8_SINT)
76 CASEDXGIFORMAT(R16_TYPELESS)
77 CASEDXGIFORMAT(R16_FLOAT)
78 CASEDXGIFORMAT(D16_UNORM)
79 CASEDXGIFORMAT(R16_UNORM)
80 CASEDXGIFORMAT(R16_UINT)
81 CASEDXGIFORMAT(R16_SNORM)
82 CASEDXGIFORMAT(R16_SINT)
83 CASEDXGIFORMAT(R8_TYPELESS)
84 CASEDXGIFORMAT(R8_UNORM)
85 CASEDXGIFORMAT(R8_UINT)
86 CASEDXGIFORMAT(R8_SNORM)
87 CASEDXGIFORMAT(R8_SINT)
88 CASEDXGIFORMAT(A8_UNORM)
89 CASEDXGIFORMAT(R1_UNORM)
90 CASEDXGIFORMAT(R9G9B9E5_SHAREDEXP)
91 CASEDXGIFORMAT(R8G8_B8G8_UNORM)
92 CASEDXGIFORMAT(BC1_TYPELESS)
93 CASEDXGIFORMAT(BC1_UNORM)
94 CASEDXGIFORMAT(BC1_UNORM_SRGB)
95 CASEDXGIFORMAT(BC2_TYPELESS)
96 CASEDXGIFORMAT(BC2_UNORM)
97 CASEDXGIFORMAT(BC2_UNORM_SRGB)
98 CASEDXGIFORMAT(BC3_TYPELESS)
99 CASEDXGIFORMAT(BC3_UNORM)
100 CASEDXGIFORMAT(BC3_UNORM_SRGB)
101 CASEDXGIFORMAT(BC4_TYPELESS)
102 CASEDXGIFORMAT(BC4_UNORM)
103 CASEDXGIFORMAT(BC4_SNORM)
104 CASEDXGIFORMAT(BC5_TYPELESS)
105 CASEDXGIFORMAT(BC5_UNORM)
106 CASEDXGIFORMAT(BC5_SNORM)
107 CASEDXGIFORMAT(B5G6R5_UNORM)
108 CASEDXGIFORMAT(B5G5R5A1_UNORM)
109 CASEDXGIFORMAT(B8G8R8A8_UNORM)
110 CASEDXGIFORMAT(B8G8R8X8_UNORM)
111 CASEDXGIFORMAT(R10G10B10_XR_BIAS_A2_UNORM)
112 CASEDXGIFORMAT(B8G8R8A8_TYPELESS)
113 CASEDXGIFORMAT(B8G8R8A8_UNORM_SRGB)
114 CASEDXGIFORMAT(B8G8R8X8_TYPELESS)
115 CASEDXGIFORMAT(B8G8R8X8_UNORM_SRGB)
116 CASEDXGIFORMAT(BC6H_TYPELESS)
117 CASEDXGIFORMAT(BC6H_UF16)
118 CASEDXGIFORMAT(BC6H_SF16)
119 CASEDXGIFORMAT(BC7_TYPELESS)
120 CASEDXGIFORMAT(BC7_UNORM)
121 CASEDXGIFORMAT(BC7_UNORM_SRGB)
122 CASEDXGIFORMAT(AYUV)
123 CASEDXGIFORMAT(Y410)
124 CASEDXGIFORMAT(Y416)
125 CASEDXGIFORMAT(NV12)
126 CASEDXGIFORMAT(P010)
127 CASEDXGIFORMAT(P016)
128 CASEDXGIFORMAT(420_OPAQUE)
129 CASEDXGIFORMAT(YUY2)
130 CASEDXGIFORMAT(Y210)
131 CASEDXGIFORMAT(Y216)
132 CASEDXGIFORMAT(NV11)
133 CASEDXGIFORMAT(AI44)
134 CASEDXGIFORMAT(IA44)
135 CASEDXGIFORMAT(P8)
136 CASEDXGIFORMAT(A8P8)
137 CASEDXGIFORMAT(B4G4R4A4_UNORM)
138 CASEDXGIFORMAT(P208)
139 CASEDXGIFORMAT(V208)
140 CASEDXGIFORMAT(V408)
141 default:
142 return std::to_string(format);
144 #undef CASEDXGIFORMAT
147 const std::string DXGIColorSpaceTypeToString(DXGI_COLOR_SPACE_TYPE type)
149 #define CASEDXGICOLORSPACETYPE(type) \
150 case DXGI_COLOR_SPACE_##type: \
151 return #type;
153 switch (type)
155 CASEDXGICOLORSPACETYPE(RGB_FULL_G22_NONE_P709)
156 CASEDXGICOLORSPACETYPE(RGB_FULL_G10_NONE_P709)
157 CASEDXGICOLORSPACETYPE(RGB_STUDIO_G22_NONE_P709)
158 CASEDXGICOLORSPACETYPE(RGB_STUDIO_G22_NONE_P2020)
159 CASEDXGICOLORSPACETYPE(RESERVED)
160 CASEDXGICOLORSPACETYPE(YCBCR_FULL_G22_NONE_P709_X601)
161 CASEDXGICOLORSPACETYPE(YCBCR_STUDIO_G22_LEFT_P601)
162 CASEDXGICOLORSPACETYPE(YCBCR_FULL_G22_LEFT_P601)
163 CASEDXGICOLORSPACETYPE(YCBCR_STUDIO_G22_LEFT_P709)
164 CASEDXGICOLORSPACETYPE(YCBCR_FULL_G22_LEFT_P709)
165 CASEDXGICOLORSPACETYPE(YCBCR_STUDIO_G22_LEFT_P2020)
166 CASEDXGICOLORSPACETYPE(YCBCR_FULL_G22_LEFT_P2020)
167 CASEDXGICOLORSPACETYPE(RGB_FULL_G2084_NONE_P2020)
168 CASEDXGICOLORSPACETYPE(YCBCR_STUDIO_G2084_LEFT_P2020)
169 CASEDXGICOLORSPACETYPE(RGB_STUDIO_G2084_NONE_P2020)
170 CASEDXGICOLORSPACETYPE(YCBCR_STUDIO_G22_TOPLEFT_P2020)
171 CASEDXGICOLORSPACETYPE(YCBCR_STUDIO_G2084_TOPLEFT_P2020)
172 CASEDXGICOLORSPACETYPE(RGB_FULL_G22_NONE_P2020)
173 CASEDXGICOLORSPACETYPE(YCBCR_STUDIO_GHLG_TOPLEFT_P2020)
174 CASEDXGICOLORSPACETYPE(YCBCR_FULL_GHLG_TOPLEFT_P2020)
175 CASEDXGICOLORSPACETYPE(RGB_STUDIO_G24_NONE_P709)
176 CASEDXGICOLORSPACETYPE(RGB_STUDIO_G24_NONE_P2020)
177 CASEDXGICOLORSPACETYPE(YCBCR_STUDIO_G24_LEFT_P709)
178 CASEDXGICOLORSPACETYPE(YCBCR_STUDIO_G24_LEFT_P2020)
179 CASEDXGICOLORSPACETYPE(YCBCR_STUDIO_G24_TOPLEFT_P2020)
180 default:
181 return std::to_string(type);
183 #undef CASEDXGICOLORSPACETYPE
186 const std::string D3D11VideoProcessorFormatSupportToString(
187 D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT value)
189 switch (value)
191 case D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT:
192 return "input";
193 case D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT:
194 return "output";
195 default:
196 return std::to_string(value);
199 } // namespace DX