• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2020 The Khronos Group Inc.
6  * Copyright (c) 2020 Google Inc.
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 Texel buffer tests.
23  *//*--------------------------------------------------------------------*/
24 
25 #include "vktTextureTexelBufferTests.hpp"
26 #include "vktAmberTestCase.hpp"
27 #include "vktTestGroupUtil.hpp"
28 
29 using namespace vk;
30 
31 namespace vkt
32 {
33 namespace texture
34 {
35 namespace
36 {
37 
createUniformTexelBufferTests(tcu::TestContext & testCtx)38 tcu::TestCaseGroup* createUniformTexelBufferTests (tcu::TestContext& testCtx)
39 {
40 	de::MovePtr<tcu::TestCaseGroup>	uniform	 (new tcu::TestCaseGroup(testCtx, "uniform", "Test uniform texel buffer"));
41 
42 	// .packed
43 	{
44 		tcu::TestCaseGroup* const	packed		= new tcu::TestCaseGroup(testCtx, "packed", "Test uniform texel buffer with packed formats");
45 		static const char			dataDir[]	= "texture/texel_buffer/uniform/packed";
46 
47 		static const std::string	cases[]		=
48 		{
49 			"a2b10g10r10-uint-pack32",
50 			"a2b10g10r10-unorm-pack32",
51 			"a8b8g8r8-sint-pack32",
52 			"a8b8g8r8-snorm-pack32",
53 			"a8b8g8r8-uint-pack32",
54 			"a8b8g8r8-unorm-pack32",
55 			"b10g11r11-ufloat-pack32"
56 		};
57 
58 		uniform->addChild(packed);
59 
60 		for (int i = 0; i < DE_LENGTH_OF_ARRAY(cases); ++i)
61 		{
62 			const std::string			fileName	= cases[i] + ".amber";
63 			cts_amber::AmberTestCase*	testCase	= cts_amber::createAmberTestCase(testCtx, cases[i].c_str(), "", dataDir, fileName);
64 
65 			packed->addChild(testCase);
66 		}
67 	}
68 
69 	// .snorm
70 	{
71 		tcu::TestCaseGroup* const	snorm		= new tcu::TestCaseGroup(testCtx, "snorm", "Test uniform texel buffer with SNORM formats");
72 		static const char			dataDir[]	= "texture/texel_buffer/uniform/snorm";
73 
74 		static const struct {
75 			std::string	testName;
76 			bool		mandatoryFormat;
77 			VkFormat	format;
78 		} cases[]                               =
79 		{
80 			{	"b8g8r8-snorm",			false,	VK_FORMAT_B8G8R8_SNORM			},
81 			{	"b8g8r8a8-snorm",		false,	VK_FORMAT_B8G8R8A8_SINT			},
82 			{	"r16-snorm",			false,	VK_FORMAT_R16_SNORM				},
83 			{	"r16g16-snorm",			false,	VK_FORMAT_R16G16_SNORM			},
84 			{	"r16g16b16-snorm",		false,	VK_FORMAT_R16G16B16_SNORM		},
85 			{	"r16g16b16a16-snorm",	false,	VK_FORMAT_R16G16B16A16_SNORM	},
86 			{	"r8-snorm",				true,	VK_FORMAT_R8_SNORM				},
87 			{	"r8g8-snorm",			true,	VK_FORMAT_R8G8_SNORM			},
88 			{	"r8g8b8-snorm",			false,	VK_FORMAT_R8G8B8_SNORM			},
89 			{	"r8g8b8a8-snorm",		false,	VK_FORMAT_R8G8B8A8_SNORM		}
90 		};
91 
92 		uniform->addChild(snorm);
93 
94 		for (const auto& c : cases)
95 		{
96 			const std::string							fileName			= c.testName + ".amber";
97 			std::vector<cts_amber::BufferRequirement>	bufferRequirements;
98 
99 			if (!c.mandatoryFormat)
100 				bufferRequirements.push_back({c.format, VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT});
101 
102 			cts_amber::AmberTestCase*					testCase			= cts_amber::createAmberTestCase(testCtx, c.testName.c_str(), "",
103 																											 dataDir, fileName,
104 																											 std::vector<std::string>(),
105 																											 std::vector<vk::VkImageCreateInfo>(),
106 																											 bufferRequirements);
107 
108 			snorm->addChild(testCase);
109 		}
110 	}
111 
112 	return uniform.release();
113 }
114 
115 } // anonymous
116 
createTextureTexelBufferTests(tcu::TestContext & testCtx)117 tcu::TestCaseGroup* createTextureTexelBufferTests (tcu::TestContext& testCtx)
118 {
119 	de::MovePtr<tcu::TestCaseGroup> texelBuffer (new tcu::TestCaseGroup(testCtx, "texel_buffer", "Test texel buffer"));
120 
121 	texelBuffer->addChild(createUniformTexelBufferTests(testCtx));
122 
123 	return texelBuffer.release();
124 }
125 
126 } // texture
127 } // vkt
128