Skip to content

Commit eb969a8

Browse files
author
Allan Sandfeld Jensen
committed
[Revert] ui/gl: Remove WGL support on Windows
We still use it Change-Id: I4fbe6a55fcecdcd875c2a948170423d0c4380f5d Reviewed-by: Michal Klocek <[email protected]>
1 parent eb94d3a commit eb969a8

15 files changed

+1997
-1
lines changed

chromium/ui/gl/BUILD.gn

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,16 @@ jumbo_component("gl") {
331331
"direct_composition_surface_win.h",
332332
"gl_angle_util_win.cc",
333333
"gl_angle_util_win.h",
334+
"gl_bindings_autogen_wgl.cc",
335+
"gl_bindings_autogen_wgl.h",
336+
"gl_context_wgl.cc",
337+
"gl_context_wgl.h",
334338
"gl_fence_win.cc",
335339
"gl_fence_win.h",
340+
"gl_surface_wgl.cc",
341+
"gl_surface_wgl.h",
342+
"gl_wgl_api_implementation.cc",
343+
"gl_wgl_api_implementation.h",
336344
"hdr_metadata_helper_win.cc",
337345
"hdr_metadata_helper_win.h",
338346
"swap_chain_presenter.cc",
@@ -599,6 +607,7 @@ test("gl_unittests") {
599607
"direct_composition_surface_win_unittest.cc",
600608
"gl_fence_win_unittest.cc",
601609
"hdr_metadata_helper_win_unittest.cc",
610+
"wgl_api_unittest.cc",
602611
]
603612
}
604613

chromium/ui/gl/generate_bindings.py

Lines changed: 231 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
]
2323

2424
UNCONDITIONALLY_BOUND_EXTENSIONS = set([
25+
'WGL_ARB_extensions_string',
26+
'WGL_EXT_extensions_string',
2527
'GL_CHROMIUM_gles_depth_binding_hack', # crbug.com/448206
2628
'GL_CHROMIUM_glgetstringi_hack', # crbug.com/470396
2729
'GL_CHROMIUM_egl_khr_fence_sync_hack', # crbug.com/504758
@@ -2963,6 +2965,232 @@
29632965
'EGL_NOK_texture_from_pixmap',
29642966
]
29652967

2968+
WGL_FUNCTIONS = [
2969+
{ 'return_type': 'BOOL',
2970+
'names': ['wglChoosePixelFormatARB'],
2971+
'arguments':
2972+
'HDC dc, const int* int_attrib_list, const float* float_attrib_list, '
2973+
'UINT max_formats, int* formats, UINT* num_formats', },
2974+
{ 'return_type': 'BOOL',
2975+
'names': ['wglCopyContext'],
2976+
'arguments': 'HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask', },
2977+
{ 'return_type': 'HGLRC',
2978+
'names': ['wglCreateContext'],
2979+
'arguments': 'HDC hdc', },
2980+
{ 'return_type': 'HGLRC',
2981+
'names': ['wglCreateContextAttribsARB'],
2982+
'arguments': 'HDC hDC, HGLRC hShareContext, const int* attribList', },
2983+
{ 'return_type': 'HGLRC',
2984+
'names': ['wglCreateLayerContext'],
2985+
'arguments': 'HDC hdc, int iLayerPlane', },
2986+
{ 'return_type': 'HPBUFFERARB',
2987+
'names': ['wglCreatePbufferARB'],
2988+
'arguments': 'HDC hDC, int iPixelFormat, int iWidth, int iHeight, '
2989+
'const int* piAttribList', },
2990+
{ 'return_type': 'BOOL',
2991+
'names': ['wglDeleteContext'],
2992+
'arguments': 'HGLRC hglrc', },
2993+
{ 'return_type': 'BOOL',
2994+
'names': ['wglDestroyPbufferARB'],
2995+
'arguments': 'HPBUFFERARB hPbuffer', },
2996+
{ 'return_type': 'HGLRC',
2997+
'names': ['wglGetCurrentContext'],
2998+
'arguments': '', },
2999+
{ 'return_type': 'HDC',
3000+
'names': ['wglGetCurrentDC'],
3001+
'arguments': '', },
3002+
{ 'return_type': 'const char*',
3003+
'names': ['wglGetExtensionsStringARB'],
3004+
'arguments': 'HDC hDC', },
3005+
{ 'return_type': 'const char*',
3006+
'names': ['wglGetExtensionsStringEXT'],
3007+
'arguments': '', },
3008+
{ 'return_type': 'HDC',
3009+
'names': ['wglGetPbufferDCARB'],
3010+
'arguments': 'HPBUFFERARB hPbuffer', },
3011+
{ 'return_type': 'BOOL',
3012+
'names': ['wglMakeCurrent'],
3013+
'arguments': 'HDC hdc, HGLRC hglrc', },
3014+
{ 'return_type': 'BOOL',
3015+
'names': ['wglQueryPbufferARB'],
3016+
'arguments': 'HPBUFFERARB hPbuffer, int iAttribute, int* piValue', },
3017+
{ 'return_type': 'int',
3018+
'names': ['wglReleasePbufferDCARB'],
3019+
'arguments': 'HPBUFFERARB hPbuffer, HDC hDC', },
3020+
{ 'return_type': 'BOOL',
3021+
'names': ['wglShareLists'],
3022+
'arguments': 'HGLRC hglrc1, HGLRC hglrc2', },
3023+
{ 'return_type': 'BOOL',
3024+
'names': ['wglSwapIntervalEXT'],
3025+
'arguments': 'int interval', },
3026+
{ 'return_type': 'BOOL',
3027+
'names': ['wglSwapLayerBuffers'],
3028+
'arguments': 'HDC hdc, UINT fuPlanes', },
3029+
]
3030+
3031+
GLX_FUNCTIONS = [
3032+
{ 'return_type': 'void',
3033+
'names': ['glXBindTexImageEXT'],
3034+
'arguments':
3035+
'Display* dpy, GLXDrawable drawable, int buffer, int* attribList', },
3036+
{ 'return_type': 'GLXFBConfig*',
3037+
'names': ['glXChooseFBConfig'],
3038+
'arguments':
3039+
'Display* dpy, int screen, const int* attribList, int* nitems', },
3040+
{ 'return_type': 'XVisualInfo*',
3041+
'names': ['glXChooseVisual'],
3042+
'arguments': 'Display* dpy, int screen, int* attribList', },
3043+
{ 'return_type': 'void',
3044+
'names': ['glXCopyContext'],
3045+
'arguments':
3046+
'Display* dpy, GLXContext src, GLXContext dst, unsigned long mask', },
3047+
{ 'return_type': 'void',
3048+
'names': ['glXCopySubBufferMESA'],
3049+
'arguments': 'Display* dpy, GLXDrawable drawable, '
3050+
'int x, int y, int width, int height', },
3051+
{ 'return_type': 'GLXContext',
3052+
'names': ['glXCreateContext'],
3053+
'arguments':
3054+
'Display* dpy, XVisualInfo* vis, GLXContext shareList, int direct', },
3055+
{ 'return_type': 'GLXContext',
3056+
'names': ['glXCreateContextAttribsARB'],
3057+
'arguments':
3058+
'Display* dpy, GLXFBConfig config, GLXContext share_context, int direct, '
3059+
'const int* attrib_list', },
3060+
{ 'return_type': 'GLXPixmap',
3061+
'names': ['glXCreateGLXPixmap'],
3062+
'arguments': 'Display* dpy, XVisualInfo* visual, Pixmap pixmap', },
3063+
{ 'return_type': 'GLXContext',
3064+
'names': ['glXCreateNewContext'],
3065+
'arguments': 'Display* dpy, GLXFBConfig config, int renderType, '
3066+
'GLXContext shareList, int direct', },
3067+
{ 'return_type': 'GLXPbuffer',
3068+
'names': ['glXCreatePbuffer'],
3069+
'arguments': 'Display* dpy, GLXFBConfig config, const int* attribList', },
3070+
{ 'return_type': 'GLXPixmap',
3071+
'names': ['glXCreatePixmap'],
3072+
'arguments': 'Display* dpy, GLXFBConfig config, '
3073+
'Pixmap pixmap, const int* attribList', },
3074+
{ 'return_type': 'GLXWindow',
3075+
'names': ['glXCreateWindow'],
3076+
'arguments':
3077+
'Display* dpy, GLXFBConfig config, Window win, const int* attribList', },
3078+
{ 'return_type': 'void',
3079+
'names': ['glXDestroyContext'],
3080+
'arguments': 'Display* dpy, GLXContext ctx', },
3081+
{ 'return_type': 'void',
3082+
'names': ['glXDestroyGLXPixmap'],
3083+
'arguments': 'Display* dpy, GLXPixmap pixmap', },
3084+
{ 'return_type': 'void',
3085+
'names': ['glXDestroyPbuffer'],
3086+
'arguments': 'Display* dpy, GLXPbuffer pbuf', },
3087+
{ 'return_type': 'void',
3088+
'names': ['glXDestroyPixmap'],
3089+
'arguments': 'Display* dpy, GLXPixmap pixmap', },
3090+
{ 'return_type': 'void',
3091+
'names': ['glXDestroyWindow'],
3092+
'arguments': 'Display* dpy, GLXWindow window', },
3093+
{ 'return_type': 'const char*',
3094+
'names': ['glXGetClientString'],
3095+
'arguments': 'Display* dpy, int name', },
3096+
{ 'return_type': 'int',
3097+
'names': ['glXGetConfig'],
3098+
'arguments': 'Display* dpy, XVisualInfo* visual, int attrib, int* value', },
3099+
{ 'return_type': 'GLXContext',
3100+
'names': ['glXGetCurrentContext'],
3101+
'arguments': 'void', },
3102+
{ 'return_type': 'Display*',
3103+
'names': ['glXGetCurrentDisplay'],
3104+
'arguments': 'void', },
3105+
{ 'return_type': 'GLXDrawable',
3106+
'names': ['glXGetCurrentDrawable'],
3107+
'arguments': 'void', },
3108+
{ 'return_type': 'GLXDrawable',
3109+
'names': ['glXGetCurrentReadDrawable'],
3110+
'arguments': 'void', },
3111+
{ 'return_type': 'int',
3112+
'names': ['glXGetFBConfigAttrib'],
3113+
'arguments': 'Display* dpy, GLXFBConfig config, int attribute, int* value', },
3114+
{ 'return_type': 'GLXFBConfig',
3115+
'names': ['glXGetFBConfigFromVisualSGIX'],
3116+
'arguments': 'Display* dpy, XVisualInfo* visualInfo', },
3117+
{ 'return_type': 'GLXFBConfig*',
3118+
'names': ['glXGetFBConfigs'],
3119+
'arguments': 'Display* dpy, int screen, int* nelements', },
3120+
{ 'return_type': 'bool',
3121+
'names': ['glXGetMscRateOML'],
3122+
'arguments':
3123+
'Display* dpy, GLXDrawable drawable, int32_t* numerator, '
3124+
'int32_t* denominator' },
3125+
{ 'return_type': 'void',
3126+
'names': ['glXGetSelectedEvent'],
3127+
'arguments': 'Display* dpy, GLXDrawable drawable, unsigned long* mask', },
3128+
{ 'return_type': 'bool',
3129+
'names': ['glXGetSyncValuesOML'],
3130+
'arguments':
3131+
'Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, '
3132+
'int64_t* sbc' },
3133+
{ 'return_type': 'XVisualInfo*',
3134+
'names': ['glXGetVisualFromFBConfig'],
3135+
'arguments': 'Display* dpy, GLXFBConfig config', },
3136+
{ 'return_type': 'int',
3137+
'names': ['glXIsDirect'],
3138+
'arguments': 'Display* dpy, GLXContext ctx', },
3139+
{ 'return_type': 'int',
3140+
'names': ['glXMakeContextCurrent'],
3141+
'arguments':
3142+
'Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx', },
3143+
{ 'return_type': 'int',
3144+
'names': ['glXMakeCurrent'],
3145+
'arguments': 'Display* dpy, GLXDrawable drawable, GLXContext ctx', },
3146+
{ 'return_type': 'int',
3147+
'names': ['glXQueryContext'],
3148+
'arguments': 'Display* dpy, GLXContext ctx, int attribute, int* value', },
3149+
{ 'return_type': 'void',
3150+
'names': ['glXQueryDrawable'],
3151+
'arguments':
3152+
'Display* dpy, GLXDrawable draw, int attribute, unsigned int* value', },
3153+
{ 'return_type': 'int',
3154+
'names': ['glXQueryExtension'],
3155+
'arguments': 'Display* dpy, int* errorb, int* event', },
3156+
{ 'return_type': 'const char*',
3157+
'names': ['glXQueryExtensionsString'],
3158+
'arguments': 'Display* dpy, int screen', },
3159+
{ 'return_type': 'const char*',
3160+
'names': ['glXQueryServerString'],
3161+
'arguments': 'Display* dpy, int screen, int name', },
3162+
{ 'return_type': 'int',
3163+
'names': ['glXQueryVersion'],
3164+
'arguments': 'Display* dpy, int* maj, int* min', },
3165+
{ 'return_type': 'void',
3166+
'names': ['glXReleaseTexImageEXT'],
3167+
'arguments': 'Display* dpy, GLXDrawable drawable, int buffer', },
3168+
{ 'return_type': 'void',
3169+
'names': ['glXSelectEvent'],
3170+
'arguments': 'Display* dpy, GLXDrawable drawable, unsigned long mask', },
3171+
{ 'return_type': 'void',
3172+
'names': ['glXSwapBuffers'],
3173+
'arguments': 'Display* dpy, GLXDrawable drawable', },
3174+
{ 'return_type': 'void',
3175+
'names': ['glXSwapIntervalEXT'],
3176+
'arguments': 'Display* dpy, GLXDrawable drawable, int interval', },
3177+
{ 'return_type': 'void',
3178+
'names': ['glXSwapIntervalMESA'],
3179+
'arguments': 'unsigned int interval', },
3180+
{ 'return_type': 'void',
3181+
'names': ['glXUseXFont'],
3182+
'arguments': 'Font font, int first, int count, int list', },
3183+
{ 'return_type': 'void',
3184+
'names': ['glXWaitGL'],
3185+
'arguments': 'void', },
3186+
{ 'return_type': 'int',
3187+
'names': ['glXWaitVideoSyncSGI'],
3188+
'arguments': 'int divisor, int remainder, unsigned int* count', },
3189+
{ 'return_type': 'void',
3190+
'names': ['glXWaitX'],
3191+
'arguments': 'void', },
3192+
]
3193+
29663194
FUNCTION_SETS = [
29673195
[GL_FUNCTIONS, 'gl', [
29683196
'GL/gl.h',
@@ -2993,6 +3221,8 @@
29933221
'EGL_ANGLE_surface_d3d_texture_2d_share_handle',
29943222
],
29953223
],
3224+
[WGL_FUNCTIONS, 'wgl', ['noninclude/GL/wglext.h'], []],
3225+
[GLX_FUNCTIONS, 'glx', ['GL/glx.h', 'noninclude/GL/glxext.h'], []],
29963226
]
29973227

29983228
GLES2_HEADERS_WITH_ENUMS = [
@@ -3830,7 +4060,7 @@ def ParseFunctionsFromHeader(header_file, extensions, versions):
38304060
version_start = re.compile(
38314061
r'#ifndef GL_(ES_|)VERSION((?:_[0-9])+)$')
38324062
extension_start = re.compile(
3833-
r'#ifndef ((?:GL|EGL)_[A-Z]+_[a-zA-Z]\w+)')
4063+
r'#ifndef ((?:GL|EGL|WGL|GLX)_[A-Z]+_[a-zA-Z]\w+)')
38344064
extension_function = re.compile(r'.+\s+([a-z]+\w+)\s*\(')
38354065
typedef = re.compile(r'typedef .*')
38364066
macro_start = re.compile(r'^#(if|ifdef|ifndef).*')

chromium/ui/gl/gl_bindings.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,27 @@
1515
#include "ui/gfx/x/glx.h"
1616
#endif
1717

18+
#if defined(OS_WIN)
19+
#include "ui/gl/gl_surface_wgl.h"
20+
#endif
21+
1822
#if defined(USE_EGL)
1923
#include "ui/gl/gl_display.h"
2024
#include "ui/gl/gl_surface_egl.h"
2125
#endif
2226

2327
namespace gl {
2428

29+
#if defined(OS_WIN)
30+
std::string DriverWGL::GetPlatformExtensions() {
31+
const char* str = nullptr;
32+
str = wglGetExtensionsStringARB(GLSurfaceWGL::GetDisplayDC());
33+
if (str)
34+
return str;
35+
return wglGetExtensionsStringEXT();
36+
}
37+
#endif
38+
2539
#if defined(USE_EGL)
2640
void DisplayExtensionsEGL::UpdateConditionalExtensionSettings(
2741
EGLDisplay display) {

chromium/ui/gl/gl_bindings.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,10 @@ typedef uint64_t EGLuint64CHROMIUM;
505505
#include "gl_bindings_autogen_egl.h"
506506
#endif
507507

508+
#if defined(OS_WIN)
509+
#include "gl_bindings_autogen_wgl.h"
510+
#endif
511+
508512
#if defined(USE_GLX)
509513
#include "gl_bindings_autogen_glx.h"
510514
#endif
@@ -534,6 +538,20 @@ struct GL_EXPORT CurrentGL {
534538
raw_ptr<const GLVersionInfo, AcrossTasksDanglingUntriaged> Version = nullptr;
535539
};
536540

541+
#if defined(OS_WIN)
542+
struct GL_EXPORT DriverWGL {
543+
void InitializeStaticBindings();
544+
void InitializeExtensionBindings();
545+
void ClearBindings();
546+
547+
ProcsWGL fn;
548+
ExtensionsWGL ext;
549+
550+
private:
551+
static std::string GetPlatformExtensions();
552+
};
553+
#endif
554+
537555
#if defined(USE_EGL)
538556
struct GL_EXPORT DriverEGL {
539557
void InitializeStaticBindings();
@@ -574,6 +592,11 @@ GL_EXPORT extern EGLApi* g_current_egl_context;
574592
GL_EXPORT extern DriverEGL g_driver_egl;
575593
#endif
576594

595+
#if defined(OS_WIN)
596+
GL_EXPORT extern WGLApi* g_current_wgl_context;
597+
GL_EXPORT extern DriverWGL g_driver_wgl;
598+
#endif
599+
577600
#if defined(USE_GLX)
578601
GL_EXPORT extern GLXApi* g_current_glx_context;
579602
GL_EXPORT extern DriverGLX g_driver_glx;

0 commit comments

Comments
 (0)