Edit

kc3-lang/angle/src/tests/test_expectations/GPUTestExpectationsTest.cpp

Branch :

  • Show log

    Commit

  • Author : Shahbaz Youssefi
    Date : 2020-10-29 00:31:49
    Hash : 09932e04
    Message : Vulkan: Support emulated pre-rotation in dEQP testing Similarly to end2end tests, the window dimensions are swapped with emulated prerotation at 90 and 270 degrees, while maintaining to the application that dimensions are as requested. The following new command line argument can be used to select an emulated prerotation: --emulated-pre-rotation=90 --emulated-pre-rotation=180 --emulated-pre-rotation=270 For example: $ ./angle_deqp_gles2_tests --use-angle=vulkan \ --deqp-case=*draw* \ --emulated-pre-rotation=270 Additionally, the deqp test expectations can be marked with the following new tags to add suppressions for failing tests under prerotation: PREROTATION PREROTATION90 PREROTATION180 PREROTATION270 Bug: angleproject:4901 Change-Id: I7a68c1a1e7da4366cde981469c589d8d900c40c5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2506810 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>

  • src/tests/test_expectations/GPUTestExpectationsTest.cpp
  • //
    // Copyright 2019 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    
    // GPUTestExpectationsTest.cpp : Tests of the test_expectations library.
    
    #include "test_expectations/GPUTestConfig.h"
    #include "test_expectations/GPUTestExpectationsParser.h"
    #include "test_utils/ANGLETest.h"
    
    namespace angle
    {
    
    class GPUTestConfigTest : public ANGLETest
    {
      protected:
        GPUTestConfigTest() {}
    
        // todo(jonahr): Eventually could add support for all conditions/operating
        // systems, but these are the ones in use for now
        void validateConfigBase(const GPUTestConfig &config)
        {
            EXPECT_EQ(IsWindows(), config.getConditions()[GPUTestConfig::kConditionWin]);
            EXPECT_EQ(IsOSX(), config.getConditions()[GPUTestConfig::kConditionMac]);
            EXPECT_EQ(IsLinux(), config.getConditions()[GPUTestConfig::kConditionLinux]);
            EXPECT_EQ(IsAndroid(), config.getConditions()[GPUTestConfig::kConditionAndroid]);
            EXPECT_EQ(IsNexus5X(), config.getConditions()[GPUTestConfig::kConditionNexus5X]);
            EXPECT_EQ((IsPixel2() || IsPixel2XL()),
                      config.getConditions()[GPUTestConfig::kConditionPixel2OrXL]);
            EXPECT_EQ(IsIntel(), config.getConditions()[GPUTestConfig::kConditionIntel]);
            EXPECT_EQ(IsAMD(), config.getConditions()[GPUTestConfig::kConditionAMD]);
            EXPECT_EQ(IsNVIDIA(), config.getConditions()[GPUTestConfig::kConditionNVIDIA]);
            EXPECT_EQ(IsDebug(), config.getConditions()[GPUTestConfig::kConditionDebug]);
            EXPECT_EQ(IsRelease(), config.getConditions()[GPUTestConfig::kConditionRelease]);
        }
    
        void validateConfigAPI(const GPUTestConfig &config,
                               const GPUTestConfig::API &api,
                               uint32_t preRotation)
        {
            bool D3D9      = false;
            bool D3D11     = false;
            bool GLDesktop = false;
            bool GLES      = false;
            bool Vulkan    = false;
            bool Metal     = false;
            switch (api)
            {
                case GPUTestConfig::kAPID3D9:
                    D3D9 = true;
                    break;
                case GPUTestConfig::kAPID3D11:
                    D3D11 = true;
                    break;
                case GPUTestConfig::kAPIGLDesktop:
                    GLDesktop = true;
                    break;
                case GPUTestConfig::kAPIGLES:
                    GLES = true;
                    break;
                case GPUTestConfig::kAPIVulkan:
                    Vulkan = true;
                    break;
                case GPUTestConfig::kAPIMetal:
                    Metal = true;
                    break;
                case GPUTestConfig::kAPIUnknown:
                default:
                    break;
            }
            EXPECT_EQ(D3D9, config.getConditions()[GPUTestConfig::kConditionD3D9]);
            EXPECT_EQ(D3D11, config.getConditions()[GPUTestConfig::kConditionD3D11]);
            EXPECT_EQ(GLDesktop, config.getConditions()[GPUTestConfig::kConditionGLDesktop]);
            EXPECT_EQ(GLES, config.getConditions()[GPUTestConfig::kConditionGLES]);
            EXPECT_EQ(Vulkan, config.getConditions()[GPUTestConfig::kConditionVulkan]);
            EXPECT_EQ(Metal, config.getConditions()[GPUTestConfig::kConditionMetal]);
    
            switch (preRotation)
            {
                case 90:
                    EXPECT_TRUE(config.getConditions()[GPUTestConfig::kConditionPreRotation]);
                    EXPECT_TRUE(config.getConditions()[GPUTestConfig::kConditionPreRotation90]);
                    EXPECT_FALSE(config.getConditions()[GPUTestConfig::kConditionPreRotation180]);
                    EXPECT_FALSE(config.getConditions()[GPUTestConfig::kConditionPreRotation270]);
                    break;
                case 180:
                    EXPECT_TRUE(config.getConditions()[GPUTestConfig::kConditionPreRotation]);
                    EXPECT_FALSE(config.getConditions()[GPUTestConfig::kConditionPreRotation90]);
                    EXPECT_TRUE(config.getConditions()[GPUTestConfig::kConditionPreRotation180]);
                    EXPECT_FALSE(config.getConditions()[GPUTestConfig::kConditionPreRotation270]);
                    break;
                case 270:
                    EXPECT_TRUE(config.getConditions()[GPUTestConfig::kConditionPreRotation]);
                    EXPECT_FALSE(config.getConditions()[GPUTestConfig::kConditionPreRotation90]);
                    EXPECT_FALSE(config.getConditions()[GPUTestConfig::kConditionPreRotation180]);
                    EXPECT_TRUE(config.getConditions()[GPUTestConfig::kConditionPreRotation270]);
                    break;
                default:
                    EXPECT_FALSE(config.getConditions()[GPUTestConfig::kConditionPreRotation]);
                    EXPECT_FALSE(config.getConditions()[GPUTestConfig::kConditionPreRotation90]);
                    EXPECT_FALSE(config.getConditions()[GPUTestConfig::kConditionPreRotation180]);
                    EXPECT_FALSE(config.getConditions()[GPUTestConfig::kConditionPreRotation270]);
                    break;
            }
        }
    };
    
    // Create a new GPUTestConfig and make sure all the condition flags were set
    // correctly based on the hardware.
    TEST_P(GPUTestConfigTest, GPUTestConfigConditions)
    {
        GPUTestConfig config;
        validateConfigBase(config);
    }
    
    // Create a new GPUTestConfig with each backend specified and validate the
    // condition flags are set correctly.
    TEST_P(GPUTestConfigTest, GPUTestConfigConditions_D3D9)
    {
        GPUTestConfig config(GPUTestConfig::kAPID3D9, 0);
        validateConfigAPI(config, GPUTestConfig::kAPID3D9, 0);
    }
    
    TEST_P(GPUTestConfigTest, GPUTestConfigConditions_D3D11)
    {
        GPUTestConfig config(GPUTestConfig::kAPID3D11, 0);
        validateConfigAPI(config, GPUTestConfig::kAPID3D11, 0);
    }
    
    TEST_P(GPUTestConfigTest, GPUTestConfigConditions_Metal)
    {
        GPUTestConfig config(GPUTestConfig::kAPIMetal, 0);
        validateConfigAPI(config, GPUTestConfig::kAPIMetal, 0);
    }
    
    TEST_P(GPUTestConfigTest, GPUTestConfigConditions_GLDesktop)
    {
        GPUTestConfig config(GPUTestConfig::kAPIGLDesktop, 0);
        validateConfigAPI(config, GPUTestConfig::kAPIGLDesktop, 0);
    }
    
    TEST_P(GPUTestConfigTest, GPUTestConfigConditions_GLES)
    {
        GPUTestConfig config(GPUTestConfig::kAPIGLES, 0);
        validateConfigAPI(config, GPUTestConfig::kAPIGLES, 0);
    }
    
    TEST_P(GPUTestConfigTest, GPUTestConfigConditions_Vulkan)
    {
        GPUTestConfig config(GPUTestConfig::kAPIVulkan, 0);
        validateConfigAPI(config, GPUTestConfig::kAPIVulkan, 0);
    }
    
    TEST_P(GPUTestConfigTest, GPUTestConfigConditions_Vulkan_PreRotation90)
    {
        GPUTestConfig config(GPUTestConfig::kAPIVulkan, 90);
        validateConfigAPI(config, GPUTestConfig::kAPIVulkan, 90);
    }
    
    TEST_P(GPUTestConfigTest, GPUTestConfigConditions_Vulkan_PreRotation180)
    {
        GPUTestConfig config(GPUTestConfig::kAPIVulkan, 180);
        validateConfigAPI(config, GPUTestConfig::kAPIVulkan, 180);
    }
    
    TEST_P(GPUTestConfigTest, GPUTestConfigConditions_Vulkan_PreRotation270)
    {
        GPUTestConfig config(GPUTestConfig::kAPIVulkan, 270);
        validateConfigAPI(config, GPUTestConfig::kAPIVulkan, 270);
    }
    
    // Use this to select which configurations (e.g. which renderer, which GLES major version) these
    // tests should be run against.
    ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(GPUTestConfigTest);
    
    }  // namespace angle