Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftshader
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
swiftshader
Commits
6a7e8718
Commit
6a7e8718
authored
Oct 28, 2014
by
Nicolas Capens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return the requested GL context version.
BUG=18110152 Change-Id: Ia2a04777e6303cd9f2e53a735455c8c7921b1b13
parent
afd1f9f6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
16 deletions
+66
-16
Display.cpp
src/GLES2/libEGL/Display.cpp
+27
-3
Display.h
src/GLES2/libEGL/Display.h
+1
-1
libEGL.cpp
src/GLES2/libEGL/libEGL.cpp
+3
-11
main.cpp
src/GLES2/libEGL/main.cpp
+24
-1
main.h
src/GLES2/libEGL/main.h
+11
-0
No files found.
src/GLES2/libEGL/Display.cpp
View file @
6a7e8718
...
@@ -383,14 +383,38 @@ EGLSurface Display::createOffscreenSurface(EGLConfig config, const EGLint *attri
...
@@ -383,14 +383,38 @@ EGLSurface Display::createOffscreenSurface(EGLConfig config, const EGLint *attri
return
success
(
surface
);
return
success
(
surface
);
}
}
EGLContext
Display
::
createContext
(
EGLConfig
configHandle
,
const
egl
::
Context
*
shareContext
)
EGLContext
Display
::
createContext
(
EGLConfig
configHandle
,
const
egl
::
Context
*
shareContext
,
EGLint
clientVersion
)
{
{
const
egl
::
Config
*
config
=
mConfigSet
.
get
(
configHandle
);
const
egl
::
Config
*
config
=
mConfigSet
.
get
(
configHandle
);
egl
::
Context
*
context
=
0
;
if
(
clientVersion
==
1
&&
config
->
mRenderableType
&
EGL_OPENGL_ES_BIT
)
{
if
(
gl
::
createContext
!=
0
)
{
context
=
gl
::
createContext
(
config
,
shareContext
);
}
}
else
if
(
clientVersion
==
2
&&
config
->
mRenderableType
&
EGL_OPENGL_ES2_BIT
)
{
if
(
gl2
::
createContext
!=
0
)
{
context
=
gl2
::
createContext
(
config
,
shareContext
);
}
}
else
{
return
error
(
EGL_BAD_CONFIG
,
EGL_NO_CONTEXT
);
}
if
(
!
context
)
{
return
error
(
EGL_BAD_ALLOC
,
EGL_NO_CONTEXT
);
}
egl
::
Context
*
context
=
gl2
::
createContext
(
config
,
shareContext
);
mContextSet
.
insert
(
context
);
mContextSet
.
insert
(
context
);
return
context
;
return
success
(
context
);
;
}
}
void
Display
::
destroySurface
(
egl
::
Surface
*
surface
)
void
Display
::
destroySurface
(
egl
::
Surface
*
surface
)
...
...
src/GLES2/libEGL/Display.h
View file @
6a7e8718
...
@@ -40,7 +40,7 @@ namespace egl
...
@@ -40,7 +40,7 @@ namespace egl
EGLSurface
createWindowSurface
(
EGLNativeWindowType
window
,
EGLConfig
config
,
const
EGLint
*
attribList
);
EGLSurface
createWindowSurface
(
EGLNativeWindowType
window
,
EGLConfig
config
,
const
EGLint
*
attribList
);
EGLSurface
createOffscreenSurface
(
EGLConfig
config
,
const
EGLint
*
attribList
);
EGLSurface
createOffscreenSurface
(
EGLConfig
config
,
const
EGLint
*
attribList
);
EGLContext
createContext
(
EGLConfig
configHandle
,
const
Context
*
shareContext
);
EGLContext
createContext
(
EGLConfig
configHandle
,
const
Context
*
shareContext
,
EGLint
clientVersion
);
void
destroySurface
(
Surface
*
surface
);
void
destroySurface
(
Surface
*
surface
);
void
destroyContext
(
Context
*
context
);
void
destroyContext
(
Context
*
context
);
...
...
src/GLES2/libEGL/libEGL.cpp
View file @
6a7e8718
...
@@ -765,15 +765,14 @@ EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLCon
...
@@ -765,15 +765,14 @@ EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLCon
try
try
{
{
// Get the requested client version (default is 1) and check it is two.
EGLint
clientVersion
=
1
;
EGLint
client_version
=
1
;
if
(
attrib_list
)
if
(
attrib_list
)
{
{
for
(
const
EGLint
*
attribute
=
attrib_list
;
attribute
[
0
]
!=
EGL_NONE
;
attribute
+=
2
)
for
(
const
EGLint
*
attribute
=
attrib_list
;
attribute
[
0
]
!=
EGL_NONE
;
attribute
+=
2
)
{
{
if
(
attribute
[
0
]
==
EGL_CONTEXT_CLIENT_VERSION
)
if
(
attribute
[
0
]
==
EGL_CONTEXT_CLIENT_VERSION
)
{
{
client
_v
ersion
=
attribute
[
1
];
client
V
ersion
=
attribute
[
1
];
}
}
else
else
{
{
...
@@ -782,11 +781,6 @@ EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLCon
...
@@ -782,11 +781,6 @@ EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLCon
}
}
}
}
if
(
client_version
!=
2
)
{
return
error
(
EGL_BAD_CONFIG
,
EGL_NO_CONTEXT
);
}
egl
::
Display
*
display
=
static_cast
<
egl
::
Display
*>
(
dpy
);
egl
::
Display
*
display
=
static_cast
<
egl
::
Display
*>
(
dpy
);
if
(
!
validateConfig
(
display
,
config
))
if
(
!
validateConfig
(
display
,
config
))
...
@@ -794,9 +788,7 @@ EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLCon
...
@@ -794,9 +788,7 @@ EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLCon
return
EGL_NO_CONTEXT
;
return
EGL_NO_CONTEXT
;
}
}
EGLContext
context
=
display
->
createContext
(
config
,
static_cast
<
egl
::
Context
*>
(
share_context
));
return
display
->
createContext
(
config
,
static_cast
<
egl
::
Context
*>
(
share_context
),
clientVersion
);
return
success
(
context
);
}
}
catch
(
std
::
bad_alloc
&
)
catch
(
std
::
bad_alloc
&
)
{
{
...
...
src/GLES2/libEGL/main.cpp
View file @
6a7e8718
...
@@ -83,6 +83,19 @@ CONSTRUCTOR static bool eglAttachProcess()
...
@@ -83,6 +83,19 @@ CONSTRUCTOR static bool eglAttachProcess()
eglAttachThread
();
eglAttachThread
();
#if defined(_WIN32)
#if defined(_WIN32)
const
char
*
libGLES_CM_lib
=
"libGLES_CM.dll"
;
#else
const
char
*
libGLES_CM_lib
=
"libGLES_CM.so.1"
;
#endif
libGLES_CM
=
loadLibrary
(
libGLES_CM_lib
);
gl
::
createContext
=
(
egl
::
Context
*
(
*
)(
const
egl
::
Config
*
,
const
egl
::
Context
*
))
getProcAddress
(
libGLES_CM
,
"glCreateContext"
);
gl
::
getProcAddress
=
(
__eglMustCastToProperFunctionPointerType
(
*
)(
const
char
*
))
getProcAddress
(
libGLES_CM
,
"glGetProcAddress"
);
gl
::
createBackBuffer
=
(
egl
::
Image
*
(
*
)(
int
,
int
,
const
egl
::
Config
*
))
getProcAddress
(
libGLES_CM
,
"createBackBuffer"
);
gl
::
createDepthStencil
=
(
egl
::
Image
*
(
*
)(
unsigned
int
,
unsigned
int
,
sw
::
Format
,
int
,
bool
))
getProcAddress
(
libGLES_CM
,
"createDepthStencil"
);
gl
::
createFrameBuffer
=
(
sw
::
FrameBuffer
*
(
*
)(
EGLNativeDisplayType
,
EGLNativeWindowType
,
int
,
int
))
getProcAddress
(
libGLES_CM
,
"createFrameBuffer"
);
#if defined(_WIN32)
const
char
*
libGLESv2_lib
=
"libGLESv2.dll"
;
const
char
*
libGLESv2_lib
=
"libGLESv2.dll"
;
#else
#else
const
char
*
libGLESv2_lib
=
"libGLESv2.so.2"
;
const
char
*
libGLESv2_lib
=
"libGLESv2.so.2"
;
...
@@ -95,7 +108,7 @@ CONSTRUCTOR static bool eglAttachProcess()
...
@@ -95,7 +108,7 @@ CONSTRUCTOR static bool eglAttachProcess()
gl2
::
createDepthStencil
=
(
egl
::
Image
*
(
*
)(
unsigned
int
,
unsigned
int
,
sw
::
Format
,
int
,
bool
))
getProcAddress
(
libGLESv2
,
"createDepthStencil"
);
gl2
::
createDepthStencil
=
(
egl
::
Image
*
(
*
)(
unsigned
int
,
unsigned
int
,
sw
::
Format
,
int
,
bool
))
getProcAddress
(
libGLESv2
,
"createDepthStencil"
);
gl2
::
createFrameBuffer
=
(
sw
::
FrameBuffer
*
(
*
)(
EGLNativeDisplayType
,
EGLNativeWindowType
,
int
,
int
))
getProcAddress
(
libGLESv2
,
"createFrameBuffer"
);
gl2
::
createFrameBuffer
=
(
sw
::
FrameBuffer
*
(
*
)(
EGLNativeDisplayType
,
EGLNativeWindowType
,
int
,
int
))
getProcAddress
(
libGLESv2
,
"createFrameBuffer"
);
return
libGLESv2
!=
0
;
return
libGLES
_CM
!=
0
||
libGLES
v2
!=
0
;
}
}
DESTRUCTOR
static
void
eglDetachProcess
()
DESTRUCTOR
static
void
eglDetachProcess
()
...
@@ -257,6 +270,15 @@ void error(EGLint errorCode)
...
@@ -257,6 +270,15 @@ void error(EGLint errorCode)
}
}
}
}
namespace
gl
{
egl
::
Context
*
(
*
createContext
)(
const
egl
::
Config
*
config
,
const
egl
::
Context
*
shareContext
)
=
0
;
__eglMustCastToProperFunctionPointerType
(
*
getProcAddress
)(
const
char
*
procname
)
=
0
;
egl
::
Image
*
(
*
createBackBuffer
)(
int
width
,
int
height
,
const
egl
::
Config
*
config
)
=
0
;
egl
::
Image
*
(
*
createDepthStencil
)(
unsigned
int
width
,
unsigned
int
height
,
sw
::
Format
format
,
int
multiSampleDepth
,
bool
discard
)
=
0
;
sw
::
FrameBuffer
*
(
*
createFrameBuffer
)(
EGLNativeDisplayType
display
,
EGLNativeWindowType
window
,
int
width
,
int
height
)
=
0
;
}
namespace
gl2
namespace
gl2
{
{
egl
::
Context
*
(
*
createContext
)(
const
egl
::
Config
*
config
,
const
egl
::
Context
*
shareContext
)
=
0
;
egl
::
Context
*
(
*
createContext
)(
const
egl
::
Config
*
config
,
const
egl
::
Context
*
shareContext
)
=
0
;
...
@@ -266,4 +288,5 @@ namespace gl2
...
@@ -266,4 +288,5 @@ namespace gl2
sw
::
FrameBuffer
*
(
*
createFrameBuffer
)(
EGLNativeDisplayType
display
,
EGLNativeWindowType
window
,
int
width
,
int
height
)
=
0
;
sw
::
FrameBuffer
*
(
*
createFrameBuffer
)(
EGLNativeDisplayType
display
,
EGLNativeWindowType
window
,
int
width
,
int
height
)
=
0
;
}
}
void
*
libGLES_CM
=
0
;
// Handle to the libGLES_CM module
void
*
libGLESv2
=
0
;
// Handle to the libGLESv2 module
void
*
libGLESv2
=
0
;
// Handle to the libGLESv2 module
src/GLES2/libEGL/main.h
View file @
6a7e8718
...
@@ -82,6 +82,16 @@ namespace sw
...
@@ -82,6 +82,16 @@ namespace sw
enum
Format
:
unsigned
char
;
enum
Format
:
unsigned
char
;
}
}
// libGLES_CM dependencies
namespace
gl
{
extern
egl
::
Context
*
(
*
createContext
)(
const
egl
::
Config
*
config
,
const
egl
::
Context
*
shareContext
);
extern
__eglMustCastToProperFunctionPointerType
(
*
getProcAddress
)(
const
char
*
procname
);
extern
egl
::
Image
*
(
*
createBackBuffer
)(
int
width
,
int
height
,
const
egl
::
Config
*
config
);
extern
egl
::
Image
*
(
*
createDepthStencil
)(
unsigned
int
width
,
unsigned
int
height
,
sw
::
Format
format
,
int
multiSampleDepth
,
bool
discard
);
extern
sw
::
FrameBuffer
*
(
*
createFrameBuffer
)(
EGLNativeDisplayType
display
,
EGLNativeWindowType
window
,
int
width
,
int
height
);
}
// libGLESv2 dependencies
// libGLESv2 dependencies
namespace
gl2
namespace
gl2
{
{
...
@@ -92,6 +102,7 @@ namespace gl2
...
@@ -92,6 +102,7 @@ namespace gl2
extern
sw
::
FrameBuffer
*
(
*
createFrameBuffer
)(
EGLNativeDisplayType
display
,
EGLNativeWindowType
window
,
int
width
,
int
height
);
extern
sw
::
FrameBuffer
*
(
*
createFrameBuffer
)(
EGLNativeDisplayType
display
,
EGLNativeWindowType
window
,
int
width
,
int
height
);
}
}
extern
void
*
libGLES_CM
;
// Handle to the libGLES_CM module
extern
void
*
libGLESv2
;
// Handle to the libGLESv2 module
extern
void
*
libGLESv2
;
// Handle to the libGLESv2 module
#endif // LIBEGL_MAIN_H_
#endif // LIBEGL_MAIN_H_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment