aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Madill <jmadill@chromium.org>2021-07-19 10:30:57 -0400
committerAngle LUCI CQ <angle-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-07-19 19:05:44 +0000
commit2b86e2d60f03d6cd6aa59c9aec78ff0ff604eaff (patch)
treec5a90f96f65ec16807cb8a1f88a32207f0e0f900
parent8c1cbc5a85e5ce57f45b88d1fcfe5dcc4da9fb6b (diff)
downloadangle-2b86e2d60f03d6cd6aa59c9aec78ff0ff604eaff.tar.gz
GN: Update dcheck/assert conditions.
In preparation for a Chromium change that makes dchecks enabled by default in Release builds, we'll keep ASSERT disabled in Release by default. We add a new flag 'angle_assert_always_on' for controlling ANGLE ASSERT behaviour. Also slightly refactors the direct SPIR-V generation GN. Chromium CL: https://crrev.com/c/2893204 Bug: chromium:1225701 Change-Id: I01a6def28d7c21e771e9800889a6b9c274972de2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3035447 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Dirk Pranke <dpranke@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
-rw-r--r--BUILD.gn12
-rw-r--r--doc/DevSetup.md8
-rw-r--r--doc/DevSetupAndroid.md4
-rw-r--r--gni/angle.gni13
-rw-r--r--include/GLSLANG/ShaderLang.h2
-rw-r--r--infra/specs/angle_mb_config.pyl2
-rw-r--r--src/common/debug.h2
-rw-r--r--src/common/spirv/BUILD.gn11
-rwxr-xr-xsrc/tests/capture_replay_tests.py2
-rw-r--r--src/tests/perf_tests/README.md2
10 files changed, 35 insertions, 23 deletions
diff --git a/BUILD.gn b/BUILD.gn
index aef8e41431..6adfd38656 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -321,9 +321,9 @@ config("debug_annotations_config") {
}
}
-config("angle_release_asserts_config") {
- if (dcheck_always_on) {
- defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ]
+config("angle_asserts_config") {
+ if (angle_assert_always_on) {
+ defines = [ "ANGLE_ASSERT_ALWAYS_ON" ]
}
}
@@ -564,12 +564,6 @@ template("translator_lib") {
# This translator is needed by metal backend also.
sources += angle_translator_lib_vulkan_sources
-
- # Enable direct SPIR-V generation conditionally to avoid increasing binary size of ANGLE on
- # official builds until that's the only path.
- if (dcheck_always_on || is_debug) {
- defines += [ "ANGLE_ENABLE_DIRECT_SPIRV_GENERATION" ]
- }
}
if (angle_enable_vulkan || use_fuzzing_engine) {
diff --git a/doc/DevSetup.md b/doc/DevSetup.md
index b90b809e03..17c458b7b6 100644
--- a/doc/DevSetup.md
+++ b/doc/DevSetup.md
@@ -56,10 +56,10 @@ On Windows only, ensure you **set `DEPOT_TOOLS_WIN_TOOLCHAIN=0` in your environm
GN will generate ninja files. To change the default build options run `gn args out/Debug`. Some commonly used options are:
```
-target_cpu = "x86" (default is "x64")
-is_clang = false (to use system default compiler instead of clang)
-is_debug = true (enable debugging, true is the default)
-dcheck_always_on = true (enable release asserts and debug layers)
+target_cpu = "x86" (default is "x64")
+is_clang = false (to use system default compiler instead of clang)
+is_debug = false (for release builds. is_debug = true is the default)
+angle_assert_always_on = true (enable release asserts and debug layers)
```
For a release build run `gn args out/Release` and set `is_debug = false`.
diff --git a/doc/DevSetupAndroid.md b/doc/DevSetupAndroid.md
index 3e6d5325d8..404bcc9feb 100644
--- a/doc/DevSetupAndroid.md
+++ b/doc/DevSetupAndroid.md
@@ -19,8 +19,8 @@ target_os = "android"
target_cpu = "arm64"
is_component_build = false
is_debug = false
-dcheck_always_on = true # Recommended for debugging. Turn off for performance.
-use_goma = true # Googlers-only! If you're not a Googler remove this.
+angle_assert_always_on = true # Recommended for debugging. Turn off for performance.
+use_goma = true # Googlers-only! If you're not a Googler remove this.
```
More targeted GN arg combinations can be found [below](#android-gn-args-combinations).
diff --git a/gni/angle.gni b/gni/angle.gni
index fb9c310ae5..ae27200ebb 100644
--- a/gni/angle.gni
+++ b/gni/angle.gni
@@ -70,6 +70,8 @@ if (angle_has_build) {
angle_data_dir = "angledata"
declare_args() {
+ angle_assert_always_on = build_with_chromium && dcheck_always_on
+
if (current_cpu == "arm64" || current_cpu == "x64" ||
current_cpu == "mips64el" || current_cpu == "s390x" ||
current_cpu == "ppc64") {
@@ -84,6 +86,13 @@ declare_args() {
}
declare_args() {
+ # By default we enable debug layers when asserts are turned on.
+ angle_debug_layers_enabled = is_debug || angle_assert_always_on
+
+ # Enable direct SPIR-V generation conditionally to avoid increasing binary size of ANGLE on
+ # official builds until that's the only path.
+ angle_enable_direct_spirv_gen = is_debug || angle_assert_always_on
+
if (!is_android) {
ndk_api_level_at_least_26 = false
} else {
@@ -175,7 +184,7 @@ declare_args() {
# Vulkan Validation Layers compatibility issues, see http://crrev/c/1405714.
angle_enable_vulkan_validation_layers =
angle_enable_vulkan && !is_ubsan && !is_tsan && !is_asan &&
- (is_debug || dcheck_always_on) && !is_mac &&
+ angle_debug_layers_enabled && !is_mac &&
(!is_android || ndk_api_level_at_least_26)
# ISpriteVisual windows cannot be validated and can lead to crashes if an invalid window is
@@ -216,7 +225,7 @@ if (!defined(angle_zlib_compression_utils_dir)) {
}
angle_common_configs = [
- angle_root + ":angle_release_asserts_config",
+ angle_root + ":angle_asserts_config",
angle_root + ":constructor_and_destructor_warnings",
angle_root + ":extra_warnings",
angle_root + ":internal_config",
diff --git a/include/GLSLANG/ShaderLang.h b/include/GLSLANG/ShaderLang.h
index b2432b2498..18aa8c8469 100644
--- a/include/GLSLANG/ShaderLang.h
+++ b/include/GLSLANG/ShaderLang.h
@@ -338,7 +338,7 @@ const ShCompileOptions SH_ADD_VULKAN_XFB_EXTENSION_SUPPORT_CODE = UINT64_C(1) <<
const ShCompileOptions SH_INIT_FRAGMENT_OUTPUT_VARIABLES = UINT64_C(1) << 57;
// Transitory flag to select between producing SPIR-V directly vs using glslang. Ignored in
-// non-dcheck-enabled builds to avoid increasing ANGLE's binary size while both generators coexist.
+// non-assert-enabled builds to avoid increasing ANGLE's binary size while both generators coexist.
const ShCompileOptions SH_GENERATE_SPIRV_DIRECTLY = UINT64_C(1) << 58;
// Generate workarounds in SPIR-V for buggy code.
diff --git a/infra/specs/angle_mb_config.pyl b/infra/specs/angle_mb_config.pyl
index c7e747d17c..9ecbd0808d 100644
--- a/infra/specs/angle_mb_config.pyl
+++ b/infra/specs/angle_mb_config.pyl
@@ -95,7 +95,7 @@
'gn_args': 'is_debug=false symbol_level=1',
},
'release': {
- 'gn_args': 'is_debug=false dcheck_always_on=true symbol_level=1',
+ 'gn_args': 'is_debug=false angle_assert_always_on=true symbol_level=1',
},
'traces': {
'gn_args': 'build_angle_trace_perf_tests=true',
diff --git a/src/common/debug.h b/src/common/debug.h
index 9095d4eb29..129d43e4df 100644
--- a/src/common/debug.h
+++ b/src/common/debug.h
@@ -244,7 +244,7 @@ std::ostream &FmtHex(std::ostream &os, T value)
# define ANGLE_TRACE_ENABLED
#endif
-#if !defined(NDEBUG) || defined(ANGLE_ENABLE_RELEASE_ASSERTS)
+#if !defined(NDEBUG) || defined(ANGLE_ASSERT_ALWAYS_ON)
# define ANGLE_ENABLE_ASSERTS
#endif
diff --git a/src/common/spirv/BUILD.gn b/src/common/spirv/BUILD.gn
index adc1db646c..ad6487be44 100644
--- a/src/common/spirv/BUILD.gn
+++ b/src/common/spirv/BUILD.gn
@@ -10,6 +10,12 @@ angle_source_set("angle_spirv_headers") {
deps = [ "$angle_root:angle_common" ]
}
+config("angle_spirv_config") {
+ if (angle_enable_direct_spirv_gen) {
+ defines = [ "ANGLE_ENABLE_DIRECT_SPIRV_GENERATION" ]
+ }
+}
+
angle_source_set("angle_spirv_base") {
sources = [ "angle_spirv_utils.cpp" ]
deps = [
@@ -18,8 +24,9 @@ angle_source_set("angle_spirv_base") {
"${angle_spirv_headers_dir}:spv_headers",
"${angle_spirv_tools_dir}:spvtools_headers",
]
+ public_configs = [ ":angle_spirv_config" ]
- if (dcheck_always_on || is_debug) {
+ if (angle_debug_layers_enabled) {
deps += [ "$angle_spirv_tools_dir:spvtools_val" ]
}
}
@@ -35,6 +42,7 @@ angle_source_set("angle_spirv_builder") {
"$angle_root:angle_common",
"${angle_spirv_headers_dir}:spv_headers",
]
+ public_configs = [ ":angle_spirv_config" ]
}
angle_source_set("angle_spirv_parser") {
@@ -48,4 +56,5 @@ angle_source_set("angle_spirv_parser") {
"$angle_root:angle_common",
"${angle_spirv_headers_dir}:spv_headers",
]
+ public_configs = [ ":angle_spirv_config" ]
}
diff --git a/src/tests/capture_replay_tests.py b/src/tests/capture_replay_tests.py
index 6965fb977b..27a160950f 100755
--- a/src/tests/capture_replay_tests.py
+++ b/src/tests/capture_replay_tests.py
@@ -263,7 +263,7 @@ class ChildProcessesManager():
if not args.debug:
gn_args.append(('is_debug', 'false'))
gn_args.append(('symbol_level', '1'))
- gn_args.append(('dcheck_always_on', 'true'))
+ gn_args.append(('angle_assert_always_on', 'true'))
if args.goma_dir:
gn_args.append(('goma_dir', '"%s"' % args.goma_dir))
if args.asan:
diff --git a/src/tests/perf_tests/README.md b/src/tests/perf_tests/README.md
index 1320a0b9b9..7faa8e4c6d 100644
--- a/src/tests/perf_tests/README.md
+++ b/src/tests/perf_tests/README.md
@@ -6,7 +6,7 @@ You can also build your own dashboards. For example, a comparison of ANGLE's bac
## Running the Tests
-You can follow the usual instructions to [check out and build ANGLE](../../../doc/DevSetup.md). Build the `angle_perftests` target. Note that all test scores are higher-is-better. You should also ensure `is_debug=false` in your build. Running with `dcheck_always_on` or debug validation enabled is not recommended.
+You can follow the usual instructions to [check out and build ANGLE](../../../doc/DevSetup.md). Build the `angle_perftests` target. Note that all test scores are higher-is-better. You should also ensure `is_debug=false` in your build. Running with `angle_assert_always_on` or debug validation enabled is not recommended.
Variance can be a problem when benchmarking. We have a test harness to run a single test in an infinite loop and print some statistics to help mitigate variance. See [`scripts/perf_test_runner.py`](https://chromium.googlesource.com/angle/angle/+/master/scripts/perf_test_runner.py). To use the script first compile `angle_perftests` into a folder with the word `Release` in it. Then provide the name of the test as the argument to the script. The script will automatically pick up the most current `angle_perftests` and run in an infinite loop.