// // Copyright 2021 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. // // EGLMultiContextTest.cpp: // Tests relating to multiple non-shared Contexts. #include <gtest/gtest.h> #include "test_utils/ANGLETest.h" #include "test_utils/MultiThreadSteps.h" #include "test_utils/angle_test_configs.h" #include "test_utils/gl_raii.h" #include "util/EGLWindow.h" #include "util/test_utils.h" usingnamespaceangle; namespace { EGLBoolean SafeDestroyContext(EGLDisplay display, EGLContext &context) { … } class EGLMultiContextTest : public ANGLETest<> { … }; // Test that calling eglDeleteContext on a context that is not current succeeds. TEST_P(EGLMultiContextTest, TestContextDestroySimple) { … } // Test that an error is generated when using EGL objects after calling eglTerminate. TEST_P(EGLMultiContextTest, NegativeTestAfterEglTerminate) { … } // Test that a compute shader running in one thread will still work when rendering is happening in // another thread (with non-shared contexts). The non-shared context will still share a Vulkan // command buffer. TEST_P(EGLMultiContextTest, ComputeShaderOkayWithRendering) { … } // Test that repeated EGL init + terminate with improper cleanup doesn't cause an OOM crash. // To reproduce the OOM error - // 1. Increase the loop count to a large number // 2. Remove the call to "eglReleaseThread" in the for loop TEST_P(EGLMultiContextTest, RepeatedEglInitAndTerminate) { … } // Test that thread B can reuse the unterminated display created by thread A // even after thread A is destroyed. TEST_P(EGLMultiContextTest, ReuseUnterminatedDisplay) { … } // Test that thread B can wait on thread A's sync before thread A flushes it, and wakes up after // that. Note that only validatity of the fence operations are tested here. The test could // potentially be enhanced with EGL images similarly to how // MultithreadingTestES3::testFenceWithOpenRenderPass tests correctness of synchronization through // a shared texture. void EGLMultiContextTest::testFenceWithOpenRenderPass(FenceTest test, FlushMethod flushMethod) { … } // Test that thread B can wait on thread A's sync before thread A flushes it, and wakes up after // that. TEST_P(EGLMultiContextTest, ThreadBClientWaitBeforeThreadASyncFlush) { … } // Test that thread B can wait on thread A's sync before thread A flushes it, and wakes up after // that. TEST_P(EGLMultiContextTest, ThreadBServerWaitBeforeThreadASyncFlush) { … } // Test that thread B can wait on thread A's sync before thread A flushes it, and wakes up after // that. TEST_P(EGLMultiContextTest, ThreadBGetStatusBeforeThreadASyncFlush) { … } // Test that thread B can wait on thread A's sync before thread A flushes it, and wakes up after // that. TEST_P(EGLMultiContextTest, ThreadBClientWaitBeforeThreadASyncFinish) { … } // Test that thread B can wait on thread A's sync before thread A flushes it, and wakes up after // that. TEST_P(EGLMultiContextTest, ThreadBServerWaitBeforeThreadASyncFinish) { … } // Test that thread B can wait on thread A's sync before thread A flushes it, and wakes up after // that. TEST_P(EGLMultiContextTest, ThreadBGetStatusBeforeThreadASyncFinish) { … } // Test that thread B can submit while three other threads are waiting for GPU to finish. TEST_P(EGLMultiContextTest, ThreadBCanSubmitWhileThreadAWaiting) { … } // Test that if there are any placeholder objects when the programs don't use any resources // (such as textures), they can correctly be used in non-shared contexts (without causing // double-free). TEST_P(EGLMultiContextTest, NonSharedContextsReuseDescritorSetLayoutHandle) { … } } // anonymous namespace GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(…); ANGLE_INSTANTIATE_TEST_ES31(…);