Hash :
2de99d47
Author :
Date :
2022-11-17T12:19:35
Reset instance/device extensions in RendererVk::onDestroy() RendererVk::initialize() adds a nullptr to the end of RendererVk::mEnabledInstanceExtensions (presumably to ensure the VK implementation crashes if it tries to read past?). If RendererVk::onDestroy() fails to clear this nullptr, it can lead to a crash when sorting the extension lists when the renderer is re-initialized the second time. Bug: b/249457381 Test: cvd start --gpu_mode=guest_swiftshader Test: EGLDisplayTest.InitalizeTerminateInitalize/ES3_Vulkan_NoFixture Change-Id: Ib24af11024cad6b28284f3a75cc862c48abec258 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4035646 Commit-Queue: Jason Macnak <natsu@google.com> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
//
// Copyright 2022 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.
//
#include <gtest/gtest.h>
#include <vector>
#include "test_utils/ANGLETest.h"
using namespace angle;
class EGLDisplayTest : public ANGLETest<>
{};
// Tests that an EGLDisplay can be re-initialized.
TEST_P(EGLDisplayTest, InitalizeTerminateInitalize)
{
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
EXPECT_EGL_TRUE(eglInitialize(display, nullptr, nullptr) != EGL_FALSE);
EXPECT_EGL_TRUE(eglTerminate(display) != EGL_FALSE);
EXPECT_EGL_TRUE(eglInitialize(display, nullptr, nullptr) != EGL_FALSE);
}
ANGLE_INSTANTIATE_TEST(EGLDisplayTest,
WithNoFixture(ES2_D3D9()),
WithNoFixture(ES2_D3D11()),
WithNoFixture(ES2_OPENGL()),
WithNoFixture(ES2_VULKAN()),
WithNoFixture(ES3_D3D11()),
WithNoFixture(ES3_OPENGL()),
WithNoFixture(ES3_VULKAN()));