1 /*-------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
5 * Copyright (c) 2015 Google Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief Api Feature Query tests
22 *//*--------------------------------------------------------------------*/
24 #include "vktApiFeatureInfo.hpp"
26 #include "vktTestCaseUtil.hpp"
27 #include "vktTestGroupUtil.hpp"
29 #include "vkPlatform.hpp"
30 #include "vkStrUtil.hpp"
32 #include "vkDeviceUtil.hpp"
33 #include "vkQueryUtil.hpp"
34 #include "vkImageUtil.hpp"
35 #include "vkApiVersion.hpp"
37 #include "tcuTestLog.hpp"
38 #include "tcuFormatUtil.hpp"
39 #include "tcuTextureUtil.hpp"
40 #include "tcuResultCollector.hpp"
42 #include "deUniquePtr.hpp"
44 #include "deStringUtil.hpp"
45 #include "deSTLUtil.hpp"
65 using tcu::ScopedLogSection;
69 GUARD_SIZE = 0x20, //!< Number of bytes to check
70 GUARD_VALUE = 0xcd, //!< Data pattern
73 static const VkDeviceSize MINIMUM_REQUIRED_IMAGE_RESOURCE_SIZE = (1LLU<<31); //!< Minimum value for VkImageFormatProperties::maxResourceSize (2GiB)
77 LIMIT_FORMAT_SIGNED_INT,
78 LIMIT_FORMAT_UNSIGNED_INT,
80 LIMIT_FORMAT_DEVICE_SIZE,
95 #define LIMIT(_X_) DE_OFFSET_OF(VkPhysicalDeviceLimits, _X_),(char*)(#_X_)
96 #define FEATURE(_X_) DE_OFFSET_OF(VkPhysicalDeviceFeatures, _X_)
98 bool validateFeatureLimits(VkPhysicalDeviceProperties* properties, VkPhysicalDeviceFeatures* features, TestLog& log)
100 bool limitsOk = true;
101 VkPhysicalDeviceLimits* limits = &properties->limits;
102 struct FeatureLimitTable
106 deUint32 uintVal; //!< Format is UNSIGNED_INT
107 deInt32 intVal; //!< Format is SIGNED_INT
108 deUint64 deviceSizeVal; //!< Format is DEVICE_SIZE
109 float floatVal; //!< Format is FLOAT
112 deInt32 unsuppTableNdx;
113 } featureLimitTable[] = //!< From gitlab.khronos.org/vulkan/vulkan.git:doc/specs/vulkan/chapters/features.txt@63b23f3bb3ecd211cd6e448e2001ce1088dacd35
115 { LIMIT(maxImageDimension1D), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
116 { LIMIT(maxImageDimension2D), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
117 { LIMIT(maxImageDimension3D), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
118 { LIMIT(maxImageDimensionCube), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
119 { LIMIT(maxImageArrayLayers), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
120 { LIMIT(maxTexelBufferElements), 65536, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
121 { LIMIT(maxUniformBufferRange), 16384, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
122 { LIMIT(maxStorageBufferRange), 0, 0, 0, 0, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1 },
123 { LIMIT(maxPushConstantsSize), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
124 { LIMIT(maxMemoryAllocationCount), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
125 { LIMIT(maxSamplerAllocationCount), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE , -1 },
126 { LIMIT(bufferImageGranularity), 0, 0, 131072, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1 },
127 { LIMIT(sparseAddressSpaceSize), 0, 0, 2UL*1024*1024*1024, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MIN, -1 },
128 { LIMIT(maxBoundDescriptorSets), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
129 { LIMIT(maxPerStageDescriptorSamplers), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
130 { LIMIT(maxPerStageDescriptorUniformBuffers), 12, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
131 { LIMIT(maxPerStageDescriptorStorageBuffers), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
132 { LIMIT(maxPerStageDescriptorSampledImages), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
133 { LIMIT(maxPerStageDescriptorStorageImages), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
134 { LIMIT(maxPerStageDescriptorInputAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
135 { LIMIT(maxPerStageResources), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE , -1 },
136 { LIMIT(maxDescriptorSetSamplers), 96, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
137 { LIMIT(maxDescriptorSetUniformBuffers), 72, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
138 { LIMIT(maxDescriptorSetUniformBuffersDynamic), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
139 { LIMIT(maxDescriptorSetStorageBuffers), 24, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
140 { LIMIT(maxDescriptorSetStorageBuffersDynamic), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
141 { LIMIT(maxDescriptorSetSampledImages), 96, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
142 { LIMIT(maxDescriptorSetStorageImages), 24, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
143 { LIMIT(maxDescriptorSetInputAttachments), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE , -1 },
144 { LIMIT(maxVertexInputAttributes), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
145 { LIMIT(maxVertexInputBindings), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
146 { LIMIT(maxVertexInputAttributeOffset), 2047, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
147 { LIMIT(maxVertexInputBindingStride), 2048, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
148 { LIMIT(maxVertexOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
149 { LIMIT(maxTessellationGenerationLevel), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
150 { LIMIT(maxTessellationPatchSize), 32, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
151 { LIMIT(maxTessellationControlPerVertexInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
152 { LIMIT(maxTessellationControlPerVertexOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
153 { LIMIT(maxTessellationControlPerPatchOutputComponents), 120, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
154 { LIMIT(maxTessellationControlTotalOutputComponents), 2048, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
155 { LIMIT(maxTessellationEvaluationInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
156 { LIMIT(maxTessellationEvaluationOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
157 { LIMIT(maxGeometryShaderInvocations), 32, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
158 { LIMIT(maxGeometryInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
159 { LIMIT(maxGeometryOutputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
160 { LIMIT(maxGeometryOutputVertices), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
161 { LIMIT(maxGeometryTotalOutputComponents), 1024, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
162 { LIMIT(maxFragmentInputComponents), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
163 { LIMIT(maxFragmentOutputAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
164 { LIMIT(maxFragmentDualSrcAttachments), 1, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
165 { LIMIT(maxFragmentCombinedOutputResources), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
166 { LIMIT(maxComputeSharedMemorySize), 16384, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
167 { LIMIT(maxComputeWorkGroupCount[0]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
168 { LIMIT(maxComputeWorkGroupCount[1]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
169 { LIMIT(maxComputeWorkGroupCount[2]), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
170 { LIMIT(maxComputeWorkGroupInvocations), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
171 { LIMIT(maxComputeWorkGroupSize[0]), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
172 { LIMIT(maxComputeWorkGroupSize[1]), 128, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
173 { LIMIT(maxComputeWorkGroupSize[2]), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
174 { LIMIT(subPixelPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
175 { LIMIT(subTexelPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
176 { LIMIT(mipmapPrecisionBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
177 { LIMIT(maxDrawIndexedIndexValue), (deUint32)~0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
178 { LIMIT(maxDrawIndirectCount), 65535, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
179 { LIMIT(maxSamplerLodBias), 0, 0, 0, 2.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
180 { LIMIT(maxSamplerAnisotropy), 0, 0, 0, 16.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
181 { LIMIT(maxViewports), 16, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
182 { LIMIT(maxViewportDimensions[0]), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
183 { LIMIT(maxViewportDimensions[1]), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN , -1 },
184 { LIMIT(viewportBoundsRange[0]), 0, 0, 0, -8192.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
185 { LIMIT(viewportBoundsRange[1]), 0, 0, 0, 8191.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
186 { LIMIT(viewportSubPixelBits), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
187 { LIMIT(minMemoryMapAlignment), 64, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
188 { LIMIT(minTexelBufferOffsetAlignment), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MAX, -1 },
189 { LIMIT(minUniformBufferOffsetAlignment), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MAX, -1 },
190 { LIMIT(minStorageBufferOffsetAlignment), 256, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MAX, -1 },
191 { LIMIT(minTexelOffset), 0, -8, 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MAX, -1 },
192 { LIMIT(maxTexelOffset), 7, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
193 { LIMIT(minTexelGatherOffset), 0, -8, 0, 0.0f, LIMIT_FORMAT_SIGNED_INT, LIMIT_TYPE_MAX, -1 },
194 { LIMIT(maxTexelGatherOffset), 7, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
195 { LIMIT(minInterpolationOffset), 0, 0, 0, -0.5f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
196 { LIMIT(maxInterpolationOffset), 0, 0, 0, 0.5f - (1.0f/deFloatPow(2.0f, (float)limits->subPixelInterpolationOffsetBits)), LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
197 { LIMIT(subPixelInterpolationOffsetBits), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
198 { LIMIT(maxFramebufferWidth), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
199 { LIMIT(maxFramebufferHeight), 4096, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
200 { LIMIT(maxFramebufferLayers), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
201 { LIMIT(framebufferColorSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
202 { LIMIT(framebufferDepthSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
203 { LIMIT(framebufferStencilSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
204 { LIMIT(framebufferNoAttachmentsSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
205 { LIMIT(maxColorAttachments), 4, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
206 { LIMIT(sampledImageColorSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
207 { LIMIT(sampledImageIntegerSampleCounts), VK_SAMPLE_COUNT_1_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
208 { LIMIT(sampledImageDepthSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
209 { LIMIT(sampledImageStencilSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
210 { LIMIT(storageImageSampleCounts), VK_SAMPLE_COUNT_1_BIT|VK_SAMPLE_COUNT_4_BIT, 0, 0, 0.0f, LIMIT_FORMAT_BITMASK, LIMIT_TYPE_MIN, -1 },
211 { LIMIT(maxSampleMaskWords), 1, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
212 { LIMIT(timestampComputeAndGraphics), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1 },
213 { LIMIT(timestampPeriod), 0, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1 },
214 { LIMIT(maxClipDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
215 { LIMIT(maxCullDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
216 { LIMIT(maxCombinedClipAndCullDistances), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_MIN, -1 },
217 { LIMIT(discreteQueuePriorities), 8, 0, 0, 0.0f, LIMIT_FORMAT_UNSIGNED_INT, LIMIT_TYPE_NONE, -1 },
218 { LIMIT(pointSizeRange[0]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
219 { LIMIT(pointSizeRange[1]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
220 { LIMIT(pointSizeRange[0]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
221 { LIMIT(pointSizeRange[1]), 0, 0, 0, 64.0f - limits->pointSizeGranularity , LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
222 { LIMIT(lineWidthRange[0]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
223 { LIMIT(lineWidthRange[1]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
224 { LIMIT(lineWidthRange[0]), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
225 { LIMIT(lineWidthRange[1]), 0, 0, 0, 8.0f - limits->lineWidthGranularity, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MIN, -1 },
226 { LIMIT(pointSizeGranularity), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
227 { LIMIT(lineWidthGranularity), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_MAX, -1 },
228 { LIMIT(strictLines), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_NONE, -1 },
229 { LIMIT(standardSampleLocations), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_NONE, -1 },
230 { LIMIT(optimalBufferCopyOffsetAlignment), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_NONE, -1 },
231 { LIMIT(optimalBufferCopyRowPitchAlignment), 0, 0, 0, 1.0f, LIMIT_FORMAT_FLOAT, LIMIT_TYPE_NONE, -1 },
232 { LIMIT(nonCoherentAtomSize), 0, 0, 128, 0.0f, LIMIT_FORMAT_DEVICE_SIZE, LIMIT_TYPE_MAX, -1 },
235 struct UnsupportedFeatureLimitTable
237 deUint32 limitOffset;
239 deUint32 featureOffset;
240 deUint32 uintVal; //!< Format is UNSIGNED_INT
241 deInt32 intVal; //!< Format is SIGNED_INT
242 deUint64 deviceSizeVal; //!< Format is DEVICE_SIZE
243 float floatVal; //!< Format is FLOAT
244 } unsupportedFeatureTable[] =
246 { LIMIT(sparseAddressSpaceSize), FEATURE(sparseBinding), 0, 0, 0, 0.0f },
247 { LIMIT(maxTessellationGenerationLevel), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
248 { LIMIT(maxTessellationPatchSize), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
249 { LIMIT(maxTessellationControlPerVertexInputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
250 { LIMIT(maxTessellationControlPerVertexOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
251 { LIMIT(maxTessellationControlPerPatchOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
252 { LIMIT(maxTessellationControlTotalOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
253 { LIMIT(maxTessellationEvaluationInputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
254 { LIMIT(maxTessellationEvaluationOutputComponents), FEATURE(tessellationShader), 0, 0, 0, 0.0f },
255 { LIMIT(maxGeometryShaderInvocations), FEATURE(geometryShader), 0, 0, 0, 0.0f },
256 { LIMIT(maxGeometryInputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f },
257 { LIMIT(maxGeometryOutputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f },
258 { LIMIT(maxGeometryOutputVertices), FEATURE(geometryShader), 0, 0, 0, 0.0f },
259 { LIMIT(maxGeometryTotalOutputComponents), FEATURE(geometryShader), 0, 0, 0, 0.0f },
260 { LIMIT(maxFragmentDualSrcAttachments), FEATURE(dualSrcBlend), 0, 0, 0, 0.0f },
261 { LIMIT(maxDrawIndexedIndexValue), FEATURE(fullDrawIndexUint32), (1<<24)-1, 0, 0, 0.0f },
262 { LIMIT(maxDrawIndirectCount), FEATURE(multiDrawIndirect), 1, 0, 0, 0.0f },
263 { LIMIT(maxSamplerAnisotropy), FEATURE(samplerAnisotropy), 1, 0, 0, 0.0f },
264 { LIMIT(maxViewports), FEATURE(multiViewport), 1, 0, 0, 0.0f },
265 { LIMIT(minTexelGatherOffset), FEATURE(shaderImageGatherExtended), 0, 0, 0, 0.0f },
266 { LIMIT(maxTexelGatherOffset), FEATURE(shaderImageGatherExtended), 0, 0, 0, 0.0f },
267 { LIMIT(minInterpolationOffset), FEATURE(sampleRateShading), 0, 0, 0, 0.0f },
268 { LIMIT(maxInterpolationOffset), FEATURE(sampleRateShading), 0, 0, 0, 0.0f },
269 { LIMIT(subPixelInterpolationOffsetBits), FEATURE(sampleRateShading), 0, 0, 0, 0.0f },
270 { LIMIT(storageImageSampleCounts), FEATURE(shaderStorageImageMultisample), VK_SAMPLE_COUNT_1_BIT, 0, 0, 0.0f },
271 { LIMIT(maxClipDistances), FEATURE(shaderClipDistance), 0, 0, 0, 0.0f },
272 { LIMIT(maxCullDistances), FEATURE(shaderClipDistance), 0, 0, 0, 0.0f },
273 { LIMIT(maxCombinedClipAndCullDistances), FEATURE(shaderClipDistance), 0, 0, 0, 0.0f },
274 { LIMIT(pointSizeRange[0]), FEATURE(largePoints), 0, 0, 0, 1.0f },
275 { LIMIT(pointSizeRange[1]), FEATURE(largePoints), 0, 0, 0, 1.0f },
276 { LIMIT(lineWidthRange[0]), FEATURE(wideLines), 0, 0, 0, 1.0f },
277 { LIMIT(lineWidthRange[1]), FEATURE(wideLines), 0, 0, 0, 1.0f },
278 { LIMIT(pointSizeGranularity), FEATURE(largePoints), 0, 0, 0, 0.0f },
279 { LIMIT(lineWidthGranularity), FEATURE(wideLines), 0, 0, 0, 0.0f }
282 log << TestLog::Message << *limits << TestLog::EndMessage;
284 //!< First build a map from limit to unsupported table index
285 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
287 for (deUint32 unsuppNdx = 0; unsuppNdx < DE_LENGTH_OF_ARRAY(unsupportedFeatureTable); unsuppNdx++)
289 if (unsupportedFeatureTable[unsuppNdx].limitOffset == featureLimitTable[ndx].offset)
291 featureLimitTable[ndx].unsuppTableNdx = unsuppNdx;
297 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(featureLimitTable); ndx++)
299 switch (featureLimitTable[ndx].format)
301 case LIMIT_FORMAT_UNSIGNED_INT:
303 deUint32 limitToCheck = featureLimitTable[ndx].uintVal;
304 if (featureLimitTable[ndx].unsuppTableNdx != -1)
306 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
307 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].uintVal;
310 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
313 if (*((deUint32*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
315 log << TestLog::Message << "limit Validation failed " << featureLimitTable[ndx].name
316 << " not valid-limit type MIN - actual is "
317 << *((deUint32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
321 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
323 if (*((deUint32*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
325 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
326 << " not valid-limit type MAX - actual is "
327 << *((deUint32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
334 case LIMIT_FORMAT_FLOAT:
336 float limitToCheck = featureLimitTable[ndx].floatVal;
337 if (featureLimitTable[ndx].unsuppTableNdx != -1)
339 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
340 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].floatVal;
343 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
345 if (*((float*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
347 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
348 << " not valid-limit type MIN - actual is "
349 << *((float*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
353 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
355 if (*((float*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
357 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
358 << " not valid-limit type MAX actual is "
359 << *((float*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
366 case LIMIT_FORMAT_SIGNED_INT:
368 deInt32 limitToCheck = featureLimitTable[ndx].intVal;
369 if (featureLimitTable[ndx].unsuppTableNdx != -1)
371 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
372 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].intVal;
374 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
376 if (*((deInt32*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
378 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
379 << " not valid-limit type MIN actual is "
380 << *((deInt32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
384 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
386 if (*((deInt32*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
388 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
389 << " not valid-limit type MAX actual is "
390 << *((deInt32*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
397 case LIMIT_FORMAT_DEVICE_SIZE:
399 deUint64 limitToCheck = featureLimitTable[ndx].deviceSizeVal;
400 if (featureLimitTable[ndx].unsuppTableNdx != -1)
402 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
403 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].deviceSizeVal;
406 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
408 if (*((deUint64*)((deUint8*)limits+featureLimitTable[ndx].offset)) < limitToCheck)
410 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
411 << " not valid-limit type MIN actual is "
412 << *((deUint64*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
416 else if (featureLimitTable[ndx].type == LIMIT_TYPE_MAX)
418 if (*((deUint64*)((deUint8*)limits+featureLimitTable[ndx].offset)) > limitToCheck)
420 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
421 << " not valid-limit type MAX actual is "
422 << *((deUint64*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
429 case LIMIT_FORMAT_BITMASK:
431 deUint32 limitToCheck = featureLimitTable[ndx].uintVal;
432 if (featureLimitTable[ndx].unsuppTableNdx != -1)
434 if (*((VkBool32*)((deUint8*)features+unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].featureOffset)) == VK_FALSE)
435 limitToCheck = unsupportedFeatureTable[featureLimitTable[ndx].unsuppTableNdx].uintVal;
438 if (featureLimitTable[ndx].type == LIMIT_TYPE_MIN)
440 if ((*((deUint32*)((deUint8*)limits+featureLimitTable[ndx].offset)) & limitToCheck) != limitToCheck)
442 log << TestLog::Message << "limit validation failed, " << featureLimitTable[ndx].name
443 << " not valid-limit type bitmask actual is "
444 << *((deUint64*)((deUint8*)limits + featureLimitTable[ndx].offset)) << TestLog::EndMessage;
457 for (deUint32 ndx = 0; ndx < DE_LENGTH_OF_ARRAY(limits->maxViewportDimensions); ndx++)
459 if (limits->maxImageDimension2D > limits->maxViewportDimensions[ndx])
461 log << TestLog::Message << "limit validation failed, maxImageDimension2D of " << limits->maxImageDimension2D
462 << "is larger than maxViewportDimension[" << ndx << "] of " << limits->maxViewportDimensions[ndx] << TestLog::EndMessage;
467 if (limits->viewportBoundsRange[0] > -2 * limits->maxViewportDimensions[0])
469 log << TestLog::Message << "limit validation failed, viewPortBoundsRange[0] of " << limits->viewportBoundsRange[0]
470 << "is larger than -2*maxViewportDimension[0] of " << -2*limits->maxViewportDimensions[0] << TestLog::EndMessage;
474 if (limits->viewportBoundsRange[1] < 2 * limits->maxViewportDimensions[1] - 1)
476 log << TestLog::Message << "limit validation failed, viewportBoundsRange[1] of " << limits->viewportBoundsRange[1]
477 << "is less than 2*maxViewportDimension[1] of " << 2*limits->maxViewportDimensions[1] << TestLog::EndMessage;
484 tcu::TestStatus enumeratePhysicalDevices (Context& context)
486 TestLog& log = context.getTestContext().getLog();
487 const vector<VkPhysicalDevice> devices = enumeratePhysicalDevices(context.getInstanceInterface(), context.getInstance());
489 log << TestLog::Integer("NumDevices", "Number of devices", "", QP_KEY_TAG_NONE, deInt64(devices.size()));
491 for (size_t ndx = 0; ndx < devices.size(); ndx++)
492 log << TestLog::Message << ndx << ": " << devices[ndx] << TestLog::EndMessage;
494 return tcu::TestStatus::pass("Enumerating devices succeeded");
498 void collectDuplicates (set<T>& duplicates, const vector<T>& values)
502 for (size_t ndx = 0; ndx < values.size(); ndx++)
504 const T& value = values[ndx];
506 if (!seen.insert(value).second)
507 duplicates.insert(value);
511 bool checkDuplicates (TestLog& log, const char* what, const vector<string>& values)
513 set<string> duplicates;
515 collectDuplicates(duplicates, values);
517 if (duplicates.empty())
523 for (set<string>::const_iterator iter = duplicates.begin(); iter != duplicates.end(); ++iter)
524 log << TestLog::Message << "Duplicate " << what << ": " << *iter << TestLog::EndMessage;
530 bool checkDuplicateExtensions (TestLog& log, const vector<string>& extensions)
532 return checkDuplicates(log, "extension", extensions);
535 bool checkDuplicateLayers (TestLog& log, const vector<string>& layers)
537 return checkDuplicates(log, "layer", layers);
540 tcu::TestStatus enumerateInstanceLayers (Context& context)
542 TestLog& log = context.getTestContext().getLog();
543 const vector<VkLayerProperties> properties = enumerateInstanceLayerProperties(context.getPlatformInterface());
544 vector<string> layerNames;
546 for (size_t ndx = 0; ndx < properties.size(); ndx++)
548 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
550 layerNames.push_back(properties[ndx].layerName);
553 if (checkDuplicateLayers(log, layerNames))
554 return tcu::TestStatus::pass("Enumerating layers succeeded");
556 return tcu::TestStatus::fail("Duplicate layers");
559 tcu::TestStatus enumerateInstanceExtensions (Context& context)
561 TestLog& log = context.getTestContext().getLog();
562 bool hasDuplicateExtensions = false;
565 const ScopedLogSection section (log, "Global", "Global Extensions");
566 const vector<VkExtensionProperties> properties = enumerateInstanceExtensionProperties(context.getPlatformInterface(), DE_NULL);
567 vector<string> extensionNames;
569 for (size_t ndx = 0; ndx < properties.size(); ndx++)
571 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
573 extensionNames.push_back(properties[ndx].extensionName);
576 if (!checkDuplicateExtensions(log, extensionNames))
577 hasDuplicateExtensions = true;
581 const vector<VkLayerProperties> layers = enumerateInstanceLayerProperties(context.getPlatformInterface());
583 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
585 const ScopedLogSection section (log, layer->layerName, string("Layer: ") + layer->layerName);
586 const vector<VkExtensionProperties> properties = enumerateInstanceExtensionProperties(context.getPlatformInterface(), layer->layerName);
587 vector<string> extensionNames;
589 for (size_t extNdx = 0; extNdx < properties.size(); extNdx++)
591 log << TestLog::Message << extNdx << ": " << properties[extNdx] << TestLog::EndMessage;
593 extensionNames.push_back(properties[extNdx].extensionName);
596 if (!checkDuplicateExtensions(log, extensionNames))
597 hasDuplicateExtensions = true;
601 if (hasDuplicateExtensions)
602 return tcu::TestStatus::fail("Duplicate extensions");
604 return tcu::TestStatus::pass("Enumerating extensions succeeded");
607 tcu::TestStatus enumerateDeviceLayers (Context& context)
609 TestLog& log = context.getTestContext().getLog();
610 const vector<VkLayerProperties> properties = vk::enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
611 vector<string> layerNames;
613 for (size_t ndx = 0; ndx < properties.size(); ndx++)
615 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
617 layerNames.push_back(properties[ndx].layerName);
620 if (checkDuplicateLayers(log, layerNames))
621 return tcu::TestStatus::pass("Enumerating layers succeeded");
623 return tcu::TestStatus::fail("Duplicate layers");
626 tcu::TestStatus enumerateDeviceExtensions (Context& context)
628 TestLog& log = context.getTestContext().getLog();
629 bool hasDuplicateExtensions = false;
632 const ScopedLogSection section (log, "Global", "Global Extensions");
633 const vector<VkExtensionProperties> properties = enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), DE_NULL);
634 vector<string> extensionNames;
636 for (size_t ndx = 0; ndx < properties.size(); ndx++)
638 log << TestLog::Message << ndx << ": " << properties[ndx] << TestLog::EndMessage;
640 extensionNames.push_back(properties[ndx].extensionName);
643 if (!checkDuplicateExtensions(log, extensionNames))
644 hasDuplicateExtensions = true;
648 const vector<VkLayerProperties> layers = enumerateDeviceLayerProperties(context.getInstanceInterface(), context.getPhysicalDevice());
650 for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
652 const ScopedLogSection section (log, layer->layerName, string("Layer: ") + layer->layerName);
653 const vector<VkExtensionProperties> properties = enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), layer->layerName);
654 vector<string> extensionNames;
656 for (size_t extNdx = 0; extNdx < properties.size(); extNdx++)
658 log << TestLog::Message << extNdx << ": " << properties[extNdx] << TestLog::EndMessage;
661 extensionNames.push_back(properties[extNdx].extensionName);
664 if (!checkDuplicateExtensions(log, extensionNames))
665 hasDuplicateExtensions = true;
669 if (hasDuplicateExtensions)
670 return tcu::TestStatus::fail("Duplicate extensions");
672 return tcu::TestStatus::pass("Enumerating extensions succeeded");
675 #define VK_SIZE_OF(STRUCT, MEMBER) (sizeof(((STRUCT*)0)->MEMBER))
676 #define OFFSET_TABLE_ENTRY(STRUCT, MEMBER) { DE_OFFSET_OF(STRUCT, MEMBER), VK_SIZE_OF(STRUCT, MEMBER) }
678 tcu::TestStatus deviceFeatures (Context& context)
680 TestLog& log = context.getTestContext().getLog();
681 VkPhysicalDeviceFeatures* features;
682 deUint8 buffer[sizeof(VkPhysicalDeviceFeatures) + GUARD_SIZE];
684 const QueryMemberTableEntry featureOffsetTable[] =
686 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, robustBufferAccess),
687 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fullDrawIndexUint32),
688 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, imageCubeArray),
689 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, independentBlend),
690 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, geometryShader),
691 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, tessellationShader),
692 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sampleRateShading),
693 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, dualSrcBlend),
694 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, logicOp),
695 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, multiDrawIndirect),
696 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, drawIndirectFirstInstance),
697 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthClamp),
698 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthBiasClamp),
699 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fillModeNonSolid),
700 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, depthBounds),
701 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, wideLines),
702 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, largePoints),
703 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, alphaToOne),
704 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, multiViewport),
705 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, samplerAnisotropy),
706 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionETC2),
707 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionASTC_LDR),
708 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, textureCompressionBC),
709 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, occlusionQueryPrecise),
710 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, pipelineStatisticsQuery),
711 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, vertexPipelineStoresAndAtomics),
712 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, fragmentStoresAndAtomics),
713 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderTessellationAndGeometryPointSize),
714 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderImageGatherExtended),
715 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageExtendedFormats),
716 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageMultisample),
717 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageReadWithoutFormat),
718 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageWriteWithoutFormat),
719 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderUniformBufferArrayDynamicIndexing),
720 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderSampledImageArrayDynamicIndexing),
721 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageBufferArrayDynamicIndexing),
722 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderStorageImageArrayDynamicIndexing),
723 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderClipDistance),
724 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderCullDistance),
725 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderFloat64),
726 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderInt64),
727 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderInt16),
728 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderResourceResidency),
729 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, shaderResourceMinLod),
730 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseBinding),
731 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyBuffer),
732 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyImage2D),
733 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyImage3D),
734 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency2Samples),
735 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency4Samples),
736 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency8Samples),
737 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidency16Samples),
738 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, sparseResidencyAliased),
739 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, variableMultisampleRate),
740 OFFSET_TABLE_ENTRY(VkPhysicalDeviceFeatures, inheritedQueries),
745 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
746 features = reinterpret_cast<VkPhysicalDeviceFeatures*>(buffer);
748 context.getInstanceInterface().getPhysicalDeviceFeatures(context.getPhysicalDevice(), features);
750 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
751 << TestLog::Message << *features << TestLog::EndMessage;
753 if (!features->robustBufferAccess)
754 return tcu::TestStatus::fail("robustBufferAccess is not supported");
756 for (int ndx = 0; ndx < GUARD_SIZE; ndx++)
758 if (buffer[ndx + sizeof(VkPhysicalDeviceFeatures)] != GUARD_VALUE)
760 log << TestLog::Message << "deviceFeatures - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
761 return tcu::TestStatus::fail("deviceFeatures buffer overflow");
765 if (!validateInitComplete(context.getPhysicalDevice(), &InstanceInterface::getPhysicalDeviceFeatures, context.getInstanceInterface(), featureOffsetTable))
767 log << TestLog::Message << "deviceFeatures - VkPhysicalDeviceFeatures not completely initialized" << TestLog::EndMessage;
768 return tcu::TestStatus::fail("deviceFeatures incomplete initialization");
772 return tcu::TestStatus::pass("Query succeeded");
775 tcu::TestStatus deviceProperties (Context& context)
777 TestLog& log = context.getTestContext().getLog();
778 VkPhysicalDeviceProperties* props;
779 VkPhysicalDeviceFeatures features;
780 deUint8 buffer[sizeof(VkPhysicalDeviceProperties) + GUARD_SIZE];
782 const QueryMemberTableEntry physicalDevicePropertiesOffsetTable[] =
784 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, apiVersion),
785 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, driverVersion),
786 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, vendorID),
787 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, deviceID),
788 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, deviceType),
789 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, pipelineCacheUUID),
790 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension1D),
791 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension2D),
792 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimension3D),
793 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageDimensionCube),
794 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxImageArrayLayers),
795 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelBufferElements),
796 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxUniformBufferRange),
797 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxStorageBufferRange),
798 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPushConstantsSize),
799 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxMemoryAllocationCount),
800 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerAllocationCount),
801 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.bufferImageGranularity),
802 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sparseAddressSpaceSize),
803 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxBoundDescriptorSets),
804 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorSamplers),
805 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorUniformBuffers),
806 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorStorageBuffers),
807 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorSampledImages),
808 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorStorageImages),
809 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageDescriptorInputAttachments),
810 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxPerStageResources),
811 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetSamplers),
812 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetUniformBuffers),
813 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetUniformBuffersDynamic),
814 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageBuffers),
815 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageBuffersDynamic),
816 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetSampledImages),
817 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetStorageImages),
818 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDescriptorSetInputAttachments),
819 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputAttributes),
820 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputBindings),
821 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputAttributeOffset),
822 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexInputBindingStride),
823 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxVertexOutputComponents),
824 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationGenerationLevel),
825 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationPatchSize),
826 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerVertexInputComponents),
827 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerVertexOutputComponents),
828 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlPerPatchOutputComponents),
829 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationControlTotalOutputComponents),
830 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationEvaluationInputComponents),
831 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTessellationEvaluationOutputComponents),
832 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryShaderInvocations),
833 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryInputComponents),
834 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryOutputComponents),
835 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryOutputVertices),
836 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxGeometryTotalOutputComponents),
837 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentInputComponents),
838 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentOutputAttachments),
839 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentDualSrcAttachments),
840 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFragmentCombinedOutputResources),
841 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeSharedMemorySize),
842 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupCount[3]),
843 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupInvocations),
844 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxComputeWorkGroupSize[3]),
845 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subPixelPrecisionBits),
846 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subTexelPrecisionBits),
847 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.mipmapPrecisionBits),
848 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDrawIndexedIndexValue),
849 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxDrawIndirectCount),
850 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerLodBias),
851 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSamplerAnisotropy),
852 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxViewports),
853 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxViewportDimensions[2]),
854 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.viewportBoundsRange[2]),
855 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.viewportSubPixelBits),
856 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minMemoryMapAlignment),
857 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelBufferOffsetAlignment),
858 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minUniformBufferOffsetAlignment),
859 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minStorageBufferOffsetAlignment),
860 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelOffset),
861 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelOffset),
862 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minTexelGatherOffset),
863 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxTexelGatherOffset),
864 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.minInterpolationOffset),
865 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxInterpolationOffset),
866 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.subPixelInterpolationOffsetBits),
867 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferWidth),
868 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferHeight),
869 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxFramebufferLayers),
870 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferColorSampleCounts),
871 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferDepthSampleCounts),
872 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferStencilSampleCounts),
873 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.framebufferNoAttachmentsSampleCounts),
874 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxColorAttachments),
875 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageColorSampleCounts),
876 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageIntegerSampleCounts),
877 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageDepthSampleCounts),
878 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.sampledImageStencilSampleCounts),
879 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.storageImageSampleCounts),
880 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxSampleMaskWords),
881 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.timestampComputeAndGraphics),
882 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.timestampPeriod),
883 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxClipDistances),
884 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxCullDistances),
885 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.maxCombinedClipAndCullDistances),
886 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.discreteQueuePriorities),
887 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.pointSizeRange[2]),
888 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.lineWidthRange[2]),
889 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.pointSizeGranularity),
890 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.lineWidthGranularity),
891 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.strictLines),
892 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.standardSampleLocations),
893 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.optimalBufferCopyOffsetAlignment),
894 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.optimalBufferCopyRowPitchAlignment),
895 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, limits.nonCoherentAtomSize),
896 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard2DBlockShape),
897 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard2DMultisampleBlockShape),
898 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyStandard3DBlockShape),
899 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyAlignedMipSize),
900 OFFSET_TABLE_ENTRY(VkPhysicalDeviceProperties, sparseProperties.residencyNonResidentStrict),
904 props = reinterpret_cast<VkPhysicalDeviceProperties*>(buffer);
905 deMemset(props, GUARD_VALUE, sizeof(buffer));
907 context.getInstanceInterface().getPhysicalDeviceProperties(context.getPhysicalDevice(), props);
908 context.getInstanceInterface().getPhysicalDeviceFeatures(context.getPhysicalDevice(), &features);
910 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
911 << TestLog::Message << *props << TestLog::EndMessage;
913 if (!validateFeatureLimits(props, &features, log))
914 return tcu::TestStatus::fail("deviceProperties - feature limits failed");
916 for (int ndx = 0; ndx < GUARD_SIZE; ndx++)
918 if (buffer[ndx + sizeof(VkPhysicalDeviceProperties)] != GUARD_VALUE)
920 log << TestLog::Message << "deviceProperties - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
921 return tcu::TestStatus::fail("deviceProperties buffer overflow");
925 if (!validateInitComplete(context.getPhysicalDevice(), &InstanceInterface::getPhysicalDeviceProperties, context.getInstanceInterface(), physicalDevicePropertiesOffsetTable))
927 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceProperties not completely initialized" << TestLog::EndMessage;
928 return tcu::TestStatus::fail("deviceProperties incomplete initialization");
931 // Check if deviceName string is properly terminated.
932 if (deStrnlen(props->deviceName, VK_MAX_PHYSICAL_DEVICE_NAME_SIZE) == VK_MAX_PHYSICAL_DEVICE_NAME_SIZE)
934 log << TestLog::Message << "deviceProperties - VkPhysicalDeviceProperties deviceName not properly initialized" << TestLog::EndMessage;
935 return tcu::TestStatus::fail("deviceProperties incomplete initialization");
939 const ApiVersion deviceVersion = unpackVersion(props->apiVersion);
940 const ApiVersion deqpVersion = unpackVersion(VK_API_VERSION);
942 if (deviceVersion.majorNum != deqpVersion.majorNum)
944 log << TestLog::Message << "deviceProperties - API Major Version " << deviceVersion.majorNum << " is not valid" << TestLog::EndMessage;
945 return tcu::TestStatus::fail("deviceProperties apiVersion not valid");
948 if (deviceVersion.minorNum > deqpVersion.minorNum)
950 log << TestLog::Message << "deviceProperties - API Minor Version " << deviceVersion.minorNum << " is not valid for this version of dEQP" << TestLog::EndMessage;
951 return tcu::TestStatus::fail("deviceProperties apiVersion not valid");
955 return tcu::TestStatus::pass("DeviceProperites query succeeded");
958 tcu::TestStatus deviceQueueFamilyProperties (Context& context)
960 TestLog& log = context.getTestContext().getLog();
961 const vector<VkQueueFamilyProperties> queueProperties = getPhysicalDeviceQueueFamilyProperties(context.getInstanceInterface(), context.getPhysicalDevice());
963 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage;
965 for (size_t queueNdx = 0; queueNdx < queueProperties.size(); queueNdx++)
966 log << TestLog::Message << queueNdx << ": " << queueProperties[queueNdx] << TestLog::EndMessage;
968 return tcu::TestStatus::pass("Querying queue properties succeeded");
971 tcu::TestStatus deviceMemoryProperties (Context& context)
973 TestLog& log = context.getTestContext().getLog();
974 VkPhysicalDeviceMemoryProperties* memProps;
975 deUint8 buffer[sizeof(VkPhysicalDeviceMemoryProperties) + GUARD_SIZE];
977 memProps = reinterpret_cast<VkPhysicalDeviceMemoryProperties*>(buffer);
978 deMemset(buffer, GUARD_VALUE, sizeof(buffer));
980 context.getInstanceInterface().getPhysicalDeviceMemoryProperties(context.getPhysicalDevice(), memProps);
982 log << TestLog::Message << "device = " << context.getPhysicalDevice() << TestLog::EndMessage
983 << TestLog::Message << *memProps << TestLog::EndMessage;
985 for (deInt32 ndx = 0; ndx < GUARD_SIZE; ndx++)
987 if (buffer[ndx + sizeof(VkPhysicalDeviceMemoryProperties)] != GUARD_VALUE)
989 log << TestLog::Message << "deviceMemoryProperties - Guard offset " << ndx << " not valid" << TestLog::EndMessage;
990 return tcu::TestStatus::fail("deviceMemoryProperties buffer overflow");
994 if (memProps->memoryHeapCount >= VK_MAX_MEMORY_HEAPS)
996 log << TestLog::Message << "deviceMemoryProperties - HeapCount larger than " << (deUint32)VK_MAX_MEMORY_HEAPS << TestLog::EndMessage;
997 return tcu::TestStatus::fail("deviceMemoryProperties HeapCount too large");
1000 if (memProps->memoryHeapCount == 1)
1002 if ((memProps->memoryHeaps[0].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) == 0)
1004 log << TestLog::Message << "deviceMemoryProperties - Single heap is not marked DEVICE_LOCAL" << TestLog::EndMessage;
1005 return tcu::TestStatus::fail("deviceMemoryProperties invalid HeapFlags");
1009 const VkMemoryPropertyFlags validPropertyFlags[] =
1012 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
1013 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
1014 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
1015 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
1016 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
1017 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
1018 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_CACHED_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
1019 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT|VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT
1022 const VkMemoryPropertyFlags requiredPropertyFlags[] =
1024 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT|VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
1027 bool requiredFlagsFound[DE_LENGTH_OF_ARRAY(requiredPropertyFlags)];
1028 std::fill(DE_ARRAY_BEGIN(requiredFlagsFound), DE_ARRAY_END(requiredFlagsFound), false);
1030 for (deUint32 memoryNdx = 0; memoryNdx < memProps->memoryTypeCount; memoryNdx++)
1032 bool validPropTypeFound = false;
1034 if (memProps->memoryTypes[memoryNdx].heapIndex >= memProps->memoryHeapCount)
1036 log << TestLog::Message << "deviceMemoryProperties - heapIndex " << memProps->memoryTypes[memoryNdx].heapIndex << " larger than heapCount" << TestLog::EndMessage;
1037 return tcu::TestStatus::fail("deviceMemoryProperties - invalid heapIndex");
1040 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;
1042 for (const VkMemoryPropertyFlags* requiredFlagsIterator = DE_ARRAY_BEGIN(requiredPropertyFlags); requiredFlagsIterator != DE_ARRAY_END(requiredPropertyFlags); requiredFlagsIterator++)
1043 if ((memProps->memoryTypes[memoryNdx].propertyFlags & *requiredFlagsIterator) == *requiredFlagsIterator)
1044 requiredFlagsFound[requiredFlagsIterator - DE_ARRAY_BEGIN(requiredPropertyFlags)] = true;
1046 if (de::contains(DE_ARRAY_BEGIN(validPropertyFlags), DE_ARRAY_END(validPropertyFlags), memProps->memoryTypes[memoryNdx].propertyFlags & bitsToCheck))
1047 validPropTypeFound = true;
1049 if (!validPropTypeFound)
1051 log << TestLog::Message << "deviceMemoryProperties - propertyFlags "
1052 << memProps->memoryTypes[memoryNdx].propertyFlags << " not valid" << TestLog::EndMessage;
1053 return tcu::TestStatus::fail("deviceMemoryProperties propertyFlags not valid");
1056 if (memProps->memoryTypes[memoryNdx].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
1058 if ((memProps->memoryHeaps[memProps->memoryTypes[memoryNdx].heapIndex].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) == 0)
1060 log << TestLog::Message << "deviceMemoryProperties - DEVICE_LOCAL memory type references heap which is not DEVICE_LOCAL" << TestLog::EndMessage;
1061 return tcu::TestStatus::fail("deviceMemoryProperties inconsistent memoryType and HeapFlags");
1066 if (memProps->memoryHeaps[memProps->memoryTypes[memoryNdx].heapIndex].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT)
1068 log << TestLog::Message << "deviceMemoryProperties - non-DEVICE_LOCAL memory type references heap with is DEVICE_LOCAL" << TestLog::EndMessage;
1069 return tcu::TestStatus::fail("deviceMemoryProperties inconsistent memoryType and HeapFlags");
1074 bool* requiredFlagsFoundIterator = std::find(DE_ARRAY_BEGIN(requiredFlagsFound), DE_ARRAY_END(requiredFlagsFound), false);
1075 if (requiredFlagsFoundIterator != DE_ARRAY_END(requiredFlagsFound))
1077 DE_ASSERT(requiredFlagsFoundIterator - DE_ARRAY_BEGIN(requiredFlagsFound) <= DE_LENGTH_OF_ARRAY(requiredPropertyFlags));
1078 log << TestLog::Message << "deviceMemoryProperties - required property flags "
1079 << getMemoryPropertyFlagsStr(requiredPropertyFlags[requiredFlagsFoundIterator - DE_ARRAY_BEGIN(requiredFlagsFound)]) << " not found" << TestLog::EndMessage;
1081 return tcu::TestStatus::fail("deviceMemoryProperties propertyFlags not valid");
1084 return tcu::TestStatus::pass("Querying memory properties succeeded");
1087 // \todo [2016-01-22 pyry] Optimize by doing format -> flags mapping instead
1089 VkFormatFeatureFlags getRequiredOptimalTilingFeatures (VkFormat format)
1091 static const VkFormat s_requiredSampledImageBlitSrcFormats[] =
1093 VK_FORMAT_B4G4R4A4_UNORM_PACK16,
1094 VK_FORMAT_R5G6B5_UNORM_PACK16,
1095 VK_FORMAT_A1R5G5B5_UNORM_PACK16,
1100 VK_FORMAT_R8G8_UNORM,
1101 VK_FORMAT_R8G8_SNORM,
1102 VK_FORMAT_R8G8_UINT,
1103 VK_FORMAT_R8G8_SINT,
1104 VK_FORMAT_R8G8B8A8_UNORM,
1105 VK_FORMAT_R8G8B8A8_SNORM,
1106 VK_FORMAT_R8G8B8A8_UINT,
1107 VK_FORMAT_R8G8B8A8_SINT,
1108 VK_FORMAT_R8G8B8A8_SRGB,
1109 VK_FORMAT_B8G8R8A8_UNORM,
1110 VK_FORMAT_B8G8R8A8_SRGB,
1111 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
1112 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
1113 VK_FORMAT_A8B8G8R8_UINT_PACK32,
1114 VK_FORMAT_A8B8G8R8_SINT_PACK32,
1115 VK_FORMAT_A8B8G8R8_SRGB_PACK32,
1116 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
1117 VK_FORMAT_A2B10G10R10_UINT_PACK32,
1120 VK_FORMAT_R16_SFLOAT,
1121 VK_FORMAT_R16G16_UINT,
1122 VK_FORMAT_R16G16_SINT,
1123 VK_FORMAT_R16G16_SFLOAT,
1124 VK_FORMAT_R16G16B16A16_UINT,
1125 VK_FORMAT_R16G16B16A16_SINT,
1126 VK_FORMAT_R16G16B16A16_SFLOAT,
1129 VK_FORMAT_R32_SFLOAT,
1130 VK_FORMAT_R32G32_UINT,
1131 VK_FORMAT_R32G32_SINT,
1132 VK_FORMAT_R32G32_SFLOAT,
1133 VK_FORMAT_R32G32B32A32_UINT,
1134 VK_FORMAT_R32G32B32A32_SINT,
1135 VK_FORMAT_R32G32B32A32_SFLOAT,
1136 VK_FORMAT_B10G11R11_UFLOAT_PACK32,
1137 VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
1138 VK_FORMAT_D16_UNORM,
1139 VK_FORMAT_D32_SFLOAT
1141 static const VkFormat s_requiredSampledImageFilterLinearFormats[] =
1143 VK_FORMAT_B4G4R4A4_UNORM_PACK16,
1144 VK_FORMAT_R5G6B5_UNORM_PACK16,
1145 VK_FORMAT_A1R5G5B5_UNORM_PACK16,
1148 VK_FORMAT_R8G8_UNORM,
1149 VK_FORMAT_R8G8_SNORM,
1150 VK_FORMAT_R8G8B8A8_UNORM,
1151 VK_FORMAT_R8G8B8A8_SNORM,
1152 VK_FORMAT_R8G8B8A8_SRGB,
1153 VK_FORMAT_B8G8R8A8_UNORM,
1154 VK_FORMAT_B8G8R8A8_SRGB,
1155 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
1156 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
1157 VK_FORMAT_A8B8G8R8_SRGB_PACK32,
1158 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
1159 VK_FORMAT_R16_SFLOAT,
1160 VK_FORMAT_R16G16_SFLOAT,
1161 VK_FORMAT_R16G16B16A16_SFLOAT,
1162 VK_FORMAT_B10G11R11_UFLOAT_PACK32,
1163 VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
1165 static const VkFormat s_requiredStorageImageFormats[] =
1167 VK_FORMAT_R8G8B8A8_UNORM,
1168 VK_FORMAT_R8G8B8A8_SNORM,
1169 VK_FORMAT_R8G8B8A8_UINT,
1170 VK_FORMAT_R8G8B8A8_SINT,
1171 VK_FORMAT_R16G16B16A16_UINT,
1172 VK_FORMAT_R16G16B16A16_SINT,
1173 VK_FORMAT_R16G16B16A16_SFLOAT,
1176 VK_FORMAT_R32_SFLOAT,
1177 VK_FORMAT_R32G32_UINT,
1178 VK_FORMAT_R32G32_SINT,
1179 VK_FORMAT_R32G32_SFLOAT,
1180 VK_FORMAT_R32G32B32A32_UINT,
1181 VK_FORMAT_R32G32B32A32_SINT,
1182 VK_FORMAT_R32G32B32A32_SFLOAT
1184 static const VkFormat s_requiredStorageImageAtomicFormats[] =
1189 static const VkFormat s_requiredColorAttachmentBlitDstFormats[] =
1191 VK_FORMAT_R5G6B5_UNORM_PACK16,
1192 VK_FORMAT_A1R5G5B5_UNORM_PACK16,
1196 VK_FORMAT_R8G8_UNORM,
1197 VK_FORMAT_R8G8_UINT,
1198 VK_FORMAT_R8G8_SINT,
1199 VK_FORMAT_R8G8B8A8_UNORM,
1200 VK_FORMAT_R8G8B8A8_UINT,
1201 VK_FORMAT_R8G8B8A8_SINT,
1202 VK_FORMAT_R8G8B8A8_SRGB,
1203 VK_FORMAT_B8G8R8A8_UNORM,
1204 VK_FORMAT_B8G8R8A8_SRGB,
1205 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
1206 VK_FORMAT_A8B8G8R8_UINT_PACK32,
1207 VK_FORMAT_A8B8G8R8_SINT_PACK32,
1208 VK_FORMAT_A8B8G8R8_SRGB_PACK32,
1209 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
1210 VK_FORMAT_A2B10G10R10_UINT_PACK32,
1213 VK_FORMAT_R16_SFLOAT,
1214 VK_FORMAT_R16G16_UINT,
1215 VK_FORMAT_R16G16_SINT,
1216 VK_FORMAT_R16G16_SFLOAT,
1217 VK_FORMAT_R16G16B16A16_UINT,
1218 VK_FORMAT_R16G16B16A16_SINT,
1219 VK_FORMAT_R16G16B16A16_SFLOAT,
1222 VK_FORMAT_R32_SFLOAT,
1223 VK_FORMAT_R32G32_UINT,
1224 VK_FORMAT_R32G32_SINT,
1225 VK_FORMAT_R32G32_SFLOAT,
1226 VK_FORMAT_R32G32B32A32_UINT,
1227 VK_FORMAT_R32G32B32A32_SINT,
1228 VK_FORMAT_R32G32B32A32_SFLOAT
1230 static const VkFormat s_requiredColorAttachmentBlendFormats[] =
1232 VK_FORMAT_R5G6B5_UNORM_PACK16,
1233 VK_FORMAT_A1R5G5B5_UNORM_PACK16,
1235 VK_FORMAT_R8G8_UNORM,
1236 VK_FORMAT_R8G8B8A8_UNORM,
1237 VK_FORMAT_R8G8B8A8_SRGB,
1238 VK_FORMAT_B8G8R8A8_UNORM,
1239 VK_FORMAT_B8G8R8A8_SRGB,
1240 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
1241 VK_FORMAT_A8B8G8R8_SRGB_PACK32,
1242 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
1243 VK_FORMAT_R16_SFLOAT,
1244 VK_FORMAT_R16G16_SFLOAT,
1245 VK_FORMAT_R16G16B16A16_SFLOAT
1247 static const VkFormat s_requiredDepthStencilAttachmentFormats[] =
1252 VkFormatFeatureFlags flags = (VkFormatFeatureFlags)0;
1254 if (de::contains(DE_ARRAY_BEGIN(s_requiredSampledImageBlitSrcFormats), DE_ARRAY_END(s_requiredSampledImageBlitSrcFormats), format))
1255 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT|VK_FORMAT_FEATURE_BLIT_SRC_BIT;
1257 if (de::contains(DE_ARRAY_BEGIN(s_requiredSampledImageFilterLinearFormats), DE_ARRAY_END(s_requiredSampledImageFilterLinearFormats), format))
1258 flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
1260 if (de::contains(DE_ARRAY_BEGIN(s_requiredStorageImageFormats), DE_ARRAY_END(s_requiredStorageImageFormats), format))
1261 flags |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
1263 if (de::contains(DE_ARRAY_BEGIN(s_requiredStorageImageAtomicFormats), DE_ARRAY_END(s_requiredStorageImageAtomicFormats), format))
1264 flags |= VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT;
1266 if (de::contains(DE_ARRAY_BEGIN(s_requiredColorAttachmentBlitDstFormats), DE_ARRAY_END(s_requiredColorAttachmentBlitDstFormats), format))
1267 flags |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT|VK_FORMAT_FEATURE_BLIT_DST_BIT;
1269 if (de::contains(DE_ARRAY_BEGIN(s_requiredColorAttachmentBlendFormats), DE_ARRAY_END(s_requiredColorAttachmentBlendFormats), format))
1270 flags |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT;
1272 if (de::contains(DE_ARRAY_BEGIN(s_requiredDepthStencilAttachmentFormats), DE_ARRAY_END(s_requiredDepthStencilAttachmentFormats), format))
1273 flags |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT;
1278 VkFormatFeatureFlags getRequiredBufferFeatures (VkFormat format)
1280 static const VkFormat s_requiredVertexBufferFormats[] =
1286 VK_FORMAT_R8G8_UNORM,
1287 VK_FORMAT_R8G8_SNORM,
1288 VK_FORMAT_R8G8_UINT,
1289 VK_FORMAT_R8G8_SINT,
1290 VK_FORMAT_R8G8B8A8_UNORM,
1291 VK_FORMAT_R8G8B8A8_SNORM,
1292 VK_FORMAT_R8G8B8A8_UINT,
1293 VK_FORMAT_R8G8B8A8_SINT,
1294 VK_FORMAT_B8G8R8A8_UNORM,
1295 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
1296 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
1297 VK_FORMAT_A8B8G8R8_UINT_PACK32,
1298 VK_FORMAT_A8B8G8R8_SINT_PACK32,
1299 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
1300 VK_FORMAT_R16_UNORM,
1301 VK_FORMAT_R16_SNORM,
1304 VK_FORMAT_R16_SFLOAT,
1305 VK_FORMAT_R16G16_UNORM,
1306 VK_FORMAT_R16G16_SNORM,
1307 VK_FORMAT_R16G16_UINT,
1308 VK_FORMAT_R16G16_SINT,
1309 VK_FORMAT_R16G16_SFLOAT,
1310 VK_FORMAT_R16G16B16A16_UNORM,
1311 VK_FORMAT_R16G16B16A16_SNORM,
1312 VK_FORMAT_R16G16B16A16_UINT,
1313 VK_FORMAT_R16G16B16A16_SINT,
1314 VK_FORMAT_R16G16B16A16_SFLOAT,
1317 VK_FORMAT_R32_SFLOAT,
1318 VK_FORMAT_R32G32_UINT,
1319 VK_FORMAT_R32G32_SINT,
1320 VK_FORMAT_R32G32_SFLOAT,
1321 VK_FORMAT_R32G32B32_UINT,
1322 VK_FORMAT_R32G32B32_SINT,
1323 VK_FORMAT_R32G32B32_SFLOAT,
1324 VK_FORMAT_R32G32B32A32_UINT,
1325 VK_FORMAT_R32G32B32A32_SINT,
1326 VK_FORMAT_R32G32B32A32_SFLOAT
1328 static const VkFormat s_requiredUniformTexelBufferFormats[] =
1334 VK_FORMAT_R8G8_UNORM,
1335 VK_FORMAT_R8G8_SNORM,
1336 VK_FORMAT_R8G8_UINT,
1337 VK_FORMAT_R8G8_SINT,
1338 VK_FORMAT_R8G8B8A8_UNORM,
1339 VK_FORMAT_R8G8B8A8_SNORM,
1340 VK_FORMAT_R8G8B8A8_UINT,
1341 VK_FORMAT_R8G8B8A8_SINT,
1342 VK_FORMAT_B8G8R8A8_UNORM,
1343 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
1344 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
1345 VK_FORMAT_A8B8G8R8_UINT_PACK32,
1346 VK_FORMAT_A8B8G8R8_SINT_PACK32,
1347 VK_FORMAT_A2B10G10R10_UNORM_PACK32,
1348 VK_FORMAT_A2B10G10R10_UINT_PACK32,
1351 VK_FORMAT_R16_SFLOAT,
1352 VK_FORMAT_R16G16_UINT,
1353 VK_FORMAT_R16G16_SINT,
1354 VK_FORMAT_R16G16_SFLOAT,
1355 VK_FORMAT_R16G16B16A16_UINT,
1356 VK_FORMAT_R16G16B16A16_SINT,
1357 VK_FORMAT_R16G16B16A16_SFLOAT,
1360 VK_FORMAT_R32_SFLOAT,
1361 VK_FORMAT_R32G32_UINT,
1362 VK_FORMAT_R32G32_SINT,
1363 VK_FORMAT_R32G32_SFLOAT,
1364 VK_FORMAT_R32G32B32A32_UINT,
1365 VK_FORMAT_R32G32B32A32_SINT,
1366 VK_FORMAT_R32G32B32A32_SFLOAT,
1367 VK_FORMAT_B10G11R11_UFLOAT_PACK32
1369 static const VkFormat s_requiredStorageTexelBufferFormats[] =
1371 VK_FORMAT_R8G8B8A8_UNORM,
1372 VK_FORMAT_R8G8B8A8_SNORM,
1373 VK_FORMAT_R8G8B8A8_UINT,
1374 VK_FORMAT_R8G8B8A8_SINT,
1375 VK_FORMAT_A8B8G8R8_UNORM_PACK32,
1376 VK_FORMAT_A8B8G8R8_SNORM_PACK32,
1377 VK_FORMAT_A8B8G8R8_UINT_PACK32,
1378 VK_FORMAT_A8B8G8R8_SINT_PACK32,
1379 VK_FORMAT_R16G16B16A16_UINT,
1380 VK_FORMAT_R16G16B16A16_SINT,
1381 VK_FORMAT_R16G16B16A16_SFLOAT,
1384 VK_FORMAT_R32_SFLOAT,
1385 VK_FORMAT_R32G32_UINT,
1386 VK_FORMAT_R32G32_SINT,
1387 VK_FORMAT_R32G32_SFLOAT,
1388 VK_FORMAT_R32G32B32A32_UINT,
1389 VK_FORMAT_R32G32B32A32_SINT,
1390 VK_FORMAT_R32G32B32A32_SFLOAT
1392 static const VkFormat s_requiredStorageTexelBufferAtomicFormats[] =
1398 VkFormatFeatureFlags flags = (VkFormatFeatureFlags)0;
1400 if (de::contains(DE_ARRAY_BEGIN(s_requiredVertexBufferFormats), DE_ARRAY_END(s_requiredVertexBufferFormats), format))
1401 flags |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT;
1403 if (de::contains(DE_ARRAY_BEGIN(s_requiredUniformTexelBufferFormats), DE_ARRAY_END(s_requiredUniformTexelBufferFormats), format))
1404 flags |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT;
1406 if (de::contains(DE_ARRAY_BEGIN(s_requiredStorageTexelBufferFormats), DE_ARRAY_END(s_requiredStorageTexelBufferFormats), format))
1407 flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
1409 if (de::contains(DE_ARRAY_BEGIN(s_requiredStorageTexelBufferAtomicFormats), DE_ARRAY_END(s_requiredStorageTexelBufferAtomicFormats), format))
1410 flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT;
1415 tcu::TestStatus formatProperties (Context& context, VkFormat format)
1417 TestLog& log = context.getTestContext().getLog();
1418 const VkFormatProperties properties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
1423 VkFormatFeatureFlags VkFormatProperties::* field;
1424 const char* fieldName;
1425 VkFormatFeatureFlags requiredFeatures;
1428 { &VkFormatProperties::linearTilingFeatures, "linearTilingFeatures", (VkFormatFeatureFlags)0 },
1429 { &VkFormatProperties::optimalTilingFeatures, "optimalTilingFeatures", getRequiredOptimalTilingFeatures(format) },
1430 { &VkFormatProperties::bufferFeatures, "buffeFeatures", getRequiredBufferFeatures(format) }
1433 log << TestLog::Message << properties << TestLog::EndMessage;
1435 for (int fieldNdx = 0; fieldNdx < DE_LENGTH_OF_ARRAY(fields); fieldNdx++)
1437 const char* const fieldName = fields[fieldNdx].fieldName;
1438 const VkFormatFeatureFlags supported = properties.*fields[fieldNdx].field;
1439 const VkFormatFeatureFlags required = fields[fieldNdx].requiredFeatures;
1441 if ((supported & required) != required)
1443 log << TestLog::Message << "ERROR in " << fieldName << ":\n"
1444 << " required: " << getFormatFeatureFlagsStr(required) << "\n "
1445 << " missing: " << getFormatFeatureFlagsStr(~supported & required)
1446 << TestLog::EndMessage;
1452 return tcu::TestStatus::pass("Query and validation passed");
1454 return tcu::TestStatus::fail("Required features not supported");
1457 bool optimalTilingFeaturesSupported (Context& context, VkFormat format, VkFormatFeatureFlags features)
1459 const VkFormatProperties properties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
1461 return (properties.optimalTilingFeatures & features) == features;
1464 bool optimalTilingFeaturesSupportedForAll (Context& context, const VkFormat* begin, const VkFormat* end, VkFormatFeatureFlags features)
1466 for (const VkFormat* cur = begin; cur != end; ++cur)
1468 if (!optimalTilingFeaturesSupported(context, *cur, features))
1475 tcu::TestStatus testDepthStencilSupported (Context& context)
1477 if (!optimalTilingFeaturesSupported(context, VK_FORMAT_X8_D24_UNORM_PACK32, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) &&
1478 !optimalTilingFeaturesSupported(context, VK_FORMAT_D32_SFLOAT, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))
1479 return tcu::TestStatus::fail("Doesn't support one of VK_FORMAT_X8_D24_UNORM_PACK32 or VK_FORMAT_D32_SFLOAT");
1481 if (!optimalTilingFeaturesSupported(context, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) &&
1482 !optimalTilingFeaturesSupported(context, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))
1483 return tcu::TestStatus::fail("Doesn't support one of VK_FORMAT_D24_UNORM_S8_UINT or VK_FORMAT_D32_SFLOAT_S8_UINT");
1485 return tcu::TestStatus::pass("Required depth/stencil formats supported");
1488 tcu::TestStatus testCompressedFormatsSupported (Context& context)
1490 static const VkFormat s_allBcFormats[] =
1492 VK_FORMAT_BC1_RGB_UNORM_BLOCK,
1493 VK_FORMAT_BC1_RGB_SRGB_BLOCK,
1494 VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
1495 VK_FORMAT_BC1_RGBA_SRGB_BLOCK,
1496 VK_FORMAT_BC2_UNORM_BLOCK,
1497 VK_FORMAT_BC2_SRGB_BLOCK,
1498 VK_FORMAT_BC3_UNORM_BLOCK,
1499 VK_FORMAT_BC3_SRGB_BLOCK,
1500 VK_FORMAT_BC4_UNORM_BLOCK,
1501 VK_FORMAT_BC4_SNORM_BLOCK,
1502 VK_FORMAT_BC5_UNORM_BLOCK,
1503 VK_FORMAT_BC5_SNORM_BLOCK,
1504 VK_FORMAT_BC6H_UFLOAT_BLOCK,
1505 VK_FORMAT_BC6H_SFLOAT_BLOCK,
1506 VK_FORMAT_BC7_UNORM_BLOCK,
1507 VK_FORMAT_BC7_SRGB_BLOCK,
1509 static const VkFormat s_allEtc2Formats[] =
1511 VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,
1512 VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK,
1513 VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,
1514 VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,
1515 VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,
1516 VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,
1517 VK_FORMAT_EAC_R11_UNORM_BLOCK,
1518 VK_FORMAT_EAC_R11_SNORM_BLOCK,
1519 VK_FORMAT_EAC_R11G11_UNORM_BLOCK,
1520 VK_FORMAT_EAC_R11G11_SNORM_BLOCK,
1522 static const VkFormat s_allAstcLdrFormats[] =
1524 VK_FORMAT_ASTC_4x4_UNORM_BLOCK,
1525 VK_FORMAT_ASTC_4x4_SRGB_BLOCK,
1526 VK_FORMAT_ASTC_5x4_UNORM_BLOCK,
1527 VK_FORMAT_ASTC_5x4_SRGB_BLOCK,
1528 VK_FORMAT_ASTC_5x5_UNORM_BLOCK,
1529 VK_FORMAT_ASTC_5x5_SRGB_BLOCK,
1530 VK_FORMAT_ASTC_6x5_UNORM_BLOCK,
1531 VK_FORMAT_ASTC_6x5_SRGB_BLOCK,
1532 VK_FORMAT_ASTC_6x6_UNORM_BLOCK,
1533 VK_FORMAT_ASTC_6x6_SRGB_BLOCK,
1534 VK_FORMAT_ASTC_8x5_UNORM_BLOCK,
1535 VK_FORMAT_ASTC_8x5_SRGB_BLOCK,
1536 VK_FORMAT_ASTC_8x6_UNORM_BLOCK,
1537 VK_FORMAT_ASTC_8x6_SRGB_BLOCK,
1538 VK_FORMAT_ASTC_8x8_UNORM_BLOCK,
1539 VK_FORMAT_ASTC_8x8_SRGB_BLOCK,
1540 VK_FORMAT_ASTC_10x5_UNORM_BLOCK,
1541 VK_FORMAT_ASTC_10x5_SRGB_BLOCK,
1542 VK_FORMAT_ASTC_10x6_UNORM_BLOCK,
1543 VK_FORMAT_ASTC_10x6_SRGB_BLOCK,
1544 VK_FORMAT_ASTC_10x8_UNORM_BLOCK,
1545 VK_FORMAT_ASTC_10x8_SRGB_BLOCK,
1546 VK_FORMAT_ASTC_10x10_UNORM_BLOCK,
1547 VK_FORMAT_ASTC_10x10_SRGB_BLOCK,
1548 VK_FORMAT_ASTC_12x10_UNORM_BLOCK,
1549 VK_FORMAT_ASTC_12x10_SRGB_BLOCK,
1550 VK_FORMAT_ASTC_12x12_UNORM_BLOCK,
1551 VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
1556 const char* setName;
1557 const char* featureName;
1558 const VkBool32 VkPhysicalDeviceFeatures::* feature;
1559 const VkFormat* formatsBegin;
1560 const VkFormat* formatsEnd;
1561 } s_compressedFormatSets[] =
1563 { "BC", "textureCompressionBC", &VkPhysicalDeviceFeatures::textureCompressionBC, DE_ARRAY_BEGIN(s_allBcFormats), DE_ARRAY_END(s_allBcFormats) },
1564 { "ETC2", "textureCompressionETC2", &VkPhysicalDeviceFeatures::textureCompressionETC2, DE_ARRAY_BEGIN(s_allEtc2Formats), DE_ARRAY_END(s_allEtc2Formats) },
1565 { "ASTC LDR", "textureCompressionASTC_LDR", &VkPhysicalDeviceFeatures::textureCompressionASTC_LDR, DE_ARRAY_BEGIN(s_allAstcLdrFormats), DE_ARRAY_END(s_allAstcLdrFormats) },
1568 TestLog& log = context.getTestContext().getLog();
1569 const VkPhysicalDeviceFeatures& features = context.getDeviceFeatures();
1570 int numSupportedSets = 0;
1572 int numWarnings = 0;
1574 for (int setNdx = 0; setNdx < DE_LENGTH_OF_ARRAY(s_compressedFormatSets); ++setNdx)
1576 const char* const setName = s_compressedFormatSets[setNdx].setName;
1577 const char* const featureName = s_compressedFormatSets[setNdx].featureName;
1578 const bool featureBitSet = features.*s_compressedFormatSets[setNdx].feature == VK_TRUE;
1579 const bool allSupported = optimalTilingFeaturesSupportedForAll(context,
1580 s_compressedFormatSets[setNdx].formatsBegin,
1581 s_compressedFormatSets[setNdx].formatsEnd,
1582 VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT);
1584 if (featureBitSet && !allSupported)
1586 log << TestLog::Message << "ERROR: " << featureName << " = VK_TRUE but " << setName << " formats not supported" << TestLog::EndMessage;
1589 else if (allSupported && !featureBitSet)
1591 log << TestLog::Message << "WARNING: " << setName << " formats supported but " << featureName << " = VK_FALSE" << TestLog::EndMessage;
1597 log << TestLog::Message << "All " << setName << " formats are supported" << TestLog::EndMessage;
1598 numSupportedSets += 1;
1601 log << TestLog::Message << setName << " formats are not supported" << TestLog::EndMessage;
1604 if (numSupportedSets == 0)
1606 log << TestLog::Message << "No compressed format sets supported" << TestLog::EndMessage;
1611 return tcu::TestStatus::fail("Compressed format support not valid");
1612 else if (numWarnings > 0)
1613 return tcu::TestStatus(QP_TEST_RESULT_QUALITY_WARNING, "Found inconsistencies in compressed format support");
1615 return tcu::TestStatus::pass("Compressed texture format support is valid");
1618 void createFormatTests (tcu::TestCaseGroup* testGroup)
1620 DE_STATIC_ASSERT(VK_FORMAT_UNDEFINED == 0);
1622 for (deUint32 formatNdx = VK_FORMAT_UNDEFINED+1; formatNdx < VK_FORMAT_LAST; ++formatNdx)
1624 const VkFormat format = (VkFormat)formatNdx;
1625 const char* const enumName = getFormatName(format);
1626 const string caseName = de::toLower(string(enumName).substr(10));
1628 addFunctionCase(testGroup, caseName, enumName, formatProperties, format);
1631 addFunctionCase(testGroup, "depth_stencil", "", testDepthStencilSupported);
1632 addFunctionCase(testGroup, "compressed_formats", "", testCompressedFormatsSupported);
1635 VkImageUsageFlags getValidImageUsageFlags (VkFormat, VkFormatFeatureFlags supportedFeatures)
1637 VkImageUsageFlags flags = (VkImageUsageFlags)0;
1639 // If format is supported at all, it must be valid transfer src+dst
1640 if (supportedFeatures != 0)
1641 flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT;
1643 if ((supportedFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0)
1644 flags |= VK_IMAGE_USAGE_SAMPLED_BIT;
1646 if ((supportedFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) != 0)
1647 flags |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT|VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
1649 if ((supportedFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0)
1650 flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
1652 if ((supportedFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) != 0)
1653 flags |= VK_IMAGE_USAGE_STORAGE_BIT;
1658 bool isValidImageUsageFlagCombination (VkImageUsageFlags usage)
1660 if (usage & vk::VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT)
1662 const VkImageUsageFlags allowedFlags = vk::VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
1663 | vk::VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
1664 | vk::VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
1665 | vk::VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
1667 return (usage & ~allowedFlags) == 0 && usage != vk::VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT;
1673 VkImageCreateFlags getValidImageCreateFlags (const VkPhysicalDeviceFeatures& deviceFeatures, VkFormat, VkFormatFeatureFlags, VkImageType type, VkImageUsageFlags usage)
1675 VkImageCreateFlags flags = (VkImageCreateFlags)0;
1677 if ((usage & VK_IMAGE_USAGE_SAMPLED_BIT) != 0)
1679 flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
1681 if (type == VK_IMAGE_TYPE_2D)
1682 flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
1685 if ((usage & (VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_STORAGE_BIT)) != 0 &&
1686 (usage & VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT) == 0)
1688 if (deviceFeatures.sparseBinding)
1689 flags |= VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT;
1691 if (deviceFeatures.sparseResidencyAliased)
1692 flags |= VK_IMAGE_CREATE_SPARSE_ALIASED_BIT;
1698 bool isValidImageCreateFlagCombination (VkImageCreateFlags)
1703 bool isRequiredImageParameterCombination (const VkPhysicalDeviceFeatures& deviceFeatures,
1704 const VkFormat format,
1705 const VkFormatProperties& formatProperties,
1706 const VkImageType imageType,
1707 const VkImageTiling imageTiling,
1708 const VkImageUsageFlags usageFlags,
1709 const VkImageCreateFlags createFlags)
1711 DE_UNREF(deviceFeatures);
1712 DE_UNREF(formatProperties);
1713 DE_UNREF(createFlags);
1715 // Linear images can have arbitrary limitations
1716 if (imageTiling == VK_IMAGE_TILING_LINEAR)
1719 // Support for other usages for compressed formats is optional
1720 if (isCompressedFormat(format) &&
1721 (usageFlags & ~(VK_IMAGE_USAGE_SAMPLED_BIT|VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT)) != 0)
1724 // Support for 1D, and sliced 3D compressed formats is optional
1725 if (isCompressedFormat(format) && (imageType == VK_IMAGE_TYPE_1D || imageType == VK_IMAGE_TYPE_3D))
1728 DE_ASSERT(deviceFeatures.sparseBinding || (createFlags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)) == 0);
1729 DE_ASSERT(deviceFeatures.sparseResidencyAliased || (createFlags & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) == 0);
1734 VkSampleCountFlags getRequiredOptimalTilingSampleCounts (const VkPhysicalDeviceLimits& deviceLimits,
1735 const VkFormat format,
1736 const VkImageUsageFlags usageFlags)
1738 if (!isCompressedFormat(format))
1740 const tcu::TextureFormat tcuFormat = mapVkFormat(format);
1742 if (usageFlags & VK_IMAGE_USAGE_STORAGE_BIT)
1743 return deviceLimits.storageImageSampleCounts;
1744 else if (tcuFormat.order == tcu::TextureFormat::D)
1745 return deviceLimits.sampledImageDepthSampleCounts;
1746 else if (tcuFormat.order == tcu::TextureFormat::S)
1747 return deviceLimits.sampledImageStencilSampleCounts;
1748 else if (tcuFormat.order == tcu::TextureFormat::DS)
1749 return deviceLimits.sampledImageDepthSampleCounts & deviceLimits.sampledImageStencilSampleCounts;
1752 const tcu::TextureChannelClass chnClass = tcu::getTextureChannelClass(tcuFormat.type);
1754 if (chnClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER ||
1755 chnClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER)
1756 return deviceLimits.sampledImageIntegerSampleCounts;
1758 return deviceLimits.sampledImageColorSampleCounts;
1762 return VK_SAMPLE_COUNT_1_BIT;
1765 struct ImageFormatPropertyCase
1768 VkImageType imageType;
1769 VkImageTiling tiling;
1771 ImageFormatPropertyCase (VkFormat format_, VkImageType imageType_, VkImageTiling tiling_)
1773 , imageType (imageType_)
1777 ImageFormatPropertyCase (void)
1778 : format (VK_FORMAT_LAST)
1779 , imageType (VK_IMAGE_TYPE_LAST)
1780 , tiling (VK_IMAGE_TILING_LAST)
1784 tcu::TestStatus imageFormatProperties (Context& context, ImageFormatPropertyCase params)
1786 TestLog& log = context.getTestContext().getLog();
1787 const VkFormat format = params.format;
1788 const VkImageType imageType = params.imageType;
1789 const VkImageTiling tiling = params.tiling;
1790 const VkPhysicalDeviceFeatures& deviceFeatures = context.getDeviceFeatures();
1791 const VkPhysicalDeviceLimits& deviceLimits = context.getDeviceProperties().limits;
1792 const VkFormatProperties formatProperties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format);
1794 const VkFormatFeatureFlags supportedFeatures = tiling == VK_IMAGE_TILING_LINEAR ? formatProperties.linearTilingFeatures : formatProperties.optimalTilingFeatures;
1795 const VkImageUsageFlags usageFlagSet = getValidImageUsageFlags(format, supportedFeatures);
1797 tcu::ResultCollector results (log, "ERROR: ");
1799 for (VkImageUsageFlags curUsageFlags = 0; curUsageFlags <= usageFlagSet; curUsageFlags++)
1801 if ((curUsageFlags & ~usageFlagSet) != 0 ||
1802 !isValidImageUsageFlagCombination(curUsageFlags))
1805 const VkImageCreateFlags createFlagSet = getValidImageCreateFlags(deviceFeatures, format, supportedFeatures, imageType, curUsageFlags);
1807 for (VkImageCreateFlags curCreateFlags = 0; curCreateFlags <= createFlagSet; curCreateFlags++)
1809 if ((curCreateFlags & ~createFlagSet) != 0 ||
1810 !isValidImageCreateFlagCombination(curCreateFlags))
1813 const bool isRequiredCombination = isRequiredImageParameterCombination(deviceFeatures,
1820 VkImageFormatProperties properties;
1821 VkResult queryResult;
1823 log << TestLog::Message << "Testing " << getImageTypeStr(imageType) << ", "
1824 << getImageTilingStr(tiling) << ", "
1825 << getImageUsageFlagsStr(curUsageFlags) << ", "
1826 << getImageCreateFlagsStr(curCreateFlags)
1827 << TestLog::EndMessage;
1829 // Set return value to known garbage
1830 deMemset(&properties, 0xcd, sizeof(properties));
1832 queryResult = context.getInstanceInterface().getPhysicalDeviceImageFormatProperties(context.getPhysicalDevice(),
1840 if (queryResult == VK_SUCCESS)
1842 const deUint32 fullMipPyramidSize = de::max(de::max(deLog2Ceil32(properties.maxExtent.width),
1843 deLog2Ceil32(properties.maxExtent.height)),
1844 deLog2Ceil32(properties.maxExtent.depth)) + 1;
1846 log << TestLog::Message << properties << "\n" << TestLog::EndMessage;
1848 results.check(imageType != VK_IMAGE_TYPE_1D || (properties.maxExtent.width >= 1 && properties.maxExtent.height == 1 && properties.maxExtent.depth == 1), "Invalid dimensions for 1D image");
1849 results.check(imageType != VK_IMAGE_TYPE_2D || (properties.maxExtent.width >= 1 && properties.maxExtent.height >= 1 && properties.maxExtent.depth == 1), "Invalid dimensions for 2D image");
1850 results.check(imageType != VK_IMAGE_TYPE_3D || (properties.maxExtent.width >= 1 && properties.maxExtent.height >= 1 && properties.maxExtent.depth >= 1), "Invalid dimensions for 3D image");
1851 results.check(imageType != VK_IMAGE_TYPE_3D || properties.maxArrayLayers == 1, "Invalid maxArrayLayers for 3D image");
1853 if (tiling == VK_IMAGE_TILING_OPTIMAL)
1855 // Vulkan API specification has changed since initial Android Nougat release.
1856 // For NYC CTS we need to tolerate old behavior as well and issue compatibility
1859 // See spec issues 272, 282, 302, 445 and CTS issues 369, 440.
1860 const bool requiredByNewSpec = (imageType == VK_IMAGE_TYPE_2D && !(curCreateFlags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) &&
1861 ((supportedFeatures & (VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) ||
1862 ((supportedFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) && deviceFeatures.shaderStorageImageMultisample)));
1864 if (requiredByNewSpec)
1866 const VkSampleCountFlags requiredSampleCounts = getRequiredOptimalTilingSampleCounts(deviceLimits, format, curUsageFlags);
1868 results.check((properties.sampleCounts & requiredSampleCounts) == requiredSampleCounts, "Required sample counts not supported");
1870 else if (properties.sampleCounts != VK_SAMPLE_COUNT_1_BIT)
1872 results.addResult(QP_TEST_RESULT_COMPATIBILITY_WARNING,
1873 "Implementation supports more sample counts than allowed by the spec");
1877 results.check(properties.sampleCounts == VK_SAMPLE_COUNT_1_BIT, "sampleCounts != VK_SAMPLE_COUNT_1_BIT");
1879 if (isRequiredCombination)
1881 results.check(imageType != VK_IMAGE_TYPE_1D || (properties.maxExtent.width >= deviceLimits.maxImageDimension1D),
1882 "Reported dimensions smaller than device limits");
1883 results.check(imageType != VK_IMAGE_TYPE_2D || (properties.maxExtent.width >= deviceLimits.maxImageDimension2D &&
1884 properties.maxExtent.height >= deviceLimits.maxImageDimension2D),
1885 "Reported dimensions smaller than device limits");
1886 results.check(imageType != VK_IMAGE_TYPE_3D || (properties.maxExtent.width >= deviceLimits.maxImageDimension3D &&
1887 properties.maxExtent.height >= deviceLimits.maxImageDimension3D &&
1888 properties.maxExtent.depth >= deviceLimits.maxImageDimension3D),
1889 "Reported dimensions smaller than device limits");
1890 results.check(properties.maxMipLevels == fullMipPyramidSize, "maxMipLevels is not full mip pyramid size");
1891 results.check(imageType == VK_IMAGE_TYPE_3D || properties.maxArrayLayers >= deviceLimits.maxImageArrayLayers,
1892 "maxArrayLayers smaller than device limits");
1896 results.check(properties.maxMipLevels == 1 || properties.maxMipLevels == fullMipPyramidSize, "Invalid mip pyramid size");
1897 results.check(properties.maxArrayLayers >= 1, "Invalid maxArrayLayers");
1900 results.check(properties.maxResourceSize >= (VkDeviceSize)MINIMUM_REQUIRED_IMAGE_RESOURCE_SIZE,
1901 "maxResourceSize smaller than minimum required size");
1903 else if (queryResult == VK_ERROR_FORMAT_NOT_SUPPORTED)
1905 log << TestLog::Message << "Got VK_ERROR_FORMAT_NOT_SUPPORTED" << TestLog::EndMessage;
1907 if (isRequiredCombination)
1908 results.fail("VK_ERROR_FORMAT_NOT_SUPPORTED returned for required image parameter combination");
1910 // Specification requires that all fields are set to 0
1911 results.check(properties.maxExtent.width == 0, "maxExtent.width != 0");
1912 results.check(properties.maxExtent.height == 0, "maxExtent.height != 0");
1913 results.check(properties.maxExtent.depth == 0, "maxExtent.depth != 0");
1914 results.check(properties.maxMipLevels == 0, "maxMipLevels != 0");
1915 results.check(properties.maxArrayLayers == 0, "maxArrayLayers != 0");
1916 results.check(properties.sampleCounts == 0, "sampleCounts != 0");
1917 results.check(properties.maxResourceSize == 0, "maxResourceSize != 0");
1921 results.fail("Got unexpected error" + de::toString(queryResult));
1926 return tcu::TestStatus(results.getResult(), results.getMessage());
1929 void createImageFormatTypeTilingTests (tcu::TestCaseGroup* testGroup, ImageFormatPropertyCase params)
1931 DE_ASSERT(params.format == VK_FORMAT_LAST);
1933 for (deUint32 formatNdx = VK_FORMAT_UNDEFINED+1; formatNdx < VK_FORMAT_LAST; ++formatNdx)
1935 const VkFormat format = (VkFormat)formatNdx;
1936 const char* const enumName = getFormatName(format);
1937 const string caseName = de::toLower(string(enumName).substr(10));
1939 params.format = format;
1941 addFunctionCase(testGroup, caseName, enumName, imageFormatProperties, params);
1945 void createImageFormatTypeTests (tcu::TestCaseGroup* testGroup, ImageFormatPropertyCase params)
1947 DE_ASSERT(params.tiling == VK_IMAGE_TILING_LAST);
1949 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "optimal", "", createImageFormatTypeTilingTests, ImageFormatPropertyCase(VK_FORMAT_LAST, params.imageType, VK_IMAGE_TILING_OPTIMAL)));
1950 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "linear", "", createImageFormatTypeTilingTests, ImageFormatPropertyCase(VK_FORMAT_LAST, params.imageType, VK_IMAGE_TILING_LINEAR)));
1953 void createImageFormatTests (tcu::TestCaseGroup* testGroup)
1955 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "1d", "", createImageFormatTypeTests, ImageFormatPropertyCase(VK_FORMAT_LAST, VK_IMAGE_TYPE_1D, VK_IMAGE_TILING_LAST)));
1956 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "2d", "", createImageFormatTypeTests, ImageFormatPropertyCase(VK_FORMAT_LAST, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_LAST)));
1957 testGroup->addChild(createTestGroup(testGroup->getTestContext(), "3d", "", createImageFormatTypeTests, ImageFormatPropertyCase(VK_FORMAT_LAST, VK_IMAGE_TYPE_3D, VK_IMAGE_TILING_LAST)));
1962 tcu::TestCaseGroup* createFeatureInfoTests (tcu::TestContext& testCtx)
1964 de::MovePtr<tcu::TestCaseGroup> infoTests (new tcu::TestCaseGroup(testCtx, "info", "Platform Information Tests"));
1967 de::MovePtr<tcu::TestCaseGroup> instanceInfoTests (new tcu::TestCaseGroup(testCtx, "instance", "Instance Information Tests"));
1969 addFunctionCase(instanceInfoTests.get(), "physical_devices", "Physical devices", enumeratePhysicalDevices);
1970 addFunctionCase(instanceInfoTests.get(), "layers", "Layers", enumerateInstanceLayers);
1971 addFunctionCase(instanceInfoTests.get(), "extensions", "Extensions", enumerateInstanceExtensions);
1973 infoTests->addChild(instanceInfoTests.release());
1977 de::MovePtr<tcu::TestCaseGroup> deviceInfoTests (new tcu::TestCaseGroup(testCtx, "device", "Device Information Tests"));
1979 addFunctionCase(deviceInfoTests.get(), "features", "Device Features", deviceFeatures);
1980 addFunctionCase(deviceInfoTests.get(), "properties", "Device Properties", deviceProperties);
1981 addFunctionCase(deviceInfoTests.get(), "queue_family_properties", "Queue family properties", deviceQueueFamilyProperties);
1982 addFunctionCase(deviceInfoTests.get(), "memory_properties", "Memory properties", deviceMemoryProperties);
1983 addFunctionCase(deviceInfoTests.get(), "layers", "Layers", enumerateDeviceLayers);
1984 addFunctionCase(deviceInfoTests.get(), "extensions", "Extensions", enumerateDeviceExtensions);
1986 infoTests->addChild(deviceInfoTests.release());
1989 infoTests->addChild(createTestGroup(testCtx, "format_properties", "VkGetPhysicalDeviceFormatProperties() Tests", createFormatTests));
1990 infoTests->addChild(createTestGroup(testCtx, "image_format_properties", "VkGetPhysicalDeviceImageFormatProperties() Tests", createImageFormatTests));
1992 return infoTests.release();