Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
eb7640fb
A
anbox
项目概览
openeuler
/
anbox
通知
24
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
anbox
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eb7640fb
编写于
2月 28, 2017
作者:
S
Simon Fels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use extension helper class also to check GL ES extensions
上级
a2294b22
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
77 deletion
+5
-77
src/anbox/graphics/emugl/Renderer.cpp
src/anbox/graphics/emugl/Renderer.cpp
+5
-77
未找到文件。
src/anbox/graphics/emugl/Renderer.cpp
浏览文件 @
eb7640fb
...
...
@@ -84,55 +84,6 @@ class ColorBufferHelper : public ColorBuffer::Helper {
HandleType
Renderer
::
s_nextHandle
=
0
;
static
char
*
getGLES1ExtensionString
(
EGLDisplay
p_dpy
)
{
EGLConfig
config
;
EGLSurface
surface
;
static
const
GLint
configAttribs
[]
=
{
EGL_SURFACE_TYPE
,
EGL_PBUFFER_BIT
,
EGL_RENDERABLE_TYPE
,
EGL_OPENGL_ES_BIT
,
EGL_NONE
};
int
n
;
if
(
!
s_egl
.
eglChooseConfig
(
p_dpy
,
configAttribs
,
&
config
,
1
,
&
n
)
||
n
==
0
)
{
ERROR
(
"%s: Could not find GLES 1.x config!"
,
__FUNCTION__
);
return
NULL
;
}
static
const
EGLint
pbufAttribs
[]
=
{
EGL_WIDTH
,
1
,
EGL_HEIGHT
,
1
,
EGL_NONE
};
surface
=
s_egl
.
eglCreatePbufferSurface
(
p_dpy
,
config
,
pbufAttribs
);
if
(
surface
==
EGL_NO_SURFACE
)
{
ERROR
(
"%s: Could not create GLES 1.x Pbuffer!"
,
__FUNCTION__
);
return
NULL
;
}
static
const
GLint
gles1ContextAttribs
[]
=
{
EGL_CONTEXT_CLIENT_VERSION
,
1
,
EGL_NONE
};
EGLContext
ctx
=
s_egl
.
eglCreateContext
(
p_dpy
,
config
,
EGL_NO_CONTEXT
,
gles1ContextAttribs
);
if
(
ctx
==
EGL_NO_CONTEXT
)
{
ERROR
(
"%s: Could not create GLES 1.x Context!"
,
__FUNCTION__
);
s_egl
.
eglDestroySurface
(
p_dpy
,
surface
);
return
NULL
;
}
if
(
!
s_egl
.
eglMakeCurrent
(
p_dpy
,
surface
,
surface
,
ctx
))
{
ERROR
(
"%s: Could not make GLES 1.x context current!"
,
__FUNCTION__
);
s_egl
.
eglDestroySurface
(
p_dpy
,
surface
);
s_egl
.
eglDestroyContext
(
p_dpy
,
ctx
);
return
NULL
;
}
// the string pointer may become invalid when the context is destroyed
const
char
*
s
=
reinterpret_cast
<
const
char
*>
(
s_gles1
.
glGetString
(
GL_EXTENSIONS
));
char
*
extString
=
strdup
(
s
?
s
:
""
);
s_egl
.
eglMakeCurrent
(
p_dpy
,
NULL
,
NULL
,
NULL
);
s_egl
.
eglDestroyContext
(
p_dpy
,
ctx
);
s_egl
.
eglDestroySurface
(
p_dpy
,
surface
);
return
extString
;
}
void
Renderer
::
finalize
()
{
m_colorbuffers
.
clear
();
m_windows
.
clear
();
...
...
@@ -163,15 +114,6 @@ bool Renderer::initialize(EGLNativeDisplayType nativeDisplay) {
s_egl
.
eglBindAPI
(
EGL_OPENGL_ES_API
);
// If GLES2 plugin was loaded - try to make GLES2 context and
// get GLES2 extension string
char
*
gles1Extensions
=
NULL
;
gles1Extensions
=
getGLES1ExtensionString
(
m_eglDisplay
);
if
(
!
gles1Extensions
)
{
ERROR
(
"Failed to obtain GLES 2.x extensions string!"
);
return
false
;
}
// Create EGL context for framebuffer post rendering.
GLint
surfaceType
=
EGL_WINDOW_BIT
|
EGL_PBUFFER_BIT
;
const
GLint
configAttribs
[]
=
{
EGL_RED_SIZE
,
1
,
...
...
@@ -185,7 +127,6 @@ bool Renderer::initialize(EGLNativeDisplayType nativeDisplay) {
if
(
!
s_egl
.
eglChooseConfig
(
m_eglDisplay
,
configAttribs
,
&
m_eglConfig
,
1
,
&
n
))
{
ERROR
(
"Failed to select EGL configuration"
);
free
(
gles1Extensions
);
return
false
;
}
...
...
@@ -196,7 +137,6 @@ bool Renderer::initialize(EGLNativeDisplayType nativeDisplay) {
EGL_NO_CONTEXT
,
glContextAttribs
);
if
(
m_eglContext
==
EGL_NO_CONTEXT
)
{
ERROR
(
"Failed to create context: error=0x%x"
,
s_egl
.
eglGetError
());
free
(
gles1Extensions
);
return
false
;
}
...
...
@@ -209,7 +149,6 @@ bool Renderer::initialize(EGLNativeDisplayType nativeDisplay) {
m_pbufContext
=
s_egl
.
eglCreateContext
(
m_eglDisplay
,
m_eglConfig
,
m_eglContext
,
glContextAttribs
);
if
(
m_pbufContext
==
EGL_NO_CONTEXT
)
{
ERROR
(
"Failed to create pbuffer context: error=0x%x"
,
s_egl
.
eglGetError
());
free
(
gles1Extensions
);
return
false
;
}
...
...
@@ -221,7 +160,6 @@ bool Renderer::initialize(EGLNativeDisplayType nativeDisplay) {
m_pbufSurface
=
s_egl
.
eglCreatePbufferSurface
(
m_eglDisplay
,
m_eglConfig
,
pbufAttribs
);
if
(
m_pbufSurface
==
EGL_NO_SURFACE
)
{
ERROR
(
"Failed to create pbuffer surface: error=0x%x"
,
s_egl
.
eglGetError
());
free
(
gles1Extensions
);
return
false
;
}
}
else
{
...
...
@@ -233,23 +171,13 @@ bool Renderer::initialize(EGLNativeDisplayType nativeDisplay) {
ScopedBind
bind
(
this
);
if
(
!
bind
.
isValid
())
{
ERROR
(
"Failed to make current"
);
free
(
gles1Extensions
);
return
false
;
}
// Initilize framebuffer capabilities
auto
has_gl_oes_image
=
strstr
(
gles1Extensions
,
"GL_OES_EGL_image"
)
!=
NULL
;
free
(
gles1Extensions
);
gles1Extensions
=
NULL
;
const
char
*
eglExtensions
=
s_egl
.
eglQueryString
(
m_eglDisplay
,
EGL_EXTENSIONS
);
if
(
eglExtensions
&&
has_gl_oes_image
)
{
m_caps
.
has_eglimage_texture_2d
=
strstr
(
eglExtensions
,
"EGL_KHR_gl_texture_2D_image"
)
!=
NULL
;
m_caps
.
has_eglimage_renderbuffer
=
strstr
(
eglExtensions
,
"EGL_KHR_gl_renderbuffer_image"
)
!=
NULL
;
anbox
::
graphics
::
GLExtensions
gl_extensions
{
reinterpret_cast
<
const
char
*>
(
s_gles2
.
glGetString
(
GL_EXTENSIONS
))};
if
(
gl_extensions
.
support
(
"GL_OES_EGL_image"
))
{
m_caps
.
has_eglimage_texture_2d
=
egl_extensions
.
support
(
"EGL_KHR_gl_texture_2D_image"
);
m_caps
.
has_eglimage_renderbuffer
=
egl_extensions
.
support
(
"EGL_KHR_gl_renderbuffer_image"
);
}
else
{
m_caps
.
has_eglimage_texture_2d
=
false
;
m_caps
.
has_eglimage_renderbuffer
=
false
;
...
...
@@ -258,7 +186,7 @@ bool Renderer::initialize(EGLNativeDisplayType nativeDisplay) {
// Fail initialization if not all of the following extensions
// exist:
// EGL_KHR_gl_texture_2d_image
// GL_OES_EGL_IMAGE
(by both GLES implementations [1 and 2])
// GL_OES_EGL_IMAGE
if
(
!
m_caps
.
has_eglimage_texture_2d
)
{
ERROR
(
"Failed: Missing egl_image related extension(s)"
);
bind
.
release
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录