Skip to content

Commit 1df21e7

Browse files
committed
Revert "Fix WGL implementation"
This reverts commit 2082c24. Change-Id: I2ac5229172ed1e8695ca8df841762833e1f43a96 Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/595115 Reviewed-by: Allan Sandfeld Jensen <[email protected]>
1 parent 81b06b8 commit 1df21e7

11 files changed

+161
-265
lines changed

chromium/ui/gl/generate_bindings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
UNCONDITIONALLY_BOUND_EXTENSIONS = set([
2525
'WGL_ARB_extensions_string',
2626
'WGL_EXT_extensions_string',
27-
'WGL_ARB_pbuffer',
2827
'GL_CHROMIUM_gles_depth_binding_hack', # crbug.com/448206
2928
'GL_CHROMIUM_glgetstringi_hack', # crbug.com/470396
3029
'GL_CHROMIUM_egl_khr_fence_sync_hack', # crbug.com/504758

chromium/ui/gl/gl_bindings_autogen_wgl.cc

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ void DriverWGL::InitializeStaticBindings() {
3434
GetGLProcAddress("wglCreateContext"));
3535
fn.wglCreateLayerContextFn = reinterpret_cast<wglCreateLayerContextProc>(
3636
GetGLProcAddress("wglCreateLayerContext"));
37-
fn.wglCreatePbufferARBFn = reinterpret_cast<wglCreatePbufferARBProc>(
38-
GetGLProcAddress("wglCreatePbufferARB"));
3937
fn.wglDeleteContextFn = reinterpret_cast<wglDeleteContextProc>(
4038
GetGLProcAddress("wglDeleteContext"));
41-
fn.wglDestroyPbufferARBFn = reinterpret_cast<wglDestroyPbufferARBProc>(
42-
GetGLProcAddress("wglDestroyPbufferARB"));
4339
fn.wglGetCurrentContextFn = reinterpret_cast<wglGetCurrentContextProc>(
4440
GetGLProcAddress("wglGetCurrentContext"));
4541
fn.wglGetCurrentDCFn = reinterpret_cast<wglGetCurrentDCProc>(
@@ -50,14 +46,8 @@ void DriverWGL::InitializeStaticBindings() {
5046
fn.wglGetExtensionsStringEXTFn =
5147
reinterpret_cast<wglGetExtensionsStringEXTProc>(
5248
GetGLProcAddress("wglGetExtensionsStringEXT"));
53-
fn.wglGetPbufferDCARBFn = reinterpret_cast<wglGetPbufferDCARBProc>(
54-
GetGLProcAddress("wglGetPbufferDCARB"));
5549
fn.wglMakeCurrentFn =
5650
reinterpret_cast<wglMakeCurrentProc>(GetGLProcAddress("wglMakeCurrent"));
57-
fn.wglQueryPbufferARBFn = reinterpret_cast<wglQueryPbufferARBProc>(
58-
GetGLProcAddress("wglQueryPbufferARB"));
59-
fn.wglReleasePbufferDCARBFn = reinterpret_cast<wglReleasePbufferDCARBProc>(
60-
GetGLProcAddress("wglReleasePbufferDCARB"));
6151
fn.wglShareListsFn =
6252
reinterpret_cast<wglShareListsProc>(GetGLProcAddress("wglShareLists"));
6353
fn.wglSwapLayerBuffersFn = reinterpret_cast<wglSwapLayerBuffersProc>(
@@ -66,7 +56,8 @@ void DriverWGL::InitializeStaticBindings() {
6656

6757
void DriverWGL::InitializeExtensionBindings() {
6858
std::string platform_extensions(GetPlatformExtensions());
69-
[[maybe_unused]] gfx::ExtensionSet extensions(gfx::MakeExtensionSet(platform_extensions));
59+
gfx::ExtensionSet extensions(gfx::MakeExtensionSet(platform_extensions));
60+
ALLOW_UNUSED_LOCAL(extensions);
7061

7162
ext.b_WGL_ARB_create_context =
7263
gfx::HasExtension(extensions, "WGL_ARB_create_context");
@@ -92,6 +83,31 @@ void DriverWGL::InitializeExtensionBindings() {
9283
GetGLProcAddress("wglCreateContextAttribsARB"));
9384
}
9485

86+
if (ext.b_WGL_ARB_pbuffer) {
87+
fn.wglCreatePbufferARBFn = reinterpret_cast<wglCreatePbufferARBProc>(
88+
GetGLProcAddress("wglCreatePbufferARB"));
89+
}
90+
91+
if (ext.b_WGL_ARB_pbuffer) {
92+
fn.wglDestroyPbufferARBFn = reinterpret_cast<wglDestroyPbufferARBProc>(
93+
GetGLProcAddress("wglDestroyPbufferARB"));
94+
}
95+
96+
if (ext.b_WGL_ARB_pbuffer) {
97+
fn.wglGetPbufferDCARBFn = reinterpret_cast<wglGetPbufferDCARBProc>(
98+
GetGLProcAddress("wglGetPbufferDCARB"));
99+
}
100+
101+
if (ext.b_WGL_ARB_pbuffer) {
102+
fn.wglQueryPbufferARBFn = reinterpret_cast<wglQueryPbufferARBProc>(
103+
GetGLProcAddress("wglQueryPbufferARB"));
104+
}
105+
106+
if (ext.b_WGL_ARB_pbuffer) {
107+
fn.wglReleasePbufferDCARBFn = reinterpret_cast<wglReleasePbufferDCARBProc>(
108+
GetGLProcAddress("wglReleasePbufferDCARB"));
109+
}
110+
95111
if (ext.b_WGL_EXT_swap_control) {
96112
fn.wglSwapIntervalEXTFn = reinterpret_cast<wglSwapIntervalEXTProc>(
97113
GetGLProcAddress("wglSwapIntervalEXT"));

chromium/ui/gl/gl_display.cc

Lines changed: 0 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -553,11 +553,6 @@ GLDisplayPlatform* GLDisplay::GetAs() {
553553
type_checked = std::is_same<GLDisplayPlatform, GLDisplayX11>::value;
554554
#endif // defined(USE_GLX)
555555
break;
556-
case WGL:
557-
#if BUILDFLAG(IS_WIN)
558-
type_checked = std::is_same<GLDisplayPlatform, GLDisplayWGL>::value;
559-
#endif // BUILDFLAG(IS_WIN)
560-
break;
561556
}
562557
if (type_checked)
563558
return static_cast<GLDisplayPlatform*>(this);
@@ -575,11 +570,6 @@ template EXPORT_TEMPLATE_DEFINE(GL_EXPORT)
575570
GLDisplayX11* GLDisplay::GetAs<GLDisplayX11>();
576571
#endif // defined(USE_GLX)
577572

578-
#if BUILDFLAG(IS_WIN)
579-
template EXPORT_TEMPLATE_DEFINE(GL_EXPORT)
580-
GLDisplayWGL* GLDisplay::GetAs<GLDisplayWGL>();
581-
#endif // BUILDFLAG(IS_WIN)
582-
583573
#if defined(USE_EGL)
584574
GLDisplayEGL::EGLGpuSwitchingObserver::EGLGpuSwitchingObserver(
585575
EGLDisplay display)
@@ -941,159 +931,4 @@ bool GLDisplayX11::Initialize(gl::GLDisplay*) {
941931
}
942932
#endif // defined(USE_GLX)
943933

944-
#if BUILDFLAG(IS_WIN)
945-
946-
namespace {
947-
const PIXELFORMATDESCRIPTOR kPixelFormatDescriptor = {
948-
sizeof(kPixelFormatDescriptor), // Size of structure.
949-
1, // Default version.
950-
PFD_DRAW_TO_WINDOW | // Window drawing support.
951-
PFD_SUPPORT_OPENGL | // OpenGL support.
952-
PFD_DOUBLEBUFFER, // Double buffering support (not stereo).
953-
PFD_TYPE_RGBA, // RGBA color mode (not indexed).
954-
24, // 24 bit color mode.
955-
0, 0, 0, 0, 0, 0, // Don't set RGB bits & shifts.
956-
8, 0, // 8 bit alpha
957-
0, // No accumulation buffer.
958-
0, 0, 0, 0, // Ignore accumulation bits.
959-
0, // no z-buffer.
960-
0, // no stencil buffer.
961-
0, // No aux buffer.
962-
PFD_MAIN_PLANE, // Main drawing plane (not overlay).
963-
0, // Reserved.
964-
0, 0, 0, // Layer masks ignored.
965-
};
966-
967-
LRESULT CALLBACK IntermediateWindowProc(HWND window,
968-
UINT message,
969-
WPARAM w_param,
970-
LPARAM l_param) {
971-
switch (message) {
972-
case WM_ERASEBKGND:
973-
// Prevent windows from erasing the background.
974-
return 1;
975-
case WM_PAINT:
976-
// Do not paint anything.
977-
PAINTSTRUCT paint;
978-
if (BeginPaint(window, &paint))
979-
EndPaint(window, &paint);
980-
return 0;
981-
default:
982-
return DefWindowProc(window, message, w_param, l_param);
983-
}
984-
}
985-
} // namespace
986-
987-
GLDisplayWGL::GLDisplayWGL(uint64_t system_device_id, DisplayKey display_key)
988-
: GLDisplay(system_device_id, display_key, WGL),
989-
module_handle_(0),
990-
window_class_(0),
991-
window_handle_(0),
992-
device_context_(0),
993-
pixel_format_(0) {}
994-
995-
GLDisplayWGL::~GLDisplayWGL() {
996-
if (window_handle_)
997-
DestroyWindow(window_handle_);
998-
if (window_class_)
999-
UnregisterClass(reinterpret_cast<wchar_t*>(window_class_),
1000-
module_handle_);
1001-
}
1002-
1003-
bool GLDisplayWGL::Init(bool software_rendering) {
1004-
// We must initialize a GL context before we can bind to extension entry
1005-
// points. This requires the device context for a window.
1006-
if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT |
1007-
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
1008-
reinterpret_cast<wchar_t*>(IntermediateWindowProc),
1009-
&module_handle_)) {
1010-
LOG(ERROR) << "GetModuleHandleEx failed.";
1011-
return false;
1012-
}
1013-
1014-
WNDCLASS intermediate_class;
1015-
intermediate_class.style = CS_OWNDC;
1016-
intermediate_class.lpfnWndProc = IntermediateWindowProc;
1017-
intermediate_class.cbClsExtra = 0;
1018-
intermediate_class.cbWndExtra = 0;
1019-
intermediate_class.hInstance = module_handle_;
1020-
intermediate_class.hIcon = LoadIcon(NULL, IDI_APPLICATION);
1021-
intermediate_class.hCursor = LoadCursor(NULL, IDC_ARROW);
1022-
intermediate_class.hbrBackground = NULL;
1023-
intermediate_class.lpszMenuName = NULL;
1024-
intermediate_class.lpszClassName = L"Intermediate GL Window";
1025-
window_class_ = RegisterClass(&intermediate_class);
1026-
if (!window_class_) {
1027-
LOG(ERROR) << "RegisterClass failed.";
1028-
return false;
1029-
}
1030-
1031-
window_handle_ = CreateWindowEx(WS_EX_NOPARENTNOTIFY,
1032-
reinterpret_cast<wchar_t*>(window_class_),
1033-
L"",
1034-
WS_OVERLAPPEDWINDOW,
1035-
0,
1036-
0,
1037-
100,
1038-
100,
1039-
NULL,
1040-
NULL,
1041-
NULL,
1042-
NULL);
1043-
if (!window_handle_) {
1044-
LOG(ERROR) << "CreateWindow failed.";
1045-
return false;
1046-
}
1047-
1048-
device_context_ = GetDC(window_handle_);
1049-
pixel_format_ = ChoosePixelFormat(device_context_,
1050-
&kPixelFormatDescriptor);
1051-
if (pixel_format_ == 0) {
1052-
LOG(ERROR) << "Unable to get the pixel format for GL context.";
1053-
return false;
1054-
}
1055-
1056-
bool result = false;
1057-
if (software_rendering) {
1058-
// wglSetPixelFormat needs to be called instead of SetPixelFormat to allow
1059-
// a differently named software GL implementation library to set up its
1060-
// internal data. The windows gdi.dll SetPixelFormat call directly calls
1061-
// into the stock opengl32.dll, instead of opengl32sw.dll for example.
1062-
typedef BOOL(WINAPI * wglSetPixelFormatProc)(
1063-
HDC, int, const PIXELFORMATDESCRIPTOR*);
1064-
wglSetPixelFormatProc wglSetPixelFormatFn =
1065-
reinterpret_cast<wglSetPixelFormatProc>(
1066-
GetGLProcAddress("wglSetPixelFormat"));
1067-
1068-
result = wglSetPixelFormatFn(device_context_, pixel_format_,
1069-
&kPixelFormatDescriptor);
1070-
} else {
1071-
result = SetPixelFormat(device_context_, pixel_format_,
1072-
&kPixelFormatDescriptor);
1073-
}
1074-
if (!result) {
1075-
LOG(ERROR) << "Unable to set the pixel format for temporary GL context.";
1076-
return false;
1077-
}
1078-
return true;
1079-
}
1080-
1081-
void* GLDisplayWGL::GetDisplay() const
1082-
{
1083-
return device_context();
1084-
}
1085-
1086-
bool GLDisplayWGL::IsInitialized() const
1087-
{
1088-
return true;
1089-
}
1090-
void GLDisplayWGL::Shutdown()
1091-
{
1092-
}
1093-
bool GLDisplayWGL::Initialize(gl::GLDisplay*) {
1094-
// FIXME?
1095-
return false;
1096-
}
1097-
#endif // BUILDFLAG(IS_WIN)
1098-
1099934
} // namespace gl

chromium/ui/gl/gl_display.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ enum DisplayPlatform {
7777
NONE = 0,
7878
EGL = 1,
7979
X11 = 2,
80-
WGL = 3,
8180
};
8281

8382
class GL_EXPORT GLDisplay {
@@ -219,32 +218,6 @@ class GL_EXPORT GLDisplayX11 : public GLDisplay {
219218
};
220219
#endif // defined(USE_GLX)
221220

222-
#if BUILDFLAG(IS_WIN)
223-
class GLDisplayWGL : public GLDisplay {
224-
public:
225-
~GLDisplayWGL() override;
226-
227-
void* GetDisplay() const override;
228-
bool IsInitialized() const override;
229-
void Shutdown() override;
230-
bool Initialize(GLDisplay* display) override;
231-
232-
bool Init(bool software_rendering);
233-
234-
ATOM window_class() const { return window_class_; }
235-
HDC device_context() const { return device_context_; }
236-
int pixel_format() const { return pixel_format_; }
237-
238-
GLDisplayWGL(uint64_t system_device_id, DisplayKey display_key);
239-
private:
240-
HINSTANCE module_handle_;
241-
ATOM window_class_;
242-
HWND window_handle_;
243-
HDC device_context_;
244-
int pixel_format_;
245-
};
246-
#endif // BUILDFLAG(IS_WIN)
247-
248221
} // namespace gl
249222

250223
#endif // UI_GL_GL_DISPLAY_H_

chromium/ui/gl/gl_display_manager.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,4 @@ template class EXPORT_TEMPLATE_DEFINE(GL_EXPORT) GLDisplayManager<GLDisplayEGL>;
1212
#if defined(USE_GLX)
1313
template class EXPORT_TEMPLATE_DEFINE(GL_EXPORT) GLDisplayManager<GLDisplayX11>;
1414
#endif
15-
16-
#if BUILDFLAG(IS_WIN)
17-
template class EXPORT_TEMPLATE_DEFINE(GL_EXPORT) GLDisplayManager<GLDisplayWGL>;
18-
#endif
19-
2015
} // namespace gl

chromium/ui/gl/gl_display_manager.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,6 @@ extern template class EXPORT_TEMPLATE_DECLARE(GL_EXPORT)
169169
GLDisplayManager<GLDisplayX11>;
170170
#endif
171171

172-
#if BUILDFLAG(IS_WIN)
173-
using GLDisplayManagerWGL = GLDisplayManager<GLDisplayWGL>;
174-
175-
extern template class EXPORT_TEMPLATE_DECLARE(GL_EXPORT)
176-
GLDisplayManager<GLDisplayWGL>;
177-
#endif
178-
179172
} // namespace gl
180173

181174
#endif // UI_GL_GL_DISPLAY_MANAGER_H_

0 commit comments

Comments
 (0)