• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
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 
16 #ifndef _ROSEN_CONTEXT_H_
17 #define _ROSEN_CONTEXT_H_
18 
19 #include<stdint.h>
20 
21 namespace OHOS {
22 
23 enum class RCI_GLES_VERSION {
24     V20 = 20,
25     V30 = 30,
26     V31 = 31,
27     V32 = 32
28 };
29 
30 enum class RCI_PROFILE {
31     ES = 0,
32     CORE,
33     COMPATIBILITY
34 };
35 
36 enum class RCI_CONTEXT_FLAG
37 {
38     NONE                = 0,
39 	ROBUST				= (1<<0),	//!< Robust context
40 	DEBUG				= (1<<1),	//!< Debug context
41 	FORWARD_COMPATIBLE	= (1<<2),	//!< Forward-compatible context
42 };
43 
44 enum class RCI_SURFACE_TYPE
45 {
46     NONE = 0,
47     WINDOW,
48     PIXMAP,
49     PBUFFER
50 };
51 
52 struct RCI_PIXEL_FORMAT
53 {
54 	int32_t redBits;
55 	int32_t greenBits;
56 	int32_t blueBits;
57 	int32_t alphaBits;
58 	int32_t depthBits;
59 	int32_t stencilBits;
60 	int32_t numSamples;
61 };
62 
63 class OhosContextI {
64 public:
65     static OhosContextI &GetInstance();
66 
67     virtual bool SetConfig(int32_t w,int32_t h,RCI_GLES_VERSION ver,RCI_PIXEL_FORMAT pf,RCI_SURFACE_TYPE st,RCI_PROFILE tp,RCI_CONTEXT_FLAG flags) = 0;
68     virtual bool InitNativeWindow() = 0;
69     virtual bool InitEglSurface() = 0;
70     virtual bool InitEglContext() = 0;
71 
72     virtual void MakeCurrent() = 0;
73     virtual void SwapBuffer() = 0;
74 
75     virtual int32_t GetAttrib(int32_t attrType) = 0;
76 private:
77 
78 };
79 
80 }
81 
82 #endif