ANGLETest: fix crashes when switching between GLESDriverTypes

The condition for mLastLoadedDriver was incorrect. We never initialized
it, so it never switched to the correct EGL implementation when
alternating between tests using different GLESDriverTypes.

This was reproducible with:

    angle_end2end_tests.exe --gtest_filter="SimpleOperationTest.DrawSingleSampleWithAlphaToCoverage/ES3_D3D11:SimpleOperationTest.DrawSingleSampleWithAlphaToCoverage/ES3_ANGLE_Vulkan_Secondaries_SwiftShader:SimpleOperationTest.DrawSingleMultiSampleWithAlphaToCoverage/ES3_D3D11"

The above does three tests:

    - D3D11 test (using GLESDriverType::AngleEGL)
    - Vulkan test (using GLESDriverType::AngleVulkanSecondariesEGL)
    - D3D11 test (using GLESDriverType::AngleEGL)

What would happen is this:

    - the first test would initialize a D3D11 EGLDisplay
    - the second test would switch the API entry points to use
      AngleVulkanSecondariesEGL
    - the third test begins reuses the first test's EGLDisplay, but
      fails to notice the GLESDriverType change and uses the
      AngleVulkanSecondariesEGL entry points
    - when eglQueryString is called with the D3D11 EGLDisplay, the
      VulkanSecondaries library has no knowledge of this display and
      fails the call

Bug: angleproject:8286
Change-Id: I1f22060e2c5725dad5e410a76385e2802b627844
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4749296
Auto-Submit: Steven Noonan <steven@uplinklabs.net>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Steven Noonan
2023-08-02 08:06:47 -07:00
committed by Angle LUCI CQ
parent 135a24fc37
commit 30bd0149fc

View File

@@ -656,7 +656,7 @@ void ANGLETestBase::ANGLETestSetUp()
return;
}
if (mLastLoadedDriver.valid() && mCurrentParams->driver != mLastLoadedDriver.value())
if (!mLastLoadedDriver.valid() || mCurrentParams->driver != mLastLoadedDriver.value())
{
LoadEntryPointsWithUtilLoader(mCurrentParams->driver);
mLastLoadedDriver = mCurrentParams->driver;