-
-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathGraphicsFormat.py
More file actions
277 lines (248 loc) · 9.44 KB
/
GraphicsFormat.py
File metadata and controls
277 lines (248 loc) · 9.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
from enum import IntEnum
from .TextureFormat import TextureFormat
class GraphicsFormat(IntEnum):
NONE = 0
R8_SRGB = 1
R8G8_SRGB = 2
R8G8B8_SRGB = 3
R8G8B8A8_SRGB = 4
R8_UNorm = 5
R8G8_UNorm = 6
R8G8B8_UNorm = 7
R8G8B8A8_UNorm = 8
R8_SNorm = 9
R8G8_SNorm = 10
R8G8B8_SNorm = 11
R8G8B8A8_SNorm = 12
R8_UInt = 13
R8G8_UInt = 14
R8G8B8_UInt = 15
R8G8B8A8_UInt = 16
R8_SInt = 17
R8G8_SInt = 18
R8G8B8_SInt = 19
R8G8B8A8_SInt = 20
R16_UNorm = 21
R16G16_UNorm = 22
R16G16B16_UNorm = 23
R16G16B16A16_UNorm = 24
R16_SNorm = 25
R16G16_SNorm = 26
R16G16B16_SNorm = 27
R16G16B16A16_SNorm = 28
R16_UInt = 29
R16G16_UInt = 30
R16G16B16_UInt = 31
R16G16B16A16_UInt = 32
R16_SInt = 33
R16G16_SInt = 34
R16G16B16_SInt = 35
R16G16B16A16_SInt = 36
R32_UInt = 37
R32G32_UInt = 38
R32G32B32_UInt = 39
R32G32B32A32_UInt = 40
R32_SInt = 41
R32G32_SInt = 42
R32G32B32_SInt = 43
R32G32B32A32_SInt = 44
R16_SFloat = 45
R16G16_SFloat = 46
R16G16B16_SFloat = 47
R16G16B16A16_SFloat = 48
R32_SFloat = 49
R32G32_SFloat = 50
R32G32B32_SFloat = 51
R32G32B32A32_SFloat = 52
B8G8R8_SRGB = 56
B8G8R8A8_SRGB = 57
B8G8R8_UNorm = 58
B8G8R8A8_UNorm = 59
B8G8R8_SNorm = 60
B8G8R8A8_SNorm = 61
B8G8R8_UInt = 62
B8G8R8A8_UInt = 63
B8G8R8_SInt = 64
B8G8R8A8_SInt = 65
R4G4B4A4_UNormPack16 = 66
B4G4R4A4_UNormPack16 = 67
R5G6B5_UNormPack16 = 68
B5G6R5_UNormPack16 = 69
R5G5B5A1_UNormPack16 = 70
B5G5R5A1_UNormPack16 = 71
A1R5G5B5_UNormPack16 = 72
E5B9G9R9_UFloatPack32 = 73
B10G11R11_UFloatPack32 = 74
A2B10G10R10_UNormPack32 = 75
A2B10G10R10_UIntPack32 = 76
A2B10G10R10_SIntPack32 = 77
A2R10G10B10_UNormPack32 = 78
A2R10G10B10_UIntPack32 = 79
A2R10G10B10_SIntPack32 = 80
A2R10G10B10_XRSRGBPack32 = 81
A2R10G10B10_XRUNormPack32 = 82
R10G10B10_XRSRGBPack32 = 83
R10G10B10_XRUNormPack32 = 84
A10R10G10B10_XRSRGBPack32 = 85
A10R10G10B10_XRUNormPack32 = 86
D16_UNorm = 90
D24_UNorm = 91
D24_UNorm_S8_UInt = 92
D32_SFloat = 93
D32_SFloat_S8_UInt = 94
S8_UInt = 95
RGB_DXT1_SRGB = 96
RGBA_DXT1_SRGB = 96
RGB_DXT1_UNorm = 97
RGBA_DXT1_UNorm = 97
RGBA_DXT3_SRGB = 98
RGBA_DXT3_UNorm = 99
RGBA_DXT5_SRGB = 100
RGBA_DXT5_UNorm = 101
R_BC4_UNorm = 102
R_BC4_SNorm = 103
RG_BC5_UNorm = 104
RG_BC5_SNorm = 105
RGB_BC6H_UFloat = 106
RGB_BC6H_SFloat = 107
RGBA_BC7_SRGB = 108
RGBA_BC7_UNorm = 109
RGB_PVRTC_2Bpp_SRGB = 110
RGB_PVRTC_2Bpp_UNorm = 111
RGB_PVRTC_4Bpp_SRGB = 112
RGB_PVRTC_4Bpp_UNorm = 113
RGBA_PVRTC_2Bpp_SRGB = 114
RGBA_PVRTC_2Bpp_UNorm = 115
RGBA_PVRTC_4Bpp_SRGB = 116
RGBA_PVRTC_4Bpp_UNorm = 117
RGB_ETC_UNorm = 118
RGB_ETC2_SRGB = 119
RGB_ETC2_UNorm = 120
RGB_A1_ETC2_SRGB = 121
RGB_A1_ETC2_UNorm = 122
RGBA_ETC2_SRGB = 123
RGBA_ETC2_UNorm = 124
R_EAC_UNorm = 125
R_EAC_SNorm = 126
RG_EAC_UNorm = 127
RG_EAC_SNorm = 128
RGBA_ASTC4X4_SRGB = 129
RGBA_ASTC4X4_UNorm = 130
RGBA_ASTC5X5_SRGB = 131
RGBA_ASTC5X5_UNorm = 132
RGBA_ASTC6X6_SRGB = 133
RGBA_ASTC6X6_UNorm = 134
RGBA_ASTC8X8_SRGB = 135
RGBA_ASTC8X8_UNorm = 136
RGBA_ASTC10X10_SRGB = 137
RGBA_ASTC10X10_UNorm = 138
RGBA_ASTC12X12_SRGB = 139
RGBA_ASTC12X12_UNorm = 140
YUV2 = 141
RGBA_ASTC4X4_UFloat = 145
RGBA_ASTC5X5_UFloat = 146
RGBA_ASTC6X6_UFloat = 147
RGBA_ASTC8X8_UFloat = 148
RGBA_ASTC10X10_UFloat = 149
RGBA_ASTC12X12_UFloat = 150
D16_UNorm_S8_UInt = 151
# very experimental & untested
GRAPHICS_TO_TEXTURE_MAP = {
GraphicsFormat.R8_SRGB: TextureFormat.R8,
GraphicsFormat.R8G8_SRGB: TextureFormat.RG16,
GraphicsFormat.R8G8B8_SRGB: TextureFormat.RGB24,
GraphicsFormat.R8G8B8A8_SRGB: TextureFormat.RGBA32,
GraphicsFormat.R8_UNorm: TextureFormat.R8,
GraphicsFormat.R8G8_UNorm: TextureFormat.RG16,
GraphicsFormat.R8G8B8_UNorm: TextureFormat.RGB24,
GraphicsFormat.R8G8B8A8_UNorm: TextureFormat.RGBA32,
GraphicsFormat.R8_SNorm: TextureFormat.R8_SIGNED,
GraphicsFormat.R8G8_SNorm: TextureFormat.RG16_SIGNED,
GraphicsFormat.R8G8B8_SNorm: TextureFormat.RGB24_SIGNED,
GraphicsFormat.R8G8B8A8_SNorm: TextureFormat.RGBA32_SIGNED,
GraphicsFormat.R8_UInt: TextureFormat.R16,
GraphicsFormat.R8G8_UInt: TextureFormat.RG32,
GraphicsFormat.R8G8B8_UInt: TextureFormat.RGB48,
GraphicsFormat.R8G8B8A8_UInt: TextureFormat.RGBA64,
GraphicsFormat.R8_SInt: TextureFormat.R16_SIGNED,
GraphicsFormat.R8G8_SInt: TextureFormat.RG32_SIGNED,
GraphicsFormat.R8G8B8_SInt: TextureFormat.RGB48_SIGNED,
GraphicsFormat.R8G8B8A8_SInt: TextureFormat.RGBA64_SIGNED,
GraphicsFormat.R16_UNorm: TextureFormat.R16,
GraphicsFormat.R16G16_UNorm: TextureFormat.RG32,
GraphicsFormat.R16G16B16_UNorm: TextureFormat.RGB48,
GraphicsFormat.R16G16B16A16_UNorm: TextureFormat.RGBA64,
GraphicsFormat.R16_SNorm: TextureFormat.R16_SIGNED,
GraphicsFormat.R16G16_SNorm: TextureFormat.RG32_SIGNED,
GraphicsFormat.R16G16B16_SNorm: TextureFormat.RGB48_SIGNED,
GraphicsFormat.R16G16B16A16_SNorm: TextureFormat.RGBA64_SIGNED,
GraphicsFormat.R16_UInt: TextureFormat.R16,
GraphicsFormat.R16G16_UInt: TextureFormat.RG32,
GraphicsFormat.R16G16B16_UInt: TextureFormat.RGB48,
GraphicsFormat.R16G16B16A16_UInt: TextureFormat.RGBA64,
GraphicsFormat.R16_SInt: TextureFormat.R16_SIGNED,
GraphicsFormat.R16G16_SInt: TextureFormat.RG32_SIGNED,
GraphicsFormat.R16G16B16_SInt: TextureFormat.RGB48_SIGNED,
GraphicsFormat.R16G16B16A16_SInt: TextureFormat.RGBA64_SIGNED,
GraphicsFormat.B8G8R8_SRGB: TextureFormat.BGR24,
GraphicsFormat.B8G8R8A8_SRGB: TextureFormat.BGRA32,
GraphicsFormat.B8G8R8_UNorm: TextureFormat.BGR24,
GraphicsFormat.B8G8R8A8_UNorm: TextureFormat.BGRA32,
# GraphicsFormat.B8G8R8_SNorm: TextureFormat.BGR24_SIGNED,
# GraphicsFormat.B8G8R8A8_SNorm: TextureFormat.BGRA32_SIGNED,
# GraphicsFormat.B8G8R8_UInt: TextureFormat.BGR48,
GraphicsFormat.RGB_DXT1_SRGB: TextureFormat.DXT1,
GraphicsFormat.RGBA_DXT1_SRGB: TextureFormat.DXT1,
GraphicsFormat.RGB_DXT1_UNorm: TextureFormat.DXT1,
GraphicsFormat.RGBA_DXT1_UNorm: TextureFormat.DXT1,
GraphicsFormat.RGBA_DXT3_SRGB: TextureFormat.DXT3,
GraphicsFormat.RGBA_DXT3_UNorm: TextureFormat.DXT3,
GraphicsFormat.RGBA_DXT5_SRGB: TextureFormat.DXT5,
GraphicsFormat.RGBA_DXT5_UNorm: TextureFormat.DXT5,
GraphicsFormat.R_BC4_UNorm: TextureFormat.BC4,
# GraphicsFormat.R_BC4_SNorm: TextureFormat.BC4_SIGNED,
GraphicsFormat.RG_BC5_UNorm: TextureFormat.BC5,
# GraphicsFormat.RG_BC5_SNorm: TextureFormat.BC5_SIGNED,
GraphicsFormat.RGB_BC6H_UFloat: TextureFormat.BC6H,
# GraphicsFormat.RGB_BC6H_SFloat: TextureFormat.BC6H_SIGNED,
GraphicsFormat.RGBA_BC7_SRGB: TextureFormat.BC7,
GraphicsFormat.RGBA_BC7_UNorm: TextureFormat.BC7,
GraphicsFormat.RGB_PVRTC_2Bpp_SRGB: TextureFormat.PVRTC_RGB2,
GraphicsFormat.RGB_PVRTC_2Bpp_UNorm: TextureFormat.PVRTC_RGB2,
GraphicsFormat.RGB_PVRTC_4Bpp_SRGB: TextureFormat.PVRTC_RGB4,
GraphicsFormat.RGB_PVRTC_4Bpp_UNorm: TextureFormat.PVRTC_RGB4,
GraphicsFormat.RGBA_PVRTC_2Bpp_SRGB: TextureFormat.PVRTC_RGBA2,
GraphicsFormat.RGBA_PVRTC_2Bpp_UNorm: TextureFormat.PVRTC_RGBA2,
GraphicsFormat.RGBA_PVRTC_4Bpp_SRGB: TextureFormat.PVRTC_RGBA4,
GraphicsFormat.RGBA_PVRTC_4Bpp_UNorm: TextureFormat.PVRTC_RGBA4,
GraphicsFormat.RGB_ETC_UNorm: TextureFormat.ETC_RGB4,
GraphicsFormat.RGB_ETC2_SRGB: TextureFormat.ETC2_RGB,
GraphicsFormat.RGB_ETC2_UNorm: TextureFormat.ETC2_RGB,
GraphicsFormat.RGB_A1_ETC2_SRGB: TextureFormat.ETC2_RGBA1,
GraphicsFormat.RGB_A1_ETC2_UNorm: TextureFormat.ETC2_RGBA1,
GraphicsFormat.RGBA_ETC2_SRGB: TextureFormat.ETC2_RGBA8,
GraphicsFormat.RGBA_ETC2_UNorm: TextureFormat.ETC2_RGBA8,
GraphicsFormat.R_EAC_UNorm: TextureFormat.EAC_R,
GraphicsFormat.R_EAC_SNorm: TextureFormat.EAC_R_SIGNED,
GraphicsFormat.RG_EAC_UNorm: TextureFormat.EAC_RG,
GraphicsFormat.RG_EAC_SNorm: TextureFormat.EAC_RG_SIGNED,
GraphicsFormat.RGBA_ASTC4X4_SRGB: TextureFormat.ASTC_RGBA_4x4,
GraphicsFormat.RGBA_ASTC4X4_UNorm: TextureFormat.ASTC_RGBA_4x4,
GraphicsFormat.RGBA_ASTC5X5_SRGB: TextureFormat.ASTC_RGBA_5x5,
GraphicsFormat.RGBA_ASTC5X5_UNorm: TextureFormat.ASTC_RGBA_5x5,
GraphicsFormat.RGBA_ASTC6X6_SRGB: TextureFormat.ASTC_RGBA_6x6,
GraphicsFormat.RGBA_ASTC6X6_UNorm: TextureFormat.ASTC_RGBA_6x6,
GraphicsFormat.RGBA_ASTC8X8_SRGB: TextureFormat.ASTC_RGBA_8x8,
GraphicsFormat.RGBA_ASTC8X8_UNorm: TextureFormat.ASTC_RGBA_8x8,
GraphicsFormat.RGBA_ASTC10X10_SRGB: TextureFormat.ASTC_RGBA_10x10,
GraphicsFormat.RGBA_ASTC10X10_UNorm: TextureFormat.ASTC_RGBA_10x10,
GraphicsFormat.RGBA_ASTC12X12_SRGB: TextureFormat.ASTC_RGBA_12x12,
GraphicsFormat.RGBA_ASTC12X12_UNorm: TextureFormat.ASTC_RGBA_12x12,
GraphicsFormat.YUV2: TextureFormat.YUY2,
# GraphicsFormat.RGBA_ASTC4X4_UFloat: TextureFormat.ASTC_RGBA_4x4,
# GraphicsFormat.RGBA_ASTC5X5_UFloat: TextureFormat.ASTC_RGBA_5x5,
# GraphicsFormat.RGBA_ASTC6X6_UFloat: TextureFormat.ASTC_RGBA_6x6,
# GraphicsFormat.RGBA_ASTC8X8_UFloat: TextureFormat.ASTC_RGBA_8x8,
# GraphicsFormat.RGBA_ASTC10X10_UFloat: TextureFormat.ASTC_RGBA_10x10,
# GraphicsFormat.RGBA_ASTC12X12_UFloat: TextureFormat.ASTC_RGBA_12x12,
}