Merge "CP: Reduce max iter count in alloc_callback_fail.device" into nougat-cts-dev
authorDaniel Xie <dxie@google.com>
Tue, 13 Sep 2016 16:43:30 +0000 (16:43 +0000)
committerGerrit Code Review <noreply-gerritcodereview@google.com>
Tue, 13 Sep 2016 16:43:30 +0000 (16:43 +0000)
external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp
external/vulkancts/modules/vulkan/vktTestCase.cpp
external/vulkancts/modules/vulkan/vktTestCase.hpp
modules/gles31/functional/es31fGeometryShaderTests.cpp
modules/gles31/functional/es31fNegativeFragmentApiTests.cpp
modules/gles31/functional/es31fNegativeShaderApiTests.cpp

index 399b894..65c077d 100644 (file)
@@ -1842,8 +1842,26 @@ tcu::TestStatus imageFormatProperties (Context& context, ImageFormatPropertyCase
 
                                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");
index f7730a4..ef6b309 100644 (file)
@@ -31,6 +31,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRefUtil.hpp"
 #include "tcuImageCompare.hpp"
+#include "deSTLUtil.hpp"
 
 namespace vkt
 {
@@ -367,6 +368,12 @@ ImageSamplingInstance::ImageSamplingInstance (Context&                                                     context,
                !isLinearFilteringSupported(context.getInstanceInterface(), context.getPhysicalDevice(), imageFormat, VK_IMAGE_TILING_OPTIMAL))
                throw tcu::NotSupportedError(std::string("Unsupported format for linear filtering: ") + getFormatName(imageFormat));
 
+       if ((samplerParams.addressModeU == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE ||
+                samplerParams.addressModeV == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE ||
+                samplerParams.addressModeW == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE) &&
+               !de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), "VK_KHR_sampler_mirror_clamp_to_edge"))
+               TCU_THROW(NotSupportedError, "VK_KHR_sampler_mirror_clamp_to_edge not supported");
+
        if (isCompressedFormat(imageFormat) && imageViewType == VK_IMAGE_VIEW_TYPE_3D)
        {
                // \todo [2016-01-22 pyry] Mandate VK_ERROR_FORMAT_NOT_SUPPORTED
index 42b066c..6971b11 100644 (file)
@@ -123,12 +123,14 @@ Move<VkDevice> createDefaultDevice (const InstanceInterface&              vki,
                                                                        VkPhysicalDevice                                physicalDevice,
                                                                        deUint32                                                queueIndex,
                                                                        const VkPhysicalDeviceFeatures& enabledFeatures,
+                                                                       const vector<string>&                   enabledExtensions,
                                                                        const tcu::CommandLine&                 cmdLine)
 {
        VkDeviceQueueCreateInfo         queueInfo;
        VkDeviceCreateInfo                      deviceInfo;
        vector<string>                          enabledLayers;
        vector<const char*>                     layerPtrs;
+       vector<const char*>                     extensionPtrs;
        const float                                     queuePriority   = 1.0f;
 
        deMemset(&queueInfo,    0, sizeof(queueInfo));
@@ -146,6 +148,11 @@ Move<VkDevice> createDefaultDevice (const InstanceInterface&               vki,
        for (size_t ndx = 0; ndx < enabledLayers.size(); ++ndx)
                layerPtrs[ndx] = enabledLayers[ndx].c_str();
 
+       extensionPtrs.resize(enabledExtensions.size());
+
+       for (size_t ndx = 0; ndx < enabledExtensions.size(); ++ndx)
+               extensionPtrs[ndx] = enabledExtensions[ndx].c_str();
+
        queueInfo.sType                                                 = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
        queueInfo.pNext                                                 = DE_NULL;
        queueInfo.flags                                                 = (VkDeviceQueueCreateFlags)0u;
@@ -157,8 +164,8 @@ Move<VkDevice> createDefaultDevice (const InstanceInterface&                vki,
        deviceInfo.pNext                                                = DE_NULL;
        deviceInfo.queueCreateInfoCount                 = 1u;
        deviceInfo.pQueueCreateInfos                    = &queueInfo;
-       deviceInfo.enabledExtensionCount                = 0u;
-       deviceInfo.ppEnabledExtensionNames              = DE_NULL;
+       deviceInfo.enabledExtensionCount                = (deUint32)extensionPtrs.size();
+       deviceInfo.ppEnabledExtensionNames              = (extensionPtrs.empty() ? DE_NULL : &extensionPtrs[0]);
        deviceInfo.enabledLayerCount                    = (deUint32)layerPtrs.size();
        deviceInfo.ppEnabledLayerNames                  = (layerPtrs.empty() ? DE_NULL : &layerPtrs[0]);
        deviceInfo.pEnabledFeatures                             = &enabledFeatures;
@@ -180,12 +187,14 @@ public:
        VkDevice                                                        getDevice                                               (void) const    { return *m_device;                                             }
        const DeviceInterface&                          getDeviceInterface                              (void) const    { return m_deviceInterface;                             }
        const VkPhysicalDeviceProperties&       getDeviceProperties                             (void) const    { return m_deviceProperties;                    }
+       const vector<string>&                           getDeviceExtensions                             (void) const    { return m_deviceExtensions;                    }
 
        deUint32                                                        getUniversalQueueFamilyIndex    (void) const    { return m_universalQueueFamilyIndex;   }
        VkQueue                                                         getUniversalQueue                               (void) const;
 
 private:
        static VkPhysicalDeviceFeatures         filterDefaultDeviceFeatures             (const VkPhysicalDeviceFeatures& deviceFeatures);
+       static vector<string>                           filterDefaultDeviceExtensions   (const vector<VkExtensionProperties>& deviceExtensions);
 
        const Unique<VkInstance>                        m_instance;
        const InstanceDriver                            m_instanceInterface;
@@ -195,6 +204,7 @@ private:
        const deUint32                                          m_universalQueueFamilyIndex;
        const VkPhysicalDeviceFeatures          m_deviceFeatures;
        const VkPhysicalDeviceProperties        m_deviceProperties;
+       const vector<string>                            m_deviceExtensions;
 
        const Unique<VkDevice>                          m_device;
        const DeviceDriver                                      m_deviceInterface;
@@ -207,7 +217,8 @@ DefaultDevice::DefaultDevice (const PlatformInterface& vkPlatform, const tcu::Co
        , m_universalQueueFamilyIndex   (findQueueFamilyIndexWithCaps(m_instanceInterface, m_physicalDevice, VK_QUEUE_GRAPHICS_BIT|VK_QUEUE_COMPUTE_BIT))
        , m_deviceFeatures                              (filterDefaultDeviceFeatures(getPhysicalDeviceFeatures(m_instanceInterface, m_physicalDevice)))
        , m_deviceProperties                    (getPhysicalDeviceProperties(m_instanceInterface, m_physicalDevice))
-       , m_device                                              (createDefaultDevice(m_instanceInterface, m_physicalDevice, m_universalQueueFamilyIndex, m_deviceFeatures, cmdLine))
+       , m_deviceExtensions                    (filterDefaultDeviceExtensions(enumerateDeviceExtensionProperties(m_instanceInterface, m_physicalDevice, DE_NULL)))
+       , m_device                                              (createDefaultDevice(m_instanceInterface, m_physicalDevice, m_universalQueueFamilyIndex, m_deviceFeatures, m_deviceExtensions, cmdLine))
        , m_deviceInterface                             (m_instanceInterface, *m_device)
 {
 }
@@ -233,6 +244,20 @@ VkPhysicalDeviceFeatures DefaultDevice::filterDefaultDeviceFeatures (const VkPhy
        return enabledDeviceFeatures;
 }
 
+vector<string> DefaultDevice::filterDefaultDeviceExtensions (const vector<VkExtensionProperties>& deviceExtensions)
+{
+       vector<string> enabledExtensions;
+
+       // The only extension we enable always (when supported) is
+       // VK_KHR_sampler_mirror_clamp_to_edge that is defined in
+       // the core spec and supported widely.
+       const char* const       mirrorClampToEdgeExt    = "VK_KHR_sampler_mirror_clamp_to_edge";
+       if (vk::isExtensionSupported(deviceExtensions, vk::RequiredExtension(mirrorClampToEdgeExt)))
+               enabledExtensions.push_back(mirrorClampToEdgeExt);
+
+       return enabledExtensions;
+}
+
 // Allocator utilities
 
 vk::Allocator* createAllocator (DefaultDevice* device)
@@ -265,6 +290,7 @@ const vk::InstanceInterface&                        Context::getInstanceInterface                   (void) const { re
 vk::VkPhysicalDevice                                   Context::getPhysicalDevice                              (void) const { return m_device->getPhysicalDevice();                    }
 const vk::VkPhysicalDeviceFeatures&            Context::getDeviceFeatures                              (void) const { return m_device->getDeviceFeatures();                    }
 const vk::VkPhysicalDeviceProperties&  Context::getDeviceProperties                    (void) const { return m_device->getDeviceProperties();                  }
+const vector<string>&                                  Context::getDeviceExtensions                    (void) const { return m_device->getDeviceExtensions();                  }
 vk::VkDevice                                                   Context::getDevice                                              (void) const { return m_device->getDevice();                                    }
 const vk::DeviceInterface&                             Context::getDeviceInterface                             (void) const { return m_device->getDeviceInterface();                   }
 deUint32                                                               Context::getUniversalQueueFamilyIndex   (void) const { return m_device->getUniversalQueueFamilyIndex(); }
index 89a6492..379d86c 100644 (file)
@@ -65,6 +65,7 @@ public:
        vk::VkPhysicalDevice                                            getPhysicalDevice                               (void) const;
        const vk::VkPhysicalDeviceFeatures&                     getDeviceFeatures                               (void) const;
        const vk::VkPhysicalDeviceProperties&           getDeviceProperties                             (void) const;
+       const std::vector<std::string>&                         getDeviceExtensions                             (void) const;
        vk::VkDevice                                                            getDevice                                               (void) const;
        const vk::DeviceInterface&                                      getDeviceInterface                              (void) const;
        deUint32                                                                        getUniversalQueueFamilyIndex    (void) const;
index 3926a8e..715c3ee 100644 (file)
@@ -3947,7 +3947,7 @@ GeometryProgramQueryCase::GeometryProgramQueryCase (Context& context, const char
 
 void GeometryProgramQueryCase::init (void)
 {
-       if (!m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader") && glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)))
+       if (!(m_context.getContextInfo().isExtensionSupported("GL_EXT_geometry_shader") || glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2))))
                TCU_THROW(NotSupportedError, "Tests require GL_EXT_geometry_shader extension or higher context version.");
 }
 
index 0a5ad9e..1410aea 100644 (file)
@@ -161,8 +161,8 @@ void blend_equationi (NegativeTestContext& ctx)
 {
        glw::GLint maxDrawBuffers = -1;
 
-       if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_KHR_blend_equation_advanced"))
-               throw tcu::NotSupportedError("GL_KHR_blend_equation_advanced is not supported", DE_NULL, __FILE__, __LINE__);
+       if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed"))
+               throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
 
        ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
        ctx.beginSection("GL_INVALID_ENUM is generated if mode is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
@@ -181,8 +181,8 @@ void blend_equation_separatei (NegativeTestContext& ctx)
 {
        glw::GLint maxDrawBuffers = -1;
 
-       if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_KHR_blend_equation_advanced"))
-               throw tcu::NotSupportedError("GL_KHR_blend_equation_advanced is not supported", DE_NULL, __FILE__, __LINE__);
+       if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed"))
+               throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
 
        ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
        ctx.beginSection("GL_INVALID_ENUM is generated if modeRGB is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
@@ -229,8 +229,8 @@ void blend_funci (NegativeTestContext& ctx)
 {
        glw::GLint maxDrawBuffers = -1;
 
-       if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_KHR_blend_equation_advanced"))
-               throw tcu::NotSupportedError("GL_KHR_blend_equation_advanced is not supported", DE_NULL, __FILE__, __LINE__);
+       if (!contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed"))
+               throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
 
        ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
        ctx.beginSection("GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.");
@@ -251,8 +251,8 @@ void blend_func_separatei (NegativeTestContext& ctx)
 {
        glw::GLint maxDrawBuffers = -1;
 
-       if (!glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_KHR_blend_equation_advanced"))
-               throw tcu::NotSupportedError("GL_KHR_blend_equation_advanced is not supported", DE_NULL, __FILE__, __LINE__);
+       if (!glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) && !ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed"))
+               throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
 
        ctx.glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
        ctx.beginSection("GL_INVALID_ENUM is generated if srcRGB, dstRGB, srcAlpha, or dstAlpha is not an accepted value.");
index e33ecbf..64b3504 100644 (file)
@@ -517,20 +517,24 @@ void program_binary (NegativeTestContext& ctx)
        ctx.glGetProgramiv              (srcProgram.getProgram(), GL_LINK_STATUS,                       &linkStatus);
        ctx.getLog() << TestLog::Message << "// GL_PROGRAM_BINARY_LENGTH = " << bufSize << TestLog::EndMessage;
        ctx.getLog() << TestLog::Message << "// GL_LINK_STATUS = " << linkStatus << TestLog::EndMessage;
-       TCU_CHECK(bufSize > 0);
-       binaryBuf.resize(bufSize);
-       ctx.glGetProgramBinary  (srcProgram.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryBuf[0]);
-       ctx.expectError         (GL_NO_ERROR);
 
-       ctx.beginSection("GL_INVALID_OPERATION is generated if program is not the name of an existing program object.");
-       ctx.glProgramBinary             (dummyShader, binaryFormat, &binaryBuf[0], binaryLength);
-       ctx.expectError         (GL_INVALID_OPERATION);
-       ctx.endSection();
+       TCU_CHECK(bufSize >= 0);
+       if (bufSize > 0)
+       {
+               binaryBuf.resize(bufSize);
+               ctx.glGetProgramBinary  (srcProgram.getProgram(), bufSize, &binaryLength, &binaryFormat, &binaryBuf[0]);
+               ctx.expectError                 (GL_NO_ERROR);
 
-       ctx.beginSection("GL_INVALID_ENUM is generated if binaryFormat is not a value recognized by the implementation.");
-       ctx.glProgramBinary             (dstProgram, -1, &binaryBuf[0], binaryLength);
-       ctx.expectError         (GL_INVALID_ENUM);
-       ctx.endSection();
+               ctx.beginSection("GL_INVALID_OPERATION is generated if program is not the name of an existing program object.");
+               ctx.glProgramBinary             (dummyShader, binaryFormat, &binaryBuf[0], binaryLength);
+               ctx.expectError                 (GL_INVALID_OPERATION);
+               ctx.endSection();
+
+               ctx.beginSection("GL_INVALID_ENUM is generated if binaryFormat is not a value recognized by the implementation.");
+               ctx.glProgramBinary             (dstProgram, -1, &binaryBuf[0], binaryLength);
+               ctx.expectError                 (GL_INVALID_ENUM);
+               ctx.endSection();
+       }
 
        ctx.glDeleteShader(dummyShader);
        ctx.glDeleteProgram(dstProgram);