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