Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
5c1644d4
Commit
5c1644d4
authored
Mar 22, 2012
by
Philippe Coent
Committed by
Felix Paul Kühne
Mar 22, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vout/opengl: fixed compilation for iOS
Signed-off-by:
Felix Paul Kühne
<
fkuehne@videolan.org
>
parent
5482b9b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
modules/video_output/opengl.c
modules/video_output/opengl.c
+42
-0
No files found.
modules/video_output/opengl.c
View file @
5c1644d4
...
...
@@ -37,6 +37,7 @@
// Define USE_OPENGL_ES to the GL ES Version you want to select
#ifdef __APPLE__
#ifndef __IPHONE_OS_VERSION_MIN_REQUIRED
# define PFNGLGENPROGRAMSARBPROC typeof(glGenProgramsARB)*
# define PFNGLBINDPROGRAMARBPROC typeof(glBindProgramARB)*
# define PFNGLPROGRAMSTRINGARBPROC typeof(glProgramStringARB)*
...
...
@@ -44,6 +45,9 @@
# define PFNGLPROGRAMLOCALPARAMETER4FVARBPROC typeof(glProgramLocalParameter4fvARB)*
# define PFNGLACTIVETEXTUREARBPROC typeof(glActiveTextureARB)*
# define PFNGLCLIENTACTIVETEXTUREARBPROC typeof(glClientActiveTextureARB)*
#else
#define USE_OPENGL_ES 2
#endif
#endif
/* RV16 */
...
...
@@ -108,6 +112,7 @@ struct vout_display_opengl_t {
int
local_count
;
GLfloat
local_value
[
16
][
4
];
#ifndef USE_OPENGL_ES
/* fragment_program */
PFNGLGENPROGRAMSARBPROC
GenProgramsARB
;
PFNGLBINDPROGRAMARBPROC
BindProgramARB
;
...
...
@@ -119,6 +124,7 @@ struct vout_display_opengl_t {
bool
use_multitexture
;
PFNGLACTIVETEXTUREARBPROC
ActiveTextureARB
;
PFNGLCLIENTACTIVETEXTUREARBPROC
ClientActiveTextureARB
;
#endif
};
static
inline
int
GetAlignedSize
(
unsigned
size
)
...
...
@@ -128,6 +134,7 @@ static inline int GetAlignedSize(unsigned size)
return
((
align
>>
1
)
==
size
)
?
size
:
align
;
}
#ifndef USE_OPENGL_ES
static
bool
IsLuminance16Supported
(
int
target
)
{
GLuint
texture
;
...
...
@@ -143,6 +150,7 @@ static bool IsLuminance16Supported(int target)
return
size
==
16
;
}
#endif
vout_display_opengl_t
*
vout_display_opengl_New
(
video_format_t
*
fmt
,
const
vlc_fourcc_t
**
subpicture_chromas
,
...
...
@@ -162,6 +170,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
/* Load extensions */
bool
supports_fp
=
false
;
#ifndef USE_OPENGL_ES
if
(
HasExtension
(
extensions
,
"GL_ARB_fragment_program"
))
{
#if !defined(MACOS_OPENGL)
vgl
->
GenProgramsARB
=
(
PFNGLGENPROGRAMSARBPROC
)
vlc_gl_GetProcAddress
(
vgl
->
gl
,
"glGenProgramsARB"
);
...
...
@@ -182,7 +192,9 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
vgl
->
DeleteProgramsARB
&&
vgl
->
ProgramLocalParameter4fvARB
;
}
#endif
#ifndef USE_OPENGL_ES
bool
supports_multitexture
=
false
;
GLint
max_texture_units
=
0
;
if
(
HasExtension
(
extensions
,
"GL_ARB_multitexture"
))
{
...
...
@@ -198,6 +210,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
if
(
supports_multitexture
)
glGetIntegerv
(
GL_MAX_TEXTURE_UNITS_ARB
,
&
max_texture_units
);
}
#endif
/* Initialize with default chroma */
vgl
->
fmt
=
*
fmt
;
...
...
@@ -235,6 +248,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
/* Use YUV if possible and needed */
bool
need_fs_yuv
=
false
;
float
yuv_range_correction
=
1
.
0
;
#ifndef USE_OPENGL_ES
if
(
supports_fp
&&
supports_multitexture
&&
max_texture_units
>=
3
&&
vlc_fourcc_IsYUV
(
fmt
->
i_chroma
)
&&
!
vlc_fourcc_IsYUV
(
vgl
->
fmt
.
i_chroma
))
{
const
vlc_fourcc_t
*
list
=
vlc_fourcc_GetYUVFallback
(
fmt
->
i_chroma
);
...
...
@@ -263,9 +278,12 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
list
++
;
}
}
#endif
vgl
->
chroma
=
vlc_fourcc_GetChromaDescription
(
vgl
->
fmt
.
i_chroma
);
#ifndef USE_OPENGL_ES
vgl
->
use_multitexture
=
vgl
->
chroma
->
plane_count
>
1
;
#endif
bool
supports_npot
=
false
;
#if USE_OPENGL_ES == 2
...
...
@@ -346,6 +364,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
}
vgl
->
local_count
+=
4
;
}
#ifndef USE_OPENGL_ES
if
(
code
)
{
// Here you have shaders
vgl
->
GenProgramsARB
(
1
,
&
vgl
->
program
);
...
...
@@ -367,6 +386,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
}
free
(
code
);
}
#endif
}
/* */
...
...
@@ -414,8 +434,10 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl)
}
free
(
vgl
->
region
);
#ifndef USE_OPENGL_ES
if
(
vgl
->
program
)
vgl
->
DeleteProgramsARB
(
1
,
&
vgl
->
program
);
#endif
vlc_gl_Unlock
(
vgl
->
gl
);
}
...
...
@@ -457,8 +479,10 @@ picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned
for
(
int
i
=
0
;
i
<
VLCGL_TEXTURE_COUNT
;
i
++
)
{
glGenTextures
(
vgl
->
chroma
->
plane_count
,
vgl
->
texture
[
i
]);
for
(
unsigned
j
=
0
;
j
<
vgl
->
chroma
->
plane_count
;
j
++
)
{
#ifndef USE_OPENGL_ES
if
(
vgl
->
use_multitexture
)
vgl
->
ActiveTextureARB
(
GL_TEXTURE0_ARB
+
j
);
#endif
glBindTexture
(
vgl
->
tex_target
,
vgl
->
texture
[
i
][
j
]);
#if !USE_OPENGL_ES
...
...
@@ -513,10 +537,14 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
/* Update the texture */
for
(
unsigned
j
=
0
;
j
<
vgl
->
chroma
->
plane_count
;
j
++
)
{
#ifndef USE_OPENGL_ES
if
(
vgl
->
use_multitexture
)
vgl
->
ActiveTextureARB
(
GL_TEXTURE0_ARB
+
j
);
#endif
glBindTexture
(
vgl
->
tex_target
,
vgl
->
texture
[
0
][
j
]);
#ifndef USE_OPENGL_ES
glPixelStorei
(
GL_UNPACK_ROW_LENGTH
,
picture
->
p
[
j
].
i_pitch
/
picture
->
p
[
j
].
i_pixel_pitch
);
#endif
glTexSubImage2D
(
vgl
->
tex_target
,
0
,
0
,
0
,
vgl
->
fmt
.
i_width
*
vgl
->
chroma
->
p
[
j
].
w
.
num
/
vgl
->
chroma
->
p
[
j
].
w
.
den
,
...
...
@@ -539,8 +567,10 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
vgl
->
region_count
=
count
;
vgl
->
region
=
calloc
(
count
,
sizeof
(
*
vgl
->
region
));
#ifndef USE_OPENGL_ES
if
(
vgl
->
use_multitexture
)
vgl
->
ActiveTextureARB
(
GL_TEXTURE0_ARB
+
0
);
#endif
int
i
=
0
;
for
(
subpicture_region_t
*
r
=
subpicture
->
p_region
;
r
;
r
=
r
->
p_next
,
i
++
)
{
gl_region_t
*
glr
=
&
vgl
->
region
[
i
];
...
...
@@ -573,21 +603,27 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
if
(
glr
->
texture
)
{
glBindTexture
(
GL_TEXTURE_2D
,
glr
->
texture
);
/* TODO set GL_UNPACK_ALIGNMENT */
#ifndef USE_OPENGL_ES
glPixelStorei
(
GL_UNPACK_ROW_LENGTH
,
r
->
p_picture
->
p
->
i_pitch
/
r
->
p_picture
->
p
->
i_pixel_pitch
);
#endif
glTexSubImage2D
(
GL_TEXTURE_2D
,
0
,
0
,
0
,
glr
->
width
,
glr
->
height
,
glr
->
format
,
glr
->
type
,
&
r
->
p_picture
->
p
->
p_pixels
[
pixels_offset
]);
}
else
{
glGenTextures
(
1
,
&
glr
->
texture
);
glBindTexture
(
GL_TEXTURE_2D
,
glr
->
texture
);
#ifndef USE_OPENGL_ES
glTexParameterf
(
GL_TEXTURE_2D
,
GL_TEXTURE_PRIORITY
,
1
.
0
);
#endif
glTexEnvf
(
GL_TEXTURE_ENV
,
GL_TEXTURE_ENV_MODE
,
GL_MODULATE
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
GL_LINEAR
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_WRAP_S
,
GL_CLAMP_TO_EDGE
);
glTexParameteri
(
GL_TEXTURE_2D
,
GL_TEXTURE_WRAP_T
,
GL_CLAMP_TO_EDGE
);
/* TODO set GL_UNPACK_ALIGNMENT */
#ifndef USE_OPENGL_ES
glPixelStorei
(
GL_UNPACK_ROW_LENGTH
,
r
->
p_picture
->
p
->
i_pitch
/
r
->
p_picture
->
p
->
i_pixel_pitch
);
#endif
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
glr
->
format
,
glr
->
width
,
glr
->
height
,
0
,
glr
->
format
,
glr
->
type
,
&
r
->
p_picture
->
p
->
p_pixels
[
pixels_offset
]);
...
...
@@ -640,6 +676,7 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl,
glClear
(
GL_COLOR_BUFFER_BIT
);
#ifndef USE_OPENGL_ES
if
(
vgl
->
program
)
{
glEnable
(
GL_FRAGMENT_PROGRAM_ARB
);
for
(
int
i
=
0
;
i
<
vgl
->
local_count
;
i
++
)
...
...
@@ -647,6 +684,7 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl,
}
else
{
glEnable
(
vgl
->
tex_target
);
}
#endif
#if USE_OPENGL_ES
static
const
GLfloat
vertexCoord
[]
=
{
...
...
@@ -710,10 +748,14 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl,
#endif
#ifndef USE_OPENGL_ES
if
(
vgl
->
program
)
glDisable
(
GL_FRAGMENT_PROGRAM_ARB
);
else
glDisable
(
vgl
->
tex_target
);
#else
glDisable
(
vgl
->
tex_target
);
#endif
#if !USE_OPENGL_ES
if
(
vgl
->
use_multitexture
)
...
...
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