1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
4 *
5 * Copyright (c) 2015 The Khronos Group Inc.
6 * Copyright (c) 2015 Imagination Technologies Ltd.
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 *//*!
21 * \file
22 * \brief Image Tests
23 *//*--------------------------------------------------------------------*/
24
25 #include "vktPipelineImageTests.hpp"
26 #include "vktPipelineImageSamplingInstance.hpp"
27 #include "vktPipelineImageUtil.hpp"
28 #include "vktPipelineVertexUtil.hpp"
29 #include "vktTestCase.hpp"
30 #include "vkImageUtil.hpp"
31 #include "vkPrograms.hpp"
32 #include "tcuTextureUtil.hpp"
33 #include "deStringUtil.hpp"
34
35 #include <sstream>
36 #include <vector>
37
38 namespace vkt
39 {
40 namespace pipeline
41 {
42
43 using namespace vk;
44 using de::MovePtr;
45
46 namespace
47 {
48
49 class ImageTest : public vkt::TestCase
50 {
51 public:
52 ImageTest (tcu::TestContext& testContext,
53 const char* name,
54 const char* description,
55 VkImageViewType imageViewType,
56 VkFormat imageFormat,
57 const tcu::IVec3& imageSize,
58 int arraySize);
59
60 virtual void initPrograms (SourceCollections& sourceCollections) const;
61 virtual TestInstance* createInstance (Context& context) const;
62 static std::string getGlslSamplerType (const tcu::TextureFormat& format, VkImageViewType type);
63
64 private:
65 VkImageViewType m_imageViewType;
66 VkFormat m_imageFormat;
67 tcu::IVec3 m_imageSize;
68 int m_arraySize;
69 };
70
ImageTest(tcu::TestContext & testContext,const char * name,const char * description,VkImageViewType imageViewType,VkFormat imageFormat,const tcu::IVec3 & imageSize,int arraySize)71 ImageTest::ImageTest (tcu::TestContext& testContext,
72 const char* name,
73 const char* description,
74 VkImageViewType imageViewType,
75 VkFormat imageFormat,
76 const tcu::IVec3& imageSize,
77 int arraySize)
78
79 : vkt::TestCase (testContext, name, description)
80 , m_imageViewType (imageViewType)
81 , m_imageFormat (imageFormat)
82 , m_imageSize (imageSize)
83 , m_arraySize (arraySize)
84 {
85 }
86
initPrograms(SourceCollections & sourceCollections) const87 void ImageTest::initPrograms (SourceCollections& sourceCollections) const
88 {
89 std::ostringstream vertexSrc;
90 std::ostringstream fragmentSrc;
91 const char* texCoordSwizzle = DE_NULL;
92 const tcu::TextureFormat format = (isCompressedFormat(m_imageFormat)) ? tcu::getUncompressedFormat(mapVkCompressedFormat(m_imageFormat))
93 : mapVkFormat(m_imageFormat);
94
95 // \note We don't want to perform normalization on any compressed formats.
96 // In case of non-sRGB LDR ASTC it would lead to lack of coverage
97 // as uncompressed format for that is f16 but values will be in range
98 // 0..1 already.
99 const tcu::TextureFormatInfo formatInfo = (!isCompressedFormat(m_imageFormat) ? tcu::getTextureFormatInfo(format)
100 : tcu::getTextureFormatInfo(tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8)));
101
102 switch (m_imageViewType)
103 {
104 case VK_IMAGE_VIEW_TYPE_1D:
105 texCoordSwizzle = "x";
106 break;
107 case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
108 case VK_IMAGE_VIEW_TYPE_2D:
109 texCoordSwizzle = "xy";
110 break;
111 case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
112 case VK_IMAGE_VIEW_TYPE_3D:
113 case VK_IMAGE_VIEW_TYPE_CUBE:
114 texCoordSwizzle = "xyz";
115 break;
116 case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
117 texCoordSwizzle = "xyzw";
118 break;
119 default:
120 DE_ASSERT(false);
121 break;
122 }
123
124 vertexSrc << "#version 440\n"
125 << "layout(location = 0) in vec4 position;\n"
126 << "layout(location = 1) in vec4 texCoords;\n"
127 << "layout(location = 0) out highp vec4 vtxTexCoords;\n"
128 << "out gl_PerVertex {\n"
129 << " vec4 gl_Position;\n"
130 << "};\n"
131 << "void main (void)\n"
132 << "{\n"
133 << " gl_Position = position;\n"
134 << " vtxTexCoords = texCoords;\n"
135 << "}\n";
136
137 fragmentSrc << "#version 440\n"
138 << "layout(set = 0, binding = 0) uniform highp " << getGlslSamplerType(format, m_imageViewType) << " texSampler;\n"
139 << "layout(location = 0) in highp vec4 vtxTexCoords;\n"
140 << "layout(location = 0) out highp vec4 fragColor;\n"
141 << "void main (void)\n"
142 << "{\n"
143 << " fragColor = (texture(texSampler, vtxTexCoords." << texCoordSwizzle << std::scientific << ") * vec4" << formatInfo.lookupScale << ") + vec4" << formatInfo.lookupBias << ";\n"
144 << "}\n";
145
146 sourceCollections.glslSources.add("tex_vert") << glu::VertexSource(vertexSrc.str());
147 sourceCollections.glslSources.add("tex_frag") << glu::FragmentSource(fragmentSrc.str());
148 }
149
createInstance(Context & context) const150 TestInstance* ImageTest::createInstance (Context& context) const
151 {
152 tcu::UVec2 renderSize;
153
154 if (m_imageViewType == VK_IMAGE_VIEW_TYPE_1D || m_imageViewType == VK_IMAGE_VIEW_TYPE_2D)
155 {
156 renderSize = tcu::UVec2((deUint32)m_imageSize.x(), (deUint32)m_imageSize.y());
157 }
158 else
159 {
160 // Draw a 3x2 grid of texture layers
161 renderSize = tcu::UVec2((deUint32)m_imageSize.x() * 3, (deUint32)m_imageSize.y() * 2);
162 }
163
164 const std::vector<Vertex4Tex4> vertices = createTestQuadMosaic(m_imageViewType);
165 const VkComponentMapping componentMapping = getFormatComponentMapping(m_imageFormat);
166 const VkImageSubresourceRange subresourceRange =
167 {
168 VK_IMAGE_ASPECT_COLOR_BIT,
169 0u,
170 (deUint32)deLog2Floor32(deMax32(m_imageSize.x(), deMax32(m_imageSize.y(), m_imageSize.z()))) + 1,
171 0u,
172 (deUint32)m_arraySize,
173 };
174
175 const VkSamplerCreateInfo samplerParams =
176 {
177 VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, // VkStructureType sType;
178 DE_NULL, // const void* pNext;
179 0u, // VkSamplerCreateFlags flags;
180 VK_FILTER_NEAREST, // VkFilter magFilter;
181 VK_FILTER_NEAREST, // VkFilter minFilter;
182 VK_SAMPLER_MIPMAP_MODE_NEAREST, // VkSamplerMipmapMode mipmapMode;
183 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, // VkSamplerAddressMode addressModeU;
184 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, // VkSamplerAddressMode addressModeV;
185 VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, // VkSamplerAddressMode addressModeW;
186 0.0f, // float mipLodBias;
187 VK_FALSE, // VkBool32 anisotropyEnable;
188 1.0f, // float maxAnisotropy;
189 false, // VkBool32 compareEnable;
190 VK_COMPARE_OP_NEVER, // VkCompareOp compareOp;
191 0.0f, // float minLod;
192 (float)(subresourceRange.levelCount - 1), // float maxLod;
193 getFormatBorderColor(BORDER_COLOR_TRANSPARENT_BLACK, m_imageFormat), // VkBorderColor borderColor;
194 false // VkBool32 unnormalizedCoordinates;
195 };
196
197 return new ImageSamplingInstance(context, renderSize, m_imageViewType, m_imageFormat, m_imageSize, m_arraySize, componentMapping, subresourceRange, samplerParams, 0.0f, vertices);
198 }
199
getGlslSamplerType(const tcu::TextureFormat & format,VkImageViewType type)200 std::string ImageTest::getGlslSamplerType (const tcu::TextureFormat& format, VkImageViewType type)
201 {
202 std::ostringstream samplerType;
203
204 if (tcu::getTextureChannelClass(format.type) == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER)
205 samplerType << "u";
206 else if (tcu::getTextureChannelClass(format.type) == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER)
207 samplerType << "i";
208
209 switch (type)
210 {
211 case VK_IMAGE_VIEW_TYPE_1D:
212 samplerType << "sampler1D";
213 break;
214
215 case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
216 samplerType << "sampler1DArray";
217 break;
218
219 case VK_IMAGE_VIEW_TYPE_2D:
220 samplerType << "sampler2D";
221 break;
222
223 case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
224 samplerType << "sampler2DArray";
225 break;
226
227 case VK_IMAGE_VIEW_TYPE_3D:
228 samplerType << "sampler3D";
229 break;
230
231 case VK_IMAGE_VIEW_TYPE_CUBE:
232 samplerType << "samplerCube";
233 break;
234
235 case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
236 samplerType << "samplerCubeArray";
237 break;
238
239 default:
240 DE_FATAL("Unknown image view type");
241 break;
242 }
243
244 return samplerType.str();
245 }
246
getFormatCaseName(const VkFormat format)247 std::string getFormatCaseName (const VkFormat format)
248 {
249 const std::string fullName = getFormatName(format);
250
251 DE_ASSERT(de::beginsWith(fullName, "VK_FORMAT_"));
252
253 return de::toLower(fullName.substr(10));
254 }
255
getSizeName(VkImageViewType viewType,const tcu::IVec3 & size,int arraySize)256 std::string getSizeName (VkImageViewType viewType, const tcu::IVec3& size, int arraySize)
257 {
258 std::ostringstream caseName;
259
260 switch (viewType)
261 {
262 case VK_IMAGE_VIEW_TYPE_1D:
263 case VK_IMAGE_VIEW_TYPE_2D:
264 case VK_IMAGE_VIEW_TYPE_CUBE:
265 caseName << size.x() << "x" << size.y();
266 break;
267
268 case VK_IMAGE_VIEW_TYPE_3D:
269 caseName << size.x() << "x" << size.y() << "x" << size.z();
270 break;
271
272 case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
273 case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
274 case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
275 caseName << size.x() << "x" << size.y() << "_array_of_" << arraySize;
276 break;
277
278 default:
279 DE_ASSERT(false);
280 break;
281 }
282
283 return caseName.str();
284 }
285
createImageSizeTests(tcu::TestContext & testCtx,VkImageViewType imageViewType,VkFormat imageFormat)286 de::MovePtr<tcu::TestCaseGroup> createImageSizeTests (tcu::TestContext& testCtx, VkImageViewType imageViewType, VkFormat imageFormat)
287 {
288 using tcu::IVec3;
289
290 std::vector<IVec3> imageSizes;
291 std::vector<int> arraySizes;
292 de::MovePtr<tcu::TestCaseGroup> imageSizeTests (new tcu::TestCaseGroup(testCtx, "size", ""));
293
294 // Select image imageSizes
295 switch (imageViewType)
296 {
297 case VK_IMAGE_VIEW_TYPE_1D:
298 case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
299 // POT
300 imageSizes.push_back(IVec3(1, 1, 1));
301 imageSizes.push_back(IVec3(2, 1, 1));
302 imageSizes.push_back(IVec3(32, 1, 1));
303 imageSizes.push_back(IVec3(128, 1, 1));
304 imageSizes.push_back(IVec3(512, 1, 1));
305
306 // NPOT
307 imageSizes.push_back(IVec3(3, 1, 1));
308 imageSizes.push_back(IVec3(13, 1, 1));
309 imageSizes.push_back(IVec3(127, 1, 1));
310 imageSizes.push_back(IVec3(443, 1, 1));
311 break;
312
313 case VK_IMAGE_VIEW_TYPE_2D:
314 case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
315 // POT
316 imageSizes.push_back(IVec3(1, 1, 1));
317 imageSizes.push_back(IVec3(2, 2, 1));
318 imageSizes.push_back(IVec3(32, 32, 1));
319
320 // NPOT
321 imageSizes.push_back(IVec3(3, 3, 1));
322 imageSizes.push_back(IVec3(13, 13, 1));
323
324 // POT rectangular
325 imageSizes.push_back(IVec3(8, 16, 1));
326 imageSizes.push_back(IVec3(32, 16, 1));
327
328 // NPOT rectangular
329 imageSizes.push_back(IVec3(13, 23, 1));
330 imageSizes.push_back(IVec3(23, 8, 1));
331 break;
332
333 case VK_IMAGE_VIEW_TYPE_3D:
334 // POT cube
335 imageSizes.push_back(IVec3(1, 1, 1));
336 imageSizes.push_back(IVec3(2, 2, 2));
337 imageSizes.push_back(IVec3(16, 16, 16));
338
339 // POT non-cube
340 imageSizes.push_back(IVec3(32, 16, 8));
341 imageSizes.push_back(IVec3(8, 16, 32));
342 break;
343
344 case VK_IMAGE_VIEW_TYPE_CUBE:
345 case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
346 // POT
347 imageSizes.push_back(IVec3(32, 32, 1));
348
349 // NPOT
350 imageSizes.push_back(IVec3(13, 13, 1));
351 break;
352
353 default:
354 DE_ASSERT(false);
355 break;
356 }
357
358 // Select array sizes
359 switch (imageViewType)
360 {
361 case VK_IMAGE_VIEW_TYPE_1D_ARRAY:
362 case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
363 arraySizes.push_back(3);
364 arraySizes.push_back(6);
365 break;
366
367 case VK_IMAGE_VIEW_TYPE_CUBE:
368 arraySizes.push_back(6);
369 break;
370
371 case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
372 arraySizes.push_back(6);
373 arraySizes.push_back(6 * 6);
374 break;
375
376 default:
377 arraySizes.push_back(1);
378 break;
379 }
380
381 for (size_t sizeNdx = 0; sizeNdx < imageSizes.size(); sizeNdx++)
382 {
383 for (size_t arraySizeNdx = 0; arraySizeNdx < arraySizes.size(); arraySizeNdx++)
384 {
385 imageSizeTests->addChild(new ImageTest(testCtx,
386 getSizeName(imageViewType, imageSizes[sizeNdx], arraySizes[arraySizeNdx]).c_str(),
387 "",
388 imageViewType,
389 imageFormat,
390 imageSizes[sizeNdx],
391 arraySizes[arraySizeNdx]));
392 }
393 }
394
395 return imageSizeTests;
396 }
397
398 } // anonymous
399
createImageTests(tcu::TestContext & testCtx)400 tcu::TestCaseGroup* createImageTests (tcu::TestContext& testCtx)
401 {
402 const struct
403 {
404 VkImageViewType type;
405 const char* name;
406 }
407 imageViewTypes[] =
408 {
409 { VK_IMAGE_VIEW_TYPE_1D, "1d" },
410 { VK_IMAGE_VIEW_TYPE_1D_ARRAY, "1d_array" },
411 { VK_IMAGE_VIEW_TYPE_2D, "2d" },
412 { VK_IMAGE_VIEW_TYPE_2D_ARRAY, "2d_array" },
413 { VK_IMAGE_VIEW_TYPE_3D, "3d" },
414 { VK_IMAGE_VIEW_TYPE_CUBE, "cube" },
415 { VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, "cube_array" }
416 };
417
418 // All supported dEQP formats that are not intended for depth or stencil.
419 const VkFormat formats[] =
420 {
421 VK_FORMAT_R4G4_UNORM_PACK8,
422 VK_FORMAT_R4G4B4A4_UNORM_PACK16,
423 VK_FORMAT_R5G6B5_UNORM_PACK16,
424 VK_FORMAT_R5G5B5A1_UNORM_PACK16,
425 VK_FORMAT_R8_UNORM,
426 VK_FORMAT_R8_SNORM,
427 VK_FORMAT_R8_USCALED,
428 VK_FORMAT_R8_SSCALED,
429 VK_FORMAT_R8_UINT,
430 VK_FORMAT_R8_SINT,
431 VK_FORMAT_R8_SRGB,
432 VK_FORMAT_R8G8_UNORM,
433 VK_FORMAT_R8G8_SNORM,
434 VK_FORMAT_R8G8_USCALED,
435 VK_FORMAT_R8G8_SSCALED,
436 VK_FORMAT_R8G8_UINT,
437 VK_FORMAT_R8G8_SINT,
438 VK_FORMAT_R8G8_SRGB,
439 VK_FORMAT_R8G8B8_UNORM,
440 VK_FORMAT_R8G8B8_SNORM,
441 VK_FORMAT_R8G8B8_USCALED,
442 VK_FORMAT_R8G8B8_SSCALED,
443 VK_FORMAT_R8G8B8_UINT,
444 VK_FORMAT_R8G8B8_SINT,
445 VK_FORMAT_R8G8B8_SRGB,
446 VK_FORMAT_R8G8B8A8_UNORM,
447 VK_FORMAT_R8G8B8A8_SNORM,
448 VK_FORMAT_R8G8B8A8_USCALED,
449 VK_FORMAT_R8G8B8A8_SSCALED,
450 VK_FORMAT_R8G8B8A8_UINT,
451 VK_FORMAT_R8G8B8A8_SINT,
452 VK_FORMAT_R8G8B8A8_SRGB,
453 VK_FORMAT_A2R10G10B10_UNORM_PACK32,
454 VK_FORMAT_A2R10G10B10_UINT_PACK32,
455 VK_FORMAT_A2R10G10B10_USCALED_PACK32,
456 VK_FORMAT_R16_UNORM,
457 VK_FORMAT_R16_SNORM,
458 VK_FORMAT_R16_USCALED,
459 VK_FORMAT_R16_SSCALED,
460 VK_FORMAT_R16_UINT,
461 VK_FORMAT_R16_SINT,
462 VK_FORMAT_R16_SFLOAT,
463 VK_FORMAT_R16G16_UNORM,
464 VK_FORMAT_R16G16_SNORM,
465 VK_FORMAT_R16G16_USCALED,
466 VK_FORMAT_R16G16_SSCALED,
467 VK_FORMAT_R16G16_UINT,
468 VK_FORMAT_R16G16_SINT,
469 VK_FORMAT_R16G16_SFLOAT,
470 VK_FORMAT_R16G16B16_UNORM,
471 VK_FORMAT_R16G16B16_SNORM,
472 VK_FORMAT_R16G16B16_USCALED,
473 VK_FORMAT_R16G16B16_SSCALED,
474 VK_FORMAT_R16G16B16_UINT,
475 VK_FORMAT_R16G16B16_SINT,
476 VK_FORMAT_R16G16B16_SFLOAT,
477 VK_FORMAT_R16G16B16A16_UNORM,
478 VK_FORMAT_R16G16B16A16_SNORM,
479 VK_FORMAT_R16G16B16A16_USCALED,
480 VK_FORMAT_R16G16B16A16_SSCALED,
481 VK_FORMAT_R16G16B16A16_UINT,
482 VK_FORMAT_R16G16B16A16_SINT,
483 VK_FORMAT_R16G16B16A16_SFLOAT,
484 VK_FORMAT_R32_UINT,
485 VK_FORMAT_R32_SINT,
486 VK_FORMAT_R32_SFLOAT,
487 VK_FORMAT_R32G32_UINT,
488 VK_FORMAT_R32G32_SINT,
489 VK_FORMAT_R32G32_SFLOAT,
490 VK_FORMAT_R32G32B32_UINT,
491 VK_FORMAT_R32G32B32_SINT,
492 VK_FORMAT_R32G32B32_SFLOAT,
493 VK_FORMAT_R32G32B32A32_UINT,
494 VK_FORMAT_R32G32B32A32_SINT,
495 VK_FORMAT_R32G32B32A32_SFLOAT,
496 VK_FORMAT_B10G11R11_UFLOAT_PACK32,
497 VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
498 VK_FORMAT_B4G4R4A4_UNORM_PACK16,
499 VK_FORMAT_B5G5R5A1_UNORM_PACK16,
500
501 // Compressed formats
502 VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,
503 VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK,
504 VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,
505 VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,
506 VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,
507 VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,
508 VK_FORMAT_EAC_R11_UNORM_BLOCK,
509 VK_FORMAT_EAC_R11_SNORM_BLOCK,
510 VK_FORMAT_EAC_R11G11_UNORM_BLOCK,
511 VK_FORMAT_EAC_R11G11_SNORM_BLOCK,
512 VK_FORMAT_ASTC_4x4_UNORM_BLOCK,
513 VK_FORMAT_ASTC_4x4_SRGB_BLOCK,
514 VK_FORMAT_ASTC_5x4_UNORM_BLOCK,
515 VK_FORMAT_ASTC_5x4_SRGB_BLOCK,
516 VK_FORMAT_ASTC_5x5_UNORM_BLOCK,
517 VK_FORMAT_ASTC_5x5_SRGB_BLOCK,
518 VK_FORMAT_ASTC_6x5_UNORM_BLOCK,
519 VK_FORMAT_ASTC_6x5_SRGB_BLOCK,
520 VK_FORMAT_ASTC_6x6_UNORM_BLOCK,
521 VK_FORMAT_ASTC_6x6_SRGB_BLOCK,
522 VK_FORMAT_ASTC_8x5_UNORM_BLOCK,
523 VK_FORMAT_ASTC_8x5_SRGB_BLOCK,
524 VK_FORMAT_ASTC_8x6_UNORM_BLOCK,
525 VK_FORMAT_ASTC_8x6_SRGB_BLOCK,
526 VK_FORMAT_ASTC_8x8_UNORM_BLOCK,
527 VK_FORMAT_ASTC_8x8_SRGB_BLOCK,
528 VK_FORMAT_ASTC_10x5_UNORM_BLOCK,
529 VK_FORMAT_ASTC_10x5_SRGB_BLOCK,
530 VK_FORMAT_ASTC_10x6_UNORM_BLOCK,
531 VK_FORMAT_ASTC_10x6_SRGB_BLOCK,
532 VK_FORMAT_ASTC_10x8_UNORM_BLOCK,
533 VK_FORMAT_ASTC_10x8_SRGB_BLOCK,
534 VK_FORMAT_ASTC_10x10_UNORM_BLOCK,
535 VK_FORMAT_ASTC_10x10_SRGB_BLOCK,
536 VK_FORMAT_ASTC_12x10_UNORM_BLOCK,
537 VK_FORMAT_ASTC_12x10_SRGB_BLOCK,
538 VK_FORMAT_ASTC_12x12_UNORM_BLOCK,
539 VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
540 };
541
542 de::MovePtr<tcu::TestCaseGroup> imageTests (new tcu::TestCaseGroup(testCtx, "image", "Image tests"));
543 de::MovePtr<tcu::TestCaseGroup> viewTypeTests (new tcu::TestCaseGroup(testCtx, "view_type", ""));
544
545 for (int viewTypeNdx = 0; viewTypeNdx < DE_LENGTH_OF_ARRAY(imageViewTypes); viewTypeNdx++)
546 {
547 const VkImageViewType viewType = imageViewTypes[viewTypeNdx].type;
548 de::MovePtr<tcu::TestCaseGroup> viewTypeGroup (new tcu::TestCaseGroup(testCtx, imageViewTypes[viewTypeNdx].name, (std::string("Uses a ") + imageViewTypes[viewTypeNdx].name + " view").c_str()));
549 de::MovePtr<tcu::TestCaseGroup> formatTests (new tcu::TestCaseGroup(testCtx, "format", "Tests samplable formats"));
550
551 for (size_t formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(formats); formatNdx++)
552 {
553 const VkFormat format = formats[formatNdx];
554
555 if (isCompressedFormat(format))
556 {
557 // Do not use compressed formats with 1D and 1D array textures.
558 if (viewType == VK_IMAGE_VIEW_TYPE_1D || viewType == VK_IMAGE_VIEW_TYPE_1D_ARRAY)
559 break;
560 }
561
562 de::MovePtr<tcu::TestCaseGroup> formatGroup (new tcu::TestCaseGroup(testCtx,
563 getFormatCaseName(format).c_str(),
564 (std::string("Samples a texture of format ") + getFormatName(format)).c_str()));
565
566 de::MovePtr<tcu::TestCaseGroup> sizeTests = createImageSizeTests(testCtx, viewType, format);
567
568 formatGroup->addChild(sizeTests.release());
569 formatTests->addChild(formatGroup.release());
570 }
571
572 viewTypeGroup->addChild(formatTests.release());
573 viewTypeTests->addChild(viewTypeGroup.release());
574 }
575
576 imageTests->addChild(viewTypeTests.release());
577
578 return imageTests.release();
579 }
580
581 } // pipeline
582 } // vkt
583