Enable Vulkan validation layers on Linux

When vkDestroyDebugReportCallbackEXT() is called in Backend::~Backend()
and Vulkan validation layers are in use, the variable unique_id_mapping
is referenced internally[1]. However, the variable is global[2] and it's
destructed before Backend::~Backend(), which causes a use-after-free
issue. The issue was unnoticed on Windows, but we observed the crash at
exit on Linux.

[1] 9fba37afae/layers/generated/layer_chassis_dispatch.cpp (4961)
[2] 9fba37afae/layers/generated/chassis.cpp (40)

Bug: dawn:150
Change-Id: I505373a88ef9795243dd18da9785fb49d253e498
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13787
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Jiajie Hu
2019-11-20 09:45:41 +00:00
committed by Commit Bot service account
parent 756a9d7e49
commit 9e5b9edb43
3 changed files with 12 additions and 3 deletions

View File

@@ -49,7 +49,9 @@ declare_args() {
# GN does not allow reading a variable defined in the same declare_args().
# Put them in two separate declare_args() when setting the value of one
# argument based on another.
declare_args() {
# Uses our built version of Vulkan validation layers
dawn_enable_vulkan_validation_layers = dawn_enable_vulkan && is_win
if (dawn_enable_vulkan) {
declare_args() {
# Uses our built version of Vulkan validation layers
dawn_enable_vulkan_validation_layers = is_linux || is_win
}
}