• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2 * Copyright (C) 2016 Intel Corporation.   All Rights Reserved.
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 * @file gen_formats.h
24 *
25 * @brief auto-generated file
26 *
27 * DO NOT EDIT
28 *
29 ******************************************************************************/
30 
31 #pragma once
32 
33 #include "common/os.h"
34 
35 //////////////////////////////////////////////////////////////////////////
36 /// SWR_TYPE - Format component type
37 //////////////////////////////////////////////////////////////////////////
38 enum SWR_TYPE
39 {
40     SWR_TYPE_UNKNOWN,
41     SWR_TYPE_UNUSED,
42     SWR_TYPE_UNORM,
43     SWR_TYPE_SNORM,
44     SWR_TYPE_UINT,
45     SWR_TYPE_SINT,
46     SWR_TYPE_FLOAT,
47     SWR_TYPE_SSCALED,
48     SWR_TYPE_USCALED,
49     SWR_TYPE_SFIXED,
50 };
51 
52 //////////////////////////////////////////////////////////////////////////
53 /// SWR_FORMAT
54 //////////////////////////////////////////////////////////////////////////
55 enum SWR_FORMAT
56 {
57     R32G32B32A32_FLOAT          = 0x0,
58     R32G32B32A32_SINT           = 0x1,
59     R32G32B32A32_UINT           = 0x2,
60     R64G64_FLOAT                = 0x5,
61     R32G32B32X32_FLOAT          = 0x6,
62     R32G32B32A32_SSCALED        = 0x7,
63     R32G32B32A32_USCALED        = 0x8,
64     R32G32B32A32_SFIXED         = 0x20,
65     R32G32B32_FLOAT             = 0x40,
66     R32G32B32_SINT              = 0x41,
67     R32G32B32_UINT              = 0x42,
68     R32G32B32_SSCALED           = 0x45,
69     R32G32B32_USCALED           = 0x46,
70     R32G32B32_SFIXED            = 0x50,
71     R16G16B16A16_UNORM          = 0x80,
72     R16G16B16A16_SNORM          = 0x81,
73     R16G16B16A16_SINT           = 0x82,
74     R16G16B16A16_UINT           = 0x83,
75     R16G16B16A16_FLOAT          = 0x84,
76     R32G32_FLOAT                = 0x85,
77     R32G32_SINT                 = 0x86,
78     R32G32_UINT                 = 0x87,
79     R32_FLOAT_X8X24_TYPELESS    = 0x88,
80     X32_TYPELESS_G8X24_UINT     = 0x89,
81     L32A32_FLOAT                = 0x8A,
82     R64_FLOAT                   = 0x8D,
83     R16G16B16X16_UNORM          = 0x8E,
84     R16G16B16X16_FLOAT          = 0x8F,
85     L32X32_FLOAT                = 0x91,
86     I32X32_FLOAT                = 0x92,
87     R16G16B16A16_SSCALED        = 0x93,
88     R16G16B16A16_USCALED        = 0x94,
89     R32G32_SSCALED              = 0x95,
90     R32G32_USCALED              = 0x96,
91     R32G32_SFIXED               = 0xA0,
92     B8G8R8A8_UNORM              = 0xC0,
93     B8G8R8A8_UNORM_SRGB         = 0xC1,
94     R10G10B10A2_UNORM           = 0xC2,
95     R10G10B10A2_UNORM_SRGB      = 0xC3,
96     R10G10B10A2_UINT            = 0xC4,
97     R8G8B8A8_UNORM              = 0xC7,
98     R8G8B8A8_UNORM_SRGB         = 0xC8,
99     R8G8B8A8_SNORM              = 0xC9,
100     R8G8B8A8_SINT               = 0xCA,
101     R8G8B8A8_UINT               = 0xCB,
102     R16G16_UNORM                = 0xCC,
103     R16G16_SNORM                = 0xCD,
104     R16G16_SINT                 = 0xCE,
105     R16G16_UINT                 = 0xCF,
106     R16G16_FLOAT                = 0xD0,
107     B10G10R10A2_UNORM           = 0xD1,
108     B10G10R10A2_UNORM_SRGB      = 0xD2,
109     R11G11B10_FLOAT             = 0xD3,
110     R10G10B10_FLOAT_A2_UNORM    = 0xD5,
111     R32_SINT                    = 0xD6,
112     R32_UINT                    = 0xD7,
113     R32_FLOAT                   = 0xD8,
114     R24_UNORM_X8_TYPELESS       = 0xD9,
115     X24_TYPELESS_G8_UINT        = 0xDA,
116     L32_UNORM                   = 0xDD,
117     L16A16_UNORM                = 0xDF,
118     I24X8_UNORM                 = 0xE0,
119     L24X8_UNORM                 = 0xE1,
120     I32_FLOAT                   = 0xE3,
121     L32_FLOAT                   = 0xE4,
122     A32_FLOAT                   = 0xE5,
123     B8G8R8X8_UNORM              = 0xE9,
124     B8G8R8X8_UNORM_SRGB         = 0xEA,
125     R8G8B8X8_UNORM              = 0xEB,
126     R8G8B8X8_UNORM_SRGB         = 0xEC,
127     R9G9B9E5_SHAREDEXP          = 0xED,
128     B10G10R10X2_UNORM           = 0xEE,
129     L16A16_FLOAT                = 0xF0,
130     R10G10B10X2_USCALED         = 0xF3,
131     R8G8B8A8_SSCALED            = 0xF4,
132     R8G8B8A8_USCALED            = 0xF5,
133     R16G16_SSCALED              = 0xF6,
134     R16G16_USCALED              = 0xF7,
135     R32_SSCALED                 = 0xF8,
136     R32_USCALED                 = 0xF9,
137     B5G6R5_UNORM                = 0x100,
138     B5G6R5_UNORM_SRGB           = 0x101,
139     B5G5R5A1_UNORM              = 0x102,
140     B5G5R5A1_UNORM_SRGB         = 0x103,
141     B4G4R4A4_UNORM              = 0x104,
142     B4G4R4A4_UNORM_SRGB         = 0x105,
143     R8G8_UNORM                  = 0x106,
144     R8G8_SNORM                  = 0x107,
145     R8G8_SINT                   = 0x108,
146     R8G8_UINT                   = 0x109,
147     R16_UNORM                   = 0x10A,
148     R16_SNORM                   = 0x10B,
149     R16_SINT                    = 0x10C,
150     R16_UINT                    = 0x10D,
151     R16_FLOAT                   = 0x10E,
152     I16_UNORM                   = 0x111,
153     L16_UNORM                   = 0x112,
154     A16_UNORM                   = 0x113,
155     L8A8_UNORM                  = 0x114,
156     I16_FLOAT                   = 0x115,
157     L16_FLOAT                   = 0x116,
158     A16_FLOAT                   = 0x117,
159     L8A8_UNORM_SRGB             = 0x118,
160     B5G5R5X1_UNORM              = 0x11A,
161     B5G5R5X1_UNORM_SRGB         = 0x11B,
162     R8G8_SSCALED                = 0x11C,
163     R8G8_USCALED                = 0x11D,
164     R16_SSCALED                 = 0x11E,
165     R16_USCALED                 = 0x11F,
166     A1B5G5R5_UNORM              = 0x124,
167     A4B4G4R4_UNORM              = 0x125,
168     L8A8_UINT                   = 0x126,
169     L8A8_SINT                   = 0x127,
170     R8_UNORM                    = 0x140,
171     R8_SNORM                    = 0x141,
172     R8_SINT                     = 0x142,
173     R8_UINT                     = 0x143,
174     A8_UNORM                    = 0x144,
175     I8_UNORM                    = 0x145,
176     L8_UNORM                    = 0x146,
177     R8_SSCALED                  = 0x149,
178     R8_USCALED                  = 0x14A,
179     L8_UNORM_SRGB               = 0x14C,
180     L8_UINT                     = 0x152,
181     L8_SINT                     = 0x153,
182     I8_UINT                     = 0x154,
183     I8_SINT                     = 0x155,
184     YCRCB_SWAPUVY               = 0x183,
185     BC1_UNORM                   = 0x186,
186     BC2_UNORM                   = 0x187,
187     BC3_UNORM                   = 0x188,
188     BC4_UNORM                   = 0x189,
189     BC5_UNORM                   = 0x18A,
190     BC1_UNORM_SRGB              = 0x18B,
191     BC2_UNORM_SRGB              = 0x18C,
192     BC3_UNORM_SRGB              = 0x18D,
193     YCRCB_SWAPUV                = 0x18F,
194     R8G8B8_UNORM                = 0x193,
195     R8G8B8_SNORM                = 0x194,
196     R8G8B8_SSCALED              = 0x195,
197     R8G8B8_USCALED              = 0x196,
198     R64G64B64A64_FLOAT          = 0x197,
199     R64G64B64_FLOAT             = 0x198,
200     BC4_SNORM                   = 0x199,
201     BC5_SNORM                   = 0x19A,
202     R16G16B16_FLOAT             = 0x19B,
203     R16G16B16_UNORM             = 0x19C,
204     R16G16B16_SNORM             = 0x19D,
205     R16G16B16_SSCALED           = 0x19E,
206     R16G16B16_USCALED           = 0x19F,
207     BC6H_SF16                   = 0x1A1,
208     BC7_UNORM                   = 0x1A2,
209     BC7_UNORM_SRGB              = 0x1A3,
210     BC6H_UF16                   = 0x1A4,
211     R8G8B8_UNORM_SRGB           = 0x1A8,
212     R16G16B16_UINT              = 0x1B0,
213     R16G16B16_SINT              = 0x1B1,
214     R32_SFIXED                  = 0x1B2,
215     R10G10B10A2_SNORM           = 0x1B3,
216     R10G10B10A2_USCALED         = 0x1B4,
217     R10G10B10A2_SSCALED         = 0x1B5,
218     R10G10B10A2_SINT            = 0x1B6,
219     B10G10R10A2_SNORM           = 0x1B7,
220     B10G10R10A2_USCALED         = 0x1B8,
221     B10G10R10A2_SSCALED         = 0x1B9,
222     B10G10R10A2_UINT            = 0x1BA,
223     B10G10R10A2_SINT            = 0x1BB,
224     R8G8B8_UINT                 = 0x1C8,
225     R8G8B8_SINT                 = 0x1C9,
226     RAW                         = 0x1FF,
227     NUM_SWR_FORMATS             = 0x200,
228 };
229 
230 //////////////////////////////////////////////////////////////////////////
231 /// SWR_FORMAT_INFO - Format information
232 //////////////////////////////////////////////////////////////////////////
233 struct SWR_FORMAT_INFO
234 {
235     const char* name;
236     SWR_TYPE    type[4];
237     uint32_t    defaults[4];
238     uint32_t    swizzle[4]; ///< swizzle per component
239     uint32_t    bpc[4];     ///< bits per component
240     uint32_t    bpp;        ///< bits per pixel
241     uint32_t    Bpp;        ///< bytes per pixel
242     uint32_t    numComps;   ///< number of components
243     bool        isSRGB;
244     bool        isBC;
245     bool        isSubsampled;
246     bool        isLuminance;
247     bool        isNormalized[4];
248     float       toFloat[4];
249     uint32_t    bcWidth;
250     uint32_t    bcHeight;
251 };
252 
253 extern const SWR_FORMAT_INFO gFormatInfo[NUM_SWR_FORMATS];
254 
255 //////////////////////////////////////////////////////////////////////////
256 /// @brief Retrieves format info struct for given format.
257 /// @param format - SWR format
GetFormatInfo(SWR_FORMAT format)258 INLINE const SWR_FORMAT_INFO& GetFormatInfo(SWR_FORMAT format)
259 {
260     SWR_ASSERT(format < NUM_SWR_FORMATS, "Invalid Surface Format: %d", format);
261     SWR_ASSERT(gFormatInfo[format].name != nullptr, "Invalid Surface Format: %d", format);
262     return gFormatInfo[format];
263 }
264 
265 // lookup table for unorm8 srgb -> float conversion
266 extern const uint32_t srgb8Table[256];
267 
268