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:
parent
756a9d7e49
commit
9e5b9edb43
|
@ -49,7 +49,9 @@ declare_args() {
|
||||||
# GN does not allow reading a variable defined in the same 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
|
# Put them in two separate declare_args() when setting the value of one
|
||||||
# argument based on another.
|
# argument based on another.
|
||||||
declare_args() {
|
if (dawn_enable_vulkan) {
|
||||||
# Uses our built version of Vulkan validation layers
|
declare_args() {
|
||||||
dawn_enable_vulkan_validation_layers = dawn_enable_vulkan && is_win
|
# Uses our built version of Vulkan validation layers
|
||||||
|
dawn_enable_vulkan_validation_layers = is_linux || is_win
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,6 +214,12 @@ void DawnTestEnvironment::SetUp() {
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DawnTestEnvironment::TearDown() {
|
||||||
|
// When Vulkan validation layers are enabled, it's unsafe to call Vulkan APIs in the destructor
|
||||||
|
// of a static/global variable, so the instance must be manually released beforehand.
|
||||||
|
mInstance.reset();
|
||||||
|
}
|
||||||
|
|
||||||
bool DawnTestEnvironment::UsesWire() const {
|
bool DawnTestEnvironment::UsesWire() const {
|
||||||
return mUseWire;
|
return mUseWire;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,7 @@ class DawnTestEnvironment : public testing::Environment {
|
||||||
static void SetEnvironment(DawnTestEnvironment* env);
|
static void SetEnvironment(DawnTestEnvironment* env);
|
||||||
|
|
||||||
void SetUp() override;
|
void SetUp() override;
|
||||||
|
void TearDown() override;
|
||||||
|
|
||||||
bool UsesWire() const;
|
bool UsesWire() const;
|
||||||
bool IsBackendValidationEnabled() const;
|
bool IsBackendValidationEnabled() const;
|
||||||
|
|
Loading…
Reference in New Issue