vkImageUtil.cpp revision 3d2071b82061ee418aa87064333069281133edda
1/*-------------------------------------------------------------------------
2 * Vulkan CTS Framework
3 * --------------------
4 *
5 * Copyright (c) 2015 The Khronos Group Inc.
6 * Copyright (c) 2015 Imagination Technologies Ltd.
7 * Copyright (c) 2015 Google Inc.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and/or associated documentation files (the
11 * "Materials"), to deal in the Materials without restriction, including
12 * without limitation the rights to use, copy, modify, merge, publish,
13 * distribute, sublicense, and/or sell copies of the Materials, and to
14 * permit persons to whom the Materials are furnished to do so, subject to
15 * the following conditions:
16 *
17 * The above copyright notice(s) and this permission notice shall be
18 * included in all copies or substantial portions of the Materials.
19 *
20 * The Materials are Confidential Information as defined by the
21 * Khronos Membership Agreement until designated non-confidential by
22 * Khronos, at which point this condition clause shall be removed.
23 *
24 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
27 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
28 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
29 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
30 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
31 *
32 *//*!
33 * \file
34 * \brief Utilities for images.
35 *//*--------------------------------------------------------------------*/
36
37#include "vkImageUtil.hpp"
38#include "tcuTextureUtil.hpp"
39
40namespace vk
41{
42
43bool isFloatFormat (VkFormat format)
44{
45	return tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_FLOATING_POINT;
46}
47
48bool isUnormFormat (VkFormat format)
49{
50	return tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT;
51}
52
53bool isSnormFormat (VkFormat format)
54{
55	return tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT;
56}
57
58bool isIntFormat (VkFormat format)
59{
60	return tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER;
61}
62
63bool isUintFormat (VkFormat format)
64{
65	return tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER;
66}
67
68bool isDepthStencilFormat (VkFormat format)
69{
70	const tcu::TextureFormat tcuFormat = mapVkFormat(format);
71	return tcuFormat.order == tcu::TextureFormat::D || tcuFormat.order == tcu::TextureFormat::S || tcuFormat.order == tcu::TextureFormat::DS;
72}
73
74bool isCompressedFormat (VkFormat format)
75{
76	switch (format)
77	{
78		case VK_FORMAT_BC1_RGBA_SRGB:
79		case VK_FORMAT_BC1_RGBA_UNORM:
80		case VK_FORMAT_BC1_RGB_SRGB:
81		case VK_FORMAT_BC1_RGB_UNORM:
82		case VK_FORMAT_BC2_UNORM:
83		case VK_FORMAT_BC2_SRGB:
84		case VK_FORMAT_BC3_UNORM:
85		case VK_FORMAT_BC3_SRGB:
86		case VK_FORMAT_BC4_UNORM:
87		case VK_FORMAT_BC4_SNORM:
88		case VK_FORMAT_BC5_UNORM:
89		case VK_FORMAT_BC5_SNORM:
90		case VK_FORMAT_BC6H_UFLOAT:
91		case VK_FORMAT_BC6H_SFLOAT:
92		case VK_FORMAT_BC7_UNORM:
93		case VK_FORMAT_BC7_SRGB:
94		case VK_FORMAT_ETC2_R8G8B8_UNORM:
95		case VK_FORMAT_ETC2_R8G8B8A1_UNORM:
96		case VK_FORMAT_ETC2_R8G8B8A8_UNORM:
97		case VK_FORMAT_EAC_R11_UNORM:
98		case VK_FORMAT_EAC_R11_SNORM:
99		case VK_FORMAT_EAC_R11G11_UNORM:
100		case VK_FORMAT_EAC_R11G11_SNORM:
101		case VK_FORMAT_ASTC_4x4_UNORM:
102		case VK_FORMAT_ASTC_4x4_SRGB:
103		case VK_FORMAT_ASTC_5x4_UNORM:
104		case VK_FORMAT_ASTC_5x4_SRGB:
105		case VK_FORMAT_ASTC_5x5_UNORM:
106		case VK_FORMAT_ASTC_5x5_SRGB:
107		case VK_FORMAT_ASTC_6x5_UNORM:
108		case VK_FORMAT_ASTC_6x5_SRGB:
109		case VK_FORMAT_ASTC_6x6_UNORM:
110		case VK_FORMAT_ASTC_6x6_SRGB:
111		case VK_FORMAT_ASTC_8x5_UNORM:
112		case VK_FORMAT_ASTC_8x5_SRGB:
113		case VK_FORMAT_ASTC_8x6_UNORM:
114		case VK_FORMAT_ASTC_8x6_SRGB:
115		case VK_FORMAT_ASTC_8x8_UNORM:
116		case VK_FORMAT_ASTC_8x8_SRGB:
117		case VK_FORMAT_ASTC_10x5_UNORM:
118		case VK_FORMAT_ASTC_10x5_SRGB:
119		case VK_FORMAT_ASTC_10x6_UNORM:
120		case VK_FORMAT_ASTC_10x6_SRGB:
121		case VK_FORMAT_ASTC_10x8_UNORM:
122		case VK_FORMAT_ASTC_10x8_SRGB:
123		case VK_FORMAT_ASTC_10x10_UNORM:
124		case VK_FORMAT_ASTC_10x10_SRGB:
125		case VK_FORMAT_ASTC_12x10_UNORM:
126		case VK_FORMAT_ASTC_12x10_SRGB:
127		case VK_FORMAT_ASTC_12x12_UNORM:
128		case VK_FORMAT_ASTC_12x12_SRGB:
129			return true;
130		default:
131			break;
132	}
133	return false;
134}
135
136VkFormat mapTextureFormat (const tcu::TextureFormat& format)
137{
138	DE_STATIC_ASSERT(tcu::TextureFormat::CHANNELORDER_LAST < (1<<16));
139	DE_STATIC_ASSERT(tcu::TextureFormat::CHANNELTYPE_LAST < (1<<16));
140
141#define PACK_FMT(ORDER, TYPE) ((int(ORDER) << 16) | int(TYPE))
142#define FMT_CASE(ORDER, TYPE) PACK_FMT(tcu::TextureFormat::ORDER, tcu::TextureFormat::TYPE)
143
144	switch (PACK_FMT(format.order, format.type))
145	{
146		case FMT_CASE(RGB, UNORM_SHORT_565):				return VK_FORMAT_R5G6B5_UNORM;
147		case FMT_CASE(RGBA, UNORM_SHORT_5551):				return VK_FORMAT_R5G5B5A1_UNORM;
148
149		case FMT_CASE(R, UNORM_INT8):						return VK_FORMAT_R8_UNORM;
150		case FMT_CASE(R, SNORM_INT8):						return VK_FORMAT_R8_SNORM;
151		case FMT_CASE(R, UNSIGNED_INT8):					return VK_FORMAT_R8_UINT;
152		case FMT_CASE(R, SIGNED_INT8):						return VK_FORMAT_R8_SINT;
153		case FMT_CASE(sR, UNORM_INT8):						return VK_FORMAT_R8_SRGB;
154
155		case FMT_CASE(RG, UNORM_INT8):						return VK_FORMAT_R8G8_UNORM;
156		case FMT_CASE(RG, SNORM_INT8):						return VK_FORMAT_R8G8_SNORM;
157		case FMT_CASE(RG, UNSIGNED_INT8):					return VK_FORMAT_R8G8_UINT;
158		case FMT_CASE(RG, SIGNED_INT8):						return VK_FORMAT_R8G8_SINT;
159		case FMT_CASE(sRG, UNORM_INT8):						return VK_FORMAT_R8G8_SRGB;
160
161		case FMT_CASE(RGB, UNORM_INT8):						return VK_FORMAT_R8G8B8_UNORM;
162		case FMT_CASE(RGB, SNORM_INT8):						return VK_FORMAT_R8G8B8_SNORM;
163		case FMT_CASE(RGB, UNSIGNED_INT8):					return VK_FORMAT_R8G8B8_UINT;
164		case FMT_CASE(RGB, SIGNED_INT8):					return VK_FORMAT_R8G8B8_SINT;
165		case FMT_CASE(sRGB, UNORM_INT8):					return VK_FORMAT_R8G8B8_SRGB;
166
167		case FMT_CASE(RGBA, UNORM_INT8):					return VK_FORMAT_R8G8B8A8_UNORM;
168		case FMT_CASE(RGBA, SNORM_INT8):					return VK_FORMAT_R8G8B8A8_SNORM;
169		case FMT_CASE(RGBA, UNSIGNED_INT8):					return VK_FORMAT_R8G8B8A8_UINT;
170		case FMT_CASE(RGBA, SIGNED_INT8):					return VK_FORMAT_R8G8B8A8_SINT;
171		case FMT_CASE(sRGBA, UNORM_INT8):					return VK_FORMAT_R8G8B8A8_SRGB;
172
173		case FMT_CASE(RGBA, UNORM_INT_1010102_REV):			return VK_FORMAT_R10G10B10A2_UNORM;
174		case FMT_CASE(RGBA, UNSIGNED_INT_1010102_REV):		return VK_FORMAT_R10G10B10A2_UINT;
175
176		case FMT_CASE(R, UNORM_INT16):						return VK_FORMAT_R16_UNORM;
177		case FMT_CASE(R, SNORM_INT16):						return VK_FORMAT_R16_SNORM;
178		case FMT_CASE(R, UNSIGNED_INT16):					return VK_FORMAT_R16_UINT;
179		case FMT_CASE(R, SIGNED_INT16):						return VK_FORMAT_R16_SINT;
180		case FMT_CASE(R, HALF_FLOAT):						return VK_FORMAT_R16_SFLOAT;
181
182		case FMT_CASE(RG, UNORM_INT16):						return VK_FORMAT_R16G16_UNORM;
183		case FMT_CASE(RG, SNORM_INT16):						return VK_FORMAT_R16G16_SNORM;
184		case FMT_CASE(RG, UNSIGNED_INT16):					return VK_FORMAT_R16G16_UINT;
185		case FMT_CASE(RG, SIGNED_INT16):					return VK_FORMAT_R16G16_SINT;
186		case FMT_CASE(RG, HALF_FLOAT):						return VK_FORMAT_R16G16_SFLOAT;
187
188		case FMT_CASE(RGB, UNORM_INT16):					return VK_FORMAT_R16G16B16_UNORM;
189		case FMT_CASE(RGB, SNORM_INT16):					return VK_FORMAT_R16G16B16_SNORM;
190		case FMT_CASE(RGB, UNSIGNED_INT16):					return VK_FORMAT_R16G16B16_UINT;
191		case FMT_CASE(RGB, SIGNED_INT16):					return VK_FORMAT_R16G16B16_SINT;
192		case FMT_CASE(RGB, HALF_FLOAT):						return VK_FORMAT_R16G16B16_SFLOAT;
193
194		case FMT_CASE(RGBA, UNORM_INT16):					return VK_FORMAT_R16G16B16A16_UNORM;
195		case FMT_CASE(RGBA, SNORM_INT16):					return VK_FORMAT_R16G16B16A16_SNORM;
196		case FMT_CASE(RGBA, UNSIGNED_INT16):				return VK_FORMAT_R16G16B16A16_UINT;
197		case FMT_CASE(RGBA, SIGNED_INT16):					return VK_FORMAT_R16G16B16A16_SINT;
198		case FMT_CASE(RGBA, HALF_FLOAT):					return VK_FORMAT_R16G16B16A16_SFLOAT;
199
200		case FMT_CASE(R, UNSIGNED_INT32):					return VK_FORMAT_R32_UINT;
201		case FMT_CASE(R, SIGNED_INT32):						return VK_FORMAT_R32_SINT;
202		case FMT_CASE(R, FLOAT):							return VK_FORMAT_R32_SFLOAT;
203
204		case FMT_CASE(RG, UNSIGNED_INT32):					return VK_FORMAT_R32G32_UINT;
205		case FMT_CASE(RG, SIGNED_INT32):					return VK_FORMAT_R32G32_SINT;
206		case FMT_CASE(RG, FLOAT):							return VK_FORMAT_R32G32_SFLOAT;
207
208		case FMT_CASE(RGB, UNSIGNED_INT32):					return VK_FORMAT_R32G32B32_UINT;
209		case FMT_CASE(RGB, SIGNED_INT32):					return VK_FORMAT_R32G32B32_SINT;
210		case FMT_CASE(RGB, FLOAT):							return VK_FORMAT_R32G32B32_SFLOAT;
211
212		case FMT_CASE(RGBA, UNSIGNED_INT32):				return VK_FORMAT_R32G32B32A32_UINT;
213		case FMT_CASE(RGBA, SIGNED_INT32):					return VK_FORMAT_R32G32B32A32_SINT;
214		case FMT_CASE(RGBA, FLOAT):							return VK_FORMAT_R32G32B32A32_SFLOAT;
215
216		case FMT_CASE(RGB, UNSIGNED_INT_11F_11F_10F_REV):	return VK_FORMAT_R11G11B10_UFLOAT;
217		case FMT_CASE(RGB, UNSIGNED_INT_999_E5_REV):		return VK_FORMAT_R9G9B9E5_UFLOAT;
218
219		case FMT_CASE(D, UNORM_INT16):						return VK_FORMAT_D16_UNORM;
220		case FMT_CASE(D, UNSIGNED_INT_24_8):				return VK_FORMAT_D24_UNORM_X8;
221		case FMT_CASE(D, FLOAT):							return VK_FORMAT_D32_SFLOAT;
222
223		case FMT_CASE(S, UNSIGNED_INT8):					return VK_FORMAT_S8_UINT;
224		case FMT_CASE(DS, UNSIGNED_INT_24_8):				return VK_FORMAT_D24_UNORM_S8_UINT;
225
226		case FMT_CASE(BGRA, UNORM_SHORT_4444):				return VK_FORMAT_B4G4R4A4_UNORM;
227		case FMT_CASE(BGRA, UNORM_SHORT_5551):				return VK_FORMAT_B5G5R5A1_UNORM;
228		default:
229			TCU_THROW(InternalError, "Unknown texture format");
230	}
231
232#undef PACK_FMT
233#undef FMT_CASE
234}
235
236tcu::TextureFormat mapVkFormat (VkFormat format)
237{
238	using tcu::TextureFormat;
239
240	switch (format)
241	{
242		case VK_FORMAT_R4G4_UNORM:			return TextureFormat(TextureFormat::RG,		TextureFormat::UNORM_SHORT_4444);
243		case VK_FORMAT_R4G4B4A4_UNORM:		return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNORM_SHORT_4444);
244		case VK_FORMAT_R5G6B5_UNORM:		return TextureFormat(TextureFormat::RGB,	TextureFormat::UNORM_SHORT_565);
245		case VK_FORMAT_R5G5B5A1_UNORM:		return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNORM_SHORT_5551);
246
247		case VK_FORMAT_R8_UNORM:			return TextureFormat(TextureFormat::R,		TextureFormat::UNORM_INT8);
248		case VK_FORMAT_R8_SNORM:			return TextureFormat(TextureFormat::R,		TextureFormat::SNORM_INT8);
249		case VK_FORMAT_R8_USCALED:			return TextureFormat(TextureFormat::R,		TextureFormat::UNSIGNED_INT8);
250		case VK_FORMAT_R8_SSCALED:			return TextureFormat(TextureFormat::R,		TextureFormat::SIGNED_INT8);
251		case VK_FORMAT_R8_UINT:				return TextureFormat(TextureFormat::R,		TextureFormat::UNSIGNED_INT8);
252		case VK_FORMAT_R8_SINT:				return TextureFormat(TextureFormat::R,		TextureFormat::SIGNED_INT8);
253		case VK_FORMAT_R8_SRGB:				return TextureFormat(TextureFormat::sR,		TextureFormat::UNORM_INT8);
254
255		case VK_FORMAT_R8G8_UNORM:			return TextureFormat(TextureFormat::RG,		TextureFormat::UNORM_INT8);
256		case VK_FORMAT_R8G8_SNORM:			return TextureFormat(TextureFormat::RG,		TextureFormat::SNORM_INT8);
257		case VK_FORMAT_R8G8_USCALED:		return TextureFormat(TextureFormat::RG,		TextureFormat::UNSIGNED_INT8);
258		case VK_FORMAT_R8G8_SSCALED:		return TextureFormat(TextureFormat::RG,		TextureFormat::SIGNED_INT8);
259		case VK_FORMAT_R8G8_UINT:			return TextureFormat(TextureFormat::RG,		TextureFormat::UNSIGNED_INT8);
260		case VK_FORMAT_R8G8_SINT:			return TextureFormat(TextureFormat::RG,		TextureFormat::SIGNED_INT8);
261		case VK_FORMAT_R8G8_SRGB:			return TextureFormat(TextureFormat::sRG,	TextureFormat::UNORM_INT8);
262
263		case VK_FORMAT_R8G8B8_UNORM:		return TextureFormat(TextureFormat::RGB,	TextureFormat::UNORM_INT8);
264		case VK_FORMAT_R8G8B8_SNORM:		return TextureFormat(TextureFormat::RGB,	TextureFormat::SNORM_INT8);
265		case VK_FORMAT_R8G8B8_USCALED:		return TextureFormat(TextureFormat::RGB,	TextureFormat::UNSIGNED_INT8);
266		case VK_FORMAT_R8G8B8_SSCALED:		return TextureFormat(TextureFormat::RGB,	TextureFormat::SIGNED_INT8);
267		case VK_FORMAT_R8G8B8_UINT:			return TextureFormat(TextureFormat::RGB,	TextureFormat::UNSIGNED_INT8);
268		case VK_FORMAT_R8G8B8_SINT:			return TextureFormat(TextureFormat::RGB,	TextureFormat::SIGNED_INT8);
269		case VK_FORMAT_R8G8B8_SRGB:			return TextureFormat(TextureFormat::sRGB,	TextureFormat::UNORM_INT8);
270
271		case VK_FORMAT_R8G8B8A8_UNORM:		return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNORM_INT8);
272		case VK_FORMAT_R8G8B8A8_SNORM:		return TextureFormat(TextureFormat::RGBA,	TextureFormat::SNORM_INT8);
273		case VK_FORMAT_R8G8B8A8_USCALED:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNSIGNED_INT8);
274		case VK_FORMAT_R8G8B8A8_SSCALED:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::SIGNED_INT8);
275		case VK_FORMAT_R8G8B8A8_UINT:		return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNSIGNED_INT8);
276		case VK_FORMAT_R8G8B8A8_SINT:		return TextureFormat(TextureFormat::RGBA,	TextureFormat::SIGNED_INT8);
277		case VK_FORMAT_R8G8B8A8_SRGB:		return TextureFormat(TextureFormat::sRGBA,	TextureFormat::UNORM_INT8);
278
279		case VK_FORMAT_R10G10B10A2_UNORM:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNORM_INT_1010102_REV);
280		case VK_FORMAT_R10G10B10A2_UINT:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNSIGNED_INT_1010102_REV);
281		case VK_FORMAT_R10G10B10A2_USCALED:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNSIGNED_INT_1010102_REV);
282
283		case VK_FORMAT_R16_UNORM:			return TextureFormat(TextureFormat::R,		TextureFormat::UNORM_INT16);
284		case VK_FORMAT_R16_SNORM:			return TextureFormat(TextureFormat::R,		TextureFormat::SNORM_INT16);
285		case VK_FORMAT_R16_USCALED:			return TextureFormat(TextureFormat::R,		TextureFormat::UNSIGNED_INT16);
286		case VK_FORMAT_R16_SSCALED:			return TextureFormat(TextureFormat::R,		TextureFormat::SIGNED_INT16);
287		case VK_FORMAT_R16_UINT:			return TextureFormat(TextureFormat::R,		TextureFormat::UNSIGNED_INT16);
288		case VK_FORMAT_R16_SINT:			return TextureFormat(TextureFormat::R,		TextureFormat::SIGNED_INT16);
289		case VK_FORMAT_R16_SFLOAT:			return TextureFormat(TextureFormat::R,		TextureFormat::HALF_FLOAT);
290
291		case VK_FORMAT_R16G16_UNORM:		return TextureFormat(TextureFormat::RG,		TextureFormat::UNORM_INT16);
292		case VK_FORMAT_R16G16_SNORM:		return TextureFormat(TextureFormat::RG,		TextureFormat::SNORM_INT16);
293		case VK_FORMAT_R16G16_USCALED:		return TextureFormat(TextureFormat::RG,		TextureFormat::UNSIGNED_INT16);
294		case VK_FORMAT_R16G16_SSCALED:		return TextureFormat(TextureFormat::RG,		TextureFormat::SIGNED_INT16);
295		case VK_FORMAT_R16G16_UINT:			return TextureFormat(TextureFormat::RG,		TextureFormat::UNSIGNED_INT16);
296		case VK_FORMAT_R16G16_SINT:			return TextureFormat(TextureFormat::RG,		TextureFormat::SIGNED_INT16);
297		case VK_FORMAT_R16G16_SFLOAT:		return TextureFormat(TextureFormat::RG,		TextureFormat::HALF_FLOAT);
298
299		case VK_FORMAT_R16G16B16_UNORM:		return TextureFormat(TextureFormat::RGB,	TextureFormat::UNORM_INT16);
300		case VK_FORMAT_R16G16B16_SNORM:		return TextureFormat(TextureFormat::RGB,	TextureFormat::SNORM_INT16);
301		case VK_FORMAT_R16G16B16_USCALED:	return TextureFormat(TextureFormat::RGB,	TextureFormat::UNSIGNED_INT16);
302		case VK_FORMAT_R16G16B16_SSCALED:	return TextureFormat(TextureFormat::RGB,	TextureFormat::SIGNED_INT16);
303		case VK_FORMAT_R16G16B16_UINT:		return TextureFormat(TextureFormat::RGB,	TextureFormat::UNSIGNED_INT16);
304		case VK_FORMAT_R16G16B16_SINT:		return TextureFormat(TextureFormat::RGB,	TextureFormat::SIGNED_INT16);
305		case VK_FORMAT_R16G16B16_SFLOAT:	return TextureFormat(TextureFormat::RGB,	TextureFormat::HALF_FLOAT);
306
307		case VK_FORMAT_R16G16B16A16_UNORM:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNORM_INT16);
308		case VK_FORMAT_R16G16B16A16_SNORM:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::SNORM_INT16);
309		case VK_FORMAT_R16G16B16A16_USCALED:return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNSIGNED_INT16);
310		case VK_FORMAT_R16G16B16A16_SSCALED:return TextureFormat(TextureFormat::RGBA,	TextureFormat::SIGNED_INT16);
311		case VK_FORMAT_R16G16B16A16_UINT:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNSIGNED_INT16);
312		case VK_FORMAT_R16G16B16A16_SINT:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::SIGNED_INT16);
313		case VK_FORMAT_R16G16B16A16_SFLOAT:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::HALF_FLOAT);
314
315		case VK_FORMAT_R32_UINT:			return TextureFormat(TextureFormat::R,		TextureFormat::UNSIGNED_INT32);
316		case VK_FORMAT_R32_SINT:			return TextureFormat(TextureFormat::R,		TextureFormat::SIGNED_INT32);
317		case VK_FORMAT_R32_SFLOAT:			return TextureFormat(TextureFormat::R,		TextureFormat::FLOAT);
318
319		case VK_FORMAT_R32G32_UINT:			return TextureFormat(TextureFormat::RG,		TextureFormat::UNSIGNED_INT32);
320		case VK_FORMAT_R32G32_SINT:			return TextureFormat(TextureFormat::RG,		TextureFormat::SIGNED_INT32);
321		case VK_FORMAT_R32G32_SFLOAT:		return TextureFormat(TextureFormat::RG,		TextureFormat::FLOAT);
322
323		case VK_FORMAT_R32G32B32_UINT:		return TextureFormat(TextureFormat::RGB,	TextureFormat::UNSIGNED_INT32);
324		case VK_FORMAT_R32G32B32_SINT:		return TextureFormat(TextureFormat::RGB,	TextureFormat::SIGNED_INT32);
325		case VK_FORMAT_R32G32B32_SFLOAT:	return TextureFormat(TextureFormat::RGB,	TextureFormat::FLOAT);
326
327		case VK_FORMAT_R32G32B32A32_UINT:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::UNSIGNED_INT32);
328		case VK_FORMAT_R32G32B32A32_SINT:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::SIGNED_INT32);
329		case VK_FORMAT_R32G32B32A32_SFLOAT:	return TextureFormat(TextureFormat::RGBA,	TextureFormat::FLOAT);
330
331		case VK_FORMAT_R11G11B10_UFLOAT:	return TextureFormat(TextureFormat::RGB,	TextureFormat::UNSIGNED_INT_11F_11F_10F_REV);
332		case VK_FORMAT_R9G9B9E5_UFLOAT:		return TextureFormat(TextureFormat::RGB,	TextureFormat::UNSIGNED_INT_999_E5_REV);
333
334		case VK_FORMAT_D16_UNORM:			return TextureFormat(TextureFormat::D,		TextureFormat::UNORM_INT16);
335		case VK_FORMAT_D24_UNORM_X8:		return TextureFormat(TextureFormat::D,		TextureFormat::UNSIGNED_INT_24_8);
336		case VK_FORMAT_D32_SFLOAT:			return TextureFormat(TextureFormat::D,		TextureFormat::FLOAT);
337
338		case VK_FORMAT_S8_UINT:				return TextureFormat(TextureFormat::S,		TextureFormat::UNSIGNED_INT8);
339
340		// \note There is no standard interleaved memory layout for DS formats; buffer-image copies
341		//		 will always operate on either D or S aspect only. See Khronos bug 12998
342		case VK_FORMAT_D16_UNORM_S8_UINT:	return TextureFormat(TextureFormat::DS,		TextureFormat::UNSIGNED_INT_16_8);
343		case VK_FORMAT_D24_UNORM_S8_UINT:	return TextureFormat(TextureFormat::DS,		TextureFormat::UNSIGNED_INT_24_8);
344		case VK_FORMAT_D32_SFLOAT_S8_UINT:	return TextureFormat(TextureFormat::DS,		TextureFormat::FLOAT_UNSIGNED_INT_8);
345
346		case VK_FORMAT_B4G4R4A4_UNORM:		return TextureFormat(TextureFormat::BGRA,	TextureFormat::UNORM_SHORT_4444);
347		case VK_FORMAT_B5G5R5A1_UNORM:		return TextureFormat(TextureFormat::BGRA,	TextureFormat::UNORM_SHORT_5551);
348
349		case VK_FORMAT_R4G4_USCALED:
350		case VK_FORMAT_R4G4B4A4_USCALED:
351		case VK_FORMAT_R5G6B5_USCALED:
352		case VK_FORMAT_R5G5B5A1_USCALED:
353			DE_FATAL("Format not implemented");
354
355		default:
356			TCU_THROW(InternalError, "Unknown image format");
357	}
358}
359
360} // vk
361