Hash :
f3d5dac3
Author :
Date :
2021-08-23T17:25:15
Vulkan: SPIR-V Gen: Drop dependency to glslang
The SPIR-V gen path is now made default. Compilation through glslang is
still supported for debugging, and is enabled on the GLSL* end2end tests
for smoke testing. On release builds, glslang is not supported.
To test with glslang, add the following gn arg (only necessary if dcheck
is disabled):
angle_enable_spirv_gen_through_glslang = true
Then enable the generateSPIRVThroughGlslang feature. This can be done
by setting an environment variable:
ANGLE_FEATURE_OVERRIDES_ENABLED=generateSPIRVThroughGlslang ./angle_deqp_gles2_tests
Binary size saving:
- 1.3MB on Linux (SPIR-V gen itself: 240KB)
- 730KB on Android (SPIR-V gen itself: 140KB)
Perf tests:
- LinkProgramBenchmark.Run/vulkan_compile_single_thread
* Through glslang:
truncated mean: 1287033.36
* Direct SPIR-V Gen:
truncated mean: 244495.91 (~80% reduction)
- LinkProgramBenchmark.Run/vulkan_compile_multi_thread
* Through glslang:
truncated mean: 4565894.83
* Direct SPIR-V Gen:
truncated mean: 1158164.10 (~75% reduction)
Bug: angleproject:4889
Bug: angleproject:6210
Change-Id: I486342702977c8114e90073b97183aba115a8b2d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3115140
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
//
// 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(IsIOS(), config.getConditions()[GPUTestConfig::kConditionIOS]);
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