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 "vkQueryUtil.hpp"
36 #include "vkImageUtil.hpp"
37 #include "vkApiVersion.hpp"
39 #include "tcuTestLog.hpp"
40 #include "tcuFormatUtil.hpp"
41 #include "tcuTextureUtil.hpp"
42 #include "tcuResultCollector.hpp"
43 #include "tcuCommandLine.hpp"
45 #include "deUniquePtr.hpp"
47 #include "deStringUtil.hpp"
48 #include "deSTLUtil.hpp"
64 #include "vkApiExtensionDependencyInfo.inl"
71 using tcu::ScopedLogSection;
73 const deUint32 DEUINT32_MAX = std::numeric_limits<deUint32>::max();
77 GUARD_SIZE = 0x20, //!< Number of bytes to check
78 GUARD_VALUE = 0xcd, //!< Data pattern
81 static const VkDeviceSize MINIMUM_REQUIRED_IMAGE_RESOURCE_SIZE = (1LLU<<31); //!< Minimum value for VkImageFormatProperties::maxResourceSize (2GiB)
85 LIMIT_FORMAT_SIGNED_INT,
86 LIMIT_FORMAT_UNSIGNED_INT,
88 LIMIT_FORMAT_DEVICE_SIZE,
103 #define LIMIT(_X_) DE_OFFSET_OF(VkPhysicalDeviceLimits, _X_), (const char*)(#_X_)
104 #define FEATURE(_X_) DE_OFFSET_OF(VkPhysicalDeviceFeatures, _X_)
106 bool validateFeatureLimits(VkPhysicalDeviceProperties* properties, VkPhysicalDeviceFeatures* features, TestLog& log)
108 bool limitsOk = true;
109 VkPhysicalDeviceLimits* limits = &properties->limits;
110 deUint32 shaderStages = 3;
111 deUint32 maxPerStageResourcesMin = deMin32(128, limits->maxPerStageDescriptorUniformBuffers +
112 limits->maxPerStageDescriptorStorageBuffers +
113 limits->maxPerStageDescriptorSampledImages +
114 limits->maxPerStageDescriptorStorageImages +
115 limits->maxPerStageDescriptorInputAttachments +
116 limits->maxColorAttachments);
118 if (features->tessellationShader)
123 if (features->geometryShader)
128 struct FeatureLimitTable
132 deUint32 uintVal; //!< Format is UNSIGNED_INT
133 deInt32 intVal; //!< Format is SIGNED_INT
134 deUint64 deviceSizeVal; //!< Format is DEVICE_SIZE
135 float floatVal; //!< Format is FLOAT
138 deInt32 unsuppTableNdx;
139 } featureLimitTable[] = //!< Based on 1.0.28 Vulkan spec
141 { LIMIT(maxImageDimension1D), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
142 { LIMIT(maxImageDimension2D), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
143 { LIMIT(maxImageDimension3D), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
144 { LIMIT(maxImageDimensionCube), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
145 { LIMIT(maxImageArrayLayers), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
146 { LIMIT(maxTexelBufferElements), 65536, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
147 { LIMIT(maxUniformBufferRange), 16384, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
148 { LIMIT(maxStorageBufferRange), 134217728, 0, 0, 0, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
149 { LIMIT(maxPushConstantsSize), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
150 { LIMIT(maxMemoryAllocationCount), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
151 { LIMIT(maxSamplerAllocationCount), 4000, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
152 { LIMIT(bufferImageGranularity), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1 },
153 { LIMIT(bufferImageGranularity), 0, 0, 131072, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1 },
154 { LIMIT(sparseAddressSpaceSize), 0, 0, 2UL*1024*1024*1024, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1 },
155 { LIMIT(maxBoundDescriptorSets), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
156 { LIMIT(maxPerStageDescriptorSamplers), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
157 { LIMIT(maxPerStageDescriptorUniformBuffers), 12, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
158 { LIMIT(maxPerStageDescriptorStorageBuffers), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
159 { LIMIT(maxPerStageDescriptorSampledImages), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
160 { LIMIT(maxPerStageDescriptorStorageImages), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
161 { LIMIT(maxPerStageDescriptorInputAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
162 { LIMIT(maxPerStageResources), maxPerStageResourcesMin, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
163 { LIMIT(maxDescriptorSetSamplers), shaderStages * 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
164 { LIMIT(maxDescriptorSetUniformBuffers), shaderStages * 12, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
165 { LIMIT(maxDescriptorSetUniformBuffersDynamic), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
166 { LIMIT(maxDescriptorSetStorageBuffers), shaderStages * 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
167 { LIMIT(maxDescriptorSetStorageBuffersDynamic), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
168 { LIMIT(maxDescriptorSetSampledImages), shaderStages * 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
169 { LIMIT(maxDescriptorSetStorageImages), shaderStages * 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
170 { LIMIT(maxDescriptorSetInputAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
171 { LIMIT(maxVertexInputAttributes), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
172 { LIMIT(maxVertexInputBindings), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
173 { LIMIT(maxVertexInputAttributeOffset), 2047, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
174 { LIMIT(maxVertexInputBindingStride), 2048, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
175 { LIMIT(maxVertexOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
176 { LIMIT(maxTessellationGenerationLevel), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
177 { LIMIT(maxTessellationPatchSize), 32, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
178 { LIMIT(maxTessellationControlPerVertexInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
179 { LIMIT(maxTessellationControlPerVertexOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
180 { LIMIT(maxTessellationControlPerPatchOutputComponents), 120, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
181 { LIMIT(maxTessellationControlTotalOutputComponents), 2048, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
182 { LIMIT(maxTessellationEvaluationInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
183 { LIMIT(maxTessellationEvaluationOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
184 { LIMIT(maxGeometryShaderInvocations), 32, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
185 { LIMIT(maxGeometryInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
186 { LIMIT(maxGeometryOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
187 { LIMIT(maxGeometryOutputVertices), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
188 { LIMIT(maxGeometryTotalOutputComponents), 1024, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
189 { LIMIT(maxFragmentInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
190 { LIMIT(maxFragmentOutputAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
191 { LIMIT(maxFragmentDualSrcAttachments), 1, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
192 { LIMIT(maxFragmentCombinedOutputResources), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
193 { LIMIT(maxComputeSharedMemorySize), 16384, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
194 { LIMIT(maxComputeWorkGroupCount[0]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
195 { LIMIT(maxComputeWorkGroupCount[1]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
196 { LIMIT(maxComputeWorkGroupCount[2]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
197 { LIMIT(maxComputeWorkGroupInvocations), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
198 { LIMIT(maxComputeWorkGroupSize[0]), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
199 { LIMIT(maxComputeWorkGroupSize[1]), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
200 { LIMIT(maxComputeWorkGroupSize[2]), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
201 { LIMIT(subPixelPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
202 { LIMIT(subTexelPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
203 { LIMIT(mipmapPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
204 { LIMIT(maxDrawIndexedIndexValue), (deUint32)~0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
205 { LIMIT(maxDrawIndirectCount), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
206 { LIMIT(maxSamplerLodBias), 0, 0, 0, 2.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
207 { LIMIT(maxSamplerAnisotropy), 0, 0, 0, 16.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
208 { LIMIT(maxViewports), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
209 { LIMIT(maxViewportDimensions[0]), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
210 { LIMIT(maxViewportDimensions[1]), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
211 { LIMIT(viewportBoundsRange[0]), 0, 0, 0, -8192.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
212 { LIMIT(viewportBoundsRange[1]), 0, 0, 0, 8191.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
213 { LIMIT(viewportSubPixelBits), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
214 { LIMIT(minMemoryMapAlignment), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
215 { LIMIT(minTexelBufferOffsetAlignment), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1 },
216 { LIMIT(minTexelBufferOffsetAlignment), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1 },
217 { LIMIT(minUniformBufferOffsetAlignment), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1 },
218 { LIMIT(minUniformBufferOffsetAlignment), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1 },
219 { LIMIT(minStorageBufferOffsetAlignment), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1 },
220 { LIMIT(minStorageBufferOffsetAlignment), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1 },
221 { LIMIT(minTexelOffset), 0, -8, 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MAX, -1 },
222 { LIMIT(maxTexelOffset), 7, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
223 { LIMIT(minTexelGatherOffset), 0, -8, 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MAX, -1 },
224 { LIMIT(maxTexelGatherOffset), 7, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
225 { LIMIT(minInterpolationOffset), 0, 0, 0, -0.5f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
226 { LIMIT(maxInterpolationOffset), 0, 0, 0, 0.5f - (1.0f/deFloatPow(2.0f, (float)limits->subPixelInterpolationOffsetBits)), LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
227 { LIMIT(subPixelInterpolationOffsetBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
228 { LIMIT(maxFramebufferWidth), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
229 { LIMIT(maxFramebufferHeight), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
230 { LIMIT(maxFramebufferLayers), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
231 { LIMIT(framebufferColorSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
232 { LIMIT(framebufferDepthSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
233 { LIMIT(framebufferStencilSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
234 { LIMIT(framebufferNoAttachmentsSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
235 { LIMIT(maxColorAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
236 { LIMIT(sampledImageColorSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
237 { LIMIT(sampledImageIntegerSampleCounts), VK_SAMPLE_COUNT_1_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
238 { LIMIT(sampledImageDepthSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
239 { LIMIT(sampledImageStencilSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
240 { LIMIT(storageImageSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
241 { LIMIT(maxSampleMaskWords), 1, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
242 { LIMIT(timestampComputeAndGraphics), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1 },
243 { LIMIT(timestampPeriod), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1 },
244 { LIMIT(maxClipDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
245 { LIMIT(maxCullDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
246 { LIMIT(maxCombinedClipAndCullDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
247 { LIMIT(discreteQueuePriorities), 2, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
248 { LIMIT(pointSizeRange[0]), 0, 0, 0, 0.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
249 { LIMIT(pointSizeRange[0]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
250 { LIMIT(pointSizeRange[1]), 0, 0, 0, 64.0f - limits->pointSizeGranularity , LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
251 { LIMIT(lineWidthRange[0]), 0, 0, 0, 0.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
252 { LIMIT(lineWidthRange[0]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
253 { LIMIT(lineWidthRange[1]), 0, 0, 0, 8.0f - limits->lineWidthGranularity, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
254 { LIMIT(pointSizeGranularity), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
255 { LIMIT(lineWidthGranularity), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
256 { LIMIT(strictLines), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1 },
257 { LIMIT(standardSampleLocations), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1 },
258 { LIMIT(optimalBufferCopyOffsetAlignment), 0, 0, 0, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_NONE, -1 },
259 { LIMIT(optimalBufferCopyRowPitchAlignment), 0, 0, 0, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_NONE, -1 },
260 { LIMIT(nonCoherentAtomSize), 0, 0, 1, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1 },
261 { LIMIT(nonCoherentAtomSize), 0, 0, 256, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1 },
264 const struct UnsupportedFeatureLimitTable
266 deUint32 limitOffset;
268 deUint32 featureOffset;
269 deUint32 uintVal; //!< Format is UNSIGNED_INT
270 deInt32 intVal; //!< Format is SIGNED_INT
271 deUint64 deviceSizeVal; //!< Format is DEVICE_SIZE
272 float floatVal; //!< Format is FLOAT
273 } unsupportedFeatureTable[] =
275 { LIMIT(sparseAddressSpaceSize), FEATURE(sparseBinding), 0, 0, 0, 0.0f },
276 { LIMIT(maxTessellationGenerationLevel), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
277 { LIMIT(maxTessellationPatchSize), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
278 { LIMIT(maxTessellationControlPerVertexInputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
279 { LIMIT(maxTessellationControlPerVertexOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
280 { LIMIT(maxTessellationControlPerPatchOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
281 { LIMIT(maxTessellationControlTotalOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
282 { LIMIT(maxTessellationEvaluationInputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
283 { LIMIT(maxTessellationEvaluationOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
284 { LIMIT(maxGeometryShaderInvocations), FEATURE(geometryShader), 0, 0, 0, 0.0f },
285 { LIMIT(maxGeometryInputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f },
286 { LIMIT(maxGeometryOutputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f },
287 { LIMIT(maxGeometryOutputVertices), FEATURE(geometryShader), 0, 0, 0, 0.0f },
288 { LIMIT(maxGeometryTotalOutputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f },
289 { LIMIT(maxFragmentDualSrcAttachments), FEATURE(dualSrcBlend), 0, 0, 0, 0.0f },
290 { LIMIT(maxDrawIndexedIndexValue), FEATURE(fullDrawIndexUint32), (1<<24)-1, 0, 0, 0.0f },
291 { LIMIT(maxDrawIndirectCount), FEATURE(multiDrawIndirect), 1, 0, 0, 0.0f },
292 { LIMIT(maxSamplerAnisotropy), FEATURE(samplerAnisotropy), 1, 0, 0, 0.0f },
293 { LIMIT(maxViewports), FEATURE(multiViewport), 1, 0, 0, 0.0f },
294 { LIMIT(minTexelGatherOffset), FEATURE(shaderImageGatherExtended), 0, 0, 0, 0.0f },
295 { LIMIT(maxTexelGatherOffset), FEATURE(shaderImageGatherExtended), 0, 0, 0, 0.0f },
296 { LIMIT(minInterpolationOffset), FEATURE(sampleRateShading), 0, 0, 0, 0.0f },
297 { LIMIT(maxInterpolationOffset), FEATURE(sampleRateShading), 0, 0, 0, 0.0f },
298 { LIMIT(subPixelInterpolationOffsetBits), FEATURE(sampleRateShading), 0, 0, 0, 0.0f },
299 { LIMIT(storageImageSampleCounts), FEATURE(shaderStorageImageMultisample), VK_SAMPLE_COUNT_1_BIT, 0, 0, 0.0f },
300 { LIMIT(maxClipDistances), FEATURE(shaderClipDistance), 0, 0, 0, 0.0f },
301 { LIMIT(maxCullDistances), FEATURE(shaderClipDistance), 0, 0, 0, 0.0f },
302 { LIMIT(maxCombinedClipAndCullDistances), FEATURE(shaderClipDistance), 0, 0, 0, 0.0f },
303 { LIMIT(pointSizeRange[0]), FEATURE(largePoints), 0, 0, 0, 1.0f },
304 { LIMIT(pointSizeRange[1]), FEATURE(largePoints), 0, 0, 0, 1.0f },
305 { LIMIT(lineWidthRange[0]), FEATURE(wideLines), 0, 0, 0, 1.0f },
306 { LIMIT(lineWidthRange[1]), FEATURE(wideLines), 0, 0, 0, 1.0f },
307 { LIMIT(pointSizeGranularity), FEATURE(largePoints), 0, 0, 0, 0.0f },
308 { LIMIT(lineWidthGranularity), FEATURE(wideLines), 0, 0, 0, 0.0f }
311 log << TestLog::Message << *limits << TestLog::EndMessage;
313 //!< First build a map from limit to unsupported table index
314 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
316 for (deUint32 unsuppNdx = 0; unsuppNdx < DE_LENGTH_OF_ARRAY(unsupportedFeatureTable); unsuppNdx++)
318 if (unsupportedFeatureTable[unsuppNdx].limitOffset == featureLimitTable[ndx].offset)
320 featureLimitTable[ndx].unsuppTableNdx = unsuppNdx;
326 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
328 switch (featureLimitTable[ndx].format)
330 case LIMIT_FORMAT_UNSIGNED_INT:
332 deUint32 limitToCheck = featureLimitTable[ndx].uintVal;
333 if (featureLimitTable[ndx].unsuppTableNdx != -1)
335 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
336 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].uintVal;
339 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
342 if (*((deUint32*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
344 log << TestLog::Message << "limit Validation failed " << featureLimitTable[ndx].name
345 << " not valid-limit type MIN - actual is "
346 << *((deUint32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
350 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
352 if (*((deUint32*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
354 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
355 << " not valid-limit type MAX - actual is "
356 << *((deUint32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
363 case LIMIT_FORMAT_FLOAT:
365 float limitToCheck = featureLimitTable[ndx].floatVal;
366 if (featureLimitTable[ndx].unsuppTableNdx != -1)
368 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
369 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].floatVal;
372 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
374 if (*((float*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
376 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
377 << " not valid-limit type MIN - actual is "
378 << *((float*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
382 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
384 if (*((float*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
386 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
387 << " not valid-limit type MAX actual is "
388 << *((float*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
395 case LIMIT_FORMAT_SIGNED_INT:
397 deInt32 limitToCheck = featureLimitTable[ndx].intVal;
398 if (featureLimitTable[ndx].unsuppTableNdx != -1)
400 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
401 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].intVal;
403 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
405 if (*((deInt32*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
407 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
408 << " not valid-limit type MIN actual is "
409 << *((deInt32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
413 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
415 if (*((deInt32*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
417 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
418 << " not valid-limit type MAX actual is "
419 << *((deInt32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
426 case LIMIT_FORMAT_DEVICE_SIZE:
428 deUint64 limitToCheck = featureLimitTable[ndx].deviceSizeVal;
429 if (featureLimitTable[ndx].unsuppTableNdx != -1)
431 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
432 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].deviceSizeVal;
435 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
437 if (*((deUint64*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
439 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
440 << " not valid-limit type MIN actual is "
441 << *((deUint64*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
445 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
447 if (*((deUint64*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
449 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
450 << " not valid-limit type MAX actual is "
451 << *((deUint64*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
458 case LIMIT_FORMAT_BITMASK:
460 deUint32 limitToCheck = featureLimitTable[ndx].uintVal;
461 if (featureLimitTable[ndx].unsuppTableNdx != -1)
463 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
464 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].uintVal;
467 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
469 if ((*((deUint32*)((deUint8*)limits+featureLimitTable[ndx].offset)) & limitToCheck) != limitToCheck)
471 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
472 << " not valid-limit type bitmask actual is "
473 << *((deUint64*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
486 if (limits->maxFramebufferWidth > limits->maxViewportDimensions[0] ||
487 limits->maxFramebufferHeight > limits->maxViewportDimensions[1])
489 log << TestLog::Message << "limit validation failed, maxFramebufferDimension of "
490 << "[" << limits->maxFramebufferWidth << ", " << limits->maxFramebufferHeight << "] "
491 << "is larger than maxViewportDimension of "
492 << "[" << limits->maxViewportDimensions[0] << ", " << limits->maxViewportDimensions[1] << "]" << TestLog::EndMessage;
496 if (limits->viewportBoundsRange[0] > float(-2 * limits->maxViewportDimensions[0]))
498 log << TestLog::Message << "limit validation failed, viewPortBoundsRange[0] of " << limits->viewportBoundsRange[0]
499 << "is larger than -2*maxViewportDimension[0] of " << -2*limits->maxViewportDimensions[0] << TestLog::EndMessage;
503 if (limits->viewportBoundsRange[1] < float(2 * limits->maxViewportDimensions[1] - 1))
505 log << TestLog::Message << "limit validation failed, viewportBoundsRange[1] of " << limits->viewportBoundsRange[1]
506 << "is less than 2*maxViewportDimension[1] of " << 2*limits->maxViewportDimensions[1] << TestLog::EndMessage;
513 void validateLimitsCheckSupport (Context& context)
515 if (!context.contextSupports(vk::ApiVersion(1, 2, 0)))
516 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
519 typedef struct FeatureLimitTableItem_
522 const char* condName;
525 deUint32 uintVal; //!< Format is UNSIGNED_INT
526 deInt32 intVal; //!< Format is SIGNED_INT
527 deUint64 deviceSizeVal; //!< Format is DEVICE_SIZE
528 float floatVal; //!< Format is FLOAT
531 } FeatureLimitTableItem;
534 bool validateNumericLimit (const T limitToCheck, const T reportedValue, const LimitType limitType, const char* limitName, TestLog& log)
536 if (limitType == LIMIT_TYPE_MIN)
538 if (reportedValue < limitToCheck)
540 log << TestLog::Message << "Limit validation failed " << limitName
541 << " reported value is " << reportedValue
542 << " expected MIN " << limitToCheck
543 << TestLog::EndMessage;
548 log << TestLog::Message << limitName
549 << "=" << reportedValue
550 << " (>=" << limitToCheck << ")"
551 << TestLog::EndMessage;
553 else if (limitType == LIMIT_TYPE_MAX)
555 if (reportedValue > limitToCheck)
557 log << TestLog::Message << "Limit validation failed " << limitName
558 << " reported value is " << reportedValue
559 << " expected MAX " << limitToCheck
560 << TestLog::EndMessage;
565 log << TestLog::Message << limitName
566 << "=" << reportedValue
567 << " (<=" << limitToCheck << ")"
568 << TestLog::EndMessage;
575 bool validateBitmaskLimit (const T limitToCheck, const T reportedValue, const LimitType limitType, const char* limitName, TestLog& log)
577 if (limitType == LIMIT_TYPE_MIN)
579 if ((reportedValue & limitToCheck) != limitToCheck)
581 log << TestLog::Message << "Limit validation failed " << limitName
582 << " reported value is " << reportedValue
583 << " expected MIN " << limitToCheck
584 << TestLog::EndMessage;
589 log << TestLog::Message << limitName
590 << "=" << tcu::toHex(reportedValue)
591 << " (contains " << tcu::toHex(limitToCheck) << ")"
592 << TestLog::EndMessage;
598 bool validateLimit (FeatureLimitTableItem limit, TestLog& log)
600 if (*((VkBool32*)limit.cond) == DE_FALSE)
602 log << TestLog::Message
603 << "Limit validation skipped '" << limit.name << "' due to "
604 << limit.condName << " == false'"
605 << TestLog::EndMessage;
610 switch (limit.format)
612 case LIMIT_FORMAT_UNSIGNED_INT:
614 const deUint32 limitToCheck = limit.uintVal;
615 const deUint32 reportedValue = *(deUint32*)limit.ptr;
617 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
620 case LIMIT_FORMAT_FLOAT:
622 const float limitToCheck = limit.floatVal;
623 const float reportedValue = *(float*)limit.ptr;
625 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
628 case LIMIT_FORMAT_SIGNED_INT:
630 const deInt32 limitToCheck = limit.intVal;
631 const deInt32 reportedValue = *(deInt32*)limit.ptr;
633 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
636 case LIMIT_FORMAT_DEVICE_SIZE:
638 const deUint64 limitToCheck = limit.deviceSizeVal;
639 const deUint64 reportedValue = *(deUint64*)limit.ptr;
641 return validateNumericLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
644 case LIMIT_FORMAT_BITMASK:
646 const deUint32 limitToCheck = limit.uintVal;
647 const deUint32 reportedValue = *(deUint32*)limit.ptr;
649 return validateBitmaskLimit(limitToCheck, reportedValue, limit.type, limit.name, log);
653 TCU_THROW(InternalError, "Unknown LimitFormat specified");
660 #define PN(_X_) &(_X_), (const char*)(#_X_)
663 #define LIM_MIN_UINT32(X) deUint32(X), 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN
664 #define LIM_MAX_UINT32(X) deUint32(X), 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MAX
665 #define LIM_NONE_UINT32 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE
666 #define LIM_MIN_INT32(X) 0, deInt32(X), 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MIN
667 #define LIM_MAX_INT32(X) 0, deInt32(X), 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MAX
668 #define LIM_NONE_INT32 0, 0, 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_NONE
669 #define LIM_MIN_DEVSIZE(X) 0, 0, VkDeviceSize(X), 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN
670 #define LIM_MAX_DEVSIZE(X) 0, 0, VkDeviceSize(X), 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX
671 #define LIM_NONE_DEVSIZE 0, 0, 0, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_NONE
672 #define LIM_MIN_FLOAT(X) 0, 0, 0, float(X), LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN
673 #define LIM_MAX_FLOAT(X) 0, 0, 0, float(X), LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX
674 #define LIM_NONE_FLOAT 0, 0, 0, 0.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_NONE
675 #define LIM_MIN_BITI32(X) deUint32(X), 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN
676 #define LIM_MAX_BITI32(X) deUint32(X), 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MAX
677 #define LIM_NONE_BITI32 0, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_NONE
679 tcu::TestStatus validateLimits12 (Context& context)
681 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
682 const InstanceInterface& vki = context.getInstanceInterface();
683 TestLog& log = context.getTestContext().getLog();
684 bool limitsOk = true;
686 const VkPhysicalDeviceFeatures2& features2 = context.getDeviceFeatures2();
687 const VkPhysicalDeviceFeatures& features = features2.features;
688 const VkPhysicalDeviceVulkan12Features features12 = getPhysicalDeviceVulkan12Features(vki, physicalDevice);
690 const VkPhysicalDeviceProperties2& properties2 = context.getDeviceProperties2();
691 const VkPhysicalDeviceVulkan12Properties vulkan12Properties = getPhysicalDeviceVulkan12Properties(vki, physicalDevice);
692 const VkPhysicalDeviceVulkan11Properties vulkan11Properties = getPhysicalDeviceVulkan11Properties(vki, physicalDevice);
693 const VkPhysicalDeviceLimits& limits = properties2.properties.limits;
695 const VkBool32 checkAlways = VK_TRUE;
696 const VkBool32 checkVulkan12Limit = VK_TRUE;
698 deUint32 shaderStages = 3;
699 deUint32 maxPerStageResourcesMin = deMin32(128, limits.maxPerStageDescriptorUniformBuffers +
700 limits.maxPerStageDescriptorStorageBuffers +
701 limits.maxPerStageDescriptorSampledImages +
702 limits.maxPerStageDescriptorStorageImages +
703 limits.maxPerStageDescriptorInputAttachments +
704 limits.maxColorAttachments);
706 if (features.tessellationShader)
711 if (features.geometryShader)
716 FeatureLimitTableItem featureLimitTable[] =
718 { PN(checkAlways), PN(limits.maxImageDimension1D), LIM_MIN_UINT32(4096) },
719 { PN(checkAlways), PN(limits.maxImageDimension2D), LIM_MIN_UINT32(4096) },
720 { PN(checkAlways), PN(limits.maxImageDimension3D), LIM_MIN_UINT32(256) },
721 { PN(checkAlways), PN(limits.maxImageDimensionCube), LIM_MIN_UINT32(4096) },
722 { PN(checkAlways), PN(limits.maxImageArrayLayers), LIM_MIN_UINT32(256) },
723 { PN(checkAlways), PN(limits.maxTexelBufferElements), LIM_MIN_UINT32(65536) },
724 { PN(checkAlways), PN(limits.maxUniformBufferRange), LIM_MIN_UINT32(16384) },
725 { PN(checkAlways), PN(limits.maxStorageBufferRange), LIM_MIN_UINT32((1<<27)) },
726 { PN(checkAlways), PN(limits.maxPushConstantsSize), LIM_MIN_UINT32(128) },
727 { PN(checkAlways), PN(limits.maxMemoryAllocationCount), LIM_MIN_UINT32(4096) },
728 { PN(checkAlways), PN(limits.maxSamplerAllocationCount), LIM_MIN_UINT32(4000) },
729 { PN(checkAlways), PN(limits.bufferImageGranularity), LIM_MIN_DEVSIZE(1) },
730 { PN(checkAlways), PN(limits.bufferImageGranularity), LIM_MAX_DEVSIZE(131072) },
731 { PN(features.sparseBinding), PN(limits.sparseAddressSpaceSize), LIM_MIN_DEVSIZE((1ull<<31)) },
732 { PN(checkAlways), PN(limits.maxBoundDescriptorSets), LIM_MIN_UINT32(4) },
733 { PN(checkAlways), PN(limits.maxPerStageDescriptorSamplers), LIM_MIN_UINT32(16) },
734 { PN(checkAlways), PN(limits.maxPerStageDescriptorUniformBuffers), LIM_MIN_UINT32(12) },
735 { PN(checkAlways), PN(limits.maxPerStageDescriptorStorageBuffers), LIM_MIN_UINT32(4) },
736 { PN(checkAlways), PN(limits.maxPerStageDescriptorSampledImages), LIM_MIN_UINT32(16) },
737 { PN(checkAlways), PN(limits.maxPerStageDescriptorStorageImages), LIM_MIN_UINT32(4) },
738 { PN(checkAlways), PN(limits.maxPerStageDescriptorInputAttachments), LIM_MIN_UINT32(4) },
739 { PN(checkAlways), PN(limits.maxPerStageResources), LIM_MIN_UINT32(maxPerStageResourcesMin) },
740 { PN(checkAlways), PN(limits.maxDescriptorSetSamplers), LIM_MIN_UINT32(shaderStages * 16) },
741 { PN(checkAlways), PN(limits.maxDescriptorSetUniformBuffers), LIM_MIN_UINT32(shaderStages * 12) },
742 { PN(checkAlways), PN(limits.maxDescriptorSetUniformBuffersDynamic), LIM_MIN_UINT32(8) },
743 { PN(checkAlways), PN(limits.maxDescriptorSetStorageBuffers), LIM_MIN_UINT32(shaderStages * 4) },
744 { PN(checkAlways), PN(limits.maxDescriptorSetStorageBuffersDynamic), LIM_MIN_UINT32(4) },
745 { PN(checkAlways), PN(limits.maxDescriptorSetSampledImages), LIM_MIN_UINT32(shaderStages * 16) },
746 { PN(checkAlways), PN(limits.maxDescriptorSetStorageImages), LIM_MIN_UINT32(shaderStages * 4) },
747 { PN(checkAlways), PN(limits.maxDescriptorSetInputAttachments), LIM_MIN_UINT32(4) },
748 { PN(checkAlways), PN(limits.maxVertexInputAttributes), LIM_MIN_UINT32(16) },
749 { PN(checkAlways), PN(limits.maxVertexInputBindings), LIM_MIN_UINT32(16) },
750 { PN(checkAlways), PN(limits.maxVertexInputAttributeOffset), LIM_MIN_UINT32(2047) },
751 { PN(checkAlways), PN(limits.maxVertexInputBindingStride), LIM_MIN_UINT32(2048) },
752 { PN(checkAlways), PN(limits.maxVertexOutputComponents), LIM_MIN_UINT32(64) },
753 { PN(features.tessellationShader), PN(limits.maxTessellationGenerationLevel), LIM_MIN_UINT32(64) },
754 { PN(features.tessellationShader), PN(limits.maxTessellationPatchSize), LIM_MIN_UINT32(32) },
755 { PN(features.tessellationShader), PN(limits.maxTessellationControlPerVertexInputComponents), LIM_MIN_UINT32(64) },
756 { PN(features.tessellationShader), PN(limits.maxTessellationControlPerVertexOutputComponents), LIM_MIN_UINT32(64) },
757 { PN(features.tessellationShader), PN(limits.maxTessellationControlPerPatchOutputComponents), LIM_MIN_UINT32(120) },
758 { PN(features.tessellationShader), PN(limits.maxTessellationControlTotalOutputComponents), LIM_MIN_UINT32(2048) },
759 { PN(features.tessellationShader), PN(limits.maxTessellationEvaluationInputComponents), LIM_MIN_UINT32(64) },
760 { PN(features.tessellationShader), PN(limits.maxTessellationEvaluationOutputComponents), LIM_MIN_UINT32(64) },
761 { PN(features.geometryShader), PN(limits.maxGeometryShaderInvocations), LIM_MIN_UINT32(32) },
762 { PN(features.geometryShader), PN(limits.maxGeometryInputComponents), LIM_MIN_UINT32(64) },
763 { PN(features.geometryShader), PN(limits.maxGeometryOutputComponents), LIM_MIN_UINT32(64) },
764 { PN(features.geometryShader), PN(limits.maxGeometryOutputVertices), LIM_MIN_UINT32(256) },
765 { PN(features.geometryShader), PN(limits.maxGeometryTotalOutputComponents), LIM_MIN_UINT32(1024) },
766 { PN(checkAlways), PN(limits.maxFragmentInputComponents), LIM_MIN_UINT32(64) },
767 { PN(checkAlways), PN(limits.maxFragmentOutputAttachments), LIM_MIN_UINT32(4) },
768 { PN(features.dualSrcBlend), PN(limits.maxFragmentDualSrcAttachments), LIM_MIN_UINT32(1) },
769 { PN(checkAlways), PN(limits.maxFragmentCombinedOutputResources), LIM_MIN_UINT32(4) },
770 { PN(checkAlways), PN(limits.maxComputeSharedMemorySize), LIM_MIN_UINT32(16384) },
771 { PN(checkAlways), PN(limits.maxComputeWorkGroupCount[0]), LIM_MIN_UINT32(65535) },
772 { PN(checkAlways), PN(limits.maxComputeWorkGroupCount[1]), LIM_MIN_UINT32(65535) },
773 { PN(checkAlways), PN(limits.maxComputeWorkGroupCount[2]), LIM_MIN_UINT32(65535) },
774 { PN(checkAlways), PN(limits.maxComputeWorkGroupInvocations), LIM_MIN_UINT32(128) },
775 { PN(checkAlways), PN(limits.maxComputeWorkGroupSize[0]), LIM_MIN_UINT32(128) },
776 { PN(checkAlways), PN(limits.maxComputeWorkGroupSize[1]), LIM_MIN_UINT32(128) },
777 { PN(checkAlways), PN(limits.maxComputeWorkGroupSize[2]), LIM_MIN_UINT32(64) },
778 { PN(checkAlways), PN(limits.subPixelPrecisionBits), LIM_MIN_UINT32(4) },
779 { PN(checkAlways), PN(limits.subTexelPrecisionBits), LIM_MIN_UINT32(4) },
780 { PN(checkAlways), PN(limits.mipmapPrecisionBits), LIM_MIN_UINT32(4) },
781 { PN(features.fullDrawIndexUint32), PN(limits.maxDrawIndexedIndexValue), LIM_MIN_UINT32((deUint32)~0) },
782 { PN(features.multiDrawIndirect), PN(limits.maxDrawIndirectCount), LIM_MIN_UINT32(65535) },
783 { PN(checkAlways), PN(limits.maxSamplerLodBias), LIM_MIN_FLOAT(2.0f) },
784 { PN(features.samplerAnisotropy), PN(limits.maxSamplerAnisotropy), LIM_MIN_FLOAT(16.0f) },
785 { PN(features.multiViewport), PN(limits.maxViewports), LIM_MIN_UINT32(16) },
786 { PN(checkAlways), PN(limits.maxViewportDimensions[0]), LIM_MIN_UINT32(4096) },
787 { PN(checkAlways), PN(limits.maxViewportDimensions[1]), LIM_MIN_UINT32(4096) },
788 { PN(checkAlways), PN(limits.viewportBoundsRange[0]), LIM_MAX_FLOAT(-8192.0f) },
789 { PN(checkAlways), PN(limits.viewportBoundsRange[1]), LIM_MIN_FLOAT(8191.0f) },
790 { PN(checkAlways), PN(limits.viewportSubPixelBits), LIM_MIN_UINT32(0) },
791 { PN(checkAlways), PN(limits.minMemoryMapAlignment), LIM_MIN_UINT32(64) },
792 { PN(checkAlways), PN(limits.minTexelBufferOffsetAlignment), LIM_MIN_DEVSIZE(1) },
793 { PN(checkAlways), PN(limits.minTexelBufferOffsetAlignment), LIM_MAX_DEVSIZE(256) },
794 { PN(checkAlways), PN(limits.minUniformBufferOffsetAlignment), LIM_MIN_DEVSIZE(1) },
795 { PN(checkAlways), PN(limits.minUniformBufferOffsetAlignment), LIM_MAX_DEVSIZE(256) },
796 { PN(checkAlways), PN(limits.minStorageBufferOffsetAlignment), LIM_MIN_DEVSIZE(1) },
797 { PN(checkAlways), PN(limits.minStorageBufferOffsetAlignment), LIM_MAX_DEVSIZE(256) },
798 { PN(checkAlways), PN(limits.minTexelOffset), LIM_MAX_INT32(-8) },
799 { PN(checkAlways), PN(limits.maxTexelOffset), LIM_MIN_INT32(7) },
800 { PN(features.shaderImageGatherExtended), PN(limits.minTexelGatherOffset), LIM_MAX_INT32(-8) },
801 { PN(features.shaderImageGatherExtended), PN(limits.maxTexelGatherOffset), LIM_MIN_INT32(7) },
802 { PN(features.sampleRateShading), PN(limits.minInterpolationOffset), LIM_MAX_FLOAT(-0.5f) },
803 { PN(features.sampleRateShading), PN(limits.maxInterpolationOffset), LIM_MIN_FLOAT(0.5f - (1.0f/deFloatPow(2.0f, (float)limits.subPixelInterpolationOffsetBits))) },
804 { PN(features.sampleRateShading), PN(limits.subPixelInterpolationOffsetBits), LIM_MIN_UINT32(4) },
805 { PN(checkAlways), PN(limits.maxFramebufferWidth), LIM_MIN_UINT32(4096) },
806 { PN(checkAlways), PN(limits.maxFramebufferHeight), LIM_MIN_UINT32(4096) },
807 { PN(checkAlways), PN(limits.maxFramebufferLayers), LIM_MIN_UINT32(256) },
808 { PN(checkAlways), PN(limits.framebufferColorSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
809 { PN(checkVulkan12Limit), PN(vulkan12Properties.framebufferIntegerColorSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT) },
810 { PN(checkAlways), PN(limits.framebufferDepthSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
811 { PN(checkAlways), PN(limits.framebufferStencilSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
812 { PN(checkAlways), PN(limits.framebufferNoAttachmentsSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
813 { PN(checkAlways), PN(limits.maxColorAttachments), LIM_MIN_UINT32(4) },
814 { PN(checkAlways), PN(limits.sampledImageColorSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
815 { PN(checkAlways), PN(limits.sampledImageIntegerSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT) },
816 { PN(checkAlways), PN(limits.sampledImageDepthSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
817 { PN(checkAlways), PN(limits.sampledImageStencilSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
818 { PN(features.shaderStorageImageMultisample), PN(limits.storageImageSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT) },
819 { PN(checkAlways), PN(limits.maxSampleMaskWords), LIM_MIN_UINT32(1) },
820 { PN(checkAlways), PN(limits.timestampComputeAndGraphics), LIM_NONE_UINT32 },
821 { PN(checkAlways), PN(limits.timestampPeriod), LIM_NONE_UINT32 },
822 { PN(features.shaderClipDistance), PN(limits.maxClipDistances), LIM_MIN_UINT32(8) },
823 { PN(features.shaderClipDistance), PN(limits.maxCullDistances), LIM_MIN_UINT32(8) },
824 { PN(features.shaderClipDistance), PN(limits.maxCombinedClipAndCullDistances), LIM_MIN_UINT32(8) },
825 { PN(checkAlways), PN(limits.discreteQueuePriorities), LIM_MIN_UINT32(2) },
826 { PN(features.largePoints), PN(limits.pointSizeRange[0]), LIM_MIN_FLOAT(0.0f) },
827 { PN(features.largePoints), PN(limits.pointSizeRange[0]), LIM_MAX_FLOAT(1.0f) },
828 { PN(features.largePoints), PN(limits.pointSizeRange[1]), LIM_MIN_FLOAT(64.0f - limits.pointSizeGranularity) },
829 { PN(features.wideLines), PN(limits.lineWidthRange[0]), LIM_MIN_FLOAT(0.0f) },
830 { PN(features.wideLines), PN(limits.lineWidthRange[0]), LIM_MAX_FLOAT(1.0f) },
831 { PN(features.wideLines), PN(limits.lineWidthRange[1]), LIM_MIN_FLOAT(8.0f - limits.lineWidthGranularity) },
832 { PN(features.largePoints), PN(limits.pointSizeGranularity), LIM_MIN_FLOAT(0.0f) },
833 { PN(features.largePoints), PN(limits.pointSizeGranularity), LIM_MAX_FLOAT(1.0f) },
834 { PN(features.wideLines), PN(limits.lineWidthGranularity), LIM_MIN_FLOAT(0.0f) },
835 { PN(features.wideLines), PN(limits.lineWidthGranularity), LIM_MAX_FLOAT(1.0f) },
836 { PN(checkAlways), PN(limits.strictLines), LIM_NONE_UINT32 },
837 { PN(checkAlways), PN(limits.standardSampleLocations), LIM_NONE_UINT32 },
838 { PN(checkAlways), PN(limits.optimalBufferCopyOffsetAlignment), LIM_NONE_DEVSIZE },
839 { PN(checkAlways), PN(limits.optimalBufferCopyRowPitchAlignment), LIM_NONE_DEVSIZE },
840 { PN(checkAlways), PN(limits.nonCoherentAtomSize), LIM_MIN_DEVSIZE(1) },
841 { PN(checkAlways), PN(limits.nonCoherentAtomSize), LIM_MAX_DEVSIZE(256) },
844 { PN(checkVulkan12Limit), PN(vulkan11Properties.maxMultiviewViewCount), LIM_MIN_UINT32(6) },
845 { PN(checkVulkan12Limit), PN(vulkan11Properties.maxMultiviewInstanceIndex), LIM_MIN_UINT32((1<<27) - 1) },
847 // VK_KHR_maintenance3
848 { PN(checkVulkan12Limit), PN(vulkan11Properties.maxPerSetDescriptors), LIM_MIN_UINT32(1024) },
849 { PN(checkVulkan12Limit), PN(vulkan11Properties.maxMemoryAllocationSize), LIM_MIN_DEVSIZE(1<<30) },
851 // VK_EXT_descriptor_indexing
852 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxUpdateAfterBindDescriptorsInAllPools), LIM_MIN_UINT32(500000) },
853 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSamplers), LIM_MIN_UINT32(500000) },
854 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(12) },
855 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(500000) },
856 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSampledImages), LIM_MIN_UINT32(500000) },
857 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageImages), LIM_MIN_UINT32(500000) },
858 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindInputAttachments), LIM_MIN_UINT32(4) },
859 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageUpdateAfterBindResources), LIM_MIN_UINT32(500000) },
860 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSamplers), LIM_MIN_UINT32(500000) },
861 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(shaderStages * 12) },
862 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic), LIM_MIN_UINT32(8) },
863 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(500000) },
864 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic), LIM_MIN_UINT32(4) },
865 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSampledImages), LIM_MIN_UINT32(500000) },
866 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageImages), LIM_MIN_UINT32(500000) },
867 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindInputAttachments), LIM_MIN_UINT32(4) },
868 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSamplers), LIM_MIN_UINT32(limits.maxPerStageDescriptorSamplers) },
869 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(limits.maxPerStageDescriptorUniformBuffers) },
870 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageBuffers) },
871 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSampledImages), LIM_MIN_UINT32(limits.maxPerStageDescriptorSampledImages) },
872 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageImages), LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageImages) },
873 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageDescriptorUpdateAfterBindInputAttachments), LIM_MIN_UINT32(limits.maxPerStageDescriptorInputAttachments) },
874 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxPerStageUpdateAfterBindResources), LIM_MIN_UINT32(limits.maxPerStageResources) },
875 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSamplers), LIM_MIN_UINT32(limits.maxDescriptorSetSamplers) },
876 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffers) },
877 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic), LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffersDynamic) },
878 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffers) },
879 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic), LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffersDynamic) },
880 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindSampledImages), LIM_MIN_UINT32(limits.maxDescriptorSetSampledImages) },
881 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageImages), LIM_MIN_UINT32(limits.maxDescriptorSetStorageImages) },
882 { PN(features12.descriptorIndexing), PN(vulkan12Properties.maxDescriptorSetUpdateAfterBindInputAttachments), LIM_MIN_UINT32(limits.maxDescriptorSetInputAttachments) },
885 { PN(checkVulkan12Limit), PN(vulkan12Properties.maxTimelineSemaphoreValueDifference), LIM_MIN_DEVSIZE((1ull<<31) - 1) },
888 log << TestLog::Message << limits << TestLog::EndMessage;
890 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
891 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
893 if (limits.maxFramebufferWidth > limits.maxViewportDimensions[0] ||
894 limits.maxFramebufferHeight > limits.maxViewportDimensions[1])
896 log << TestLog::Message << "limit validation failed, maxFramebufferDimension of "
897 << "[" << limits.maxFramebufferWidth << ", " << limits.maxFramebufferHeight << "] "
898 << "is larger than maxViewportDimension of "
899 << "[" << limits.maxViewportDimensions[0] << ", " << limits.maxViewportDimensions[1] << "]" << TestLog::EndMessage;
903 if (limits.viewportBoundsRange[0] > float(-2 * limits.maxViewportDimensions[0]))
905 log << TestLog::Message << "limit validation failed, viewPortBoundsRange[0] of " << limits.viewportBoundsRange[0]
906 << "is larger than -2*maxViewportDimension[0] of " << -2*limits.maxViewportDimensions[0] << TestLog::EndMessage;
910 if (limits.viewportBoundsRange[1] < float(2 * limits.maxViewportDimensions[1] - 1))
912 log << TestLog::Message << "limit validation failed, viewportBoundsRange[1] of " << limits.viewportBoundsRange[1]
913 << "is less than 2*maxViewportDimension[1] of " << 2*limits.maxViewportDimensions[1] << TestLog::EndMessage;
918 return tcu::TestStatus::pass("pass");
920 return tcu::TestStatus::fail("fail");
923 void checkSupportKhrPushDescriptor (Context& context)
925 context.requireDeviceFunctionality("VK_KHR_push_descriptor");
928 tcu::TestStatus validateLimitsKhrPushDescriptor (Context& context)
930 const VkBool32 checkAlways = VK_TRUE;
931 const VkPhysicalDevicePushDescriptorPropertiesKHR& pushDescriptorPropertiesKHR = context.getPushDescriptorProperties();
932 TestLog& log = context.getTestContext().getLog();
933 bool limitsOk = true;
935 FeatureLimitTableItem featureLimitTable[] =
937 { PN(checkAlways), PN(pushDescriptorPropertiesKHR.maxPushDescriptors), LIM_MIN_UINT32(32) },
940 log << TestLog::Message << pushDescriptorPropertiesKHR << TestLog::EndMessage;
942 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
943 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
946 return tcu::TestStatus::pass("pass");
948 return tcu::TestStatus::fail("fail");
951 void checkSupportKhrMultiview (Context& context)
953 context.requireDeviceFunctionality("VK_KHR_multiview");
956 tcu::TestStatus validateLimitsKhrMultiview (Context& context)
958 const VkBool32 checkAlways = VK_TRUE;
959 const VkPhysicalDeviceMultiviewProperties& multiviewProperties = context.getMultiviewProperties();
960 TestLog& log = context.getTestContext().getLog();
961 bool limitsOk = true;
963 FeatureLimitTableItem featureLimitTable[] =
966 { PN(checkAlways), PN(multiviewProperties.maxMultiviewViewCount), LIM_MIN_UINT32(6) },
967 { PN(checkAlways), PN(multiviewProperties.maxMultiviewInstanceIndex), LIM_MIN_UINT32((1<<27) - 1) },
970 log << TestLog::Message << multiviewProperties << TestLog::EndMessage;
972 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
973 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
976 return tcu::TestStatus::pass("pass");
978 return tcu::TestStatus::fail("fail");
981 void checkSupportExtDiscardRectangles (Context& context)
983 context.requireDeviceFunctionality("VK_EXT_discard_rectangles");
986 tcu::TestStatus validateLimitsExtDiscardRectangles (Context& context)
988 const VkBool32 checkAlways = VK_TRUE;
989 const VkPhysicalDeviceDiscardRectanglePropertiesEXT& discardRectanglePropertiesEXT = context.getDiscardRectanglePropertiesEXT();
990 TestLog& log = context.getTestContext().getLog();
991 bool limitsOk = true;
993 FeatureLimitTableItem featureLimitTable[] =
995 { PN(checkAlways), PN(discardRectanglePropertiesEXT.maxDiscardRectangles), LIM_MIN_UINT32(4) },
998 log << TestLog::Message << discardRectanglePropertiesEXT << TestLog::EndMessage;
1000 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1001 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1004 return tcu::TestStatus::pass("pass");
1006 return tcu::TestStatus::fail("fail");
1009 void checkSupportExtSampleLocations (Context& context)
1011 context.requireDeviceFunctionality("VK_EXT_sample_locations");
1014 tcu::TestStatus validateLimitsExtSampleLocations (Context& context)
1016 const VkBool32 checkAlways = VK_TRUE;
1017 const VkPhysicalDeviceSampleLocationsPropertiesEXT& sampleLocationsPropertiesEXT = context.getSampleLocationsPropertiesEXT();
1018 TestLog& log = context.getTestContext().getLog();
1019 bool limitsOk = true;
1021 FeatureLimitTableItem featureLimitTable[] =
1023 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationSampleCounts), LIM_MIN_BITI32(VK_SAMPLE_COUNT_4_BIT) },
1024 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.maxSampleLocationGridSize.width), LIM_MIN_FLOAT(0.0f) },
1025 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.maxSampleLocationGridSize.height), LIM_MIN_FLOAT(0.0f) },
1026 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationCoordinateRange[0]), LIM_MAX_FLOAT(0.0f) },
1027 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationCoordinateRange[1]), LIM_MIN_FLOAT(0.9375f) },
1028 { PN(checkAlways), PN(sampleLocationsPropertiesEXT.sampleLocationSubPixelBits), LIM_MIN_UINT32(4) },
1031 log << TestLog::Message << sampleLocationsPropertiesEXT << TestLog::EndMessage;
1033 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1034 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1037 return tcu::TestStatus::pass("pass");
1039 return tcu::TestStatus::fail("fail");
1042 void checkSupportExtExternalMemoryHost (Context& context)
1044 context.requireDeviceFunctionality("VK_EXT_external_memory_host");
1047 tcu::TestStatus validateLimitsExtExternalMemoryHost (Context& context)
1049 const VkBool32 checkAlways = VK_TRUE;
1050 const VkPhysicalDeviceExternalMemoryHostPropertiesEXT& externalMemoryHostPropertiesEXT = context.getExternalMemoryHostPropertiesEXT();
1051 TestLog& log = context.getTestContext().getLog();
1052 bool limitsOk = true;
1054 FeatureLimitTableItem featureLimitTable[] =
1056 { PN(checkAlways), PN(externalMemoryHostPropertiesEXT.minImportedHostPointerAlignment), LIM_MAX_DEVSIZE(65536) },
1059 log << TestLog::Message << externalMemoryHostPropertiesEXT << TestLog::EndMessage;
1061 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1062 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1065 return tcu::TestStatus::pass("pass");
1067 return tcu::TestStatus::fail("fail");
1070 void checkSupportExtBlendOperationAdvanced (Context& context)
1072 context.requireDeviceFunctionality("VK_EXT_blend_operation_advanced");
1075 tcu::TestStatus validateLimitsExtBlendOperationAdvanced (Context& context)
1077 const VkBool32 checkAlways = VK_TRUE;
1078 const VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT& blendOperationAdvancedPropertiesEXT = context.getBlendOperationAdvancedPropertiesEXT();
1079 TestLog& log = context.getTestContext().getLog();
1080 bool limitsOk = true;
1082 FeatureLimitTableItem featureLimitTable[] =
1084 { PN(checkAlways), PN(blendOperationAdvancedPropertiesEXT.advancedBlendMaxColorAttachments), LIM_MIN_UINT32(1) },
1087 log << TestLog::Message << blendOperationAdvancedPropertiesEXT << TestLog::EndMessage;
1089 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1090 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1093 return tcu::TestStatus::pass("pass");
1095 return tcu::TestStatus::fail("fail");
1098 void checkSupportKhrMaintenance3 (Context& context)
1100 context.requireDeviceFunctionality("VK_KHR_maintenance3");
1103 tcu::TestStatus validateLimitsKhrMaintenance3 (Context& context)
1105 const VkBool32 checkAlways = VK_TRUE;
1106 const VkPhysicalDeviceMaintenance3Properties& maintenance3Properties = context.getMaintenance3Properties();
1107 TestLog& log = context.getTestContext().getLog();
1108 bool limitsOk = true;
1110 FeatureLimitTableItem featureLimitTable[] =
1112 { PN(checkAlways), PN(maintenance3Properties.maxPerSetDescriptors), LIM_MIN_UINT32(1024) },
1113 { PN(checkAlways), PN(maintenance3Properties.maxMemoryAllocationSize), LIM_MIN_DEVSIZE(1<<30) },
1116 log << TestLog::Message << maintenance3Properties << TestLog::EndMessage;
1118 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1119 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1122 return tcu::TestStatus::pass("pass");
1124 return tcu::TestStatus::fail("fail");
1127 void checkSupportExtConservativeRasterization (Context& context)
1129 context.requireDeviceFunctionality("VK_EXT_conservative_rasterization");
1132 tcu::TestStatus validateLimitsExtConservativeRasterization (Context& context)
1134 const VkBool32 checkAlways = VK_TRUE;
1135 const VkPhysicalDeviceConservativeRasterizationPropertiesEXT& conservativeRasterizationPropertiesEXT = context.getConservativeRasterizationPropertiesEXT();
1136 TestLog& log = context.getTestContext().getLog();
1137 bool limitsOk = true;
1139 FeatureLimitTableItem featureLimitTable[] =
1141 { PN(checkAlways), PN(conservativeRasterizationPropertiesEXT.primitiveOverestimationSize), LIM_MIN_FLOAT(0.0f) },
1142 { PN(checkAlways), PN(conservativeRasterizationPropertiesEXT.maxExtraPrimitiveOverestimationSize), LIM_MIN_FLOAT(0.0f) },
1143 { PN(checkAlways), PN(conservativeRasterizationPropertiesEXT.extraPrimitiveOverestimationSizeGranularity), LIM_MIN_FLOAT(0.0f) },
1146 log << TestLog::Message << conservativeRasterizationPropertiesEXT << TestLog::EndMessage;
1148 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1149 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1152 return tcu::TestStatus::pass("pass");
1154 return tcu::TestStatus::fail("fail");
1157 void checkSupportExtDescriptorIndexing (Context& context)
1159 const std::string& requiredDeviceExtension = "VK_EXT_descriptor_indexing";
1160 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1161 const InstanceInterface& vki = context.getInstanceInterface();
1162 const std::vector<VkExtensionProperties> deviceExtensionProperties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
1164 if (!isExtensionSupported(deviceExtensionProperties, RequiredExtension(requiredDeviceExtension)))
1165 TCU_THROW(NotSupportedError, requiredDeviceExtension + " is not supported");
1167 // Extension string is present, then extension is really supported and should have been added into chain in DefaultDevice properties and features
1170 tcu::TestStatus validateLimitsExtDescriptorIndexing (Context& context)
1172 const VkBool32 checkAlways = VK_TRUE;
1173 const VkPhysicalDeviceProperties2& properties2 = context.getDeviceProperties2();
1174 const VkPhysicalDeviceLimits& limits = properties2.properties.limits;
1175 const VkPhysicalDeviceDescriptorIndexingPropertiesEXT& descriptorIndexingPropertiesEXT = context.getDescriptorIndexingProperties();
1176 const VkPhysicalDeviceFeatures& features = context.getDeviceFeatures();
1177 const deUint32 tessellationShaderCount = (features.tessellationShader) ? 2 : 0;
1178 const deUint32 geometryShaderCount = (features.geometryShader) ? 1 : 0;
1179 const deUint32 shaderStages = 3 + tessellationShaderCount + geometryShaderCount;
1180 TestLog& log = context.getTestContext().getLog();
1181 bool limitsOk = true;
1183 FeatureLimitTableItem featureLimitTable[] =
1185 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxUpdateAfterBindDescriptorsInAllPools), LIM_MIN_UINT32(500000) },
1186 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindSamplers), LIM_MIN_UINT32(500000) },
1187 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(12) },
1188 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(500000) },
1189 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindSampledImages), LIM_MIN_UINT32(500000) },
1190 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindStorageImages), LIM_MIN_UINT32(500000) },
1191 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindInputAttachments), LIM_MIN_UINT32(4) },
1192 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageUpdateAfterBindResources), LIM_MIN_UINT32(500000) },
1193 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindSamplers), LIM_MIN_UINT32(500000) },
1194 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(shaderStages * 12) },
1195 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic), LIM_MIN_UINT32(8) },
1196 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(500000) },
1197 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic), LIM_MIN_UINT32(4) },
1198 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindSampledImages), LIM_MIN_UINT32(500000) },
1199 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindStorageImages), LIM_MIN_UINT32(500000) },
1200 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindInputAttachments), LIM_MIN_UINT32(4) },
1201 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindSamplers), LIM_MIN_UINT32(limits.maxPerStageDescriptorSamplers) },
1202 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(limits.maxPerStageDescriptorUniformBuffers) },
1203 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageBuffers) },
1204 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindSampledImages), LIM_MIN_UINT32(limits.maxPerStageDescriptorSampledImages) },
1205 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindStorageImages), LIM_MIN_UINT32(limits.maxPerStageDescriptorStorageImages) },
1206 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageDescriptorUpdateAfterBindInputAttachments), LIM_MIN_UINT32(limits.maxPerStageDescriptorInputAttachments) },
1207 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxPerStageUpdateAfterBindResources), LIM_MIN_UINT32(limits.maxPerStageResources) },
1208 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindSamplers), LIM_MIN_UINT32(limits.maxDescriptorSetSamplers) },
1209 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindUniformBuffers), LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffers) },
1210 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic), LIM_MIN_UINT32(limits.maxDescriptorSetUniformBuffersDynamic) },
1211 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindStorageBuffers), LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffers) },
1212 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic), LIM_MIN_UINT32(limits.maxDescriptorSetStorageBuffersDynamic) },
1213 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindSampledImages), LIM_MIN_UINT32(limits.maxDescriptorSetSampledImages) },
1214 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindStorageImages), LIM_MIN_UINT32(limits.maxDescriptorSetStorageImages) },
1215 { PN(checkAlways), PN(descriptorIndexingPropertiesEXT.maxDescriptorSetUpdateAfterBindInputAttachments), LIM_MIN_UINT32(limits.maxDescriptorSetInputAttachments) },
1218 log << TestLog::Message << descriptorIndexingPropertiesEXT << TestLog::EndMessage;
1220 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1221 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1224 return tcu::TestStatus::pass("pass");
1226 return tcu::TestStatus::fail("fail");
1229 void checkSupportExtInlineUniformBlock (Context& context)
1231 context.requireDeviceFunctionality("VK_EXT_inline_uniform_block");
1234 tcu::TestStatus validateLimitsExtInlineUniformBlock (Context& context)
1236 const VkBool32 checkAlways = VK_TRUE;
1237 const VkPhysicalDeviceInlineUniformBlockPropertiesEXT& inlineUniformBlockPropertiesEXT = context.getInlineUniformBlockPropertiesEXT();
1238 TestLog& log = context.getTestContext().getLog();
1239 bool limitsOk = true;
1241 FeatureLimitTableItem featureLimitTable[] =
1243 { PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxInlineUniformBlockSize), LIM_MIN_UINT32(256) },
1244 { PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxPerStageDescriptorInlineUniformBlocks), LIM_MIN_UINT32(4) },
1245 { PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks), LIM_MIN_UINT32(4) },
1246 { PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxDescriptorSetInlineUniformBlocks), LIM_MIN_UINT32(4) },
1247 { PN(checkAlways), PN(inlineUniformBlockPropertiesEXT.maxDescriptorSetUpdateAfterBindInlineUniformBlocks), LIM_MIN_UINT32(4) },
1250 log << TestLog::Message << inlineUniformBlockPropertiesEXT << TestLog::EndMessage;
1252 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1253 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1256 return tcu::TestStatus::pass("pass");
1258 return tcu::TestStatus::fail("fail");
1261 void checkSupportExtVertexAttributeDivisor (Context& context)
1263 context.requireDeviceFunctionality("VK_EXT_vertex_attribute_divisor");
1266 tcu::TestStatus validateLimitsExtVertexAttributeDivisor (Context& context)
1268 const VkBool32 checkAlways = VK_TRUE;
1269 const VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT& vertexAttributeDivisorPropertiesEXT = context.getVertexAttributeDivisorPropertiesEXT();
1270 TestLog& log = context.getTestContext().getLog();
1271 bool limitsOk = true;
1273 FeatureLimitTableItem featureLimitTable[] =
1275 { PN(checkAlways), PN(vertexAttributeDivisorPropertiesEXT.maxVertexAttribDivisor), LIM_MIN_UINT32((1<<16) - 1) },
1278 log << TestLog::Message << vertexAttributeDivisorPropertiesEXT << TestLog::EndMessage;
1280 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1281 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1284 return tcu::TestStatus::pass("pass");
1286 return tcu::TestStatus::fail("fail");
1289 void checkSupportNvMeshShader (Context& context)
1291 const std::string& requiredDeviceExtension = "VK_NV_mesh_shader";
1292 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1293 const InstanceInterface& vki = context.getInstanceInterface();
1294 const std::vector<VkExtensionProperties> deviceExtensionProperties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
1296 if (!isExtensionSupported(deviceExtensionProperties, RequiredExtension(requiredDeviceExtension)))
1297 TCU_THROW(NotSupportedError, requiredDeviceExtension + " is not supported");
1300 tcu::TestStatus validateLimitsNvMeshShader (Context& context)
1302 const VkBool32 checkAlways = VK_TRUE;
1303 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1304 const InstanceInterface& vki = context.getInstanceInterface();
1305 TestLog& log = context.getTestContext().getLog();
1306 bool limitsOk = true;
1307 VkPhysicalDeviceMeshShaderPropertiesNV meshShaderPropertiesNV = initVulkanStructure();
1308 VkPhysicalDeviceProperties2 properties2 = initVulkanStructure(&meshShaderPropertiesNV);
1310 vki.getPhysicalDeviceProperties2(physicalDevice, &properties2);
1312 FeatureLimitTableItem featureLimitTable[] =
1314 { PN(checkAlways), PN(meshShaderPropertiesNV.maxDrawMeshTasksCount), LIM_MIN_UINT32(deUint32((1ull<<16) - 1)) },
1315 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupInvocations), LIM_MIN_UINT32(32) },
1316 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupSize[0]), LIM_MIN_UINT32(32) },
1317 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupSize[1]), LIM_MIN_UINT32(1) },
1318 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskWorkGroupSize[2]), LIM_MIN_UINT32(1) },
1319 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskTotalMemorySize), LIM_MIN_UINT32(16384) },
1320 { PN(checkAlways), PN(meshShaderPropertiesNV.maxTaskOutputCount), LIM_MIN_UINT32((1<<16) - 1) },
1321 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupInvocations), LIM_MIN_UINT32(32) },
1322 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupSize[0]), LIM_MIN_UINT32(32) },
1323 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupSize[1]), LIM_MIN_UINT32(1) },
1324 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshWorkGroupSize[2]), LIM_MIN_UINT32(1) },
1325 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshTotalMemorySize), LIM_MIN_UINT32(16384) },
1326 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshOutputVertices), LIM_MIN_UINT32(256) },
1327 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshOutputPrimitives), LIM_MIN_UINT32(256) },
1328 { PN(checkAlways), PN(meshShaderPropertiesNV.maxMeshMultiviewViewCount), LIM_MIN_UINT32(1) },
1331 log << TestLog::Message << meshShaderPropertiesNV << TestLog::EndMessage;
1333 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1334 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1337 return tcu::TestStatus::pass("pass");
1339 return tcu::TestStatus::fail("fail");
1342 void checkSupportExtTransformFeedback (Context& context)
1344 context.requireDeviceFunctionality("VK_EXT_transform_feedback");
1347 tcu::TestStatus validateLimitsExtTransformFeedback (Context& context)
1349 const VkBool32 checkAlways = VK_TRUE;
1350 const VkPhysicalDeviceTransformFeedbackPropertiesEXT& transformFeedbackPropertiesEXT = context.getTransformFeedbackPropertiesEXT();
1351 TestLog& log = context.getTestContext().getLog();
1352 bool limitsOk = true;
1354 FeatureLimitTableItem featureLimitTable[] =
1356 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackStreams), LIM_MIN_UINT32(1) },
1357 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBuffers), LIM_MIN_UINT32(1) },
1358 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBufferSize), LIM_MIN_DEVSIZE(1ull<<27) },
1359 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackStreamDataSize), LIM_MIN_UINT32(512) },
1360 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBufferDataSize), LIM_MIN_UINT32(512) },
1361 { PN(checkAlways), PN(transformFeedbackPropertiesEXT.maxTransformFeedbackBufferDataStride), LIM_MIN_UINT32(512) },
1364 log << TestLog::Message << transformFeedbackPropertiesEXT << 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 void checkSupportExtFragmentDensityMap (Context& context)
1377 context.requireDeviceFunctionality("VK_EXT_fragment_density_map");
1380 tcu::TestStatus validateLimitsExtFragmentDensityMap (Context& context)
1382 const VkBool32 checkAlways = VK_TRUE;
1383 const VkPhysicalDeviceFragmentDensityMapPropertiesEXT& fragmentDensityMapPropertiesEXT = context.getFragmentDensityMapPropertiesEXT();
1384 TestLog& log = context.getTestContext().getLog();
1385 bool limitsOk = true;
1387 FeatureLimitTableItem featureLimitTable[] =
1389 { PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.minFragmentDensityTexelSize.width), LIM_MIN_UINT32(1) },
1390 { PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.minFragmentDensityTexelSize.height), LIM_MIN_UINT32(1) },
1391 { PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.maxFragmentDensityTexelSize.width), LIM_MIN_UINT32(1) },
1392 { PN(checkAlways), PN(fragmentDensityMapPropertiesEXT.maxFragmentDensityTexelSize.height), LIM_MIN_UINT32(1) },
1395 log << TestLog::Message << fragmentDensityMapPropertiesEXT << TestLog::EndMessage;
1397 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1398 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1401 return tcu::TestStatus::pass("pass");
1403 return tcu::TestStatus::fail("fail");
1406 void checkSupportNvRayTracing (Context& context)
1408 const std::string& requiredDeviceExtension = "VK_NV_ray_tracing";
1409 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1410 const InstanceInterface& vki = context.getInstanceInterface();
1411 const std::vector<VkExtensionProperties> deviceExtensionProperties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
1413 if (!isExtensionSupported(deviceExtensionProperties, RequiredExtension(requiredDeviceExtension)))
1414 TCU_THROW(NotSupportedError, requiredDeviceExtension + " is not supported");
1417 tcu::TestStatus validateLimitsNvRayTracing (Context& context)
1419 const VkBool32 checkAlways = VK_TRUE;
1420 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1421 const InstanceInterface& vki = context.getInstanceInterface();
1422 TestLog& log = context.getTestContext().getLog();
1423 bool limitsOk = true;
1424 VkPhysicalDeviceRayTracingPropertiesNV rayTracingPropertiesNV = initVulkanStructure();
1425 VkPhysicalDeviceProperties2 properties2 = initVulkanStructure(&rayTracingPropertiesNV);
1427 vki.getPhysicalDeviceProperties2(physicalDevice, &properties2);
1429 FeatureLimitTableItem featureLimitTable[] =
1431 { PN(checkAlways), PN(rayTracingPropertiesNV.shaderGroupHandleSize), LIM_MIN_UINT32(16) },
1432 { PN(checkAlways), PN(rayTracingPropertiesNV.maxRecursionDepth), LIM_MIN_UINT32(31) },
1433 { PN(checkAlways), PN(rayTracingPropertiesNV.shaderGroupBaseAlignment), LIM_MIN_UINT32(64) },
1434 { PN(checkAlways), PN(rayTracingPropertiesNV.maxGeometryCount), LIM_MIN_UINT32((1<<24) - 1) },
1435 { PN(checkAlways), PN(rayTracingPropertiesNV.maxInstanceCount), LIM_MIN_UINT32((1<<24) - 1) },
1436 { PN(checkAlways), PN(rayTracingPropertiesNV.maxTriangleCount), LIM_MIN_UINT32((1<<29) - 1) },
1437 { PN(checkAlways), PN(rayTracingPropertiesNV.maxDescriptorSetAccelerationStructures), LIM_MIN_UINT32(16) },
1440 log << TestLog::Message << rayTracingPropertiesNV << TestLog::EndMessage;
1442 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1443 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1446 return tcu::TestStatus::pass("pass");
1448 return tcu::TestStatus::fail("fail");
1451 void checkSupportKhrTimelineSemaphore (Context& context)
1453 context.requireDeviceFunctionality("VK_KHR_timeline_semaphore");
1456 tcu::TestStatus validateLimitsKhrTimelineSemaphore (Context& context)
1458 const VkBool32 checkAlways = VK_TRUE;
1459 const VkPhysicalDeviceTimelineSemaphorePropertiesKHR& timelineSemaphorePropertiesKHR = context.getTimelineSemaphoreProperties();
1460 bool limitsOk = true;
1461 TestLog& log = context.getTestContext().getLog();
1463 FeatureLimitTableItem featureLimitTable[] =
1465 { PN(checkAlways), PN(timelineSemaphorePropertiesKHR.maxTimelineSemaphoreValueDifference), LIM_MIN_DEVSIZE((1ull<<31) - 1) },
1468 log << TestLog::Message << timelineSemaphorePropertiesKHR << TestLog::EndMessage;
1470 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1471 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1474 return tcu::TestStatus::pass("pass");
1476 return tcu::TestStatus::fail("fail");
1479 void checkSupportExtLineRasterization (Context& context)
1481 context.requireDeviceFunctionality("VK_EXT_line_rasterization");
1484 tcu::TestStatus validateLimitsExtLineRasterization (Context& context)
1486 const VkBool32 checkAlways = VK_TRUE;
1487 const VkPhysicalDeviceLineRasterizationPropertiesEXT& lineRasterizationPropertiesEXT = context.getLineRasterizationPropertiesEXT();
1488 TestLog& log = context.getTestContext().getLog();
1489 bool limitsOk = true;
1491 FeatureLimitTableItem featureLimitTable[] =
1493 { PN(checkAlways), PN(lineRasterizationPropertiesEXT.lineSubPixelPrecisionBits), LIM_MIN_UINT32(4) },
1496 log << TestLog::Message << lineRasterizationPropertiesEXT << TestLog::EndMessage;
1498 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
1499 limitsOk = validateLimit(featureLimitTable[ndx], log) && limitsOk;
1502 return tcu::TestStatus::pass("pass");
1504 return tcu::TestStatus::fail("fail");
1507 void checkSupportFeatureBitInfluence (Context& context)
1509 if (!context.contextSupports(vk::ApiVersion(1, 2, 0)))
1510 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
1513 void createDevice (Context& context, void* pNext, const char* const* ppEnabledExtensionNames, deUint32 enabledExtensionCount)
1515 const PlatformInterface& platformInterface = context.getPlatformInterface();
1516 const Unique<VkInstance> instance (createDefaultInstance(platformInterface, context.getUsedApiVersion()));
1517 const InstanceDriver instanceDriver (platformInterface, instance.get());
1518 const VkPhysicalDevice physicalDevice = chooseDevice(instanceDriver, instance.get(), context.getTestContext().getCommandLine());
1519 const deUint32 queueFamilyIndex = 0;
1520 const deUint32 queueCount = 1;
1521 const deUint32 queueIndex = 0;
1522 const float queuePriority = 1.0f;
1523 const vector<VkQueueFamilyProperties> queueFamilyProperties = getPhysicalDeviceQueueFamilyProperties(instanceDriver, physicalDevice);
1524 const VkDeviceQueueCreateInfo deviceQueueCreateInfo =
1526 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, // VkStructureType sType;
1527 DE_NULL, // const void* pNext;
1528 (VkDeviceQueueCreateFlags)0u, // VkDeviceQueueCreateFlags flags;
1529 queueFamilyIndex, // deUint32 queueFamilyIndex;
1530 queueCount, // deUint32 queueCount;
1531 &queuePriority, // const float* pQueuePriorities;
1533 const VkDeviceCreateInfo deviceCreateInfo =
1535 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, // VkStructureType sType;
1536 pNext, // const void* pNext;
1537 (VkDeviceCreateFlags)0u, // VkDeviceCreateFlags flags;
1538 1, // deUint32 queueCreateInfoCount;
1539 &deviceQueueCreateInfo, // const VkDeviceQueueCreateInfo* pQueueCreateInfos;
1540 0, // deUint32 enabledLayerCount;
1541 DE_NULL, // const char* const* ppEnabledLayerNames;
1542 enabledExtensionCount, // deUint32 enabledExtensionCount;
1543 ppEnabledExtensionNames, // const char* const* ppEnabledExtensionNames;
1544 DE_NULL, // const VkPhysicalDeviceFeatures* pEnabledFeatures;
1546 const Unique<VkDevice> device (createDevice(platformInterface, *instance, instanceDriver, physicalDevice, &deviceCreateInfo));
1547 const DeviceDriver deviceDriver (platformInterface, instance.get(), device.get());
1548 const VkQueue queue = getDeviceQueue(deviceDriver, *device, queueFamilyIndex, queueIndex);
1550 VK_CHECK(deviceDriver.queueWaitIdle(queue));
1553 void cleanVulkanStruct (void* structPtr, size_t structSize)
1555 struct StructureBase
1557 VkStructureType sType;
1561 VkStructureType sType = ((StructureBase*)structPtr)->sType;
1563 deMemset(structPtr, 0, structSize);
1565 ((StructureBase*)structPtr)->sType = sType;
1568 tcu::TestStatus featureBitInfluenceOnDeviceCreate (Context& context)
1570 #define FEATURE_TABLE_ITEM(CORE, EXT, FIELD, STR) { &(CORE), sizeof(CORE), &(CORE.FIELD), #CORE "." #FIELD, &(EXT), sizeof(EXT), &(EXT.FIELD), #EXT "." #FIELD, STR }
1571 #define DEPENDENCY_DUAL_ITEM(CORE, EXT, FIELD, PARENT) { &(CORE.FIELD), &(CORE.PARENT) }, { &(EXT.FIELD), &(EXT.PARENT) }
1572 #define DEPENDENCY_SINGLE_ITEM(CORE, FIELD, PARENT) { &(CORE.FIELD), &(CORE.PARENT) }
1574 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
1575 const InstanceInterface& vki = context.getInstanceInterface();
1576 TestLog& log = context.getTestContext().getLog();
1577 const std::vector<VkExtensionProperties> deviceExtensionProperties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
1579 VkPhysicalDeviceFeatures2 features2 = initVulkanStructure();
1580 VkPhysicalDeviceVulkan11Features vulkan11Features = initVulkanStructure();
1581 VkPhysicalDeviceVulkan12Features vulkan12Features = initVulkanStructure();
1582 VkPhysicalDevice16BitStorageFeaturesKHR sixteenBitStorageFeatures = initVulkanStructure();
1583 VkPhysicalDeviceMultiviewFeatures multiviewFeatures = initVulkanStructure();
1584 VkPhysicalDeviceVariablePointersFeatures variablePointersFeatures = initVulkanStructure();
1585 VkPhysicalDeviceProtectedMemoryFeatures protectedMemoryFeatures = initVulkanStructure();
1586 VkPhysicalDeviceSamplerYcbcrConversionFeatures samplerYcbcrConversionFeatures = initVulkanStructure();
1587 VkPhysicalDeviceShaderDrawParametersFeatures shaderDrawParametersFeatures = initVulkanStructure();
1588 VkPhysicalDevice8BitStorageFeatures eightBitStorageFeatures = initVulkanStructure();
1589 VkPhysicalDeviceShaderAtomicInt64Features shaderAtomicInt64Features = initVulkanStructure();
1590 VkPhysicalDeviceShaderFloat16Int8Features shaderFloat16Int8Features = initVulkanStructure();
1591 VkPhysicalDeviceDescriptorIndexingFeatures descriptorIndexingFeatures = initVulkanStructure();
1592 VkPhysicalDeviceScalarBlockLayoutFeatures scalarBlockLayoutFeatures = initVulkanStructure();
1593 VkPhysicalDeviceImagelessFramebufferFeatures imagelessFramebufferFeatures = initVulkanStructure();
1594 VkPhysicalDeviceUniformBufferStandardLayoutFeatures uniformBufferStandardLayoutFeatures = initVulkanStructure();
1595 VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures shaderSubgroupExtendedTypesFeatures = initVulkanStructure();
1596 VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures separateDepthStencilLayoutsFeatures = initVulkanStructure();
1597 VkPhysicalDeviceHostQueryResetFeatures hostQueryResetFeatures = initVulkanStructure();
1598 VkPhysicalDeviceTimelineSemaphoreFeatures timelineSemaphoreFeatures = initVulkanStructure();
1599 VkPhysicalDeviceBufferDeviceAddressFeatures bufferDeviceAddressFeatures = initVulkanStructure();
1600 VkPhysicalDeviceVulkanMemoryModelFeatures vulkanMemoryModelFeatures = initVulkanStructure();
1602 struct DummyExtensionFeatures
1604 VkStructureType sType;
1606 VkBool32 descriptorIndexing;
1607 VkBool32 samplerFilterMinmax;
1608 } dummyExtensionFeatures;
1612 void* coreStructPtr;
1613 size_t coreStructSize;
1614 VkBool32* coreFieldPtr;
1615 const char* coreFieldName;
1617 size_t extStructSize;
1618 VkBool32* extFieldPtr;
1619 const char* extFieldName;
1620 const char* extString;
1624 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, storageBuffer16BitAccess, "VK_KHR_16bit_storage"),
1625 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, uniformAndStorageBuffer16BitAccess, "VK_KHR_16bit_storage"),
1626 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, storagePushConstant16, "VK_KHR_16bit_storage"),
1627 FEATURE_TABLE_ITEM(vulkan11Features, sixteenBitStorageFeatures, storageInputOutput16, "VK_KHR_16bit_storage"),
1628 FEATURE_TABLE_ITEM(vulkan11Features, multiviewFeatures, multiview, "VK_KHR_multiview"),
1629 FEATURE_TABLE_ITEM(vulkan11Features, multiviewFeatures, multiviewGeometryShader, "VK_KHR_multiview"),
1630 FEATURE_TABLE_ITEM(vulkan11Features, multiviewFeatures, multiviewTessellationShader, "VK_KHR_multiview"),
1631 FEATURE_TABLE_ITEM(vulkan11Features, variablePointersFeatures, variablePointersStorageBuffer, "VK_KHR_variable_pointers"),
1632 FEATURE_TABLE_ITEM(vulkan11Features, variablePointersFeatures, variablePointers, "VK_KHR_variable_pointers"),
1633 FEATURE_TABLE_ITEM(vulkan11Features, protectedMemoryFeatures, protectedMemory, DE_NULL),
1634 FEATURE_TABLE_ITEM(vulkan11Features, samplerYcbcrConversionFeatures, samplerYcbcrConversion, "VK_KHR_sampler_ycbcr_conversion"),
1635 FEATURE_TABLE_ITEM(vulkan11Features, shaderDrawParametersFeatures, shaderDrawParameters, DE_NULL),
1636 FEATURE_TABLE_ITEM(vulkan12Features, eightBitStorageFeatures, storageBuffer8BitAccess, "VK_KHR_8bit_storage"),
1637 FEATURE_TABLE_ITEM(vulkan12Features, eightBitStorageFeatures, uniformAndStorageBuffer8BitAccess, "VK_KHR_8bit_storage"),
1638 FEATURE_TABLE_ITEM(vulkan12Features, eightBitStorageFeatures, storagePushConstant8, "VK_KHR_8bit_storage"),
1639 FEATURE_TABLE_ITEM(vulkan12Features, shaderAtomicInt64Features, shaderBufferInt64Atomics, "VK_KHR_shader_atomic_int64"),
1640 FEATURE_TABLE_ITEM(vulkan12Features, shaderAtomicInt64Features, shaderSharedInt64Atomics, "VK_KHR_shader_atomic_int64"),
1641 FEATURE_TABLE_ITEM(vulkan12Features, shaderFloat16Int8Features, shaderFloat16, "VK_KHR_shader_float16_int8"),
1642 FEATURE_TABLE_ITEM(vulkan12Features, shaderFloat16Int8Features, shaderInt8, "VK_KHR_shader_float16_int8"),
1643 FEATURE_TABLE_ITEM(vulkan12Features, dummyExtensionFeatures, descriptorIndexing, DE_NULL),
1644 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderInputAttachmentArrayDynamicIndexing, "VK_EXT_descriptor_indexing"),
1645 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderUniformTexelBufferArrayDynamicIndexing, "VK_EXT_descriptor_indexing"),
1646 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderStorageTexelBufferArrayDynamicIndexing, "VK_EXT_descriptor_indexing"),
1647 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderUniformBufferArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
1648 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderSampledImageArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
1649 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderStorageBufferArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
1650 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderStorageImageArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
1651 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderInputAttachmentArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
1652 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderUniformTexelBufferArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
1653 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, shaderStorageTexelBufferArrayNonUniformIndexing, "VK_EXT_descriptor_indexing"),
1654 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingUniformBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
1655 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingSampledImageUpdateAfterBind, "VK_EXT_descriptor_indexing"),
1656 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingStorageImageUpdateAfterBind, "VK_EXT_descriptor_indexing"),
1657 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingStorageBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
1658 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingUniformTexelBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
1659 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingStorageTexelBufferUpdateAfterBind, "VK_EXT_descriptor_indexing"),
1660 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingUpdateUnusedWhilePending, "VK_EXT_descriptor_indexing"),
1661 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingPartiallyBound, "VK_EXT_descriptor_indexing"),
1662 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, descriptorBindingVariableDescriptorCount, "VK_EXT_descriptor_indexing"),
1663 FEATURE_TABLE_ITEM(vulkan12Features, descriptorIndexingFeatures, runtimeDescriptorArray, "VK_EXT_descriptor_indexing"),
1664 FEATURE_TABLE_ITEM(vulkan12Features, dummyExtensionFeatures, samplerFilterMinmax, "VK_EXT_sampler_filter_minmax"),
1665 FEATURE_TABLE_ITEM(vulkan12Features, scalarBlockLayoutFeatures, scalarBlockLayout, "VK_EXT_scalar_block_layout"),
1666 FEATURE_TABLE_ITEM(vulkan12Features, imagelessFramebufferFeatures, imagelessFramebuffer, "VK_KHR_imageless_framebuffer"),
1667 FEATURE_TABLE_ITEM(vulkan12Features, uniformBufferStandardLayoutFeatures, uniformBufferStandardLayout, "VK_KHR_uniform_buffer_standard_layout"),
1668 FEATURE_TABLE_ITEM(vulkan12Features, shaderSubgroupExtendedTypesFeatures, shaderSubgroupExtendedTypes, "VK_KHR_shader_subgroup_extended_types"),
1669 FEATURE_TABLE_ITEM(vulkan12Features, separateDepthStencilLayoutsFeatures, separateDepthStencilLayouts, "VK_KHR_separate_depth_stencil_layouts"),
1670 FEATURE_TABLE_ITEM(vulkan12Features, hostQueryResetFeatures, hostQueryReset, "VK_EXT_host_query_reset"),
1671 FEATURE_TABLE_ITEM(vulkan12Features, timelineSemaphoreFeatures, timelineSemaphore, "VK_KHR_timeline_semaphore"),
1672 FEATURE_TABLE_ITEM(vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddress, "VK_EXT_buffer_device_address"),
1673 FEATURE_TABLE_ITEM(vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressCaptureReplay, "VK_EXT_buffer_device_address"),
1674 FEATURE_TABLE_ITEM(vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressMultiDevice, "VK_EXT_buffer_device_address"),
1675 FEATURE_TABLE_ITEM(vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModel, "VK_KHR_vulkan_memory_model"),
1676 FEATURE_TABLE_ITEM(vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModelDeviceScope, "VK_KHR_vulkan_memory_model"),
1677 FEATURE_TABLE_ITEM(vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModelAvailabilityVisibilityChains, "VK_KHR_vulkan_memory_model"),
1679 struct FeatureDependencyTable
1681 VkBool32* featurePtr;
1682 VkBool32* dependOnPtr;
1684 featureDependencyTable[] =
1686 DEPENDENCY_DUAL_ITEM (vulkan11Features, multiviewFeatures, multiviewGeometryShader, multiview),
1687 DEPENDENCY_DUAL_ITEM (vulkan11Features, multiviewFeatures, multiviewTessellationShader, multiview),
1688 DEPENDENCY_SINGLE_ITEM (vulkan12Features, shaderInputAttachmentArrayDynamicIndexing, descriptorIndexing),
1689 DEPENDENCY_SINGLE_ITEM (vulkan12Features, shaderUniformTexelBufferArrayDynamicIndexing, descriptorIndexing),
1690 DEPENDENCY_SINGLE_ITEM (vulkan12Features, shaderStorageTexelBufferArrayDynamicIndexing, descriptorIndexing),
1691 DEPENDENCY_SINGLE_ITEM (vulkan12Features, shaderUniformBufferArrayNonUniformIndexing, descriptorIndexing),
1692 DEPENDENCY_SINGLE_ITEM (vulkan12Features, shaderSampledImageArrayNonUniformIndexing, descriptorIndexing),
1693 DEPENDENCY_SINGLE_ITEM (vulkan12Features, shaderStorageBufferArrayNonUniformIndexing, descriptorIndexing),
1694 DEPENDENCY_SINGLE_ITEM (vulkan12Features, shaderStorageImageArrayNonUniformIndexing, descriptorIndexing),
1695 DEPENDENCY_SINGLE_ITEM (vulkan12Features, shaderInputAttachmentArrayNonUniformIndexing, descriptorIndexing),
1696 DEPENDENCY_SINGLE_ITEM (vulkan12Features, shaderUniformTexelBufferArrayNonUniformIndexing, descriptorIndexing),
1697 DEPENDENCY_SINGLE_ITEM (vulkan12Features, shaderStorageTexelBufferArrayNonUniformIndexing, descriptorIndexing),
1698 DEPENDENCY_SINGLE_ITEM (vulkan12Features, descriptorBindingUniformBufferUpdateAfterBind, descriptorIndexing),
1699 DEPENDENCY_SINGLE_ITEM (vulkan12Features, descriptorBindingSampledImageUpdateAfterBind, descriptorIndexing),
1700 DEPENDENCY_SINGLE_ITEM (vulkan12Features, descriptorBindingStorageImageUpdateAfterBind, descriptorIndexing),
1701 DEPENDENCY_SINGLE_ITEM (vulkan12Features, descriptorBindingStorageBufferUpdateAfterBind, descriptorIndexing),
1702 DEPENDENCY_SINGLE_ITEM (vulkan12Features, descriptorBindingUniformTexelBufferUpdateAfterBind, descriptorIndexing),
1703 DEPENDENCY_SINGLE_ITEM (vulkan12Features, descriptorBindingStorageTexelBufferUpdateAfterBind, descriptorIndexing),
1704 DEPENDENCY_SINGLE_ITEM (vulkan12Features, descriptorBindingUpdateUnusedWhilePending, descriptorIndexing),
1705 DEPENDENCY_SINGLE_ITEM (vulkan12Features, descriptorBindingPartiallyBound, descriptorIndexing),
1706 DEPENDENCY_SINGLE_ITEM (vulkan12Features, descriptorBindingVariableDescriptorCount, descriptorIndexing),
1707 DEPENDENCY_SINGLE_ITEM (vulkan12Features, runtimeDescriptorArray, descriptorIndexing),
1708 DEPENDENCY_DUAL_ITEM (vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressCaptureReplay, bufferDeviceAddress),
1709 DEPENDENCY_DUAL_ITEM (vulkan12Features, bufferDeviceAddressFeatures, bufferDeviceAddressMultiDevice, bufferDeviceAddress),
1710 DEPENDENCY_DUAL_ITEM (vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModelDeviceScope, vulkanMemoryModel),
1711 DEPENDENCY_DUAL_ITEM (vulkan12Features, vulkanMemoryModelFeatures, vulkanMemoryModelAvailabilityVisibilityChains, vulkanMemoryModel),
1714 deMemset(&dummyExtensionFeatures, 0, sizeof(dummyExtensionFeatures));
1716 for (size_t featureTableNdx = 0; featureTableNdx < DE_LENGTH_OF_ARRAY(featureTable); ++featureTableNdx)
1718 FeatureTable& testedFeature = featureTable[featureTableNdx];
1719 VkBool32 coreFeatureState= DE_FALSE;
1720 VkBool32 extFeatureState = DE_FALSE;
1724 void* structPtr = testedFeature.coreStructPtr;
1725 size_t structSize = testedFeature.coreStructSize;
1726 VkBool32* featurePtr = testedFeature.coreFieldPtr;
1728 if (structPtr != &dummyExtensionFeatures)
1729 features2.pNext = structPtr;
1731 vki.getPhysicalDeviceFeatures2(physicalDevice, &features2);
1733 coreFeatureState = featurePtr[0];
1735 log << TestLog::Message
1736 << "Feature status "
1737 << testedFeature.coreFieldName << "=" << coreFeatureState
1738 << TestLog::EndMessage;
1740 if (coreFeatureState)
1742 cleanVulkanStruct(structPtr, structSize);
1744 featurePtr[0] = DE_TRUE;
1746 for (size_t featureDependencyTableNdx = 0; featureDependencyTableNdx < DE_LENGTH_OF_ARRAY(featureDependencyTable); ++featureDependencyTableNdx)
1747 if (featureDependencyTable[featureDependencyTableNdx].featurePtr == featurePtr)
1748 featureDependencyTable[featureDependencyTableNdx].dependOnPtr[0] = DE_TRUE;
1750 createDevice(context, &features2, DE_NULL, 0u);
1756 void* structPtr = testedFeature.extStructPtr;
1757 size_t structSize = testedFeature.extStructSize;
1758 VkBool32* featurePtr = testedFeature.extFieldPtr;
1759 const char* extStringPtr = testedFeature.extString;
1761 if (structPtr != &dummyExtensionFeatures)
1762 features2.pNext = structPtr;
1764 if (extStringPtr == DE_NULL || isExtensionSupported(deviceExtensionProperties, RequiredExtension(extStringPtr)))
1766 vki.getPhysicalDeviceFeatures2(physicalDevice, &features2);
1768 extFeatureState = *featurePtr;
1770 log << TestLog::Message
1771 << "Feature status "
1772 << testedFeature.extFieldName << "=" << extFeatureState
1773 << TestLog::EndMessage;
1775 if (extFeatureState)
1777 cleanVulkanStruct(structPtr, structSize);
1779 featurePtr[0] = DE_TRUE;
1781 for (size_t featureDependencyTableNdx = 0; featureDependencyTableNdx < DE_LENGTH_OF_ARRAY(featureDependencyTable); ++featureDependencyTableNdx)
1782 if (featureDependencyTable[featureDependencyTableNdx].featurePtr == featurePtr)
1783 featureDependencyTable[featureDependencyTableNdx].dependOnPtr[0] = DE_TRUE;
1785 createDevice(context, &features2, &extStringPtr, (extStringPtr == DE_NULL) ? 0u : 1u );
1791 return tcu::TestStatus::pass("pass");
1794 template<typename T>
1795 class CheckIncompleteResult
1798 virtual ~CheckIncompleteResult (void) {}
1799 virtual void getResult (Context& context, T* data) = 0;
1801 void operator() (Context& context, tcu::ResultCollector& results, const std::size_t expectedCompleteSize)
1803 if (expectedCompleteSize == 0)
1806 vector<T> outputData (expectedCompleteSize);
1807 const deUint32 usedSize = static_cast<deUint32>(expectedCompleteSize / 3);
1809 ValidateQueryBits::fillBits(outputData.begin(), outputData.end()); // unused entries should have this pattern intact
1811 m_result = VK_SUCCESS;
1813 getResult(context, &outputData[0]); // update m_count and m_result
1815 if (m_count != usedSize || m_result != VK_INCOMPLETE || !ValidateQueryBits::checkBits(outputData.begin() + m_count, outputData.end()))
1816 results.fail("Query didn't return VK_INCOMPLETE");
1824 struct CheckEnumeratePhysicalDevicesIncompleteResult : public CheckIncompleteResult<VkPhysicalDevice>
1826 void getResult (Context& context, VkPhysicalDevice* data)
1828 m_result = context.getInstanceInterface().enumeratePhysicalDevices(context.getInstance(), &m_count, data);
1832 struct CheckEnumeratePhysicalDeviceGroupsIncompleteResult : public CheckIncompleteResult<VkPhysicalDeviceGroupProperties>
1834 void getResult (Context& context, VkPhysicalDeviceGroupProperties* data)
1836 m_result = context.getInstanceInterface().enumeratePhysicalDeviceGroups(context.getInstance(), &m_count, data);
1840 struct CheckEnumerateInstanceLayerPropertiesIncompleteResult : public CheckIncompleteResult<VkLayerProperties>
1842 void getResult (Context& context, VkLayerProperties* data)
1844 m_result = context.getPlatformInterface().enumerateInstanceLayerProperties(&m_count, data);
1848 struct CheckEnumerateDeviceLayerPropertiesIncompleteResult : public CheckIncompleteResult<VkLayerProperties>
1850 void getResult (Context& context, VkLayerProperties* data)
1852 m_result = context.getInstanceInterface().enumerateDeviceLayerProperties(context.getPhysicalDevice(), &m_count, data);
1856 struct CheckEnumerateInstanceExtensionPropertiesIncompleteResult : public CheckIncompleteResult<VkExtensionProperties>
1858 CheckEnumerateInstanceExtensionPropertiesIncompleteResult (std::string layerName = std::string()) : m_layerName(layerName) {}
1860 void getResult (Context& context, VkExtensionProperties* data)
1862 const char* pLayerName = (m_layerName.length() != 0 ? m_layerName.c_str() : DE_NULL);
1863 m_result = context.getPlatformInterface().enumerateInstanceExtensionProperties(pLayerName, &m_count, data);
1867 const std::string m_layerName;
1870 struct CheckEnumerateDeviceExtensionPropertiesIncompleteResult : public CheckIncompleteResult<VkExtensionProperties>
1872 CheckEnumerateDeviceExtensionPropertiesIncompleteResult (std::string layerName = std::string()) : m_layerName(layerName) {}
1874 void getResult (Context& context, VkExtensionProperties* data)
1876 const char* pLayerName = (m_layerName.length() != 0 ? m_layerName.c_str() : DE_NULL);
1877 m_result = context.getInstanceInterface().enumerateDeviceExtensionProperties(context.getPhysicalDevice(), pLayerName, &m_count, data);
1881 const std::string m_layerName;
1884 tcu::TestStatus enumeratePhysicalDevices (Context& context)
1886 TestLog& log = context.getTestContext().getLog();
1887 tcu::ResultCollector results (log);
1888 const vector<VkPhysicalDevice> devices = enumeratePhysicalDevices(context.getInstanceInterface(), context.getInstance());
1890 log << TestLog::Integer("NumDevices", "Number of devices", "", QP_KEY_TAG_NONE, deInt64(devices.size()));
1892 for (size_t ndx = 0; ndx < devices.size(); ndx++)
1893 log << TestLog::Message << ndx << ": " << devices[ndx] << TestLog::EndMessage;
1895 CheckEnumeratePhysicalDevicesIncompleteResult()(context, results, devices.size());
1897 return tcu::TestStatus(results.getResult(), results.getMessage());
1900 tcu::TestStatus enumeratePhysicalDeviceGroups (Context& context)
1902 TestLog& log = context.getTestContext().getLog();
1903 tcu::ResultCollector results (log);
1904 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_device_group_creation"));
1905 const InstanceDriver& vki (instance.getDriver());
1906 const vector<VkPhysicalDeviceGroupProperties> devicegroups = enumeratePhysicalDeviceGroups(vki, instance);
1908 log << TestLog::Integer("NumDevices", "Number of device groups", "", QP_KEY_TAG_NONE, deInt64(devicegroups.size()));
1910 for (size_t ndx = 0; ndx < devicegroups.size(); ndx++)
1911 log << TestLog::Message << ndx << ": " << devicegroups[ndx] << TestLog::EndMessage;
1913 CheckEnumeratePhysicalDeviceGroupsIncompleteResult()(context, results, devicegroups.size());
1915 return tcu::TestStatus(results.getResult(), results.getMessage());
1918 template<typename T>
1919 void collectDuplicates (set<T>& duplicates, const vector<T>& values)
1923 for (size_t ndx = 0; ndx < values.size(); ndx++)
1925 const T& value = values[ndx];
1927 if (!seen.insert(value).second)
1928 duplicates.insert(value);
1932 void checkDuplicates (tcu::ResultCollector& results, const char* what, const vector<string>& values)
1934 set<string> duplicates;
1936 collectDuplicates(duplicates, values);
1938 for (set<string>::const_iterator iter = duplicates.begin(); iter != duplicates.end(); ++iter)
1940 std::ostringstream msg;
1941 msg << "Duplicate " << what << ": " << *iter;
1942 results.fail(msg.str());
1946 void checkDuplicateExtensions (tcu::ResultCollector& results, const vector<string>& extensions)
1948 checkDuplicates(results, "extension", extensions);
1951 void checkDuplicateLayers (tcu::ResultCollector& results, const vector<string>& layers)
1953 checkDuplicates(results, "layer", layers);
1956 void checkKhrExtensions (tcu::ResultCollector& results,
1957 const vector<string>& extensions,
1958 const int numAllowedKhrExtensions,
1959 const char* const* allowedKhrExtensions)
1961 const set<string> allowedExtSet (allowedKhrExtensions, allowedKhrExtensions+numAllowedKhrExtensions);
1963 for (vector<string>::const_iterator extIter = extensions.begin(); extIter != extensions.end(); ++extIter)
1965 // Only Khronos-controlled extensions are checked
1966 if (de::beginsWith(*extIter, "VK_KHR_") &&
1967 !de::contains(allowedExtSet, *extIter))
1969 results.fail("Unknown extension " + *extIter);
1974 void checkInstanceExtensions (tcu::ResultCollector& results, const vector<string>& extensions)
1976 #include "vkInstanceExtensions.inl"
1978 checkKhrExtensions(results, extensions, DE_LENGTH_OF_ARRAY(s_allowedInstanceKhrExtensions), s_allowedInstanceKhrExtensions);
1979 checkDuplicateExtensions(results, extensions);
1982 void checkDeviceExtensions (tcu::ResultCollector& results, const vector<string>& extensions)
1984 #include "vkDeviceExtensions.inl"
1986 checkKhrExtensions(results, extensions, DE_LENGTH_OF_ARRAY(s_allowedDeviceKhrExtensions), s_allowedDeviceKhrExtensions);
1987 checkDuplicateExtensions(results, extensions);
1990 void checkInstanceExtensionDependencies(tcu::ResultCollector& results,
1991 int dependencyLength,
1992 const std::tuple<deUint32, deUint32, const char*, const char*>* dependencies,
1993 deUint32 versionMajor,
1994 deUint32 versionMinor,
1995 const vector<VkExtensionProperties>& extensionProperties)
1997 for (int ndx = 0; ndx < dependencyLength; ndx++)
1999 deUint32 currentVersionMajor, currentVersionMinor;
2000 const char* extensionFirst;
2001 const char* extensionSecond;
2002 std::tie(currentVersionMajor, currentVersionMinor, extensionFirst, extensionSecond) = dependencies[ndx];
2003 if (currentVersionMajor != versionMajor || currentVersionMinor != versionMinor)
2005 if (isExtensionSupported(extensionProperties, RequiredExtension(extensionFirst)) &&
2006 !isExtensionSupported(extensionProperties, RequiredExtension(extensionSecond)))
2008 results.fail("Extension " + string(extensionFirst) + " is missing dependency: " + string(extensionSecond));
2013 void checkDeviceExtensionDependencies(tcu::ResultCollector& results,
2014 int dependencyLength,
2015 const std::tuple<deUint32, deUint32, const char*, const char*>* dependencies,
2016 deUint32 versionMajor,
2017 deUint32 versionMinor,
2018 const vector<VkExtensionProperties>& instanceExtensionProperties,
2019 const vector<VkExtensionProperties>& deviceExtensionProperties)
2021 for (int ndx = 0; ndx < dependencyLength; ndx++)
2023 deUint32 currentVersionMajor, currentVersionMinor;
2024 const char* extensionFirst;
2025 const char* extensionSecond;
2026 std::tie(currentVersionMajor, currentVersionMinor, extensionFirst, extensionSecond) = dependencies[ndx];
2027 if (currentVersionMajor != versionMajor || currentVersionMinor != versionMinor)
2029 if (isExtensionSupported(deviceExtensionProperties, RequiredExtension(extensionFirst)) &&
2030 !isExtensionSupported(deviceExtensionProperties, RequiredExtension(extensionSecond)) &&
2031 !isExtensionSupported(instanceExtensionProperties, RequiredExtension(extensionSecond)))
2033 results.fail("Extension " + string(extensionFirst) + " is missing dependency: " + string(extensionSecond));
2038 tcu::TestStatus enumerateInstanceLayers (Context& context)
2040 TestLog& log = context.getTestContext().getLog();
2041 tcu::ResultCollector results (log);
2042 const vector<VkLayerProperties> properties = enumerateInstanceLayerProperties(context.getPlatformInterface());
2043 vector<string> layerNames;
2045 for (size_t ndx = 0; ndx < properties.size(); ndx++)
2047 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
2049 layerNames.push_back(properties[ndx].layerName);
2052 checkDuplicateLayers(results, layerNames);
2053 CheckEnumerateInstanceLayerPropertiesIncompleteResult()(context, results, layerNames.size());
2055 return tcu::TestStatus(results.getResult(), results.getMessage());
2058 tcu::TestStatus enumerateInstanceExtensions (Context& context)
2060 TestLog& log = context.getTestContext().getLog();
2061 tcu::ResultCollector results (log);
2064 const ScopedLogSection section (log, "Global", "Global Extensions");
2065 const vector<VkExtensionProperties> properties = enumerateInstanceExtensionProperties(context.getPlatformInterface(), DE_NULL);
2066 vector<string> extensionNames;
2068 for (size_t ndx = 0; ndx < properties.size(); ndx++)
2070 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
2072 extensionNames.push_back(properties[ndx].extensionName);
2075 checkInstanceExtensions(results, extensionNames);
2076 CheckEnumerateInstanceExtensionPropertiesIncompleteResult()(context, results, properties.size());
2078 for (const auto& version : releasedApiVersions)
2080 deUint32 versionMajor, versionMinor;
2081 std::tie(std::ignore, versionMajor, versionMinor) = version;
2082 if (context.contextSupports(vk::ApiVersion(versionMajor, versionMinor, 0)))
2084 checkInstanceExtensionDependencies(results,
2085 DE_LENGTH_OF_ARRAY(instanceExtensionDependencies),
2086 instanceExtensionDependencies,
2096 const vector<VkLayerProperties> layers = enumerateInstanceLayerProperties(context.getPlatformInterface());
2098 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
2100 const ScopedLogSection section (log, layer->layerName, string("Layer: ") + layer->layerName);
2101 const vector<VkExtensionProperties> properties = enumerateInstanceExtensionProperties(context.getPlatformInterface(), layer->layerName);
2102 vector<string> extensionNames;
2104 for (size_t extNdx = 0; extNdx < properties.size(); extNdx++)
2106 log << TestLog::Message << extNdx << ": " << properties[extNdx] << TestLog::EndMessage;
2108 extensionNames.push_back(properties[extNdx].extensionName);
2111 checkInstanceExtensions(results, extensionNames);
2112 CheckEnumerateInstanceExtensionPropertiesIncompleteResult(layer->layerName)(context, results, properties.size());
2116 return tcu::TestStatus(results.getResult(), results.getMessage());
2119 tcu::TestStatus testNoKhxExtensions (Context& context)
2121 VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
2122 const PlatformInterface& vkp = context.getPlatformInterface();
2123 const InstanceInterface& vki = context.getInstanceInterface();
2125 tcu::ResultCollector results(context.getTestContext().getLog());
2126 bool testSucceeded = true;
2127 deUint32 instanceExtensionsCount;
2128 deUint32 deviceExtensionsCount;
2130 // grab number of instance and device extensions
2131 vkp.enumerateInstanceExtensionProperties(DE_NULL, &instanceExtensionsCount, DE_NULL);
2132 vki.enumerateDeviceExtensionProperties(physicalDevice, DE_NULL, &deviceExtensionsCount, DE_NULL);
2133 vector<VkExtensionProperties> extensionsProperties(instanceExtensionsCount + deviceExtensionsCount);
2135 // grab instance and device extensions into single vector
2136 if (instanceExtensionsCount)
2137 vkp.enumerateInstanceExtensionProperties(DE_NULL, &instanceExtensionsCount, &extensionsProperties[0]);
2138 if (deviceExtensionsCount)
2139 vki.enumerateDeviceExtensionProperties(physicalDevice, DE_NULL, &deviceExtensionsCount, &extensionsProperties[instanceExtensionsCount]);
2141 // iterate over all extensions and verify their names
2142 vector<VkExtensionProperties>::const_iterator extension = extensionsProperties.begin();
2143 while (extension != extensionsProperties.end())
2145 // KHX author ID is no longer used, all KHX extensions have been promoted to KHR status
2146 std::string extensionName(extension->extensionName);
2147 bool caseFailed = de::beginsWith(extensionName, "VK_KHX_");
2150 results.fail("Invalid extension name " + extensionName);
2151 testSucceeded = false;
2157 return tcu::TestStatus::pass("No extensions begining with \"VK_KHX\"");
2158 return tcu::TestStatus::fail("One or more extensions begins with \"VK_KHX\"");
2161 tcu::TestStatus enumerateDeviceLayers (Context& context)
2163 TestLog& log = context.getTestContext().getLog();
2164 tcu::ResultCollector results (log);
2165 const vector<VkLayerProperties> properties = enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
2166 vector<string> layerNames;
2168 for (size_t ndx = 0; ndx < properties.size(); ndx++)
2170 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
2172 layerNames.push_back(properties[ndx].layerName);
2175 checkDuplicateLayers(results, layerNames);
2176 CheckEnumerateDeviceLayerPropertiesIncompleteResult()(context, results, layerNames.size());
2178 return tcu::TestStatus(results.getResult(), results.getMessage());
2181 tcu::TestStatus enumerateDeviceExtensions (Context& context)
2183 TestLog& log = context.getTestContext().getLog();
2184 tcu::ResultCollector results (log);
2187 const ScopedLogSection section (log, "Global", "Global Extensions");
2188 const vector<VkExtensionProperties> instanceExtensionProperties = enumerateInstanceExtensionProperties(context.getPlatformInterface(), DE_NULL);
2189 const vector<VkExtensionProperties> deviceExtensionProperties = enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), DE_NULL);
2190 vector<string> deviceExtensionNames;
2192 for (size_t ndx = 0; ndx < deviceExtensionProperties.size(); ndx++)
2194 log << TestLog::Message << ndx << ": " << deviceExtensionProperties[ndx] << TestLog::EndMessage;
2196 deviceExtensionNames.push_back(deviceExtensionProperties[ndx].extensionName);
2199 checkDeviceExtensions(results, deviceExtensionNames);
2200 CheckEnumerateDeviceExtensionPropertiesIncompleteResult()(context, results, deviceExtensionProperties.size());
2202 for (const auto& version : releasedApiVersions)
2204 deUint32 versionMajor, versionMinor;
2205 std::tie(std::ignore, versionMajor, versionMinor) = version;
2206 if (context.contextSupports(vk::ApiVersion(versionMajor, versionMinor, 0)))
2208 checkDeviceExtensionDependencies(results,
2209 DE_LENGTH_OF_ARRAY(instanceExtensionDependencies),
2210 instanceExtensionDependencies,
2213 instanceExtensionProperties,
2214 deviceExtensionProperties);
2221 const vector<VkLayerProperties> layers = enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
2223 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
2225 const ScopedLogSection section (log, layer->layerName, string("Layer: ") + layer->layerName);
2226 const vector<VkExtensionProperties> properties = enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), layer->layerName);
2227 vector<string> extensionNames;
2229 for (size_t extNdx = 0; extNdx < properties.size(); extNdx++)
2231 log << TestLog::Message << extNdx << ": " << properties[extNdx] << TestLog::EndMessage;
2234 extensionNames.push_back(properties[extNdx].extensionName);
2237 checkDeviceExtensions(results, extensionNames);
2238 CheckEnumerateDeviceExtensionPropertiesIncompleteResult(layer->layerName)(context, results, properties.size());
2242 return tcu::TestStatus(results.getResult(), results.getMessage());
2245 #define VK_SIZE_OF(STRUCT, MEMBER) (sizeof(((STRUCT*)0)->MEMBER))
2246 #define OFFSET_TABLE_ENTRY(STRUCT, MEMBER) { (size_t)DE_OFFSET_OF(STRUCT, MEMBER), VK_SIZE_OF(STRUCT, MEMBER) }
2248 tcu::TestStatus deviceFeatures (Context& context)
2250 using namespace ValidateQueryBits;
2252 TestLog& log = context.getTestContext().getLog();
2253 VkPhysicalDeviceFeatures* features;
2254 deUint8 buffer[sizeof(VkPhysicalDeviceFeatures) + GUARD_SIZE];
2256 const QueryMemberTableEntry featureOffsetTable[] =
2258 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, robustBufferAccess),
2259 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fullDrawIndexUint32),
2260 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, imageCubeArray),
2261 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, independentBlend),
2262 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, geometryShader),
2263 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, tessellationShader),
2264 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sampleRateShading),
2265 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, dualSrcBlend),
2266 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, logicOp),
2267 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, multiDrawIndirect),
2268 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, drawIndirectFirstInstance),
2269 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthClamp),
2270 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthBiasClamp),
2271 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fillModeNonSolid),
2272 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthBounds),
2273 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, wideLines),
2274 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, largePoints),
2275 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, alphaToOne),
2276 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, multiViewport),
2277 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, samplerAnisotropy),
2278 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionETC2),
2279 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionASTC_LDR),
2280 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionBC),
2281 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, occlusionQueryPrecise),
2282 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, pipelineStatisticsQuery),
2283 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, vertexPipelineStoresAndAtomics),
2284 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fragmentStoresAndAtomics),
2285 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderTessellationAndGeometryPointSize),
2286 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderImageGatherExtended),
2287 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageExtendedFormats),
2288 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageMultisample),
2289 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageReadWithoutFormat),
2290 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageWriteWithoutFormat),
2291 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderUniformBufferArrayDynamicIndexing),
2292 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderSampledImageArrayDynamicIndexing),
2293 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageBufferArrayDynamicIndexing),
2294 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageArrayDynamicIndexing),
2295 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderClipDistance),
2296 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderCullDistance),
2297 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderFloat64),
2298 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderInt64),
2299 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderInt16),
2300 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderResourceResidency),
2301 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderResourceMinLod),
2302 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseBinding),
2303 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyBuffer),
2304 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyImage2D),
2305 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyImage3D),
2306 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency2Samples),
2307 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency4Samples),
2308 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency8Samples),
2309 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency16Samples),
2310 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyAliased),
2311 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, variableMultisampleRate),
2312 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, inheritedQueries),
2316 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
2317 features = reinterpret_cast<VkPhysicalDeviceFeatures*>(buffer);
2319 context.getInstanceInterface().getPhysicalDeviceFeatures(context.getPhysicalDevice(), features);
2321 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
2322 << TestLog::Message << *features << TestLog::EndMessage;
2324 // Requirements and dependencies
2326 if (!features->robustBufferAccess)
2327 return tcu::TestStatus::fail("robustBufferAccess is not supported");
2329 // multiViewport requires MultiViewport (SPIR-V capability) support, which depends on Geometry
2330 if (features->multiViewport && !features->geometryShader)
2331 return tcu::TestStatus::fail("multiViewport is supported but geometryShader is not");
2334 for (int ndx = 0; ndx < GUARD_SIZE; ndx++)
2336 if (buffer[ndx + sizeof(VkPhysicalDeviceFeatures)] != GUARD_VALUE)
2338 log << TestLog::Message << "deviceFeatures - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
2339 return tcu::TestStatus::fail("deviceFeatures buffer overflow");
2343 if (!validateInitComplete(context.getPhysicalDevice(), &InstanceInterface::getPhysicalDeviceFeatures, context.getInstanceInterface(), featureOffsetTable))
2345 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceFeatures not completely initialized" << TestLog::EndMessage;
2346 return tcu::TestStatus::fail("deviceFeatures incomplete initialization");
2349 return tcu::TestStatus::pass("Query succeeded");
2352 static const ValidateQueryBits::QueryMemberTableEntry s_physicalDevicePropertiesOffsetTable[] =
2354 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, apiVersion),
2355 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, driverVersion),
2356 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, vendorID),
2357 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, deviceID),
2358 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, deviceType),
2359 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, pipelineCacheUUID),
2360 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension1D),
2361 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension2D),
2362 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension3D),
2363 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimensionCube),
2364 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageArrayLayers),
2365 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelBufferElements),
2366 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxUniformBufferRange),
2367 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxStorageBufferRange),
2368 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPushConstantsSize),
2369 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxMemoryAllocationCount),
2370 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerAllocationCount),
2371 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.bufferImageGranularity),
2372 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sparseAddressSpaceSize),
2373 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxBoundDescriptorSets),
2374 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorSamplers),
2375 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorUniformBuffers),
2376 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorStorageBuffers),
2377 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorSampledImages),
2378 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorStorageImages),
2379 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorInputAttachments),
2380 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageResources),
2381 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetSamplers),
2382 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetUniformBuffers),
2383 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetUniformBuffersDynamic),
2384 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageBuffers),
2385 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageBuffersDynamic),
2386 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetSampledImages),
2387 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageImages),
2388 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetInputAttachments),
2389 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputAttributes),
2390 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputBindings),
2391 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputAttributeOffset),
2392 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputBindingStride),
2393 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexOutputComponents),
2394 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationGenerationLevel),
2395 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationPatchSize),
2396 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerVertexInputComponents),
2397 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerVertexOutputComponents),
2398 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerPatchOutputComponents),
2399 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlTotalOutputComponents),
2400 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationEvaluationInputComponents),
2401 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationEvaluationOutputComponents),
2402 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryShaderInvocations),
2403 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryInputComponents),
2404 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryOutputComponents),
2405 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryOutputVertices),
2406 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryTotalOutputComponents),
2407 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentInputComponents),
2408 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentOutputAttachments),
2409 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentDualSrcAttachments),
2410 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentCombinedOutputResources),
2411 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeSharedMemorySize),
2412 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupCount[3]),
2413 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupInvocations),
2414 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupSize[3]),
2415 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subPixelPrecisionBits),
2416 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subTexelPrecisionBits),
2417 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.mipmapPrecisionBits),
2418 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDrawIndexedIndexValue),
2419 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDrawIndirectCount),
2420 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerLodBias),
2421 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerAnisotropy),
2422 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxViewports),
2423 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxViewportDimensions[2]),
2424 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.viewportBoundsRange[2]),
2425 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.viewportSubPixelBits),
2426 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minMemoryMapAlignment),
2427 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelBufferOffsetAlignment),
2428 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minUniformBufferOffsetAlignment),
2429 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minStorageBufferOffsetAlignment),
2430 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelOffset),
2431 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelOffset),
2432 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelGatherOffset),
2433 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelGatherOffset),
2434 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minInterpolationOffset),
2435 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxInterpolationOffset),
2436 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subPixelInterpolationOffsetBits),
2437 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferWidth),
2438 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferHeight),
2439 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferLayers),
2440 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferColorSampleCounts),
2441 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferDepthSampleCounts),
2442 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferStencilSampleCounts),
2443 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferNoAttachmentsSampleCounts),
2444 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxColorAttachments),
2445 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageColorSampleCounts),
2446 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageIntegerSampleCounts),
2447 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageDepthSampleCounts),
2448 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageStencilSampleCounts),
2449 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.storageImageSampleCounts),
2450 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSampleMaskWords),
2451 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.timestampComputeAndGraphics),
2452 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.timestampPeriod),
2453 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxClipDistances),
2454 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxCullDistances),
2455 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxCombinedClipAndCullDistances),
2456 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.discreteQueuePriorities),
2457 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.pointSizeRange[2]),
2458 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.lineWidthRange[2]),
2459 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.pointSizeGranularity),
2460 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.lineWidthGranularity),
2461 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.strictLines),
2462 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.standardSampleLocations),
2463 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.optimalBufferCopyOffsetAlignment),
2464 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.optimalBufferCopyRowPitchAlignment),
2465 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.nonCoherentAtomSize),
2466 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard2DBlockShape),
2467 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard2DMultisampleBlockShape),
2468 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard3DBlockShape),
2469 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyAlignedMipSize),
2470 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyNonResidentStrict),
2474 tcu::TestStatus deviceProperties (Context& context)
2476 using namespace ValidateQueryBits;
2478 TestLog& log = context.getTestContext().getLog();
2479 VkPhysicalDeviceProperties* props;
2480 VkPhysicalDeviceFeatures features;
2481 deUint8 buffer[sizeof(VkPhysicalDeviceProperties) + GUARD_SIZE];
2483 props = reinterpret_cast<VkPhysicalDeviceProperties*>(buffer);
2484 deMemset(props, GUARD_VALUE, sizeof(buffer));
2486 context.getInstanceInterface().getPhysicalDeviceProperties(context.getPhysicalDevice(), props);
2487 context.getInstanceInterface().getPhysicalDeviceFeatures(context.getPhysicalDevice(), &features);
2489 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
2490 << TestLog::Message << *props << TestLog::EndMessage;
2492 if (!validateFeatureLimits(props, &features, log))
2493 return tcu::TestStatus::fail("deviceProperties - feature limits failed");
2495 for (int ndx = 0; ndx < GUARD_SIZE; ndx++)
2497 if (buffer[ndx + sizeof(VkPhysicalDeviceProperties)] != GUARD_VALUE)
2499 log << TestLog::Message << "deviceProperties - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
2500 return tcu::TestStatus::fail("deviceProperties buffer overflow");
2504 if (!validateInitComplete(context.getPhysicalDevice(), &InstanceInterface::getPhysicalDeviceProperties, context.getInstanceInterface(), s_physicalDevicePropertiesOffsetTable))
2506 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceProperties not completely initialized" << TestLog::EndMessage;
2507 return tcu::TestStatus::fail("deviceProperties incomplete initialization");
2510 // Check if deviceName string is properly terminated.
2511 if (deStrnlen(props->deviceName, VK_MAX_PHYSICAL_DEVICE_NAME_SIZE) == VK_MAX_PHYSICAL_DEVICE_NAME_SIZE)
2513 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceProperties deviceName not properly initialized" << TestLog::EndMessage;
2514 return tcu::TestStatus::fail("deviceProperties incomplete initialization");
2518 const ApiVersion deviceVersion = unpackVersion(props->apiVersion);
2519 const ApiVersion deqpVersion = unpackVersion(VK_API_VERSION_1_2);
2521 if (deviceVersion.majorNum != deqpVersion.majorNum)
2523 log << TestLog::Message << "deviceProperties - API Major Version " << deviceVersion.majorNum << " is not valid" << TestLog::EndMessage;
2524 return tcu::TestStatus::fail("deviceProperties apiVersion not valid");
2527 if (deviceVersion.minorNum > deqpVersion.minorNum)
2529 log << TestLog::Message << "deviceProperties - API Minor Version " << deviceVersion.minorNum << " is not valid for this version of dEQP" << TestLog::EndMessage;
2530 return tcu::TestStatus::fail("deviceProperties apiVersion not valid");
2534 return tcu::TestStatus::pass("DeviceProperites query succeeded");
2537 tcu::TestStatus deviceQueueFamilyProperties (Context& context)
2539 TestLog& log = context.getTestContext().getLog();
2540 const vector<VkQueueFamilyProperties> queueProperties = getPhysicalDeviceQueueFamilyProperties(context.getInstanceInterface(), context.getPhysicalDevice());
2542 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage;
2544 for (size_t queueNdx = 0; queueNdx < queueProperties.size(); queueNdx++)
2545 log << TestLog::Message << queueNdx << ": " << queueProperties[queueNdx] << TestLog::EndMessage;
2547 return tcu::TestStatus::pass("Querying queue properties succeeded");
2550 tcu::TestStatus deviceMemoryProperties (Context& context)
2552 TestLog& log = context.getTestContext().getLog();
2553 VkPhysicalDeviceMemoryProperties* memProps;
2554 deUint8 buffer[sizeof(VkPhysicalDeviceMemoryProperties) + GUARD_SIZE];
2556 memProps = reinterpret_cast<VkPhysicalDeviceMemoryProperties*>(buffer);
2557 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
2559 context.getInstanceInterface().getPhysicalDeviceMemoryProperties(context.getPhysicalDevice(), memProps);
2561 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
2562 << TestLog::Message << *memProps << TestLog::EndMessage;
2564 for (deInt32 ndx = 0; ndx < GUARD_SIZE; ndx++)
2566 if (buffer[ndx + sizeof(VkPhysicalDeviceMemoryProperties)] != GUARD_VALUE)
2568 log << TestLog::Message << "deviceMemoryProperties - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
2569 return tcu::TestStatus::fail("deviceMemoryProperties buffer overflow");
2573 if (memProps->memoryHeapCount >= VK_MAX_MEMORY_HEAPS)
2575 log << TestLog::Message << "deviceMemoryProperties - HeapCount larger than " << (deUint32)VK_MAX_MEMORY_HEAPS << TestLog::EndMessage;
2576 return tcu::TestStatus::fail("deviceMemoryProperties HeapCount too large");
2579 if (memProps->memoryHeapCount == 1)
2581 if ((memProps->memoryHeaps[0].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) == 0)
2583 log << TestLog::Message << "deviceMemoryProperties - Single heap is not marked DEVICE_LOCAL" << TestLog::EndMessage;
2584 return tcu::TestStatus::fail("deviceMemoryProperties invalid HeapFlags");
2588 const VkMemoryPropertyFlags validPropertyFlags[] =
2591 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
2592 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
2593 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
2594 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
2595 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
2596 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
2597 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
2598 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT
2601 const VkMemoryPropertyFlags requiredPropertyFlags[] =
2603 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
2606 bool requiredFlagsFound[DE_LENGTH_OF_ARRAY(requiredPropertyFlags)];
2607 std::fill(DE_ARRAY_BEGIN(requiredFlagsFound), DE_ARRAY_END(requiredFlagsFound), false);
2609 for (deUint32 memoryNdx = 0; memoryNdx < memProps->memoryTypeCount; memoryNdx++)
2611 bool validPropTypeFound = false;
2613 if (memProps->memoryTypes[memoryNdx].heapIndex >= memProps->memoryHeapCount)
2615 log << TestLog::Message << "deviceMemoryProperties - heapIndex " << memProps->memoryTypes[memoryNdx].heapIndex << " larger than heapCount" << TestLog::EndMessage;
2616 return tcu::TestStatus::fail("deviceMemoryProperties - invalid heapIndex");
2619 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;
2621 for (const VkMemoryPropertyFlags* requiredFlagsIterator = DE_ARRAY_BEGIN(requiredPropertyFlags); requiredFlagsIterator != DE_ARRAY_END(requiredPropertyFlags); requiredFlagsIterator++)
2622 if ((memProps->memoryTypes[memoryNdx].propertyFlags & *requiredFlagsIterator) == *requiredFlagsIterator)
2623 requiredFlagsFound[requiredFlagsIterator - DE_ARRAY_BEGIN(requiredPropertyFlags)] = true;
2625 if (de::contains(DE_ARRAY_BEGIN(validPropertyFlags), DE_ARRAY_END(validPropertyFlags), memProps->memoryTypes[memoryNdx].propertyFlags & bitsToCheck))
2626 validPropTypeFound = true;
2628 if (!validPropTypeFound)
2630 log << TestLog::Message << "deviceMemoryProperties - propertyFlags "
2631 << memProps->memoryTypes[memoryNdx].propertyFlags << " not valid" << TestLog::EndMessage;
2632 return tcu::TestStatus::fail("deviceMemoryProperties propertyFlags not valid");
2635 if (memProps->memoryTypes[memoryNdx].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
2637 if ((memProps->memoryHeaps[memProps->memoryTypes[memoryNdx].heapIndex].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) == 0)
2639 log << TestLog::Message << "deviceMemoryProperties - DEVICE_LOCAL memory type references heap which is not DEVICE_LOCAL" << TestLog::EndMessage;
2640 return tcu::TestStatus::fail("deviceMemoryProperties inconsistent memoryType and HeapFlags");
2645 if (memProps->memoryHeaps[memProps->memoryTypes[memoryNdx].heapIndex].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT)
2647 log << TestLog::Message << "deviceMemoryProperties - non-DEVICE_LOCAL memory type references heap with is DEVICE_LOCAL" << TestLog::EndMessage;
2648 return tcu::TestStatus::fail("deviceMemoryProperties inconsistent memoryType and HeapFlags");
2653 bool* requiredFlagsFoundIterator = std::find(DE_ARRAY_BEGIN(requiredFlagsFound), DE_ARRAY_END(requiredFlagsFound), false);
2654 if (requiredFlagsFoundIterator != DE_ARRAY_END(requiredFlagsFound))
2656 DE_ASSERT(requiredFlagsFoundIterator - DE_ARRAY_BEGIN(requiredFlagsFound) <= DE_LENGTH_OF_ARRAY(requiredPropertyFlags));
2657 log << TestLog::Message << "deviceMemoryProperties - required property flags "
2658 << getMemoryPropertyFlagsStr(requiredPropertyFlags[requiredFlagsFoundIterator - DE_ARRAY_BEGIN(requiredFlagsFound)]) << " not found" << TestLog::EndMessage;
2660 return tcu::TestStatus::fail("deviceMemoryProperties propertyFlags not valid");
2663 return tcu::TestStatus::pass("Querying memory properties succeeded");
2666 tcu::TestStatus deviceGroupPeerMemoryFeatures (Context& context)
2668 TestLog& log = context.getTestContext().getLog();
2669 const PlatformInterface& vkp = context.getPlatformInterface();
2670 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_device_group_creation"));
2671 const InstanceDriver& vki (instance.getDriver());
2672 const tcu::CommandLine& cmdLine = context.getTestContext().getCommandLine();
2673 const deUint32 devGroupIdx = cmdLine.getVKDeviceGroupId() - 1;
2674 const deUint32 deviceIdx = vk::chooseDeviceIndex(context.getInstanceInterface(), instance, cmdLine);
2675 const float queuePriority = 1.0f;
2676 VkPhysicalDeviceMemoryProperties memProps;
2677 VkPeerMemoryFeatureFlags* peerMemFeatures;
2678 deUint8 buffer [sizeof(VkPeerMemoryFeatureFlags) + GUARD_SIZE];
2679 deUint32 numPhysicalDevices = 0;
2680 deUint32 queueFamilyIndex = 0;
2682 const vector<VkPhysicalDeviceGroupProperties> deviceGroupProps = enumeratePhysicalDeviceGroups(vki, instance);
2683 std::vector<const char*> deviceExtensions;
2684 deviceExtensions.push_back("VK_KHR_device_group");
2686 if (!isCoreDeviceExtension(context.getUsedApiVersion(), "VK_KHR_device_group"))
2687 deviceExtensions.push_back("VK_KHR_device_group");
2689 const std::vector<VkQueueFamilyProperties> queueProps = getPhysicalDeviceQueueFamilyProperties(vki, deviceGroupProps[devGroupIdx].physicalDevices[deviceIdx]);
2690 for (size_t queueNdx = 0; queueNdx < queueProps.size(); queueNdx++)
2692 if (queueProps[queueNdx].queueFlags & VK_QUEUE_GRAPHICS_BIT)
2693 queueFamilyIndex = (deUint32)queueNdx;
2695 const VkDeviceQueueCreateInfo deviceQueueCreateInfo =
2697 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, //type
2699 (VkDeviceQueueCreateFlags)0u, //flags
2700 queueFamilyIndex, //queueFamilyIndex;
2702 &queuePriority, //pQueuePriorities;
2705 // Need atleast 2 devices for peer memory features
2706 numPhysicalDevices = deviceGroupProps[devGroupIdx].physicalDeviceCount;
2707 if (numPhysicalDevices < 2)
2708 TCU_THROW(NotSupportedError, "Need a device Group with at least 2 physical devices.");
2710 // Create device groups
2711 const VkDeviceGroupDeviceCreateInfo deviceGroupInfo =
2713 VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO, //stype
2715 deviceGroupProps[devGroupIdx].physicalDeviceCount, //physicalDeviceCount
2716 deviceGroupProps[devGroupIdx].physicalDevices //physicalDevices
2719 const VkDeviceCreateInfo deviceCreateInfo =
2721 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, //sType;
2722 &deviceGroupInfo, //pNext;
2723 (VkDeviceCreateFlags)0u, //flags
2724 1, //queueRecordCount;
2725 &deviceQueueCreateInfo, //pRequestedQueues;
2727 DE_NULL, //ppEnabledLayerNames;
2728 deUint32(deviceExtensions.size()), //extensionCount;
2729 (deviceExtensions.empty() ? DE_NULL : &deviceExtensions[0]), //ppEnabledExtensionNames;
2730 DE_NULL, //pEnabledFeatures;
2733 Move<VkDevice> deviceGroup = createCustomDevice(context.getTestContext().getCommandLine().isValidationEnabled(), vkp, instance, vki, deviceGroupProps[devGroupIdx].physicalDevices[deviceIdx], &deviceCreateInfo);
2734 const DeviceDriver vk (vkp, instance, *deviceGroup);
2735 context.getInstanceInterface().getPhysicalDeviceMemoryProperties(deviceGroupProps[devGroupIdx].physicalDevices[deviceIdx], &memProps);
2737 peerMemFeatures = reinterpret_cast<VkPeerMemoryFeatureFlags*>(buffer);
2738 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
2740 for (deUint32 heapIndex = 0; heapIndex < memProps.memoryHeapCount; heapIndex++)
2742 for (deUint32 localDeviceIndex = 0; localDeviceIndex < numPhysicalDevices; localDeviceIndex++)
2744 for (deUint32 remoteDeviceIndex = 0; remoteDeviceIndex < numPhysicalDevices; remoteDeviceIndex++)
2746 if (localDeviceIndex != remoteDeviceIndex)
2748 vk.getDeviceGroupPeerMemoryFeatures(deviceGroup.get(), heapIndex, localDeviceIndex, remoteDeviceIndex, peerMemFeatures);
2751 for (deInt32 ndx = 0; ndx < GUARD_SIZE; ndx++)
2753 if (buffer[ndx + sizeof(VkPeerMemoryFeatureFlags)] != GUARD_VALUE)
2755 log << TestLog::Message << "deviceGroupPeerMemoryFeatures - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
2756 return tcu::TestStatus::fail("deviceGroupPeerMemoryFeatures buffer overflow");
2760 VkPeerMemoryFeatureFlags requiredFlag = VK_PEER_MEMORY_FEATURE_COPY_DST_BIT;
2761 VkPeerMemoryFeatureFlags maxValidFlag = VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT|VK_PEER_MEMORY_FEATURE_COPY_DST_BIT|
2762 VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT|VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT;
2763 if ((!(*peerMemFeatures & requiredFlag)) ||
2764 *peerMemFeatures > maxValidFlag)
2765 return tcu::TestStatus::fail("deviceGroupPeerMemoryFeatures invalid flag");
2767 log << TestLog::Message << "deviceGroup = " << deviceGroup.get() << TestLog::EndMessage
2768 << TestLog::Message << "heapIndex = " << heapIndex << TestLog::EndMessage
2769 << TestLog::Message << "localDeviceIndex = " << localDeviceIndex << TestLog::EndMessage
2770 << TestLog::Message << "remoteDeviceIndex = " << remoteDeviceIndex << TestLog::EndMessage
2771 << TestLog::Message << "PeerMemoryFeatureFlags = " << *peerMemFeatures << TestLog::EndMessage;
2777 return tcu::TestStatus::pass("Querying deviceGroup peer memory features succeeded");
2780 tcu::TestStatus deviceMemoryBudgetProperties (Context& context)
2782 TestLog& log = context.getTestContext().getLog();
2783 deUint8 buffer[sizeof(VkPhysicalDeviceMemoryBudgetPropertiesEXT) + GUARD_SIZE];
2785 if (!context.isDeviceFunctionalitySupported("VK_EXT_memory_budget"))
2786 TCU_THROW(NotSupportedError, "VK_EXT_memory_budget is not supported");
2788 VkPhysicalDeviceMemoryBudgetPropertiesEXT *budgetProps = reinterpret_cast<VkPhysicalDeviceMemoryBudgetPropertiesEXT *>(buffer);
2789 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
2791 budgetProps->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT;
2792 budgetProps->pNext = DE_NULL;
2794 VkPhysicalDeviceMemoryProperties2 memProps;
2795 deMemset(&memProps, 0, sizeof(memProps));
2796 memProps.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2;
2797 memProps.pNext = budgetProps;
2799 context.getInstanceInterface().getPhysicalDeviceMemoryProperties2(context.getPhysicalDevice(), &memProps);
2801 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
2802 << TestLog::Message << *budgetProps << TestLog::EndMessage;
2804 for (deInt32 ndx = 0; ndx < GUARD_SIZE; ndx++)
2806 if (buffer[ndx + sizeof(VkPhysicalDeviceMemoryBudgetPropertiesEXT)] != GUARD_VALUE)
2808 log << TestLog::Message << "deviceMemoryBudgetProperties - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
2809 return tcu::TestStatus::fail("deviceMemoryBudgetProperties buffer overflow");
2813 for (deUint32 i = 0; i < memProps.memoryProperties.memoryHeapCount; ++i)
2815 if (budgetProps->heapBudget[i] == 0)
2817 log << TestLog::Message << "deviceMemoryBudgetProperties - Supported heaps must report nonzero budget" << TestLog::EndMessage;
2818 return tcu::TestStatus::fail("deviceMemoryBudgetProperties invalid heap budget (zero)");
2820 if (budgetProps->heapBudget[i] > memProps.memoryProperties.memoryHeaps[i].size)
2822 log << TestLog::Message << "deviceMemoryBudgetProperties - Heap budget must be less than or equal to heap size" << TestLog::EndMessage;
2823 return tcu::TestStatus::fail("deviceMemoryBudgetProperties invalid heap budget (too large)");
2827 for (deUint32 i = memProps.memoryProperties.memoryHeapCount; i < VK_MAX_MEMORY_HEAPS; ++i)
2829 if (budgetProps->heapBudget[i] != 0 || budgetProps->heapUsage[i] != 0)
2831 log << TestLog::Message << "deviceMemoryBudgetProperties - Unused heaps must report budget/usage of zero" << TestLog::EndMessage;
2832 return tcu::TestStatus::fail("deviceMemoryBudgetProperties invalid unused heaps");
2836 return tcu::TestStatus::pass("Querying memory budget properties succeeded");
2842 #include "vkMandatoryFeatures.inl"
2846 tcu::TestStatus deviceMandatoryFeatures(Context& context)
2848 if( checkMandatoryFeatures(context) )
2849 return tcu::TestStatus::pass("Passed");
2850 return tcu::TestStatus::fail("Not all mandatory features are supported ( see: chapter 35.1 )");
2853 VkFormatFeatureFlags getRequiredOptimalTilingFeatures (VkFormat format)
2858 VkFormatFeatureFlags flags;
2863 SAIM = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT,
2864 BLSR = VK_FORMAT_FEATURE_BLIT_SRC_BIT,
2865 SIFL = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT,
2866 COAT = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT,
2867 BLDS = VK_FORMAT_FEATURE_BLIT_DST_BIT,
2868 CABL = VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT,
2869 STIM = VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT,
2870 STIA = VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT,
2871 DSAT = VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT
2874 static const Formatpair formatflags[] =
2876 { VK_FORMAT_B4G4R4A4_UNORM_PACK16, SAIM | BLSR | SIFL },
2877 { VK_FORMAT_R5G6B5_UNORM_PACK16, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2878 { VK_FORMAT_A1R5G5B5_UNORM_PACK16, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2879 { VK_FORMAT_R8_UNORM, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2880 { VK_FORMAT_R8_SNORM, SAIM | BLSR | SIFL },
2881 { VK_FORMAT_R8_UINT, SAIM | BLSR | COAT | BLDS },
2882 { VK_FORMAT_R8_SINT, SAIM | BLSR | COAT | BLDS },
2883 { VK_FORMAT_R8G8_UNORM, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2884 { VK_FORMAT_R8G8_SNORM, SAIM | BLSR | SIFL },
2885 { VK_FORMAT_R8G8_UINT, SAIM | BLSR | COAT | BLDS },
2886 { VK_FORMAT_R8G8_SINT, SAIM | BLSR | COAT | BLDS },
2887 { VK_FORMAT_R8G8B8A8_UNORM, SAIM | BLSR | COAT | BLDS | SIFL | STIM | CABL },
2888 { VK_FORMAT_R8G8B8A8_SNORM, SAIM | BLSR | SIFL | STIM },
2889 { VK_FORMAT_R8G8B8A8_UINT, SAIM | BLSR | COAT | BLDS | STIM },
2890 { VK_FORMAT_R8G8B8A8_SINT, SAIM | BLSR | COAT | BLDS | STIM },
2891 { VK_FORMAT_R8G8B8A8_SRGB, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2892 { VK_FORMAT_B8G8R8A8_UNORM, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2893 { VK_FORMAT_B8G8R8A8_SRGB, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2894 { VK_FORMAT_A8B8G8R8_UNORM_PACK32, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2895 { VK_FORMAT_A8B8G8R8_SNORM_PACK32, SAIM | BLSR | SIFL },
2896 { VK_FORMAT_A8B8G8R8_UINT_PACK32, SAIM | BLSR | COAT | BLDS },
2897 { VK_FORMAT_A8B8G8R8_SINT_PACK32, SAIM | BLSR | COAT | BLDS },
2898 { VK_FORMAT_A8B8G8R8_SRGB_PACK32, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2899 { VK_FORMAT_A2B10G10R10_UNORM_PACK32, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2900 { VK_FORMAT_A2B10G10R10_UINT_PACK32, SAIM | BLSR | COAT | BLDS },
2901 { VK_FORMAT_R16_UINT, SAIM | BLSR | COAT | BLDS },
2902 { VK_FORMAT_R16_SINT, SAIM | BLSR | COAT | BLDS },
2903 { VK_FORMAT_R16_SFLOAT, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2904 { VK_FORMAT_R16G16_UINT, SAIM | BLSR | COAT | BLDS },
2905 { VK_FORMAT_R16G16_SINT, SAIM | BLSR | COAT | BLDS },
2906 { VK_FORMAT_R16G16_SFLOAT, SAIM | BLSR | COAT | BLDS | SIFL | CABL },
2907 { VK_FORMAT_R16G16B16A16_UINT, SAIM | BLSR | COAT | BLDS | STIM },
2908 { VK_FORMAT_R16G16B16A16_SINT, SAIM | BLSR | COAT | BLDS | STIM },
2909 { VK_FORMAT_R16G16B16A16_SFLOAT, SAIM | BLSR | COAT | BLDS | SIFL | STIM | CABL },
2910 { VK_FORMAT_R32_UINT, SAIM | BLSR | COAT | BLDS | STIM | STIA },
2911 { VK_FORMAT_R32_SINT, SAIM | BLSR | COAT | BLDS | STIM | STIA },
2912 { VK_FORMAT_R32_SFLOAT, SAIM | BLSR | COAT | BLDS | STIM },
2913 { VK_FORMAT_R32G32_UINT, SAIM | BLSR | COAT | BLDS | STIM },
2914 { VK_FORMAT_R32G32_SINT, SAIM | BLSR | COAT | BLDS | STIM },
2915 { VK_FORMAT_R32G32_SFLOAT, SAIM | BLSR | COAT | BLDS | STIM },
2916 { VK_FORMAT_R32G32B32A32_UINT, SAIM | BLSR | COAT | BLDS | STIM },
2917 { VK_FORMAT_R32G32B32A32_SINT, SAIM | BLSR | COAT | BLDS | STIM },
2918 { VK_FORMAT_R32G32B32A32_SFLOAT, SAIM | BLSR | COAT | BLDS | STIM },
2919 { VK_FORMAT_B10G11R11_UFLOAT_PACK32, SAIM | BLSR | SIFL },
2920 { VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, SAIM | BLSR | SIFL },
2921 { VK_FORMAT_D16_UNORM, SAIM | BLSR | DSAT },
2922 { VK_FORMAT_D32_SFLOAT, SAIM | BLSR }
2925 size_t formatpairs = sizeof(formatflags) / sizeof(Formatpair);
2927 for (unsigned int i = 0; i < formatpairs; i++)
2928 if (formatflags[i].format == format)
2929 return formatflags[i].flags;
2933 VkFormatFeatureFlags getRequiredOptimalExtendedTilingFeatures (Context& context, VkFormat format, VkFormatFeatureFlags queriedFlags)
2935 VkFormatFeatureFlags flags = (VkFormatFeatureFlags)0;
2937 // VK_EXT_sampler_filter_minmax:
2938 // If filterMinmaxSingleComponentFormats is VK_TRUE, the following formats must
2939 // support the VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT feature with
2940 // VK_IMAGE_TILING_OPTIMAL, if they support VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT.
2942 static const VkFormat s_requiredSampledImageFilterMinMaxFormats[] =
2946 VK_FORMAT_R16_UNORM,
2947 VK_FORMAT_R16_SNORM,
2948 VK_FORMAT_R16_SFLOAT,
2949 VK_FORMAT_R32_SFLOAT,
2950 VK_FORMAT_D16_UNORM,
2951 VK_FORMAT_X8_D24_UNORM_PACK32,
2952 VK_FORMAT_D32_SFLOAT,
2953 VK_FORMAT_D16_UNORM_S8_UINT,
2954 VK_FORMAT_D24_UNORM_S8_UINT,
2955 VK_FORMAT_D32_SFLOAT_S8_UINT,
2958 if ((queriedFlags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0)
2960 if (de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), "VK_EXT_sampler_filter_minmax"))
2962 if (de::contains(DE_ARRAY_BEGIN(s_requiredSampledImageFilterMinMaxFormats), DE_ARRAY_END(s_requiredSampledImageFilterMinMaxFormats), format))
2964 VkPhysicalDeviceSamplerFilterMinmaxProperties physicalDeviceSamplerMinMaxProperties =
2966 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT,
2973 VkPhysicalDeviceProperties2 physicalDeviceProperties;
2974 physicalDeviceProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
2975 physicalDeviceProperties.pNext = &physicalDeviceSamplerMinMaxProperties;
2977 const InstanceInterface& vk = context.getInstanceInterface();
2978 vk.getPhysicalDeviceProperties2(context.getPhysicalDevice(), &physicalDeviceProperties);
2981 if (physicalDeviceSamplerMinMaxProperties.filterMinmaxSingleComponentFormats)
2983 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT;
2991 VkFormatFeatureFlags getRequiredBufferFeatures (VkFormat format)
2993 static const VkFormat s_requiredVertexBufferFormats[] =
2999 VK_FORMAT_R8G8_UNORM,
3000 VK_FORMAT_R8G8_SNORM,
3001 VK_FORMAT_R8G8_UINT,
3002 VK_FORMAT_R8G8_SINT,
3003 VK_FORMAT_R8G8B8A8_UNORM,
3004 VK_FORMAT_R8G8B8A8_SNORM,
3005 VK_FORMAT_R8G8B8A8_UINT,
3006 VK_FORMAT_R8G8B8A8_SINT,
3007 VK_FORMAT_B8G8R8A8_UNORM,
3008 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
3009 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
3010 VK_FORMAT_A8B8G8R8_UINT_PACK32,
3011 VK_FORMAT_A8B8G8R8_SINT_PACK32,
3012 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
3013 VK_FORMAT_R16_UNORM,
3014 VK_FORMAT_R16_SNORM,
3017 VK_FORMAT_R16_SFLOAT,
3018 VK_FORMAT_R16G16_UNORM,
3019 VK_FORMAT_R16G16_SNORM,
3020 VK_FORMAT_R16G16_UINT,
3021 VK_FORMAT_R16G16_SINT,
3022 VK_FORMAT_R16G16_SFLOAT,
3023 VK_FORMAT_R16G16B16A16_UNORM,
3024 VK_FORMAT_R16G16B16A16_SNORM,
3025 VK_FORMAT_R16G16B16A16_UINT,
3026 VK_FORMAT_R16G16B16A16_SINT,
3027 VK_FORMAT_R16G16B16A16_SFLOAT,
3030 VK_FORMAT_R32_SFLOAT,
3031 VK_FORMAT_R32G32_UINT,
3032 VK_FORMAT_R32G32_SINT,
3033 VK_FORMAT_R32G32_SFLOAT,
3034 VK_FORMAT_R32G32B32_UINT,
3035 VK_FORMAT_R32G32B32_SINT,
3036 VK_FORMAT_R32G32B32_SFLOAT,
3037 VK_FORMAT_R32G32B32A32_UINT,
3038 VK_FORMAT_R32G32B32A32_SINT,
3039 VK_FORMAT_R32G32B32A32_SFLOAT
3041 static const VkFormat s_requiredUniformTexelBufferFormats[] =
3047 VK_FORMAT_R8G8_UNORM,
3048 VK_FORMAT_R8G8_SNORM,
3049 VK_FORMAT_R8G8_UINT,
3050 VK_FORMAT_R8G8_SINT,
3051 VK_FORMAT_R8G8B8A8_UNORM,
3052 VK_FORMAT_R8G8B8A8_SNORM,
3053 VK_FORMAT_R8G8B8A8_UINT,
3054 VK_FORMAT_R8G8B8A8_SINT,
3055 VK_FORMAT_B8G8R8A8_UNORM,
3056 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
3057 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
3058 VK_FORMAT_A8B8G8R8_UINT_PACK32,
3059 VK_FORMAT_A8B8G8R8_SINT_PACK32,
3060 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
3061 VK_FORMAT_A2B10G10R10_UINT_PACK32,
3064 VK_FORMAT_R16_SFLOAT,
3065 VK_FORMAT_R16G16_UINT,
3066 VK_FORMAT_R16G16_SINT,
3067 VK_FORMAT_R16G16_SFLOAT,
3068 VK_FORMAT_R16G16B16A16_UINT,
3069 VK_FORMAT_R16G16B16A16_SINT,
3070 VK_FORMAT_R16G16B16A16_SFLOAT,
3073 VK_FORMAT_R32_SFLOAT,
3074 VK_FORMAT_R32G32_UINT,
3075 VK_FORMAT_R32G32_SINT,
3076 VK_FORMAT_R32G32_SFLOAT,
3077 VK_FORMAT_R32G32B32A32_UINT,
3078 VK_FORMAT_R32G32B32A32_SINT,
3079 VK_FORMAT_R32G32B32A32_SFLOAT,
3080 VK_FORMAT_B10G11R11_UFLOAT_PACK32
3082 static const VkFormat s_requiredStorageTexelBufferFormats[] =
3084 VK_FORMAT_R8G8B8A8_UNORM,
3085 VK_FORMAT_R8G8B8A8_SNORM,
3086 VK_FORMAT_R8G8B8A8_UINT,
3087 VK_FORMAT_R8G8B8A8_SINT,
3088 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
3089 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
3090 VK_FORMAT_A8B8G8R8_UINT_PACK32,
3091 VK_FORMAT_A8B8G8R8_SINT_PACK32,
3092 VK_FORMAT_R16G16B16A16_UINT,
3093 VK_FORMAT_R16G16B16A16_SINT,
3094 VK_FORMAT_R16G16B16A16_SFLOAT,
3097 VK_FORMAT_R32_SFLOAT,
3098 VK_FORMAT_R32G32_UINT,
3099 VK_FORMAT_R32G32_SINT,
3100 VK_FORMAT_R32G32_SFLOAT,
3101 VK_FORMAT_R32G32B32A32_UINT,
3102 VK_FORMAT_R32G32B32A32_SINT,
3103 VK_FORMAT_R32G32B32A32_SFLOAT
3105 static const VkFormat s_requiredStorageTexelBufferAtomicFormats[] =
3111 VkFormatFeatureFlags flags = (VkFormatFeatureFlags)0;
3113 if (de::contains(DE_ARRAY_BEGIN(s_requiredVertexBufferFormats), DE_ARRAY_END(s_requiredVertexBufferFormats), format))
3114 flags |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT;
3116 if (de::contains(DE_ARRAY_BEGIN(s_requiredUniformTexelBufferFormats), DE_ARRAY_END(s_requiredUniformTexelBufferFormats), format))
3117 flags |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT;
3119 if (de::contains(DE_ARRAY_BEGIN(s_requiredStorageTexelBufferFormats), DE_ARRAY_END(s_requiredStorageTexelBufferFormats), format))
3120 flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
3122 if (de::contains(DE_ARRAY_BEGIN(s_requiredStorageTexelBufferAtomicFormats), DE_ARRAY_END(s_requiredStorageTexelBufferAtomicFormats), format))
3123 flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT;
3128 tcu::TestStatus formatProperties (Context& context, VkFormat format)
3130 TestLog& log = context.getTestContext().getLog();
3131 const VkFormatProperties properties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
3134 // \todo [2017-05-16 pyry] This should be extended to cover for example COLOR_ATTACHMENT for depth formats etc.
3135 // \todo [2017-05-18 pyry] Any other color conversion related features that can't be supported by regular formats?
3136 const VkFormatFeatureFlags extOptimalFeatures = getRequiredOptimalExtendedTilingFeatures(context, format, properties.optimalTilingFeatures);
3138 const VkFormatFeatureFlags notAllowedFeatures = VK_FORMAT_FEATURE_DISJOINT_BIT;
3142 VkFormatFeatureFlags VkFormatProperties::* field;
3143 const char* fieldName;
3144 VkFormatFeatureFlags requiredFeatures;
3147 { &VkFormatProperties::linearTilingFeatures, "linearTilingFeatures", (VkFormatFeatureFlags)0 },
3148 { &VkFormatProperties::optimalTilingFeatures, "optimalTilingFeatures", getRequiredOptimalTilingFeatures(format) | extOptimalFeatures },
3149 { &VkFormatProperties::bufferFeatures, "bufferFeatures", getRequiredBufferFeatures(format) }
3152 log << TestLog::Message << properties << TestLog::EndMessage;
3154 for (int fieldNdx = 0; fieldNdx < DE_LENGTH_OF_ARRAY(fields); fieldNdx++)
3156 const char* const fieldName = fields[fieldNdx].fieldName;
3157 const VkFormatFeatureFlags supported = properties.*fields[fieldNdx].field;
3158 const VkFormatFeatureFlags required = fields[fieldNdx].requiredFeatures;
3160 if ((supported & required) != required)
3162 log << TestLog::Message << "ERROR in " << fieldName << ":\n"
3163 << " required: " << getFormatFeatureFlagsStr(required) << "\n "
3164 << " missing: " << getFormatFeatureFlagsStr(~supported & required)
3165 << TestLog::EndMessage;
3169 if ((supported & notAllowedFeatures) != 0)
3171 log << TestLog::Message << "ERROR in " << fieldName << ":\n"
3172 << " has: " << getFormatFeatureFlagsStr(supported & notAllowedFeatures)
3173 << TestLog::EndMessage;
3179 return tcu::TestStatus::pass("Query and validation passed");
3181 return tcu::TestStatus::fail("Required features not supported");
3184 VkPhysicalDeviceSamplerYcbcrConversionFeatures getPhysicalDeviceSamplerYcbcrConversionFeatures (const InstanceInterface& vk, VkPhysicalDevice physicalDevice)
3186 VkPhysicalDeviceFeatures2 coreFeatures;
3187 VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures;
3189 deMemset(&coreFeatures, 0, sizeof(coreFeatures));
3190 deMemset(&ycbcrFeatures, 0, sizeof(ycbcrFeatures));
3192 coreFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
3193 coreFeatures.pNext = &ycbcrFeatures;
3194 ycbcrFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES;
3196 vk.getPhysicalDeviceFeatures2(physicalDevice, &coreFeatures);
3198 return ycbcrFeatures;
3201 void checkYcbcrApiSupport (Context& context)
3203 // check if YCbcr API and are supported by implementation
3205 // the support for formats and YCbCr may still be optional - see isYcbcrConversionSupported below
3207 if (!vk::isCoreDeviceExtension(context.getUsedApiVersion(), "VK_KHR_sampler_ycbcr_conversion"))
3209 if (!context.isDeviceFunctionalitySupported("VK_KHR_sampler_ycbcr_conversion"))
3210 TCU_THROW(NotSupportedError, "VK_KHR_sampler_ycbcr_conversion is not supported");
3212 // Hard dependency for ycbcr
3213 TCU_CHECK(de::contains(context.getInstanceExtensions().begin(), context.getInstanceExtensions().end(), "VK_KHR_get_physical_device_properties2"));
3217 bool isYcbcrConversionSupported (Context& context)
3219 checkYcbcrApiSupport(context);
3221 const VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures = getPhysicalDeviceSamplerYcbcrConversionFeatures(context.getInstanceInterface(), context.getPhysicalDevice());
3223 return (ycbcrFeatures.samplerYcbcrConversion == VK_TRUE);
3226 VkFormatFeatureFlags getAllowedYcbcrFormatFeatures (VkFormat format)
3228 DE_ASSERT(isYCbCrFormat(format));
3230 VkFormatFeatureFlags flags = (VkFormatFeatureFlags)0;
3232 // all formats *may* support these
3233 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
3234 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
3235 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG;
3236 flags |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT;
3237 flags |= VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
3238 flags |= VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT;
3239 flags |= VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT;
3240 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT;
3241 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT;
3242 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT;
3243 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT;
3244 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT;
3246 // multi-plane formats *may* support DISJOINT_BIT
3247 if (getPlaneCount(format) >= 2)
3248 flags |= VK_FORMAT_FEATURE_DISJOINT_BIT;
3250 if (isChromaSubsampled(format))
3251 flags |= VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT;
3256 tcu::TestStatus ycbcrFormatProperties (Context& context, VkFormat format)
3258 DE_ASSERT(isYCbCrFormat(format));
3259 // check if Ycbcr format enums are valid given the version and extensions
3260 checkYcbcrApiSupport(context);
3262 TestLog& log = context.getTestContext().getLog();
3263 const VkFormatProperties properties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
3265 const VkFormatFeatureFlags allowedImageFeatures = getAllowedYcbcrFormatFeatures(format);
3269 VkFormatFeatureFlags VkFormatProperties::* field;
3270 const char* fieldName;
3271 bool requiredFeatures;
3272 VkFormatFeatureFlags allowedFeatures;
3275 { &VkFormatProperties::linearTilingFeatures, "linearTilingFeatures", false, allowedImageFeatures },
3276 { &VkFormatProperties::optimalTilingFeatures, "optimalTilingFeatures", true, allowedImageFeatures },
3277 { &VkFormatProperties::bufferFeatures, "bufferFeatures", false, (VkFormatFeatureFlags)0 }
3279 static const VkFormat s_requiredBaseFormats[] =
3281 VK_FORMAT_G8_B8R8_2PLANE_420_UNORM,
3282 VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM
3284 const bool isRequiredBaseFormat = isYcbcrConversionSupported(context) &&
3285 de::contains(DE_ARRAY_BEGIN(s_requiredBaseFormats), DE_ARRAY_END(s_requiredBaseFormats), format);
3287 log << TestLog::Message << properties << TestLog::EndMessage;
3289 for (int fieldNdx = 0; fieldNdx < DE_LENGTH_OF_ARRAY(fields); fieldNdx++)
3291 const char* const fieldName = fields[fieldNdx].fieldName;
3292 const VkFormatFeatureFlags supported = properties.*fields[fieldNdx].field;
3293 const VkFormatFeatureFlags allowed = fields[fieldNdx].allowedFeatures;
3295 if (isRequiredBaseFormat && fields[fieldNdx].requiredFeatures)
3297 const VkFormatFeatureFlags required = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
3298 | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
3299 | VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
3301 if ((supported & required) != required)
3303 log << TestLog::Message << "ERROR in " << fieldName << ":\n"
3304 << " required: " << getFormatFeatureFlagsStr(required) << "\n "
3305 << " missing: " << getFormatFeatureFlagsStr(~supported & required)
3306 << TestLog::EndMessage;
3310 if ((supported & (VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT | VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT)) == 0)
3312 log << TestLog::Message << "ERROR in " << fieldName << ":\n"
3313 << " Either VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT or VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT required"
3314 << TestLog::EndMessage;
3319 if ((supported & ~allowed) != 0)
3321 log << TestLog::Message << "ERROR in " << fieldName << ":\n"
3322 << " has: " << getFormatFeatureFlagsStr(supported & ~allowed)
3323 << TestLog::EndMessage;
3329 return tcu::TestStatus::pass("Query and validation passed");
3331 return tcu::TestStatus::fail("Required features not supported");
3334 bool optimalTilingFeaturesSupported (Context& context, VkFormat format, VkFormatFeatureFlags features)
3336 const VkFormatProperties properties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
3338 return (properties.optimalTilingFeatures & features) == features;
3341 bool optimalTilingFeaturesSupportedForAll (Context& context, const VkFormat* begin, const VkFormat* end, VkFormatFeatureFlags features)
3343 for (const VkFormat* cur = begin; cur != end; ++cur)
3345 if (!optimalTilingFeaturesSupported(context, *cur, features))
3352 tcu::TestStatus testDepthStencilSupported (Context& context)
3354 if (!optimalTilingFeaturesSupported(context, VK_FORMAT_X8_D24_UNORM_PACK32, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) &&
3355 !optimalTilingFeaturesSupported(context, VK_FORMAT_D32_SFLOAT, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))
3356 return tcu::TestStatus::fail("Doesn't support one of VK_FORMAT_X8_D24_UNORM_PACK32 or VK_FORMAT_D32_SFLOAT");
3358 if (!optimalTilingFeaturesSupported(context, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) &&
3359 !optimalTilingFeaturesSupported(context, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))
3360 return tcu::TestStatus::fail("Doesn't support one of VK_FORMAT_D24_UNORM_S8_UINT or VK_FORMAT_D32_SFLOAT_S8_UINT");
3362 return tcu::TestStatus::pass("Required depth/stencil formats supported");
3365 tcu::TestStatus testCompressedFormatsSupported (Context& context)
3367 static const VkFormat s_allBcFormats[] =
3369 VK_FORMAT_BC1_RGB_UNORM_BLOCK,
3370 VK_FORMAT_BC1_RGB_SRGB_BLOCK,
3371 VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
3372 VK_FORMAT_BC1_RGBA_SRGB_BLOCK,
3373 VK_FORMAT_BC2_UNORM_BLOCK,
3374 VK_FORMAT_BC2_SRGB_BLOCK,
3375 VK_FORMAT_BC3_UNORM_BLOCK,
3376 VK_FORMAT_BC3_SRGB_BLOCK,
3377 VK_FORMAT_BC4_UNORM_BLOCK,
3378 VK_FORMAT_BC4_SNORM_BLOCK,
3379 VK_FORMAT_BC5_UNORM_BLOCK,
3380 VK_FORMAT_BC5_SNORM_BLOCK,
3381 VK_FORMAT_BC6H_UFLOAT_BLOCK,
3382 VK_FORMAT_BC6H_SFLOAT_BLOCK,
3383 VK_FORMAT_BC7_UNORM_BLOCK,
3384 VK_FORMAT_BC7_SRGB_BLOCK,
3386 static const VkFormat s_allEtc2Formats[] =
3388 VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,
3389 VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK,
3390 VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,
3391 VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,
3392 VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,
3393 VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,
3394 VK_FORMAT_EAC_R11_UNORM_BLOCK,
3395 VK_FORMAT_EAC_R11_SNORM_BLOCK,
3396 VK_FORMAT_EAC_R11G11_UNORM_BLOCK,
3397 VK_FORMAT_EAC_R11G11_SNORM_BLOCK,
3399 static const VkFormat s_allAstcLdrFormats[] =
3401 VK_FORMAT_ASTC_4x4_UNORM_BLOCK,
3402 VK_FORMAT_ASTC_4x4_SRGB_BLOCK,
3403 VK_FORMAT_ASTC_5x4_UNORM_BLOCK,
3404 VK_FORMAT_ASTC_5x4_SRGB_BLOCK,
3405 VK_FORMAT_ASTC_5x5_UNORM_BLOCK,
3406 VK_FORMAT_ASTC_5x5_SRGB_BLOCK,
3407 VK_FORMAT_ASTC_6x5_UNORM_BLOCK,
3408 VK_FORMAT_ASTC_6x5_SRGB_BLOCK,
3409 VK_FORMAT_ASTC_6x6_UNORM_BLOCK,
3410 VK_FORMAT_ASTC_6x6_SRGB_BLOCK,
3411 VK_FORMAT_ASTC_8x5_UNORM_BLOCK,
3412 VK_FORMAT_ASTC_8x5_SRGB_BLOCK,
3413 VK_FORMAT_ASTC_8x6_UNORM_BLOCK,
3414 VK_FORMAT_ASTC_8x6_SRGB_BLOCK,
3415 VK_FORMAT_ASTC_8x8_UNORM_BLOCK,
3416 VK_FORMAT_ASTC_8x8_SRGB_BLOCK,
3417 VK_FORMAT_ASTC_10x5_UNORM_BLOCK,
3418 VK_FORMAT_ASTC_10x5_SRGB_BLOCK,
3419 VK_FORMAT_ASTC_10x6_UNORM_BLOCK,
3420 VK_FORMAT_ASTC_10x6_SRGB_BLOCK,
3421 VK_FORMAT_ASTC_10x8_UNORM_BLOCK,
3422 VK_FORMAT_ASTC_10x8_SRGB_BLOCK,
3423 VK_FORMAT_ASTC_10x10_UNORM_BLOCK,
3424 VK_FORMAT_ASTC_10x10_SRGB_BLOCK,
3425 VK_FORMAT_ASTC_12x10_UNORM_BLOCK,
3426 VK_FORMAT_ASTC_12x10_SRGB_BLOCK,
3427 VK_FORMAT_ASTC_12x12_UNORM_BLOCK,
3428 VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
3433 const char* setName;
3434 const char* featureName;
3435 const VkBool32 VkPhysicalDeviceFeatures::* feature;
3436 const VkFormat* formatsBegin;
3437 const VkFormat* formatsEnd;
3438 } s_compressedFormatSets[] =
3440 { "BC", "textureCompressionBC", &VkPhysicalDeviceFeatures::textureCompressionBC, DE_ARRAY_BEGIN(s_allBcFormats), DE_ARRAY_END(s_allBcFormats) },
3441 { "ETC2", "textureCompressionETC2", &VkPhysicalDeviceFeatures::textureCompressionETC2, DE_ARRAY_BEGIN(s_allEtc2Formats), DE_ARRAY_END(s_allEtc2Formats) },
3442 { "ASTC LDR", "textureCompressionASTC_LDR", &VkPhysicalDeviceFeatures::textureCompressionASTC_LDR, DE_ARRAY_BEGIN(s_allAstcLdrFormats), DE_ARRAY_END(s_allAstcLdrFormats) },
3445 TestLog& log = context.getTestContext().getLog();
3446 const VkPhysicalDeviceFeatures& features = context.getDeviceFeatures();
3447 int numSupportedSets = 0;
3449 int numWarnings = 0;
3451 for (int setNdx = 0; setNdx < DE_LENGTH_OF_ARRAY(s_compressedFormatSets); ++setNdx)
3453 const char* const setName = s_compressedFormatSets[setNdx].setName;
3454 const char* const featureName = s_compressedFormatSets[setNdx].featureName;
3455 const bool featureBitSet = features.*s_compressedFormatSets[setNdx].feature == VK_TRUE;
3456 const bool allSupported = optimalTilingFeaturesSupportedForAll(context,
3457 s_compressedFormatSets[setNdx].formatsBegin,
3458 s_compressedFormatSets[setNdx].formatsEnd,
3459 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT);
3461 if (featureBitSet && !allSupported)
3463 log << TestLog::Message << "ERROR: " << featureName << " = VK_TRUE but " << setName << " formats not supported" << TestLog::EndMessage;
3466 else if (allSupported && !featureBitSet)
3468 log << TestLog::Message << "WARNING: " << setName << " formats supported but " << featureName << " = VK_FALSE" << TestLog::EndMessage;
3474 log << TestLog::Message << "All " << setName << " formats are supported" << TestLog::EndMessage;
3475 numSupportedSets += 1;
3478 log << TestLog::Message << setName << " formats are not supported" << TestLog::EndMessage;
3481 if (numSupportedSets == 0)
3483 log << TestLog::Message << "No compressed format sets supported" << TestLog::EndMessage;
3488 return tcu::TestStatus::fail("Compressed format support not valid");
3489 else if (numWarnings > 0)
3490 return tcu::TestStatus(QP_TEST_RESULT_QUALITY_WARNING, "Found inconsistencies in compressed format support");
3492 return tcu::TestStatus::pass("Compressed texture format support is valid");
3495 void createFormatTests (tcu::TestCaseGroup* testGroup)
3497 DE_STATIC_ASSERT(VK_FORMAT_UNDEFINED == 0);
3503 FunctionInstance1<VkFormat>::Function testFunction;
3504 } s_formatRanges[] =
3507 { (VkFormat)(VK_FORMAT_UNDEFINED+1), VK_CORE_FORMAT_LAST, formatProperties },
3510 { VK_FORMAT_G8B8G8R8_422_UNORM, (VkFormat)(VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM+1), ycbcrFormatProperties },
3513 for (int rangeNdx = 0; rangeNdx < DE_LENGTH_OF_ARRAY(s_formatRanges); ++rangeNdx)
3515 const VkFormat rangeBegin = s_formatRanges[rangeNdx].begin;
3516 const VkFormat rangeEnd = s_formatRanges[rangeNdx].end;
3517 const FunctionInstance1<VkFormat>::Function testFunction = s_formatRanges[rangeNdx].testFunction;
3519 for (VkFormat format = rangeBegin; format != rangeEnd; format = (VkFormat)(format+1))
3521 const char* const enumName = getFormatName(format);
3522 const string caseName = de::toLower(string(enumName).substr(10));
3524 addFunctionCase(testGroup, caseName, enumName, testFunction, format);
3528 addFunctionCase(testGroup, "depth_stencil", "", testDepthStencilSupported);
3529 addFunctionCase(testGroup, "compressed_formats", "", testCompressedFormatsSupported);
3532 VkImageUsageFlags getValidImageUsageFlags (const VkFormatFeatureFlags supportedFeatures, const bool useKhrMaintenance1Semantics)
3534 VkImageUsageFlags flags = (VkImageUsageFlags)0;
3536 if (useKhrMaintenance1Semantics)
3538 if ((supportedFeatures & VK_FORMAT_FEATURE_TRANSFER_SRC_BIT) != 0)
3539 flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
3541 if ((supportedFeatures & VK_FORMAT_FEATURE_TRANSFER_DST_BIT) != 0)
3542 flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
3546 // If format is supported at all, it must be valid transfer src+dst
3547 if (supportedFeatures != 0)
3548 flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT;
3551 if ((supportedFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0)
3552 flags |= VK_IMAGE_USAGE_SAMPLED_BIT;
3554 if ((supportedFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) != 0)
3555 flags |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT|VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
3557 if ((supportedFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0)
3558 flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
3560 if ((supportedFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) != 0)
3561 flags |= VK_IMAGE_USAGE_STORAGE_BIT;
3566 bool isValidImageUsageFlagCombination (VkImageUsageFlags usage)
3568 if ((usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) != 0)
3570 const VkImageUsageFlags allowedFlags = VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
3571 | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
3572 | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
3573 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
3575 // Only *_ATTACHMENT_BIT flags can be combined with TRANSIENT_ATTACHMENT_BIT
3576 if ((usage & ~allowedFlags) != 0)
3579 // TRANSIENT_ATTACHMENT_BIT is not valid without COLOR_ or DEPTH_STENCIL_ATTACHMENT_BIT
3580 if ((usage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)) == 0)
3587 VkImageCreateFlags getValidImageCreateFlags (const VkPhysicalDeviceFeatures& deviceFeatures, VkFormat format, VkFormatFeatureFlags formatFeatures, VkImageType type, VkImageUsageFlags usage)
3589 VkImageCreateFlags flags = (VkImageCreateFlags)0;
3591 if ((usage & VK_IMAGE_USAGE_SAMPLED_BIT) != 0)
3593 flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
3595 if (type == VK_IMAGE_TYPE_2D && !isYCbCrFormat(format))
3597 flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
3601 if (isYCbCrFormat(format) && getPlaneCount(format) > 1)
3603 if (formatFeatures & VK_FORMAT_FEATURE_DISJOINT_BIT_KHR)
3604 flags |= VK_IMAGE_CREATE_DISJOINT_BIT_KHR;
3607 if ((usage & (VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_STORAGE_BIT)) != 0 &&
3608 (usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) == 0)
3610 if (deviceFeatures.sparseBinding)
3611 flags |= VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT;
3613 if (deviceFeatures.sparseResidencyAliased)
3614 flags |= VK_IMAGE_CREATE_SPARSE_ALIASED_BIT;
3620 bool isValidImageCreateFlagCombination (VkImageCreateFlags)
3625 bool isRequiredImageParameterCombination (const VkPhysicalDeviceFeatures& deviceFeatures,
3626 const VkFormat format,
3627 const VkFormatProperties& formatProperties,
3628 const VkImageType imageType,
3629 const VkImageTiling imageTiling,
3630 const VkImageUsageFlags usageFlags,
3631 const VkImageCreateFlags createFlags)
3633 DE_UNREF(deviceFeatures);
3634 DE_UNREF(formatProperties);
3635 DE_UNREF(createFlags);
3637 // Linear images can have arbitrary limitations
3638 if (imageTiling == VK_IMAGE_TILING_LINEAR)
3641 // Support for other usages for compressed formats is optional
3642 if (isCompressedFormat(format) &&
3643 (usageFlags & ~(VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT)) != 0)
3646 // Support for 1D, and sliced 3D compressed formats is optional
3647 if (isCompressedFormat(format) && (imageType == VK_IMAGE_TYPE_1D || imageType == VK_IMAGE_TYPE_3D))
3650 // Support for 1D and 3D depth/stencil textures is optional
3651 if (isDepthStencilFormat(format) && (imageType == VK_IMAGE_TYPE_1D || imageType == VK_IMAGE_TYPE_3D))
3654 DE_ASSERT(deviceFeatures.sparseBinding || (createFlags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)) == 0);
3655 DE_ASSERT(deviceFeatures.sparseResidencyAliased || (createFlags & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) == 0);
3657 if (isYCbCrFormat(format) && (createFlags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)))
3660 if (createFlags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)
3662 if (isCompressedFormat(format))
3665 if (isDepthStencilFormat(format))
3668 if (!deIsPowerOfTwo32(mapVkFormat(format).getPixelSize()))
3673 case VK_IMAGE_TYPE_2D:
3674 return (deviceFeatures.sparseResidencyImage2D == VK_TRUE);
3675 case VK_IMAGE_TYPE_3D:
3676 return (deviceFeatures.sparseResidencyImage3D == VK_TRUE);
3685 VkSampleCountFlags getRequiredOptimalTilingSampleCounts (const VkPhysicalDeviceLimits& deviceLimits,
3686 const VkFormat format,
3687 const VkImageUsageFlags usageFlags)
3689 if (isCompressedFormat(format))
3690 return VK_SAMPLE_COUNT_1_BIT;
3692 bool hasDepthComp = false;
3693 bool hasStencilComp = false;
3694 const bool isYCbCr = isYCbCrFormat(format);
3697 const tcu::TextureFormat tcuFormat = mapVkFormat(format);
3698 hasDepthComp = (tcuFormat.order == tcu::TextureFormat::D || tcuFormat.order == tcu::TextureFormat::DS);
3699 hasStencilComp = (tcuFormat.order == tcu::TextureFormat::S || tcuFormat.order == tcu::TextureFormat::DS);
3702 const bool isColorFormat = !hasDepthComp && !hasStencilComp;
3703 VkSampleCountFlags sampleCounts = ~(VkSampleCountFlags)0;
3705 DE_ASSERT((hasDepthComp || hasStencilComp) != isColorFormat);
3707 if ((usageFlags & VK_IMAGE_USAGE_STORAGE_BIT) != 0)
3708 sampleCounts &= deviceLimits.storageImageSampleCounts;
3710 if ((usageFlags & VK_IMAGE_USAGE_SAMPLED_BIT) != 0)
3713 sampleCounts &= deviceLimits.sampledImageDepthSampleCounts;
3716 sampleCounts &= deviceLimits.sampledImageStencilSampleCounts;
3721 sampleCounts &= deviceLimits.sampledImageColorSampleCounts;
3724 const tcu::TextureFormat tcuFormat = mapVkFormat(format);
3725 const tcu::TextureChannelClass chnClass = tcu::getTextureChannelClass(tcuFormat.type);
3727 if (chnClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER ||
3728 chnClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER)
3729 sampleCounts &= deviceLimits.sampledImageIntegerSampleCounts;
3731 sampleCounts &= deviceLimits.sampledImageColorSampleCounts;
3736 if ((usageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) != 0)
3737 sampleCounts &= deviceLimits.framebufferColorSampleCounts;
3739 if ((usageFlags & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0)
3742 sampleCounts &= deviceLimits.framebufferDepthSampleCounts;
3745 sampleCounts &= deviceLimits.framebufferStencilSampleCounts;
3748 // If there is no usage flag set that would have corresponding device limit,
3749 // only VK_SAMPLE_COUNT_1_BIT is required.
3750 if (sampleCounts == ~(VkSampleCountFlags)0)
3751 sampleCounts &= VK_SAMPLE_COUNT_1_BIT;
3753 return sampleCounts;
3756 struct ImageFormatPropertyCase
3758 typedef tcu::TestStatus (*Function) (Context& context, const VkFormat format, const VkImageType imageType, const VkImageTiling tiling);
3760 Function testFunction;
3762 VkImageType imageType;
3763 VkImageTiling tiling;
3765 ImageFormatPropertyCase (Function testFunction_, VkFormat format_, VkImageType imageType_, VkImageTiling tiling_)
3766 : testFunction (testFunction_)
3768 , imageType (imageType_)
3772 ImageFormatPropertyCase (void)
3773 : testFunction ((Function)DE_NULL)
3774 , format (VK_FORMAT_UNDEFINED)
3775 , imageType (VK_IMAGE_TYPE_LAST)
3776 , tiling (VK_IMAGE_TILING_MAX_ENUM)
3780 tcu::TestStatus imageFormatProperties (Context& context, const VkFormat format, const VkImageType imageType, const VkImageTiling tiling)
3782 if (isYCbCrFormat(format))
3783 // check if Ycbcr format enums are valid given the version and extensions
3784 checkYcbcrApiSupport(context);
3786 TestLog& log = context.getTestContext().getLog();
3787 const VkPhysicalDeviceFeatures& deviceFeatures = context.getDeviceFeatures();
3788 const VkPhysicalDeviceLimits& deviceLimits = context.getDeviceProperties().limits;
3789 const VkFormatProperties formatProperties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
3790 const bool hasKhrMaintenance1 = context.isDeviceFunctionalitySupported("VK_KHR_maintenance1");
3792 const VkFormatFeatureFlags supportedFeatures = tiling == VK_IMAGE_TILING_LINEAR ? formatProperties.linearTilingFeatures : formatProperties.optimalTilingFeatures;
3793 const VkImageUsageFlags usageFlagSet = getValidImageUsageFlags(supportedFeatures, hasKhrMaintenance1);
3795 tcu::ResultCollector results (log, "ERROR: ");
3797 if (hasKhrMaintenance1 && (supportedFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0)
3799 results.check((supportedFeatures & (VK_FORMAT_FEATURE_TRANSFER_SRC_BIT|VK_FORMAT_FEATURE_TRANSFER_DST_BIT)) != 0,
3800 "A sampled image format must have VK_FORMAT_FEATURE_TRANSFER_SRC_BIT and VK_FORMAT_FEATURE_TRANSFER_DST_BIT format feature flags set");
3803 if (isYcbcrConversionSupported(context) && (format == VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR || format == VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR))
3805 VkFormatFeatureFlags requiredFeatures = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR | VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR;
3806 if (tiling == VK_IMAGE_TILING_OPTIMAL)
3807 requiredFeatures |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR;
3809 results.check((supportedFeatures & requiredFeatures) == requiredFeatures,
3810 getFormatName(format) + string(" must support ") + de::toString(getFormatFeatureFlagsStr(requiredFeatures)));
3813 for (VkImageUsageFlags curUsageFlags = 0; curUsageFlags <= usageFlagSet; curUsageFlags++)
3815 if ((curUsageFlags & ~usageFlagSet) != 0 ||
3816 !isValidImageUsageFlagCombination(curUsageFlags))
3819 const VkImageCreateFlags createFlagSet = getValidImageCreateFlags(deviceFeatures, format, supportedFeatures, imageType, curUsageFlags);
3821 for (VkImageCreateFlags curCreateFlags = 0; curCreateFlags <= createFlagSet; curCreateFlags++)
3823 if ((curCreateFlags & ~createFlagSet) != 0 ||
3824 !isValidImageCreateFlagCombination(curCreateFlags))
3827 const bool isRequiredCombination = isRequiredImageParameterCombination(deviceFeatures,
3834 VkImageFormatProperties properties;
3835 VkResult queryResult;
3837 log << TestLog::Message << "Testing " << getImageTypeStr(imageType) << ", "
3838 << getImageTilingStr(tiling) << ", "
3839 << getImageUsageFlagsStr(curUsageFlags) << ", "
3840 << getImageCreateFlagsStr(curCreateFlags)
3841 << TestLog::EndMessage;
3843 // Set return value to known garbage
3844 deMemset(&properties, 0xcd, sizeof(properties));
3846 queryResult = context.getInstanceInterface().getPhysicalDeviceImageFormatProperties(context.getPhysicalDevice(),
3854 if (queryResult == VK_SUCCESS)
3856 const deUint32 fullMipPyramidSize = de::max(de::max(deLog2Ceil32(properties.maxExtent.width),
3857 deLog2Ceil32(properties.maxExtent.height)),
3858 deLog2Ceil32(properties.maxExtent.depth)) + 1;
3860 log << TestLog::Message << properties << "\n" << TestLog::EndMessage;
3862 results.check(imageType != VK_IMAGE_TYPE_1D || (properties.maxExtent.width >= 1 && properties.maxExtent.height == 1 && properties.maxExtent.depth == 1), "Invalid dimensions for 1D image");
3863 results.check(imageType != VK_IMAGE_TYPE_2D || (properties.maxExtent.width >= 1 && properties.maxExtent.height >= 1 && properties.maxExtent.depth == 1), "Invalid dimensions for 2D image");
3864 results.check(imageType != VK_IMAGE_TYPE_3D || (properties.maxExtent.width >= 1 && properties.maxExtent.height >= 1 && properties.maxExtent.depth >= 1), "Invalid dimensions for 3D image");
3865 results.check(imageType != VK_IMAGE_TYPE_3D || properties.maxArrayLayers == 1, "Invalid maxArrayLayers for 3D image");
3867 if (tiling == VK_IMAGE_TILING_OPTIMAL && imageType == VK_IMAGE_TYPE_2D && !(curCreateFlags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) &&
3868 (supportedFeatures & (VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)))
3870 const VkSampleCountFlags requiredSampleCounts = getRequiredOptimalTilingSampleCounts(deviceLimits, format, curUsageFlags);
3871 results.check((properties.sampleCounts & requiredSampleCounts) == requiredSampleCounts, "Required sample counts not supported");
3874 results.check(properties.sampleCounts == VK_SAMPLE_COUNT_1_BIT, "sampleCounts != VK_SAMPLE_COUNT_1_BIT");
3876 if (isRequiredCombination)
3878 results.check(imageType != VK_IMAGE_TYPE_1D || (properties.maxExtent.width >= deviceLimits.maxImageDimension1D),
3879 "Reported dimensions smaller than device limits");
3880 results.check(imageType != VK_IMAGE_TYPE_2D || (properties.maxExtent.width >= deviceLimits.maxImageDimension2D &&
3881 properties.maxExtent.height >= deviceLimits.maxImageDimension2D),
3882 "Reported dimensions smaller than device limits");
3883 results.check(imageType != VK_IMAGE_TYPE_3D || (properties.maxExtent.width >= deviceLimits.maxImageDimension3D &&
3884 properties.maxExtent.height >= deviceLimits.maxImageDimension3D &&
3885 properties.maxExtent.depth >= deviceLimits.maxImageDimension3D),
3886 "Reported dimensions smaller than device limits");
3887 results.check((isYCbCrFormat(format) && (properties.maxMipLevels == 1)) || properties.maxMipLevels == fullMipPyramidSize,
3888 "Invalid mip pyramid size");
3889 results.check((isYCbCrFormat(format) && (properties.maxArrayLayers == 1)) || imageType == VK_IMAGE_TYPE_3D ||
3890 properties.maxArrayLayers >= deviceLimits.maxImageArrayLayers, "Invalid maxArrayLayers");
3894 results.check(properties.maxMipLevels == 1 || properties.maxMipLevels == fullMipPyramidSize, "Invalid mip pyramid size");
3895 results.check(properties.maxArrayLayers >= 1, "Invalid maxArrayLayers");
3898 results.check(properties.maxResourceSize >= (VkDeviceSize)MINIMUM_REQUIRED_IMAGE_RESOURCE_SIZE,
3899 "maxResourceSize smaller than minimum required size");
3901 else if (queryResult == VK_ERROR_FORMAT_NOT_SUPPORTED)
3903 log << TestLog::Message << "Got VK_ERROR_FORMAT_NOT_SUPPORTED" << TestLog::EndMessage;
3905 if (isRequiredCombination)
3906 results.fail("VK_ERROR_FORMAT_NOT_SUPPORTED returned for required image parameter combination");
3908 // Specification requires that all fields are set to 0
3909 results.check(properties.maxExtent.width == 0, "maxExtent.width != 0");
3910 results.check(properties.maxExtent.height == 0, "maxExtent.height != 0");
3911 results.check(properties.maxExtent.depth == 0, "maxExtent.depth != 0");
3912 results.check(properties.maxMipLevels == 0, "maxMipLevels != 0");
3913 results.check(properties.maxArrayLayers == 0, "maxArrayLayers != 0");
3914 results.check(properties.sampleCounts == 0, "sampleCounts != 0");
3915 results.check(properties.maxResourceSize == 0, "maxResourceSize != 0");
3919 results.fail("Got unexpected error" + de::toString(queryResult));
3924 return tcu::TestStatus(results.getResult(), results.getMessage());
3927 // VK_KHR_get_physical_device_properties2
3929 string toString(const VkPhysicalDevicePCIBusInfoPropertiesEXT& value)
3931 std::ostringstream s;
3932 s << "VkPhysicalDevicePCIBusInfoPropertiesEXT = {\n";
3933 s << "\tsType = " << value.sType << '\n';
3934 s << "\tpciDomain = " << value.pciDomain << '\n';
3935 s << "\tpciBus = " << value.pciBus << '\n';
3936 s << "\tpciDevice = " << value.pciDevice << '\n';
3937 s << "\tpciFunction = " << value.pciFunction << '\n';
3942 bool checkExtension (vector<VkExtensionProperties>& properties, const char* extension)
3944 for (size_t ndx = 0; ndx < properties.size(); ++ndx)
3946 if (strncmp(properties[ndx].extensionName, extension, VK_MAX_EXTENSION_NAME_SIZE) == 0)
3952 tcu::TestStatus deviceFeatures2 (Context& context)
3954 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
3955 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
3956 const InstanceDriver& vki (instance.getDriver());
3957 TestLog& log = context.getTestContext().getLog();
3958 VkPhysicalDeviceFeatures coreFeatures;
3959 VkPhysicalDeviceFeatures2 extFeatures;
3961 deMemset(&coreFeatures, 0xcd, sizeof(coreFeatures));
3962 deMemset(&extFeatures.features, 0xcd, sizeof(extFeatures.features));
3963 std::vector<std::string> instExtensions = context.getInstanceExtensions();
3965 extFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
3966 extFeatures.pNext = DE_NULL;
3968 vki.getPhysicalDeviceFeatures(physicalDevice, &coreFeatures);
3969 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
3971 TCU_CHECK(extFeatures.sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2);
3972 TCU_CHECK(extFeatures.pNext == DE_NULL);
3974 if (deMemCmp(&coreFeatures, &extFeatures.features, sizeof(VkPhysicalDeviceFeatures)) != 0)
3975 TCU_FAIL("Mismatch between features reported by vkGetPhysicalDeviceFeatures and vkGetPhysicalDeviceFeatures2");
3977 log << TestLog::Message << extFeatures << TestLog::EndMessage;
3979 vector<VkExtensionProperties> properties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
3980 const bool ext_conditional_rendering = checkExtension(properties, "VK_EXT_conditional_rendering");
3981 const bool ext_scalar_block_layout = checkExtension(properties, "VK_EXT_scalar_block_layout");
3982 const bool khr_performance_counter = checkExtension(properties, "VK_KHR_performance_query");
3983 const bool khr_16bit_storage = checkExtension(properties, "VK_KHR_16bit_storage") || context.contextSupports(vk::ApiVersion(1, 1, 0));
3984 const bool khr_multiview = checkExtension(properties, "VK_KHR_multiview") || context.contextSupports(vk::ApiVersion(1, 1, 0));
3985 const bool khr_device_protected_memory = context.contextSupports(vk::ApiVersion(1, 1, 0));
3986 const bool khr_sampler_ycbcr_conversion = checkExtension(properties, "VK_KHR_sampler_ycbcr_conversion") || context.contextSupports(vk::ApiVersion(1, 1, 0));
3987 const bool khr_variable_pointers = checkExtension(properties, "VK_KHR_variable_pointers") || context.contextSupports(vk::ApiVersion(1, 1, 0));
3988 const bool khr_8bit_storage = checkExtension(properties, "VK_KHR_8bit_storage") || context.contextSupports(vk::ApiVersion(1, 2, 0));
3989 const bool khr_shader_atomic_int64 = checkExtension(properties, "VK_KHR_shader_atomic_int64") || context.contextSupports(vk::ApiVersion(1, 2, 0));
3990 const bool khr_shader_float16_int8 = checkExtension(properties, "VK_KHR_shader_float16_int8") || context.contextSupports(vk::ApiVersion(1, 2, 0));
3991 const bool khr_buffer_device_address = checkExtension(properties, "VK_KHR_buffer_device_address") || context.contextSupports(vk::ApiVersion(1, 2, 0));
3992 const bool ext_descriptor_indexing = checkExtension(properties, "VK_EXT_descriptor_indexing") || context.contextSupports(vk::ApiVersion(1, 2, 0));
3993 const bool ext_buffer_device_address = checkExtension(properties, "VK_EXT_buffer_device_address");
3995 const int count = 2u;
3996 VkPhysicalDeviceConditionalRenderingFeaturesEXT deviceConditionalRenderingFeatures[count];
3997 VkPhysicalDeviceScalarBlockLayoutFeatures scalarBlockLayoutFeatures[count];
3998 VkPhysicalDevicePerformanceQueryFeaturesKHR performanceQueryFeatures[count];
3999 VkPhysicalDevice16BitStorageFeatures device16BitStorageFeatures[count];
4000 VkPhysicalDeviceMultiviewFeatures deviceMultiviewFeatures[count];
4001 VkPhysicalDeviceProtectedMemoryFeatures protectedMemoryFeatures[count];
4002 VkPhysicalDeviceSamplerYcbcrConversionFeatures samplerYcbcrConversionFeatures[count];
4003 VkPhysicalDeviceVariablePointersFeatures variablePointerFeatures[count];
4004 VkPhysicalDevice8BitStorageFeatures device8BitStorageFeatures[count];
4005 VkPhysicalDeviceShaderAtomicInt64Features deviceShaderAtomicInt64Features[count];
4006 VkPhysicalDeviceShaderFloat16Int8Features deviceShaderFloat16Int8Features[count];
4007 VkPhysicalDeviceBufferDeviceAddressFeaturesEXT deviceBufferDeviceAddressFeaturesEXT[count];
4008 VkPhysicalDeviceBufferDeviceAddressFeatures deviceBufferDeviceAddressFeatures[count];
4009 VkPhysicalDeviceDescriptorIndexingFeatures deviceDescriptorIndexingFeatures[count];
4010 VkPhysicalDeviceTimelineSemaphoreFeatures timelineSemaphoreFeatures[count];
4012 for (int ndx = 0; ndx < count; ++ndx)
4014 deMemset(&deviceConditionalRenderingFeatures[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceConditionalRenderingFeaturesEXT));
4015 deMemset(&scalarBlockLayoutFeatures[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceScalarBlockLayoutFeatures));
4016 deMemset(&performanceQueryFeatures[ndx], 0xFF * ndx, sizeof(VkPhysicalDevicePerformanceQueryFeaturesKHR));
4017 deMemset(&device16BitStorageFeatures[ndx], 0xFF * ndx, sizeof(VkPhysicalDevice16BitStorageFeatures));
4018 deMemset(&deviceMultiviewFeatures[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceMultiviewFeatures));
4019 deMemset(&protectedMemoryFeatures[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceProtectedMemoryFeatures));
4020 deMemset(&samplerYcbcrConversionFeatures[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceSamplerYcbcrConversionFeatures));
4021 deMemset(&variablePointerFeatures[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVariablePointersFeatures));
4022 deMemset(&device8BitStorageFeatures[ndx], 0xFF * ndx, sizeof(VkPhysicalDevice8BitStorageFeaturesKHR));
4023 deMemset(&deviceShaderAtomicInt64Features[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceShaderAtomicInt64Features));
4024 deMemset(&deviceShaderFloat16Int8Features[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceShaderFloat16Int8Features));
4025 deMemset(&deviceBufferDeviceAddressFeatures[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceBufferDeviceAddressFeatures));
4026 deMemset(&deviceBufferDeviceAddressFeaturesEXT[ndx],0xFF * ndx, sizeof(VkPhysicalDeviceBufferDeviceAddressFeaturesEXT));
4027 deMemset(&deviceDescriptorIndexingFeatures[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceDescriptorIndexingFeatures));
4029 deviceConditionalRenderingFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT;
4030 deviceConditionalRenderingFeatures[ndx].pNext = &scalarBlockLayoutFeatures[ndx];
4032 scalarBlockLayoutFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT;
4033 scalarBlockLayoutFeatures[ndx].pNext = &performanceQueryFeatures[ndx];
4035 performanceQueryFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR;
4036 performanceQueryFeatures[ndx].pNext = &device16BitStorageFeatures[ndx];
4038 device16BitStorageFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES;
4039 device16BitStorageFeatures[ndx].pNext = &deviceMultiviewFeatures[ndx];
4041 deviceMultiviewFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES;
4042 deviceMultiviewFeatures[ndx].pNext = &protectedMemoryFeatures[ndx];
4044 protectedMemoryFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES;
4045 protectedMemoryFeatures[ndx].pNext = &samplerYcbcrConversionFeatures[ndx];
4047 samplerYcbcrConversionFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES;
4048 samplerYcbcrConversionFeatures[ndx].pNext = &variablePointerFeatures[ndx];
4050 variablePointerFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES;
4051 variablePointerFeatures[ndx].pNext = &device8BitStorageFeatures[ndx];
4053 device8BitStorageFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR;
4054 device8BitStorageFeatures[ndx].pNext = &deviceShaderAtomicInt64Features[ndx];
4056 deviceShaderAtomicInt64Features[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES;
4057 deviceShaderAtomicInt64Features[ndx].pNext = &deviceShaderFloat16Int8Features[ndx];
4059 deviceShaderFloat16Int8Features[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES;
4060 deviceShaderFloat16Int8Features[ndx].pNext = &deviceBufferDeviceAddressFeatures[ndx];
4062 deviceBufferDeviceAddressFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES;
4063 deviceBufferDeviceAddressFeatures[ndx].pNext = &deviceBufferDeviceAddressFeaturesEXT[ndx];
4065 deviceBufferDeviceAddressFeaturesEXT[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT;
4066 deviceBufferDeviceAddressFeaturesEXT[ndx].pNext = &deviceDescriptorIndexingFeatures[ndx];
4068 deviceDescriptorIndexingFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES;
4069 deviceDescriptorIndexingFeatures[ndx].pNext = &timelineSemaphoreFeatures[ndx];
4071 timelineSemaphoreFeatures[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES;
4072 timelineSemaphoreFeatures[ndx].pNext = DE_NULL;
4074 deMemset(&extFeatures.features, 0xcd, sizeof(extFeatures.features));
4075 extFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
4076 extFeatures.pNext = &deviceConditionalRenderingFeatures[ndx];
4078 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
4081 if (ext_conditional_rendering)
4082 log << TestLog::Message << deviceConditionalRenderingFeatures[0] << TestLog::EndMessage;
4083 if (ext_scalar_block_layout)
4084 log << TestLog::Message << scalarBlockLayoutFeatures[0] << TestLog::EndMessage;
4085 if (khr_performance_counter)
4086 log << TestLog::Message << performanceQueryFeatures[0] << TestLog::EndMessage;
4087 if (khr_16bit_storage)
4088 log << TestLog::Message << device16BitStorageFeatures[0] << TestLog::EndMessage;
4090 log << TestLog::Message << deviceMultiviewFeatures[0] << TestLog::EndMessage;
4091 if (khr_device_protected_memory)
4092 log << TestLog::Message << protectedMemoryFeatures[0] << TestLog::EndMessage;
4093 if (khr_sampler_ycbcr_conversion)
4094 log << TestLog::Message << samplerYcbcrConversionFeatures[0] << TestLog::EndMessage;
4095 if (khr_variable_pointers)
4096 log << TestLog::Message << variablePointerFeatures[0] << TestLog::EndMessage;
4097 if (khr_8bit_storage)
4098 log << TestLog::Message << device8BitStorageFeatures[0] << TestLog::EndMessage;
4099 if (khr_shader_atomic_int64)
4100 log << TestLog::Message << deviceShaderAtomicInt64Features[0] << TestLog::EndMessage;
4101 if (khr_shader_float16_int8)
4102 log << TestLog::Message << deviceShaderFloat16Int8Features[0] << TestLog::EndMessage;
4103 if (khr_buffer_device_address)
4104 log << TestLog::Message << deviceBufferDeviceAddressFeatures[0] << TestLog::EndMessage;
4105 if (ext_buffer_device_address)
4106 log << TestLog::Message << deviceBufferDeviceAddressFeaturesEXT[0] << TestLog::EndMessage;
4107 if (ext_descriptor_indexing)
4108 log << TestLog::Message << deviceDescriptorIndexingFeatures[0] << TestLog::EndMessage;
4110 if ( ext_conditional_rendering &&
4111 ( deviceConditionalRenderingFeatures[0].conditionalRendering != deviceConditionalRenderingFeatures[1].conditionalRendering ||
4112 deviceConditionalRenderingFeatures[0].inheritedConditionalRendering != deviceConditionalRenderingFeatures[1].inheritedConditionalRendering ))
4114 TCU_FAIL("Mismatch between VkPhysicalDeviceConditionalRenderingFeaturesEXT");
4116 if ( khr_performance_counter &&
4117 ( performanceQueryFeatures[0].performanceCounterQueryPools != performanceQueryFeatures[1].performanceCounterQueryPools ||
4118 performanceQueryFeatures[0].performanceCounterMultipleQueryPools != performanceQueryFeatures[1].performanceCounterMultipleQueryPools ))
4120 TCU_FAIL("Mismatch between VkPhysicalDevicePerformancQueryFeaturesKHR");
4123 if ( ext_scalar_block_layout &&
4124 ( scalarBlockLayoutFeatures[0].scalarBlockLayout != scalarBlockLayoutFeatures[1].scalarBlockLayout ))
4126 TCU_FAIL("Mismatch between VkPhysicalDeviceScalarBlockLayoutFeatures");
4129 if ( khr_performance_counter &&
4130 ( performanceQueryFeatures[0].performanceCounterQueryPools != performanceQueryFeatures[1].performanceCounterQueryPools ||
4131 performanceQueryFeatures[0].performanceCounterMultipleQueryPools != performanceQueryFeatures[1].performanceCounterMultipleQueryPools ))
4133 TCU_FAIL("Mismatch between VkPhysicalDevicePerformancQueryFeaturesKHR");
4136 if ( khr_16bit_storage &&
4137 ( device16BitStorageFeatures[0].storageBuffer16BitAccess != device16BitStorageFeatures[1].storageBuffer16BitAccess ||
4138 device16BitStorageFeatures[0].uniformAndStorageBuffer16BitAccess != device16BitStorageFeatures[1].uniformAndStorageBuffer16BitAccess ||
4139 device16BitStorageFeatures[0].storagePushConstant16 != device16BitStorageFeatures[1].storagePushConstant16 ||
4140 device16BitStorageFeatures[0].storageInputOutput16 != device16BitStorageFeatures[1].storageInputOutput16 ))
4142 TCU_FAIL("Mismatch between VkPhysicalDevice16BitStorageFeatures");
4145 if ( khr_multiview &&
4146 ( deviceMultiviewFeatures[0].multiview != deviceMultiviewFeatures[1].multiview ||
4147 deviceMultiviewFeatures[0].multiviewGeometryShader != deviceMultiviewFeatures[1].multiviewGeometryShader ||
4148 deviceMultiviewFeatures[0].multiviewTessellationShader != deviceMultiviewFeatures[1].multiviewTessellationShader ))
4150 TCU_FAIL("Mismatch between VkPhysicalDeviceMultiviewFeatures");
4153 if ( khr_device_protected_memory && protectedMemoryFeatures[0].protectedMemory != protectedMemoryFeatures[1].protectedMemory )
4155 TCU_FAIL("Mismatch between VkPhysicalDeviceProtectedMemoryFeatures");
4158 if ( khr_sampler_ycbcr_conversion && samplerYcbcrConversionFeatures[0].samplerYcbcrConversion != samplerYcbcrConversionFeatures[1].samplerYcbcrConversion )
4160 TCU_FAIL("Mismatch between VkPhysicalDeviceSamplerYcbcrConversionFeatures");
4163 if ( khr_variable_pointers &&
4164 ( variablePointerFeatures[0].variablePointersStorageBuffer != variablePointerFeatures[1].variablePointersStorageBuffer ||
4165 variablePointerFeatures[0].variablePointers != variablePointerFeatures[1].variablePointers))
4167 TCU_FAIL("Mismatch between VkPhysicalDeviceVariablePointersFeatures");
4170 if ( khr_8bit_storage &&
4171 ( device8BitStorageFeatures[0].storageBuffer8BitAccess != device8BitStorageFeatures[1].storageBuffer8BitAccess ||
4172 device8BitStorageFeatures[0].uniformAndStorageBuffer8BitAccess != device8BitStorageFeatures[1].uniformAndStorageBuffer8BitAccess ||
4173 device8BitStorageFeatures[0].storagePushConstant8 != device8BitStorageFeatures[1].storagePushConstant8 ))
4175 TCU_FAIL("Mismatch between VkPhysicalDevice8BitStorageFeatures");
4178 if ( khr_shader_atomic_int64 &&
4179 ( deviceShaderAtomicInt64Features[0].shaderBufferInt64Atomics != deviceShaderAtomicInt64Features[1].shaderBufferInt64Atomics ||
4180 deviceShaderAtomicInt64Features[0].shaderSharedInt64Atomics != deviceShaderAtomicInt64Features[1].shaderSharedInt64Atomics ))
4182 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderAtomicInt64Features");
4185 if ( khr_shader_float16_int8 &&
4186 ( deviceShaderFloat16Int8Features[0].shaderFloat16 != deviceShaderFloat16Int8Features[1].shaderFloat16 ||
4187 deviceShaderFloat16Int8Features[0].shaderInt8 != deviceShaderFloat16Int8Features[1].shaderInt8 ))
4189 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderFloat16Int8Features");
4192 if ( khr_buffer_device_address &&
4193 ( deviceBufferDeviceAddressFeatures[0].bufferDeviceAddress != deviceBufferDeviceAddressFeatures[1].bufferDeviceAddress ||
4194 deviceBufferDeviceAddressFeatures[0].bufferDeviceAddressCaptureReplay != deviceBufferDeviceAddressFeatures[1].bufferDeviceAddressCaptureReplay ||
4195 deviceBufferDeviceAddressFeatures[0].bufferDeviceAddressMultiDevice != deviceBufferDeviceAddressFeatures[1].bufferDeviceAddressMultiDevice ))
4197 TCU_FAIL("Mismatch between VkPhysicalDeviceBufferDeviceAddressFeatures");
4200 if ( ext_buffer_device_address &&
4201 ( deviceBufferDeviceAddressFeaturesEXT[0].bufferDeviceAddress != deviceBufferDeviceAddressFeaturesEXT[1].bufferDeviceAddress ||
4202 deviceBufferDeviceAddressFeaturesEXT[0].bufferDeviceAddressCaptureReplay != deviceBufferDeviceAddressFeaturesEXT[1].bufferDeviceAddressCaptureReplay ||
4203 deviceBufferDeviceAddressFeaturesEXT[0].bufferDeviceAddressMultiDevice != deviceBufferDeviceAddressFeaturesEXT[1].bufferDeviceAddressMultiDevice ))
4205 TCU_FAIL("Mismatch between VkPhysicalDeviceBufferDeviceAddressFeaturesEXT");
4208 if ( ext_descriptor_indexing &&
4209 ( deviceDescriptorIndexingFeatures[0].shaderInputAttachmentArrayDynamicIndexing != deviceDescriptorIndexingFeatures[1].shaderInputAttachmentArrayDynamicIndexing ||
4210 deviceDescriptorIndexingFeatures[0].shaderUniformTexelBufferArrayDynamicIndexing != deviceDescriptorIndexingFeatures[1].shaderUniformTexelBufferArrayDynamicIndexing ||
4211 deviceDescriptorIndexingFeatures[0].shaderStorageTexelBufferArrayDynamicIndexing != deviceDescriptorIndexingFeatures[1].shaderStorageTexelBufferArrayDynamicIndexing ||
4212 deviceDescriptorIndexingFeatures[0].shaderUniformBufferArrayNonUniformIndexing != deviceDescriptorIndexingFeatures[1].shaderUniformBufferArrayNonUniformIndexing ||
4213 deviceDescriptorIndexingFeatures[0].shaderSampledImageArrayNonUniformIndexing != deviceDescriptorIndexingFeatures[1].shaderSampledImageArrayNonUniformIndexing ||
4214 deviceDescriptorIndexingFeatures[0].shaderStorageBufferArrayNonUniformIndexing != deviceDescriptorIndexingFeatures[1].shaderStorageBufferArrayNonUniformIndexing ||
4215 deviceDescriptorIndexingFeatures[0].shaderStorageImageArrayNonUniformIndexing != deviceDescriptorIndexingFeatures[1].shaderStorageImageArrayNonUniformIndexing ||
4216 deviceDescriptorIndexingFeatures[0].shaderInputAttachmentArrayNonUniformIndexing != deviceDescriptorIndexingFeatures[1].shaderInputAttachmentArrayNonUniformIndexing ||
4217 deviceDescriptorIndexingFeatures[0].shaderUniformTexelBufferArrayNonUniformIndexing != deviceDescriptorIndexingFeatures[1].shaderUniformTexelBufferArrayNonUniformIndexing ||
4218 deviceDescriptorIndexingFeatures[0].shaderStorageTexelBufferArrayNonUniformIndexing != deviceDescriptorIndexingFeatures[1].shaderStorageTexelBufferArrayNonUniformIndexing ||
4219 deviceDescriptorIndexingFeatures[0].descriptorBindingUniformBufferUpdateAfterBind != deviceDescriptorIndexingFeatures[1].descriptorBindingUniformBufferUpdateAfterBind ||
4220 deviceDescriptorIndexingFeatures[0].descriptorBindingSampledImageUpdateAfterBind != deviceDescriptorIndexingFeatures[1].descriptorBindingSampledImageUpdateAfterBind ||
4221 deviceDescriptorIndexingFeatures[0].descriptorBindingStorageImageUpdateAfterBind != deviceDescriptorIndexingFeatures[1].descriptorBindingStorageImageUpdateAfterBind ||
4222 deviceDescriptorIndexingFeatures[0].descriptorBindingStorageBufferUpdateAfterBind != deviceDescriptorIndexingFeatures[1].descriptorBindingStorageBufferUpdateAfterBind ||
4223 deviceDescriptorIndexingFeatures[0].descriptorBindingUniformTexelBufferUpdateAfterBind != deviceDescriptorIndexingFeatures[1].descriptorBindingUniformTexelBufferUpdateAfterBind ||
4224 deviceDescriptorIndexingFeatures[0].descriptorBindingStorageTexelBufferUpdateAfterBind != deviceDescriptorIndexingFeatures[1].descriptorBindingStorageTexelBufferUpdateAfterBind ||
4225 deviceDescriptorIndexingFeatures[0].descriptorBindingUpdateUnusedWhilePending != deviceDescriptorIndexingFeatures[1].descriptorBindingUpdateUnusedWhilePending ||
4226 deviceDescriptorIndexingFeatures[0].descriptorBindingPartiallyBound != deviceDescriptorIndexingFeatures[1].descriptorBindingPartiallyBound ||
4227 deviceDescriptorIndexingFeatures[0].descriptorBindingVariableDescriptorCount != deviceDescriptorIndexingFeatures[1].descriptorBindingVariableDescriptorCount ||
4228 deviceDescriptorIndexingFeatures[0].runtimeDescriptorArray != deviceDescriptorIndexingFeatures[1].runtimeDescriptorArray ))
4230 TCU_FAIL("Mismatch between VkPhysicalDeviceDescriptorIndexingFeatures");
4233 return tcu::TestStatus::pass("Querying device features succeeded");
4236 tcu::TestStatus deviceProperties2 (Context& context)
4238 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
4239 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
4240 const InstanceDriver& vki (instance.getDriver());
4241 TestLog& log = context.getTestContext().getLog();
4242 VkPhysicalDeviceProperties coreProperties;
4243 VkPhysicalDeviceProperties2 extProperties;
4245 extProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
4246 extProperties.pNext = DE_NULL;
4248 vki.getPhysicalDeviceProperties(physicalDevice, &coreProperties);
4249 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
4251 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2);
4252 TCU_CHECK(extProperties.pNext == DE_NULL);
4254 // We can't use memcmp() here because the structs may contain padding bytes that drivers may or may not
4255 // have written while writing the data and memcmp will compare them anyway, so we iterate through the
4256 // valid bytes for each field in the struct and compare only the valid bytes for each one.
4257 for (int propNdx = 0; propNdx < DE_LENGTH_OF_ARRAY(s_physicalDevicePropertiesOffsetTable); propNdx++)
4259 const size_t offset = s_physicalDevicePropertiesOffsetTable[propNdx].offset;
4260 const size_t size = s_physicalDevicePropertiesOffsetTable[propNdx].size;
4262 const deUint8* corePropertyBytes = reinterpret_cast<deUint8*>(&coreProperties) + offset;
4263 const deUint8* extPropertyBytes = reinterpret_cast<deUint8*>(&extProperties.properties) + offset;
4265 if (deMemCmp(corePropertyBytes, extPropertyBytes, size) != 0)
4266 TCU_FAIL("Mismatch between properties reported by vkGetPhysicalDeviceProperties and vkGetPhysicalDeviceProperties2");
4269 log << TestLog::Message << extProperties.properties << TestLog::EndMessage;
4271 const int count = 2u;
4273 vector<VkExtensionProperties> properties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
4274 const bool khr_external_fence_capabilities = checkExtension(properties, "VK_KHR_external_fence_capabilities") || context.contextSupports(vk::ApiVersion(1, 1, 0));
4275 const bool khr_external_memory_capabilities = checkExtension(properties, "VK_KHR_external_memory_capabilities") || context.contextSupports(vk::ApiVersion(1, 1, 0));
4276 const bool khr_external_semaphore_capabilities = checkExtension(properties, "VK_KHR_external_semaphore_capabilities") || context.contextSupports(vk::ApiVersion(1, 1, 0));
4277 const bool khr_multiview = checkExtension(properties, "VK_KHR_multiview") || context.contextSupports(vk::ApiVersion(1, 1, 0));
4278 const bool khr_device_protected_memory = context.contextSupports(vk::ApiVersion(1, 1, 0));
4279 const bool khr_device_subgroup = context.contextSupports(vk::ApiVersion(1, 1, 0));
4280 const bool khr_maintenance2 = checkExtension(properties, "VK_KHR_maintenance2") || context.contextSupports(vk::ApiVersion(1, 1, 0));
4281 const bool khr_maintenance3 = checkExtension(properties, "VK_KHR_maintenance3") || context.contextSupports(vk::ApiVersion(1, 1, 0));
4282 const bool khr_depth_stencil_resolve = checkExtension(properties, "VK_KHR_depth_stencil_resolve") || context.contextSupports(vk::ApiVersion(1, 2, 0));
4283 const bool khr_driver_properties = checkExtension(properties, "VK_KHR_driver_properties") || context.contextSupports(vk::ApiVersion(1, 2, 0));
4284 const bool khr_shader_float_controls = checkExtension(properties, "VK_KHR_shader_float_controls") || context.contextSupports(vk::ApiVersion(1, 2, 0));
4285 const bool khr_descriptor_indexing = checkExtension(properties, "VK_EXT_descriptor_indexing") || context.contextSupports(vk::ApiVersion(1, 2, 0));
4286 const bool khr_sampler_filter_minmax = checkExtension(properties, "VK_EXT_sampler_filter_minmax") || context.contextSupports(vk::ApiVersion(1, 2, 0));
4288 VkPhysicalDeviceIDProperties idProperties[count];
4289 VkPhysicalDeviceMultiviewProperties multiviewProperties[count];
4290 VkPhysicalDeviceProtectedMemoryProperties protectedMemoryPropertiesKHR[count];
4291 VkPhysicalDeviceSubgroupProperties subgroupProperties[count];
4292 VkPhysicalDevicePointClippingProperties pointClippingProperties[count];
4293 VkPhysicalDeviceMaintenance3Properties maintenance3Properties[count];
4294 VkPhysicalDeviceDepthStencilResolveProperties depthStencilResolveProperties[count];
4295 VkPhysicalDeviceDriverProperties driverProperties[count];
4296 VkPhysicalDeviceFloatControlsProperties floatControlsProperties[count];
4297 VkPhysicalDeviceDescriptorIndexingProperties descriptorIndexingProperties[count];
4298 VkPhysicalDeviceSamplerFilterMinmaxProperties samplerFilterMinmaxProperties[count];
4300 for (int ndx = 0; ndx < count; ++ndx)
4302 deMemset(&idProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceIDProperties ));
4303 deMemset(&multiviewProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceMultiviewProperties ));
4304 deMemset(&protectedMemoryPropertiesKHR[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceProtectedMemoryProperties ));
4305 deMemset(&subgroupProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceSubgroupProperties ));
4306 deMemset(&pointClippingProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDevicePointClippingProperties ));
4307 deMemset(&maintenance3Properties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceMaintenance3Properties ));
4308 deMemset(&depthStencilResolveProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceDepthStencilResolveProperties ));
4309 deMemset(&driverProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceDriverProperties ));
4310 deMemset(&floatControlsProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceFloatControlsProperties ));
4311 deMemset(&descriptorIndexingProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceDescriptorIndexingProperties ));
4312 deMemset(&samplerFilterMinmaxProperties[ndx], 0xFF*ndx, sizeof(VkPhysicalDeviceSamplerFilterMinmaxProperties ));
4314 idProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES;
4315 idProperties[ndx].pNext = &multiviewProperties[ndx];
4317 multiviewProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES;
4318 multiviewProperties[ndx].pNext = &protectedMemoryPropertiesKHR[ndx];
4320 protectedMemoryPropertiesKHR[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES;
4321 protectedMemoryPropertiesKHR[ndx].pNext = &subgroupProperties[ndx];
4323 subgroupProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES;
4324 subgroupProperties[ndx].pNext = &pointClippingProperties[ndx];
4326 pointClippingProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES;
4327 pointClippingProperties[ndx].pNext = &maintenance3Properties[ndx];
4329 maintenance3Properties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES;
4330 maintenance3Properties[ndx].pNext = &depthStencilResolveProperties[ndx];
4332 depthStencilResolveProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES;
4333 depthStencilResolveProperties[ndx].pNext = &driverProperties[ndx];
4335 driverProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES;
4336 driverProperties[ndx].pNext = &floatControlsProperties[ndx];
4338 floatControlsProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR;
4339 floatControlsProperties[ndx].pNext = &descriptorIndexingProperties[ndx];
4341 descriptorIndexingProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES;
4342 descriptorIndexingProperties[ndx].pNext = &samplerFilterMinmaxProperties[ndx];
4344 samplerFilterMinmaxProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES;
4345 samplerFilterMinmaxProperties[ndx].pNext = DE_NULL;
4347 extProperties.pNext = &idProperties[ndx];
4349 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
4352 if ( khr_external_fence_capabilities || khr_external_memory_capabilities || khr_external_semaphore_capabilities )
4353 log << TestLog::Message << idProperties[0] << TestLog::EndMessage;
4355 log << TestLog::Message << multiviewProperties[0] << TestLog::EndMessage;
4356 if (khr_device_protected_memory)
4357 log << TestLog::Message << protectedMemoryPropertiesKHR[0] << TestLog::EndMessage;
4358 if (khr_device_subgroup)
4359 log << TestLog::Message << subgroupProperties[0] << TestLog::EndMessage;
4360 if (khr_maintenance2)
4361 log << TestLog::Message << pointClippingProperties[0] << TestLog::EndMessage;
4362 if (khr_maintenance3)
4363 log << TestLog::Message << maintenance3Properties[0] << TestLog::EndMessage;
4364 if (khr_depth_stencil_resolve)
4365 log << TestLog::Message << depthStencilResolveProperties[0] << TestLog::EndMessage;
4366 if (khr_driver_properties)
4367 log << TestLog::Message << driverProperties[0] << TestLog::EndMessage;
4368 if (khr_shader_float_controls)
4369 log << TestLog::Message << floatControlsProperties[0] << TestLog::EndMessage;
4370 if (khr_descriptor_indexing)
4371 log << TestLog::Message << descriptorIndexingProperties[0] << TestLog::EndMessage;
4372 if (khr_sampler_filter_minmax)
4373 log << TestLog::Message << samplerFilterMinmaxProperties[0] << TestLog::EndMessage;
4375 if ( khr_external_fence_capabilities || khr_external_memory_capabilities || khr_external_semaphore_capabilities )
4377 if ((deMemCmp(idProperties[0].deviceUUID, idProperties[1].deviceUUID, VK_UUID_SIZE) != 0) ||
4378 (deMemCmp(idProperties[0].driverUUID, idProperties[1].driverUUID, VK_UUID_SIZE) != 0) ||
4379 (idProperties[0].deviceLUIDValid != idProperties[1].deviceLUIDValid))
4381 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties");
4383 else if (idProperties[0].deviceLUIDValid)
4385 // If deviceLUIDValid is VK_FALSE, the contents of deviceLUID and deviceNodeMask are undefined
4386 // so thay can only be compared when deviceLUIDValid is VK_TRUE.
4387 if ((deMemCmp(idProperties[0].deviceLUID, idProperties[1].deviceLUID, VK_UUID_SIZE) != 0) ||
4388 (idProperties[0].deviceNodeMask != idProperties[1].deviceNodeMask))
4390 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties");
4394 if (khr_multiview &&
4395 (multiviewProperties[0].maxMultiviewViewCount != multiviewProperties[1].maxMultiviewViewCount ||
4396 multiviewProperties[0].maxMultiviewInstanceIndex != multiviewProperties[1].maxMultiviewInstanceIndex))
4398 TCU_FAIL("Mismatch between VkPhysicalDeviceMultiviewProperties");
4400 if (khr_device_protected_memory &&
4401 (protectedMemoryPropertiesKHR[0].protectedNoFault != protectedMemoryPropertiesKHR[1].protectedNoFault))
4403 TCU_FAIL("Mismatch between VkPhysicalDeviceProtectedMemoryProperties");
4405 if (khr_device_subgroup &&
4406 (subgroupProperties[0].subgroupSize != subgroupProperties[1].subgroupSize ||
4407 subgroupProperties[0].supportedStages != subgroupProperties[1].supportedStages ||
4408 subgroupProperties[0].supportedOperations != subgroupProperties[1].supportedOperations ||
4409 subgroupProperties[0].quadOperationsInAllStages != subgroupProperties[1].quadOperationsInAllStages ))
4411 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupProperties");
4413 if (khr_maintenance2 &&
4414 (pointClippingProperties[0].pointClippingBehavior != pointClippingProperties[1].pointClippingBehavior))
4416 TCU_FAIL("Mismatch between VkPhysicalDevicePointClippingProperties");
4418 if (khr_maintenance3 &&
4419 (maintenance3Properties[0].maxPerSetDescriptors != maintenance3Properties[1].maxPerSetDescriptors ||
4420 maintenance3Properties[0].maxMemoryAllocationSize != maintenance3Properties[1].maxMemoryAllocationSize))
4422 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance3Properties");
4424 if (khr_depth_stencil_resolve &&
4425 (depthStencilResolveProperties[0].supportedDepthResolveModes != depthStencilResolveProperties[1].supportedDepthResolveModes ||
4426 depthStencilResolveProperties[0].supportedStencilResolveModes != depthStencilResolveProperties[1].supportedStencilResolveModes ||
4427 depthStencilResolveProperties[0].independentResolveNone != depthStencilResolveProperties[1].independentResolveNone ||
4428 depthStencilResolveProperties[0].independentResolve != depthStencilResolveProperties[1].independentResolve))
4430 TCU_FAIL("Mismatch between VkPhysicalDeviceDepthStencilResolveProperties");
4432 if (khr_driver_properties &&
4433 (driverProperties[0].driverID != driverProperties[1].driverID ||
4434 strncmp(driverProperties[0].driverName, driverProperties[1].driverName, VK_MAX_DRIVER_NAME_SIZE) != 0 ||
4435 strncmp(driverProperties[0].driverInfo, driverProperties[1].driverInfo, VK_MAX_DRIVER_INFO_SIZE) != 0 ||
4436 driverProperties[0].conformanceVersion.major != driverProperties[1].conformanceVersion.major ||
4437 driverProperties[0].conformanceVersion.minor != driverProperties[1].conformanceVersion.minor ||
4438 driverProperties[0].conformanceVersion.subminor != driverProperties[1].conformanceVersion.subminor ||
4439 driverProperties[0].conformanceVersion.patch != driverProperties[1].conformanceVersion.patch))
4441 TCU_FAIL("Mismatch between VkPhysicalDeviceDriverProperties");
4443 if (khr_shader_float_controls &&
4444 (floatControlsProperties[0].denormBehaviorIndependence != floatControlsProperties[1].denormBehaviorIndependence ||
4445 floatControlsProperties[0].roundingModeIndependence != floatControlsProperties[1].roundingModeIndependence ||
4446 floatControlsProperties[0].shaderSignedZeroInfNanPreserveFloat16 != floatControlsProperties[1].shaderSignedZeroInfNanPreserveFloat16 ||
4447 floatControlsProperties[0].shaderSignedZeroInfNanPreserveFloat32 != floatControlsProperties[1].shaderSignedZeroInfNanPreserveFloat32 ||
4448 floatControlsProperties[0].shaderSignedZeroInfNanPreserveFloat64 != floatControlsProperties[1].shaderSignedZeroInfNanPreserveFloat64 ||
4449 floatControlsProperties[0].shaderDenormPreserveFloat16 != floatControlsProperties[1].shaderDenormPreserveFloat16 ||
4450 floatControlsProperties[0].shaderDenormPreserveFloat32 != floatControlsProperties[1].shaderDenormPreserveFloat32 ||
4451 floatControlsProperties[0].shaderDenormPreserveFloat64 != floatControlsProperties[1].shaderDenormPreserveFloat64 ||
4452 floatControlsProperties[0].shaderDenormFlushToZeroFloat16 != floatControlsProperties[1].shaderDenormFlushToZeroFloat16 ||
4453 floatControlsProperties[0].shaderDenormFlushToZeroFloat32 != floatControlsProperties[1].shaderDenormFlushToZeroFloat32 ||
4454 floatControlsProperties[0].shaderDenormFlushToZeroFloat64 != floatControlsProperties[1].shaderDenormFlushToZeroFloat64 ||
4455 floatControlsProperties[0].shaderRoundingModeRTEFloat16 != floatControlsProperties[1].shaderRoundingModeRTEFloat16 ||
4456 floatControlsProperties[0].shaderRoundingModeRTEFloat32 != floatControlsProperties[1].shaderRoundingModeRTEFloat32 ||
4457 floatControlsProperties[0].shaderRoundingModeRTEFloat64 != floatControlsProperties[1].shaderRoundingModeRTEFloat64 ||
4458 floatControlsProperties[0].shaderRoundingModeRTZFloat16 != floatControlsProperties[1].shaderRoundingModeRTZFloat16 ||
4459 floatControlsProperties[0].shaderRoundingModeRTZFloat32 != floatControlsProperties[1].shaderRoundingModeRTZFloat32 ||
4460 floatControlsProperties[0].shaderRoundingModeRTZFloat64 != floatControlsProperties[1].shaderRoundingModeRTZFloat64 ))
4462 TCU_FAIL("Mismatch between VkPhysicalDeviceFloatControlsProperties");
4464 if (khr_descriptor_indexing &&
4465 (descriptorIndexingProperties[0].maxUpdateAfterBindDescriptorsInAllPools != descriptorIndexingProperties[1].maxUpdateAfterBindDescriptorsInAllPools ||
4466 descriptorIndexingProperties[0].shaderUniformBufferArrayNonUniformIndexingNative != descriptorIndexingProperties[1].shaderUniformBufferArrayNonUniformIndexingNative ||
4467 descriptorIndexingProperties[0].shaderSampledImageArrayNonUniformIndexingNative != descriptorIndexingProperties[1].shaderSampledImageArrayNonUniformIndexingNative ||
4468 descriptorIndexingProperties[0].shaderStorageBufferArrayNonUniformIndexingNative != descriptorIndexingProperties[1].shaderStorageBufferArrayNonUniformIndexingNative ||
4469 descriptorIndexingProperties[0].shaderStorageImageArrayNonUniformIndexingNative != descriptorIndexingProperties[1].shaderStorageImageArrayNonUniformIndexingNative ||
4470 descriptorIndexingProperties[0].shaderInputAttachmentArrayNonUniformIndexingNative != descriptorIndexingProperties[1].shaderInputAttachmentArrayNonUniformIndexingNative ||
4471 descriptorIndexingProperties[0].robustBufferAccessUpdateAfterBind != descriptorIndexingProperties[1].robustBufferAccessUpdateAfterBind ||
4472 descriptorIndexingProperties[0].quadDivergentImplicitLod != descriptorIndexingProperties[1].quadDivergentImplicitLod ||
4473 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindSamplers != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindSamplers ||
4474 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindUniformBuffers != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindUniformBuffers ||
4475 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindStorageBuffers != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindStorageBuffers ||
4476 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindSampledImages != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindSampledImages ||
4477 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindStorageImages != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindStorageImages ||
4478 descriptorIndexingProperties[0].maxPerStageDescriptorUpdateAfterBindInputAttachments != descriptorIndexingProperties[1].maxPerStageDescriptorUpdateAfterBindInputAttachments ||
4479 descriptorIndexingProperties[0].maxPerStageUpdateAfterBindResources != descriptorIndexingProperties[1].maxPerStageUpdateAfterBindResources ||
4480 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindSamplers != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindSamplers ||
4481 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindUniformBuffers != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindUniformBuffers ||
4482 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindUniformBuffersDynamic != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindUniformBuffersDynamic ||
4483 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindStorageBuffers != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindStorageBuffers ||
4484 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindStorageBuffersDynamic != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindStorageBuffersDynamic ||
4485 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindSampledImages != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindSampledImages ||
4486 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindStorageImages != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindStorageImages ||
4487 descriptorIndexingProperties[0].maxDescriptorSetUpdateAfterBindInputAttachments != descriptorIndexingProperties[1].maxDescriptorSetUpdateAfterBindInputAttachments ))
4489 TCU_FAIL("Mismatch between VkPhysicalDeviceDescriptorIndexingProperties");
4491 if (khr_sampler_filter_minmax &&
4492 (samplerFilterMinmaxProperties[0].filterMinmaxSingleComponentFormats != samplerFilterMinmaxProperties[1].filterMinmaxSingleComponentFormats ||
4493 samplerFilterMinmaxProperties[0].filterMinmaxImageComponentMapping != samplerFilterMinmaxProperties[1].filterMinmaxImageComponentMapping))
4495 TCU_FAIL("Mismatch between VkPhysicalDeviceSamplerFilterMinmaxProperties");
4498 if (isExtensionSupported(properties, RequiredExtension("VK_KHR_push_descriptor")))
4500 VkPhysicalDevicePushDescriptorPropertiesKHR pushDescriptorProperties[count];
4502 for (int ndx = 0; ndx < count; ++ndx)
4504 deMemset(&pushDescriptorProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDevicePushDescriptorPropertiesKHR));
4506 pushDescriptorProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR;
4507 pushDescriptorProperties[ndx].pNext = DE_NULL;
4509 extProperties.pNext = &pushDescriptorProperties[ndx];
4511 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
4513 pushDescriptorProperties[ndx].pNext = DE_NULL;
4516 log << TestLog::Message << pushDescriptorProperties[0] << TestLog::EndMessage;
4518 if ( pushDescriptorProperties[0].maxPushDescriptors != pushDescriptorProperties[1].maxPushDescriptors )
4520 TCU_FAIL("Mismatch between VkPhysicalDevicePushDescriptorPropertiesKHR ");
4522 if (pushDescriptorProperties[0].maxPushDescriptors < 32)
4524 TCU_FAIL("VkPhysicalDevicePushDescriptorPropertiesKHR.maxPushDescriptors must be at least 32");
4528 if (isExtensionSupported(properties, RequiredExtension("VK_KHR_performance_query")))
4530 VkPhysicalDevicePerformanceQueryPropertiesKHR performanceQueryProperties[count];
4532 for (int ndx = 0; ndx < count; ++ndx)
4534 deMemset(&performanceQueryProperties[ndx], 0xFF * ndx, sizeof(VkPhysicalDevicePerformanceQueryPropertiesKHR));
4535 performanceQueryProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR;
4536 performanceQueryProperties[ndx].pNext = DE_NULL;
4538 extProperties.pNext = &performanceQueryProperties[ndx];
4540 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
4543 log << TestLog::Message << performanceQueryProperties[0] << TestLog::EndMessage;
4545 if (performanceQueryProperties[0].allowCommandBufferQueryCopies != performanceQueryProperties[0].allowCommandBufferQueryCopies)
4547 TCU_FAIL("Mismatch between VkPhysicalDevicePerformanceQueryPropertiesKHR");
4551 if (isExtensionSupported(properties, RequiredExtension("VK_EXT_pci_bus_info", 2, 2)))
4553 VkPhysicalDevicePCIBusInfoPropertiesEXT pciBusInfoProperties[count];
4555 for (int ndx = 0; ndx < count; ++ndx)
4557 // Each PCI device is identified by an 8-bit domain number, 5-bit
4558 // device number and 3-bit function number[1][2].
4560 // In addition, because PCI systems can be interconnected and
4561 // divided in segments, Linux assigns a 16-bit number to the device
4562 // as the "domain". In Windows, the segment or domain is stored in
4563 // the higher 24-bit section of the bus number.
4565 // This means the maximum unsigned 32-bit integer for these members
4566 // are invalid values and should change after querying properties.
4568 // [1] https://en.wikipedia.org/wiki/PCI_configuration_space
4569 // [2] PCI Express Base Specification Revision 3.0, section 2.2.4.2.
4570 deMemset(pciBusInfoProperties + ndx, 0xFF * ndx, sizeof(pciBusInfoProperties[ndx]));
4571 pciBusInfoProperties[ndx].pciDomain = DEUINT32_MAX;
4572 pciBusInfoProperties[ndx].pciBus = DEUINT32_MAX;
4573 pciBusInfoProperties[ndx].pciDevice = DEUINT32_MAX;
4574 pciBusInfoProperties[ndx].pciFunction = DEUINT32_MAX;
4576 pciBusInfoProperties[ndx].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT;
4577 pciBusInfoProperties[ndx].pNext = DE_NULL;
4579 extProperties.pNext = pciBusInfoProperties + ndx;
4580 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
4583 log << TestLog::Message << toString(pciBusInfoProperties[0]) << TestLog::EndMessage;
4585 if (pciBusInfoProperties[0].pciDomain != pciBusInfoProperties[1].pciDomain ||
4586 pciBusInfoProperties[0].pciBus != pciBusInfoProperties[1].pciBus ||
4587 pciBusInfoProperties[0].pciDevice != pciBusInfoProperties[1].pciDevice ||
4588 pciBusInfoProperties[0].pciFunction != pciBusInfoProperties[1].pciFunction)
4590 TCU_FAIL("Mismatch between VkPhysicalDevicePCIBusInfoPropertiesEXT");
4592 if (pciBusInfoProperties[0].pciDomain == DEUINT32_MAX ||
4593 pciBusInfoProperties[0].pciBus == DEUINT32_MAX ||
4594 pciBusInfoProperties[0].pciDevice == DEUINT32_MAX ||
4595 pciBusInfoProperties[0].pciFunction == DEUINT32_MAX)
4597 TCU_FAIL("Invalid information in VkPhysicalDevicePCIBusInfoPropertiesEXT");
4601 return tcu::TestStatus::pass("Querying device properties succeeded");
4604 string toString (const VkFormatProperties2& value)
4606 std::ostringstream s;
4607 s << "VkFormatProperties2 = {\n";
4608 s << "\tsType = " << value.sType << '\n';
4609 s << "\tformatProperties = {\n";
4610 s << "\tlinearTilingFeatures = " << getFormatFeatureFlagsStr(value.formatProperties.linearTilingFeatures) << '\n';
4611 s << "\toptimalTilingFeatures = " << getFormatFeatureFlagsStr(value.formatProperties.optimalTilingFeatures) << '\n';
4612 s << "\tbufferFeatures = " << getFormatFeatureFlagsStr(value.formatProperties.bufferFeatures) << '\n';
4618 tcu::TestStatus deviceFormatProperties2 (Context& context)
4620 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
4621 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
4622 const InstanceDriver& vki (instance.getDriver());
4623 TestLog& log = context.getTestContext().getLog();
4625 for (int formatNdx = 0; formatNdx < VK_CORE_FORMAT_LAST; ++formatNdx)
4627 const VkFormat format = (VkFormat)formatNdx;
4628 VkFormatProperties coreProperties;
4629 VkFormatProperties2 extProperties;
4631 deMemset(&coreProperties, 0xcd, sizeof(VkFormatProperties));
4632 deMemset(&extProperties, 0xcd, sizeof(VkFormatProperties2));
4634 extProperties.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2;
4635 extProperties.pNext = DE_NULL;
4637 vki.getPhysicalDeviceFormatProperties(physicalDevice, format, &coreProperties);
4638 vki.getPhysicalDeviceFormatProperties2(physicalDevice, format, &extProperties);
4640 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2);
4641 TCU_CHECK(extProperties.pNext == DE_NULL);
4643 if (deMemCmp(&coreProperties, &extProperties.formatProperties, sizeof(VkFormatProperties)) != 0)
4644 TCU_FAIL("Mismatch between format properties reported by vkGetPhysicalDeviceFormatProperties and vkGetPhysicalDeviceFormatProperties2");
4646 log << TestLog::Message << toString (extProperties) << TestLog::EndMessage;
4649 return tcu::TestStatus::pass("Querying device format properties succeeded");
4652 tcu::TestStatus deviceQueueFamilyProperties2 (Context& context)
4654 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
4655 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
4656 const InstanceDriver& vki (instance.getDriver());
4657 TestLog& log = context.getTestContext().getLog();
4658 deUint32 numCoreQueueFamilies = ~0u;
4659 deUint32 numExtQueueFamilies = ~0u;
4661 vki.getPhysicalDeviceQueueFamilyProperties(physicalDevice, &numCoreQueueFamilies, DE_NULL);
4662 vki.getPhysicalDeviceQueueFamilyProperties2(physicalDevice, &numExtQueueFamilies, DE_NULL);
4664 TCU_CHECK_MSG(numCoreQueueFamilies == numExtQueueFamilies, "Different number of queue family properties reported");
4665 TCU_CHECK(numCoreQueueFamilies > 0);
4668 std::vector<VkQueueFamilyProperties> coreProperties (numCoreQueueFamilies);
4669 std::vector<VkQueueFamilyProperties2> extProperties (numExtQueueFamilies);
4671 deMemset(&coreProperties[0], 0xcd, sizeof(VkQueueFamilyProperties)*numCoreQueueFamilies);
4672 deMemset(&extProperties[0], 0xcd, sizeof(VkQueueFamilyProperties2)*numExtQueueFamilies);
4674 for (size_t ndx = 0; ndx < extProperties.size(); ++ndx)
4676 extProperties[ndx].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2;
4677 extProperties[ndx].pNext = DE_NULL;
4680 vki.getPhysicalDeviceQueueFamilyProperties(physicalDevice, &numCoreQueueFamilies, &coreProperties[0]);
4681 vki.getPhysicalDeviceQueueFamilyProperties2(physicalDevice, &numExtQueueFamilies, &extProperties[0]);
4683 TCU_CHECK((size_t)numCoreQueueFamilies == coreProperties.size());
4684 TCU_CHECK((size_t)numExtQueueFamilies == extProperties.size());
4685 DE_ASSERT(numCoreQueueFamilies == numExtQueueFamilies);
4687 for (size_t ndx = 0; ndx < extProperties.size(); ++ndx)
4689 TCU_CHECK(extProperties[ndx].sType == VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2);
4690 TCU_CHECK(extProperties[ndx].pNext == DE_NULL);
4692 if (deMemCmp(&coreProperties[ndx], &extProperties[ndx].queueFamilyProperties, sizeof(VkQueueFamilyProperties)) != 0)
4693 TCU_FAIL("Mismatch between format properties reported by vkGetPhysicalDeviceQueueFamilyProperties and vkGetPhysicalDeviceQueueFamilyProperties2");
4695 log << TestLog::Message << " queueFamilyNdx = " << ndx <<TestLog::EndMessage
4696 << TestLog::Message << extProperties[ndx] << TestLog::EndMessage;
4700 return tcu::TestStatus::pass("Querying device queue family properties succeeded");
4703 tcu::TestStatus deviceMemoryProperties2 (Context& context)
4705 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
4706 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
4707 const InstanceDriver& vki (instance.getDriver());
4708 TestLog& log = context.getTestContext().getLog();
4709 VkPhysicalDeviceMemoryProperties coreProperties;
4710 VkPhysicalDeviceMemoryProperties2 extProperties;
4712 deMemset(&coreProperties, 0xcd, sizeof(VkPhysicalDeviceMemoryProperties));
4713 deMemset(&extProperties, 0xcd, sizeof(VkPhysicalDeviceMemoryProperties2));
4715 extProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2;
4716 extProperties.pNext = DE_NULL;
4718 vki.getPhysicalDeviceMemoryProperties(physicalDevice, &coreProperties);
4719 vki.getPhysicalDeviceMemoryProperties2(physicalDevice, &extProperties);
4721 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2);
4722 TCU_CHECK(extProperties.pNext == DE_NULL);
4724 if (deMemCmp(&coreProperties, &extProperties.memoryProperties, sizeof(VkPhysicalDeviceMemoryProperties)) != 0)
4725 TCU_FAIL("Mismatch between properties reported by vkGetPhysicalDeviceMemoryProperties and vkGetPhysicalDeviceMemoryProperties2");
4727 log << TestLog::Message << extProperties << TestLog::EndMessage;
4729 return tcu::TestStatus::pass("Querying device memory properties succeeded");
4732 tcu::TestStatus deviceFeaturesVulkan12 (Context& context)
4734 using namespace ValidateQueryBits;
4736 const QueryMemberTableEntry feature11OffsetTable[] =
4738 // VkPhysicalDevice16BitStorageFeatures
4739 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, storageBuffer16BitAccess),
4740 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, uniformAndStorageBuffer16BitAccess),
4741 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, storagePushConstant16),
4742 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, storageInputOutput16),
4744 // VkPhysicalDeviceMultiviewFeatures
4745 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, multiview),
4746 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, multiviewGeometryShader),
4747 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, multiviewTessellationShader),
4749 // VkPhysicalDeviceVariablePointersFeatures
4750 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, variablePointersStorageBuffer),
4751 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, variablePointers),
4753 // VkPhysicalDeviceProtectedMemoryFeatures
4754 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, protectedMemory),
4756 // VkPhysicalDeviceSamplerYcbcrConversionFeatures
4757 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, samplerYcbcrConversion),
4759 // VkPhysicalDeviceShaderDrawParametersFeatures
4760 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Features, shaderDrawParameters),
4763 const QueryMemberTableEntry feature12OffsetTable[] =
4766 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, samplerMirrorClampToEdge),
4767 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, drawIndirectCount),
4769 // VkPhysicalDevice8BitStorageFeatures
4770 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, storageBuffer8BitAccess),
4771 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, uniformAndStorageBuffer8BitAccess),
4772 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, storagePushConstant8),
4774 // VkPhysicalDeviceShaderAtomicInt64Features
4775 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderBufferInt64Atomics),
4776 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderSharedInt64Atomics),
4778 // VkPhysicalDeviceShaderFloat16Int8Features
4779 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderFloat16),
4780 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderInt8),
4782 // VkPhysicalDeviceDescriptorIndexingFeatures
4783 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorIndexing),
4784 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderInputAttachmentArrayDynamicIndexing),
4785 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderUniformTexelBufferArrayDynamicIndexing),
4786 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageTexelBufferArrayDynamicIndexing),
4787 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderUniformBufferArrayNonUniformIndexing),
4788 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderSampledImageArrayNonUniformIndexing),
4789 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageBufferArrayNonUniformIndexing),
4790 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageImageArrayNonUniformIndexing),
4791 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderInputAttachmentArrayNonUniformIndexing),
4792 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderUniformTexelBufferArrayNonUniformIndexing),
4793 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderStorageTexelBufferArrayNonUniformIndexing),
4794 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingUniformBufferUpdateAfterBind),
4795 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingSampledImageUpdateAfterBind),
4796 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingStorageImageUpdateAfterBind),
4797 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingStorageBufferUpdateAfterBind),
4798 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingUniformTexelBufferUpdateAfterBind),
4799 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingStorageTexelBufferUpdateAfterBind),
4800 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingUpdateUnusedWhilePending),
4801 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingPartiallyBound),
4802 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, descriptorBindingVariableDescriptorCount),
4803 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, runtimeDescriptorArray),
4806 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, samplerFilterMinmax),
4808 // VkPhysicalDeviceScalarBlockLayoutFeatures
4809 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, scalarBlockLayout),
4811 // VkPhysicalDeviceImagelessFramebufferFeatures
4812 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, imagelessFramebuffer),
4814 // VkPhysicalDeviceUniformBufferStandardLayoutFeatures
4815 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, uniformBufferStandardLayout),
4817 // VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures
4818 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderSubgroupExtendedTypes),
4820 // VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures
4821 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, separateDepthStencilLayouts),
4823 // VkPhysicalDeviceHostQueryResetFeatures
4824 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, hostQueryReset),
4826 // VkPhysicalDeviceTimelineSemaphoreFeatures
4827 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, timelineSemaphore),
4829 // VkPhysicalDeviceBufferDeviceAddressFeatures
4830 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, bufferDeviceAddress),
4831 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, bufferDeviceAddressCaptureReplay),
4832 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, bufferDeviceAddressMultiDevice),
4834 // VkPhysicalDeviceVulkanMemoryModelFeatures
4835 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, vulkanMemoryModel),
4836 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, vulkanMemoryModelDeviceScope),
4837 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, vulkanMemoryModelAvailabilityVisibilityChains),
4840 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderOutputViewportIndex),
4841 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, shaderOutputLayer),
4842 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Features, subgroupBroadcastDynamicId),
4845 TestLog& log = context.getTestContext().getLog();
4846 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
4847 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
4848 const InstanceDriver& vki = instance.getDriver();
4849 const deUint32 vulkan11FeaturesBufferSize = sizeof(VkPhysicalDeviceVulkan11Features) + GUARD_SIZE;
4850 const deUint32 vulkan12FeaturesBufferSize = sizeof(VkPhysicalDeviceVulkan12Features) + GUARD_SIZE;
4851 VkPhysicalDeviceFeatures2 extFeatures;
4852 deUint8 buffer11a[vulkan11FeaturesBufferSize];
4853 deUint8 buffer11b[vulkan11FeaturesBufferSize];
4854 deUint8 buffer12a[vulkan12FeaturesBufferSize];
4855 deUint8 buffer12b[vulkan12FeaturesBufferSize];
4856 const int count = 2u;
4857 VkPhysicalDeviceVulkan11Features* vulkan11Features[count] = { (VkPhysicalDeviceVulkan11Features*)(buffer11a), (VkPhysicalDeviceVulkan11Features*)(buffer11b)};
4858 VkPhysicalDeviceVulkan12Features* vulkan12Features[count] = { (VkPhysicalDeviceVulkan12Features*)(buffer12a), (VkPhysicalDeviceVulkan12Features*)(buffer12b)};
4860 if (!context.contextSupports(vk::ApiVersion(1, 2, 0)))
4861 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
4863 deMemset(buffer11b, GUARD_VALUE, sizeof(buffer11b));
4864 deMemset(buffer12a, GUARD_VALUE, sizeof(buffer12a));
4865 deMemset(buffer12b, GUARD_VALUE, sizeof(buffer12b));
4866 deMemset(buffer11a, GUARD_VALUE, sizeof(buffer11a));
4868 // Validate all fields initialized
4869 for (int ndx = 0; ndx < count; ++ndx)
4871 deMemset(&extFeatures.features, 0x00, sizeof(extFeatures.features));
4872 extFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
4873 extFeatures.pNext = vulkan11Features[ndx];
4875 deMemset(vulkan11Features[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan11Features));
4876 vulkan11Features[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
4877 vulkan11Features[ndx]->pNext = vulkan12Features[ndx];
4879 deMemset(vulkan12Features[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan12Features));
4880 vulkan12Features[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
4881 vulkan12Features[ndx]->pNext = DE_NULL;
4883 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
4886 log << TestLog::Message << *vulkan11Features[0] << TestLog::EndMessage;
4887 log << TestLog::Message << *vulkan12Features[0] << TestLog::EndMessage;
4889 if (!validateStructsWithGuard(feature11OffsetTable, vulkan11Features, GUARD_VALUE, GUARD_SIZE))
4891 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceVulkan11Features initialization failure" << TestLog::EndMessage;
4893 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan11Features initialization failure");
4896 if (!validateStructsWithGuard(feature12OffsetTable, vulkan12Features, GUARD_VALUE, GUARD_SIZE))
4898 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceVulkan12Features initialization failure" << TestLog::EndMessage;
4900 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan12Features initialization failure");
4903 return tcu::TestStatus::pass("Querying Vulkan 1.2 device features succeeded");
4906 tcu::TestStatus devicePropertiesVulkan12 (Context& context)
4908 using namespace ValidateQueryBits;
4910 const QueryMemberTableEntry properties11OffsetTable[] =
4912 // VkPhysicalDeviceIDProperties
4913 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceUUID),
4914 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, driverUUID),
4915 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceLUID),
4916 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceNodeMask),
4917 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, deviceLUIDValid),
4919 // VkPhysicalDeviceSubgroupProperties
4920 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupSize),
4921 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupSupportedStages),
4922 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupSupportedOperations),
4923 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, subgroupQuadOperationsInAllStages),
4925 // VkPhysicalDevicePointClippingProperties
4926 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, pointClippingBehavior),
4928 // VkPhysicalDeviceMultiviewProperties
4929 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxMultiviewViewCount),
4930 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxMultiviewInstanceIndex),
4932 // VkPhysicalDeviceProtectedMemoryProperties
4933 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, protectedNoFault),
4935 // VkPhysicalDeviceMaintenance3Properties
4936 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxPerSetDescriptors),
4937 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan11Properties, maxMemoryAllocationSize),
4940 const QueryMemberTableEntry properties12OffsetTable[] =
4942 // VkPhysicalDeviceDriverProperties
4943 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, driverID),
4944 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, conformanceVersion),
4946 // VkPhysicalDeviceFloatControlsProperties
4947 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, denormBehaviorIndependence),
4948 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, roundingModeIndependence),
4949 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSignedZeroInfNanPreserveFloat16),
4950 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSignedZeroInfNanPreserveFloat32),
4951 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSignedZeroInfNanPreserveFloat64),
4952 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormPreserveFloat16),
4953 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormPreserveFloat32),
4954 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormPreserveFloat64),
4955 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormFlushToZeroFloat16),
4956 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormFlushToZeroFloat32),
4957 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderDenormFlushToZeroFloat64),
4958 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTEFloat16),
4959 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTEFloat32),
4960 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTEFloat64),
4961 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTZFloat16),
4962 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTZFloat32),
4963 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderRoundingModeRTZFloat64),
4965 // VkPhysicalDeviceDescriptorIndexingProperties
4966 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxUpdateAfterBindDescriptorsInAllPools),
4967 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderUniformBufferArrayNonUniformIndexingNative),
4968 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderSampledImageArrayNonUniformIndexingNative),
4969 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderStorageBufferArrayNonUniformIndexingNative),
4970 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderStorageImageArrayNonUniformIndexingNative),
4971 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, shaderInputAttachmentArrayNonUniformIndexingNative),
4972 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, robustBufferAccessUpdateAfterBind),
4973 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, quadDivergentImplicitLod),
4974 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindSamplers),
4975 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindUniformBuffers),
4976 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindStorageBuffers),
4977 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindSampledImages),
4978 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindStorageImages),
4979 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageDescriptorUpdateAfterBindInputAttachments),
4980 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxPerStageUpdateAfterBindResources),
4981 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindSamplers),
4982 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindUniformBuffers),
4983 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindUniformBuffersDynamic),
4984 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindStorageBuffers),
4985 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindStorageBuffersDynamic),
4986 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindSampledImages),
4987 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindStorageImages),
4988 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxDescriptorSetUpdateAfterBindInputAttachments),
4990 // VkPhysicalDeviceDepthStencilResolveProperties
4991 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, supportedDepthResolveModes),
4992 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, supportedStencilResolveModes),
4993 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, independentResolveNone),
4994 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, independentResolve),
4996 // VkPhysicalDeviceSamplerFilterMinmaxProperties
4997 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, filterMinmaxSingleComponentFormats),
4998 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, filterMinmaxImageComponentMapping),
5000 // VkPhysicalDeviceTimelineSemaphoreProperties
5001 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, maxTimelineSemaphoreValueDifference),
5004 OFFSET_TABLE_ENTRY(VkPhysicalDeviceVulkan12Properties, framebufferIntegerColorSampleCounts),
5007 TestLog& log = context.getTestContext().getLog();
5008 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
5009 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5010 const InstanceDriver& vki = instance.getDriver();
5011 const deUint32 vulkan11PropertiesBufferSize = sizeof(VkPhysicalDeviceVulkan11Properties) + GUARD_SIZE;
5012 const deUint32 vulkan12PropertiesBufferSize = sizeof(VkPhysicalDeviceVulkan12Properties) + GUARD_SIZE;
5013 VkPhysicalDeviceProperties2 extProperties;
5014 deUint8 buffer11a[vulkan11PropertiesBufferSize];
5015 deUint8 buffer11b[vulkan11PropertiesBufferSize];
5016 deUint8 buffer12a[vulkan12PropertiesBufferSize];
5017 deUint8 buffer12b[vulkan12PropertiesBufferSize];
5018 const int count = 2u;
5019 VkPhysicalDeviceVulkan11Properties* vulkan11Properties[count] = { (VkPhysicalDeviceVulkan11Properties*)(buffer11a), (VkPhysicalDeviceVulkan11Properties*)(buffer11b)};
5020 VkPhysicalDeviceVulkan12Properties* vulkan12Properties[count] = { (VkPhysicalDeviceVulkan12Properties*)(buffer12a), (VkPhysicalDeviceVulkan12Properties*)(buffer12b)};
5022 if (!context.contextSupports(vk::ApiVersion(1, 2, 0)))
5023 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
5025 deMemset(buffer11a, GUARD_VALUE, sizeof(buffer11a));
5026 deMemset(buffer11b, GUARD_VALUE, sizeof(buffer11b));
5027 deMemset(buffer12a, GUARD_VALUE, sizeof(buffer12a));
5028 deMemset(buffer12b, GUARD_VALUE, sizeof(buffer12b));
5030 for (int ndx = 0; ndx < count; ++ndx)
5032 deMemset(&extProperties.properties, 0x00, sizeof(extProperties.properties));
5033 extProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
5034 extProperties.pNext = vulkan11Properties[ndx];
5036 deMemset(vulkan11Properties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan11Properties));
5037 vulkan11Properties[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES;
5038 vulkan11Properties[ndx]->pNext = vulkan12Properties[ndx];
5040 deMemset(vulkan12Properties[ndx], 0xFF * ndx, sizeof(VkPhysicalDeviceVulkan12Properties));
5041 vulkan12Properties[ndx]->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES;
5042 vulkan12Properties[ndx]->pNext = DE_NULL;
5044 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5047 log << TestLog::Message << *vulkan11Properties[0] << TestLog::EndMessage;
5048 log << TestLog::Message << *vulkan12Properties[0] << TestLog::EndMessage;
5050 if (!validateStructsWithGuard(properties11OffsetTable, vulkan11Properties, GUARD_VALUE, GUARD_SIZE))
5052 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceVulkan11Properties initialization failure" << TestLog::EndMessage;
5054 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan11Properties initialization failure");
5057 if (!validateStructsWithGuard(properties12OffsetTable, vulkan12Properties, GUARD_VALUE, GUARD_SIZE) ||
5058 strncmp(vulkan12Properties[0]->driverName, vulkan12Properties[1]->driverName, VK_MAX_DRIVER_NAME_SIZE) != 0 ||
5059 strncmp(vulkan12Properties[0]->driverInfo, vulkan12Properties[1]->driverInfo, VK_MAX_DRIVER_INFO_SIZE) != 0 )
5061 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceVulkan12Properties initialization failure" << TestLog::EndMessage;
5063 return tcu::TestStatus::fail("VkPhysicalDeviceVulkan12Properties initialization failure");
5066 return tcu::TestStatus::pass("Querying Vulkan 1.2 device properties succeeded");
5069 tcu::TestStatus deviceFeatureExtensionsConsistencyVulkan12(Context& context)
5071 TestLog& log = context.getTestContext().getLog();
5072 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
5073 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5074 const InstanceDriver& vki = instance.getDriver();
5076 if (!context.contextSupports(vk::ApiVersion(1, 2, 0)))
5077 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
5079 VkPhysicalDeviceVulkan12Features vulkan12Features = initVulkanStructure();
5080 VkPhysicalDeviceVulkan11Features vulkan11Features = initVulkanStructure(&vulkan12Features);
5081 VkPhysicalDeviceFeatures2 extFeatures = initVulkanStructure(&vulkan11Features);
5083 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
5085 log << TestLog::Message << vulkan11Features << TestLog::EndMessage;
5086 log << TestLog::Message << vulkan12Features << TestLog::EndMessage;
5088 // Validate if proper VkPhysicalDeviceVulkanXXFeatures fields are set when corresponding extensions are present
5089 std::pair<std::pair<const char*,const char*>, VkBool32> extensions2validate[] =
5091 { { "VK_KHR_sampler_mirror_clamp_to_edge", "VkPhysicalDeviceVulkan12Features.samplerMirrorClampToEdge" }, vulkan12Features.samplerMirrorClampToEdge },
5092 { { "VK_KHR_draw_indirect_count", "VkPhysicalDeviceVulkan12Features.drawIndirectCount" }, vulkan12Features.drawIndirectCount },
5093 { { "VK_EXT_descriptor_indexing", "VkPhysicalDeviceVulkan12Features.descriptorIndexing" }, vulkan12Features.descriptorIndexing },
5094 { { "VK_EXT_sampler_filter_minmax", "VkPhysicalDeviceVulkan12Features.samplerFilterMinmax" }, vulkan12Features.samplerFilterMinmax },
5095 { { "VK_EXT_shader_viewport_index_layer", "VkPhysicalDeviceVulkan12Features.shaderOutputViewportIndex" }, vulkan12Features.shaderOutputViewportIndex },
5096 { { "VK_EXT_shader_viewport_index_layer", "VkPhysicalDeviceVulkan12Features.shaderOutputLayer" }, vulkan12Features.shaderOutputLayer }
5098 vector<VkExtensionProperties> extensionProperties = enumerateDeviceExtensionProperties(vki, physicalDevice, DE_NULL);
5099 for (const auto& ext : extensions2validate)
5100 if (checkExtension(extensionProperties, ext.first.first) && !ext.second)
5101 TCU_FAIL(string("Mismatch between extension ") + ext.first.first + " and " + ext.first.second);
5103 // collect all extension features
5105 VkPhysicalDevice16BitStorageFeatures device16BitStorageFeatures = initVulkanStructure();
5106 VkPhysicalDeviceMultiviewFeatures deviceMultiviewFeatures = initVulkanStructure(&device16BitStorageFeatures);
5107 VkPhysicalDeviceProtectedMemoryFeatures protectedMemoryFeatures = initVulkanStructure(&deviceMultiviewFeatures);
5108 VkPhysicalDeviceSamplerYcbcrConversionFeatures samplerYcbcrConversionFeatures = initVulkanStructure(&protectedMemoryFeatures);
5109 VkPhysicalDeviceShaderDrawParametersFeatures shaderDrawParametersFeatures = initVulkanStructure(&samplerYcbcrConversionFeatures);
5110 VkPhysicalDeviceVariablePointersFeatures variablePointerFeatures = initVulkanStructure(&shaderDrawParametersFeatures);
5111 VkPhysicalDevice8BitStorageFeatures device8BitStorageFeatures = initVulkanStructure(&variablePointerFeatures);
5112 VkPhysicalDeviceShaderAtomicInt64Features shaderAtomicInt64Features = initVulkanStructure(&device8BitStorageFeatures);
5113 VkPhysicalDeviceShaderFloat16Int8Features shaderFloat16Int8Features = initVulkanStructure(&shaderAtomicInt64Features);
5114 VkPhysicalDeviceDescriptorIndexingFeatures descriptorIndexingFeatures = initVulkanStructure(&shaderFloat16Int8Features);
5115 VkPhysicalDeviceScalarBlockLayoutFeatures scalarBlockLayoutFeatures = initVulkanStructure(&descriptorIndexingFeatures);
5116 VkPhysicalDeviceImagelessFramebufferFeatures imagelessFramebufferFeatures = initVulkanStructure(&scalarBlockLayoutFeatures);
5117 VkPhysicalDeviceUniformBufferStandardLayoutFeatures uniformBufferStandardLayoutFeatures = initVulkanStructure(&imagelessFramebufferFeatures);
5118 VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures shaderSubgroupExtendedTypesFeatures = initVulkanStructure(&uniformBufferStandardLayoutFeatures);
5119 VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures separateDepthStencilLayoutsFeatures = initVulkanStructure(&shaderSubgroupExtendedTypesFeatures);
5120 VkPhysicalDeviceHostQueryResetFeatures hostQueryResetFeatures = initVulkanStructure(&separateDepthStencilLayoutsFeatures);
5121 VkPhysicalDeviceTimelineSemaphoreFeatures timelineSemaphoreFeatures = initVulkanStructure(&hostQueryResetFeatures);
5122 VkPhysicalDeviceBufferDeviceAddressFeatures bufferDeviceAddressFeatures = initVulkanStructure(&timelineSemaphoreFeatures);
5123 VkPhysicalDeviceVulkanMemoryModelFeatures vulkanMemoryModelFeatures = initVulkanStructure(&bufferDeviceAddressFeatures);
5124 extFeatures = initVulkanStructure(&vulkanMemoryModelFeatures);
5126 vki.getPhysicalDeviceFeatures2(physicalDevice, &extFeatures);
5128 log << TestLog::Message << extFeatures << TestLog::EndMessage;
5129 log << TestLog::Message << device16BitStorageFeatures << TestLog::EndMessage;
5130 log << TestLog::Message << deviceMultiviewFeatures << TestLog::EndMessage;
5131 log << TestLog::Message << protectedMemoryFeatures << TestLog::EndMessage;
5132 log << TestLog::Message << samplerYcbcrConversionFeatures << TestLog::EndMessage;
5133 log << TestLog::Message << shaderDrawParametersFeatures << TestLog::EndMessage;
5134 log << TestLog::Message << variablePointerFeatures << TestLog::EndMessage;
5135 log << TestLog::Message << device8BitStorageFeatures << TestLog::EndMessage;
5136 log << TestLog::Message << shaderAtomicInt64Features << TestLog::EndMessage;
5137 log << TestLog::Message << shaderFloat16Int8Features << TestLog::EndMessage;
5138 log << TestLog::Message << descriptorIndexingFeatures << TestLog::EndMessage;
5139 log << TestLog::Message << scalarBlockLayoutFeatures << TestLog::EndMessage;
5140 log << TestLog::Message << imagelessFramebufferFeatures << TestLog::EndMessage;
5141 log << TestLog::Message << uniformBufferStandardLayoutFeatures << TestLog::EndMessage;
5142 log << TestLog::Message << shaderSubgroupExtendedTypesFeatures << TestLog::EndMessage;
5143 log << TestLog::Message << separateDepthStencilLayoutsFeatures << TestLog::EndMessage;
5144 log << TestLog::Message << hostQueryResetFeatures << TestLog::EndMessage;
5145 log << TestLog::Message << timelineSemaphoreFeatures << TestLog::EndMessage;
5146 log << TestLog::Message << bufferDeviceAddressFeatures << TestLog::EndMessage;
5147 log << TestLog::Message << vulkanMemoryModelFeatures << TestLog::EndMessage;
5149 if (( device16BitStorageFeatures.storageBuffer16BitAccess != vulkan11Features.storageBuffer16BitAccess ||
5150 device16BitStorageFeatures.uniformAndStorageBuffer16BitAccess != vulkan11Features.uniformAndStorageBuffer16BitAccess ||
5151 device16BitStorageFeatures.storagePushConstant16 != vulkan11Features.storagePushConstant16 ||
5152 device16BitStorageFeatures.storageInputOutput16 != vulkan11Features.storageInputOutput16 ))
5154 TCU_FAIL("Mismatch between VkPhysicalDevice16BitStorageFeatures and VkPhysicalDeviceVulkan11Features");
5157 if (( deviceMultiviewFeatures.multiview != vulkan11Features.multiview ||
5158 deviceMultiviewFeatures.multiviewGeometryShader != vulkan11Features.multiviewGeometryShader ||
5159 deviceMultiviewFeatures.multiviewTessellationShader != vulkan11Features.multiviewTessellationShader ))
5161 TCU_FAIL("Mismatch between VkPhysicalDeviceMultiviewFeatures and VkPhysicalDeviceVulkan11Features");
5164 if ( (protectedMemoryFeatures.protectedMemory != vulkan11Features.protectedMemory ))
5166 TCU_FAIL("Mismatch between VkPhysicalDeviceProtectedMemoryFeatures and VkPhysicalDeviceVulkan11Features");
5169 if ( (samplerYcbcrConversionFeatures.samplerYcbcrConversion != vulkan11Features.samplerYcbcrConversion ))
5171 TCU_FAIL("Mismatch between VkPhysicalDeviceSamplerYcbcrConversionFeatures and VkPhysicalDeviceVulkan11Features");
5174 if ( (shaderDrawParametersFeatures.shaderDrawParameters != vulkan11Features.shaderDrawParameters ))
5176 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderDrawParametersFeatures and VkPhysicalDeviceVulkan11Features");
5179 if (( variablePointerFeatures.variablePointersStorageBuffer != vulkan11Features.variablePointersStorageBuffer ||
5180 variablePointerFeatures.variablePointers != vulkan11Features.variablePointers))
5182 TCU_FAIL("Mismatch between VkPhysicalDeviceVariablePointersFeatures and VkPhysicalDeviceVulkan11Features");
5185 if (( device8BitStorageFeatures.storageBuffer8BitAccess != vulkan12Features.storageBuffer8BitAccess ||
5186 device8BitStorageFeatures.uniformAndStorageBuffer8BitAccess != vulkan12Features.uniformAndStorageBuffer8BitAccess ||
5187 device8BitStorageFeatures.storagePushConstant8 != vulkan12Features.storagePushConstant8 ))
5189 TCU_FAIL("Mismatch between VkPhysicalDevice8BitStorageFeatures and VkPhysicalDeviceVulkan12Features");
5192 if (( shaderAtomicInt64Features.shaderBufferInt64Atomics != vulkan12Features.shaderBufferInt64Atomics ||
5193 shaderAtomicInt64Features.shaderSharedInt64Atomics != vulkan12Features.shaderSharedInt64Atomics ))
5195 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderAtomicInt64Features and VkPhysicalDeviceVulkan12Features");
5198 if (( shaderFloat16Int8Features.shaderFloat16 != vulkan12Features.shaderFloat16 ||
5199 shaderFloat16Int8Features.shaderInt8 != vulkan12Features.shaderInt8 ))
5201 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderFloat16Int8Features and VkPhysicalDeviceVulkan12Features");
5204 if ((vulkan12Features.descriptorIndexing) &&
5205 ( descriptorIndexingFeatures.shaderInputAttachmentArrayDynamicIndexing != vulkan12Features.shaderInputAttachmentArrayDynamicIndexing ||
5206 descriptorIndexingFeatures.shaderUniformTexelBufferArrayDynamicIndexing != vulkan12Features.shaderUniformTexelBufferArrayDynamicIndexing ||
5207 descriptorIndexingFeatures.shaderStorageTexelBufferArrayDynamicIndexing != vulkan12Features.shaderStorageTexelBufferArrayDynamicIndexing ||
5208 descriptorIndexingFeatures.shaderUniformBufferArrayNonUniformIndexing != vulkan12Features.shaderUniformBufferArrayNonUniformIndexing ||
5209 descriptorIndexingFeatures.shaderSampledImageArrayNonUniformIndexing != vulkan12Features.shaderSampledImageArrayNonUniformIndexing ||
5210 descriptorIndexingFeatures.shaderStorageBufferArrayNonUniformIndexing != vulkan12Features.shaderStorageBufferArrayNonUniformIndexing ||
5211 descriptorIndexingFeatures.shaderStorageImageArrayNonUniformIndexing != vulkan12Features.shaderStorageImageArrayNonUniformIndexing ||
5212 descriptorIndexingFeatures.shaderInputAttachmentArrayNonUniformIndexing != vulkan12Features.shaderInputAttachmentArrayNonUniformIndexing ||
5213 descriptorIndexingFeatures.shaderUniformTexelBufferArrayNonUniformIndexing != vulkan12Features.shaderUniformTexelBufferArrayNonUniformIndexing ||
5214 descriptorIndexingFeatures.shaderStorageTexelBufferArrayNonUniformIndexing != vulkan12Features.shaderStorageTexelBufferArrayNonUniformIndexing ||
5215 descriptorIndexingFeatures.descriptorBindingUniformBufferUpdateAfterBind != vulkan12Features.descriptorBindingUniformBufferUpdateAfterBind ||
5216 descriptorIndexingFeatures.descriptorBindingSampledImageUpdateAfterBind != vulkan12Features.descriptorBindingSampledImageUpdateAfterBind ||
5217 descriptorIndexingFeatures.descriptorBindingStorageImageUpdateAfterBind != vulkan12Features.descriptorBindingStorageImageUpdateAfterBind ||
5218 descriptorIndexingFeatures.descriptorBindingStorageBufferUpdateAfterBind != vulkan12Features.descriptorBindingStorageBufferUpdateAfterBind ||
5219 descriptorIndexingFeatures.descriptorBindingUniformTexelBufferUpdateAfterBind != vulkan12Features.descriptorBindingUniformTexelBufferUpdateAfterBind ||
5220 descriptorIndexingFeatures.descriptorBindingStorageTexelBufferUpdateAfterBind != vulkan12Features.descriptorBindingStorageTexelBufferUpdateAfterBind ||
5221 descriptorIndexingFeatures.descriptorBindingUpdateUnusedWhilePending != vulkan12Features.descriptorBindingUpdateUnusedWhilePending ||
5222 descriptorIndexingFeatures.descriptorBindingPartiallyBound != vulkan12Features.descriptorBindingPartiallyBound ||
5223 descriptorIndexingFeatures.descriptorBindingVariableDescriptorCount != vulkan12Features.descriptorBindingVariableDescriptorCount ||
5224 descriptorIndexingFeatures.runtimeDescriptorArray != vulkan12Features.runtimeDescriptorArray ))
5226 TCU_FAIL("Mismatch between VkPhysicalDeviceDescriptorIndexingFeatures and VkPhysicalDeviceVulkan12Features");
5229 if (( scalarBlockLayoutFeatures.scalarBlockLayout != vulkan12Features.scalarBlockLayout ))
5231 TCU_FAIL("Mismatch between VkPhysicalDeviceScalarBlockLayoutFeatures and VkPhysicalDeviceVulkan12Features");
5234 if (( imagelessFramebufferFeatures.imagelessFramebuffer != vulkan12Features.imagelessFramebuffer ))
5236 TCU_FAIL("Mismatch between VkPhysicalDeviceImagelessFramebufferFeatures and VkPhysicalDeviceVulkan12Features");
5239 if (( uniformBufferStandardLayoutFeatures.uniformBufferStandardLayout != vulkan12Features.uniformBufferStandardLayout ))
5241 TCU_FAIL("Mismatch between VkPhysicalDeviceUniformBufferStandardLayoutFeatures and VkPhysicalDeviceVulkan12Features");
5244 if (( shaderSubgroupExtendedTypesFeatures.shaderSubgroupExtendedTypes != vulkan12Features.shaderSubgroupExtendedTypes ))
5246 TCU_FAIL("Mismatch between VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures and VkPhysicalDeviceVulkan12Features");
5249 if (( separateDepthStencilLayoutsFeatures.separateDepthStencilLayouts != vulkan12Features.separateDepthStencilLayouts ))
5251 TCU_FAIL("Mismatch between VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures and VkPhysicalDeviceVulkan12Features");
5254 if (( hostQueryResetFeatures.hostQueryReset != vulkan12Features.hostQueryReset ))
5256 TCU_FAIL("Mismatch between VkPhysicalDeviceHostQueryResetFeatures and VkPhysicalDeviceVulkan12Features");
5259 if (( timelineSemaphoreFeatures.timelineSemaphore != vulkan12Features.timelineSemaphore ))
5261 TCU_FAIL("Mismatch between VkPhysicalDeviceTimelineSemaphoreFeatures and VkPhysicalDeviceVulkan12Features");
5264 if (( bufferDeviceAddressFeatures.bufferDeviceAddress != vulkan12Features.bufferDeviceAddress ||
5265 bufferDeviceAddressFeatures.bufferDeviceAddressCaptureReplay != vulkan12Features.bufferDeviceAddressCaptureReplay ||
5266 bufferDeviceAddressFeatures.bufferDeviceAddressMultiDevice != vulkan12Features.bufferDeviceAddressMultiDevice ))
5268 TCU_FAIL("Mismatch between VkPhysicalDeviceBufferDeviceAddressFeatures and VkPhysicalDeviceVulkan12Features");
5271 if (( vulkanMemoryModelFeatures.vulkanMemoryModel != vulkan12Features.vulkanMemoryModel ||
5272 vulkanMemoryModelFeatures.vulkanMemoryModelDeviceScope != vulkan12Features.vulkanMemoryModelDeviceScope ||
5273 vulkanMemoryModelFeatures.vulkanMemoryModelAvailabilityVisibilityChains != vulkan12Features.vulkanMemoryModelAvailabilityVisibilityChains ))
5275 TCU_FAIL("Mismatch between VkPhysicalDeviceVulkanMemoryModelFeatures and VkPhysicalDeviceVulkan12Features");
5279 return tcu::TestStatus::pass("Vulkan 1.2 device features are consistent with extensions");
5282 tcu::TestStatus devicePropertyExtensionsConsistencyVulkan12(Context& context)
5284 TestLog& log = context.getTestContext().getLog();
5285 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
5286 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5287 const InstanceDriver& vki = instance.getDriver();
5289 if (!context.contextSupports(vk::ApiVersion(1, 2, 0)))
5290 TCU_THROW(NotSupportedError, "At least Vulkan 1.2 required to run test");
5292 VkPhysicalDeviceVulkan12Properties vulkan12Properties = initVulkanStructure();
5293 VkPhysicalDeviceVulkan11Properties vulkan11Properties = initVulkanStructure(&vulkan12Properties);
5294 VkPhysicalDeviceProperties2 extProperties = initVulkanStructure(&vulkan11Properties);
5296 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5298 log << TestLog::Message << vulkan11Properties << TestLog::EndMessage;
5299 log << TestLog::Message << vulkan12Properties << TestLog::EndMessage;
5301 // Validate all fields initialized matching to extension structures
5303 VkPhysicalDeviceIDProperties idProperties = initVulkanStructure();
5304 VkPhysicalDeviceSubgroupProperties subgroupProperties = initVulkanStructure(&idProperties);
5305 VkPhysicalDevicePointClippingProperties pointClippingProperties = initVulkanStructure(&subgroupProperties);
5306 VkPhysicalDeviceMultiviewProperties multiviewProperties = initVulkanStructure(&pointClippingProperties);
5307 VkPhysicalDeviceProtectedMemoryProperties protectedMemoryPropertiesKHR = initVulkanStructure(&multiviewProperties);
5308 VkPhysicalDeviceMaintenance3Properties maintenance3Properties = initVulkanStructure(&protectedMemoryPropertiesKHR);
5309 VkPhysicalDeviceDriverProperties driverProperties = initVulkanStructure(&maintenance3Properties);
5310 VkPhysicalDeviceFloatControlsProperties floatControlsProperties = initVulkanStructure(&driverProperties);
5311 VkPhysicalDeviceDescriptorIndexingProperties descriptorIndexingProperties = initVulkanStructure(&floatControlsProperties);
5312 VkPhysicalDeviceDepthStencilResolveProperties depthStencilResolveProperties = initVulkanStructure(&descriptorIndexingProperties);
5313 VkPhysicalDeviceSamplerFilterMinmaxProperties samplerFilterMinmaxProperties = initVulkanStructure(&depthStencilResolveProperties);
5314 VkPhysicalDeviceTimelineSemaphoreProperties timelineSemaphoreProperties = initVulkanStructure(&samplerFilterMinmaxProperties);
5315 extProperties = initVulkanStructure(&timelineSemaphoreProperties);
5317 vki.getPhysicalDeviceProperties2(physicalDevice, &extProperties);
5319 if ((deMemCmp(idProperties.deviceUUID, vulkan11Properties.deviceUUID, VK_UUID_SIZE) != 0) ||
5320 (deMemCmp(idProperties.driverUUID, vulkan11Properties.driverUUID, VK_UUID_SIZE) != 0) ||
5321 (idProperties.deviceLUIDValid != vulkan11Properties.deviceLUIDValid))
5323 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties and VkPhysicalDeviceVulkan11Properties");
5325 else if (idProperties.deviceLUIDValid)
5327 // If deviceLUIDValid is VK_FALSE, the contents of deviceLUID and deviceNodeMask are undefined
5328 // so thay can only be compared when deviceLUIDValid is VK_TRUE.
5329 if ((deMemCmp(idProperties.deviceLUID, vulkan11Properties.deviceLUID, VK_UUID_SIZE) != 0) ||
5330 (idProperties.deviceNodeMask != vulkan11Properties.deviceNodeMask))
5332 TCU_FAIL("Mismatch between VkPhysicalDeviceIDProperties and VkPhysicalDeviceVulkan11Properties");
5336 if ((subgroupProperties.subgroupSize != vulkan11Properties.subgroupSize ||
5337 subgroupProperties.supportedStages != vulkan11Properties.subgroupSupportedStages ||
5338 subgroupProperties.supportedOperations != vulkan11Properties.subgroupSupportedOperations ||
5339 subgroupProperties.quadOperationsInAllStages != vulkan11Properties.subgroupQuadOperationsInAllStages))
5341 TCU_FAIL("Mismatch between VkPhysicalDeviceSubgroupProperties and VkPhysicalDeviceVulkan11Properties");
5344 if ((pointClippingProperties.pointClippingBehavior != vulkan11Properties.pointClippingBehavior))
5346 TCU_FAIL("Mismatch between VkPhysicalDevicePointClippingProperties and VkPhysicalDeviceVulkan11Properties");
5349 if ((multiviewProperties.maxMultiviewViewCount != vulkan11Properties.maxMultiviewViewCount ||
5350 multiviewProperties.maxMultiviewInstanceIndex != vulkan11Properties.maxMultiviewInstanceIndex))
5352 TCU_FAIL("Mismatch between VkPhysicalDeviceMultiviewProperties and VkPhysicalDeviceVulkan11Properties");
5355 if ((protectedMemoryPropertiesKHR.protectedNoFault != vulkan11Properties.protectedNoFault))
5357 TCU_FAIL("Mismatch between VkPhysicalDeviceProtectedMemoryProperties and VkPhysicalDeviceVulkan11Properties");
5360 if ((maintenance3Properties.maxPerSetDescriptors != vulkan11Properties.maxPerSetDescriptors ||
5361 maintenance3Properties.maxMemoryAllocationSize != vulkan11Properties.maxMemoryAllocationSize))
5363 TCU_FAIL("Mismatch between VkPhysicalDeviceMaintenance3Properties and VkPhysicalDeviceVulkan11Properties");
5366 if ((driverProperties.driverID != vulkan12Properties.driverID ||
5367 strncmp(driverProperties.driverName, vulkan12Properties.driverName, VK_MAX_DRIVER_NAME_SIZE) != 0 ||
5368 strncmp(driverProperties.driverInfo, vulkan12Properties.driverInfo, VK_MAX_DRIVER_INFO_SIZE) != 0 ||
5369 driverProperties.conformanceVersion.major != vulkan12Properties.conformanceVersion.major ||
5370 driverProperties.conformanceVersion.minor != vulkan12Properties.conformanceVersion.minor ||
5371 driverProperties.conformanceVersion.subminor != vulkan12Properties.conformanceVersion.subminor ||
5372 driverProperties.conformanceVersion.patch != vulkan12Properties.conformanceVersion.patch))
5374 TCU_FAIL("Mismatch between VkPhysicalDeviceDriverProperties and VkPhysicalDeviceVulkan12Properties");
5377 if ((floatControlsProperties.denormBehaviorIndependence != vulkan12Properties.denormBehaviorIndependence ||
5378 floatControlsProperties.roundingModeIndependence != vulkan12Properties.roundingModeIndependence ||
5379 floatControlsProperties.shaderSignedZeroInfNanPreserveFloat16 != vulkan12Properties.shaderSignedZeroInfNanPreserveFloat16 ||
5380 floatControlsProperties.shaderSignedZeroInfNanPreserveFloat32 != vulkan12Properties.shaderSignedZeroInfNanPreserveFloat32 ||
5381 floatControlsProperties.shaderSignedZeroInfNanPreserveFloat64 != vulkan12Properties.shaderSignedZeroInfNanPreserveFloat64 ||
5382 floatControlsProperties.shaderDenormPreserveFloat16 != vulkan12Properties.shaderDenormPreserveFloat16 ||
5383 floatControlsProperties.shaderDenormPreserveFloat32 != vulkan12Properties.shaderDenormPreserveFloat32 ||
5384 floatControlsProperties.shaderDenormPreserveFloat64 != vulkan12Properties.shaderDenormPreserveFloat64 ||
5385 floatControlsProperties.shaderDenormFlushToZeroFloat16 != vulkan12Properties.shaderDenormFlushToZeroFloat16 ||
5386 floatControlsProperties.shaderDenormFlushToZeroFloat32 != vulkan12Properties.shaderDenormFlushToZeroFloat32 ||
5387 floatControlsProperties.shaderDenormFlushToZeroFloat64 != vulkan12Properties.shaderDenormFlushToZeroFloat64 ||
5388 floatControlsProperties.shaderRoundingModeRTEFloat16 != vulkan12Properties.shaderRoundingModeRTEFloat16 ||
5389 floatControlsProperties.shaderRoundingModeRTEFloat32 != vulkan12Properties.shaderRoundingModeRTEFloat32 ||
5390 floatControlsProperties.shaderRoundingModeRTEFloat64 != vulkan12Properties.shaderRoundingModeRTEFloat64 ||
5391 floatControlsProperties.shaderRoundingModeRTZFloat16 != vulkan12Properties.shaderRoundingModeRTZFloat16 ||
5392 floatControlsProperties.shaderRoundingModeRTZFloat32 != vulkan12Properties.shaderRoundingModeRTZFloat32 ||
5393 floatControlsProperties.shaderRoundingModeRTZFloat64 != vulkan12Properties.shaderRoundingModeRTZFloat64 ))
5395 TCU_FAIL("Mismatch between VkPhysicalDeviceFloatControlsProperties and VkPhysicalDeviceVulkan12Properties");
5398 if ((descriptorIndexingProperties.maxUpdateAfterBindDescriptorsInAllPools != vulkan12Properties.maxUpdateAfterBindDescriptorsInAllPools ||
5399 descriptorIndexingProperties.shaderUniformBufferArrayNonUniformIndexingNative != vulkan12Properties.shaderUniformBufferArrayNonUniformIndexingNative ||
5400 descriptorIndexingProperties.shaderSampledImageArrayNonUniformIndexingNative != vulkan12Properties.shaderSampledImageArrayNonUniformIndexingNative ||
5401 descriptorIndexingProperties.shaderStorageBufferArrayNonUniformIndexingNative != vulkan12Properties.shaderStorageBufferArrayNonUniformIndexingNative ||
5402 descriptorIndexingProperties.shaderStorageImageArrayNonUniformIndexingNative != vulkan12Properties.shaderStorageImageArrayNonUniformIndexingNative ||
5403 descriptorIndexingProperties.shaderInputAttachmentArrayNonUniformIndexingNative != vulkan12Properties.shaderInputAttachmentArrayNonUniformIndexingNative ||
5404 descriptorIndexingProperties.robustBufferAccessUpdateAfterBind != vulkan12Properties.robustBufferAccessUpdateAfterBind ||
5405 descriptorIndexingProperties.quadDivergentImplicitLod != vulkan12Properties.quadDivergentImplicitLod ||
5406 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSamplers != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSamplers ||
5407 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindUniformBuffers != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindUniformBuffers ||
5408 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageBuffers != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageBuffers ||
5409 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindSampledImages != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindSampledImages ||
5410 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindStorageImages != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindStorageImages ||
5411 descriptorIndexingProperties.maxPerStageDescriptorUpdateAfterBindInputAttachments != vulkan12Properties.maxPerStageDescriptorUpdateAfterBindInputAttachments ||
5412 descriptorIndexingProperties.maxPerStageUpdateAfterBindResources != vulkan12Properties.maxPerStageUpdateAfterBindResources ||
5413 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSamplers != vulkan12Properties.maxDescriptorSetUpdateAfterBindSamplers ||
5414 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffers != vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffers ||
5415 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic != vulkan12Properties.maxDescriptorSetUpdateAfterBindUniformBuffersDynamic ||
5416 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffers != vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffers ||
5417 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic != vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageBuffersDynamic ||
5418 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindSampledImages != vulkan12Properties.maxDescriptorSetUpdateAfterBindSampledImages ||
5419 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindStorageImages != vulkan12Properties.maxDescriptorSetUpdateAfterBindStorageImages ||
5420 descriptorIndexingProperties.maxDescriptorSetUpdateAfterBindInputAttachments != vulkan12Properties.maxDescriptorSetUpdateAfterBindInputAttachments ))
5422 TCU_FAIL("Mismatch between VkPhysicalDeviceDescriptorIndexingProperties and VkPhysicalDeviceVulkan12Properties");
5425 if ((depthStencilResolveProperties.supportedDepthResolveModes != vulkan12Properties.supportedDepthResolveModes ||
5426 depthStencilResolveProperties.supportedStencilResolveModes != vulkan12Properties.supportedStencilResolveModes ||
5427 depthStencilResolveProperties.independentResolveNone != vulkan12Properties.independentResolveNone ||
5428 depthStencilResolveProperties.independentResolve != vulkan12Properties.independentResolve))
5430 TCU_FAIL("Mismatch between VkPhysicalDeviceDepthStencilResolveProperties and VkPhysicalDeviceVulkan12Properties");
5433 if ((samplerFilterMinmaxProperties.filterMinmaxSingleComponentFormats != vulkan12Properties.filterMinmaxSingleComponentFormats ||
5434 samplerFilterMinmaxProperties.filterMinmaxImageComponentMapping != vulkan12Properties.filterMinmaxImageComponentMapping))
5436 TCU_FAIL("Mismatch between VkPhysicalDeviceSamplerFilterMinmaxProperties and VkPhysicalDeviceVulkan12Properties");
5439 if ((timelineSemaphoreProperties.maxTimelineSemaphoreValueDifference != vulkan12Properties.maxTimelineSemaphoreValueDifference))
5441 TCU_FAIL("Mismatch between VkPhysicalDeviceTimelineSemaphoreProperties and VkPhysicalDeviceVulkan12Properties");
5445 return tcu::TestStatus::pass("Vulkan 1.2 device properties are consistent with extension properties");
5448 tcu::TestStatus imageFormatProperties2 (Context& context, const VkFormat format, const VkImageType imageType, const VkImageTiling tiling)
5450 if (isYCbCrFormat(format))
5451 // check if Ycbcr format enums are valid given the version and extensions
5452 checkYcbcrApiSupport(context);
5454 TestLog& log = context.getTestContext().getLog();
5456 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
5457 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5458 const InstanceDriver& vki (instance.getDriver());
5460 const VkImageCreateFlags ycbcrFlags = isYCbCrFormat(format) ? (VkImageCreateFlags)VK_IMAGE_CREATE_DISJOINT_BIT_KHR : (VkImageCreateFlags)0u;
5461 const VkImageUsageFlags allUsageFlags = VK_IMAGE_USAGE_TRANSFER_SRC_BIT
5462 | VK_IMAGE_USAGE_TRANSFER_DST_BIT
5463 | VK_IMAGE_USAGE_SAMPLED_BIT
5464 | VK_IMAGE_USAGE_STORAGE_BIT
5465 | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
5466 | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
5467 | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
5468 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
5469 const VkImageCreateFlags allCreateFlags = VK_IMAGE_CREATE_SPARSE_BINDING_BIT
5470 | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT
5471 | VK_IMAGE_CREATE_SPARSE_ALIASED_BIT
5472 | VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT
5473 | VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT
5476 for (VkImageUsageFlags curUsageFlags = (VkImageUsageFlags)1; curUsageFlags <= allUsageFlags; curUsageFlags++)
5478 if (!isValidImageUsageFlagCombination(curUsageFlags))
5481 for (VkImageCreateFlags curCreateFlags = 0; curCreateFlags <= allCreateFlags; curCreateFlags++)
5483 const VkPhysicalDeviceImageFormatInfo2 imageFormatInfo =
5485 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2,
5494 VkImageFormatProperties coreProperties;
5495 VkImageFormatProperties2 extProperties;
5496 VkResult coreResult;
5499 deMemset(&coreProperties, 0xcd, sizeof(VkImageFormatProperties));
5500 deMemset(&extProperties, 0xcd, sizeof(VkImageFormatProperties2));
5502 extProperties.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2;
5503 extProperties.pNext = DE_NULL;
5505 coreResult = vki.getPhysicalDeviceImageFormatProperties(physicalDevice, imageFormatInfo.format, imageFormatInfo.type, imageFormatInfo.tiling, imageFormatInfo.usage, imageFormatInfo.flags, &coreProperties);
5506 extResult = vki.getPhysicalDeviceImageFormatProperties2(physicalDevice, &imageFormatInfo, &extProperties);
5508 TCU_CHECK(extProperties.sType == VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2);
5509 TCU_CHECK(extProperties.pNext == DE_NULL);
5511 if ((coreResult != extResult) ||
5512 (deMemCmp(&coreProperties, &extProperties.imageFormatProperties, sizeof(VkImageFormatProperties)) != 0))
5514 log << TestLog::Message << "ERROR: device mismatch with query " << imageFormatInfo << TestLog::EndMessage
5515 << TestLog::Message << "vkGetPhysicalDeviceImageFormatProperties() returned " << coreResult << ", " << coreProperties << TestLog::EndMessage
5516 << TestLog::Message << "vkGetPhysicalDeviceImageFormatProperties2() returned " << extResult << ", " << extProperties << TestLog::EndMessage;
5517 TCU_FAIL("Mismatch between image format properties reported by vkGetPhysicalDeviceImageFormatProperties and vkGetPhysicalDeviceImageFormatProperties2");
5522 return tcu::TestStatus::pass("Querying image format properties succeeded");
5525 tcu::TestStatus sparseImageFormatProperties2 (Context& context, const VkFormat format, const VkImageType imageType, const VkImageTiling tiling)
5527 TestLog& log = context.getTestContext().getLog();
5529 const VkPhysicalDevice physicalDevice = context.getPhysicalDevice();
5530 const CustomInstance instance (createCustomInstanceWithExtension(context, "VK_KHR_get_physical_device_properties2"));
5531 const InstanceDriver& vki (instance.getDriver());
5533 const VkImageUsageFlags allUsageFlags = VK_IMAGE_USAGE_TRANSFER_SRC_BIT
5534 | VK_IMAGE_USAGE_TRANSFER_DST_BIT
5535 | VK_IMAGE_USAGE_SAMPLED_BIT
5536 | VK_IMAGE_USAGE_STORAGE_BIT
5537 | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
5538 | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
5539 | VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
5540 | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
5542 for (deUint32 sampleCountBit = VK_SAMPLE_COUNT_1_BIT; sampleCountBit <= VK_SAMPLE_COUNT_64_BIT; sampleCountBit = (sampleCountBit << 1u))
5544 for (VkImageUsageFlags curUsageFlags = (VkImageUsageFlags)1; curUsageFlags <= allUsageFlags; curUsageFlags++)
5546 if (!isValidImageUsageFlagCombination(curUsageFlags))
5549 const VkPhysicalDeviceSparseImageFormatInfo2 imageFormatInfo =
5551 VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2,
5555 (VkSampleCountFlagBits)sampleCountBit,
5560 deUint32 numCoreProperties = ~0u;
5561 deUint32 numExtProperties = ~0u;
5564 vki.getPhysicalDeviceSparseImageFormatProperties(physicalDevice, imageFormatInfo.format, imageFormatInfo.type, imageFormatInfo.samples, imageFormatInfo.usage, imageFormatInfo.tiling, &numCoreProperties, DE_NULL);
5565 vki.getPhysicalDeviceSparseImageFormatProperties2(physicalDevice, &imageFormatInfo, &numExtProperties, DE_NULL);
5567 if (numCoreProperties != numExtProperties)
5569 log << TestLog::Message << "ERROR: different number of properties reported for " << imageFormatInfo << TestLog::EndMessage;
5570 TCU_FAIL("Mismatch in reported property count");
5573 if (!context.getDeviceFeatures().sparseBinding)
5575 // There is no support for sparse binding, getPhysicalDeviceSparseImageFormatProperties* MUST report no properties
5576 // Only have to check one of the entrypoints as a mismatch in count is already caught.
5577 if (numCoreProperties > 0)
5579 log << TestLog::Message << "ERROR: device does not support sparse binding but claims support for " << numCoreProperties << " properties in vkGetPhysicalDeviceSparseImageFormatProperties with parameters " << imageFormatInfo << TestLog::EndMessage;
5580 TCU_FAIL("Claimed format properties inconsistent with overall sparseBinding feature");
5584 if (numCoreProperties > 0)
5586 std::vector<VkSparseImageFormatProperties> coreProperties (numCoreProperties);
5587 std::vector<VkSparseImageFormatProperties2> extProperties (numExtProperties);
5589 deMemset(&coreProperties[0], 0xcd, sizeof(VkSparseImageFormatProperties)*numCoreProperties);
5590 deMemset(&extProperties[0], 0xcd, sizeof(VkSparseImageFormatProperties2)*numExtProperties);
5592 for (deUint32 ndx = 0; ndx < numExtProperties; ++ndx)
5594 extProperties[ndx].sType = VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2;
5595 extProperties[ndx].pNext = DE_NULL;
5598 vki.getPhysicalDeviceSparseImageFormatProperties(physicalDevice, imageFormatInfo.format, imageFormatInfo.type, imageFormatInfo.samples, imageFormatInfo.usage, imageFormatInfo.tiling, &numCoreProperties, &coreProperties[0]);
5599 vki.getPhysicalDeviceSparseImageFormatProperties2(physicalDevice, &imageFormatInfo, &numExtProperties, &extProperties[0]);
5601 TCU_CHECK((size_t)numCoreProperties == coreProperties.size());
5602 TCU_CHECK((size_t)numExtProperties == extProperties.size());
5604 for (deUint32 ndx = 0; ndx < numCoreProperties; ++ndx)
5606 TCU_CHECK(extProperties[ndx].sType == VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2);
5607 TCU_CHECK(extProperties[ndx].pNext == DE_NULL);
5609 if ((deMemCmp(&coreProperties[ndx], &extProperties[ndx].properties, sizeof(VkSparseImageFormatProperties)) != 0))
5611 log << TestLog::Message << "ERROR: device mismatch with query " << imageFormatInfo << " property " << ndx << TestLog::EndMessage
5612 << TestLog::Message << "vkGetPhysicalDeviceSparseImageFormatProperties() returned " << coreProperties[ndx] << TestLog::EndMessage
5613 << TestLog::Message << "vkGetPhysicalDeviceSparseImageFormatProperties2() returned " << extProperties[ndx] << TestLog::EndMessage;
5614 TCU_FAIL("Mismatch between image format properties reported by vkGetPhysicalDeviceSparseImageFormatProperties and vkGetPhysicalDeviceSparseImageFormatProperties2");
5621 return tcu::TestStatus::pass("Querying sparse image format properties succeeded");
5624 tcu::TestStatus execImageFormatTest (Context& context, ImageFormatPropertyCase testCase)
5626 return testCase.testFunction(context, testCase.format, testCase.imageType, testCase.tiling);
5629 void createImageFormatTypeTilingTests (tcu::TestCaseGroup* testGroup, ImageFormatPropertyCase params)
5631 DE_ASSERT(params.format == VK_FORMAT_UNDEFINED);
5637 ImageFormatPropertyCase params;
5638 } s_formatRanges[] =
5641 { (VkFormat)(VK_FORMAT_UNDEFINED + 1), VK_CORE_FORMAT_LAST, params },
5644 { VK_FORMAT_G8B8G8R8_422_UNORM_KHR, (VkFormat)(VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR + 1), params }
5647 for (int rangeNdx = 0; rangeNdx < DE_LENGTH_OF_ARRAY(s_formatRanges); ++rangeNdx)
5649 const VkFormat rangeBegin = s_formatRanges[rangeNdx].begin;
5650 const VkFormat rangeEnd = s_formatRanges[rangeNdx].end;
5652 for (VkFormat format = rangeBegin; format != rangeEnd; format = (VkFormat)(format+1))
5654 const bool isYCbCr = isYCbCrFormat(format);
5655 const bool isSparse = (params.testFunction == sparseImageFormatProperties2);
5657 if (isYCbCr && isSparse)
5660 if (isYCbCr && params.imageType != VK_IMAGE_TYPE_2D)
5663 const char* const enumName = getFormatName(format);
5664 const string caseName = de::toLower(string(enumName).substr(10));
5666 params.format = format;
5668 addFunctionCase(testGroup, caseName, enumName, execImageFormatTest, params);
5673 void createImageFormatTypeTests (tcu::TestCaseGroup* testGroup, ImageFormatPropertyCase params)
5675 DE_ASSERT(params.tiling == VK_IMAGE_TILING_MAX_ENUM);
5677 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "optimal", "", createImageFormatTypeTilingTests, ImageFormatPropertyCase(params.testFunction, VK_FORMAT_UNDEFINED, params.imageType, VK_IMAGE_TILING_OPTIMAL)));
5678 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "linear", "", createImageFormatTypeTilingTests, ImageFormatPropertyCase(params.testFunction, VK_FORMAT_UNDEFINED, params.imageType, VK_IMAGE_TILING_LINEAR)));
5681 void createImageFormatTests (tcu::TestCaseGroup* testGroup, ImageFormatPropertyCase::Function testFunction)
5683 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "1d", "", createImageFormatTypeTests, ImageFormatPropertyCase(testFunction, VK_FORMAT_UNDEFINED, VK_IMAGE_TYPE_1D, VK_IMAGE_TILING_MAX_ENUM)));
5684 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "2d", "", createImageFormatTypeTests, ImageFormatPropertyCase(testFunction, VK_FORMAT_UNDEFINED, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_MAX_ENUM)));
5685 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "3d", "", createImageFormatTypeTests, ImageFormatPropertyCase(testFunction, VK_FORMAT_UNDEFINED, VK_IMAGE_TYPE_3D, VK_IMAGE_TILING_MAX_ENUM)));
5689 // Android CTS -specific tests
5694 void checkExtensions (tcu::ResultCollector& results, const set<string>& allowedExtensions, const vector<VkExtensionProperties>& reportedExtensions)
5696 for (vector<VkExtensionProperties>::const_iterator extension = reportedExtensions.begin(); extension != reportedExtensions.end(); ++extension)
5698 const string extensionName (extension->extensionName);
5699 const bool mustBeKnown = de::beginsWith(extensionName, "VK_GOOGLE_") ||
5700 de::beginsWith(extensionName, "VK_ANDROID_");
5702 if (mustBeKnown && !de::contains(allowedExtensions, extensionName))
5703 results.fail("Unknown extension: " + extensionName);
5707 tcu::TestStatus testNoUnknownExtensions (Context& context)
5709 TestLog& log = context.getTestContext().getLog();
5710 tcu::ResultCollector results (log);
5711 set<string> allowedInstanceExtensions;
5712 set<string> allowedDeviceExtensions;
5714 // All known extensions should be added to allowedExtensions:
5715 // allowedExtensions.insert("VK_GOOGLE_extension1");
5716 allowedDeviceExtensions.insert("VK_ANDROID_external_memory_android_hardware_buffer");
5717 allowedDeviceExtensions.insert("VK_GOOGLE_display_timing");
5719 // Instance extensions
5720 checkExtensions(results,
5721 allowedInstanceExtensions,
5722 enumerateInstanceExtensionProperties(context.getPlatformInterface(), DE_NULL));
5724 // Extensions exposed by instance layers
5726 const vector<VkLayerProperties> layers = enumerateInstanceLayerProperties(context.getPlatformInterface());
5728 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
5730 checkExtensions(results,
5731 allowedInstanceExtensions,
5732 enumerateInstanceExtensionProperties(context.getPlatformInterface(), layer->layerName));
5736 // Device extensions
5737 checkExtensions(results,
5738 allowedDeviceExtensions,
5739 enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), DE_NULL));
5741 // Extensions exposed by device layers
5743 const vector<VkLayerProperties> layers = enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
5745 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
5747 checkExtensions(results,
5748 allowedDeviceExtensions,
5749 enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), layer->layerName));
5753 return tcu::TestStatus(results.getResult(), results.getMessage());
5756 tcu::TestStatus testNoLayers (Context& context)
5758 TestLog& log = context.getTestContext().getLog();
5759 tcu::ResultCollector results (log);
5762 const vector<VkLayerProperties> layers = enumerateInstanceLayerProperties(context.getPlatformInterface());
5764 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
5765 results.fail(string("Instance layer enumerated: ") + layer->layerName);
5769 const vector<VkLayerProperties> layers = enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
5771 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
5772 results.fail(string("Device layer enumerated: ") + layer->layerName);
5775 return tcu::TestStatus(results.getResult(), results.getMessage());
5778 tcu::TestStatus testMandatoryExtensions (Context& context)
5780 TestLog& log = context.getTestContext().getLog();
5781 tcu::ResultCollector results (log);
5783 // Instance extensions
5785 static const string mandatoryExtensions[] =
5787 "VK_KHR_get_physical_device_properties2",
5790 for (const auto ext : mandatoryExtensions)
5792 if (!context.isInstanceFunctionalitySupported(ext))
5793 results.fail(ext + " is not supported");
5797 // Device extensions
5799 static const string mandatoryExtensions[] =
5801 "VK_KHR_maintenance1",
5804 for (const auto ext : mandatoryExtensions)
5806 if (!context.isDeviceFunctionalitySupported(ext))
5807 results.fail(ext + " is not supported");
5811 return tcu::TestStatus(results.getResult(), results.getMessage());
5818 tcu::TestCaseGroup* createFeatureInfoTests (tcu::TestContext& testCtx)
5820 de::MovePtr<tcu::TestCaseGroup> infoTests (new tcu::TestCaseGroup(testCtx, "info", "Platform Information Tests"));
5822 infoTests->addChild(createTestGroup(testCtx, "format_properties", "VkGetPhysicalDeviceFormatProperties() Tests", createFormatTests));
5823 infoTests->addChild(createTestGroup(testCtx, "image_format_properties", "VkGetPhysicalDeviceImageFormatProperties() Tests", createImageFormatTests, imageFormatProperties));
5826 de::MovePtr<tcu::TestCaseGroup> extendedPropertiesTests (new tcu::TestCaseGroup(testCtx, "get_physical_device_properties2", "VK_KHR_get_physical_device_properties2"));
5828 addFunctionCase(extendedPropertiesTests.get(), "features", "Extended Device Features", deviceFeatures2);
5829 addFunctionCase(extendedPropertiesTests.get(), "properties", "Extended Device Properties", deviceProperties2);
5830 addFunctionCase(extendedPropertiesTests.get(), "format_properties", "Extended Device Format Properties", deviceFormatProperties2);
5831 addFunctionCase(extendedPropertiesTests.get(), "queue_family_properties", "Extended Device Queue Family Properties", deviceQueueFamilyProperties2);
5832 addFunctionCase(extendedPropertiesTests.get(), "memory_properties", "Extended Device Memory Properties", deviceMemoryProperties2);
5834 infoTests->addChild(extendedPropertiesTests.release());
5838 de::MovePtr<tcu::TestCaseGroup> extendedPropertiesTests (new tcu::TestCaseGroup(testCtx, "vulkan1p2", "Vulkan 1.2 related tests"));
5840 addFunctionCase(extendedPropertiesTests.get(), "features", "Extended Vulkan 1.2 Device Features", deviceFeaturesVulkan12);
5841 addFunctionCase(extendedPropertiesTests.get(), "properties", "Extended Vulkan 1.2 Device Properties", devicePropertiesVulkan12);
5842 addFunctionCase(extendedPropertiesTests.get(), "feature_extensions_consistency", "Vulkan 1.2 consistency between Features and Extensions", deviceFeatureExtensionsConsistencyVulkan12);
5843 addFunctionCase(extendedPropertiesTests.get(), "property_extensions_consistency", "Vulkan 1.2 consistency between Properties and Extensions", devicePropertyExtensionsConsistencyVulkan12);
5844 addFunctionCase(extendedPropertiesTests.get(), "feature_bits_influence", "Validate feature bits influence on feature activation", checkSupportFeatureBitInfluence, featureBitInfluenceOnDeviceCreate);
5846 infoTests->addChild(extendedPropertiesTests.release());
5850 de::MovePtr<tcu::TestCaseGroup> limitsValidationTests (new tcu::TestCaseGroup(testCtx, "vulkan1p2_limits_validation", "Vulkan 1.2 and core extensions limits validation"));
5852 addFunctionCase(limitsValidationTests.get(), "general", "Vulkan 1.2 Limit validation", validateLimitsCheckSupport, validateLimits12);
5853 addFunctionCase(limitsValidationTests.get(), "khr_push_descriptor", "VK_KHR_push_descriptor limit validation", checkSupportKhrPushDescriptor, validateLimitsKhrPushDescriptor);
5854 addFunctionCase(limitsValidationTests.get(), "khr_multiview", "VK_KHR_multiview limit validation", checkSupportKhrMultiview, validateLimitsKhrMultiview);
5855 addFunctionCase(limitsValidationTests.get(), "ext_discard_rectangles", "VK_EXT_discard_rectangles limit validation", checkSupportExtDiscardRectangles, validateLimitsExtDiscardRectangles);
5856 addFunctionCase(limitsValidationTests.get(), "ext_sample_locations", "VK_EXT_sample_locations limit validation", checkSupportExtSampleLocations, validateLimitsExtSampleLocations);
5857 addFunctionCase(limitsValidationTests.get(), "ext_external_memory_host", "VK_EXT_external_memory_host limit validation", checkSupportExtExternalMemoryHost, validateLimitsExtExternalMemoryHost);
5858 addFunctionCase(limitsValidationTests.get(), "ext_blend_operation_advanced", "VK_EXT_blend_operation_advanced limit validation", checkSupportExtBlendOperationAdvanced, validateLimitsExtBlendOperationAdvanced);
5859 addFunctionCase(limitsValidationTests.get(), "khr_maintenance_3", "VK_KHR_maintenance3 limit validation", checkSupportKhrMaintenance3, validateLimitsKhrMaintenance3);
5860 addFunctionCase(limitsValidationTests.get(), "ext_conservative_rasterization", "VK_EXT_conservative_rasterization limit validation", checkSupportExtConservativeRasterization, validateLimitsExtConservativeRasterization);
5861 addFunctionCase(limitsValidationTests.get(), "ext_descriptor_indexing", "VK_EXT_descriptor_indexing limit validation", checkSupportExtDescriptorIndexing, validateLimitsExtDescriptorIndexing);
5862 addFunctionCase(limitsValidationTests.get(), "ext_inline_uniform_block", "VK_EXT_inline_uniform_block limit validation", checkSupportExtInlineUniformBlock, validateLimitsExtInlineUniformBlock);
5863 addFunctionCase(limitsValidationTests.get(), "ext_vertex_attribute_divisor", "VK_EXT_vertex_attribute_divisor limit validation", checkSupportExtVertexAttributeDivisor, validateLimitsExtVertexAttributeDivisor);
5864 addFunctionCase(limitsValidationTests.get(), "nv_mesh_shader", "VK_NV_mesh_shader limit validation", checkSupportNvMeshShader, validateLimitsNvMeshShader);
5865 addFunctionCase(limitsValidationTests.get(), "ext_transform_feedback", "VK_EXT_transform_feedback limit validation", checkSupportExtTransformFeedback, validateLimitsExtTransformFeedback);
5866 addFunctionCase(limitsValidationTests.get(), "fragment_density_map", "VK_EXT_fragment_density_map limit validation", checkSupportExtFragmentDensityMap, validateLimitsExtFragmentDensityMap);
5867 addFunctionCase(limitsValidationTests.get(), "nv_ray_tracing", "VK_NV_ray_tracing limit validation", checkSupportNvRayTracing, validateLimitsNvRayTracing);
5868 addFunctionCase(limitsValidationTests.get(), "timeline_semaphore", "VK_KHR_timeline_semaphore limit validation", checkSupportKhrTimelineSemaphore, validateLimitsKhrTimelineSemaphore);
5869 addFunctionCase(limitsValidationTests.get(), "ext_line_rasterization", "VK_EXT_line_rasterization limit validation", checkSupportExtLineRasterization, validateLimitsExtLineRasterization);
5871 infoTests->addChild(limitsValidationTests.release());
5874 infoTests->addChild(createTestGroup(testCtx, "image_format_properties2", "VkGetPhysicalDeviceImageFormatProperties2() Tests", createImageFormatTests, imageFormatProperties2));
5875 infoTests->addChild(createTestGroup(testCtx, "sparse_image_format_properties2", "VkGetPhysicalDeviceSparseImageFormatProperties2() Tests", createImageFormatTests, sparseImageFormatProperties2));
5878 de::MovePtr<tcu::TestCaseGroup> androidTests (new tcu::TestCaseGroup(testCtx, "android", "Android CTS Tests"));
5880 addFunctionCase(androidTests.get(), "mandatory_extensions", "Test that all mandatory extensions are supported", android::testMandatoryExtensions);
5881 addFunctionCase(androidTests.get(), "no_unknown_extensions", "Test for unknown device or instance extensions", android::testNoUnknownExtensions);
5882 addFunctionCase(androidTests.get(), "no_layers", "Test that no layers are enumerated", android::testNoLayers);
5884 infoTests->addChild(androidTests.release());
5887 return infoTests.release();
5890 void createFeatureInfoInstanceTests(tcu::TestCaseGroup* testGroup)
5892 addFunctionCase(testGroup, "physical_devices", "Physical devices", enumeratePhysicalDevices);
5893 addFunctionCase(testGroup, "physical_device_groups", "Physical devices Groups", enumeratePhysicalDeviceGroups);
5894 addFunctionCase(testGroup, "instance_layers", "Layers", enumerateInstanceLayers);
5895 addFunctionCase(testGroup, "instance_extensions", "Extensions", enumerateInstanceExtensions);
5898 void createFeatureInfoDeviceTests(tcu::TestCaseGroup* testGroup)
5900 addFunctionCase(testGroup, "device_features", "Device Features", deviceFeatures);
5901 addFunctionCase(testGroup, "device_properties", "Device Properties", deviceProperties);
5902 addFunctionCase(testGroup, "device_queue_family_properties", "Queue family properties", deviceQueueFamilyProperties);
5903 addFunctionCase(testGroup, "device_memory_properties", "Memory properties", deviceMemoryProperties);
5904 addFunctionCase(testGroup, "device_layers", "Layers", enumerateDeviceLayers);
5905 addFunctionCase(testGroup, "device_extensions", "Extensions", enumerateDeviceExtensions);
5906 addFunctionCase(testGroup, "device_no_khx_extensions", "KHX extensions", testNoKhxExtensions);
5907 addFunctionCase(testGroup, "device_memory_budget", "Memory budget", deviceMemoryBudgetProperties);
5908 addFunctionCase(testGroup, "device_mandatory_features", "Mandatory features", deviceMandatoryFeatures);
5911 void createFeatureInfoDeviceGroupTests(tcu::TestCaseGroup* testGroup)
5913 addFunctionCase(testGroup, "device_group_peer_memory_features", "Device Group peer memory features", deviceGroupPeerMemoryFeatures);