Mercurial > mplayer.hg
annotate libvo/gl_common.h @ 36215:4eb27365d0b0
Add hack to fix compilation issues on OSX with broken libiconv.
Such a hack is not really a good solution, but since the
issue is relatively common it seems worth it for the moment.
author | reimar |
---|---|
date | Sun, 09 Jun 2013 13:54:47 +0000 |
parents | df7cb3197862 |
children | 673719da1a92 |
rev | line source |
---|---|
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
1 /* |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
2 * This file is part of MPlayer. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
3 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
7 * (at your option) any later version. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
8 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
12 * GNU General Public License for more details. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
13 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
31309
1a35ec7c45e0
Dual-license gl_common and vo_gl under the LGPL v2.1 or later as
reimar
parents:
31065
diff
changeset
|
17 * |
1a35ec7c45e0
Dual-license gl_common and vo_gl under the LGPL v2.1 or later as
reimar
parents:
31065
diff
changeset
|
18 * You can alternatively redistribute this file and/or |
1a35ec7c45e0
Dual-license gl_common and vo_gl under the LGPL v2.1 or later as
reimar
parents:
31065
diff
changeset
|
19 * modify it under the terms of the GNU Lesser General Public |
1a35ec7c45e0
Dual-license gl_common and vo_gl under the LGPL v2.1 or later as
reimar
parents:
31065
diff
changeset
|
20 * License as published by the Free Software Foundation; either |
1a35ec7c45e0
Dual-license gl_common and vo_gl under the LGPL v2.1 or later as
reimar
parents:
31065
diff
changeset
|
21 * version 2.1 of the License, or (at your option) any later version. |
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
22 */ |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28070
diff
changeset
|
23 |
26029 | 24 #ifndef MPLAYER_GL_COMMON_H |
25 #define MPLAYER_GL_COMMON_H | |
13653
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
26 |
26162
0585db9f5b32
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
27 #include <stdio.h> |
26163
f3e72d1a2329
This header uses parts of stdint.h, so #include it.
diego
parents:
26162
diff
changeset
|
28 #include <stdint.h> |
26162
0585db9f5b32
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
29 |
26203 | 30 #include "config.h" |
13843 | 31 #include "video_out.h" |
30108
0898adc64a6f
Extract functions to generate yuv->rgb matrices and lookup tables into a
reimar
parents:
30107
diff
changeset
|
32 #include "csputils.h" |
13843 | 33 |
30023 | 34 #ifdef CONFIG_GL_WIN32 |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
14078
diff
changeset
|
35 #include <windows.h> |
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
14078
diff
changeset
|
36 #include "w32_common.h" |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
37 #endif |
30023 | 38 #ifdef CONFIG_GL_X11 |
13843 | 39 #include <X11/Xlib.h> |
40 #include <GL/glx.h> | |
41 #include "x11_common.h" | |
42 #endif | |
34338 | 43 #ifdef CONFIG_GL_EGL_X11 |
44 #include <EGL/egl.h> | |
45 #include "x11_common.h" | |
46 #endif | |
35089
a87c434ecaa3
Allow compiling -vo gl with OSX backend even if X11 and SDL are not available.
reimar
parents:
35087
diff
changeset
|
47 #ifdef CONFIG_GL_OSX |
35087 | 48 #include "osx_common.h" |
35811 | 49 #include <OpenGL/gl.h> |
35889 | 50 #elif defined(CONFIG_GL_EGL_ANDROID) |
51 #include <EGL/egl.h> | |
52 #include <GLES/gl.h> | |
35089
a87c434ecaa3
Allow compiling -vo gl with OSX backend even if X11 and SDL are not available.
reimar
parents:
35087
diff
changeset
|
53 #else |
a87c434ecaa3
Allow compiling -vo gl with OSX backend even if X11 and SDL are not available.
reimar
parents:
35087
diff
changeset
|
54 #include <GL/gl.h> |
35087 | 55 #endif |
13653
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
56 |
35886
4921bccc0968
Split out defines for compatibility between different GL headers.
reimar
parents:
35811
diff
changeset
|
57 #include "gl_compat.h" |
16099 | 58 |
13653
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
59 void glAdjustAlignment(int stride); |
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
60 |
14078
c4033dcb986f
More similar code from gl and gl2 moved to gl_common
reimar
parents:
13921
diff
changeset
|
61 const char *glValName(GLint value); |
c4033dcb986f
More similar code from gl and gl2 moved to gl_common
reimar
parents:
13921
diff
changeset
|
62 |
16879
6ea220b10e8e
More consistent and sane types. Also avoids some gcc 4 warnings.
reimar
parents:
16625
diff
changeset
|
63 int glFindFormat(uint32_t format, int *bpp, GLint *gl_texfmt, |
14078
c4033dcb986f
More similar code from gl and gl2 moved to gl_common
reimar
parents:
13921
diff
changeset
|
64 GLenum *gl_format, GLenum *gl_type); |
16117 | 65 int glFmt2bpp(GLenum format, GLenum type); |
27621
53b5cf466361
Change glCreateClearTex to use the same host data format as later uploads.
reimar
parents:
27306
diff
changeset
|
66 void glCreateClearTex(GLenum target, GLenum fmt, GLenum format, GLenum type, GLint filter, |
16460 | 67 int w, int h, unsigned char val); |
16592 | 68 int glCreatePPMTex(GLenum target, GLenum fmt, GLint filter, |
69 FILE *f, int *width, int *height, int *maxval); | |
16117 | 70 void glUploadTex(GLenum target, GLenum format, GLenum type, |
21201 | 71 const void *dataptr, int stride, |
16117 | 72 int x, int y, int w, int h, int slice); |
16214
ede5b4afd262
Helper function for drawing texture and general cleanup of vo_gl2.c
reimar
parents:
16117
diff
changeset
|
73 void glDrawTex(GLfloat x, GLfloat y, GLfloat w, GLfloat h, |
ede5b4afd262
Helper function for drawing texture and general cleanup of vo_gl2.c
reimar
parents:
16117
diff
changeset
|
74 GLfloat tx, GLfloat ty, GLfloat tw, GLfloat th, |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
75 int sx, int sy, int rect_tex, int is_yv12, int flip, |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
76 int use_stipple); |
18653
5af43a16abc3
loadGPUProgram function to load fragment program with error checking and statistics
reimar
parents:
18622
diff
changeset
|
77 int loadGPUProgram(GLenum target, char *prog); |
16488
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
78 |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
79 /** \addtogroup glconversion |
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
80 * \{ */ |
16488
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
81 //! do not use YUV conversion, this should always stay 0 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
82 #define YUV_CONVERSION_NONE 0 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
83 //! use nVidia specific register combiners for YUV conversion |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
84 #define YUV_CONVERSION_COMBINERS 1 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
85 //! use a fragment program for YUV conversion |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
86 #define YUV_CONVERSION_FRAGMENT 2 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
87 //! use a fragment program for YUV conversion with gamma using POW |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
88 #define YUV_CONVERSION_FRAGMENT_POW 3 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
89 //! use a fragment program with additional table lookup for YUV conversion |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
90 #define YUV_CONVERSION_FRAGMENT_LOOKUP 4 |
16625 | 91 //! use ATI specific register combiners ("fragment program") |
92 #define YUV_CONVERSION_COMBINERS_ATI 5 | |
18655
6aa0b26d584b
Add yuv to rgb conversion using a 3D lookup texture
reimar
parents:
18653
diff
changeset
|
93 //! use a fragment program with 3D table lookup for YUV conversion |
6aa0b26d584b
Add yuv to rgb conversion using a 3D lookup texture
reimar
parents:
18653
diff
changeset
|
94 #define YUV_CONVERSION_FRAGMENT_LOOKUP3D 6 |
30951
e76a4f6bfc8d
Implement OpenGL-based YUV to RGB version for Radeon 9200 class
reimar
parents:
30945
diff
changeset
|
95 //! use ATI specific "text" register combiners ("fragment program") |
e76a4f6bfc8d
Implement OpenGL-based YUV to RGB version for Radeon 9200 class
reimar
parents:
30945
diff
changeset
|
96 #define YUV_CONVERSION_TEXT_FRAGMENT 7 |
36126 | 97 #define YUV_CONVERSION_SL_PROGRAM 8 |
18619
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
98 //! use normal bilinear scaling for textures |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
99 #define YUV_SCALER_BILIN 0 |
18622 | 100 //! use higher quality bicubic scaling for textures |
101 #define YUV_SCALER_BICUB 1 | |
22491 | 102 //! use cubic scaling in X and normal linear scaling in Y direction |
103 #define YUV_SCALER_BICUB_X 2 | |
24318
e6e8bf060dae
Add a bicubic scaler that needs a lot more instruction but no
reimar
parents:
23689
diff
changeset
|
104 //! use cubic scaling without additional lookup texture |
e6e8bf060dae
Add a bicubic scaler that needs a lot more instruction but no
reimar
parents:
23689
diff
changeset
|
105 #define YUV_SCALER_BICUB_NOTEX 3 |
25729
9a96fd14d1c5
Add experimental unsharp-mask OpenGL scaler. Certainly not yet perfect.
reimar
parents:
25535
diff
changeset
|
106 #define YUV_SCALER_UNSHARP 4 |
25758 | 107 #define YUV_SCALER_UNSHARP2 5 |
18619
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
108 //! mask for conversion type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
109 #define YUV_CONVERSION_MASK 0xF |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
110 //! mask for scaler type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
111 #define YUV_SCALER_MASK 0xF |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
112 //! shift value for luminance scaler type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
113 #define YUV_LUM_SCALER_SHIFT 8 |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
114 //! shift value for chrominance scaler type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
115 #define YUV_CHROM_SCALER_SHIFT 12 |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
116 //! extract conversion out of type |
31675 | 117 #define YUV_CONVERSION(t) ((t) & YUV_CONVERSION_MASK) |
18619
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
118 //! extract luminance scaler out of type |
31675 | 119 #define YUV_LUM_SCALER(t) (((t) >> YUV_LUM_SCALER_SHIFT) & YUV_SCALER_MASK) |
18619
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
120 //! extract chrominance scaler out of type |
31675 | 121 #define YUV_CHROM_SCALER(t) (((t) >> YUV_CHROM_SCALER_SHIFT) & YUV_SCALER_MASK) |
31676
a0a48c62bb8c
Helper macros to build the yuv conversion type number.
reimar
parents:
31675
diff
changeset
|
122 #define SET_YUV_CONVERSION(c) ((c) & YUV_CONVERSION_MASK) |
a0a48c62bb8c
Helper macros to build the yuv conversion type number.
reimar
parents:
31675
diff
changeset
|
123 #define SET_YUV_LUM_SCALER(s) (((s) & YUV_SCALER_MASK) << YUV_LUM_SCALER_SHIFT) |
a0a48c62bb8c
Helper macros to build the yuv conversion type number.
reimar
parents:
31675
diff
changeset
|
124 #define SET_YUV_CHROM_SCALER(s) (((s) & YUV_SCALER_MASK) << YUV_CHROM_SCALER_SHIFT) |
33414 | 125 //! returns whether the yuv conversion supports large brightness range etc. |
126 static inline int glYUVLargeRange(int conv) | |
127 { | |
128 switch (conv) | |
129 { | |
130 case YUV_CONVERSION_NONE: | |
131 case YUV_CONVERSION_COMBINERS: | |
132 case YUV_CONVERSION_COMBINERS_ATI: | |
133 case YUV_CONVERSION_FRAGMENT_LOOKUP3D: | |
134 case YUV_CONVERSION_TEXT_FRAGMENT: | |
135 return 0; | |
136 } | |
137 return 1; | |
138 } | |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
139 |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
140 static inline int glYUVSupportsAlphaTex(int conv) |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
141 { |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
142 switch (conv) |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
143 { |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
144 case YUV_CONVERSION_COMBINERS: |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
145 case YUV_CONVERSION_COMBINERS_ATI: |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
146 case YUV_CONVERSION_TEXT_FRAGMENT: |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
147 return 0; |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
148 } |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
149 return 1; |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
150 } |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
151 /** \} */ |
30107
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
152 |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
153 typedef struct { |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
154 GLenum target; |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
155 int type; |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
156 struct mp_csp_params csp_params; |
26835 | 157 int texw; |
158 int texh; | |
30097 | 159 int chrom_texw; |
160 int chrom_texh; | |
36111 | 161 int is_planar; |
26836
ba086caf1230
Add a filter strength parameter for blurring/sharpening scalers.
reimar
parents:
26835
diff
changeset
|
162 float filter_strength; |
33927 | 163 float noise_strength; |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
164 int has_alpha_tex; |
26835 | 165 } gl_conversion_params_t; |
166 | |
30964
a5c6b37b3af6
Factor out the YUV->RGB conversion auto-selection and also
reimar
parents:
30951
diff
changeset
|
167 int glAutodetectYUVConversion(void); |
26835 | 168 void glSetupYUVConversion(gl_conversion_params_t *params); |
18175
01ca8a5fb8a6
minor fixes: get rid of pointless inline attributes and some additional checks
reimar
parents:
17688
diff
changeset
|
169 void glEnableYUVConversion(GLenum target, int type); |
01ca8a5fb8a6
minor fixes: get rid of pointless inline attributes and some additional checks
reimar
parents:
17688
diff
changeset
|
170 void glDisableYUVConversion(GLenum target, int type); |
14078
c4033dcb986f
More similar code from gl and gl2 moved to gl_common
reimar
parents:
13921
diff
changeset
|
171 |
34375 | 172 #define GL_3D_SWAP 32 |
31567 | 173 #define GL_3D_RED_CYAN 1 |
174 #define GL_3D_GREEN_MAGENTA 2 | |
175 #define GL_3D_QUADBUFFER 3 | |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
176 #define GL_3D_STIPPLE 4 |
31567 | 177 |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
178 void glSetupAlphaStippleTex(unsigned pattern); |
31567 | 179 void glEnable3DLeft(int type); |
180 void glEnable3DRight(int type); | |
181 void glDisable3D(int type); | |
182 | |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
183 /** \addtogroup glcontext |
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
184 * \{ */ |
13843 | 185 //! could not set new window, will continue drawing into the old one. |
186 #define SET_WINDOW_FAILED -1 | |
187 //! new window is set, could even transfer the OpenGL context. | |
188 #define SET_WINDOW_OK 0 | |
189 //! new window is set, but the OpenGL context needs to be reinitialized. | |
190 #define SET_WINDOW_REINIT 1 | |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
191 /** \} */ |
13843 | 192 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
193 enum MPGLType { |
34350
27dead7f2593
Add a suboption to allow forcing use of e.g. OpenGL ES to -vo gl.
reimar
parents:
34338
diff
changeset
|
194 GLTYPE_AUTO = -1, |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
195 GLTYPE_W32, |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
196 GLTYPE_X11, |
31020
529614f44431
First steps to support -vo gl with SDL-based Window handling.
reimar
parents:
30985
diff
changeset
|
197 GLTYPE_SDL, |
34338 | 198 GLTYPE_EGL_X11, |
35087 | 199 GLTYPE_OSX, |
35889 | 200 GLTYPE_EGL_ANDROID, |
34350
27dead7f2593
Add a suboption to allow forcing use of e.g. OpenGL ES to -vo gl.
reimar
parents:
34338
diff
changeset
|
201 GLTYPE_COUNT |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
202 }; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
203 |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
204 typedef struct MPGLContext { |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
205 enum MPGLType type; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
206 union { |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
207 int w32; |
30023 | 208 #ifdef CONFIG_GL_X11 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
209 XVisualInfo *x11; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
210 #endif |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
211 } vinfo; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
212 union { |
30023 | 213 #ifdef CONFIG_GL_WIN32 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
214 HGLRC w32; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
215 #endif |
30023 | 216 #ifdef CONFIG_GL_X11 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
217 GLXContext x11; |
13653
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
218 #endif |
35889 | 219 #if defined(CONFIG_GL_EGL_X11) || defined(CONFIG_GL_EGL_ANDROID) |
34338 | 220 EGLContext egl; |
221 #endif | |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
222 } context; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
223 int (*setGlWindow)(struct MPGLContext *); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
224 void (*releaseGlContext)(struct MPGLContext *); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
225 void (*swapGlBuffers)(struct MPGLContext *); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
226 void (*update_xinerama_info)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
227 void (*border)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
228 int (*check_events)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
229 void (*fullscreen)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
230 void (*ontop)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
231 } MPGLContext; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
232 |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
233 int init_mpglcontext(MPGLContext *ctx, enum MPGLType type); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
234 void uninit_mpglcontext(MPGLContext *ctx); |
13843 | 235 |
34841 | 236 extern GLenum (GLAPIENTRY *mpglGetError)(void); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
237 extern void (GLAPIENTRY *mpglBegin)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
238 extern void (GLAPIENTRY *mpglEnd)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
239 extern void (GLAPIENTRY *mpglViewport)(GLint, GLint, GLsizei, GLsizei); |
36126 | 240 extern void (GLAPIENTRY *mpglLoadMatrixf)(const float *); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
241 extern void (GLAPIENTRY *mpglClear)(GLbitfield); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
242 extern GLuint (GLAPIENTRY *mpglGenLists)(GLsizei); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
243 extern void (GLAPIENTRY *mpglDeleteLists)(GLuint, GLsizei); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
244 extern void (GLAPIENTRY *mpglNewList)(GLuint, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
245 extern void (GLAPIENTRY *mpglEndList)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
246 extern void (GLAPIENTRY *mpglCallList)(GLuint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
247 extern void (GLAPIENTRY *mpglCallLists)(GLsizei, GLenum, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
248 extern void (GLAPIENTRY *mpglGenTextures)(GLsizei, GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
249 extern void (GLAPIENTRY *mpglDeleteTextures)(GLsizei, const GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
250 extern void (GLAPIENTRY *mpglTexEnvi)(GLenum, GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
251 extern void (GLAPIENTRY *mpglColor4ub)(GLubyte, GLubyte, GLubyte, GLubyte); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
252 extern void (GLAPIENTRY *mpglClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); |
35890 | 253 extern void (GLAPIENTRY *mpglClearDepth)(double); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
254 extern void (GLAPIENTRY *mpglDepthFunc)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
255 extern void (GLAPIENTRY *mpglEnable)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
256 extern void (GLAPIENTRY *mpglDisable)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
257 extern const GLubyte *(GLAPIENTRY *mpglGetString)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
258 extern void (GLAPIENTRY *mpglDrawBuffer)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
259 extern void (GLAPIENTRY *mpglDepthMask)(GLboolean); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
260 extern void (GLAPIENTRY *mpglBlendFunc)(GLenum, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
261 extern void (GLAPIENTRY *mpglFlush)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
262 extern void (GLAPIENTRY *mpglFinish)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
263 extern void (GLAPIENTRY *mpglPixelStorei)(GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
264 extern void (GLAPIENTRY *mpglTexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
265 extern void (GLAPIENTRY *mpglTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
266 extern void (GLAPIENTRY *mpglTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
267 extern void (GLAPIENTRY *mpglTexParameteri)(GLenum, GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
268 extern void (GLAPIENTRY *mpglTexParameterf)(GLenum, GLenum, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
269 extern void (GLAPIENTRY *mpglTexParameterfv)(GLenum, GLenum, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
270 extern void (GLAPIENTRY *mpglTexCoord2f)(GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
271 extern void (GLAPIENTRY *mpglVertex2f)(GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
272 extern void (GLAPIENTRY *mpglVertex3f)(GLfloat, GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
273 extern void (GLAPIENTRY *mpglNormal3f)(GLfloat, GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
274 extern void (GLAPIENTRY *mpglLightfv)(GLenum, GLenum, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
275 extern void (GLAPIENTRY *mpglColorMaterial)(GLenum, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
276 extern void (GLAPIENTRY *mpglShadeModel)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
277 extern void (GLAPIENTRY *mpglGetIntegerv)(GLenum, GLint *); |
31567 | 278 extern void (GLAPIENTRY *mpglColorMask)(GLboolean, GLboolean, GLboolean, GLboolean); |
29939
319b62d55feb
Pass all OpenGL functions through a function pointer indirection.
reimar
parents:
29938
diff
changeset
|
279 |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
280 extern void (GLAPIENTRY *mpglGenBuffers)(GLsizei, GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
281 extern void (GLAPIENTRY *mpglDeleteBuffers)(GLsizei, const GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
282 extern void (GLAPIENTRY *mpglBindBuffer)(GLenum, GLuint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
283 extern GLvoid* (GLAPIENTRY *mpglMapBuffer)(GLenum, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
284 extern GLboolean (GLAPIENTRY *mpglUnmapBuffer)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
285 extern void (GLAPIENTRY *mpglBufferData)(GLenum, intptr_t, const GLvoid *, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
286 extern void (GLAPIENTRY *mpglCombinerParameterfv)(GLenum, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
287 extern void (GLAPIENTRY *mpglCombinerParameteri)(GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
288 extern void (GLAPIENTRY *mpglCombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum, |
16099 | 289 GLenum); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
290 extern void (GLAPIENTRY *mpglCombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum, |
16099 | 291 GLenum, GLenum, GLboolean, GLboolean, |
292 GLboolean); | |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
293 extern void (GLAPIENTRY *mpglBeginFragmentShader)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
294 extern void (GLAPIENTRY *mpglEndFragmentShader)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
295 extern void (GLAPIENTRY *mpglSampleMap)(GLuint, GLuint, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
296 extern void (GLAPIENTRY *mpglColorFragmentOp2)(GLenum, GLuint, GLuint, GLuint, GLuint, |
16625 | 297 GLuint, GLuint, GLuint, GLuint, GLuint); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
298 extern void (GLAPIENTRY *mpglColorFragmentOp3)(GLenum, GLuint, GLuint, GLuint, GLuint, |
16625 | 299 GLuint, GLuint, GLuint, GLuint, GLuint, |
300 GLuint, GLuint, GLuint); | |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
301 extern void (GLAPIENTRY *mpglSetFragmentShaderConstant)(GLuint, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
302 extern void (GLAPIENTRY *mpglActiveTexture)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
303 extern void (GLAPIENTRY *mpglBindTexture)(GLenum, GLuint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
304 extern void (GLAPIENTRY *mpglMultiTexCoord2f)(GLenum, GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
305 extern void (GLAPIENTRY *mpglGenPrograms)(GLsizei, GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
306 extern void (GLAPIENTRY *mpglDeletePrograms)(GLsizei, const GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
307 extern void (GLAPIENTRY *mpglBindProgram)(GLenum, GLuint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
308 extern void (GLAPIENTRY *mpglProgramString)(GLenum, GLenum, GLsizei, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
309 extern void (GLAPIENTRY *mpglProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat, |
16099 | 310 GLfloat, GLfloat); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
311 extern int (GLAPIENTRY *mpglSwapInterval)(int); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
312 extern void (GLAPIENTRY *mpglTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, |
18578 | 313 GLsizei, GLint, GLenum, GLenum, const GLvoid *); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
314 extern void* (GLAPIENTRY *mpglAllocateMemoryMESA)(void *, int, size_t, float, float, float); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
315 extern void (GLAPIENTRY *mpglFreeMemoryMESA)(void *, int, void *); |
16099 | 316 |
26029 | 317 #endif /* MPLAYER_GL_COMMON_H */ |