Line data Source code
1 : /* Copyright (C) 2023 Wildfire Games.
2 : * This file is part of 0 A.D.
3 : *
4 : * 0 A.D. is free software: you can redistribute it and/or modify
5 : * it under the terms of the GNU General Public License as published by
6 : * the Free Software Foundation, either version 2 of the License, or
7 : * (at your option) any later version.
8 : *
9 : * 0 A.D. is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : * GNU General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU General Public License
15 : * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 : */
17 :
18 : #ifndef INCLUDED_RENDERER_BACKEND_FORMAT
19 : #define INCLUDED_RENDERER_BACKEND_FORMAT
20 :
21 : namespace Renderer
22 : {
23 :
24 : namespace Backend
25 : {
26 :
27 : enum class Format
28 : {
29 : UNDEFINED,
30 : R8_UNORM,
31 : R8G8_UNORM,
32 : R8G8_UINT,
33 : R8G8B8_UNORM,
34 : R8G8B8A8_UNORM,
35 : R8G8B8A8_UINT,
36 :
37 : // TODO: we need to drop legacy A8 and L8 formats as soon as we have proper
38 : // channel swizzling.
39 : A8_UNORM,
40 : L8_UNORM,
41 :
42 : R16_UNORM,
43 : R16_UINT,
44 : R16_SINT,
45 : R16G16_UNORM,
46 : R16G16_UINT,
47 : R16G16_SINT,
48 :
49 : R32_SFLOAT,
50 : R32G32_SFLOAT,
51 : R32G32B32_SFLOAT,
52 : R32G32B32A32_SFLOAT,
53 :
54 : D16_UNORM,
55 : D24_UNORM,
56 : D24_UNORM_S8_UINT,
57 : D32_SFLOAT,
58 : D32_SFLOAT_S8_UINT,
59 :
60 : BC1_RGB_UNORM,
61 : BC1_RGBA_UNORM,
62 : BC2_UNORM,
63 : BC3_UNORM
64 : };
65 :
66 0 : inline bool IsDepthFormat(const Format format)
67 : {
68 : return
69 0 : format == Format::D16_UNORM ||
70 0 : format == Format::D24_UNORM ||
71 0 : format == Format::D24_UNORM_S8_UINT ||
72 0 : format == Format::D32_SFLOAT ||
73 0 : format == Format::D32_SFLOAT_S8_UINT;
74 : }
75 :
76 : } // namespace Backend
77 :
78 : } // namespace Renderer
79 :
80 : #endif // INCLUDED_RENDERER_BACKEND_FORMAT
|