blob: 22d738e1db9c206eda7e859a06262bfe2b5ea5f4 [file] [log] [blame]
Lingfeng Yang0e6868f2020-11-03 12:32:59 -08001// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include "OpenGLTestContext.h"
16
17#include <gtest/gtest.h>
18
Jason Macnaked0c9e62023-03-30 15:58:24 -070019namespace gfxstream {
20namespace {
Lingfeng Yang0e6868f2020-11-03 12:32:59 -080021
22TEST_F(GLTest, InitDestroy) {}
23
24TEST_F(GLTest, SetUpMulticontext) {
25 const EGLDispatch* egl = LazyLoadedEGLDispatch::get();
26 EXPECT_TRUE(egl != nullptr);
27 EXPECT_TRUE(gl != nullptr);
28
29 egl->eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
30 EGL_NO_CONTEXT);
31 EGLSurface duoSurface = pbufferSurface(
32 m_display, m_config, kTestSurfaceSize[0], kTestSurfaceSize[1]);
33 EGLContext duoContext = createContext(m_display, m_config, 3, 0);
34
35 egl->eglMakeCurrent(m_display, duoSurface, duoSurface, duoContext);
36 EXPECT_EQ(EGL_SUCCESS, egl->eglGetError());
37
38 destroyContext(m_display, duoContext);
39 destroySurface(m_display, duoSurface);
40
41 egl->eglMakeCurrent(m_display, m_surface, m_surface, m_context);
42 EXPECT_EQ(EGL_SUCCESS, egl->eglGetError());
43}
44
Jason Macnaked0c9e62023-03-30 15:58:24 -070045} // namespace
46} // namespace gfxstream