1 /*-------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
5 * Copyright (c) 2015 Google Inc.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * \brief Api Feature Query tests
22 *//*--------------------------------------------------------------------*/
24 #include "vktApiFeatureInfo.hpp"
26 #include "vktTestCaseUtil.hpp"
27 #include "vktTestGroupUtil.hpp"
28 #include "vktCustomInstancesDevices.hpp"
30 #include "vkPlatform.hpp"
31 #include "vkStrUtil.hpp"
33 #include "vkRefUtil.hpp"
34 #include "vkDeviceUtil.hpp"
35 #include "vkSafetyCriticalUtil.hpp"
36 #include "vkQueryUtil.hpp"
37 #include "vkImageUtil.hpp"
38 #include "vkApiVersion.hpp"
40 #include "tcuTestLog.hpp"
41 #include "tcuFormatUtil.hpp"
42 #include "tcuTextureUtil.hpp"
43 #include "tcuResultCollector.hpp"
44 #include "tcuCommandLine.hpp"
46 #include "deUniquePtr.hpp"
48 #include "deStringUtil.hpp"
49 #include "deSTLUtil.hpp"
65 #include "vkApiExtensionDependencyInfo.inl"
72 using tcu::ScopedLogSection;
74 const deUint32 DEUINT32_MAX = std::numeric_limits<deUint32>::max();
78 GUARD_SIZE = 0x20, //!< Number of bytes to check
79 GUARD_VALUE = 0xcd, //!< Data pattern
82 static const VkDeviceSize MINIMUM_REQUIRED_IMAGE_RESOURCE_SIZE = (1LLU<<31); //!< Minimum value for VkImageFormatProperties::maxResourceSize (2GiB)
86 LIMIT_FORMAT_SIGNED_INT,
87 LIMIT_FORMAT_UNSIGNED_INT,
89 LIMIT_FORMAT_DEVICE_SIZE,
104 #define LIMIT(_X_) DE_OFFSET_OF(VkPhysicalDeviceLimits, _X_), (const char*)(#_X_)
105 #define FEATURE(_X_) DE_OFFSET_OF(VkPhysicalDeviceFeatures, _X_)
107 bool validateFeatureLimits(VkPhysicalDeviceProperties* properties, VkPhysicalDeviceFeatures* features, TestLog& log)
109 bool limitsOk = true;
110 VkPhysicalDeviceLimits* limits = &properties->limits;
111 deUint32 shaderStages = 3;
112 deUint32 maxPerStageResourcesMin = deMin32(128, limits->maxPerStageDescriptorUniformBuffers +
113 limits->maxPerStageDescriptorStorageBuffers +
114 limits->maxPerStageDescriptorSampledImages +
115 limits->maxPerStageDescriptorStorageImages +
116 limits->maxPerStageDescriptorInputAttachments +
117 limits->maxColorAttachments);
119 if (features->tessellationShader)
124 if (features->geometryShader)
129 struct FeatureLimitTable
133 deUint32 uintVal; //!< Format is UNSIGNED_INT
134 deInt32 intVal; //!< Format is SIGNED_INT
135 deUint64 deviceSizeVal; //!< Format is DEVICE_SIZE
136 float floatVal; //!< Format is FLOAT
139 deInt32 unsuppTableNdx;
141 } featureLimitTable[] = //!< Based on 1.0.28 Vulkan spec
143 { LIMIT(maxImageDimension1D), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
144 { LIMIT(maxImageDimension2D), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
145 { LIMIT(maxImageDimension3D), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
146 { LIMIT(maxImageDimensionCube), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
147 { LIMIT(maxImageArrayLayers), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
148 { LIMIT(maxTexelBufferElements), 65536, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
149 { LIMIT(maxUniformBufferRange), 16384, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
150 { LIMIT(maxStorageBufferRange), 134217728, 0, 0, 0, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
151 { LIMIT(maxPushConstantsSize), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
152 { LIMIT(maxMemoryAllocationCount), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
153 { LIMIT(maxSamplerAllocationCount), 4000, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
154 { LIMIT(bufferImageGranularity), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1, false },
155 { LIMIT(bufferImageGranularity), 0, 0, 131072, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1, false },
156 { LIMIT(sparseAddressSpaceSize), 0, 0, 2UL*1024*1024*1024, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1, false },
157 { LIMIT(maxBoundDescriptorSets), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
158 { LIMIT(maxPerStageDescriptorSamplers), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
159 { LIMIT(maxPerStageDescriptorUniformBuffers), 12, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
160 { LIMIT(maxPerStageDescriptorStorageBuffers), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
161 { LIMIT(maxPerStageDescriptorSampledImages), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
162 { LIMIT(maxPerStageDescriptorStorageImages), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
163 { LIMIT(maxPerStageDescriptorInputAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
164 { LIMIT(maxPerStageResources), maxPerStageResourcesMin, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
165 { LIMIT(maxDescriptorSetSamplers), shaderStages * 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
166 { LIMIT(maxDescriptorSetUniformBuffers), shaderStages * 12, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
167 { LIMIT(maxDescriptorSetUniformBuffersDynamic), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
168 { LIMIT(maxDescriptorSetStorageBuffers), shaderStages * 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
169 { LIMIT(maxDescriptorSetStorageBuffersDynamic), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
170 { LIMIT(maxDescriptorSetSampledImages), shaderStages * 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
171 { LIMIT(maxDescriptorSetStorageImages), shaderStages * 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
172 { LIMIT(maxDescriptorSetInputAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
173 { LIMIT(maxVertexInputAttributes), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
174 { LIMIT(maxVertexInputBindings), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
175 { LIMIT(maxVertexInputAttributeOffset), 2047, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
176 { LIMIT(maxVertexInputBindingStride), 2048, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
177 { LIMIT(maxVertexOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
178 { LIMIT(maxTessellationGenerationLevel), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
179 { LIMIT(maxTessellationPatchSize), 32, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
180 { LIMIT(maxTessellationControlPerVertexInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
181 { LIMIT(maxTessellationControlPerVertexOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
182 { LIMIT(maxTessellationControlPerPatchOutputComponents), 120, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
183 { LIMIT(maxTessellationControlTotalOutputComponents), 2048, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
184 { LIMIT(maxTessellationEvaluationInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
185 { LIMIT(maxTessellationEvaluationOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
186 { LIMIT(maxGeometryShaderInvocations), 32, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
187 { LIMIT(maxGeometryInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
188 { LIMIT(maxGeometryOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
189 { LIMIT(maxGeometryOutputVertices), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
190 { LIMIT(maxGeometryTotalOutputComponents), 1024, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
191 { LIMIT(maxFragmentInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
192 { LIMIT(maxFragmentOutputAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
193 { LIMIT(maxFragmentDualSrcAttachments), 1, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
194 { LIMIT(maxFragmentCombinedOutputResources), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
195 { LIMIT(maxComputeSharedMemorySize), 16384, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
196 { LIMIT(maxComputeWorkGroupCount[0]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
197 { LIMIT(maxComputeWorkGroupCount[1]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
198 { LIMIT(maxComputeWorkGroupCount[2]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
199 { LIMIT(maxComputeWorkGroupInvocations), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
200 { LIMIT(maxComputeWorkGroupSize[0]), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
201 { LIMIT(maxComputeWorkGroupSize[1]), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
202 { LIMIT(maxComputeWorkGroupSize[2]), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
203 { LIMIT(subPixelPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
204 { LIMIT(subTexelPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
205 { LIMIT(mipmapPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
206 { LIMIT(maxDrawIndexedIndexValue), (deUint32)~0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
207 { LIMIT(maxDrawIndirectCount), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
208 { LIMIT(maxSamplerLodBias), 0, 0, 0, 2.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false },
209 { LIMIT(maxSamplerAnisotropy), 0, 0, 0, 16.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false },
210 { LIMIT(maxViewports), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
211 { LIMIT(maxViewportDimensions[0]), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
212 { LIMIT(maxViewportDimensions[1]), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1, false },
213 { LIMIT(viewportBoundsRange[0]), 0, 0, 0, -8192.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false },
214 { LIMIT(viewportBoundsRange[1]), 0, 0, 0, 8191.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false },
215 { LIMIT(viewportSubPixelBits), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
216 { LIMIT(minMemoryMapAlignment), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, true },
217 { LIMIT(minTexelBufferOffsetAlignment), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1, true },
218 { LIMIT(minTexelBufferOffsetAlignment), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1, true },
219 { LIMIT(minUniformBufferOffsetAlignment), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1, true },
220 { LIMIT(minUniformBufferOffsetAlignment), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1, true },
221 { LIMIT(minStorageBufferOffsetAlignment), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1, true },
222 { LIMIT(minStorageBufferOffsetAlignment), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1, true },
223 { LIMIT(minTexelOffset), 0, -8, 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MAX, -1, false },
224 { LIMIT(maxTexelOffset), 7, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
225 { LIMIT(minTexelGatherOffset), 0, -8, 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MAX, -1, false },
226 { LIMIT(maxTexelGatherOffset), 7, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
227 { LIMIT(minInterpolationOffset), 0, 0, 0, -0.5f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false },
228 { LIMIT(maxInterpolationOffset), 0, 0, 0, 0.5f - (1.0f/deFloatPow(2.0f, (float)limits->subPixelInterpolationOffsetBits)), LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false },
229 { LIMIT(subPixelInterpolationOffsetBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
230 { LIMIT(maxFramebufferWidth), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
231 { LIMIT(maxFramebufferHeight), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
232 { LIMIT(maxFramebufferLayers), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
233 { LIMIT(framebufferColorSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false },
234 { LIMIT(framebufferDepthSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false },
235 { LIMIT(framebufferStencilSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false },
236 { LIMIT(framebufferNoAttachmentsSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false },
237 { LIMIT(maxColorAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
238 { LIMIT(sampledImageColorSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false },
239 { LIMIT(sampledImageIntegerSampleCounts), VK_SAMPLE_COUNT_1_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false },
240 { LIMIT(sampledImageDepthSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false },
241 { LIMIT(sampledImageStencilSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false },
242 { LIMIT(storageImageSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1, false },
243 { LIMIT(maxSampleMaskWords), 1, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
244 { LIMIT(timestampComputeAndGraphics), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1, false },
245 { LIMIT(timestampPeriod), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1, false },
246 { LIMIT(maxClipDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
247 { LIMIT(maxCullDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
248 { LIMIT(maxCombinedClipAndCullDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
249 { LIMIT(discreteQueuePriorities), 2, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1, false },
250 { LIMIT(pointSizeRange[0]), 0, 0, 0, 0.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false },
251 { LIMIT(pointSizeRange[0]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false },
252 { LIMIT(pointSizeRange[1]), 0, 0, 0, 64.0f - limits->pointSizeGranularity , LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false },
253 { LIMIT(lineWidthRange[0]), 0, 0, 0, 0.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false },
254 { LIMIT(lineWidthRange[0]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false },
255 { LIMIT(lineWidthRange[1]), 0, 0, 0, 8.0f - limits->lineWidthGranularity, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1, false },
256 { LIMIT(pointSizeGranularity), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false },
257 { LIMIT(lineWidthGranularity), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1, false },
258 { LIMIT(strictLines), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1, false },
259 { LIMIT(standardSampleLocations), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1, false },
260 { LIMIT(optimalBufferCopyOffsetAlignment), 0, 0, 0, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_NONE, -1, true },
261 { LIMIT(optimalBufferCopyRowPitchAlignment), 0, 0, 0, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_NONE, -1, true },
262 { LIMIT(nonCoherentAtomSize), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1, true },
263 { LIMIT(nonCoherentAtomSize), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1, true },
266 const struct UnsupportedFeatureLimitTable
268 deUint32 limitOffset;
270 deUint32 featureOffset;
271 deUint32 uintVal; //!< Format is UNSIGNED_INT
272 deInt32 intVal; //!< Format is SIGNED_INT
273 deUint64 deviceSizeVal; //!< Format is DEVICE_SIZE
274 float floatVal; //!< Format is FLOAT
275 } unsupportedFeatureTable[] =
277 { LIMIT(sparseAddressSpaceSize), FEATURE(sparseBinding), 0, 0, 0, 0.0f },
278 { LIMIT(maxTessellationGenerationLevel), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
279 { LIMIT(maxTessellationPatchSize), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
280 { LIMIT(maxTessellationControlPerVertexInputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
281 { LIMIT(maxTessellationControlPerVertexOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
282 { LIMIT(maxTessellationControlPerPatchOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
283 { LIMIT(maxTessellationControlTotalOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
284 { LIMIT(maxTessellationEvaluationInputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
285 { LIMIT(maxTessellationEvaluationOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
286 { LIMIT(maxGeometryShaderInvocations), FEATURE(geometryShader), 0, 0, 0, 0.0f },
287 { LIMIT(maxGeometryInputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f },
288 { LIMIT(maxGeometryOutputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f },
289 { LIMIT(maxGeometryOutputVertices), FEATURE(geometryShader), 0, 0, 0, 0.0f },
290 { LIMIT(maxGeometryTotalOutputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f },
291 { LIMIT(maxFragmentDualSrcAttachments), FEATURE(dualSrcBlend), 0, 0, 0, 0.0f },
292 { LIMIT(maxDrawIndexedIndexValue), FEATURE(fullDrawIndexUint32), (1<<24)-1, 0, 0, 0.0f },
293 { LIMIT(maxDrawIndirectCount), FEATURE(multiDrawIndirect), 1, 0, 0, 0.0f },
294 { LIMIT(maxSamplerAnisotropy), FEATURE(samplerAnisotropy), 1, 0, 0, 0.0f },
295 { LIMIT(maxViewports), FEATURE(multiViewport), 1, 0, 0, 0.0f },
296 { LIMIT(minTexelGatherOffset), FEATURE(shaderImageGatherExtended), 0, 0, 0, 0.0f },
297 { LIMIT(maxTexelGatherOffset), FEATURE(shaderImageGatherExtended), 0, 0, 0, 0.0f },
298 { LIMIT(minInterpolationOffset), FEATURE(sampleRateShading), 0, 0, 0, 0.0f },
299 { LIMIT(maxInterpolationOffset), FEATURE(sampleRateShading), 0, 0, 0, 0.0f },
300 { LIMIT(subPixelInterpolationOffsetBits), FEATURE(sampleRateShading), 0, 0, 0, 0.0f },
301 { LIMIT(storageImageSampleCounts), FEATURE(shaderStorageImageMultisample), VK_SAMPLE_COUNT_1_BIT, 0, 0, 0.0f },
302 { LIMIT(maxClipDistances), FEATURE(shaderClipDistance), 0, 0, 0, 0.0f },
303 { LIMIT(maxCullDistances), FEATURE(shaderCullDistance), 0, 0, 0, 0.0f },
304 { LIMIT(maxCombinedClipAndCullDistances), FEATURE(shaderClipDistance), 0, 0, 0, 0.0f },
305 { LIMIT(pointSizeRange[0]), FEATURE(largePoints), 0, 0, 0, 1.0f },
306 { LIMIT(pointSizeRange[1]), FEATURE(largePoints), 0, 0, 0, 1.0f },
307 { LIMIT(lineWidthRange[0]), FEATURE(wideLines), 0, 0, 0, 1.0f },
308 { LIMIT(lineWidthRange[1]), FEATURE(wideLines), 0, 0, 0, 1.0f },
309 { LIMIT(pointSizeGranularity), FEATURE(largePoints), 0, 0, 0, 0.0f },
310 { LIMIT(lineWidthGranularity), FEATURE(wideLines), 0, 0, 0, 0.0f }
313 log << TestLog::Message << *limits << TestLog::EndMessage;
315 //!< First build a map from limit to unsupported table index
316 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
318 for (deUint32 unsuppNdx = 0; unsuppNdx < DE_LENGTH_OF_ARRAY(unsupportedFeatureTable); unsuppNdx++)
320 if (unsupportedFeatureTable[unsuppNdx].limitOffset == featureLimitTable[ndx].offset)
322 featureLimitTable[ndx].unsuppTableNdx = unsuppNdx;
328 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
330 switch (featureLimitTable[ndx].format)
332 case LIMIT_FORMAT_UNSIGNED_INT:
334 deUint32 limitToCheck = featureLimitTable[ndx].uintVal;
335 if (featureLimitTable[ndx].unsuppTableNdx != -1)
337 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
338 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].uintVal;
341 if (featureLimitTable[ndx].pot)
343 if (*((deUint32*)((deUint8*)limits + featureLimitTable[ndx].offset)) == 0 || !deIntIsPow2(*((deUint32*)((deUint8*)limits + featureLimitTable[ndx].offset))))
345 log << TestLog::Message << "limit Validation failed " << featureLimitTable[ndx].name
346 << " is not a power of two." << TestLog::EndMessage;
351 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
353 if (*((deUint32*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
355 log << TestLog::Message << "limit Validation failed " << featureLimitTable[ndx].name
356 << " not valid-limit type MIN - actual is "
357 << *((deUint32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
361 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
363 if (*((deUint32*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
365 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
366 << " not valid-limit type MAX - actual is "
367 << *((deUint32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
374 case LIMIT_FORMAT_FLOAT:
376 float limitToCheck = featureLimitTable[ndx].floatVal;
377 if (featureLimitTable[ndx].unsuppTableNdx != -1)
379 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
380 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].floatVal;
383 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
385 if (*((float*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
387 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
388 << " not valid-limit type MIN - actual is "
389 << *((float*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
393 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
395 if (*((float*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
397 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
398 << " not valid-limit type MAX actual is "
399 << *((float*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
406 case LIMIT_FORMAT_SIGNED_INT:
408 deInt32 limitToCheck = featureLimitTable[ndx].intVal;
409 if (featureLimitTable[ndx].unsuppTableNdx != -1)
411 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
412 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].intVal;
414 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
416 if (*((deInt32*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
418 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
419 << " not valid-limit type MIN actual is "
420 << *((deInt32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
424 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
426 if (*((deInt32*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
428 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
429 << " not valid-limit type MAX actual is "
430 << *((deInt32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
437 case LIMIT_FORMAT_DEVICE_SIZE:
439 deUint64 limitToCheck = featureLimitTable[ndx].deviceSizeVal;
440 if (featureLimitTable[ndx].unsuppTableNdx != -1)
442 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
443 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].deviceSizeVal;
446 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
448 if (*((deUint64*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
450 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
451 << " not valid-limit type MIN actual is "
452 << *((deUint64*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
456 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
458 if (*((deUint64*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
460 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
461 << " not valid-limit type MAX actual is "
462 << *((deUint64*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
469 case LIMIT_FORMAT_BITMASK:
471 deUint32 limitToCheck = featureLimitTable[ndx].uintVal;
472 if (featureLimitTable[ndx].unsuppTableNdx != -1)
474 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
475 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].uintVal;
478 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
480 if ((*((deUint32*)((deUint8*)limits+featureLimitTable[ndx].offset)) & limitToCheck) != limitToCheck)
482 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
483 << " not valid-limit type bitmask actual is "
484 << *((deUint64*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
497 if (limits->maxFramebufferWidth > limits->maxViewportDimensions[0] ||
498 limits->maxFramebufferHeight > limits->maxViewportDimensions[1])
500 log << TestLog::Message << "limit validation failed, maxFramebufferDimension of "
501 << "[" << limits->maxFramebufferWidth << ", " << limits->maxFramebufferHeight << "] "
502 << "is larger than maxViewportDimension of "
503 << "[" << limits->maxViewportDimensions[0] << ", " << limits->maxViewportDimensions[1] << "]" << TestLog::EndMessage;
507 if (limits->viewportBoundsRange[0] > float(-2 * limits->maxViewportDimensions[0]))
509 log << TestLog::Message << "limit validation failed, viewPortBoundsRange[0] of " << limits->viewportBoundsRange[0]
510 << "is larger than -2*maxViewportDimension[0] of " << -2*limits->maxViewportDimensions[0] << TestLog::EndMessage;
514 if (limits->viewportBoundsRange[1] < float(2 * limits->maxViewportDimensions[1] - 1))
516 log << TestLog::Message << "limit validation failed, viewportBoundsRange[1] of " << limits->viewportBoundsRange[1]
517 << "is less than 2*maxViewportDimension[1] of " << 2*limits->maxViewportDimensions[1] << TestLog::EndMessage;
524 template<deUint32 MAJOR, deUint32 MINOR>
525 void checkApiVersionSupport(Context& context)
527 if (!context.contextSupports(vk::ApiVersion(0, MAJOR, MINOR, 0)))
528 TCU_THROW(NotSupportedError, std::string("At least Vulkan ") + std::to_string(MAJOR) + "." + std::to_string(MINOR) + " required to run test");
531 typedef struct FeatureLimitTableItem_
534 const char* condName;
537 deUint32 uintVal; //!< Format is UNSIGNED_INT
538 deInt32 intVal; //!< Format is SIGNED_INT
539 deUint64 deviceSizeVal; //!< Format is DEVICE_SIZE
540 float floatVal; //!< Format is FLOAT
543 } FeatureLimitTableItem;
546 bool validateNumericLimit (const T limitToCheck, const T reportedValue, const LimitType limitType, const char* limitName, TestLog& log)
548 if (limitType == LIMIT_TYPE_MIN)
550 if (reportedValue < limitToCheck)
552 log << TestLog::Message << "Limit validation failed " << limitName
553 << " reported value is " << reportedValue
554 << " expected MIN " << limitToCheck
555 << TestLog::EndMessage;
560 log << TestLog::Message << limitName
561 << "=" << reportedValue
562 << " (>=" << limitToCheck << ")"
563 << TestLog::EndMessage;
565 else if (limitType == LIMIT_TYPE_MAX)
567 if (reportedValue > limitToCheck)
569 log << TestLog::Message << "Limit validation failed " << limitName
570 << " reported value is " << reportedValue
571 << " expected MAX " << limitToCheck
572 << TestLog::EndMessage;
577 log << TestLog::Message << limitName
578 << "=" << reportedValue
579 << " (<=" << limitToCheck << ")"
580 << TestLog::EndMessage;
587 bool validateBitmaskLimit (const T limitToCheck, const T reportedValue, const LimitType limitType, const char* limitName, TestLog& log)
589 if (limitType == LIMIT_TYPE_MIN)
591 if ((reportedValue & limitToCheck) != limitToCheck)
593 log << TestLog::Message << "Limit validation failed " << limitName
594 << " reported value is " << reportedValue
595 << " expected MIN " << limitToCheck
596 << TestLog::EndMessage;
601 log << TestLog::Message << limitName
602 << "=" << tcu::toHex(reportedValue)
603 << " (contains " << tcu::toHex(limitToCheck) << ")"
604 << TestLog::EndMessage;
610 bool validateLimit (FeatureLimitTableItem limit, TestLog& log)
612 if (*((VkBool32*)limit.cond) == DE_FALSE)
614 log << TestLog::Message
615 << "Limit validation skipped '" << limit.name << "' due to "
616 << limit.condName << " == false'"
617 << TestLog::EndMessage;
622 switch (limit.format)
624 case LIMIT_FORMAT_UNSIGNED_INT:
626 const deUint32 limitToCheck = limit.uintVal;
627 const deUint32 reportedValue = *(deUint32*)limit.ptr;
629 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
632 case LIMIT_FORMAT_FLOAT:
634 const float limitToCheck = limit.floatVal;
635 const float reportedValue = *(float*)limit.ptr;
637 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
640 case LIMIT_FORMAT_SIGNED_INT:
642 const deInt32 limitToCheck = limit.intVal;
643 const deInt32 reportedValue = *(deInt32*)limit.ptr;
645 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
648 case LIMIT_FORMAT_DEVICE_SIZE:
650 const deUint64 limitToCheck = limit.deviceSizeVal;
651 const deUint64 reportedValue = *(deUint64*)limit.ptr;
653 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
656 case LIMIT_FORMAT_BITMASK:
658 const deUint32 limitToCheck = limit.uintVal;
659 const deUint32 reportedValue = *(deUint32*)limit.ptr;
661 return validateBitmaskLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
665 TCU_THROW(InternalError, "Unknown LimitFormat specified");
672 #define PN(_X_) &(_X_), (const char*)(#_X_)
675 #define LIM_MIN_UINT32(X) deUint32(X), 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN
676 #define LIM_MAX_UINT32(X) deUint32(X), 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MAX
677 #define LIM_NONE_UINT32 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE
678 #define LIM_MIN_INT32(X) 0, deInt32(X), 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MIN
679 #define LIM_MAX_INT32(X) 0, deInt32(X), 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MAX
680 #define LIM_NONE_INT32 0, 0, 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_NONE
681 #define LIM_MIN_DEVSIZE(X) 0, 0, VkDeviceSize(X), 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN
682 #define LIM_MAX_DEVSIZE(X) 0, 0, VkDeviceSize(X), 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX
683 #define LIM_NONE_DEVSIZE 0, 0, 0, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_NONE
684 #define LIM_MIN_FLOAT(X) 0, 0, 0, float(X), LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN
685 #define LIM_MAX_FLOAT(X) 0, 0, 0, float(X), LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX
686 #define LIM_NONE_FLOAT 0, 0, 0, 0.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_NONE
687 #define LIM_MIN_BITI32(X) deUint32(X), 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN
688 #define LIM_MAX_BITI32(X) deUint32(X), 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MAX
689 #define LIM_NONE_BITI32 0, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_NONE
691 tcu::TestStatus validateLimits12 (Context& context)
693 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
694 const InstanceInterface& vki = context.getInstanceInterface();
695 TestLog& log = context.getTestContext().getLog();
696 bool limitsOk = true;
698 const VkPhysicalDeviceFeatures2& features2 = context.getDeviceFeatures2();
699 const VkPhysicalDeviceFeatures& features = features2.features;
700 #ifdef CTS_USES_VULKANSC
701 const VkPhysicalDeviceVulkan11Features features11 = getPhysicalDeviceVulkan11Features(vki, physicalDevice);
702 #endif // CTS_USES_VULKANSC
703 const VkPhysicalDeviceVulkan12Features features12 = getPhysicalDeviceVulkan12Features(vki, physicalDevice);
705 const VkPhysicalDeviceProperties2& properties2 = context.getDeviceProperties2();
706 const VkPhysicalDeviceVulkan12Properties vulkan12Properties = getPhysicalDeviceVulkan12Properties(vki, physicalDevice);
707 const VkPhysicalDeviceVulkan11Properties vulkan11Properties = getPhysicalDeviceVulkan11Properties(vki, physicalDevice);
708 #ifdef CTS_USES_VULKANSC
709 const VkPhysicalDeviceVulkanSC10Properties vulkanSC10Properties = getPhysicalDeviceVulkanSC10Properties(vki, physicalDevice);
710 #endif // CTS_USES_VULKANSC
711 const VkPhysicalDeviceLimits& limits = properties2.properties.limits;
713 const VkBool32 checkAlways = VK_TRUE;
714 const VkBool32 checkVulkan12Limit = VK_TRUE;
715 #ifdef CTS_USES_VULKANSC
716 const VkBool32 checkVulkanSC10Limit = VK_TRUE;
717 #endif // CTS_USES_VULKANSC
719 deUint32 shaderStages = 3;
720 deUint32 maxPerStageResourcesMin = deMin32(128, limits.maxPerStageDescriptorUniformBuffers +
721 limits.maxPerStageDescriptorStorageBuffers +
722 limits.maxPerStageDescriptorSampledImages +
723 limits.maxPerStageDescriptorStorageImages +
724 limits.maxPerStageDescriptorInputAttachments +
725 limits.maxColorAttachments);
727 if (features.tessellationShader)
732 if (features.geometryShader)
737 FeatureLimitTableItem featureLimitTable[] =
739 { PN(checkAlways), PN(limits.maxImageDimension1D), LIM_MIN_UINT32(4096) },
740 { PN(checkAlways), PN(limits.maxImageDimension2D), LIM_MIN_UINT32(4096) },
741 { PN(checkAlways), PN(limits.maxImageDimension3D), LIM_MIN_UINT32(256) },
742 { PN(checkAlways), PN(limits.maxImageDimensionCube), LIM_MIN_UINT32(4096) },
743 { PN(checkAlways), PN(limits.maxImageArrayLayers), LIM_MIN_UINT32(256) },
744 { PN(checkAlways), PN(limits.maxTexelBufferElements), LIM_MIN_UINT32(65536) },
745 { PN(checkAlways), PN(limits.maxUniformBufferRange), LIM_MIN_UINT32(16384) },
746 { PN(checkAlways), PN(limits.maxStorageBufferRange), LIM_MIN_UINT32((1<<27)) },
747 { PN(checkAlways), PN(limits.maxPushConstantsSize), LIM_MIN_UINT32(128) },
748 { PN(checkAlways), PN(limits.maxMemoryAllocationCount), LIM_MIN_UINT32(4096) },
749 { PN(checkAlways), PN(limits.maxSamplerAllocationCount), LIM_MIN_UINT32(4000) },
750 { PN(checkAlways), PN(limits.bufferImageGranularity), LIM_MIN_DEVSIZE(1) },
751 { PN(checkAlways), PN(limits.bufferImageGranularity), LIM_MAX_DEVSIZE(131072) },
752 { PN(features.sparseBinding), PN(limits.sparseAddressSpaceSize), LIM_MIN_DEVSIZE((1ull<<31)) },
753 { PN(checkAlways), PN(limits.maxBoundDescriptorSets), LIM_MIN_UINT32(4) },
754 { PN(checkAlways), PN(limits.maxPerStageDescriptorSamplers), LIM_MIN_UINT32(16) },
755 { PN(checkAlways), PN(limits.maxPerStageDescriptorUniformBuffers), LIM_MIN_UINT32(12) },
756 { PN(checkAlways), PN(limits.maxPerStageDescriptorStorageBuffers), LIM_MIN_UINT32(4) },
757 { PN(checkAlways), PN(limits.maxPerStageDescriptorSampledImages), LIM_MIN_UINT32(16) },
758 { PN(checkAlways), PN(limits.maxPerStageDescriptorStorageImages), LIM_MIN_UINT32(4) },
759 { PN(checkAlways), PN(limits.maxPerStageDescriptorInputAttachments), LIM_MIN_UINT32(4) },
760 { PN(checkAlways), PN(limits.maxPerStageResources), LIM_MIN_UINT32(maxPerStageResourcesMin) },
761 { PN(checkAlways), PN(limits.maxDescriptorSetSamplers), LIM_MIN_UINT32(shaderStages * 16) },
762 { PN(checkAlways), PN(limits.maxDescriptorSetUniformBuffers), LIM_MIN_UINT32(shaderStages * 12) },
763 { PN(checkAlways), PN(limits.maxDescriptorSetUniformBuffersDynamic), LIM_MIN_UINT32(8) },
764 { PN(checkAlways), PN(limits.maxDescriptorSetStorageBuffers), LIM_MIN_UINT32(shaderStages * 4) },
765 { PN(checkAlways), PN(limits.maxDescriptorSetStorageBuffersDynamic), LIM_MIN_UINT32(4) },
766 { PN(checkAlways), PN(limits.maxDescriptorSetSampledImages), LIM_MIN_UINT32(shaderStages * 16) },
767 { PN(checkAlways), PN(limits.maxDescriptorSetStorageImages), LIM_MIN_UINT32(shaderStages * 4) },
768 { PN(checkAlways), PN(limits.maxDescriptorSetInputAttachments), LIM_MIN_UINT32(4) },
769 { PN(checkAlways), PN(limits.maxVertexInputAttributes), LIM_MIN_UINT32(16) },
770 { PN(checkAlways), PN(limits.maxVertexInputBindings), LIM_MIN_UINT32(16) },
771 { PN(checkAlways), PN(limits.maxVertexInputAttributeOffset), LIM_MIN_UINT32(2047) },
772 { PN(checkAlways), PN(limits.maxVertexInputBindingStride), LIM_MIN_UINT32(2048) },
773 { PN(checkAlways), PN(limits.maxVertexOutputComponents), LIM_MIN_UINT32(64) },
774 { PN(features.tessellationShader), PN(limits.maxTessellationGenerationLevel), LIM_MIN_UINT32(64) },
775 { PN(features.tessellationShader), PN(limits.maxTessellationPatchSize), LIM_MIN_UINT32(32) },
776 { PN(features.tessellationShader), PN(limits.maxTessellationControlPerVertexInputComponents), LIM_MIN_UINT32(64) },
777 { PN(features.tessellationShader), PN(limits.maxTessellationControlPerVertexOutputComponents), LIM_MIN_UINT32(64) },
778 { PN(features.tessellationShader), PN(limits.maxTessellationControlPerPatchOutputComponents), LIM_MIN_UINT32(120) },
779 { PN(features.tessellationShader), PN(limits.maxTessellationControlTotalOutputComponents), LIM_MIN_UINT32(2048) },
780 { PN(features.tessellationShader), PN(limits.maxTessellationEvaluationInputComponents), LIM_MIN_UINT32(64) },
781 { PN(features.tessellationShader), PN(limits.maxTessellationEvaluationOutputComponents), LIM_MIN_UINT32(64) },
782 { PN(features.geometryShader), PN(limits.maxGeometryShaderInvocations), LIM_MIN_UINT32(32) },
783 { PN(features.geometryShader), PN(limits.maxGeometryInputComponents), LIM_MIN_UINT32(64) },
784 { PN(features.geometryShader), PN(limits.maxGeometryOutputComponents), LIM_MIN_UINT32(64) },
785 { PN(features.geometryShader), PN(limits.maxGeometryOutputVertices), LIM_MIN_UINT32(256) },
786 { PN(features.geometryShader), PN(limits.maxGeometryTotalOutputComponents), LIM_MIN_UINT32(1024) },
787 { PN(checkAlways), PN(limits.maxFragmentInputComponents), LIM_MIN_UINT32(64) },
788 { PN(checkAlways), PN(limits.maxFragmentOutputAttachments), LIM_MIN_UINT32(4) },
789 { PN(features.dualSrcBlend), PN(limits.maxFragmentDualSrcAttachments), LIM_MIN_UINT32(1) },
790 { PN(checkAlways), PN(limits.maxFragmentCombinedOutputResources), LIM_MIN_UINT32(4) },
791 { PN(checkAlways), PN(limits.maxComputeSharedMemorySize), LIM_MIN_UINT32(16384) },
792 { PN(checkAlways), PN(limits.maxComputeWorkGroupCount[0]), LIM_MIN_UINT32(65535) },
793 { PN(checkAlways), PN(limits.maxComputeWorkGroupCount[1]), LIM_MIN_UINT32(65535) },
794 { PN(checkAlways), PN(limits.maxComputeWorkGroupCount[2]), LIM_MIN_UINT32(65535) },
795 { PN(checkAlways), PN(limits.maxComputeWorkGroupInvocations), LIM_MIN_UINT32(128) },
796 { PN(checkAlways), PN(limits.maxComputeWorkGroupSize[0]), LIM_MIN_UINT32(128) },
797 { PN(checkAlways), PN(limits.maxComputeWorkGroupSize[1]), LIM_MIN_UINT32(128) },
798 { PN(checkAlways), PN(limits.maxComputeWorkGroupSize[2]), LIM_MIN_UINT32(64) },
799 { PN(checkAlways), PN(limits.subPixelPrecisionBits), LIM_MIN_UINT32(4) },
800 { PN(checkAlways), PN(limits.subTexelPrecisionBits), LIM_MIN_UINT32(4) },
801 { PN(checkAlways), PN(limits.mipmapPrecisionBits), LIM_MIN_UINT32(4) },
802 { PN(features.fullDrawIndexUint32), PN(limits.maxDrawIndexedIndexValue), LIM_MIN_UINT32((deUint32)~0) },
803 { PN(features.multiDrawIndirect), PN(limits.maxDrawIndirectCount), LIM_MIN_UINT32(65535) },
804 { PN(checkAlways), PN(limits.maxSamplerLodBias), LIM_MIN_FLOAT(2.0f) },
805 { PN(features.samplerAnisotropy), PN(limits.maxSamplerAnisotropy), LIM_MIN_FLOAT(16.0f) },
806 { PN(features.multiViewport), PN(limits.maxViewports), LIM_MIN_UINT32(16) },
807 { PN(checkAlways), PN(limits.maxViewportDimensions[0]), LIM_MIN_UINT32(4096) },
808 { PN(checkAlways), PN(limits.maxViewportDimensions[1]), LIM_MIN_UINT32(4096) },
809 { PN(checkAlways), PN(limits.viewportBoundsRange[0]), LIM_MAX_FLOAT(-8192.0f) },
810 { PN(checkAlways), PN(limits.viewportBoundsRange[1]), LIM_MIN_FLOAT(8191.0f) },
811 { PN(checkAlways), PN(limits.viewportSubPixelBits), LIM_MIN_UINT32(0) },
812 { PN(checkAlways), PN(limits.minMemoryMapAlignment), LIM_MIN_UINT32(64) },
813 { PN(checkAlways), PN(limits.minTexelBufferOffsetAlignment), LIM_MIN_DEVSIZE(1) },
814 { PN(checkAlways), PN(limits.minTexelBufferOffsetAlignment), LIM_MAX_DEVSIZE(256) },
815 { PN(checkAlways), PN(limits.minUniformBufferOffsetAlignment), LIM_MIN_DEVSIZE(1) },
816 { PN(checkAlways), PN(limits.minUniformBufferOffsetAlignment), LIM_MAX_DEVSIZE(256) },
817 { PN(checkAlways), PN(limits.minStorageBufferOffsetAlignment), LIM_MIN_DEVSIZE(1) },
818 { PN(checkAlways), PN(limits.minStorageBufferOffsetAlignment), LIM_MAX_DEVSIZE(256) },
819 { PN(checkAlways), PN(limits.minTexelOffset), LIM_MAX_INT32(-8) },
820 { PN(checkAlways), PN(limits.maxTexelOffset), LIM_MIN_INT32(7) },
821 { PN(features.shaderImageGatherExtended), PN(limits.minTexelGatherOffset), LIM_MAX_INT32(-8) },
822 { PN(features.shaderImageGatherExtended), PN(limits.maxTexelGatherOffset), LIM_MIN_INT32(7) },
823 { PN(features.sampleRateShading), PN(limits.minInterpolationOffset), LIM_MAX_FLOAT(-0.5f) },
824 { PN(features.sampleRateShading), PN(limits.maxInterpolationOffset), LIM_MIN_FLOAT(0.5f - (1.0f/deFloatPow(2.0f, (float)limits.subPixelInterpolationOffsetBits))) },
825 { PN(features.sampleRateShading), PN(limits.subPixelInterpolationOffsetBits), LIM_MIN_UINT32(4) },
826 { PN(checkAlways), PN(limits.maxFramebufferWidth), LIM_MIN_UINT32(4096) },
827 { PN(checkAlways), PN(limits.maxFramebufferHeight), LIM_MIN_UINT32(4096) },
828 { PN(checkAlways), PN(limits.maxFramebufferLayers), LIM_MIN_UINT32(256) },
829 { PN(checkAlways), PN(limits.framebufferColorSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
830 { PN(checkVulkan12Limit), PN(vulkan12Properties.framebufferIntegerColorSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT) },
831 { PN(checkAlways), PN(limits.framebufferDepthSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
832 { PN(checkAlways), PN(limits.framebufferStencilSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
833 { PN(checkAlways), PN(limits.framebufferNoAttachmentsSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
834 { PN(checkAlways), PN(limits.maxColorAttachments), LIM_MIN_UINT32(4) },
835 { PN(checkAlways), PN(limits.sampledImageColorSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
836 { PN(checkAlways), PN(limits.sampledImageIntegerSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT) },
837 { PN(checkAlways), PN(limits.sampledImageDepthSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
838 { PN(checkAlways), PN(limits.sampledImageStencilSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
839 { PN(features.shaderStorageImageMultisample), PN(limits.storageImageSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
840 { PN(checkAlways), PN(limits.maxSampleMaskWords), LIM_MIN_UINT32(1) },
841 { PN(checkAlways), PN(limits.timestampComputeAndGraphics), LIM_NONE_UINT32 },
842 { PN(checkAlways), PN(limits.timestampPeriod), LIM_NONE_UINT32 },
843 { PN(features.shaderClipDistance), PN(limits.maxClipDistances), LIM_MIN_UINT32(8) },
844 { PN(features.shaderCullDistance), PN(limits.maxCullDistances), LIM_MIN_UINT32(8) },
845 { PN(features.shaderClipDistance), PN(limits.maxCombinedClipAndCullDistances), LIM_MIN_UINT32(8) },
846 { PN(checkAlways), PN(limits.discreteQueuePriorities), LIM_MIN_UINT32(2) },
847 { PN(features.largePoints), PN(limits.pointSizeRange[0]), LIM_MIN_FLOAT(0.0f) },
848 { PN(features.largePoints), PN(limits.pointSizeRange[0]), LIM_MAX_FLOAT(1.0f) },
849 { PN(features.largePoints), PN(limits.pointSizeRange[1]), LIM_MIN_FLOAT(64.0f - limits.pointSizeGranularity) },
850 { PN(features.wideLines), PN(limits.lineWidthRange[0]), LIM_MIN_FLOAT(0.0f) },
851 { PN(features.wideLines), PN(limits.lineWidthRange[0]), LIM_MAX_FLOAT(1.0f) },
852 { PN(features.wideLines), PN(limits.lineWidthRange[1]), LIM_MIN_FLOAT(8.0f - limits.lineWidthGranularity) },
853 { PN(features.largePoints), PN(limits.pointSizeGranularity), LIM_MIN_FLOAT(0.0f) },
854 { PN(features.largePoints), PN(limits.pointSizeGranularity), LIM_MAX_FLOAT(1.0f) },
855 { PN(features.wideLines), PN(limits.lineWidthGranularity), LIM_MIN_FLOAT(0.0f) },
856 { PN(features.wideLines), PN(limits.lineWidthGranularity), LIM_MAX_FLOAT(1.0f) },
857 { PN(checkAlways), PN(limits.strictLines), LIM_NONE_UINT32 },
858 { PN(checkAlways), PN(limits.standardSampleLocations), LIM_NONE_UINT32 },
859 { PN(checkAlways), PN(limits.optimalBufferCopyOffsetAlignment), LIM_NONE_DEVSIZE },
860 { PN(checkAlways), PN(limits.optimalBufferCopyRowPitchAlignment), LIM_NONE_DEVSIZE },
861 { PN(checkAlways), PN(limits.nonCoherentAtomSize), LIM_MIN_DEVSIZE(1) },
862 { PN(checkAlways), PN(limits.nonCoherentAtomSize), LIM_MAX_DEVSIZE(256) },
865 #ifndef CTS_USES_VULKANSC
866 { PN(checkVulkan12Limit), PN(vulkan11Properties.maxMultiviewViewCount), LIM_MIN_UINT32(6) },
867 { PN(checkVulkan12Limit), PN(vulkan11Properties.maxMultiviewInstanceIndex), LIM_MIN_UINT32((1 << 27) - 1) },
869 { PN(features11.multiview), PN(vulkan11Properties.maxMultiviewViewCount), LIM_MIN_UINT32(6) },
870 { PN(features11.multiview), PN(vulkan11Properties.maxMultiviewInstanceIndex), LIM_MIN_UINT32((1 << 27) - 1) },
871 #endif // CTS_USES_VULKANSC
873 // VK_KHR_maintenance3
874 { PN(checkVulkan12Limit), PN(vulkan11Properties.maxPerSetDescriptors), LIM_MIN_UINT32(1024) },
875 { PN(checkVulkan12Limit), PN(vulkan11Properties.maxMemoryAllocationSize), LIM_MIN_DEVSIZE(1<<30) },
877 // VK_EXT_descriptor_indexing
878 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxUpdateAfterBindDescriptorsInAllPools), LIM_MIN_UINT32(500000) },
879 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSamplers), LIM_MIN_UINT32(500000) },
880 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(12) },
881 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(500000) },
882 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSampledImages), LIM_MIN_UINT32(500000) },
883 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageImages), LIM_MIN_UINT32(500000) },
884 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindInputAttachments), LIM_MIN_UINT32(4) },
885 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageUpdateAfterBindResources), LIM_MIN_UINT32(500000) },
886 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSamplers), LIM_MIN_UINT32(500000) },
887 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(shaderStages * 12) },
888 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic), LIM_MIN_UINT32(8) },
889 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(500000) },
890 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic), LIM_MIN_UINT32(4) },
891 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSampledImages), LIM_MIN_UINT32(500000) },
892 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageImages), LIM_MIN_UINT32(500000) },
893 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindInputAttachments), LIM_MIN_UINT32(4) },
894 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSamplers), LIM_MIN_UINT32(limits.maxPerStageDescriptorSamplers) },
895 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(limits.maxPerStageDescriptorUniformBuffers) },
896 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageBuffers) },
897 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSampledImages), LIM_MIN_UINT32(limits.maxPerStageDescriptorSampledImages) },
898 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageImages), LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageImages) },
899 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindInputAttachments), LIM_MIN_UINT32(limits.maxPerStageDescriptorInputAttachments) },
900 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageUpdateAfterBindResources), LIM_MIN_UINT32(limits.maxPerStageResources) },
901 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSamplers), LIM_MIN_UINT32(limits.maxDescriptorSetSamplers) },
902 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffers) },
903 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic), LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffersDynamic) },
904 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffers) },
905 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic), LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffersDynamic) },
906 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSampledImages), LIM_MIN_UINT32(limits.maxDescriptorSetSampledImages) },
907 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageImages), LIM_MIN_UINT32(limits.maxDescriptorSetStorageImages) },
908 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindInputAttachments), LIM_MIN_UINT32(limits.maxDescriptorSetInputAttachments) },
911 #ifndef CTS_USES_VULKANSC
912 { PN(checkVulkan12Limit), PN(vulkan12Properties.maxTimelineSemaphoreValueDifference), LIM_MIN_DEVSIZE((1ull << 31) - 1) },
914 // VkPhysicalDeviceVulkan12Features::timelineSemaphore is optional in Vulkan SC
915 { PN(features12.timelineSemaphore), PN(vulkan12Properties.maxTimelineSemaphoreValueDifference), LIM_MIN_DEVSIZE((1ull << 31) - 1) },
916 #endif // CTS_USES_VULKANSC
919 #ifdef CTS_USES_VULKANSC
920 { PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxRenderPassSubpasses), LIM_MIN_UINT32(1) },
921 { PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxRenderPassDependencies), LIM_MIN_UINT32(18) },
922 { PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxSubpassInputAttachments), LIM_MIN_UINT32(0) },
923 { PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxSubpassPreserveAttachments), LIM_MIN_UINT32(0) },
924 { PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxFramebufferAttachments), LIM_MIN_UINT32(9) },
925 { PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxDescriptorSetLayoutBindings), LIM_MIN_UINT32(64) },
926 { PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxQueryFaultCount), LIM_MIN_UINT32(16) },
927 { PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxCallbackFaultCount), LIM_MIN_UINT32(1) },
928 { PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxCommandPoolCommandBuffers), LIM_MIN_UINT32(256) },
929 { PN(checkVulkanSC10Limit), PN(vulkanSC10Properties.maxCommandBufferSize), LIM_MIN_UINT32(1048576) },
930 #endif // CTS_USES_VULKANSC
933 log << TestLog::Message << limits << TestLog::EndMessage;
935 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
936 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
938 if (limits.maxFramebufferWidth > limits.maxViewportDimensions[0] ||
939 limits.maxFramebufferHeight > limits.maxViewportDimensions[1])
941 log << TestLog::Message << "limit validation failed, maxFramebufferDimension of "
942 << "[" << limits.maxFramebufferWidth << ", " << limits.maxFramebufferHeight << "] "
943 << "is larger than maxViewportDimension of "
944 << "[" << limits.maxViewportDimensions[0] << ", " << limits.maxViewportDimensions[1] << "]" << TestLog::EndMessage;
948 if (limits.viewportBoundsRange[0] > float(-2 * limits.maxViewportDimensions[0]))
950 log << TestLog::Message << "limit validation failed, viewPortBoundsRange[0] of " << limits.viewportBoundsRange[0]
951 << "is larger than -2*maxViewportDimension[0] of " << -2*limits.maxViewportDimensions[0] << TestLog::EndMessage;
955 if (limits.viewportBoundsRange[1] < float(2 * limits.maxViewportDimensions[1] - 1))
957 log << TestLog::Message << "limit validation failed, viewportBoundsRange[1] of " << limits.viewportBoundsRange[1]
958 << "is less than 2*maxViewportDimension[1] of " << 2*limits.maxViewportDimensions[1] << TestLog::EndMessage;
963 return tcu::TestStatus::pass("pass");
965 return tcu::TestStatus::fail("fail");
968 #ifndef CTS_USES_VULKANSC
970 void checkSupportKhrPushDescriptor (Context& context)
972 context.requireDeviceFunctionality("VK_KHR_push_descriptor");
975 tcu::TestStatus validateLimitsKhrPushDescriptor (Context& context)
977 const VkBool32 checkAlways = VK_TRUE;
978 const VkPhysicalDevicePushDescriptorPropertiesKHR& pushDescriptorPropertiesKHR = context.getPushDescriptorProperties();
979 TestLog& log = context.getTestContext().getLog();
980 bool limitsOk = true;
982 FeatureLimitTableItem featureLimitTable[] =
984 { PN(checkAlways), PN(pushDescriptorPropertiesKHR.maxPushDescriptors), LIM_MIN_UINT32(32) },
987 log << TestLog::Message << pushDescriptorPropertiesKHR << TestLog::EndMessage;
989 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
990 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
993 return tcu::TestStatus::pass("pass");
995 return tcu::TestStatus::fail("fail");
998 #endif // CTS_USES_VULKANSC
1000 void checkSupportKhrMultiview (Context& context)
1002 context.requireDeviceFunctionality("VK_KHR_multiview");
1005 tcu::TestStatus validateLimitsKhrMultiview (Context& context)
1007 const VkBool32 checkAlways = VK_TRUE;
1008 const VkPhysicalDeviceMultiviewProperties& multiviewProperties = context.getMultiviewProperties();
1009 TestLog& log = context.getTestContext().getLog();
1010 bool limitsOk = true;
1012 FeatureLimitTableItem featureLimitTable[] =
1015 { PN(checkAlways), PN(multiviewProperties.maxMultiviewViewCount), LIM_MIN_UINT32(6) },
1016 { PN(checkAlways), PN(multiviewProperties.maxMultiviewInstanceIndex), LIM_MIN_UINT32((1<<27) - 1) },
1019 log << TestLog::Message << multiviewProperties << TestLog::EndMessage;
1021 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1022 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1025 return tcu::TestStatus::pass("pass");
1027 return tcu::TestStatus::fail("fail");
1030 void checkSupportExtDiscardRectangles (Context& context)
1032 context.requireDeviceFunctionality("VK_EXT_discard_rectangles");
1035 tcu::TestStatus validateLimitsExtDiscardRectangles (Context& context)
1037 const VkBool32 checkAlways = VK_TRUE;
1038 const VkPhysicalDeviceDiscardRectanglePropertiesEXT& discardRectanglePropertiesEXT = context.getDiscardRectanglePropertiesEXT();
1039 TestLog& log = context.getTestContext().getLog();
1040 bool limitsOk = true;
1042 FeatureLimitTableItem featureLimitTable[] =
1044 { PN(checkAlways), PN(discardRectanglePropertiesEXT.maxDiscardRectangles), LIM_MIN_UINT32(4) },
1047 log << TestLog::Message << discardRectanglePropertiesEXT << TestLog::EndMessage;
1049 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1050 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1053 return tcu::TestStatus::pass("pass");
1055 return tcu::TestStatus::fail("fail");
1058 void checkSupportExtSampleLocations (Context& context)
1060 context.requireDeviceFunctionality("VK_EXT_sample_locations");
1063 tcu::TestStatus validateLimitsExtSampleLocations (Context& context)
1065 const VkBool32 checkAlways = VK_TRUE;
1066 const VkPhysicalDeviceSampleLocationsPropertiesEXT& sampleLocationsPropertiesEXT = context.getSampleLocationsPropertiesEXT();
1067 TestLog& log = context.getTestContext().getLog();
1068 bool limitsOk = true;
1070 FeatureLimitTableItem featureLimitTable[] =
1072 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_4_BIT) },
1073 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.maxSampleLocationGridSize.width), LIM_MIN_FLOAT(0.0f) },
1074 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.maxSampleLocationGridSize.height), LIM_MIN_FLOAT(0.0f) },
1075 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationCoordinateRange[0]), LIM_MAX_FLOAT(0.0f) },
1076 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationCoordinateRange[1]), LIM_MIN_FLOAT(0.9375f) },
1077 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationSubPixelBits), LIM_MIN_UINT32(4) },
1080 log << TestLog::Message << sampleLocationsPropertiesEXT << TestLog::EndMessage;
1082 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1083 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1086 return tcu::TestStatus::pass("pass");
1088 return tcu::TestStatus::fail("fail");
1091 void checkSupportExtExternalMemoryHost (Context& context)
1093 context.requireDeviceFunctionality("VK_EXT_external_memory_host");
1096 tcu::TestStatus validateLimitsExtExternalMemoryHost (Context& context)
1098 const VkBool32 checkAlways = VK_TRUE;
1099 const VkPhysicalDeviceExternalMemoryHostPropertiesEXT& externalMemoryHostPropertiesEXT = context.getExternalMemoryHostPropertiesEXT();
1100 TestLog& log = context.getTestContext().getLog();
1101 bool limitsOk = true;
1103 FeatureLimitTableItem featureLimitTable[] =
1105 { PN(checkAlways), PN(externalMemoryHostPropertiesEXT.minImportedHostPointerAlignment), LIM_MAX_DEVSIZE(65536) },
1108 log << TestLog::Message << externalMemoryHostPropertiesEXT << TestLog::EndMessage;
1110 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1111 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1114 return tcu::TestStatus::pass("pass");
1116 return tcu::TestStatus::fail("fail");
1119 void checkSupportExtBlendOperationAdvanced (Context& context)
1121 context.requireDeviceFunctionality("VK_EXT_blend_operation_advanced");
1124 tcu::TestStatus validateLimitsExtBlendOperationAdvanced (Context& context)
1126 const VkBool32 checkAlways = VK_TRUE;
1127 const VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT& blendOperationAdvancedPropertiesEXT = context.getBlendOperationAdvancedPropertiesEXT();
1128 TestLog& log = context.getTestContext().getLog();
1129 bool limitsOk = true;
1131 FeatureLimitTableItem featureLimitTable[] =
1133 { PN(checkAlways), PN(blendOperationAdvancedPropertiesEXT.advancedBlendMaxColorAttachments), LIM_MIN_UINT32(1) },
1136 log << TestLog::Message << blendOperationAdvancedPropertiesEXT << TestLog::EndMessage;
1138 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1139 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1142 return tcu::TestStatus::pass("pass");
1144 return tcu::TestStatus::fail("fail");
1147 void checkSupportKhrMaintenance3 (Context& context)
1149 context.requireDeviceFunctionality("VK_KHR_maintenance3");
1152 #ifndef CTS_USES_VULKANSC
1153 void checkSupportKhrMaintenance4 (Context& context)
1155 context.requireDeviceFunctionality("VK_KHR_maintenance4");
1157 #endif // CTS_USES_VULKANSC
1159 tcu::TestStatus validateLimitsKhrMaintenance3 (Context& context)
1161 const VkBool32 checkAlways = VK_TRUE;
1162 const VkPhysicalDeviceMaintenance3Properties& maintenance3Properties = context.getMaintenance3Properties();
1163 TestLog& log = context.getTestContext().getLog();
1164 bool limitsOk = true;
1166 FeatureLimitTableItem featureLimitTable[] =
1168 { PN(checkAlways), PN(maintenance3Properties.maxPerSetDescriptors), LIM_MIN_UINT32(1024) },
1169 { PN(checkAlways), PN(maintenance3Properties.maxMemoryAllocationSize), LIM_MIN_DEVSIZE(1<<30) },
1172 log << TestLog::Message << maintenance3Properties << TestLog::EndMessage;
1174 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1175 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1178 return tcu::TestStatus::pass("pass");
1180 return tcu::TestStatus::fail("fail");
1183 #ifndef CTS_USES_VULKANSC
1184 tcu::TestStatus validateLimitsKhrMaintenance4 (Context& context)
1186 const VkBool32 checkAlways = VK_TRUE;
1187 const VkPhysicalDeviceMaintenance4Properties& maintenance4Properties = context.getMaintenance4Properties();
1188 TestLog& log = context.getTestContext().getLog();
1189 bool limitsOk = true;
1191 FeatureLimitTableItem featureLimitTable[] =
1193 { PN(checkAlways), PN(maintenance4Properties.maxBufferSize), LIM_MIN_DEVSIZE(1<<30) },
1196 log << TestLog::Message << maintenance4Properties << TestLog::EndMessage;
1198 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1199 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1202 return tcu::TestStatus::pass("pass");
1204 return tcu::TestStatus::fail("fail");
1206 #endif // CTS_USES_VULKANSC
1208 void checkSupportExtConservativeRasterization (Context& context)
1210 context.requireDeviceFunctionality("VK_EXT_conservative_rasterization");
1213 tcu::TestStatus validateLimitsExtConservativeRasterization (Context& context)
1215 const VkBool32 checkAlways = VK_TRUE;
1216 const VkPhysicalDeviceConservativeRasterizationPropertiesEXT& conservativeRasterizationPropertiesEXT = context.getConservativeRasterizationPropertiesEXT();
1217 TestLog& log = context.getTestContext().getLog();
1218 bool limitsOk = true;
1220 FeatureLimitTableItem featureLimitTable[] =
1222 { PN(checkAlways), PN(conservativeRasterizationPropertiesEXT.primitiveOverestimationSize), LIM_MIN_FLOAT(0.0f) },
1223 { PN(checkAlways), PN(conservativeRasterizationPropertiesEXT.maxExtraPrimitiveOverestimationSize), LIM_MIN_FLOAT(0.0f) },
1224 { PN(checkAlways), PN(conservativeRasterizationPropertiesEXT.extraPrimitiveOverestimationSizeGranularity), LIM_MIN_FLOAT(0.0f) },
1227 log << TestLog::Message << conservativeRasterizationPropertiesEXT << TestLog::EndMessage;
1229 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1230 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1233 return tcu::TestStatus::pass("pass");
1235 return tcu::TestStatus::fail("fail");
1238 void checkSupportExtDescriptorIndexing (Context& context)
1240 const std::string& requiredDeviceExtension = "VK_EXT_descriptor_indexing";
1241 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1242 const InstanceInterface& vki = context.getInstanceInterface();
1243 const std::vector<VkExtensionProperties> deviceExtensionProperties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
1245 if (!isExtensionSupported(deviceExtensionProperties, RequiredExtension(requiredDeviceExtension)))
1246 TCU_THROW(NotSupportedError, requiredDeviceExtension + " is not supported");
1248 // Extension string is present, then extension is really supported and should have been added into chain in DefaultDevice properties and features
1251 tcu::TestStatus validateLimitsExtDescriptorIndexing (Context& context)
1253 const VkBool32 checkAlways = VK_TRUE;
1254 const VkPhysicalDeviceProperties2& properties2 = context.getDeviceProperties2();
1255 const VkPhysicalDeviceLimits& limits = properties2.properties.limits;
1256 const VkPhysicalDeviceDescriptorIndexingProperties& descriptorIndexingProperties = context.getDescriptorIndexingProperties();
1257 const VkPhysicalDeviceFeatures& features = context.getDeviceFeatures();
1258 const deUint32 tessellationShaderCount = (features.tessellationShader) ? 2 : 0;
1259 const deUint32 geometryShaderCount = (features.geometryShader) ? 1 : 0;
1260 const deUint32 shaderStages = 3 + tessellationShaderCount + geometryShaderCount;
1261 TestLog& log = context.getTestContext().getLog();
1262 bool limitsOk = true;
1264 FeatureLimitTableItem featureLimitTable[] =
1266 { PN(checkAlways), PN(descriptorIndexingProperties.maxUpdateAfterBindDescriptorsInAllPools), LIM_MIN_UINT32(500000) },
1267 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSamplers), LIM_MIN_UINT32(500000) },
1268 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(12) },
1269 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(500000) },
1270 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSampledImages), LIM_MIN_UINT32(500000) },
1271 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageImages), LIM_MIN_UINT32(500000) },
1272 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindInputAttachments), LIM_MIN_UINT32(4) },
1273 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageUpdateAfterBindResources), LIM_MIN_UINT32(500000) },
1274 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSamplers), LIM_MIN_UINT32(500000) },
1275 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(shaderStages * 12) },
1276 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic), LIM_MIN_UINT32(8) },
1277 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(500000) },
1278 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic), LIM_MIN_UINT32(4) },
1279 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSampledImages), LIM_MIN_UINT32(500000) },
1280 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageImages), LIM_MIN_UINT32(500000) },
1281 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindInputAttachments), LIM_MIN_UINT32(4) },
1282 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSamplers), LIM_MIN_UINT32(limits.maxPerStageDescriptorSamplers) },
1283 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(limits.maxPerStageDescriptorUniformBuffers) },
1284 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageBuffers) },
1285 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSampledImages), LIM_MIN_UINT32(limits.maxPerStageDescriptorSampledImages) },
1286 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageImages), LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageImages) },
1287 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindInputAttachments), LIM_MIN_UINT32(limits.maxPerStageDescriptorInputAttachments) },
1288 { PN(checkAlways), PN(descriptorIndexingProperties.maxPerStageUpdateAfterBindResources), LIM_MIN_UINT32(limits.maxPerStageResources) },
1289 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSamplers), LIM_MIN_UINT32(limits.maxDescriptorSetSamplers) },
1290 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffers) },
1291 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic), LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffersDynamic) },
1292 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffers) },
1293 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic), LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffersDynamic) },
1294 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSampledImages), LIM_MIN_UINT32(limits.maxDescriptorSetSampledImages) },
1295 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageImages), LIM_MIN_UINT32(limits.maxDescriptorSetStorageImages) },
1296 { PN(checkAlways), PN(descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindInputAttachments), LIM_MIN_UINT32(limits.maxDescriptorSetInputAttachments) },
1299 log << TestLog::Message << descriptorIndexingProperties << TestLog::EndMessage;
1301 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1302 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1305 return tcu::TestStatus::pass("pass");
1307 return tcu::TestStatus::fail("fail");
1310 #ifndef CTS_USES_VULKANSC
1312 void checkSupportExtInlineUniformBlock (Context& context)
1314 context.requireDeviceFunctionality("VK_EXT_inline_uniform_block");
1317 tcu::TestStatus validateLimitsExtInlineUniformBlock (Context& context)
1319 const VkBool32 checkAlways = VK_TRUE;
1320 const VkPhysicalDeviceInlineUniformBlockProperties& inlineUniformBlockPropertiesEXT = context.getInlineUniformBlockProperties();
1321 TestLog& log = context.getTestContext().getLog();
1322 bool limitsOk = true;
1324 FeatureLimitTableItem featureLimitTable[] =
1326 { PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxInlineUniformBlockSize), LIM_MIN_UINT32(256) },
1327 { PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxPerStageDescriptorInlineUniformBlocks), LIM_MIN_UINT32(4) },
1328 { PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks), LIM_MIN_UINT32(4) },
1329 { PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxDescriptorSetInlineUniformBlocks), LIM_MIN_UINT32(4) },
1330 { PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxDescriptorSetUpdateAfterBindInlineUniformBlocks), LIM_MIN_UINT32(4) },
1333 log << TestLog::Message << inlineUniformBlockPropertiesEXT << TestLog::EndMessage;
1335 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1336 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1339 return tcu::TestStatus::pass("pass");
1341 return tcu::TestStatus::fail("fail");
1344 #endif // CTS_USES_VULKANSC
1347 void checkSupportExtVertexAttributeDivisor (Context& context)
1349 context.requireDeviceFunctionality("VK_EXT_vertex_attribute_divisor");
1352 tcu::TestStatus validateLimitsExtVertexAttributeDivisor (Context& context)
1354 const VkBool32 checkAlways = VK_TRUE;
1355 const VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT& vertexAttributeDivisorPropertiesEXT = context.getVertexAttributeDivisorPropertiesEXT();
1356 TestLog& log = context.getTestContext().getLog();
1357 bool limitsOk = true;
1359 FeatureLimitTableItem featureLimitTable[] =
1361 { PN(checkAlways), PN(vertexAttributeDivisorPropertiesEXT.maxVertexAttribDivisor), LIM_MIN_UINT32((1<<16) - 1) },
1364 log << TestLog::Message << vertexAttributeDivisorPropertiesEXT << TestLog::EndMessage;
1366 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1367 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1370 return tcu::TestStatus::pass("pass");
1372 return tcu::TestStatus::fail("fail");
1375 #ifndef CTS_USES_VULKANSC
1377 void checkSupportNvMeshShader (Context& context)
1379 const std::string& requiredDeviceExtension = "VK_NV_mesh_shader";
1380 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1381 const InstanceInterface& vki = context.getInstanceInterface();
1382 const std::vector<VkExtensionProperties> deviceExtensionProperties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
1384 if (!isExtensionSupported(deviceExtensionProperties, RequiredExtension(requiredDeviceExtension)))
1385 TCU_THROW(NotSupportedError, requiredDeviceExtension + " is not supported");
1388 tcu::TestStatus validateLimitsNvMeshShader (Context& context)
1390 const VkBool32 checkAlways = VK_TRUE;
1391 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1392 const InstanceInterface& vki = context.getInstanceInterface();
1393 TestLog& log = context.getTestContext().getLog();
1394 bool limitsOk = true;
1395 VkPhysicalDeviceMeshShaderPropertiesNV meshShaderPropertiesNV = initVulkanStructure();
1396 VkPhysicalDeviceProperties2 properties2 = initVulkanStructure(&meshShaderPropertiesNV);
1398 vki.getPhysicalDeviceProperties2(physicalDevice, &properties2);
1400 FeatureLimitTableItem featureLimitTable[] =
1402 { PN(checkAlways), PN(meshShaderPropertiesNV.maxDrawMeshTasksCount), LIM_MIN_UINT32(deUint32((1ull<<16) - 1)) },
1403 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupInvocations), LIM_MIN_UINT32(32) },
1404 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupSize[0]), LIM_MIN_UINT32(32) },
1405 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupSize[1]), LIM_MIN_UINT32(1) },
1406 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupSize[2]), LIM_MIN_UINT32(1) },
1407 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskTotalMemorySize), LIM_MIN_UINT32(16384) },
1408 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskOutputCount), LIM_MIN_UINT32((1<<16) - 1) },
1409 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupInvocations), LIM_MIN_UINT32(32) },
1410 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupSize[0]), LIM_MIN_UINT32(32) },
1411 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupSize[1]), LIM_MIN_UINT32(1) },
1412 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupSize[2]), LIM_MIN_UINT32(1) },
1413 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshTotalMemorySize), LIM_MIN_UINT32(16384) },
1414 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshOutputVertices), LIM_MIN_UINT32(256) },
1415 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshOutputPrimitives), LIM_MIN_UINT32(256) },
1416 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshMultiviewViewCount), LIM_MIN_UINT32(1) },
1419 log << TestLog::Message << meshShaderPropertiesNV << TestLog::EndMessage;
1421 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1422 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1425 return tcu::TestStatus::pass("pass");
1427 return tcu::TestStatus::fail("fail");
1430 void checkSupportExtTransformFeedback (Context& context)
1432 context.requireDeviceFunctionality("VK_EXT_transform_feedback");
1435 tcu::TestStatus validateLimitsExtTransformFeedback (Context& context)
1437 const VkBool32 checkAlways = VK_TRUE;
1438 const VkPhysicalDeviceTransformFeedbackPropertiesEXT& transformFeedbackPropertiesEXT = context.getTransformFeedbackPropertiesEXT();
1439 TestLog& log = context.getTestContext().getLog();
1440 bool limitsOk = true;
1442 FeatureLimitTableItem featureLimitTable[] =
1444 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackStreams), LIM_MIN_UINT32(1) },
1445 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBuffers), LIM_MIN_UINT32(1) },
1446 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBufferSize), LIM_MIN_DEVSIZE(1ull<<27) },
1447 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackStreamDataSize), LIM_MIN_UINT32(512) },
1448 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBufferDataSize), LIM_MIN_UINT32(512) },
1449 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBufferDataStride), LIM_MIN_UINT32(512) },
1452 log << TestLog::Message << transformFeedbackPropertiesEXT << TestLog::EndMessage;
1454 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1455 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1458 return tcu::TestStatus::pass("pass");
1460 return tcu::TestStatus::fail("fail");
1463 void checkSupportExtFragmentDensityMap (Context& context)
1465 context.requireDeviceFunctionality("VK_EXT_fragment_density_map");
1468 tcu::TestStatus validateLimitsExtFragmentDensityMap (Context& context)
1470 const VkBool32 checkAlways = VK_TRUE;
1471 const VkPhysicalDeviceFragmentDensityMapPropertiesEXT& fragmentDensityMapPropertiesEXT = context.getFragmentDensityMapPropertiesEXT();
1472 TestLog& log = context.getTestContext().getLog();
1473 bool limitsOk = true;
1475 FeatureLimitTableItem featureLimitTable[] =
1477 { PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.minFragmentDensityTexelSize.width), LIM_MIN_UINT32(1) },
1478 { PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.minFragmentDensityTexelSize.height), LIM_MIN_UINT32(1) },
1479 { PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.maxFragmentDensityTexelSize.width), LIM_MIN_UINT32(1) },
1480 { PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.maxFragmentDensityTexelSize.height), LIM_MIN_UINT32(1) },
1483 log << TestLog::Message << fragmentDensityMapPropertiesEXT << TestLog::EndMessage;
1485 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1486 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1489 return tcu::TestStatus::pass("pass");
1491 return tcu::TestStatus::fail("fail");
1494 void checkSupportNvRayTracing (Context& context)
1496 const std::string& requiredDeviceExtension = "VK_NV_ray_tracing";
1497 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1498 const InstanceInterface& vki = context.getInstanceInterface();
1499 const std::vector<VkExtensionProperties> deviceExtensionProperties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
1501 if (!isExtensionSupported(deviceExtensionProperties, RequiredExtension(requiredDeviceExtension)))
1502 TCU_THROW(NotSupportedError, requiredDeviceExtension + " is not supported");
1505 tcu::TestStatus validateLimitsNvRayTracing (Context& context)
1507 const VkBool32 checkAlways = VK_TRUE;
1508 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1509 const InstanceInterface& vki = context.getInstanceInterface();
1510 TestLog& log = context.getTestContext().getLog();
1511 bool limitsOk = true;
1512 VkPhysicalDeviceRayTracingPropertiesNV rayTracingPropertiesNV = initVulkanStructure();
1513 VkPhysicalDeviceProperties2 properties2 = initVulkanStructure(&rayTracingPropertiesNV);
1515 vki.getPhysicalDeviceProperties2(physicalDevice, &properties2);
1517 FeatureLimitTableItem featureLimitTable[] =
1519 { PN(checkAlways), PN(rayTracingPropertiesNV.shaderGroupHandleSize), LIM_MIN_UINT32(16) },
1520 { PN(checkAlways), PN(rayTracingPropertiesNV.maxRecursionDepth), LIM_MIN_UINT32(31) },
1521 { PN(checkAlways), PN(rayTracingPropertiesNV.shaderGroupBaseAlignment), LIM_MIN_UINT32(64) },
1522 { PN(checkAlways), PN(rayTracingPropertiesNV.maxGeometryCount), LIM_MIN_UINT32((1<<24) - 1) },
1523 { PN(checkAlways), PN(rayTracingPropertiesNV.maxInstanceCount), LIM_MIN_UINT32((1<<24) - 1) },
1524 { PN(checkAlways), PN(rayTracingPropertiesNV.maxTriangleCount), LIM_MIN_UINT32((1<<29) - 1) },
1525 { PN(checkAlways), PN(rayTracingPropertiesNV.maxDescriptorSetAccelerationStructures), LIM_MIN_UINT32(16) },
1528 log << TestLog::Message << rayTracingPropertiesNV << TestLog::EndMessage;
1530 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1531 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1534 return tcu::TestStatus::pass("pass");
1536 return tcu::TestStatus::fail("fail");
1539 #endif // CTS_USES_VULKANSC
1541 void checkSupportKhrTimelineSemaphore (Context& context)
1543 context.requireDeviceFunctionality("VK_KHR_timeline_semaphore");
1546 tcu::TestStatus validateLimitsKhrTimelineSemaphore (Context& context)
1548 const VkBool32 checkAlways = VK_TRUE;
1549 const VkPhysicalDeviceTimelineSemaphoreProperties& timelineSemaphoreProperties = context.getTimelineSemaphoreProperties();
1550 bool limitsOk = true;
1551 TestLog& log = context.getTestContext().getLog();
1553 FeatureLimitTableItem featureLimitTable[] =
1555 { PN(checkAlways), PN(timelineSemaphoreProperties.maxTimelineSemaphoreValueDifference), LIM_MIN_DEVSIZE((1ull<<31) - 1) },
1558 log << TestLog::Message << timelineSemaphoreProperties << TestLog::EndMessage;
1560 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1561 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1564 return tcu::TestStatus::pass("pass");
1566 return tcu::TestStatus::fail("fail");
1569 void checkSupportExtLineRasterization (Context& context)
1571 context.requireDeviceFunctionality("VK_EXT_line_rasterization");
1574 tcu::TestStatus validateLimitsExtLineRasterization (Context& context)
1576 const VkBool32 checkAlways = VK_TRUE;
1577 const VkPhysicalDeviceLineRasterizationPropertiesEXT& lineRasterizationPropertiesEXT = context.getLineRasterizationPropertiesEXT();
1578 TestLog& log = context.getTestContext().getLog();
1579 bool limitsOk = true;
1581 FeatureLimitTableItem featureLimitTable[] =
1583 { PN(checkAlways), PN(lineRasterizationPropertiesEXT.lineSubPixelPrecisionBits), LIM_MIN_UINT32(4) },
1586 log << TestLog::Message << lineRasterizationPropertiesEXT << TestLog::EndMessage;
1588 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1589 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1592 return tcu::TestStatus::pass("pass");
1594 return tcu::TestStatus::fail("fail");
1597 void checkSupportRobustness2 (Context& context)
1599 context.requireDeviceFunctionality("VK_EXT_robustness2");
1602 tcu::TestStatus validateLimitsRobustness2 (Context& context)
1604 const InstanceInterface& vki = context.getInstanceInterface();
1605 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1606 const VkPhysicalDeviceRobustness2PropertiesEXT& robustness2PropertiesEXT = context.getRobustness2PropertiesEXT();
1607 VkPhysicalDeviceRobustness2FeaturesEXT robustness2Features = initVulkanStructure();
1608 VkPhysicalDeviceFeatures2 features2 = initVulkanStructure(&robustness2Features);
1610 vki.getPhysicalDeviceFeatures2(physicalDevice, &features2);
1612 if (robustness2Features.robustBufferAccess2 && !features2.features.robustBufferAccess)
1613 return tcu::TestStatus::fail("If robustBufferAccess2 is enabled then robustBufferAccess must also be enabled");
1615 if (robustness2PropertiesEXT.robustStorageBufferAccessSizeAlignment != 1 && robustness2PropertiesEXT.robustStorageBufferAccessSizeAlignment != 4)
1616 return tcu::TestStatus::fail("robustness2PropertiesEXT.robustStorageBufferAccessSizeAlignment value must be either 1 or 4.");
1618 if (!de::inRange(robustness2PropertiesEXT.robustUniformBufferAccessSizeAlignment, (VkDeviceSize)1u, (VkDeviceSize)256u) || !deIsPowerOfTwo64(robustness2PropertiesEXT.robustUniformBufferAccessSizeAlignment))
1619 return tcu::TestStatus::fail("robustness2PropertiesEXT.robustUniformBufferAccessSizeAlignment must be a power of two in the range [1, 256]");
1621 return tcu::TestStatus::pass("pass");
1624 #ifndef CTS_USES_VULKANSC
1625 tcu::TestStatus validateLimitsMaxInlineUniformTotalSize (Context& context)
1627 const VkBool32 checkAlways = VK_TRUE;
1628 const VkPhysicalDeviceVulkan13Properties& vulkan13Properties = context.getDeviceVulkan13Properties();
1629 bool limitsOk = true;
1630 TestLog& log = context.getTestContext().getLog();
1632 FeatureLimitTableItem featureLimitTable[] =
1634 { PN(checkAlways), PN(vulkan13Properties.maxInlineUniformTotalSize), LIM_MIN_DEVSIZE(256) },
1637 log << TestLog::Message << vulkan13Properties << TestLog::EndMessage;
1639 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1640 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1643 return tcu::TestStatus::pass("pass");
1645 return tcu::TestStatus::fail("fail");
1648 tcu::TestStatus validateRoadmap2022(Context& context)
1650 if (context.getUsedApiVersion() < VK_API_VERSION_1_3)
1651 TCU_THROW(NotSupportedError, "Profile not supported");
1653 const VkBool32 checkAlways = VK_TRUE;
1654 VkBool32 oneOrMoreChecksFailed = VK_FALSE;
1655 TestLog& log = context.getTestContext().getLog();
1657 auto vk10Features = context.getDeviceFeatures();
1658 auto vk11Features = context.getDeviceVulkan11Features();
1659 auto vk12Features = context.getDeviceVulkan12Features();
1661 const auto& vk10Properties = context.getDeviceProperties2();
1662 const auto& vk11Properties = context.getDeviceVulkan11Properties();
1663 const auto& vk12Properties = context.getDeviceVulkan12Properties();
1664 const auto& vk13Properties = context.getDeviceVulkan13Properties();
1665 const auto& limits = vk10Properties.properties.limits;
1667 #define ROADMAP_FEATURE_ITEM(STRUC, FIELD) { &(STRUC), &(STRUC.FIELD), #STRUC "." #FIELD }
1673 const char* fieldName;
1676 std::vector<FeatureTable> featureTable
1678 // Vulkan 1.0 Features
1679 ROADMAP_FEATURE_ITEM(vk10Features, fullDrawIndexUint32),
1680 ROADMAP_FEATURE_ITEM(vk10Features, imageCubeArray),
1681 ROADMAP_FEATURE_ITEM(vk10Features, independentBlend),
1682 ROADMAP_FEATURE_ITEM(vk10Features, sampleRateShading),
1683 ROADMAP_FEATURE_ITEM(vk10Features, drawIndirectFirstInstance),
1684 ROADMAP_FEATURE_ITEM(vk10Features, depthClamp),
1685 ROADMAP_FEATURE_ITEM(vk10Features, depthBiasClamp),
1686 ROADMAP_FEATURE_ITEM(vk10Features, samplerAnisotropy),
1687 ROADMAP_FEATURE_ITEM(vk10Features, occlusionQueryPrecise),
1688 ROADMAP_FEATURE_ITEM(vk10Features, fragmentStoresAndAtomics),
1689 ROADMAP_FEATURE_ITEM(vk10Features, shaderStorageImageExtendedFormats),
1690 ROADMAP_FEATURE_ITEM(vk10Features, shaderUniformBufferArrayDynamicIndexing),
1691 ROADMAP_FEATURE_ITEM(vk10Features, shaderSampledImageArrayDynamicIndexing),
1692 ROADMAP_FEATURE_ITEM(vk10Features, shaderStorageBufferArrayDynamicIndexing),
1693 ROADMAP_FEATURE_ITEM(vk10Features, shaderStorageImageArrayDynamicIndexing),
1695 // Vulkan 1.1 Features
1696 ROADMAP_FEATURE_ITEM(vk11Features, samplerYcbcrConversion),
1698 // Vulkan 1.2 Features
1699 ROADMAP_FEATURE_ITEM(vk12Features, samplerMirrorClampToEdge),
1700 ROADMAP_FEATURE_ITEM(vk12Features, descriptorIndexing),
1701 ROADMAP_FEATURE_ITEM(vk12Features, shaderUniformTexelBufferArrayDynamicIndexing),
1702 ROADMAP_FEATURE_ITEM(vk12Features, shaderStorageTexelBufferArrayDynamicIndexing),
1703 ROADMAP_FEATURE_ITEM(vk12Features, shaderUniformBufferArrayNonUniformIndexing),
1704 ROADMAP_FEATURE_ITEM(vk12Features, shaderSampledImageArrayNonUniformIndexing),
1705 ROADMAP_FEATURE_ITEM(vk12Features, shaderStorageBufferArrayNonUniformIndexing),
1706 ROADMAP_FEATURE_ITEM(vk12Features, shaderStorageImageArrayNonUniformIndexing),
1707 ROADMAP_FEATURE_ITEM(vk12Features, shaderUniformTexelBufferArrayNonUniformIndexing),
1708 ROADMAP_FEATURE_ITEM(vk12Features, shaderStorageTexelBufferArrayNonUniformIndexing),
1709 ROADMAP_FEATURE_ITEM(vk12Features, descriptorBindingSampledImageUpdateAfterBind),
1710 ROADMAP_FEATURE_ITEM(vk12Features, descriptorBindingStorageImageUpdateAfterBind),
1711 ROADMAP_FEATURE_ITEM(vk12Features, descriptorBindingStorageBufferUpdateAfterBind),
1712 ROADMAP_FEATURE_ITEM(vk12Features, descriptorBindingUniformTexelBufferUpdateAfterBind),
1713 ROADMAP_FEATURE_ITEM(vk12Features, descriptorBindingStorageTexelBufferUpdateAfterBind),
1714 ROADMAP_FEATURE_ITEM(vk12Features, descriptorBindingUpdateUnusedWhilePending),
1715 ROADMAP_FEATURE_ITEM(vk12Features, descriptorBindingPartiallyBound),
1716 ROADMAP_FEATURE_ITEM(vk12Features, descriptorBindingVariableDescriptorCount),
1717 ROADMAP_FEATURE_ITEM(vk12Features, runtimeDescriptorArray),
1718 ROADMAP_FEATURE_ITEM(vk12Features, scalarBlockLayout),
1721 for (FeatureTable& testedFeature : featureTable)
1723 if (!testedFeature.fieldPtr[0])
1725 log << TestLog::Message
1726 << "Feature " << testedFeature.fieldName << "is not supported"
1727 << TestLog::EndMessage;
1728 oneOrMoreChecksFailed = VK_TRUE;
1732 std::vector<FeatureLimitTableItem> featureLimitTable
1734 // Vulkan 1.0 limits
1735 { PN(checkAlways), PN(limits.maxImageDimension1D), LIM_MIN_UINT32(8192) },
1736 { PN(checkAlways), PN(limits.maxImageDimension2D), LIM_MIN_UINT32(8192) },
1737 { PN(checkAlways), PN(limits.maxImageDimensionCube), LIM_MIN_UINT32(8192) },
1738 { PN(checkAlways), PN(limits.maxImageArrayLayers), LIM_MIN_UINT32(2048) },
1739 { PN(checkAlways), PN(limits.maxUniformBufferRange), LIM_MIN_UINT32(65536) },
1740 { PN(checkAlways), PN(limits.bufferImageGranularity), LIM_MAX_DEVSIZE(4096) },
1741 { PN(checkAlways), PN(limits.maxPerStageDescriptorSamplers), LIM_MIN_UINT32(64) },
1742 { PN(checkAlways), PN(limits.maxPerStageDescriptorUniformBuffers), LIM_MIN_UINT32(15) },
1743 { PN(checkAlways), PN(limits.maxPerStageDescriptorStorageBuffers), LIM_MIN_UINT32(30) },
1744 { PN(checkAlways), PN(limits.maxPerStageDescriptorSampledImages), LIM_MIN_UINT32(200) },
1745 { PN(checkAlways), PN(limits.maxPerStageDescriptorStorageImages), LIM_MIN_UINT32(16) },
1746 { PN(checkAlways), PN(limits.maxPerStageResources), LIM_MIN_UINT32(200) },
1747 { PN(checkAlways), PN(limits.maxDescriptorSetSamplers), LIM_MIN_UINT32(576) },
1748 { PN(checkAlways), PN(limits.maxDescriptorSetUniformBuffers), LIM_MIN_UINT32(90) },
1749 { PN(checkAlways), PN(limits.maxDescriptorSetStorageBuffers), LIM_MIN_UINT32(96) },
1750 { PN(checkAlways), PN(limits.maxDescriptorSetSampledImages), LIM_MIN_UINT32(1800) },
1751 { PN(checkAlways), PN(limits.maxDescriptorSetStorageImages), LIM_MIN_UINT32(144) },
1752 { PN(checkAlways), PN(limits.maxFragmentCombinedOutputResources), LIM_MIN_UINT32(16) },
1753 { PN(checkAlways), PN(limits.maxComputeWorkGroupInvocations), LIM_MIN_UINT32(256) },
1754 { PN(checkAlways), PN(limits.maxComputeWorkGroupSize[0]), LIM_MIN_UINT32(256) },
1755 { PN(checkAlways), PN(limits.maxComputeWorkGroupSize[1]), LIM_MIN_UINT32(256) },
1756 { PN(checkAlways), PN(limits.maxComputeWorkGroupSize[2]), LIM_MIN_UINT32(64) },
1757 { PN(checkAlways), PN(limits.subPixelPrecisionBits), LIM_MIN_UINT32(8) },
1758 { PN(checkAlways), PN(limits.mipmapPrecisionBits), LIM_MIN_UINT32(6) },
1759 { PN(checkAlways), PN(limits.maxSamplerLodBias), LIM_MIN_FLOAT(14.0f) },
1760 { PN(checkAlways), PN(limits.pointSizeGranularity), LIM_MAX_FLOAT(0.125f) },
1761 { PN(checkAlways), PN(limits.lineWidthGranularity), LIM_MAX_FLOAT(0.5f) },
1762 { PN(checkAlways), PN(limits.standardSampleLocations), LIM_MIN_UINT32(1) },
1763 { PN(checkAlways), PN(limits.maxColorAttachments), LIM_MIN_UINT32(7) },
1765 // Vulkan 1.1 limits
1766 { PN(checkAlways), PN(vk11Properties.subgroupSize), LIM_MIN_UINT32(4) },
1767 { PN(checkAlways), PN(vk11Properties.subgroupSupportedStages), LIM_MIN_UINT32(VK_SHADER_STAGE_COMPUTE_BIT|VK_SHADER_STAGE_FRAGMENT_BIT) },
1768 { PN(checkAlways), PN(vk11Properties.subgroupSupportedOperations), LIM_MIN_UINT32(VK_SUBGROUP_FEATURE_BASIC_BIT|VK_SUBGROUP_FEATURE_VOTE_BIT|
1769 VK_SUBGROUP_FEATURE_ARITHMETIC_BIT|VK_SUBGROUP_FEATURE_BALLOT_BIT|
1770 VK_SUBGROUP_FEATURE_SHUFFLE_BIT|VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT|
1771 VK_SUBGROUP_FEATURE_QUAD_BIT) },
1772 // Vulkan 1.2 limits
1773 { PN(checkAlways), PN(vk12Properties.shaderSignedZeroInfNanPreserveFloat16), LIM_MIN_UINT32(1) },
1774 { PN(checkAlways), PN(vk12Properties.shaderSignedZeroInfNanPreserveFloat32), LIM_MIN_UINT32(1) },
1776 // Vulkan 1.3 limits
1777 { PN(checkAlways), PN(vk13Properties.maxSubgroupSize), LIM_MIN_UINT32(4) },
1780 for (const auto& featureLimit : featureLimitTable)
1781 oneOrMoreChecksFailed |= !validateLimit(featureLimit, log);
1783 if (!context.isDeviceFunctionalitySupported("VK_KHR_global_priority"))
1785 log << TestLog::Message
1786 << "VK_KHR_global_priority is not supported"
1787 << TestLog::EndMessage;
1788 oneOrMoreChecksFailed = VK_TRUE;
1791 if (oneOrMoreChecksFailed)
1792 TCU_THROW(NotSupportedError, "Profile not supported");
1794 return tcu::TestStatus::pass("Profile supported");
1796 #endif // CTS_USES_VULKANSC
1799 void createTestDevice (Context& context, void* pNext, const char* const* ppEnabledExtensionNames, deUint32 enabledExtensionCount)
1801 const PlatformInterface& platformInterface = context.getPlatformInterface();
1802 const auto validationEnabled = context.getTestContext().getCommandLine().isValidationEnabled();
1803 const Unique<VkInstance> instance (createDefaultInstance(platformInterface, context.getUsedApiVersion()));
1804 const InstanceDriver instanceDriver (platformInterface, instance.get());
1805 const VkPhysicalDevice physicalDevice = chooseDevice(instanceDriver, instance.get(), context.getTestContext().getCommandLine());
1806 const deUint32 queueFamilyIndex = 0;
1807 const deUint32 queueCount = 1;
1808 const deUint32 queueIndex = 0;
1809 const float queuePriority = 1.0f;
1810 const vector<VkQueueFamilyProperties> queueFamilyProperties = getPhysicalDeviceQueueFamilyProperties(instanceDriver, physicalDevice);
1811 const VkDeviceQueueCreateInfo deviceQueueCreateInfo =
1813 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // VkStructureType sType;
1814 DE_NULL, // const void* pNext;
1815 (VkDeviceQueueCreateFlags)0u, // VkDeviceQueueCreateFlags flags;
1816 queueFamilyIndex, // deUint32 queueFamilyIndex;
1817 queueCount, // deUint32 queueCount;
1818 &queuePriority, // const float* pQueuePriorities;
1820 #ifdef CTS_USES_VULKANSC
1821 VkDeviceObjectReservationCreateInfo memReservationInfo = context.getTestContext().getCommandLine().isSubProcess() ? context.getResourceInterface()->getStatMax() : resetDeviceObjectReservationCreateInfo();
1822 memReservationInfo.pNext = pNext;
1823 pNext = &memReservationInfo;
1825 VkPhysicalDeviceVulkanSC10Features sc10Features = createDefaultSC10Features();
1826 sc10Features.pNext = pNext;
1827 pNext = &sc10Features;
1829 VkPipelineCacheCreateInfo pcCI;
1830 std::vector<VkPipelinePoolSize> poolSizes;
1831 if (context.getTestContext().getCommandLine().isSubProcess())
1833 if (context.getResourceInterface()->getCacheDataSize() > 0)
1837 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO, // VkStructureType sType;
1838 DE_NULL, // const void* pNext;
1839 VK_PIPELINE_CACHE_CREATE_READ_ONLY_BIT |
1840 VK_PIPELINE_CACHE_CREATE_USE_APPLICATION_STORAGE_BIT, // VkPipelineCacheCreateFlags flags;
1841 context.getResourceInterface()->getCacheDataSize(), // deUintptr initialDataSize;
1842 context.getResourceInterface()->getCacheData() // const void* pInitialData;
1844 memReservationInfo.pipelineCacheCreateInfoCount = 1;
1845 memReservationInfo.pPipelineCacheCreateInfos = &pcCI;
1848 poolSizes = context.getResourceInterface()->getPipelinePoolSizes();
1849 if (!poolSizes.empty())
1851 memReservationInfo.pipelinePoolSizeCount = deUint32(poolSizes.size());
1852 memReservationInfo.pPipelinePoolSizes = poolSizes.data();
1855 #endif // CTS_USES_VULKANSC
1857 const VkDeviceCreateInfo deviceCreateInfo =
1859 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, // VkStructureType sType;
1860 pNext, // const void* pNext;
1861 (VkDeviceCreateFlags)0u, // VkDeviceCreateFlags flags;
1862 1, // deUint32 queueCreateInfoCount;
1863 &deviceQueueCreateInfo, // const VkDeviceQueueCreateInfo* pQueueCreateInfos;
1864 0, // deUint32 enabledLayerCount;
1865 DE_NULL, // const char* const* ppEnabledLayerNames;
1866 enabledExtensionCount, // deUint32 enabledExtensionCount;
1867 ppEnabledExtensionNames, // const char* const* ppEnabledExtensionNames;
1868 DE_NULL, // const VkPhysicalDeviceFeatures* pEnabledFeatures;
1870 const Unique<VkDevice> device (createCustomDevice(validationEnabled, platformInterface, *instance, instanceDriver, physicalDevice, &deviceCreateInfo));
1871 const DeviceDriver deviceDriver (platformInterface, instance.get(), device.get());
1872 const VkQueue queue = getDeviceQueue(deviceDriver, *device, queueFamilyIndex, queueIndex);
1874 VK_CHECK(deviceDriver.queueWaitIdle(queue));
1877 void cleanVulkanStruct (void* structPtr, size_t structSize)
1879 struct StructureBase
1881 VkStructureType sType;
1885 VkStructureType sType = ((StructureBase*)structPtr)->sType;
1887 deMemset(structPtr, 0, structSize);
1889 ((StructureBase*)structPtr)->sType = sType;
1892 template <deUint32 VK_API_VERSION>
1893 tcu::TestStatus featureBitInfluenceOnDeviceCreate (Context& context)
1895 #define FEATURE_TABLE_ITEM(CORE, EXT, FIELD, STR) { &(CORE), sizeof(CORE), &(CORE.FIELD), #CORE "." #FIELD, &(EXT), sizeof(EXT), &(EXT.FIELD), #EXT "." #FIELD, STR }
1896 #define DEPENDENCY_DUAL_ITEM(CORE, EXT, FIELD, PARENT) { &(CORE.FIELD), &(CORE.PARENT) }, { &(EXT.FIELD), &(EXT.PARENT) }
1897 #define DEPENDENCY_SINGLE_ITEM(CORE, FIELD, PARENT) { &(CORE.FIELD), &(CORE.PARENT) }
1899 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1900 const InstanceInterface& vki = context.getInstanceInterface();
1901 TestLog& log = context.getTestContext().getLog();
1902 const std::vector<VkExtensionProperties> deviceExtensionProperties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
1904 VkPhysicalDeviceFeatures2 features2 = initVulkanStructure();
1906 VkPhysicalDeviceVulkan11Features vulkan11Features = initVulkanStructure();
1907 VkPhysicalDeviceVulkan12Features vulkan12Features = initVulkanStructure();
1908 VkPhysicalDevice16BitStorageFeatures sixteenBitStorageFeatures = initVulkanStructure();
1909 VkPhysicalDeviceMultiviewFeatures multiviewFeatures = initVulkanStructure();
1910 VkPhysicalDeviceVariablePointersFeatures variablePointersFeatures = initVulkanStructure();
1911 VkPhysicalDeviceProtectedMemoryFeatures protectedMemoryFeatures = initVulkanStructure();
1912 VkPhysicalDeviceSamplerYcbcrConversionFeatures samplerYcbcrConversionFeatures = initVulkanStructure();
1913 VkPhysicalDeviceShaderDrawParametersFeatures shaderDrawParametersFeatures = initVulkanStructure();
1914 VkPhysicalDevice8BitStorageFeatures eightBitStorageFeatures = initVulkanStructure();
1915 VkPhysicalDeviceShaderAtomicInt64Features shaderAtomicInt64Features = initVulkanStructure();
1916 VkPhysicalDeviceShaderFloat16Int8Features shaderFloat16Int8Features = initVulkanStructure();
1917 VkPhysicalDeviceDescriptorIndexingFeatures descriptorIndexingFeatures = initVulkanStructure();
1918 VkPhysicalDeviceScalarBlockLayoutFeatures scalarBlockLayoutFeatures = initVulkanStructure();
1919 VkPhysicalDeviceImagelessFramebufferFeatures imagelessFramebufferFeatures = initVulkanStructure();
1920 VkPhysicalDeviceUniformBufferStandardLayoutFeatures uniformBufferStandardLayoutFeatures = initVulkanStructure();
1921 VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures shaderSubgroupExtendedTypesFeatures = initVulkanStructure();
1922 VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures separateDepthStencilLayoutsFeatures = initVulkanStructure();
1923 VkPhysicalDeviceHostQueryResetFeatures hostQueryResetFeatures = initVulkanStructure();
1924 VkPhysicalDeviceTimelineSemaphoreFeatures timelineSemaphoreFeatures = initVulkanStructure();
1925 VkPhysicalDeviceBufferDeviceAddressFeatures bufferDeviceAddressFeatures = initVulkanStructure();
1926 VkPhysicalDeviceVulkanMemoryModelFeatures vulkanMemoryModelFeatures = initVulkanStructure();
1928 #ifndef CTS_USES_VULKANSC
1929 VkPhysicalDeviceVulkan13Features vulkan13Features = initVulkanStructure();
1930 VkPhysicalDeviceImageRobustnessFeatures imageRobustnessFeatures = initVulkanStructure();
1931 VkPhysicalDeviceInlineUniformBlockFeatures inlineUniformBlockFeatures = initVulkanStructure();
1932 VkPhysicalDevicePipelineCreationCacheControlFeatures pipelineCreationCacheControlFeatures = initVulkanStructure();
1933 VkPhysicalDevicePrivateDataFeatures privateDataFeatures = initVulkanStructure();
1934 VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures shaderDemoteToHelperInvocationFeatures = initVulkanStructure();
1935 VkPhysicalDeviceShaderTerminateInvocationFeatures shaderTerminateInvocationFeatures = initVulkanStructure();
1936 VkPhysicalDeviceSubgroupSizeControlFeatures subgroupSizeControlFeatures = initVulkanStructure();
1937 VkPhysicalDeviceSynchronization2Features synchronization2Features = initVulkanStructure();
1938 VkPhysicalDeviceTextureCompressionASTCHDRFeatures textureCompressionASTCHDRFeatures = initVulkanStructure();
1939 VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures zeroInitializeWorkgroupMemoryFeatures = initVulkanStructure();
1940 VkPhysicalDeviceDynamicRenderingFeatures dynamicRenderingFeatures = initVulkanStructure();
1941 VkPhysicalDeviceShaderIntegerDotProductFeatures shaderIntegerDotProductFeatures = initVulkanStructure();
1942 VkPhysicalDeviceMaintenance4Features maintenance4Features = initVulkanStructure();
1943 #endif // CTS_USES_VULKANSC
1945 struct UnusedExtensionFeatures
1947 VkStructureType sType;
1949 VkBool32 descriptorIndexing;
1950 VkBool32 samplerFilterMinmax;
1951 } unusedExtensionFeatures;
1955 void* coreStructPtr;
1956 size_t coreStructSize;
1957 VkBool32* coreFieldPtr;
1958 const char* coreFieldName;
1960 size_t extStructSize;
1961 VkBool32* extFieldPtr;
1962 const char* extFieldName;
1963 const char* extString;
1965 struct FeatureDependencyTable
1967 VkBool32* featurePtr;
1968 VkBool32* dependOnPtr;
1971 std::vector<FeatureTable> featureTable;
1972 std::vector<FeatureDependencyTable> featureDependencyTable;
1974 if (VK_API_VERSION == VK_API_VERSION_1_2)
1978 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, storageBuffer16BitAccess, "VK_KHR_16bit_storage"),
1979 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, uniformAndStorageBuffer16BitAccess, "VK_KHR_16bit_storage"),
1980 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, storagePushConstant16, "VK_KHR_16bit_storage"),
1981 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, storageInputOutput16, "VK_KHR_16bit_storage"),
1982 FEATURE_TABLE_ITEM(vulkan11Features, multiviewFeatures, multiview, "VK_KHR_multiview"),
1983 FEATURE_TABLE_ITEM(vulkan11Features, multiviewFeatures, multiviewGeometryShader, "VK_KHR_multiview"),
1984 FEATURE_TABLE_ITEM(vulkan11Features, multiviewFeatures, multiviewTessellationShader, "VK_KHR_multiview"),
1985 FEATURE_TABLE_ITEM(vulkan11Features, variablePointersFeatures, variablePointersStorageBuffer, "VK_KHR_variable_pointers"),
1986 FEATURE_TABLE_ITEM(vulkan11Features, variablePointersFeatures, variablePointers, "VK_KHR_variable_pointers"),
1987 FEATURE_TABLE_ITEM(vulkan11Features, protectedMemoryFeatures, protectedMemory, DE_NULL),
1988 FEATURE_TABLE_ITEM(vulkan11Features, samplerYcbcrConversionFeatures, samplerYcbcrConversion, "VK_KHR_sampler_ycbcr_conversion"),
1989 FEATURE_TABLE_ITEM(vulkan11Features, shaderDrawParametersFeatures, shaderDrawParameters, DE_NULL),
1990 FEATURE_TABLE_ITEM(vulkan12Features, eightBitStorageFeatures, storageBuffer8BitAccess, "VK_KHR_8bit_storage"),
1991 FEATURE_TABLE_ITEM(vulkan12Features, eightBitStorageFeatures, uniformAndStorageBuffer8BitAccess, "VK_KHR_8bit_storage"),
1992 FEATURE_TABLE_ITEM(vulkan12Features, eightBitStorageFeatures, storagePushConstant8, "VK_KHR_8bit_storage"),
1993 FEATURE_TABLE_ITEM(vulkan12Features, shaderAtomicInt64Features, shaderBufferInt64Atomics, "VK_KHR_shader_atomic_int64"),
1994 FEATURE_TABLE_ITEM(vulkan12Features, shaderAtomicInt64Features, shaderSharedInt64Atomics, "VK_KHR_shader_atomic_int64"),
1995 FEATURE_TABLE_ITEM(vulkan12Features, shaderFloat16Int8Features, shaderFloat16, "VK_KHR_shader_float16_int8"),
1996 FEATURE_TABLE_ITEM(vulkan12Features, shaderFloat16Int8Features, shaderInt8, "VK_KHR_shader_float16_int8"),
1997 FEATURE_TABLE_ITEM(vulkan12Features, unusedExtensionFeatures, descriptorIndexing, DE_NULL),
1998 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderInputAttachmentArrayDynamicIndexing, "VK_EXT_descriptor_indexing"),
1999 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderUniformTexelBufferArrayDynamicIndexing, "VK_EXT_descriptor_indexing"),
2000 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderStorageTexelBufferArrayDynamicIndexing, "VK_EXT_descriptor_indexing"),
2001 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderUniformBufferArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
2002 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderSampledImageArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
2003 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderStorageBufferArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
2004 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderStorageImageArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
2005 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderInputAttachmentArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
2006 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderUniformTexelBufferArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
2007 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderStorageTexelBufferArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
2008 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingUniformBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2009 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingSampledImageUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2010 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingStorageImageUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2011 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingStorageBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2012 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingUniformTexelBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2013 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingStorageTexelBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
2014 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingUpdateUnusedWhilePending, "VK_EXT_descriptor_indexing"),
2015 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingPartiallyBound, "VK_EXT_descriptor_indexing"),
2016 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingVariableDescriptorCount, "VK_EXT_descriptor_indexing"),
2017 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, runtimeDescriptorArray, "VK_EXT_descriptor_indexing"),
2018 FEATURE_TABLE_ITEM(vulkan12Features, unusedExtensionFeatures, samplerFilterMinmax, "VK_EXT_sampler_filter_minmax"),
2019 FEATURE_TABLE_ITEM(vulkan12Features, scalarBlockLayoutFeatures, scalarBlockLayout, "VK_EXT_scalar_block_layout"),
2020 FEATURE_TABLE_ITEM(vulkan12Features, imagelessFramebufferFeatures, imagelessFramebuffer, "VK_KHR_imageless_framebuffer"),
2021 FEATURE_TABLE_ITEM(vulkan12Features, uniformBufferStandardLayoutFeatures, uniformBufferStandardLayout, "VK_KHR_uniform_buffer_standard_layout"),
2022 FEATURE_TABLE_ITEM(vulkan12Features, shaderSubgroupExtendedTypesFeatures, shaderSubgroupExtendedTypes, "VK_KHR_shader_subgroup_extended_types"),
2023 FEATURE_TABLE_ITEM(vulkan12Features, separateDepthStencilLayoutsFeatures, separateDepthStencilLayouts, "VK_KHR_separate_depth_stencil_layouts"),
2024 FEATURE_TABLE_ITEM(vulkan12Features, hostQueryResetFeatures, hostQueryReset, "VK_EXT_host_query_reset"),
2025 FEATURE_TABLE_ITEM(vulkan12Features, timelineSemaphoreFeatures, timelineSemaphore, "VK_KHR_timeline_semaphore"),
2026 FEATURE_TABLE_ITEM(vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddress, "VK_EXT_buffer_device_address"),
2027 FEATURE_TABLE_ITEM(vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressCaptureReplay, "VK_EXT_buffer_device_address"),
2028 FEATURE_TABLE_ITEM(vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressMultiDevice, "VK_EXT_buffer_device_address"),
2029 FEATURE_TABLE_ITEM(vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModel, "VK_KHR_vulkan_memory_model"),
2030 FEATURE_TABLE_ITEM(vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModelDeviceScope, "VK_KHR_vulkan_memory_model"),
2031 FEATURE_TABLE_ITEM(vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModelAvailabilityVisibilityChains, "VK_KHR_vulkan_memory_model"),
2034 featureDependencyTable =
2036 DEPENDENCY_DUAL_ITEM (vulkan11Features, multiviewFeatures, multiviewGeometryShader, multiview),
2037 DEPENDENCY_DUAL_ITEM (vulkan11Features, multiviewFeatures, multiviewTessellationShader, multiview),
2038 DEPENDENCY_DUAL_ITEM (vulkan11Features, variablePointersFeatures, variablePointers, variablePointersStorageBuffer),
2039 DEPENDENCY_DUAL_ITEM (vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressCaptureReplay, bufferDeviceAddress),
2040 DEPENDENCY_DUAL_ITEM (vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressMultiDevice, bufferDeviceAddress),
2041 DEPENDENCY_DUAL_ITEM (vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModelDeviceScope, vulkanMemoryModel),
2042 DEPENDENCY_DUAL_ITEM (vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModelAvailabilityVisibilityChains, vulkanMemoryModel),
2045 #ifndef CTS_USES_VULKANSC
2046 else // if (VK_API_VERSION == VK_API_VERSION_1_3)
2050 FEATURE_TABLE_ITEM(vulkan13Features, imageRobustnessFeatures, robustImageAccess, "VK_EXT_image_robustness"),
2051 FEATURE_TABLE_ITEM(vulkan13Features, inlineUniformBlockFeatures, inlineUniformBlock, "VK_EXT_inline_uniform_block"),
2052 FEATURE_TABLE_ITEM(vulkan13Features, inlineUniformBlockFeatures, descriptorBindingInlineUniformBlockUpdateAfterBind, "VK_EXT_inline_uniform_block"),
2053 FEATURE_TABLE_ITEM(vulkan13Features, pipelineCreationCacheControlFeatures, pipelineCreationCacheControl, "VK_EXT_pipeline_creation_cache_control"),
2054 FEATURE_TABLE_ITEM(vulkan13Features, privateDataFeatures, privateData, "VK_EXT_private_data"),
2055 FEATURE_TABLE_ITEM(vulkan13Features, shaderDemoteToHelperInvocationFeatures, shaderDemoteToHelperInvocation, "VK_EXT_shader_demote_to_helper_invocation"),
2056 FEATURE_TABLE_ITEM(vulkan13Features, shaderTerminateInvocationFeatures, shaderTerminateInvocation, "VK_KHR_shader_terminate_invocation"),
2057 FEATURE_TABLE_ITEM(vulkan13Features, subgroupSizeControlFeatures, subgroupSizeControl, "VK_EXT_subgroup_size_control"),
2058 FEATURE_TABLE_ITEM(vulkan13Features, subgroupSizeControlFeatures, computeFullSubgroups, "VK_EXT_subgroup_size_control"),
2059 FEATURE_TABLE_ITEM(vulkan13Features, synchronization2Features, synchronization2, "VK_KHR_synchronization2"),
2060 FEATURE_TABLE_ITEM(vulkan13Features, textureCompressionASTCHDRFeatures, textureCompressionASTC_HDR, "VK_EXT_texture_compression_astc_hdr"),
2061 FEATURE_TABLE_ITEM(vulkan13Features, zeroInitializeWorkgroupMemoryFeatures, shaderZeroInitializeWorkgroupMemory, "VK_KHR_zero_initialize_workgroup_memory"),
2062 FEATURE_TABLE_ITEM(vulkan13Features, dynamicRenderingFeatures, dynamicRendering, "VK_KHR_dynamic_rendering"),
2063 FEATURE_TABLE_ITEM(vulkan13Features, shaderIntegerDotProductFeatures, shaderIntegerDotProduct, "VK_KHR_shader_integer_dot_product"),
2064 FEATURE_TABLE_ITEM(vulkan13Features, maintenance4Features, maintenance4, "VK_KHR_maintenance4"),
2067 #endif // CTS_USES_VULKANSC
2069 deMemset(&unusedExtensionFeatures, 0, sizeof(unusedExtensionFeatures));
2071 for (FeatureTable& testedFeature : featureTable)
2073 VkBool32 coreFeatureState= DE_FALSE;
2074 VkBool32 extFeatureState = DE_FALSE;
2078 void* structPtr = testedFeature.coreStructPtr;
2079 size_t structSize = testedFeature.coreStructSize;
2080 VkBool32* featurePtr = testedFeature.coreFieldPtr;
2082 if (structPtr != &unusedExtensionFeatures)
2083 features2.pNext = structPtr;
2085 vki.getPhysicalDeviceFeatures2(physicalDevice, &features2);
2087 coreFeatureState = featurePtr[0];
2089 log << TestLog::Message
2090 << "Feature status "
2091 << testedFeature.coreFieldName << "=" << coreFeatureState
2092 << TestLog::EndMessage;
2094 if (coreFeatureState)
2096 cleanVulkanStruct(structPtr, structSize);
2098 featurePtr[0] = DE_TRUE;
2100 for (FeatureDependencyTable featureDependency : featureDependencyTable)
2101 if (featureDependency.featurePtr == featurePtr)
2102 featureDependency.dependOnPtr[0] = DE_TRUE;
2104 createTestDevice(context, &features2, DE_NULL, 0u);
2110 void* structPtr = testedFeature.extStructPtr;
2111 size_t structSize = testedFeature.extStructSize;
2112 VkBool32* featurePtr = testedFeature.extFieldPtr;
2113 const char* extStringPtr = testedFeature.extString;
2115 if (structPtr != &unusedExtensionFeatures)
2116 features2.pNext = structPtr;
2118 if (extStringPtr == DE_NULL || isExtensionSupported(deviceExtensionProperties, RequiredExtension(extStringPtr)))
2120 vki.getPhysicalDeviceFeatures2(physicalDevice, &features2);
2122 extFeatureState = *featurePtr;
2124 log << TestLog::Message
2125 << "Feature status "
2126 << testedFeature.extFieldName << "=" << extFeatureState
2127 << TestLog::EndMessage;
2129 if (extFeatureState)
2131 cleanVulkanStruct(structPtr, structSize);
2133 featurePtr[0] = DE_TRUE;
2135 for (FeatureDependencyTable& featureDependency : featureDependencyTable)
2136 if (featureDependency.featurePtr == featurePtr)
2137 featureDependency.dependOnPtr[0] = DE_TRUE;
2139 createTestDevice(context, &features2, &extStringPtr, (extStringPtr == DE_NULL) ? 0u : 1u );
2145 return tcu::TestStatus::pass("pass");
2148 template<typename T>
2149 class CheckIncompleteResult
2152 virtual ~CheckIncompleteResult (void) {}
2153 virtual void getResult (Context& context, T* data) = 0;
2155 void operator() (Context& context, tcu::ResultCollector& results, const std::size_t expectedCompleteSize)
2157 if (expectedCompleteSize == 0)
2160 vector<T> outputData (expectedCompleteSize);
2161 const deUint32 usedSize = static_cast<deUint32>(expectedCompleteSize / 3);
2163 ValidateQueryBits::fillBits(outputData.begin(), outputData.end()); // unused entries should have this pattern intact
2165 m_result = VK_SUCCESS;
2167 getResult(context, &outputData[0]); // update m_count and m_result
2169 if (m_count != usedSize || m_result != VK_INCOMPLETE || !ValidateQueryBits::checkBits(outputData.begin() + m_count, outputData.end()))
2170 results.fail("Query didn't return VK_INCOMPLETE");
2178 struct CheckEnumeratePhysicalDevicesIncompleteResult : public CheckIncompleteResult<VkPhysicalDevice>
2180 void getResult (Context& context, VkPhysicalDevice* data)
2182 m_result = context.getInstanceInterface().enumeratePhysicalDevices(context.getInstance(), &m_count, data);
2186 struct CheckEnumeratePhysicalDeviceGroupsIncompleteResult : public CheckIncompleteResult<VkPhysicalDeviceGroupProperties>
2188 void getResult (Context& context, VkPhysicalDeviceGroupProperties* data)
2190 m_result = context.getInstanceInterface().enumeratePhysicalDeviceGroups(context.getInstance(), &m_count, data);
2194 struct CheckEnumerateInstanceLayerPropertiesIncompleteResult : public CheckIncompleteResult<VkLayerProperties>
2196 void getResult (Context& context, VkLayerProperties* data)
2198 m_result = context.getPlatformInterface().enumerateInstanceLayerProperties(&m_count, data);
2202 struct CheckEnumerateDeviceLayerPropertiesIncompleteResult : public CheckIncompleteResult<VkLayerProperties>
2204 void getResult (Context& context, VkLayerProperties* data)
2206 m_result = context.getInstanceInterface().enumerateDeviceLayerProperties(context.getPhysicalDevice(), &m_count, data);
2210 struct CheckEnumerateInstanceExtensionPropertiesIncompleteResult : public CheckIncompleteResult<VkExtensionProperties>
2212 CheckEnumerateInstanceExtensionPropertiesIncompleteResult (std::string layerName = std::string()) : m_layerName(layerName) {}
2214 void getResult (Context& context, VkExtensionProperties* data)
2216 const char* pLayerName = (m_layerName.length() != 0 ? m_layerName.c_str() : DE_NULL);
2217 m_result = context.getPlatformInterface().enumerateInstanceExtensionProperties(pLayerName, &m_count, data);
2221 const std::string m_layerName;
2224 struct CheckEnumerateDeviceExtensionPropertiesIncompleteResult : public CheckIncompleteResult<VkExtensionProperties>
2226 CheckEnumerateDeviceExtensionPropertiesIncompleteResult (std::string layerName = std::string()) : m_layerName(layerName) {}
2228 void getResult (Context& context, VkExtensionProperties* data)
2230 const char* pLayerName = (m_layerName.length() != 0 ? m_layerName.c_str() : DE_NULL);
2231 m_result = context.getInstanceInterface().enumerateDeviceExtensionProperties(context.getPhysicalDevice(), pLayerName, &m_count, data);
2235 const std::string m_layerName;
2238 tcu::TestStatus enumeratePhysicalDevices (Context& context)
2240 TestLog& log = context.getTestContext().getLog();
2241 tcu::ResultCollector results (log);
2242 const vector<VkPhysicalDevice> devices = enumeratePhysicalDevices(context.getInstanceInterface(), context.getInstance());
2244 log << TestLog::Integer("NumDevices", "Number of devices", "", QP_KEY_TAG_NONE, deInt64(devices.size()));
2246 for (size_t ndx = 0; ndx < devices.size(); ndx++)
2247 log << TestLog::Message << ndx << ": " << devices[ndx] << TestLog::EndMessage;
2249 CheckEnumeratePhysicalDevicesIncompleteResult()(context, results, devices.size());
2251 return tcu::TestStatus(results.getResult(), results.getMessage());
2254 tcu::TestStatus enumeratePhysicalDeviceGroups (Context& context)
2256 TestLog& log = context.getTestContext().getLog();
2257 tcu::ResultCollector results (log);
2258 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_device_group_creation"));
2259 const InstanceDriver& vki (instance.getDriver());
2260 const vector<VkPhysicalDeviceGroupProperties> devicegroups = enumeratePhysicalDeviceGroups(vki, instance);
2262 log << TestLog::Integer("NumDevices", "Number of device groups", "", QP_KEY_TAG_NONE, deInt64(devicegroups.size()));
2264 for (size_t ndx = 0; ndx < devicegroups.size(); ndx++)
2265 log << TestLog::Message << ndx << ": " << devicegroups[ndx] << TestLog::EndMessage;
2267 CheckEnumeratePhysicalDeviceGroupsIncompleteResult()(context, results, devicegroups.size());
2269 return tcu::TestStatus(results.getResult(), results.getMessage());
2272 template<typename T>
2273 void collectDuplicates (set<T>& duplicates, const vector<T>& values)
2277 for (size_t ndx = 0; ndx < values.size(); ndx++)
2279 const T& value = values[ndx];
2281 if (!seen.insert(value).second)
2282 duplicates.insert(value);
2286 void checkDuplicates (tcu::ResultCollector& results, const char* what, const vector<string>& values)
2288 set<string> duplicates;
2290 collectDuplicates(duplicates, values);
2292 for (set<string>::const_iterator iter = duplicates.begin(); iter != duplicates.end(); ++iter)
2294 std::ostringstream msg;
2295 msg << "Duplicate " << what << ": " << *iter;
2296 results.fail(msg.str());
2300 void checkDuplicateExtensions (tcu::ResultCollector& results, const vector<string>& extensions)
2302 checkDuplicates(results, "extension", extensions);
2305 void checkDuplicateLayers (tcu::ResultCollector& results, const vector<string>& layers)
2307 checkDuplicates(results, "layer", layers);
2310 void checkKhrExtensions (tcu::ResultCollector& results,
2311 const vector<string>& extensions,
2312 const int numAllowedKhrExtensions,
2313 const char* const* allowedKhrExtensions)
2315 const set<string> allowedExtSet (allowedKhrExtensions, allowedKhrExtensions+numAllowedKhrExtensions);
2317 for (vector<string>::const_iterator extIter = extensions.begin(); extIter != extensions.end(); ++extIter)
2319 // Only Khronos-controlled extensions are checked
2320 if (de::beginsWith(*extIter, "VK_KHR_") &&
2321 !de::contains(allowedExtSet, *extIter))
2323 results.fail("Unknown extension " + *extIter);
2328 void checkInstanceExtensions (tcu::ResultCollector& results, const vector<string>& extensions)
2330 #include "vkInstanceExtensions.inl"
2332 checkKhrExtensions(results, extensions, DE_LENGTH_OF_ARRAY(s_allowedInstanceKhrExtensions), s_allowedInstanceKhrExtensions);
2333 checkDuplicateExtensions(results, extensions);
2336 void checkDeviceExtensions (tcu::ResultCollector& results, const vector<string>& extensions)
2338 #include "vkDeviceExtensions.inl"
2340 checkKhrExtensions(results, extensions, DE_LENGTH_OF_ARRAY(s_allowedDeviceKhrExtensions), s_allowedDeviceKhrExtensions);
2341 checkDuplicateExtensions(results, extensions);
2344 #ifndef CTS_USES_VULKANSC
2346 void checkInstanceExtensionDependencies(tcu::ResultCollector& results,
2347 int dependencyLength,
2348 const std::tuple<deUint32, deUint32, deUint32, const char*, const char*>* dependencies,
2349 deUint32 apiVariant,
2350 deUint32 versionMajor,
2351 deUint32 versionMinor,
2352 const vector<VkExtensionProperties>& extensionProperties)
2354 for (int ndx = 0; ndx < dependencyLength; ndx++)
2356 deUint32 currentApiVariant, currentVersionMajor, currentVersionMinor;
2357 const char* extensionFirst;
2358 const char* extensionSecond;
2359 std::tie(currentApiVariant, currentVersionMajor, currentVersionMinor, extensionFirst, extensionSecond) = dependencies[ndx];
2360 if (currentApiVariant != apiVariant || currentVersionMajor != versionMajor || currentVersionMinor != versionMinor)
2362 if (isExtensionSupported(extensionProperties, RequiredExtension(extensionFirst)) &&
2363 !isExtensionSupported(extensionProperties, RequiredExtension(extensionSecond)))
2365 results.fail("Extension " + string(extensionFirst) + " is missing dependency: " + string(extensionSecond));
2370 void checkDeviceExtensionDependencies(tcu::ResultCollector& results,
2371 int dependencyLength,
2372 const std::tuple<deUint32, deUint32, deUint32, const char*, const char*>* dependencies,
2373 deUint32 apiVariant,
2374 deUint32 versionMajor,
2375 deUint32 versionMinor,
2376 const vector<VkExtensionProperties>& instanceExtensionProperties,
2377 const vector<VkExtensionProperties>& deviceExtensionProperties)
2379 for (int ndx = 0; ndx < dependencyLength; ndx++)
2381 deUint32 currentApiVariant, currentVersionMajor, currentVersionMinor;
2382 const char* extensionFirst;
2383 const char* extensionSecond;
2384 std::tie(currentApiVariant, currentVersionMajor, currentVersionMinor, extensionFirst, extensionSecond) = dependencies[ndx];
2385 if (currentApiVariant != apiVariant || currentVersionMajor != versionMajor || currentVersionMinor != versionMinor)
2387 if (isExtensionSupported(deviceExtensionProperties, RequiredExtension(extensionFirst)) &&
2388 !isExtensionSupported(deviceExtensionProperties, RequiredExtension(extensionSecond)) &&
2389 !isExtensionSupported(instanceExtensionProperties, RequiredExtension(extensionSecond)))
2391 results.fail("Extension " + string(extensionFirst) + " is missing dependency: " + string(extensionSecond));
2396 #endif // CTS_USES_VULKANSC
2398 tcu::TestStatus enumerateInstanceLayers (Context& context)
2400 TestLog& log = context.getTestContext().getLog();
2401 tcu::ResultCollector results (log);
2402 const vector<VkLayerProperties> properties = enumerateInstanceLayerProperties(context.getPlatformInterface());
2403 vector<string> layerNames;
2405 for (size_t ndx = 0; ndx < properties.size(); ndx++)
2407 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
2409 layerNames.push_back(properties[ndx].layerName);
2412 checkDuplicateLayers(results, layerNames);
2413 CheckEnumerateInstanceLayerPropertiesIncompleteResult()(context, results, layerNames.size());
2415 return tcu::TestStatus(results.getResult(), results.getMessage());
2418 tcu::TestStatus enumerateInstanceExtensions (Context& context)
2420 TestLog& log = context.getTestContext().getLog();
2421 tcu::ResultCollector results (log);
2424 const ScopedLogSection section (log, "Global", "Global Extensions");
2425 const vector<VkExtensionProperties> properties = enumerateInstanceExtensionProperties(context.getPlatformInterface(), DE_NULL);
2426 vector<string> extensionNames;
2428 for (size_t ndx = 0; ndx < properties.size(); ndx++)
2430 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
2432 extensionNames.push_back(properties[ndx].extensionName);
2435 checkInstanceExtensions(results, extensionNames);
2436 CheckEnumerateInstanceExtensionPropertiesIncompleteResult()(context, results, properties.size());
2438 #ifndef CTS_USES_VULKANSC
2439 for (const auto& version : releasedApiVersions)
2441 deUint32 apiVariant, versionMajor, versionMinor;
2442 std::tie(std::ignore, apiVariant, versionMajor, versionMinor) = version;
2443 if (context.contextSupports(vk::ApiVersion(apiVariant, versionMajor, versionMinor, 0)))
2445 checkInstanceExtensionDependencies(results,
2446 DE_LENGTH_OF_ARRAY(instanceExtensionDependencies),
2447 instanceExtensionDependencies,
2455 #endif // CTS_USES_VULKANSC
2460 const vector<VkLayerProperties> layers = enumerateInstanceLayerProperties(context.getPlatformInterface());
2462 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
2464 const ScopedLogSection section (log, layer->layerName, string("Layer: ") + layer->layerName);
2465 const vector<VkExtensionProperties> properties = enumerateInstanceExtensionProperties(context.getPlatformInterface(), layer->layerName);
2466 vector<string> extensionNames;
2468 for (size_t extNdx = 0; extNdx < properties.size(); extNdx++)
2470 log << TestLog::Message << extNdx << ": " << properties[extNdx] << TestLog::EndMessage;
2472 extensionNames.push_back(properties[extNdx].extensionName);
2475 checkInstanceExtensions(results, extensionNames);
2476 CheckEnumerateInstanceExtensionPropertiesIncompleteResult(layer->layerName)(context, results, properties.size());
2480 return tcu::TestStatus(results.getResult(), results.getMessage());
2483 tcu::TestStatus testNoKhxExtensions (Context& context)
2485 VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
2486 const PlatformInterface& vkp = context.getPlatformInterface();
2487 const InstanceInterface& vki = context.getInstanceInterface();
2489 tcu::ResultCollector results(context.getTestContext().getLog());
2490 bool testSucceeded = true;
2491 deUint32 instanceExtensionsCount;
2492 deUint32 deviceExtensionsCount;
2494 // grab number of instance and device extensions
2495 vkp.enumerateInstanceExtensionProperties(DE_NULL, &instanceExtensionsCount, DE_NULL);
2496 vki.enumerateDeviceExtensionProperties(physicalDevice, DE_NULL, &deviceExtensionsCount, DE_NULL);
2497 vector<VkExtensionProperties> extensionsProperties(instanceExtensionsCount + deviceExtensionsCount);
2499 // grab instance and device extensions into single vector
2500 if (instanceExtensionsCount)
2501 vkp.enumerateInstanceExtensionProperties(DE_NULL, &instanceExtensionsCount, &extensionsProperties[0]);
2502 if (deviceExtensionsCount)
2503 vki.enumerateDeviceExtensionProperties(physicalDevice, DE_NULL, &deviceExtensionsCount, &extensionsProperties[instanceExtensionsCount]);
2505 // iterate over all extensions and verify their names
2506 vector<VkExtensionProperties>::const_iterator extension = extensionsProperties.begin();
2507 while (extension != extensionsProperties.end())
2509 // KHX author ID is no longer used, all KHX extensions have been promoted to KHR status
2510 std::string extensionName(extension->extensionName);
2511 bool caseFailed = de::beginsWith(extensionName, "VK_KHX_");
2514 results.fail("Invalid extension name " + extensionName);
2515 testSucceeded = false;
2521 return tcu::TestStatus::pass("No extensions begining with \"VK_KHX\"");
2522 return tcu::TestStatus::fail("One or more extensions begins with \"VK_KHX\"");
2525 tcu::TestStatus enumerateDeviceLayers (Context& context)
2527 TestLog& log = context.getTestContext().getLog();
2528 tcu::ResultCollector results (log);
2529 const vector<VkLayerProperties> properties = enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
2530 vector<string> layerNames;
2532 for (size_t ndx = 0; ndx < properties.size(); ndx++)
2534 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
2536 layerNames.push_back(properties[ndx].layerName);
2539 checkDuplicateLayers(results, layerNames);
2540 CheckEnumerateDeviceLayerPropertiesIncompleteResult()(context, results, layerNames.size());
2542 return tcu::TestStatus(results.getResult(), results.getMessage());
2545 tcu::TestStatus enumerateDeviceExtensions (Context& context)
2547 TestLog& log = context.getTestContext().getLog();
2548 tcu::ResultCollector results (log);
2551 const ScopedLogSection section (log, "Global", "Global Extensions");
2552 const vector<VkExtensionProperties> instanceExtensionProperties = enumerateInstanceExtensionProperties(context.getPlatformInterface(), DE_NULL);
2553 const vector<VkExtensionProperties> deviceExtensionProperties = enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), DE_NULL);
2554 vector<string> deviceExtensionNames;
2556 for (size_t ndx = 0; ndx < deviceExtensionProperties.size(); ndx++)
2558 log << TestLog::Message << ndx << ": " << deviceExtensionProperties[ndx] << TestLog::EndMessage;
2560 deviceExtensionNames.push_back(deviceExtensionProperties[ndx].extensionName);
2563 checkDeviceExtensions(results, deviceExtensionNames);
2564 CheckEnumerateDeviceExtensionPropertiesIncompleteResult()(context, results, deviceExtensionProperties.size());
2566 #ifndef CTS_USES_VULKANSC
2567 for (const auto& version : releasedApiVersions)
2569 deUint32 apiVariant, versionMajor, versionMinor;
2570 std::tie(std::ignore, apiVariant, versionMajor, versionMinor) = version;
2571 if (context.contextSupports(vk::ApiVersion(apiVariant, versionMajor, versionMinor, 0)))
2573 checkDeviceExtensionDependencies(results,
2574 DE_LENGTH_OF_ARRAY(deviceExtensionDependencies),
2575 deviceExtensionDependencies,
2579 instanceExtensionProperties,
2580 deviceExtensionProperties);
2584 #endif // CTS_USES_VULKANSC
2589 const vector<VkLayerProperties> layers = enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
2591 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
2593 const ScopedLogSection section (log, layer->layerName, string("Layer: ") + layer->layerName);
2594 const vector<VkExtensionProperties> properties = enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), layer->layerName);
2595 vector<string> extensionNames;
2597 for (size_t extNdx = 0; extNdx < properties.size(); extNdx++)
2599 log << TestLog::Message << extNdx << ": " << properties[extNdx] << TestLog::EndMessage;
2602 extensionNames.push_back(properties[extNdx].extensionName);
2605 checkDeviceExtensions(results, extensionNames);
2606 CheckEnumerateDeviceExtensionPropertiesIncompleteResult(layer->layerName)(context, results, properties.size());
2610 return tcu::TestStatus(results.getResult(), results.getMessage());
2613 tcu::TestStatus extensionCoreVersions (Context& context)
2617 const char* extName;
2619 auto& log = context.getTestContext().getLog();
2620 tcu::ResultCollector results (log);
2622 const auto instanceExtensionProperties = enumerateInstanceExtensionProperties(context.getPlatformInterface(), DE_NULL);
2623 const auto deviceExtensionProperties = enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), DE_NULL);
2625 for (const auto& majorMinorName : extensionRequiredCoreVersion)
2627 std::tie(major, minor, extName) = majorMinorName;
2628 const RequiredExtension reqExt (extName);
2630 if ((isExtensionSupported(instanceExtensionProperties, reqExt) || isExtensionSupported(deviceExtensionProperties, reqExt)) &&
2631 !context.contextSupports(vk::ApiVersion(0u, major, minor, 0u)))
2633 results.fail("Required core version for " + std::string(extName) + " not met (" + de::toString(major) + "." + de::toString(minor) + ")");
2637 return tcu::TestStatus(results.getResult(), results.getMessage());
2640 #define VK_SIZE_OF(STRUCT, MEMBER) (sizeof(((STRUCT*)0)->MEMBER))
2641 #define OFFSET_TABLE_ENTRY(STRUCT, MEMBER) { (size_t)DE_OFFSET_OF(STRUCT, MEMBER), VK_SIZE_OF(STRUCT, MEMBER) }
2643 tcu::TestStatus deviceFeatures (Context& context)
2645 using namespace ValidateQueryBits;
2647 TestLog& log = context.getTestContext().getLog();
2648 VkPhysicalDeviceFeatures* features;
2649 deUint8 buffer[sizeof(VkPhysicalDeviceFeatures) + GUARD_SIZE];
2651 const QueryMemberTableEntry featureOffsetTable[] =
2653 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, robustBufferAccess),
2654 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fullDrawIndexUint32),
2655 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, imageCubeArray),
2656 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, independentBlend),
2657 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, geometryShader),
2658 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, tessellationShader),
2659 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sampleRateShading),
2660 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, dualSrcBlend),
2661 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, logicOp),
2662 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, multiDrawIndirect),
2663 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, drawIndirectFirstInstance),
2664 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthClamp),
2665 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthBiasClamp),
2666 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fillModeNonSolid),
2667 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthBounds),
2668 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, wideLines),
2669 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, largePoints),
2670 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, alphaToOne),
2671 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, multiViewport),
2672 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, samplerAnisotropy),
2673 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionETC2),
2674 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionASTC_LDR),
2675 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionBC),
2676 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, occlusionQueryPrecise),
2677 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, pipelineStatisticsQuery),
2678 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, vertexPipelineStoresAndAtomics),
2679 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fragmentStoresAndAtomics),
2680 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderTessellationAndGeometryPointSize),
2681 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderImageGatherExtended),
2682 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageExtendedFormats),
2683 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageMultisample),
2684 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageReadWithoutFormat),
2685 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageWriteWithoutFormat),
2686 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderUniformBufferArrayDynamicIndexing),
2687 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderSampledImageArrayDynamicIndexing),
2688 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageBufferArrayDynamicIndexing),
2689 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageArrayDynamicIndexing),
2690 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderClipDistance),
2691 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderCullDistance),
2692 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderFloat64),
2693 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderInt64),
2694 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderInt16),
2695 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderResourceResidency),
2696 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderResourceMinLod),
2697 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseBinding),
2698 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyBuffer),
2699 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyImage2D),
2700 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyImage3D),
2701 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency2Samples),
2702 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency4Samples),
2703 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency8Samples),
2704 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency16Samples),
2705 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyAliased),
2706 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, variableMultisampleRate),
2707 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, inheritedQueries),
2711 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
2712 features = reinterpret_cast<VkPhysicalDeviceFeatures*>(buffer);
2714 context.getInstanceInterface().getPhysicalDeviceFeatures(context.getPhysicalDevice(), features);
2716 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
2717 << TestLog::Message << *features << TestLog::EndMessage;
2719 // Requirements and dependencies
2721 if (!features->robustBufferAccess)
2722 return tcu::TestStatus::fail("robustBufferAccess is not supported");
2725 for (int ndx = 0; ndx < GUARD_SIZE; ndx++)
2727 if (buffer[ndx + sizeof(VkPhysicalDeviceFeatures)] != GUARD_VALUE)
2729 log << TestLog::Message << "deviceFeatures - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
2730 return tcu::TestStatus::fail("deviceFeatures buffer overflow");
2734 if (!validateInitComplete(context.getPhysicalDevice(), &InstanceInterface::getPhysicalDeviceFeatures, context.getInstanceInterface(), featureOffsetTable))
2736 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceFeatures not completely initialized" << TestLog::EndMessage;
2737 return tcu::TestStatus::fail("deviceFeatures incomplete initialization");
2740 return tcu::TestStatus::pass("Query succeeded");
2743 static const ValidateQueryBits::QueryMemberTableEntry s_physicalDevicePropertiesOffsetTable[] =
2745 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, apiVersion),
2746 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, driverVersion),
2747 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, vendorID),
2748 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, deviceID),
2749 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, deviceType),
2750 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, pipelineCacheUUID),
2751 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension1D),
2752 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension2D),
2753 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension3D),
2754 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimensionCube),
2755 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageArrayLayers),
2756 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelBufferElements),
2757 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxUniformBufferRange),
2758 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxStorageBufferRange),
2759 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPushConstantsSize),
2760 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxMemoryAllocationCount),
2761 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerAllocationCount),
2762 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.bufferImageGranularity),
2763 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sparseAddressSpaceSize),
2764 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxBoundDescriptorSets),
2765 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorSamplers),
2766 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorUniformBuffers),
2767 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorStorageBuffers),
2768 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorSampledImages),
2769 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorStorageImages),
2770 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorInputAttachments),
2771 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageResources),
2772 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetSamplers),
2773 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetUniformBuffers),
2774 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetUniformBuffersDynamic),
2775 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageBuffers),
2776 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageBuffersDynamic),
2777 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetSampledImages),
2778 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageImages),
2779 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetInputAttachments),
2780 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputAttributes),
2781 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputBindings),
2782 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputAttributeOffset),
2783 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputBindingStride),
2784 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexOutputComponents),
2785 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationGenerationLevel),
2786 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationPatchSize),
2787 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerVertexInputComponents),
2788 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerVertexOutputComponents),
2789 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerPatchOutputComponents),
2790 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlTotalOutputComponents),
2791 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationEvaluationInputComponents),
2792 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationEvaluationOutputComponents),
2793 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryShaderInvocations),
2794 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryInputComponents),
2795 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryOutputComponents),
2796 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryOutputVertices),
2797 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryTotalOutputComponents),
2798 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentInputComponents),
2799 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentOutputAttachments),
2800 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentDualSrcAttachments),
2801 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentCombinedOutputResources),
2802 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeSharedMemorySize),
2803 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupCount[3]),
2804 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupInvocations),
2805 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupSize[3]),
2806 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subPixelPrecisionBits),
2807 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subTexelPrecisionBits),
2808 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.mipmapPrecisionBits),
2809 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDrawIndexedIndexValue),
2810 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDrawIndirectCount),
2811 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerLodBias),
2812 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerAnisotropy),
2813 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxViewports),
2814 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxViewportDimensions[2]),
2815 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.viewportBoundsRange[2]),
2816 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.viewportSubPixelBits),
2817 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minMemoryMapAlignment),
2818 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelBufferOffsetAlignment),
2819 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minUniformBufferOffsetAlignment),
2820 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minStorageBufferOffsetAlignment),
2821 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelOffset),
2822 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelOffset),
2823 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelGatherOffset),
2824 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelGatherOffset),
2825 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minInterpolationOffset),
2826 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxInterpolationOffset),
2827 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subPixelInterpolationOffsetBits),
2828 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferWidth),
2829 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferHeight),
2830 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferLayers),
2831 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferColorSampleCounts),
2832 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferDepthSampleCounts),
2833 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferStencilSampleCounts),
2834 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferNoAttachmentsSampleCounts),
2835 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxColorAttachments),
2836 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageColorSampleCounts),
2837 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageIntegerSampleCounts),
2838 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageDepthSampleCounts),
2839 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageStencilSampleCounts),
2840 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.storageImageSampleCounts),
2841 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSampleMaskWords),
2842 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.timestampComputeAndGraphics),
2843 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.timestampPeriod),
2844 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxClipDistances),
2845 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxCullDistances),
2846 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxCombinedClipAndCullDistances),
2847 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.discreteQueuePriorities),
2848 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.pointSizeRange[2]),
2849 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.lineWidthRange[2]),
2850 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.pointSizeGranularity),
2851 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.lineWidthGranularity),
2852 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.strictLines),
2853 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.standardSampleLocations),
2854 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.optimalBufferCopyOffsetAlignment),
2855 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.optimalBufferCopyRowPitchAlignment),
2856 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.nonCoherentAtomSize),
2857 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard2DBlockShape),
2858 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard2DMultisampleBlockShape),
2859 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard3DBlockShape),
2860 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyAlignedMipSize),
2861 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyNonResidentStrict),
2865 tcu::TestStatus deviceProperties (Context& context)
2867 using namespace ValidateQueryBits;
2869 TestLog& log = context.getTestContext().getLog();
2870 VkPhysicalDeviceProperties* props;
2871 VkPhysicalDeviceFeatures features;
2872 deUint8 buffer[sizeof(VkPhysicalDeviceProperties) + GUARD_SIZE];
2874 props = reinterpret_cast<VkPhysicalDeviceProperties*>(buffer);
2875 deMemset(props, GUARD_VALUE, sizeof(buffer));
2877 context.getInstanceInterface().getPhysicalDeviceProperties(context.getPhysicalDevice(), props);
2878 context.getInstanceInterface().getPhysicalDeviceFeatures(context.getPhysicalDevice(), &features);
2880 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
2881 << TestLog::Message << *props << TestLog::EndMessage;
2883 if (!validateFeatureLimits(props, &features, log))
2884 return tcu::TestStatus::fail("deviceProperties - feature limits failed");
2886 for (int ndx = 0; ndx < GUARD_SIZE; ndx++)
2888 if (buffer[ndx + sizeof(VkPhysicalDeviceProperties)] != GUARD_VALUE)
2890 log << TestLog::Message << "deviceProperties - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
2891 return tcu::TestStatus::fail("deviceProperties buffer overflow");
2895 if (!validateInitComplete(context.getPhysicalDevice(), &InstanceInterface::getPhysicalDeviceProperties, context.getInstanceInterface(), s_physicalDevicePropertiesOffsetTable))
2897 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceProperties not completely initialized" << TestLog::EndMessage;
2898 return tcu::TestStatus::fail("deviceProperties incomplete initialization");
2901 // Check if deviceName string is properly terminated.
2902 if (deStrnlen(props->deviceName, VK_MAX_PHYSICAL_DEVICE_NAME_SIZE) == VK_MAX_PHYSICAL_DEVICE_NAME_SIZE)
2904 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceProperties deviceName not properly initialized" << TestLog::EndMessage;
2905 return tcu::TestStatus::fail("deviceProperties incomplete initialization");
2909 const ApiVersion deviceVersion = unpackVersion(props->apiVersion);
2910 #ifndef CTS_USES_VULKANSC
2911 const ApiVersion deqpVersion = unpackVersion(VK_API_VERSION_1_3);
2913 const ApiVersion deqpVersion = unpackVersion(VK_API_VERSION_1_2);
2914 #endif // CTS_USES_VULKANSC
2916 if (deviceVersion.majorNum != deqpVersion.majorNum)
2918 log << TestLog::Message << "deviceProperties - API Major Version " << deviceVersion.majorNum << " is not valid" << TestLog::EndMessage;
2919 return tcu::TestStatus::fail("deviceProperties apiVersion not valid");
2922 if (deviceVersion.minorNum > deqpVersion.minorNum)
2924 log << TestLog::Message << "deviceProperties - API Minor Version " << deviceVersion.minorNum << " is not valid for this version of dEQP" << TestLog::EndMessage;
2925 return tcu::TestStatus::fail("deviceProperties apiVersion not valid");
2929 return tcu::TestStatus::pass("DeviceProperites query succeeded");
2932 tcu::TestStatus deviceQueueFamilyProperties (Context& context)
2934 TestLog& log = context.getTestContext().getLog();
2935 const vector<VkQueueFamilyProperties> queueProperties = getPhysicalDeviceQueueFamilyProperties(context.getInstanceInterface(), context.getPhysicalDevice());
2937 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage;
2939 for (size_t queueNdx = 0; queueNdx < queueProperties.size(); queueNdx++)
2940 log << TestLog::Message << queueNdx << ": " << queueProperties[queueNdx] << TestLog::EndMessage;
2942 return tcu::TestStatus::pass("Querying queue properties succeeded");
2945 tcu::TestStatus deviceMemoryProperties (Context& context)
2947 TestLog& log = context.getTestContext().getLog();
2948 VkPhysicalDeviceMemoryProperties* memProps;
2949 deUint8 buffer[sizeof(VkPhysicalDeviceMemoryProperties) + GUARD_SIZE];
2951 memProps = reinterpret_cast<VkPhysicalDeviceMemoryProperties*>(buffer);
2952 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
2954 context.getInstanceInterface().getPhysicalDeviceMemoryProperties(context.getPhysicalDevice(), memProps);
2956 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
2957 << TestLog::Message << *memProps << TestLog::EndMessage;
2959 for (deInt32 ndx = 0; ndx < GUARD_SIZE; ndx++)
2961 if (buffer[ndx + sizeof(VkPhysicalDeviceMemoryProperties)] != GUARD_VALUE)
2963 log << TestLog::Message << "deviceMemoryProperties - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
2964 return tcu::TestStatus::fail("deviceMemoryProperties buffer overflow");
2968 if (memProps->memoryHeapCount >= VK_MAX_MEMORY_HEAPS)
2970 log << TestLog::Message << "deviceMemoryProperties - HeapCount larger than " << (deUint32)VK_MAX_MEMORY_HEAPS << TestLog::EndMessage;
2971 return tcu::TestStatus::fail("deviceMemoryProperties HeapCount too large");
2974 if (memProps->memoryHeapCount == 1)
2976 if ((memProps->memoryHeaps[0].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) == 0)
2978 log << TestLog::Message << "deviceMemoryProperties - Single heap is not marked DEVICE_LOCAL" << TestLog::EndMessage;
2979 return tcu::TestStatus::fail("deviceMemoryProperties invalid HeapFlags");
2983 const VkMemoryPropertyFlags validPropertyFlags[] =
2986 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
2987 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
2988 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
2989 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
2990 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
2991 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
2992 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
2993 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT
2996 const VkMemoryPropertyFlags requiredPropertyFlags[] =
2998 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
3001 bool requiredFlagsFound[DE_LENGTH_OF_ARRAY(requiredPropertyFlags)];
3002 std::fill(DE_ARRAY_BEGIN(requiredFlagsFound), DE_ARRAY_END(requiredFlagsFound), false);
3004 for (deUint32 memoryNdx = 0; memoryNdx < memProps->memoryTypeCount; memoryNdx++)
3006 bool validPropTypeFound = false;
3008 if (memProps->memoryTypes[memoryNdx].heapIndex >= memProps->memoryHeapCount)
3010 log << TestLog::Message << "deviceMemoryProperties - heapIndex " << memProps->memoryTypes[memoryNdx].heapIndex << " larger than heapCount" << TestLog::EndMessage;
3011 return tcu::TestStatus::fail("deviceMemoryProperties - invalid heapIndex");
3014 const VkMemoryPropertyFlags bitsToCheck = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT|VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT;
3016 for (const VkMemoryPropertyFlags* requiredFlagsIterator = DE_ARRAY_BEGIN(requiredPropertyFlags); requiredFlagsIterator != DE_ARRAY_END(requiredPropertyFlags); requiredFlagsIterator++)
3017 if ((memProps->memoryTypes[memoryNdx].propertyFlags & *requiredFlagsIterator) == *requiredFlagsIterator)
3018 requiredFlagsFound[requiredFlagsIterator - DE_ARRAY_BEGIN(requiredPropertyFlags)] = true;
3020 if (de::contains(DE_ARRAY_BEGIN(validPropertyFlags), DE_ARRAY_END(validPropertyFlags), memProps->memoryTypes[memoryNdx].propertyFlags & bitsToCheck))
3021 validPropTypeFound = true;
3023 if (!validPropTypeFound)
3025 log << TestLog::Message << "deviceMemoryProperties - propertyFlags "
3026 << memProps->memoryTypes[memoryNdx].propertyFlags << " not valid" << TestLog::EndMessage;
3027 return tcu::TestStatus::fail("deviceMemoryProperties propertyFlags not valid");
3030 if (memProps->memoryTypes[memoryNdx].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
3032 if ((memProps->memoryHeaps[memProps->memoryTypes[memoryNdx].heapIndex].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) == 0)
3034 log << TestLog::Message << "deviceMemoryProperties - DEVICE_LOCAL memory type references heap which is not DEVICE_LOCAL" << TestLog::EndMessage;
3035 return tcu::TestStatus::fail("deviceMemoryProperties inconsistent memoryType and HeapFlags");
3040 if (memProps->memoryHeaps[memProps->memoryTypes[memoryNdx].heapIndex].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT)
3042 log << TestLog::Message << "deviceMemoryProperties - non-DEVICE_LOCAL memory type references heap with is DEVICE_LOCAL" << TestLog::EndMessage;
3043 return tcu::TestStatus::fail("deviceMemoryProperties inconsistent memoryType and HeapFlags");
3048 bool* requiredFlagsFoundIterator = std::find(DE_ARRAY_BEGIN(requiredFlagsFound), DE_ARRAY_END(requiredFlagsFound), false);
3049 if (requiredFlagsFoundIterator != DE_ARRAY_END(requiredFlagsFound))
3051 DE_ASSERT(requiredFlagsFoundIterator - DE_ARRAY_BEGIN(requiredFlagsFound) <= DE_LENGTH_OF_ARRAY(requiredPropertyFlags));
3052 log << TestLog::Message << "deviceMemoryProperties - required property flags "
3053 << getMemoryPropertyFlagsStr(requiredPropertyFlags[requiredFlagsFoundIterator - DE_ARRAY_BEGIN(requiredFlagsFound)]) << " not found" << TestLog::EndMessage;
3055 return tcu::TestStatus::fail("deviceMemoryProperties propertyFlags not valid");
3058 return tcu::TestStatus::pass("Querying memory properties succeeded");
3061 tcu::TestStatus deviceGroupPeerMemoryFeatures (Context& context)
3063 TestLog& log = context.getTestContext().getLog();
3064 const PlatformInterface& vkp = context.getPlatformInterface();
3065 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_device_group_creation"));
3066 const InstanceDriver& vki (instance.getDriver());
3067 const tcu::CommandLine& cmdLine = context.getTestContext().getCommandLine();
3068 const deUint32 devGroupIdx = cmdLine.getVKDeviceGroupId() - 1;
3069 const deUint32 deviceIdx = vk::chooseDeviceIndex(context.getInstanceInterface(), instance, cmdLine);
3070 const float queuePriority = 1.0f;
3071 VkPhysicalDeviceMemoryProperties memProps;
3072 VkPeerMemoryFeatureFlags* peerMemFeatures;
3073 deUint8 buffer [sizeof(VkPeerMemoryFeatureFlags) + GUARD_SIZE];
3074 deUint32 numPhysicalDevices = 0;
3075 deUint32 queueFamilyIndex = 0;
3077 const vector<VkPhysicalDeviceGroupProperties> deviceGroupProps = enumeratePhysicalDeviceGroups(vki, instance);
3078 std::vector<const char*> deviceExtensions;
3079 #ifndef CTS_USES_VULKANSC
3080 deviceExtensions.push_back("VK_KHR_device_group");
3081 #endif // CTS_USES_VULKANSC
3083 if (!isCoreDeviceExtension(context.getUsedApiVersion(), "VK_KHR_device_group"))
3084 deviceExtensions.push_back("VK_KHR_device_group");
3086 const std::vector<VkQueueFamilyProperties> queueProps = getPhysicalDeviceQueueFamilyProperties(vki, deviceGroupProps[devGroupIdx].physicalDevices[deviceIdx]);
3087 for (size_t queueNdx = 0; queueNdx < queueProps.size(); queueNdx++)
3089 if (queueProps[queueNdx].queueFlags & VK_QUEUE_GRAPHICS_BIT)
3090 queueFamilyIndex = (deUint32)queueNdx;
3092 const VkDeviceQueueCreateInfo deviceQueueCreateInfo =
3094 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, //type
3096 (VkDeviceQueueCreateFlags)0u, //flags
3097 queueFamilyIndex, //queueFamilyIndex;
3099 &queuePriority, //pQueuePriorities;
3102 // Need atleast 2 devices for peer memory features
3103 numPhysicalDevices = deviceGroupProps[devGroupIdx].physicalDeviceCount;
3104 if (numPhysicalDevices < 2)
3105 TCU_THROW(NotSupportedError, "Need a device Group with at least 2 physical devices.");
3107 // Create device groups
3108 VkDeviceGroupDeviceCreateInfo deviceGroupInfo =
3110 VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO, //stype
3112 deviceGroupProps[devGroupIdx].physicalDeviceCount, //physicalDeviceCount
3113 deviceGroupProps[devGroupIdx].physicalDevices //physicalDevices
3116 void* pNext = &deviceGroupInfo;
3117 #ifdef CTS_USES_VULKANSC
3118 VkDeviceObjectReservationCreateInfo memReservationInfo = context.getTestContext().getCommandLine().isSubProcess() ? context.getResourceInterface()->getStatMax() : resetDeviceObjectReservationCreateInfo();
3119 memReservationInfo.pNext = pNext;
3120 pNext = &memReservationInfo;
3122 VkPhysicalDeviceVulkanSC10Features sc10Features = createDefaultSC10Features();
3123 sc10Features.pNext = pNext;
3124 pNext = &sc10Features;
3126 VkPipelineCacheCreateInfo pcCI;
3127 std::vector<VkPipelinePoolSize> poolSizes;
3128 if (context.getTestContext().getCommandLine().isSubProcess())
3130 if (context.getResourceInterface()->getCacheDataSize() > 0)
3134 VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO, // VkStructureType sType;
3135 DE_NULL, // const void* pNext;
3136 VK_PIPELINE_CACHE_CREATE_READ_ONLY_BIT |
3137 VK_PIPELINE_CACHE_CREATE_USE_APPLICATION_STORAGE_BIT, // VkPipelineCacheCreateFlags flags;
3138 context.getResourceInterface()->getCacheDataSize(), // deUintptr initialDataSize;
3139 context.getResourceInterface()->getCacheData() // const void* pInitialData;
3141 memReservationInfo.pipelineCacheCreateInfoCount = 1;
3142 memReservationInfo.pPipelineCacheCreateInfos = &pcCI;
3145 poolSizes = context.getResourceInterface()->getPipelinePoolSizes();
3146 if (!poolSizes.empty())
3148 memReservationInfo.pipelinePoolSizeCount = deUint32(poolSizes.size());
3149 memReservationInfo.pPipelinePoolSizes = poolSizes.data();
3152 #endif // CTS_USES_VULKANSC
3154 const VkDeviceCreateInfo deviceCreateInfo =
3156 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, //sType;
3158 (VkDeviceCreateFlags)0u, //flags
3159 1, //queueRecordCount;
3160 &deviceQueueCreateInfo, //pRequestedQueues;
3162 DE_NULL, //ppEnabledLayerNames;
3163 deUint32(deviceExtensions.size()), //extensionCount;
3164 (deviceExtensions.empty() ? DE_NULL : &deviceExtensions[0]), //ppEnabledExtensionNames;
3165 DE_NULL, //pEnabledFeatures;
3168 Move<VkDevice> deviceGroup = createCustomDevice(context.getTestContext().getCommandLine().isValidationEnabled(), vkp, instance, vki, deviceGroupProps[devGroupIdx].physicalDevices[deviceIdx], &deviceCreateInfo);
3169 const DeviceDriver vk (vkp, instance, *deviceGroup);
3170 context.getInstanceInterface().getPhysicalDeviceMemoryProperties(deviceGroupProps[devGroupIdx].physicalDevices[deviceIdx], &memProps);
3172 peerMemFeatures = reinterpret_cast<VkPeerMemoryFeatureFlags*>(buffer);
3173 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
3175 for (deUint32 heapIndex = 0; heapIndex < memProps.memoryHeapCount; heapIndex++)
3177 for (deUint32 localDeviceIndex = 0; localDeviceIndex < numPhysicalDevices; localDeviceIndex++)
3179 for (deUint32 remoteDeviceIndex = 0; remoteDeviceIndex < numPhysicalDevices; remoteDeviceIndex++)
3181 if (localDeviceIndex != remoteDeviceIndex)
3183 vk.getDeviceGroupPeerMemoryFeatures(deviceGroup.get(), heapIndex, localDeviceIndex, remoteDeviceIndex, peerMemFeatures);
3186 for (deInt32 ndx = 0; ndx < GUARD_SIZE; ndx++)
3188 if (buffer[ndx + sizeof(VkPeerMemoryFeatureFlags)] != GUARD_VALUE)
3190 log << TestLog::Message << "deviceGroupPeerMemoryFeatures - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
3191 return tcu::TestStatus::fail("deviceGroupPeerMemoryFeatures buffer overflow");
3195 VkPeerMemoryFeatureFlags requiredFlag = VK_PEER_MEMORY_FEATURE_COPY_DST_BIT;
3196 VkPeerMemoryFeatureFlags maxValidFlag = VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT|VK_PEER_MEMORY_FEATURE_COPY_DST_BIT|
3197 VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT|VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT;
3198 if ((!(*peerMemFeatures & requiredFlag)) ||
3199 *peerMemFeatures > maxValidFlag)
3200 return tcu::TestStatus::fail("deviceGroupPeerMemoryFeatures invalid flag");
3202 log << TestLog::Message << "deviceGroup = " << deviceGroup.get() << TestLog::EndMessage
3203 << TestLog::Message << "heapIndex = " << heapIndex << TestLog::EndMessage
3204 << TestLog::Message << "localDeviceIndex = " << localDeviceIndex << TestLog::EndMessage
3205 << TestLog::Message << "remoteDeviceIndex = " << remoteDeviceIndex << TestLog::EndMessage
3206 << TestLog::Message << "PeerMemoryFeatureFlags = " << *peerMemFeatures << TestLog::EndMessage;
3212 return tcu::TestStatus::pass("Querying deviceGroup peer memory features succeeded");
3215 tcu::TestStatus deviceMemoryBudgetProperties (Context& context)
3217 TestLog& log = context.getTestContext().getLog();
3218 deUint8 buffer[sizeof(VkPhysicalDeviceMemoryBudgetPropertiesEXT) + GUARD_SIZE];
3220 if (!context.isDeviceFunctionalitySupported("VK_EXT_memory_budget"))
3221 TCU_THROW(NotSupportedError, "VK_EXT_memory_budget is not supported");
3223 VkPhysicalDeviceMemoryBudgetPropertiesEXT *budgetProps = reinterpret_cast<VkPhysicalDeviceMemoryBudgetPropertiesEXT *>(buffer);
3224 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
3226 budgetProps->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT;
3227 budgetProps->pNext = DE_NULL;
3229 VkPhysicalDeviceMemoryProperties2 memProps;
3230 deMemset(&memProps, 0, sizeof(memProps));
3231 memProps.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2;
3232 memProps.pNext = budgetProps;
3234 context.getInstanceInterface().getPhysicalDeviceMemoryProperties2(context.getPhysicalDevice(), &memProps);
3236 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
3237 << TestLog::Message << *budgetProps << TestLog::EndMessage;
3239 for (deInt32 ndx = 0; ndx < GUARD_SIZE; ndx++)
3241 if (buffer[ndx + sizeof(VkPhysicalDeviceMemoryBudgetPropertiesEXT)] != GUARD_VALUE)
3243 log << TestLog::Message << "deviceMemoryBudgetProperties - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
3244 return tcu::TestStatus::fail("deviceMemoryBudgetProperties buffer overflow");
3248 for (deUint32 i = 0; i < memProps.memoryProperties.memoryHeapCount; ++i)
3250 if (budgetProps->heapBudget[i] == 0)
3252 log << TestLog::Message << "deviceMemoryBudgetProperties - Supported heaps must report nonzero budget" << TestLog::EndMessage;
3253 return tcu::TestStatus::fail("deviceMemoryBudgetProperties invalid heap budget (zero)");
3255 if (budgetProps->heapBudget[i] > memProps.memoryProperties.memoryHeaps[i].size)
3257 log << TestLog::Message << "deviceMemoryBudgetProperties - Heap budget must be less than or equal to heap size" << TestLog::EndMessage;
3258 return tcu::TestStatus::fail("deviceMemoryBudgetProperties invalid heap budget (too large)");
3262 for (deUint32 i = memProps.memoryProperties.memoryHeapCount; i < VK_MAX_MEMORY_HEAPS; ++i)
3264 if (budgetProps->heapBudget[i] != 0 || budgetProps->heapUsage[i] != 0)
3266 log << TestLog::Message << "deviceMemoryBudgetProperties - Unused heaps must report budget/usage of zero" << TestLog::EndMessage;
3267 return tcu::TestStatus::fail("deviceMemoryBudgetProperties invalid unused heaps");
3271 return tcu::TestStatus::pass("Querying memory budget properties succeeded");
3277 #include "vkMandatoryFeatures.inl"
3281 tcu::TestStatus deviceMandatoryFeatures(Context& context)
3283 if ( checkMandatoryFeatures(context) )
3284 return tcu::TestStatus::pass("Passed");
3285 return tcu::TestStatus::fail("Not all mandatory features are supported ( see: vkspec.html#features-requirements )");
3288 VkFormatFeatureFlags getBaseRequiredOptimalTilingFeatures (VkFormat format)
3293 VkFormatFeatureFlags flags;
3298 SAIM = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT,
3299 BLSR = VK_FORMAT_FEATURE_BLIT_SRC_BIT,
3300 SIFL = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT,
3301 COAT = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT,
3302 BLDS = VK_FORMAT_FEATURE_BLIT_DST_BIT,
3303 CABL = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
3304 STIM = VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT,
3305 STIA = VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT,
3306 DSAT = VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT,
3307 TRSR = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT,
3308 TRDS = VK_FORMAT_FEATURE_TRANSFER_DST_BIT
3311 static const Formatpair formatflags[] =
3313 { VK_FORMAT_B4G4R4A4_UNORM_PACK16, SAIM | BLSR | TRSR | TRDS | SIFL },
3314 { VK_FORMAT_R5G6B5_UNORM_PACK16, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3315 { VK_FORMAT_A1R5G5B5_UNORM_PACK16, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3316 { VK_FORMAT_R8_UNORM, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3317 { VK_FORMAT_R8_SNORM, SAIM | BLSR | TRSR | TRDS | SIFL },
3318 { VK_FORMAT_R8_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS },
3319 { VK_FORMAT_R8_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS },
3320 { VK_FORMAT_R8G8_UNORM, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3321 { VK_FORMAT_R8G8_SNORM, SAIM | BLSR | TRSR | TRDS | SIFL },
3322 { VK_FORMAT_R8G8_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS },
3323 { VK_FORMAT_R8G8_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS },
3324 { VK_FORMAT_R8G8B8A8_UNORM, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | STIM | CABL },
3325 { VK_FORMAT_R8G8B8A8_SNORM, SAIM | BLSR | TRSR | TRDS | SIFL | STIM },
3326 { VK_FORMAT_R8G8B8A8_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM },
3327 { VK_FORMAT_R8G8B8A8_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM },
3328 { VK_FORMAT_R8G8B8A8_SRGB, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3329 { VK_FORMAT_B8G8R8A8_UNORM, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3330 { VK_FORMAT_B8G8R8A8_SRGB, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3331 { VK_FORMAT_A8B8G8R8_UNORM_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3332 { VK_FORMAT_A8B8G8R8_SNORM_PACK32, SAIM | BLSR | TRSR | TRDS | SIFL },
3333 { VK_FORMAT_A8B8G8R8_UINT_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS },
3334 { VK_FORMAT_A8B8G8R8_SINT_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS },
3335 { VK_FORMAT_A8B8G8R8_SRGB_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3336 { VK_FORMAT_A2B10G10R10_UNORM_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3337 { VK_FORMAT_A2B10G10R10_UINT_PACK32, SAIM | BLSR | TRSR | TRDS | COAT | BLDS },
3338 { VK_FORMAT_R16_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS },
3339 { VK_FORMAT_R16_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS },
3340 { VK_FORMAT_R16_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3341 { VK_FORMAT_R16G16_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS },
3342 { VK_FORMAT_R16G16_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS },
3343 { VK_FORMAT_R16G16_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | CABL },
3344 { VK_FORMAT_R16G16B16A16_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM },
3345 { VK_FORMAT_R16G16B16A16_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM },
3346 { VK_FORMAT_R16G16B16A16_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | SIFL | STIM | CABL },
3347 { VK_FORMAT_R32_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM | STIA },
3348 { VK_FORMAT_R32_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM | STIA },
3349 { VK_FORMAT_R32_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM },
3350 { VK_FORMAT_R32G32_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM },
3351 { VK_FORMAT_R32G32_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM },
3352 { VK_FORMAT_R32G32_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM },
3353 { VK_FORMAT_R32G32B32A32_UINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM },
3354 { VK_FORMAT_R32G32B32A32_SINT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM },
3355 { VK_FORMAT_R32G32B32A32_SFLOAT, SAIM | BLSR | TRSR | TRDS | COAT | BLDS | STIM },
3356 { VK_FORMAT_B10G11R11_UFLOAT_PACK32, SAIM | BLSR | TRSR | TRDS | SIFL },
3357 { VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, SAIM | BLSR | TRSR | TRDS | SIFL },
3358 { VK_FORMAT_D16_UNORM, SAIM | BLSR | TRSR | TRDS | DSAT },
3361 size_t formatpairs = sizeof(formatflags) / sizeof(Formatpair);
3363 for (unsigned int i = 0; i < formatpairs; i++)
3364 if (formatflags[i].format == format)
3365 return formatflags[i].flags;
3369 VkFormatFeatureFlags getRequiredOptimalExtendedTilingFeatures (Context& context, VkFormat format, VkFormatFeatureFlags queriedFlags)
3371 VkFormatFeatureFlags flags = (VkFormatFeatureFlags)0;
3373 // VK_EXT_sampler_filter_minmax:
3374 // If filterMinmaxSingleComponentFormats is VK_TRUE, the following formats must
3375 // support the VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT feature with
3376 // VK_IMAGE_TILING_OPTIMAL, if they support VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT.
3378 static const VkFormat s_requiredSampledImageFilterMinMaxFormats[] =
3382 VK_FORMAT_R16_UNORM,
3383 VK_FORMAT_R16_SNORM,
3384 VK_FORMAT_R16_SFLOAT,
3385 VK_FORMAT_R32_SFLOAT,
3386 VK_FORMAT_D16_UNORM,
3387 VK_FORMAT_X8_D24_UNORM_PACK32,
3388 VK_FORMAT_D32_SFLOAT,
3389 VK_FORMAT_D16_UNORM_S8_UINT,
3390 VK_FORMAT_D24_UNORM_S8_UINT,
3391 VK_FORMAT_D32_SFLOAT_S8_UINT,
3394 if ((queriedFlags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0)
3396 if (de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), "VK_EXT_sampler_filter_minmax"))
3398 if (de::contains(DE_ARRAY_BEGIN(s_requiredSampledImageFilterMinMaxFormats), DE_ARRAY_END(s_requiredSampledImageFilterMinMaxFormats), format))
3400 VkPhysicalDeviceSamplerFilterMinmaxProperties physicalDeviceSamplerMinMaxProperties =
3402 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES,
3409 VkPhysicalDeviceProperties2 physicalDeviceProperties;
3410 physicalDeviceProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
3411 physicalDeviceProperties.pNext = &physicalDeviceSamplerMinMaxProperties;
3413 const InstanceInterface& vk = context.getInstanceInterface();
3414 vk.getPhysicalDeviceProperties2(context.getPhysicalDevice(), &physicalDeviceProperties);
3417 if (physicalDeviceSamplerMinMaxProperties.filterMinmaxSingleComponentFormats)
3419 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT;
3425 // VK_EXT_filter_cubic:
3426 // If cubic filtering is supported, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT must be supported for the following image view types:
3427 // VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_VIEW_TYPE_2D_ARRAY
3428 static const VkFormat s_requiredSampledImageFilterCubicFormats[] =
3430 VK_FORMAT_R4G4_UNORM_PACK8,
3431 VK_FORMAT_R4G4B4A4_UNORM_PACK16,
3432 VK_FORMAT_B4G4R4A4_UNORM_PACK16,
3433 VK_FORMAT_R5G6B5_UNORM_PACK16,
3434 VK_FORMAT_B5G6R5_UNORM_PACK16,
3435 VK_FORMAT_R5G5B5A1_UNORM_PACK16,
3436 VK_FORMAT_B5G5R5A1_UNORM_PACK16,
3437 VK_FORMAT_A1R5G5B5_UNORM_PACK16,
3441 VK_FORMAT_R8G8_UNORM,
3442 VK_FORMAT_R8G8_SNORM,
3443 VK_FORMAT_R8G8_SRGB,
3444 VK_FORMAT_R8G8B8_UNORM,
3445 VK_FORMAT_R8G8B8_SNORM,
3446 VK_FORMAT_R8G8B8_SRGB,
3447 VK_FORMAT_B8G8R8_UNORM,
3448 VK_FORMAT_B8G8R8_SNORM,
3449 VK_FORMAT_B8G8R8_SRGB,
3450 VK_FORMAT_R8G8B8A8_UNORM,
3451 VK_FORMAT_R8G8B8A8_SNORM,
3452 VK_FORMAT_R8G8B8A8_SRGB,
3453 VK_FORMAT_B8G8R8A8_UNORM,
3454 VK_FORMAT_B8G8R8A8_SNORM,
3455 VK_FORMAT_B8G8R8A8_SRGB,
3456 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
3457 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
3458 VK_FORMAT_A8B8G8R8_SRGB_PACK32
3461 static const VkFormat s_requiredSampledImageFilterCubicFormatsETC2[] =
3463 VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,
3464 VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK,
3465 VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,
3466 VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,
3467 VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,
3468 VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK
3471 if ( (queriedFlags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0 && de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), "VK_EXT_filter_cubic") )
3473 if ( de::contains(DE_ARRAY_BEGIN(s_requiredSampledImageFilterCubicFormats), DE_ARRAY_END(s_requiredSampledImageFilterCubicFormats), format) )
3474 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT;
3476 VkPhysicalDeviceFeatures2 coreFeatures;
3477 deMemset(&coreFeatures, 0, sizeof(coreFeatures));
3479 coreFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
3480 coreFeatures.pNext = DE_NULL;
3481 context.getInstanceInterface().getPhysicalDeviceFeatures2(context.getPhysicalDevice(), &coreFeatures);
3482 if ( coreFeatures.features.textureCompressionETC2 && de::contains(DE_ARRAY_BEGIN(s_requiredSampledImageFilterCubicFormatsETC2), DE_ARRAY_END(s_requiredSampledImageFilterCubicFormatsETC2), format) )
3483 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT;
3489 VkFormatFeatureFlags getRequiredBufferFeatures (VkFormat format)
3491 static const VkFormat s_requiredVertexBufferFormats[] =
3497 VK_FORMAT_R8G8_UNORM,
3498 VK_FORMAT_R8G8_SNORM,
3499 VK_FORMAT_R8G8_UINT,
3500 VK_FORMAT_R8G8_SINT,
3501 VK_FORMAT_R8G8B8A8_UNORM,
3502 VK_FORMAT_R8G8B8A8_SNORM,
3503 VK_FORMAT_R8G8B8A8_UINT,
3504 VK_FORMAT_R8G8B8A8_SINT,
3505 VK_FORMAT_B8G8R8A8_UNORM,
3506 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
3507 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
3508 VK_FORMAT_A8B8G8R8_UINT_PACK32,
3509 VK_FORMAT_A8B8G8R8_SINT_PACK32,
3510 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
3511 VK_FORMAT_R16_UNORM,
3512 VK_FORMAT_R16_SNORM,
3515 VK_FORMAT_R16_SFLOAT,
3516 VK_FORMAT_R16G16_UNORM,
3517 VK_FORMAT_R16G16_SNORM,
3518 VK_FORMAT_R16G16_UINT,
3519 VK_FORMAT_R16G16_SINT,
3520 VK_FORMAT_R16G16_SFLOAT,
3521 VK_FORMAT_R16G16B16A16_UNORM,
3522 VK_FORMAT_R16G16B16A16_SNORM,
3523 VK_FORMAT_R16G16B16A16_UINT,
3524 VK_FORMAT_R16G16B16A16_SINT,
3525 VK_FORMAT_R16G16B16A16_SFLOAT,
3528 VK_FORMAT_R32_SFLOAT,
3529 VK_FORMAT_R32G32_UINT,
3530 VK_FORMAT_R32G32_SINT,
3531 VK_FORMAT_R32G32_SFLOAT,
3532 VK_FORMAT_R32G32B32_UINT,
3533 VK_FORMAT_R32G32B32_SINT,
3534 VK_FORMAT_R32G32B32_SFLOAT,
3535 VK_FORMAT_R32G32B32A32_UINT,
3536 VK_FORMAT_R32G32B32A32_SINT,
3537 VK_FORMAT_R32G32B32A32_SFLOAT
3539 static const VkFormat s_requiredUniformTexelBufferFormats[] =
3545 VK_FORMAT_R8G8_UNORM,
3546 VK_FORMAT_R8G8_SNORM,
3547 VK_FORMAT_R8G8_UINT,
3548 VK_FORMAT_R8G8_SINT,
3549 VK_FORMAT_R8G8B8A8_UNORM,
3550 VK_FORMAT_R8G8B8A8_SNORM,
3551 VK_FORMAT_R8G8B8A8_UINT,
3552 VK_FORMAT_R8G8B8A8_SINT,
3553 VK_FORMAT_B8G8R8A8_UNORM,
3554 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
3555 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
3556 VK_FORMAT_A8B8G8R8_UINT_PACK32,
3557 VK_FORMAT_A8B8G8R8_SINT_PACK32,
3558 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
3559 VK_FORMAT_A2B10G10R10_UINT_PACK32,
3562 VK_FORMAT_R16_SFLOAT,
3563 VK_FORMAT_R16G16_UINT,
3564 VK_FORMAT_R16G16_SINT,
3565 VK_FORMAT_R16G16_SFLOAT,
3566 VK_FORMAT_R16G16B16A16_UINT,
3567 VK_FORMAT_R16G16B16A16_SINT,
3568 VK_FORMAT_R16G16B16A16_SFLOAT,
3571 VK_FORMAT_R32_SFLOAT,
3572 VK_FORMAT_R32G32_UINT,
3573 VK_FORMAT_R32G32_SINT,
3574 VK_FORMAT_R32G32_SFLOAT,
3575 VK_FORMAT_R32G32B32A32_UINT,
3576 VK_FORMAT_R32G32B32A32_SINT,
3577 VK_FORMAT_R32G32B32A32_SFLOAT,
3578 VK_FORMAT_B10G11R11_UFLOAT_PACK32
3580 static const VkFormat s_requiredStorageTexelBufferFormats[] =
3582 VK_FORMAT_R8G8B8A8_UNORM,
3583 VK_FORMAT_R8G8B8A8_SNORM,
3584 VK_FORMAT_R8G8B8A8_UINT,
3585 VK_FORMAT_R8G8B8A8_SINT,
3586 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
3587 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
3588 VK_FORMAT_A8B8G8R8_UINT_PACK32,
3589 VK_FORMAT_A8B8G8R8_SINT_PACK32,
3590 VK_FORMAT_R16G16B16A16_UINT,
3591 VK_FORMAT_R16G16B16A16_SINT,
3592 VK_FORMAT_R16G16B16A16_SFLOAT,
3595 VK_FORMAT_R32_SFLOAT,
3596 VK_FORMAT_R32G32_UINT,
3597 VK_FORMAT_R32G32_SINT,
3598 VK_FORMAT_R32G32_SFLOAT,
3599 VK_FORMAT_R32G32B32A32_UINT,
3600 VK_FORMAT_R32G32B32A32_SINT,
3601 VK_FORMAT_R32G32B32A32_SFLOAT
3603 static const VkFormat s_requiredStorageTexelBufferAtomicFormats[] =
3609 VkFormatFeatureFlags flags = (VkFormatFeatureFlags)0;
3611 if (de::contains(DE_ARRAY_BEGIN(s_requiredVertexBufferFormats), DE_ARRAY_END(s_requiredVertexBufferFormats), format))
3612 flags |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT;
3614 if (de::contains(DE_ARRAY_BEGIN(s_requiredUniformTexelBufferFormats), DE_ARRAY_END(s_requiredUniformTexelBufferFormats), format))
3615 flags |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT;
3617 if (de::contains(DE_ARRAY_BEGIN(s_requiredStorageTexelBufferFormats), DE_ARRAY_END(s_requiredStorageTexelBufferFormats), format))
3618 flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
3620 if (de::contains(DE_ARRAY_BEGIN(s_requiredStorageTexelBufferAtomicFormats), DE_ARRAY_END(s_requiredStorageTexelBufferAtomicFormats), format))
3621 flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT;
3626 VkPhysicalDeviceSamplerYcbcrConversionFeatures getPhysicalDeviceSamplerYcbcrConversionFeatures (const InstanceInterface& vk, VkPhysicalDevice physicalDevice)
3628 VkPhysicalDeviceFeatures2 coreFeatures;
3629 VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures;
3631 deMemset(&coreFeatures, 0, sizeof(coreFeatures));
3632 deMemset(&ycbcrFeatures, 0, sizeof(ycbcrFeatures));
3634 coreFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
3635 coreFeatures.pNext = &ycbcrFeatures;
3636 ycbcrFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES;
3638 vk.getPhysicalDeviceFeatures2(physicalDevice, &coreFeatures);
3640 return ycbcrFeatures;
3643 void checkYcbcrApiSupport (Context& context)
3645 // check if YCbcr API and are supported by implementation
3647 // the support for formats and YCbCr may still be optional - see isYcbcrConversionSupported below
3649 if (!vk::isCoreDeviceExtension(context.getUsedApiVersion(), "VK_KHR_sampler_ycbcr_conversion"))
3651 if (!context.isDeviceFunctionalitySupported("VK_KHR_sampler_ycbcr_conversion"))
3652 TCU_THROW(NotSupportedError, "VK_KHR_sampler_ycbcr_conversion is not supported");
3654 // Hard dependency for ycbcr
3655 TCU_CHECK(de::contains(context.getInstanceExtensions().begin(), context.getInstanceExtensions().end(), "VK_KHR_get_physical_device_properties2"));
3659 bool isYcbcrConversionSupported (Context& context)
3661 checkYcbcrApiSupport(context);
3663 const VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures = getPhysicalDeviceSamplerYcbcrConversionFeatures(context.getInstanceInterface(), context.getPhysicalDevice());
3665 return (ycbcrFeatures.samplerYcbcrConversion == VK_TRUE);
3668 VkFormatFeatureFlags getRequiredYcbcrFormatFeatures (Context& context, VkFormat format)
3670 bool req = isYcbcrConversionSupported(context) && ( format == VK_FORMAT_G8_B8R8_2PLANE_420_UNORM ||
3671 format == VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM);
3673 const VkFormatFeatureFlags required = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
3674 | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
3675 | VK_FORMAT_FEATURE_TRANSFER_DST_BIT
3676 | VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT;
3677 return req ? required : (VkFormatFeatureFlags)0;
3680 VkFormatFeatureFlags getRequiredOptimalTilingFeatures (Context& context, VkFormat format)
3682 if (isYCbCrFormat(format))
3683 return getRequiredYcbcrFormatFeatures(context, format);
3686 VkFormatFeatureFlags ret = getBaseRequiredOptimalTilingFeatures(format);
3688 // \todo [2017-05-16 pyry] This should be extended to cover for example COLOR_ATTACHMENT for depth formats etc.
3689 // \todo [2017-05-18 pyry] Any other color conversion related features that can't be supported by regular formats?
3690 ret |= getRequiredOptimalExtendedTilingFeatures(context, format, ret);
3692 // Compressed formats have optional support for some features
3693 // TODO: Is this really correct? It looks like it should be checking the different compressed features
3694 if (isCompressedFormat(format) && (ret & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT))
3695 ret |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
3696 VK_FORMAT_FEATURE_TRANSFER_DST_BIT |
3697 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
3698 VK_FORMAT_FEATURE_BLIT_SRC_BIT;
3704 bool requiresYCbCrConversion(Context& context, VkFormat format)
3706 #ifndef CTS_USES_VULKANSC
3707 if (format == VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16)
3709 if (!context.isDeviceFunctionalitySupported("VK_EXT_rgba10x6_formats"))
3711 VkPhysicalDeviceFeatures2 coreFeatures;
3712 VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT rgba10x6features;
3714 deMemset(&coreFeatures, 0, sizeof(coreFeatures));
3715 deMemset(&rgba10x6features, 0, sizeof(rgba10x6features));
3717 coreFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
3718 coreFeatures.pNext = &rgba10x6features;
3719 rgba10x6features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT;
3721 const InstanceInterface &vk = context.getInstanceInterface();
3722 vk.getPhysicalDeviceFeatures2(context.getPhysicalDevice(), &coreFeatures);
3724 return !rgba10x6features.formatRgba10x6WithoutYCbCrSampler;
3728 #endif // CTS_USES_VULKANSC
3730 return isYCbCrFormat(format) &&
3731 format != VK_FORMAT_R10X6_UNORM_PACK16 && format != VK_FORMAT_R10X6G10X6_UNORM_2PACK16 &&
3732 format != VK_FORMAT_R12X4_UNORM_PACK16 && format != VK_FORMAT_R12X4G12X4_UNORM_2PACK16;
3735 VkFormatFeatureFlags getAllowedOptimalTilingFeatures (Context &context, VkFormat format)
3737 // YCbCr formats only support a subset of format feature flags
3738 const VkFormatFeatureFlags ycbcrAllows =
3739 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
3740 VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
3741 VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG |
3742 VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
3743 VK_FORMAT_FEATURE_TRANSFER_DST_BIT |
3744 VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT |
3745 VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT |
3746 VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT |
3747 VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT |
3748 VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT |
3749 VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT |
3750 VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT |
3751 VK_FORMAT_FEATURE_DISJOINT_BIT;
3753 // By default everything is allowed.
3754 VkFormatFeatureFlags allow = (VkFormatFeatureFlags)~0u;
3755 // Formats for which SamplerYCbCrConversion is required may not support certain features.
3756 if (requiresYCbCrConversion(context, format))
3757 allow &= ycbcrAllows;
3758 // single-plane formats *may not* support DISJOINT_BIT
3759 if (!isYCbCrFormat(format) || getPlaneCount(format) == 1)
3760 allow &= ~VK_FORMAT_FEATURE_DISJOINT_BIT;
3765 VkFormatFeatureFlags getAllowedBufferFeatures (Context &context, VkFormat format)
3767 // TODO: Do we allow non-buffer flags in the bufferFeatures?
3768 return requiresYCbCrConversion(context, format) ? (VkFormatFeatureFlags)0 : (VkFormatFeatureFlags)(~VK_FORMAT_FEATURE_DISJOINT_BIT);
3771 tcu::TestStatus formatProperties (Context& context, VkFormat format)
3773 // check if Ycbcr format enums are valid given the version and extensions
3774 if (isYCbCrFormat(format))
3775 checkYcbcrApiSupport(context);
3777 TestLog& log = context.getTestContext().getLog();
3778 const VkFormatProperties properties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
3781 const VkFormatFeatureFlags reqImg = getRequiredOptimalTilingFeatures(context, format);
3782 const VkFormatFeatureFlags reqBuf = getRequiredBufferFeatures(format);
3783 const VkFormatFeatureFlags allowImg = getAllowedOptimalTilingFeatures(context, format);
3784 const VkFormatFeatureFlags allowBuf = getAllowedBufferFeatures(context, format);
3786 const struct feature_req
3788 const char* fieldName;
3789 VkFormatFeatureFlags supportedFeatures;
3790 VkFormatFeatureFlags requiredFeatures;
3791 VkFormatFeatureFlags allowedFeatures;
3794 { "linearTilingFeatures", properties.linearTilingFeatures, (VkFormatFeatureFlags)0, allowImg },
3795 { "optimalTilingFeatures", properties.optimalTilingFeatures, reqImg, allowImg },
3796 { "bufferFeatures", properties.bufferFeatures, reqBuf, allowBuf }
3799 log << TestLog::Message << properties << TestLog::EndMessage;
3801 for (int fieldNdx = 0; fieldNdx < DE_LENGTH_OF_ARRAY(fields); fieldNdx++)
3803 const char* const fieldName = fields[fieldNdx].fieldName;
3804 const VkFormatFeatureFlags supported = fields[fieldNdx].supportedFeatures;
3805 const VkFormatFeatureFlags required = fields[fieldNdx].requiredFeatures;
3806 const VkFormatFeatureFlags allowed = fields[fieldNdx].allowedFeatures;
3808 if ((supported & required) != required)
3810 log << TestLog::Message << "ERROR in " << fieldName << ":\n"
3811 << " required: " << getFormatFeatureFlagsStr(required) << "\n "
3812 << " missing: " << getFormatFeatureFlagsStr(~supported & required)
3813 << TestLog::EndMessage;
3817 if ((supported & ~allowed) != 0)
3819 log << TestLog::Message << "ERROR in " << fieldName << ":\n"
3820 << " has: " << getFormatFeatureFlagsStr(supported & ~allowed)
3821 << TestLog::EndMessage;
3825 if (((supported & VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT) != 0) &&
3826 ((supported & VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT) == 0))
3828 log << TestLog::Message << "ERROR in " << fieldName << ":\n"
3829 << " supports VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT"
3830 << " but not VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT"
3831 << TestLog::EndMessage;
3837 return tcu::TestStatus::pass("Query and validation passed");
3839 return tcu::TestStatus::fail("Required features not supported");
3842 bool optimalTilingFeaturesSupported (Context& context, VkFormat format, VkFormatFeatureFlags features)
3844 const VkFormatProperties properties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
3846 return (properties.optimalTilingFeatures & features) == features;
3849 bool optimalTilingFeaturesSupportedForAll (Context& context, const VkFormat* begin, const VkFormat* end, VkFormatFeatureFlags features)
3851 for (const VkFormat* cur = begin; cur != end; ++cur)
3853 if (!optimalTilingFeaturesSupported(context, *cur, features))
3860 tcu::TestStatus testDepthStencilSupported (Context& context)
3862 if (!optimalTilingFeaturesSupported(context, VK_FORMAT_X8_D24_UNORM_PACK32, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) &&
3863 !optimalTilingFeaturesSupported(context, VK_FORMAT_D32_SFLOAT, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))
3864 return tcu::TestStatus::fail("Doesn't support one of VK_FORMAT_X8_D24_UNORM_PACK32 or VK_FORMAT_D32_SFLOAT");
3866 if (!optimalTilingFeaturesSupported(context, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) &&
3867 !optimalTilingFeaturesSupported(context, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))
3868 return tcu::TestStatus::fail("Doesn't support one of VK_FORMAT_D24_UNORM_S8_UINT or VK_FORMAT_D32_SFLOAT_S8_UINT");
3870 return tcu::TestStatus::pass("Required depth/stencil formats supported");
3873 tcu::TestStatus testCompressedFormatsSupported (Context& context)
3875 static const VkFormat s_allBcFormats[] =
3877 VK_FORMAT_BC1_RGB_UNORM_BLOCK,
3878 VK_FORMAT_BC1_RGB_SRGB_BLOCK,
3879 VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
3880 VK_FORMAT_BC1_RGBA_SRGB_BLOCK,
3881 VK_FORMAT_BC2_UNORM_BLOCK,
3882 VK_FORMAT_BC2_SRGB_BLOCK,
3883 VK_FORMAT_BC3_UNORM_BLOCK,
3884 VK_FORMAT_BC3_SRGB_BLOCK,
3885 VK_FORMAT_BC4_UNORM_BLOCK,
3886 VK_FORMAT_BC4_SNORM_BLOCK,
3887 VK_FORMAT_BC5_UNORM_BLOCK,
3888 VK_FORMAT_BC5_SNORM_BLOCK,
3889 VK_FORMAT_BC6H_UFLOAT_BLOCK,
3890 VK_FORMAT_BC6H_SFLOAT_BLOCK,
3891 VK_FORMAT_BC7_UNORM_BLOCK,
3892 VK_FORMAT_BC7_SRGB_BLOCK,
3894 static const VkFormat s_allEtc2Formats[] =
3896 VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,
3897 VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK,
3898 VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,
3899 VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,
3900 VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,
3901 VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,
3902 VK_FORMAT_EAC_R11_UNORM_BLOCK,
3903 VK_FORMAT_EAC_R11_SNORM_BLOCK,
3904 VK_FORMAT_EAC_R11G11_UNORM_BLOCK,
3905 VK_FORMAT_EAC_R11G11_SNORM_BLOCK,
3907 static const VkFormat s_allAstcLdrFormats[] =
3909 VK_FORMAT_ASTC_4x4_UNORM_BLOCK,
3910 VK_FORMAT_ASTC_4x4_SRGB_BLOCK,
3911 VK_FORMAT_ASTC_5x4_UNORM_BLOCK,
3912 VK_FORMAT_ASTC_5x4_SRGB_BLOCK,
3913 VK_FORMAT_ASTC_5x5_UNORM_BLOCK,
3914 VK_FORMAT_ASTC_5x5_SRGB_BLOCK,
3915 VK_FORMAT_ASTC_6x5_UNORM_BLOCK,
3916 VK_FORMAT_ASTC_6x5_SRGB_BLOCK,
3917 VK_FORMAT_ASTC_6x6_UNORM_BLOCK,
3918 VK_FORMAT_ASTC_6x6_SRGB_BLOCK,
3919 VK_FORMAT_ASTC_8x5_UNORM_BLOCK,
3920 VK_FORMAT_ASTC_8x5_SRGB_BLOCK,
3921 VK_FORMAT_ASTC_8x6_UNORM_BLOCK,
3922 VK_FORMAT_ASTC_8x6_SRGB_BLOCK,
3923 VK_FORMAT_ASTC_8x8_UNORM_BLOCK,
3924 VK_FORMAT_ASTC_8x8_SRGB_BLOCK,
3925 VK_FORMAT_ASTC_10x5_UNORM_BLOCK,
3926 VK_FORMAT_ASTC_10x5_SRGB_BLOCK,
3927 VK_FORMAT_ASTC_10x6_UNORM_BLOCK,
3928 VK_FORMAT_ASTC_10x6_SRGB_BLOCK,
3929 VK_FORMAT_ASTC_10x8_UNORM_BLOCK,
3930 VK_FORMAT_ASTC_10x8_SRGB_BLOCK,
3931 VK_FORMAT_ASTC_10x10_UNORM_BLOCK,
3932 VK_FORMAT_ASTC_10x10_SRGB_BLOCK,
3933 VK_FORMAT_ASTC_12x10_UNORM_BLOCK,
3934 VK_FORMAT_ASTC_12x10_SRGB_BLOCK,
3935 VK_FORMAT_ASTC_12x12_UNORM_BLOCK,
3936 VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
3941 const char* setName;
3942 const char* featureName;
3943 const VkBool32 VkPhysicalDeviceFeatures::* feature;
3944 const VkFormat* formatsBegin;
3945 const VkFormat* formatsEnd;
3946 } s_compressedFormatSets[] =
3948 { "BC", "textureCompressionBC", &VkPhysicalDeviceFeatures::textureCompressionBC, DE_ARRAY_BEGIN(s_allBcFormats), DE_ARRAY_END(s_allBcFormats) },
3949 { "ETC2", "textureCompressionETC2", &VkPhysicalDeviceFeatures::textureCompressionETC2, DE_ARRAY_BEGIN(s_allEtc2Formats), DE_ARRAY_END(s_allEtc2Formats) },
3950 { "ASTC LDR", "textureCompressionASTC_LDR", &VkPhysicalDeviceFeatures::textureCompressionASTC_LDR, DE_ARRAY_BEGIN(s_allAstcLdrFormats), DE_ARRAY_END(s_allAstcLdrFormats) },
3953 TestLog& log = context.getTestContext().getLog();
3954 const VkPhysicalDeviceFeatures& features = context.getDeviceFeatures();
3955 int numSupportedSets = 0;
3957 int numWarnings = 0;
3959 for (int setNdx = 0; setNdx < DE_LENGTH_OF_ARRAY(s_compressedFormatSets); ++setNdx)
3961 const char* const setName = s_compressedFormatSets[setNdx].setName;
3962 const char* const featureName = s_compressedFormatSets[setNdx].featureName;
3963 const bool featureBitSet = features.*s_compressedFormatSets[setNdx].feature == VK_TRUE;
3964 const VkFormatFeatureFlags requiredFeatures =
3965 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT |
3966 VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
3967 const bool allSupported = optimalTilingFeaturesSupportedForAll(context,
3968 s_compressedFormatSets[setNdx].formatsBegin,
3969 s_compressedFormatSets[setNdx].formatsEnd,
3972 if (featureBitSet && !allSupported)
3974 log << TestLog::Message << "ERROR: " << featureName << " = VK_TRUE but " << setName << " formats not supported" << TestLog::EndMessage;
3977 else if (allSupported && !featureBitSet)
3979 log << TestLog::Message << "WARNING: " << setName << " formats supported but " << featureName << " = VK_FALSE" << TestLog::EndMessage;
3985 log << TestLog::Message << "All " << setName << " formats are supported" << TestLog::EndMessage;
3986 numSupportedSets += 1;
3989 log << TestLog::Message << setName << " formats are not supported" << TestLog::EndMessage;
3992 if (numSupportedSets == 0)
3994 log << TestLog::Message << "No compressed format sets supported" << TestLog::EndMessage;
3999 return tcu::TestStatus::fail("Compressed format support not valid");
4000 else if (numWarnings > 0)
4001 return tcu::TestStatus(QP_TEST_RESULT_QUALITY_WARNING, "Found inconsistencies in compressed format support");
4003 return tcu::TestStatus::pass("Compressed texture format support is valid");
4006 void createFormatTests (tcu::TestCaseGroup* testGroup)
4008 DE_STATIC_ASSERT(VK_FORMAT_UNDEFINED == 0);
4014 } s_formatRanges[] =
4017 { (VkFormat)(VK_FORMAT_UNDEFINED+1), VK_CORE_FORMAT_LAST },
4020 { VK_FORMAT_G8B8G8R8_422_UNORM, (VkFormat)(VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM+1) },
4022 // YCbCr extended formats
4023 { VK_FORMAT_G8_B8R8_2PLANE_444_UNORM_EXT, (VkFormat)(VK_FORMAT_G16_B16R16_2PLANE_444_UNORM_EXT+1) },
4026 for (int rangeNdx = 0; rangeNdx < DE_LENGTH_OF_ARRAY(s_formatRanges); ++rangeNdx)
4028 const VkFormat rangeBegin = s_formatRanges[rangeNdx].begin;
4029 const VkFormat rangeEnd = s_formatRanges[rangeNdx].end;
4031 for (VkFormat format = rangeBegin; format != rangeEnd; format = (VkFormat)(format+1))
4033 const char* const enumName = getFormatName(format);
4034 const string caseName = de::toLower(string(enumName).substr(10));
4036 addFunctionCase(testGroup, caseName, enumName, formatProperties, format);
4040 addFunctionCase(testGroup, "depth_stencil", "", testDepthStencilSupported);
4041 addFunctionCase(testGroup, "compressed_formats", "", testCompressedFormatsSupported);
4044 VkImageUsageFlags getValidImageUsageFlags (const VkFormatFeatureFlags supportedFeatures, const bool useKhrMaintenance1Semantics)
4046 VkImageUsageFlags flags = (VkImageUsageFlags)0;
4048 if (useKhrMaintenance1Semantics)
4050 if ((supportedFeatures & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT) != 0)
4051 flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
4053 if ((supportedFeatures & VK_FORMAT_FEATURE_TRANSFER_DST_BIT) != 0)
4054 flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
4058 // If format is supported at all, it must be valid transfer src+dst
4059 if (supportedFeatures != 0)
4060 flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT;
4063 if ((supportedFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0)
4064 flags |= VK_IMAGE_USAGE_SAMPLED_BIT;
4066 if ((supportedFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) != 0)
4067 flags |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT|VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
4069 if ((supportedFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0)
4070 flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
4072 if ((supportedFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) != 0)
4073 flags |= VK_IMAGE_USAGE_STORAGE_BIT;
4078 bool isValidImageUsageFlagCombination (VkImageUsageFlags usage)
4080 if ((usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0)
4082 const VkImageUsageFlags allowedFlags = VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
4083 | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
4084 | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
4085 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
4087 // Only *_ATTACHMENT_BIT flags can be combined with TRANSIENT_ATTACHMENT_BIT
4088 if ((usage & ~allowedFlags) != 0)
4091 // TRANSIENT_ATTACHMENT_BIT is not valid without COLOR_ or DEPTH_STENCIL_ATTACHMENT_BIT
4092 if ((usage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)) == 0)
4099 VkImageCreateFlags getValidImageCreateFlags (const VkPhysicalDeviceFeatures& deviceFeatures, VkFormat format, VkFormatFeatureFlags formatFeatures, VkImageType type, VkImageUsageFlags usage)
4101 VkImageCreateFlags flags = (VkImageCreateFlags)0;
4103 if ((usage & VK_IMAGE_USAGE_SAMPLED_BIT) != 0)
4105 flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
4107 if (type == VK_IMAGE_TYPE_2D && !isYCbCrFormat(format))
4109 flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
4113 if (isYCbCrFormat(format) && getPlaneCount(format) > 1)
4115 if (formatFeatures & VK_FORMAT_FEATURE_DISJOINT_BIT)
4116 flags |= VK_IMAGE_CREATE_DISJOINT_BIT;
4119 if ((usage & (VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_STORAGE_BIT)) != 0 &&
4120 (usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) == 0)
4122 if (deviceFeatures.sparseBinding)
4123 flags |= VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT;
4125 if (deviceFeatures.sparseResidencyAliased)
4126 flags |= VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_ALIASED_BIT;
4132 bool isValidImageCreateFlagCombination (VkImageCreateFlags createFlags)
4134 bool isValid = true;
4136 if (((createFlags & (VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT|VK_IMAGE_CREATE_SPARSE_ALIASED_BIT)) != 0) &&
4137 ((createFlags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) == 0))
4145 bool isRequiredImageParameterCombination (const VkPhysicalDeviceFeatures& deviceFeatures,
4146 const VkFormat format,
4147 const VkFormatProperties& formatProperties,
4148 const VkImageType imageType,
4149 const VkImageTiling imageTiling,
4150 const VkImageUsageFlags usageFlags,
4151 const VkImageCreateFlags createFlags)
4153 DE_UNREF(deviceFeatures);
4154 DE_UNREF(formatProperties);
4155 DE_UNREF(createFlags);
4157 // Linear images can have arbitrary limitations
4158 if (imageTiling == VK_IMAGE_TILING_LINEAR)
4161 // Support for other usages for compressed formats is optional
4162 if (isCompressedFormat(format) &&
4163 (usageFlags & ~(VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT)) != 0)
4166 // Support for 1D, and sliced 3D compressed formats is optional
4167 if (isCompressedFormat(format) && (imageType == VK_IMAGE_TYPE_1D || imageType == VK_IMAGE_TYPE_3D))
4170 // Support for 1D and 3D depth/stencil textures is optional
4171 if (isDepthStencilFormat(format) && (imageType == VK_IMAGE_TYPE_1D || imageType == VK_IMAGE_TYPE_3D))
4174 DE_ASSERT(deviceFeatures.sparseBinding || (createFlags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)) == 0);
4175 DE_ASSERT(deviceFeatures.sparseResidencyAliased || (createFlags & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) == 0);
4177 if (isYCbCrFormat(format) && (createFlags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)))
4180 if (createFlags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)
4182 if (isCompressedFormat(format))
4185 if (isDepthStencilFormat(format))
4188 if (!deIsPowerOfTwo32(mapVkFormat(format).getPixelSize()))
4193 case VK_IMAGE_TYPE_2D:
4194 return (deviceFeatures.sparseResidencyImage2D == VK_TRUE);
4195 case VK_IMAGE_TYPE_3D:
4196 return (deviceFeatures.sparseResidencyImage3D == VK_TRUE);
4205 VkSampleCountFlags getRequiredOptimalTilingSampleCounts (const VkPhysicalDeviceLimits& deviceLimits,
4206 const VkFormat format,
4207 const VkImageUsageFlags usageFlags)
4209 if (isCompressedFormat(format))
4210 return VK_SAMPLE_COUNT_1_BIT;
4212 bool hasDepthComp = false;
4213 bool hasStencilComp = false;
4214 const bool isYCbCr = isYCbCrFormat(format);
4217 const tcu::TextureFormat tcuFormat = mapVkFormat(format);
4218 hasDepthComp = (tcuFormat.order == tcu::TextureFormat::D || tcuFormat.order == tcu::TextureFormat::DS);
4219 hasStencilComp = (tcuFormat.order == tcu::TextureFormat::S || tcuFormat.order == tcu::TextureFormat::DS);
4222 const bool isColorFormat = !hasDepthComp && !hasStencilComp;
4223 VkSampleCountFlags sampleCounts = ~(VkSampleCountFlags)0;
4225 DE_ASSERT((hasDepthComp || hasStencilComp) != isColorFormat);
4227 if ((usageFlags & VK_IMAGE_USAGE_STORAGE_BIT) != 0)
4228 sampleCounts &= deviceLimits.storageImageSampleCounts;
4230 if ((usageFlags & VK_IMAGE_USAGE_SAMPLED_BIT) != 0)
4233 sampleCounts &= deviceLimits.sampledImageDepthSampleCounts;
4236 sampleCounts &= deviceLimits.sampledImageStencilSampleCounts;
4241 sampleCounts &= deviceLimits.sampledImageColorSampleCounts;
4244 const tcu::TextureFormat tcuFormat = mapVkFormat(format);
4245 const tcu::TextureChannelClass chnClass = tcu::getTextureChannelClass(tcuFormat.type);
4247 if (chnClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER ||
4248 chnClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER)
4249 sampleCounts &= deviceLimits.sampledImageIntegerSampleCounts;
4251 sampleCounts &= deviceLimits.sampledImageColorSampleCounts;
4256 if ((usageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) != 0)
4257 sampleCounts &= deviceLimits.framebufferColorSampleCounts;
4259 if ((usageFlags & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0)
4262 sampleCounts &= deviceLimits.framebufferDepthSampleCounts;
4265 sampleCounts &= deviceLimits.framebufferStencilSampleCounts;
4268 // If there is no usage flag set that would have corresponding device limit,
4269 // only VK_SAMPLE_COUNT_1_BIT is required.
4270 if (sampleCounts == ~(VkSampleCountFlags)0)
4271 sampleCounts &= VK_SAMPLE_COUNT_1_BIT;
4273 return sampleCounts;
4276 struct ImageFormatPropertyCase
4278 typedef tcu::TestStatus (*Function) (Context& context, const VkFormat format, const VkImageType imageType, const VkImageTiling tiling);
4280 Function testFunction;
4282 VkImageType imageType;
4283 VkImageTiling tiling;
4285 ImageFormatPropertyCase (Function testFunction_, VkFormat format_, VkImageType imageType_, VkImageTiling tiling_)
4286 : testFunction (testFunction_)
4288 , imageType (imageType_)
4292 ImageFormatPropertyCase (void)
4293 : testFunction ((Function)DE_NULL)
4294 , format (VK_FORMAT_UNDEFINED)
4295 , imageType (VK_CORE_IMAGE_TYPE_LAST)
4296 , tiling (VK_CORE_IMAGE_TILING_LAST)
4300 tcu::TestStatus imageFormatProperties (Context& context, const VkFormat format, const VkImageType imageType, const VkImageTiling tiling)
4302 if (isYCbCrFormat(format))
4303 // check if Ycbcr format enums are valid given the version and extensions
4304 checkYcbcrApiSupport(context);
4306 TestLog& log = context.getTestContext().getLog();
4307 const VkPhysicalDeviceFeatures& deviceFeatures = context.getDeviceFeatures();
4308 const VkPhysicalDeviceLimits& deviceLimits = context.getDeviceProperties().limits;
4309 const VkFormatProperties formatProperties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
4310 const bool hasKhrMaintenance1 = context.isDeviceFunctionalitySupported("VK_KHR_maintenance1");
4312 const VkFormatFeatureFlags supportedFeatures = tiling == VK_IMAGE_TILING_LINEAR ? formatProperties.linearTilingFeatures : formatProperties.optimalTilingFeatures;
4313 const VkImageUsageFlags usageFlagSet = getValidImageUsageFlags(supportedFeatures, hasKhrMaintenance1);
4315 tcu::ResultCollector results (log, "ERROR: ");
4317 if (hasKhrMaintenance1 && (supportedFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0)
4319 results.check((supportedFeatures & (VK_FORMAT_FEATURE_TRANSFER_SRC_BIT|VK_FORMAT_FEATURE_TRANSFER_DST_BIT)) != 0,
4320 "A sampled image format must have VK_FORMAT_FEATURE_TRANSFER_SRC_BIT and VK_FORMAT_FEATURE_TRANSFER_DST_BIT format feature flags set");
4323 if (isYcbcrConversionSupported(context) && (format == VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM || format == VK_FORMAT_G8_B8R8_2PLANE_420_UNORM))
4325 VkFormatFeatureFlags requiredFeatures = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
4326 if (tiling == VK_IMAGE_TILING_OPTIMAL)
4327 requiredFeatures |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT;
4329 results.check((supportedFeatures & requiredFeatures) == requiredFeatures,
4330 getFormatName(format) + string(" must support ") + de::toString(getFormatFeatureFlagsStr(requiredFeatures)));
4333 for (VkImageUsageFlags curUsageFlags = 0; curUsageFlags <= usageFlagSet; curUsageFlags++)
4335 if ((curUsageFlags & ~usageFlagSet) != 0 ||
4336 !isValidImageUsageFlagCombination(curUsageFlags))
4339 const VkImageCreateFlags createFlagSet = getValidImageCreateFlags(deviceFeatures, format, supportedFeatures, imageType, curUsageFlags);
4341 for (VkImageCreateFlags curCreateFlags = 0; curCreateFlags <= createFlagSet; curCreateFlags++)
4343 if ((curCreateFlags & ~createFlagSet) != 0 ||
4344 !isValidImageCreateFlagCombination(curCreateFlags))
4347 const bool isRequiredCombination = isRequiredImageParameterCombination(deviceFeatures,
4354 VkImageFormatProperties properties;
4355 VkResult queryResult;
4357 log << TestLog::Message << "Testing " << getImageTypeStr(imageType) << ", "
4358 << getImageTilingStr(tiling) << ", "
4359 << getImageUsageFlagsStr(curUsageFlags) << ", "
4360 << getImageCreateFlagsStr(curCreateFlags)
4361 << TestLog::EndMessage;
4363 // Set return value to known garbage
4364 deMemset(&properties, 0xcd, sizeof(properties));
4366 queryResult = context.getInstanceInterface().getPhysicalDeviceImageFormatProperties(context.getPhysicalDevice(),
4374 if (queryResult == VK_SUCCESS)
4376 const deUint32 fullMipPyramidSize = de::max(de::max(deLog2Floor32(properties.maxExtent.width),
4377 deLog2Floor32(properties.maxExtent.height)),
4378 deLog2Floor32(properties.maxExtent.depth)) + 1;
4380 log << TestLog::Message << properties << "\n" << TestLog::EndMessage;
4382 results.check(imageType != VK_IMAGE_TYPE_1D || (properties.maxExtent.width >= 1 && properties.maxExtent.height == 1 && properties.maxExtent.depth == 1), "Invalid dimensions for 1D image");
4383 results.check(imageType != VK_IMAGE_TYPE_2D || (properties.maxExtent.width >= 1 && properties.maxExtent.height >= 1 && properties.maxExtent.depth == 1), "Invalid dimensions for 2D image");
4384 results.check(imageType != VK_IMAGE_TYPE_3D || (properties.maxExtent.width >= 1 && properties.maxExtent.height >= 1 && properties.maxExtent.depth >= 1), "Invalid dimensions for 3D image");
4385 results.check(imageType != VK_IMAGE_TYPE_3D || properties.maxArrayLayers == 1, "Invalid maxArrayLayers for 3D image");
4387 if (tiling == VK_IMAGE_TILING_OPTIMAL && imageType == VK_IMAGE_TYPE_2D && !(curCreateFlags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) &&
4388 (supportedFeatures & (VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)))
4390 const VkSampleCountFlags requiredSampleCounts = getRequiredOptimalTilingSampleCounts(deviceLimits, format, curUsageFlags);
4391 results.check((properties.sampleCounts & requiredSampleCounts) == requiredSampleCounts, "Required sample counts not supported");
4394 results.check(properties.sampleCounts == VK_SAMPLE_COUNT_1_BIT, "sampleCounts != VK_SAMPLE_COUNT_1_BIT");
4396 if (isRequiredCombination)
4398 results.check(imageType != VK_IMAGE_TYPE_1D || (properties.maxExtent.width >= deviceLimits.maxImageDimension1D),
4399 "Reported dimensions smaller than device limits");
4400 results.check(imageType != VK_IMAGE_TYPE_2D || (properties.maxExtent.width >= deviceLimits.maxImageDimension2D &&
4401 properties.maxExtent.height >= deviceLimits.maxImageDimension2D),
4402 "Reported dimensions smaller than device limits");
4403 results.check(imageType != VK_IMAGE_TYPE_3D || (properties.maxExtent.width >= deviceLimits.maxImageDimension3D &&
4404 properties.maxExtent.height >= deviceLimits.maxImageDimension3D &&
4405 properties.maxExtent.depth >= deviceLimits.maxImageDimension3D),
4406 "Reported dimensions smaller than device limits");
4407 results.check((isYCbCrFormat(format) && (properties.maxMipLevels == 1)) || properties.maxMipLevels == fullMipPyramidSize,
4408 "Invalid mip pyramid size");
4409 results.check((isYCbCrFormat(format) && (properties.maxArrayLayers == 1)) || imageType == VK_IMAGE_TYPE_3D ||
4410 properties.maxArrayLayers >= deviceLimits.maxImageArrayLayers, "Invalid maxArrayLayers");
4414 results.check(properties.maxMipLevels == 1 || properties.maxMipLevels == fullMipPyramidSize, "Invalid mip pyramid size");
4415 results.check(properties.maxArrayLayers >= 1, "Invalid maxArrayLayers");
4418 results.check(properties.maxResourceSize >= (VkDeviceSize)MINIMUM_REQUIRED_IMAGE_RESOURCE_SIZE,
4419 "maxResourceSize smaller than minimum required size");
4421 else if (queryResult == VK_ERROR_FORMAT_NOT_SUPPORTED)
4423 log << TestLog::Message << "Got VK_ERROR_FORMAT_NOT_SUPPORTED" << TestLog::EndMessage;
4425 if (isRequiredCombination)
4426 results.fail("VK_ERROR_FORMAT_NOT_SUPPORTED returned for required image parameter combination");
4428 // Specification requires that all fields are set to 0
4429 results.check(properties.maxExtent.width == 0, "maxExtent.width != 0");
4430 results.check(properties.maxExtent.height == 0, "maxExtent.height != 0");
4431 results.check(properties.maxExtent.depth == 0, "maxExtent.depth != 0");
4432 results.check(properties.maxMipLevels == 0, "maxMipLevels != 0");
4433 results.check(properties.maxArrayLayers == 0, "maxArrayLayers != 0");
4434 results.check(properties.sampleCounts == 0, "sampleCounts != 0");
4435 results.check(properties.maxResourceSize == 0, "maxResourceSize != 0");
4439 results.fail("Got unexpected error" + de::toString(queryResult));
4444 return tcu::TestStatus(results.getResult(), results.getMessage());
4447 // VK_KHR_get_physical_device_properties2
4449 string toString(const VkPhysicalDevicePCIBusInfoPropertiesEXT& value)
4451 std::ostringstream s;
4452 s << "VkPhysicalDevicePCIBusInfoPropertiesEXT = {\n";
4453 s << "\tsType = " << value.sType << '\n';
4454 s << "\tpciDomain = " << value.pciDomain << '\n';
4455 s << "\tpciBus = " << value.pciBus << '\n';
4456 s << "\tpciDevice = " << value.pciDevice << '\n';
4457 s << "\tpciFunction = " << value.pciFunction << '\n';
4462 bool checkExtension (vector<VkExtensionProperties>& properties, const char* extension)
4464 for (size_t ndx = 0; ndx < properties.size(); ++ndx)
4466 if (strncmp(properties[ndx].extensionName, extension, VK_MAX_EXTENSION_NAME_SIZE) == 0)
4472 #include "vkDeviceFeatures2.inl"
4474 tcu::TestStatus deviceFeatures2 (Context& context)
4476 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
4477 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
4478 const InstanceDriver& vki (instance.getDriver());
4479 TestLog& log = context.getTestContext().getLog();
4480 VkPhysicalDeviceFeatures coreFeatures;
4481 VkPhysicalDeviceFeatures2 extFeatures;
4483 deMemset(&coreFeatures, 0xcd, sizeof(coreFeatures));
4484 deMemset(&extFeatures.features, 0xcd, sizeof(extFeatures.features));
4485 std::vector<std::string> instExtensions = context.getInstanceExtensions();
4487 extFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
4488 extFeatures.pNext = DE_NULL;
4490 vki.getPhysicalDeviceFeatures(physicalDevice, &coreFeatures);
4491 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
4493 TCU_CHECK(extFeatures.sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2);
4494 TCU_CHECK(extFeatures.pNext == DE_NULL);
4496 if (deMemCmp(&coreFeatures, &extFeatures.features, sizeof(VkPhysicalDeviceFeatures)) != 0)
4497 TCU_FAIL("Mismatch between features reported by vkGetPhysicalDeviceFeatures and vkGetPhysicalDeviceFeatures2");
4499 log << TestLog::Message << extFeatures << TestLog::EndMessage;
4501 return tcu::TestStatus::pass("Querying device features succeeded");
4504 tcu::TestStatus deviceProperties2 (Context& context)
4506 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
4507 const InstanceDriver& vki (instance.getDriver());
4508 const VkPhysicalDevice physicalDevice (chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
4509 TestLog& log = context.getTestContext().getLog();
4510 VkPhysicalDeviceProperties coreProperties;
4511 VkPhysicalDeviceProperties2 extProperties;
4513 extProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
4514 extProperties.pNext = DE_NULL;
4516 vki.getPhysicalDeviceProperties(physicalDevice, &coreProperties);
4517 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
4519 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2);
4520 TCU_CHECK(extProperties.pNext == DE_NULL);
4522 // We can't use memcmp() here because the structs may contain padding bytes that drivers may or may not
4523 // have written while writing the data and memcmp will compare them anyway, so we iterate through the
4524 // valid bytes for each field in the struct and compare only the valid bytes for each one.
4525 for (int propNdx = 0; propNdx < DE_LENGTH_OF_ARRAY(s_physicalDevicePropertiesOffsetTable); propNdx++)
4527 const size_t offset = s_physicalDevicePropertiesOffsetTable[propNdx].offset;
4528 const size_t size = s_physicalDevicePropertiesOffsetTable[propNdx].size;
4530 const deUint8* corePropertyBytes = reinterpret_cast<deUint8*>(&coreProperties) + offset;
4531 const deUint8* extPropertyBytes = reinterpret_cast<deUint8*>(&extProperties.properties) + offset;
4533 if (deMemCmp(corePropertyBytes, extPropertyBytes, size) != 0)
4534 TCU_FAIL("Mismatch between properties reported by vkGetPhysicalDeviceProperties and vkGetPhysicalDeviceProperties2");
4537 log << TestLog::Message << extProperties.properties << TestLog::EndMessage;
4539 const int count = 2u;
4541 vector<VkExtensionProperties> properties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
4542 const bool khr_external_fence_capabilities = checkExtension(properties, "VK_KHR_external_fence_capabilities") || context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
4543 const bool khr_external_memory_capabilities = checkExtension(properties, "VK_KHR_external_memory_capabilities") || context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
4544 const bool khr_external_semaphore_capabilities = checkExtension(properties, "VK_KHR_external_semaphore_capabilities") || context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
4545 const bool khr_multiview = checkExtension(properties, "VK_KHR_multiview") || context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
4546 const bool khr_device_protected_memory = context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
4547 const bool khr_device_subgroup = context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
4548 const bool khr_maintenance2 = checkExtension(properties, "VK_KHR_maintenance2") || context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
4549 const bool khr_maintenance3 = checkExtension(properties, "VK_KHR_maintenance3") || context.contextSupports(vk::ApiVersion(0, 1, 1, 0));
4550 const bool khr_depth_stencil_resolve = checkExtension(properties, "VK_KHR_depth_stencil_resolve") || context.contextSupports(vk::ApiVersion(0, 1, 2, 0));
4551 const bool khr_driver_properties = checkExtension(properties, "VK_KHR_driver_properties") || context.contextSupports(vk::ApiVersion(0, 1, 2, 0));
4552 const bool khr_shader_float_controls = checkExtension(properties, "VK_KHR_shader_float_controls") || context.contextSupports(vk::ApiVersion(0, 1, 2, 0));
4553 const bool khr_descriptor_indexing = checkExtension(properties, "VK_EXT_descriptor_indexing") || context.contextSupports(vk::ApiVersion(0, 1, 2, 0));
4554 const bool khr_sampler_filter_minmax = checkExtension(properties, "VK_EXT_sampler_filter_minmax") || context.contextSupports(vk::ApiVersion(0, 1, 2, 0));
4555 #ifndef CTS_USES_VULKANSC
4556 const bool khr_acceleration_structure = checkExtension(properties, "VK_KHR_acceleration_structure");
4557 const bool khr_integer_dot_product = checkExtension(properties, "VK_KHR_shader_integer_dot_product") || context.contextSupports(vk::ApiVersion(0, 1, 3, 0));
4558 const bool khr_inline_uniform_block = checkExtension(properties, "VK_EXT_inline_uniform_block") || context.contextSupports(vk::ApiVersion(0, 1, 3, 0));
4559 const bool khr_maintenance4 = checkExtension(properties, "VK_KHR_maintenance4") || context.contextSupports(vk::ApiVersion(0, 1, 3, 0));
4560 const bool khr_subgroup_size_control = checkExtension(properties, "VK_EXT_subgroup_size_control") || context.contextSupports(vk::ApiVersion(0, 1, 3, 0));
4561 const bool khr_texel_buffer_alignment = checkExtension(properties, "VK_EXT_texel_buffer_alignment") || context.contextSupports(vk::ApiVersion(0, 1, 3, 0));
4562 #endif // CTS_USES_VULKANSC
4564 VkPhysicalDeviceIDProperties idProperties[count];
4565 VkPhysicalDeviceMultiviewProperties multiviewProperties[count];
4566 VkPhysicalDeviceProtectedMemoryProperties protectedMemoryPropertiesKHR[count];
4567 VkPhysicalDeviceSubgroupProperties subgroupProperties[count];
4568 VkPhysicalDevicePointClippingProperties pointClippingProperties[count];
4569 VkPhysicalDeviceMaintenance3Properties maintenance3Properties[count];
4570 VkPhysicalDeviceDepthStencilResolveProperties depthStencilResolveProperties[count];
4571 VkPhysicalDeviceDriverProperties driverProperties[count];
4572 VkPhysicalDeviceFloatControlsProperties floatControlsProperties[count];
4573 VkPhysicalDeviceDescriptorIndexingProperties descriptorIndexingProperties[count];
4574 VkPhysicalDeviceSamplerFilterMinmaxProperties samplerFilterMinmaxProperties[count];
4575 #ifndef CTS_USES_VULKANSC
4576 VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR integerDotProductProperties[count];
4577 VkPhysicalDeviceAccelerationStructurePropertiesKHR accelerationStructureProperties[count];
4578 VkPhysicalDeviceInlineUniformBlockProperties inlineUniformBlockProperties[count];
4579 VkPhysicalDeviceMaintenance4Properties maintenance4Properties[count];
4580 VkPhysicalDeviceSubgroupSizeControlProperties subgroupSizeControlProperties[count];
4581 VkPhysicalDeviceTexelBufferAlignmentProperties texelBufferAlignmentProperties[count];
4582 #endif // CTS_USES_VULKANSC
4583 for (int ndx = 0; ndx < count; ++ndx)
4585 deMemset(&idProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceIDProperties ));
4586 deMemset(&multiviewProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceMultiviewProperties ));
4587 deMemset(&protectedMemoryPropertiesKHR[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceProtectedMemoryProperties ));
4588 deMemset(&subgroupProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceSubgroupProperties ));
4589 deMemset(&pointClippingProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDevicePointClippingProperties ));
4590 deMemset(&maintenance3Properties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceMaintenance3Properties ));
4591 deMemset(&depthStencilResolveProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceDepthStencilResolveProperties ));
4592 deMemset(&driverProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceDriverProperties ));
4593 deMemset(&floatControlsProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceFloatControlsProperties ));
4594 deMemset(&descriptorIndexingProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceDescriptorIndexingProperties ));
4595 deMemset(&samplerFilterMinmaxProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceSamplerFilterMinmaxProperties ));
4596 #ifndef CTS_USES_VULKANSC
4597 deMemset(&integerDotProductProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR ));
4598 deMemset(&accelerationStructureProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceAccelerationStructurePropertiesKHR ));
4599 deMemset(&inlineUniformBlockProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceInlineUniformBlockProperties ));
4600 deMemset(&maintenance4Properties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceMaintenance4Properties ));
4601 deMemset(&subgroupSizeControlProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceSubgroupSizeControlProperties ));
4602 deMemset(&texelBufferAlignmentProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceTexelBufferAlignmentProperties ));
4603 #endif // CTS_USES_VULKANSC
4607 if (khr_external_fence_capabilities || khr_external_memory_capabilities || khr_external_semaphore_capabilities)
4609 idProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES;
4610 idProperties[ndx].pNext = prev;
4611 prev = &idProperties[ndx];
4616 multiviewProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES;
4617 multiviewProperties[ndx].pNext = prev;
4618 prev = &multiviewProperties[ndx];
4621 if (khr_device_protected_memory)
4623 protectedMemoryPropertiesKHR[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES;
4624 protectedMemoryPropertiesKHR[ndx].pNext = prev;
4625 prev = &protectedMemoryPropertiesKHR[ndx];
4628 if (khr_device_subgroup)
4630 subgroupProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES;
4631 subgroupProperties[ndx].pNext = prev;
4632 prev = &subgroupProperties[ndx];
4635 if (khr_maintenance2)
4637 pointClippingProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES;
4638 pointClippingProperties[ndx].pNext = prev;
4639 prev = &pointClippingProperties[ndx];
4642 if (khr_maintenance3)
4644 maintenance3Properties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES;
4645 maintenance3Properties[ndx].pNext = prev;
4646 prev = &maintenance3Properties[ndx];
4649 if (khr_depth_stencil_resolve)
4651 depthStencilResolveProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES;
4652 depthStencilResolveProperties[ndx].pNext = prev;
4653 prev = &depthStencilResolveProperties[ndx];
4656 if (khr_driver_properties)
4658 driverProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES;
4659 driverProperties[ndx].pNext = prev;
4660 prev = &driverProperties[ndx];
4663 if (khr_shader_float_controls)
4665 floatControlsProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES;
4666 floatControlsProperties[ndx].pNext = prev;
4667 prev = &floatControlsProperties[ndx];
4670 if (khr_descriptor_indexing)
4672 descriptorIndexingProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES;
4673 descriptorIndexingProperties[ndx].pNext = prev;
4674 prev = &descriptorIndexingProperties[ndx];
4677 if (khr_sampler_filter_minmax)
4679 samplerFilterMinmaxProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES;
4680 samplerFilterMinmaxProperties[ndx].pNext = prev;
4681 prev = &samplerFilterMinmaxProperties[ndx];
4684 #ifndef CTS_USES_VULKANSC
4685 if (khr_integer_dot_product)
4687 integerDotProductProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES_KHR;
4688 integerDotProductProperties[ndx].pNext = prev;
4689 prev = &integerDotProductProperties[ndx];
4692 if (khr_acceleration_structure)
4694 accelerationStructureProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR;
4695 accelerationStructureProperties[ndx].pNext = prev;
4696 prev = &accelerationStructureProperties[ndx];
4699 if (khr_inline_uniform_block)
4701 inlineUniformBlockProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES;
4702 inlineUniformBlockProperties[ndx].pNext = prev;
4703 prev = &inlineUniformBlockProperties[ndx];
4706 if (khr_maintenance4)
4708 maintenance4Properties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES;
4709 maintenance4Properties[ndx].pNext = prev;
4710 prev = &maintenance4Properties[ndx];
4713 if (khr_subgroup_size_control)
4715 subgroupSizeControlProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES;
4716 subgroupSizeControlProperties[ndx].pNext = prev;
4717 prev = &subgroupSizeControlProperties[ndx];
4720 if (khr_texel_buffer_alignment)
4722 texelBufferAlignmentProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES;
4723 texelBufferAlignmentProperties[ndx].pNext = prev;
4724 prev = &texelBufferAlignmentProperties[ndx];
4726 #endif // CTS_USES_VULKANSC
4729 TCU_THROW(NotSupportedError, "No supported structures found");
4731 extProperties.pNext = prev;
4733 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
4736 if (khr_external_fence_capabilities || khr_external_memory_capabilities || khr_external_semaphore_capabilities)
4737 log << TestLog::Message << idProperties[0] << TestLog::EndMessage;
4739 log << TestLog::Message << multiviewProperties[0] << TestLog::EndMessage;
4740 if (khr_device_protected_memory)
4741 log << TestLog::Message << protectedMemoryPropertiesKHR[0] << TestLog::EndMessage;
4742 if (khr_device_subgroup)
4743 log << TestLog::Message << subgroupProperties[0] << TestLog::EndMessage;
4744 if (khr_maintenance2)
4745 log << TestLog::Message << pointClippingProperties[0] << TestLog::EndMessage;
4746 if (khr_maintenance3)
4747 log << TestLog::Message << maintenance3Properties[0] << TestLog::EndMessage;
4748 if (khr_depth_stencil_resolve)
4749 log << TestLog::Message << depthStencilResolveProperties[0] << TestLog::EndMessage;
4750 if (khr_driver_properties)
4751 log << TestLog::Message << driverProperties[0] << TestLog::EndMessage;
4752 if (khr_shader_float_controls)
4753 log << TestLog::Message << floatControlsProperties[0] << TestLog::EndMessage;
4754 if (khr_descriptor_indexing)
4755 log << TestLog::Message << descriptorIndexingProperties[0] << TestLog::EndMessage;
4756 if (khr_sampler_filter_minmax)
4757 log << TestLog::Message << samplerFilterMinmaxProperties[0] << TestLog::EndMessage;
4758 #ifndef CTS_USES_VULKANSC
4759 if (khr_integer_dot_product)
4760 log << TestLog::Message << integerDotProductProperties[0] << TestLog::EndMessage;
4761 if (khr_acceleration_structure)
4762 log << TestLog::Message << accelerationStructureProperties[0] << TestLog::EndMessage;
4763 if (khr_inline_uniform_block)
4764 log << TestLog::Message << inlineUniformBlockProperties[0] << TestLog::EndMessage;
4765 if (khr_maintenance4)
4766 log << TestLog::Message << maintenance4Properties[0] << TestLog::EndMessage;
4767 if (khr_subgroup_size_control)
4768 log << TestLog::Message << subgroupSizeControlProperties[0] << TestLog::EndMessage;
4769 if (khr_texel_buffer_alignment)
4770 log << TestLog::Message << texelBufferAlignmentProperties[0] << TestLog::EndMessage;
4771 #endif // CTS_USES_VULKANSC
4773 if ( khr_external_fence_capabilities || khr_external_memory_capabilities || khr_external_semaphore_capabilities )
4775 if ((deMemCmp(idProperties[0].deviceUUID, idProperties[1].deviceUUID, VK_UUID_SIZE) != 0) ||
4776 (deMemCmp(idProperties[0].driverUUID, idProperties[1].driverUUID, VK_UUID_SIZE) != 0) ||
4777 (idProperties[0].deviceLUIDValid != idProperties[1].deviceLUIDValid))
4779 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties");
4781 else if (idProperties[0].deviceLUIDValid)
4783 // If deviceLUIDValid is VK_FALSE, the contents of deviceLUID and deviceNodeMask are undefined
4784 // so thay can only be compared when deviceLUIDValid is VK_TRUE.
4785 if ((deMemCmp(idProperties[0].deviceLUID, idProperties[1].deviceLUID, VK_LUID_SIZE) != 0) ||
4786 (idProperties[0].deviceNodeMask != idProperties[1].deviceNodeMask))
4788 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties");
4792 if (khr_multiview &&
4793 (multiviewProperties[0].maxMultiviewViewCount != multiviewProperties[1].maxMultiviewViewCount ||
4794 multiviewProperties[0].maxMultiviewInstanceIndex != multiviewProperties[1].maxMultiviewInstanceIndex))
4796 TCU_FAIL("Mismatch between VkPhysicalDeviceMultiviewProperties");
4798 if (khr_device_protected_memory &&
4799 (protectedMemoryPropertiesKHR[0].protectedNoFault != protectedMemoryPropertiesKHR[1].protectedNoFault))
4801 TCU_FAIL("Mismatch between VkPhysicalDeviceProtectedMemoryProperties");
4803 if (khr_device_subgroup &&
4804 (subgroupProperties[0].subgroupSize != subgroupProperties[1].subgroupSize ||
4805 subgroupProperties[0].supportedStages != subgroupProperties[1].supportedStages ||
4806 subgroupProperties[0].supportedOperations != subgroupProperties[1].supportedOperations ||
4807 subgroupProperties[0].quadOperationsInAllStages != subgroupProperties[1].quadOperationsInAllStages ))
4809 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupProperties");
4811 if (khr_maintenance2 &&
4812 (pointClippingProperties[0].pointClippingBehavior != pointClippingProperties[1].pointClippingBehavior))
4814 TCU_FAIL("Mismatch between VkPhysicalDevicePointClippingProperties");
4816 if (khr_maintenance3 &&
4817 (maintenance3Properties[0].maxPerSetDescriptors != maintenance3Properties[1].maxPerSetDescriptors ||
4818 maintenance3Properties[0].maxMemoryAllocationSize != maintenance3Properties[1].maxMemoryAllocationSize))
4820 if (protectedMemoryPropertiesKHR[0].protectedNoFault != protectedMemoryPropertiesKHR[1].protectedNoFault)
4822 TCU_FAIL("Mismatch between VkPhysicalDeviceProtectedMemoryProperties");
4824 if ((subgroupProperties[0].subgroupSize != subgroupProperties[1].subgroupSize) ||
4825 (subgroupProperties[0].supportedStages != subgroupProperties[1].supportedStages) ||
4826 (subgroupProperties[0].supportedOperations != subgroupProperties[1].supportedOperations) ||
4827 (subgroupProperties[0].quadOperationsInAllStages != subgroupProperties[1].quadOperationsInAllStages))
4829 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupProperties");
4831 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance3Properties");
4833 if (khr_depth_stencil_resolve &&
4834 (depthStencilResolveProperties[0].supportedDepthResolveModes != depthStencilResolveProperties[1].supportedDepthResolveModes ||
4835 depthStencilResolveProperties[0].supportedStencilResolveModes != depthStencilResolveProperties[1].supportedStencilResolveModes ||
4836 depthStencilResolveProperties[0].independentResolveNone != depthStencilResolveProperties[1].independentResolveNone ||
4837 depthStencilResolveProperties[0].independentResolve != depthStencilResolveProperties[1].independentResolve))
4839 TCU_FAIL("Mismatch between VkPhysicalDeviceDepthStencilResolveProperties");
4841 if (khr_driver_properties &&
4842 (driverProperties[0].driverID != driverProperties[1].driverID ||
4843 strncmp(driverProperties[0].driverName, driverProperties[1].driverName, VK_MAX_DRIVER_NAME_SIZE) != 0 ||
4844 strncmp(driverProperties[0].driverInfo, driverProperties[1].driverInfo, VK_MAX_DRIVER_INFO_SIZE) != 0 ||
4845 driverProperties[0].conformanceVersion.major != driverProperties[1].conformanceVersion.major ||
4846 driverProperties[0].conformanceVersion.minor != driverProperties[1].conformanceVersion.minor ||
4847 driverProperties[0].conformanceVersion.subminor != driverProperties[1].conformanceVersion.subminor ||
4848 driverProperties[0].conformanceVersion.patch != driverProperties[1].conformanceVersion.patch))
4850 TCU_FAIL("Mismatch between VkPhysicalDeviceDriverProperties");
4852 if (khr_shader_float_controls &&
4853 (floatControlsProperties[0].denormBehaviorIndependence != floatControlsProperties[1].denormBehaviorIndependence ||
4854 floatControlsProperties[0].roundingModeIndependence != floatControlsProperties[1].roundingModeIndependence ||
4855 floatControlsProperties[0].shaderSignedZeroInfNanPreserveFloat16 != floatControlsProperties[1].shaderSignedZeroInfNanPreserveFloat16 ||
4856 floatControlsProperties[0].shaderSignedZeroInfNanPreserveFloat32 != floatControlsProperties[1].shaderSignedZeroInfNanPreserveFloat32 ||
4857 floatControlsProperties[0].shaderSignedZeroInfNanPreserveFloat64 != floatControlsProperties[1].shaderSignedZeroInfNanPreserveFloat64 ||
4858 floatControlsProperties[0].shaderDenormPreserveFloat16 != floatControlsProperties[1].shaderDenormPreserveFloat16 ||
4859 floatControlsProperties[0].shaderDenormPreserveFloat32 != floatControlsProperties[1].shaderDenormPreserveFloat32 ||
4860 floatControlsProperties[0].shaderDenormPreserveFloat64 != floatControlsProperties[1].shaderDenormPreserveFloat64 ||
4861 floatControlsProperties[0].shaderDenormFlushToZeroFloat16 != floatControlsProperties[1].shaderDenormFlushToZeroFloat16 ||
4862 floatControlsProperties[0].shaderDenormFlushToZeroFloat32 != floatControlsProperties[1].shaderDenormFlushToZeroFloat32 ||
4863 floatControlsProperties[0].shaderDenormFlushToZeroFloat64 != floatControlsProperties[1].shaderDenormFlushToZeroFloat64 ||
4864 floatControlsProperties[0].shaderRoundingModeRTEFloat16 != floatControlsProperties[1].shaderRoundingModeRTEFloat16 ||
4865 floatControlsProperties[0].shaderRoundingModeRTEFloat32 != floatControlsProperties[1].shaderRoundingModeRTEFloat32 ||
4866 floatControlsProperties[0].shaderRoundingModeRTEFloat64 != floatControlsProperties[1].shaderRoundingModeRTEFloat64 ||
4867 floatControlsProperties[0].shaderRoundingModeRTZFloat16 != floatControlsProperties[1].shaderRoundingModeRTZFloat16 ||
4868 floatControlsProperties[0].shaderRoundingModeRTZFloat32 != floatControlsProperties[1].shaderRoundingModeRTZFloat32 ||
4869 floatControlsProperties[0].shaderRoundingModeRTZFloat64 != floatControlsProperties[1].shaderRoundingModeRTZFloat64 ))
4871 TCU_FAIL("Mismatch between VkPhysicalDeviceFloatControlsProperties");
4873 if (khr_descriptor_indexing &&
4874 (descriptorIndexingProperties[0].maxUpdateAfterBindDescriptorsInAllPools != descriptorIndexingProperties[1].maxUpdateAfterBindDescriptorsInAllPools ||
4875 descriptorIndexingProperties[0].shaderUniformBufferArrayNonUniformIndexingNative != descriptorIndexingProperties[1].shaderUniformBufferArrayNonUniformIndexingNative ||
4876 descriptorIndexingProperties[0].shaderSampledImageArrayNonUniformIndexingNative != descriptorIndexingProperties[1].shaderSampledImageArrayNonUniformIndexingNative ||
4877 descriptorIndexingProperties[0].shaderStorageBufferArrayNonUniformIndexingNative != descriptorIndexingProperties[1].shaderStorageBufferArrayNonUniformIndexingNative ||
4878 descriptorIndexingProperties[0].shaderStorageImageArrayNonUniformIndexingNative != descriptorIndexingProperties[1].shaderStorageImageArrayNonUniformIndexingNative ||
4879 descriptorIndexingProperties[0].shaderInputAttachmentArrayNonUniformIndexingNative != descriptorIndexingProperties[1].shaderInputAttachmentArrayNonUniformIndexingNative ||
4880 descriptorIndexingProperties[0].robustBufferAccessUpdateAfterBind != descriptorIndexingProperties[1].robustBufferAccessUpdateAfterBind ||
4881 descriptorIndexingProperties[0].quadDivergentImplicitLod != descriptorIndexingProperties[1].quadDivergentImplicitLod ||
4882 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindSamplers != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindSamplers ||
4883 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindUniformBuffers != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindUniformBuffers ||
4884 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindStorageBuffers != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindStorageBuffers ||
4885 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindSampledImages != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindSampledImages ||
4886 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindStorageImages != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindStorageImages ||
4887 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindInputAttachments != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindInputAttachments ||
4888 descriptorIndexingProperties[0].maxPerStageUpdateAfterBindResources != descriptorIndexingProperties[1].maxPerStageUpdateAfterBindResources ||
4889 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindSamplers != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindSamplers ||
4890 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindUniformBuffers != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindUniformBuffers ||
4891 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindUniformBuffersDynamic != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindUniformBuffersDynamic ||
4892 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindStorageBuffers != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindStorageBuffers ||
4893 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindStorageBuffersDynamic != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindStorageBuffersDynamic ||
4894 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindSampledImages != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindSampledImages ||
4895 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindStorageImages != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindStorageImages ||
4896 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindInputAttachments != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindInputAttachments ))
4898 TCU_FAIL("Mismatch between VkPhysicalDeviceDescriptorIndexingProperties");
4900 if (khr_sampler_filter_minmax &&
4901 (samplerFilterMinmaxProperties[0].filterMinmaxSingleComponentFormats != samplerFilterMinmaxProperties[1].filterMinmaxSingleComponentFormats ||
4902 samplerFilterMinmaxProperties[0].filterMinmaxImageComponentMapping != samplerFilterMinmaxProperties[1].filterMinmaxImageComponentMapping))
4904 TCU_FAIL("Mismatch between VkPhysicalDeviceSamplerFilterMinmaxProperties");
4907 #ifndef CTS_USES_VULKANSC
4909 if (khr_integer_dot_product &&
4910 (integerDotProductProperties[0].integerDotProduct8BitUnsignedAccelerated != integerDotProductProperties[1].integerDotProduct8BitUnsignedAccelerated ||
4911 integerDotProductProperties[0].integerDotProduct8BitSignedAccelerated != integerDotProductProperties[1].integerDotProduct8BitSignedAccelerated ||
4912 integerDotProductProperties[0].integerDotProduct8BitMixedSignednessAccelerated != integerDotProductProperties[1].integerDotProduct8BitMixedSignednessAccelerated ||
4913 integerDotProductProperties[0].integerDotProduct4x8BitPackedUnsignedAccelerated != integerDotProductProperties[1].integerDotProduct4x8BitPackedUnsignedAccelerated ||
4914 integerDotProductProperties[0].integerDotProduct4x8BitPackedSignedAccelerated != integerDotProductProperties[1].integerDotProduct4x8BitPackedSignedAccelerated ||
4915 integerDotProductProperties[0].integerDotProduct4x8BitPackedMixedSignednessAccelerated != integerDotProductProperties[1].integerDotProduct4x8BitPackedMixedSignednessAccelerated ||
4916 integerDotProductProperties[0].integerDotProduct16BitUnsignedAccelerated != integerDotProductProperties[1].integerDotProduct16BitUnsignedAccelerated ||
4917 integerDotProductProperties[0].integerDotProduct16BitSignedAccelerated != integerDotProductProperties[1].integerDotProduct16BitSignedAccelerated ||
4918 integerDotProductProperties[0].integerDotProduct16BitMixedSignednessAccelerated != integerDotProductProperties[1].integerDotProduct16BitMixedSignednessAccelerated ||
4919 integerDotProductProperties[0].integerDotProduct32BitUnsignedAccelerated != integerDotProductProperties[1].integerDotProduct32BitUnsignedAccelerated ||
4920 integerDotProductProperties[0].integerDotProduct32BitSignedAccelerated != integerDotProductProperties[1].integerDotProduct32BitSignedAccelerated ||
4921 integerDotProductProperties[0].integerDotProduct32BitMixedSignednessAccelerated != integerDotProductProperties[1].integerDotProduct32BitMixedSignednessAccelerated ||
4922 integerDotProductProperties[0].integerDotProduct64BitUnsignedAccelerated != integerDotProductProperties[1].integerDotProduct64BitUnsignedAccelerated ||
4923 integerDotProductProperties[0].integerDotProduct64BitSignedAccelerated != integerDotProductProperties[1].integerDotProduct64BitSignedAccelerated ||
4924 integerDotProductProperties[0].integerDotProduct64BitMixedSignednessAccelerated != integerDotProductProperties[1].integerDotProduct64BitMixedSignednessAccelerated ||
4925 integerDotProductProperties[0].integerDotProductAccumulatingSaturating8BitUnsignedAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating8BitUnsignedAccelerated ||
4926 integerDotProductProperties[0].integerDotProductAccumulatingSaturating8BitSignedAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating8BitSignedAccelerated ||
4927 integerDotProductProperties[0].integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated ||
4928 integerDotProductProperties[0].integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated ||
4929 integerDotProductProperties[0].integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated ||
4930 integerDotProductProperties[0].integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated ||
4931 integerDotProductProperties[0].integerDotProductAccumulatingSaturating16BitUnsignedAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating16BitUnsignedAccelerated ||
4932 integerDotProductProperties[0].integerDotProductAccumulatingSaturating16BitSignedAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating16BitSignedAccelerated ||
4933 integerDotProductProperties[0].integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated ||
4934 integerDotProductProperties[0].integerDotProductAccumulatingSaturating32BitUnsignedAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating32BitUnsignedAccelerated ||
4935 integerDotProductProperties[0].integerDotProductAccumulatingSaturating32BitSignedAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating32BitSignedAccelerated ||
4936 integerDotProductProperties[0].integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated ||
4937 integerDotProductProperties[0].integerDotProductAccumulatingSaturating64BitUnsignedAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating64BitUnsignedAccelerated ||
4938 integerDotProductProperties[0].integerDotProductAccumulatingSaturating64BitSignedAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating64BitSignedAccelerated ||
4939 integerDotProductProperties[0].integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated != integerDotProductProperties[1].integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated))
4941 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderIntegerDotProductPropertiesKHR");
4944 if (khr_texel_buffer_alignment)
4946 if (texelBufferAlignmentProperties[0].storageTexelBufferOffsetAlignmentBytes != texelBufferAlignmentProperties[1].storageTexelBufferOffsetAlignmentBytes ||
4947 texelBufferAlignmentProperties[0].storageTexelBufferOffsetSingleTexelAlignment != texelBufferAlignmentProperties[1].storageTexelBufferOffsetSingleTexelAlignment ||
4948 texelBufferAlignmentProperties[0].uniformTexelBufferOffsetAlignmentBytes != texelBufferAlignmentProperties[1].uniformTexelBufferOffsetAlignmentBytes ||
4949 texelBufferAlignmentProperties[0].uniformTexelBufferOffsetSingleTexelAlignment != texelBufferAlignmentProperties[1].uniformTexelBufferOffsetSingleTexelAlignment)
4951 TCU_FAIL("Mismatch between VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT");
4954 if (texelBufferAlignmentProperties[0].storageTexelBufferOffsetAlignmentBytes == 0 || !deIntIsPow2((int)texelBufferAlignmentProperties[0].storageTexelBufferOffsetAlignmentBytes))
4956 TCU_FAIL("limit Validation failed storageTexelBufferOffsetAlignmentBytes is not a power of two.");
4959 if (texelBufferAlignmentProperties[0].uniformTexelBufferOffsetAlignmentBytes == 0 || !deIntIsPow2((int)texelBufferAlignmentProperties[0].uniformTexelBufferOffsetAlignmentBytes))
4961 TCU_FAIL("limit Validation failed uniformTexelBufferOffsetAlignmentBytes is not a power of two.");
4965 if (khr_inline_uniform_block &&
4966 (inlineUniformBlockProperties[0].maxInlineUniformBlockSize != inlineUniformBlockProperties[1].maxInlineUniformBlockSize ||
4967 inlineUniformBlockProperties[0].maxPerStageDescriptorInlineUniformBlocks != inlineUniformBlockProperties[1].maxPerStageDescriptorInlineUniformBlocks ||
4968 inlineUniformBlockProperties[0].maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks != inlineUniformBlockProperties[1].maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks ||
4969 inlineUniformBlockProperties[0].maxDescriptorSetInlineUniformBlocks != inlineUniformBlockProperties[1].maxDescriptorSetInlineUniformBlocks ||
4970 inlineUniformBlockProperties[0].maxDescriptorSetUpdateAfterBindInlineUniformBlocks != inlineUniformBlockProperties[1].maxDescriptorSetUpdateAfterBindInlineUniformBlocks))
4972 TCU_FAIL("Mismatch between VkPhysicalDeviceInlineUniformBlockProperties");
4974 if (khr_maintenance4 &&
4975 (maintenance4Properties[0].maxBufferSize != maintenance4Properties[1].maxBufferSize))
4977 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance4Properties");
4979 if (khr_subgroup_size_control &&
4980 (subgroupSizeControlProperties[0].minSubgroupSize != subgroupSizeControlProperties[1].minSubgroupSize ||
4981 subgroupSizeControlProperties[0].maxSubgroupSize != subgroupSizeControlProperties[1].maxSubgroupSize ||
4982 subgroupSizeControlProperties[0].maxComputeWorkgroupSubgroups != subgroupSizeControlProperties[1].maxComputeWorkgroupSubgroups ||
4983 subgroupSizeControlProperties[0].requiredSubgroupSizeStages != subgroupSizeControlProperties[1].requiredSubgroupSizeStages))
4985 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupSizeControlProperties");
4988 if (khr_acceleration_structure)
4990 if (accelerationStructureProperties[0].maxGeometryCount != accelerationStructureProperties[1].maxGeometryCount ||
4991 accelerationStructureProperties[0].maxInstanceCount != accelerationStructureProperties[1].maxInstanceCount ||
4992 accelerationStructureProperties[0].maxPrimitiveCount != accelerationStructureProperties[1].maxPrimitiveCount ||
4993 accelerationStructureProperties[0].maxPerStageDescriptorAccelerationStructures != accelerationStructureProperties[1].maxPerStageDescriptorAccelerationStructures ||
4994 accelerationStructureProperties[0].maxPerStageDescriptorUpdateAfterBindAccelerationStructures != accelerationStructureProperties[1].maxPerStageDescriptorUpdateAfterBindAccelerationStructures ||
4995 accelerationStructureProperties[0].maxDescriptorSetAccelerationStructures != accelerationStructureProperties[1].maxDescriptorSetAccelerationStructures ||
4996 accelerationStructureProperties[0].maxDescriptorSetUpdateAfterBindAccelerationStructures != accelerationStructureProperties[1].maxDescriptorSetUpdateAfterBindAccelerationStructures ||
4997 accelerationStructureProperties[0].minAccelerationStructureScratchOffsetAlignment != accelerationStructureProperties[1].minAccelerationStructureScratchOffsetAlignment)
4999 TCU_FAIL("Mismatch between VkPhysicalDeviceAccelerationStructurePropertiesKHR");
5002 if (accelerationStructureProperties[0].minAccelerationStructureScratchOffsetAlignment == 0 || !deIntIsPow2(accelerationStructureProperties[0].minAccelerationStructureScratchOffsetAlignment))
5004 TCU_FAIL("limit Validation failed minAccelerationStructureScratchOffsetAlignment is not a power of two.");
5008 if (isExtensionSupported(properties, RequiredExtension("VK_KHR_push_descriptor")))
5010 VkPhysicalDevicePushDescriptorPropertiesKHR pushDescriptorProperties[count];
5012 for (int ndx = 0; ndx < count; ++ndx)
5014 deMemset(&pushDescriptorProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDevicePushDescriptorPropertiesKHR));
5016 pushDescriptorProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR;
5017 pushDescriptorProperties[ndx].pNext = DE_NULL;
5019 extProperties.pNext = &pushDescriptorProperties[ndx];
5021 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5023 pushDescriptorProperties[ndx].pNext = DE_NULL;
5026 log << TestLog::Message << pushDescriptorProperties[0] << TestLog::EndMessage;
5028 if ( pushDescriptorProperties[0].maxPushDescriptors != pushDescriptorProperties[1].maxPushDescriptors )
5030 TCU_FAIL("Mismatch between VkPhysicalDevicePushDescriptorPropertiesKHR ");
5032 if (pushDescriptorProperties[0].maxPushDescriptors < 32)
5034 TCU_FAIL("VkPhysicalDevicePushDescriptorPropertiesKHR.maxPushDescriptors must be at least 32");
5038 if (isExtensionSupported(properties, RequiredExtension("VK_KHR_performance_query")))
5040 VkPhysicalDevicePerformanceQueryPropertiesKHR performanceQueryProperties[count];
5042 for (int ndx = 0; ndx < count; ++ndx)
5044 deMemset(&performanceQueryProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDevicePerformanceQueryPropertiesKHR));
5045 performanceQueryProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR;
5046 performanceQueryProperties[ndx].pNext = DE_NULL;
5048 extProperties.pNext = &performanceQueryProperties[ndx];
5050 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5053 log << TestLog::Message << performanceQueryProperties[0] << TestLog::EndMessage;
5055 if (performanceQueryProperties[0].allowCommandBufferQueryCopies != performanceQueryProperties[1].allowCommandBufferQueryCopies)
5057 TCU_FAIL("Mismatch between VkPhysicalDevicePerformanceQueryPropertiesKHR");
5061 #endif // CTS_USES_VULKANSC
5063 if (isExtensionSupported(properties, RequiredExtension("VK_EXT_pci_bus_info", 2, 2)))
5065 VkPhysicalDevicePCIBusInfoPropertiesEXT pciBusInfoProperties[count];
5067 for (int ndx = 0; ndx < count; ++ndx)
5069 // Each PCI device is identified by an 8-bit domain number, 5-bit
5070 // device number and 3-bit function number[1][2].
5072 // In addition, because PCI systems can be interconnected and
5073 // divided in segments, Linux assigns a 16-bit number to the device
5074 // as the "domain". In Windows, the segment or domain is stored in
5075 // the higher 24-bit section of the bus number.
5077 // This means the maximum unsigned 32-bit integer for these members
5078 // are invalid values and should change after querying properties.
5080 // [1] https://en.wikipedia.org/wiki/PCI_configuration_space
5081 // [2] PCI Express Base Specification Revision 3.0, section 2.2.4.2.
5082 deMemset(pciBusInfoProperties + ndx, 0xFF * ndx, sizeof(pciBusInfoProperties[ndx]));
5083 pciBusInfoProperties[ndx].pciDomain = DEUINT32_MAX;
5084 pciBusInfoProperties[ndx].pciBus = DEUINT32_MAX;
5085 pciBusInfoProperties[ndx].pciDevice = DEUINT32_MAX;
5086 pciBusInfoProperties[ndx].pciFunction = DEUINT32_MAX;
5088 pciBusInfoProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT;
5089 pciBusInfoProperties[ndx].pNext = DE_NULL;
5091 extProperties.pNext = pciBusInfoProperties + ndx;
5092 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5095 log << TestLog::Message << toString(pciBusInfoProperties[0]) << TestLog::EndMessage;
5097 if (pciBusInfoProperties[0].pciDomain != pciBusInfoProperties[1].pciDomain ||
5098 pciBusInfoProperties[0].pciBus != pciBusInfoProperties[1].pciBus ||
5099 pciBusInfoProperties[0].pciDevice != pciBusInfoProperties[1].pciDevice ||
5100 pciBusInfoProperties[0].pciFunction != pciBusInfoProperties[1].pciFunction)
5102 TCU_FAIL("Mismatch between VkPhysicalDevicePCIBusInfoPropertiesEXT");
5104 if (pciBusInfoProperties[0].pciDomain == DEUINT32_MAX ||
5105 pciBusInfoProperties[0].pciBus == DEUINT32_MAX ||
5106 pciBusInfoProperties[0].pciDevice == DEUINT32_MAX ||
5107 pciBusInfoProperties[0].pciFunction == DEUINT32_MAX)
5109 TCU_FAIL("Invalid information in VkPhysicalDevicePCIBusInfoPropertiesEXT");
5113 #ifndef CTS_USES_VULKANSC
5114 if (isExtensionSupported(properties, RequiredExtension("VK_KHR_portability_subset")))
5116 VkPhysicalDevicePortabilitySubsetPropertiesKHR portabilitySubsetProperties[count];
5118 for (int ndx = 0; ndx < count; ++ndx)
5120 deMemset(&portabilitySubsetProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDevicePortabilitySubsetPropertiesKHR));
5121 portabilitySubsetProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_PROPERTIES_KHR;
5122 portabilitySubsetProperties[ndx].pNext = DE_NULL;
5124 extProperties.pNext = &portabilitySubsetProperties[ndx];
5126 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5129 log << TestLog::Message << portabilitySubsetProperties[0] << TestLog::EndMessage;
5131 if (portabilitySubsetProperties[0].minVertexInputBindingStrideAlignment != portabilitySubsetProperties[1].minVertexInputBindingStrideAlignment)
5133 TCU_FAIL("Mismatch between VkPhysicalDevicePortabilitySubsetPropertiesKHR");
5136 if (portabilitySubsetProperties[0].minVertexInputBindingStrideAlignment == 0 || !deIntIsPow2(portabilitySubsetProperties[0].minVertexInputBindingStrideAlignment))
5138 TCU_FAIL("limit Validation failed minVertexInputBindingStrideAlignment is not a power of two.");
5141 #endif // CTS_USES_VULKANSC
5143 return tcu::TestStatus::pass("Querying device properties succeeded");
5146 string toString (const VkFormatProperties2& value)
5148 std::ostringstream s;
5149 s << "VkFormatProperties2 = {\n";
5150 s << "\tsType = " << value.sType << '\n';
5151 s << "\tformatProperties = {\n";
5152 s << "\tlinearTilingFeatures = " << getFormatFeatureFlagsStr(value.formatProperties.linearTilingFeatures) << '\n';
5153 s << "\toptimalTilingFeatures = " << getFormatFeatureFlagsStr(value.formatProperties.optimalTilingFeatures) << '\n';
5154 s << "\tbufferFeatures = " << getFormatFeatureFlagsStr(value.formatProperties.bufferFeatures) << '\n';
5160 tcu::TestStatus deviceFormatProperties2 (Context& context)
5162 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5163 const InstanceDriver& vki (instance.getDriver());
5164 const VkPhysicalDevice physicalDevice (chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
5165 TestLog& log = context.getTestContext().getLog();
5167 for (int formatNdx = 0; formatNdx < VK_CORE_FORMAT_LAST; ++formatNdx)
5169 const VkFormat format = (VkFormat)formatNdx;
5170 VkFormatProperties coreProperties;
5171 VkFormatProperties2 extProperties;
5173 deMemset(&coreProperties, 0xcd, sizeof(VkFormatProperties));
5174 deMemset(&extProperties, 0xcd, sizeof(VkFormatProperties2));
5176 extProperties.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2;
5177 extProperties.pNext = DE_NULL;
5179 vki.getPhysicalDeviceFormatProperties(physicalDevice, format, &coreProperties);
5180 vki.getPhysicalDeviceFormatProperties2(physicalDevice, format, &extProperties);
5182 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2);
5183 TCU_CHECK(extProperties.pNext == DE_NULL);
5185 if (deMemCmp(&coreProperties, &extProperties.formatProperties, sizeof(VkFormatProperties)) != 0)
5186 TCU_FAIL("Mismatch between format properties reported by vkGetPhysicalDeviceFormatProperties and vkGetPhysicalDeviceFormatProperties2");
5188 log << TestLog::Message << toString (extProperties) << TestLog::EndMessage;
5191 return tcu::TestStatus::pass("Querying device format properties succeeded");
5194 tcu::TestStatus deviceQueueFamilyProperties2 (Context& context)
5196 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5197 const InstanceDriver& vki (instance.getDriver());
5198 const VkPhysicalDevice physicalDevice (chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
5199 TestLog& log = context.getTestContext().getLog();
5200 deUint32 numCoreQueueFamilies = ~0u;
5201 deUint32 numExtQueueFamilies = ~0u;
5203 vki.getPhysicalDeviceQueueFamilyProperties(physicalDevice, &numCoreQueueFamilies, DE_NULL);
5204 vki.getPhysicalDeviceQueueFamilyProperties2(physicalDevice, &numExtQueueFamilies, DE_NULL);
5206 TCU_CHECK_MSG(numCoreQueueFamilies == numExtQueueFamilies, "Different number of queue family properties reported");
5207 TCU_CHECK(numCoreQueueFamilies > 0);
5210 std::vector<VkQueueFamilyProperties> coreProperties (numCoreQueueFamilies);
5211 std::vector<VkQueueFamilyProperties2> extProperties (numExtQueueFamilies);
5213 deMemset(&coreProperties[0], 0xcd, sizeof(VkQueueFamilyProperties)*numCoreQueueFamilies);
5214 deMemset(&extProperties[0], 0xcd, sizeof(VkQueueFamilyProperties2)*numExtQueueFamilies);
5216 for (size_t ndx = 0; ndx < extProperties.size(); ++ndx)
5218 extProperties[ndx].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2;
5219 extProperties[ndx].pNext = DE_NULL;
5222 vki.getPhysicalDeviceQueueFamilyProperties(physicalDevice, &numCoreQueueFamilies, &coreProperties[0]);
5223 vki.getPhysicalDeviceQueueFamilyProperties2(physicalDevice, &numExtQueueFamilies, &extProperties[0]);
5225 TCU_CHECK((size_t)numCoreQueueFamilies == coreProperties.size());
5226 TCU_CHECK((size_t)numExtQueueFamilies == extProperties.size());
5227 DE_ASSERT(numCoreQueueFamilies == numExtQueueFamilies);
5229 for (size_t ndx = 0; ndx < extProperties.size(); ++ndx)
5231 TCU_CHECK(extProperties[ndx].sType == VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2);
5232 TCU_CHECK(extProperties[ndx].pNext == DE_NULL);
5234 if (deMemCmp(&coreProperties[ndx], &extProperties[ndx].queueFamilyProperties, sizeof(VkQueueFamilyProperties)) != 0)
5235 TCU_FAIL("Mismatch between format properties reported by vkGetPhysicalDeviceQueueFamilyProperties and vkGetPhysicalDeviceQueueFamilyProperties2");
5237 log << TestLog::Message << " queueFamilyNdx = " << ndx <<TestLog::EndMessage
5238 << TestLog::Message << extProperties[ndx] << TestLog::EndMessage;
5242 return tcu::TestStatus::pass("Querying device queue family properties succeeded");
5245 tcu::TestStatus deviceMemoryProperties2 (Context& context)
5247 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5248 const InstanceDriver& vki (instance.getDriver());
5249 const VkPhysicalDevice physicalDevice (chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
5250 TestLog& log = context.getTestContext().getLog();
5251 VkPhysicalDeviceMemoryProperties coreProperties;
5252 VkPhysicalDeviceMemoryProperties2 extProperties;
5254 deMemset(&coreProperties, 0xcd, sizeof(VkPhysicalDeviceMemoryProperties));
5255 deMemset(&extProperties, 0xcd, sizeof(VkPhysicalDeviceMemoryProperties2));
5257 extProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2;
5258 extProperties.pNext = DE_NULL;
5260 vki.getPhysicalDeviceMemoryProperties(physicalDevice, &coreProperties);
5261 vki.getPhysicalDeviceMemoryProperties2(physicalDevice, &extProperties);
5263 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2);
5264 TCU_CHECK(extProperties.pNext == DE_NULL);
5266 if (coreProperties.memoryTypeCount != extProperties.memoryProperties.memoryTypeCount)
5267 TCU_FAIL("Mismatch between memoryTypeCount reported by vkGetPhysicalDeviceMemoryProperties and vkGetPhysicalDeviceMemoryProperties2");
5268 if (coreProperties.memoryHeapCount != extProperties.memoryProperties.memoryHeapCount)
5269 TCU_FAIL("Mismatch between memoryHeapCount reported by vkGetPhysicalDeviceMemoryProperties and vkGetPhysicalDeviceMemoryProperties2");
5270 for (deUint32 i = 0; i < coreProperties.memoryTypeCount; i++) {
5271 const VkMemoryType *coreType = &coreProperties.memoryTypes[i];
5272 const VkMemoryType *extType = &extProperties.memoryProperties.memoryTypes[i];
5273 if (coreType->propertyFlags != extType->propertyFlags || coreType->heapIndex != extType->heapIndex)
5274 TCU_FAIL("Mismatch between memoryTypes reported by vkGetPhysicalDeviceMemoryProperties and vkGetPhysicalDeviceMemoryProperties2");
5276 for (deUint32 i = 0; i < coreProperties.memoryHeapCount; i++) {
5277 const VkMemoryHeap *coreHeap = &coreProperties.memoryHeaps[i];
5278 const VkMemoryHeap *extHeap = &extProperties.memoryProperties.memoryHeaps[i];
5279 if (coreHeap->size != extHeap->size || coreHeap->flags != extHeap->flags)
5280 TCU_FAIL("Mismatch between memoryHeaps reported by vkGetPhysicalDeviceMemoryProperties and vkGetPhysicalDeviceMemoryProperties2");
5283 log << TestLog::Message << extProperties << TestLog::EndMessage;
5285 return tcu::TestStatus::pass("Querying device memory properties succeeded");
5288 tcu::TestStatus deviceFeaturesVulkan12 (Context& context)
5290 using namespace ValidateQueryBits;
5292 const QueryMemberTableEntry feature11OffsetTable[] =
5294 // VkPhysicalDevice16BitStorageFeatures
5295 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, storageBuffer16BitAccess),
5296 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, uniformAndStorageBuffer16BitAccess),
5297 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, storagePushConstant16),
5298 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, storageInputOutput16),
5300 // VkPhysicalDeviceMultiviewFeatures
5301 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, multiview),
5302 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, multiviewGeometryShader),
5303 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, multiviewTessellationShader),
5305 // VkPhysicalDeviceVariablePointersFeatures
5306 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, variablePointersStorageBuffer),
5307 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, variablePointers),
5309 // VkPhysicalDeviceProtectedMemoryFeatures
5310 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, protectedMemory),
5312 // VkPhysicalDeviceSamplerYcbcrConversionFeatures
5313 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, samplerYcbcrConversion),
5315 // VkPhysicalDeviceShaderDrawParametersFeatures
5316 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, shaderDrawParameters),
5319 const QueryMemberTableEntry feature12OffsetTable[] =
5322 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, samplerMirrorClampToEdge),
5323 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, drawIndirectCount),
5325 // VkPhysicalDevice8BitStorageFeatures
5326 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, storageBuffer8BitAccess),
5327 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, uniformAndStorageBuffer8BitAccess),
5328 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, storagePushConstant8),
5330 // VkPhysicalDeviceShaderAtomicInt64Features
5331 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderBufferInt64Atomics),
5332 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderSharedInt64Atomics),
5334 // VkPhysicalDeviceShaderFloat16Int8Features
5335 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderFloat16),
5336 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderInt8),
5338 // VkPhysicalDeviceDescriptorIndexingFeatures
5339 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorIndexing),
5340 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderInputAttachmentArrayDynamicIndexing),
5341 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderUniformTexelBufferArrayDynamicIndexing),
5342 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageTexelBufferArrayDynamicIndexing),
5343 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderUniformBufferArrayNonUniformIndexing),
5344 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderSampledImageArrayNonUniformIndexing),
5345 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageBufferArrayNonUniformIndexing),
5346 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageImageArrayNonUniformIndexing),
5347 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderInputAttachmentArrayNonUniformIndexing),
5348 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderUniformTexelBufferArrayNonUniformIndexing),
5349 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageTexelBufferArrayNonUniformIndexing),
5350 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingUniformBufferUpdateAfterBind),
5351 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingSampledImageUpdateAfterBind),
5352 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingStorageImageUpdateAfterBind),
5353 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingStorageBufferUpdateAfterBind),
5354 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingUniformTexelBufferUpdateAfterBind),
5355 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingStorageTexelBufferUpdateAfterBind),
5356 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingUpdateUnusedWhilePending),
5357 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingPartiallyBound),
5358 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingVariableDescriptorCount),
5359 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, runtimeDescriptorArray),
5362 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, samplerFilterMinmax),
5364 // VkPhysicalDeviceScalarBlockLayoutFeatures
5365 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, scalarBlockLayout),
5367 // VkPhysicalDeviceImagelessFramebufferFeatures
5368 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, imagelessFramebuffer),
5370 // VkPhysicalDeviceUniformBufferStandardLayoutFeatures
5371 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, uniformBufferStandardLayout),
5373 // VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures
5374 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderSubgroupExtendedTypes),
5376 // VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures
5377 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, separateDepthStencilLayouts),
5379 // VkPhysicalDeviceHostQueryResetFeatures
5380 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, hostQueryReset),
5382 // VkPhysicalDeviceTimelineSemaphoreFeatures
5383 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, timelineSemaphore),
5385 // VkPhysicalDeviceBufferDeviceAddressFeatures
5386 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, bufferDeviceAddress),
5387 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, bufferDeviceAddressCaptureReplay),
5388 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, bufferDeviceAddressMultiDevice),
5390 // VkPhysicalDeviceVulkanMemoryModelFeatures
5391 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, vulkanMemoryModel),
5392 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, vulkanMemoryModelDeviceScope),
5393 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, vulkanMemoryModelAvailabilityVisibilityChains),
5396 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderOutputViewportIndex),
5397 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderOutputLayer),
5398 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, subgroupBroadcastDynamicId),
5401 TestLog& log = context.getTestContext().getLog();
5402 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5403 const InstanceDriver& vki = instance.getDriver();
5404 const VkPhysicalDevice physicalDevice (chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
5405 const deUint32 vulkan11FeaturesBufferSize = sizeof(VkPhysicalDeviceVulkan11Features) + GUARD_SIZE;
5406 const deUint32 vulkan12FeaturesBufferSize = sizeof(VkPhysicalDeviceVulkan12Features) + GUARD_SIZE;
5407 VkPhysicalDeviceFeatures2 extFeatures;
5408 deUint8 buffer11a[vulkan11FeaturesBufferSize];
5409 deUint8 buffer11b[vulkan11FeaturesBufferSize];
5410 deUint8 buffer12a[vulkan12FeaturesBufferSize];
5411 deUint8 buffer12b[vulkan12FeaturesBufferSize];
5412 const int count = 2u;
5413 VkPhysicalDeviceVulkan11Features* vulkan11Features[count] = { (VkPhysicalDeviceVulkan11Features*)(buffer11a), (VkPhysicalDeviceVulkan11Features*)(buffer11b)};
5414 VkPhysicalDeviceVulkan12Features* vulkan12Features[count] = { (VkPhysicalDeviceVulkan12Features*)(buffer12a), (VkPhysicalDeviceVulkan12Features*)(buffer12b)};
5416 if (!context.contextSupports(vk::ApiVersion(0, 1, 2, 0)))
5417 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
5419 deMemset(buffer11b, GUARD_VALUE, sizeof(buffer11b));
5420 deMemset(buffer12a, GUARD_VALUE, sizeof(buffer12a));
5421 deMemset(buffer12b, GUARD_VALUE, sizeof(buffer12b));
5422 deMemset(buffer11a, GUARD_VALUE, sizeof(buffer11a));
5424 // Validate all fields initialized
5425 for (int ndx = 0; ndx < count; ++ndx)
5427 deMemset(&extFeatures.features, 0x00, sizeof(extFeatures.features));
5428 extFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
5429 extFeatures.pNext = vulkan11Features[ndx];
5431 deMemset(vulkan11Features[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan11Features));
5432 vulkan11Features[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
5433 vulkan11Features[ndx]->pNext = vulkan12Features[ndx];
5435 deMemset(vulkan12Features[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan12Features));
5436 vulkan12Features[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
5437 vulkan12Features[ndx]->pNext = DE_NULL;
5439 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
5442 log << TestLog::Message << *vulkan11Features[0] << TestLog::EndMessage;
5443 log << TestLog::Message << *vulkan12Features[0] << TestLog::EndMessage;
5445 if (!validateStructsWithGuard(feature11OffsetTable, vulkan11Features, GUARD_VALUE, GUARD_SIZE))
5447 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceVulkan11Features initialization failure" << TestLog::EndMessage;
5449 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan11Features initialization failure");
5452 if (!validateStructsWithGuard(feature12OffsetTable, vulkan12Features, GUARD_VALUE, GUARD_SIZE))
5454 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceVulkan12Features initialization failure" << TestLog::EndMessage;
5456 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan12Features initialization failure");
5459 return tcu::TestStatus::pass("Querying Vulkan 1.2 device features succeeded");
5462 #ifndef CTS_USES_VULKANSC
5463 tcu::TestStatus deviceFeaturesVulkan13 (Context& context)
5465 using namespace ValidateQueryBits;
5467 const QueryMemberTableEntry feature13OffsetTable[] =
5469 // VkPhysicalDeviceImageRobustnessFeatures
5470 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, robustImageAccess),
5472 // VkPhysicalDeviceInlineUniformBlockFeatures
5473 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, inlineUniformBlock),
5474 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, descriptorBindingInlineUniformBlockUpdateAfterBind),
5476 // VkPhysicalDevicePipelineCreationCacheControlFeatures
5477 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, pipelineCreationCacheControl),
5479 // VkPhysicalDevicePrivateDataFeatures
5480 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, privateData),
5482 // VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures
5483 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, shaderDemoteToHelperInvocation),
5485 // VkPhysicalDeviceShaderTerminateInvocationFeatures
5486 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, shaderTerminateInvocation),
5488 // VkPhysicalDeviceSubgroupSizeControlFeatures
5489 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, subgroupSizeControl),
5490 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, computeFullSubgroups),
5492 // VkPhysicalDeviceSynchronization2Features
5493 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, synchronization2),
5495 // VkPhysicalDeviceTextureCompressionASTCHDRFeatures
5496 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, textureCompressionASTC_HDR),
5498 // VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures
5499 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, shaderZeroInitializeWorkgroupMemory),
5501 // VkPhysicalDeviceDynamicRenderingFeatures
5502 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, dynamicRendering),
5504 // VkPhysicalDeviceShaderIntegerDotProductFeatures
5505 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, shaderIntegerDotProduct),
5507 // VkPhysicalDeviceMaintenance4Features
5508 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Features, maintenance4),
5511 TestLog& log = context.getTestContext().getLog();
5512 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
5513 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5514 const InstanceDriver& vki = instance.getDriver();
5515 const deUint32 vulkan13FeaturesBufferSize = sizeof(VkPhysicalDeviceVulkan13Features) + GUARD_SIZE;
5516 VkPhysicalDeviceFeatures2 extFeatures;
5517 deUint8 buffer13a[vulkan13FeaturesBufferSize];
5518 deUint8 buffer13b[vulkan13FeaturesBufferSize];
5519 const int count = 2u;
5520 VkPhysicalDeviceVulkan13Features* vulkan13Features[count] = { (VkPhysicalDeviceVulkan13Features*)(buffer13a), (VkPhysicalDeviceVulkan13Features*)(buffer13b)};
5522 if (!context.contextSupports(vk::ApiVersion(0, 1, 3, 0)))
5523 TCU_THROW(NotSupportedError, "At least Vulkan 1.3 required to run test");
5525 deMemset(buffer13a, GUARD_VALUE, sizeof(buffer13a));
5526 deMemset(buffer13b, GUARD_VALUE, sizeof(buffer13b));
5528 // Validate all fields initialized
5529 for (int ndx = 0; ndx < count; ++ndx)
5531 deMemset(&extFeatures.features, 0x00, sizeof(extFeatures.features));
5532 extFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
5533 extFeatures.pNext = vulkan13Features[ndx];
5535 deMemset(vulkan13Features[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan13Features));
5536 vulkan13Features[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
5537 vulkan13Features[ndx]->pNext = DE_NULL;
5539 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
5542 log << TestLog::Message << *vulkan13Features[0] << TestLog::EndMessage;
5544 if (!validateStructsWithGuard(feature13OffsetTable, vulkan13Features, GUARD_VALUE, GUARD_SIZE))
5546 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceVulkan13Features initialization failure" << TestLog::EndMessage;
5548 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan13Features initialization failure");
5551 return tcu::TestStatus::pass("Querying Vulkan 1.3 device features succeeded");
5553 #endif // CTS_USES_VULKANSC
5555 tcu::TestStatus devicePropertiesVulkan12 (Context& context)
5557 using namespace ValidateQueryBits;
5559 const QueryMemberTableEntry properties11OffsetTable[] =
5561 // VkPhysicalDeviceIDProperties
5562 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceUUID),
5563 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, driverUUID),
5564 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceLUID),
5565 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceNodeMask),
5566 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceLUIDValid),
5568 // VkPhysicalDeviceSubgroupProperties
5569 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupSize),
5570 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupSupportedStages),
5571 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupSupportedOperations),
5572 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupQuadOperationsInAllStages),
5574 // VkPhysicalDevicePointClippingProperties
5575 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, pointClippingBehavior),
5577 // VkPhysicalDeviceMultiviewProperties
5578 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxMultiviewViewCount),
5579 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxMultiviewInstanceIndex),
5581 // VkPhysicalDeviceProtectedMemoryProperties
5582 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, protectedNoFault),
5584 // VkPhysicalDeviceMaintenance3Properties
5585 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxPerSetDescriptors),
5586 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxMemoryAllocationSize),
5589 const QueryMemberTableEntry properties12OffsetTable[] =
5591 // VkPhysicalDeviceDriverProperties
5592 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, driverID),
5593 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, conformanceVersion),
5595 // VkPhysicalDeviceFloatControlsProperties
5596 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, denormBehaviorIndependence),
5597 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, roundingModeIndependence),
5598 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSignedZeroInfNanPreserveFloat16),
5599 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSignedZeroInfNanPreserveFloat32),
5600 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSignedZeroInfNanPreserveFloat64),
5601 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormPreserveFloat16),
5602 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormPreserveFloat32),
5603 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormPreserveFloat64),
5604 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormFlushToZeroFloat16),
5605 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormFlushToZeroFloat32),
5606 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormFlushToZeroFloat64),
5607 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTEFloat16),
5608 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTEFloat32),
5609 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTEFloat64),
5610 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTZFloat16),
5611 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTZFloat32),
5612 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTZFloat64),
5614 // VkPhysicalDeviceDescriptorIndexingProperties
5615 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxUpdateAfterBindDescriptorsInAllPools),
5616 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderUniformBufferArrayNonUniformIndexingNative),
5617 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSampledImageArrayNonUniformIndexingNative),
5618 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderStorageBufferArrayNonUniformIndexingNative),
5619 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderStorageImageArrayNonUniformIndexingNative),
5620 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderInputAttachmentArrayNonUniformIndexingNative),
5621 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, robustBufferAccessUpdateAfterBind),
5622 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, quadDivergentImplicitLod),
5623 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindSamplers),
5624 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindUniformBuffers),
5625 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindStorageBuffers),
5626 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindSampledImages),
5627 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindStorageImages),
5628 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindInputAttachments),
5629 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageUpdateAfterBindResources),
5630 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindSamplers),
5631 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindUniformBuffers),
5632 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindUniformBuffersDynamic),
5633 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindStorageBuffers),
5634 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindStorageBuffersDynamic),
5635 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindSampledImages),
5636 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindStorageImages),
5637 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindInputAttachments),
5639 // VkPhysicalDeviceDepthStencilResolveProperties
5640 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, supportedDepthResolveModes),
5641 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, supportedStencilResolveModes),
5642 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, independentResolveNone),
5643 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, independentResolve),
5645 // VkPhysicalDeviceSamplerFilterMinmaxProperties
5646 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, filterMinmaxSingleComponentFormats),
5647 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, filterMinmaxImageComponentMapping),
5649 // VkPhysicalDeviceTimelineSemaphoreProperties
5650 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxTimelineSemaphoreValueDifference),
5653 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, framebufferIntegerColorSampleCounts),
5656 TestLog& log = context.getTestContext().getLog();
5657 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5658 const InstanceDriver& vki = instance.getDriver();
5659 const VkPhysicalDevice physicalDevice (chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
5660 const deUint32 vulkan11PropertiesBufferSize = sizeof(VkPhysicalDeviceVulkan11Properties) + GUARD_SIZE;
5661 const deUint32 vulkan12PropertiesBufferSize = sizeof(VkPhysicalDeviceVulkan12Properties) + GUARD_SIZE;
5662 VkPhysicalDeviceProperties2 extProperties;
5663 deUint8 buffer11a[vulkan11PropertiesBufferSize];
5664 deUint8 buffer11b[vulkan11PropertiesBufferSize];
5665 deUint8 buffer12a[vulkan12PropertiesBufferSize];
5666 deUint8 buffer12b[vulkan12PropertiesBufferSize];
5667 const int count = 2u;
5668 VkPhysicalDeviceVulkan11Properties* vulkan11Properties[count] = { (VkPhysicalDeviceVulkan11Properties*)(buffer11a), (VkPhysicalDeviceVulkan11Properties*)(buffer11b)};
5669 VkPhysicalDeviceVulkan12Properties* vulkan12Properties[count] = { (VkPhysicalDeviceVulkan12Properties*)(buffer12a), (VkPhysicalDeviceVulkan12Properties*)(buffer12b)};
5671 if (!context.contextSupports(vk::ApiVersion(0, 1, 2, 0)))
5672 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
5674 deMemset(buffer11a, GUARD_VALUE, sizeof(buffer11a));
5675 deMemset(buffer11b, GUARD_VALUE, sizeof(buffer11b));
5676 deMemset(buffer12a, GUARD_VALUE, sizeof(buffer12a));
5677 deMemset(buffer12b, GUARD_VALUE, sizeof(buffer12b));
5679 for (int ndx = 0; ndx < count; ++ndx)
5681 deMemset(&extProperties.properties, 0x00, sizeof(extProperties.properties));
5682 extProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
5683 extProperties.pNext = vulkan11Properties[ndx];
5685 deMemset(vulkan11Properties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan11Properties));
5686 vulkan11Properties[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES;
5687 vulkan11Properties[ndx]->pNext = vulkan12Properties[ndx];
5689 deMemset(vulkan12Properties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan12Properties));
5690 vulkan12Properties[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES;
5691 vulkan12Properties[ndx]->pNext = DE_NULL;
5693 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5696 log << TestLog::Message << *vulkan11Properties[0] << TestLog::EndMessage;
5697 log << TestLog::Message << *vulkan12Properties[0] << TestLog::EndMessage;
5699 if (!validateStructsWithGuard(properties11OffsetTable, vulkan11Properties, GUARD_VALUE, GUARD_SIZE))
5701 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceVulkan11Properties initialization failure" << TestLog::EndMessage;
5703 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan11Properties initialization failure");
5706 if (!validateStructsWithGuard(properties12OffsetTable, vulkan12Properties, GUARD_VALUE, GUARD_SIZE) ||
5707 strncmp(vulkan12Properties[0]->driverName, vulkan12Properties[1]->driverName, VK_MAX_DRIVER_NAME_SIZE) != 0 ||
5708 strncmp(vulkan12Properties[0]->driverInfo, vulkan12Properties[1]->driverInfo, VK_MAX_DRIVER_INFO_SIZE) != 0 )
5710 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceVulkan12Properties initialization failure" << TestLog::EndMessage;
5712 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan12Properties initialization failure");
5715 return tcu::TestStatus::pass("Querying Vulkan 1.2 device properties succeeded");
5718 #ifndef CTS_USES_VULKANSC
5719 tcu::TestStatus devicePropertiesVulkan13 (Context& context)
5721 using namespace ValidateQueryBits;
5723 const QueryMemberTableEntry properties13OffsetTable[] =
5725 // VkPhysicalDeviceSubgroupSizeControlProperties
5726 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, minSubgroupSize),
5727 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxSubgroupSize),
5728 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxComputeWorkgroupSubgroups),
5729 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, requiredSubgroupSizeStages),
5731 // VkPhysicalDeviceInlineUniformBlockProperties
5732 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxInlineUniformBlockSize),
5733 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxPerStageDescriptorInlineUniformBlocks),
5734 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks),
5735 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxDescriptorSetInlineUniformBlocks),
5736 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxDescriptorSetUpdateAfterBindInlineUniformBlocks),
5739 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxInlineUniformTotalSize),
5741 // VkPhysicalDeviceShaderIntegerDotProductProperties
5742 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct8BitUnsignedAccelerated),
5743 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct8BitSignedAccelerated),
5744 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct8BitMixedSignednessAccelerated),
5745 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct4x8BitPackedUnsignedAccelerated),
5746 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct4x8BitPackedSignedAccelerated),
5747 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct4x8BitPackedMixedSignednessAccelerated),
5748 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct16BitUnsignedAccelerated),
5749 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct16BitSignedAccelerated),
5750 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct16BitMixedSignednessAccelerated),
5751 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct32BitUnsignedAccelerated),
5752 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct32BitSignedAccelerated),
5753 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct32BitMixedSignednessAccelerated),
5754 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct64BitUnsignedAccelerated),
5755 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct64BitSignedAccelerated),
5756 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProduct64BitMixedSignednessAccelerated),
5757 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating8BitUnsignedAccelerated),
5758 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating8BitSignedAccelerated),
5759 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated),
5760 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated),
5761 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated),
5762 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated),
5763 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating16BitUnsignedAccelerated),
5764 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating16BitSignedAccelerated),
5765 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated),
5766 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating32BitUnsignedAccelerated),
5767 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating32BitSignedAccelerated),
5768 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated),
5769 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating64BitUnsignedAccelerated),
5770 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating64BitSignedAccelerated),
5771 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated),
5773 // VkPhysicalDeviceTexelBufferAlignmentProperties
5774 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, storageTexelBufferOffsetAlignmentBytes),
5775 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, storageTexelBufferOffsetSingleTexelAlignment),
5776 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, uniformTexelBufferOffsetAlignmentBytes),
5777 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, uniformTexelBufferOffsetSingleTexelAlignment),
5779 // VkPhysicalDeviceMaintenance4Properties
5780 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan13Properties, maxBufferSize),
5784 TestLog& log = context.getTestContext().getLog();
5785 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
5786 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5787 const InstanceDriver& vki = instance.getDriver();
5788 const deUint32 vulkan13PropertiesBufferSize = sizeof(VkPhysicalDeviceVulkan13Properties) + GUARD_SIZE;
5789 VkPhysicalDeviceProperties2 extProperties;
5790 deUint8 buffer13a[vulkan13PropertiesBufferSize];
5791 deUint8 buffer13b[vulkan13PropertiesBufferSize];
5792 const int count = 2u;
5793 VkPhysicalDeviceVulkan13Properties* vulkan13Properties[count] = { (VkPhysicalDeviceVulkan13Properties*)(buffer13a), (VkPhysicalDeviceVulkan13Properties*)(buffer13b)};
5795 if (!context.contextSupports(vk::ApiVersion(0, 1, 3, 0)))
5796 TCU_THROW(NotSupportedError, "At least Vulkan 1.3 required to run test");
5798 deMemset(buffer13a, GUARD_VALUE, sizeof(buffer13a));
5799 deMemset(buffer13b, GUARD_VALUE, sizeof(buffer13b));
5801 for (int ndx = 0; ndx < count; ++ndx)
5803 deMemset(&extProperties.properties, 0x00, sizeof(extProperties.properties));
5804 extProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
5805 extProperties.pNext = vulkan13Properties[ndx];
5807 deMemset(vulkan13Properties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan13Properties));
5808 vulkan13Properties[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES;
5809 vulkan13Properties[ndx]->pNext = DE_NULL;
5811 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5814 log << TestLog::Message << *vulkan13Properties[0] << TestLog::EndMessage;
5816 if (!validateStructsWithGuard(properties13OffsetTable, vulkan13Properties, GUARD_VALUE, GUARD_SIZE))
5818 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceVulkan13Properties initialization failure" << TestLog::EndMessage;
5820 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan13Properties initialization failure");
5823 return tcu::TestStatus::pass("Querying Vulkan 1.3 device properties succeeded");
5825 #endif // CTS_USES_VULKANSC
5827 tcu::TestStatus deviceFeatureExtensionsConsistencyVulkan12(Context& context)
5829 TestLog& log = context.getTestContext().getLog();
5830 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5831 const InstanceDriver& vki = instance.getDriver();
5832 const VkPhysicalDevice physicalDevice (chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
5834 if (!context.contextSupports(vk::ApiVersion(0, 1, 2, 0)))
5835 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
5837 VkPhysicalDeviceVulkan12Features vulkan12Features = initVulkanStructure();
5838 VkPhysicalDeviceVulkan11Features vulkan11Features = initVulkanStructure(&vulkan12Features);
5839 VkPhysicalDeviceFeatures2 extFeatures = initVulkanStructure(&vulkan11Features);
5841 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
5843 log << TestLog::Message << vulkan11Features << TestLog::EndMessage;
5844 log << TestLog::Message << vulkan12Features << TestLog::EndMessage;
5846 // Validate if proper VkPhysicalDeviceVulkanXXFeatures fields are set when corresponding extensions are present
5847 std::pair<std::pair<const char*,const char*>, VkBool32> extensions2validate[] =
5849 { { "VK_KHR_sampler_mirror_clamp_to_edge", "VkPhysicalDeviceVulkan12Features.samplerMirrorClampToEdge" }, vulkan12Features.samplerMirrorClampToEdge },
5850 { { "VK_KHR_draw_indirect_count", "VkPhysicalDeviceVulkan12Features.drawIndirectCount" }, vulkan12Features.drawIndirectCount },
5851 { { "VK_EXT_descriptor_indexing", "VkPhysicalDeviceVulkan12Features.descriptorIndexing" }, vulkan12Features.descriptorIndexing },
5852 { { "VK_EXT_sampler_filter_minmax", "VkPhysicalDeviceVulkan12Features.samplerFilterMinmax" }, vulkan12Features.samplerFilterMinmax },
5853 { { "VK_EXT_shader_viewport_index_layer", "VkPhysicalDeviceVulkan12Features.shaderOutputViewportIndex" }, vulkan12Features.shaderOutputViewportIndex },
5854 { { "VK_EXT_shader_viewport_index_layer", "VkPhysicalDeviceVulkan12Features.shaderOutputLayer" }, vulkan12Features.shaderOutputLayer }
5856 vector<VkExtensionProperties> extensionProperties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
5857 for (const auto& ext : extensions2validate)
5858 if (checkExtension(extensionProperties, ext.first.first) && !ext.second)
5859 TCU_FAIL(string("Mismatch between extension ") + ext.first.first + " and " + ext.first.second);
5861 // collect all extension features
5863 VkPhysicalDevice16BitStorageFeatures device16BitStorageFeatures = initVulkanStructure();
5864 VkPhysicalDeviceMultiviewFeatures deviceMultiviewFeatures = initVulkanStructure(&device16BitStorageFeatures);
5865 VkPhysicalDeviceProtectedMemoryFeatures protectedMemoryFeatures = initVulkanStructure(&deviceMultiviewFeatures);
5866 VkPhysicalDeviceSamplerYcbcrConversionFeatures samplerYcbcrConversionFeatures = initVulkanStructure(&protectedMemoryFeatures);
5867 VkPhysicalDeviceShaderDrawParametersFeatures shaderDrawParametersFeatures = initVulkanStructure(&samplerYcbcrConversionFeatures);
5868 VkPhysicalDeviceVariablePointersFeatures variablePointerFeatures = initVulkanStructure(&shaderDrawParametersFeatures);
5869 VkPhysicalDevice8BitStorageFeatures device8BitStorageFeatures = initVulkanStructure(&variablePointerFeatures);
5870 VkPhysicalDeviceShaderAtomicInt64Features shaderAtomicInt64Features = initVulkanStructure(&device8BitStorageFeatures);
5871 VkPhysicalDeviceShaderFloat16Int8Features shaderFloat16Int8Features = initVulkanStructure(&shaderAtomicInt64Features);
5872 VkPhysicalDeviceDescriptorIndexingFeatures descriptorIndexingFeatures = initVulkanStructure(&shaderFloat16Int8Features);
5873 VkPhysicalDeviceScalarBlockLayoutFeatures scalarBlockLayoutFeatures = initVulkanStructure(&descriptorIndexingFeatures);
5874 VkPhysicalDeviceImagelessFramebufferFeatures imagelessFramebufferFeatures = initVulkanStructure(&scalarBlockLayoutFeatures);
5875 VkPhysicalDeviceUniformBufferStandardLayoutFeatures uniformBufferStandardLayoutFeatures = initVulkanStructure(&imagelessFramebufferFeatures);
5876 VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures shaderSubgroupExtendedTypesFeatures = initVulkanStructure(&uniformBufferStandardLayoutFeatures);
5877 VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures separateDepthStencilLayoutsFeatures = initVulkanStructure(&shaderSubgroupExtendedTypesFeatures);
5878 VkPhysicalDeviceHostQueryResetFeatures hostQueryResetFeatures = initVulkanStructure(&separateDepthStencilLayoutsFeatures);
5879 VkPhysicalDeviceTimelineSemaphoreFeatures timelineSemaphoreFeatures = initVulkanStructure(&hostQueryResetFeatures);
5880 VkPhysicalDeviceBufferDeviceAddressFeatures bufferDeviceAddressFeatures = initVulkanStructure(&timelineSemaphoreFeatures);
5881 VkPhysicalDeviceVulkanMemoryModelFeatures vulkanMemoryModelFeatures = initVulkanStructure(&bufferDeviceAddressFeatures);
5882 extFeatures = initVulkanStructure(&vulkanMemoryModelFeatures);
5884 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
5886 log << TestLog::Message << extFeatures << TestLog::EndMessage;
5887 log << TestLog::Message << device16BitStorageFeatures << TestLog::EndMessage;
5888 log << TestLog::Message << deviceMultiviewFeatures << TestLog::EndMessage;
5889 log << TestLog::Message << protectedMemoryFeatures << TestLog::EndMessage;
5890 log << TestLog::Message << samplerYcbcrConversionFeatures << TestLog::EndMessage;
5891 log << TestLog::Message << shaderDrawParametersFeatures << TestLog::EndMessage;
5892 log << TestLog::Message << variablePointerFeatures << TestLog::EndMessage;
5893 log << TestLog::Message << device8BitStorageFeatures << TestLog::EndMessage;
5894 log << TestLog::Message << shaderAtomicInt64Features << TestLog::EndMessage;
5895 log << TestLog::Message << shaderFloat16Int8Features << TestLog::EndMessage;
5896 log << TestLog::Message << descriptorIndexingFeatures << TestLog::EndMessage;
5897 log << TestLog::Message << scalarBlockLayoutFeatures << TestLog::EndMessage;
5898 log << TestLog::Message << imagelessFramebufferFeatures << TestLog::EndMessage;
5899 log << TestLog::Message << uniformBufferStandardLayoutFeatures << TestLog::EndMessage;
5900 log << TestLog::Message << shaderSubgroupExtendedTypesFeatures << TestLog::EndMessage;
5901 log << TestLog::Message << separateDepthStencilLayoutsFeatures << TestLog::EndMessage;
5902 log << TestLog::Message << hostQueryResetFeatures << TestLog::EndMessage;
5903 log << TestLog::Message << timelineSemaphoreFeatures << TestLog::EndMessage;
5904 log << TestLog::Message << bufferDeviceAddressFeatures << TestLog::EndMessage;
5905 log << TestLog::Message << vulkanMemoryModelFeatures << TestLog::EndMessage;
5907 if (( device16BitStorageFeatures.storageBuffer16BitAccess != vulkan11Features.storageBuffer16BitAccess ||
5908 device16BitStorageFeatures.uniformAndStorageBuffer16BitAccess != vulkan11Features.uniformAndStorageBuffer16BitAccess ||
5909 device16BitStorageFeatures.storagePushConstant16 != vulkan11Features.storagePushConstant16 ||
5910 device16BitStorageFeatures.storageInputOutput16 != vulkan11Features.storageInputOutput16 ))
5912 TCU_FAIL("Mismatch between VkPhysicalDevice16BitStorageFeatures and VkPhysicalDeviceVulkan11Features");
5915 if (( deviceMultiviewFeatures.multiview != vulkan11Features.multiview ||
5916 deviceMultiviewFeatures.multiviewGeometryShader != vulkan11Features.multiviewGeometryShader ||
5917 deviceMultiviewFeatures.multiviewTessellationShader != vulkan11Features.multiviewTessellationShader ))
5919 TCU_FAIL("Mismatch between VkPhysicalDeviceMultiviewFeatures and VkPhysicalDeviceVulkan11Features");
5922 if ( (protectedMemoryFeatures.protectedMemory != vulkan11Features.protectedMemory ))
5924 TCU_FAIL("Mismatch between VkPhysicalDeviceProtectedMemoryFeatures and VkPhysicalDeviceVulkan11Features");
5927 if ( (samplerYcbcrConversionFeatures.samplerYcbcrConversion != vulkan11Features.samplerYcbcrConversion ))
5929 TCU_FAIL("Mismatch between VkPhysicalDeviceSamplerYcbcrConversionFeatures and VkPhysicalDeviceVulkan11Features");
5932 if ( (shaderDrawParametersFeatures.shaderDrawParameters != vulkan11Features.shaderDrawParameters ))
5934 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderDrawParametersFeatures and VkPhysicalDeviceVulkan11Features");
5937 if (( variablePointerFeatures.variablePointersStorageBuffer != vulkan11Features.variablePointersStorageBuffer ||
5938 variablePointerFeatures.variablePointers != vulkan11Features.variablePointers))
5940 TCU_FAIL("Mismatch between VkPhysicalDeviceVariablePointersFeatures and VkPhysicalDeviceVulkan11Features");
5943 if (( device8BitStorageFeatures.storageBuffer8BitAccess != vulkan12Features.storageBuffer8BitAccess ||
5944 device8BitStorageFeatures.uniformAndStorageBuffer8BitAccess != vulkan12Features.uniformAndStorageBuffer8BitAccess ||
5945 device8BitStorageFeatures.storagePushConstant8 != vulkan12Features.storagePushConstant8 ))
5947 TCU_FAIL("Mismatch between VkPhysicalDevice8BitStorageFeatures and VkPhysicalDeviceVulkan12Features");
5950 if (( shaderAtomicInt64Features.shaderBufferInt64Atomics != vulkan12Features.shaderBufferInt64Atomics ||
5951 shaderAtomicInt64Features.shaderSharedInt64Atomics != vulkan12Features.shaderSharedInt64Atomics ))
5953 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderAtomicInt64Features and VkPhysicalDeviceVulkan12Features");
5956 if (( shaderFloat16Int8Features.shaderFloat16 != vulkan12Features.shaderFloat16 ||
5957 shaderFloat16Int8Features.shaderInt8 != vulkan12Features.shaderInt8 ))
5959 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderFloat16Int8Features and VkPhysicalDeviceVulkan12Features");
5962 if ((vulkan12Features.descriptorIndexing) &&
5963 ( descriptorIndexingFeatures.shaderInputAttachmentArrayDynamicIndexing != vulkan12Features.shaderInputAttachmentArrayDynamicIndexing ||
5964 descriptorIndexingFeatures.shaderUniformTexelBufferArrayDynamicIndexing != vulkan12Features.shaderUniformTexelBufferArrayDynamicIndexing ||
5965 descriptorIndexingFeatures.shaderStorageTexelBufferArrayDynamicIndexing != vulkan12Features.shaderStorageTexelBufferArrayDynamicIndexing ||
5966 descriptorIndexingFeatures.shaderUniformBufferArrayNonUniformIndexing != vulkan12Features.shaderUniformBufferArrayNonUniformIndexing ||
5967 descriptorIndexingFeatures.shaderSampledImageArrayNonUniformIndexing != vulkan12Features.shaderSampledImageArrayNonUniformIndexing ||
5968 descriptorIndexingFeatures.shaderStorageBufferArrayNonUniformIndexing != vulkan12Features.shaderStorageBufferArrayNonUniformIndexing ||
5969 descriptorIndexingFeatures.shaderStorageImageArrayNonUniformIndexing != vulkan12Features.shaderStorageImageArrayNonUniformIndexing ||
5970 descriptorIndexingFeatures.shaderInputAttachmentArrayNonUniformIndexing != vulkan12Features.shaderInputAttachmentArrayNonUniformIndexing ||
5971 descriptorIndexingFeatures.shaderUniformTexelBufferArrayNonUniformIndexing != vulkan12Features.shaderUniformTexelBufferArrayNonUniformIndexing ||
5972 descriptorIndexingFeatures.shaderStorageTexelBufferArrayNonUniformIndexing != vulkan12Features.shaderStorageTexelBufferArrayNonUniformIndexing ||
5973 descriptorIndexingFeatures.descriptorBindingUniformBufferUpdateAfterBind != vulkan12Features.descriptorBindingUniformBufferUpdateAfterBind ||
5974 descriptorIndexingFeatures.descriptorBindingSampledImageUpdateAfterBind != vulkan12Features.descriptorBindingSampledImageUpdateAfterBind ||
5975 descriptorIndexingFeatures.descriptorBindingStorageImageUpdateAfterBind != vulkan12Features.descriptorBindingStorageImageUpdateAfterBind ||
5976 descriptorIndexingFeatures.descriptorBindingStorageBufferUpdateAfterBind != vulkan12Features.descriptorBindingStorageBufferUpdateAfterBind ||
5977 descriptorIndexingFeatures.descriptorBindingUniformTexelBufferUpdateAfterBind != vulkan12Features.descriptorBindingUniformTexelBufferUpdateAfterBind ||
5978 descriptorIndexingFeatures.descriptorBindingStorageTexelBufferUpdateAfterBind != vulkan12Features.descriptorBindingStorageTexelBufferUpdateAfterBind ||
5979 descriptorIndexingFeatures.descriptorBindingUpdateUnusedWhilePending != vulkan12Features.descriptorBindingUpdateUnusedWhilePending ||
5980 descriptorIndexingFeatures.descriptorBindingPartiallyBound != vulkan12Features.descriptorBindingPartiallyBound ||
5981 descriptorIndexingFeatures.descriptorBindingVariableDescriptorCount != vulkan12Features.descriptorBindingVariableDescriptorCount ||
5982 descriptorIndexingFeatures.runtimeDescriptorArray != vulkan12Features.runtimeDescriptorArray ))
5984 TCU_FAIL("Mismatch between VkPhysicalDeviceDescriptorIndexingFeatures and VkPhysicalDeviceVulkan12Features");
5987 if (( scalarBlockLayoutFeatures.scalarBlockLayout != vulkan12Features.scalarBlockLayout ))
5989 TCU_FAIL("Mismatch between VkPhysicalDeviceScalarBlockLayoutFeatures and VkPhysicalDeviceVulkan12Features");
5992 if (( imagelessFramebufferFeatures.imagelessFramebuffer != vulkan12Features.imagelessFramebuffer ))
5994 TCU_FAIL("Mismatch between VkPhysicalDeviceImagelessFramebufferFeatures and VkPhysicalDeviceVulkan12Features");
5997 if (( uniformBufferStandardLayoutFeatures.uniformBufferStandardLayout != vulkan12Features.uniformBufferStandardLayout ))
5999 TCU_FAIL("Mismatch between VkPhysicalDeviceUniformBufferStandardLayoutFeatures and VkPhysicalDeviceVulkan12Features");
6002 if (( shaderSubgroupExtendedTypesFeatures.shaderSubgroupExtendedTypes != vulkan12Features.shaderSubgroupExtendedTypes ))
6004 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures and VkPhysicalDeviceVulkan12Features");
6007 if (( separateDepthStencilLayoutsFeatures.separateDepthStencilLayouts != vulkan12Features.separateDepthStencilLayouts ))
6009 TCU_FAIL("Mismatch between VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures and VkPhysicalDeviceVulkan12Features");
6012 if (( hostQueryResetFeatures.hostQueryReset != vulkan12Features.hostQueryReset ))
6014 TCU_FAIL("Mismatch between VkPhysicalDeviceHostQueryResetFeatures and VkPhysicalDeviceVulkan12Features");
6017 if (( timelineSemaphoreFeatures.timelineSemaphore != vulkan12Features.timelineSemaphore ))
6019 TCU_FAIL("Mismatch between VkPhysicalDeviceTimelineSemaphoreFeatures and VkPhysicalDeviceVulkan12Features");
6022 if (( bufferDeviceAddressFeatures.bufferDeviceAddress != vulkan12Features.bufferDeviceAddress ||
6023 bufferDeviceAddressFeatures.bufferDeviceAddressCaptureReplay != vulkan12Features.bufferDeviceAddressCaptureReplay ||
6024 bufferDeviceAddressFeatures.bufferDeviceAddressMultiDevice != vulkan12Features.bufferDeviceAddressMultiDevice ))
6026 TCU_FAIL("Mismatch between VkPhysicalDeviceBufferDeviceAddressFeatures and VkPhysicalDeviceVulkan12Features");
6029 if (( vulkanMemoryModelFeatures.vulkanMemoryModel != vulkan12Features.vulkanMemoryModel ||
6030 vulkanMemoryModelFeatures.vulkanMemoryModelDeviceScope != vulkan12Features.vulkanMemoryModelDeviceScope ||
6031 vulkanMemoryModelFeatures.vulkanMemoryModelAvailabilityVisibilityChains != vulkan12Features.vulkanMemoryModelAvailabilityVisibilityChains ))
6033 TCU_FAIL("Mismatch between VkPhysicalDeviceVulkanMemoryModelFeatures and VkPhysicalDeviceVulkan12Features");
6037 return tcu::TestStatus::pass("Vulkan 1.2 device features are consistent with extensions");
6040 #ifndef CTS_USES_VULKANSC
6041 tcu::TestStatus deviceFeatureExtensionsConsistencyVulkan13(Context& context)
6043 TestLog& log = context.getTestContext().getLog();
6044 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
6045 const CustomInstance instance = createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2");
6046 const InstanceDriver& vki = instance.getDriver();
6048 if (!context.contextSupports(vk::ApiVersion(0, 1, 3, 0)))
6049 TCU_THROW(NotSupportedError, "At least Vulkan 1.3 required to run test");
6051 VkPhysicalDeviceVulkan13Features vulkan13Features = initVulkanStructure();
6052 VkPhysicalDeviceFeatures2 extFeatures = initVulkanStructure(&vulkan13Features);
6054 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
6056 log << TestLog::Message << vulkan13Features << TestLog::EndMessage;
6058 // Validate if required VkPhysicalDeviceVulkan13Features fields are set
6059 std::pair<const char*, VkBool32> features2validate[]
6061 { { "VkPhysicalDeviceVulkan13Features.robustImageAccess" }, vulkan13Features.robustImageAccess },
6062 { { "VkPhysicalDeviceVulkan13Features.inlineUniformBlock" }, vulkan13Features.inlineUniformBlock },
6063 { { "VkPhysicalDeviceVulkan13Features.pipelineCreationCacheControl" }, vulkan13Features.pipelineCreationCacheControl },
6064 { { "VkPhysicalDeviceVulkan13Features.privateData" }, vulkan13Features.privateData },
6065 { { "VkPhysicalDeviceVulkan13Features.shaderDemoteToHelperInvocation" }, vulkan13Features.shaderDemoteToHelperInvocation },
6066 { { "VkPhysicalDeviceVulkan13Features.shaderTerminateInvocation" }, vulkan13Features.shaderTerminateInvocation },
6067 { { "VkPhysicalDeviceVulkan13Features.subgroupSizeControl" }, vulkan13Features.subgroupSizeControl },
6068 { { "VkPhysicalDeviceVulkan13Features.computeFullSubgroups" }, vulkan13Features.computeFullSubgroups },
6069 { { "VkPhysicalDeviceVulkan13Features.synchronization2" }, vulkan13Features.synchronization2 },
6070 { { "VkPhysicalDeviceVulkan13Features.shaderZeroInitializeWorkgroupMemory" }, vulkan13Features.shaderZeroInitializeWorkgroupMemory },
6071 { { "VkPhysicalDeviceVulkan13Features.dynamicRendering" }, vulkan13Features.dynamicRendering },
6072 { { "VkPhysicalDeviceVulkan13Features.shaderIntegerDotProduct" }, vulkan13Features.shaderIntegerDotProduct },
6073 { { "VkPhysicalDeviceVulkan13Features.maintenance4" }, vulkan13Features.maintenance4 },
6075 for (const auto& feature : features2validate)
6077 if (!feature.second)
6078 TCU_FAIL(string("Required feature ") + feature.first + " is not set");
6081 // collect all extension features
6083 VkPhysicalDeviceImageRobustnessFeatures imageRobustnessFeatures = initVulkanStructure();
6084 VkPhysicalDeviceInlineUniformBlockFeatures inlineUniformBlockFeatures = initVulkanStructure(&imageRobustnessFeatures);
6085 VkPhysicalDevicePipelineCreationCacheControlFeatures pipelineCreationCacheControlFeatures = initVulkanStructure(&inlineUniformBlockFeatures);
6086 VkPhysicalDevicePrivateDataFeatures privateDataFeatures = initVulkanStructure(&pipelineCreationCacheControlFeatures);
6087 VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures shaderDemoteToHelperInvocationFeatures = initVulkanStructure(&privateDataFeatures);
6088 VkPhysicalDeviceShaderTerminateInvocationFeatures shaderTerminateInvocationFeatures = initVulkanStructure(&shaderDemoteToHelperInvocationFeatures);
6089 VkPhysicalDeviceSubgroupSizeControlFeatures subgroupSizeControlFeatures = initVulkanStructure(&shaderTerminateInvocationFeatures);
6090 VkPhysicalDeviceSynchronization2Features synchronization2Features = initVulkanStructure(&subgroupSizeControlFeatures);
6091 VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures zeroInitializeWorkgroupMemoryFeatures = initVulkanStructure(&synchronization2Features);
6092 VkPhysicalDeviceDynamicRenderingFeatures dynamicRenderingFeatures = initVulkanStructure(&zeroInitializeWorkgroupMemoryFeatures);
6093 VkPhysicalDeviceShaderIntegerDotProductFeatures shaderIntegerDotProductFeatures = initVulkanStructure(&dynamicRenderingFeatures);
6094 VkPhysicalDeviceMaintenance4Features maintenance4Features = initVulkanStructure(&shaderIntegerDotProductFeatures);
6096 // those two structures are part of extensions promoted in vk1.2 but now in 1.3 have required features
6097 VkPhysicalDeviceVulkanMemoryModelFeatures vulkanMemoryModelFeatures = initVulkanStructure(&maintenance4Features);
6098 VkPhysicalDeviceBufferDeviceAddressFeatures bufferDeviceAddressFeatures = initVulkanStructure(&vulkanMemoryModelFeatures);
6100 extFeatures = initVulkanStructure(&bufferDeviceAddressFeatures);
6102 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
6104 log << TestLog::Message << extFeatures << TestLog::EndMessage;
6105 log << TestLog::Message << imageRobustnessFeatures << TestLog::EndMessage;
6106 log << TestLog::Message << inlineUniformBlockFeatures << TestLog::EndMessage;
6107 log << TestLog::Message << pipelineCreationCacheControlFeatures << TestLog::EndMessage;
6108 log << TestLog::Message << privateDataFeatures << TestLog::EndMessage;
6109 log << TestLog::Message << shaderDemoteToHelperInvocationFeatures << TestLog::EndMessage;
6110 log << TestLog::Message << shaderTerminateInvocationFeatures << TestLog::EndMessage;
6111 log << TestLog::Message << subgroupSizeControlFeatures << TestLog::EndMessage;
6112 log << TestLog::Message << synchronization2Features << TestLog::EndMessage;
6113 log << TestLog::Message << zeroInitializeWorkgroupMemoryFeatures << TestLog::EndMessage;
6114 log << TestLog::Message << dynamicRenderingFeatures << TestLog::EndMessage;
6115 log << TestLog::Message << shaderIntegerDotProductFeatures << TestLog::EndMessage;
6116 log << TestLog::Message << maintenance4Features << TestLog::EndMessage;
6118 if (imageRobustnessFeatures.robustImageAccess != vulkan13Features.robustImageAccess)
6119 TCU_FAIL("Mismatch between VkPhysicalDeviceImageRobustnessFeatures and VkPhysicalDeviceVulkan13Features");
6121 if ((inlineUniformBlockFeatures.inlineUniformBlock != vulkan13Features.inlineUniformBlock) ||
6122 (inlineUniformBlockFeatures.descriptorBindingInlineUniformBlockUpdateAfterBind != vulkan13Features.descriptorBindingInlineUniformBlockUpdateAfterBind))
6124 TCU_FAIL("Mismatch between VkPhysicalDeviceInlineUniformBlockFeatures and VkPhysicalDeviceVulkan13Features");
6127 if (pipelineCreationCacheControlFeatures.pipelineCreationCacheControl != vulkan13Features.pipelineCreationCacheControl)
6128 TCU_FAIL("Mismatch between VkPhysicalDevicePipelineCreationCacheControlFeatures and VkPhysicalDeviceVulkan13Features");
6130 if (privateDataFeatures.privateData != vulkan13Features.privateData)
6131 TCU_FAIL("Mismatch between VkPhysicalDevicePrivateDataFeatures and VkPhysicalDeviceVulkan13Features");
6133 if (shaderDemoteToHelperInvocationFeatures.shaderDemoteToHelperInvocation != vulkan13Features.shaderDemoteToHelperInvocation)
6134 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures and VkPhysicalDeviceVulkan13Features");
6136 if (shaderTerminateInvocationFeatures.shaderTerminateInvocation != vulkan13Features.shaderTerminateInvocation)
6137 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderTerminateInvocationFeatures and VkPhysicalDeviceVulkan13Features");
6139 if ((subgroupSizeControlFeatures.subgroupSizeControl != vulkan13Features.subgroupSizeControl) ||
6140 (subgroupSizeControlFeatures.computeFullSubgroups != vulkan13Features.computeFullSubgroups))
6142 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupSizeControlFeatures and VkPhysicalDeviceVulkan13Features");
6145 if (synchronization2Features.synchronization2 != vulkan13Features.synchronization2)
6146 TCU_FAIL("Mismatch between VkPhysicalDeviceSynchronization2Features and VkPhysicalDeviceVulkan13Features");
6148 if (zeroInitializeWorkgroupMemoryFeatures.shaderZeroInitializeWorkgroupMemory != vulkan13Features.shaderZeroInitializeWorkgroupMemory)
6149 TCU_FAIL("Mismatch between VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures and VkPhysicalDeviceVulkan13Features");
6151 if (dynamicRenderingFeatures.dynamicRendering != vulkan13Features.dynamicRendering)
6152 TCU_FAIL("Mismatch between VkPhysicalDeviceDynamicRenderingFeatures and VkPhysicalDeviceVulkan13Features");
6154 if (shaderIntegerDotProductFeatures.shaderIntegerDotProduct != vulkan13Features.shaderIntegerDotProduct)
6155 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderIntegerDotProductFeatures and VkPhysicalDeviceVulkan13Features");
6157 if (maintenance4Features.maintenance4 != vulkan13Features.maintenance4)
6158 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance4Features and VkPhysicalDeviceVulkan13Features");
6160 // check required features from extensions that were promoted in earlier vulkan version
6161 if (!vulkanMemoryModelFeatures.vulkanMemoryModel)
6162 TCU_FAIL("vulkanMemoryModel feature from VkPhysicalDeviceVulkanMemoryModelFeatures is required");
6163 if (!vulkanMemoryModelFeatures.vulkanMemoryModelDeviceScope)
6164 TCU_FAIL("vulkanMemoryModelDeviceScope feature from VkPhysicalDeviceVulkanMemoryModelFeatures is required");
6165 if (!bufferDeviceAddressFeatures.bufferDeviceAddress)
6166 TCU_FAIL("bufferDeviceAddress feature from VkPhysicalDeviceBufferDeviceAddressFeatures is required");
6169 return tcu::TestStatus::pass("Vulkan 1.3 device features are consistent with extensions");
6171 #endif // CTS_USES_VULKANSC
6173 tcu::TestStatus devicePropertyExtensionsConsistencyVulkan12(Context& context)
6175 TestLog& log = context.getTestContext().getLog();
6176 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
6177 const InstanceDriver& vki = instance.getDriver();
6178 const VkPhysicalDevice physicalDevice (chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
6180 if (!context.contextSupports(vk::ApiVersion(0, 1, 2, 0)))
6181 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
6183 VkPhysicalDeviceVulkan12Properties vulkan12Properties = initVulkanStructure();
6184 VkPhysicalDeviceVulkan11Properties vulkan11Properties = initVulkanStructure(&vulkan12Properties);
6185 VkPhysicalDeviceProperties2 extProperties = initVulkanStructure(&vulkan11Properties);
6187 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
6189 log << TestLog::Message << vulkan11Properties << TestLog::EndMessage;
6190 log << TestLog::Message << vulkan12Properties << TestLog::EndMessage;
6192 // Validate all fields initialized matching to extension structures
6194 VkPhysicalDeviceIDProperties idProperties = initVulkanStructure();
6195 VkPhysicalDeviceSubgroupProperties subgroupProperties = initVulkanStructure(&idProperties);
6196 VkPhysicalDevicePointClippingProperties pointClippingProperties = initVulkanStructure(&subgroupProperties);
6197 VkPhysicalDeviceMultiviewProperties multiviewProperties = initVulkanStructure(&pointClippingProperties);
6198 VkPhysicalDeviceProtectedMemoryProperties protectedMemoryPropertiesKHR = initVulkanStructure(&multiviewProperties);
6199 VkPhysicalDeviceMaintenance3Properties maintenance3Properties = initVulkanStructure(&protectedMemoryPropertiesKHR);
6200 VkPhysicalDeviceDriverProperties driverProperties = initVulkanStructure(&maintenance3Properties);
6201 VkPhysicalDeviceFloatControlsProperties floatControlsProperties = initVulkanStructure(&driverProperties);
6202 VkPhysicalDeviceDescriptorIndexingProperties descriptorIndexingProperties = initVulkanStructure(&floatControlsProperties);
6203 VkPhysicalDeviceDepthStencilResolveProperties depthStencilResolveProperties = initVulkanStructure(&descriptorIndexingProperties);
6204 VkPhysicalDeviceSamplerFilterMinmaxProperties samplerFilterMinmaxProperties = initVulkanStructure(&depthStencilResolveProperties);
6205 VkPhysicalDeviceTimelineSemaphoreProperties timelineSemaphoreProperties = initVulkanStructure(&samplerFilterMinmaxProperties);
6206 extProperties = initVulkanStructure(&timelineSemaphoreProperties);
6208 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
6210 if ((deMemCmp(idProperties.deviceUUID, vulkan11Properties.deviceUUID, VK_UUID_SIZE) != 0) ||
6211 (deMemCmp(idProperties.driverUUID, vulkan11Properties.driverUUID, VK_UUID_SIZE) != 0) ||
6212 (idProperties.deviceLUIDValid != vulkan11Properties.deviceLUIDValid))
6214 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties and VkPhysicalDeviceVulkan11Properties");
6216 else if (idProperties.deviceLUIDValid)
6218 // If deviceLUIDValid is VK_FALSE, the contents of deviceLUID and deviceNodeMask are undefined
6219 // so thay can only be compared when deviceLUIDValid is VK_TRUE.
6220 if ((deMemCmp(idProperties.deviceLUID, vulkan11Properties.deviceLUID, VK_LUID_SIZE) != 0) ||
6221 (idProperties.deviceNodeMask != vulkan11Properties.deviceNodeMask))
6223 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties and VkPhysicalDeviceVulkan11Properties");
6227 if ((subgroupProperties.subgroupSize != vulkan11Properties.subgroupSize ||
6228 subgroupProperties.supportedStages != vulkan11Properties.subgroupSupportedStages ||
6229 subgroupProperties.supportedOperations != vulkan11Properties.subgroupSupportedOperations ||
6230 subgroupProperties.quadOperationsInAllStages != vulkan11Properties.subgroupQuadOperationsInAllStages))
6232 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupProperties and VkPhysicalDeviceVulkan11Properties");
6235 if ((pointClippingProperties.pointClippingBehavior != vulkan11Properties.pointClippingBehavior))
6237 TCU_FAIL("Mismatch between VkPhysicalDevicePointClippingProperties and VkPhysicalDeviceVulkan11Properties");
6240 if ((multiviewProperties.maxMultiviewViewCount != vulkan11Properties.maxMultiviewViewCount ||
6241 multiviewProperties.maxMultiviewInstanceIndex != vulkan11Properties.maxMultiviewInstanceIndex))
6243 TCU_FAIL("Mismatch between VkPhysicalDeviceMultiviewProperties and VkPhysicalDeviceVulkan11Properties");
6246 if ((protectedMemoryPropertiesKHR.protectedNoFault != vulkan11Properties.protectedNoFault))
6248 TCU_FAIL("Mismatch between VkPhysicalDeviceProtectedMemoryProperties and VkPhysicalDeviceVulkan11Properties");
6251 if ((maintenance3Properties.maxPerSetDescriptors != vulkan11Properties.maxPerSetDescriptors ||
6252 maintenance3Properties.maxMemoryAllocationSize != vulkan11Properties.maxMemoryAllocationSize))
6254 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance3Properties and VkPhysicalDeviceVulkan11Properties");
6257 if ((driverProperties.driverID != vulkan12Properties.driverID ||
6258 strncmp(driverProperties.driverName, vulkan12Properties.driverName, VK_MAX_DRIVER_NAME_SIZE) != 0 ||
6259 strncmp(driverProperties.driverInfo, vulkan12Properties.driverInfo, VK_MAX_DRIVER_INFO_SIZE) != 0 ||
6260 driverProperties.conformanceVersion.major != vulkan12Properties.conformanceVersion.major ||
6261 driverProperties.conformanceVersion.minor != vulkan12Properties.conformanceVersion.minor ||
6262 driverProperties.conformanceVersion.subminor != vulkan12Properties.conformanceVersion.subminor ||
6263 driverProperties.conformanceVersion.patch != vulkan12Properties.conformanceVersion.patch))
6265 TCU_FAIL("Mismatch between VkPhysicalDeviceDriverProperties and VkPhysicalDeviceVulkan12Properties");
6268 if ((floatControlsProperties.denormBehaviorIndependence != vulkan12Properties.denormBehaviorIndependence ||
6269 floatControlsProperties.roundingModeIndependence != vulkan12Properties.roundingModeIndependence ||
6270 floatControlsProperties.shaderSignedZeroInfNanPreserveFloat16 != vulkan12Properties.shaderSignedZeroInfNanPreserveFloat16 ||
6271 floatControlsProperties.shaderSignedZeroInfNanPreserveFloat32 != vulkan12Properties.shaderSignedZeroInfNanPreserveFloat32 ||
6272 floatControlsProperties.shaderSignedZeroInfNanPreserveFloat64 != vulkan12Properties.shaderSignedZeroInfNanPreserveFloat64 ||
6273 floatControlsProperties.shaderDenormPreserveFloat16 != vulkan12Properties.shaderDenormPreserveFloat16 ||
6274 floatControlsProperties.shaderDenormPreserveFloat32 != vulkan12Properties.shaderDenormPreserveFloat32 ||
6275 floatControlsProperties.shaderDenormPreserveFloat64 != vulkan12Properties.shaderDenormPreserveFloat64 ||
6276 floatControlsProperties.shaderDenormFlushToZeroFloat16 != vulkan12Properties.shaderDenormFlushToZeroFloat16 ||
6277 floatControlsProperties.shaderDenormFlushToZeroFloat32 != vulkan12Properties.shaderDenormFlushToZeroFloat32 ||
6278 floatControlsProperties.shaderDenormFlushToZeroFloat64 != vulkan12Properties.shaderDenormFlushToZeroFloat64 ||
6279 floatControlsProperties.shaderRoundingModeRTEFloat16 != vulkan12Properties.shaderRoundingModeRTEFloat16 ||
6280 floatControlsProperties.shaderRoundingModeRTEFloat32 != vulkan12Properties.shaderRoundingModeRTEFloat32 ||
6281 floatControlsProperties.shaderRoundingModeRTEFloat64 != vulkan12Properties.shaderRoundingModeRTEFloat64 ||
6282 floatControlsProperties.shaderRoundingModeRTZFloat16 != vulkan12Properties.shaderRoundingModeRTZFloat16 ||
6283 floatControlsProperties.shaderRoundingModeRTZFloat32 != vulkan12Properties.shaderRoundingModeRTZFloat32 ||
6284 floatControlsProperties.shaderRoundingModeRTZFloat64 != vulkan12Properties.shaderRoundingModeRTZFloat64 ))
6286 TCU_FAIL("Mismatch between VkPhysicalDeviceFloatControlsProperties and VkPhysicalDeviceVulkan12Properties");
6289 if ((descriptorIndexingProperties.maxUpdateAfterBindDescriptorsInAllPools != vulkan12Properties.maxUpdateAfterBindDescriptorsInAllPools ||
6290 descriptorIndexingProperties.shaderUniformBufferArrayNonUniformIndexingNative != vulkan12Properties.shaderUniformBufferArrayNonUniformIndexingNative ||
6291 descriptorIndexingProperties.shaderSampledImageArrayNonUniformIndexingNative != vulkan12Properties.shaderSampledImageArrayNonUniformIndexingNative ||
6292 descriptorIndexingProperties.shaderStorageBufferArrayNonUniformIndexingNative != vulkan12Properties.shaderStorageBufferArrayNonUniformIndexingNative ||
6293 descriptorIndexingProperties.shaderStorageImageArrayNonUniformIndexingNative != vulkan12Properties.shaderStorageImageArrayNonUniformIndexingNative ||
6294 descriptorIndexingProperties.shaderInputAttachmentArrayNonUniformIndexingNative != vulkan12Properties.shaderInputAttachmentArrayNonUniformIndexingNative ||
6295 descriptorIndexingProperties.robustBufferAccessUpdateAfterBind != vulkan12Properties.robustBufferAccessUpdateAfterBind ||
6296 descriptorIndexingProperties.quadDivergentImplicitLod != vulkan12Properties.quadDivergentImplicitLod ||
6297 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSamplers != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSamplers ||
6298 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindUniformBuffers != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindUniformBuffers ||
6299 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageBuffers != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageBuffers ||
6300 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSampledImages != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSampledImages ||
6301 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageImages != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageImages ||
6302 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindInputAttachments != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindInputAttachments ||
6303 descriptorIndexingProperties.maxPerStageUpdateAfterBindResources != vulkan12Properties.maxPerStageUpdateAfterBindResources ||
6304 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSamplers != vulkan12Properties.maxDescriptorSetUpdateAfterBindSamplers ||
6305 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffers != vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffers ||
6306 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic != vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic ||
6307 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffers != vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffers ||
6308 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic != vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic ||
6309 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSampledImages != vulkan12Properties.maxDescriptorSetUpdateAfterBindSampledImages ||
6310 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageImages != vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageImages ||
6311 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindInputAttachments != vulkan12Properties.maxDescriptorSetUpdateAfterBindInputAttachments ))
6313 TCU_FAIL("Mismatch between VkPhysicalDeviceDescriptorIndexingProperties and VkPhysicalDeviceVulkan12Properties");
6316 if ((depthStencilResolveProperties.supportedDepthResolveModes != vulkan12Properties.supportedDepthResolveModes ||
6317 depthStencilResolveProperties.supportedStencilResolveModes != vulkan12Properties.supportedStencilResolveModes ||
6318 depthStencilResolveProperties.independentResolveNone != vulkan12Properties.independentResolveNone ||
6319 depthStencilResolveProperties.independentResolve != vulkan12Properties.independentResolve))
6321 TCU_FAIL("Mismatch between VkPhysicalDeviceDepthStencilResolveProperties and VkPhysicalDeviceVulkan12Properties");
6324 if ((samplerFilterMinmaxProperties.filterMinmaxSingleComponentFormats != vulkan12Properties.filterMinmaxSingleComponentFormats ||
6325 samplerFilterMinmaxProperties.filterMinmaxImageComponentMapping != vulkan12Properties.filterMinmaxImageComponentMapping))
6327 TCU_FAIL("Mismatch between VkPhysicalDeviceSamplerFilterMinmaxProperties and VkPhysicalDeviceVulkan12Properties");
6330 if ((timelineSemaphoreProperties.maxTimelineSemaphoreValueDifference != vulkan12Properties.maxTimelineSemaphoreValueDifference))
6332 TCU_FAIL("Mismatch between VkPhysicalDeviceTimelineSemaphoreProperties and VkPhysicalDeviceVulkan12Properties");
6336 return tcu::TestStatus::pass("Vulkan 1.2 device properties are consistent with extension properties");
6339 #ifndef CTS_USES_VULKANSC
6340 tcu::TestStatus devicePropertyExtensionsConsistencyVulkan13(Context& context)
6342 TestLog& log = context.getTestContext().getLog();
6343 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
6344 const CustomInstance instance = createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2");
6345 const InstanceDriver& vki = instance.getDriver();
6347 if (!context.contextSupports(vk::ApiVersion(0, 1, 3, 0)))
6348 TCU_THROW(NotSupportedError, "At least Vulkan 1.3 required to run test");
6350 VkPhysicalDeviceVulkan13Properties vulkan13Properties = initVulkanStructure();
6351 VkPhysicalDeviceProperties2 extProperties = initVulkanStructure(&vulkan13Properties);
6353 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
6355 log << TestLog::Message << vulkan13Properties << TestLog::EndMessage;
6357 // Validate all fields initialized matching to extension structures
6359 VkPhysicalDeviceSubgroupSizeControlProperties subgroupSizeControlProperties = initVulkanStructure();
6360 VkPhysicalDeviceInlineUniformBlockProperties inlineUniformBlockProperties = initVulkanStructure(&subgroupSizeControlProperties);
6361 VkPhysicalDeviceShaderIntegerDotProductProperties shaderIntegerDotProductProperties = initVulkanStructure(&inlineUniformBlockProperties);
6362 VkPhysicalDeviceTexelBufferAlignmentProperties texelBufferAlignmentProperties = initVulkanStructure(&shaderIntegerDotProductProperties);
6363 VkPhysicalDeviceMaintenance4Properties maintenance4Properties = initVulkanStructure(&texelBufferAlignmentProperties);
6364 extProperties = initVulkanStructure(&maintenance4Properties);
6366 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
6368 if (subgroupSizeControlProperties.minSubgroupSize != vulkan13Properties.minSubgroupSize ||
6369 subgroupSizeControlProperties.maxSubgroupSize != vulkan13Properties.maxSubgroupSize ||
6370 subgroupSizeControlProperties.maxComputeWorkgroupSubgroups != vulkan13Properties.maxComputeWorkgroupSubgroups ||
6371 subgroupSizeControlProperties.requiredSubgroupSizeStages != vulkan13Properties.requiredSubgroupSizeStages)
6373 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupSizeControlProperties and VkPhysicalDeviceVulkan13Properties");
6376 if (inlineUniformBlockProperties.maxInlineUniformBlockSize != vulkan13Properties.maxInlineUniformBlockSize ||
6377 inlineUniformBlockProperties.maxPerStageDescriptorInlineUniformBlocks != vulkan13Properties.maxPerStageDescriptorInlineUniformBlocks ||
6378 inlineUniformBlockProperties.maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks != vulkan13Properties.maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks ||
6379 inlineUniformBlockProperties.maxDescriptorSetInlineUniformBlocks != vulkan13Properties.maxDescriptorSetInlineUniformBlocks ||
6380 inlineUniformBlockProperties.maxDescriptorSetUpdateAfterBindInlineUniformBlocks != vulkan13Properties.maxDescriptorSetUpdateAfterBindInlineUniformBlocks)
6382 TCU_FAIL("Mismatch between VkPhysicalDeviceInlineUniformBlockProperties and VkPhysicalDeviceVulkan13Properties");
6385 if (shaderIntegerDotProductProperties.integerDotProduct8BitUnsignedAccelerated != vulkan13Properties.integerDotProduct8BitUnsignedAccelerated ||
6386 shaderIntegerDotProductProperties.integerDotProduct8BitSignedAccelerated != vulkan13Properties.integerDotProduct8BitSignedAccelerated ||
6387 shaderIntegerDotProductProperties.integerDotProduct8BitMixedSignednessAccelerated != vulkan13Properties.integerDotProduct8BitMixedSignednessAccelerated ||
6388 shaderIntegerDotProductProperties.integerDotProduct4x8BitPackedUnsignedAccelerated != vulkan13Properties.integerDotProduct4x8BitPackedUnsignedAccelerated ||
6389 shaderIntegerDotProductProperties.integerDotProduct4x8BitPackedSignedAccelerated != vulkan13Properties.integerDotProduct4x8BitPackedSignedAccelerated ||
6390 shaderIntegerDotProductProperties.integerDotProduct4x8BitPackedMixedSignednessAccelerated != vulkan13Properties.integerDotProduct4x8BitPackedMixedSignednessAccelerated ||
6391 shaderIntegerDotProductProperties.integerDotProduct16BitUnsignedAccelerated != vulkan13Properties.integerDotProduct16BitUnsignedAccelerated ||
6392 shaderIntegerDotProductProperties.integerDotProduct16BitSignedAccelerated != vulkan13Properties.integerDotProduct16BitSignedAccelerated ||
6393 shaderIntegerDotProductProperties.integerDotProduct16BitMixedSignednessAccelerated != vulkan13Properties.integerDotProduct16BitMixedSignednessAccelerated ||
6394 shaderIntegerDotProductProperties.integerDotProduct32BitUnsignedAccelerated != vulkan13Properties.integerDotProduct32BitUnsignedAccelerated ||
6395 shaderIntegerDotProductProperties.integerDotProduct32BitSignedAccelerated != vulkan13Properties.integerDotProduct32BitSignedAccelerated ||
6396 shaderIntegerDotProductProperties.integerDotProduct32BitMixedSignednessAccelerated != vulkan13Properties.integerDotProduct32BitMixedSignednessAccelerated ||
6397 shaderIntegerDotProductProperties.integerDotProduct64BitUnsignedAccelerated != vulkan13Properties.integerDotProduct64BitUnsignedAccelerated ||
6398 shaderIntegerDotProductProperties.integerDotProduct64BitSignedAccelerated != vulkan13Properties.integerDotProduct64BitSignedAccelerated ||
6399 shaderIntegerDotProductProperties.integerDotProduct64BitMixedSignednessAccelerated != vulkan13Properties.integerDotProduct64BitMixedSignednessAccelerated ||
6400 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating8BitUnsignedAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating8BitUnsignedAccelerated ||
6401 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating8BitSignedAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating8BitSignedAccelerated ||
6402 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated ||
6403 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated ||
6404 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated ||
6405 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated ||
6406 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating16BitUnsignedAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating16BitUnsignedAccelerated ||
6407 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating16BitSignedAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating16BitSignedAccelerated ||
6408 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated ||
6409 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating32BitUnsignedAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating32BitUnsignedAccelerated ||
6410 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating32BitSignedAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating32BitSignedAccelerated ||
6411 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated ||
6412 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating64BitUnsignedAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating64BitUnsignedAccelerated ||
6413 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating64BitSignedAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating64BitSignedAccelerated ||
6414 shaderIntegerDotProductProperties.integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated != vulkan13Properties.integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated)
6416 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderIntegerDotProductProperties and VkPhysicalDeviceVulkan13Properties");
6419 if (texelBufferAlignmentProperties.storageTexelBufferOffsetAlignmentBytes != vulkan13Properties.storageTexelBufferOffsetAlignmentBytes ||
6420 texelBufferAlignmentProperties.storageTexelBufferOffsetSingleTexelAlignment != vulkan13Properties.storageTexelBufferOffsetSingleTexelAlignment ||
6421 texelBufferAlignmentProperties.uniformTexelBufferOffsetAlignmentBytes != vulkan13Properties.uniformTexelBufferOffsetAlignmentBytes ||
6422 texelBufferAlignmentProperties.uniformTexelBufferOffsetSingleTexelAlignment != vulkan13Properties.uniformTexelBufferOffsetSingleTexelAlignment)
6424 TCU_FAIL("Mismatch between VkPhysicalDeviceTexelBufferAlignmentProperties and VkPhysicalDeviceVulkan13Properties");
6427 if (maintenance4Properties.maxBufferSize != vulkan13Properties.maxBufferSize)
6429 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance4Properties and VkPhysicalDeviceVulkan13Properties");
6433 return tcu::TestStatus::pass("Vulkan 1.3 device properties are consistent with extension properties");
6435 #endif // CTS_USES_VULKANSC
6437 tcu::TestStatus imageFormatProperties2 (Context& context, const VkFormat format, const VkImageType imageType, const VkImageTiling tiling)
6439 if (isYCbCrFormat(format))
6440 // check if Ycbcr format enums are valid given the version and extensions
6441 checkYcbcrApiSupport(context);
6443 TestLog& log = context.getTestContext().getLog();
6445 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
6446 const InstanceDriver& vki (instance.getDriver());
6447 const VkPhysicalDevice physicalDevice (chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
6449 const VkImageCreateFlags ycbcrFlags = isYCbCrFormat(format) ? (VkImageCreateFlags)VK_IMAGE_CREATE_DISJOINT_BIT : (VkImageCreateFlags)0u;
6450 const VkImageUsageFlags allUsageFlags = VK_IMAGE_USAGE_TRANSFER_SRC_BIT
6451 | VK_IMAGE_USAGE_TRANSFER_DST_BIT
6452 | VK_IMAGE_USAGE_SAMPLED_BIT
6453 | VK_IMAGE_USAGE_STORAGE_BIT
6454 | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
6455 | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
6456 | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
6457 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
6458 const VkImageCreateFlags allCreateFlags = VK_IMAGE_CREATE_SPARSE_BINDING_BIT
6459 | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT
6460 | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT
6461 | VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT
6462 | VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT
6465 for (VkImageUsageFlags curUsageFlags = (VkImageUsageFlags)1; curUsageFlags <= allUsageFlags; curUsageFlags++)
6467 if (!isValidImageUsageFlagCombination(curUsageFlags))
6470 for (VkImageCreateFlags curCreateFlags = 0; curCreateFlags <= allCreateFlags; curCreateFlags++)
6472 const VkPhysicalDeviceImageFormatInfo2 imageFormatInfo =
6474 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2,
6483 VkImageFormatProperties coreProperties;
6484 VkImageFormatProperties2 extProperties;
6485 VkResult coreResult;
6488 deMemset(&coreProperties, 0xcd, sizeof(VkImageFormatProperties));
6489 deMemset(&extProperties, 0xcd, sizeof(VkImageFormatProperties2));
6491 extProperties.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2;
6492 extProperties.pNext = DE_NULL;
6494 coreResult = vki.getPhysicalDeviceImageFormatProperties(physicalDevice, imageFormatInfo.format, imageFormatInfo.type, imageFormatInfo.tiling, imageFormatInfo.usage, imageFormatInfo.flags, &coreProperties);
6495 extResult = vki.getPhysicalDeviceImageFormatProperties2(physicalDevice, &imageFormatInfo, &extProperties);
6497 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2);
6498 TCU_CHECK(extProperties.pNext == DE_NULL);
6500 if ((coreResult != extResult) ||
6501 (deMemCmp(&coreProperties, &extProperties.imageFormatProperties, sizeof(VkImageFormatProperties)) != 0))
6503 log << TestLog::Message << "ERROR: device mismatch with query " << imageFormatInfo << TestLog::EndMessage
6504 << TestLog::Message << "vkGetPhysicalDeviceImageFormatProperties() returned " << coreResult << ", " << coreProperties << TestLog::EndMessage
6505 << TestLog::Message << "vkGetPhysicalDeviceImageFormatProperties2() returned " << extResult << ", " << extProperties << TestLog::EndMessage;
6506 TCU_FAIL("Mismatch between image format properties reported by vkGetPhysicalDeviceImageFormatProperties and vkGetPhysicalDeviceImageFormatProperties2");
6511 return tcu::TestStatus::pass("Querying image format properties succeeded");
6514 #ifndef CTS_USES_VULKANSC
6515 tcu::TestStatus sparseImageFormatProperties2 (Context& context, const VkFormat format, const VkImageType imageType, const VkImageTiling tiling)
6517 TestLog& log = context.getTestContext().getLog();
6519 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
6520 const InstanceDriver& vki (instance.getDriver());
6521 const VkPhysicalDevice physicalDevice (chooseDevice(vki, instance, context.getTestContext().getCommandLine()));
6523 const VkImageUsageFlags allUsageFlags = VK_IMAGE_USAGE_TRANSFER_SRC_BIT
6524 | VK_IMAGE_USAGE_TRANSFER_DST_BIT
6525 | VK_IMAGE_USAGE_SAMPLED_BIT
6526 | VK_IMAGE_USAGE_STORAGE_BIT
6527 | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
6528 | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
6529 | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
6530 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
6532 for (deUint32 sampleCountBit = VK_SAMPLE_COUNT_1_BIT; sampleCountBit <= VK_SAMPLE_COUNT_64_BIT; sampleCountBit = (sampleCountBit << 1u))
6534 for (VkImageUsageFlags curUsageFlags = (VkImageUsageFlags)1; curUsageFlags <= allUsageFlags; curUsageFlags++)
6536 if (!isValidImageUsageFlagCombination(curUsageFlags))
6539 const VkPhysicalDeviceSparseImageFormatInfo2 imageFormatInfo =
6541 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2,
6545 (VkSampleCountFlagBits)sampleCountBit,
6550 deUint32 numCoreProperties = 0u;
6551 deUint32 numExtProperties = 0u;
6554 vki.getPhysicalDeviceSparseImageFormatProperties(physicalDevice, imageFormatInfo.format, imageFormatInfo.type, imageFormatInfo.samples, imageFormatInfo.usage, imageFormatInfo.tiling, &numCoreProperties, DE_NULL);
6555 vki.getPhysicalDeviceSparseImageFormatProperties2(physicalDevice, &imageFormatInfo, &numExtProperties, DE_NULL);
6557 if (numCoreProperties != numExtProperties)
6559 log << TestLog::Message << "ERROR: different number of properties reported for " << imageFormatInfo << TestLog::EndMessage;
6560 TCU_FAIL("Mismatch in reported property count");
6563 if (!context.getDeviceFeatures().sparseBinding)
6565 // There is no support for sparse binding, getPhysicalDeviceSparseImageFormatProperties* MUST report no properties
6566 // Only have to check one of the entrypoints as a mismatch in count is already caught.
6567 if (numCoreProperties > 0)
6569 log << TestLog::Message << "ERROR: device does not support sparse binding but claims support for " << numCoreProperties << " properties in vkGetPhysicalDeviceSparseImageFormatProperties with parameters " << imageFormatInfo << TestLog::EndMessage;
6570 TCU_FAIL("Claimed format properties inconsistent with overall sparseBinding feature");
6574 if (numCoreProperties > 0)
6576 std::vector<VkSparseImageFormatProperties> coreProperties (numCoreProperties);
6577 std::vector<VkSparseImageFormatProperties2> extProperties (numExtProperties);
6579 deMemset(&coreProperties[0], 0xcd, sizeof(VkSparseImageFormatProperties)*numCoreProperties);
6580 deMemset(&extProperties[0], 0xcd, sizeof(VkSparseImageFormatProperties2)*numExtProperties);
6582 for (deUint32 ndx = 0; ndx < numExtProperties; ++ndx)
6584 extProperties[ndx].sType = VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2;
6585 extProperties[ndx].pNext = DE_NULL;
6588 vki.getPhysicalDeviceSparseImageFormatProperties(physicalDevice, imageFormatInfo.format, imageFormatInfo.type, imageFormatInfo.samples, imageFormatInfo.usage, imageFormatInfo.tiling, &numCoreProperties, &coreProperties[0]);
6589 vki.getPhysicalDeviceSparseImageFormatProperties2(physicalDevice, &imageFormatInfo, &numExtProperties, &extProperties[0]);
6591 TCU_CHECK((size_t)numCoreProperties == coreProperties.size());
6592 TCU_CHECK((size_t)numExtProperties == extProperties.size());
6594 for (deUint32 ndx = 0; ndx < numCoreProperties; ++ndx)
6596 TCU_CHECK(extProperties[ndx].sType == VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2);
6597 TCU_CHECK(extProperties[ndx].pNext == DE_NULL);
6599 if ((deMemCmp(&coreProperties[ndx], &extProperties[ndx].properties, sizeof(VkSparseImageFormatProperties)) != 0))
6601 log << TestLog::Message << "ERROR: device mismatch with query " << imageFormatInfo << " property " << ndx << TestLog::EndMessage
6602 << TestLog::Message << "vkGetPhysicalDeviceSparseImageFormatProperties() returned " << coreProperties[ndx] << TestLog::EndMessage
6603 << TestLog::Message << "vkGetPhysicalDeviceSparseImageFormatProperties2() returned " << extProperties[ndx] << TestLog::EndMessage;
6604 TCU_FAIL("Mismatch between image format properties reported by vkGetPhysicalDeviceSparseImageFormatProperties and vkGetPhysicalDeviceSparseImageFormatProperties2");
6611 return tcu::TestStatus::pass("Querying sparse image format properties succeeded");
6613 #endif // CTS_USES_VULKANSC
6615 tcu::TestStatus execImageFormatTest (Context& context, ImageFormatPropertyCase testCase)
6617 return testCase.testFunction(context, testCase.format, testCase.imageType, testCase.tiling);
6620 void createImageFormatTypeTilingTests (tcu::TestCaseGroup* testGroup, ImageFormatPropertyCase params)
6622 DE_ASSERT(params.format == VK_FORMAT_UNDEFINED);
6628 ImageFormatPropertyCase params;
6629 } s_formatRanges[] =
6632 { (VkFormat)(VK_FORMAT_UNDEFINED + 1), VK_CORE_FORMAT_LAST, params },
6635 { VK_FORMAT_G8B8G8R8_422_UNORM, (VkFormat)(VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM + 1), params },
6637 // YCbCr extended formats
6638 { VK_FORMAT_G8_B8R8_2PLANE_444_UNORM_EXT, (VkFormat)(VK_FORMAT_G16_B16R16_2PLANE_444_UNORM_EXT+1), params },
6641 for (int rangeNdx = 0; rangeNdx < DE_LENGTH_OF_ARRAY(s_formatRanges); ++rangeNdx)
6643 const VkFormat rangeBegin = s_formatRanges[rangeNdx].begin;
6644 const VkFormat rangeEnd = s_formatRanges[rangeNdx].end;
6646 for (VkFormat format = rangeBegin; format != rangeEnd; format = (VkFormat)(format+1))
6648 const bool isYCbCr = isYCbCrFormat(format);
6649 #ifndef CTS_USES_VULKANSC
6650 const bool isSparse = (params.testFunction == sparseImageFormatProperties2);
6652 const bool isSparse = false;
6653 #endif // CTS_USES_VULKANSC
6655 if (isYCbCr && isSparse)
6658 if (isYCbCr && params.imageType != VK_IMAGE_TYPE_2D)
6661 const char* const enumName = getFormatName(format);
6662 const string caseName = de::toLower(string(enumName).substr(10));
6664 params.format = format;
6666 addFunctionCase(testGroup, caseName, enumName, execImageFormatTest, params);
6671 void createImageFormatTypeTests (tcu::TestCaseGroup* testGroup, ImageFormatPropertyCase params)
6673 DE_ASSERT(params.tiling == VK_CORE_IMAGE_TILING_LAST);
6675 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "optimal", "", createImageFormatTypeTilingTests, ImageFormatPropertyCase(params.testFunction, VK_FORMAT_UNDEFINED, params.imageType, VK_IMAGE_TILING_OPTIMAL)));
6676 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "linear", "", createImageFormatTypeTilingTests, ImageFormatPropertyCase(params.testFunction, VK_FORMAT_UNDEFINED, params.imageType, VK_IMAGE_TILING_LINEAR)));
6679 void createImageFormatTests (tcu::TestCaseGroup* testGroup, ImageFormatPropertyCase::Function testFunction)
6681 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "1d", "", createImageFormatTypeTests, ImageFormatPropertyCase(testFunction, VK_FORMAT_UNDEFINED, VK_IMAGE_TYPE_1D, VK_CORE_IMAGE_TILING_LAST)));
6682 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "2d", "", createImageFormatTypeTests, ImageFormatPropertyCase(testFunction, VK_FORMAT_UNDEFINED, VK_IMAGE_TYPE_2D, VK_CORE_IMAGE_TILING_LAST)));
6683 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "3d", "", createImageFormatTypeTests, ImageFormatPropertyCase(testFunction, VK_FORMAT_UNDEFINED, VK_IMAGE_TYPE_3D, VK_CORE_IMAGE_TILING_LAST)));
6687 // Android CTS -specific tests
6692 void checkExtensions (tcu::ResultCollector& results, const set<string>& allowedExtensions, const vector<VkExtensionProperties>& reportedExtensions)
6694 for (vector<VkExtensionProperties>::const_iterator extension = reportedExtensions.begin(); extension != reportedExtensions.end(); ++extension)
6696 const string extensionName (extension->extensionName);
6697 const bool mustBeKnown = de::beginsWith(extensionName, "VK_GOOGLE_") ||
6698 de::beginsWith(extensionName, "VK_ANDROID_");
6700 if (mustBeKnown && !de::contains(allowedExtensions, extensionName))
6701 results.fail("Unknown extension: " + extensionName);
6705 tcu::TestStatus testNoUnknownExtensions (Context& context)
6707 TestLog& log = context.getTestContext().getLog();
6708 tcu::ResultCollector results (log);
6709 set<string> allowedInstanceExtensions;
6710 set<string> allowedDeviceExtensions;
6712 // All known extensions should be added to allowedExtensions:
6713 // allowedExtensions.insert("VK_GOOGLE_extension1");
6714 allowedDeviceExtensions.insert("VK_ANDROID_external_memory_android_hardware_buffer");
6715 allowedDeviceExtensions.insert("VK_GOOGLE_display_timing");
6716 allowedDeviceExtensions.insert("VK_GOOGLE_decorate_string");
6717 allowedDeviceExtensions.insert("VK_GOOGLE_hlsl_functionality1");
6718 allowedInstanceExtensions.insert("VK_GOOGLE_surfaceless_query");
6720 // Instance extensions
6721 checkExtensions(results,
6722 allowedInstanceExtensions,
6723 enumerateInstanceExtensionProperties(context.getPlatformInterface(), DE_NULL));
6725 // Extensions exposed by instance layers
6727 const vector<VkLayerProperties> layers = enumerateInstanceLayerProperties(context.getPlatformInterface());
6729 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
6731 checkExtensions(results,
6732 allowedInstanceExtensions,
6733 enumerateInstanceExtensionProperties(context.getPlatformInterface(), layer->layerName));
6737 // Device extensions
6738 checkExtensions(results,
6739 allowedDeviceExtensions,
6740 enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), DE_NULL));
6742 // Extensions exposed by device layers
6744 const vector<VkLayerProperties> layers = enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
6746 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
6748 checkExtensions(results,
6749 allowedDeviceExtensions,
6750 enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), layer->layerName));
6754 return tcu::TestStatus(results.getResult(), results.getMessage());
6757 tcu::TestStatus testNoLayers (Context& context)
6759 TestLog& log = context.getTestContext().getLog();
6760 tcu::ResultCollector results (log);
6763 const vector<VkLayerProperties> layers = enumerateInstanceLayerProperties(context.getPlatformInterface());
6765 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
6766 results.fail(string("Instance layer enumerated: ") + layer->layerName);
6770 const vector<VkLayerProperties> layers = enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
6772 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
6773 results.fail(string("Device layer enumerated: ") + layer->layerName);
6776 return tcu::TestStatus(results.getResult(), results.getMessage());
6779 tcu::TestStatus testMandatoryExtensions (Context& context)
6781 TestLog& log = context.getTestContext().getLog();
6782 tcu::ResultCollector results (log);
6784 // Instance extensions
6786 static const string mandatoryExtensions[] =
6788 "VK_KHR_get_physical_device_properties2",
6791 for (const auto &ext : mandatoryExtensions)
6793 if (!context.isInstanceFunctionalitySupported(ext))
6794 results.fail(ext + " is not supported");
6798 // Device extensions
6800 static const string mandatoryExtensions[] =
6802 "VK_KHR_maintenance1",
6805 for (const auto &ext : mandatoryExtensions)
6807 if (!context.isDeviceFunctionalitySupported(ext))
6808 results.fail(ext + " is not supported");
6812 return tcu::TestStatus(results.getResult(), results.getMessage());
6819 static inline void addFunctionCaseInNewSubgroup (
6820 tcu::TestContext& testCtx,
6821 tcu::TestCaseGroup* group,
6822 const std::string& subgroupName,
6823 const std::string& subgroupDescription,
6824 FunctionInstance0::Function testFunc)
6826 de::MovePtr<tcu::TestCaseGroup> subgroup(new tcu::TestCaseGroup(testCtx, subgroupName.c_str(), subgroupDescription.c_str()));
6827 addFunctionCase(subgroup.get(), "basic", "", testFunc);
6828 group->addChild(subgroup.release());
6831 tcu::TestCaseGroup* createFeatureInfoTests (tcu::TestContext& testCtx)
6833 de::MovePtr<tcu::TestCaseGroup> infoTests (new tcu::TestCaseGroup(testCtx, "info", "Platform Information Tests"));
6835 infoTests->addChild(createTestGroup(testCtx, "format_properties", "VkGetPhysicalDeviceFormatProperties() Tests", createFormatTests));
6836 infoTests->addChild(createTestGroup(testCtx, "image_format_properties", "VkGetPhysicalDeviceImageFormatProperties() Tests", createImageFormatTests, imageFormatProperties));
6839 de::MovePtr<tcu::TestCaseGroup> extCoreVersionGrp (new tcu::TestCaseGroup(testCtx, "extension_core_versions", "Tests checking extension required core versions"));
6841 addFunctionCase(extCoreVersionGrp.get(), "extension_core_versions", "", extensionCoreVersions);
6843 infoTests->addChild(extCoreVersionGrp.release());
6847 de::MovePtr<tcu::TestCaseGroup> extendedPropertiesTests (new tcu::TestCaseGroup(testCtx, "get_physical_device_properties2", "VK_KHR_get_physical_device_properties2"));
6850 de::MovePtr<tcu::TestCaseGroup> subgroup(new tcu::TestCaseGroup(testCtx, "features", ""));
6851 addFunctionCase(subgroup.get(), "core", "Extended Device Features", deviceFeatures2);
6852 addSeparateFeatureTests(subgroup.get());
6853 extendedPropertiesTests->addChild(subgroup.release());
6855 addFunctionCaseInNewSubgroup(testCtx, extendedPropertiesTests.get(), "properties", "Extended Device Properties", deviceProperties2);
6856 addFunctionCaseInNewSubgroup(testCtx, extendedPropertiesTests.get(), "format_properties", "Extended Device Format Properties", deviceFormatProperties2);
6857 addFunctionCaseInNewSubgroup(testCtx, extendedPropertiesTests.get(), "queue_family_properties", "Extended Device Queue Family Properties", deviceQueueFamilyProperties2);
6858 addFunctionCaseInNewSubgroup(testCtx, extendedPropertiesTests.get(), "memory_properties", "Extended Device Memory Properties", deviceMemoryProperties2);
6860 infoTests->addChild(extendedPropertiesTests.release());
6864 de::MovePtr<tcu::TestCaseGroup> extendedPropertiesTests (new tcu::TestCaseGroup(testCtx, "vulkan1p2", "Vulkan 1.2 related tests"));
6866 addFunctionCase(extendedPropertiesTests.get(), "features", "Extended Vulkan 1.2 Device Features", deviceFeaturesVulkan12);
6867 addFunctionCase(extendedPropertiesTests.get(), "properties", "Extended Vulkan 1.2 Device Properties", devicePropertiesVulkan12);
6868 addFunctionCase(extendedPropertiesTests.get(), "feature_extensions_consistency", "Vulkan 1.2 consistency between Features and Extensions", deviceFeatureExtensionsConsistencyVulkan12);
6869 addFunctionCase(extendedPropertiesTests.get(), "property_extensions_consistency", "Vulkan 1.2 consistency between Properties and Extensions", devicePropertyExtensionsConsistencyVulkan12);
6870 addFunctionCase(extendedPropertiesTests.get(), "feature_bits_influence", "Validate feature bits influence on feature activation", checkApiVersionSupport<1,2>, featureBitInfluenceOnDeviceCreate<VK_API_VERSION_1_2>);
6872 infoTests->addChild(extendedPropertiesTests.release());
6875 #ifndef CTS_USES_VULKANSC
6877 de::MovePtr<tcu::TestCaseGroup> extendedPropertiesTests (new tcu::TestCaseGroup(testCtx, "vulkan1p3", "Vulkan 1.3 related tests"));
6879 addFunctionCase(extendedPropertiesTests.get(), "features", "Extended Vulkan 1.3 Device Features", deviceFeaturesVulkan13);
6880 addFunctionCase(extendedPropertiesTests.get(), "properties", "Extended Vulkan 1.3 Device Properties", devicePropertiesVulkan13);
6881 addFunctionCase(extendedPropertiesTests.get(), "feature_extensions_consistency", "Vulkan 1.3 consistency between Features and Extensions", deviceFeatureExtensionsConsistencyVulkan13);
6882 addFunctionCase(extendedPropertiesTests.get(), "property_extensions_consistency", "Vulkan 1.3 consistency between Properties and Extensions", devicePropertyExtensionsConsistencyVulkan13);
6883 addFunctionCase(extendedPropertiesTests.get(), "feature_bits_influence", "Validate feature bits influence on feature activation", checkApiVersionSupport<1, 3>, featureBitInfluenceOnDeviceCreate<VK_API_VERSION_1_3>);
6885 infoTests->addChild(extendedPropertiesTests.release());
6887 #endif // CTS_USES_VULKANSC
6890 de::MovePtr<tcu::TestCaseGroup> limitsValidationTests (new tcu::TestCaseGroup(testCtx, "vulkan1p2_limits_validation", "Vulkan 1.2 and core extensions limits validation"));
6892 addFunctionCase(limitsValidationTests.get(), "general", "Vulkan 1.2 Limit validation", checkApiVersionSupport<1, 2>, validateLimits12);
6893 #ifndef CTS_USES_VULKANSC
6894 // Removed from Vulkan SC test set: VK_KHR_push_descriptor extension removed from Vulkan SC
6895 addFunctionCase(limitsValidationTests.get(), "khr_push_descriptor", "VK_KHR_push_descriptor limit validation", checkSupportKhrPushDescriptor, validateLimitsKhrPushDescriptor);
6896 #endif // CTS_USES_VULKANSC
6897 addFunctionCase(limitsValidationTests.get(), "khr_multiview", "VK_KHR_multiview limit validation", checkSupportKhrMultiview, validateLimitsKhrMultiview);
6898 addFunctionCase(limitsValidationTests.get(), "ext_discard_rectangles", "VK_EXT_discard_rectangles limit validation", checkSupportExtDiscardRectangles, validateLimitsExtDiscardRectangles);
6899 addFunctionCase(limitsValidationTests.get(), "ext_sample_locations", "VK_EXT_sample_locations limit validation", checkSupportExtSampleLocations, validateLimitsExtSampleLocations);
6900 addFunctionCase(limitsValidationTests.get(), "ext_external_memory_host", "VK_EXT_external_memory_host limit validation", checkSupportExtExternalMemoryHost, validateLimitsExtExternalMemoryHost);
6901 addFunctionCase(limitsValidationTests.get(), "ext_blend_operation_advanced", "VK_EXT_blend_operation_advanced limit validation", checkSupportExtBlendOperationAdvanced, validateLimitsExtBlendOperationAdvanced);
6902 addFunctionCase(limitsValidationTests.get(), "khr_maintenance_3", "VK_KHR_maintenance3 limit validation", checkSupportKhrMaintenance3, validateLimitsKhrMaintenance3);
6903 addFunctionCase(limitsValidationTests.get(), "ext_conservative_rasterization", "VK_EXT_conservative_rasterization limit validation", checkSupportExtConservativeRasterization, validateLimitsExtConservativeRasterization);
6904 addFunctionCase(limitsValidationTests.get(), "ext_descriptor_indexing", "VK_EXT_descriptor_indexing limit validation", checkSupportExtDescriptorIndexing, validateLimitsExtDescriptorIndexing);
6905 #ifndef CTS_USES_VULKANSC
6906 // Removed from Vulkan SC test set: VK_EXT_inline_uniform_block extension removed from Vulkan SC
6907 addFunctionCase(limitsValidationTests.get(), "ext_inline_uniform_block", "VK_EXT_inline_uniform_block limit validation", checkSupportExtInlineUniformBlock, validateLimitsExtInlineUniformBlock);
6908 #endif // CTS_USES_VULKANSC
6909 addFunctionCase(limitsValidationTests.get(), "ext_vertex_attribute_divisor", "VK_EXT_vertex_attribute_divisor limit validation", checkSupportExtVertexAttributeDivisor, validateLimitsExtVertexAttributeDivisor);
6910 #ifndef CTS_USES_VULKANSC
6911 // 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
6912 addFunctionCase(limitsValidationTests.get(), "nv_mesh_shader", "VK_NV_mesh_shader limit validation", checkSupportNvMeshShader, validateLimitsNvMeshShader);
6913 addFunctionCase(limitsValidationTests.get(), "ext_transform_feedback", "VK_EXT_transform_feedback limit validation", checkSupportExtTransformFeedback, validateLimitsExtTransformFeedback);
6914 addFunctionCase(limitsValidationTests.get(), "fragment_density_map", "VK_EXT_fragment_density_map limit validation", checkSupportExtFragmentDensityMap, validateLimitsExtFragmentDensityMap);
6915 addFunctionCase(limitsValidationTests.get(), "nv_ray_tracing", "VK_NV_ray_tracing limit validation", checkSupportNvRayTracing, validateLimitsNvRayTracing);
6917 addFunctionCase(limitsValidationTests.get(), "timeline_semaphore", "VK_KHR_timeline_semaphore limit validation", checkSupportKhrTimelineSemaphore, validateLimitsKhrTimelineSemaphore);
6918 addFunctionCase(limitsValidationTests.get(), "ext_line_rasterization", "VK_EXT_line_rasterization limit validation", checkSupportExtLineRasterization, validateLimitsExtLineRasterization);
6919 addFunctionCase(limitsValidationTests.get(), "robustness2", "VK_EXT_robustness2 limit validation", checkSupportRobustness2, validateLimitsRobustness2);
6921 infoTests->addChild(limitsValidationTests.release());
6925 de::MovePtr<tcu::TestCaseGroup> limitsValidationTests(new tcu::TestCaseGroup(testCtx, "vulkan1p3_limits_validation", "Vulkan 1.3 and core extensions limits validation"));
6927 #ifndef CTS_USES_VULKANSC
6928 addFunctionCase(limitsValidationTests.get(), "khr_maintenance4", "VK_KHR_maintenance4", checkSupportKhrMaintenance4, validateLimitsKhrMaintenance4);
6929 addFunctionCase(limitsValidationTests.get(), "max_inline_uniform_total_size", "maxInlineUniformTotalSize limit validation", checkApiVersionSupport<1, 3>, validateLimitsMaxInlineUniformTotalSize);
6930 #endif // CTS_USES_VULKANSC
6932 infoTests->addChild(limitsValidationTests.release());
6935 infoTests->addChild(createTestGroup(testCtx, "image_format_properties2", "VkGetPhysicalDeviceImageFormatProperties2() Tests", createImageFormatTests, imageFormatProperties2));
6936 #ifndef CTS_USES_VULKANSC
6937 infoTests->addChild(createTestGroup(testCtx, "sparse_image_format_properties2", "VkGetPhysicalDeviceSparseImageFormatProperties2() Tests", createImageFormatTests, sparseImageFormatProperties2));
6940 de::MovePtr<tcu::TestCaseGroup> profilesValidationTests(new tcu::TestCaseGroup(testCtx, "profiles", "Profiles limits and features validation"));
6942 addFunctionCase(profilesValidationTests.get(), "roadmap_2022", "Limits and features check for roadmap 2022", checkApiVersionSupport<1, 3>, validateRoadmap2022);
6944 infoTests->addChild(profilesValidationTests.release());
6946 #endif // CTS_USES_VULKANSC
6949 de::MovePtr<tcu::TestCaseGroup> androidTests (new tcu::TestCaseGroup(testCtx, "android", "Android CTS Tests"));
6951 addFunctionCase(androidTests.get(), "mandatory_extensions", "Test that all mandatory extensions are supported", android::testMandatoryExtensions);
6952 addFunctionCase(androidTests.get(), "no_unknown_extensions", "Test for unknown device or instance extensions", android::testNoUnknownExtensions);
6953 addFunctionCase(androidTests.get(), "no_layers", "Test that no layers are enumerated", android::testNoLayers);
6955 infoTests->addChild(androidTests.release());
6958 return infoTests.release();
6961 void createFeatureInfoInstanceTests(tcu::TestCaseGroup* testGroup)
6963 addFunctionCase(testGroup, "physical_devices", "Physical devices", enumeratePhysicalDevices);
6964 addFunctionCase(testGroup, "physical_device_groups", "Physical devices Groups", enumeratePhysicalDeviceGroups);
6965 addFunctionCase(testGroup, "instance_layers", "Layers", enumerateInstanceLayers);
6966 addFunctionCase(testGroup, "instance_extensions", "Extensions", enumerateInstanceExtensions);
6969 void createFeatureInfoDeviceTests(tcu::TestCaseGroup* testGroup)
6971 addFunctionCase(testGroup, "device_features", "Device Features", deviceFeatures);
6972 addFunctionCase(testGroup, "device_properties", "Device Properties", deviceProperties);
6973 addFunctionCase(testGroup, "device_queue_family_properties", "Queue family properties", deviceQueueFamilyProperties);
6974 addFunctionCase(testGroup, "device_memory_properties", "Memory properties", deviceMemoryProperties);
6975 addFunctionCase(testGroup, "device_layers", "Layers", enumerateDeviceLayers);
6976 addFunctionCase(testGroup, "device_extensions", "Extensions", enumerateDeviceExtensions);
6977 addFunctionCase(testGroup, "device_no_khx_extensions", "KHX extensions", testNoKhxExtensions);
6978 addFunctionCase(testGroup, "device_memory_budget", "Memory budget", deviceMemoryBudgetProperties);
6979 addFunctionCase(testGroup, "device_mandatory_features", "Mandatory features", deviceMandatoryFeatures);
6982 void createFeatureInfoDeviceGroupTests(tcu::TestCaseGroup* testGroup)
6984 addFunctionCase(testGroup, "device_group_peer_memory_features", "Device Group peer memory features", deviceGroupPeerMemoryFeatures);