1f6603c60Sopenharmony_ci/*
2f6603c60Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
3f6603c60Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4f6603c60Sopenharmony_ci * you may not use this file except in compliance with the License.
5f6603c60Sopenharmony_ci * You may obtain a copy of the License at
6f6603c60Sopenharmony_ci *
7f6603c60Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8f6603c60Sopenharmony_ci *
9f6603c60Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10f6603c60Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11f6603c60Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12f6603c60Sopenharmony_ci * See the License for the specific language governing permissions and
13f6603c60Sopenharmony_ci * limitations under the License.
14f6603c60Sopenharmony_ci */
15f6603c60Sopenharmony_ci#include <gtest/gtest.h>
16f6603c60Sopenharmony_ci#include "native_vsync.h"
17f6603c60Sopenharmony_ci#include "cstring"
18f6603c60Sopenharmony_ci#include "string"
19f6603c60Sopenharmony_ci#include "GLES3/gl3.h"
20f6603c60Sopenharmony_ci#include <GLES3/gl32.h>
21f6603c60Sopenharmony_ci#include "EGL/egl.h"
22f6603c60Sopenharmony_ci#include <EGL/eglext.h>
23f6603c60Sopenharmony_ci#include <vector>
24f6603c60Sopenharmony_ci#include <iostream>
25f6603c60Sopenharmony_ci
26f6603c60Sopenharmony_ci#undef LOG_DOMAIN
27f6603c60Sopenharmony_ci#define LOG_DOMAIN 0xD003200
28f6603c60Sopenharmony_ci
29f6603c60Sopenharmony_ci#ifndef LOGI
30f6603c60Sopenharmony_ci#define LOGI(FMT, VARS...) ((void)OH_LOG_Print(LOG_APP, LOG_INFO, LOG_DOMAIN, "HMG_LOG", FMT, ##VARS))
31f6603c60Sopenharmony_ci
32f6603c60Sopenharmony_ci#endif
33f6603c60Sopenharmony_ci
34f6603c60Sopenharmony_ciusing namespace testing;
35f6603c60Sopenharmony_ciusing namespace testing::ext;
36f6603c60Sopenharmony_ci
37f6603c60Sopenharmony_cinamespace OHOS {
38f6603c60Sopenharmony_ci    namespace Rosen {
39f6603c60Sopenharmony_ci        class OH_GLES_ExtensionTest : public testing::Test {
40f6603c60Sopenharmony_ci        };
41f6603c60Sopenharmony_ci
42f6603c60Sopenharmony_ci        namespace {
43f6603c60Sopenharmony_ci            /*
44f6603c60Sopenharmony_ci             * @tc.name: OH_GLES_Extension001
45f6603c60Sopenharmony_ci             * @tc.desc: test for OH_GLES_Extension
46f6603c60Sopenharmony_ci             * @tc.type: FUNC
47f6603c60Sopenharmony_ci             */
48f6603c60Sopenharmony_ci
49f6603c60Sopenharmony_ci            HWTEST_F(OH_GLES_ExtensionTest, OH_GLES_Extension001, Function | MediumTest | Level2)
50f6603c60Sopenharmony_ci            {
51f6603c60Sopenharmony_ci                EGLDisplay display;
52f6603c60Sopenharmony_ci                EGLConfig config;
53f6603c60Sopenharmony_ci                EGLContext context;
54f6603c60Sopenharmony_ci                EGLSurface surfaceCache;
55f6603c60Sopenharmony_ci                EGLint majorVersion;
56f6603c60Sopenharmony_ci                EGLint minorVersion;
57f6603c60Sopenharmony_ci                EGLint numConfigs;
58f6603c60Sopenharmony_ci                display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
59f6603c60Sopenharmony_ci                eglInitialize(display, &majorVersion, &minorVersion);
60f6603c60Sopenharmony_ci                display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
61f6603c60Sopenharmony_ci                eglInitialize(display, &majorVersion, &minorVersion);
62f6603c60Sopenharmony_ci                EGLint attribs[] = {
63f6603c60Sopenharmony_ci                    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
64f6603c60Sopenharmony_ci                    EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8,
65f6603c60Sopenharmony_ci                    EGL_RED_SIZE, 8, EGL_NONE};
66f6603c60Sopenharmony_ci                eglChooseConfig(display, attribs, &config, 1, &numConfigs);
67f6603c60Sopenharmony_ci                context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);
68f6603c60Sopenharmony_ci                surfaceCache = eglCreatePbufferSurface(display, config, NULL);
69f6603c60Sopenharmony_ci                eglMakeCurrent(display, surfaceCache, surfaceCache, context);
70f6603c60Sopenharmony_ci                char *strTest = new char[1024];
71f6603c60Sopenharmony_ci                strTest = (char *)glGetString(GL_VERSION);
72f6603c60Sopenharmony_ci                string strTest2(strTest);
73f6603c60Sopenharmony_ci                vector<string> vv;
74f6603c60Sopenharmony_ci                string my = "";
75f6603c60Sopenharmony_ci                strTest2 = strTest2 + ' ';
76f6603c60Sopenharmony_ci                for (int i = 0; i < strTest2.size() - 1; i++)
77f6603c60Sopenharmony_ci                {
78f6603c60Sopenharmony_ci                    if (strTest2[i + 1] == ' ')
79f6603c60Sopenharmony_ci                    {
80f6603c60Sopenharmony_ci                        vv.push_back(my);
81f6603c60Sopenharmony_ci                        my = "";
82f6603c60Sopenharmony_ci                    }
83f6603c60Sopenharmony_ci                    else
84f6603c60Sopenharmony_ci                    {
85f6603c60Sopenharmony_ci                        my += strTest2[i];
86f6603c60Sopenharmony_ci                    }
87f6603c60Sopenharmony_ci                }
88f6603c60Sopenharmony_ci
89f6603c60Sopenharmony_ci                map<string, string> myMap;
90f6603c60Sopenharmony_ci                myMap["glBufferPageCommitmentMemNV"] = "GL_NV_memory_object_sparse";
91f6603c60Sopenharmony_ci                myMap["glCreateSemaphoresNV"] = "GL_NV_timeline_semaphore";
92f6603c60Sopenharmony_ci                myMap["glExtrapolateTex2DQCOM"] = "GL_QCOM_frame_extrapolation";
93f6603c60Sopenharmony_ci
94f6603c60Sopenharmony_ci                bool isHave1 = strTest2.find("GL_NV_memory_object_sparse") != -1 ? true : false;
95f6603c60Sopenharmony_ci                bool isHave2 = strTest2.find("GL_NV_timeline_semaphore") != -1 ? true : false;
96f6603c60Sopenharmony_ci                bool isHave3 = strTest2.find("GL_QCOM_frame_extrapolation") != -1 ? true : false;
97f6603c60Sopenharmony_ci
98f6603c60Sopenharmony_ci                ASSERT_EQ(isHave1, 0);
99f6603c60Sopenharmony_ci                ASSERT_EQ(isHave2, 0);
100f6603c60Sopenharmony_ci                ASSERT_EQ(isHave3, 0);
101f6603c60Sopenharmony_ci            }
102f6603c60Sopenharmony_ci
103f6603c60Sopenharmony_ci            /*
104f6603c60Sopenharmony_ci             * @tc.name: OH_GLES_Extension002
105f6603c60Sopenharmony_ci             * @tc.desc: test for OH_GLES_Extension
106f6603c60Sopenharmony_ci             * @tc.type: FUNC
107f6603c60Sopenharmony_ci             */
108f6603c60Sopenharmony_ci
109f6603c60Sopenharmony_ci            HWTEST_F(OH_GLES_ExtensionTest, OH_GLES_Extension002, Function | MediumTest | Level2)
110f6603c60Sopenharmony_ci            {
111f6603c60Sopenharmony_ci                EGLDisplay display;
112f6603c60Sopenharmony_ci                EGLConfig config;
113f6603c60Sopenharmony_ci                EGLContext context;
114f6603c60Sopenharmony_ci                EGLSurface surfaceCache;
115f6603c60Sopenharmony_ci                EGLint majorVersion;
116f6603c60Sopenharmony_ci                EGLint minorVersion;
117f6603c60Sopenharmony_ci                EGLint numConfigs;
118f6603c60Sopenharmony_ci                display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
119f6603c60Sopenharmony_ci                eglInitialize(display, &majorVersion, &minorVersion);
120f6603c60Sopenharmony_ci                display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
121f6603c60Sopenharmony_ci                eglInitialize(display, &majorVersion, &minorVersion);
122f6603c60Sopenharmony_ci                EGLint attribs[] = {
123f6603c60Sopenharmony_ci                    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
124f6603c60Sopenharmony_ci                    EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8,
125f6603c60Sopenharmony_ci                    EGL_RED_SIZE, 8, EGL_NONE};
126f6603c60Sopenharmony_ci                eglChooseConfig(display, attribs, &config, 1, &numConfigs);
127f6603c60Sopenharmony_ci                context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);
128f6603c60Sopenharmony_ci                surfaceCache = eglCreatePbufferSurface(display, config, NULL);
129f6603c60Sopenharmony_ci                eglMakeCurrent(display, surfaceCache, surfaceCache, context);
130f6603c60Sopenharmony_ci                char *strTest = new char[1024];
131f6603c60Sopenharmony_ci                strTest = (char *)glGetString(GL_VERSION);
132f6603c60Sopenharmony_ci                string strTest2(strTest);
133f6603c60Sopenharmony_ci                vector<string> vv;
134f6603c60Sopenharmony_ci                string my = "";
135f6603c60Sopenharmony_ci                strTest2 = strTest2 + ' ';
136f6603c60Sopenharmony_ci                for (int i = 0; i < strTest2.size() - 1; i++)
137f6603c60Sopenharmony_ci                {
138f6603c60Sopenharmony_ci                    if (strTest2[i + 1] == ' ')
139f6603c60Sopenharmony_ci                    {
140f6603c60Sopenharmony_ci                        vv.push_back(my);
141f6603c60Sopenharmony_ci                        my = "";
142f6603c60Sopenharmony_ci                    }
143f6603c60Sopenharmony_ci                    else
144f6603c60Sopenharmony_ci                    {
145f6603c60Sopenharmony_ci                        my += strTest2[i];
146f6603c60Sopenharmony_ci                    }
147f6603c60Sopenharmony_ci                }
148f6603c60Sopenharmony_ci
149f6603c60Sopenharmony_ci                map<string, string> myMap;
150f6603c60Sopenharmony_ci                myMap["glFramebufferParameteriMESA"] = "GL_MESA_framebuffer_flip_y";
151f6603c60Sopenharmony_ci                myMap["glGetFramebufferParameterivMESA"] = "GL_MESA_framebuffer_flip_y";
152f6603c60Sopenharmony_ci                myMap["glGetSemaphoreParameterivNV"] = "GL_NV_timeline_semaphore";
153f6603c60Sopenharmony_ci
154f6603c60Sopenharmony_ci                bool isHave1 = strTest2.find("GL_MESA_framebuffer_flip_y") != -1 ? true : false;
155f6603c60Sopenharmony_ci                bool isHave2 = strTest2.find("GL_MESA_framebuffer_flip_y") != -1 ? true : false;
156f6603c60Sopenharmony_ci                bool isHave3 = strTest2.find("GL_NV_timeline_semaphore") != -1 ? true : false;
157f6603c60Sopenharmony_ci
158f6603c60Sopenharmony_ci                ASSERT_EQ(isHave1, 0);
159f6603c60Sopenharmony_ci                ASSERT_EQ(isHave2, 0);
160f6603c60Sopenharmony_ci                ASSERT_EQ(isHave3, 0);
161f6603c60Sopenharmony_ci            }
162f6603c60Sopenharmony_ci
163f6603c60Sopenharmony_ci            /*
164f6603c60Sopenharmony_ci             * @tc.name: OH_GLES_Extension003
165f6603c60Sopenharmony_ci             * @tc.desc: test for OH_GLES_Extension
166f6603c60Sopenharmony_ci             * @tc.type: FUNC
167f6603c60Sopenharmony_ci             */
168f6603c60Sopenharmony_ci
169f6603c60Sopenharmony_ci            HWTEST_F(OH_GLES_ExtensionTest, OH_GLES_Extension003, Function | MediumTest | Level2)
170f6603c60Sopenharmony_ci            {
171f6603c60Sopenharmony_ci                EGLDisplay display;
172f6603c60Sopenharmony_ci                EGLConfig config;
173f6603c60Sopenharmony_ci                EGLContext context;
174f6603c60Sopenharmony_ci                EGLSurface surfaceCache;
175f6603c60Sopenharmony_ci                EGLint majorVersion;
176f6603c60Sopenharmony_ci                EGLint minorVersion;
177f6603c60Sopenharmony_ci                EGLint numConfigs;
178f6603c60Sopenharmony_ci                display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
179f6603c60Sopenharmony_ci                eglInitialize(display, &majorVersion, &minorVersion);
180f6603c60Sopenharmony_ci                display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
181f6603c60Sopenharmony_ci                eglInitialize(display, &majorVersion, &minorVersion);
182f6603c60Sopenharmony_ci                EGLint attribs[] = {
183f6603c60Sopenharmony_ci                    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
184f6603c60Sopenharmony_ci                    EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8,
185f6603c60Sopenharmony_ci                    EGL_RED_SIZE, 8, EGL_NONE};
186f6603c60Sopenharmony_ci                eglChooseConfig(display, attribs, &config, 1, &numConfigs);
187f6603c60Sopenharmony_ci                context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);
188f6603c60Sopenharmony_ci                surfaceCache = eglCreatePbufferSurface(display, config, NULL);
189f6603c60Sopenharmony_ci                eglMakeCurrent(display, surfaceCache, surfaceCache, context);
190f6603c60Sopenharmony_ci                char *strTest = new char[1024];
191f6603c60Sopenharmony_ci                strTest = (char *)glGetString(GL_VERSION);
192f6603c60Sopenharmony_ci                string strTest2(strTest);
193f6603c60Sopenharmony_ci                vector<string> vv;
194f6603c60Sopenharmony_ci                string my = "";
195f6603c60Sopenharmony_ci                strTest2 = strTest2 + ' ';
196f6603c60Sopenharmony_ci                for (int i = 0; i < strTest2.size() - 1; i++)
197f6603c60Sopenharmony_ci                {
198f6603c60Sopenharmony_ci                    if (strTest2[i + 1] == ' ')
199f6603c60Sopenharmony_ci                    {
200f6603c60Sopenharmony_ci                        vv.push_back(my);
201f6603c60Sopenharmony_ci                        my = "";
202f6603c60Sopenharmony_ci                    }
203f6603c60Sopenharmony_ci                    else
204f6603c60Sopenharmony_ci                    {
205f6603c60Sopenharmony_ci                        my += strTest2[i];
206f6603c60Sopenharmony_ci                    }
207f6603c60Sopenharmony_ci                }
208f6603c60Sopenharmony_ci
209f6603c60Sopenharmony_ci                map<string, string> myMap;
210f6603c60Sopenharmony_ci                myMap["glNamedBufferPageCommitmentMemNV"] = "GL_NV_memory_object_sparse";
211f6603c60Sopenharmony_ci                myMap["glSemaphoreParameterivNV"] = "GL_NV_timeline_semaphore";
212f6603c60Sopenharmony_ci                myMap["glShadingRateQCOM"] = "GL_QCOM_shading_rate";
213f6603c60Sopenharmony_ci
214f6603c60Sopenharmony_ci                bool isHave1 = strTest2.find("GL_NV_memory_object_sparse") != -1 ? true : false;
215f6603c60Sopenharmony_ci                bool isHave2 = strTest2.find("GL_NV_timeline_semaphore") != -1 ? true : false;
216f6603c60Sopenharmony_ci                bool isHave3 = strTest2.find("GL_QCOM_shading_rate") != -1 ? true : false;
217f6603c60Sopenharmony_ci
218f6603c60Sopenharmony_ci                ASSERT_EQ(isHave1, 0);
219f6603c60Sopenharmony_ci                ASSERT_EQ(isHave2, 0);
220f6603c60Sopenharmony_ci                ASSERT_EQ(isHave3, 0);
221f6603c60Sopenharmony_ci            }
222f6603c60Sopenharmony_ci
223f6603c60Sopenharmony_ci            /*
224f6603c60Sopenharmony_ci             * @tc.name: OH_GLES_Extension004
225f6603c60Sopenharmony_ci             * @tc.desc: test for OH_GLES_Extension
226f6603c60Sopenharmony_ci             * @tc.type: FUNC
227f6603c60Sopenharmony_ci             */
228f6603c60Sopenharmony_ci
229f6603c60Sopenharmony_ci            HWTEST_F(OH_GLES_ExtensionTest, OH_GLES_Extension004, Function | MediumTest | Level2)
230f6603c60Sopenharmony_ci            {
231f6603c60Sopenharmony_ci                EGLDisplay display;
232f6603c60Sopenharmony_ci                EGLConfig config;
233f6603c60Sopenharmony_ci                EGLContext context;
234f6603c60Sopenharmony_ci                EGLSurface surfaceCache;
235f6603c60Sopenharmony_ci                EGLint majorVersion;
236f6603c60Sopenharmony_ci                EGLint minorVersion;
237f6603c60Sopenharmony_ci                EGLint numConfigs;
238f6603c60Sopenharmony_ci                display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
239f6603c60Sopenharmony_ci                eglInitialize(display, &majorVersion, &minorVersion);
240f6603c60Sopenharmony_ci                display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
241f6603c60Sopenharmony_ci                eglInitialize(display, &majorVersion, &minorVersion);
242f6603c60Sopenharmony_ci                EGLint attribs[] = {
243f6603c60Sopenharmony_ci                    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
244f6603c60Sopenharmony_ci                    EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8,
245f6603c60Sopenharmony_ci                    EGL_RED_SIZE, 8, EGL_NONE};
246f6603c60Sopenharmony_ci                eglChooseConfig(display, attribs, &config, 1, &numConfigs);
247f6603c60Sopenharmony_ci                context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);
248f6603c60Sopenharmony_ci                surfaceCache = eglCreatePbufferSurface(display, config, NULL);
249f6603c60Sopenharmony_ci                eglMakeCurrent(display, surfaceCache, surfaceCache, context);
250f6603c60Sopenharmony_ci                char *strTest = new char[1024];
251f6603c60Sopenharmony_ci                strTest = (char *)glGetString(GL_VERSION);
252f6603c60Sopenharmony_ci                string strTest2(strTest);
253f6603c60Sopenharmony_ci                vector<string> vv;
254f6603c60Sopenharmony_ci                string my = "";
255f6603c60Sopenharmony_ci                strTest2 = strTest2 + ' ';
256f6603c60Sopenharmony_ci                for (int i = 0; i < strTest2.size() - 1; i++)
257f6603c60Sopenharmony_ci                {
258f6603c60Sopenharmony_ci                    if (strTest2[i + 1] == ' ')
259f6603c60Sopenharmony_ci                    {
260f6603c60Sopenharmony_ci                        vv.push_back(my);
261f6603c60Sopenharmony_ci                        my = "";
262f6603c60Sopenharmony_ci                    }
263f6603c60Sopenharmony_ci                    else
264f6603c60Sopenharmony_ci                    {
265f6603c60Sopenharmony_ci                        my += strTest2[i];
266f6603c60Sopenharmony_ci                    }
267f6603c60Sopenharmony_ci                }
268f6603c60Sopenharmony_ci
269f6603c60Sopenharmony_ci                map<string, string> myMap;
270f6603c60Sopenharmony_ci                myMap["glTexEstimateMotionQCOM"] = "GL_QCOM_motion_estimation";
271f6603c60Sopenharmony_ci                myMap["glTexEstimateMotionRegionsQCOM"] = "GL_QCOM_motion_estimation";
272f6603c60Sopenharmony_ci                myMap["glTexPageCommitmentMemNV"] = "GL_NV_memory_object_sparse";
273f6603c60Sopenharmony_ci
274f6603c60Sopenharmony_ci                bool isHave1 = strTest2.find("GL_QCOM_motion_estimation") != -1 ? true : false;
275f6603c60Sopenharmony_ci                bool isHave2 = strTest2.find("GL_NV_memory_object_sparse") != -1 ? true : false;
276f6603c60Sopenharmony_ci                bool isHave3 = strTest2.find("GL_NV_memory_object_sparse") != -1 ? true : false;
277f6603c60Sopenharmony_ci
278f6603c60Sopenharmony_ci                ASSERT_EQ(isHave1, 0);
279f6603c60Sopenharmony_ci                ASSERT_EQ(isHave2, 0);
280f6603c60Sopenharmony_ci                ASSERT_EQ(isHave3, 0);
281f6603c60Sopenharmony_ci            }
282f6603c60Sopenharmony_ci
283f6603c60Sopenharmony_ci            /*
284f6603c60Sopenharmony_ci             * @tc.name: OH_GLES_Extension005
285f6603c60Sopenharmony_ci             * @tc.desc: test for OH_GLES_Extension
286f6603c60Sopenharmony_ci             * @tc.type: FUNC
287f6603c60Sopenharmony_ci             */
288f6603c60Sopenharmony_ci
289f6603c60Sopenharmony_ci            HWTEST_F(OH_GLES_ExtensionTest, OH_GLES_Extension005, Function | MediumTest | Level2)
290f6603c60Sopenharmony_ci            {
291f6603c60Sopenharmony_ci                EGLDisplay display;
292f6603c60Sopenharmony_ci                EGLConfig config;
293f6603c60Sopenharmony_ci                EGLContext context;
294f6603c60Sopenharmony_ci                EGLSurface surfaceCache;
295f6603c60Sopenharmony_ci                EGLint majorVersion;
296f6603c60Sopenharmony_ci                EGLint minorVersion;
297f6603c60Sopenharmony_ci                EGLint numConfigs;
298f6603c60Sopenharmony_ci                display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
299f6603c60Sopenharmony_ci                eglInitialize(display, &majorVersion, &minorVersion);
300f6603c60Sopenharmony_ci                display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
301f6603c60Sopenharmony_ci                eglInitialize(display, &majorVersion, &minorVersion);
302f6603c60Sopenharmony_ci                EGLint attribs[] = {
303f6603c60Sopenharmony_ci                    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
304f6603c60Sopenharmony_ci                    EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8,
305f6603c60Sopenharmony_ci                    EGL_RED_SIZE, 8, EGL_NONE};
306f6603c60Sopenharmony_ci                eglChooseConfig(display, attribs, &config, 1, &numConfigs);
307f6603c60Sopenharmony_ci                context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);
308f6603c60Sopenharmony_ci                surfaceCache = eglCreatePbufferSurface(display, config, NULL);
309f6603c60Sopenharmony_ci                eglMakeCurrent(display, surfaceCache, surfaceCache, context);
310f6603c60Sopenharmony_ci                char *strTest = new char[1024];
311f6603c60Sopenharmony_ci                strTest = (char *)glGetString(GL_VERSION);
312f6603c60Sopenharmony_ci                string strTest2(strTest);
313f6603c60Sopenharmony_ci                vector<string> vv;
314f6603c60Sopenharmony_ci                string my = "";
315f6603c60Sopenharmony_ci                strTest2 = strTest2 + ' ';
316f6603c60Sopenharmony_ci                for (int i = 0; i < strTest2.size() - 1; i++)
317f6603c60Sopenharmony_ci                {
318f6603c60Sopenharmony_ci                    if (strTest2[i + 1] == ' ')
319f6603c60Sopenharmony_ci                    {
320f6603c60Sopenharmony_ci                        vv.push_back(my);
321f6603c60Sopenharmony_ci                        my = "";
322f6603c60Sopenharmony_ci                    }
323f6603c60Sopenharmony_ci                    else
324f6603c60Sopenharmony_ci                    {
325f6603c60Sopenharmony_ci                        my += strTest2[i];
326f6603c60Sopenharmony_ci                    }
327f6603c60Sopenharmony_ci                }
328f6603c60Sopenharmony_ci
329f6603c60Sopenharmony_ci                map<string, string> myMap;
330f6603c60Sopenharmony_ci                myMap["glTexturePageCommitmentMemNV"] = "GL_NV_memory_object_sparse";
331f6603c60Sopenharmony_ci                myMap["TexStorageAttribs2DEXT"] = "GL_EXT_texture_storage_compression";
332f6603c60Sopenharmony_ci                myMap["TexStorageAttribs3DEXT"] = "GL_EXT_texture_storage_compression";
333f6603c60Sopenharmony_ci
334f6603c60Sopenharmony_ci                bool isHave1 = strTest2.find("GL_EXT_texture_storage_compression") != -1 ? true : false;
335f6603c60Sopenharmony_ci                bool isHave2 = strTest2.find("GL_EXT_texture_storage_compression") != -1 ? true : false;
336f6603c60Sopenharmony_ci                bool isHave3 = strTest2.find("GL_QCOM_motion_estimation") != -1 ? true : false;
337f6603c60Sopenharmony_ci
338f6603c60Sopenharmony_ci                ASSERT_EQ(isHave1, 0);
339f6603c60Sopenharmony_ci                ASSERT_EQ(isHave2, 0);
340f6603c60Sopenharmony_ci                ASSERT_EQ(isHave3, 0);
341f6603c60Sopenharmony_ci            }
342f6603c60Sopenharmony_ci        } // namespace
343f6603c60Sopenharmony_ci    }     // namespace Rosen
344f6603c60Sopenharmony_ci} // namespace OHOS