Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Thomas Guillem
vlc-legacy
Commits
3239fcf2
Commit
3239fcf2
authored
Dec 30, 2016
by
Thomas Guillem
Browse files
vout/opengl: add OpenGLES 3 support
parent
ca5efc76
Changes
10
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
3239fcf2
...
...
@@ -2956,6 +2956,9 @@ AM_CONDITIONAL([HAVE_GL], [test "${have_gl}" = "yes"])
dnl OpenGL ES 2: depends on EGL 1.1
PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [disabled])
dnl OpenGL ES 3
PKG_ENABLE_MODULES_VLC([GLES3], [], [glesv3], [OpenGL ES v3 support], [disabled])
dnl
dnl Xlib
dnl
...
...
include/vlc_opengl.h
View file @
3239fcf2
...
...
@@ -55,6 +55,7 @@ struct vlc_gl_t
enum
{
VLC_OPENGL
,
VLC_OPENGL_ES2
,
VLC_OPENGL_ES3
,
};
VLC_API
vlc_gl_t
*
vlc_gl_Create
(
struct
vout_window_t
*
,
unsigned
,
const
char
*
)
VLC_USED
;
...
...
modules/video_output/Makefile.am
View file @
3239fcf2
...
...
@@ -62,8 +62,13 @@ libgles2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES2_CFLAGS) -DUSE_OPENGL_ES=2 \
libgles2_plugin_la_LIBADD
=
$(GLES2_LIBS)
$(LIBM)
$(OPENGL_COMMONLIBS)
libgles2_plugin_la_LDFLAGS
=
$(AM_LDFLAGS)
-rpath
'
$(voutdir)
'
$(OPENGL_COMMONLDFLAGS)
EXTRA_LTLIBRARIES
+=
libgles2_plugin.la
vout_LTLIBRARIES
+=
$(LTLIBgles2)
libgles3_plugin_la_SOURCES
=
$(OPENGL_COMMONSOURCES)
video_output/opengl/display.c
libgles3_plugin_la_CFLAGS
=
$(AM_CFLAGS)
$(GLES3_CFLAGS)
-DUSE_OPENGL_ES
=
3
libgles3_plugin_la_LIBADD
=
$(GLES3_LIBS)
$(LIBM)
$(OPENGL_COMMONLIBS)
libgles3_plugin_la_LDFLAGS
=
$(AM_LDFLAGS)
-rpath
'
$(voutdir)
'
$(OPENGL_COMMONLDFLAGS)
EXTRA_LTLIBRARIES
+=
libgles2_plugin.la libgles3_plugin.la
vout_LTLIBRARIES
+=
$(LTLIBgles2)
$(LTLIBgles3)
libgl_plugin_la_SOURCES
=
$(OPENGL_COMMONSOURCES)
video_output/opengl/display.c
libgl_plugin_la_CFLAGS
=
$(AM_CFLAGS)
$(GL_CFLAGS)
$(OPENGL_COMMONCFLAGS)
...
...
modules/video_output/opengl/converter_android.c
View file @
3239fcf2
...
...
@@ -26,11 +26,12 @@
# error this file must be built from android
#endif
#include
<GLES2/gl2ext.h>
#include
"internal.h"
#include
"../android/display.h"
#include
"../android/utils.h"
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
struct
priv
{
SurfaceTexture
*
stex
;
...
...
modules/video_output/opengl/converters.c
View file @
3239fcf2
...
...
@@ -32,14 +32,17 @@
#include
"internal.h"
#ifndef GL_RED
#define GL_RED 0
#define GL_RED 0
x1903
#endif
#ifndef GL_R16
#define GL_R16 0
#define GL_R16 0x822A
#endif
#ifndef GL_RG
#define GL_RG 0x8227
#endif
#ifndef GL_LUMINANCE16
#define GL_LUMINANCE16 0
#define GL_LUMINANCE16 0
x8042
#endif
#ifndef GL_UNPACK_ROW_LENGTH
...
...
@@ -120,7 +123,7 @@ tc_yuv_base_init(opengl_tex_converter_t *tc, GLenum tex_target,
GLint
oneplane_texfmt
,
oneplane16_texfmt
,
twoplanes_texfmt
;
#if !defined(USE_OPENGL_ES)
#if !defined(USE_OPENGL_ES)
|| USE_OPENGL_ES == 3
if
(
HasExtension
(
tc
->
glexts
,
"GL_ARB_texture_rg"
))
{
oneplane_texfmt
=
GL_RED
;
...
...
@@ -1098,9 +1101,13 @@ generic_init(const video_format_t *fmt, opengl_tex_converter_t *tc,
{
bool
supports_map_persistent
=
false
;
#if defined(USE_OPENGL_ES) && USE_OPENGL_ES == 3
const
bool
has_pbo
=
true
;
#else
const
bool
has_pbo
=
HasExtension
(
tc
->
glexts
,
"GL_ARB_pixel_buffer_object"
)
||
HasExtension
(
tc
->
glexts
,
"GL_EXT_pixel_buffer_object"
);
#endif
#ifdef VLCGL_HAS_MAP_PERSISTENT
const
bool
has_bs
=
...
...
modules/video_output/opengl/display.c
View file @
3239fcf2
...
...
@@ -39,6 +39,7 @@ static void Close (vlc_object_t *);
#define GL_TEXT N_("OpenGL extension")
#define GLES2_TEXT N_("OpenGL ES 2 extension")
#define GLES3_TEXT N_("OpenGL ES 3 extension")
#define PROVIDER_LONGTEXT N_( \
"Extension through which to use the Open Graphics Library (OpenGL).")
...
...
@@ -55,6 +56,16 @@ vlc_module_begin ()
add_module
(
"gles2"
,
"opengl es2"
,
NULL
,
GLES2_TEXT
,
PROVIDER_LONGTEXT
,
true
)
# elif USE_OPENGL_ES == 3
# define API VLC_OPENGL_ES3
# define MODULE_VARNAME "gles3"
set_shortname
(
N_
(
"OpenGL ES3"
))
set_description
(
N_
(
"OpenGL for Embedded Systems 3 video output"
))
set_capability
(
"vout display"
,
268
)
set_callbacks
(
Open
,
Close
)
add_shortcut
(
"opengles3"
,
"gles3"
)
add_module
(
"gles3"
,
"opengl es3"
,
NULL
,
GLES3_TEXT
,
PROVIDER_LONGTEXT
,
true
)
# else
# error "unknown USE_OPENGL_ES define value"
# endif
...
...
modules/video_output/opengl/egl.c
View file @
3239fcf2
...
...
@@ -387,6 +387,19 @@ static int OpenGLES2 (vlc_object_t *obj)
return
Open
(
obj
,
&
api
);
}
static
int
OpenGLES3
(
vlc_object_t
*
obj
)
{
#define EGL_OPENGL_ES3_BIT 0x00000040
static
const
struct
gl_api
api
=
{
"OpenGL_ES"
,
EGL_OPENGL_ES_API
,
3
,
EGL_OPENGL_ES3_BIT
,
{
EGL_CONTEXT_CLIENT_VERSION
,
3
,
EGL_NONE
},
};
fprintf
(
stderr
,
"OpenGLES3?
\n
"
);
int
ret
=
Open
(
obj
,
&
api
);
fprintf
(
stderr
,
"OpenGLES3!: %d
\n
"
,
ret
);
return
ret
;
}
static
int
OpenGL
(
vlc_object_t
*
obj
)
{
static
const
struct
gl_api
api
=
{
...
...
@@ -410,4 +423,9 @@ vlc_module_begin ()
set_callbacks
(
OpenGLES2
,
Close
)
add_shortcut
(
"egl"
)
add_submodule
()
set_capability
(
"opengl es3"
,
51
)
set_callbacks
(
OpenGLES3
,
Close
)
add_shortcut
(
"egl"
)
vlc_module_end
()
modules/video_output/opengl/vout_helper.c
View file @
3239fcf2
...
...
@@ -153,6 +153,9 @@ struct vout_display_opengl_t {
float
f_z
;
/* Position of the camera on the shpere radius vector */
float
f_z_min
;
float
f_sar
;
mtime_t
totalt
;
uint64_t
nb_prepare
;
};
static
const
GLfloat
identity
[]
=
{
...
...
@@ -554,6 +557,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
return
NULL
;
vgl
->
gl
=
gl
;
vgl
->
totalt
=
0
;
vgl
->
nb_prepare
=
0
;
if
(
gl
->
getProcAddress
==
NULL
)
{
msg_Err
(
gl
,
"getProcAddress not implemented, bailing out
\n
"
);
...
...
@@ -832,6 +837,8 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl)
if
(
vgl
->
pool
)
picture_pool_Release
(
vgl
->
pool
);
fprintf
(
stderr
,
"total time: %lld us, total frames: %llu, mean: %lld us
\n
"
,
vgl
->
totalt
,
vgl
->
nb_prepare
,
vgl
->
totalt
/
vgl
->
nb_prepare
);
free
(
vgl
);
}
...
...
@@ -951,6 +958,7 @@ error:
int
vout_display_opengl_Prepare
(
vout_display_opengl_t
*
vgl
,
picture_t
*
picture
,
subpicture_t
*
subpicture
)
{
mtime_t
start
=
mdate
();
opengl_tex_converter_t
*
tc
=
&
vgl
->
prgm
->
tc
;
/* Update the texture */
...
...
@@ -1031,6 +1039,11 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
free
(
last
);
VLC_UNUSED
(
subpicture
);
if
(
ret
==
VLC_SUCCESS
)
{
vgl
->
totalt
+=
mdate
()
-
start
;
vgl
->
nb_prepare
++
;
}
return
ret
;
}
...
...
@@ -1408,6 +1421,7 @@ static void DrawWithShaders(vout_display_opengl_t *vgl, struct prgm *prgm)
int
vout_display_opengl_Display
(
vout_display_opengl_t
*
vgl
,
const
video_format_t
*
source
)
{
mtime_t
start
=
mdate
();
/* Why drawing here and not in Render()? Because this way, the
OpenGL providers can call vout_display_opengl_Display to force redraw.
Currently, the OS X provider uses it to get a smooth window resizing */
...
...
@@ -1541,6 +1555,7 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl,
/* Display */
vlc_gl_Swap
(
vgl
->
gl
);
vgl
->
totalt
+=
mdate
()
-
start
;
return
VLC_SUCCESS
;
}
modules/video_output/opengl/vout_helper.h
View file @
3239fcf2
...
...
@@ -51,6 +51,8 @@
# if defined (USE_OPENGL_ES)
# if USE_OPENGL_ES == 2
# include <GLES2/gl2.h>
# elif USE_OPENGL_ES == 3
# include <GLES3/gl3.h>
# else
# error "unknown USE_OPENGL_ES define value"
# endif
...
...
src/video_output/opengl.c
View file @
3239fcf2
...
...
@@ -56,6 +56,9 @@ vlc_gl_t *vlc_gl_Create(struct vout_window_t *wnd, unsigned flags,
case
VLC_OPENGL_ES2
:
type
=
"opengl es2"
;
break
;
case
VLC_OPENGL_ES3
:
type
=
"opengl es3"
;
break
;
default:
return
NULL
;
}
...
...
Write
Preview
Supports
Markdown
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