Merge vk-gl-cts/vulkan-cts-1.0.2 into vk-gl-cts/master
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / api / vktApiFeatureInfo.cpp
index c2848c5..a1eb7dc 100644 (file)
@@ -472,14 +472,14 @@ bool validateFeatureLimits(VkPhysicalDeviceProperties* properties, VkPhysicalDev
                }
        }
 
-       if (limits->viewportBoundsRange[0] > -2 * limits->maxViewportDimensions[0])
+       if (limits->viewportBoundsRange[0] > float(-2 * limits->maxViewportDimensions[0]))
        {
                log << TestLog::Message << "limit validation failed, viewPortBoundsRange[0] of " << limits->viewportBoundsRange[0]
                        << "is larger than -2*maxViewportDimension[0] of " << -2*limits->maxViewportDimensions[0] << TestLog::EndMessage;
                limitsOk = false;
        }
 
-       if (limits->viewportBoundsRange[1] < 2 * limits->maxViewportDimensions[1] - 1)
+       if (limits->viewportBoundsRange[1] < float(2 * limits->maxViewportDimensions[1] - 1))
        {
                log << TestLog::Message << "limit validation failed, viewportBoundsRange[1] of " << limits->viewportBoundsRange[1]
                        << "is less than 2*maxViewportDimension[1] of " << 2*limits->maxViewportDimensions[1] << TestLog::EndMessage;
@@ -671,6 +671,8 @@ void checkDeviceExtensions (tcu::ResultCollector& results, const vector<string>&
                "VK_KHR_sampler_mirror_clamp_to_edge",
                "VK_KHR_shader_draw_parameters",
                "VK_KHR_maintenance1",
+               "VK_KHR_push_descriptor",
+               "VK_KHR_descriptor_update_template",
        };
 
        checkKhrExtensions(results, extensions, DE_LENGTH_OF_ARRAY(s_allowedDeviceKhrExtensions), s_allowedDeviceKhrExtensions);
@@ -1887,6 +1889,10 @@ bool isRequiredImageParameterCombination (const VkPhysicalDeviceFeatures&        device
        if (isCompressedFormat(format) && (imageType == VK_IMAGE_TYPE_1D || imageType == VK_IMAGE_TYPE_3D))
                return false;
 
+       // Support for 1D and 3D depth/stencil textures is optional
+       if (isDepthStencilFormat(format) && (imageType == VK_IMAGE_TYPE_1D || imageType == VK_IMAGE_TYPE_3D))
+               return false;
+
        DE_ASSERT(deviceFeatures.sparseBinding || (createFlags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT|VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT)) == 0);
        DE_ASSERT(deviceFeatures.sparseResidencyAliased || (createFlags & VK_IMAGE_CREATE_SPARSE_ALIASED_BIT) == 0);
 
@@ -2108,12 +2114,28 @@ tcu::TestStatus imageFormatProperties (Context& context, const VkFormat format,
                                results.check(imageType != VK_IMAGE_TYPE_3D || (properties.maxExtent.width >= 1 && properties.maxExtent.height >= 1 && properties.maxExtent.depth >= 1), "Invalid dimensions for 3D image");
                                results.check(imageType != VK_IMAGE_TYPE_3D || properties.maxArrayLayers == 1, "Invalid maxArrayLayers for 3D image");
 
-                               if (tiling == VK_IMAGE_TILING_OPTIMAL && imageType == VK_IMAGE_TYPE_2D && !(curCreateFlags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) &&
-                                        ((supportedFeatures & (VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) ||
-                                        ((supportedFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) && deviceFeatures.shaderStorageImageMultisample)))
+                               if (tiling == VK_IMAGE_TILING_OPTIMAL)
                                {
-                                       const VkSampleCountFlags        requiredSampleCounts    = getRequiredOptimalTilingSampleCounts(deviceLimits, format, curUsageFlags);
-                                       results.check((properties.sampleCounts & requiredSampleCounts) == requiredSampleCounts, "Required sample counts not supported");
+                                       // Vulkan API specification has changed since initial Android Nougat release.
+                                       // For NYC CTS we need to tolerate old behavior as well and issue compatibility
+                                       // warning instead.
+                                       //
+                                       // See spec issues 272, 282, 302, 445 and CTS issues 369, 440.
+                                       const bool      requiredByNewSpec       = (imageType == VK_IMAGE_TYPE_2D && !(curCreateFlags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT) &&
+                                                                                                         ((supportedFeatures & (VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) ||
+                                                                                                         ((supportedFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) && deviceFeatures.shaderStorageImageMultisample)));
+
+                                       if (requiredByNewSpec)
+                                       {
+                                               const VkSampleCountFlags        requiredSampleCounts    = getRequiredOptimalTilingSampleCounts(deviceLimits, format, curUsageFlags);
+
+                                               results.check((properties.sampleCounts & requiredSampleCounts) == requiredSampleCounts, "Required sample counts not supported");
+                                       }
+                                       else if (properties.sampleCounts != VK_SAMPLE_COUNT_1_BIT)
+                                       {
+                                               results.addResult(QP_TEST_RESULT_COMPATIBILITY_WARNING,
+                                                                             "Implementation supports more sample counts than allowed by the spec");
+                                       }
                                }
                                else
                                        results.check(properties.sampleCounts == VK_SAMPLE_COUNT_1_BIT, "sampleCounts != VK_SAMPLE_COUNT_1_BIT");
@@ -2563,14 +2585,16 @@ tcu::TestStatus testNoUnknownExtensions (Context& context)
 {
        TestLog&                                log                                     = context.getTestContext().getLog();
        tcu::ResultCollector    results                         (log);
-       set<string>                             allowedExtensions;
+       set<string>                             allowedInstanceExtensions;
+       set<string>                             allowedDeviceExtensions;
 
        // All known extensions should be added to allowedExtensions:
        // allowedExtensions.insert("VK_GOOGLE_extension1");
+       allowedDeviceExtensions.insert("VK_GOOGLE_display_timing");
 
        // Instance extensions
        checkExtensions(results,
-                                       allowedExtensions,
+                                       allowedInstanceExtensions,
                                        enumerateInstanceExtensionProperties(context.getPlatformInterface(), DE_NULL));
 
        // Extensions exposed by instance layers
@@ -2580,14 +2604,14 @@ tcu::TestStatus testNoUnknownExtensions (Context& context)
                for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
                {
                        checkExtensions(results,
-                                                       allowedExtensions,
+                                                       allowedInstanceExtensions,
                                                        enumerateInstanceExtensionProperties(context.getPlatformInterface(), layer->layerName));
                }
        }
 
        // Device extensions
        checkExtensions(results,
-                                       allowedExtensions,
+                                       allowedDeviceExtensions,
                                        enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), DE_NULL));
 
        // Extensions exposed by device layers
@@ -2597,7 +2621,7 @@ tcu::TestStatus testNoUnknownExtensions (Context& context)
                for (vector<VkLayerProperties>::const_iterator layer = layers.begin(); layer != layers.end(); ++layer)
                {
                        checkExtensions(results,
-                                                       allowedExtensions,
+                                                       allowedDeviceExtensions,
                                                        enumerateDeviceExtensionProperties(context.getInstanceInterface(), context.getPhysicalDevice(), layer->layerName));
                }
        }