Bug 1890689 accumulate input in LargerReceiverBlockSizeThanDesiredBuffering GTest...
[gecko.git] / gfx / gl / GLContextProviderImpl.h
blobe7aaeeaa62bade73da36a986f40a6bed4d169538
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef IN_GL_CONTEXT_PROVIDER_H
7 # error GLContextProviderImpl.h must only be included from GLContextProvider.h
8 #endif
10 #ifndef GL_CONTEXT_PROVIDER_NAME
11 # error GL_CONTEXT_PROVIDER_NAME not defined
12 #endif
13 #if defined(MOZ_WIDGET_ANDROID)
14 # include "GLTypes.h" // for EGLSurface and EGLConfig
15 #endif // defined(MOZ_WIDGET_ANDROID)
17 class GL_CONTEXT_PROVIDER_NAME {
18 public:
19 /**
20 * Create a context that renders to the surface of the widget represented by
21 * the compositor widget that is passed in. The context is always created
22 * with an RGB pixel format, with no alpha, depth or stencil.
23 * If any of those features are needed, either use a framebuffer, or
24 * use CreateOffscreen.
26 * This context will attempt to share resources with all other window
27 * contexts. As such, it's critical that resources allocated that are not
28 * needed by other contexts be deleted before the context is destroyed.
30 * The GetSharedContext() method will return non-null if sharing
31 * was successful.
33 * Note: a context created for a widget /must not/ hold a strong
34 * reference to the widget; otherwise a cycle can be created through
35 * a GL layer manager.
37 * @param aCompositorWidget Widget whose surface to create a context for
38 * @param aForceAccelerated true if only accelerated contexts are allowed
40 * @return Context to use for the window
42 static already_AddRefed<GLContext> CreateForCompositorWidget(
43 mozilla::widget::CompositorWidget* aCompositorWidget,
44 bool aHardwareWebRender, bool aForceAccelerated);
46 /// Just create a context. We'll add offscreen stuff ourselves.
47 static already_AddRefed<GLContext> CreateHeadless(
48 const GLContextCreateDesc&, nsACString* const out_failureId);
50 /**
51 * Get a pointer to the global context, creating it if it doesn't exist.
53 static GLContext* GetGlobalContext();
55 /**
56 * Free any resources held by this Context Provider.
58 static void Shutdown();