GL: implement EGL context creation in Dawn native.

An abstract base class (Device::Context) is used to avoid adding dependencies to Device, with ContextEGL derived from it. This also
leaves open the possibility of supporting other native GL contexts
in the future (e.g., glX). One temporary EGLContext is created by opengl::Backend during Adapter discovery, then one is created for and
owned by each Device.

Contexts for the desktop GL backend are also managed via EGL, which
works for most modern drivers. This also means that GLFW is now
always used in GLFW_NO_API mode.

Since contexts are now per-device, all of the default GL state
setting and debug output setup was moved from Adapter to Device.

Bug: dawn:810
Change-Id: Idfe30939f155d026fcad549787fc167cc43aa3cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93981
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Stephen White
2022-06-29 15:29:41 +00:00
committed by Dawn LUCI CQ
parent 3a2a279714
commit 9434949241
26 changed files with 438 additions and 333 deletions

View File

@@ -23,15 +23,14 @@ typedef void* EGLImage;
namespace dawn::native::opengl {
struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptions : public AdapterDiscoveryOptionsBase {
AdapterDiscoveryOptions();
explicit AdapterDiscoveryOptions(WGPUBackendType type);
void* (*getProc)(const char*);
};
struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptionsES : public AdapterDiscoveryOptionsBase {
// TODO(crbug.com/dawn/810): This struct can be removed once Chrome is no longer using it.
struct DAWN_NATIVE_EXPORT AdapterDiscoveryOptionsES : public AdapterDiscoveryOptions {
AdapterDiscoveryOptionsES();
void* (*getProc)(const char*);
};
using PresentCallback = void (*)(void*);