1 /*-------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
4 *
5 * Copyright (c) 2015 Google Inc.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief Api Feature Query tests
22 *//*--------------------------------------------------------------------*/
23
24 #include "vktApiFeatureInfo.hpp"
25
26 #include "deDefs.h"
27 #include "vktTestCaseUtil.hpp"
28 #include "vktTestGroupUtil.hpp"
29 #include "vktCustomInstancesDevices.hpp"
30
31 #include "vkPlatform.hpp"
32 #include "vkStrUtil.hpp"
33 #include "vkRef.hpp"
34 #include "vkRefUtil.hpp"
35 #include "vkDeviceUtil.hpp"
36 #include "vkSafetyCriticalUtil.hpp"
37 #include "vkQueryUtil.hpp"
38 #include "vkImageUtil.hpp"
39 #include "vkApiVersion.hpp"
40
41 #include "tcuTestLog.hpp"
42 #include "tcuFormatUtil.hpp"
43 #include "tcuTextureUtil.hpp"
44 #include "tcuResultCollector.hpp"
45 #include "tcuCommandLine.hpp"
46
47 #include "deUniquePtr.hpp"
48 #include "deString.h"
49 #include "deStringUtil.hpp"
50 #include "deSTLUtil.hpp"
51 #include "deMemory.h"
52 #include "deMath.h"
53
54 #include <vector>
55 #include <set>
56 #include <string>
57 #include <limits>
58 #include <optional>
59
60 namespace vkt
61 {
62 namespace api
63 {
64 namespace
65 {
66
67 #include "vkApiExtensionDependencyInfo.inl"
68
69 using namespace vk;
70 using std::set;
71 using std::string;
72 using std::vector;
73 using tcu::ScopedLogSection;
74 using tcu::TestLog;
75
76 const uint32_t DEUINT32_MAX = std::numeric_limits<uint32_t>::max();
77
78 enum
79 {
80 GUARD_SIZE = 0x20, //!< Number of bytes to check
81 GUARD_VALUE = 0xcd, //!< Data pattern
82 };
83
84 static const VkDeviceSize MINIMUM_REQUIRED_IMAGE_RESOURCE_SIZE =
85 (1LLU << 31); //!< Minimum value for VkImageFormatProperties::maxResourceSize (2GiB)
86
87 enum LimitFormat
88 {
89 LIMIT_FORMAT_SIGNED_INT,
90 LIMIT_FORMAT_UNSIGNED_INT,
91 LIMIT_FORMAT_FLOAT,
92 LIMIT_FORMAT_DEVICE_SIZE,
93 LIMIT_FORMAT_BITMASK,
94
95 LIMIT_FORMAT_LAST
96 };
97
98 enum LimitType
99 {
100 LIMIT_TYPE_MIN,
101 LIMIT_TYPE_MAX,
102 LIMIT_TYPE_NONE,
103
104 LIMIT_TYPE_LAST
105 };
106
107 #define LIMIT(_X_) offsetof(VkPhysicalDeviceLimits, _X_), (const char *)(#_X_)
108 #define FEATURE(_X_) offsetof(VkPhysicalDeviceFeatures, _X_)
109
validateFeatureLimits(VkPhysicalDeviceProperties * properties,VkPhysicalDeviceFeatures * features,TestLog & log)110 bool validateFeatureLimits(VkPhysicalDeviceProperties *properties, VkPhysicalDeviceFeatures *features, TestLog &log)
111 {
112 bool limitsOk = true;
113 VkPhysicalDeviceLimits *limits = &properties->limits;
114 uint32_t shaderStages = 3;
115 uint32_t maxPerStageResourcesMin =
116 deMin32(128, limits->maxPerStageDescriptorUniformBuffers + limits->maxPerStageDescriptorStorageBuffers +
117 limits->maxPerStageDescriptorSampledImages + limits->maxPerStageDescriptorStorageImages +
118 limits->maxPerStageDescriptorInputAttachments + limits->maxColorAttachments);
119
120 if (features->tessellationShader)
121 {
122 shaderStages += 2;
123 }
124
125 if (features->geometryShader)
126 {
127 shaderStages++;
128 }
129
130 struct FeatureLimitTable
131 {
132 uint32_t offset;
133 const char *name;
134 uint32_t uintVal; //!< Format is UNSIGNED_INT
135 int32_t intVal; //!< Format is SIGNED_INT
136 uint64_t deviceSizeVal; //!< Format is DEVICE_SIZE
137 float floatVal; //!< Format is FLOAT
138 LimitFormat format;
139 LimitType type;
140 int32_t unsuppTableNdx;
141 bool pot;
142 } featureLimitTable[] = //!< Based on 1.0.28 Vulkan spec
143 {
144 {LIMIT(maxImageDimension1D), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
145 {LIMIT(maxImageDimension2D), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
146 {LIMIT(maxImageDimension3D), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
147 {LIMIT(maxImageDimensionCube), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
148 {LIMIT(maxImageArrayLayers), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
149 {LIMIT(maxTexelBufferElements), 65536, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
150 {LIMIT(maxUniformBufferRange), 16384, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
151 {LIMIT(maxStorageBufferRange), 134217728, 0, 0, 0, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
152 {LIMIT(maxPushConstantsSize), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
153 {LIMIT(maxMemoryAllocationCount), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
154 {LIMIT(maxSamplerAllocationCount), 4000, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
155 {LIMIT(bufferImageGranularity), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1, false},
156 {LIMIT(bufferImageGranularity), 0, 0, 131072, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1, false},
157 {LIMIT(sparseAddressSpaceSize), 0, 0, 2UL * 1024 * 1024 * 1024, 0.0f, LIMIT_FORMAT_DEVICE_SIZE,
158 LIMIT_TYPE_MIN, -1, false},
159 {LIMIT(maxBoundDescriptorSets), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
160 {LIMIT(maxPerStageDescriptorSamplers), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
161 false},
162 {LIMIT(maxPerStageDescriptorUniformBuffers), 12, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
163 false},
164 {LIMIT(maxPerStageDescriptorStorageBuffers), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
165 false},
166 {LIMIT(maxPerStageDescriptorSampledImages), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
167 false},
168 {LIMIT(maxPerStageDescriptorStorageImages), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
169 false},
170 {LIMIT(maxPerStageDescriptorInputAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
171 false},
172 {LIMIT(maxPerStageResources), maxPerStageResourcesMin, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT,
173 LIMIT_TYPE_MIN, -1, false},
174 {LIMIT(maxDescriptorSetSamplers), shaderStages * 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN,
175 -1, false},
176 {LIMIT(maxDescriptorSetUniformBuffers), shaderStages * 12, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT,
177 LIMIT_TYPE_MIN, -1, false},
178 {LIMIT(maxDescriptorSetUniformBuffersDynamic), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
179 false},
180 {LIMIT(maxDescriptorSetStorageBuffers), shaderStages * 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT,
181 LIMIT_TYPE_MIN, -1, false},
182 {LIMIT(maxDescriptorSetStorageBuffersDynamic), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
183 false},
184 {LIMIT(maxDescriptorSetSampledImages), shaderStages * 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT,
185 LIMIT_TYPE_MIN, -1, false},
186 {LIMIT(maxDescriptorSetStorageImages), shaderStages * 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT,
187 LIMIT_TYPE_MIN, -1, false},
188 {LIMIT(maxDescriptorSetInputAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
189 false},
190 {LIMIT(maxVertexInputAttributes), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
191 {LIMIT(maxVertexInputBindings), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
192 {LIMIT(maxVertexInputAttributeOffset), 2047, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
193 false},
194 {LIMIT(maxVertexInputBindingStride), 2048, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
195 false},
196 {LIMIT(maxVertexOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
197 {LIMIT(maxTessellationGenerationLevel), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
198 false},
199 {LIMIT(maxTessellationPatchSize), 32, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
200 {LIMIT(maxTessellationControlPerVertexInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT,
201 LIMIT_TYPE_MIN, -1, false},
202 {LIMIT(maxTessellationControlPerVertexOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT,
203 LIMIT_TYPE_MIN, -1, false},
204 {LIMIT(maxTessellationControlPerPatchOutputComponents), 120, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT,
205 LIMIT_TYPE_MIN, -1, false},
206 {LIMIT(maxTessellationControlTotalOutputComponents), 2048, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT,
207 LIMIT_TYPE_MIN, -1, false},
208 {LIMIT(maxTessellationEvaluationInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN,
209 -1, false},
210 {LIMIT(maxTessellationEvaluationOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT,
211 LIMIT_TYPE_MIN, -1, false},
212 {LIMIT(maxGeometryShaderInvocations), 32, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
213 {LIMIT(maxGeometryInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
214 {LIMIT(maxGeometryOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
215 {LIMIT(maxGeometryOutputVertices), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
216 {LIMIT(maxGeometryTotalOutputComponents), 1024, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
217 false},
218 {LIMIT(maxFragmentInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
219 {LIMIT(maxFragmentOutputAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
220 {LIMIT(maxFragmentDualSrcAttachments), 1, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
221 {LIMIT(maxFragmentCombinedOutputResources), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
222 false},
223 {LIMIT(maxComputeSharedMemorySize), 16384, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
224 false},
225 {LIMIT(maxComputeWorkGroupCount[0]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
226 false},
227 {LIMIT(maxComputeWorkGroupCount[1]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
228 false},
229 {LIMIT(maxComputeWorkGroupCount[2]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
230 false},
231 {LIMIT(maxComputeWorkGroupInvocations), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
232 false},
233 {LIMIT(maxComputeWorkGroupSize[0]), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
234 {LIMIT(maxComputeWorkGroupSize[1]), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
235 {LIMIT(maxComputeWorkGroupSize[2]), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
236 {LIMIT(subPixelPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
237 {LIMIT(subTexelPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
238 {LIMIT(mipmapPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
239 {LIMIT(maxDrawIndexedIndexValue), (uint32_t)~0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
240 false},
241 {LIMIT(maxDrawIndirectCount), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
242 {LIMIT(maxSamplerLodBias), 0, 0, 0, 2.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false},
243 {LIMIT(maxSamplerAnisotropy), 0, 0, 0, 16.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false},
244 {LIMIT(maxViewports), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
245 {LIMIT(maxViewportDimensions[0]), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
246 {LIMIT(maxViewportDimensions[1]), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
247 {LIMIT(viewportBoundsRange[0]), 0, 0, 0, -8192.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false},
248 {LIMIT(viewportBoundsRange[1]), 0, 0, 0, 8191.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false},
249 {LIMIT(viewportSubPixelBits), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
250 {LIMIT(minMemoryMapAlignment), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, true},
251 {LIMIT(minTexelBufferOffsetAlignment), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1, true},
252 {LIMIT(minTexelBufferOffsetAlignment), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1, true},
253 {LIMIT(minUniformBufferOffsetAlignment), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1, true},
254 {LIMIT(minUniformBufferOffsetAlignment), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1,
255 true},
256 {LIMIT(minStorageBufferOffsetAlignment), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1, true},
257 {LIMIT(minStorageBufferOffsetAlignment), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1,
258 true},
259 {LIMIT(minTexelOffset), 0, -8, 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MAX, -1, false},
260 {LIMIT(maxTexelOffset), 7, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
261 {LIMIT(minTexelGatherOffset), 0, -8, 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MAX, -1, false},
262 {LIMIT(maxTexelGatherOffset), 7, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
263 {LIMIT(minInterpolationOffset), 0, 0, 0, -0.5f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false},
264 {LIMIT(maxInterpolationOffset), 0, 0, 0,
265 0.5f - (1.0f / deFloatPow(2.0f, (float)limits->subPixelInterpolationOffsetBits)), LIMIT_FORMAT_FLOAT,
266 LIMIT_TYPE_MIN, -1, false},
267 {LIMIT(subPixelInterpolationOffsetBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
268 false},
269 {LIMIT(maxFramebufferWidth), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
270 {LIMIT(maxFramebufferHeight), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
271 {LIMIT(maxFramebufferLayers), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
272 {LIMIT(framebufferColorSampleCounts), VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f,
273 LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false},
274 {LIMIT(framebufferDepthSampleCounts), VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f,
275 LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false},
276 {LIMIT(framebufferStencilSampleCounts), VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f,
277 LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false},
278 {LIMIT(framebufferNoAttachmentsSampleCounts), VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f,
279 LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false},
280 {LIMIT(maxColorAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
281 {LIMIT(sampledImageColorSampleCounts), VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f,
282 LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false},
283 {LIMIT(sampledImageIntegerSampleCounts), VK_SAMPLE_COUNT_1_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK,
284 LIMIT_TYPE_MIN, -1, false},
285 {LIMIT(sampledImageDepthSampleCounts), VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f,
286 LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false},
287 {LIMIT(sampledImageStencilSampleCounts), VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f,
288 LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false},
289 {LIMIT(storageImageSampleCounts), VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f,
290 LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false},
291 {LIMIT(maxSampleMaskWords), 1, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
292 {LIMIT(timestampComputeAndGraphics), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1, false},
293 {LIMIT(timestampPeriod), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1, false},
294 {LIMIT(maxClipDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
295 {LIMIT(maxCullDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
296 {LIMIT(maxCombinedClipAndCullDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1,
297 false},
298 {LIMIT(discreteQueuePriorities), 2, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false},
299 {LIMIT(pointSizeRange[0]), 0, 0, 0, 0.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false},
300 {LIMIT(pointSizeRange[0]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false},
301 {LIMIT(pointSizeRange[1]), 0, 0, 0, 64.0f - limits->pointSizeGranularity, LIMIT_FORMAT_FLOAT,
302 LIMIT_TYPE_MIN, -1, false},
303 {LIMIT(lineWidthRange[0]), 0, 0, 0, 0.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false},
304 {LIMIT(lineWidthRange[0]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false},
305 {LIMIT(lineWidthRange[1]), 0, 0, 0, 8.0f - limits->lineWidthGranularity, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN,
306 -1, false},
307 {LIMIT(pointSizeGranularity), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false},
308 {LIMIT(lineWidthGranularity), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false},
309 {LIMIT(strictLines), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1, false},
310 {LIMIT(standardSampleLocations), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1, false},
311 {LIMIT(optimalBufferCopyOffsetAlignment), 0, 0, 0, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_NONE, -1,
312 true},
313 {LIMIT(optimalBufferCopyRowPitchAlignment), 0, 0, 0, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_NONE, -1,
314 true},
315 {LIMIT(nonCoherentAtomSize), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1, true},
316 {LIMIT(nonCoherentAtomSize), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1, true},
317 };
318
319 const struct UnsupportedFeatureLimitTable
320 {
321 uint32_t limitOffset;
322 const char *name;
323 uint32_t featureOffset;
324 uint32_t uintVal; //!< Format is UNSIGNED_INT
325 int32_t intVal; //!< Format is SIGNED_INT
326 uint64_t deviceSizeVal; //!< Format is DEVICE_SIZE
327 float floatVal; //!< Format is FLOAT
328 } unsupportedFeatureTable[] = {
329 {LIMIT(sparseAddressSpaceSize), FEATURE(sparseBinding), 0, 0, 0, 0.0f},
330 {LIMIT(maxTessellationGenerationLevel), FEATURE(tessellationShader), 0, 0, 0, 0.0f},
331 {LIMIT(maxTessellationPatchSize), FEATURE(tessellationShader), 0, 0, 0, 0.0f},
332 {LIMIT(maxTessellationControlPerVertexInputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f},
333 {LIMIT(maxTessellationControlPerVertexOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f},
334 {LIMIT(maxTessellationControlPerPatchOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f},
335 {LIMIT(maxTessellationControlTotalOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f},
336 {LIMIT(maxTessellationEvaluationInputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f},
337 {LIMIT(maxTessellationEvaluationOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f},
338 {LIMIT(maxGeometryShaderInvocations), FEATURE(geometryShader), 0, 0, 0, 0.0f},
339 {LIMIT(maxGeometryInputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f},
340 {LIMIT(maxGeometryOutputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f},
341 {LIMIT(maxGeometryOutputVertices), FEATURE(geometryShader), 0, 0, 0, 0.0f},
342 {LIMIT(maxGeometryTotalOutputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f},
343 {LIMIT(maxFragmentDualSrcAttachments), FEATURE(dualSrcBlend), 0, 0, 0, 0.0f},
344 {LIMIT(maxDrawIndexedIndexValue), FEATURE(fullDrawIndexUint32), (1 << 24) - 1, 0, 0, 0.0f},
345 {LIMIT(maxDrawIndirectCount), FEATURE(multiDrawIndirect), 1, 0, 0, 0.0f},
346 {LIMIT(maxSamplerAnisotropy), FEATURE(samplerAnisotropy), 1, 0, 0, 0.0f},
347 {LIMIT(maxViewports), FEATURE(multiViewport), 1, 0, 0, 0.0f},
348 {LIMIT(minTexelGatherOffset), FEATURE(shaderImageGatherExtended), 0, 0, 0, 0.0f},
349 {LIMIT(maxTexelGatherOffset), FEATURE(shaderImageGatherExtended), 0, 0, 0, 0.0f},
350 {LIMIT(minInterpolationOffset), FEATURE(sampleRateShading), 0, 0, 0, 0.0f},
351 {LIMIT(maxInterpolationOffset), FEATURE(sampleRateShading), 0, 0, 0, 0.0f},
352 {LIMIT(subPixelInterpolationOffsetBits), FEATURE(sampleRateShading), 0, 0, 0, 0.0f},
353 {LIMIT(storageImageSampleCounts), FEATURE(shaderStorageImageMultisample), VK_SAMPLE_COUNT_1_BIT, 0, 0, 0.0f},
354 {LIMIT(maxClipDistances), FEATURE(shaderClipDistance), 0, 0, 0, 0.0f},
355 {LIMIT(maxCullDistances), FEATURE(shaderCullDistance), 0, 0, 0, 0.0f},
356 {LIMIT(maxCombinedClipAndCullDistances), FEATURE(shaderClipDistance), 0, 0, 0, 0.0f},
357 {LIMIT(pointSizeRange[0]), FEATURE(largePoints), 0, 0, 0, 1.0f},
358 {LIMIT(pointSizeRange[1]), FEATURE(largePoints), 0, 0, 0, 1.0f},
359 {LIMIT(lineWidthRange[0]), FEATURE(wideLines), 0, 0, 0, 1.0f},
360 {LIMIT(lineWidthRange[1]), FEATURE(wideLines), 0, 0, 0, 1.0f},
361 {LIMIT(pointSizeGranularity), FEATURE(largePoints), 0, 0, 0, 0.0f},
362 {LIMIT(lineWidthGranularity), FEATURE(wideLines), 0, 0, 0, 0.0f}};
363
364 log << TestLog::Message << *limits << TestLog::EndMessage;
365
366 //!< First build a map from limit to unsupported table index
367 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
368 {
369 for (uint32_t unsuppNdx = 0; unsuppNdx < DE_LENGTH_OF_ARRAY(unsupportedFeatureTable); unsuppNdx++)
370 {
371 if (unsupportedFeatureTable[unsuppNdx].limitOffset == featureLimitTable[ndx].offset)
372 {
373 featureLimitTable[ndx].unsuppTableNdx = unsuppNdx;
374 break;
375 }
376 }
377 }
378
379 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
380 {
381 switch (featureLimitTable[ndx].format)
382 {
383 case LIMIT_FORMAT_UNSIGNED_INT:
384 {
385 uint32_t limitToCheck = featureLimitTable[ndx].uintVal;
386 if (featureLimitTable[ndx].unsuppTableNdx != -1)
387 {
388 if (*((VkBool32 *)((uint8_t *)features +
389 unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) ==
390 VK_FALSE)
391 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].uintVal;
392 }
393
394 if (featureLimitTable[ndx].pot)
395 {
396 if (*((uint32_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) == 0 ||
397 !deIntIsPow2(*((uint32_t *)((uint8_t *)limits + featureLimitTable[ndx].offset))))
398 {
399 log << TestLog::Message << "limit Validation failed " << featureLimitTable[ndx].name
400 << " is not a power of two." << TestLog::EndMessage;
401 limitsOk = false;
402 }
403 }
404
405 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
406 {
407 if (*((uint32_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) < limitToCheck)
408 {
409 log << TestLog::Message << "limit Validation failed " << featureLimitTable[ndx].name
410 << " not valid-limit type MIN - actual is "
411 << *((uint32_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
412 limitsOk = false;
413 }
414 }
415 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
416 {
417 if (*((uint32_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) > limitToCheck)
418 {
419 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
420 << " not valid-limit type MAX - actual is "
421 << *((uint32_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
422 limitsOk = false;
423 }
424 }
425 break;
426 }
427
428 case LIMIT_FORMAT_FLOAT:
429 {
430 float limitToCheck = featureLimitTable[ndx].floatVal;
431 if (featureLimitTable[ndx].unsuppTableNdx != -1)
432 {
433 if (*((VkBool32 *)((uint8_t *)features +
434 unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) ==
435 VK_FALSE)
436 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].floatVal;
437 }
438
439 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
440 {
441 if (*((float *)((uint8_t *)limits + featureLimitTable[ndx].offset)) < limitToCheck)
442 {
443 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
444 << " not valid-limit type MIN - actual is "
445 << *((float *)((uint8_t *)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
446 limitsOk = false;
447 }
448 }
449 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
450 {
451 if (*((float *)((uint8_t *)limits + featureLimitTable[ndx].offset)) > limitToCheck)
452 {
453 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
454 << " not valid-limit type MAX actual is "
455 << *((float *)((uint8_t *)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
456 limitsOk = false;
457 }
458 }
459 break;
460 }
461
462 case LIMIT_FORMAT_SIGNED_INT:
463 {
464 int32_t limitToCheck = featureLimitTable[ndx].intVal;
465 if (featureLimitTable[ndx].unsuppTableNdx != -1)
466 {
467 if (*((VkBool32 *)((uint8_t *)features +
468 unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) ==
469 VK_FALSE)
470 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].intVal;
471 }
472 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
473 {
474 if (*((int32_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) < limitToCheck)
475 {
476 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
477 << " not valid-limit type MIN actual is "
478 << *((int32_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
479 limitsOk = false;
480 }
481 }
482 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
483 {
484 if (*((int32_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) > limitToCheck)
485 {
486 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
487 << " not valid-limit type MAX actual is "
488 << *((int32_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
489 limitsOk = false;
490 }
491 }
492 break;
493 }
494
495 case LIMIT_FORMAT_DEVICE_SIZE:
496 {
497 uint64_t limitToCheck = featureLimitTable[ndx].deviceSizeVal;
498 if (featureLimitTable[ndx].unsuppTableNdx != -1)
499 {
500 if (*((VkBool32 *)((uint8_t *)features +
501 unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) ==
502 VK_FALSE)
503 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].deviceSizeVal;
504 }
505
506 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
507 {
508 if (*((uint64_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) < limitToCheck)
509 {
510 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
511 << " not valid-limit type MIN actual is "
512 << *((uint64_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
513 limitsOk = false;
514 }
515 }
516 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
517 {
518 if (*((uint64_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) > limitToCheck)
519 {
520 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
521 << " not valid-limit type MAX actual is "
522 << *((uint64_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
523 limitsOk = false;
524 }
525 }
526 break;
527 }
528
529 case LIMIT_FORMAT_BITMASK:
530 {
531 uint32_t limitToCheck = featureLimitTable[ndx].uintVal;
532 if (featureLimitTable[ndx].unsuppTableNdx != -1)
533 {
534 if (*((VkBool32 *)((uint8_t *)features +
535 unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) ==
536 VK_FALSE)
537 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].uintVal;
538 }
539
540 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
541 {
542 if ((*((uint32_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) & limitToCheck) != limitToCheck)
543 {
544 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
545 << " not valid-limit type bitmask actual is "
546 << *((uint64_t *)((uint8_t *)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
547 limitsOk = false;
548 }
549 }
550 break;
551 }
552
553 default:
554 DE_ASSERT(0);
555 limitsOk = false;
556 }
557 }
558
559 if (limits->maxFramebufferWidth > limits->maxViewportDimensions[0] ||
560 limits->maxFramebufferHeight > limits->maxViewportDimensions[1])
561 {
562 log << TestLog::Message << "limit validation failed, maxFramebufferDimension of "
563 << "[" << limits->maxFramebufferWidth << ", " << limits->maxFramebufferHeight << "] "
564 << "is larger than maxViewportDimension of "
565 << "[" << limits->maxViewportDimensions[0] << ", " << limits->maxViewportDimensions[1] << "]"
566 << TestLog::EndMessage;
567 limitsOk = false;
568 }
569
570 if (limits->viewportBoundsRange[0] > float(-2 * limits->maxViewportDimensions[0]))
571 {
572 log << TestLog::Message << "limit validation failed, viewPortBoundsRange[0] of "
573 << limits->viewportBoundsRange[0] << "is larger than -2*maxViewportDimension[0] of "
574 << -2 * limits->maxViewportDimensions[0] << TestLog::EndMessage;
575 limitsOk = false;
576 }
577
578 if (limits->viewportBoundsRange[1] < float(2 * limits->maxViewportDimensions[1] - 1))
579 {
580 log << TestLog::Message << "limit validation failed, viewportBoundsRange[1] of "
581 << limits->viewportBoundsRange[1] << "is less than 2*maxViewportDimension[1] of "
582 << 2 * limits->maxViewportDimensions[1] << TestLog::EndMessage;
583 limitsOk = false;
584 }
585
586 return limitsOk;
587 }
588
589 template <uint32_t MAJOR, uint32_t MINOR>
checkApiVersionSupport(Context & context)590 void checkApiVersionSupport(Context &context)
591 {
592 if (!context.contextSupports(vk::ApiVersion(0, MAJOR, MINOR, 0)))
593 TCU_THROW(NotSupportedError, std::string("At least Vulkan ") + std::to_string(MAJOR) + "." +
594 std::to_string(MINOR) + " required to run test");
595 }
596
597 typedef struct FeatureLimitTableItem_
598 {
599 const VkBool32 *cond;
600 const char *condName;
601 const void *ptr;
602 const char *name;
603 uint32_t uintVal; //!< Format is UNSIGNED_INT
604 int32_t intVal; //!< Format is SIGNED_INT
605 uint64_t deviceSizeVal; //!< Format is DEVICE_SIZE
606 float floatVal; //!< Format is FLOAT
607 LimitFormat format;
608 LimitType type;
609 } FeatureLimitTableItem;
610
611 template <typename T>
validateNumericLimit(const T limitToCheck,const T reportedValue,const LimitType limitType,const char * limitName,TestLog & log)612 bool validateNumericLimit(const T limitToCheck, const T reportedValue, const LimitType limitType, const char *limitName,
613 TestLog &log)
614 {
615 if (limitType == LIMIT_TYPE_MIN)
616 {
617 if (reportedValue < limitToCheck)
618 {
619 log << TestLog::Message << "Limit validation failed " << limitName << " reported value is " << reportedValue
620 << " expected MIN " << limitToCheck << TestLog::EndMessage;
621
622 return false;
623 }
624
625 log << TestLog::Message << limitName << "=" << reportedValue << " (>=" << limitToCheck << ")"
626 << TestLog::EndMessage;
627 }
628 else if (limitType == LIMIT_TYPE_MAX)
629 {
630 if (reportedValue > limitToCheck)
631 {
632 log << TestLog::Message << "Limit validation failed " << limitName << " reported value is " << reportedValue
633 << " expected MAX " << limitToCheck << TestLog::EndMessage;
634
635 return false;
636 }
637
638 log << TestLog::Message << limitName << "=" << reportedValue << " (<=" << limitToCheck << ")"
639 << TestLog::EndMessage;
640 }
641
642 return true;
643 }
644
645 template <typename T>
validateBitmaskLimit(const T limitToCheck,const T reportedValue,const LimitType limitType,const char * limitName,TestLog & log)646 bool validateBitmaskLimit(const T limitToCheck, const T reportedValue, const LimitType limitType, const char *limitName,
647 TestLog &log)
648 {
649 if (limitType == LIMIT_TYPE_MIN)
650 {
651 if ((reportedValue & limitToCheck) != limitToCheck)
652 {
653 log << TestLog::Message << "Limit validation failed " << limitName << " reported value is " << reportedValue
654 << " expected MIN " << limitToCheck << TestLog::EndMessage;
655
656 return false;
657 }
658
659 log << TestLog::Message << limitName << "=" << tcu::toHex(reportedValue) << " (contains "
660 << tcu::toHex(limitToCheck) << ")" << TestLog::EndMessage;
661 }
662
663 return true;
664 }
665
validateLimit(FeatureLimitTableItem limit,TestLog & log)666 bool validateLimit(FeatureLimitTableItem limit, TestLog &log)
667 {
668 if (*limit.cond == VK_FALSE)
669 {
670 log << TestLog::Message << "Limit validation skipped '" << limit.name << "' due to " << limit.condName
671 << " == VK_FALSE'" << TestLog::EndMessage;
672
673 return true;
674 }
675
676 switch (limit.format)
677 {
678 case LIMIT_FORMAT_UNSIGNED_INT:
679 {
680 const uint32_t limitToCheck = limit.uintVal;
681 const uint32_t reportedValue = *(uint32_t *)limit.ptr;
682
683 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
684 }
685
686 case LIMIT_FORMAT_FLOAT:
687 {
688 const float limitToCheck = limit.floatVal;
689 const float reportedValue = *(float *)limit.ptr;
690
691 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
692 }
693
694 case LIMIT_FORMAT_SIGNED_INT:
695 {
696 const int32_t limitToCheck = limit.intVal;
697 const int32_t reportedValue = *(int32_t *)limit.ptr;
698
699 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
700 }
701
702 case LIMIT_FORMAT_DEVICE_SIZE:
703 {
704 const uint64_t limitToCheck = limit.deviceSizeVal;
705 const uint64_t reportedValue = *(uint64_t *)limit.ptr;
706
707 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
708 }
709
710 case LIMIT_FORMAT_BITMASK:
711 {
712 const uint32_t limitToCheck = limit.uintVal;
713 const uint32_t reportedValue = *(uint32_t *)limit.ptr;
714
715 return validateBitmaskLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
716 }
717
718 default:
719 TCU_THROW(InternalError, "Unknown LimitFormat specified");
720 }
721 }
722
723 #ifdef PN
724 #error PN defined
725 #else
726 #define PN(_X_) &(_X_), (const char *)(#_X_)
727 #endif
728
729 #define LIM_MIN_UINT32(X) uint32_t(X), 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN
730 #define LIM_MAX_UINT32(X) uint32_t(X), 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MAX
731 #define LIM_NONE_UINT32 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE
732 #define LIM_MIN_INT32(X) 0, int32_t(X), 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MIN
733 #define LIM_MAX_INT32(X) 0, int32_t(X), 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MAX
734 #define LIM_NONE_INT32 0, 0, 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_NONE
735 #define LIM_MIN_DEVSIZE(X) 0, 0, VkDeviceSize(X), 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN
736 #define LIM_MAX_DEVSIZE(X) 0, 0, VkDeviceSize(X), 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX
737 #define LIM_NONE_DEVSIZE 0, 0, 0, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_NONE
738 #define LIM_MIN_FLOAT(X) 0, 0, 0, float(X), LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN
739 #define LIM_MAX_FLOAT(X) 0, 0, 0, float(X), LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX
740 #define LIM_NONE_FLOAT 0, 0, 0, 0.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_NONE
741 #define LIM_MIN_BITI32(X) uint32_t(X), 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN
742 #define LIM_MAX_BITI32(X) uint32_t(X), 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MAX
743 #define LIM_NONE_BITI32 0, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_NONE
744
validateLimits12(Context & context)745 tcu::TestStatus validateLimits12(Context &context)
746 {
747 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
748 const InstanceInterface &vki = context.getInstanceInterface();
749 TestLog &log = context.getTestContext().getLog();
750 bool limitsOk = true;
751
752 const VkPhysicalDeviceFeatures2 &features2 = context.getDeviceFeatures2();
753 const VkPhysicalDeviceFeatures &features = features2.features;
754 #ifdef CTS_USES_VULKANSC
755 const VkPhysicalDeviceVulkan11Features features11 = getPhysicalDeviceVulkan11Features(vki, physicalDevice);
756 #endif // CTS_USES_VULKANSC
757 const VkPhysicalDeviceVulkan12Features features12 = getPhysicalDeviceVulkan12Features(vki, physicalDevice);
758
759 const VkPhysicalDeviceProperties2 &properties2 = context.getDeviceProperties2();
760 const VkPhysicalDeviceVulkan12Properties vulkan12Properties =
761 getPhysicalDeviceVulkan12Properties(vki, physicalDevice);
762 const VkPhysicalDeviceVulkan11Properties vulkan11Properties =
763 getPhysicalDeviceVulkan11Properties(vki, physicalDevice);
764 #ifdef CTS_USES_VULKANSC
765 const VkPhysicalDeviceVulkanSC10Properties vulkanSC10Properties =
766 getPhysicalDeviceVulkanSC10Properties(vki, physicalDevice);
767 #endif // CTS_USES_VULKANSC
768 const VkPhysicalDeviceLimits &limits = properties2.properties.limits;
769
770 const VkBool32 checkAlways = VK_TRUE;
771 const VkBool32 checkVulkan12Limit = VK_TRUE;
772 #ifdef CTS_USES_VULKANSC
773 const VkBool32 checkVulkanSC10Limit = VK_TRUE;
774 #endif // CTS_USES_VULKANSC
775
776 uint32_t shaderStages = 3;
777 uint32_t maxPerStageResourcesMin =
778 deMin32(128, limits.maxPerStageDescriptorUniformBuffers + limits.maxPerStageDescriptorStorageBuffers +
779 limits.maxPerStageDescriptorSampledImages + limits.maxPerStageDescriptorStorageImages +
780 limits.maxPerStageDescriptorInputAttachments + limits.maxColorAttachments);
781 uint32_t maxFramebufferLayers = 256;
782
783 if (features.tessellationShader)
784 {
785 shaderStages += 2;
786 }
787
788 if (features.geometryShader)
789 {
790 shaderStages++;
791 }
792
793 // Vulkan SC
794 #ifdef CTS_USES_VULKANSC
795 if (features.geometryShader == VK_FALSE && features12.shaderOutputLayer == VK_FALSE)
796 {
797 maxFramebufferLayers = 1;
798 }
799 #endif // CTS_USES_VULKANSC
800
801 FeatureLimitTableItem featureLimitTable[] = {
802 {PN(checkAlways), PN(limits.maxImageDimension1D), LIM_MIN_UINT32(4096)},
803 {PN(checkAlways), PN(limits.maxImageDimension2D), LIM_MIN_UINT32(4096)},
804 {PN(checkAlways), PN(limits.maxImageDimension3D), LIM_MIN_UINT32(256)},
805 {PN(checkAlways), PN(limits.maxImageDimensionCube), LIM_MIN_UINT32(4096)},
806 {PN(checkAlways), PN(limits.maxImageArrayLayers), LIM_MIN_UINT32(256)},
807 {PN(checkAlways), PN(limits.maxTexelBufferElements), LIM_MIN_UINT32(65536)},
808 {PN(checkAlways), PN(limits.maxUniformBufferRange), LIM_MIN_UINT32(16384)},
809 {PN(checkAlways), PN(limits.maxStorageBufferRange), LIM_MIN_UINT32((1 << 27))},
810 {PN(checkAlways), PN(limits.maxPushConstantsSize), LIM_MIN_UINT32(128)},
811 {PN(checkAlways), PN(limits.maxMemoryAllocationCount), LIM_MIN_UINT32(4096)},
812 {PN(checkAlways), PN(limits.maxSamplerAllocationCount), LIM_MIN_UINT32(4000)},
813 {PN(checkAlways), PN(limits.bufferImageGranularity), LIM_MIN_DEVSIZE(1)},
814 {PN(checkAlways), PN(limits.bufferImageGranularity), LIM_MAX_DEVSIZE(131072)},
815 {PN(features.sparseBinding), PN(limits.sparseAddressSpaceSize), LIM_MIN_DEVSIZE((1ull << 31))},
816 {PN(checkAlways), PN(limits.maxBoundDescriptorSets), LIM_MIN_UINT32(4)},
817 {PN(checkAlways), PN(limits.maxPerStageDescriptorSamplers), LIM_MIN_UINT32(16)},
818 {PN(checkAlways), PN(limits.maxPerStageDescriptorUniformBuffers), LIM_MIN_UINT32(12)},
819 {PN(checkAlways), PN(limits.maxPerStageDescriptorStorageBuffers), LIM_MIN_UINT32(4)},
820 {PN(checkAlways), PN(limits.maxPerStageDescriptorSampledImages), LIM_MIN_UINT32(16)},
821 {PN(checkAlways), PN(limits.maxPerStageDescriptorStorageImages), LIM_MIN_UINT32(4)},
822 {PN(checkAlways), PN(limits.maxPerStageDescriptorInputAttachments), LIM_MIN_UINT32(4)},
823 {PN(checkAlways), PN(limits.maxPerStageResources), LIM_MIN_UINT32(maxPerStageResourcesMin)},
824 {PN(checkAlways), PN(limits.maxDescriptorSetSamplers), LIM_MIN_UINT32(shaderStages * 16)},
825 {PN(checkAlways), PN(limits.maxDescriptorSetUniformBuffers), LIM_MIN_UINT32(shaderStages * 12)},
826 {PN(checkAlways), PN(limits.maxDescriptorSetUniformBuffersDynamic), LIM_MIN_UINT32(8)},
827 {PN(checkAlways), PN(limits.maxDescriptorSetStorageBuffers), LIM_MIN_UINT32(shaderStages * 4)},
828 {PN(checkAlways), PN(limits.maxDescriptorSetStorageBuffersDynamic), LIM_MIN_UINT32(4)},
829 {PN(checkAlways), PN(limits.maxDescriptorSetSampledImages), LIM_MIN_UINT32(shaderStages * 16)},
830 {PN(checkAlways), PN(limits.maxDescriptorSetStorageImages), LIM_MIN_UINT32(shaderStages * 4)},
831 {PN(checkAlways), PN(limits.maxDescriptorSetInputAttachments), LIM_MIN_UINT32(4)},
832 {PN(checkAlways), PN(limits.maxVertexInputAttributes), LIM_MIN_UINT32(16)},
833 {PN(checkAlways), PN(limits.maxVertexInputBindings), LIM_MIN_UINT32(16)},
834 {PN(checkAlways), PN(limits.maxVertexInputAttributeOffset), LIM_MIN_UINT32(2047)},
835 {PN(checkAlways), PN(limits.maxVertexInputBindingStride), LIM_MIN_UINT32(2048)},
836 {PN(checkAlways), PN(limits.maxVertexOutputComponents), LIM_MIN_UINT32(64)},
837 {PN(features.tessellationShader), PN(limits.maxTessellationGenerationLevel), LIM_MIN_UINT32(64)},
838 {PN(features.tessellationShader), PN(limits.maxTessellationPatchSize), LIM_MIN_UINT32(32)},
839 {PN(features.tessellationShader), PN(limits.maxTessellationControlPerVertexInputComponents),
840 LIM_MIN_UINT32(64)},
841 {PN(features.tessellationShader), PN(limits.maxTessellationControlPerVertexOutputComponents),
842 LIM_MIN_UINT32(64)},
843 {PN(features.tessellationShader), PN(limits.maxTessellationControlPerPatchOutputComponents),
844 LIM_MIN_UINT32(120)},
845 {PN(features.tessellationShader), PN(limits.maxTessellationControlTotalOutputComponents), LIM_MIN_UINT32(2048)},
846 {PN(features.tessellationShader), PN(limits.maxTessellationEvaluationInputComponents), LIM_MIN_UINT32(64)},
847 {PN(features.tessellationShader), PN(limits.maxTessellationEvaluationOutputComponents), LIM_MIN_UINT32(64)},
848 {PN(features.geometryShader), PN(limits.maxGeometryShaderInvocations), LIM_MIN_UINT32(32)},
849 {PN(features.geometryShader), PN(limits.maxGeometryInputComponents), LIM_MIN_UINT32(64)},
850 {PN(features.geometryShader), PN(limits.maxGeometryOutputComponents), LIM_MIN_UINT32(64)},
851 {PN(features.geometryShader), PN(limits.maxGeometryOutputVertices), LIM_MIN_UINT32(256)},
852 {PN(features.geometryShader), PN(limits.maxGeometryTotalOutputComponents), LIM_MIN_UINT32(1024)},
853 {PN(checkAlways), PN(limits.maxFragmentInputComponents), LIM_MIN_UINT32(64)},
854 {PN(checkAlways), PN(limits.maxFragmentOutputAttachments), LIM_MIN_UINT32(4)},
855 {PN(features.dualSrcBlend), PN(limits.maxFragmentDualSrcAttachments), LIM_MIN_UINT32(1)},
856 {PN(checkAlways), PN(limits.maxFragmentCombinedOutputResources), LIM_MIN_UINT32(4)},
857 {PN(checkAlways), PN(limits.maxComputeSharedMemorySize), LIM_MIN_UINT32(16384)},
858 {PN(checkAlways), PN(limits.maxComputeWorkGroupCount[0]), LIM_MIN_UINT32(65535)},
859 {PN(checkAlways), PN(limits.maxComputeWorkGroupCount[1]), LIM_MIN_UINT32(65535)},
860 {PN(checkAlways), PN(limits.maxComputeWorkGroupCount[2]), LIM_MIN_UINT32(65535)},
861 {PN(checkAlways), PN(limits.maxComputeWorkGroupInvocations), LIM_MIN_UINT32(128)},
862 {PN(checkAlways), PN(limits.maxComputeWorkGroupSize[0]), LIM_MIN_UINT32(128)},
863 {PN(checkAlways), PN(limits.maxComputeWorkGroupSize[1]), LIM_MIN_UINT32(128)},
864 {PN(checkAlways), PN(limits.maxComputeWorkGroupSize[2]), LIM_MIN_UINT32(64)},
865 {PN(checkAlways), PN(limits.subPixelPrecisionBits), LIM_MIN_UINT32(4)},
866 {PN(checkAlways), PN(limits.subTexelPrecisionBits), LIM_MIN_UINT32(4)},
867 {PN(checkAlways), PN(limits.mipmapPrecisionBits), LIM_MIN_UINT32(4)},
868 {PN(features.fullDrawIndexUint32), PN(limits.maxDrawIndexedIndexValue), LIM_MIN_UINT32((uint32_t)~0)},
869 {PN(features.multiDrawIndirect), PN(limits.maxDrawIndirectCount), LIM_MIN_UINT32(65535)},
870 {PN(checkAlways), PN(limits.maxSamplerLodBias), LIM_MIN_FLOAT(2.0f)},
871 {PN(features.samplerAnisotropy), PN(limits.maxSamplerAnisotropy), LIM_MIN_FLOAT(16.0f)},
872 {PN(features.multiViewport), PN(limits.maxViewports), LIM_MIN_UINT32(16)},
873 {PN(checkAlways), PN(limits.maxViewportDimensions[0]), LIM_MIN_UINT32(4096)},
874 {PN(checkAlways), PN(limits.maxViewportDimensions[1]), LIM_MIN_UINT32(4096)},
875 {PN(checkAlways), PN(limits.viewportBoundsRange[0]), LIM_MAX_FLOAT(-8192.0f)},
876 {PN(checkAlways), PN(limits.viewportBoundsRange[1]), LIM_MIN_FLOAT(8191.0f)},
877 {PN(checkAlways), PN(limits.viewportSubPixelBits), LIM_MIN_UINT32(0)},
878 {PN(checkAlways), PN(limits.minMemoryMapAlignment), LIM_MIN_UINT32(64)},
879 {PN(checkAlways), PN(limits.minTexelBufferOffsetAlignment), LIM_MIN_DEVSIZE(1)},
880 {PN(checkAlways), PN(limits.minTexelBufferOffsetAlignment), LIM_MAX_DEVSIZE(256)},
881 {PN(checkAlways), PN(limits.minUniformBufferOffsetAlignment), LIM_MIN_DEVSIZE(1)},
882 {PN(checkAlways), PN(limits.minUniformBufferOffsetAlignment), LIM_MAX_DEVSIZE(256)},
883 {PN(checkAlways), PN(limits.minStorageBufferOffsetAlignment), LIM_MIN_DEVSIZE(1)},
884 {PN(checkAlways), PN(limits.minStorageBufferOffsetAlignment), LIM_MAX_DEVSIZE(256)},
885 {PN(checkAlways), PN(limits.minTexelOffset), LIM_MAX_INT32(-8)},
886 {PN(checkAlways), PN(limits.maxTexelOffset), LIM_MIN_INT32(7)},
887 {PN(features.shaderImageGatherExtended), PN(limits.minTexelGatherOffset), LIM_MAX_INT32(-8)},
888 {PN(features.shaderImageGatherExtended), PN(limits.maxTexelGatherOffset), LIM_MIN_INT32(7)},
889 {PN(features.sampleRateShading), PN(limits.minInterpolationOffset), LIM_MAX_FLOAT(-0.5f)},
890 {PN(features.sampleRateShading), PN(limits.maxInterpolationOffset),
891 LIM_MIN_FLOAT(0.5f - (1.0f / deFloatPow(2.0f, (float)limits.subPixelInterpolationOffsetBits)))},
892 {PN(features.sampleRateShading), PN(limits.subPixelInterpolationOffsetBits), LIM_MIN_UINT32(4)},
893 {PN(checkAlways), PN(limits.maxFramebufferWidth), LIM_MIN_UINT32(4096)},
894 {PN(checkAlways), PN(limits.maxFramebufferHeight), LIM_MIN_UINT32(4096)},
895 {PN(checkAlways), PN(limits.maxFramebufferLayers), LIM_MIN_UINT32(maxFramebufferLayers)},
896 {PN(checkAlways), PN(limits.framebufferColorSampleCounts),
897 LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT)},
898 {PN(checkVulkan12Limit), PN(vulkan12Properties.framebufferIntegerColorSampleCounts),
899 LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT)},
900 {PN(checkAlways), PN(limits.framebufferDepthSampleCounts),
901 LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT)},
902 {PN(checkAlways), PN(limits.framebufferStencilSampleCounts),
903 LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT)},
904 {PN(checkAlways), PN(limits.framebufferNoAttachmentsSampleCounts),
905 LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT)},
906 {PN(checkAlways), PN(limits.maxColorAttachments), LIM_MIN_UINT32(4)},
907 {PN(checkAlways), PN(limits.sampledImageColorSampleCounts),
908 LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT)},
909 {PN(checkAlways), PN(limits.sampledImageIntegerSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT)},
910 {PN(checkAlways), PN(limits.sampledImageDepthSampleCounts),
911 LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT)},
912 {PN(checkAlways), PN(limits.sampledImageStencilSampleCounts),
913 LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT)},
914 {PN(features.shaderStorageImageMultisample), PN(limits.storageImageSampleCounts),
915 LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_4_BIT)},
916 {PN(checkAlways), PN(limits.maxSampleMaskWords), LIM_MIN_UINT32(1)},
917 {PN(checkAlways), PN(limits.timestampComputeAndGraphics), LIM_NONE_UINT32},
918 {PN(checkAlways), PN(limits.timestampPeriod), LIM_NONE_UINT32},
919 {PN(features.shaderClipDistance), PN(limits.maxClipDistances), LIM_MIN_UINT32(8)},
920 {PN(features.shaderCullDistance), PN(limits.maxCullDistances), LIM_MIN_UINT32(8)},
921 {PN(features.shaderClipDistance), PN(limits.maxCombinedClipAndCullDistances), LIM_MIN_UINT32(8)},
922 {PN(checkAlways), PN(limits.discreteQueuePriorities), LIM_MIN_UINT32(2)},
923 {PN(features.largePoints), PN(limits.pointSizeRange[0]), LIM_MIN_FLOAT(0.0f)},
924 {PN(features.largePoints), PN(limits.pointSizeRange[0]), LIM_MAX_FLOAT(1.0f)},
925 {PN(features.largePoints), PN(limits.pointSizeRange[1]), LIM_MIN_FLOAT(64.0f - limits.pointSizeGranularity)},
926 {PN(features.wideLines), PN(limits.lineWidthRange[0]), LIM_MIN_FLOAT(0.0f)},
927 {PN(features.wideLines), PN(limits.lineWidthRange[0]), LIM_MAX_FLOAT(1.0f)},
928 {PN(features.wideLines), PN(limits.lineWidthRange[1]), LIM_MIN_FLOAT(8.0f - limits.lineWidthGranularity)},
929 {PN(features.largePoints), PN(limits.pointSizeGranularity), LIM_MIN_FLOAT(0.0f)},
930 {PN(features.largePoints), PN(limits.pointSizeGranularity), LIM_MAX_FLOAT(1.0f)},
931 {PN(features.wideLines), PN(limits.lineWidthGranularity), LIM_MIN_FLOAT(0.0f)},
932 {PN(features.wideLines), PN(limits.lineWidthGranularity), LIM_MAX_FLOAT(1.0f)},
933 {PN(checkAlways), PN(limits.strictLines), LIM_NONE_UINT32},
934 {PN(checkAlways), PN(limits.standardSampleLocations), LIM_NONE_UINT32},
935 {PN(checkAlways), PN(limits.optimalBufferCopyOffsetAlignment), LIM_NONE_DEVSIZE},
936 {PN(checkAlways), PN(limits.optimalBufferCopyRowPitchAlignment), LIM_NONE_DEVSIZE},
937 {PN(checkAlways), PN(limits.nonCoherentAtomSize), LIM_MIN_DEVSIZE(1)},
938 {PN(checkAlways), PN(limits.nonCoherentAtomSize), LIM_MAX_DEVSIZE(256)},
939
940 // VK_KHR_multiview
941 #ifndef CTS_USES_VULKANSC
942 {PN(checkVulkan12Limit), PN(vulkan11Properties.maxMultiviewViewCount), LIM_MIN_UINT32(6)},
943 {PN(checkVulkan12Limit), PN(vulkan11Properties.maxMultiviewInstanceIndex), LIM_MIN_UINT32((1 << 27) - 1)},
944 #else
945 {PN(features11.multiview), PN(vulkan11Properties.maxMultiviewViewCount), LIM_MIN_UINT32(6)},
946 {PN(features11.multiview), PN(vulkan11Properties.maxMultiviewInstanceIndex), LIM_MIN_UINT32((1 << 27) - 1)},
947 #endif // CTS_USES_VULKANSC
948
949 // VK_KHR_maintenance3
950 {PN(checkVulkan12Limit), PN(vulkan11Properties.maxPerSetDescriptors), LIM_MIN_UINT32(1024)},
951 {PN(checkVulkan12Limit), PN(vulkan11Properties.maxMemoryAllocationSize), LIM_MIN_DEVSIZE(1 << 30)},
952
953 // VK_EXT_descriptor_indexing
954 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxUpdateAfterBindDescriptorsInAllPools),
955 LIM_MIN_UINT32(500000)},
956 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSamplers),
957 LIM_MIN_UINT32(500000)},
958 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindUniformBuffers),
959 LIM_MIN_UINT32(12)},
960 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageBuffers),
961 LIM_MIN_UINT32(500000)},
962 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSampledImages),
963 LIM_MIN_UINT32(500000)},
964 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageImages),
965 LIM_MIN_UINT32(500000)},
966 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindInputAttachments),
967 LIM_MIN_UINT32(4)},
968 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageUpdateAfterBindResources),
969 LIM_MIN_UINT32(500000)},
970 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSamplers),
971 LIM_MIN_UINT32(500000)},
972 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffers),
973 LIM_MIN_UINT32(shaderStages * 12)},
974 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic),
975 LIM_MIN_UINT32(8)},
976 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffers),
977 LIM_MIN_UINT32(500000)},
978 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic),
979 LIM_MIN_UINT32(4)},
980 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSampledImages),
981 LIM_MIN_UINT32(500000)},
982 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageImages),
983 LIM_MIN_UINT32(500000)},
984 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindInputAttachments),
985 LIM_MIN_UINT32(4)},
986 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSamplers),
987 LIM_MIN_UINT32(limits.maxPerStageDescriptorSamplers)},
988 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindUniformBuffers),
989 LIM_MIN_UINT32(limits.maxPerStageDescriptorUniformBuffers)},
990 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageBuffers),
991 LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageBuffers)},
992 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSampledImages),
993 LIM_MIN_UINT32(limits.maxPerStageDescriptorSampledImages)},
994 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageImages),
995 LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageImages)},
996 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindInputAttachments),
997 LIM_MIN_UINT32(limits.maxPerStageDescriptorInputAttachments)},
998 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageUpdateAfterBindResources),
999 LIM_MIN_UINT32(limits.maxPerStageResources)},
1000 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSamplers),
1001 LIM_MIN_UINT32(limits.maxDescriptorSetSamplers)},
1002 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffers),
1003 LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffers)},
1004 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic),
1005 LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffersDynamic)},
1006 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffers),
1007 LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffers)},
1008 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic),
1009 LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffersDynamic)},
1010 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSampledImages),
1011 LIM_MIN_UINT32(limits.maxDescriptorSetSampledImages)},
1012 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageImages),
1013 LIM_MIN_UINT32(limits.maxDescriptorSetStorageImages)},
1014 {PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindInputAttachments),
1015 LIM_MIN_UINT32(limits.maxDescriptorSetInputAttachments)},
1016
1017 // timelineSemaphore
1018 #ifndef CTS_USES_VULKANSC
1019 {PN(checkVulkan12Limit), PN(vulkan12Properties.maxTimelineSemaphoreValueDifference),
1020 LIM_MIN_DEVSIZE((1ull << 31) - 1)},
1021 #else
1022 // VkPhysicalDeviceVulkan12Features::timelineSemaphore is optional in Vulkan SC
1023 {PN(features12.timelineSemaphore), PN(vulkan12Properties.maxTimelineSemaphoreValueDifference),
1024 LIM_MIN_DEVSIZE((1ull << 31) - 1)},
1025 #endif // CTS_USES_VULKANSC
1026
1027 // Vulkan SC
1028 #ifdef CTS_USES_VULKANSC
1029 {PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxRenderPassSubpasses), LIM_MIN_UINT32(1)},
1030 {PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxRenderPassDependencies), LIM_MIN_UINT32(18)},
1031 {PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxSubpassInputAttachments), LIM_MIN_UINT32(0)},
1032 {PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxSubpassPreserveAttachments), LIM_MIN_UINT32(0)},
1033 {PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxFramebufferAttachments), LIM_MIN_UINT32(9)},
1034 {PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxDescriptorSetLayoutBindings), LIM_MIN_UINT32(64)},
1035 {PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxQueryFaultCount), LIM_MIN_UINT32(16)},
1036 {PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxCallbackFaultCount), LIM_MIN_UINT32(1)},
1037 {PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxCommandPoolCommandBuffers), LIM_MIN_UINT32(256)},
1038 {PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxCommandBufferSize), LIM_MIN_UINT32(1048576)},
1039 #endif // CTS_USES_VULKANSC
1040 };
1041
1042 log << TestLog::Message << limits << TestLog::EndMessage;
1043
1044 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1045 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1046
1047 if (limits.maxFramebufferWidth > limits.maxViewportDimensions[0] ||
1048 limits.maxFramebufferHeight > limits.maxViewportDimensions[1])
1049 {
1050 log << TestLog::Message << "limit validation failed, maxFramebufferDimension of "
1051 << "[" << limits.maxFramebufferWidth << ", " << limits.maxFramebufferHeight << "] "
1052 << "is larger than maxViewportDimension of "
1053 << "[" << limits.maxViewportDimensions[0] << ", " << limits.maxViewportDimensions[1] << "]"
1054 << TestLog::EndMessage;
1055 limitsOk = false;
1056 }
1057
1058 if (limits.viewportBoundsRange[0] > float(-2 * limits.maxViewportDimensions[0]))
1059 {
1060 log << TestLog::Message << "limit validation failed, viewPortBoundsRange[0] of "
1061 << limits.viewportBoundsRange[0] << "is larger than -2*maxViewportDimension[0] of "
1062 << -2 * limits.maxViewportDimensions[0] << TestLog::EndMessage;
1063 limitsOk = false;
1064 }
1065
1066 if (limits.viewportBoundsRange[1] < float(2 * limits.maxViewportDimensions[1] - 1))
1067 {
1068 log << TestLog::Message << "limit validation failed, viewportBoundsRange[1] of "
1069 << limits.viewportBoundsRange[1] << "is less than 2*maxViewportDimension[1] of "
1070 << 2 * limits.maxViewportDimensions[1] << TestLog::EndMessage;
1071 limitsOk = false;
1072 }
1073
1074 if (limitsOk)
1075 return tcu::TestStatus::pass("pass");
1076 else
1077 return tcu::TestStatus::fail("fail");
1078 }
1079
1080 #ifndef CTS_USES_VULKANSC
1081
validateLimits14(Context & context)1082 tcu::TestStatus validateLimits14(Context &context)
1083 {
1084 TestLog &log = context.getTestContext().getLog();
1085 bool limitsOk = true;
1086
1087 const auto &features2 = context.getDeviceFeatures2();
1088 const auto &features = features2.features;
1089
1090 const auto vk11Properties = context.getDeviceVulkan11Properties();
1091 const auto vk12Properties = context.getDeviceVulkan12Properties();
1092 const auto vk12Features = context.getDeviceVulkan12Features();
1093 const auto &properties2 = context.getDeviceProperties2();
1094 const auto &limits = properties2.properties.limits;
1095
1096 const VkBool32 checkAlways = VK_TRUE;
1097 const VkBool32 checkShaderSZINPreserve = vk11Properties.subgroupSize > 1;
1098 const VkBool32 checkShaderSZINPreserveF16 = (checkShaderSZINPreserve && vk12Features.shaderFloat16);
1099
1100 VkShaderStageFlags subgroupSupportedStages = VK_SHADER_STAGE_COMPUTE_BIT | VK_SHADER_STAGE_FRAGMENT_BIT;
1101 VkSubgroupFeatureFlags subgroupFeatureFlags =
1102 VK_SUBGROUP_FEATURE_BASIC_BIT | VK_SUBGROUP_FEATURE_VOTE_BIT | VK_SUBGROUP_FEATURE_ARITHMETIC_BIT |
1103 VK_SUBGROUP_FEATURE_BALLOT_BIT | VK_SUBGROUP_FEATURE_SHUFFLE_BIT | VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT;
1104 if (vk11Properties.subgroupSize > 3)
1105 subgroupFeatureFlags |= VK_SUBGROUP_FEATURE_QUAD_BIT;
1106
1107 FeatureLimitTableItem featureLimitTable[] = {
1108 {PN(checkAlways), PN(limits.maxImageDimension1D), LIM_MIN_UINT32(8192)},
1109 {PN(checkAlways), PN(limits.maxImageDimension2D), LIM_MIN_UINT32(8192)},
1110 {PN(checkAlways), PN(limits.maxImageDimension3D), LIM_MIN_UINT32(512)},
1111 {PN(checkAlways), PN(limits.maxImageDimensionCube), LIM_MIN_UINT32(8192)},
1112 {PN(checkAlways), PN(limits.maxImageArrayLayers), LIM_MIN_UINT32(2048)},
1113 {PN(checkAlways), PN(limits.maxUniformBufferRange), LIM_MIN_UINT32(65536)},
1114 {PN(checkAlways), PN(limits.maxPushConstantsSize), LIM_MIN_UINT32(256)},
1115 {PN(checkAlways), PN(limits.bufferImageGranularity), LIM_MIN_DEVSIZE(1)},
1116 {PN(checkAlways), PN(limits.bufferImageGranularity), LIM_MAX_DEVSIZE(4096)},
1117 {PN(checkAlways), PN(limits.maxBoundDescriptorSets), LIM_MIN_UINT32(7)},
1118 {PN(checkAlways), PN(limits.maxPerStageDescriptorUniformBuffers), LIM_MIN_UINT32(15)},
1119 {PN(checkAlways), PN(limits.maxPerStageResources), LIM_MIN_UINT32(200)},
1120 {PN(checkAlways), PN(limits.maxDescriptorSetUniformBuffers), LIM_MIN_UINT32(90)},
1121 {PN(checkAlways), PN(limits.maxDescriptorSetStorageBuffers), LIM_MIN_UINT32(96)},
1122 {PN(checkAlways), PN(limits.maxDescriptorSetStorageImages), LIM_MIN_UINT32(144)},
1123 {PN(checkAlways), PN(limits.maxFragmentCombinedOutputResources), LIM_MIN_UINT32(16)},
1124 {PN(checkAlways), PN(limits.maxComputeWorkGroupInvocations), LIM_MIN_UINT32(256)},
1125 {PN(checkAlways), PN(limits.maxComputeWorkGroupSize[0]), LIM_MIN_UINT32(256)},
1126 {PN(checkAlways), PN(limits.maxComputeWorkGroupSize[1]), LIM_MIN_UINT32(256)},
1127 {PN(checkAlways), PN(limits.maxComputeWorkGroupSize[2]), LIM_MIN_UINT32(64)},
1128 {PN(checkAlways), PN(limits.subTexelPrecisionBits), LIM_MIN_UINT32(8)},
1129 {PN(checkAlways), PN(limits.mipmapPrecisionBits), LIM_MIN_UINT32(6)},
1130 {PN(checkAlways), PN(limits.maxSamplerLodBias), LIM_MIN_FLOAT(14.0f)},
1131 {PN(checkAlways), PN(limits.maxColorAttachments), LIM_MIN_UINT32(8)},
1132 {PN(checkAlways), PN(limits.timestampComputeAndGraphics), LIM_MIN_UINT32(1)},
1133 {PN(checkAlways), PN(limits.standardSampleLocations), LIM_MIN_UINT32(1)},
1134 {PN(features.largePoints), PN(limits.pointSizeRange[0]), LIM_MIN_FLOAT(0.0f)},
1135 {PN(features.largePoints), PN(limits.pointSizeRange[0]), LIM_MAX_FLOAT(1.0f)},
1136 {PN(features.largePoints), PN(limits.pointSizeRange[1]), LIM_MIN_FLOAT(256.0f - limits.pointSizeGranularity)},
1137 {PN(features.largePoints), PN(limits.pointSizeGranularity), LIM_MIN_FLOAT(0.0f)},
1138 {PN(features.largePoints), PN(limits.pointSizeGranularity), LIM_MAX_FLOAT(0.125f)},
1139 {PN(features.wideLines), PN(limits.lineWidthGranularity), LIM_MIN_FLOAT(0.0f)},
1140 {PN(features.wideLines), PN(limits.lineWidthGranularity), LIM_MAX_FLOAT(0.5f)},
1141 {PN(checkAlways), PN(vk11Properties.subgroupSupportedStages), LIM_MIN_UINT32(subgroupSupportedStages)},
1142 {PN(checkAlways), PN(vk11Properties.subgroupSupportedOperations), LIM_MIN_UINT32(subgroupFeatureFlags)},
1143 {PN(checkShaderSZINPreserveF16), PN(vk12Properties.shaderSignedZeroInfNanPreserveFloat16), LIM_MIN_UINT32(1)},
1144 {PN(checkShaderSZINPreserve), PN(vk12Properties.shaderSignedZeroInfNanPreserveFloat32), LIM_MIN_UINT32(1)},
1145 };
1146
1147 log << TestLog::Message << limits << TestLog::EndMessage;
1148
1149 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1150 {
1151 if (!validateLimit(featureLimitTable[ndx], log))
1152 limitsOk = false;
1153 }
1154
1155 if (limitsOk)
1156 return tcu::TestStatus::pass("pass");
1157
1158 return tcu::TestStatus::fail("fail");
1159 }
1160
checkSupportKhrPushDescriptor(Context & context)1161 void checkSupportKhrPushDescriptor(Context &context)
1162 {
1163 context.requireDeviceFunctionality("VK_KHR_push_descriptor");
1164 }
1165
validateLimitsKhrPushDescriptor(Context & context)1166 tcu::TestStatus validateLimitsKhrPushDescriptor(Context &context)
1167 {
1168 const VkBool32 checkAlways = VK_TRUE;
1169 const VkPhysicalDevicePushDescriptorPropertiesKHR &pushDescriptorPropertiesKHR =
1170 context.getPushDescriptorProperties();
1171 TestLog &log = context.getTestContext().getLog();
1172 bool limitsOk = true;
1173
1174 FeatureLimitTableItem featureLimitTable[] = {
1175 {PN(checkAlways), PN(pushDescriptorPropertiesKHR.maxPushDescriptors), LIM_MIN_UINT32(32)},
1176 };
1177
1178 log << TestLog::Message << pushDescriptorPropertiesKHR << TestLog::EndMessage;
1179
1180 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1181 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1182
1183 if (limitsOk)
1184 return tcu::TestStatus::pass("pass");
1185 else
1186 return tcu::TestStatus::fail("fail");
1187 }
1188
1189 #endif // CTS_USES_VULKANSC
1190
checkSupportKhrMultiview(Context & context)1191 void checkSupportKhrMultiview(Context &context)
1192 {
1193 context.requireDeviceFunctionality("VK_KHR_multiview");
1194 }
1195
validateLimitsKhrMultiview(Context & context)1196 tcu::TestStatus validateLimitsKhrMultiview(Context &context)
1197 {
1198 const VkBool32 checkAlways = VK_TRUE;
1199 const VkPhysicalDeviceMultiviewProperties &multiviewProperties = context.getMultiviewProperties();
1200 TestLog &log = context.getTestContext().getLog();
1201 bool limitsOk = true;
1202
1203 FeatureLimitTableItem featureLimitTable[] = {
1204 // VK_KHR_multiview
1205 {PN(checkAlways), PN(multiviewProperties.maxMultiviewViewCount), LIM_MIN_UINT32(6)},
1206 {PN(checkAlways), PN(multiviewProperties.maxMultiviewInstanceIndex), LIM_MIN_UINT32((1 << 27) - 1)},
1207 };
1208
1209 log << TestLog::Message << multiviewProperties << TestLog::EndMessage;
1210
1211 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1212 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1213
1214 if (limitsOk)
1215 return tcu::TestStatus::pass("pass");
1216 else
1217 return tcu::TestStatus::fail("fail");
1218 }
1219
checkSupportExtDiscardRectangles(Context & context)1220 void checkSupportExtDiscardRectangles(Context &context)
1221 {
1222 context.requireDeviceFunctionality("VK_EXT_discard_rectangles");
1223 }
1224
validateLimitsExtDiscardRectangles(Context & context)1225 tcu::TestStatus validateLimitsExtDiscardRectangles(Context &context)
1226 {
1227 const VkBool32 checkAlways = VK_TRUE;
1228 const VkPhysicalDeviceDiscardRectanglePropertiesEXT &discardRectanglePropertiesEXT =
1229 context.getDiscardRectanglePropertiesEXT();
1230 TestLog &log = context.getTestContext().getLog();
1231 bool limitsOk = true;
1232
1233 FeatureLimitTableItem featureLimitTable[] = {
1234 {PN(checkAlways), PN(discardRectanglePropertiesEXT.maxDiscardRectangles), LIM_MIN_UINT32(4)},
1235 };
1236
1237 log << TestLog::Message << discardRectanglePropertiesEXT << TestLog::EndMessage;
1238
1239 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1240 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1241
1242 if (limitsOk)
1243 return tcu::TestStatus::pass("pass");
1244 else
1245 return tcu::TestStatus::fail("fail");
1246 }
1247
checkSupportExtSampleLocations(Context & context)1248 void checkSupportExtSampleLocations(Context &context)
1249 {
1250 context.requireDeviceFunctionality("VK_EXT_sample_locations");
1251 }
1252
validateLimitsExtSampleLocations(Context & context)1253 tcu::TestStatus validateLimitsExtSampleLocations(Context &context)
1254 {
1255 const VkBool32 checkAlways = VK_TRUE;
1256 const VkPhysicalDeviceSampleLocationsPropertiesEXT &sampleLocationsPropertiesEXT =
1257 context.getSampleLocationsPropertiesEXT();
1258 TestLog &log = context.getTestContext().getLog();
1259 bool limitsOk = true;
1260
1261 FeatureLimitTableItem featureLimitTable[] = {
1262 {PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationSampleCounts),
1263 LIM_MIN_BITI32(VK_SAMPLE_COUNT_4_BIT)},
1264 {PN(checkAlways), PN(sampleLocationsPropertiesEXT.maxSampleLocationGridSize.width), LIM_MIN_FLOAT(0.0f)},
1265 {PN(checkAlways), PN(sampleLocationsPropertiesEXT.maxSampleLocationGridSize.height), LIM_MIN_FLOAT(0.0f)},
1266 {PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationCoordinateRange[0]), LIM_MAX_FLOAT(0.0f)},
1267 {PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationCoordinateRange[1]), LIM_MIN_FLOAT(0.9375f)},
1268 {PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationSubPixelBits), LIM_MIN_UINT32(4)},
1269 };
1270
1271 log << TestLog::Message << sampleLocationsPropertiesEXT << TestLog::EndMessage;
1272
1273 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1274 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1275
1276 if (limitsOk)
1277 return tcu::TestStatus::pass("pass");
1278 else
1279 return tcu::TestStatus::fail("fail");
1280 }
1281
checkSupportExtExternalMemoryHost(Context & context)1282 void checkSupportExtExternalMemoryHost(Context &context)
1283 {
1284 context.requireDeviceFunctionality("VK_EXT_external_memory_host");
1285 }
1286
validateLimitsExtExternalMemoryHost(Context & context)1287 tcu::TestStatus validateLimitsExtExternalMemoryHost(Context &context)
1288 {
1289 const VkBool32 checkAlways = VK_TRUE;
1290 const VkPhysicalDeviceExternalMemoryHostPropertiesEXT &externalMemoryHostPropertiesEXT =
1291 context.getExternalMemoryHostPropertiesEXT();
1292 TestLog &log = context.getTestContext().getLog();
1293 bool limitsOk = true;
1294
1295 FeatureLimitTableItem featureLimitTable[] = {
1296 {PN(checkAlways), PN(externalMemoryHostPropertiesEXT.minImportedHostPointerAlignment), LIM_MAX_DEVSIZE(65536)},
1297 };
1298
1299 log << TestLog::Message << externalMemoryHostPropertiesEXT << TestLog::EndMessage;
1300
1301 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1302 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1303
1304 if (limitsOk)
1305 return tcu::TestStatus::pass("pass");
1306 else
1307 return tcu::TestStatus::fail("fail");
1308 }
1309
checkSupportExtBlendOperationAdvanced(Context & context)1310 void checkSupportExtBlendOperationAdvanced(Context &context)
1311 {
1312 context.requireDeviceFunctionality("VK_EXT_blend_operation_advanced");
1313 }
1314
validateLimitsExtBlendOperationAdvanced(Context & context)1315 tcu::TestStatus validateLimitsExtBlendOperationAdvanced(Context &context)
1316 {
1317 const VkBool32 checkAlways = VK_TRUE;
1318 const VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT &blendOperationAdvancedPropertiesEXT =
1319 context.getBlendOperationAdvancedPropertiesEXT();
1320 TestLog &log = context.getTestContext().getLog();
1321 bool limitsOk = true;
1322
1323 FeatureLimitTableItem featureLimitTable[] = {
1324 {PN(checkAlways), PN(blendOperationAdvancedPropertiesEXT.advancedBlendMaxColorAttachments), LIM_MIN_UINT32(1)},
1325 };
1326
1327 log << TestLog::Message << blendOperationAdvancedPropertiesEXT << TestLog::EndMessage;
1328
1329 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1330 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1331
1332 if (limitsOk)
1333 return tcu::TestStatus::pass("pass");
1334 else
1335 return tcu::TestStatus::fail("fail");
1336 }
1337
checkSupportKhrMaintenance3(Context & context)1338 void checkSupportKhrMaintenance3(Context &context)
1339 {
1340 context.requireDeviceFunctionality("VK_KHR_maintenance3");
1341 }
1342
1343 #ifndef CTS_USES_VULKANSC
checkSupportKhrMaintenance4(Context & context)1344 void checkSupportKhrMaintenance4(Context &context)
1345 {
1346 context.requireDeviceFunctionality("VK_KHR_maintenance4");
1347 }
1348 #endif // CTS_USES_VULKANSC
1349
validateLimitsKhrMaintenance3(Context & context)1350 tcu::TestStatus validateLimitsKhrMaintenance3(Context &context)
1351 {
1352 const VkBool32 checkAlways = VK_TRUE;
1353 const VkPhysicalDeviceMaintenance3Properties &maintenance3Properties = context.getMaintenance3Properties();
1354 TestLog &log = context.getTestContext().getLog();
1355 bool limitsOk = true;
1356
1357 FeatureLimitTableItem featureLimitTable[] = {
1358 {PN(checkAlways), PN(maintenance3Properties.maxPerSetDescriptors), LIM_MIN_UINT32(1024)},
1359 {PN(checkAlways), PN(maintenance3Properties.maxMemoryAllocationSize), LIM_MIN_DEVSIZE(1 << 30)},
1360 };
1361
1362 log << TestLog::Message << maintenance3Properties << TestLog::EndMessage;
1363
1364 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1365 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1366
1367 if (limitsOk)
1368 return tcu::TestStatus::pass("pass");
1369 else
1370 return tcu::TestStatus::fail("fail");
1371 }
1372
1373 #ifndef CTS_USES_VULKANSC
validateLimitsKhrMaintenance4(Context & context)1374 tcu::TestStatus validateLimitsKhrMaintenance4(Context &context)
1375 {
1376 const VkBool32 checkAlways = VK_TRUE;
1377 const VkPhysicalDeviceMaintenance4Properties &maintenance4Properties = context.getMaintenance4Properties();
1378 TestLog &log = context.getTestContext().getLog();
1379 bool limitsOk = true;
1380
1381 FeatureLimitTableItem featureLimitTable[] = {
1382 {PN(checkAlways), PN(maintenance4Properties.maxBufferSize), LIM_MIN_DEVSIZE(1 << 30)},
1383 };
1384
1385 log << TestLog::Message << maintenance4Properties << TestLog::EndMessage;
1386
1387 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1388 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1389
1390 if (limitsOk)
1391 return tcu::TestStatus::pass("pass");
1392 else
1393 return tcu::TestStatus::fail("fail");
1394 }
1395 #endif // CTS_USES_VULKANSC
1396
checkSupportExtConservativeRasterization(Context & context)1397 void checkSupportExtConservativeRasterization(Context &context)
1398 {
1399 context.requireDeviceFunctionality("VK_EXT_conservative_rasterization");
1400 }
1401
validateLimitsExtConservativeRasterization(Context & context)1402 tcu::TestStatus validateLimitsExtConservativeRasterization(Context &context)
1403 {
1404 const VkBool32 checkAlways = VK_TRUE;
1405 const VkPhysicalDeviceConservativeRasterizationPropertiesEXT &conservativeRasterizationPropertiesEXT =
1406 context.getConservativeRasterizationPropertiesEXT();
1407 TestLog &log = context.getTestContext().getLog();
1408 bool limitsOk = true;
1409
1410 FeatureLimitTableItem featureLimitTable[] = {
1411 {PN(checkAlways), PN(conservativeRasterizationPropertiesEXT.primitiveOverestimationSize), LIM_MIN_FLOAT(0.0f)},
1412 {PN(checkAlways), PN(conservativeRasterizationPropertiesEXT.maxExtraPrimitiveOverestimationSize),
1413 LIM_MIN_FLOAT(0.0f)},
1414 {PN(checkAlways), PN(conservativeRasterizationPropertiesEXT.extraPrimitiveOverestimationSizeGranularity),
1415 LIM_MIN_FLOAT(0.0f)},
1416 };
1417
1418 log << TestLog::Message << conservativeRasterizationPropertiesEXT << TestLog::EndMessage;
1419
1420 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1421 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1422
1423 if (limitsOk)
1424 return tcu::TestStatus::pass("pass");
1425 else
1426 return tcu::TestStatus::fail("fail");
1427 }
1428
checkSupportExtDescriptorIndexing(Context & context)1429 void checkSupportExtDescriptorIndexing(Context &context)
1430 {
1431 const std::string &requiredDeviceExtension = "VK_EXT_descriptor_indexing";
1432
1433 if (!context.isDeviceFunctionalitySupported(requiredDeviceExtension))
1434 TCU_THROW(NotSupportedError, requiredDeviceExtension + " is not supported");
1435
1436 // Extension string is present, then extension is really supported and should have been added into chain in DefaultDevice properties and features
1437 }
1438
validateLimitsExtDescriptorIndexing(Context & context)1439 tcu::TestStatus validateLimitsExtDescriptorIndexing(Context &context)
1440 {
1441 const VkBool32 checkAlways = VK_TRUE;
1442 const VkPhysicalDeviceProperties2 &properties2 = context.getDeviceProperties2();
1443 const VkPhysicalDeviceLimits &limits = properties2.properties.limits;
1444 const VkPhysicalDeviceDescriptorIndexingProperties &descriptorIndexingProperties =
1445 context.getDescriptorIndexingProperties();
1446 const VkPhysicalDeviceFeatures &features = context.getDeviceFeatures();
1447 const uint32_t tessellationShaderCount = (features.tessellationShader) ? 2 : 0;
1448 const uint32_t geometryShaderCount = (features.geometryShader) ? 1 : 0;
1449 const uint32_t shaderStages = 3 + tessellationShaderCount + geometryShaderCount;
1450 TestLog &log = context.getTestContext().getLog();
1451 bool limitsOk = true;
1452
1453 FeatureLimitTableItem featureLimitTable[] = {
1454 {PN(checkAlways), PN(descriptorIndexingProperties.maxUpdateAfterBindDescriptorsInAllPools),
1455 LIM_MIN_UINT32(500000)},
1456 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSamplers),
1457 LIM_MIN_UINT32(500000)},
1458 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindUniformBuffers),
1459 LIM_MIN_UINT32(12)},
1460 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageBuffers),
1461 LIM_MIN_UINT32(500000)},
1462 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSampledImages),
1463 LIM_MIN_UINT32(500000)},
1464 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageImages),
1465 LIM_MIN_UINT32(500000)},
1466 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindInputAttachments),
1467 LIM_MIN_UINT32(4)},
1468 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageUpdateAfterBindResources), LIM_MIN_UINT32(500000)},
1469 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSamplers),
1470 LIM_MIN_UINT32(500000)},
1471 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffers),
1472 LIM_MIN_UINT32(shaderStages * 12)},
1473 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic),
1474 LIM_MIN_UINT32(8)},
1475 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffers),
1476 LIM_MIN_UINT32(500000)},
1477 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic),
1478 LIM_MIN_UINT32(4)},
1479 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSampledImages),
1480 LIM_MIN_UINT32(500000)},
1481 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageImages),
1482 LIM_MIN_UINT32(500000)},
1483 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindInputAttachments),
1484 LIM_MIN_UINT32(4)},
1485 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSamplers),
1486 LIM_MIN_UINT32(limits.maxPerStageDescriptorSamplers)},
1487 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindUniformBuffers),
1488 LIM_MIN_UINT32(limits.maxPerStageDescriptorUniformBuffers)},
1489 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageBuffers),
1490 LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageBuffers)},
1491 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSampledImages),
1492 LIM_MIN_UINT32(limits.maxPerStageDescriptorSampledImages)},
1493 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageImages),
1494 LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageImages)},
1495 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindInputAttachments),
1496 LIM_MIN_UINT32(limits.maxPerStageDescriptorInputAttachments)},
1497 {PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageUpdateAfterBindResources),
1498 LIM_MIN_UINT32(limits.maxPerStageResources)},
1499 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSamplers),
1500 LIM_MIN_UINT32(limits.maxDescriptorSetSamplers)},
1501 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffers),
1502 LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffers)},
1503 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic),
1504 LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffersDynamic)},
1505 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffers),
1506 LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffers)},
1507 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic),
1508 LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffersDynamic)},
1509 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSampledImages),
1510 LIM_MIN_UINT32(limits.maxDescriptorSetSampledImages)},
1511 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageImages),
1512 LIM_MIN_UINT32(limits.maxDescriptorSetStorageImages)},
1513 {PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindInputAttachments),
1514 LIM_MIN_UINT32(limits.maxDescriptorSetInputAttachments)},
1515 };
1516
1517 log << TestLog::Message << descriptorIndexingProperties << TestLog::EndMessage;
1518
1519 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1520 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1521
1522 if (limitsOk)
1523 return tcu::TestStatus::pass("pass");
1524 else
1525 return tcu::TestStatus::fail("fail");
1526 }
1527
1528 #ifndef CTS_USES_VULKANSC
1529
checkSupportExtInlineUniformBlock(Context & context)1530 void checkSupportExtInlineUniformBlock(Context &context)
1531 {
1532 context.requireDeviceFunctionality("VK_EXT_inline_uniform_block");
1533 }
1534
validateLimitsExtInlineUniformBlock(Context & context)1535 tcu::TestStatus validateLimitsExtInlineUniformBlock(Context &context)
1536 {
1537 const VkBool32 checkAlways = VK_TRUE;
1538 const VkPhysicalDeviceInlineUniformBlockProperties &inlineUniformBlockPropertiesEXT =
1539 context.getInlineUniformBlockProperties();
1540 TestLog &log = context.getTestContext().getLog();
1541 bool limitsOk = true;
1542
1543 FeatureLimitTableItem featureLimitTable[] = {
1544 {PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxInlineUniformBlockSize), LIM_MIN_UINT32(256)},
1545 {PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxPerStageDescriptorInlineUniformBlocks),
1546 LIM_MIN_UINT32(4)},
1547 {PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks),
1548 LIM_MIN_UINT32(4)},
1549 {PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxDescriptorSetInlineUniformBlocks), LIM_MIN_UINT32(4)},
1550 {PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxDescriptorSetUpdateAfterBindInlineUniformBlocks),
1551 LIM_MIN_UINT32(4)},
1552 };
1553
1554 log << TestLog::Message << inlineUniformBlockPropertiesEXT << TestLog::EndMessage;
1555
1556 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1557 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1558
1559 if (limitsOk)
1560 return tcu::TestStatus::pass("pass");
1561 else
1562 return tcu::TestStatus::fail("fail");
1563 }
1564
1565 #endif // CTS_USES_VULKANSC
1566
checkSupportExtVertexAttributeDivisorEXT(Context & context)1567 void checkSupportExtVertexAttributeDivisorEXT(Context &context)
1568 {
1569 context.requireDeviceFunctionality("VK_EXT_vertex_attribute_divisor");
1570 }
1571
checkSupportExtVertexAttributeDivisorKHR(Context & context)1572 void checkSupportExtVertexAttributeDivisorKHR(Context &context)
1573 {
1574 context.requireDeviceFunctionality("VK_KHR_vertex_attribute_divisor");
1575 }
1576
validateLimitsExtVertexAttributeDivisorEXT(Context & context)1577 tcu::TestStatus validateLimitsExtVertexAttributeDivisorEXT(Context &context)
1578 {
1579 const VkBool32 checkAlways = VK_TRUE;
1580 const InstanceInterface &vk = context.getInstanceInterface();
1581 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1582 vk::VkPhysicalDeviceVertexAttributeDivisorPropertiesKHR vertexAttributeDivisorPropertiesKHR =
1583 vk::initVulkanStructure();
1584 vk::VkPhysicalDeviceProperties2 properties2 = vk::initVulkanStructure(&vertexAttributeDivisorPropertiesKHR);
1585 TestLog &log = context.getTestContext().getLog();
1586 bool limitsOk = true;
1587
1588 vk.getPhysicalDeviceProperties2(physicalDevice, &properties2);
1589
1590 FeatureLimitTableItem featureLimitTable[] = {
1591 {PN(checkAlways), PN(vertexAttributeDivisorPropertiesKHR.maxVertexAttribDivisor),
1592 LIM_MIN_UINT32((1 << 16) - 1)},
1593 };
1594
1595 log << TestLog::Message << vertexAttributeDivisorPropertiesKHR << TestLog::EndMessage;
1596
1597 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1598 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1599
1600 if (limitsOk)
1601 return tcu::TestStatus::pass("pass");
1602 else
1603 return tcu::TestStatus::fail("fail");
1604 }
1605
validateLimitsExtVertexAttributeDivisorKHR(Context & context)1606 tcu::TestStatus validateLimitsExtVertexAttributeDivisorKHR(Context &context)
1607 {
1608 const VkBool32 checkAlways = VK_TRUE;
1609
1610 vk::VkPhysicalDeviceVertexAttributeDivisorPropertiesKHR vertexAttributeDivisorProperties =
1611 context.getVertexAttributeDivisorProperties();
1612 #ifndef CTS_USES_VULKANSC
1613 const InstanceInterface &vki = context.getInstanceInterface();
1614 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1615 vk::VkPhysicalDeviceProperties2 properties2 = vk::initVulkanStructure(&vertexAttributeDivisorProperties);
1616 vki.getPhysicalDeviceProperties2(physicalDevice, &properties2);
1617 #endif
1618 TestLog &log = context.getTestContext().getLog();
1619 bool limitsOk = true;
1620
1621 FeatureLimitTableItem featureLimitTable[] = {
1622 {PN(checkAlways), PN(vertexAttributeDivisorProperties.maxVertexAttribDivisor), LIM_MIN_UINT32((1 << 16) - 1)},
1623 };
1624
1625 log << TestLog::Message << vertexAttributeDivisorProperties << TestLog::EndMessage;
1626
1627 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1628 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1629
1630 if (limitsOk)
1631 return tcu::TestStatus::pass("pass");
1632 else
1633 return tcu::TestStatus::fail("fail");
1634 }
1635
1636 #ifndef CTS_USES_VULKANSC
1637
checkSupportNvMeshShader(Context & context)1638 void checkSupportNvMeshShader(Context &context)
1639 {
1640 const std::string &requiredDeviceExtension = "VK_NV_mesh_shader";
1641
1642 if (!context.isDeviceFunctionalitySupported(requiredDeviceExtension))
1643 TCU_THROW(NotSupportedError, requiredDeviceExtension + " is not supported");
1644 }
1645
validateLimitsNvMeshShader(Context & context)1646 tcu::TestStatus validateLimitsNvMeshShader(Context &context)
1647 {
1648 const VkBool32 checkAlways = VK_TRUE;
1649 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1650 const InstanceInterface &vki = context.getInstanceInterface();
1651 TestLog &log = context.getTestContext().getLog();
1652 bool limitsOk = true;
1653 VkPhysicalDeviceMeshShaderPropertiesNV meshShaderPropertiesNV = initVulkanStructure();
1654 VkPhysicalDeviceProperties2 properties2 = initVulkanStructure(&meshShaderPropertiesNV);
1655
1656 vki.getPhysicalDeviceProperties2(physicalDevice, &properties2);
1657
1658 FeatureLimitTableItem featureLimitTable[] = {
1659 {PN(checkAlways), PN(meshShaderPropertiesNV.maxDrawMeshTasksCount), LIM_MIN_UINT32(uint32_t((1ull << 16) - 1))},
1660 {PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupInvocations), LIM_MIN_UINT32(32)},
1661 {PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupSize[0]), LIM_MIN_UINT32(32)},
1662 {PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupSize[1]), LIM_MIN_UINT32(1)},
1663 {PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupSize[2]), LIM_MIN_UINT32(1)},
1664 {PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskTotalMemorySize), LIM_MIN_UINT32(16384)},
1665 {PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskOutputCount), LIM_MIN_UINT32((1 << 16) - 1)},
1666 {PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupInvocations), LIM_MIN_UINT32(32)},
1667 {PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupSize[0]), LIM_MIN_UINT32(32)},
1668 {PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupSize[1]), LIM_MIN_UINT32(1)},
1669 {PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupSize[2]), LIM_MIN_UINT32(1)},
1670 {PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshTotalMemorySize), LIM_MIN_UINT32(16384)},
1671 {PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshOutputVertices), LIM_MIN_UINT32(256)},
1672 {PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshOutputPrimitives), LIM_MIN_UINT32(256)},
1673 {PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshMultiviewViewCount), LIM_MIN_UINT32(1)},
1674 };
1675
1676 log << TestLog::Message << meshShaderPropertiesNV << TestLog::EndMessage;
1677
1678 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1679 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1680
1681 if (limitsOk)
1682 return tcu::TestStatus::pass("pass");
1683 else
1684 return tcu::TestStatus::fail("fail");
1685 }
1686
checkSupportExtTransformFeedback(Context & context)1687 void checkSupportExtTransformFeedback(Context &context)
1688 {
1689 context.requireDeviceFunctionality("VK_EXT_transform_feedback");
1690 }
1691
validateLimitsExtTransformFeedback(Context & context)1692 tcu::TestStatus validateLimitsExtTransformFeedback(Context &context)
1693 {
1694 const VkBool32 checkAlways = VK_TRUE;
1695 const VkPhysicalDeviceTransformFeedbackPropertiesEXT &transformFeedbackPropertiesEXT =
1696 context.getTransformFeedbackPropertiesEXT();
1697 TestLog &log = context.getTestContext().getLog();
1698 bool limitsOk = true;
1699
1700 FeatureLimitTableItem featureLimitTable[] = {
1701 {PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackStreams), LIM_MIN_UINT32(1)},
1702 {PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBuffers), LIM_MIN_UINT32(1)},
1703 {PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBufferSize),
1704 LIM_MIN_DEVSIZE(1ull << 27)},
1705 {PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackStreamDataSize), LIM_MIN_UINT32(512)},
1706 {PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBufferDataSize), LIM_MIN_UINT32(512)},
1707 {PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBufferDataStride), LIM_MIN_UINT32(512)},
1708 };
1709
1710 log << TestLog::Message << transformFeedbackPropertiesEXT << TestLog::EndMessage;
1711
1712 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1713 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1714
1715 if (limitsOk)
1716 return tcu::TestStatus::pass("pass");
1717 else
1718 return tcu::TestStatus::fail("fail");
1719 }
1720
checkSupportExtFragmentDensityMap(Context & context)1721 void checkSupportExtFragmentDensityMap(Context &context)
1722 {
1723 context.requireDeviceFunctionality("VK_EXT_fragment_density_map");
1724 }
1725
validateLimitsExtFragmentDensityMap(Context & context)1726 tcu::TestStatus validateLimitsExtFragmentDensityMap(Context &context)
1727 {
1728 const VkBool32 checkAlways = VK_TRUE;
1729 const VkPhysicalDeviceFragmentDensityMapPropertiesEXT &fragmentDensityMapPropertiesEXT =
1730 context.getFragmentDensityMapPropertiesEXT();
1731 TestLog &log = context.getTestContext().getLog();
1732 bool limitsOk = true;
1733
1734 FeatureLimitTableItem featureLimitTable[] = {
1735 {PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.minFragmentDensityTexelSize.width), LIM_MIN_UINT32(1)},
1736 {PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.minFragmentDensityTexelSize.height), LIM_MIN_UINT32(1)},
1737 {PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.maxFragmentDensityTexelSize.width), LIM_MIN_UINT32(1)},
1738 {PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.maxFragmentDensityTexelSize.height), LIM_MIN_UINT32(1)},
1739 };
1740
1741 log << TestLog::Message << fragmentDensityMapPropertiesEXT << TestLog::EndMessage;
1742
1743 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1744 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1745
1746 if (limitsOk)
1747 return tcu::TestStatus::pass("pass");
1748 else
1749 return tcu::TestStatus::fail("fail");
1750 }
1751
checkSupportNvRayTracing(Context & context)1752 void checkSupportNvRayTracing(Context &context)
1753 {
1754 const std::string &requiredDeviceExtension = "VK_NV_ray_tracing";
1755
1756 if (!context.isDeviceFunctionalitySupported(requiredDeviceExtension))
1757 TCU_THROW(NotSupportedError, requiredDeviceExtension + " is not supported");
1758 }
1759
validateLimitsNvRayTracing(Context & context)1760 tcu::TestStatus validateLimitsNvRayTracing(Context &context)
1761 {
1762 const VkBool32 checkAlways = VK_TRUE;
1763 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1764 const InstanceInterface &vki = context.getInstanceInterface();
1765 TestLog &log = context.getTestContext().getLog();
1766 bool limitsOk = true;
1767 VkPhysicalDeviceRayTracingPropertiesNV rayTracingPropertiesNV = initVulkanStructure();
1768 VkPhysicalDeviceProperties2 properties2 = initVulkanStructure(&rayTracingPropertiesNV);
1769
1770 vki.getPhysicalDeviceProperties2(physicalDevice, &properties2);
1771
1772 FeatureLimitTableItem featureLimitTable[] = {
1773 {PN(checkAlways), PN(rayTracingPropertiesNV.shaderGroupHandleSize), LIM_MIN_UINT32(16)},
1774 {PN(checkAlways), PN(rayTracingPropertiesNV.maxRecursionDepth), LIM_MIN_UINT32(31)},
1775 {PN(checkAlways), PN(rayTracingPropertiesNV.shaderGroupBaseAlignment), LIM_MIN_UINT32(64)},
1776 {PN(checkAlways), PN(rayTracingPropertiesNV.maxGeometryCount), LIM_MIN_UINT32((1 << 24) - 1)},
1777 {PN(checkAlways), PN(rayTracingPropertiesNV.maxInstanceCount), LIM_MIN_UINT32((1 << 24) - 1)},
1778 {PN(checkAlways), PN(rayTracingPropertiesNV.maxTriangleCount), LIM_MIN_UINT32((1 << 29) - 1)},
1779 {PN(checkAlways), PN(rayTracingPropertiesNV.maxDescriptorSetAccelerationStructures), LIM_MIN_UINT32(16)},
1780 };
1781
1782 log << TestLog::Message << rayTracingPropertiesNV << TestLog::EndMessage;
1783
1784 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1785 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1786
1787 if (limitsOk)
1788 return tcu::TestStatus::pass("pass");
1789 else
1790 return tcu::TestStatus::fail("fail");
1791 }
1792
1793 #endif // CTS_USES_VULKANSC
1794
checkSupportKhrTimelineSemaphore(Context & context)1795 void checkSupportKhrTimelineSemaphore(Context &context)
1796 {
1797 context.requireDeviceFunctionality("VK_KHR_timeline_semaphore");
1798 }
1799
validateLimitsKhrTimelineSemaphore(Context & context)1800 tcu::TestStatus validateLimitsKhrTimelineSemaphore(Context &context)
1801 {
1802 const VkBool32 checkAlways = VK_TRUE;
1803 const VkPhysicalDeviceTimelineSemaphoreProperties &timelineSemaphoreProperties =
1804 context.getTimelineSemaphoreProperties();
1805 bool limitsOk = true;
1806 TestLog &log = context.getTestContext().getLog();
1807
1808 FeatureLimitTableItem featureLimitTable[] = {
1809 {PN(checkAlways), PN(timelineSemaphoreProperties.maxTimelineSemaphoreValueDifference),
1810 LIM_MIN_DEVSIZE((1ull << 31) - 1)},
1811 };
1812
1813 log << TestLog::Message << timelineSemaphoreProperties << TestLog::EndMessage;
1814
1815 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1816 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1817
1818 if (limitsOk)
1819 return tcu::TestStatus::pass("pass");
1820 else
1821 return tcu::TestStatus::fail("fail");
1822 }
1823
checkSupportExtLineRasterization(Context & context)1824 void checkSupportExtLineRasterization(Context &context)
1825 {
1826 context.requireDeviceFunctionality("VK_EXT_line_rasterization");
1827 }
1828
checkSupportKhrLineRasterization(Context & context)1829 void checkSupportKhrLineRasterization(Context &context)
1830 {
1831 context.requireDeviceFunctionality("VK_KHR_line_rasterization");
1832 }
1833
validateLimitsLineRasterization(Context & context)1834 tcu::TestStatus validateLimitsLineRasterization(Context &context)
1835 {
1836 const VkBool32 checkAlways = VK_TRUE;
1837 TestLog &log = context.getTestContext().getLog();
1838 bool limitsOk = true;
1839 auto lineRasterizationProperties = context.getLineRasterizationProperties();
1840 vk::VkPhysicalDeviceProperties2 properties2 = vk::initVulkanStructure(&lineRasterizationProperties);
1841 const InstanceInterface &vk = context.getInstanceInterface();
1842
1843 vk.getPhysicalDeviceProperties2(context.getPhysicalDevice(), &properties2);
1844
1845 FeatureLimitTableItem featureLimitTable[] = {
1846 {PN(checkAlways), PN(lineRasterizationProperties.lineSubPixelPrecisionBits), LIM_MIN_UINT32(4)},
1847 };
1848
1849 log << TestLog::Message << lineRasterizationProperties << TestLog::EndMessage;
1850
1851 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1852 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1853
1854 if (limitsOk)
1855 return tcu::TestStatus::pass("pass");
1856 else
1857 return tcu::TestStatus::fail("fail");
1858 }
1859
checkSupportRobustness2(Context & context)1860 void checkSupportRobustness2(Context &context)
1861 {
1862 context.requireDeviceFunctionality("VK_EXT_robustness2");
1863 }
1864
validateLimitsRobustness2(Context & context)1865 tcu::TestStatus validateLimitsRobustness2(Context &context)
1866 {
1867 const InstanceInterface &vki = context.getInstanceInterface();
1868 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1869 const VkPhysicalDeviceRobustness2PropertiesEXT &robustness2PropertiesEXT = context.getRobustness2PropertiesEXT();
1870 VkPhysicalDeviceRobustness2FeaturesEXT robustness2Features = initVulkanStructure();
1871 VkPhysicalDeviceFeatures2 features2 = initVulkanStructure(&robustness2Features);
1872
1873 vki.getPhysicalDeviceFeatures2(physicalDevice, &features2);
1874
1875 if (robustness2Features.robustBufferAccess2 && !features2.features.robustBufferAccess)
1876 return tcu::TestStatus::fail("If robustBufferAccess2 is enabled then robustBufferAccess must also be enabled");
1877
1878 if (robustness2PropertiesEXT.robustStorageBufferAccessSizeAlignment != 1 &&
1879 robustness2PropertiesEXT.robustStorageBufferAccessSizeAlignment != 4)
1880 return tcu::TestStatus::fail(
1881 "robustness2PropertiesEXT.robustStorageBufferAccessSizeAlignment value must be either 1 or 4.");
1882
1883 if (!de::inRange(robustness2PropertiesEXT.robustUniformBufferAccessSizeAlignment, (VkDeviceSize)1u,
1884 (VkDeviceSize)256u) ||
1885 !deIsPowerOfTwo64(robustness2PropertiesEXT.robustUniformBufferAccessSizeAlignment))
1886 return tcu::TestStatus::fail("robustness2PropertiesEXT.robustUniformBufferAccessSizeAlignment must be a power "
1887 "of two in the range [1, 256]");
1888
1889 return tcu::TestStatus::pass("pass");
1890 }
1891
1892 #ifndef CTS_USES_VULKANSC
validateLimitsMaxInlineUniformTotalSize(Context & context)1893 tcu::TestStatus validateLimitsMaxInlineUniformTotalSize(Context &context)
1894 {
1895 const VkBool32 checkAlways = VK_TRUE;
1896 const VkPhysicalDeviceVulkan13Properties &vulkan13Properties = context.getDeviceVulkan13Properties();
1897 bool limitsOk = true;
1898 TestLog &log = context.getTestContext().getLog();
1899
1900 FeatureLimitTableItem featureLimitTable[] = {
1901 {PN(checkAlways), PN(vulkan13Properties.maxInlineUniformTotalSize), LIM_MIN_DEVSIZE(256)},
1902 };
1903
1904 log << TestLog::Message << vulkan13Properties << TestLog::EndMessage;
1905
1906 for (uint32_t ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1907 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1908
1909 if (limitsOk)
1910 return tcu::TestStatus::pass("pass");
1911 else
1912 return tcu::TestStatus::fail("fail");
1913 }
1914
1915 #define ROADMAP_FEATURE_ITEM(STRUC, FIELD) \
1916 { \
1917 &(STRUC), &(STRUC.FIELD), #STRUC "." #FIELD \
1918 }
1919
1920 struct FeatureEntry
1921 {
1922 void *structPtr;
1923 VkBool32 *fieldPtr;
1924 const char *fieldName;
1925 };
1926
1927 struct FormatEntry
1928 {
1929 VkFormat format;
1930 const std::string name;
1931 VkFormatProperties properties;
1932 };
1933
1934 struct ProfileEntry
1935 {
1936 std::string name;
1937 void (*checkSupportFunction)(Context &);
1938 tcu::TestStatus (*validateFunction)(Context &);
1939 };
1940
1941 #include "vkProfileTests.inl"
1942
1943 #endif // CTS_USES_VULKANSC
1944
createTestDevice(Context & context,void * pNext,const char * const * ppEnabledExtensionNames,uint32_t enabledExtensionCount)1945 void createTestDevice(Context &context, void *pNext, const char *const *ppEnabledExtensionNames,
1946 uint32_t enabledExtensionCount)
1947 {
1948 const PlatformInterface &platformInterface = context.getPlatformInterface();
1949 const auto validationEnabled = context.getTestContext().getCommandLine().isValidationEnabled();
1950 const Unique<VkInstance> instance(createDefaultInstance(platformInterface, context.getUsedApiVersion(),
1951 context.getTestContext().getCommandLine()));
1952 const InstanceDriver instanceDriver(platformInterface, instance.get());
1953 const VkPhysicalDevice physicalDevice =
1954 chooseDevice(instanceDriver, instance.get(), context.getTestContext().getCommandLine());
1955 const uint32_t queueFamilyIndex = 0;
1956 const uint32_t queueCount = 1;
1957 const uint32_t queueIndex = 0;
1958 const float queuePriority = 1.0f;
1959 const vector<VkQueueFamilyProperties> queueFamilyProperties =
1960 getPhysicalDeviceQueueFamilyProperties(instanceDriver, physicalDevice);
1961 const VkDeviceQueueCreateInfo deviceQueueCreateInfo = {
1962 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // VkStructureType sType;
1963 nullptr, // const void* pNext;
1964 (VkDeviceQueueCreateFlags)0u, // VkDeviceQueueCreateFlags flags;
1965 queueFamilyIndex, // uint32_t queueFamilyIndex;
1966 queueCount, // uint32_t queueCount;
1967 &queuePriority, // const float* pQueuePriorities;
1968 };
1969 #ifdef CTS_USES_VULKANSC
1970 VkDeviceObjectReservationCreateInfo memReservationInfo = context.getTestContext().getCommandLine().isSubProcess() ?
1971 context.getResourceInterface()->getStatMax() :
1972 resetDeviceObjectReservationCreateInfo();
1973 memReservationInfo.pNext = pNext;
1974 pNext = &memReservationInfo;
1975
1976 VkPhysicalDeviceVulkanSC10Features sc10Features = createDefaultSC10Features();
1977 sc10Features.pNext = pNext;
1978 pNext = &sc10Features;
1979
1980 VkPipelineCacheCreateInfo pcCI;
1981 std::vector<VkPipelinePoolSize> poolSizes;
1982 if (context.getTestContext().getCommandLine().isSubProcess())
1983 {
1984 if (context.getResourceInterface()->getCacheDataSize() > 0)
1985 {
1986 pcCI = {
1987 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO, // VkStructureType sType;
1988 nullptr, // const void* pNext;
1989 VK_PIPELINE_CACHE_CREATE_READ_ONLY_BIT |
1990 VK_PIPELINE_CACHE_CREATE_USE_APPLICATION_STORAGE_BIT, // VkPipelineCacheCreateFlags flags;
1991 context.getResourceInterface()->getCacheDataSize(), // uintptr_t initialDataSize;
1992 context.getResourceInterface()->getCacheData() // const void* pInitialData;
1993 };
1994 memReservationInfo.pipelineCacheCreateInfoCount = 1;
1995 memReservationInfo.pPipelineCacheCreateInfos = &pcCI;
1996 }
1997
1998 poolSizes = context.getResourceInterface()->getPipelinePoolSizes();
1999 if (!poolSizes.empty())
2000 {
2001 memReservationInfo.pipelinePoolSizeCount = uint32_t(poolSizes.size());
2002 memReservationInfo.pPipelinePoolSizes = poolSizes.data();
2003 }
2004 }
2005 #endif // CTS_USES_VULKANSC
2006
2007 const VkDeviceCreateInfo deviceCreateInfo = {
2008 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, // VkStructureType sType;
2009 pNext, // const void* pNext;
2010 (VkDeviceCreateFlags)0u, // VkDeviceCreateFlags flags;
2011 1, // uint32_t queueCreateInfoCount;
2012 &deviceQueueCreateInfo, // const VkDeviceQueueCreateInfo* pQueueCreateInfos;
2013 0, // uint32_t enabledLayerCount;
2014 nullptr, // const char* const* ppEnabledLayerNames;
2015 enabledExtensionCount, // uint32_t enabledExtensionCount;
2016 ppEnabledExtensionNames, // const char* const* ppEnabledExtensionNames;
2017 nullptr, // const VkPhysicalDeviceFeatures* pEnabledFeatures;
2018 };
2019 const Unique<VkDevice> device(createCustomDevice(validationEnabled, platformInterface, *instance, instanceDriver,
2020 physicalDevice, &deviceCreateInfo));
2021 const DeviceDriver deviceDriver(platformInterface, instance.get(), device.get(), context.getUsedApiVersion(),
2022 context.getTestContext().getCommandLine());
2023 const VkQueue queue = getDeviceQueue(deviceDriver, *device, queueFamilyIndex, queueIndex);
2024
2025 VK_CHECK(deviceDriver.queueWaitIdle(queue));
2026 }
2027
cleanVulkanStruct(void * structPtr,size_t structSize)2028 void cleanVulkanStruct(void *structPtr, size_t structSize)
2029 {
2030 struct StructureBase
2031 {
2032 VkStructureType sType;
2033 void *pNext;
2034 };
2035
2036 VkStructureType sType = ((StructureBase *)structPtr)->sType;
2037
2038 deMemset(structPtr, 0, structSize);
2039
2040 ((StructureBase *)structPtr)->sType = sType;
2041 }
2042
2043 template <uint32_t VK_API_VERSION>
featureBitInfluenceOnDeviceCreate(Context & context)2044 tcu::TestStatus featureBitInfluenceOnDeviceCreate(Context &context)
2045 {
2046 #define FEATURE_TABLE_ITEM(CORE, EXT, FIELD, STR) \
2047 { \
2048 &(CORE), sizeof(CORE), &(CORE.FIELD), #CORE "." #FIELD, &(EXT), sizeof(EXT), &(EXT.FIELD), #EXT "." #FIELD, \
2049 STR \
2050 }
2051 #define DEPENDENCY_DUAL_ITEM(CORE, EXT, FIELD, PARENT) \
2052 {&(CORE.FIELD), &(CORE.PARENT)}, \
2053 { \
2054 &(EXT.FIELD), &(EXT.PARENT) \
2055 }
2056 #define DEPENDENCY_SINGLE_ITEM(CORE, FIELD, PARENT) \
2057 { \
2058 &(CORE.FIELD), &(CORE.PARENT) \
2059 }
2060
2061 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
2062 const InstanceInterface &vki = context.getInstanceInterface();
2063 TestLog &log = context.getTestContext().getLog();
2064 const std::vector<VkExtensionProperties> deviceExtensionProperties =
2065 enumerateDeviceExtensionProperties(vki, physicalDevice, nullptr);
2066
2067 VkPhysicalDeviceFeatures2 features2 = initVulkanStructure();
2068
2069 VkPhysicalDeviceVulkan11Features vulkan11Features = initVulkanStructure();
2070 VkPhysicalDeviceVulkan12Features vulkan12Features = initVulkanStructure();
2071 VkPhysicalDevice16BitStorageFeatures sixteenBitStorageFeatures = initVulkanStructure();
2072 VkPhysicalDeviceMultiviewFeatures multiviewFeatures = initVulkanStructure();
2073 VkPhysicalDeviceVariablePointersFeatures variablePointersFeatures = initVulkanStructure();
2074 VkPhysicalDeviceProtectedMemoryFeatures protectedMemoryFeatures = initVulkanStructure();
2075 VkPhysicalDeviceSamplerYcbcrConversionFeatures samplerYcbcrConversionFeatures = initVulkanStructure();
2076 VkPhysicalDeviceShaderDrawParametersFeatures shaderDrawParametersFeatures = initVulkanStructure();
2077 VkPhysicalDevice8BitStorageFeatures eightBitStorageFeatures = initVulkanStructure();
2078 VkPhysicalDeviceShaderAtomicInt64Features shaderAtomicInt64Features = initVulkanStructure();
2079 VkPhysicalDeviceShaderFloat16Int8Features shaderFloat16Int8Features = initVulkanStructure();
2080 VkPhysicalDeviceDescriptorIndexingFeatures descriptorIndexingFeatures = initVulkanStructure();
2081 VkPhysicalDeviceScalarBlockLayoutFeatures scalarBlockLayoutFeatures = initVulkanStructure();
2082 VkPhysicalDeviceImagelessFramebufferFeatures imagelessFramebufferFeatures = initVulkanStructure();
2083 VkPhysicalDeviceUniformBufferStandardLayoutFeatures uniformBufferStandardLayoutFeatures = initVulkanStructure();
2084 VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures shaderSubgroupExtendedTypesFeatures = initVulkanStructure();
2085 VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures separateDepthStencilLayoutsFeatures = initVulkanStructure();
2086 VkPhysicalDeviceHostQueryResetFeatures hostQueryResetFeatures = initVulkanStructure();
2087 VkPhysicalDeviceTimelineSemaphoreFeatures timelineSemaphoreFeatures = initVulkanStructure();
2088 VkPhysicalDeviceBufferDeviceAddressFeatures bufferDeviceAddressFeatures = initVulkanStructure();
2089 VkPhysicalDeviceVulkanMemoryModelFeatures vulkanMemoryModelFeatures = initVulkanStructure();
2090
2091 #ifndef CTS_USES_VULKANSC
2092 VkPhysicalDeviceVulkan13Features vulkan13Features = initVulkanStructure();
2093 VkPhysicalDeviceImageRobustnessFeatures imageRobustnessFeatures = initVulkanStructure();
2094 VkPhysicalDeviceInlineUniformBlockFeatures inlineUniformBlockFeatures = initVulkanStructure();
2095 VkPhysicalDevicePipelineCreationCacheControlFeatures pipelineCreationCacheControlFeatures = initVulkanStructure();
2096 VkPhysicalDevicePrivateDataFeatures privateDataFeatures = initVulkanStructure();
2097 VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures shaderDemoteToHelperInvocationFeatures =
2098 initVulkanStructure();
2099 VkPhysicalDeviceShaderTerminateInvocationFeatures shaderTerminateInvocationFeatures = initVulkanStructure();
2100 VkPhysicalDeviceSubgroupSizeControlFeatures subgroupSizeControlFeatures = initVulkanStructure();
2101 VkPhysicalDeviceSynchronization2Features synchronization2Features = initVulkanStructure();
2102 VkPhysicalDeviceTextureCompressionASTCHDRFeatures textureCompressionASTCHDRFeatures = initVulkanStructure();
2103 VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures zeroInitializeWorkgroupMemoryFeatures = initVulkanStructure();
2104 VkPhysicalDeviceDynamicRenderingFeatures dynamicRenderingFeatures = initVulkanStructure();
2105 VkPhysicalDeviceShaderIntegerDotProductFeatures shaderIntegerDotProductFeatures = initVulkanStructure();
2106 VkPhysicalDeviceMaintenance4Features maintenance4Features = initVulkanStructure();
2107 #endif // CTS_USES_VULKANSC
2108
2109 struct UnusedExtensionFeatures
2110 {
2111 VkStructureType sType;
2112 void *pNext;
2113 VkBool32 descriptorIndexing;
2114 VkBool32 samplerFilterMinmax;
2115 } unusedExtensionFeatures;
2116
2117 struct FeatureTable
2118 {
2119 void *coreStructPtr;
2120 size_t coreStructSize;
2121 VkBool32 *coreFieldPtr;
2122 const char *coreFieldName;
2123 void *extStructPtr;
2124 size_t extStructSize;
2125 VkBool32 *extFieldPtr;
2126 const char *extFieldName;
2127 const char *extString;
2128 };
2129 struct FeatureDependencyTable
2130 {
2131 VkBool32 *featurePtr;
2132 VkBool32 *dependOnPtr;
2133 };
2134
2135 std::vector<FeatureTable> featureTable;
2136 std::vector<FeatureDependencyTable> featureDependencyTable;
2137
2138 if (VK_API_VERSION == VK_API_VERSION_1_2)
2139 {
2140 featureTable = {
2141 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, storageBuffer16BitAccess,
2142 "VK_KHR_16bit_storage"),
2143 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, uniformAndStorageBuffer16BitAccess,
2144 "VK_KHR_16bit_storage"),
2145 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, storagePushConstant16,
2146 "VK_KHR_16bit_storage"),
2147 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, storageInputOutput16,
2148 "VK_KHR_16bit_storage"),
2149 FEATURE_TABLE_ITEM(vulkan11Features, multiviewFeatures, multiview, "VK_KHR_multiview"),
2150 FEATURE_TABLE_ITEM(vulkan11Features, multiviewFeatures, multiviewGeometryShader, "VK_KHR_multiview"),
2151 FEATURE_TABLE_ITEM(vulkan11Features, multiviewFeatures, multiviewTessellationShader, "VK_KHR_multiview"),
2152 FEATURE_TABLE_ITEM(vulkan11Features, variablePointersFeatures, variablePointersStorageBuffer,
2153 "VK_KHR_variable_pointers"),
2154 FEATURE_TABLE_ITEM(vulkan11Features, variablePointersFeatures, variablePointers,
2155 "VK_KHR_variable_pointers"),
2156 FEATURE_TABLE_ITEM(vulkan11Features, protectedMemoryFeatures, protectedMemory, nullptr),
2157 FEATURE_TABLE_ITEM(vulkan11Features, samplerYcbcrConversionFeatures, samplerYcbcrConversion,
2158 "VK_KHR_sampler_ycbcr_conversion"),
2159 FEATURE_TABLE_ITEM(vulkan11Features, shaderDrawParametersFeatures, shaderDrawParameters, nullptr),
2160 FEATURE_TABLE_ITEM(vulkan12Features, eightBitStorageFeatures, storageBuffer8BitAccess,
2161 "VK_KHR_8bit_storage"),
2162 FEATURE_TABLE_ITEM(vulkan12Features, eightBitStorageFeatures, uniformAndStorageBuffer8BitAccess,
2163 "VK_KHR_8bit_storage"),
2164 FEATURE_TABLE_ITEM(vulkan12Features, eightBitStorageFeatures, storagePushConstant8, "VK_KHR_8bit_storage"),
2165 FEATURE_TABLE_ITEM(vulkan12Features, shaderAtomicInt64Features, shaderBufferInt64Atomics,
2166 "VK_KHR_shader_atomic_int64"),
2167 FEATURE_TABLE_ITEM(vulkan12Features, shaderAtomicInt64Features, shaderSharedInt64Atomics,
2168 "VK_KHR_shader_atomic_int64"),
2169 FEATURE_TABLE_ITEM(vulkan12Features, shaderFloat16Int8Features, shaderFloat16,
2170 "VK_KHR_shader_float16_int8"),
2171 FEATURE_TABLE_ITEM(vulkan12Features, shaderFloat16Int8Features, shaderInt8, "VK_KHR_shader_float16_int8"),
2172 FEATURE_TABLE_ITEM(vulkan12Features, unusedExtensionFeatures, descriptorIndexing, nullptr),
2173 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderInputAttachmentArrayDynamicIndexing,
2174 "VK_EXT_descriptor_indexing"),
2175 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures,
2176 shaderUniformTexelBufferArrayDynamicIndexing, "VK_EXT_descriptor_indexing"),
2177 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures,
2178 shaderStorageTexelBufferArrayDynamicIndexing, "VK_EXT_descriptor_indexing"),
2179 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderUniformBufferArrayNonUniformIndexing,
2180 "VK_EXT_descriptor_indexing"),
2181 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderSampledImageArrayNonUniformIndexing,
2182 "VK_EXT_descriptor_indexing"),
2183 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderStorageBufferArrayNonUniformIndexing,
2184 "VK_EXT_descriptor_indexing"),
2185 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderStorageImageArrayNonUniformIndexing,
2186 "VK_EXT_descriptor_indexing"),
2187 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures,
2188 shaderInputAttachmentArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
2189 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures,
2190 shaderUniformTexelBufferArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
2191 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures,
2192 shaderStorageTexelBufferArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
2193 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures,
2194 descriptorBindingUniformBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2195 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures,
2196 descriptorBindingSampledImageUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2197 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures,
2198 descriptorBindingStorageImageUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2199 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures,
2200 descriptorBindingStorageBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2201 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures,
2202 descriptorBindingUniformTexelBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2203 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures,
2204 descriptorBindingStorageTexelBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2205 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingUpdateUnusedWhilePending,
2206 "VK_EXT_descriptor_indexing"),
2207 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingPartiallyBound,
2208 "VK_EXT_descriptor_indexing"),
2209 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingVariableDescriptorCount,
2210 "VK_EXT_descriptor_indexing"),
2211 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, runtimeDescriptorArray,
2212 "VK_EXT_descriptor_indexing"),
2213 FEATURE_TABLE_ITEM(vulkan12Features, unusedExtensionFeatures, samplerFilterMinmax,
2214 "VK_EXT_sampler_filter_minmax"),
2215 FEATURE_TABLE_ITEM(vulkan12Features, scalarBlockLayoutFeatures, scalarBlockLayout,
2216 "VK_EXT_scalar_block_layout"),
2217 FEATURE_TABLE_ITEM(vulkan12Features, imagelessFramebufferFeatures, imagelessFramebuffer,
2218 "VK_KHR_imageless_framebuffer"),
2219 FEATURE_TABLE_ITEM(vulkan12Features, uniformBufferStandardLayoutFeatures, uniformBufferStandardLayout,
2220 "VK_KHR_uniform_buffer_standard_layout"),
2221 FEATURE_TABLE_ITEM(vulkan12Features, shaderSubgroupExtendedTypesFeatures, shaderSubgroupExtendedTypes,
2222 "VK_KHR_shader_subgroup_extended_types"),
2223 FEATURE_TABLE_ITEM(vulkan12Features, separateDepthStencilLayoutsFeatures, separateDepthStencilLayouts,
2224 "VK_KHR_separate_depth_stencil_layouts"),
2225 FEATURE_TABLE_ITEM(vulkan12Features, hostQueryResetFeatures, hostQueryReset, "VK_EXT_host_query_reset"),
2226 FEATURE_TABLE_ITEM(vulkan12Features, timelineSemaphoreFeatures, timelineSemaphore,
2227 "VK_KHR_timeline_semaphore"),
2228 FEATURE_TABLE_ITEM(vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddress,
2229 "VK_EXT_buffer_device_address"),
2230 FEATURE_TABLE_ITEM(vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressCaptureReplay,
2231 "VK_EXT_buffer_device_address"),
2232 FEATURE_TABLE_ITEM(vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressMultiDevice,
2233 "VK_EXT_buffer_device_address"),
2234 FEATURE_TABLE_ITEM(vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModel,
2235 "VK_KHR_vulkan_memory_model"),
2236 FEATURE_TABLE_ITEM(vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModelDeviceScope,
2237 "VK_KHR_vulkan_memory_model"),
2238 FEATURE_TABLE_ITEM(vulkan12Features, vulkanMemoryModelFeatures,
2239 vulkanMemoryModelAvailabilityVisibilityChains, "VK_KHR_vulkan_memory_model"),
2240 };
2241
2242 featureDependencyTable = {
2243 DEPENDENCY_DUAL_ITEM(vulkan11Features, multiviewFeatures, multiviewGeometryShader, multiview),
2244 DEPENDENCY_DUAL_ITEM(vulkan11Features, multiviewFeatures, multiviewTessellationShader, multiview),
2245 DEPENDENCY_DUAL_ITEM(vulkan11Features, variablePointersFeatures, variablePointers,
2246 variablePointersStorageBuffer),
2247 DEPENDENCY_DUAL_ITEM(vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressCaptureReplay,
2248 bufferDeviceAddress),
2249 DEPENDENCY_DUAL_ITEM(vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressMultiDevice,
2250 bufferDeviceAddress),
2251 DEPENDENCY_DUAL_ITEM(vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModelDeviceScope,
2252 vulkanMemoryModel),
2253 DEPENDENCY_DUAL_ITEM(vulkan12Features, vulkanMemoryModelFeatures,
2254 vulkanMemoryModelAvailabilityVisibilityChains, vulkanMemoryModel),
2255 };
2256 }
2257 #ifndef CTS_USES_VULKANSC
2258 else // if (VK_API_VERSION == VK_API_VERSION_1_3)
2259 {
2260 featureTable = {
2261 FEATURE_TABLE_ITEM(vulkan13Features, imageRobustnessFeatures, robustImageAccess, "VK_EXT_image_robustness"),
2262 FEATURE_TABLE_ITEM(vulkan13Features, inlineUniformBlockFeatures, inlineUniformBlock,
2263 "VK_EXT_inline_uniform_block"),
2264 FEATURE_TABLE_ITEM(vulkan13Features, inlineUniformBlockFeatures,
2265 descriptorBindingInlineUniformBlockUpdateAfterBind, "VK_EXT_inline_uniform_block"),
2266 FEATURE_TABLE_ITEM(vulkan13Features, pipelineCreationCacheControlFeatures, pipelineCreationCacheControl,
2267 "VK_EXT_pipeline_creation_cache_control"),
2268 FEATURE_TABLE_ITEM(vulkan13Features, privateDataFeatures, privateData, "VK_EXT_private_data"),
2269 FEATURE_TABLE_ITEM(vulkan13Features, shaderDemoteToHelperInvocationFeatures, shaderDemoteToHelperInvocation,
2270 "VK_EXT_shader_demote_to_helper_invocation"),
2271 FEATURE_TABLE_ITEM(vulkan13Features, shaderTerminateInvocationFeatures, shaderTerminateInvocation,
2272 "VK_KHR_shader_terminate_invocation"),
2273 FEATURE_TABLE_ITEM(vulkan13Features, subgroupSizeControlFeatures, subgroupSizeControl,
2274 "VK_EXT_subgroup_size_control"),
2275 FEATURE_TABLE_ITEM(vulkan13Features, subgroupSizeControlFeatures, computeFullSubgroups,
2276 "VK_EXT_subgroup_size_control"),
2277 FEATURE_TABLE_ITEM(vulkan13Features, synchronization2Features, synchronization2, "VK_KHR_synchronization2"),
2278 FEATURE_TABLE_ITEM(vulkan13Features, textureCompressionASTCHDRFeatures, textureCompressionASTC_HDR,
2279 "VK_EXT_texture_compression_astc_hdr"),
2280 FEATURE_TABLE_ITEM(vulkan13Features, zeroInitializeWorkgroupMemoryFeatures,
2281 shaderZeroInitializeWorkgroupMemory, "VK_KHR_zero_initialize_workgroup_memory"),
2282 FEATURE_TABLE_ITEM(vulkan13Features, dynamicRenderingFeatures, dynamicRendering,
2283 "VK_KHR_dynamic_rendering"),
2284 FEATURE_TABLE_ITEM(vulkan13Features, shaderIntegerDotProductFeatures, shaderIntegerDotProduct,
2285 "VK_KHR_shader_integer_dot_product"),
2286 FEATURE_TABLE_ITEM(vulkan13Features, maintenance4Features, maintenance4, "VK_KHR_maintenance4"),
2287 };
2288 }
2289 #endif // CTS_USES_VULKANSC
2290
2291 deMemset(&unusedExtensionFeatures, 0, sizeof(unusedExtensionFeatures));
2292
2293 for (FeatureTable &testedFeature : featureTable)
2294 {
2295 VkBool32 coreFeatureState = false;
2296 VkBool32 extFeatureState = false;
2297
2298 // Core test
2299 {
2300 void *structPtr = testedFeature.coreStructPtr;
2301 size_t structSize = testedFeature.coreStructSize;
2302 VkBool32 *featurePtr = testedFeature.coreFieldPtr;
2303
2304 if (structPtr != &unusedExtensionFeatures)
2305 features2.pNext = structPtr;
2306
2307 vki.getPhysicalDeviceFeatures2(physicalDevice, &features2);
2308
2309 coreFeatureState = featurePtr[0];
2310
2311 log << TestLog::Message << "Feature status " << testedFeature.coreFieldName << "=" << coreFeatureState
2312 << TestLog::EndMessage;
2313
2314 if (coreFeatureState)
2315 {
2316 cleanVulkanStruct(structPtr, structSize);
2317
2318 featurePtr[0] = true;
2319
2320 for (FeatureDependencyTable featureDependency : featureDependencyTable)
2321 if (featureDependency.featurePtr == featurePtr)
2322 featureDependency.dependOnPtr[0] = true;
2323
2324 createTestDevice(context, &features2, nullptr, 0u);
2325 }
2326 }
2327
2328 // ext test
2329 {
2330 void *structPtr = testedFeature.extStructPtr;
2331 size_t structSize = testedFeature.extStructSize;
2332 VkBool32 *featurePtr = testedFeature.extFieldPtr;
2333 const char *extStringPtr = testedFeature.extString;
2334
2335 if (structPtr != &unusedExtensionFeatures)
2336 features2.pNext = structPtr;
2337
2338 if (extStringPtr == nullptr ||
2339 isExtensionStructSupported(deviceExtensionProperties, RequiredExtension(extStringPtr)))
2340 {
2341 vki.getPhysicalDeviceFeatures2(physicalDevice, &features2);
2342
2343 extFeatureState = *featurePtr;
2344
2345 log << TestLog::Message << "Feature status " << testedFeature.extFieldName << "=" << extFeatureState
2346 << TestLog::EndMessage;
2347
2348 if (extFeatureState)
2349 {
2350 cleanVulkanStruct(structPtr, structSize);
2351
2352 featurePtr[0] = true;
2353
2354 for (FeatureDependencyTable &featureDependency : featureDependencyTable)
2355 if (featureDependency.featurePtr == featurePtr)
2356 featureDependency.dependOnPtr[0] = true;
2357
2358 createTestDevice(context, &features2, &extStringPtr, (extStringPtr == nullptr) ? 0u : 1u);
2359 }
2360 }
2361 }
2362 }
2363
2364 return tcu::TestStatus::pass("pass");
2365 }
2366
2367 template <typename T>
2368 class CheckIncompleteResult
2369 {
2370 public:
~CheckIncompleteResult(void)2371 virtual ~CheckIncompleteResult(void)
2372 {
2373 }
2374 virtual void getResult(Context &context, T *data) = 0;
2375
operator ()(Context & context,tcu::ResultCollector & results,const std::size_t expectedCompleteSize)2376 void operator()(Context &context, tcu::ResultCollector &results, const std::size_t expectedCompleteSize)
2377 {
2378 if (expectedCompleteSize == 0)
2379 return;
2380
2381 vector<T> outputData(expectedCompleteSize);
2382 const uint32_t usedSize = static_cast<uint32_t>(expectedCompleteSize / 3);
2383
2384 ValidateQueryBits::fillBits(outputData.begin(),
2385 outputData.end()); // unused entries should have this pattern intact
2386 m_count = usedSize;
2387 m_result = VK_SUCCESS;
2388
2389 getResult(context, &outputData[0]); // update m_count and m_result
2390
2391 if (m_count != usedSize || m_result != VK_INCOMPLETE ||
2392 !ValidateQueryBits::checkBits(outputData.begin() + m_count, outputData.end()))
2393 results.fail("Query didn't return VK_INCOMPLETE");
2394 }
2395
2396 protected:
2397 uint32_t m_count;
2398 VkResult m_result;
2399 };
2400
2401 struct CheckEnumeratePhysicalDevicesIncompleteResult : public CheckIncompleteResult<VkPhysicalDevice>
2402 {
getResultvkt::api::__anon17ef26850111::CheckEnumeratePhysicalDevicesIncompleteResult2403 void getResult(Context &context, VkPhysicalDevice *data)
2404 {
2405 m_result = context.getInstanceInterface().enumeratePhysicalDevices(context.getInstance(), &m_count, data);
2406 }
2407 };
2408
2409 struct CheckEnumeratePhysicalDeviceGroupsIncompleteResult
2410 : public CheckIncompleteResult<VkPhysicalDeviceGroupProperties>
2411 {
CheckEnumeratePhysicalDeviceGroupsIncompleteResultvkt::api::__anon17ef26850111::CheckEnumeratePhysicalDeviceGroupsIncompleteResult2412 CheckEnumeratePhysicalDeviceGroupsIncompleteResult(const InstanceInterface &vki, const VkInstance instance)
2413 : m_vki(vki)
2414 , m_instance(instance)
2415 {
2416 }
2417
getResultvkt::api::__anon17ef26850111::CheckEnumeratePhysicalDeviceGroupsIncompleteResult2418 void getResult(Context &, VkPhysicalDeviceGroupProperties *data)
2419 {
2420 for (uint32_t idx = 0u; idx < m_count; ++idx)
2421 data[idx] = initVulkanStructure();
2422 m_result = m_vki.enumeratePhysicalDeviceGroups(m_instance, &m_count, data);
2423 }
2424
2425 protected:
2426 const InstanceInterface &m_vki;
2427 const VkInstance m_instance;
2428 };
2429
2430 struct CheckEnumerateInstanceLayerPropertiesIncompleteResult : public CheckIncompleteResult<VkLayerProperties>
2431 {
getResultvkt::api::__anon17ef26850111::CheckEnumerateInstanceLayerPropertiesIncompleteResult2432 void getResult(Context &context, VkLayerProperties *data)
2433 {
2434 m_result = context.getPlatformInterface().enumerateInstanceLayerProperties(&m_count, data);
2435 }
2436 };
2437
2438 struct CheckEnumerateDeviceLayerPropertiesIncompleteResult : public CheckIncompleteResult<VkLayerProperties>
2439 {
getResultvkt::api::__anon17ef26850111::CheckEnumerateDeviceLayerPropertiesIncompleteResult2440 void getResult(Context &context, VkLayerProperties *data)
2441 {
2442 m_result =
2443 context.getInstanceInterface().enumerateDeviceLayerProperties(context.getPhysicalDevice(), &m_count, data);
2444 }
2445 };
2446
2447 struct CheckEnumerateInstanceExtensionPropertiesIncompleteResult : public CheckIncompleteResult<VkExtensionProperties>
2448 {
CheckEnumerateInstanceExtensionPropertiesIncompleteResultvkt::api::__anon17ef26850111::CheckEnumerateInstanceExtensionPropertiesIncompleteResult2449 CheckEnumerateInstanceExtensionPropertiesIncompleteResult(std::string layerName = std::string())
2450 : m_layerName(layerName)
2451 {
2452 }
2453
getResultvkt::api::__anon17ef26850111::CheckEnumerateInstanceExtensionPropertiesIncompleteResult2454 void getResult(Context &context, VkExtensionProperties *data)
2455 {
2456 const char *pLayerName = (m_layerName.length() != 0 ? m_layerName.c_str() : nullptr);
2457 m_result = context.getPlatformInterface().enumerateInstanceExtensionProperties(pLayerName, &m_count, data);
2458 }
2459
2460 private:
2461 const std::string m_layerName;
2462 };
2463
2464 struct CheckEnumerateDeviceExtensionPropertiesIncompleteResult : public CheckIncompleteResult<VkExtensionProperties>
2465 {
CheckEnumerateDeviceExtensionPropertiesIncompleteResultvkt::api::__anon17ef26850111::CheckEnumerateDeviceExtensionPropertiesIncompleteResult2466 CheckEnumerateDeviceExtensionPropertiesIncompleteResult(std::string layerName = std::string())
2467 : m_layerName(layerName)
2468 {
2469 }
2470
getResultvkt::api::__anon17ef26850111::CheckEnumerateDeviceExtensionPropertiesIncompleteResult2471 void getResult(Context &context, VkExtensionProperties *data)
2472 {
2473 const char *pLayerName = (m_layerName.length() != 0 ? m_layerName.c_str() : nullptr);
2474 m_result = context.getInstanceInterface().enumerateDeviceExtensionProperties(context.getPhysicalDevice(),
2475 pLayerName, &m_count, data);
2476 }
2477
2478 private:
2479 const std::string m_layerName;
2480 };
2481
enumeratePhysicalDevices(Context & context)2482 tcu::TestStatus enumeratePhysicalDevices(Context &context)
2483 {
2484 TestLog &log = context.getTestContext().getLog();
2485 tcu::ResultCollector results(log);
2486 const vector<VkPhysicalDevice> devices =
2487 enumeratePhysicalDevices(context.getInstanceInterface(), context.getInstance());
2488
2489 log << TestLog::Integer("NumDevices", "Number of devices", "", QP_KEY_TAG_NONE, int64_t(devices.size()));
2490
2491 for (size_t ndx = 0; ndx < devices.size(); ndx++)
2492 log << TestLog::Message << ndx << ": " << devices[ndx] << TestLog::EndMessage;
2493
2494 CheckEnumeratePhysicalDevicesIncompleteResult()(context, results, devices.size());
2495
2496 return tcu::TestStatus(results.getResult(), results.getMessage());
2497 }
2498
enumeratePhysicalDeviceGroups(Context & context)2499 tcu::TestStatus enumeratePhysicalDeviceGroups(Context &context)
2500 {
2501 TestLog &log = context.getTestContext().getLog();
2502 tcu::ResultCollector results(log);
2503 CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_device_group_creation"));
2504 const InstanceDriver &vki(instance.getDriver());
2505 const vector<VkPhysicalDeviceGroupProperties> devicegroups = enumeratePhysicalDeviceGroups(vki, instance);
2506
2507 log << TestLog::Integer("NumDevices", "Number of device groups", "", QP_KEY_TAG_NONE, int64_t(devicegroups.size()));
2508
2509 for (size_t ndx = 0; ndx < devicegroups.size(); ndx++)
2510 log << TestLog::Message << ndx << ": " << devicegroups[ndx] << TestLog::EndMessage;
2511
2512 CheckEnumeratePhysicalDeviceGroupsIncompleteResult(vki, instance)(context, results, devicegroups.size());
2513
2514 instance.collectMessages();
2515 return tcu::TestStatus(results.getResult(), results.getMessage());
2516 }
2517
2518 template <typename T>
collectDuplicates(set<T> & duplicates,const vector<T> & values)2519 void collectDuplicates(set<T> &duplicates, const vector<T> &values)
2520 {
2521 set<T> seen;
2522
2523 for (size_t ndx = 0; ndx < values.size(); ndx++)
2524 {
2525 const T &value = values[ndx];
2526
2527 if (!seen.insert(value).second)
2528 duplicates.insert(value);
2529 }
2530 }
2531
checkDuplicates(tcu::ResultCollector & results,const char * what,const vector<string> & values)2532 void checkDuplicates(tcu::ResultCollector &results, const char *what, const vector<string> &values)
2533 {
2534 set<string> duplicates;
2535
2536 collectDuplicates(duplicates, values);
2537
2538 for (set<string>::const_iterator iter = duplicates.begin(); iter != duplicates.end(); ++iter)
2539 {
2540 std::ostringstream msg;
2541 msg << "Duplicate " << what << ": " << *iter;
2542 results.fail(msg.str());
2543 }
2544 }
2545
checkDuplicateExtensions(tcu::ResultCollector & results,const vector<string> & extensions)2546 void checkDuplicateExtensions(tcu::ResultCollector &results, const vector<string> &extensions)
2547 {
2548 checkDuplicates(results, "extension", extensions);
2549 }
2550
checkDuplicateLayers(tcu::ResultCollector & results,const vector<string> & layers)2551 void checkDuplicateLayers(tcu::ResultCollector &results, const vector<string> &layers)
2552 {
2553 checkDuplicates(results, "layer", layers);
2554 }
2555
checkKhrExtensions(tcu::ResultCollector & results,const vector<string> & extensions,const int numAllowedKhrExtensions,const char * const * allowedKhrExtensions)2556 void checkKhrExtensions(tcu::ResultCollector &results, const vector<string> &extensions,
2557 const int numAllowedKhrExtensions, const char *const *allowedKhrExtensions)
2558 {
2559 const set<string> allowedExtSet(allowedKhrExtensions, allowedKhrExtensions + numAllowedKhrExtensions);
2560
2561 for (vector<string>::const_iterator extIter = extensions.begin(); extIter != extensions.end(); ++extIter)
2562 {
2563 // Only Khronos-controlled extensions are checked
2564 if (de::beginsWith(*extIter, "VK_KHR_") && !de::contains(allowedExtSet, *extIter))
2565 {
2566 results.fail("Unknown extension " + *extIter);
2567 }
2568 }
2569 }
2570
checkInstanceExtensions(tcu::ResultCollector & results,const vector<string> & extensions)2571 void checkInstanceExtensions(tcu::ResultCollector &results, const vector<string> &extensions)
2572 {
2573 #include "vkInstanceExtensions.inl"
2574
2575 checkKhrExtensions(results, extensions, DE_LENGTH_OF_ARRAY(s_allowedInstanceKhrExtensions),
2576 s_allowedInstanceKhrExtensions);
2577 checkDuplicateExtensions(results, extensions);
2578 }
2579
checkDeviceExtensions(tcu::ResultCollector & results,const vector<string> & extensions)2580 void checkDeviceExtensions(tcu::ResultCollector &results, const vector<string> &extensions)
2581 {
2582 #include "vkDeviceExtensions.inl"
2583
2584 checkKhrExtensions(results, extensions, DE_LENGTH_OF_ARRAY(s_allowedDeviceKhrExtensions),
2585 s_allowedDeviceKhrExtensions);
2586 checkDuplicateExtensions(results, extensions);
2587 }
2588
2589 #ifndef CTS_USES_VULKANSC
2590
checkExtensionDependencies(tcu::ResultCollector & results,const DependencyCheckVect & dependencies,uint32_t versionMajor,uint32_t versionMinor,const ExtPropVect & instanceExtensionProperties,const ExtPropVect & deviceExtensionProperties)2591 void checkExtensionDependencies(tcu::ResultCollector &results, const DependencyCheckVect &dependencies,
2592 uint32_t versionMajor, uint32_t versionMinor,
2593 const ExtPropVect &instanceExtensionProperties,
2594 const ExtPropVect &deviceExtensionProperties)
2595 {
2596 tcu::UVec2 v(versionMajor, versionMinor);
2597 for (const auto &dependency : dependencies)
2598 {
2599 // call function that will check all extension dependencies
2600 if (!dependency.second(v, instanceExtensionProperties, deviceExtensionProperties))
2601 {
2602 results.fail("Extension " + string(dependency.first) + " is missing dependency");
2603 }
2604 }
2605 }
2606
2607 #endif // CTS_USES_VULKANSC
2608
enumerateInstanceLayers(Context & context)2609 tcu::TestStatus enumerateInstanceLayers(Context &context)
2610 {
2611 TestLog &log = context.getTestContext().getLog();
2612 tcu::ResultCollector results(log);
2613 const vector<VkLayerProperties> properties = enumerateInstanceLayerProperties(context.getPlatformInterface());
2614 vector<string> layerNames;
2615
2616 for (size_t ndx = 0; ndx < properties.size(); ndx++)
2617 {
2618 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
2619
2620 layerNames.push_back(properties[ndx].layerName);
2621 }
2622
2623 checkDuplicateLayers(results, layerNames);
2624 CheckEnumerateInstanceLayerPropertiesIncompleteResult()(context, results, layerNames.size());
2625
2626 return tcu::TestStatus(results.getResult(), results.getMessage());
2627 }
2628
enumerateInstanceExtensions(Context & context)2629 tcu::TestStatus enumerateInstanceExtensions(Context &context)
2630 {
2631 TestLog &log = context.getTestContext().getLog();
2632 tcu::ResultCollector results(log);
2633
2634 {
2635 const ScopedLogSection section(log, "Global", "Global Extensions");
2636 const vector<VkExtensionProperties> properties =
2637 enumerateInstanceExtensionProperties(context.getPlatformInterface(), nullptr);
2638 const vector<VkExtensionProperties> unused;
2639 vector<string> extensionNames;
2640
2641 for (size_t ndx = 0; ndx < properties.size(); ndx++)
2642 {
2643 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
2644
2645 extensionNames.push_back(properties[ndx].extensionName);
2646 }
2647
2648 checkInstanceExtensions(results, extensionNames);
2649 CheckEnumerateInstanceExtensionPropertiesIncompleteResult()(context, results, properties.size());
2650
2651 #ifndef CTS_USES_VULKANSC
2652 for (const auto &version : releasedApiVersions)
2653 {
2654 uint32_t apiVariant, versionMajor, versionMinor;
2655 std::tie(std::ignore, apiVariant, versionMajor, versionMinor) = version;
2656 if (context.contextSupports(vk::ApiVersion(apiVariant, versionMajor, versionMinor, 0)))
2657 {
2658 checkExtensionDependencies(results, instanceExtensionDependencies, versionMajor, versionMinor,
2659 properties, unused);
2660 break;
2661 }
2662 }
2663 #endif // CTS_USES_VULKANSC
2664 }
2665
2666 {
2667 const vector<VkLayerProperties> layers = enumerateInstanceLayerProperties(context.getPlatformInterface());
2668
2669 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
2670 {
2671 const ScopedLogSection section(log, layer->layerName, string("Layer: ") + layer->layerName);
2672 const vector<VkExtensionProperties> properties =
2673 enumerateInstanceExtensionProperties(context.getPlatformInterface(), layer->layerName);
2674 vector<string> extensionNames;
2675
2676 for (size_t extNdx = 0; extNdx < properties.size(); extNdx++)
2677 {
2678 log << TestLog::Message << extNdx << ": " << properties[extNdx] << TestLog::EndMessage;
2679
2680 extensionNames.push_back(properties[extNdx].extensionName);
2681 }
2682
2683 checkInstanceExtensions(results, extensionNames);
2684 CheckEnumerateInstanceExtensionPropertiesIncompleteResult(layer->layerName)(context, results,
2685 properties.size());
2686 }
2687 }
2688
2689 return tcu::TestStatus(results.getResult(), results.getMessage());
2690 }
2691
validateDeviceLevelEntryPointsFromInstanceExtensions(Context & context)2692 tcu::TestStatus validateDeviceLevelEntryPointsFromInstanceExtensions(Context &context)
2693 {
2694
2695 #include "vkEntryPointValidation.inl"
2696
2697 TestLog &log(context.getTestContext().getLog());
2698 tcu::ResultCollector results(log);
2699 const DeviceInterface &vk(context.getDeviceInterface());
2700 const VkDevice device(context.getDevice());
2701
2702 for (const auto &keyValue : instExtDeviceFun)
2703 {
2704 const std::string &extensionName = keyValue.first;
2705 if (!context.isInstanceFunctionalitySupported(extensionName))
2706 continue;
2707
2708 for (const auto &deviceEntryPoint : keyValue.second)
2709 {
2710 if (!vk.getDeviceProcAddr(device, deviceEntryPoint.c_str()))
2711 results.fail("Missing " + deviceEntryPoint);
2712 }
2713 }
2714
2715 return tcu::TestStatus(results.getResult(), results.getMessage());
2716 }
2717
testNoKhxExtensions(Context & context)2718 tcu::TestStatus testNoKhxExtensions(Context &context)
2719 {
2720 VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
2721 const PlatformInterface &vkp = context.getPlatformInterface();
2722 const InstanceInterface &vki = context.getInstanceInterface();
2723
2724 tcu::ResultCollector results(context.getTestContext().getLog());
2725 bool testSucceeded = true;
2726 uint32_t instanceExtensionsCount;
2727 uint32_t deviceExtensionsCount;
2728
2729 // grab number of instance and device extensions
2730 vkp.enumerateInstanceExtensionProperties(nullptr, &instanceExtensionsCount, nullptr);
2731 vki.enumerateDeviceExtensionProperties(physicalDevice, nullptr, &deviceExtensionsCount, nullptr);
2732 vector<VkExtensionProperties> extensionsProperties(instanceExtensionsCount + deviceExtensionsCount);
2733
2734 // grab instance and device extensions into single vector
2735 if (instanceExtensionsCount)
2736 vkp.enumerateInstanceExtensionProperties(nullptr, &instanceExtensionsCount, &extensionsProperties[0]);
2737 if (deviceExtensionsCount)
2738 vki.enumerateDeviceExtensionProperties(physicalDevice, nullptr, &deviceExtensionsCount,
2739 &extensionsProperties[instanceExtensionsCount]);
2740
2741 // iterate over all extensions and verify their names
2742 vector<VkExtensionProperties>::const_iterator extension = extensionsProperties.begin();
2743 while (extension != extensionsProperties.end())
2744 {
2745 // KHX author ID is no longer used, all KHX extensions have been promoted to KHR status
2746 std::string extensionName(extension->extensionName);
2747 bool caseFailed = de::beginsWith(extensionName, "VK_KHX_");
2748 if (caseFailed)
2749 {
2750 results.fail("Invalid extension name " + extensionName);
2751 testSucceeded = false;
2752 }
2753 ++extension;
2754 }
2755
2756 if (testSucceeded)
2757 return tcu::TestStatus::pass("No extensions begining with \"VK_KHX\"");
2758 return tcu::TestStatus::fail("One or more extensions begins with \"VK_KHX\"");
2759 }
2760
enumerateDeviceLayers(Context & context)2761 tcu::TestStatus enumerateDeviceLayers(Context &context)
2762 {
2763 TestLog &log = context.getTestContext().getLog();
2764 tcu::ResultCollector results(log);
2765 const vector<VkLayerProperties> properties =
2766 enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
2767 vector<string> layerNames;
2768
2769 for (size_t ndx = 0; ndx < properties.size(); ndx++)
2770 {
2771 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
2772
2773 layerNames.push_back(properties[ndx].layerName);
2774 }
2775
2776 checkDuplicateLayers(results, layerNames);
2777 CheckEnumerateDeviceLayerPropertiesIncompleteResult()(context, results, layerNames.size());
2778
2779 return tcu::TestStatus(results.getResult(), results.getMessage());
2780 }
2781
enumerateDeviceExtensions(Context & context)2782 tcu::TestStatus enumerateDeviceExtensions(Context &context)
2783 {
2784 TestLog &log = context.getTestContext().getLog();
2785 tcu::ResultCollector results(log);
2786
2787 {
2788 const ScopedLogSection section(log, "Global", "Global Extensions");
2789 const vector<VkExtensionProperties> instanceExtensionProperties =
2790 enumerateInstanceExtensionProperties(context.getPlatformInterface(), nullptr);
2791 const vector<VkExtensionProperties> deviceExtensionProperties =
2792 enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), nullptr);
2793 vector<string> deviceExtensionNames;
2794
2795 for (size_t ndx = 0; ndx < deviceExtensionProperties.size(); ndx++)
2796 {
2797 log << TestLog::Message << ndx << ": " << deviceExtensionProperties[ndx] << TestLog::EndMessage;
2798
2799 deviceExtensionNames.push_back(deviceExtensionProperties[ndx].extensionName);
2800 }
2801
2802 checkDeviceExtensions(results, deviceExtensionNames);
2803 CheckEnumerateDeviceExtensionPropertiesIncompleteResult()(context, results, deviceExtensionProperties.size());
2804
2805 #ifndef CTS_USES_VULKANSC
2806 for (const auto &version : releasedApiVersions)
2807 {
2808 uint32_t apiVariant, versionMajor, versionMinor;
2809 std::tie(std::ignore, apiVariant, versionMajor, versionMinor) = version;
2810 if (context.contextSupports(vk::ApiVersion(apiVariant, versionMajor, versionMinor, 0)))
2811 {
2812 checkExtensionDependencies(results, deviceExtensionDependencies, versionMajor, versionMinor,
2813 instanceExtensionProperties, deviceExtensionProperties);
2814 break;
2815 }
2816 }
2817 #endif // CTS_USES_VULKANSC
2818 }
2819
2820 {
2821 const vector<VkLayerProperties> layers =
2822 enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
2823
2824 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
2825 {
2826 const ScopedLogSection section(log, layer->layerName, string("Layer: ") + layer->layerName);
2827 const vector<VkExtensionProperties> properties = enumerateDeviceExtensionProperties(
2828 context.getInstanceInterface(), context.getPhysicalDevice(), layer->layerName);
2829 vector<string> extensionNames;
2830
2831 for (size_t extNdx = 0; extNdx < properties.size(); extNdx++)
2832 {
2833 log << TestLog::Message << extNdx << ": " << properties[extNdx] << TestLog::EndMessage;
2834
2835 extensionNames.push_back(properties[extNdx].extensionName);
2836 }
2837
2838 checkDeviceExtensions(results, extensionNames);
2839 CheckEnumerateDeviceExtensionPropertiesIncompleteResult(layer->layerName)(context, results,
2840 properties.size());
2841 }
2842 }
2843
2844 return tcu::TestStatus(results.getResult(), results.getMessage());
2845 }
2846
extensionCoreVersions(Context & context)2847 tcu::TestStatus extensionCoreVersions(Context &context)
2848 {
2849 uint32_t major;
2850 uint32_t minor;
2851 const char *extName;
2852
2853 auto &log = context.getTestContext().getLog();
2854 tcu::ResultCollector results(log);
2855
2856 const auto instanceExtensionProperties =
2857 enumerateInstanceExtensionProperties(context.getPlatformInterface(), nullptr);
2858 const auto deviceExtensionProperties =
2859 enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), nullptr);
2860
2861 for (const auto &majorMinorName : extensionRequiredCoreVersion)
2862 {
2863 std::tie(major, minor, extName) = majorMinorName;
2864 const RequiredExtension reqExt(extName);
2865
2866 if ((isExtensionStructSupported(instanceExtensionProperties, reqExt) ||
2867 isExtensionStructSupported(deviceExtensionProperties, reqExt)) &&
2868 !context.contextSupports(vk::ApiVersion(0u, major, minor, 0u)))
2869 {
2870 results.fail("Required core version for " + std::string(extName) + " not met (" + de::toString(major) +
2871 "." + de::toString(minor) + ")");
2872 }
2873 }
2874
2875 return tcu::TestStatus(results.getResult(), results.getMessage());
2876 }
2877
2878 #define VK_SIZE_OF(STRUCT, MEMBER) (sizeof(((STRUCT *)0)->MEMBER))
2879 #define OFFSET_TABLE_ENTRY(STRUCT, MEMBER) \
2880 { \
2881 (size_t) offsetof(STRUCT, MEMBER), VK_SIZE_OF(STRUCT, MEMBER) \
2882 }
2883
deviceFeatures(Context & context)2884 tcu::TestStatus deviceFeatures(Context &context)
2885 {
2886 using namespace ValidateQueryBits;
2887
2888 TestLog &log = context.getTestContext().getLog();
2889 VkPhysicalDeviceFeatures *features;
2890 uint8_t buffer[sizeof(VkPhysicalDeviceFeatures) + GUARD_SIZE];
2891
2892 const QueryMemberTableEntry featureOffsetTable[] = {
2893 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, robustBufferAccess),
2894 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fullDrawIndexUint32),
2895 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, imageCubeArray),
2896 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, independentBlend),
2897 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, geometryShader),
2898 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, tessellationShader),
2899 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sampleRateShading),
2900 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, dualSrcBlend),
2901 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, logicOp),
2902 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, multiDrawIndirect),
2903 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, drawIndirectFirstInstance),
2904 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthClamp),
2905 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthBiasClamp),
2906 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fillModeNonSolid),
2907 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthBounds),
2908 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, wideLines),
2909 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, largePoints),
2910 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, alphaToOne),
2911 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, multiViewport),
2912 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, samplerAnisotropy),
2913 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionETC2),
2914 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionASTC_LDR),
2915 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionBC),
2916 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, occlusionQueryPrecise),
2917 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, pipelineStatisticsQuery),
2918 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, vertexPipelineStoresAndAtomics),
2919 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fragmentStoresAndAtomics),
2920 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderTessellationAndGeometryPointSize),
2921 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderImageGatherExtended),
2922 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageExtendedFormats),
2923 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageMultisample),
2924 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageReadWithoutFormat),
2925 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageWriteWithoutFormat),
2926 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderUniformBufferArrayDynamicIndexing),
2927 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderSampledImageArrayDynamicIndexing),
2928 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageBufferArrayDynamicIndexing),
2929 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageArrayDynamicIndexing),
2930 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderClipDistance),
2931 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderCullDistance),
2932 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderFloat64),
2933 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderInt64),
2934 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderInt16),
2935 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderResourceResidency),
2936 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderResourceMinLod),
2937 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseBinding),
2938 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyBuffer),
2939 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyImage2D),
2940 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyImage3D),
2941 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency2Samples),
2942 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency4Samples),
2943 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency8Samples),
2944 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency16Samples),
2945 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyAliased),
2946 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, variableMultisampleRate),
2947 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, inheritedQueries),
2948 {0, 0}};
2949
2950 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
2951 features = reinterpret_cast<VkPhysicalDeviceFeatures *>(buffer);
2952
2953 context.getInstanceInterface().getPhysicalDeviceFeatures(context.getPhysicalDevice(), features);
2954
2955 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage << TestLog::Message
2956 << *features << TestLog::EndMessage;
2957
2958 // Requirements and dependencies
2959 {
2960 if (!features->robustBufferAccess)
2961 return tcu::TestStatus::fail("robustBufferAccess is not supported");
2962 }
2963
2964 for (int ndx = 0; ndx < GUARD_SIZE; ndx++)
2965 {
2966 if (buffer[ndx + sizeof(VkPhysicalDeviceFeatures)] != GUARD_VALUE)
2967 {
2968 log << TestLog::Message << "deviceFeatures - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
2969 return tcu::TestStatus::fail("deviceFeatures buffer overflow");
2970 }
2971 }
2972
2973 if (!validateInitComplete(context.getPhysicalDevice(), &InstanceInterface::getPhysicalDeviceFeatures,
2974 context.getInstanceInterface(), featureOffsetTable))
2975 {
2976 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceFeatures not completely initialized"
2977 << TestLog::EndMessage;
2978 return tcu::TestStatus::fail("deviceFeatures incomplete initialization");
2979 }
2980
2981 return tcu::TestStatus::pass("Query succeeded");
2982 }
2983
2984 static const ValidateQueryBits::QueryMemberTableEntry s_physicalDevicePropertiesOffsetTable[] = {
2985 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, apiVersion),
2986 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, driverVersion),
2987 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, vendorID),
2988 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, deviceID),
2989 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, deviceType),
2990 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, pipelineCacheUUID),
2991 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension1D),
2992 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension2D),
2993 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension3D),
2994 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimensionCube),
2995 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageArrayLayers),
2996 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelBufferElements),
2997 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxUniformBufferRange),
2998 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxStorageBufferRange),
2999 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPushConstantsSize),
3000 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxMemoryAllocationCount),
3001 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerAllocationCount),
3002 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.bufferImageGranularity),
3003 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sparseAddressSpaceSize),
3004 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxBoundDescriptorSets),
3005 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorSamplers),
3006 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorUniformBuffers),
3007 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorStorageBuffers),
3008 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorSampledImages),
3009 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorStorageImages),
3010 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorInputAttachments),
3011 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageResources),
3012 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetSamplers),
3013 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetUniformBuffers),
3014 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetUniformBuffersDynamic),
3015 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageBuffers),
3016 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageBuffersDynamic),
3017 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetSampledImages),
3018 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageImages),
3019 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetInputAttachments),
3020 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputAttributes),
3021 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputBindings),
3022 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputAttributeOffset),
3023 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputBindingStride),
3024 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexOutputComponents),
3025 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationGenerationLevel),
3026 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationPatchSize),
3027 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerVertexInputComponents),
3028 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerVertexOutputComponents),
3029 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerPatchOutputComponents),
3030 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlTotalOutputComponents),
3031 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationEvaluationInputComponents),
3032 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationEvaluationOutputComponents),
3033 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryShaderInvocations),
3034 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryInputComponents),
3035 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryOutputComponents),
3036 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryOutputVertices),
3037 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryTotalOutputComponents),
3038 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentInputComponents),
3039 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentOutputAttachments),
3040 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentDualSrcAttachments),
3041 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentCombinedOutputResources),
3042 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeSharedMemorySize),
3043 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupCount[3]),
3044 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupInvocations),
3045 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupSize[3]),
3046 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subPixelPrecisionBits),
3047 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subTexelPrecisionBits),
3048 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.mipmapPrecisionBits),
3049 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDrawIndexedIndexValue),
3050 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDrawIndirectCount),
3051 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerLodBias),
3052 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerAnisotropy),
3053 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxViewports),
3054 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxViewportDimensions[2]),
3055 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.viewportBoundsRange[2]),
3056 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.viewportSubPixelBits),
3057 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minMemoryMapAlignment),
3058 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelBufferOffsetAlignment),
3059 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minUniformBufferOffsetAlignment),
3060 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minStorageBufferOffsetAlignment),
3061 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelOffset),
3062 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelOffset),
3063 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelGatherOffset),
3064 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelGatherOffset),
3065 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minInterpolationOffset),
3066 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxInterpolationOffset),
3067 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subPixelInterpolationOffsetBits),
3068 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferWidth),
3069 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferHeight),
3070 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferLayers),
3071 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferColorSampleCounts),
3072 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferDepthSampleCounts),
3073 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferStencilSampleCounts),
3074 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferNoAttachmentsSampleCounts),
3075 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxColorAttachments),
3076 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageColorSampleCounts),
3077 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageIntegerSampleCounts),
3078 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageDepthSampleCounts),
3079 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageStencilSampleCounts),
3080 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.storageImageSampleCounts),
3081 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSampleMaskWords),
3082 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.timestampComputeAndGraphics),
3083 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.timestampPeriod),
3084 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxClipDistances),
3085 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxCullDistances),
3086 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxCombinedClipAndCullDistances),
3087 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.discreteQueuePriorities),
3088 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.pointSizeRange[2]),
3089 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.lineWidthRange[2]),
3090 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.pointSizeGranularity),
3091 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.lineWidthGranularity),
3092 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.strictLines),
3093 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.standardSampleLocations),
3094 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.optimalBufferCopyOffsetAlignment),
3095 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.optimalBufferCopyRowPitchAlignment),
3096 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.nonCoherentAtomSize),
3097 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard2DBlockShape),
3098 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard2DMultisampleBlockShape),
3099 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard3DBlockShape),
3100 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyAlignedMipSize),
3101 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyNonResidentStrict),
3102 {0, 0}};
3103
deviceProperties(Context & context)3104 tcu::TestStatus deviceProperties(Context &context)
3105 {
3106 using namespace ValidateQueryBits;
3107
3108 TestLog &log = context.getTestContext().getLog();
3109 VkPhysicalDeviceProperties *props;
3110 VkPhysicalDeviceFeatures features;
3111 uint8_t buffer[sizeof(VkPhysicalDeviceProperties) + GUARD_SIZE];
3112
3113 props = reinterpret_cast<VkPhysicalDeviceProperties *>(buffer);
3114 deMemset(props, GUARD_VALUE, sizeof(buffer));
3115
3116 context.getInstanceInterface().getPhysicalDeviceProperties(context.getPhysicalDevice(), props);
3117 context.getInstanceInterface().getPhysicalDeviceFeatures(context.getPhysicalDevice(), &features);
3118
3119 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage << TestLog::Message
3120 << *props << TestLog::EndMessage;
3121
3122 if (!validateFeatureLimits(props, &features, log))
3123 return tcu::TestStatus::fail("deviceProperties - feature limits failed");
3124
3125 for (int ndx = 0; ndx < GUARD_SIZE; ndx++)
3126 {
3127 if (buffer[ndx + sizeof(VkPhysicalDeviceProperties)] != GUARD_VALUE)
3128 {
3129 log << TestLog::Message << "deviceProperties - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
3130 return tcu::TestStatus::fail("deviceProperties buffer overflow");
3131 }
3132 }
3133
3134 if (!validateInitComplete(context.getPhysicalDevice(), &InstanceInterface::getPhysicalDeviceProperties,
3135 context.getInstanceInterface(), s_physicalDevicePropertiesOffsetTable))
3136 {
3137 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceProperties not completely initialized"
3138 << TestLog::EndMessage;
3139 return tcu::TestStatus::fail("deviceProperties incomplete initialization");
3140 }
3141
3142 // Check if deviceName string is properly terminated.
3143 if (memchr(props->deviceName, '\0', VK_MAX_PHYSICAL_DEVICE_NAME_SIZE) == nullptr)
3144 {
3145 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceProperties deviceName not properly initialized"
3146 << TestLog::EndMessage;
3147 return tcu::TestStatus::fail("deviceProperties incomplete initialization");
3148 }
3149
3150 {
3151 const ApiVersion deviceVersion = unpackVersion(props->apiVersion);
3152 #ifndef CTS_USES_VULKANSC
3153 const ApiVersion deqpVersion = unpackVersion(VK_API_MAX_FRAMEWORK_VERSION);
3154 #else
3155 const ApiVersion deqpVersion = unpackVersion(VK_API_VERSION_1_2);
3156 #endif // CTS_USES_VULKANSC
3157
3158 if (deviceVersion.majorNum != deqpVersion.majorNum)
3159 {
3160 log << TestLog::Message << "deviceProperties - API Major Version " << deviceVersion.majorNum
3161 << " is not valid" << TestLog::EndMessage;
3162 return tcu::TestStatus::fail("deviceProperties apiVersion not valid");
3163 }
3164
3165 if (deviceVersion.minorNum > deqpVersion.minorNum)
3166 {
3167 log << TestLog::Message << "deviceProperties - API Minor Version " << deviceVersion.minorNum
3168 << " is not valid for this version of dEQP" << TestLog::EndMessage;
3169 return tcu::TestStatus::fail("deviceProperties apiVersion not valid");
3170 }
3171 }
3172
3173 return tcu::TestStatus::pass("DeviceProperites query succeeded");
3174 }
3175
deviceQueueFamilyProperties(Context & context)3176 tcu::TestStatus deviceQueueFamilyProperties(Context &context)
3177 {
3178 TestLog &log = context.getTestContext().getLog();
3179 const vector<VkQueueFamilyProperties> queueProperties =
3180 getPhysicalDeviceQueueFamilyProperties(context.getInstanceInterface(), context.getPhysicalDevice());
3181
3182 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage;
3183
3184 for (size_t queueNdx = 0; queueNdx < queueProperties.size(); queueNdx++)
3185 log << TestLog::Message << queueNdx << ": " << queueProperties[queueNdx] << TestLog::EndMessage;
3186
3187 return tcu::TestStatus::pass("Querying queue properties succeeded");
3188 }
3189
deviceMemoryProperties(Context & context)3190 tcu::TestStatus deviceMemoryProperties(Context &context)
3191 {
3192 TestLog &log = context.getTestContext().getLog();
3193 VkPhysicalDeviceMemoryProperties *memProps;
3194 uint8_t buffer[sizeof(VkPhysicalDeviceMemoryProperties) + GUARD_SIZE];
3195
3196 memProps = reinterpret_cast<VkPhysicalDeviceMemoryProperties *>(buffer);
3197 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
3198
3199 context.getInstanceInterface().getPhysicalDeviceMemoryProperties(context.getPhysicalDevice(), memProps);
3200
3201 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage << TestLog::Message
3202 << *memProps << TestLog::EndMessage;
3203
3204 for (int32_t ndx = 0; ndx < GUARD_SIZE; ndx++)
3205 {
3206 if (buffer[ndx + sizeof(VkPhysicalDeviceMemoryProperties)] != GUARD_VALUE)
3207 {
3208 log << TestLog::Message << "deviceMemoryProperties - Guard offset " << ndx << " not valid"
3209 << TestLog::EndMessage;
3210 return tcu::TestStatus::fail("deviceMemoryProperties buffer overflow");
3211 }
3212 }
3213
3214 if (memProps->memoryHeapCount >= VK_MAX_MEMORY_HEAPS)
3215 {
3216 log << TestLog::Message << "deviceMemoryProperties - HeapCount larger than " << (uint32_t)VK_MAX_MEMORY_HEAPS
3217 << TestLog::EndMessage;
3218 return tcu::TestStatus::fail("deviceMemoryProperties HeapCount too large");
3219 }
3220
3221 if (memProps->memoryHeapCount == 1)
3222 {
3223 if ((memProps->memoryHeaps[0].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) == 0)
3224 {
3225 log << TestLog::Message << "deviceMemoryProperties - Single heap is not marked DEVICE_LOCAL"
3226 << TestLog::EndMessage;
3227 return tcu::TestStatus::fail("deviceMemoryProperties invalid HeapFlags");
3228 }
3229 }
3230
3231 const VkMemoryPropertyFlags validPropertyFlags[] = {
3232 0,
3233 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
3234 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
3235 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
3236 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
3237 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT |
3238 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
3239 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
3240 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
3241 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
3242 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT};
3243
3244 const VkMemoryPropertyFlags requiredPropertyFlags[] = {VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
3245 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT};
3246
3247 bool requiredFlagsFound[DE_LENGTH_OF_ARRAY(requiredPropertyFlags)];
3248 std::fill(DE_ARRAY_BEGIN(requiredFlagsFound), DE_ARRAY_END(requiredFlagsFound), false);
3249
3250 for (uint32_t memoryNdx = 0; memoryNdx < memProps->memoryTypeCount; memoryNdx++)
3251 {
3252 bool validPropTypeFound = false;
3253
3254 if (memProps->memoryTypes[memoryNdx].heapIndex >= memProps->memoryHeapCount)
3255 {
3256 log << TestLog::Message << "deviceMemoryProperties - heapIndex "
3257 << memProps->memoryTypes[memoryNdx].heapIndex << " larger than heapCount" << TestLog::EndMessage;
3258 return tcu::TestStatus::fail("deviceMemoryProperties - invalid heapIndex");
3259 }
3260
3261 const VkMemoryPropertyFlags bitsToCheck =
3262 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
3263 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | VK_MEMORY_PROPERTY_HOST_CACHED_BIT |
3264 VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT;
3265
3266 for (const VkMemoryPropertyFlags *requiredFlagsIterator = DE_ARRAY_BEGIN(requiredPropertyFlags);
3267 requiredFlagsIterator != DE_ARRAY_END(requiredPropertyFlags); requiredFlagsIterator++)
3268 if ((memProps->memoryTypes[memoryNdx].propertyFlags & *requiredFlagsIterator) == *requiredFlagsIterator)
3269 requiredFlagsFound[requiredFlagsIterator - DE_ARRAY_BEGIN(requiredPropertyFlags)] = true;
3270
3271 if (de::contains(DE_ARRAY_BEGIN(validPropertyFlags), DE_ARRAY_END(validPropertyFlags),
3272 memProps->memoryTypes[memoryNdx].propertyFlags & bitsToCheck))
3273 validPropTypeFound = true;
3274
3275 if (!validPropTypeFound)
3276 {
3277 log << TestLog::Message << "deviceMemoryProperties - propertyFlags "
3278 << memProps->memoryTypes[memoryNdx].propertyFlags << " not valid" << TestLog::EndMessage;
3279 return tcu::TestStatus::fail("deviceMemoryProperties propertyFlags not valid");
3280 }
3281
3282 if (memProps->memoryTypes[memoryNdx].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
3283 {
3284 if ((memProps->memoryHeaps[memProps->memoryTypes[memoryNdx].heapIndex].flags &
3285 VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) == 0)
3286 {
3287 log << TestLog::Message
3288 << "deviceMemoryProperties - DEVICE_LOCAL memory type references heap which is not DEVICE_LOCAL"
3289 << TestLog::EndMessage;
3290 return tcu::TestStatus::fail("deviceMemoryProperties inconsistent memoryType and HeapFlags");
3291 }
3292 }
3293 else
3294 {
3295 if (memProps->memoryHeaps[memProps->memoryTypes[memoryNdx].heapIndex].flags &
3296 VK_MEMORY_HEAP_DEVICE_LOCAL_BIT)
3297 {
3298 log << TestLog::Message
3299 << "deviceMemoryProperties - non-DEVICE_LOCAL memory type references heap with is DEVICE_LOCAL"
3300 << TestLog::EndMessage;
3301 return tcu::TestStatus::fail("deviceMemoryProperties inconsistent memoryType and HeapFlags");
3302 }
3303 }
3304 }
3305
3306 bool *requiredFlagsFoundIterator =
3307 std::find(DE_ARRAY_BEGIN(requiredFlagsFound), DE_ARRAY_END(requiredFlagsFound), false);
3308 if (requiredFlagsFoundIterator != DE_ARRAY_END(requiredFlagsFound))
3309 {
3310 DE_ASSERT(requiredFlagsFoundIterator - DE_ARRAY_BEGIN(requiredFlagsFound) <=
3311 DE_LENGTH_OF_ARRAY(requiredPropertyFlags));
3312 log << TestLog::Message << "deviceMemoryProperties - required property flags "
3313 << getMemoryPropertyFlagsStr(
3314 requiredPropertyFlags[requiredFlagsFoundIterator - DE_ARRAY_BEGIN(requiredFlagsFound)])
3315 << " not found" << TestLog::EndMessage;
3316
3317 return tcu::TestStatus::fail("deviceMemoryProperties propertyFlags not valid");
3318 }
3319
3320 return tcu::TestStatus::pass("Querying memory properties succeeded");
3321 }
3322
deviceGroupPeerMemoryFeatures(Context & context)3323 tcu::TestStatus deviceGroupPeerMemoryFeatures(Context &context)
3324 {
3325 TestLog &log = context.getTestContext().getLog();
3326 const PlatformInterface &vkp = context.getPlatformInterface();
3327 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_device_group_creation"));
3328 const InstanceDriver &vki(instance.getDriver());
3329 const tcu::CommandLine &cmdLine = context.getTestContext().getCommandLine();
3330 const uint32_t devGroupIdx = cmdLine.getVKDeviceGroupId() - 1;
3331 const uint32_t deviceIdx = vk::chooseDeviceIndex(context.getInstanceInterface(), instance, cmdLine);
3332 const float queuePriority = 1.0f;
3333 const char *deviceGroupExtName = "VK_KHR_device_group";
3334 VkPhysicalDeviceMemoryProperties memProps;
3335 VkPeerMemoryFeatureFlags *peerMemFeatures;
3336 uint8_t buffer[sizeof(VkPeerMemoryFeatureFlags) + GUARD_SIZE];
3337 uint32_t queueFamilyIndex = 0;
3338
3339 const vector<VkPhysicalDeviceGroupProperties> deviceGroupProps = enumeratePhysicalDeviceGroups(vki, instance);
3340 std::vector<const char *> deviceExtensions;
3341
3342 if (static_cast<size_t>(devGroupIdx) >= deviceGroupProps.size())
3343 {
3344 std::ostringstream msg;
3345 msg << "Chosen device group index " << devGroupIdx << " too big: found " << deviceGroupProps.size()
3346 << " device groups";
3347 TCU_THROW(NotSupportedError, msg.str());
3348 }
3349
3350 const auto numPhysicalDevices = deviceGroupProps[devGroupIdx].physicalDeviceCount;
3351
3352 if (deviceIdx >= numPhysicalDevices)
3353 {
3354 std::ostringstream msg;
3355 msg << "Chosen device index " << deviceIdx << " too big: chosen device group " << devGroupIdx << " has "
3356 << numPhysicalDevices << " devices";
3357 TCU_THROW(NotSupportedError, msg.str());
3358 }
3359
3360 // Need at least 2 devices for peer memory features.
3361 if (numPhysicalDevices < 2)
3362 TCU_THROW(NotSupportedError, "Need a device group with at least 2 physical devices");
3363
3364 if (!isCoreDeviceExtension(context.getUsedApiVersion(), deviceGroupExtName))
3365 deviceExtensions.push_back(deviceGroupExtName);
3366
3367 const std::vector<VkQueueFamilyProperties> queueProps =
3368 getPhysicalDeviceQueueFamilyProperties(vki, deviceGroupProps[devGroupIdx].physicalDevices[deviceIdx]);
3369 for (size_t queueNdx = 0; queueNdx < queueProps.size(); queueNdx++)
3370 {
3371 if (queueProps[queueNdx].queueFlags & VK_QUEUE_GRAPHICS_BIT)
3372 queueFamilyIndex = (uint32_t)queueNdx;
3373 }
3374 const VkDeviceQueueCreateInfo deviceQueueCreateInfo = {
3375 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, //type
3376 nullptr, //pNext
3377 (VkDeviceQueueCreateFlags)0u, //flags
3378 queueFamilyIndex, //queueFamilyIndex;
3379 1u, //queueCount;
3380 &queuePriority, //pQueuePriorities;
3381 };
3382
3383 // Create device groups
3384 VkDeviceGroupDeviceCreateInfo deviceGroupInfo = {
3385 VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO, //stype
3386 nullptr, //pNext
3387 deviceGroupProps[devGroupIdx].physicalDeviceCount, //physicalDeviceCount
3388 deviceGroupProps[devGroupIdx].physicalDevices //physicalDevices
3389 };
3390
3391 void *pNext = &deviceGroupInfo;
3392 #ifdef CTS_USES_VULKANSC
3393 VkDeviceObjectReservationCreateInfo memReservationInfo = context.getTestContext().getCommandLine().isSubProcess() ?
3394 context.getResourceInterface()->getStatMax() :
3395 resetDeviceObjectReservationCreateInfo();
3396 memReservationInfo.pNext = pNext;
3397 pNext = &memReservationInfo;
3398
3399 VkPhysicalDeviceVulkanSC10Features sc10Features = createDefaultSC10Features();
3400 sc10Features.pNext = pNext;
3401 pNext = &sc10Features;
3402
3403 VkPipelineCacheCreateInfo pcCI;
3404 std::vector<VkPipelinePoolSize> poolSizes;
3405 if (context.getTestContext().getCommandLine().isSubProcess())
3406 {
3407 if (context.getResourceInterface()->getCacheDataSize() > 0)
3408 {
3409 pcCI = {
3410 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO, // VkStructureType sType;
3411 nullptr, // const void* pNext;
3412 VK_PIPELINE_CACHE_CREATE_READ_ONLY_BIT |
3413 VK_PIPELINE_CACHE_CREATE_USE_APPLICATION_STORAGE_BIT, // VkPipelineCacheCreateFlags flags;
3414 context.getResourceInterface()->getCacheDataSize(), // uintptr_t initialDataSize;
3415 context.getResourceInterface()->getCacheData() // const void* pInitialData;
3416 };
3417 memReservationInfo.pipelineCacheCreateInfoCount = 1;
3418 memReservationInfo.pPipelineCacheCreateInfos = &pcCI;
3419 }
3420
3421 poolSizes = context.getResourceInterface()->getPipelinePoolSizes();
3422 if (!poolSizes.empty())
3423 {
3424 memReservationInfo.pipelinePoolSizeCount = uint32_t(poolSizes.size());
3425 memReservationInfo.pPipelinePoolSizes = poolSizes.data();
3426 }
3427 }
3428 #endif // CTS_USES_VULKANSC
3429
3430 const VkDeviceCreateInfo deviceCreateInfo = {
3431 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, //sType;
3432 pNext, //pNext;
3433 (VkDeviceCreateFlags)0u, //flags
3434 1, //queueRecordCount;
3435 &deviceQueueCreateInfo, //pRequestedQueues;
3436 0, //layerCount;
3437 nullptr, //ppEnabledLayerNames;
3438 uint32_t(deviceExtensions.size()), //extensionCount;
3439 de::dataOrNull(deviceExtensions), //ppEnabledExtensionNames;
3440 nullptr, //pEnabledFeatures;
3441 };
3442
3443 Move<VkDevice> deviceGroup =
3444 createCustomDevice(context.getTestContext().getCommandLine().isValidationEnabled(), vkp, instance, vki,
3445 deviceGroupProps[devGroupIdx].physicalDevices[deviceIdx], &deviceCreateInfo);
3446 const DeviceDriver vk(vkp, instance, *deviceGroup, context.getUsedApiVersion(),
3447 context.getTestContext().getCommandLine());
3448 context.getInstanceInterface().getPhysicalDeviceMemoryProperties(
3449 deviceGroupProps[devGroupIdx].physicalDevices[deviceIdx], &memProps);
3450
3451 peerMemFeatures = reinterpret_cast<VkPeerMemoryFeatureFlags *>(buffer);
3452 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
3453
3454 for (uint32_t heapIndex = 0; heapIndex < memProps.memoryHeapCount; heapIndex++)
3455 {
3456 for (uint32_t localDeviceIndex = 0; localDeviceIndex < numPhysicalDevices; localDeviceIndex++)
3457 {
3458 for (uint32_t remoteDeviceIndex = 0; remoteDeviceIndex < numPhysicalDevices; remoteDeviceIndex++)
3459 {
3460 if (localDeviceIndex != remoteDeviceIndex)
3461 {
3462 vk.getDeviceGroupPeerMemoryFeatures(deviceGroup.get(), heapIndex, localDeviceIndex,
3463 remoteDeviceIndex, peerMemFeatures);
3464
3465 // Check guard
3466 for (int32_t ndx = 0; ndx < GUARD_SIZE; ndx++)
3467 {
3468 if (buffer[ndx + sizeof(VkPeerMemoryFeatureFlags)] != GUARD_VALUE)
3469 {
3470 log << TestLog::Message << "deviceGroupPeerMemoryFeatures - Guard offset " << ndx
3471 << " not valid" << TestLog::EndMessage;
3472 return tcu::TestStatus::fail("deviceGroupPeerMemoryFeatures buffer overflow");
3473 }
3474 }
3475
3476 VkPeerMemoryFeatureFlags requiredFlag = VK_PEER_MEMORY_FEATURE_COPY_DST_BIT;
3477 VkPeerMemoryFeatureFlags maxValidFlag =
3478 VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT | VK_PEER_MEMORY_FEATURE_COPY_DST_BIT |
3479 VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT | VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT;
3480 if ((!(*peerMemFeatures & requiredFlag)) || *peerMemFeatures > maxValidFlag)
3481 return tcu::TestStatus::fail("deviceGroupPeerMemoryFeatures invalid flag");
3482
3483 log << TestLog::Message << "deviceGroup = " << deviceGroup.get() << TestLog::EndMessage
3484 << TestLog::Message << "heapIndex = " << heapIndex << TestLog::EndMessage << TestLog::Message
3485 << "localDeviceIndex = " << localDeviceIndex << TestLog::EndMessage << TestLog::Message
3486 << "remoteDeviceIndex = " << remoteDeviceIndex << TestLog::EndMessage << TestLog::Message
3487 << "PeerMemoryFeatureFlags = " << *peerMemFeatures << TestLog::EndMessage;
3488 }
3489 } // remote device
3490 } // local device
3491 } // heap Index
3492
3493 return tcu::TestStatus::pass("Querying deviceGroup peer memory features succeeded");
3494 }
3495
deviceMemoryBudgetProperties(Context & context)3496 tcu::TestStatus deviceMemoryBudgetProperties(Context &context)
3497 {
3498 TestLog &log = context.getTestContext().getLog();
3499 uint8_t buffer[sizeof(VkPhysicalDeviceMemoryBudgetPropertiesEXT) + GUARD_SIZE];
3500
3501 if (!context.isDeviceFunctionalitySupported("VK_EXT_memory_budget"))
3502 TCU_THROW(NotSupportedError, "VK_EXT_memory_budget is not supported");
3503
3504 VkPhysicalDeviceMemoryBudgetPropertiesEXT *budgetProps =
3505 reinterpret_cast<VkPhysicalDeviceMemoryBudgetPropertiesEXT *>(buffer);
3506 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
3507
3508 budgetProps->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT;
3509 budgetProps->pNext = nullptr;
3510
3511 VkPhysicalDeviceMemoryProperties2 memProps;
3512 deMemset(&memProps, 0, sizeof(memProps));
3513 memProps.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2;
3514 memProps.pNext = budgetProps;
3515
3516 context.getInstanceInterface().getPhysicalDeviceMemoryProperties2(context.getPhysicalDevice(), &memProps);
3517
3518 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage << TestLog::Message
3519 << *budgetProps << TestLog::EndMessage;
3520
3521 for (int32_t ndx = 0; ndx < GUARD_SIZE; ndx++)
3522 {
3523 if (buffer[ndx + sizeof(VkPhysicalDeviceMemoryBudgetPropertiesEXT)] != GUARD_VALUE)
3524 {
3525 log << TestLog::Message << "deviceMemoryBudgetProperties - Guard offset " << ndx << " not valid"
3526 << TestLog::EndMessage;
3527 return tcu::TestStatus::fail("deviceMemoryBudgetProperties buffer overflow");
3528 }
3529 }
3530
3531 for (uint32_t i = 0; i < memProps.memoryProperties.memoryHeapCount; ++i)
3532 {
3533 if (budgetProps->heapBudget[i] == 0)
3534 {
3535 log << TestLog::Message << "deviceMemoryBudgetProperties - Supported heaps must report nonzero budget"
3536 << TestLog::EndMessage;
3537 return tcu::TestStatus::fail("deviceMemoryBudgetProperties invalid heap budget (zero)");
3538 }
3539 if (budgetProps->heapBudget[i] > memProps.memoryProperties.memoryHeaps[i].size)
3540 {
3541 log << TestLog::Message
3542 << "deviceMemoryBudgetProperties - Heap budget must be less than or equal to heap size"
3543 << TestLog::EndMessage;
3544 return tcu::TestStatus::fail("deviceMemoryBudgetProperties invalid heap budget (too large)");
3545 }
3546 }
3547
3548 for (uint32_t i = memProps.memoryProperties.memoryHeapCount; i < VK_MAX_MEMORY_HEAPS; ++i)
3549 {
3550 if (budgetProps->heapBudget[i] != 0 || budgetProps->heapUsage[i] != 0)
3551 {
3552 log << TestLog::Message << "deviceMemoryBudgetProperties - Unused heaps must report budget/usage of zero"
3553 << TestLog::EndMessage;
3554 return tcu::TestStatus::fail("deviceMemoryBudgetProperties invalid unused heaps");
3555 }
3556 }
3557
3558 return tcu::TestStatus::pass("Querying memory budget properties succeeded");
3559 }
3560
3561 namespace
3562 {
3563
3564 #include "vkMandatoryFeatures.inl"
3565
3566 }
3567
deviceMandatoryFeatures(Context & context)3568 tcu::TestStatus deviceMandatoryFeatures(Context &context)
3569 {
3570 bool result = checkBasicMandatoryFeatures(context);
3571
3572 #if defined(CTS_USES_VULKAN)
3573 // for vulkan 1.4+ we need to check complex cases that were not generated in vkMandatoryFeatures.inl
3574 if (context.contextSupports(vk::ApiVersion(0, 1, 4, 0)))
3575 {
3576 const InstanceInterface &vki = context.getInstanceInterface();
3577 VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
3578 const auto &cmdLine = context.getTestContext().getCommandLine();
3579 const auto &vulkan14Features = context.getDeviceVulkan14Features();
3580 tcu::TestLog &log = context.getTestContext().getLog();
3581
3582 if (!cmdLine.isComputeOnly() && (vulkan14Features.hostImageCopy == VK_FALSE))
3583 {
3584 // find graphics and transfer queues
3585 std::optional<size_t> graphicsQueueNdx;
3586 std::optional<size_t> transferQueueNdx;
3587 const auto queuePropsVect = getPhysicalDeviceQueueFamilyProperties(vki, physicalDevice);
3588 for (size_t queueNdx = 0; queueNdx < queuePropsVect.size(); queueNdx++)
3589 {
3590 uint32_t queueFlags = queuePropsVect[queueNdx].queueFlags;
3591 if ((queueFlags & VK_QUEUE_GRAPHICS_BIT) && !graphicsQueueNdx.has_value())
3592 graphicsQueueNdx = (uint32_t)queueNdx;
3593 else if ((queueFlags & VK_QUEUE_TRANSFER_BIT) && !transferQueueNdx.has_value())
3594 transferQueueNdx = (uint32_t)queueNdx;
3595 }
3596
3597 if (!graphicsQueueNdx.has_value() || !transferQueueNdx.has_value())
3598 {
3599 log << tcu::TestLog::Message
3600 << "Implementation that has a VK_QUEUE_GRAPHICS_BIT queue must support "
3601 "either the hostImageCopy feature or an additional queue that supports VK_QUEUE_TRANSFER_BIT"
3602 << tcu::TestLog::EndMessage;
3603 result = false;
3604 }
3605 }
3606 }
3607 #endif // defined(CTS_USES_VULKAN)
3608
3609 if (result)
3610 return tcu::TestStatus::pass("Passed");
3611
3612 return tcu::TestStatus::fail("Not all mandatory features are supported ( see: vkspec.html#features-requirements )");
3613 }
3614
getBaseRequiredOptimalTilingFeatures(VkFormat format)3615 VkFormatFeatureFlags getBaseRequiredOptimalTilingFeatures(VkFormat format)
3616 {
3617 struct Formatpair
3618 {
3619 VkFormat format;
3620 VkFormatFeatureFlags flags;
3621 };
3622
3623 enum
3624 {
3625 SAIM = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT,
3626 BLSR = VK_FORMAT_FEATURE_BLIT_SRC_BIT,
3627 SIFL = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT,
3628 COAT = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT,
3629 BLDS = VK_FORMAT_FEATURE_BLIT_DST_BIT,
3630 CABL = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
3631 STIM = VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT,
3632 STIA = VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT,
3633 DSAT = VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT,
3634 TRSR = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT,
3635 TRDS = VK_FORMAT_FEATURE_TRANSFER_DST_BIT
3636 };
3637
3638 static const Formatpair formatflags[] = {
3639 {VK_FORMAT_B4G4R4A4_UNORM_PACK16, SAIM | BLSR | TRSR | TRDS | SIFL},
3640 {VK_FORMAT_R5G6B5_UNORM_PACK16, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3641 {VK_FORMAT_A1R5G5B5_UNORM_PACK16, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3642 {VK_FORMAT_R8_UNORM, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3643 {VK_FORMAT_R8_SNORM, SAIM | BLSR | TRSR | TRDS | SIFL},
3644 {VK_FORMAT_R8_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS},
3645 {VK_FORMAT_R8_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS},
3646 {VK_FORMAT_R8G8_UNORM, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3647 {VK_FORMAT_R8G8_SNORM, SAIM | BLSR | TRSR | TRDS | SIFL},
3648 {VK_FORMAT_R8G8_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS},
3649 {VK_FORMAT_R8G8_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS},
3650 {VK_FORMAT_R8G8B8A8_UNORM, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | STIM | CABL},
3651 {VK_FORMAT_R8G8B8A8_SNORM, SAIM | BLSR | TRSR | TRDS | SIFL | STIM},
3652 {VK_FORMAT_R8G8B8A8_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM},
3653 {VK_FORMAT_R8G8B8A8_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM},
3654 {VK_FORMAT_R8G8B8A8_SRGB, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3655 {VK_FORMAT_B8G8R8A8_UNORM, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3656 {VK_FORMAT_B8G8R8A8_SRGB, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3657 {VK_FORMAT_A8B8G8R8_UNORM_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3658 {VK_FORMAT_A8B8G8R8_SNORM_PACK32, SAIM | BLSR | TRSR | TRDS | SIFL},
3659 {VK_FORMAT_A8B8G8R8_UINT_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS},
3660 {VK_FORMAT_A8B8G8R8_SINT_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS},
3661 {VK_FORMAT_A8B8G8R8_SRGB_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3662 {VK_FORMAT_A2B10G10R10_UNORM_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3663 {VK_FORMAT_A2B10G10R10_UINT_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS},
3664 {VK_FORMAT_R16_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS},
3665 {VK_FORMAT_R16_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS},
3666 {VK_FORMAT_R16_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3667 {VK_FORMAT_R16G16_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS},
3668 {VK_FORMAT_R16G16_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS},
3669 {VK_FORMAT_R16G16_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL},
3670 {VK_FORMAT_R16G16B16A16_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM},
3671 {VK_FORMAT_R16G16B16A16_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM},
3672 {VK_FORMAT_R16G16B16A16_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | STIM | CABL},
3673 {VK_FORMAT_R32_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM | STIA},
3674 {VK_FORMAT_R32_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM | STIA},
3675 {VK_FORMAT_R32_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM},
3676 {VK_FORMAT_R32G32_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM},
3677 {VK_FORMAT_R32G32_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM},
3678 {VK_FORMAT_R32G32_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM},
3679 {VK_FORMAT_R32G32B32A32_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM},
3680 {VK_FORMAT_R32G32B32A32_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM},
3681 {VK_FORMAT_R32G32B32A32_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM},
3682 {VK_FORMAT_B10G11R11_UFLOAT_PACK32, SAIM | BLSR | TRSR | TRDS | SIFL},
3683 {VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, SAIM | BLSR | TRSR | TRDS | SIFL},
3684 {VK_FORMAT_D16_UNORM, SAIM | BLSR | TRSR | TRDS | DSAT},
3685 };
3686
3687 size_t formatpairs = sizeof(formatflags) / sizeof(Formatpair);
3688
3689 for (unsigned int i = 0; i < formatpairs; i++)
3690 if (formatflags[i].format == format)
3691 return formatflags[i].flags;
3692 return 0;
3693 }
3694
getRequiredOptimalExtendedTilingFeatures(Context & context,VkFormat format,VkFormatFeatureFlags queriedFlags)3695 VkFormatFeatureFlags getRequiredOptimalExtendedTilingFeatures(Context &context, VkFormat format,
3696 VkFormatFeatureFlags queriedFlags)
3697 {
3698 VkFormatFeatureFlags flags = (VkFormatFeatureFlags)0;
3699
3700 // VK_EXT_sampler_filter_minmax:
3701 // If filterMinmaxSingleComponentFormats is VK_TRUE, the following formats must
3702 // support the VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT feature with
3703 // VK_IMAGE_TILING_OPTIMAL, if they support VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT.
3704
3705 static const VkFormat s_requiredSampledImageFilterMinMaxFormats[] = {
3706 VK_FORMAT_R8_UNORM, VK_FORMAT_R8_SNORM, VK_FORMAT_R16_UNORM, VK_FORMAT_R16_SNORM,
3707 VK_FORMAT_R16_SFLOAT, VK_FORMAT_R32_SFLOAT, VK_FORMAT_D16_UNORM, VK_FORMAT_X8_D24_UNORM_PACK32,
3708 VK_FORMAT_D32_SFLOAT, VK_FORMAT_D16_UNORM_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT,
3709 };
3710
3711 if ((queriedFlags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0)
3712 {
3713 if (de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(),
3714 "VK_EXT_sampler_filter_minmax"))
3715 {
3716 if (de::contains(DE_ARRAY_BEGIN(s_requiredSampledImageFilterMinMaxFormats),
3717 DE_ARRAY_END(s_requiredSampledImageFilterMinMaxFormats), format))
3718 {
3719 VkPhysicalDeviceSamplerFilterMinmaxProperties physicalDeviceSamplerMinMaxProperties = {
3720 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES, nullptr, false, false};
3721
3722 {
3723 VkPhysicalDeviceProperties2 physicalDeviceProperties;
3724 physicalDeviceProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
3725 physicalDeviceProperties.pNext = &physicalDeviceSamplerMinMaxProperties;
3726
3727 const InstanceInterface &vk = context.getInstanceInterface();
3728 vk.getPhysicalDeviceProperties2(context.getPhysicalDevice(), &physicalDeviceProperties);
3729 }
3730
3731 if (physicalDeviceSamplerMinMaxProperties.filterMinmaxSingleComponentFormats)
3732 {
3733 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT;
3734 }
3735 }
3736 }
3737 }
3738
3739 // VK_EXT_filter_cubic:
3740 // If cubic filtering is supported, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT must be supported for the following image view types:
3741 // VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_VIEW_TYPE_2D_ARRAY
3742 static const VkFormat s_requiredSampledImageFilterCubicFormats[] = {VK_FORMAT_R4G4_UNORM_PACK8,
3743 VK_FORMAT_R4G4B4A4_UNORM_PACK16,
3744 VK_FORMAT_B4G4R4A4_UNORM_PACK16,
3745 VK_FORMAT_R5G6B5_UNORM_PACK16,
3746 VK_FORMAT_B5G6R5_UNORM_PACK16,
3747 VK_FORMAT_R5G5B5A1_UNORM_PACK16,
3748 VK_FORMAT_B5G5R5A1_UNORM_PACK16,
3749 VK_FORMAT_A1R5G5B5_UNORM_PACK16,
3750 VK_FORMAT_R8_UNORM,
3751 VK_FORMAT_R8_SNORM,
3752 VK_FORMAT_R8_SRGB,
3753 VK_FORMAT_R8G8_UNORM,
3754 VK_FORMAT_R8G8_SNORM,
3755 VK_FORMAT_R8G8_SRGB,
3756 VK_FORMAT_R8G8B8_UNORM,
3757 VK_FORMAT_R8G8B8_SNORM,
3758 VK_FORMAT_R8G8B8_SRGB,
3759 VK_FORMAT_B8G8R8_UNORM,
3760 VK_FORMAT_B8G8R8_SNORM,
3761 VK_FORMAT_B8G8R8_SRGB,
3762 VK_FORMAT_R8G8B8A8_UNORM,
3763 VK_FORMAT_R8G8B8A8_SNORM,
3764 VK_FORMAT_R8G8B8A8_SRGB,
3765 VK_FORMAT_B8G8R8A8_UNORM,
3766 VK_FORMAT_B8G8R8A8_SNORM,
3767 VK_FORMAT_B8G8R8A8_SRGB,
3768 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
3769 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
3770 VK_FORMAT_A8B8G8R8_SRGB_PACK32};
3771
3772 static const VkFormat s_requiredSampledImageFilterCubicFormatsETC2[] = {
3773 VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,
3774 VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK};
3775
3776 if ((queriedFlags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0 &&
3777 de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), "VK_EXT_filter_cubic"))
3778 {
3779 if (de::contains(DE_ARRAY_BEGIN(s_requiredSampledImageFilterCubicFormats),
3780 DE_ARRAY_END(s_requiredSampledImageFilterCubicFormats), format))
3781 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT;
3782
3783 const auto &coreFeatures = context.getDeviceFeatures();
3784 if (coreFeatures.textureCompressionETC2 &&
3785 de::contains(DE_ARRAY_BEGIN(s_requiredSampledImageFilterCubicFormatsETC2),
3786 DE_ARRAY_END(s_requiredSampledImageFilterCubicFormatsETC2), format))
3787 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT;
3788 }
3789
3790 return flags;
3791 }
3792
getRequiredBufferFeatures(VkFormat format)3793 VkFormatFeatureFlags getRequiredBufferFeatures(VkFormat format)
3794 {
3795 static const VkFormat s_requiredVertexBufferFormats[] = {VK_FORMAT_R8_UNORM,
3796 VK_FORMAT_R8_SNORM,
3797 VK_FORMAT_R8_UINT,
3798 VK_FORMAT_R8_SINT,
3799 VK_FORMAT_R8G8_UNORM,
3800 VK_FORMAT_R8G8_SNORM,
3801 VK_FORMAT_R8G8_UINT,
3802 VK_FORMAT_R8G8_SINT,
3803 VK_FORMAT_R8G8B8A8_UNORM,
3804 VK_FORMAT_R8G8B8A8_SNORM,
3805 VK_FORMAT_R8G8B8A8_UINT,
3806 VK_FORMAT_R8G8B8A8_SINT,
3807 VK_FORMAT_B8G8R8A8_UNORM,
3808 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
3809 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
3810 VK_FORMAT_A8B8G8R8_UINT_PACK32,
3811 VK_FORMAT_A8B8G8R8_SINT_PACK32,
3812 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
3813 VK_FORMAT_R16_UNORM,
3814 VK_FORMAT_R16_SNORM,
3815 VK_FORMAT_R16_UINT,
3816 VK_FORMAT_R16_SINT,
3817 VK_FORMAT_R16_SFLOAT,
3818 VK_FORMAT_R16G16_UNORM,
3819 VK_FORMAT_R16G16_SNORM,
3820 VK_FORMAT_R16G16_UINT,
3821 VK_FORMAT_R16G16_SINT,
3822 VK_FORMAT_R16G16_SFLOAT,
3823 VK_FORMAT_R16G16B16A16_UNORM,
3824 VK_FORMAT_R16G16B16A16_SNORM,
3825 VK_FORMAT_R16G16B16A16_UINT,
3826 VK_FORMAT_R16G16B16A16_SINT,
3827 VK_FORMAT_R16G16B16A16_SFLOAT,
3828 VK_FORMAT_R32_UINT,
3829 VK_FORMAT_R32_SINT,
3830 VK_FORMAT_R32_SFLOAT,
3831 VK_FORMAT_R32G32_UINT,
3832 VK_FORMAT_R32G32_SINT,
3833 VK_FORMAT_R32G32_SFLOAT,
3834 VK_FORMAT_R32G32B32_UINT,
3835 VK_FORMAT_R32G32B32_SINT,
3836 VK_FORMAT_R32G32B32_SFLOAT,
3837 VK_FORMAT_R32G32B32A32_UINT,
3838 VK_FORMAT_R32G32B32A32_SINT,
3839 VK_FORMAT_R32G32B32A32_SFLOAT};
3840 static const VkFormat s_requiredUniformTexelBufferFormats[] = {VK_FORMAT_R8_UNORM,
3841 VK_FORMAT_R8_SNORM,
3842 VK_FORMAT_R8_UINT,
3843 VK_FORMAT_R8_SINT,
3844 VK_FORMAT_R8G8_UNORM,
3845 VK_FORMAT_R8G8_SNORM,
3846 VK_FORMAT_R8G8_UINT,
3847 VK_FORMAT_R8G8_SINT,
3848 VK_FORMAT_R8G8B8A8_UNORM,
3849 VK_FORMAT_R8G8B8A8_SNORM,
3850 VK_FORMAT_R8G8B8A8_UINT,
3851 VK_FORMAT_R8G8B8A8_SINT,
3852 VK_FORMAT_B8G8R8A8_UNORM,
3853 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
3854 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
3855 VK_FORMAT_A8B8G8R8_UINT_PACK32,
3856 VK_FORMAT_A8B8G8R8_SINT_PACK32,
3857 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
3858 VK_FORMAT_A2B10G10R10_UINT_PACK32,
3859 VK_FORMAT_R16_UINT,
3860 VK_FORMAT_R16_SINT,
3861 VK_FORMAT_R16_SFLOAT,
3862 VK_FORMAT_R16G16_UINT,
3863 VK_FORMAT_R16G16_SINT,
3864 VK_FORMAT_R16G16_SFLOAT,
3865 VK_FORMAT_R16G16B16A16_UINT,
3866 VK_FORMAT_R16G16B16A16_SINT,
3867 VK_FORMAT_R16G16B16A16_SFLOAT,
3868 VK_FORMAT_R32_UINT,
3869 VK_FORMAT_R32_SINT,
3870 VK_FORMAT_R32_SFLOAT,
3871 VK_FORMAT_R32G32_UINT,
3872 VK_FORMAT_R32G32_SINT,
3873 VK_FORMAT_R32G32_SFLOAT,
3874 VK_FORMAT_R32G32B32A32_UINT,
3875 VK_FORMAT_R32G32B32A32_SINT,
3876 VK_FORMAT_R32G32B32A32_SFLOAT,
3877 VK_FORMAT_B10G11R11_UFLOAT_PACK32};
3878 static const VkFormat s_requiredStorageTexelBufferFormats[] = {VK_FORMAT_R8G8B8A8_UNORM,
3879 VK_FORMAT_R8G8B8A8_SNORM,
3880 VK_FORMAT_R8G8B8A8_UINT,
3881 VK_FORMAT_R8G8B8A8_SINT,
3882 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
3883 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
3884 VK_FORMAT_A8B8G8R8_UINT_PACK32,
3885 VK_FORMAT_A8B8G8R8_SINT_PACK32,
3886 VK_FORMAT_R16G16B16A16_UINT,
3887 VK_FORMAT_R16G16B16A16_SINT,
3888 VK_FORMAT_R16G16B16A16_SFLOAT,
3889 VK_FORMAT_R32_UINT,
3890 VK_FORMAT_R32_SINT,
3891 VK_FORMAT_R32_SFLOAT,
3892 VK_FORMAT_R32G32_UINT,
3893 VK_FORMAT_R32G32_SINT,
3894 VK_FORMAT_R32G32_SFLOAT,
3895 VK_FORMAT_R32G32B32A32_UINT,
3896 VK_FORMAT_R32G32B32A32_SINT,
3897 VK_FORMAT_R32G32B32A32_SFLOAT};
3898 static const VkFormat s_requiredStorageTexelBufferAtomicFormats[] = {VK_FORMAT_R32_UINT, VK_FORMAT_R32_SINT};
3899
3900 VkFormatFeatureFlags flags = (VkFormatFeatureFlags)0;
3901
3902 if (de::contains(DE_ARRAY_BEGIN(s_requiredVertexBufferFormats), DE_ARRAY_END(s_requiredVertexBufferFormats),
3903 format))
3904 flags |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT;
3905
3906 if (de::contains(DE_ARRAY_BEGIN(s_requiredUniformTexelBufferFormats),
3907 DE_ARRAY_END(s_requiredUniformTexelBufferFormats), format))
3908 flags |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT;
3909
3910 if (de::contains(DE_ARRAY_BEGIN(s_requiredStorageTexelBufferFormats),
3911 DE_ARRAY_END(s_requiredStorageTexelBufferFormats), format))
3912 flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
3913
3914 if (de::contains(DE_ARRAY_BEGIN(s_requiredStorageTexelBufferAtomicFormats),
3915 DE_ARRAY_END(s_requiredStorageTexelBufferAtomicFormats), format))
3916 flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT;
3917
3918 return flags;
3919 }
3920
getPhysicalDeviceSamplerYcbcrConversionFeatures(const InstanceInterface & vk,VkPhysicalDevice physicalDevice)3921 VkPhysicalDeviceSamplerYcbcrConversionFeatures getPhysicalDeviceSamplerYcbcrConversionFeatures(
3922 const InstanceInterface &vk, VkPhysicalDevice physicalDevice)
3923 {
3924 VkPhysicalDeviceFeatures2 coreFeatures;
3925 VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures;
3926
3927 deMemset(&coreFeatures, 0, sizeof(coreFeatures));
3928 deMemset(&ycbcrFeatures, 0, sizeof(ycbcrFeatures));
3929
3930 coreFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
3931 coreFeatures.pNext = &ycbcrFeatures;
3932 ycbcrFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES;
3933
3934 vk.getPhysicalDeviceFeatures2(physicalDevice, &coreFeatures);
3935
3936 return ycbcrFeatures;
3937 }
3938
checkYcbcrApiSupport(Context & context)3939 void checkYcbcrApiSupport(Context &context)
3940 {
3941 // check if YCbcr API and are supported by implementation
3942
3943 // the support for formats and YCbCr may still be optional - see isYcbcrConversionSupported below
3944
3945 if (!vk::isCoreDeviceExtension(context.getUsedApiVersion(), "VK_KHR_sampler_ycbcr_conversion"))
3946 {
3947 if (!context.isDeviceFunctionalitySupported("VK_KHR_sampler_ycbcr_conversion"))
3948 TCU_THROW(NotSupportedError, "VK_KHR_sampler_ycbcr_conversion is not supported");
3949
3950 // Hard dependency for ycbcr
3951 TCU_CHECK(de::contains(context.getInstanceExtensions().begin(), context.getInstanceExtensions().end(),
3952 "VK_KHR_get_physical_device_properties2"));
3953 }
3954 }
3955
isYcbcrConversionSupported(Context & context)3956 bool isYcbcrConversionSupported(Context &context)
3957 {
3958 checkYcbcrApiSupport(context);
3959
3960 const VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures =
3961 getPhysicalDeviceSamplerYcbcrConversionFeatures(context.getInstanceInterface(), context.getPhysicalDevice());
3962
3963 return (ycbcrFeatures.samplerYcbcrConversion == VK_TRUE);
3964 }
3965
getRequiredYcbcrFormatFeatures(Context & context,VkFormat format)3966 VkFormatFeatureFlags getRequiredYcbcrFormatFeatures(Context &context, VkFormat format)
3967 {
3968 bool req = isYcbcrConversionSupported(context) &&
3969 (format == VK_FORMAT_G8_B8R8_2PLANE_420_UNORM || format == VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM);
3970
3971 const VkFormatFeatureFlags required = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
3972 VK_FORMAT_FEATURE_TRANSFER_DST_BIT |
3973 VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT;
3974 return req ? required : (VkFormatFeatureFlags)0;
3975 }
3976
getRequiredOptimalTilingFeatures(Context & context,VkFormat format)3977 VkFormatFeatureFlags getRequiredOptimalTilingFeatures(Context &context, VkFormat format)
3978 {
3979 if (isYCbCrFormat(format))
3980 return getRequiredYcbcrFormatFeatures(context, format);
3981 else
3982 {
3983 VkFormatFeatureFlags ret = getBaseRequiredOptimalTilingFeatures(format);
3984
3985 // \todo [2017-05-16 pyry] This should be extended to cover for example COLOR_ATTACHMENT for depth formats etc.
3986 // \todo [2017-05-18 pyry] Any other color conversion related features that can't be supported by regular formats?
3987 ret |= getRequiredOptimalExtendedTilingFeatures(context, format, ret);
3988
3989 // Compressed formats have optional support for some features
3990 // TODO: Is this really correct? It looks like it should be checking the different compressed features
3991 if (isCompressedFormat(format) && (ret & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT))
3992 ret |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT |
3993 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT;
3994
3995 return ret;
3996 }
3997 }
3998
requiresYCbCrConversion(Context & context,VkFormat format)3999 bool requiresYCbCrConversion(Context &context, VkFormat format)
4000 {
4001 #ifndef CTS_USES_VULKANSC
4002 if (format == VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16)
4003 {
4004 if (!context.isDeviceFunctionalitySupported("VK_EXT_rgba10x6_formats"))
4005 return true;
4006 VkPhysicalDeviceFeatures2 coreFeatures;
4007 VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT rgba10x6features;
4008
4009 deMemset(&coreFeatures, 0, sizeof(coreFeatures));
4010 deMemset(&rgba10x6features, 0, sizeof(rgba10x6features));
4011
4012 coreFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
4013 coreFeatures.pNext = &rgba10x6features;
4014 rgba10x6features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT;
4015
4016 const InstanceInterface &vk = context.getInstanceInterface();
4017 vk.getPhysicalDeviceFeatures2(context.getPhysicalDevice(), &coreFeatures);
4018
4019 return !rgba10x6features.formatRgba10x6WithoutYCbCrSampler;
4020 }
4021 #else
4022 DE_UNREF(context);
4023 #endif // CTS_USES_VULKANSC
4024
4025 return isYCbCrFormat(format) && format != VK_FORMAT_R10X6_UNORM_PACK16 &&
4026 format != VK_FORMAT_R10X6G10X6_UNORM_2PACK16 && format != VK_FORMAT_R12X4_UNORM_PACK16 &&
4027 format != VK_FORMAT_R12X4G12X4_UNORM_2PACK16;
4028 }
4029
getAllowedOptimalTilingFeatures(Context & context,VkFormat format)4030 VkFormatFeatureFlags getAllowedOptimalTilingFeatures(Context &context, VkFormat format)
4031 {
4032
4033 VkFormatFeatureFlags vulkanOnlyFeatureFlags = 0;
4034 #ifndef CTS_USES_VULKANSC
4035 if (context.isDeviceFunctionalitySupported(VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME))
4036 vulkanOnlyFeatureFlags |=
4037 VK_FORMAT_FEATURE_VIDEO_DECODE_DPB_BIT_KHR | VK_FORMAT_FEATURE_VIDEO_DECODE_OUTPUT_BIT_KHR;
4038 if (context.isDeviceFunctionalitySupported(VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME))
4039 vulkanOnlyFeatureFlags |=
4040 VK_FORMAT_FEATURE_VIDEO_ENCODE_INPUT_BIT_KHR | VK_FORMAT_FEATURE_VIDEO_ENCODE_DPB_BIT_KHR;
4041 #endif
4042
4043 // YCbCr formats only support a subset of format feature flags
4044 const VkFormatFeatureFlags ycbcrAllows =
4045 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
4046 VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
4047 VK_FORMAT_FEATURE_TRANSFER_DST_BIT | VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT |
4048 VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT |
4049 VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT |
4050 VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT |
4051 VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT |
4052 VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT |
4053 VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT | VK_FORMAT_FEATURE_DISJOINT_BIT | vulkanOnlyFeatureFlags;
4054
4055 // By default everything is allowed.
4056 VkFormatFeatureFlags allow = (VkFormatFeatureFlags)~0u;
4057 // Formats for which SamplerYCbCrConversion is required may not support certain features.
4058 if (requiresYCbCrConversion(context, format))
4059 allow &= ycbcrAllows;
4060 // single-plane formats *may not* support DISJOINT_BIT
4061 if (!isYCbCrFormat(format) || getPlaneCount(format) == 1)
4062 allow &= ~VK_FORMAT_FEATURE_DISJOINT_BIT;
4063
4064 return allow;
4065 }
4066
getAllowedBufferFeatures(Context & context,VkFormat format)4067 VkFormatFeatureFlags getAllowedBufferFeatures(Context &context, VkFormat format)
4068 {
4069 // TODO: Do we allow non-buffer flags in the bufferFeatures?
4070 return requiresYCbCrConversion(context, format) ? (VkFormatFeatureFlags)0 :
4071 (VkFormatFeatureFlags)(~VK_FORMAT_FEATURE_DISJOINT_BIT);
4072 }
4073
formatProperties(Context & context,VkFormat format)4074 tcu::TestStatus formatProperties(Context &context, VkFormat format)
4075 {
4076 // check if Ycbcr format enums are valid given the version and extensions
4077 if (isYCbCrFormat(format))
4078 checkYcbcrApiSupport(context);
4079
4080 TestLog &log = context.getTestContext().getLog();
4081 const VkFormatProperties properties =
4082 getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
4083 const bool apiVersion10WithoutKhrMaintenance1 =
4084 isApiVersionEqual(context.getUsedApiVersion(), VK_API_VERSION_1_0) &&
4085 !context.isDeviceFunctionalitySupported("VK_KHR_maintenance1");
4086
4087 const VkFormatFeatureFlags reqImg = getRequiredOptimalTilingFeatures(context, format);
4088 const VkFormatFeatureFlags reqBuf = getRequiredBufferFeatures(format);
4089 const VkFormatFeatureFlags allowImg = getAllowedOptimalTilingFeatures(context, format);
4090 const VkFormatFeatureFlags allowBuf = getAllowedBufferFeatures(context, format);
4091 tcu::ResultCollector results(log, "ERROR: ");
4092
4093 const struct feature_req
4094 {
4095 const char *fieldName;
4096 VkFormatFeatureFlags supportedFeatures;
4097 VkFormatFeatureFlags requiredFeatures;
4098 VkFormatFeatureFlags allowedFeatures;
4099 } fields[] = {{"linearTilingFeatures", properties.linearTilingFeatures, (VkFormatFeatureFlags)0, allowImg},
4100 {"optimalTilingFeatures", properties.optimalTilingFeatures, reqImg, allowImg},
4101 {"bufferFeatures", properties.bufferFeatures, reqBuf, allowBuf}};
4102
4103 log << TestLog::Message << properties << TestLog::EndMessage;
4104
4105 if (format == vk::VK_FORMAT_UNDEFINED)
4106 {
4107 VkFormatProperties formatUndefProperties;
4108 deMemset(&formatUndefProperties, 0xcd, sizeof(VkFormatProperties));
4109 formatUndefProperties.bufferFeatures = 0;
4110 formatUndefProperties.linearTilingFeatures = 0;
4111 formatUndefProperties.optimalTilingFeatures = 0;
4112 results.check((deMemCmp(&formatUndefProperties, &properties, sizeof(VkFormatProperties)) == 0),
4113 "vkGetPhysicalDeviceFormatProperties, with VK_FORMAT_UNDEFINED as input format, is returning "
4114 "non-zero properties");
4115 }
4116 else
4117 {
4118 for (int fieldNdx = 0; fieldNdx < DE_LENGTH_OF_ARRAY(fields); fieldNdx++)
4119 {
4120 const char *const fieldName = fields[fieldNdx].fieldName;
4121 VkFormatFeatureFlags supported = fields[fieldNdx].supportedFeatures;
4122 const VkFormatFeatureFlags required = fields[fieldNdx].requiredFeatures;
4123 const VkFormatFeatureFlags allowed = fields[fieldNdx].allowedFeatures;
4124
4125 if (apiVersion10WithoutKhrMaintenance1 && supported)
4126 {
4127 supported |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
4128 }
4129
4130 results.check((supported & required) == required,
4131 de::toString(fieldName) + ": required: " + de::toString(getFormatFeatureFlagsStr(required)) +
4132 " missing: " + de::toString(getFormatFeatureFlagsStr(~supported & required)));
4133
4134 results.check((supported & ~allowed) == 0,
4135 de::toString(fieldName) +
4136 ": has: " + de::toString(getFormatFeatureFlagsStr(supported & ~allowed)));
4137
4138 if (((supported & VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT) !=
4139 0) &&
4140 ((supported &
4141 VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT) == 0))
4142 {
4143 results.addResult(
4144 QP_TEST_RESULT_FAIL,
4145 de::toString(fieldName) +
4146 " supports VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT "
4147 "but not "
4148 "VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_"
4149 "BIT");
4150 }
4151
4152 if (!isYCbCrFormat(format) && !isCompressedFormat(format))
4153 {
4154 const tcu::TextureFormat tcuFormat = mapVkFormat(format);
4155 if (tcu::getNumUsedChannels(tcuFormat.order) != 1 &&
4156 (supported & (VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT |
4157 VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT)) != 0)
4158 {
4159 results.addResult(
4160 QP_TEST_RESULT_QUALITY_WARNING,
4161 "VK_FORMAT_FEATURE_STORAGE_*_ATOMIC_BIT is only defined for single-component images");
4162 }
4163 }
4164 }
4165 }
4166
4167 return tcu::TestStatus(results.getResult(), results.getMessage());
4168 }
4169
optimalTilingFeaturesSupported(Context & context,VkFormat format,VkFormatFeatureFlags features)4170 bool optimalTilingFeaturesSupported(Context &context, VkFormat format, VkFormatFeatureFlags features)
4171 {
4172 const VkFormatProperties properties =
4173 getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
4174 const bool apiVersion10WithoutKhrMaintenance1 =
4175 isApiVersionEqual(context.getUsedApiVersion(), VK_API_VERSION_1_0) &&
4176 !context.isDeviceFunctionalitySupported("VK_KHR_maintenance1");
4177 VkFormatFeatureFlags supported = properties.optimalTilingFeatures;
4178
4179 if (apiVersion10WithoutKhrMaintenance1 && supported)
4180 {
4181 supported |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
4182 }
4183
4184 return (supported & features) == features;
4185 }
4186
optimalTilingFeaturesSupportedForAll(Context & context,const VkFormat * begin,const VkFormat * end,VkFormatFeatureFlags features)4187 bool optimalTilingFeaturesSupportedForAll(Context &context, const VkFormat *begin, const VkFormat *end,
4188 VkFormatFeatureFlags features)
4189 {
4190 for (const VkFormat *cur = begin; cur != end; ++cur)
4191 {
4192 if (!optimalTilingFeaturesSupported(context, *cur, features))
4193 return false;
4194 }
4195
4196 return true;
4197 }
4198
testDepthStencilSupported(Context & context)4199 tcu::TestStatus testDepthStencilSupported(Context &context)
4200 {
4201 if (!optimalTilingFeaturesSupported(context, VK_FORMAT_X8_D24_UNORM_PACK32,
4202 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) &&
4203 !optimalTilingFeaturesSupported(context, VK_FORMAT_D32_SFLOAT, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))
4204 return tcu::TestStatus::fail("Doesn't support one of VK_FORMAT_X8_D24_UNORM_PACK32 or VK_FORMAT_D32_SFLOAT");
4205
4206 if (!optimalTilingFeaturesSupported(context, VK_FORMAT_D24_UNORM_S8_UINT,
4207 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) &&
4208 !optimalTilingFeaturesSupported(context, VK_FORMAT_D32_SFLOAT_S8_UINT,
4209 VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))
4210 return tcu::TestStatus::fail(
4211 "Doesn't support one of VK_FORMAT_D24_UNORM_S8_UINT or VK_FORMAT_D32_SFLOAT_S8_UINT");
4212
4213 return tcu::TestStatus::pass("Required depth/stencil formats supported");
4214 }
4215
testCompressedFormatsSupported(Context & context)4216 tcu::TestStatus testCompressedFormatsSupported(Context &context)
4217 {
4218 static const VkFormat s_allBcFormats[] = {
4219 VK_FORMAT_BC1_RGB_UNORM_BLOCK, VK_FORMAT_BC1_RGB_SRGB_BLOCK, VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
4220 VK_FORMAT_BC1_RGBA_SRGB_BLOCK, VK_FORMAT_BC2_UNORM_BLOCK, VK_FORMAT_BC2_SRGB_BLOCK,
4221 VK_FORMAT_BC3_UNORM_BLOCK, VK_FORMAT_BC3_SRGB_BLOCK, VK_FORMAT_BC4_UNORM_BLOCK,
4222 VK_FORMAT_BC4_SNORM_BLOCK, VK_FORMAT_BC5_UNORM_BLOCK, VK_FORMAT_BC5_SNORM_BLOCK,
4223 VK_FORMAT_BC6H_UFLOAT_BLOCK, VK_FORMAT_BC6H_SFLOAT_BLOCK, VK_FORMAT_BC7_UNORM_BLOCK,
4224 VK_FORMAT_BC7_SRGB_BLOCK,
4225 };
4226 static const VkFormat s_allEtc2Formats[] = {
4227 VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,
4228 VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,
4229 VK_FORMAT_EAC_R11_UNORM_BLOCK, VK_FORMAT_EAC_R11_SNORM_BLOCK, VK_FORMAT_EAC_R11G11_UNORM_BLOCK,
4230 VK_FORMAT_EAC_R11G11_SNORM_BLOCK,
4231 };
4232 static const VkFormat s_allAstcLdrFormats[] = {
4233 VK_FORMAT_ASTC_4x4_UNORM_BLOCK, VK_FORMAT_ASTC_4x4_SRGB_BLOCK, VK_FORMAT_ASTC_5x4_UNORM_BLOCK,
4234 VK_FORMAT_ASTC_5x4_SRGB_BLOCK, VK_FORMAT_ASTC_5x5_UNORM_BLOCK, VK_FORMAT_ASTC_5x5_SRGB_BLOCK,
4235 VK_FORMAT_ASTC_6x5_UNORM_BLOCK, VK_FORMAT_ASTC_6x5_SRGB_BLOCK, VK_FORMAT_ASTC_6x6_UNORM_BLOCK,
4236 VK_FORMAT_ASTC_6x6_SRGB_BLOCK, VK_FORMAT_ASTC_8x5_UNORM_BLOCK, VK_FORMAT_ASTC_8x5_SRGB_BLOCK,
4237 VK_FORMAT_ASTC_8x6_UNORM_BLOCK, VK_FORMAT_ASTC_8x6_SRGB_BLOCK, VK_FORMAT_ASTC_8x8_UNORM_BLOCK,
4238 VK_FORMAT_ASTC_8x8_SRGB_BLOCK, VK_FORMAT_ASTC_10x5_UNORM_BLOCK, VK_FORMAT_ASTC_10x5_SRGB_BLOCK,
4239 VK_FORMAT_ASTC_10x6_UNORM_BLOCK, VK_FORMAT_ASTC_10x6_SRGB_BLOCK, VK_FORMAT_ASTC_10x8_UNORM_BLOCK,
4240 VK_FORMAT_ASTC_10x8_SRGB_BLOCK, VK_FORMAT_ASTC_10x10_UNORM_BLOCK, VK_FORMAT_ASTC_10x10_SRGB_BLOCK,
4241 VK_FORMAT_ASTC_12x10_UNORM_BLOCK, VK_FORMAT_ASTC_12x10_SRGB_BLOCK, VK_FORMAT_ASTC_12x12_UNORM_BLOCK,
4242 VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
4243 };
4244
4245 static const struct
4246 {
4247 const char *setName;
4248 const char *featureName;
4249 const VkBool32 VkPhysicalDeviceFeatures::*feature;
4250 const VkFormat *formatsBegin;
4251 const VkFormat *formatsEnd;
4252 } s_compressedFormatSets[] = {
4253 {"BC", "textureCompressionBC", &VkPhysicalDeviceFeatures::textureCompressionBC, DE_ARRAY_BEGIN(s_allBcFormats),
4254 DE_ARRAY_END(s_allBcFormats)},
4255 {"ETC2", "textureCompressionETC2", &VkPhysicalDeviceFeatures::textureCompressionETC2,
4256 DE_ARRAY_BEGIN(s_allEtc2Formats), DE_ARRAY_END(s_allEtc2Formats)},
4257 {"ASTC LDR", "textureCompressionASTC_LDR", &VkPhysicalDeviceFeatures::textureCompressionASTC_LDR,
4258 DE_ARRAY_BEGIN(s_allAstcLdrFormats), DE_ARRAY_END(s_allAstcLdrFormats)},
4259 };
4260
4261 TestLog &log = context.getTestContext().getLog();
4262 const VkPhysicalDeviceFeatures &features = context.getDeviceFeatures();
4263 int numSupportedSets = 0;
4264 int numErrors = 0;
4265 int numWarnings = 0;
4266
4267 for (int setNdx = 0; setNdx < DE_LENGTH_OF_ARRAY(s_compressedFormatSets); ++setNdx)
4268 {
4269 const char *const setName = s_compressedFormatSets[setNdx].setName;
4270 const char *const featureName = s_compressedFormatSets[setNdx].featureName;
4271 const bool featureBitSet = features.*s_compressedFormatSets[setNdx].feature == VK_TRUE;
4272 const VkFormatFeatureFlags requiredFeatures =
4273 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT |
4274 VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
4275 VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
4276 const bool allSupported =
4277 optimalTilingFeaturesSupportedForAll(context, s_compressedFormatSets[setNdx].formatsBegin,
4278 s_compressedFormatSets[setNdx].formatsEnd, requiredFeatures);
4279
4280 if (featureBitSet && !allSupported)
4281 {
4282 log << TestLog::Message << "ERROR: " << featureName << " = VK_TRUE but " << setName
4283 << " formats not supported" << TestLog::EndMessage;
4284 numErrors += 1;
4285 }
4286 else if (allSupported && !featureBitSet)
4287 {
4288 log << TestLog::Message << "WARNING: " << setName << " formats supported but " << featureName
4289 << " = VK_FALSE" << TestLog::EndMessage;
4290 numWarnings += 1;
4291 }
4292
4293 if (featureBitSet)
4294 {
4295 log << TestLog::Message << "All " << setName << " formats are supported" << TestLog::EndMessage;
4296 numSupportedSets += 1;
4297 }
4298 else
4299 log << TestLog::Message << setName << " formats are not supported" << TestLog::EndMessage;
4300 }
4301
4302 if (numSupportedSets == 0)
4303 {
4304 log << TestLog::Message << "No compressed format sets supported" << TestLog::EndMessage;
4305 numErrors += 1;
4306 }
4307
4308 if (numErrors > 0)
4309 return tcu::TestStatus::fail("Compressed format support not valid");
4310 else if (numWarnings > 0)
4311 return tcu::TestStatus(QP_TEST_RESULT_QUALITY_WARNING, "Found inconsistencies in compressed format support");
4312 else
4313 return tcu::TestStatus::pass("Compressed texture format support is valid");
4314 }
4315
createFormatTests(tcu::TestCaseGroup * testGroup)4316 void createFormatTests(tcu::TestCaseGroup *testGroup)
4317 {
4318 DE_STATIC_ASSERT(VK_FORMAT_UNDEFINED == 0);
4319
4320 static const struct
4321 {
4322 VkFormat begin;
4323 VkFormat end;
4324 } s_formatRanges[] = {
4325 // core formats
4326 {(VkFormat)(VK_FORMAT_UNDEFINED), VK_CORE_FORMAT_LAST},
4327
4328 // YCbCr formats
4329 {VK_FORMAT_G8B8G8R8_422_UNORM, (VkFormat)(VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM + 1)},
4330
4331 // YCbCr extended formats
4332 {VK_FORMAT_G8_B8R8_2PLANE_444_UNORM_EXT, (VkFormat)(VK_FORMAT_G16_B16R16_2PLANE_444_UNORM_EXT + 1)},
4333 };
4334
4335 for (int rangeNdx = 0; rangeNdx < DE_LENGTH_OF_ARRAY(s_formatRanges); ++rangeNdx)
4336 {
4337 const VkFormat rangeBegin = s_formatRanges[rangeNdx].begin;
4338 const VkFormat rangeEnd = s_formatRanges[rangeNdx].end;
4339
4340 for (VkFormat format = rangeBegin; format != rangeEnd; format = (VkFormat)(format + 1))
4341 {
4342 const char *const enumName = getFormatName(format);
4343 const string caseName = de::toLower(string(enumName).substr(10));
4344
4345 addFunctionCase(testGroup, caseName, formatProperties, format);
4346 }
4347 }
4348
4349 addFunctionCase(testGroup, "depth_stencil", testDepthStencilSupported);
4350 addFunctionCase(testGroup, "compressed_formats", testCompressedFormatsSupported);
4351 }
4352
getValidImageUsageFlags(const VkFormatFeatureFlags supportedFeatures,const bool useKhrMaintenance1Semantics)4353 VkImageUsageFlags getValidImageUsageFlags(const VkFormatFeatureFlags supportedFeatures,
4354 const bool useKhrMaintenance1Semantics)
4355 {
4356 VkImageUsageFlags flags = (VkImageUsageFlags)0;
4357
4358 if (useKhrMaintenance1Semantics)
4359 {
4360 if ((supportedFeatures & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT) != 0)
4361 flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
4362
4363 if ((supportedFeatures & VK_FORMAT_FEATURE_TRANSFER_DST_BIT) != 0)
4364 flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
4365 }
4366 else
4367 {
4368 // If format is supported at all, it must be valid transfer src+dst
4369 if (supportedFeatures != 0)
4370 flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
4371 }
4372
4373 if ((supportedFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0)
4374 flags |= VK_IMAGE_USAGE_SAMPLED_BIT;
4375
4376 if ((supportedFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) != 0)
4377 flags |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT |
4378 VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
4379
4380 if ((supportedFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0)
4381 flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
4382
4383 if ((supportedFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) != 0)
4384 flags |= VK_IMAGE_USAGE_STORAGE_BIT;
4385
4386 if ((supportedFeatures &
4387 (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) != 0)
4388 flags |= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
4389
4390 return flags;
4391 }
4392
isValidImageUsageFlagCombination(VkImageUsageFlags usage)4393 bool isValidImageUsageFlagCombination(VkImageUsageFlags usage)
4394 {
4395 if ((usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0)
4396 {
4397 const VkImageUsageFlags allowedFlags =
4398 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
4399 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
4400
4401 // Only *_ATTACHMENT_BIT flags can be combined with TRANSIENT_ATTACHMENT_BIT
4402 if ((usage & ~allowedFlags) != 0)
4403 return false;
4404
4405 // TRANSIENT_ATTACHMENT_BIT is not valid without COLOR_ or DEPTH_STENCIL_ATTACHMENT_BIT
4406 if ((usage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)) == 0)
4407 return false;
4408 }
4409
4410 return usage != 0;
4411 }
4412
getValidImageCreateFlags(const VkPhysicalDeviceFeatures & deviceFeatures,VkFormat format,VkFormatFeatureFlags formatFeatures,VkImageType type,VkImageUsageFlags usage)4413 VkImageCreateFlags getValidImageCreateFlags(const VkPhysicalDeviceFeatures &deviceFeatures, VkFormat format,
4414 VkFormatFeatureFlags formatFeatures, VkImageType type,
4415 VkImageUsageFlags usage)
4416 {
4417 VkImageCreateFlags flags = (VkImageCreateFlags)0;
4418
4419 if ((usage & VK_IMAGE_USAGE_SAMPLED_BIT) != 0)
4420 {
4421 flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
4422
4423 if (type == VK_IMAGE_TYPE_2D && !isYCbCrFormat(format))
4424 {
4425 flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
4426 }
4427 }
4428
4429 if (isYCbCrFormat(format) && getPlaneCount(format) > 1)
4430 {
4431 if (formatFeatures & VK_FORMAT_FEATURE_DISJOINT_BIT)
4432 flags |= VK_IMAGE_CREATE_DISJOINT_BIT;
4433 }
4434
4435 if ((usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT)) != 0 &&
4436 (usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) == 0)
4437 {
4438 if (deviceFeatures.sparseBinding)
4439 flags |= VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT;
4440
4441 if (deviceFeatures.sparseResidencyAliased)
4442 flags |= VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT;
4443 }
4444
4445 return flags;
4446 }
4447
isValidImageCreateFlagCombination(VkImageCreateFlags createFlags)4448 bool isValidImageCreateFlagCombination(VkImageCreateFlags createFlags)
4449 {
4450 bool isValid = true;
4451
4452 if (((createFlags & (VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT)) != 0) &&
4453 ((createFlags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) == 0))
4454 {
4455 isValid = false;
4456 }
4457
4458 return isValid;
4459 }
4460
isRequiredImageParameterCombination(const VkPhysicalDeviceFeatures & deviceFeatures,const VkFormat format,const VkFormatProperties & formatProperties,const VkImageType imageType,const VkImageTiling imageTiling,const VkImageUsageFlags usageFlags,const VkImageCreateFlags createFlags)4461 bool isRequiredImageParameterCombination(const VkPhysicalDeviceFeatures &deviceFeatures, const VkFormat format,
4462 const VkFormatProperties &formatProperties, const VkImageType imageType,
4463 const VkImageTiling imageTiling, const VkImageUsageFlags usageFlags,
4464 const VkImageCreateFlags createFlags)
4465 {
4466 DE_UNREF(deviceFeatures);
4467 DE_UNREF(formatProperties);
4468 DE_UNREF(createFlags);
4469
4470 // Linear images can have arbitrary limitations
4471 if (imageTiling == VK_IMAGE_TILING_LINEAR)
4472 return false;
4473
4474 // Support for other usages for compressed formats is optional
4475 if (isCompressedFormat(format) && (usageFlags & ~(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
4476 VK_IMAGE_USAGE_TRANSFER_DST_BIT)) != 0)
4477 return false;
4478
4479 // Support for 1D, and sliced 3D compressed formats is optional
4480 if (isCompressedFormat(format) && (imageType == VK_IMAGE_TYPE_1D || imageType == VK_IMAGE_TYPE_3D))
4481 return false;
4482
4483 // Support for 1D and 3D depth/stencil textures is optional
4484 if (isDepthStencilFormat(format) && (imageType == VK_IMAGE_TYPE_1D || imageType == VK_IMAGE_TYPE_3D))
4485 return false;
4486
4487 DE_ASSERT(deviceFeatures.sparseBinding ||
4488 (createFlags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)) == 0);
4489 DE_ASSERT(deviceFeatures.sparseResidencyAliased || (createFlags & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) == 0);
4490
4491 if (isYCbCrFormat(format) &&
4492 (createFlags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT |
4493 VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)))
4494 return false;
4495
4496 if (createFlags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)
4497 {
4498 if (isCompressedFormat(format))
4499 return false;
4500
4501 if (isDepthStencilFormat(format))
4502 return false;
4503
4504 if (!deIsPowerOfTwo32(mapVkFormat(format).getPixelSize()))
4505 return false;
4506
4507 switch (imageType)
4508 {
4509 case VK_IMAGE_TYPE_2D:
4510 return (deviceFeatures.sparseResidencyImage2D == VK_TRUE);
4511 case VK_IMAGE_TYPE_3D:
4512 return (deviceFeatures.sparseResidencyImage3D == VK_TRUE);
4513 default:
4514 return false;
4515 }
4516 }
4517
4518 return true;
4519 }
4520
getRequiredOptimalTilingSampleCounts(const VkPhysicalDeviceLimits & deviceLimits,bool hasVulkan12,const VkPhysicalDeviceVulkan12Properties & vulkan12Properties,const VkFormat format,const VkImageUsageFlags usageFlags)4521 VkSampleCountFlags getRequiredOptimalTilingSampleCounts(const VkPhysicalDeviceLimits &deviceLimits, bool hasVulkan12,
4522 const VkPhysicalDeviceVulkan12Properties &vulkan12Properties,
4523 const VkFormat format, const VkImageUsageFlags usageFlags)
4524 {
4525 if (isCompressedFormat(format))
4526 return VK_SAMPLE_COUNT_1_BIT;
4527
4528 bool hasDepthComp = false;
4529 bool hasStencilComp = false;
4530 const bool isYCbCr = isYCbCrFormat(format);
4531 if (!isYCbCr)
4532 {
4533 const tcu::TextureFormat tcuFormat = mapVkFormat(format);
4534 hasDepthComp = (tcuFormat.order == tcu::TextureFormat::D || tcuFormat.order == tcu::TextureFormat::DS);
4535 hasStencilComp = (tcuFormat.order == tcu::TextureFormat::S || tcuFormat.order == tcu::TextureFormat::DS);
4536 }
4537
4538 const bool isColorFormat = !hasDepthComp && !hasStencilComp;
4539 VkSampleCountFlags sampleCounts = ~(VkSampleCountFlags)0;
4540
4541 DE_ASSERT((hasDepthComp || hasStencilComp) != isColorFormat);
4542
4543 if ((usageFlags & VK_IMAGE_USAGE_STORAGE_BIT) != 0)
4544 sampleCounts &= deviceLimits.storageImageSampleCounts;
4545
4546 if ((usageFlags & VK_IMAGE_USAGE_SAMPLED_BIT) != 0)
4547 {
4548 if (hasDepthComp)
4549 sampleCounts &= deviceLimits.sampledImageDepthSampleCounts;
4550
4551 if (hasStencilComp)
4552 sampleCounts &= deviceLimits.sampledImageStencilSampleCounts;
4553
4554 if (isColorFormat)
4555 {
4556 if (isYCbCr)
4557 sampleCounts &= deviceLimits.sampledImageColorSampleCounts;
4558 else
4559 {
4560 const tcu::TextureFormat tcuFormat = mapVkFormat(format);
4561 const tcu::TextureChannelClass chnClass = tcu::getTextureChannelClass(tcuFormat.type);
4562
4563 if (chnClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER ||
4564 chnClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER)
4565 sampleCounts &= deviceLimits.sampledImageIntegerSampleCounts;
4566 else
4567 sampleCounts &= deviceLimits.sampledImageColorSampleCounts;
4568 }
4569 }
4570 }
4571
4572 if ((usageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) != 0)
4573 {
4574 const tcu::TextureFormat tcuFormat = mapVkFormat(format);
4575 const tcu::TextureChannelClass chnClass = tcu::getTextureChannelClass(tcuFormat.type);
4576
4577 if (hasVulkan12 && (chnClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER ||
4578 chnClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER))
4579 sampleCounts &= vulkan12Properties.framebufferIntegerColorSampleCounts;
4580 else
4581 sampleCounts &= deviceLimits.framebufferColorSampleCounts;
4582 }
4583
4584 if ((usageFlags & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0)
4585 {
4586 if (hasDepthComp)
4587 sampleCounts &= deviceLimits.framebufferDepthSampleCounts;
4588
4589 if (hasStencilComp)
4590 sampleCounts &= deviceLimits.framebufferStencilSampleCounts;
4591 }
4592
4593 // If there is no usage flag set that would have corresponding device limit,
4594 // only VK_SAMPLE_COUNT_1_BIT is required.
4595 if (sampleCounts == ~(VkSampleCountFlags)0)
4596 sampleCounts &= VK_SAMPLE_COUNT_1_BIT;
4597
4598 return sampleCounts;
4599 }
4600
4601 struct ImageFormatPropertyCase
4602 {
4603 typedef tcu::TestStatus (*Function)(Context &context, const VkFormat format, const VkImageType imageType,
4604 const VkImageTiling tiling);
4605
4606 Function testFunction;
4607 VkFormat format;
4608 VkImageType imageType;
4609 VkImageTiling tiling;
4610
ImageFormatPropertyCasevkt::api::__anon17ef26850111::ImageFormatPropertyCase4611 ImageFormatPropertyCase(Function testFunction_, VkFormat format_, VkImageType imageType_, VkImageTiling tiling_)
4612 : testFunction(testFunction_)
4613 , format(format_)
4614 , imageType(imageType_)
4615 , tiling(tiling_)
4616 {
4617 }
4618
ImageFormatPropertyCasevkt::api::__anon17ef26850111::ImageFormatPropertyCase4619 ImageFormatPropertyCase(void)
4620 : testFunction(nullptr)
4621 , format(VK_FORMAT_UNDEFINED)
4622 , imageType(VK_CORE_IMAGE_TYPE_LAST)
4623 , tiling(VK_CORE_IMAGE_TILING_LAST)
4624 {
4625 }
4626 };
4627
imageFormatProperties(Context & context,const VkFormat format,const VkImageType imageType,const VkImageTiling tiling)4628 tcu::TestStatus imageFormatProperties(Context &context, const VkFormat format, const VkImageType imageType,
4629 const VkImageTiling tiling)
4630 {
4631 if (isYCbCrFormat(format))
4632 // check if Ycbcr format enums are valid given the version and extensions
4633 checkYcbcrApiSupport(context);
4634
4635 TestLog &log = context.getTestContext().getLog();
4636 const VkPhysicalDeviceFeatures &deviceFeatures = context.getDeviceFeatures();
4637 const VkPhysicalDeviceLimits &deviceLimits = context.getDeviceProperties().limits;
4638 const VkPhysicalDeviceVulkan12Properties &vulkan12Properties = context.getDeviceVulkan12Properties();
4639 const VkFormatProperties formatProperties =
4640 getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
4641 const bool hasKhrMaintenance1 = context.isDeviceFunctionalitySupported("VK_KHR_maintenance1");
4642 const bool hasVulkan12 = context.contextSupports(VK_API_VERSION_1_2);
4643
4644 const VkFormatFeatureFlags supportedFeatures = tiling == VK_IMAGE_TILING_LINEAR ?
4645 formatProperties.linearTilingFeatures :
4646 formatProperties.optimalTilingFeatures;
4647 const VkImageUsageFlags usageFlagSet = getValidImageUsageFlags(supportedFeatures, hasKhrMaintenance1);
4648
4649 tcu::ResultCollector results(log, "ERROR: ");
4650
4651 if (hasKhrMaintenance1 && (supportedFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0)
4652 {
4653 results.check((supportedFeatures & (VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT)) !=
4654 0,
4655 "A sampled image format must have VK_FORMAT_FEATURE_TRANSFER_SRC_BIT and "
4656 "VK_FORMAT_FEATURE_TRANSFER_DST_BIT format feature flags set");
4657 }
4658
4659 if (isYcbcrConversionSupported(context) &&
4660 (format == VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM || format == VK_FORMAT_G8_B8R8_2PLANE_420_UNORM))
4661 {
4662 VkFormatFeatureFlags requiredFeatures = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
4663 if (tiling == VK_IMAGE_TILING_OPTIMAL)
4664 requiredFeatures |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT;
4665
4666 results.check((supportedFeatures & requiredFeatures) == requiredFeatures,
4667 getFormatName(format) + string(" must support ") +
4668 de::toString(getFormatFeatureFlagsStr(requiredFeatures)));
4669 }
4670
4671 for (VkImageUsageFlags curUsageFlags = 0; curUsageFlags <= usageFlagSet; curUsageFlags++)
4672 {
4673 if ((curUsageFlags & ~usageFlagSet) != 0 || !isValidImageUsageFlagCombination(curUsageFlags))
4674 continue;
4675
4676 const VkImageCreateFlags createFlagSet =
4677 getValidImageCreateFlags(deviceFeatures, format, supportedFeatures, imageType, curUsageFlags);
4678
4679 for (VkImageCreateFlags curCreateFlags = 0; curCreateFlags <= createFlagSet; curCreateFlags++)
4680 {
4681 if ((curCreateFlags & ~createFlagSet) != 0 || !isValidImageCreateFlagCombination(curCreateFlags))
4682 continue;
4683
4684 const bool isRequiredCombination = isRequiredImageParameterCombination(
4685 deviceFeatures, format, formatProperties, imageType, tiling, curUsageFlags, curCreateFlags);
4686 VkImageFormatProperties properties;
4687 VkResult queryResult;
4688
4689 log << TestLog::Message << "Testing " << getImageTypeStr(imageType) << ", " << getImageTilingStr(tiling)
4690 << ", " << getImageUsageFlagsStr(curUsageFlags) << ", " << getImageCreateFlagsStr(curCreateFlags)
4691 << TestLog::EndMessage;
4692
4693 // Set return value to known garbage
4694 deMemset(&properties, 0xcd, sizeof(properties));
4695
4696 queryResult = context.getInstanceInterface().getPhysicalDeviceImageFormatProperties(
4697 context.getPhysicalDevice(), format, imageType, tiling, curUsageFlags, curCreateFlags, &properties);
4698
4699 if (queryResult == VK_SUCCESS)
4700 {
4701 const uint32_t fullMipPyramidSize = de::max(de::max(deLog2Floor32(properties.maxExtent.width),
4702 deLog2Floor32(properties.maxExtent.height)),
4703 deLog2Floor32(properties.maxExtent.depth)) +
4704 1;
4705
4706 log << TestLog::Message << properties << "\n" << TestLog::EndMessage;
4707
4708 results.check(imageType != VK_IMAGE_TYPE_1D ||
4709 (properties.maxExtent.width >= 1 && properties.maxExtent.height == 1 &&
4710 properties.maxExtent.depth == 1),
4711 "Invalid dimensions for 1D image");
4712 results.check(imageType != VK_IMAGE_TYPE_2D ||
4713 (properties.maxExtent.width >= 1 && properties.maxExtent.height >= 1 &&
4714 properties.maxExtent.depth == 1),
4715 "Invalid dimensions for 2D image");
4716 results.check(imageType != VK_IMAGE_TYPE_3D ||
4717 (properties.maxExtent.width >= 1 && properties.maxExtent.height >= 1 &&
4718 properties.maxExtent.depth >= 1),
4719 "Invalid dimensions for 3D image");
4720 results.check(imageType != VK_IMAGE_TYPE_3D || properties.maxArrayLayers == 1,
4721 "Invalid maxArrayLayers for 3D image");
4722
4723 if (tiling == VK_IMAGE_TILING_OPTIMAL && imageType == VK_IMAGE_TYPE_2D &&
4724 !(curCreateFlags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) &&
4725 (supportedFeatures &
4726 (VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)))
4727 {
4728 const VkSampleCountFlags requiredSampleCounts = getRequiredOptimalTilingSampleCounts(
4729 deviceLimits, hasVulkan12, vulkan12Properties, format, curUsageFlags);
4730 results.check((properties.sampleCounts & requiredSampleCounts) == requiredSampleCounts,
4731 "Required sample counts not supported");
4732 }
4733 else
4734 results.check(properties.sampleCounts == VK_SAMPLE_COUNT_1_BIT,
4735 "sampleCounts != VK_SAMPLE_COUNT_1_BIT");
4736
4737 if (isRequiredCombination)
4738 {
4739 results.check(imageType != VK_IMAGE_TYPE_1D ||
4740 (properties.maxExtent.width >= deviceLimits.maxImageDimension1D),
4741 "Reported dimensions smaller than device limits");
4742 results.check(imageType != VK_IMAGE_TYPE_2D ||
4743 (properties.maxExtent.width >= deviceLimits.maxImageDimension2D &&
4744 properties.maxExtent.height >= deviceLimits.maxImageDimension2D),
4745 "Reported dimensions smaller than device limits");
4746 results.check(imageType != VK_IMAGE_TYPE_3D ||
4747 (properties.maxExtent.width >= deviceLimits.maxImageDimension3D &&
4748 properties.maxExtent.height >= deviceLimits.maxImageDimension3D &&
4749 properties.maxExtent.depth >= deviceLimits.maxImageDimension3D),
4750 "Reported dimensions smaller than device limits");
4751 results.check((isYCbCrFormat(format) && (properties.maxMipLevels == 1)) ||
4752 properties.maxMipLevels == fullMipPyramidSize,
4753 "Invalid mip pyramid size");
4754 results.check((isYCbCrFormat(format) && (properties.maxArrayLayers == 1)) ||
4755 imageType == VK_IMAGE_TYPE_3D ||
4756 properties.maxArrayLayers >= deviceLimits.maxImageArrayLayers,
4757 "Invalid maxArrayLayers");
4758 }
4759 else
4760 {
4761 results.check(properties.maxMipLevels == 1 || properties.maxMipLevels == fullMipPyramidSize,
4762 "Invalid mip pyramid size");
4763 results.check(properties.maxArrayLayers >= 1, "Invalid maxArrayLayers");
4764 }
4765
4766 results.check(properties.maxResourceSize >= (VkDeviceSize)MINIMUM_REQUIRED_IMAGE_RESOURCE_SIZE,
4767 "maxResourceSize smaller than minimum required size");
4768
4769 if (format == VK_FORMAT_UNDEFINED)
4770 results.fail("VK_SUCCESS returned for VK_FORMAT_UNDEFINED format");
4771 }
4772 else if (queryResult == VK_ERROR_FORMAT_NOT_SUPPORTED)
4773 {
4774 log << TestLog::Message << "Got VK_ERROR_FORMAT_NOT_SUPPORTED" << TestLog::EndMessage;
4775
4776 if (isRequiredCombination)
4777 results.fail("VK_ERROR_FORMAT_NOT_SUPPORTED returned for required image parameter combination");
4778
4779 // Specification requires that all fields are set to 0
4780 results.check(properties.maxExtent.width == 0, "maxExtent.width != 0");
4781 results.check(properties.maxExtent.height == 0, "maxExtent.height != 0");
4782 results.check(properties.maxExtent.depth == 0, "maxExtent.depth != 0");
4783 results.check(properties.maxMipLevels == 0, "maxMipLevels != 0");
4784 results.check(properties.maxArrayLayers == 0, "maxArrayLayers != 0");
4785 results.check(properties.sampleCounts == 0, "sampleCounts != 0");
4786 results.check(properties.maxResourceSize == 0, "maxResourceSize != 0");
4787 }
4788 else
4789 {
4790 if (format == VK_FORMAT_UNDEFINED)
4791 results.fail(de::toString(queryResult) + " returned for VK_FORMAT_UNDEFINED format");
4792
4793 results.fail("Got unexpected error" + de::toString(queryResult));
4794 }
4795 }
4796 }
4797 return tcu::TestStatus(results.getResult(), results.getMessage());
4798 }
4799
4800 struct ImageUsagePropertyCase
4801 {
4802 typedef tcu::TestStatus (*Function)(Context &context, const VkFormat format, const VkImageUsageFlags usage,
4803 const VkImageTiling tiling);
4804
4805 Function testFunction;
4806 VkFormat format;
4807 VkImageUsageFlags usage;
4808 VkImageTiling tiling;
4809
ImageUsagePropertyCasevkt::api::__anon17ef26850111::ImageUsagePropertyCase4810 ImageUsagePropertyCase(Function testFunction_, VkFormat format_, VkImageUsageFlags usage_, VkImageTiling tiling_)
4811 : testFunction(testFunction_)
4812 , format(format_)
4813 , usage(usage_)
4814 , tiling(tiling_)
4815 {
4816 }
4817
ImageUsagePropertyCasevkt::api::__anon17ef26850111::ImageUsagePropertyCase4818 ImageUsagePropertyCase(void)
4819 : testFunction(nullptr)
4820 , format(VK_FORMAT_UNDEFINED)
4821 , usage(0)
4822 , tiling(VK_CORE_IMAGE_TILING_LAST)
4823 {
4824 }
4825 };
4826
unsupportedImageUsage(Context & context,const VkFormat format,const VkImageUsageFlags imageUsage,const VkImageTiling tiling)4827 tcu::TestStatus unsupportedImageUsage(Context &context, const VkFormat format, const VkImageUsageFlags imageUsage,
4828 const VkImageTiling tiling)
4829 {
4830 const InstanceInterface &vki = context.getInstanceInterface();
4831 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
4832 #ifndef CTS_USES_VULKANSC
4833 const VkFormatProperties3 formatProperties = context.getFormatProperties(format);
4834 const VkFormatFeatureFlags2 supportedFeatures = tiling == VK_IMAGE_TILING_LINEAR ?
4835 formatProperties.linearTilingFeatures :
4836 formatProperties.optimalTilingFeatures;
4837 #else
4838 const VkFormatProperties formatProperties =
4839 getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
4840 const VkFormatFeatureFlags supportedFeatures = tiling == VK_IMAGE_TILING_LINEAR ?
4841 formatProperties.linearTilingFeatures :
4842 formatProperties.optimalTilingFeatures;
4843 #endif
4844 TestLog &log = context.getTestContext().getLog();
4845
4846 VkFormatFeatureFlags2 usageRequiredFeatures = 0u;
4847 switch (imageUsage)
4848 {
4849 case VK_IMAGE_USAGE_SAMPLED_BIT:
4850 usageRequiredFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
4851 break;
4852 case VK_IMAGE_USAGE_STORAGE_BIT:
4853 usageRequiredFeatures = VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
4854 break;
4855 case VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT:
4856 #ifndef CTS_USES_VULKANSC
4857 if (tiling == VK_IMAGE_TILING_LINEAR && context.getLinearColorAttachmentFeatures().linearColorAttachment)
4858 {
4859 usageRequiredFeatures = VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV;
4860 }
4861 else
4862 {
4863 usageRequiredFeatures = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT;
4864 }
4865 #else
4866 usageRequiredFeatures = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT;
4867 #endif
4868 break;
4869 case VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT:
4870 usageRequiredFeatures = VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT;
4871 break;
4872 case VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT:
4873 usageRequiredFeatures = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT;
4874 break;
4875 case VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR:
4876 usageRequiredFeatures = VK_FORMAT_FEATURE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR;
4877 break;
4878 default:
4879 DE_ASSERT(0);
4880 }
4881
4882 VkImageFormatProperties imageFormatProperties;
4883 VkResult res = vki.getPhysicalDeviceImageFormatProperties(physicalDevice, format, VK_IMAGE_TYPE_2D, tiling,
4884 imageUsage, 0u, &imageFormatProperties);
4885
4886 if ((supportedFeatures & usageRequiredFeatures) == 0 && res != VK_ERROR_FORMAT_NOT_SUPPORTED)
4887 {
4888 log << TestLog::Message << "Required format features for usage " << imageUsage
4889 << " are not supported. Format features are " << supportedFeatures
4890 << ", but vkGetPhysicalDeviceImageFormatProperties with usage " << imageUsage << " returned " << res
4891 << TestLog::EndMessage;
4892 return tcu::TestStatus::fail("Fail");
4893 }
4894
4895 return tcu::TestStatus::pass("Pass");
4896 }
4897
4898 // VK_KHR_get_physical_device_properties2
4899
toString(const VkPhysicalDevicePCIBusInfoPropertiesEXT & value)4900 string toString(const VkPhysicalDevicePCIBusInfoPropertiesEXT &value)
4901 {
4902 std::ostringstream s;
4903 s << "VkPhysicalDevicePCIBusInfoPropertiesEXT = {\n";
4904 s << "\tsType = " << value.sType << '\n';
4905 s << "\tpciDomain = " << value.pciDomain << '\n';
4906 s << "\tpciBus = " << value.pciBus << '\n';
4907 s << "\tpciDevice = " << value.pciDevice << '\n';
4908 s << "\tpciFunction = " << value.pciFunction << '\n';
4909 s << '}';
4910 return s.str();
4911 }
4912
checkExtension(vector<VkExtensionProperties> & properties,const char * extension)4913 bool checkExtension(vector<VkExtensionProperties> &properties, const char *extension)
4914 {
4915 for (size_t ndx = 0; ndx < properties.size(); ++ndx)
4916 {
4917 if (strncmp(properties[ndx].extensionName, extension, VK_MAX_EXTENSION_NAME_SIZE) == 0)
4918 return true;
4919 }
4920 return false;
4921 }
4922
4923 #include "vkDeviceFeatures2.inl"
4924
deviceFeatures2(Context & context)4925 tcu::TestStatus deviceFeatures2(Context &context)
4926 {
4927 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
4928 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
4929 const InstanceDriver &vki(instance.getDriver());
4930 TestLog &log = context.getTestContext().getLog();
4931 VkPhysicalDeviceFeatures coreFeatures;
4932 VkPhysicalDeviceFeatures2 extFeatures;
4933
4934 deMemset(&coreFeatures, 0xcd, sizeof(coreFeatures));
4935 deMemset(&extFeatures.features, 0xcd, sizeof(extFeatures.features));
4936 std::vector<std::string> instExtensions = context.getInstanceExtensions();
4937
4938 extFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
4939 extFeatures.pNext = nullptr;
4940
4941 vki.getPhysicalDeviceFeatures(physicalDevice, &coreFeatures);
4942 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
4943
4944 TCU_CHECK(extFeatures.sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2);
4945 TCU_CHECK(extFeatures.pNext == nullptr);
4946
4947 if (deMemCmp(&coreFeatures, &extFeatures.features, sizeof(VkPhysicalDeviceFeatures)) != 0)
4948 TCU_FAIL("Mismatch between features reported by vkGetPhysicalDeviceFeatures and vkGetPhysicalDeviceFeatures2");
4949
4950 log << TestLog::Message << extFeatures << TestLog::EndMessage;
4951
4952 return tcu::TestStatus::pass("Querying device features succeeded");
4953 }
4954
deviceProperties2(Context & context)4955 tcu::TestStatus deviceProperties2(Context &context)
4956 {
4957 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
4958 const InstanceDriver &vki(instance.getDriver());
4959 const VkPhysicalDevice physicalDevice(chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
4960 TestLog &log = context.getTestContext().getLog();
4961 VkPhysicalDeviceProperties coreProperties;
4962 VkPhysicalDeviceProperties2 extProperties;
4963
4964 extProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
4965 extProperties.pNext = nullptr;
4966
4967 vki.getPhysicalDeviceProperties(physicalDevice, &coreProperties);
4968 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
4969
4970 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2);
4971 TCU_CHECK(extProperties.pNext == nullptr);
4972
4973 // We can't use memcmp() here because the structs may contain padding bytes that drivers may or may not
4974 // have written while writing the data and memcmp will compare them anyway, so we iterate through the
4975 // valid bytes for each field in the struct and compare only the valid bytes for each one.
4976 for (int propNdx = 0; propNdx < DE_LENGTH_OF_ARRAY(s_physicalDevicePropertiesOffsetTable); propNdx++)
4977 {
4978 const size_t offset = s_physicalDevicePropertiesOffsetTable[propNdx].offset;
4979 const size_t size = s_physicalDevicePropertiesOffsetTable[propNdx].size;
4980
4981 const uint8_t *corePropertyBytes = reinterpret_cast<uint8_t *>(&coreProperties) + offset;
4982 const uint8_t *extPropertyBytes = reinterpret_cast<uint8_t *>(&extProperties.properties) + offset;
4983
4984 if (deMemCmp(corePropertyBytes, extPropertyBytes, size) != 0)
4985 TCU_FAIL("Mismatch between properties reported by vkGetPhysicalDeviceProperties and "
4986 "vkGetPhysicalDeviceProperties2");
4987 }
4988
4989 log << TestLog::Message << extProperties.properties << TestLog::EndMessage;
4990
4991 const int count = 2u;
4992
4993 vector<VkExtensionProperties> properties = enumerateDeviceExtensionProperties(vki, physicalDevice, nullptr);
4994 const bool khr_external_fence_capabilities = checkExtension(properties, "VK_KHR_external_fence_capabilities") ||
4995 context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
4996 const bool khr_external_memory_capabilities = checkExtension(properties, "VK_KHR_external_memory_capabilities") ||
4997 context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
4998 const bool khr_external_semaphore_capabilities =
4999 checkExtension(properties, "VK_KHR_external_semaphore_capabilities") ||
5000 context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
5001 const bool khr_multiview =
5002 checkExtension(properties, "VK_KHR_multiview") || context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
5003 const bool khr_device_protected_memory = context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
5004 const bool khr_device_subgroup = context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
5005 const bool khr_maintenance2 =
5006 checkExtension(properties, "VK_KHR_maintenance2") || context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
5007 const bool khr_maintenance3 =
5008 checkExtension(properties, "VK_KHR_maintenance3") || context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
5009 const bool khr_depth_stencil_resolve = checkExtension(properties, "VK_KHR_depth_stencil_resolve") ||
5010 context.contextSupports(vk::ApiVersion(0, 1, 2, 0));
5011 const bool khr_driver_properties =
5012 checkExtension(properties, "VK_KHR_driver_properties") || context.contextSupports(vk::ApiVersion(0, 1, 2, 0));
5013 const bool khr_shader_float_controls = checkExtension(properties, "VK_KHR_shader_float_controls") ||
5014 context.contextSupports(vk::ApiVersion(0, 1, 2, 0));
5015 const bool khr_descriptor_indexing =
5016 checkExtension(properties, "VK_EXT_descriptor_indexing") || context.contextSupports(vk::ApiVersion(0, 1, 2, 0));
5017 const bool khr_sampler_filter_minmax = checkExtension(properties, "VK_EXT_sampler_filter_minmax") ||
5018 context.contextSupports(vk::ApiVersion(0, 1, 2, 0));
5019 #ifndef CTS_USES_VULKANSC
5020 const bool khr_acceleration_structure = checkExtension(properties, "VK_KHR_acceleration_structure");
5021 const bool khr_integer_dot_product = checkExtension(properties, "VK_KHR_shader_integer_dot_product") ||
5022 context.contextSupports(vk::ApiVersion(0, 1, 3, 0));
5023 const bool khr_inline_uniform_block = checkExtension(properties, "VK_EXT_inline_uniform_block") ||
5024 context.contextSupports(vk::ApiVersion(0, 1, 3, 0));
5025 const bool khr_maintenance4 =
5026 checkExtension(properties, "VK_KHR_maintenance4") || context.contextSupports(vk::ApiVersion(0, 1, 3, 0));
5027 const bool khr_subgroup_size_control = checkExtension(properties, "VK_EXT_subgroup_size_control") ||
5028 context.contextSupports(vk::ApiVersion(0, 1, 3, 0));
5029 const bool khr_texel_buffer_alignment = checkExtension(properties, "VK_EXT_texel_buffer_alignment") ||
5030 context.contextSupports(vk::ApiVersion(0, 1, 3, 0));
5031 #endif // CTS_USES_VULKANSC
5032
5033 VkPhysicalDeviceIDProperties idProperties[count];
5034 VkPhysicalDeviceMultiviewProperties multiviewProperties[count];
5035 VkPhysicalDeviceProtectedMemoryProperties protectedMemoryPropertiesKHR[count];
5036 VkPhysicalDeviceSubgroupProperties subgroupProperties[count];
5037 VkPhysicalDevicePointClippingProperties pointClippingProperties[count];
5038 VkPhysicalDeviceMaintenance3Properties maintenance3Properties[count];
5039 VkPhysicalDeviceDepthStencilResolveProperties depthStencilResolveProperties[count];
5040 VkPhysicalDeviceDriverProperties driverProperties[count];
5041 VkPhysicalDeviceFloatControlsProperties floatControlsProperties[count];
5042 VkPhysicalDeviceDescriptorIndexingProperties descriptorIndexingProperties[count];
5043 VkPhysicalDeviceSamplerFilterMinmaxProperties samplerFilterMinmaxProperties[count];
5044 #ifndef CTS_USES_VULKANSC
5045 VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR integerDotProductProperties[count];
5046 VkPhysicalDeviceAccelerationStructurePropertiesKHR accelerationStructureProperties[count];
5047 VkPhysicalDeviceInlineUniformBlockProperties inlineUniformBlockProperties[count];
5048 VkPhysicalDeviceMaintenance4Properties maintenance4Properties[count];
5049 VkPhysicalDeviceSubgroupSizeControlProperties subgroupSizeControlProperties[count];
5050 VkPhysicalDeviceTexelBufferAlignmentProperties texelBufferAlignmentProperties[count];
5051 #endif // CTS_USES_VULKANSC
5052 for (int ndx = 0; ndx < count; ++ndx)
5053 {
5054 deMemset(&idProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceIDProperties));
5055 deMemset(&multiviewProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceMultiviewProperties));
5056 deMemset(&protectedMemoryPropertiesKHR[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceProtectedMemoryProperties));
5057 deMemset(&subgroupProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceSubgroupProperties));
5058 deMemset(&pointClippingProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDevicePointClippingProperties));
5059 deMemset(&maintenance3Properties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceMaintenance3Properties));
5060 deMemset(&depthStencilResolveProperties[ndx], 0xFF * ndx,
5061 sizeof(VkPhysicalDeviceDepthStencilResolveProperties));
5062 deMemset(&driverProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceDriverProperties));
5063 deMemset(&floatControlsProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceFloatControlsProperties));
5064 deMemset(&descriptorIndexingProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceDescriptorIndexingProperties));
5065 deMemset(&samplerFilterMinmaxProperties[ndx], 0xFF * ndx,
5066 sizeof(VkPhysicalDeviceSamplerFilterMinmaxProperties));
5067 #ifndef CTS_USES_VULKANSC
5068 deMemset(&integerDotProductProperties[ndx], 0xFF * ndx,
5069 sizeof(VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR));
5070 deMemset(&accelerationStructureProperties[ndx], 0xFF * ndx,
5071 sizeof(VkPhysicalDeviceAccelerationStructurePropertiesKHR));
5072 deMemset(&inlineUniformBlockProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceInlineUniformBlockProperties));
5073 deMemset(&maintenance4Properties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceMaintenance4Properties));
5074 deMemset(&subgroupSizeControlProperties[ndx], 0xFF * ndx,
5075 sizeof(VkPhysicalDeviceSubgroupSizeControlProperties));
5076 deMemset(&texelBufferAlignmentProperties[ndx], 0xFF * ndx,
5077 sizeof(VkPhysicalDeviceTexelBufferAlignmentProperties));
5078 #endif // CTS_USES_VULKANSC
5079
5080 void *prev = 0;
5081
5082 if (khr_external_fence_capabilities || khr_external_memory_capabilities || khr_external_semaphore_capabilities)
5083 {
5084 idProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES;
5085 idProperties[ndx].pNext = prev;
5086 prev = &idProperties[ndx];
5087 }
5088
5089 if (khr_multiview)
5090 {
5091 multiviewProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES;
5092 multiviewProperties[ndx].pNext = prev;
5093 prev = &multiviewProperties[ndx];
5094 }
5095
5096 if (khr_device_protected_memory)
5097 {
5098 protectedMemoryPropertiesKHR[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES;
5099 protectedMemoryPropertiesKHR[ndx].pNext = prev;
5100 prev = &protectedMemoryPropertiesKHR[ndx];
5101 }
5102
5103 if (khr_device_subgroup)
5104 {
5105 subgroupProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES;
5106 subgroupProperties[ndx].pNext = prev;
5107 prev = &subgroupProperties[ndx];
5108 }
5109
5110 if (khr_maintenance2)
5111 {
5112 pointClippingProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES;
5113 pointClippingProperties[ndx].pNext = prev;
5114 prev = &pointClippingProperties[ndx];
5115 }
5116
5117 if (khr_maintenance3)
5118 {
5119 maintenance3Properties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES;
5120 maintenance3Properties[ndx].pNext = prev;
5121 prev = &maintenance3Properties[ndx];
5122 }
5123
5124 if (khr_depth_stencil_resolve)
5125 {
5126 depthStencilResolveProperties[ndx].sType =
5127 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES;
5128 depthStencilResolveProperties[ndx].pNext = prev;
5129 prev = &depthStencilResolveProperties[ndx];
5130 }
5131
5132 if (khr_driver_properties)
5133 {
5134 driverProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES;
5135 driverProperties[ndx].pNext = prev;
5136 prev = &driverProperties[ndx];
5137 }
5138
5139 if (khr_shader_float_controls)
5140 {
5141 floatControlsProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES;
5142 floatControlsProperties[ndx].pNext = prev;
5143 prev = &floatControlsProperties[ndx];
5144 }
5145
5146 if (khr_descriptor_indexing)
5147 {
5148 descriptorIndexingProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES;
5149 descriptorIndexingProperties[ndx].pNext = prev;
5150 prev = &descriptorIndexingProperties[ndx];
5151 }
5152
5153 if (khr_sampler_filter_minmax)
5154 {
5155 samplerFilterMinmaxProperties[ndx].sType =
5156 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES;
5157 samplerFilterMinmaxProperties[ndx].pNext = prev;
5158 prev = &samplerFilterMinmaxProperties[ndx];
5159 }
5160
5161 #ifndef CTS_USES_VULKANSC
5162 if (khr_integer_dot_product)
5163 {
5164 integerDotProductProperties[ndx].sType =
5165 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES_KHR;
5166 integerDotProductProperties[ndx].pNext = prev;
5167 prev = &integerDotProductProperties[ndx];
5168 }
5169
5170 if (khr_acceleration_structure)
5171 {
5172 accelerationStructureProperties[ndx].sType =
5173 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR;
5174 accelerationStructureProperties[ndx].pNext = prev;
5175 prev = &accelerationStructureProperties[ndx];
5176 }
5177
5178 if (khr_inline_uniform_block)
5179 {
5180 inlineUniformBlockProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES;
5181 inlineUniformBlockProperties[ndx].pNext = prev;
5182 prev = &inlineUniformBlockProperties[ndx];
5183 }
5184
5185 if (khr_maintenance4)
5186 {
5187 maintenance4Properties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES;
5188 maintenance4Properties[ndx].pNext = prev;
5189 prev = &maintenance4Properties[ndx];
5190 }
5191
5192 if (khr_subgroup_size_control)
5193 {
5194 subgroupSizeControlProperties[ndx].sType =
5195 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES;
5196 subgroupSizeControlProperties[ndx].pNext = prev;
5197 prev = &subgroupSizeControlProperties[ndx];
5198 }
5199
5200 if (khr_texel_buffer_alignment)
5201 {
5202 texelBufferAlignmentProperties[ndx].sType =
5203 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES;
5204 texelBufferAlignmentProperties[ndx].pNext = prev;
5205 prev = &texelBufferAlignmentProperties[ndx];
5206 }
5207 #endif // CTS_USES_VULKANSC
5208
5209 if (prev == 0)
5210 TCU_THROW(NotSupportedError, "No supported structures found");
5211
5212 extProperties.pNext = prev;
5213
5214 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5215 }
5216
5217 if (khr_external_fence_capabilities || khr_external_memory_capabilities || khr_external_semaphore_capabilities)
5218 log << TestLog::Message << idProperties[0] << TestLog::EndMessage;
5219 if (khr_multiview)
5220 log << TestLog::Message << multiviewProperties[0] << TestLog::EndMessage;
5221 if (khr_device_protected_memory)
5222 log << TestLog::Message << protectedMemoryPropertiesKHR[0] << TestLog::EndMessage;
5223 if (khr_device_subgroup)
5224 log << TestLog::Message << subgroupProperties[0] << TestLog::EndMessage;
5225 if (khr_maintenance2)
5226 log << TestLog::Message << pointClippingProperties[0] << TestLog::EndMessage;
5227 if (khr_maintenance3)
5228 log << TestLog::Message << maintenance3Properties[0] << TestLog::EndMessage;
5229 if (khr_depth_stencil_resolve)
5230 log << TestLog::Message << depthStencilResolveProperties[0] << TestLog::EndMessage;
5231 if (khr_driver_properties)
5232 log << TestLog::Message << driverProperties[0] << TestLog::EndMessage;
5233 if (khr_shader_float_controls)
5234 log << TestLog::Message << floatControlsProperties[0] << TestLog::EndMessage;
5235 if (khr_descriptor_indexing)
5236 log << TestLog::Message << descriptorIndexingProperties[0] << TestLog::EndMessage;
5237 if (khr_sampler_filter_minmax)
5238 log << TestLog::Message << samplerFilterMinmaxProperties[0] << TestLog::EndMessage;
5239 #ifndef CTS_USES_VULKANSC
5240 if (khr_integer_dot_product)
5241 log << TestLog::Message << integerDotProductProperties[0] << TestLog::EndMessage;
5242 if (khr_acceleration_structure)
5243 log << TestLog::Message << accelerationStructureProperties[0] << TestLog::EndMessage;
5244 if (khr_inline_uniform_block)
5245 log << TestLog::Message << inlineUniformBlockProperties[0] << TestLog::EndMessage;
5246 if (khr_maintenance4)
5247 log << TestLog::Message << maintenance4Properties[0] << TestLog::EndMessage;
5248 if (khr_subgroup_size_control)
5249 log << TestLog::Message << subgroupSizeControlProperties[0] << TestLog::EndMessage;
5250 if (khr_texel_buffer_alignment)
5251 log << TestLog::Message << texelBufferAlignmentProperties[0] << TestLog::EndMessage;
5252 #endif // CTS_USES_VULKANSC
5253
5254 if (khr_external_fence_capabilities || khr_external_memory_capabilities || khr_external_semaphore_capabilities)
5255 {
5256 if ((deMemCmp(idProperties[0].deviceUUID, idProperties[1].deviceUUID, VK_UUID_SIZE) != 0) ||
5257 (deMemCmp(idProperties[0].driverUUID, idProperties[1].driverUUID, VK_UUID_SIZE) != 0) ||
5258 (idProperties[0].deviceLUIDValid != idProperties[1].deviceLUIDValid))
5259 {
5260 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties");
5261 }
5262 else if (idProperties[0].deviceLUIDValid)
5263 {
5264 // If deviceLUIDValid is VK_FALSE, the contents of deviceLUID and deviceNodeMask are undefined
5265 // so thay can only be compared when deviceLUIDValid is VK_TRUE.
5266 if ((deMemCmp(idProperties[0].deviceLUID, idProperties[1].deviceLUID, VK_LUID_SIZE) != 0) ||
5267 (idProperties[0].deviceNodeMask != idProperties[1].deviceNodeMask))
5268 {
5269 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties");
5270 }
5271 }
5272 }
5273 if (khr_multiview &&
5274 (multiviewProperties[0].maxMultiviewViewCount != multiviewProperties[1].maxMultiviewViewCount ||
5275 multiviewProperties[0].maxMultiviewInstanceIndex != multiviewProperties[1].maxMultiviewInstanceIndex))
5276 {
5277 TCU_FAIL("Mismatch between VkPhysicalDeviceMultiviewProperties");
5278 }
5279 if (khr_device_protected_memory &&
5280 (protectedMemoryPropertiesKHR[0].protectedNoFault != protectedMemoryPropertiesKHR[1].protectedNoFault))
5281 {
5282 TCU_FAIL("Mismatch between VkPhysicalDeviceProtectedMemoryProperties");
5283 }
5284 if (khr_device_subgroup &&
5285 (subgroupProperties[0].subgroupSize != subgroupProperties[1].subgroupSize ||
5286 subgroupProperties[0].supportedStages != subgroupProperties[1].supportedStages ||
5287 subgroupProperties[0].supportedOperations != subgroupProperties[1].supportedOperations ||
5288 subgroupProperties[0].quadOperationsInAllStages != subgroupProperties[1].quadOperationsInAllStages))
5289 {
5290 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupProperties");
5291 }
5292 if (khr_maintenance2 &&
5293 (pointClippingProperties[0].pointClippingBehavior != pointClippingProperties[1].pointClippingBehavior))
5294 {
5295 TCU_FAIL("Mismatch between VkPhysicalDevicePointClippingProperties");
5296 }
5297 if (khr_maintenance3 &&
5298 (maintenance3Properties[0].maxPerSetDescriptors != maintenance3Properties[1].maxPerSetDescriptors ||
5299 maintenance3Properties[0].maxMemoryAllocationSize != maintenance3Properties[1].maxMemoryAllocationSize))
5300 {
5301 if (protectedMemoryPropertiesKHR[0].protectedNoFault != protectedMemoryPropertiesKHR[1].protectedNoFault)
5302 {
5303 TCU_FAIL("Mismatch between VkPhysicalDeviceProtectedMemoryProperties");
5304 }
5305 if ((subgroupProperties[0].subgroupSize != subgroupProperties[1].subgroupSize) ||
5306 (subgroupProperties[0].supportedStages != subgroupProperties[1].supportedStages) ||
5307 (subgroupProperties[0].supportedOperations != subgroupProperties[1].supportedOperations) ||
5308 (subgroupProperties[0].quadOperationsInAllStages != subgroupProperties[1].quadOperationsInAllStages))
5309 {
5310 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupProperties");
5311 }
5312 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance3Properties");
5313 }
5314 if (khr_depth_stencil_resolve &&
5315 (depthStencilResolveProperties[0].supportedDepthResolveModes !=
5316 depthStencilResolveProperties[1].supportedDepthResolveModes ||
5317 depthStencilResolveProperties[0].supportedStencilResolveModes !=
5318 depthStencilResolveProperties[1].supportedStencilResolveModes ||
5319 depthStencilResolveProperties[0].independentResolveNone !=
5320 depthStencilResolveProperties[1].independentResolveNone ||
5321 depthStencilResolveProperties[0].independentResolve != depthStencilResolveProperties[1].independentResolve))
5322 {
5323 TCU_FAIL("Mismatch between VkPhysicalDeviceDepthStencilResolveProperties");
5324 }
5325 if (khr_driver_properties &&
5326 (driverProperties[0].driverID != driverProperties[1].driverID ||
5327 strncmp(driverProperties[0].driverName, driverProperties[1].driverName, VK_MAX_DRIVER_NAME_SIZE) != 0 ||
5328 strncmp(driverProperties[0].driverInfo, driverProperties[1].driverInfo, VK_MAX_DRIVER_INFO_SIZE) != 0 ||
5329 driverProperties[0].conformanceVersion.major != driverProperties[1].conformanceVersion.major ||
5330 driverProperties[0].conformanceVersion.minor != driverProperties[1].conformanceVersion.minor ||
5331 driverProperties[0].conformanceVersion.subminor != driverProperties[1].conformanceVersion.subminor ||
5332 driverProperties[0].conformanceVersion.patch != driverProperties[1].conformanceVersion.patch))
5333 {
5334 TCU_FAIL("Mismatch between VkPhysicalDeviceDriverProperties");
5335 }
5336 if (khr_shader_float_controls &&
5337 (floatControlsProperties[0].denormBehaviorIndependence !=
5338 floatControlsProperties[1].denormBehaviorIndependence ||
5339 floatControlsProperties[0].roundingModeIndependence != floatControlsProperties[1].roundingModeIndependence ||
5340 floatControlsProperties[0].shaderSignedZeroInfNanPreserveFloat16 !=
5341 floatControlsProperties[1].shaderSignedZeroInfNanPreserveFloat16 ||
5342 floatControlsProperties[0].shaderSignedZeroInfNanPreserveFloat32 !=
5343 floatControlsProperties[1].shaderSignedZeroInfNanPreserveFloat32 ||
5344 floatControlsProperties[0].shaderSignedZeroInfNanPreserveFloat64 !=
5345 floatControlsProperties[1].shaderSignedZeroInfNanPreserveFloat64 ||
5346 floatControlsProperties[0].shaderDenormPreserveFloat16 !=
5347 floatControlsProperties[1].shaderDenormPreserveFloat16 ||
5348 floatControlsProperties[0].shaderDenormPreserveFloat32 !=
5349 floatControlsProperties[1].shaderDenormPreserveFloat32 ||
5350 floatControlsProperties[0].shaderDenormPreserveFloat64 !=
5351 floatControlsProperties[1].shaderDenormPreserveFloat64 ||
5352 floatControlsProperties[0].shaderDenormFlushToZeroFloat16 !=
5353 floatControlsProperties[1].shaderDenormFlushToZeroFloat16 ||
5354 floatControlsProperties[0].shaderDenormFlushToZeroFloat32 !=
5355 floatControlsProperties[1].shaderDenormFlushToZeroFloat32 ||
5356 floatControlsProperties[0].shaderDenormFlushToZeroFloat64 !=
5357 floatControlsProperties[1].shaderDenormFlushToZeroFloat64 ||
5358 floatControlsProperties[0].shaderRoundingModeRTEFloat16 !=
5359 floatControlsProperties[1].shaderRoundingModeRTEFloat16 ||
5360 floatControlsProperties[0].shaderRoundingModeRTEFloat32 !=
5361 floatControlsProperties[1].shaderRoundingModeRTEFloat32 ||
5362 floatControlsProperties[0].shaderRoundingModeRTEFloat64 !=
5363 floatControlsProperties[1].shaderRoundingModeRTEFloat64 ||
5364 floatControlsProperties[0].shaderRoundingModeRTZFloat16 !=
5365 floatControlsProperties[1].shaderRoundingModeRTZFloat16 ||
5366 floatControlsProperties[0].shaderRoundingModeRTZFloat32 !=
5367 floatControlsProperties[1].shaderRoundingModeRTZFloat32 ||
5368 floatControlsProperties[0].shaderRoundingModeRTZFloat64 !=
5369 floatControlsProperties[1].shaderRoundingModeRTZFloat64))
5370 {
5371 TCU_FAIL("Mismatch between VkPhysicalDeviceFloatControlsProperties");
5372 }
5373 if (khr_descriptor_indexing &&
5374 (descriptorIndexingProperties[0].maxUpdateAfterBindDescriptorsInAllPools !=
5375 descriptorIndexingProperties[1].maxUpdateAfterBindDescriptorsInAllPools ||
5376 descriptorIndexingProperties[0].shaderUniformBufferArrayNonUniformIndexingNative !=
5377 descriptorIndexingProperties[1].shaderUniformBufferArrayNonUniformIndexingNative ||
5378 descriptorIndexingProperties[0].shaderSampledImageArrayNonUniformIndexingNative !=
5379 descriptorIndexingProperties[1].shaderSampledImageArrayNonUniformIndexingNative ||
5380 descriptorIndexingProperties[0].shaderStorageBufferArrayNonUniformIndexingNative !=
5381 descriptorIndexingProperties[1].shaderStorageBufferArrayNonUniformIndexingNative ||
5382 descriptorIndexingProperties[0].shaderStorageImageArrayNonUniformIndexingNative !=
5383 descriptorIndexingProperties[1].shaderStorageImageArrayNonUniformIndexingNative ||
5384 descriptorIndexingProperties[0].shaderInputAttachmentArrayNonUniformIndexingNative !=
5385 descriptorIndexingProperties[1].shaderInputAttachmentArrayNonUniformIndexingNative ||
5386 descriptorIndexingProperties[0].robustBufferAccessUpdateAfterBind !=
5387 descriptorIndexingProperties[1].robustBufferAccessUpdateAfterBind ||
5388 descriptorIndexingProperties[0].quadDivergentImplicitLod !=
5389 descriptorIndexingProperties[1].quadDivergentImplicitLod ||
5390 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindSamplers !=
5391 descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindSamplers ||
5392 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindUniformBuffers !=
5393 descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindUniformBuffers ||
5394 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindStorageBuffers !=
5395 descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindStorageBuffers ||
5396 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindSampledImages !=
5397 descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindSampledImages ||
5398 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindStorageImages !=
5399 descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindStorageImages ||
5400 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindInputAttachments !=
5401 descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindInputAttachments ||
5402 descriptorIndexingProperties[0].maxPerStageUpdateAfterBindResources !=
5403 descriptorIndexingProperties[1].maxPerStageUpdateAfterBindResources ||
5404 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindSamplers !=
5405 descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindSamplers ||
5406 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindUniformBuffers !=
5407 descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindUniformBuffers ||
5408 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindUniformBuffersDynamic !=
5409 descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindUniformBuffersDynamic ||
5410 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindStorageBuffers !=
5411 descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindStorageBuffers ||
5412 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindStorageBuffersDynamic !=
5413 descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindStorageBuffersDynamic ||
5414 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindSampledImages !=
5415 descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindSampledImages ||
5416 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindStorageImages !=
5417 descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindStorageImages ||
5418 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindInputAttachments !=
5419 descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindInputAttachments))
5420 {
5421 TCU_FAIL("Mismatch between VkPhysicalDeviceDescriptorIndexingProperties");
5422 }
5423 if (khr_sampler_filter_minmax && (samplerFilterMinmaxProperties[0].filterMinmaxSingleComponentFormats !=
5424 samplerFilterMinmaxProperties[1].filterMinmaxSingleComponentFormats ||
5425 samplerFilterMinmaxProperties[0].filterMinmaxImageComponentMapping !=
5426 samplerFilterMinmaxProperties[1].filterMinmaxImageComponentMapping))
5427 {
5428 TCU_FAIL("Mismatch between VkPhysicalDeviceSamplerFilterMinmaxProperties");
5429 }
5430
5431 #ifndef CTS_USES_VULKANSC
5432
5433 if (khr_integer_dot_product &&
5434 (integerDotProductProperties[0].integerDotProduct8BitUnsignedAccelerated !=
5435 integerDotProductProperties[1].integerDotProduct8BitUnsignedAccelerated ||
5436 integerDotProductProperties[0].integerDotProduct8BitSignedAccelerated !=
5437 integerDotProductProperties[1].integerDotProduct8BitSignedAccelerated ||
5438 integerDotProductProperties[0].integerDotProduct8BitMixedSignednessAccelerated !=
5439 integerDotProductProperties[1].integerDotProduct8BitMixedSignednessAccelerated ||
5440 integerDotProductProperties[0].integerDotProduct4x8BitPackedUnsignedAccelerated !=
5441 integerDotProductProperties[1].integerDotProduct4x8BitPackedUnsignedAccelerated ||
5442 integerDotProductProperties[0].integerDotProduct4x8BitPackedSignedAccelerated !=
5443 integerDotProductProperties[1].integerDotProduct4x8BitPackedSignedAccelerated ||
5444 integerDotProductProperties[0].integerDotProduct4x8BitPackedMixedSignednessAccelerated !=
5445 integerDotProductProperties[1].integerDotProduct4x8BitPackedMixedSignednessAccelerated ||
5446 integerDotProductProperties[0].integerDotProduct16BitUnsignedAccelerated !=
5447 integerDotProductProperties[1].integerDotProduct16BitUnsignedAccelerated ||
5448 integerDotProductProperties[0].integerDotProduct16BitSignedAccelerated !=
5449 integerDotProductProperties[1].integerDotProduct16BitSignedAccelerated ||
5450 integerDotProductProperties[0].integerDotProduct16BitMixedSignednessAccelerated !=
5451 integerDotProductProperties[1].integerDotProduct16BitMixedSignednessAccelerated ||
5452 integerDotProductProperties[0].integerDotProduct32BitUnsignedAccelerated !=
5453 integerDotProductProperties[1].integerDotProduct32BitUnsignedAccelerated ||
5454 integerDotProductProperties[0].integerDotProduct32BitSignedAccelerated !=
5455 integerDotProductProperties[1].integerDotProduct32BitSignedAccelerated ||
5456 integerDotProductProperties[0].integerDotProduct32BitMixedSignednessAccelerated !=
5457 integerDotProductProperties[1].integerDotProduct32BitMixedSignednessAccelerated ||
5458 integerDotProductProperties[0].integerDotProduct64BitUnsignedAccelerated !=
5459 integerDotProductProperties[1].integerDotProduct64BitUnsignedAccelerated ||
5460 integerDotProductProperties[0].integerDotProduct64BitSignedAccelerated !=
5461 integerDotProductProperties[1].integerDotProduct64BitSignedAccelerated ||
5462 integerDotProductProperties[0].integerDotProduct64BitMixedSignednessAccelerated !=
5463 integerDotProductProperties[1].integerDotProduct64BitMixedSignednessAccelerated ||
5464 integerDotProductProperties[0].integerDotProductAccumulatingSaturating8BitUnsignedAccelerated !=
5465 integerDotProductProperties[1].integerDotProductAccumulatingSaturating8BitUnsignedAccelerated ||
5466 integerDotProductProperties[0].integerDotProductAccumulatingSaturating8BitSignedAccelerated !=
5467 integerDotProductProperties[1].integerDotProductAccumulatingSaturating8BitSignedAccelerated ||
5468 integerDotProductProperties[0].integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated !=
5469 integerDotProductProperties[1].integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated ||
5470 integerDotProductProperties[0].integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated !=
5471 integerDotProductProperties[1].integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated ||
5472 integerDotProductProperties[0].integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated !=
5473 integerDotProductProperties[1].integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated ||
5474 integerDotProductProperties[0].integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated !=
5475 integerDotProductProperties[1]
5476 .integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated ||
5477 integerDotProductProperties[0].integerDotProductAccumulatingSaturating16BitUnsignedAccelerated !=
5478 integerDotProductProperties[1].integerDotProductAccumulatingSaturating16BitUnsignedAccelerated ||
5479 integerDotProductProperties[0].integerDotProductAccumulatingSaturating16BitSignedAccelerated !=
5480 integerDotProductProperties[1].integerDotProductAccumulatingSaturating16BitSignedAccelerated ||
5481 integerDotProductProperties[0].integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated !=
5482 integerDotProductProperties[1].integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated ||
5483 integerDotProductProperties[0].integerDotProductAccumulatingSaturating32BitUnsignedAccelerated !=
5484 integerDotProductProperties[1].integerDotProductAccumulatingSaturating32BitUnsignedAccelerated ||
5485 integerDotProductProperties[0].integerDotProductAccumulatingSaturating32BitSignedAccelerated !=
5486 integerDotProductProperties[1].integerDotProductAccumulatingSaturating32BitSignedAccelerated ||
5487 integerDotProductProperties[0].integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated !=
5488 integerDotProductProperties[1].integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated ||
5489 integerDotProductProperties[0].integerDotProductAccumulatingSaturating64BitUnsignedAccelerated !=
5490 integerDotProductProperties[1].integerDotProductAccumulatingSaturating64BitUnsignedAccelerated ||
5491 integerDotProductProperties[0].integerDotProductAccumulatingSaturating64BitSignedAccelerated !=
5492 integerDotProductProperties[1].integerDotProductAccumulatingSaturating64BitSignedAccelerated ||
5493 integerDotProductProperties[0].integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated !=
5494 integerDotProductProperties[1].integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated))
5495 {
5496 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR");
5497 }
5498
5499 if (khr_texel_buffer_alignment)
5500 {
5501 if (texelBufferAlignmentProperties[0].storageTexelBufferOffsetAlignmentBytes !=
5502 texelBufferAlignmentProperties[1].storageTexelBufferOffsetAlignmentBytes ||
5503 texelBufferAlignmentProperties[0].storageTexelBufferOffsetSingleTexelAlignment !=
5504 texelBufferAlignmentProperties[1].storageTexelBufferOffsetSingleTexelAlignment ||
5505 texelBufferAlignmentProperties[0].uniformTexelBufferOffsetAlignmentBytes !=
5506 texelBufferAlignmentProperties[1].uniformTexelBufferOffsetAlignmentBytes ||
5507 texelBufferAlignmentProperties[0].uniformTexelBufferOffsetSingleTexelAlignment !=
5508 texelBufferAlignmentProperties[1].uniformTexelBufferOffsetSingleTexelAlignment)
5509 {
5510 TCU_FAIL("Mismatch between VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT");
5511 }
5512
5513 if (texelBufferAlignmentProperties[0].storageTexelBufferOffsetAlignmentBytes == 0 ||
5514 !deIntIsPow2((int)texelBufferAlignmentProperties[0].storageTexelBufferOffsetAlignmentBytes))
5515 {
5516 TCU_FAIL("limit Validation failed storageTexelBufferOffsetAlignmentBytes is not a power of two.");
5517 }
5518
5519 if (texelBufferAlignmentProperties[0].uniformTexelBufferOffsetAlignmentBytes == 0 ||
5520 !deIntIsPow2((int)texelBufferAlignmentProperties[0].uniformTexelBufferOffsetAlignmentBytes))
5521 {
5522 TCU_FAIL("limit Validation failed uniformTexelBufferOffsetAlignmentBytes is not a power of two.");
5523 }
5524 }
5525
5526 if (khr_inline_uniform_block &&
5527 (inlineUniformBlockProperties[0].maxInlineUniformBlockSize !=
5528 inlineUniformBlockProperties[1].maxInlineUniformBlockSize ||
5529 inlineUniformBlockProperties[0].maxPerStageDescriptorInlineUniformBlocks !=
5530 inlineUniformBlockProperties[1].maxPerStageDescriptorInlineUniformBlocks ||
5531 inlineUniformBlockProperties[0].maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks !=
5532 inlineUniformBlockProperties[1].maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks ||
5533 inlineUniformBlockProperties[0].maxDescriptorSetInlineUniformBlocks !=
5534 inlineUniformBlockProperties[1].maxDescriptorSetInlineUniformBlocks ||
5535 inlineUniformBlockProperties[0].maxDescriptorSetUpdateAfterBindInlineUniformBlocks !=
5536 inlineUniformBlockProperties[1].maxDescriptorSetUpdateAfterBindInlineUniformBlocks))
5537 {
5538 TCU_FAIL("Mismatch between VkPhysicalDeviceInlineUniformBlockProperties");
5539 }
5540 if (khr_maintenance4 && (maintenance4Properties[0].maxBufferSize != maintenance4Properties[1].maxBufferSize))
5541 {
5542 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance4Properties");
5543 }
5544 if (khr_subgroup_size_control &&
5545 (subgroupSizeControlProperties[0].minSubgroupSize != subgroupSizeControlProperties[1].minSubgroupSize ||
5546 subgroupSizeControlProperties[0].maxSubgroupSize != subgroupSizeControlProperties[1].maxSubgroupSize ||
5547 subgroupSizeControlProperties[0].maxComputeWorkgroupSubgroups !=
5548 subgroupSizeControlProperties[1].maxComputeWorkgroupSubgroups ||
5549 subgroupSizeControlProperties[0].requiredSubgroupSizeStages !=
5550 subgroupSizeControlProperties[1].requiredSubgroupSizeStages))
5551 {
5552 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupSizeControlProperties");
5553 }
5554
5555 if (khr_acceleration_structure)
5556 {
5557 if (accelerationStructureProperties[0].maxGeometryCount !=
5558 accelerationStructureProperties[1].maxGeometryCount ||
5559 accelerationStructureProperties[0].maxInstanceCount !=
5560 accelerationStructureProperties[1].maxInstanceCount ||
5561 accelerationStructureProperties[0].maxPrimitiveCount !=
5562 accelerationStructureProperties[1].maxPrimitiveCount ||
5563 accelerationStructureProperties[0].maxPerStageDescriptorAccelerationStructures !=
5564 accelerationStructureProperties[1].maxPerStageDescriptorAccelerationStructures ||
5565 accelerationStructureProperties[0].maxPerStageDescriptorUpdateAfterBindAccelerationStructures !=
5566 accelerationStructureProperties[1].maxPerStageDescriptorUpdateAfterBindAccelerationStructures ||
5567 accelerationStructureProperties[0].maxDescriptorSetAccelerationStructures !=
5568 accelerationStructureProperties[1].maxDescriptorSetAccelerationStructures ||
5569 accelerationStructureProperties[0].maxDescriptorSetUpdateAfterBindAccelerationStructures !=
5570 accelerationStructureProperties[1].maxDescriptorSetUpdateAfterBindAccelerationStructures ||
5571 accelerationStructureProperties[0].minAccelerationStructureScratchOffsetAlignment !=
5572 accelerationStructureProperties[1].minAccelerationStructureScratchOffsetAlignment)
5573 {
5574 TCU_FAIL("Mismatch between VkPhysicalDeviceAccelerationStructurePropertiesKHR");
5575 }
5576
5577 if (accelerationStructureProperties[0].minAccelerationStructureScratchOffsetAlignment == 0 ||
5578 !deIntIsPow2(accelerationStructureProperties[0].minAccelerationStructureScratchOffsetAlignment))
5579 {
5580 TCU_FAIL("limit Validation failed minAccelerationStructureScratchOffsetAlignment is not a power of two.");
5581 }
5582 }
5583
5584 if (isExtensionStructSupported(properties, RequiredExtension("VK_KHR_push_descriptor")))
5585 {
5586 VkPhysicalDevicePushDescriptorPropertiesKHR pushDescriptorProperties[count];
5587
5588 for (int ndx = 0; ndx < count; ++ndx)
5589 {
5590 deMemset(&pushDescriptorProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDevicePushDescriptorPropertiesKHR));
5591
5592 pushDescriptorProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR;
5593 pushDescriptorProperties[ndx].pNext = nullptr;
5594
5595 extProperties.pNext = &pushDescriptorProperties[ndx];
5596
5597 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5598
5599 pushDescriptorProperties[ndx].pNext = nullptr;
5600 }
5601
5602 log << TestLog::Message << pushDescriptorProperties[0] << TestLog::EndMessage;
5603
5604 if (pushDescriptorProperties[0].maxPushDescriptors != pushDescriptorProperties[1].maxPushDescriptors)
5605 {
5606 TCU_FAIL("Mismatch between VkPhysicalDevicePushDescriptorPropertiesKHR ");
5607 }
5608 if (pushDescriptorProperties[0].maxPushDescriptors < 32)
5609 {
5610 TCU_FAIL("VkPhysicalDevicePushDescriptorPropertiesKHR.maxPushDescriptors must be at least 32");
5611 }
5612 }
5613
5614 if (isExtensionStructSupported(properties, RequiredExtension("VK_KHR_performance_query")))
5615 {
5616 VkPhysicalDevicePerformanceQueryPropertiesKHR performanceQueryProperties[count];
5617
5618 for (int ndx = 0; ndx < count; ++ndx)
5619 {
5620 deMemset(&performanceQueryProperties[ndx], 0xFF * ndx,
5621 sizeof(VkPhysicalDevicePerformanceQueryPropertiesKHR));
5622 performanceQueryProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR;
5623 performanceQueryProperties[ndx].pNext = nullptr;
5624
5625 extProperties.pNext = &performanceQueryProperties[ndx];
5626
5627 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5628 }
5629
5630 log << TestLog::Message << performanceQueryProperties[0] << TestLog::EndMessage;
5631
5632 if (performanceQueryProperties[0].allowCommandBufferQueryCopies !=
5633 performanceQueryProperties[1].allowCommandBufferQueryCopies)
5634 {
5635 TCU_FAIL("Mismatch between VkPhysicalDevicePerformanceQueryPropertiesKHR");
5636 }
5637 }
5638
5639 #endif // CTS_USES_VULKANSC
5640
5641 if (isExtensionStructSupported(properties, RequiredExtension("VK_EXT_pci_bus_info", 2, 2)))
5642 {
5643 VkPhysicalDevicePCIBusInfoPropertiesEXT pciBusInfoProperties[count];
5644
5645 for (int ndx = 0; ndx < count; ++ndx)
5646 {
5647 // Each PCI device is identified by an 8-bit domain number, 5-bit
5648 // device number and 3-bit function number[1][2].
5649 //
5650 // In addition, because PCI systems can be interconnected and
5651 // divided in segments, Linux assigns a 16-bit number to the device
5652 // as the "domain". In Windows, the segment or domain is stored in
5653 // the higher 24-bit section of the bus number.
5654 //
5655 // This means the maximum unsigned 32-bit integer for these members
5656 // are invalid values and should change after querying properties.
5657 //
5658 // [1] https://en.wikipedia.org/wiki/PCI_configuration_space
5659 // [2] PCI Express Base Specification Revision 3.0, section 2.2.4.2.
5660 deMemset(pciBusInfoProperties + ndx, 0xFF * ndx, sizeof(pciBusInfoProperties[ndx]));
5661 pciBusInfoProperties[ndx].pciDomain = DEUINT32_MAX;
5662 pciBusInfoProperties[ndx].pciBus = DEUINT32_MAX;
5663 pciBusInfoProperties[ndx].pciDevice = DEUINT32_MAX;
5664 pciBusInfoProperties[ndx].pciFunction = DEUINT32_MAX;
5665
5666 pciBusInfoProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT;
5667 pciBusInfoProperties[ndx].pNext = nullptr;
5668
5669 extProperties.pNext = pciBusInfoProperties + ndx;
5670 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5671 }
5672
5673 log << TestLog::Message << toString(pciBusInfoProperties[0]) << TestLog::EndMessage;
5674
5675 if (pciBusInfoProperties[0].pciDomain != pciBusInfoProperties[1].pciDomain ||
5676 pciBusInfoProperties[0].pciBus != pciBusInfoProperties[1].pciBus ||
5677 pciBusInfoProperties[0].pciDevice != pciBusInfoProperties[1].pciDevice ||
5678 pciBusInfoProperties[0].pciFunction != pciBusInfoProperties[1].pciFunction)
5679 {
5680 TCU_FAIL("Mismatch between VkPhysicalDevicePCIBusInfoPropertiesEXT");
5681 }
5682 if (pciBusInfoProperties[0].pciDomain == DEUINT32_MAX || pciBusInfoProperties[0].pciBus == DEUINT32_MAX ||
5683 pciBusInfoProperties[0].pciDevice == DEUINT32_MAX || pciBusInfoProperties[0].pciFunction == DEUINT32_MAX)
5684 {
5685 TCU_FAIL("Invalid information in VkPhysicalDevicePCIBusInfoPropertiesEXT");
5686 }
5687 }
5688
5689 #ifndef CTS_USES_VULKANSC
5690 if (isExtensionStructSupported(properties, RequiredExtension("VK_KHR_portability_subset")))
5691 {
5692 VkPhysicalDevicePortabilitySubsetPropertiesKHR portabilitySubsetProperties[count];
5693
5694 for (int ndx = 0; ndx < count; ++ndx)
5695 {
5696 deMemset(&portabilitySubsetProperties[ndx], 0xFF * ndx,
5697 sizeof(VkPhysicalDevicePortabilitySubsetPropertiesKHR));
5698 portabilitySubsetProperties[ndx].sType =
5699 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_PROPERTIES_KHR;
5700 portabilitySubsetProperties[ndx].pNext = nullptr;
5701
5702 extProperties.pNext = &portabilitySubsetProperties[ndx];
5703
5704 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5705 }
5706
5707 log << TestLog::Message << portabilitySubsetProperties[0] << TestLog::EndMessage;
5708
5709 if (portabilitySubsetProperties[0].minVertexInputBindingStrideAlignment !=
5710 portabilitySubsetProperties[1].minVertexInputBindingStrideAlignment)
5711 {
5712 TCU_FAIL("Mismatch between VkPhysicalDevicePortabilitySubsetPropertiesKHR");
5713 }
5714
5715 if (portabilitySubsetProperties[0].minVertexInputBindingStrideAlignment == 0 ||
5716 !deIntIsPow2(portabilitySubsetProperties[0].minVertexInputBindingStrideAlignment))
5717 {
5718 TCU_FAIL("limit Validation failed minVertexInputBindingStrideAlignment is not a power of two.");
5719 }
5720 }
5721 #endif // CTS_USES_VULKANSC
5722
5723 return tcu::TestStatus::pass("Querying device properties succeeded");
5724 }
5725
toString(const VkFormatProperties2 & value)5726 string toString(const VkFormatProperties2 &value)
5727 {
5728 std::ostringstream s;
5729 s << "VkFormatProperties2 = {\n";
5730 s << "\tsType = " << value.sType << '\n';
5731 s << "\tformatProperties = {\n";
5732 s << "\tlinearTilingFeatures = " << getFormatFeatureFlagsStr(value.formatProperties.linearTilingFeatures) << '\n';
5733 s << "\toptimalTilingFeatures = " << getFormatFeatureFlagsStr(value.formatProperties.optimalTilingFeatures) << '\n';
5734 s << "\tbufferFeatures = " << getFormatFeatureFlagsStr(value.formatProperties.bufferFeatures) << '\n';
5735 s << "\t}";
5736 s << "}";
5737 return s.str();
5738 }
5739
deviceFormatProperties2(Context & context)5740 tcu::TestStatus deviceFormatProperties2(Context &context)
5741 {
5742 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5743 const InstanceDriver &vki(instance.getDriver());
5744 const VkPhysicalDevice physicalDevice(chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
5745 TestLog &log = context.getTestContext().getLog();
5746
5747 for (int formatNdx = 0; formatNdx < VK_CORE_FORMAT_LAST; ++formatNdx)
5748 {
5749 const VkFormat format = (VkFormat)formatNdx;
5750 VkFormatProperties coreProperties;
5751 VkFormatProperties2 extProperties;
5752
5753 deMemset(&coreProperties, 0xcd, sizeof(VkFormatProperties));
5754 deMemset(&extProperties, 0xcd, sizeof(VkFormatProperties2));
5755
5756 extProperties.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2;
5757 extProperties.pNext = nullptr;
5758
5759 vki.getPhysicalDeviceFormatProperties(physicalDevice, format, &coreProperties);
5760 vki.getPhysicalDeviceFormatProperties2(physicalDevice, format, &extProperties);
5761
5762 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2);
5763
5764 if (format == vk::VK_FORMAT_UNDEFINED)
5765 {
5766 VkFormatProperties2 formatUndefProperties2;
5767
5768 deMemset(&formatUndefProperties2, 0xcd, sizeof(VkFormatProperties2));
5769 formatUndefProperties2.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2;
5770 formatUndefProperties2.pNext = nullptr;
5771 formatUndefProperties2.formatProperties.bufferFeatures = 0;
5772 formatUndefProperties2.formatProperties.linearTilingFeatures = 0;
5773 formatUndefProperties2.formatProperties.optimalTilingFeatures = 0;
5774
5775 if (deMemCmp(&formatUndefProperties2, &extProperties, sizeof(VkFormatProperties2)) != 0)
5776 TCU_FAIL("vkGetPhysicalDeviceFormatProperties2, with VK_FORMAT_UNDEFINED as input format, is returning "
5777 "non-zero properties");
5778 }
5779 else
5780 TCU_CHECK(extProperties.pNext == nullptr);
5781
5782 if (deMemCmp(&coreProperties, &extProperties.formatProperties, sizeof(VkFormatProperties)) != 0)
5783 TCU_FAIL("Mismatch between format properties reported by vkGetPhysicalDeviceFormatProperties and "
5784 "vkGetPhysicalDeviceFormatProperties2");
5785
5786 log << TestLog::Message << toString(extProperties) << TestLog::EndMessage;
5787 }
5788
5789 return tcu::TestStatus::pass("Querying device format properties succeeded");
5790 }
5791
deviceQueueFamilyProperties2(Context & context)5792 tcu::TestStatus deviceQueueFamilyProperties2(Context &context)
5793 {
5794 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5795 const InstanceDriver &vki(instance.getDriver());
5796 const VkPhysicalDevice physicalDevice(chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
5797 TestLog &log = context.getTestContext().getLog();
5798 uint32_t numCoreQueueFamilies = ~0u;
5799 uint32_t numExtQueueFamilies = ~0u;
5800
5801 vki.getPhysicalDeviceQueueFamilyProperties(physicalDevice, &numCoreQueueFamilies, nullptr);
5802 vki.getPhysicalDeviceQueueFamilyProperties2(physicalDevice, &numExtQueueFamilies, nullptr);
5803
5804 TCU_CHECK_MSG(numCoreQueueFamilies == numExtQueueFamilies, "Different number of queue family properties reported");
5805 TCU_CHECK(numCoreQueueFamilies > 0);
5806
5807 {
5808 std::vector<VkQueueFamilyProperties> coreProperties(numCoreQueueFamilies);
5809 std::vector<VkQueueFamilyProperties2> extProperties(numExtQueueFamilies);
5810
5811 deMemset(&coreProperties[0], 0xcd, sizeof(VkQueueFamilyProperties) * numCoreQueueFamilies);
5812 deMemset(&extProperties[0], 0xcd, sizeof(VkQueueFamilyProperties2) * numExtQueueFamilies);
5813
5814 for (size_t ndx = 0; ndx < extProperties.size(); ++ndx)
5815 {
5816 extProperties[ndx].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2;
5817 extProperties[ndx].pNext = nullptr;
5818 }
5819
5820 vki.getPhysicalDeviceQueueFamilyProperties(physicalDevice, &numCoreQueueFamilies, &coreProperties[0]);
5821 vki.getPhysicalDeviceQueueFamilyProperties2(physicalDevice, &numExtQueueFamilies, &extProperties[0]);
5822
5823 TCU_CHECK((size_t)numCoreQueueFamilies == coreProperties.size());
5824 TCU_CHECK((size_t)numExtQueueFamilies == extProperties.size());
5825 DE_ASSERT(numCoreQueueFamilies == numExtQueueFamilies);
5826
5827 for (size_t ndx = 0; ndx < extProperties.size(); ++ndx)
5828 {
5829 TCU_CHECK(extProperties[ndx].sType == VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2);
5830 TCU_CHECK(extProperties[ndx].pNext == nullptr);
5831
5832 if (deMemCmp(&coreProperties[ndx], &extProperties[ndx].queueFamilyProperties,
5833 sizeof(VkQueueFamilyProperties)) != 0)
5834 TCU_FAIL("Mismatch between format properties reported by vkGetPhysicalDeviceQueueFamilyProperties and "
5835 "vkGetPhysicalDeviceQueueFamilyProperties2");
5836
5837 log << TestLog::Message << " queueFamilyNdx = " << ndx << TestLog::EndMessage << TestLog::Message
5838 << extProperties[ndx] << TestLog::EndMessage;
5839 }
5840 }
5841
5842 return tcu::TestStatus::pass("Querying device queue family properties succeeded");
5843 }
5844
deviceMemoryProperties2(Context & context)5845 tcu::TestStatus deviceMemoryProperties2(Context &context)
5846 {
5847 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5848 const InstanceDriver &vki(instance.getDriver());
5849 const VkPhysicalDevice physicalDevice(chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
5850 TestLog &log = context.getTestContext().getLog();
5851 VkPhysicalDeviceMemoryProperties coreProperties;
5852 VkPhysicalDeviceMemoryProperties2 extProperties;
5853
5854 deMemset(&coreProperties, 0xcd, sizeof(VkPhysicalDeviceMemoryProperties));
5855 deMemset(&extProperties, 0xcd, sizeof(VkPhysicalDeviceMemoryProperties2));
5856
5857 extProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2;
5858 extProperties.pNext = nullptr;
5859
5860 vki.getPhysicalDeviceMemoryProperties(physicalDevice, &coreProperties);
5861 vki.getPhysicalDeviceMemoryProperties2(physicalDevice, &extProperties);
5862
5863 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2);
5864 TCU_CHECK(extProperties.pNext == nullptr);
5865
5866 if (coreProperties.memoryTypeCount != extProperties.memoryProperties.memoryTypeCount)
5867 TCU_FAIL("Mismatch between memoryTypeCount reported by vkGetPhysicalDeviceMemoryProperties and "
5868 "vkGetPhysicalDeviceMemoryProperties2");
5869 if (coreProperties.memoryHeapCount != extProperties.memoryProperties.memoryHeapCount)
5870 TCU_FAIL("Mismatch between memoryHeapCount reported by vkGetPhysicalDeviceMemoryProperties and "
5871 "vkGetPhysicalDeviceMemoryProperties2");
5872 for (uint32_t i = 0; i < coreProperties.memoryTypeCount; i++)
5873 {
5874 const VkMemoryType *coreType = &coreProperties.memoryTypes[i];
5875 const VkMemoryType *extType = &extProperties.memoryProperties.memoryTypes[i];
5876 if (coreType->propertyFlags != extType->propertyFlags || coreType->heapIndex != extType->heapIndex)
5877 TCU_FAIL("Mismatch between memoryTypes reported by vkGetPhysicalDeviceMemoryProperties and "
5878 "vkGetPhysicalDeviceMemoryProperties2");
5879 }
5880 for (uint32_t i = 0; i < coreProperties.memoryHeapCount; i++)
5881 {
5882 const VkMemoryHeap *coreHeap = &coreProperties.memoryHeaps[i];
5883 const VkMemoryHeap *extHeap = &extProperties.memoryProperties.memoryHeaps[i];
5884 if (coreHeap->size != extHeap->size || coreHeap->flags != extHeap->flags)
5885 TCU_FAIL("Mismatch between memoryHeaps reported by vkGetPhysicalDeviceMemoryProperties and "
5886 "vkGetPhysicalDeviceMemoryProperties2");
5887 }
5888
5889 log << TestLog::Message << extProperties << TestLog::EndMessage;
5890
5891 return tcu::TestStatus::pass("Querying device memory properties succeeded");
5892 }
5893
deviceFeaturesVulkan12(Context & context)5894 tcu::TestStatus deviceFeaturesVulkan12(Context &context)
5895 {
5896 using namespace ValidateQueryBits;
5897
5898 const QueryMemberTableEntry feature11OffsetTable[] = {
5899 // VkPhysicalDevice16BitStorageFeatures
5900 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, storageBuffer16BitAccess),
5901 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, uniformAndStorageBuffer16BitAccess),
5902 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, storagePushConstant16),
5903 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, storageInputOutput16),
5904
5905 // VkPhysicalDeviceMultiviewFeatures
5906 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, multiview),
5907 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, multiviewGeometryShader),
5908 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, multiviewTessellationShader),
5909
5910 // VkPhysicalDeviceVariablePointersFeatures
5911 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, variablePointersStorageBuffer),
5912 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, variablePointers),
5913
5914 // VkPhysicalDeviceProtectedMemoryFeatures
5915 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, protectedMemory),
5916
5917 // VkPhysicalDeviceSamplerYcbcrConversionFeatures
5918 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, samplerYcbcrConversion),
5919
5920 // VkPhysicalDeviceShaderDrawParametersFeatures
5921 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, shaderDrawParameters),
5922 {0, 0}};
5923 const QueryMemberTableEntry feature12OffsetTable[] = {
5924 // None
5925 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, samplerMirrorClampToEdge),
5926 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, drawIndirectCount),
5927
5928 // VkPhysicalDevice8BitStorageFeatures
5929 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, storageBuffer8BitAccess),
5930 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, uniformAndStorageBuffer8BitAccess),
5931 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, storagePushConstant8),
5932
5933 // VkPhysicalDeviceShaderAtomicInt64Features
5934 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderBufferInt64Atomics),
5935 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderSharedInt64Atomics),
5936
5937 // VkPhysicalDeviceShaderFloat16Int8Features
5938 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderFloat16),
5939 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderInt8),
5940
5941 // VkPhysicalDeviceDescriptorIndexingFeatures
5942 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorIndexing),
5943 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderInputAttachmentArrayDynamicIndexing),
5944 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderUniformTexelBufferArrayDynamicIndexing),
5945 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageTexelBufferArrayDynamicIndexing),
5946 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderUniformBufferArrayNonUniformIndexing),
5947 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderSampledImageArrayNonUniformIndexing),
5948 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageBufferArrayNonUniformIndexing),
5949 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageImageArrayNonUniformIndexing),
5950 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderInputAttachmentArrayNonUniformIndexing),
5951 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderUniformTexelBufferArrayNonUniformIndexing),
5952 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageTexelBufferArrayNonUniformIndexing),
5953 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingUniformBufferUpdateAfterBind),
5954 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingSampledImageUpdateAfterBind),
5955 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingStorageImageUpdateAfterBind),
5956 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingStorageBufferUpdateAfterBind),
5957 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingUniformTexelBufferUpdateAfterBind),
5958 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingStorageTexelBufferUpdateAfterBind),
5959 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingUpdateUnusedWhilePending),
5960 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingPartiallyBound),
5961 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingVariableDescriptorCount),
5962 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, runtimeDescriptorArray),
5963
5964 // None
5965 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, samplerFilterMinmax),
5966
5967 // VkPhysicalDeviceScalarBlockLayoutFeatures
5968 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, scalarBlockLayout),
5969
5970 // VkPhysicalDeviceImagelessFramebufferFeatures
5971 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, imagelessFramebuffer),
5972
5973 // VkPhysicalDeviceUniformBufferStandardLayoutFeatures
5974 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, uniformBufferStandardLayout),
5975
5976 // VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures
5977 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderSubgroupExtendedTypes),
5978
5979 // VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures
5980 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, separateDepthStencilLayouts),
5981
5982 // VkPhysicalDeviceHostQueryResetFeatures
5983 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, hostQueryReset),
5984
5985 // VkPhysicalDeviceTimelineSemaphoreFeatures
5986 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, timelineSemaphore),
5987
5988 // VkPhysicalDeviceBufferDeviceAddressFeatures
5989 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, bufferDeviceAddress),
5990 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, bufferDeviceAddressCaptureReplay),
5991 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, bufferDeviceAddressMultiDevice),
5992
5993 // VkPhysicalDeviceVulkanMemoryModelFeatures
5994 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, vulkanMemoryModel),
5995 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, vulkanMemoryModelDeviceScope),
5996 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, vulkanMemoryModelAvailabilityVisibilityChains),
5997
5998 // None
5999 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderOutputViewportIndex),
6000 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderOutputLayer),
6001 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, subgroupBroadcastDynamicId),
6002 {0, 0}};
6003 TestLog &log = context.getTestContext().getLog();
6004 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
6005 const InstanceDriver &vki = instance.getDriver();
6006 const VkPhysicalDevice physicalDevice(chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
6007 const uint32_t vulkan11FeaturesBufferSize = sizeof(VkPhysicalDeviceVulkan11Features) + GUARD_SIZE;
6008 const uint32_t vulkan12FeaturesBufferSize = sizeof(VkPhysicalDeviceVulkan12Features) + GUARD_SIZE;
6009 VkPhysicalDeviceFeatures2 extFeatures;
6010 uint8_t buffer11a[vulkan11FeaturesBufferSize];
6011 uint8_t buffer11b[vulkan11FeaturesBufferSize];
6012 uint8_t buffer12a[vulkan12FeaturesBufferSize];
6013 uint8_t buffer12b[vulkan12FeaturesBufferSize];
6014 const int count = 2u;
6015 VkPhysicalDeviceVulkan11Features *vulkan11Features[count] = {(VkPhysicalDeviceVulkan11Features *)(buffer11a),
6016 (VkPhysicalDeviceVulkan11Features *)(buffer11b)};
6017 VkPhysicalDeviceVulkan12Features *vulkan12Features[count] = {(VkPhysicalDeviceVulkan12Features *)(buffer12a),
6018 (VkPhysicalDeviceVulkan12Features *)(buffer12b)};
6019
6020 if (!context.contextSupports(vk::ApiVersion(0, 1, 2, 0)))
6021 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
6022
6023 deMemset(buffer11b, GUARD_VALUE, sizeof(buffer11b));
6024 deMemset(buffer12a, GUARD_VALUE, sizeof(buffer12a));
6025 deMemset(buffer12b, GUARD_VALUE, sizeof(buffer12b));
6026 deMemset(buffer11a, GUARD_VALUE, sizeof(buffer11a));
6027
6028 // Validate all fields initialized
6029 for (int ndx = 0; ndx < count; ++ndx)
6030 {
6031 deMemset(&extFeatures.features, 0x00, sizeof(extFeatures.features));
6032 extFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
6033 extFeatures.pNext = vulkan11Features[ndx];
6034
6035 deMemset(vulkan11Features[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan11Features));
6036 vulkan11Features[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
6037 vulkan11Features[ndx]->pNext = vulkan12Features[ndx];
6038
6039 deMemset(vulkan12Features[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan12Features));
6040 vulkan12Features[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
6041 vulkan12Features[ndx]->pNext = nullptr;
6042
6043 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
6044 }
6045
6046 log << TestLog::Message << *vulkan11Features[0] << TestLog::EndMessage;
6047 log << TestLog::Message << *vulkan12Features[0] << TestLog::EndMessage;
6048
6049 if (!validateStructsWithGuard(feature11OffsetTable, vulkan11Features, GUARD_VALUE, GUARD_SIZE))
6050 {
6051 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceVulkan11Features initialization failure"
6052 << TestLog::EndMessage;
6053
6054 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan11Features initialization failure");
6055 }
6056
6057 if (!validateStructsWithGuard(feature12OffsetTable, vulkan12Features, GUARD_VALUE, GUARD_SIZE))
6058 {
6059 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceVulkan12Features initialization failure"
6060 << TestLog::EndMessage;
6061
6062 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan12Features initialization failure");
6063 }
6064
6065 return tcu::TestStatus::pass("Querying Vulkan 1.2 device features succeeded");
6066 }
6067
6068 #ifndef CTS_USES_VULKANSC
deviceFeaturesVulkan13(Context & context)6069 tcu::TestStatus deviceFeaturesVulkan13(Context &context)
6070 {
6071 using namespace ValidateQueryBits;
6072
6073 const QueryMemberTableEntry feature13OffsetTable[] = {
6074 // VkPhysicalDeviceImageRobustnessFeatures
6075 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, robustImageAccess),
6076
6077 // VkPhysicalDeviceInlineUniformBlockFeatures
6078 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, inlineUniformBlock),
6079 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, descriptorBindingInlineUniformBlockUpdateAfterBind),
6080
6081 // VkPhysicalDevicePipelineCreationCacheControlFeatures
6082 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, pipelineCreationCacheControl),
6083
6084 // VkPhysicalDevicePrivateDataFeatures
6085 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, privateData),
6086
6087 // VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures
6088 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, shaderDemoteToHelperInvocation),
6089
6090 // VkPhysicalDeviceShaderTerminateInvocationFeatures
6091 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, shaderTerminateInvocation),
6092
6093 // VkPhysicalDeviceSubgroupSizeControlFeatures
6094 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, subgroupSizeControl),
6095 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, computeFullSubgroups),
6096
6097 // VkPhysicalDeviceSynchronization2Features
6098 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, synchronization2),
6099
6100 // VkPhysicalDeviceTextureCompressionASTCHDRFeatures
6101 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, textureCompressionASTC_HDR),
6102
6103 // VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures
6104 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, shaderZeroInitializeWorkgroupMemory),
6105
6106 // VkPhysicalDeviceDynamicRenderingFeatures
6107 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, dynamicRendering),
6108
6109 // VkPhysicalDeviceShaderIntegerDotProductFeatures
6110 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, shaderIntegerDotProduct),
6111
6112 // VkPhysicalDeviceMaintenance4Features
6113 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, maintenance4),
6114 {0, 0}};
6115 TestLog &log = context.getTestContext().getLog();
6116 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
6117 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
6118 const InstanceDriver &vki = instance.getDriver();
6119 const uint32_t vulkan13FeaturesBufferSize = sizeof(VkPhysicalDeviceVulkan13Features) + GUARD_SIZE;
6120 VkPhysicalDeviceFeatures2 extFeatures;
6121 uint8_t buffer13a[vulkan13FeaturesBufferSize];
6122 uint8_t buffer13b[vulkan13FeaturesBufferSize];
6123 const int count = 2u;
6124 VkPhysicalDeviceVulkan13Features *vulkan13Features[count] = {(VkPhysicalDeviceVulkan13Features *)(buffer13a),
6125 (VkPhysicalDeviceVulkan13Features *)(buffer13b)};
6126
6127 if (!context.contextSupports(vk::ApiVersion(0, 1, 3, 0)))
6128 TCU_THROW(NotSupportedError, "At least Vulkan 1.3 required to run test");
6129
6130 deMemset(buffer13a, GUARD_VALUE, sizeof(buffer13a));
6131 deMemset(buffer13b, GUARD_VALUE, sizeof(buffer13b));
6132
6133 // Validate all fields initialized
6134 for (int ndx = 0; ndx < count; ++ndx)
6135 {
6136 deMemset(&extFeatures.features, 0x00, sizeof(extFeatures.features));
6137 extFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
6138 extFeatures.pNext = vulkan13Features[ndx];
6139
6140 deMemset(vulkan13Features[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan13Features));
6141 vulkan13Features[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
6142 vulkan13Features[ndx]->pNext = nullptr;
6143
6144 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
6145 }
6146
6147 log << TestLog::Message << *vulkan13Features[0] << TestLog::EndMessage;
6148
6149 if (!validateStructsWithGuard(feature13OffsetTable, vulkan13Features, GUARD_VALUE, GUARD_SIZE))
6150 {
6151 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceVulkan13Features initialization failure"
6152 << TestLog::EndMessage;
6153
6154 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan13Features initialization failure");
6155 }
6156
6157 return tcu::TestStatus::pass("Querying Vulkan 1.3 device features succeeded");
6158 }
6159
deviceFeaturesVulkan14(Context & context)6160 tcu::TestStatus deviceFeaturesVulkan14(Context &context)
6161 {
6162 using namespace ValidateQueryBits;
6163
6164 const QueryMemberTableEntry feature14OffsetTable[] = {
6165
6166 // VkPhysicalDeviceDynamicRenderingLocalReadFeaturesKHR
6167 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, dynamicRenderingLocalRead),
6168
6169 // VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR
6170 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, globalPriorityQuery),
6171
6172 // VkPhysicalDeviceIndexTypeUint8FeaturesKHR
6173 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, indexTypeUint8),
6174
6175 // VkPhysicalDeviceLineRasterizationFeaturesKHR
6176 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, rectangularLines),
6177 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, bresenhamLines),
6178 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, smoothLines),
6179 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, stippledRectangularLines),
6180 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, stippledBresenhamLines),
6181 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, stippledSmoothLines),
6182
6183 // VkPhysicalDeviceMaintenance5FeaturesKHR
6184 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, maintenance5),
6185
6186 // VkPhysicalDeviceMaintenance6FeaturesKHR
6187 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, maintenance6),
6188
6189 // VkPhysicalDeviceShaderExpectAssumeFeaturesKHR
6190 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, shaderExpectAssume),
6191
6192 // VkPhysicalDeviceShaderFloatControls2FeaturesKHR
6193 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, shaderFloatControls2),
6194
6195 // VkPhysicalDeviceShaderSubgroupRotateFeaturesKHR
6196 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, shaderSubgroupRotate),
6197 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, shaderSubgroupRotateClustered),
6198
6199 // VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR
6200 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, vertexAttributeInstanceRateDivisor),
6201 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, vertexAttributeInstanceRateZeroDivisor),
6202
6203 // VkPhysicalDeviceHostImageCopyFeaturesEXT
6204 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, hostImageCopy),
6205
6206 // VkPhysicalDevicePipelineProtectedAccessFeaturesEXT
6207 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, pipelineProtectedAccess),
6208
6209 // VkPhysicalDevicePipelineRobustnessFeaturesEXT
6210 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Features, pipelineRobustness),
6211 {0, 0}};
6212 TestLog &log = context.getTestContext().getLog();
6213 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
6214 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
6215 const InstanceDriver &vki = instance.getDriver();
6216 const uint32_t vulkan14FeaturesBufferSize = sizeof(VkPhysicalDeviceVulkan14Features) + GUARD_SIZE;
6217 VkPhysicalDeviceFeatures2 extFeatures;
6218 uint8_t buffer14a[vulkan14FeaturesBufferSize];
6219 uint8_t buffer14b[vulkan14FeaturesBufferSize];
6220 const int count = 2u;
6221 VkPhysicalDeviceVulkan14Features *vulkan14Features[count] = {(VkPhysicalDeviceVulkan14Features *)(buffer14a),
6222 (VkPhysicalDeviceVulkan14Features *)(buffer14b)};
6223
6224 if (!context.contextSupports(vk::ApiVersion(0, 1, 4, 0)))
6225 TCU_THROW(NotSupportedError, "At least Vulkan 1.4 required to run test");
6226
6227 deMemset(buffer14a, GUARD_VALUE, sizeof(buffer14a));
6228 deMemset(buffer14b, GUARD_VALUE, sizeof(buffer14b));
6229
6230 // Validate all fields initialized
6231 for (int ndx = 0; ndx < count; ++ndx)
6232 {
6233 deMemset(&extFeatures.features, 0x00, sizeof(extFeatures.features));
6234 extFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
6235 extFeatures.pNext = vulkan14Features[ndx];
6236
6237 deMemset(vulkan14Features[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan14Features));
6238 vulkan14Features[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_4_FEATURES;
6239 vulkan14Features[ndx]->pNext = DE_NULL;
6240
6241 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
6242 }
6243
6244 log << TestLog::Message << *vulkan14Features[0] << TestLog::EndMessage;
6245
6246 if (!validateStructsWithGuard(feature14OffsetTable, vulkan14Features, GUARD_VALUE, GUARD_SIZE))
6247 {
6248 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceVulkan14Features initialization failure"
6249 << TestLog::EndMessage;
6250
6251 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan14Features initialization failure");
6252 }
6253
6254 return tcu::TestStatus::pass("Querying Vulkan 1.4 device features succeeded");
6255 }
6256 #endif // CTS_USES_VULKANSC
6257
devicePropertiesVulkan12(Context & context)6258 tcu::TestStatus devicePropertiesVulkan12(Context &context)
6259 {
6260 using namespace ValidateQueryBits;
6261
6262 const QueryMemberTableEntry properties11OffsetTable[] = {
6263 // VkPhysicalDeviceIDProperties
6264 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceUUID),
6265 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, driverUUID),
6266 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceLUID),
6267 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceNodeMask),
6268 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceLUIDValid),
6269
6270 // VkPhysicalDeviceSubgroupProperties
6271 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupSize),
6272 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupSupportedStages),
6273 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupSupportedOperations),
6274 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupQuadOperationsInAllStages),
6275
6276 // VkPhysicalDevicePointClippingProperties
6277 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, pointClippingBehavior),
6278
6279 // VkPhysicalDeviceMultiviewProperties
6280 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxMultiviewViewCount),
6281 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxMultiviewInstanceIndex),
6282
6283 // VkPhysicalDeviceProtectedMemoryProperties
6284 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, protectedNoFault),
6285
6286 // VkPhysicalDeviceMaintenance3Properties
6287 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxPerSetDescriptors),
6288 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxMemoryAllocationSize),
6289 {0, 0}};
6290 const QueryMemberTableEntry properties12OffsetTable[] = {
6291 // VkPhysicalDeviceDriverProperties
6292 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, driverID),
6293 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, conformanceVersion),
6294
6295 // VkPhysicalDeviceFloatControlsProperties
6296 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, denormBehaviorIndependence),
6297 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, roundingModeIndependence),
6298 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSignedZeroInfNanPreserveFloat16),
6299 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSignedZeroInfNanPreserveFloat32),
6300 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSignedZeroInfNanPreserveFloat64),
6301 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormPreserveFloat16),
6302 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormPreserveFloat32),
6303 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormPreserveFloat64),
6304 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormFlushToZeroFloat16),
6305 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormFlushToZeroFloat32),
6306 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormFlushToZeroFloat64),
6307 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTEFloat16),
6308 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTEFloat32),
6309 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTEFloat64),
6310 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTZFloat16),
6311 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTZFloat32),
6312 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTZFloat64),
6313
6314 // VkPhysicalDeviceDescriptorIndexingProperties
6315 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxUpdateAfterBindDescriptorsInAllPools),
6316 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderUniformBufferArrayNonUniformIndexingNative),
6317 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSampledImageArrayNonUniformIndexingNative),
6318 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderStorageBufferArrayNonUniformIndexingNative),
6319 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderStorageImageArrayNonUniformIndexingNative),
6320 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderInputAttachmentArrayNonUniformIndexingNative),
6321 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, robustBufferAccessUpdateAfterBind),
6322 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, quadDivergentImplicitLod),
6323 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindSamplers),
6324 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindUniformBuffers),
6325 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindStorageBuffers),
6326 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindSampledImages),
6327 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindStorageImages),
6328 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindInputAttachments),
6329 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageUpdateAfterBindResources),
6330 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindSamplers),
6331 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindUniformBuffers),
6332 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindUniformBuffersDynamic),
6333 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindStorageBuffers),
6334 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindStorageBuffersDynamic),
6335 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindSampledImages),
6336 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindStorageImages),
6337 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindInputAttachments),
6338
6339 // VkPhysicalDeviceDepthStencilResolveProperties
6340 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, supportedDepthResolveModes),
6341 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, supportedStencilResolveModes),
6342 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, independentResolveNone),
6343 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, independentResolve),
6344
6345 // VkPhysicalDeviceSamplerFilterMinmaxProperties
6346 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, filterMinmaxSingleComponentFormats),
6347 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, filterMinmaxImageComponentMapping),
6348
6349 // VkPhysicalDeviceTimelineSemaphoreProperties
6350 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxTimelineSemaphoreValueDifference),
6351
6352 // None
6353 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, framebufferIntegerColorSampleCounts),
6354 {0, 0}};
6355 TestLog &log = context.getTestContext().getLog();
6356 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
6357 const InstanceDriver &vki = instance.getDriver();
6358 const VkPhysicalDevice physicalDevice(chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
6359 const uint32_t vulkan11PropertiesBufferSize = sizeof(VkPhysicalDeviceVulkan11Properties) + GUARD_SIZE;
6360 const uint32_t vulkan12PropertiesBufferSize = sizeof(VkPhysicalDeviceVulkan12Properties) + GUARD_SIZE;
6361 VkPhysicalDeviceProperties2 extProperties;
6362 uint8_t buffer11a[vulkan11PropertiesBufferSize];
6363 uint8_t buffer11b[vulkan11PropertiesBufferSize];
6364 uint8_t buffer12a[vulkan12PropertiesBufferSize];
6365 uint8_t buffer12b[vulkan12PropertiesBufferSize];
6366 const int count = 2u;
6367 VkPhysicalDeviceVulkan11Properties *vulkan11Properties[count] = {(VkPhysicalDeviceVulkan11Properties *)(buffer11a),
6368 (VkPhysicalDeviceVulkan11Properties *)(buffer11b)};
6369 VkPhysicalDeviceVulkan12Properties *vulkan12Properties[count] = {(VkPhysicalDeviceVulkan12Properties *)(buffer12a),
6370 (VkPhysicalDeviceVulkan12Properties *)(buffer12b)};
6371
6372 if (!context.contextSupports(vk::ApiVersion(0, 1, 2, 0)))
6373 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
6374
6375 deMemset(buffer11a, GUARD_VALUE, sizeof(buffer11a));
6376 deMemset(buffer11b, GUARD_VALUE, sizeof(buffer11b));
6377 deMemset(buffer12a, GUARD_VALUE, sizeof(buffer12a));
6378 deMemset(buffer12b, GUARD_VALUE, sizeof(buffer12b));
6379
6380 for (int ndx = 0; ndx < count; ++ndx)
6381 {
6382 deMemset(&extProperties.properties, 0x00, sizeof(extProperties.properties));
6383 extProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
6384 extProperties.pNext = vulkan11Properties[ndx];
6385
6386 deMemset(vulkan11Properties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan11Properties));
6387 vulkan11Properties[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES;
6388 vulkan11Properties[ndx]->pNext = vulkan12Properties[ndx];
6389
6390 deMemset(vulkan12Properties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan12Properties));
6391 vulkan12Properties[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES;
6392 vulkan12Properties[ndx]->pNext = nullptr;
6393
6394 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
6395 }
6396
6397 log << TestLog::Message << *vulkan11Properties[0] << TestLog::EndMessage;
6398 log << TestLog::Message << *vulkan12Properties[0] << TestLog::EndMessage;
6399
6400 if (!validateStructsWithGuard(properties11OffsetTable, vulkan11Properties, GUARD_VALUE, GUARD_SIZE))
6401 {
6402 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceVulkan11Properties initialization failure"
6403 << TestLog::EndMessage;
6404
6405 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan11Properties initialization failure");
6406 }
6407
6408 if (!validateStructsWithGuard(properties12OffsetTable, vulkan12Properties, GUARD_VALUE, GUARD_SIZE) ||
6409 strncmp(vulkan12Properties[0]->driverName, vulkan12Properties[1]->driverName, VK_MAX_DRIVER_NAME_SIZE) != 0 ||
6410 strncmp(vulkan12Properties[0]->driverInfo, vulkan12Properties[1]->driverInfo, VK_MAX_DRIVER_INFO_SIZE) != 0)
6411 {
6412 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceVulkan12Properties initialization failure"
6413 << TestLog::EndMessage;
6414
6415 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan12Properties initialization failure");
6416 }
6417
6418 return tcu::TestStatus::pass("Querying Vulkan 1.2 device properties succeeded");
6419 }
6420
6421 #ifndef CTS_USES_VULKANSC
devicePropertiesVulkan13(Context & context)6422 tcu::TestStatus devicePropertiesVulkan13(Context &context)
6423 {
6424 using namespace ValidateQueryBits;
6425
6426 const QueryMemberTableEntry properties13OffsetTable[] = {
6427 // VkPhysicalDeviceSubgroupSizeControlProperties
6428 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, minSubgroupSize),
6429 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxSubgroupSize),
6430 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxComputeWorkgroupSubgroups),
6431 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, requiredSubgroupSizeStages),
6432
6433 // VkPhysicalDeviceInlineUniformBlockProperties
6434 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxInlineUniformBlockSize),
6435 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxPerStageDescriptorInlineUniformBlocks),
6436 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks),
6437 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxDescriptorSetInlineUniformBlocks),
6438 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxDescriptorSetUpdateAfterBindInlineUniformBlocks),
6439
6440 // None
6441 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxInlineUniformTotalSize),
6442
6443 // VkPhysicalDeviceShaderIntegerDotProductProperties
6444 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct8BitUnsignedAccelerated),
6445 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct8BitSignedAccelerated),
6446 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct8BitMixedSignednessAccelerated),
6447 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct4x8BitPackedUnsignedAccelerated),
6448 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct4x8BitPackedSignedAccelerated),
6449 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct4x8BitPackedMixedSignednessAccelerated),
6450 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct16BitUnsignedAccelerated),
6451 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct16BitSignedAccelerated),
6452 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct16BitMixedSignednessAccelerated),
6453 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct32BitUnsignedAccelerated),
6454 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct32BitSignedAccelerated),
6455 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct32BitMixedSignednessAccelerated),
6456 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct64BitUnsignedAccelerated),
6457 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct64BitSignedAccelerated),
6458 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct64BitMixedSignednessAccelerated),
6459 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6460 integerDotProductAccumulatingSaturating8BitUnsignedAccelerated),
6461 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6462 integerDotProductAccumulatingSaturating8BitSignedAccelerated),
6463 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6464 integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated),
6465 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6466 integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated),
6467 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6468 integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated),
6469 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6470 integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated),
6471 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6472 integerDotProductAccumulatingSaturating16BitUnsignedAccelerated),
6473 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6474 integerDotProductAccumulatingSaturating16BitSignedAccelerated),
6475 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6476 integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated),
6477 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6478 integerDotProductAccumulatingSaturating32BitUnsignedAccelerated),
6479 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6480 integerDotProductAccumulatingSaturating32BitSignedAccelerated),
6481 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6482 integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated),
6483 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6484 integerDotProductAccumulatingSaturating64BitUnsignedAccelerated),
6485 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6486 integerDotProductAccumulatingSaturating64BitSignedAccelerated),
6487 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties,
6488 integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated),
6489
6490 // VkPhysicalDeviceTexelBufferAlignmentProperties
6491 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, storageTexelBufferOffsetAlignmentBytes),
6492 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, storageTexelBufferOffsetSingleTexelAlignment),
6493 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, uniformTexelBufferOffsetAlignmentBytes),
6494 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, uniformTexelBufferOffsetSingleTexelAlignment),
6495
6496 // VkPhysicalDeviceMaintenance4Properties
6497 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxBufferSize),
6498 {0, 0}};
6499
6500 TestLog &log = context.getTestContext().getLog();
6501 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
6502 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
6503 const InstanceDriver &vki = instance.getDriver();
6504 const uint32_t vulkan13PropertiesBufferSize = sizeof(VkPhysicalDeviceVulkan13Properties) + GUARD_SIZE;
6505 VkPhysicalDeviceProperties2 extProperties;
6506 uint8_t buffer13a[vulkan13PropertiesBufferSize];
6507 uint8_t buffer13b[vulkan13PropertiesBufferSize];
6508 const int count = 2u;
6509 VkPhysicalDeviceVulkan13Properties *vulkan13Properties[count] = {(VkPhysicalDeviceVulkan13Properties *)(buffer13a),
6510 (VkPhysicalDeviceVulkan13Properties *)(buffer13b)};
6511
6512 if (!context.contextSupports(vk::ApiVersion(0, 1, 3, 0)))
6513 TCU_THROW(NotSupportedError, "At least Vulkan 1.3 required to run test");
6514
6515 deMemset(buffer13a, GUARD_VALUE, sizeof(buffer13a));
6516 deMemset(buffer13b, GUARD_VALUE, sizeof(buffer13b));
6517
6518 for (int ndx = 0; ndx < count; ++ndx)
6519 {
6520 deMemset(&extProperties.properties, 0x00, sizeof(extProperties.properties));
6521 extProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
6522 extProperties.pNext = vulkan13Properties[ndx];
6523
6524 deMemset(vulkan13Properties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan13Properties));
6525 vulkan13Properties[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES;
6526 vulkan13Properties[ndx]->pNext = nullptr;
6527
6528 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
6529 }
6530
6531 log << TestLog::Message << *vulkan13Properties[0] << TestLog::EndMessage;
6532
6533 if (!validateStructsWithGuard(properties13OffsetTable, vulkan13Properties, GUARD_VALUE, GUARD_SIZE))
6534 {
6535 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceVulkan13Properties initialization failure"
6536 << TestLog::EndMessage;
6537
6538 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan13Properties initialization failure");
6539 }
6540
6541 return tcu::TestStatus::pass("Querying Vulkan 1.3 device properties succeeded");
6542 }
6543
devicePropertiesVulkan14(Context & context)6544 tcu::TestStatus devicePropertiesVulkan14(Context &context)
6545 {
6546 using namespace ValidateQueryBits;
6547
6548 const QueryMemberTableEntry properties14OffsetTable[] = {
6549
6550 // VkPhysicalDeviceLineRasterizationPropertiesKHR
6551 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, lineSubPixelPrecisionBits),
6552
6553 // VkPhysicalDeviceMaintenance5PropertiesKHR
6554 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, earlyFragmentMultisampleCoverageAfterSampleCounting),
6555 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, earlyFragmentSampleMaskTestBeforeSampleCounting),
6556 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, depthStencilSwizzleOneSupport),
6557 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, polygonModePointSize),
6558 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, nonStrictSinglePixelWideLinesUseParallelogram),
6559 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, nonStrictWideLinesUseParallelogram),
6560
6561 // VkPhysicalDeviceMaintenance6PropertiesKHR
6562 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, blockTexelViewCompatibleMultipleLayers),
6563 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, maxCombinedImageSamplerDescriptorCount),
6564 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, fragmentShadingRateClampCombinerInputs),
6565
6566 // VkPhysicalDevicePushDescriptorPropertiesKHR
6567 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, maxPushDescriptors),
6568
6569 // VkPhysicalDeviceVertexAttributeDivisorPropertiesKHR
6570 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, maxVertexAttribDivisor),
6571 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, supportsNonZeroFirstInstance),
6572
6573 // VkPhysicalDeviceHostImageCopyPropertiesEXT
6574 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, copySrcLayoutCount),
6575 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, copyDstLayoutCount),
6576 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, optimalTilingLayoutUUID),
6577 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, identicalMemoryTypeRequirements),
6578
6579 // VkPhysicalDevicePipelineRobustnessPropertiesEXT
6580 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, defaultRobustnessStorageBuffers),
6581 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, defaultRobustnessUniformBuffers),
6582 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, defaultRobustnessVertexInputs),
6583 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan14Properties, defaultRobustnessImages),
6584 {0, 0}};
6585
6586 TestLog &log = context.getTestContext().getLog();
6587 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
6588 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
6589 const InstanceDriver &vki = instance.getDriver();
6590 const uint32_t vulkan14PropertiesBufferSize = sizeof(VkPhysicalDeviceVulkan14Properties) + GUARD_SIZE;
6591 VkPhysicalDeviceProperties2 extProperties;
6592 uint8_t buffer14a[vulkan14PropertiesBufferSize];
6593 uint8_t buffer14b[vulkan14PropertiesBufferSize];
6594 const int count = 2u;
6595 VkPhysicalDeviceVulkan14Properties *vulkan14Properties[count] = {(VkPhysicalDeviceVulkan14Properties *)(buffer14a),
6596 (VkPhysicalDeviceVulkan14Properties *)(buffer14b)};
6597 std::vector<VkImageLayout> copyLayouts[count];
6598
6599 if (!context.contextSupports(vk::ApiVersion(0, 1, 4, 0)))
6600 TCU_THROW(NotSupportedError, "At least Vulkan 1.4 required to run test");
6601
6602 deMemset(buffer14a, GUARD_VALUE, sizeof(buffer14a));
6603 deMemset(buffer14b, GUARD_VALUE, sizeof(buffer14b));
6604
6605 for (int ndx = 0; ndx < count; ++ndx)
6606 {
6607 deMemset(vulkan14Properties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan14Properties));
6608 vulkan14Properties[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_4_PROPERTIES;
6609 vulkan14Properties[ndx]->pNext = DE_NULL;
6610 vulkan14Properties[ndx]->pCopySrcLayouts = DE_NULL;
6611 vulkan14Properties[ndx]->pCopyDstLayouts = DE_NULL;
6612
6613 extProperties = initVulkanStructure(vulkan14Properties[ndx]);
6614
6615 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
6616
6617 // safety check in case large array counts are returned
6618 if ((vulkan14Properties[ndx]->copyDstLayoutCount + vulkan14Properties[ndx]->copySrcLayoutCount) > GUARD_VALUE)
6619 return tcu::TestStatus::fail("Wrong layouts count");
6620
6621 // set pCopySrcLayouts / pCopyDstLayouts to allocated array and query again
6622 copyLayouts[ndx].resize(vulkan14Properties[ndx]->copyDstLayoutCount +
6623 vulkan14Properties[ndx]->copySrcLayoutCount);
6624 vulkan14Properties[ndx]->pCopySrcLayouts = copyLayouts[ndx].data();
6625 vulkan14Properties[ndx]->pCopyDstLayouts =
6626 copyLayouts[ndx].data() + vulkan14Properties[ndx]->copySrcLayoutCount;
6627 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
6628 }
6629
6630 log << TestLog::Message << *vulkan14Properties[0] << TestLog::EndMessage;
6631
6632 if (!validateStructsWithGuard(properties14OffsetTable, vulkan14Properties, GUARD_VALUE, GUARD_SIZE))
6633 {
6634 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceVulkan14Properties initialization failure"
6635 << TestLog::EndMessage;
6636
6637 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan14Properties initialization failure");
6638 }
6639
6640 // validation of pCopySrcLayouts / pCopyDstLayouts needs to be done separately
6641 // because the size of those arrays is not know at compile time
6642 if ((deMemCmp(vulkan14Properties[0]->pCopySrcLayouts, vulkan14Properties[1]->pCopySrcLayouts,
6643 vulkan14Properties[0]->copySrcLayoutCount * sizeof(VkImageLayout)) != 0) ||
6644 (deMemCmp(vulkan14Properties[0]->pCopyDstLayouts, vulkan14Properties[1]->pCopyDstLayouts,
6645 vulkan14Properties[0]->copyDstLayoutCount * sizeof(VkImageLayout)) != 0))
6646 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan14Properties initialization failure");
6647
6648 return tcu::TestStatus::pass("Querying Vulkan 1.4 device properties succeeded");
6649 }
6650 #endif // CTS_USES_VULKANSC
6651
deviceFeatureExtensionsConsistencyVulkan12(Context & context)6652 tcu::TestStatus deviceFeatureExtensionsConsistencyVulkan12(Context &context)
6653 {
6654 TestLog &log = context.getTestContext().getLog();
6655 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
6656 const InstanceDriver &vki = instance.getDriver();
6657 const VkPhysicalDevice physicalDevice(chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
6658
6659 if (!context.contextSupports(vk::ApiVersion(0, 1, 2, 0)))
6660 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
6661
6662 VkPhysicalDeviceVulkan12Features vulkan12Features = initVulkanStructure();
6663 VkPhysicalDeviceVulkan11Features vulkan11Features = initVulkanStructure(&vulkan12Features);
6664 VkPhysicalDeviceFeatures2 extFeatures = initVulkanStructure(&vulkan11Features);
6665
6666 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
6667
6668 log << TestLog::Message << vulkan11Features << TestLog::EndMessage;
6669 log << TestLog::Message << vulkan12Features << TestLog::EndMessage;
6670
6671 // Where promoted extensions didn't originally have feature structs, validate that the feature bits are set
6672 // when the extension is supported. (These checks could go in the extension's mandatory_features check, but
6673 // they're checked here because the extensions came first, so adding the extra dependency there seems odd.
6674 std::pair<std::pair<const char *, const char *>, VkBool32> extensions2validate[] = {
6675 {{"VK_KHR_sampler_mirror_clamp_to_edge", "VkPhysicalDeviceVulkan12Features.samplerMirrorClampToEdge"},
6676 vulkan12Features.samplerMirrorClampToEdge},
6677 {{"VK_KHR_draw_indirect_count", "VkPhysicalDeviceVulkan12Features.drawIndirectCount"},
6678 vulkan12Features.drawIndirectCount},
6679 {{"VK_EXT_descriptor_indexing", "VkPhysicalDeviceVulkan12Features.descriptorIndexing"},
6680 vulkan12Features.descriptorIndexing},
6681 {{"VK_EXT_sampler_filter_minmax", "VkPhysicalDeviceVulkan12Features.samplerFilterMinmax"},
6682 vulkan12Features.samplerFilterMinmax},
6683 {{"VK_EXT_shader_viewport_index_layer", "VkPhysicalDeviceVulkan12Features.shaderOutputViewportIndex"},
6684 vulkan12Features.shaderOutputViewportIndex},
6685 {{"VK_EXT_shader_viewport_index_layer", "VkPhysicalDeviceVulkan12Features.shaderOutputLayer"},
6686 vulkan12Features.shaderOutputLayer}};
6687 vector<VkExtensionProperties> extensionProperties =
6688 enumerateDeviceExtensionProperties(vki, physicalDevice, nullptr);
6689 for (const auto &ext : extensions2validate)
6690 if (checkExtension(extensionProperties, ext.first.first) && !ext.second)
6691 TCU_FAIL(string("Mismatch between extension ") + ext.first.first + " and " + ext.first.second);
6692
6693 // collect all extension features
6694 {
6695 VkPhysicalDevice16BitStorageFeatures device16BitStorageFeatures = initVulkanStructure();
6696 VkPhysicalDeviceMultiviewFeatures deviceMultiviewFeatures = initVulkanStructure(&device16BitStorageFeatures);
6697 VkPhysicalDeviceProtectedMemoryFeatures protectedMemoryFeatures = initVulkanStructure(&deviceMultiviewFeatures);
6698 VkPhysicalDeviceSamplerYcbcrConversionFeatures samplerYcbcrConversionFeatures =
6699 initVulkanStructure(&protectedMemoryFeatures);
6700 VkPhysicalDeviceShaderDrawParametersFeatures shaderDrawParametersFeatures =
6701 initVulkanStructure(&samplerYcbcrConversionFeatures);
6702 VkPhysicalDeviceVariablePointersFeatures variablePointerFeatures =
6703 initVulkanStructure(&shaderDrawParametersFeatures);
6704 VkPhysicalDevice8BitStorageFeatures device8BitStorageFeatures = initVulkanStructure(&variablePointerFeatures);
6705 VkPhysicalDeviceShaderAtomicInt64Features shaderAtomicInt64Features =
6706 initVulkanStructure(&device8BitStorageFeatures);
6707 VkPhysicalDeviceShaderFloat16Int8Features shaderFloat16Int8Features =
6708 initVulkanStructure(&shaderAtomicInt64Features);
6709 VkPhysicalDeviceDescriptorIndexingFeatures descriptorIndexingFeatures =
6710 initVulkanStructure(&shaderFloat16Int8Features);
6711 VkPhysicalDeviceScalarBlockLayoutFeatures scalarBlockLayoutFeatures =
6712 initVulkanStructure(&descriptorIndexingFeatures);
6713 VkPhysicalDeviceImagelessFramebufferFeatures imagelessFramebufferFeatures =
6714 initVulkanStructure(&scalarBlockLayoutFeatures);
6715 VkPhysicalDeviceUniformBufferStandardLayoutFeatures uniformBufferStandardLayoutFeatures =
6716 initVulkanStructure(&imagelessFramebufferFeatures);
6717 VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures shaderSubgroupExtendedTypesFeatures =
6718 initVulkanStructure(&uniformBufferStandardLayoutFeatures);
6719 VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures separateDepthStencilLayoutsFeatures =
6720 initVulkanStructure(&shaderSubgroupExtendedTypesFeatures);
6721 VkPhysicalDeviceHostQueryResetFeatures hostQueryResetFeatures =
6722 initVulkanStructure(&separateDepthStencilLayoutsFeatures);
6723 VkPhysicalDeviceTimelineSemaphoreFeatures timelineSemaphoreFeatures =
6724 initVulkanStructure(&hostQueryResetFeatures);
6725 VkPhysicalDeviceBufferDeviceAddressFeatures bufferDeviceAddressFeatures =
6726 initVulkanStructure(&timelineSemaphoreFeatures);
6727 VkPhysicalDeviceVulkanMemoryModelFeatures vulkanMemoryModelFeatures =
6728 initVulkanStructure(&bufferDeviceAddressFeatures);
6729 extFeatures = initVulkanStructure(&vulkanMemoryModelFeatures);
6730
6731 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
6732
6733 log << TestLog::Message << extFeatures << TestLog::EndMessage;
6734 log << TestLog::Message << device16BitStorageFeatures << TestLog::EndMessage;
6735 log << TestLog::Message << deviceMultiviewFeatures << TestLog::EndMessage;
6736 log << TestLog::Message << protectedMemoryFeatures << TestLog::EndMessage;
6737 log << TestLog::Message << samplerYcbcrConversionFeatures << TestLog::EndMessage;
6738 log << TestLog::Message << shaderDrawParametersFeatures << TestLog::EndMessage;
6739 log << TestLog::Message << variablePointerFeatures << TestLog::EndMessage;
6740 log << TestLog::Message << device8BitStorageFeatures << TestLog::EndMessage;
6741 log << TestLog::Message << shaderAtomicInt64Features << TestLog::EndMessage;
6742 log << TestLog::Message << shaderFloat16Int8Features << TestLog::EndMessage;
6743 log << TestLog::Message << descriptorIndexingFeatures << TestLog::EndMessage;
6744 log << TestLog::Message << scalarBlockLayoutFeatures << TestLog::EndMessage;
6745 log << TestLog::Message << imagelessFramebufferFeatures << TestLog::EndMessage;
6746 log << TestLog::Message << uniformBufferStandardLayoutFeatures << TestLog::EndMessage;
6747 log << TestLog::Message << shaderSubgroupExtendedTypesFeatures << TestLog::EndMessage;
6748 log << TestLog::Message << separateDepthStencilLayoutsFeatures << TestLog::EndMessage;
6749 log << TestLog::Message << hostQueryResetFeatures << TestLog::EndMessage;
6750 log << TestLog::Message << timelineSemaphoreFeatures << TestLog::EndMessage;
6751 log << TestLog::Message << bufferDeviceAddressFeatures << TestLog::EndMessage;
6752 log << TestLog::Message << vulkanMemoryModelFeatures << TestLog::EndMessage;
6753
6754 // First verify the 1.1 feature struct consistency because that struct is newly added in 1.2
6755 if ((device16BitStorageFeatures.storageBuffer16BitAccess != vulkan11Features.storageBuffer16BitAccess ||
6756 device16BitStorageFeatures.uniformAndStorageBuffer16BitAccess !=
6757 vulkan11Features.uniformAndStorageBuffer16BitAccess ||
6758 device16BitStorageFeatures.storagePushConstant16 != vulkan11Features.storagePushConstant16 ||
6759 device16BitStorageFeatures.storageInputOutput16 != vulkan11Features.storageInputOutput16))
6760 {
6761 TCU_FAIL("Mismatch between VkPhysicalDevice16BitStorageFeatures and VkPhysicalDeviceVulkan11Features");
6762 }
6763
6764 if ((deviceMultiviewFeatures.multiview != vulkan11Features.multiview ||
6765 deviceMultiviewFeatures.multiviewGeometryShader != vulkan11Features.multiviewGeometryShader ||
6766 deviceMultiviewFeatures.multiviewTessellationShader != vulkan11Features.multiviewTessellationShader))
6767 {
6768 TCU_FAIL("Mismatch between VkPhysicalDeviceMultiviewFeatures and VkPhysicalDeviceVulkan11Features");
6769 }
6770
6771 if ((protectedMemoryFeatures.protectedMemory != vulkan11Features.protectedMemory))
6772 {
6773 TCU_FAIL("Mismatch between VkPhysicalDeviceProtectedMemoryFeatures and VkPhysicalDeviceVulkan11Features");
6774 }
6775
6776 if ((samplerYcbcrConversionFeatures.samplerYcbcrConversion != vulkan11Features.samplerYcbcrConversion))
6777 {
6778 TCU_FAIL(
6779 "Mismatch between VkPhysicalDeviceSamplerYcbcrConversionFeatures and VkPhysicalDeviceVulkan11Features");
6780 }
6781
6782 if ((shaderDrawParametersFeatures.shaderDrawParameters != vulkan11Features.shaderDrawParameters))
6783 {
6784 TCU_FAIL(
6785 "Mismatch between VkPhysicalDeviceShaderDrawParametersFeatures and VkPhysicalDeviceVulkan11Features");
6786 }
6787
6788 if ((variablePointerFeatures.variablePointersStorageBuffer != vulkan11Features.variablePointersStorageBuffer ||
6789 variablePointerFeatures.variablePointers != vulkan11Features.variablePointers))
6790 {
6791 TCU_FAIL("Mismatch between VkPhysicalDeviceVariablePointersFeatures and VkPhysicalDeviceVulkan11Features");
6792 }
6793
6794 // Now check the consistency of the 1.2 feature struct
6795 if ((device8BitStorageFeatures.storageBuffer8BitAccess != vulkan12Features.storageBuffer8BitAccess ||
6796 device8BitStorageFeatures.uniformAndStorageBuffer8BitAccess !=
6797 vulkan12Features.uniformAndStorageBuffer8BitAccess ||
6798 device8BitStorageFeatures.storagePushConstant8 != vulkan12Features.storagePushConstant8))
6799 {
6800 TCU_FAIL("Mismatch between VkPhysicalDevice8BitStorageFeatures and VkPhysicalDeviceVulkan12Features");
6801 }
6802
6803 if ((shaderAtomicInt64Features.shaderBufferInt64Atomics != vulkan12Features.shaderBufferInt64Atomics ||
6804 shaderAtomicInt64Features.shaderSharedInt64Atomics != vulkan12Features.shaderSharedInt64Atomics))
6805 {
6806 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderAtomicInt64Features and VkPhysicalDeviceVulkan12Features");
6807 }
6808
6809 if ((shaderFloat16Int8Features.shaderFloat16 != vulkan12Features.shaderFloat16 ||
6810 shaderFloat16Int8Features.shaderInt8 != vulkan12Features.shaderInt8))
6811 {
6812 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderFloat16Int8Features and VkPhysicalDeviceVulkan12Features");
6813 }
6814
6815 if (descriptorIndexingFeatures.shaderInputAttachmentArrayDynamicIndexing !=
6816 vulkan12Features.shaderInputAttachmentArrayDynamicIndexing ||
6817 descriptorIndexingFeatures.shaderUniformTexelBufferArrayDynamicIndexing !=
6818 vulkan12Features.shaderUniformTexelBufferArrayDynamicIndexing ||
6819 descriptorIndexingFeatures.shaderStorageTexelBufferArrayDynamicIndexing !=
6820 vulkan12Features.shaderStorageTexelBufferArrayDynamicIndexing ||
6821 descriptorIndexingFeatures.shaderUniformBufferArrayNonUniformIndexing !=
6822 vulkan12Features.shaderUniformBufferArrayNonUniformIndexing ||
6823 descriptorIndexingFeatures.shaderSampledImageArrayNonUniformIndexing !=
6824 vulkan12Features.shaderSampledImageArrayNonUniformIndexing ||
6825 descriptorIndexingFeatures.shaderStorageBufferArrayNonUniformIndexing !=
6826 vulkan12Features.shaderStorageBufferArrayNonUniformIndexing ||
6827 descriptorIndexingFeatures.shaderStorageImageArrayNonUniformIndexing !=
6828 vulkan12Features.shaderStorageImageArrayNonUniformIndexing ||
6829 descriptorIndexingFeatures.shaderInputAttachmentArrayNonUniformIndexing !=
6830 vulkan12Features.shaderInputAttachmentArrayNonUniformIndexing ||
6831 descriptorIndexingFeatures.shaderUniformTexelBufferArrayNonUniformIndexing !=
6832 vulkan12Features.shaderUniformTexelBufferArrayNonUniformIndexing ||
6833 descriptorIndexingFeatures.shaderStorageTexelBufferArrayNonUniformIndexing !=
6834 vulkan12Features.shaderStorageTexelBufferArrayNonUniformIndexing ||
6835 descriptorIndexingFeatures.descriptorBindingUniformBufferUpdateAfterBind !=
6836 vulkan12Features.descriptorBindingUniformBufferUpdateAfterBind ||
6837 descriptorIndexingFeatures.descriptorBindingSampledImageUpdateAfterBind !=
6838 vulkan12Features.descriptorBindingSampledImageUpdateAfterBind ||
6839 descriptorIndexingFeatures.descriptorBindingStorageImageUpdateAfterBind !=
6840 vulkan12Features.descriptorBindingStorageImageUpdateAfterBind ||
6841 descriptorIndexingFeatures.descriptorBindingStorageBufferUpdateAfterBind !=
6842 vulkan12Features.descriptorBindingStorageBufferUpdateAfterBind ||
6843 descriptorIndexingFeatures.descriptorBindingUniformTexelBufferUpdateAfterBind !=
6844 vulkan12Features.descriptorBindingUniformTexelBufferUpdateAfterBind ||
6845 descriptorIndexingFeatures.descriptorBindingStorageTexelBufferUpdateAfterBind !=
6846 vulkan12Features.descriptorBindingStorageTexelBufferUpdateAfterBind ||
6847 descriptorIndexingFeatures.descriptorBindingUpdateUnusedWhilePending !=
6848 vulkan12Features.descriptorBindingUpdateUnusedWhilePending ||
6849 descriptorIndexingFeatures.descriptorBindingPartiallyBound !=
6850 vulkan12Features.descriptorBindingPartiallyBound ||
6851 descriptorIndexingFeatures.descriptorBindingVariableDescriptorCount !=
6852 vulkan12Features.descriptorBindingVariableDescriptorCount ||
6853 descriptorIndexingFeatures.runtimeDescriptorArray != vulkan12Features.runtimeDescriptorArray)
6854 {
6855 TCU_FAIL(
6856 "Mismatch between VkPhysicalDeviceDescriptorIndexingFeatures and VkPhysicalDeviceVulkan12Features");
6857 }
6858
6859 if ((scalarBlockLayoutFeatures.scalarBlockLayout != vulkan12Features.scalarBlockLayout))
6860 {
6861 TCU_FAIL("Mismatch between VkPhysicalDeviceScalarBlockLayoutFeatures and VkPhysicalDeviceVulkan12Features");
6862 }
6863
6864 if ((imagelessFramebufferFeatures.imagelessFramebuffer != vulkan12Features.imagelessFramebuffer))
6865 {
6866 TCU_FAIL(
6867 "Mismatch between VkPhysicalDeviceImagelessFramebufferFeatures and VkPhysicalDeviceVulkan12Features");
6868 }
6869
6870 if ((uniformBufferStandardLayoutFeatures.uniformBufferStandardLayout !=
6871 vulkan12Features.uniformBufferStandardLayout))
6872 {
6873 TCU_FAIL("Mismatch between VkPhysicalDeviceUniformBufferStandardLayoutFeatures and "
6874 "VkPhysicalDeviceVulkan12Features");
6875 }
6876
6877 if ((shaderSubgroupExtendedTypesFeatures.shaderSubgroupExtendedTypes !=
6878 vulkan12Features.shaderSubgroupExtendedTypes))
6879 {
6880 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures and "
6881 "VkPhysicalDeviceVulkan12Features");
6882 }
6883
6884 if ((separateDepthStencilLayoutsFeatures.separateDepthStencilLayouts !=
6885 vulkan12Features.separateDepthStencilLayouts))
6886 {
6887 TCU_FAIL("Mismatch between VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures and "
6888 "VkPhysicalDeviceVulkan12Features");
6889 }
6890
6891 if ((hostQueryResetFeatures.hostQueryReset != vulkan12Features.hostQueryReset))
6892 {
6893 TCU_FAIL("Mismatch between VkPhysicalDeviceHostQueryResetFeatures and VkPhysicalDeviceVulkan12Features");
6894 }
6895
6896 if ((timelineSemaphoreFeatures.timelineSemaphore != vulkan12Features.timelineSemaphore))
6897 {
6898 TCU_FAIL("Mismatch between VkPhysicalDeviceTimelineSemaphoreFeatures and VkPhysicalDeviceVulkan12Features");
6899 }
6900
6901 if ((bufferDeviceAddressFeatures.bufferDeviceAddress != vulkan12Features.bufferDeviceAddress ||
6902 bufferDeviceAddressFeatures.bufferDeviceAddressCaptureReplay !=
6903 vulkan12Features.bufferDeviceAddressCaptureReplay ||
6904 bufferDeviceAddressFeatures.bufferDeviceAddressMultiDevice !=
6905 vulkan12Features.bufferDeviceAddressMultiDevice))
6906 {
6907 TCU_FAIL(
6908 "Mismatch between VkPhysicalDeviceBufferDeviceAddressFeatures and VkPhysicalDeviceVulkan12Features");
6909 }
6910
6911 if ((vulkanMemoryModelFeatures.vulkanMemoryModel != vulkan12Features.vulkanMemoryModel ||
6912 vulkanMemoryModelFeatures.vulkanMemoryModelDeviceScope != vulkan12Features.vulkanMemoryModelDeviceScope ||
6913 vulkanMemoryModelFeatures.vulkanMemoryModelAvailabilityVisibilityChains !=
6914 vulkan12Features.vulkanMemoryModelAvailabilityVisibilityChains))
6915 {
6916 TCU_FAIL("Mismatch between VkPhysicalDeviceVulkanMemoryModelFeatures and VkPhysicalDeviceVulkan12Features");
6917 }
6918 }
6919
6920 return tcu::TestStatus::pass("Vulkan 1.2 device features are consistent with extensions");
6921 }
6922
6923 #ifndef CTS_USES_VULKANSC
deviceFeatureExtensionsConsistencyVulkan14(Context & context)6924 tcu::TestStatus deviceFeatureExtensionsConsistencyVulkan14(Context &context)
6925 {
6926 TestLog &log = context.getTestContext().getLog();
6927 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
6928 const CustomInstance instance =
6929 createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2");
6930 const InstanceDriver &vki = instance.getDriver();
6931
6932 if (!context.contextSupports(vk::ApiVersion(0, 1, 4, 0)))
6933 TCU_THROW(NotSupportedError, "At least Vulkan 1.4 required to run test");
6934
6935 VkPhysicalDeviceVulkan14Features vulkan14Features = initVulkanStructure();
6936 VkPhysicalDeviceFeatures2 extFeatures = initVulkanStructure(&vulkan14Features);
6937
6938 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
6939
6940 log << TestLog::Message << vulkan14Features << TestLog::EndMessage;
6941
6942 // collect all extension features
6943 {
6944 VkPhysicalDeviceDynamicRenderingLocalReadFeaturesKHR dynamicRenderingLocalReadFeatures = initVulkanStructure();
6945 VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR globalPriorityQueryFeatures =
6946 initVulkanStructure(&dynamicRenderingLocalReadFeatures);
6947 VkPhysicalDeviceIndexTypeUint8FeaturesKHR indexTypeUint8Features =
6948 initVulkanStructure(&globalPriorityQueryFeatures);
6949 VkPhysicalDeviceLineRasterizationFeaturesKHR lineRasterizationFeatures =
6950 initVulkanStructure(&indexTypeUint8Features);
6951 VkPhysicalDeviceMaintenance5FeaturesKHR maintenance5Features = initVulkanStructure(&lineRasterizationFeatures);
6952 VkPhysicalDeviceMaintenance6FeaturesKHR maintenance6Features = initVulkanStructure(&maintenance5Features);
6953 VkPhysicalDeviceShaderExpectAssumeFeaturesKHR shaderExpectAssumeFeatures =
6954 initVulkanStructure(&maintenance6Features);
6955 VkPhysicalDeviceShaderFloatControls2FeaturesKHR shaderFloatControls2Features =
6956 initVulkanStructure(&shaderExpectAssumeFeatures);
6957 VkPhysicalDeviceShaderSubgroupRotateFeaturesKHR shaderSubgroupRotateFeatures =
6958 initVulkanStructure(&shaderFloatControls2Features);
6959 VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR vertexAttributeDivisorFeatures =
6960 initVulkanStructure(&shaderSubgroupRotateFeatures);
6961 VkPhysicalDeviceHostImageCopyFeaturesEXT hostImageCopyFeatures =
6962 initVulkanStructure(&vertexAttributeDivisorFeatures);
6963 VkPhysicalDevicePipelineProtectedAccessFeaturesEXT pipelineProtectedAccessFeatures =
6964 initVulkanStructure(&hostImageCopyFeatures);
6965 VkPhysicalDevicePipelineRobustnessFeaturesEXT pipelineRobustnessFeatures =
6966 initVulkanStructure(&pipelineProtectedAccessFeatures);
6967
6968 extFeatures = initVulkanStructure(&pipelineRobustnessFeatures);
6969
6970 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
6971
6972 log << TestLog::Message << extFeatures << TestLog::EndMessage;
6973 log << TestLog::Message << dynamicRenderingLocalReadFeatures << TestLog::EndMessage;
6974 log << TestLog::Message << globalPriorityQueryFeatures << TestLog::EndMessage;
6975 log << TestLog::Message << indexTypeUint8Features << TestLog::EndMessage;
6976 log << TestLog::Message << lineRasterizationFeatures << TestLog::EndMessage;
6977 log << TestLog::Message << maintenance5Features << TestLog::EndMessage;
6978 log << TestLog::Message << maintenance6Features << TestLog::EndMessage;
6979 log << TestLog::Message << shaderExpectAssumeFeatures << TestLog::EndMessage;
6980 log << TestLog::Message << shaderFloatControls2Features << TestLog::EndMessage;
6981 log << TestLog::Message << shaderSubgroupRotateFeatures << TestLog::EndMessage;
6982 log << TestLog::Message << vertexAttributeDivisorFeatures << TestLog::EndMessage;
6983 log << TestLog::Message << hostImageCopyFeatures << TestLog::EndMessage;
6984 log << TestLog::Message << pipelineProtectedAccessFeatures << TestLog::EndMessage;
6985 log << TestLog::Message << pipelineRobustnessFeatures << TestLog::EndMessage;
6986
6987 if (dynamicRenderingLocalReadFeatures.dynamicRenderingLocalRead != vulkan14Features.dynamicRenderingLocalRead)
6988 TCU_FAIL("Mismatch between VkPhysicalDeviceDynamicRenderingLocalReadFeaturesKHR and "
6989 "VkPhysicalDeviceVulkan14Features");
6990
6991 if (globalPriorityQueryFeatures.globalPriorityQuery != vulkan14Features.globalPriorityQuery)
6992 TCU_FAIL(
6993 "Mismatch between VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR and VkPhysicalDeviceVulkan14Features");
6994
6995 if (indexTypeUint8Features.indexTypeUint8 != vulkan14Features.indexTypeUint8)
6996 TCU_FAIL("Mismatch between VkPhysicalDeviceIndexTypeUint8FeaturesKHR and VkPhysicalDeviceVulkan14Features");
6997
6998 if ((lineRasterizationFeatures.rectangularLines != vulkan14Features.rectangularLines) ||
6999 (lineRasterizationFeatures.bresenhamLines != vulkan14Features.bresenhamLines) ||
7000 (lineRasterizationFeatures.smoothLines != vulkan14Features.smoothLines) ||
7001 (lineRasterizationFeatures.stippledRectangularLines != vulkan14Features.stippledRectangularLines) ||
7002 (lineRasterizationFeatures.stippledBresenhamLines != vulkan14Features.stippledBresenhamLines) ||
7003 (lineRasterizationFeatures.stippledSmoothLines != vulkan14Features.stippledSmoothLines))
7004 TCU_FAIL(
7005 "Mismatch between VkPhysicalDeviceLineRasterizationFeaturesKHR and VkPhysicalDeviceVulkan14Features");
7006
7007 if (maintenance5Features.maintenance5 != vulkan14Features.maintenance5)
7008 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance5FeaturesKHR and VkPhysicalDeviceVulkan14Features");
7009
7010 if (maintenance6Features.maintenance6 != vulkan14Features.maintenance6)
7011 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance6FeaturesKHR and VkPhysicalDeviceVulkan14Features");
7012
7013 if (shaderExpectAssumeFeatures.shaderExpectAssume != vulkan14Features.shaderExpectAssume)
7014 TCU_FAIL(
7015 "Mismatch between VkPhysicalDeviceShaderExpectAssumeFeatures and VkPhysicalDeviceVulkan14Features");
7016
7017 if (shaderFloatControls2Features.shaderFloatControls2 != vulkan14Features.shaderFloatControls2)
7018 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderFloatControls2FeaturesKHR and "
7019 "VkPhysicalDeviceVulkan14Features");
7020
7021 if ((shaderSubgroupRotateFeatures.shaderSubgroupRotate != vulkan14Features.shaderSubgroupRotate) ||
7022 (shaderSubgroupRotateFeatures.shaderSubgroupRotateClustered !=
7023 vulkan14Features.shaderSubgroupRotateClustered))
7024 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderSubgroupRotateFeaturesKHR and "
7025 "VkPhysicalDeviceVulkan14Features");
7026
7027 if ((vertexAttributeDivisorFeatures.vertexAttributeInstanceRateDivisor !=
7028 vulkan14Features.vertexAttributeInstanceRateDivisor) ||
7029 (vertexAttributeDivisorFeatures.vertexAttributeInstanceRateZeroDivisor !=
7030 vulkan14Features.vertexAttributeInstanceRateZeroDivisor))
7031 TCU_FAIL("Mismatch between VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR and "
7032 "VkPhysicalDeviceVulkan14Features");
7033
7034 if (hostImageCopyFeatures.hostImageCopy != vulkan14Features.hostImageCopy)
7035 TCU_FAIL("Mismatch between VkPhysicalDeviceHostImageCopyFeaturesEXT and VkPhysicalDeviceVulkan14Features");
7036
7037 if (pipelineProtectedAccessFeatures.pipelineProtectedAccess != vulkan14Features.pipelineProtectedAccess)
7038 TCU_FAIL("Mismatch between VkPhysicalDevicePipelineProtectedAccessFeaturesEXT and "
7039 "VkPhysicalDeviceVulkan14Features");
7040
7041 if (pipelineRobustnessFeatures.pipelineRobustness != vulkan14Features.pipelineRobustness)
7042 TCU_FAIL(
7043 "Mismatch between VkPhysicalDevicePipelineRobustnessFeaturesEXT and VkPhysicalDeviceVulkan14Features");
7044 }
7045
7046 return tcu::TestStatus::pass("Vulkan 1.4 device features are consistent with extensions");
7047 }
7048
deviceFeatureExtensionsConsistencyVulkan13(Context & context)7049 tcu::TestStatus deviceFeatureExtensionsConsistencyVulkan13(Context &context)
7050 {
7051 TestLog &log = context.getTestContext().getLog();
7052 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
7053 const CustomInstance instance =
7054 createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2");
7055 const InstanceDriver &vki = instance.getDriver();
7056
7057 if (!context.contextSupports(vk::ApiVersion(0, 1, 3, 0)))
7058 TCU_THROW(NotSupportedError, "At least Vulkan 1.3 required to run test");
7059
7060 VkPhysicalDeviceVulkan13Features vulkan13Features = initVulkanStructure();
7061 VkPhysicalDeviceFeatures2 extFeatures = initVulkanStructure(&vulkan13Features);
7062
7063 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
7064
7065 log << TestLog::Message << vulkan13Features << TestLog::EndMessage;
7066
7067 // collect all extension features
7068 {
7069 VkPhysicalDeviceImageRobustnessFeatures imageRobustnessFeatures = initVulkanStructure();
7070 VkPhysicalDeviceInlineUniformBlockFeatures inlineUniformBlockFeatures =
7071 initVulkanStructure(&imageRobustnessFeatures);
7072 VkPhysicalDevicePipelineCreationCacheControlFeatures pipelineCreationCacheControlFeatures =
7073 initVulkanStructure(&inlineUniformBlockFeatures);
7074 VkPhysicalDevicePrivateDataFeatures privateDataFeatures =
7075 initVulkanStructure(&pipelineCreationCacheControlFeatures);
7076 VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures shaderDemoteToHelperInvocationFeatures =
7077 initVulkanStructure(&privateDataFeatures);
7078 VkPhysicalDeviceShaderTerminateInvocationFeatures shaderTerminateInvocationFeatures =
7079 initVulkanStructure(&shaderDemoteToHelperInvocationFeatures);
7080 VkPhysicalDeviceSubgroupSizeControlFeatures subgroupSizeControlFeatures =
7081 initVulkanStructure(&shaderTerminateInvocationFeatures);
7082 VkPhysicalDeviceSynchronization2Features synchronization2Features =
7083 initVulkanStructure(&subgroupSizeControlFeatures);
7084 VkPhysicalDeviceTextureCompressionASTCHDRFeatures textureCompressionASTCHDRFeatures =
7085 initVulkanStructure(&synchronization2Features);
7086 VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures zeroInitializeWorkgroupMemoryFeatures =
7087 initVulkanStructure(&textureCompressionASTCHDRFeatures);
7088 VkPhysicalDeviceDynamicRenderingFeatures dynamicRenderingFeatures =
7089 initVulkanStructure(&zeroInitializeWorkgroupMemoryFeatures);
7090 VkPhysicalDeviceShaderIntegerDotProductFeatures shaderIntegerDotProductFeatures =
7091 initVulkanStructure(&dynamicRenderingFeatures);
7092 VkPhysicalDeviceMaintenance4Features maintenance4Features =
7093 initVulkanStructure(&shaderIntegerDotProductFeatures);
7094
7095 extFeatures = initVulkanStructure(&maintenance4Features);
7096
7097 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
7098
7099 log << TestLog::Message << extFeatures << TestLog::EndMessage;
7100 log << TestLog::Message << imageRobustnessFeatures << TestLog::EndMessage;
7101 log << TestLog::Message << inlineUniformBlockFeatures << TestLog::EndMessage;
7102 log << TestLog::Message << pipelineCreationCacheControlFeatures << TestLog::EndMessage;
7103 log << TestLog::Message << privateDataFeatures << TestLog::EndMessage;
7104 log << TestLog::Message << shaderDemoteToHelperInvocationFeatures << TestLog::EndMessage;
7105 log << TestLog::Message << shaderTerminateInvocationFeatures << TestLog::EndMessage;
7106 log << TestLog::Message << subgroupSizeControlFeatures << TestLog::EndMessage;
7107 log << TestLog::Message << synchronization2Features << TestLog::EndMessage;
7108 log << TestLog::Message << textureCompressionASTCHDRFeatures << TestLog::EndMessage;
7109 log << TestLog::Message << zeroInitializeWorkgroupMemoryFeatures << TestLog::EndMessage;
7110 log << TestLog::Message << dynamicRenderingFeatures << TestLog::EndMessage;
7111 log << TestLog::Message << shaderIntegerDotProductFeatures << TestLog::EndMessage;
7112 log << TestLog::Message << maintenance4Features << TestLog::EndMessage;
7113
7114 if (imageRobustnessFeatures.robustImageAccess != vulkan13Features.robustImageAccess)
7115 TCU_FAIL("Mismatch between VkPhysicalDeviceImageRobustnessFeatures and VkPhysicalDeviceVulkan13Features");
7116
7117 if ((inlineUniformBlockFeatures.inlineUniformBlock != vulkan13Features.inlineUniformBlock) ||
7118 (inlineUniformBlockFeatures.descriptorBindingInlineUniformBlockUpdateAfterBind !=
7119 vulkan13Features.descriptorBindingInlineUniformBlockUpdateAfterBind))
7120 {
7121 TCU_FAIL(
7122 "Mismatch between VkPhysicalDeviceInlineUniformBlockFeatures and VkPhysicalDeviceVulkan13Features");
7123 }
7124
7125 if (pipelineCreationCacheControlFeatures.pipelineCreationCacheControl !=
7126 vulkan13Features.pipelineCreationCacheControl)
7127 TCU_FAIL("Mismatch between VkPhysicalDevicePipelineCreationCacheControlFeatures and "
7128 "VkPhysicalDeviceVulkan13Features");
7129
7130 if (privateDataFeatures.privateData != vulkan13Features.privateData)
7131 TCU_FAIL("Mismatch between VkPhysicalDevicePrivateDataFeatures and VkPhysicalDeviceVulkan13Features");
7132
7133 if (shaderDemoteToHelperInvocationFeatures.shaderDemoteToHelperInvocation !=
7134 vulkan13Features.shaderDemoteToHelperInvocation)
7135 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures and "
7136 "VkPhysicalDeviceVulkan13Features");
7137
7138 if (shaderTerminateInvocationFeatures.shaderTerminateInvocation != vulkan13Features.shaderTerminateInvocation)
7139 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderTerminateInvocationFeatures and "
7140 "VkPhysicalDeviceVulkan13Features");
7141
7142 if ((subgroupSizeControlFeatures.subgroupSizeControl != vulkan13Features.subgroupSizeControl) ||
7143 (subgroupSizeControlFeatures.computeFullSubgroups != vulkan13Features.computeFullSubgroups))
7144 {
7145 TCU_FAIL(
7146 "Mismatch between VkPhysicalDeviceSubgroupSizeControlFeatures and VkPhysicalDeviceVulkan13Features");
7147 }
7148
7149 if (synchronization2Features.synchronization2 != vulkan13Features.synchronization2)
7150 TCU_FAIL("Mismatch between VkPhysicalDeviceSynchronization2Features and VkPhysicalDeviceVulkan13Features");
7151
7152 if (textureCompressionASTCHDRFeatures.textureCompressionASTC_HDR != vulkan13Features.textureCompressionASTC_HDR)
7153 TCU_FAIL("Mismatch between VkPhysicalDeviceTextureCompressionASTCHDRFeatures and "
7154 "VkPhysicalDeviceVulkan13Features");
7155
7156 if (zeroInitializeWorkgroupMemoryFeatures.shaderZeroInitializeWorkgroupMemory !=
7157 vulkan13Features.shaderZeroInitializeWorkgroupMemory)
7158 TCU_FAIL("Mismatch between VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures and "
7159 "VkPhysicalDeviceVulkan13Features");
7160
7161 if (dynamicRenderingFeatures.dynamicRendering != vulkan13Features.dynamicRendering)
7162 TCU_FAIL("Mismatch between VkPhysicalDeviceDynamicRenderingFeatures and VkPhysicalDeviceVulkan13Features");
7163
7164 if (shaderIntegerDotProductFeatures.shaderIntegerDotProduct != vulkan13Features.shaderIntegerDotProduct)
7165 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderIntegerDotProductFeatures and "
7166 "VkPhysicalDeviceVulkan13Features");
7167
7168 if (maintenance4Features.maintenance4 != vulkan13Features.maintenance4)
7169 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance4Features and VkPhysicalDeviceVulkan13Features");
7170 }
7171
7172 return tcu::TestStatus::pass("Vulkan 1.3 device features are consistent with extensions");
7173 }
7174 #endif // CTS_USES_VULKANSC
7175
devicePropertyExtensionsConsistencyVulkan12(Context & context)7176 tcu::TestStatus devicePropertyExtensionsConsistencyVulkan12(Context &context)
7177 {
7178 TestLog &log = context.getTestContext().getLog();
7179 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
7180 const InstanceDriver &vki = instance.getDriver();
7181 const VkPhysicalDevice physicalDevice(chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
7182
7183 if (!context.contextSupports(vk::ApiVersion(0, 1, 2, 0)))
7184 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
7185
7186 VkPhysicalDeviceVulkan12Properties vulkan12Properties = initVulkanStructure();
7187 VkPhysicalDeviceVulkan11Properties vulkan11Properties = initVulkanStructure(&vulkan12Properties);
7188 VkPhysicalDeviceProperties2 extProperties = initVulkanStructure(&vulkan11Properties);
7189
7190 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
7191
7192 log << TestLog::Message << vulkan11Properties << TestLog::EndMessage;
7193 log << TestLog::Message << vulkan12Properties << TestLog::EndMessage;
7194
7195 // Validate all fields initialized matching to extension structures
7196 {
7197 VkPhysicalDeviceIDProperties idProperties = initVulkanStructure();
7198 VkPhysicalDeviceSubgroupProperties subgroupProperties = initVulkanStructure(&idProperties);
7199 VkPhysicalDevicePointClippingProperties pointClippingProperties = initVulkanStructure(&subgroupProperties);
7200 VkPhysicalDeviceMultiviewProperties multiviewProperties = initVulkanStructure(&pointClippingProperties);
7201 VkPhysicalDeviceProtectedMemoryProperties protectedMemoryPropertiesKHR =
7202 initVulkanStructure(&multiviewProperties);
7203 VkPhysicalDeviceMaintenance3Properties maintenance3Properties =
7204 initVulkanStructure(&protectedMemoryPropertiesKHR);
7205 VkPhysicalDeviceDriverProperties driverProperties = initVulkanStructure(&maintenance3Properties);
7206 VkPhysicalDeviceFloatControlsProperties floatControlsProperties = initVulkanStructure(&driverProperties);
7207 VkPhysicalDeviceDescriptorIndexingProperties descriptorIndexingProperties =
7208 initVulkanStructure(&floatControlsProperties);
7209 VkPhysicalDeviceDepthStencilResolveProperties depthStencilResolveProperties =
7210 initVulkanStructure(&descriptorIndexingProperties);
7211 VkPhysicalDeviceSamplerFilterMinmaxProperties samplerFilterMinmaxProperties =
7212 initVulkanStructure(&depthStencilResolveProperties);
7213 VkPhysicalDeviceTimelineSemaphoreProperties timelineSemaphoreProperties =
7214 initVulkanStructure(&samplerFilterMinmaxProperties);
7215 extProperties = initVulkanStructure(&timelineSemaphoreProperties);
7216
7217 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
7218
7219 if ((deMemCmp(idProperties.deviceUUID, vulkan11Properties.deviceUUID, VK_UUID_SIZE) != 0) ||
7220 (deMemCmp(idProperties.driverUUID, vulkan11Properties.driverUUID, VK_UUID_SIZE) != 0) ||
7221 (idProperties.deviceLUIDValid != vulkan11Properties.deviceLUIDValid))
7222 {
7223 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties and VkPhysicalDeviceVulkan11Properties");
7224 }
7225 else if (idProperties.deviceLUIDValid)
7226 {
7227 // If deviceLUIDValid is VK_FALSE, the contents of deviceLUID and deviceNodeMask are undefined
7228 // so thay can only be compared when deviceLUIDValid is VK_TRUE.
7229 if ((deMemCmp(idProperties.deviceLUID, vulkan11Properties.deviceLUID, VK_LUID_SIZE) != 0) ||
7230 (idProperties.deviceNodeMask != vulkan11Properties.deviceNodeMask))
7231 {
7232 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties and VkPhysicalDeviceVulkan11Properties");
7233 }
7234 }
7235
7236 if ((subgroupProperties.subgroupSize != vulkan11Properties.subgroupSize ||
7237 subgroupProperties.supportedStages != vulkan11Properties.subgroupSupportedStages ||
7238 subgroupProperties.supportedOperations != vulkan11Properties.subgroupSupportedOperations ||
7239 subgroupProperties.quadOperationsInAllStages != vulkan11Properties.subgroupQuadOperationsInAllStages))
7240 {
7241 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupProperties and VkPhysicalDeviceVulkan11Properties");
7242 }
7243
7244 if ((pointClippingProperties.pointClippingBehavior != vulkan11Properties.pointClippingBehavior))
7245 {
7246 TCU_FAIL("Mismatch between VkPhysicalDevicePointClippingProperties and VkPhysicalDeviceVulkan11Properties");
7247 }
7248
7249 if ((multiviewProperties.maxMultiviewViewCount != vulkan11Properties.maxMultiviewViewCount ||
7250 multiviewProperties.maxMultiviewInstanceIndex != vulkan11Properties.maxMultiviewInstanceIndex))
7251 {
7252 TCU_FAIL("Mismatch between VkPhysicalDeviceMultiviewProperties and VkPhysicalDeviceVulkan11Properties");
7253 }
7254
7255 if ((protectedMemoryPropertiesKHR.protectedNoFault != vulkan11Properties.protectedNoFault))
7256 {
7257 TCU_FAIL(
7258 "Mismatch between VkPhysicalDeviceProtectedMemoryProperties and VkPhysicalDeviceVulkan11Properties");
7259 }
7260
7261 if ((maintenance3Properties.maxPerSetDescriptors != vulkan11Properties.maxPerSetDescriptors ||
7262 maintenance3Properties.maxMemoryAllocationSize != vulkan11Properties.maxMemoryAllocationSize))
7263 {
7264 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance3Properties and VkPhysicalDeviceVulkan11Properties");
7265 }
7266
7267 if ((driverProperties.driverID != vulkan12Properties.driverID ||
7268 strncmp(driverProperties.driverName, vulkan12Properties.driverName, VK_MAX_DRIVER_NAME_SIZE) != 0 ||
7269 strncmp(driverProperties.driverInfo, vulkan12Properties.driverInfo, VK_MAX_DRIVER_INFO_SIZE) != 0 ||
7270 driverProperties.conformanceVersion.major != vulkan12Properties.conformanceVersion.major ||
7271 driverProperties.conformanceVersion.minor != vulkan12Properties.conformanceVersion.minor ||
7272 driverProperties.conformanceVersion.subminor != vulkan12Properties.conformanceVersion.subminor ||
7273 driverProperties.conformanceVersion.patch != vulkan12Properties.conformanceVersion.patch))
7274 {
7275 TCU_FAIL("Mismatch between VkPhysicalDeviceDriverProperties and VkPhysicalDeviceVulkan12Properties");
7276 }
7277
7278 if ((floatControlsProperties.denormBehaviorIndependence != vulkan12Properties.denormBehaviorIndependence ||
7279 floatControlsProperties.roundingModeIndependence != vulkan12Properties.roundingModeIndependence ||
7280 floatControlsProperties.shaderSignedZeroInfNanPreserveFloat16 !=
7281 vulkan12Properties.shaderSignedZeroInfNanPreserveFloat16 ||
7282 floatControlsProperties.shaderSignedZeroInfNanPreserveFloat32 !=
7283 vulkan12Properties.shaderSignedZeroInfNanPreserveFloat32 ||
7284 floatControlsProperties.shaderSignedZeroInfNanPreserveFloat64 !=
7285 vulkan12Properties.shaderSignedZeroInfNanPreserveFloat64 ||
7286 floatControlsProperties.shaderDenormPreserveFloat16 != vulkan12Properties.shaderDenormPreserveFloat16 ||
7287 floatControlsProperties.shaderDenormPreserveFloat32 != vulkan12Properties.shaderDenormPreserveFloat32 ||
7288 floatControlsProperties.shaderDenormPreserveFloat64 != vulkan12Properties.shaderDenormPreserveFloat64 ||
7289 floatControlsProperties.shaderDenormFlushToZeroFloat16 !=
7290 vulkan12Properties.shaderDenormFlushToZeroFloat16 ||
7291 floatControlsProperties.shaderDenormFlushToZeroFloat32 !=
7292 vulkan12Properties.shaderDenormFlushToZeroFloat32 ||
7293 floatControlsProperties.shaderDenormFlushToZeroFloat64 !=
7294 vulkan12Properties.shaderDenormFlushToZeroFloat64 ||
7295 floatControlsProperties.shaderRoundingModeRTEFloat16 != vulkan12Properties.shaderRoundingModeRTEFloat16 ||
7296 floatControlsProperties.shaderRoundingModeRTEFloat32 != vulkan12Properties.shaderRoundingModeRTEFloat32 ||
7297 floatControlsProperties.shaderRoundingModeRTEFloat64 != vulkan12Properties.shaderRoundingModeRTEFloat64 ||
7298 floatControlsProperties.shaderRoundingModeRTZFloat16 != vulkan12Properties.shaderRoundingModeRTZFloat16 ||
7299 floatControlsProperties.shaderRoundingModeRTZFloat32 != vulkan12Properties.shaderRoundingModeRTZFloat32 ||
7300 floatControlsProperties.shaderRoundingModeRTZFloat64 != vulkan12Properties.shaderRoundingModeRTZFloat64))
7301 {
7302 TCU_FAIL("Mismatch between VkPhysicalDeviceFloatControlsProperties and VkPhysicalDeviceVulkan12Properties");
7303 }
7304
7305 if ((descriptorIndexingProperties.maxUpdateAfterBindDescriptorsInAllPools !=
7306 vulkan12Properties.maxUpdateAfterBindDescriptorsInAllPools ||
7307 descriptorIndexingProperties.shaderUniformBufferArrayNonUniformIndexingNative !=
7308 vulkan12Properties.shaderUniformBufferArrayNonUniformIndexingNative ||
7309 descriptorIndexingProperties.shaderSampledImageArrayNonUniformIndexingNative !=
7310 vulkan12Properties.shaderSampledImageArrayNonUniformIndexingNative ||
7311 descriptorIndexingProperties.shaderStorageBufferArrayNonUniformIndexingNative !=
7312 vulkan12Properties.shaderStorageBufferArrayNonUniformIndexingNative ||
7313 descriptorIndexingProperties.shaderStorageImageArrayNonUniformIndexingNative !=
7314 vulkan12Properties.shaderStorageImageArrayNonUniformIndexingNative ||
7315 descriptorIndexingProperties.shaderInputAttachmentArrayNonUniformIndexingNative !=
7316 vulkan12Properties.shaderInputAttachmentArrayNonUniformIndexingNative ||
7317 descriptorIndexingProperties.robustBufferAccessUpdateAfterBind !=
7318 vulkan12Properties.robustBufferAccessUpdateAfterBind ||
7319 descriptorIndexingProperties.quadDivergentImplicitLod != vulkan12Properties.quadDivergentImplicitLod ||
7320 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSamplers !=
7321 vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSamplers ||
7322 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindUniformBuffers !=
7323 vulkan12Properties.maxPerStageDescriptorUpdateAfterBindUniformBuffers ||
7324 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageBuffers !=
7325 vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageBuffers ||
7326 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSampledImages !=
7327 vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSampledImages ||
7328 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageImages !=
7329 vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageImages ||
7330 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindInputAttachments !=
7331 vulkan12Properties.maxPerStageDescriptorUpdateAfterBindInputAttachments ||
7332 descriptorIndexingProperties.maxPerStageUpdateAfterBindResources !=
7333 vulkan12Properties.maxPerStageUpdateAfterBindResources ||
7334 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSamplers !=
7335 vulkan12Properties.maxDescriptorSetUpdateAfterBindSamplers ||
7336 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffers !=
7337 vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffers ||
7338 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic !=
7339 vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic ||
7340 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffers !=
7341 vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffers ||
7342 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic !=
7343 vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic ||
7344 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSampledImages !=
7345 vulkan12Properties.maxDescriptorSetUpdateAfterBindSampledImages ||
7346 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageImages !=
7347 vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageImages ||
7348 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindInputAttachments !=
7349 vulkan12Properties.maxDescriptorSetUpdateAfterBindInputAttachments))
7350 {
7351 TCU_FAIL(
7352 "Mismatch between VkPhysicalDeviceDescriptorIndexingProperties and VkPhysicalDeviceVulkan12Properties");
7353 }
7354
7355 if ((depthStencilResolveProperties.supportedDepthResolveModes !=
7356 vulkan12Properties.supportedDepthResolveModes ||
7357 depthStencilResolveProperties.supportedStencilResolveModes !=
7358 vulkan12Properties.supportedStencilResolveModes ||
7359 depthStencilResolveProperties.independentResolveNone != vulkan12Properties.independentResolveNone ||
7360 depthStencilResolveProperties.independentResolve != vulkan12Properties.independentResolve))
7361 {
7362 TCU_FAIL("Mismatch between VkPhysicalDeviceDepthStencilResolveProperties and "
7363 "VkPhysicalDeviceVulkan12Properties");
7364 }
7365
7366 if ((samplerFilterMinmaxProperties.filterMinmaxSingleComponentFormats !=
7367 vulkan12Properties.filterMinmaxSingleComponentFormats ||
7368 samplerFilterMinmaxProperties.filterMinmaxImageComponentMapping !=
7369 vulkan12Properties.filterMinmaxImageComponentMapping))
7370 {
7371 TCU_FAIL("Mismatch between VkPhysicalDeviceSamplerFilterMinmaxProperties and "
7372 "VkPhysicalDeviceVulkan12Properties");
7373 }
7374
7375 if ((timelineSemaphoreProperties.maxTimelineSemaphoreValueDifference !=
7376 vulkan12Properties.maxTimelineSemaphoreValueDifference))
7377 {
7378 TCU_FAIL(
7379 "Mismatch between VkPhysicalDeviceTimelineSemaphoreProperties and VkPhysicalDeviceVulkan12Properties");
7380 }
7381 }
7382
7383 return tcu::TestStatus::pass("Vulkan 1.2 device properties are consistent with extension properties");
7384 }
7385
7386 #ifndef CTS_USES_VULKANSC
checkSupportKhrShaderSubgroupRotate(Context & context)7387 void checkSupportKhrShaderSubgroupRotate(Context &context)
7388 {
7389 context.requireDeviceFunctionality("VK_KHR_shader_subgroup_rotate");
7390 }
7391
subgroupRotatePropertyExtensionFeatureConsistency(Context & context)7392 tcu::TestStatus subgroupRotatePropertyExtensionFeatureConsistency(Context &context)
7393 {
7394 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
7395 const InstanceDriver &vki = instance.getDriver();
7396 const VkPhysicalDevice physicalDevice(chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
7397
7398 const VkPhysicalDeviceSubgroupProperties &subgroupProperties = context.getSubgroupProperties();
7399 VkPhysicalDeviceShaderSubgroupRotateFeaturesKHR subgroupRotateFeatures = initVulkanStructure();
7400 VkPhysicalDeviceFeatures2 extFeatures = initVulkanStructure(&subgroupRotateFeatures);
7401
7402 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
7403
7404 // Need access to VkSubgroupFeatureFlagBits which are provided by Vulkan 1.1
7405 if (!context.contextSupports(vk::ApiVersion(0, 1, 1, 0)))
7406 TCU_THROW(NotSupportedError, "At least Vulkan 1.1 required to run test");
7407
7408 // Ensure "VK_KHR_shader_subgroup_rotate" extension's spec version is at least 2
7409 {
7410 const std::string extensionName = "VK_KHR_shader_subgroup_rotate";
7411 const std::vector<VkExtensionProperties> deviceExtensionProperties =
7412 enumerateDeviceExtensionProperties(vki, physicalDevice, nullptr);
7413
7414 for (const auto &property : deviceExtensionProperties)
7415 {
7416 if (property.extensionName == extensionName && property.specVersion < 2)
7417 {
7418 TCU_FAIL(extensionName + " is version 1. Need version 2 or higher");
7419 }
7420 }
7421 }
7422
7423 // Validate all fields initialized matching to extension structures
7424 {
7425 if (subgroupRotateFeatures.shaderSubgroupRotate !=
7426 ((subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_ROTATE_BIT_KHR) != 0) ||
7427 subgroupRotateFeatures.shaderSubgroupRotateClustered !=
7428 ((subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_ROTATE_CLUSTERED_BIT_KHR) != 0))
7429 {
7430 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderSubgroupRotateFeaturesKHR and "
7431 "VkPhysicalDeviceVulkan11Properties");
7432 }
7433 }
7434 return tcu::TestStatus::pass(
7435 "Vulkan device properties are consistent with VkPhysicalDeviceShaderSubgroupRotateFeaturesKHR");
7436 }
7437 #endif // CTS_USES_VULKANSC
7438
7439 #ifndef CTS_USES_VULKANSC
devicePropertyExtensionsConsistencyVulkan13(Context & context)7440 tcu::TestStatus devicePropertyExtensionsConsistencyVulkan13(Context &context)
7441 {
7442 TestLog &log = context.getTestContext().getLog();
7443 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
7444 const CustomInstance instance =
7445 createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2");
7446 const InstanceDriver &vki = instance.getDriver();
7447
7448 if (!context.contextSupports(vk::ApiVersion(0, 1, 3, 0)))
7449 TCU_THROW(NotSupportedError, "At least Vulkan 1.3 required to run test");
7450
7451 VkPhysicalDeviceVulkan13Properties vulkan13Properties = initVulkanStructure();
7452 VkPhysicalDeviceProperties2 extProperties = initVulkanStructure(&vulkan13Properties);
7453
7454 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
7455
7456 log << TestLog::Message << vulkan13Properties << TestLog::EndMessage;
7457
7458 // Validate all fields initialized matching to extension structures
7459 {
7460 VkPhysicalDeviceSubgroupSizeControlProperties subgroupSizeControlProperties = initVulkanStructure();
7461 VkPhysicalDeviceInlineUniformBlockProperties inlineUniformBlockProperties =
7462 initVulkanStructure(&subgroupSizeControlProperties);
7463 VkPhysicalDeviceShaderIntegerDotProductProperties shaderIntegerDotProductProperties =
7464 initVulkanStructure(&inlineUniformBlockProperties);
7465 VkPhysicalDeviceTexelBufferAlignmentProperties texelBufferAlignmentProperties =
7466 initVulkanStructure(&shaderIntegerDotProductProperties);
7467 VkPhysicalDeviceMaintenance4Properties maintenance4Properties =
7468 initVulkanStructure(&texelBufferAlignmentProperties);
7469 extProperties = initVulkanStructure(&maintenance4Properties);
7470
7471 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
7472
7473 if (subgroupSizeControlProperties.minSubgroupSize != vulkan13Properties.minSubgroupSize ||
7474 subgroupSizeControlProperties.maxSubgroupSize != vulkan13Properties.maxSubgroupSize ||
7475 subgroupSizeControlProperties.maxComputeWorkgroupSubgroups !=
7476 vulkan13Properties.maxComputeWorkgroupSubgroups ||
7477 subgroupSizeControlProperties.requiredSubgroupSizeStages != vulkan13Properties.requiredSubgroupSizeStages)
7478 {
7479 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupSizeControlProperties and "
7480 "VkPhysicalDeviceVulkan13Properties");
7481 }
7482
7483 if (inlineUniformBlockProperties.maxInlineUniformBlockSize != vulkan13Properties.maxInlineUniformBlockSize ||
7484 inlineUniformBlockProperties.maxPerStageDescriptorInlineUniformBlocks !=
7485 vulkan13Properties.maxPerStageDescriptorInlineUniformBlocks ||
7486 inlineUniformBlockProperties.maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks !=
7487 vulkan13Properties.maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks ||
7488 inlineUniformBlockProperties.maxDescriptorSetInlineUniformBlocks !=
7489 vulkan13Properties.maxDescriptorSetInlineUniformBlocks ||
7490 inlineUniformBlockProperties.maxDescriptorSetUpdateAfterBindInlineUniformBlocks !=
7491 vulkan13Properties.maxDescriptorSetUpdateAfterBindInlineUniformBlocks)
7492 {
7493 TCU_FAIL(
7494 "Mismatch between VkPhysicalDeviceInlineUniformBlockProperties and VkPhysicalDeviceVulkan13Properties");
7495 }
7496
7497 if (shaderIntegerDotProductProperties.integerDotProduct8BitUnsignedAccelerated !=
7498 vulkan13Properties.integerDotProduct8BitUnsignedAccelerated ||
7499 shaderIntegerDotProductProperties.integerDotProduct8BitSignedAccelerated !=
7500 vulkan13Properties.integerDotProduct8BitSignedAccelerated ||
7501 shaderIntegerDotProductProperties.integerDotProduct8BitMixedSignednessAccelerated !=
7502 vulkan13Properties.integerDotProduct8BitMixedSignednessAccelerated ||
7503 shaderIntegerDotProductProperties.integerDotProduct4x8BitPackedUnsignedAccelerated !=
7504 vulkan13Properties.integerDotProduct4x8BitPackedUnsignedAccelerated ||
7505 shaderIntegerDotProductProperties.integerDotProduct4x8BitPackedSignedAccelerated !=
7506 vulkan13Properties.integerDotProduct4x8BitPackedSignedAccelerated ||
7507 shaderIntegerDotProductProperties.integerDotProduct4x8BitPackedMixedSignednessAccelerated !=
7508 vulkan13Properties.integerDotProduct4x8BitPackedMixedSignednessAccelerated ||
7509 shaderIntegerDotProductProperties.integerDotProduct16BitUnsignedAccelerated !=
7510 vulkan13Properties.integerDotProduct16BitUnsignedAccelerated ||
7511 shaderIntegerDotProductProperties.integerDotProduct16BitSignedAccelerated !=
7512 vulkan13Properties.integerDotProduct16BitSignedAccelerated ||
7513 shaderIntegerDotProductProperties.integerDotProduct16BitMixedSignednessAccelerated !=
7514 vulkan13Properties.integerDotProduct16BitMixedSignednessAccelerated ||
7515 shaderIntegerDotProductProperties.integerDotProduct32BitUnsignedAccelerated !=
7516 vulkan13Properties.integerDotProduct32BitUnsignedAccelerated ||
7517 shaderIntegerDotProductProperties.integerDotProduct32BitSignedAccelerated !=
7518 vulkan13Properties.integerDotProduct32BitSignedAccelerated ||
7519 shaderIntegerDotProductProperties.integerDotProduct32BitMixedSignednessAccelerated !=
7520 vulkan13Properties.integerDotProduct32BitMixedSignednessAccelerated ||
7521 shaderIntegerDotProductProperties.integerDotProduct64BitUnsignedAccelerated !=
7522 vulkan13Properties.integerDotProduct64BitUnsignedAccelerated ||
7523 shaderIntegerDotProductProperties.integerDotProduct64BitSignedAccelerated !=
7524 vulkan13Properties.integerDotProduct64BitSignedAccelerated ||
7525 shaderIntegerDotProductProperties.integerDotProduct64BitMixedSignednessAccelerated !=
7526 vulkan13Properties.integerDotProduct64BitMixedSignednessAccelerated ||
7527 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating8BitUnsignedAccelerated !=
7528 vulkan13Properties.integerDotProductAccumulatingSaturating8BitUnsignedAccelerated ||
7529 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating8BitSignedAccelerated !=
7530 vulkan13Properties.integerDotProductAccumulatingSaturating8BitSignedAccelerated ||
7531 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated !=
7532 vulkan13Properties.integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated ||
7533 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated !=
7534 vulkan13Properties.integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated ||
7535 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated !=
7536 vulkan13Properties.integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated ||
7537 shaderIntegerDotProductProperties
7538 .integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated !=
7539 vulkan13Properties.integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated ||
7540 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating16BitUnsignedAccelerated !=
7541 vulkan13Properties.integerDotProductAccumulatingSaturating16BitUnsignedAccelerated ||
7542 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating16BitSignedAccelerated !=
7543 vulkan13Properties.integerDotProductAccumulatingSaturating16BitSignedAccelerated ||
7544 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated !=
7545 vulkan13Properties.integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated ||
7546 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating32BitUnsignedAccelerated !=
7547 vulkan13Properties.integerDotProductAccumulatingSaturating32BitUnsignedAccelerated ||
7548 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating32BitSignedAccelerated !=
7549 vulkan13Properties.integerDotProductAccumulatingSaturating32BitSignedAccelerated ||
7550 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated !=
7551 vulkan13Properties.integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated ||
7552 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating64BitUnsignedAccelerated !=
7553 vulkan13Properties.integerDotProductAccumulatingSaturating64BitUnsignedAccelerated ||
7554 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating64BitSignedAccelerated !=
7555 vulkan13Properties.integerDotProductAccumulatingSaturating64BitSignedAccelerated ||
7556 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated !=
7557 vulkan13Properties.integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated)
7558 {
7559 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderIntegerDotProductProperties and "
7560 "VkPhysicalDeviceVulkan13Properties");
7561 }
7562
7563 if (texelBufferAlignmentProperties.storageTexelBufferOffsetAlignmentBytes !=
7564 vulkan13Properties.storageTexelBufferOffsetAlignmentBytes ||
7565 texelBufferAlignmentProperties.storageTexelBufferOffsetSingleTexelAlignment !=
7566 vulkan13Properties.storageTexelBufferOffsetSingleTexelAlignment ||
7567 texelBufferAlignmentProperties.uniformTexelBufferOffsetAlignmentBytes !=
7568 vulkan13Properties.uniformTexelBufferOffsetAlignmentBytes ||
7569 texelBufferAlignmentProperties.uniformTexelBufferOffsetSingleTexelAlignment !=
7570 vulkan13Properties.uniformTexelBufferOffsetSingleTexelAlignment)
7571 {
7572 TCU_FAIL("Mismatch between VkPhysicalDeviceTexelBufferAlignmentProperties and "
7573 "VkPhysicalDeviceVulkan13Properties");
7574 }
7575
7576 if (maintenance4Properties.maxBufferSize != vulkan13Properties.maxBufferSize)
7577 {
7578 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance4Properties and VkPhysicalDeviceVulkan13Properties");
7579 }
7580 }
7581
7582 return tcu::TestStatus::pass("Vulkan 1.3 device properties are consistent with extension properties");
7583 }
7584
devicePropertyExtensionsConsistencyVulkan14(Context & context)7585 tcu::TestStatus devicePropertyExtensionsConsistencyVulkan14(Context &context)
7586 {
7587 TestLog &log = context.getTestContext().getLog();
7588 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
7589 const CustomInstance instance =
7590 createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2");
7591 const InstanceDriver &vki = instance.getDriver();
7592
7593 if (!context.contextSupports(vk::ApiVersion(0, 1, 4, 0)))
7594 TCU_THROW(NotSupportedError, "At least Vulkan 1.4 required to run test");
7595
7596 VkPhysicalDeviceVulkan14Properties vulkan14Properties = initVulkanStructure();
7597 VkPhysicalDeviceProperties2 extProperties = initVulkanStructure(&vulkan14Properties);
7598 std::vector<VkImageLayout> vulkan14CopyLayouts;
7599 std::vector<VkImageLayout> extCopyLayouts;
7600
7601 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
7602
7603 vulkan14CopyLayouts.resize(vulkan14Properties.copySrcLayoutCount + vulkan14Properties.copyDstLayoutCount);
7604 vulkan14Properties.pCopySrcLayouts = vulkan14CopyLayouts.data();
7605 vulkan14Properties.pCopyDstLayouts = vulkan14CopyLayouts.data() + vulkan14Properties.copySrcLayoutCount;
7606 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
7607
7608 log << TestLog::Message << vulkan14Properties << TestLog::EndMessage;
7609
7610 // Validate all fields initialized matching to extension structures
7611 {
7612 VkPhysicalDeviceLineRasterizationPropertiesKHR lineRasterizationProperties = initVulkanStructure();
7613 VkPhysicalDeviceMaintenance5PropertiesKHR maintenance5Properties =
7614 initVulkanStructure(&lineRasterizationProperties);
7615 VkPhysicalDeviceMaintenance6PropertiesKHR maintenance6Properties = initVulkanStructure(&maintenance5Properties);
7616 VkPhysicalDevicePushDescriptorPropertiesKHR pushDescriptorProperties =
7617 initVulkanStructure(&maintenance6Properties);
7618 VkPhysicalDeviceVertexAttributeDivisorPropertiesKHR vertexAttributeDivisorProperties =
7619 initVulkanStructure(&pushDescriptorProperties);
7620 VkPhysicalDeviceHostImageCopyPropertiesEXT hostImageCopyProperties =
7621 initVulkanStructure(&vertexAttributeDivisorProperties);
7622 VkPhysicalDevicePipelineRobustnessPropertiesEXT pipelineRobustnessProperties =
7623 initVulkanStructure(&hostImageCopyProperties);
7624 extProperties = initVulkanStructure(&pipelineRobustnessProperties);
7625
7626 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
7627
7628 // alocate and fill pCopySrcLayouts/pCopyDstLayouts data
7629 extCopyLayouts.resize(hostImageCopyProperties.copySrcLayoutCount + hostImageCopyProperties.copyDstLayoutCount);
7630 hostImageCopyProperties.pCopySrcLayouts = extCopyLayouts.data();
7631 hostImageCopyProperties.pCopyDstLayouts = extCopyLayouts.data() + hostImageCopyProperties.copySrcLayoutCount;
7632 hostImageCopyProperties.pNext = nullptr;
7633 extProperties.pNext = &hostImageCopyProperties;
7634 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
7635
7636 if (lineRasterizationProperties.lineSubPixelPrecisionBits != vulkan14Properties.lineSubPixelPrecisionBits)
7637 {
7638 TCU_FAIL("Mismatch between VkPhysicalDeviceLineRasterizationPropertiesKHR and "
7639 "VkPhysicalDeviceVulkan14Properties");
7640 }
7641
7642 if (maintenance5Properties.earlyFragmentMultisampleCoverageAfterSampleCounting !=
7643 vulkan14Properties.earlyFragmentMultisampleCoverageAfterSampleCounting ||
7644 maintenance5Properties.earlyFragmentSampleMaskTestBeforeSampleCounting !=
7645 vulkan14Properties.earlyFragmentSampleMaskTestBeforeSampleCounting ||
7646 maintenance5Properties.depthStencilSwizzleOneSupport != vulkan14Properties.depthStencilSwizzleOneSupport ||
7647 maintenance5Properties.polygonModePointSize != vulkan14Properties.polygonModePointSize ||
7648 maintenance5Properties.nonStrictSinglePixelWideLinesUseParallelogram !=
7649 vulkan14Properties.nonStrictSinglePixelWideLinesUseParallelogram ||
7650 maintenance5Properties.nonStrictWideLinesUseParallelogram !=
7651 vulkan14Properties.nonStrictWideLinesUseParallelogram)
7652 {
7653 TCU_FAIL(
7654 "Mismatch between VkPhysicalDeviceMaintenance5PropertiesKHR and VkPhysicalDeviceVulkan14Properties");
7655 }
7656
7657 if (maintenance6Properties.blockTexelViewCompatibleMultipleLayers !=
7658 vulkan14Properties.blockTexelViewCompatibleMultipleLayers ||
7659 maintenance6Properties.maxCombinedImageSamplerDescriptorCount !=
7660 vulkan14Properties.maxCombinedImageSamplerDescriptorCount ||
7661 maintenance6Properties.fragmentShadingRateClampCombinerInputs !=
7662 vulkan14Properties.fragmentShadingRateClampCombinerInputs)
7663 {
7664 TCU_FAIL(
7665 "Mismatch between VkPhysicalDeviceMaintenance6PropertiesKHR and VkPhysicalDeviceVulkan14Properties");
7666 }
7667
7668 if (pushDescriptorProperties.maxPushDescriptors != vulkan14Properties.maxPushDescriptors)
7669 {
7670 TCU_FAIL(
7671 "Mismatch between VkPhysicalDevicePushDescriptorPropertiesKHR and VkPhysicalDeviceVulkan14Properties");
7672 }
7673
7674 if (vertexAttributeDivisorProperties.maxVertexAttribDivisor != vulkan14Properties.maxVertexAttribDivisor ||
7675 vertexAttributeDivisorProperties.supportsNonZeroFirstInstance !=
7676 vulkan14Properties.supportsNonZeroFirstInstance)
7677 {
7678 TCU_FAIL("Mismatch between VkPhysicalDeviceVertexAttributeDivisorPropertiesKHR and "
7679 "VkPhysicalDeviceVulkan14Properties");
7680 }
7681
7682 if (hostImageCopyProperties.copySrcLayoutCount != vulkan14Properties.copySrcLayoutCount ||
7683 (deMemCmp(hostImageCopyProperties.pCopySrcLayouts, vulkan14Properties.pCopySrcLayouts,
7684 vulkan14Properties.copySrcLayoutCount) != 0) ||
7685 hostImageCopyProperties.copyDstLayoutCount != vulkan14Properties.copyDstLayoutCount ||
7686 (deMemCmp(hostImageCopyProperties.pCopyDstLayouts, vulkan14Properties.pCopyDstLayouts,
7687 vulkan14Properties.copyDstLayoutCount) != 0) ||
7688 (deMemCmp(hostImageCopyProperties.optimalTilingLayoutUUID, vulkan14Properties.optimalTilingLayoutUUID,
7689 VK_LUID_SIZE) != 0) ||
7690 hostImageCopyProperties.identicalMemoryTypeRequirements !=
7691 vulkan14Properties.identicalMemoryTypeRequirements)
7692 {
7693 TCU_FAIL(
7694 "Mismatch between VkPhysicalDeviceHostImageCopyPropertiesEXT and VkPhysicalDeviceVulkan14Properties");
7695 }
7696
7697 if (pipelineRobustnessProperties.defaultRobustnessStorageBuffers !=
7698 vulkan14Properties.defaultRobustnessStorageBuffers ||
7699 pipelineRobustnessProperties.defaultRobustnessUniformBuffers !=
7700 vulkan14Properties.defaultRobustnessUniformBuffers ||
7701 pipelineRobustnessProperties.defaultRobustnessVertexInputs !=
7702 vulkan14Properties.defaultRobustnessVertexInputs ||
7703 pipelineRobustnessProperties.defaultRobustnessImages != vulkan14Properties.defaultRobustnessImages)
7704 {
7705 TCU_FAIL("Mismatch between VkPhysicalDevicePipelineRobustnessPropertiesEXT and "
7706 "VkPhysicalDeviceVulkan14Properties");
7707 }
7708 }
7709
7710 return tcu::TestStatus::pass("Vulkan 1.4 device properties are consistent with extension properties");
7711 }
7712 #endif // CTS_USES_VULKANSC
7713
imageFormatProperties2(Context & context,const VkFormat format,const VkImageType imageType,const VkImageTiling tiling)7714 tcu::TestStatus imageFormatProperties2(Context &context, const VkFormat format, const VkImageType imageType,
7715 const VkImageTiling tiling)
7716 {
7717 if (isYCbCrFormat(format))
7718 // check if Ycbcr format enums are valid given the version and extensions
7719 checkYcbcrApiSupport(context);
7720
7721 TestLog &log = context.getTestContext().getLog();
7722
7723 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
7724 const InstanceDriver &vki(instance.getDriver());
7725 const VkPhysicalDevice physicalDevice(chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
7726
7727 const VkImageCreateFlags ycbcrFlags =
7728 isYCbCrFormat(format) ? (VkImageCreateFlags)VK_IMAGE_CREATE_DISJOINT_BIT : (VkImageCreateFlags)0u;
7729 const VkImageUsageFlags allUsageFlags =
7730 VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
7731 VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT |
7732 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
7733 const VkImageCreateFlags allCreateFlags =
7734 VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT |
7735 VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT | ycbcrFlags;
7736
7737 for (VkImageUsageFlags curUsageFlags = (VkImageUsageFlags)1; curUsageFlags <= allUsageFlags; curUsageFlags++)
7738 {
7739 if (!isValidImageUsageFlagCombination(curUsageFlags))
7740 continue;
7741
7742 for (VkImageCreateFlags curCreateFlags = 0; curCreateFlags <= allCreateFlags; curCreateFlags++)
7743 {
7744 const VkPhysicalDeviceImageFormatInfo2 imageFormatInfo = {
7745 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2,
7746 nullptr,
7747 format,
7748 imageType,
7749 tiling,
7750 curUsageFlags,
7751 curCreateFlags};
7752
7753 VkImageFormatProperties coreProperties;
7754 VkImageFormatProperties2 extProperties;
7755 VkResult coreResult;
7756 VkResult extResult;
7757
7758 deMemset(&coreProperties, 0xcd, sizeof(VkImageFormatProperties));
7759 deMemset(&extProperties, 0xcd, sizeof(VkImageFormatProperties2));
7760
7761 extProperties.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2;
7762 extProperties.pNext = nullptr;
7763
7764 coreResult = vki.getPhysicalDeviceImageFormatProperties(
7765 physicalDevice, imageFormatInfo.format, imageFormatInfo.type, imageFormatInfo.tiling,
7766 imageFormatInfo.usage, imageFormatInfo.flags, &coreProperties);
7767 extResult = vki.getPhysicalDeviceImageFormatProperties2(physicalDevice, &imageFormatInfo, &extProperties);
7768
7769 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2);
7770 TCU_CHECK(extProperties.pNext == nullptr);
7771
7772 if ((coreResult != extResult) ||
7773 (deMemCmp(&coreProperties, &extProperties.imageFormatProperties, sizeof(VkImageFormatProperties)) != 0))
7774 {
7775 log << TestLog::Message << "ERROR: device mismatch with query " << imageFormatInfo
7776 << TestLog::EndMessage << TestLog::Message << "vkGetPhysicalDeviceImageFormatProperties() returned "
7777 << coreResult << ", " << coreProperties << TestLog::EndMessage << TestLog::Message
7778 << "vkGetPhysicalDeviceImageFormatProperties2() returned " << extResult << ", " << extProperties
7779 << TestLog::EndMessage;
7780 TCU_FAIL("Mismatch between image format properties reported by "
7781 "vkGetPhysicalDeviceImageFormatProperties and vkGetPhysicalDeviceImageFormatProperties2");
7782 }
7783 }
7784 }
7785
7786 return tcu::TestStatus::pass("Querying image format properties succeeded");
7787 }
7788
7789 #ifndef CTS_USES_VULKANSC
sparseImageFormatProperties2(Context & context,const VkFormat format,const VkImageType imageType,const VkImageTiling tiling)7790 tcu::TestStatus sparseImageFormatProperties2(Context &context, const VkFormat format, const VkImageType imageType,
7791 const VkImageTiling tiling)
7792 {
7793 TestLog &log = context.getTestContext().getLog();
7794
7795 const CustomInstance instance(createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
7796 const InstanceDriver &vki(instance.getDriver());
7797 const VkPhysicalDevice physicalDevice(chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
7798
7799 const VkImageUsageFlags allUsageFlags =
7800 VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
7801 VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT |
7802 VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
7803
7804 for (uint32_t sampleCountBit = VK_SAMPLE_COUNT_1_BIT; sampleCountBit <= VK_SAMPLE_COUNT_64_BIT;
7805 sampleCountBit = (sampleCountBit << 1u))
7806 {
7807 for (VkImageUsageFlags curUsageFlags = (VkImageUsageFlags)1; curUsageFlags <= allUsageFlags; curUsageFlags++)
7808 {
7809 if (!isValidImageUsageFlagCombination(curUsageFlags))
7810 continue;
7811
7812 const VkPhysicalDeviceSparseImageFormatInfo2 imageFormatInfo = {
7813 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2,
7814 nullptr,
7815 format,
7816 imageType,
7817 (VkSampleCountFlagBits)sampleCountBit,
7818 curUsageFlags,
7819 tiling,
7820 };
7821
7822 uint32_t numCoreProperties = 0u;
7823 uint32_t numExtProperties = 0u;
7824
7825 // Query count
7826 vki.getPhysicalDeviceSparseImageFormatProperties(
7827 physicalDevice, imageFormatInfo.format, imageFormatInfo.type, imageFormatInfo.samples,
7828 imageFormatInfo.usage, imageFormatInfo.tiling, &numCoreProperties, nullptr);
7829 vki.getPhysicalDeviceSparseImageFormatProperties2(physicalDevice, &imageFormatInfo, &numExtProperties,
7830 nullptr);
7831
7832 if (numCoreProperties != numExtProperties)
7833 {
7834 log << TestLog::Message << "ERROR: different number of properties reported for " << imageFormatInfo
7835 << TestLog::EndMessage;
7836 TCU_FAIL("Mismatch in reported property count");
7837 }
7838
7839 if (!context.getDeviceFeatures().sparseBinding)
7840 {
7841 // There is no support for sparse binding, getPhysicalDeviceSparseImageFormatProperties* MUST report no properties
7842 // Only have to check one of the entrypoints as a mismatch in count is already caught.
7843 if (numCoreProperties > 0)
7844 {
7845 log << TestLog::Message << "ERROR: device does not support sparse binding but claims support for "
7846 << numCoreProperties
7847 << " properties in vkGetPhysicalDeviceSparseImageFormatProperties with parameters "
7848 << imageFormatInfo << TestLog::EndMessage;
7849 TCU_FAIL("Claimed format properties inconsistent with overall sparseBinding feature");
7850 }
7851 }
7852
7853 if (numCoreProperties > 0)
7854 {
7855 std::vector<VkSparseImageFormatProperties> coreProperties(numCoreProperties);
7856 std::vector<VkSparseImageFormatProperties2> extProperties(numExtProperties);
7857
7858 deMemset(&coreProperties[0], 0xcd, sizeof(VkSparseImageFormatProperties) * numCoreProperties);
7859 deMemset(&extProperties[0], 0xcd, sizeof(VkSparseImageFormatProperties2) * numExtProperties);
7860
7861 for (uint32_t ndx = 0; ndx < numExtProperties; ++ndx)
7862 {
7863 extProperties[ndx].sType = VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2;
7864 extProperties[ndx].pNext = nullptr;
7865 }
7866
7867 vki.getPhysicalDeviceSparseImageFormatProperties(
7868 physicalDevice, imageFormatInfo.format, imageFormatInfo.type, imageFormatInfo.samples,
7869 imageFormatInfo.usage, imageFormatInfo.tiling, &numCoreProperties, &coreProperties[0]);
7870 vki.getPhysicalDeviceSparseImageFormatProperties2(physicalDevice, &imageFormatInfo, &numExtProperties,
7871 &extProperties[0]);
7872
7873 TCU_CHECK((size_t)numCoreProperties == coreProperties.size());
7874 TCU_CHECK((size_t)numExtProperties == extProperties.size());
7875
7876 for (uint32_t ndx = 0; ndx < numCoreProperties; ++ndx)
7877 {
7878 TCU_CHECK(extProperties[ndx].sType == VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2);
7879 TCU_CHECK(extProperties[ndx].pNext == nullptr);
7880
7881 if ((deMemCmp(&coreProperties[ndx], &extProperties[ndx].properties,
7882 sizeof(VkSparseImageFormatProperties)) != 0))
7883 {
7884 log << TestLog::Message << "ERROR: device mismatch with query " << imageFormatInfo
7885 << " property " << ndx << TestLog::EndMessage << TestLog::Message
7886 << "vkGetPhysicalDeviceSparseImageFormatProperties() returned " << coreProperties[ndx]
7887 << TestLog::EndMessage << TestLog::Message
7888 << "vkGetPhysicalDeviceSparseImageFormatProperties2() returned " << extProperties[ndx]
7889 << TestLog::EndMessage;
7890 TCU_FAIL("Mismatch between image format properties reported by "
7891 "vkGetPhysicalDeviceSparseImageFormatProperties and "
7892 "vkGetPhysicalDeviceSparseImageFormatProperties2");
7893 }
7894 }
7895 }
7896 }
7897 }
7898
7899 return tcu::TestStatus::pass("Querying sparse image format properties succeeded");
7900 }
7901 #endif // CTS_USES_VULKANSC
7902
execImageFormatTest(Context & context,ImageFormatPropertyCase testCase)7903 tcu::TestStatus execImageFormatTest(Context &context, ImageFormatPropertyCase testCase)
7904 {
7905 return testCase.testFunction(context, testCase.format, testCase.imageType, testCase.tiling);
7906 }
7907
createImageFormatTypeTilingTests(tcu::TestCaseGroup * testGroup,ImageFormatPropertyCase params)7908 void createImageFormatTypeTilingTests(tcu::TestCaseGroup *testGroup, ImageFormatPropertyCase params)
7909 {
7910 DE_ASSERT(params.format == VK_FORMAT_UNDEFINED);
7911
7912 static const struct
7913 {
7914 VkFormat begin;
7915 VkFormat end;
7916 ImageFormatPropertyCase params;
7917 } s_formatRanges[] = {
7918 // core formats
7919 {(VkFormat)(VK_FORMAT_UNDEFINED), VK_CORE_FORMAT_LAST, params},
7920
7921 // YCbCr formats
7922 {VK_FORMAT_G8B8G8R8_422_UNORM, (VkFormat)(VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM + 1), params},
7923
7924 // YCbCr extended formats
7925 {VK_FORMAT_G8_B8R8_2PLANE_444_UNORM_EXT, (VkFormat)(VK_FORMAT_G16_B16R16_2PLANE_444_UNORM_EXT + 1), params},
7926 };
7927
7928 for (int rangeNdx = 0; rangeNdx < DE_LENGTH_OF_ARRAY(s_formatRanges); ++rangeNdx)
7929 {
7930 const VkFormat rangeBegin = s_formatRanges[rangeNdx].begin;
7931 const VkFormat rangeEnd = s_formatRanges[rangeNdx].end;
7932
7933 for (VkFormat format = rangeBegin; format != rangeEnd; format = (VkFormat)(format + 1))
7934 {
7935 const bool isYCbCr = isYCbCrFormat(format);
7936 #ifndef CTS_USES_VULKANSC
7937 const bool isSparse = (params.testFunction == sparseImageFormatProperties2);
7938 #else
7939 const bool isSparse = false;
7940 #endif // CTS_USES_VULKANSC
7941
7942 if (isYCbCr && isSparse)
7943 continue;
7944
7945 if (isYCbCr && params.imageType != VK_IMAGE_TYPE_2D)
7946 continue;
7947
7948 const char *const enumName = getFormatName(format);
7949 const string caseName = de::toLower(string(enumName).substr(10));
7950
7951 params.format = format;
7952
7953 addFunctionCase(testGroup, caseName, execImageFormatTest, params);
7954 }
7955 }
7956 }
7957
createImageFormatTypeTests(tcu::TestCaseGroup * testGroup,ImageFormatPropertyCase params)7958 void createImageFormatTypeTests(tcu::TestCaseGroup *testGroup, ImageFormatPropertyCase params)
7959 {
7960 DE_ASSERT(params.tiling == VK_CORE_IMAGE_TILING_LAST);
7961
7962 testGroup->addChild(createTestGroup(
7963 testGroup->getTestContext(), "optimal", createImageFormatTypeTilingTests,
7964 ImageFormatPropertyCase(params.testFunction, VK_FORMAT_UNDEFINED, params.imageType, VK_IMAGE_TILING_OPTIMAL)));
7965 testGroup->addChild(createTestGroup(
7966 testGroup->getTestContext(), "linear", createImageFormatTypeTilingTests,
7967 ImageFormatPropertyCase(params.testFunction, VK_FORMAT_UNDEFINED, params.imageType, VK_IMAGE_TILING_LINEAR)));
7968 }
7969
createImageFormatTests(tcu::TestCaseGroup * testGroup,ImageFormatPropertyCase::Function testFunction)7970 void createImageFormatTests(tcu::TestCaseGroup *testGroup, ImageFormatPropertyCase::Function testFunction)
7971 {
7972 testGroup->addChild(createTestGroup(
7973 testGroup->getTestContext(), "1d", createImageFormatTypeTests,
7974 ImageFormatPropertyCase(testFunction, VK_FORMAT_UNDEFINED, VK_IMAGE_TYPE_1D, VK_CORE_IMAGE_TILING_LAST)));
7975 testGroup->addChild(createTestGroup(
7976 testGroup->getTestContext(), "2d", createImageFormatTypeTests,
7977 ImageFormatPropertyCase(testFunction, VK_FORMAT_UNDEFINED, VK_IMAGE_TYPE_2D, VK_CORE_IMAGE_TILING_LAST)));
7978 testGroup->addChild(createTestGroup(
7979 testGroup->getTestContext(), "3d", createImageFormatTypeTests,
7980 ImageFormatPropertyCase(testFunction, VK_FORMAT_UNDEFINED, VK_IMAGE_TYPE_3D, VK_CORE_IMAGE_TILING_LAST)));
7981 }
7982
execImageUsageTest(Context & context,ImageUsagePropertyCase testCase)7983 tcu::TestStatus execImageUsageTest(Context &context, ImageUsagePropertyCase testCase)
7984 {
7985 return testCase.testFunction(context, testCase.format, testCase.usage, testCase.tiling);
7986 }
7987
checkSupportImageUsage(Context & context,ImageUsagePropertyCase params)7988 void checkSupportImageUsage(Context &context, ImageUsagePropertyCase params)
7989 {
7990 if (params.usage == VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR)
7991 context.requireDeviceFunctionality("VK_KHR_fragment_shading_rate");
7992 }
7993
createImageUsageTilingTests(tcu::TestCaseGroup * testGroup,ImageUsagePropertyCase params)7994 void createImageUsageTilingTests(tcu::TestCaseGroup *testGroup, ImageUsagePropertyCase params)
7995 {
7996 struct UsageTest
7997 {
7998 const char *name;
7999 VkImageUsageFlags usage;
8000 } usageTests[] = {
8001 {"sampled", VK_IMAGE_USAGE_SAMPLED_BIT},
8002 {"storage", VK_IMAGE_USAGE_STORAGE_BIT},
8003 {"color_attachment", VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT},
8004 {"depth_stencil_attachment", VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT},
8005 {"input_attachment", VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT},
8006 {"fragment_shading_rate_attachment", VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR},
8007 };
8008
8009 for (int rangeNdx = 0; rangeNdx < DE_LENGTH_OF_ARRAY(usageTests); ++rangeNdx)
8010 {
8011 const auto usage = usageTests[rangeNdx];
8012
8013 const VkFormat rangeBegin = VK_FORMAT_UNDEFINED;
8014 const VkFormat rangeEnd = VK_CORE_FORMAT_LAST;
8015
8016 for (VkFormat format = rangeBegin; format != rangeEnd; format = (VkFormat)(format + 1))
8017 {
8018 const char *const enumName = getFormatName(format);
8019 const string caseName = std::string(usage.name) + "_" + de::toLower(string(enumName).substr(10));
8020
8021 params.usage = usage.usage;
8022 params.format = format;
8023
8024 addFunctionCase(testGroup, caseName, checkSupportImageUsage, execImageUsageTest, params);
8025 }
8026 }
8027 }
8028
createImageUsageTests(tcu::TestCaseGroup * testGroup,ImageUsagePropertyCase::Function testFunction)8029 void createImageUsageTests(tcu::TestCaseGroup *testGroup, ImageUsagePropertyCase::Function testFunction)
8030 {
8031 testGroup->addChild(
8032 createTestGroup(testGroup->getTestContext(), "optimal", createImageUsageTilingTests,
8033 ImageUsagePropertyCase(testFunction, VK_FORMAT_UNDEFINED, 0u, VK_IMAGE_TILING_OPTIMAL)));
8034 testGroup->addChild(
8035 createTestGroup(testGroup->getTestContext(), "linear", createImageUsageTilingTests,
8036 ImageUsagePropertyCase(testFunction, VK_FORMAT_UNDEFINED, 0u, VK_IMAGE_TILING_LINEAR)));
8037 }
8038
8039 // Android CTS -specific tests
8040
8041 namespace android
8042 {
8043
checkSupportAndroid(Context &)8044 void checkSupportAndroid(Context &)
8045 {
8046 #if (DE_OS != DE_OS_ANDROID)
8047 TCU_THROW(NotSupportedError, "Test is only for Android");
8048 #endif
8049 }
8050
checkExtensions(tcu::ResultCollector & results,const set<string> & allowedExtensions,const vector<VkExtensionProperties> & reportedExtensions)8051 void checkExtensions(tcu::ResultCollector &results, const set<string> &allowedExtensions,
8052 const vector<VkExtensionProperties> &reportedExtensions)
8053 {
8054 for (vector<VkExtensionProperties>::const_iterator extension = reportedExtensions.begin();
8055 extension != reportedExtensions.end(); ++extension)
8056 {
8057 const string extensionName(extension->extensionName);
8058 const bool mustBeKnown =
8059 de::beginsWith(extensionName, "VK_GOOGLE_") || de::beginsWith(extensionName, "VK_ANDROID_");
8060
8061 if (mustBeKnown && !de::contains(allowedExtensions, extensionName))
8062 results.fail("Unknown extension: " + extensionName);
8063 }
8064 }
8065
testNoUnknownExtensions(Context & context)8066 tcu::TestStatus testNoUnknownExtensions(Context &context)
8067 {
8068 TestLog &log = context.getTestContext().getLog();
8069 tcu::ResultCollector results(log);
8070 set<string> allowedInstanceExtensions;
8071 set<string> allowedDeviceExtensions;
8072
8073 // All known extensions should be added to allowedExtensions:
8074 // allowedExtensions.insert("VK_GOOGLE_extension1");
8075 allowedDeviceExtensions.insert("VK_ANDROID_external_format_resolve");
8076 allowedDeviceExtensions.insert("VK_ANDROID_external_memory_android_hardware_buffer");
8077 allowedDeviceExtensions.insert("VK_GOOGLE_display_timing");
8078 allowedDeviceExtensions.insert("VK_GOOGLE_decorate_string");
8079 allowedDeviceExtensions.insert("VK_GOOGLE_hlsl_functionality1");
8080 allowedDeviceExtensions.insert("VK_GOOGLE_user_type");
8081 allowedInstanceExtensions.insert("VK_GOOGLE_surfaceless_query");
8082
8083 // Instance extensions
8084 checkExtensions(results, allowedInstanceExtensions,
8085 enumerateInstanceExtensionProperties(context.getPlatformInterface(), nullptr));
8086
8087 // Extensions exposed by instance layers
8088 {
8089 const vector<VkLayerProperties> layers = enumerateInstanceLayerProperties(context.getPlatformInterface());
8090
8091 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
8092 {
8093 checkExtensions(results, allowedInstanceExtensions,
8094 enumerateInstanceExtensionProperties(context.getPlatformInterface(), layer->layerName));
8095 }
8096 }
8097
8098 // Device extensions
8099 checkExtensions(
8100 results, allowedDeviceExtensions,
8101 enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), nullptr));
8102
8103 // Extensions exposed by device layers
8104 {
8105 const vector<VkLayerProperties> layers =
8106 enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
8107
8108 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
8109 {
8110 checkExtensions(results, allowedDeviceExtensions,
8111 enumerateDeviceExtensionProperties(context.getInstanceInterface(),
8112 context.getPhysicalDevice(), layer->layerName));
8113 }
8114 }
8115
8116 return tcu::TestStatus(results.getResult(), results.getMessage());
8117 }
8118
testNoLayers(Context & context)8119 tcu::TestStatus testNoLayers(Context &context)
8120 {
8121 TestLog &log = context.getTestContext().getLog();
8122 tcu::ResultCollector results(log);
8123
8124 {
8125 const vector<VkLayerProperties> layers = enumerateInstanceLayerProperties(context.getPlatformInterface());
8126
8127 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
8128 results.fail(string("Instance layer enumerated: ") + layer->layerName);
8129 }
8130
8131 {
8132 const vector<VkLayerProperties> layers =
8133 enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
8134
8135 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
8136 results.fail(string("Device layer enumerated: ") + layer->layerName);
8137 }
8138
8139 return tcu::TestStatus(results.getResult(), results.getMessage());
8140 }
8141
testMandatoryExtensions(Context & context)8142 tcu::TestStatus testMandatoryExtensions(Context &context)
8143 {
8144 TestLog &log = context.getTestContext().getLog();
8145 tcu::ResultCollector results(log);
8146
8147 // Instance extensions
8148 {
8149 static const string mandatoryExtensions[] = {
8150 "VK_KHR_get_physical_device_properties2",
8151 };
8152
8153 for (const auto &ext : mandatoryExtensions)
8154 {
8155 if (!context.isInstanceFunctionalitySupported(ext))
8156 results.fail(ext + " is not supported");
8157 }
8158 }
8159
8160 // Device extensions
8161 {
8162 static const string mandatoryExtensions[] = {
8163 "VK_KHR_maintenance1",
8164 };
8165
8166 for (const auto &ext : mandatoryExtensions)
8167 {
8168 if (!context.isDeviceFunctionalitySupported(ext))
8169 results.fail(ext + " is not supported");
8170 }
8171 }
8172
8173 return tcu::TestStatus(results.getResult(), results.getMessage());
8174 }
8175
8176 } // namespace android
8177
8178 } // namespace
8179
addFunctionCaseInNewSubgroup(tcu::TestContext & testCtx,tcu::TestCaseGroup * group,const std::string & subgroupName,FunctionInstance0::Function testFunc)8180 static inline void addFunctionCaseInNewSubgroup(tcu::TestContext &testCtx, tcu::TestCaseGroup *group,
8181 const std::string &subgroupName, FunctionInstance0::Function testFunc)
8182 {
8183 de::MovePtr<tcu::TestCaseGroup> subgroup(new tcu::TestCaseGroup(testCtx, subgroupName.c_str()));
8184 addFunctionCase(subgroup.get(), "basic", testFunc);
8185 group->addChild(subgroup.release());
8186 }
8187
createFeatureInfoTests(tcu::TestContext & testCtx)8188 tcu::TestCaseGroup *createFeatureInfoTests(tcu::TestContext &testCtx)
8189 {
8190 de::MovePtr<tcu::TestCaseGroup> infoTests(new tcu::TestCaseGroup(testCtx, "info"));
8191
8192 infoTests->addChild(createTestGroup(testCtx, "format_properties", createFormatTests));
8193 infoTests->addChild(
8194 createTestGroup(testCtx, "image_format_properties", createImageFormatTests, imageFormatProperties));
8195 infoTests->addChild(
8196 createTestGroup(testCtx, "unsupported_image_usage", createImageUsageTests, unsupportedImageUsage));
8197
8198 {
8199 de::MovePtr<tcu::TestCaseGroup> extCoreVersionGrp(new tcu::TestCaseGroup(testCtx, "extension_core_versions"));
8200
8201 addFunctionCase(extCoreVersionGrp.get(), "extension_core_versions", extensionCoreVersions);
8202
8203 infoTests->addChild(extCoreVersionGrp.release());
8204 }
8205
8206 {
8207 de::MovePtr<tcu::TestCaseGroup> extendedPropertiesTests(
8208 new tcu::TestCaseGroup(testCtx, "get_physical_device_properties2"));
8209
8210 {
8211 de::MovePtr<tcu::TestCaseGroup> subgroup(new tcu::TestCaseGroup(testCtx, "features"));
8212 // Extended Device Features
8213 addFunctionCase(subgroup.get(), "core", deviceFeatures2);
8214 addSeparateFeatureTests(subgroup.get());
8215 #ifndef CTS_USES_VULKANSC
8216 addFunctionCase(subgroup.get(), "shader_subgroup_rotate_property_consistency_khr",
8217 checkSupportKhrShaderSubgroupRotate, subgroupRotatePropertyExtensionFeatureConsistency);
8218 #endif // CTS_USES_VULKANSC
8219 extendedPropertiesTests->addChild(subgroup.release());
8220 }
8221 addFunctionCaseInNewSubgroup(testCtx, extendedPropertiesTests.get(), "properties", deviceProperties2);
8222 addFunctionCaseInNewSubgroup(testCtx, extendedPropertiesTests.get(), "format_properties",
8223 deviceFormatProperties2);
8224 addFunctionCaseInNewSubgroup(testCtx, extendedPropertiesTests.get(), "queue_family_properties",
8225 deviceQueueFamilyProperties2);
8226 addFunctionCaseInNewSubgroup(testCtx, extendedPropertiesTests.get(), "memory_properties",
8227 deviceMemoryProperties2);
8228
8229 infoTests->addChild(extendedPropertiesTests.release());
8230 }
8231
8232 {
8233 // Vulkan 1.2 related tests
8234 de::MovePtr<tcu::TestCaseGroup> extendedPropertiesTests(new tcu::TestCaseGroup(testCtx, "vulkan1p2"));
8235
8236 addFunctionCase(extendedPropertiesTests.get(), "features", deviceFeaturesVulkan12);
8237 addFunctionCase(extendedPropertiesTests.get(), "properties", devicePropertiesVulkan12);
8238 addFunctionCase(extendedPropertiesTests.get(), "feature_extensions_consistency",
8239 deviceFeatureExtensionsConsistencyVulkan12);
8240 addFunctionCase(extendedPropertiesTests.get(), "property_extensions_consistency",
8241 devicePropertyExtensionsConsistencyVulkan12);
8242 addFunctionCase(extendedPropertiesTests.get(), "feature_bits_influence", checkApiVersionSupport<1, 2>,
8243 featureBitInfluenceOnDeviceCreate<VK_API_VERSION_1_2>);
8244
8245 infoTests->addChild(extendedPropertiesTests.release());
8246 }
8247
8248 #ifndef CTS_USES_VULKANSC
8249 {
8250 // Vulkan 1.3 related tests
8251 de::MovePtr<tcu::TestCaseGroup> extendedPropertiesTests(new tcu::TestCaseGroup(testCtx, "vulkan1p3"));
8252
8253 addFunctionCase(extendedPropertiesTests.get(), "features", deviceFeaturesVulkan13);
8254 addFunctionCase(extendedPropertiesTests.get(), "properties", devicePropertiesVulkan13);
8255 addFunctionCase(extendedPropertiesTests.get(), "feature_extensions_consistency",
8256 deviceFeatureExtensionsConsistencyVulkan13);
8257 addFunctionCase(extendedPropertiesTests.get(), "property_extensions_consistency",
8258 devicePropertyExtensionsConsistencyVulkan13);
8259 addFunctionCase(extendedPropertiesTests.get(), "feature_bits_influence", checkApiVersionSupport<1, 3>,
8260 featureBitInfluenceOnDeviceCreate<VK_API_VERSION_1_3>);
8261
8262 infoTests->addChild(extendedPropertiesTests.release());
8263 }
8264 {
8265 // Vulkan 1.4 related tests
8266 de::MovePtr<tcu::TestCaseGroup> extendedPropertiesTests(new tcu::TestCaseGroup(testCtx, "vulkan1p4"));
8267
8268 addFunctionCase(extendedPropertiesTests.get(), "features", deviceFeaturesVulkan14);
8269 addFunctionCase(extendedPropertiesTests.get(), "properties", devicePropertiesVulkan14);
8270 addFunctionCase(extendedPropertiesTests.get(), "feature_extensions_consistency",
8271 deviceFeatureExtensionsConsistencyVulkan14);
8272 addFunctionCase(extendedPropertiesTests.get(), "property_extensions_consistency",
8273 devicePropertyExtensionsConsistencyVulkan14);
8274 addFunctionCase(extendedPropertiesTests.get(), "feature_bits_influence", checkApiVersionSupport<1, 4>,
8275 featureBitInfluenceOnDeviceCreate<VK_API_VERSION_1_4>);
8276
8277 infoTests->addChild(extendedPropertiesTests.release());
8278 }
8279 #endif // CTS_USES_VULKANSC
8280
8281 {
8282 de::MovePtr<tcu::TestCaseGroup> limitsValidationTests(
8283 new tcu::TestCaseGroup(testCtx, "vulkan1p2_limits_validation"));
8284
8285 addFunctionCase(limitsValidationTests.get(), "general", checkApiVersionSupport<1, 2>, validateLimits12);
8286 #ifndef CTS_USES_VULKANSC
8287 // Removed from Vulkan SC test set: VK_KHR_push_descriptor extension removed from Vulkan SC
8288 addFunctionCase(limitsValidationTests.get(), "khr_push_descriptor", checkSupportKhrPushDescriptor,
8289 validateLimitsKhrPushDescriptor);
8290 #endif // CTS_USES_VULKANSC
8291 addFunctionCase(limitsValidationTests.get(), "khr_multiview", checkSupportKhrMultiview,
8292 validateLimitsKhrMultiview);
8293 addFunctionCase(limitsValidationTests.get(), "ext_discard_rectangles", checkSupportExtDiscardRectangles,
8294 validateLimitsExtDiscardRectangles);
8295 addFunctionCase(limitsValidationTests.get(), "ext_sample_locations", checkSupportExtSampleLocations,
8296 validateLimitsExtSampleLocations);
8297 addFunctionCase(limitsValidationTests.get(), "ext_external_memory_host", checkSupportExtExternalMemoryHost,
8298 validateLimitsExtExternalMemoryHost);
8299 addFunctionCase(limitsValidationTests.get(), "ext_blend_operation_advanced",
8300 checkSupportExtBlendOperationAdvanced, validateLimitsExtBlendOperationAdvanced);
8301 addFunctionCase(limitsValidationTests.get(), "khr_maintenance_3", checkSupportKhrMaintenance3,
8302 validateLimitsKhrMaintenance3);
8303 addFunctionCase(limitsValidationTests.get(), "ext_conservative_rasterization",
8304 checkSupportExtConservativeRasterization, validateLimitsExtConservativeRasterization);
8305 addFunctionCase(limitsValidationTests.get(), "ext_descriptor_indexing", checkSupportExtDescriptorIndexing,
8306 validateLimitsExtDescriptorIndexing);
8307 #ifndef CTS_USES_VULKANSC
8308 // Removed from Vulkan SC test set: VK_EXT_inline_uniform_block extension removed from Vulkan SC
8309 addFunctionCase(limitsValidationTests.get(), "ext_inline_uniform_block", checkSupportExtInlineUniformBlock,
8310 validateLimitsExtInlineUniformBlock);
8311 #endif // CTS_USES_VULKANSC
8312 addFunctionCase(limitsValidationTests.get(), "ext_vertex_attribute_divisor",
8313 checkSupportExtVertexAttributeDivisorEXT, validateLimitsExtVertexAttributeDivisorEXT);
8314 addFunctionCase(limitsValidationTests.get(), "khr_vertex_attribute_divisor",
8315 checkSupportExtVertexAttributeDivisorKHR, validateLimitsExtVertexAttributeDivisorKHR);
8316 #ifndef CTS_USES_VULKANSC
8317 // Removed from Vulkan SC test set: extensions VK_NV_mesh_shader, VK_EXT_transform_feedback, VK_EXT_fragment_density_map, VK_NV_ray_tracing extension removed from Vulkan SC
8318 addFunctionCase(limitsValidationTests.get(), "nv_mesh_shader", checkSupportNvMeshShader,
8319 validateLimitsNvMeshShader);
8320 addFunctionCase(limitsValidationTests.get(), "ext_transform_feedback", checkSupportExtTransformFeedback,
8321 validateLimitsExtTransformFeedback);
8322 addFunctionCase(limitsValidationTests.get(), "fragment_density_map", checkSupportExtFragmentDensityMap,
8323 validateLimitsExtFragmentDensityMap);
8324 addFunctionCase(limitsValidationTests.get(), "nv_ray_tracing", checkSupportNvRayTracing,
8325 validateLimitsNvRayTracing);
8326 #endif
8327 addFunctionCase(limitsValidationTests.get(), "timeline_semaphore", checkSupportKhrTimelineSemaphore,
8328 validateLimitsKhrTimelineSemaphore);
8329 addFunctionCase(limitsValidationTests.get(), "ext_line_rasterization", checkSupportExtLineRasterization,
8330 validateLimitsLineRasterization);
8331 addFunctionCase(limitsValidationTests.get(), "khr_line_rasterization", checkSupportKhrLineRasterization,
8332 validateLimitsLineRasterization);
8333 addFunctionCase(limitsValidationTests.get(), "robustness2", checkSupportRobustness2, validateLimitsRobustness2);
8334
8335 infoTests->addChild(limitsValidationTests.release());
8336 }
8337
8338 {
8339 de::MovePtr<tcu::TestCaseGroup> limitsValidationTests(
8340 new tcu::TestCaseGroup(testCtx, "vulkan1p3_limits_validation"));
8341
8342 #ifndef CTS_USES_VULKANSC
8343 addFunctionCase(limitsValidationTests.get(), "khr_maintenance4", checkSupportKhrMaintenance4,
8344 validateLimitsKhrMaintenance4);
8345 addFunctionCase(limitsValidationTests.get(), "max_inline_uniform_total_size", checkApiVersionSupport<1, 3>,
8346 validateLimitsMaxInlineUniformTotalSize);
8347 #endif // CTS_USES_VULKANSC
8348
8349 infoTests->addChild(limitsValidationTests.release());
8350 }
8351
8352 {
8353 de::MovePtr<tcu::TestCaseGroup> limitsValidationTests(
8354 new tcu::TestCaseGroup(testCtx, "vulkan1p4_limits_validation"));
8355
8356 #ifndef CTS_USES_VULKANSC
8357 addFunctionCase(limitsValidationTests.get(), "general", checkApiVersionSupport<1, 4>, validateLimits14);
8358 #endif // CTS_USES_VULKANSC
8359
8360 infoTests->addChild(limitsValidationTests.release());
8361 }
8362
8363 infoTests->addChild(
8364 createTestGroup(testCtx, "image_format_properties2", createImageFormatTests, imageFormatProperties2));
8365 #ifndef CTS_USES_VULKANSC
8366 infoTests->addChild(createTestGroup(testCtx, "sparse_image_format_properties2", createImageFormatTests,
8367 sparseImageFormatProperties2));
8368
8369 {
8370 de::MovePtr<tcu::TestCaseGroup> profilesValidationTests(new tcu::TestCaseGroup(testCtx, "profiles"));
8371
8372 for (const auto &[name, checkSupportFun, validateFun] : profileEntries)
8373 addFunctionCase(profilesValidationTests.get(), name, *checkSupportFun, *validateFun);
8374
8375 infoTests->addChild(profilesValidationTests.release());
8376 }
8377 #endif // CTS_USES_VULKANSC
8378
8379 {
8380 de::MovePtr<tcu::TestCaseGroup> androidTests(new tcu::TestCaseGroup(testCtx, "android"));
8381
8382 // Test that all mandatory extensions are supported
8383 addFunctionCase(androidTests.get(), "mandatory_extensions", android::checkSupportAndroid,
8384 android::testMandatoryExtensions);
8385 // Test for unknown device or instance extensions
8386 addFunctionCase(androidTests.get(), "no_unknown_extensions", android::checkSupportAndroid,
8387 android::testNoUnknownExtensions);
8388 // Test that no layers are enumerated
8389 addFunctionCase(androidTests.get(), "no_layers", android::checkSupportAndroid, android::testNoLayers);
8390
8391 infoTests->addChild(androidTests.release());
8392 }
8393
8394 return infoTests.release();
8395 }
8396
createFeatureInfoInstanceTests(tcu::TestCaseGroup * testGroup)8397 void createFeatureInfoInstanceTests(tcu::TestCaseGroup *testGroup)
8398 {
8399 addFunctionCase(testGroup, "physical_devices", enumeratePhysicalDevices);
8400 addFunctionCase(testGroup, "physical_device_groups", enumeratePhysicalDeviceGroups);
8401 addFunctionCase(testGroup, "instance_layers", enumerateInstanceLayers);
8402 addFunctionCase(testGroup, "instance_extensions", enumerateInstanceExtensions);
8403 addFunctionCase(testGroup, "instance_extension_device_functions",
8404 validateDeviceLevelEntryPointsFromInstanceExtensions);
8405 }
8406
createFeatureInfoDeviceTests(tcu::TestCaseGroup * testGroup)8407 void createFeatureInfoDeviceTests(tcu::TestCaseGroup *testGroup)
8408 {
8409 addFunctionCase(testGroup, "device_features", deviceFeatures);
8410 addFunctionCase(testGroup, "device_properties", deviceProperties);
8411 addFunctionCase(testGroup, "device_queue_family_properties", deviceQueueFamilyProperties);
8412 addFunctionCase(testGroup, "device_memory_properties", deviceMemoryProperties);
8413 addFunctionCase(testGroup, "device_layers", enumerateDeviceLayers);
8414 addFunctionCase(testGroup, "device_extensions", enumerateDeviceExtensions);
8415 addFunctionCase(testGroup, "device_no_khx_extensions", testNoKhxExtensions);
8416 addFunctionCase(testGroup, "device_memory_budget", deviceMemoryBudgetProperties);
8417 addFunctionCase(testGroup, "device_mandatory_features", deviceMandatoryFeatures);
8418 }
8419
createFeatureInfoDeviceGroupTests(tcu::TestCaseGroup * testGroup)8420 void createFeatureInfoDeviceGroupTests(tcu::TestCaseGroup *testGroup)
8421 {
8422 addFunctionCase(testGroup, "device_group_peer_memory_features", deviceGroupPeerMemoryFeatures);
8423 }
8424
8425 } // namespace api
8426 } // namespace vkt
8427