Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
55bc237c
Commit
55bc237c
authored
Sep 15, 2011
by
Sebastien Zwickert
Committed by
Jean-Baptiste Kempf
Sep 16, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OpenGL: enable shaders for MacOS and cleans some specific MacOS code.
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
7c4e25d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
85 deletions
+15
-85
modules/video_output/opengl.c
modules/video_output/opengl.c
+15
-85
No files found.
modules/video_output/opengl.c
View file @
55bc237c
...
...
@@ -166,12 +166,19 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
/* Load extensions */
bool
supports_fp
=
false
;
if
(
HasExtension
(
extensions
,
"GL_ARB_fragment_program"
))
{
#if !defined(MACOS_OPENGL)
vgl
->
GenProgramsARB
=
(
PFNGLGENPROGRAMSARBPROC
)
vlc_gl_GetProcAddress
(
vgl
->
gl
,
"glGenProgramsARB"
);
vgl
->
BindProgramARB
=
(
PFNGLBINDPROGRAMARBPROC
)
vlc_gl_GetProcAddress
(
vgl
->
gl
,
"glBindProgramARB"
);
vgl
->
ProgramStringARB
=
(
PFNGLPROGRAMSTRINGARBPROC
)
vlc_gl_GetProcAddress
(
vgl
->
gl
,
"glProgramStringARB"
);
vgl
->
DeleteProgramsARB
=
(
PFNGLDELETEPROGRAMSARBPROC
)
vlc_gl_GetProcAddress
(
vgl
->
gl
,
"glDeleteProgramsARB"
);
vgl
->
ProgramLocalParameter4fvARB
=
(
PFNGLPROGRAMLOCALPARAMETER4FVARBPROC
)
vlc_gl_GetProcAddress
(
vgl
->
gl
,
"glProgramLocalParameter4fvARB"
);
#else
vgl
->
GenProgramsARB
=
glGenProgramsARB
;
vgl
->
BindProgramARB
=
glBindProgramARB
;
vgl
->
ProgramStringARB
=
glProgramStringARB
;
vgl
->
DeleteProgramsARB
=
glDeleteProgramsARB
;
vgl
->
ProgramLocalParameter4fvARB
=
glProgramLocalParameter4fvARB
;
#endif
supports_fp
=
vgl
->
GenProgramsARB
&&
vgl
->
BindProgramARB
&&
vgl
->
ProgramStringARB
&&
...
...
@@ -182,9 +189,13 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
bool
supports_multitexture
=
false
;
GLint
max_texture_units
=
0
;
if
(
HasExtension
(
extensions
,
"GL_ARB_multitexture"
))
{
#if !defined(MACOS_OPENGL)
vgl
->
ActiveTextureARB
=
(
PFNGLACTIVETEXTUREARBPROC
)
vlc_gl_GetProcAddress
(
vgl
->
gl
,
"glActiveTextureARB"
);
vgl
->
MultiTexCoord2fARB
=
(
PFNGLMULTITEXCOORD2FARBPROC
)
vlc_gl_GetProcAddress
(
vgl
->
gl
,
"glMultiTexCoord2fARB"
);
#else
vgl
->
ActiveTextureARB
=
glActiveTextureARB
;
vgl
->
MultiTexCoord2fARB
=
glMultiTexCoord2fARB
;
#endif
supports_multitexture
=
vgl
->
ActiveTextureARB
&&
vgl
->
MultiTexCoord2fARB
;
if
(
supports_multitexture
)
...
...
@@ -208,16 +219,6 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
vgl
->
tex_format
=
GL_RGB
;
vgl
->
tex_internal
=
GL_RGB
;
vgl
->
tex_type
=
GL_UNSIGNED_SHORT_5_6_5
;
#elif defined(MACOS_OPENGL)
# if defined(WORDS_BIGENDIAN)
vgl
->
fmt
.
i_chroma
=
VLC_CODEC_YUYV
;
# else
vgl
->
fmt
.
i_chroma
=
VLC_CODEC_UYVY
;
# endif
vgl
->
tex_target
=
GL_TEXTURE_RECTANGLE_EXT
;
vgl
->
tex_format
=
GL_YCBCR_422_APPLE
;
vgl
->
tex_internal
=
GL_RGBA
;
vgl
->
tex_type
=
GL_UNSIGNED_SHORT_8_8_APPLE
;
#else
vgl
->
fmt
.
i_chroma
=
VLC_CODEC_RGB32
;
# if defined(WORDS_BIGENDIAN)
...
...
@@ -272,8 +273,6 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
bool
supports_npot
=
false
;
#if USE_OPENGL_ES == 2
supports_npot
=
true
;
#elif defined(MACOS_OPENGL)
supports_npot
=
true
;
#else
supports_npot
|=
HasExtension
(
extensions
,
"GL_APPLE_texture_2D_limited_npot"
)
||
HasExtension
(
extensions
,
"GL_ARB_texture_non_power_of_two"
);
...
...
@@ -395,7 +394,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
*
fmt
=
vgl
->
fmt
;
if
(
subpicture_chromas
)
{
*
subpicture_chromas
=
NULL
;
#if !
defined(MACOS_OPENGL) && !
USE_OPENGL_ES
#if !USE_OPENGL_ES
if
(
supports_npot
)
*
subpicture_chromas
=
gl_subpicture_chromas
;
#endif
...
...
@@ -428,42 +427,6 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl)
free
(
vgl
);
}
#ifdef MACOS_OPENGL
struct
picture_sys_t
{
vout_display_opengl_t
*
vgl
;
GLuint
*
texture
;
};
/* Small helper */
static
inline
GLuint
PictureGetTexture
(
picture_t
*
picture
)
{
return
*
picture
->
p_sys
->
texture
;
}
static
int
PictureLock
(
picture_t
*
picture
)
{
if
(
!
picture
->
p_sys
)
return
VLC_SUCCESS
;
vout_display_opengl_t
*
vgl
=
picture
->
p_sys
->
vgl
;
if
(
!
vlc_gl_Lock
(
vgl
->
gl
))
{
glBindTexture
(
vgl
->
tex_target
,
PictureGetTexture
(
picture
));
glPixelStorei
(
GL_UNPACK_ROW_LENGTH
,
picture
->
p
->
i_pitch
/
picture
->
p
->
i_pixel_pitch
);
glTexSubImage2D
(
vgl
->
tex_target
,
0
,
0
,
0
,
vgl
->
fmt
.
i_width
,
vgl
->
fmt
.
i_height
,
vgl
->
tex_format
,
vgl
->
tex_type
,
picture
->
p
[
0
].
p_pixels
);
vlc_gl_Unlock
(
vgl
->
gl
);
}
return
VLC_SUCCESS
;
}
static
void
PictureUnlock
(
picture_t
*
picture
)
{
VLC_UNUSED
(
picture
);
}
#endif
picture_pool_t
*
vout_display_opengl_GetPool
(
vout_display_opengl_t
*
vgl
,
unsigned
requested_count
)
{
if
(
vgl
->
pool
)
...
...
@@ -477,14 +440,6 @@ picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned
picture
[
count
]
=
picture_NewFromFormat
(
&
vgl
->
fmt
);
if
(
!
picture
[
count
])
break
;
#ifdef MACOS_OPENGL
picture_sys_t
*
sys
=
picture
[
count
]
->
p_sys
=
malloc
(
sizeof
(
*
sys
));
if
(
sys
)
{
sys
->
vgl
=
vgl
;
sys
->
texture
=
vgl
->
texture
[
count
];
}
#endif
}
if
(
count
<=
0
)
return
NULL
;
...
...
@@ -494,10 +449,6 @@ picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned
memset
(
&
cfg
,
0
,
sizeof
(
cfg
));
cfg
.
picture_count
=
count
;
cfg
.
picture
=
picture
;
#ifdef MACOS_OPENGL
cfg
.
lock
=
PictureLock
;
cfg
.
unlock
=
PictureUnlock
;
#endif
vgl
->
pool
=
picture_pool_NewExtended
(
&
cfg
);
if
(
!
vgl
->
pool
)
goto
error
;
...
...
@@ -509,7 +460,6 @@ 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
++
)
{
uint8_t
*
buffer
=
NULL
;
if
(
vgl
->
use_multitexture
)
vgl
->
ActiveTextureARB
(
GL_TEXTURE0_ARB
+
j
);
glBindTexture
(
vgl
->
tex_target
,
vgl
->
texture
[
i
][
j
]);
...
...
@@ -525,23 +475,10 @@ picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned
glTexParameteri
(
vgl
->
tex_target
,
GL_TEXTURE_WRAP_S
,
GL_CLAMP_TO_EDGE
);
glTexParameteri
(
vgl
->
tex_target
,
GL_TEXTURE_WRAP_T
,
GL_CLAMP_TO_EDGE
);
#ifdef MACOS_OPENGL
/* Tell the driver not to make a copy of the texture but to use
our buffer */
glEnable
(
GL_UNPACK_CLIENT_STORAGE_APPLE
);
glPixelStorei
(
GL_UNPACK_CLIENT_STORAGE_APPLE
,
GL_TRUE
);
buffer
=
picture
[
i
]
->
p
[
j
].
p_pixels
;
/* Use AGP texturing */
glTexParameteri
(
vgl
->
tex_target
,
GL_TEXTURE_STORAGE_HINT_APPLE
,
GL_STORAGE_SHARED_APPLE
);
#endif
/* Call glTexImage2D only once, and use glTexSubImage2D later */
glTexImage2D
(
vgl
->
tex_target
,
0
,
vgl
->
tex_internal
,
vgl
->
tex_width
[
j
],
vgl
->
tex_height
[
j
],
0
,
vgl
->
tex_format
,
vgl
->
tex_type
,
buffer
);
0
,
vgl
->
tex_format
,
vgl
->
tex_type
,
NULL
);
}
}
...
...
@@ -577,10 +514,6 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
if
(
vlc_gl_Lock
(
vgl
->
gl
))
return
VLC_EGENERIC
;
#ifdef MACOS_OPENGL
/* Bind to the texture for drawing */
glBindTexture
(
vgl
->
tex_target
,
PictureGetTexture
(
picture
));
#else
/* Update the texture */
for
(
unsigned
j
=
0
;
j
<
vgl
->
chroma
->
plane_count
;
j
++
)
{
const
int
plane
=
vgl
->
fmt
.
i_chroma
==
VLC_CODEC_YV12
&&
j
>
0
?
(
3
-
j
)
:
j
;
...
...
@@ -594,7 +527,6 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
vgl
->
fmt
.
i_height
*
vgl
->
chroma
->
p
[
plane
].
h
.
num
/
vgl
->
chroma
->
p
[
plane
].
h
.
den
,
vgl
->
tex_format
,
vgl
->
tex_type
,
picture
->
p
[
plane
].
p_pixels
);
}
#endif
int
last_count
=
vgl
->
region_count
;
gl_region_t
*
last
=
vgl
->
region
;
...
...
@@ -740,13 +672,11 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl,
glDrawArrays
(
GL_TRIANGLE_STRIP
,
0
,
4
);
#else
#if !defined(MACOS_OPENGL)
for
(
unsigned
j
=
0
;
j
<
vgl
->
chroma
->
plane_count
;
j
++
)
{
if
(
vgl
->
use_multitexture
)
vgl
->
ActiveTextureARB
(
GL_TEXTURE0_ARB
+
j
);
glBindTexture
(
vgl
->
tex_target
,
vgl
->
texture
[
0
][
j
]);
}
#endif
glBegin
(
GL_POLYGON
);
glTexCoord2f
(
left
[
0
],
top
[
0
]);
...
...
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