Mercurial > mplayer.hg
annotate libvo/gl_common.h @ 36875:50687cb6d3be
Revise MSGTR_GUI_MSG_SkinErrorMessage.
author | ib |
---|---|
date | Tue, 04 Mar 2014 12:57:05 +0000 |
parents | 44334c832149 |
children |
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> |
36693
44334c832149
add missing include of stddef.h, as it's needed to use "ptrdiff_t"
gpoirier
parents:
36678
diff
changeset
|
29 #include <stddef.h> |
26162
0585db9f5b32
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
30 |
26203 | 31 #include "config.h" |
13843 | 32 #include "video_out.h" |
30108
0898adc64a6f
Extract functions to generate yuv->rgb matrices and lookup tables into a
reimar
parents:
30107
diff
changeset
|
33 #include "csputils.h" |
13843 | 34 |
30023 | 35 #ifdef CONFIG_GL_WIN32 |
14142
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
14078
diff
changeset
|
36 #include <windows.h> |
f0c1ee83b216
Improving gl2 under windows, moving some functionality to gl_common
reimar
parents:
14078
diff
changeset
|
37 #include "w32_common.h" |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
38 #endif |
30023 | 39 #ifdef CONFIG_GL_X11 |
13843 | 40 #include <X11/Xlib.h> |
41 #include <GL/glx.h> | |
42 #include "x11_common.h" | |
43 #endif | |
34338 | 44 #ifdef CONFIG_GL_EGL_X11 |
45 #include <EGL/egl.h> | |
46 #include "x11_common.h" | |
47 #endif | |
35089
a87c434ecaa3
Allow compiling -vo gl with OSX backend even if X11 and SDL are not available.
reimar
parents:
35087
diff
changeset
|
48 #ifdef CONFIG_GL_OSX |
35087 | 49 #include "osx_common.h" |
35811 | 50 #include <OpenGL/gl.h> |
35889 | 51 #elif defined(CONFIG_GL_EGL_ANDROID) |
52 #include <EGL/egl.h> | |
53 #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
|
54 #else |
a87c434ecaa3
Allow compiling -vo gl with OSX backend even if X11 and SDL are not available.
reimar
parents:
35087
diff
changeset
|
55 #include <GL/gl.h> |
35087 | 56 #endif |
13653
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
57 |
35886
4921bccc0968
Split out defines for compatibility between different GL headers.
reimar
parents:
35811
diff
changeset
|
58 #include "gl_compat.h" |
16099 | 59 |
13653
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
60 void glAdjustAlignment(int stride); |
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
61 |
14078
c4033dcb986f
More similar code from gl and gl2 moved to gl_common
reimar
parents:
13921
diff
changeset
|
62 const char *glValName(GLint value); |
c4033dcb986f
More similar code from gl and gl2 moved to gl_common
reimar
parents:
13921
diff
changeset
|
63 |
16879
6ea220b10e8e
More consistent and sane types. Also avoids some gcc 4 warnings.
reimar
parents:
16625
diff
changeset
|
64 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
|
65 GLenum *gl_format, GLenum *gl_type); |
16117 | 66 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
|
67 void glCreateClearTex(GLenum target, GLenum fmt, GLenum format, GLenum type, GLint filter, |
16460 | 68 int w, int h, unsigned char val); |
16592 | 69 int glCreatePPMTex(GLenum target, GLenum fmt, GLint filter, |
70 FILE *f, int *width, int *height, int *maxval); | |
16117 | 71 void glUploadTex(GLenum target, GLenum format, GLenum type, |
21201 | 72 const void *dataptr, int stride, |
16117 | 73 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
|
74 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
|
75 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
|
76 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
|
77 int use_stipple); |
18653
5af43a16abc3
loadGPUProgram function to load fragment program with error checking and statistics
reimar
parents:
18622
diff
changeset
|
78 int loadGPUProgram(GLenum target, char *prog); |
16488
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
79 |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
80 /** \addtogroup glconversion |
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
81 * \{ */ |
16488
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
82 //! 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
|
83 #define YUV_CONVERSION_NONE 0 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
84 //! use nVidia specific register combiners for YUV conversion |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
85 #define YUV_CONVERSION_COMBINERS 1 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
86 //! use a fragment program for YUV conversion |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
87 #define YUV_CONVERSION_FRAGMENT 2 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
88 //! 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
|
89 #define YUV_CONVERSION_FRAGMENT_POW 3 |
3191dcb27a12
hardware color-space conversion for vo_gl and vo_gl2
reimar
parents:
16460
diff
changeset
|
90 //! 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
|
91 #define YUV_CONVERSION_FRAGMENT_LOOKUP 4 |
16625 | 92 //! use ATI specific register combiners ("fragment program") |
93 #define YUV_CONVERSION_COMBINERS_ATI 5 | |
18655
6aa0b26d584b
Add yuv to rgb conversion using a 3D lookup texture
reimar
parents:
18653
diff
changeset
|
94 //! 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
|
95 #define YUV_CONVERSION_FRAGMENT_LOOKUP3D 6 |
30951
e76a4f6bfc8d
Implement OpenGL-based YUV to RGB version for Radeon 9200 class
reimar
parents:
30945
diff
changeset
|
96 //! 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
|
97 #define YUV_CONVERSION_TEXT_FRAGMENT 7 |
36126 | 98 #define YUV_CONVERSION_SL_PROGRAM 8 |
18619
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
99 //! use normal bilinear scaling for textures |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
100 #define YUV_SCALER_BILIN 0 |
18622 | 101 //! use higher quality bicubic scaling for textures |
102 #define YUV_SCALER_BICUB 1 | |
22491 | 103 //! use cubic scaling in X and normal linear scaling in Y direction |
104 #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
|
105 //! 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
|
106 #define YUV_SCALER_BICUB_NOTEX 3 |
25729
9a96fd14d1c5
Add experimental unsharp-mask OpenGL scaler. Certainly not yet perfect.
reimar
parents:
25535
diff
changeset
|
107 #define YUV_SCALER_UNSHARP 4 |
25758 | 108 #define YUV_SCALER_UNSHARP2 5 |
18619
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
109 //! mask for conversion type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
110 #define YUV_CONVERSION_MASK 0xF |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
111 //! mask for scaler type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
112 #define YUV_SCALER_MASK 0xF |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
113 //! shift value for luminance scaler type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
114 #define YUV_LUM_SCALER_SHIFT 8 |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
115 //! shift value for chrominance scaler type |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
116 #define YUV_CHROM_SCALER_SHIFT 12 |
106a0c366002
Reworked YUV2RGB fragment program setup in preparation for upcoming patches
reimar
parents:
18578
diff
changeset
|
117 //! extract conversion out of type |
31675 | 118 #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
|
119 //! extract luminance scaler out of type |
31675 | 120 #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
|
121 //! extract chrominance scaler out of type |
31675 | 122 #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
|
123 #define SET_YUV_CONVERSION(c) ((c) & YUV_CONVERSION_MASK) |
a0a48c62bb8c
Helper macros to build the yuv conversion type number.
reimar
parents:
31675
diff
changeset
|
124 #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
|
125 #define SET_YUV_CHROM_SCALER(s) (((s) & YUV_SCALER_MASK) << YUV_CHROM_SCALER_SHIFT) |
33414 | 126 //! returns whether the yuv conversion supports large brightness range etc. |
127 static inline int glYUVLargeRange(int conv) | |
128 { | |
129 switch (conv) | |
130 { | |
131 case YUV_CONVERSION_NONE: | |
132 case YUV_CONVERSION_COMBINERS: | |
133 case YUV_CONVERSION_COMBINERS_ATI: | |
134 case YUV_CONVERSION_FRAGMENT_LOOKUP3D: | |
135 case YUV_CONVERSION_TEXT_FRAGMENT: | |
136 return 0; | |
137 } | |
138 return 1; | |
139 } | |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
140 |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
141 static inline int glYUVSupportsAlphaTex(int conv) |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
142 { |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
143 switch (conv) |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
144 { |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
145 case YUV_CONVERSION_COMBINERS: |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
146 case YUV_CONVERSION_COMBINERS_ATI: |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
147 case YUV_CONVERSION_TEXT_FRAGMENT: |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
148 return 0; |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
149 } |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
150 return 1; |
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
151 } |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
152 /** \} */ |
30107
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
153 |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
154 typedef struct { |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
155 GLenum target; |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
156 int type; |
11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
reimar
parents:
30097
diff
changeset
|
157 struct mp_csp_params csp_params; |
26835 | 158 int texw; |
159 int texh; | |
30097 | 160 int chrom_texw; |
161 int chrom_texh; | |
36111 | 162 int is_planar; |
26836
ba086caf1230
Add a filter strength parameter for blurring/sharpening scalers.
reimar
parents:
26835
diff
changeset
|
163 float filter_strength; |
33927 | 164 float noise_strength; |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
165 int has_alpha_tex; |
26835 | 166 } gl_conversion_params_t; |
167 | |
30964
a5c6b37b3af6
Factor out the YUV->RGB conversion auto-selection and also
reimar
parents:
30951
diff
changeset
|
168 int glAutodetectYUVConversion(void); |
26835 | 169 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
|
170 void glEnableYUVConversion(GLenum target, int type); |
01ca8a5fb8a6
minor fixes: get rid of pointless inline attributes and some additional checks
reimar
parents:
17688
diff
changeset
|
171 void glDisableYUVConversion(GLenum target, int type); |
14078
c4033dcb986f
More similar code from gl and gl2 moved to gl_common
reimar
parents:
13921
diff
changeset
|
172 |
34375 | 173 #define GL_3D_SWAP 32 |
31567 | 174 #define GL_3D_RED_CYAN 1 |
175 #define GL_3D_GREEN_MAGENTA 2 | |
176 #define GL_3D_QUADBUFFER 3 | |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
177 #define GL_3D_STIPPLE 4 |
31567 | 178 |
34983
0034a2bf7b42
Support interleaving the two frame halves from a 3D video
reimar
parents:
34973
diff
changeset
|
179 void glSetupAlphaStippleTex(unsigned pattern); |
31567 | 180 void glEnable3DLeft(int type); |
181 void glEnable3DRight(int type); | |
182 void glDisable3D(int type); | |
183 | |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
184 /** \addtogroup glcontext |
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
185 * \{ */ |
13843 | 186 //! could not set new window, will continue drawing into the old one. |
187 #define SET_WINDOW_FAILED -1 | |
188 //! new window is set, could even transfer the OpenGL context. | |
189 #define SET_WINDOW_OK 0 | |
190 //! new window is set, but the OpenGL context needs to be reinitialized. | |
191 #define SET_WINDOW_REINIT 1 | |
16595
b3a9fb41f475
fix/improve code doxumentation. Also group gl_common functions in several
reimar
parents:
16592
diff
changeset
|
192 /** \} */ |
13843 | 193 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
194 enum MPGLType { |
34350
27dead7f2593
Add a suboption to allow forcing use of e.g. OpenGL ES to -vo gl.
reimar
parents:
34338
diff
changeset
|
195 GLTYPE_AUTO = -1, |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
196 GLTYPE_W32, |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
197 GLTYPE_X11, |
31020
529614f44431
First steps to support -vo gl with SDL-based Window handling.
reimar
parents:
30985
diff
changeset
|
198 GLTYPE_SDL, |
34338 | 199 GLTYPE_EGL_X11, |
35087 | 200 GLTYPE_OSX, |
35889 | 201 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
|
202 GLTYPE_COUNT |
29938
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 |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
205 typedef struct MPGLContext { |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
206 enum MPGLType type; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
207 union { |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
208 int w32; |
30023 | 209 #ifdef CONFIG_GL_X11 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
210 XVisualInfo *x11; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
211 #endif |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
212 } vinfo; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
213 union { |
30023 | 214 #ifdef CONFIG_GL_WIN32 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
215 HGLRC w32; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
216 #endif |
30023 | 217 #ifdef CONFIG_GL_X11 |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
218 GLXContext x11; |
13653
799f81d3cb19
added gl_common for code used by both vo_gl.c and vo_gl2.c.
reimar
parents:
diff
changeset
|
219 #endif |
35889 | 220 #if defined(CONFIG_GL_EGL_X11) || defined(CONFIG_GL_EGL_ANDROID) |
34338 | 221 EGLContext egl; |
222 #endif | |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
223 } context; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
224 int (*setGlWindow)(struct MPGLContext *); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
225 void (*releaseGlContext)(struct MPGLContext *); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
226 void (*swapGlBuffers)(struct MPGLContext *); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
227 void (*update_xinerama_info)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
228 void (*border)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
229 int (*check_events)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
230 void (*fullscreen)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
231 void (*ontop)(void); |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
232 } MPGLContext; |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
233 |
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
234 int init_mpglcontext(MPGLContext *ctx, enum MPGLType type); |
36219 | 235 int mpglcontext_create_window(MPGLContext *ctx, uint32_t d_width, uint32_t d_height, uint32_t flags, const char *title); |
29938
eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
reimar
parents:
29263
diff
changeset
|
236 void uninit_mpglcontext(MPGLContext *ctx); |
13843 | 237 |
34841 | 238 extern GLenum (GLAPIENTRY *mpglGetError)(void); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
239 extern void (GLAPIENTRY *mpglBegin)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
240 extern void (GLAPIENTRY *mpglEnd)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
241 extern void (GLAPIENTRY *mpglViewport)(GLint, GLint, GLsizei, GLsizei); |
36126 | 242 extern void (GLAPIENTRY *mpglLoadMatrixf)(const float *); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
243 extern void (GLAPIENTRY *mpglClear)(GLbitfield); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
244 extern GLuint (GLAPIENTRY *mpglGenLists)(GLsizei); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
245 extern void (GLAPIENTRY *mpglDeleteLists)(GLuint, GLsizei); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
246 extern void (GLAPIENTRY *mpglNewList)(GLuint, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
247 extern void (GLAPIENTRY *mpglEndList)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
248 extern void (GLAPIENTRY *mpglCallList)(GLuint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
249 extern void (GLAPIENTRY *mpglCallLists)(GLsizei, GLenum, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
250 extern void (GLAPIENTRY *mpglGenTextures)(GLsizei, GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
251 extern void (GLAPIENTRY *mpglDeleteTextures)(GLsizei, const GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
252 extern void (GLAPIENTRY *mpglTexEnvi)(GLenum, GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
253 extern void (GLAPIENTRY *mpglColor4ub)(GLubyte, GLubyte, GLubyte, GLubyte); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
254 extern void (GLAPIENTRY *mpglClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); |
35890 | 255 extern void (GLAPIENTRY *mpglClearDepth)(double); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
256 extern void (GLAPIENTRY *mpglDepthFunc)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
257 extern void (GLAPIENTRY *mpglEnable)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
258 extern void (GLAPIENTRY *mpglDisable)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
259 extern const GLubyte *(GLAPIENTRY *mpglGetString)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
260 extern void (GLAPIENTRY *mpglDrawBuffer)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
261 extern void (GLAPIENTRY *mpglDepthMask)(GLboolean); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
262 extern void (GLAPIENTRY *mpglBlendFunc)(GLenum, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
263 extern void (GLAPIENTRY *mpglFlush)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
264 extern void (GLAPIENTRY *mpglFinish)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
265 extern void (GLAPIENTRY *mpglPixelStorei)(GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
266 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
|
267 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
|
268 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
|
269 extern void (GLAPIENTRY *mpglTexParameteri)(GLenum, GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
270 extern void (GLAPIENTRY *mpglTexParameterf)(GLenum, GLenum, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
271 extern void (GLAPIENTRY *mpglTexParameterfv)(GLenum, GLenum, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
272 extern void (GLAPIENTRY *mpglTexCoord2f)(GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
273 extern void (GLAPIENTRY *mpglVertex2f)(GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
274 extern void (GLAPIENTRY *mpglVertex3f)(GLfloat, GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
275 extern void (GLAPIENTRY *mpglNormal3f)(GLfloat, GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
276 extern void (GLAPIENTRY *mpglLightfv)(GLenum, GLenum, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
277 extern void (GLAPIENTRY *mpglColorMaterial)(GLenum, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
278 extern void (GLAPIENTRY *mpglShadeModel)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
279 extern void (GLAPIENTRY *mpglGetIntegerv)(GLenum, GLint *); |
31567 | 280 extern void (GLAPIENTRY *mpglColorMask)(GLboolean, GLboolean, GLboolean, GLboolean); |
29939
319b62d55feb
Pass all OpenGL functions through a function pointer indirection.
reimar
parents:
29938
diff
changeset
|
281 |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
282 extern void (GLAPIENTRY *mpglGenBuffers)(GLsizei, GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
283 extern void (GLAPIENTRY *mpglDeleteBuffers)(GLsizei, const GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
284 extern void (GLAPIENTRY *mpglBindBuffer)(GLenum, GLuint); |
36678 | 285 extern GLvoid* (GLAPIENTRY *mpglMapBufferRange)(GLenum, ptrdiff_t, ptrdiff_t, unsigned); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
286 extern GLboolean (GLAPIENTRY *mpglUnmapBuffer)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
287 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
|
288 extern void (GLAPIENTRY *mpglCombinerParameterfv)(GLenum, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
289 extern void (GLAPIENTRY *mpglCombinerParameteri)(GLenum, GLint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
290 extern void (GLAPIENTRY *mpglCombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum, |
16099 | 291 GLenum); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
292 extern void (GLAPIENTRY *mpglCombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum, |
16099 | 293 GLenum, GLenum, GLboolean, GLboolean, |
294 GLboolean); | |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
295 extern void (GLAPIENTRY *mpglBeginFragmentShader)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
296 extern void (GLAPIENTRY *mpglEndFragmentShader)(void); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
297 extern void (GLAPIENTRY *mpglSampleMap)(GLuint, GLuint, GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
298 extern void (GLAPIENTRY *mpglColorFragmentOp2)(GLenum, GLuint, GLuint, GLuint, GLuint, |
16625 | 299 GLuint, GLuint, GLuint, GLuint, GLuint); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
300 extern void (GLAPIENTRY *mpglColorFragmentOp3)(GLenum, GLuint, GLuint, GLuint, GLuint, |
16625 | 301 GLuint, GLuint, GLuint, GLuint, GLuint, |
302 GLuint, GLuint, GLuint); | |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
303 extern void (GLAPIENTRY *mpglSetFragmentShaderConstant)(GLuint, const GLfloat *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
304 extern void (GLAPIENTRY *mpglActiveTexture)(GLenum); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
305 extern void (GLAPIENTRY *mpglBindTexture)(GLenum, GLuint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
306 extern void (GLAPIENTRY *mpglMultiTexCoord2f)(GLenum, GLfloat, GLfloat); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
307 extern void (GLAPIENTRY *mpglGenPrograms)(GLsizei, GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
308 extern void (GLAPIENTRY *mpglDeletePrograms)(GLsizei, const GLuint *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
309 extern void (GLAPIENTRY *mpglBindProgram)(GLenum, GLuint); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
310 extern void (GLAPIENTRY *mpglProgramString)(GLenum, GLenum, GLsizei, const GLvoid *); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
311 extern void (GLAPIENTRY *mpglProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat, |
16099 | 312 GLfloat, GLfloat); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
313 extern int (GLAPIENTRY *mpglSwapInterval)(int); |
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
314 extern void (GLAPIENTRY *mpglTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, |
18578 | 315 GLsizei, GLint, GLenum, GLenum, const GLvoid *); |
30945
55917a674d7d
Add mpgl prefix to all OpenGL-related function pointers.
reimar
parents:
30137
diff
changeset
|
316 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
|
317 extern void (GLAPIENTRY *mpglFreeMemoryMESA)(void *, int, void *); |
16099 | 318 |
26029 | 319 #endif /* MPLAYER_GL_COMMON_H */ |