File: gl_factory.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (128 lines) | stat: -rw-r--r-- 4,755 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_GL_INIT_GL_FACTORY_H_
#define UI_GL_INIT_GL_FACTORY_H_

#include <memory>
#include <string>
#include <vector>

#include "base/memory/scoped_refptr.h"
#include "build/build_config.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gl/gl_display.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_surface_format.h"
#include "ui/gl/gpu_preference.h"
#include "ui/gl/init/gl_init_export.h"
#include "ui/gl/presenter.h"

namespace gl {

class GLContext;
class GLShareGroup;
class GLSurface;

struct GLContextAttribs;
struct GLVersionInfo;

namespace init {

// Returns a list of allowed GL implementations. The default implementation will
// be the first item.
GL_INIT_EXPORT std::vector<GLImplementationParts> GetAllowedGLImplementations();

// Initializes GL bindings and extension settings.
// |gpu_preference| specifies which GPU to use on a multi-GPU system.
// If its value is kDefault, use the default GPU of the system.
GL_INIT_EXPORT GLDisplay* InitializeGLOneOff(gl::GpuPreference gpu_preference);

// Initializes GL bindings without initializing extension settings.
// |gpu_preference| specifies which GPU to use on a multi-GPU system.
// If its value is kDefault, use the default GPU of the system.
GL_INIT_EXPORT GLDisplay* InitializeGLNoExtensionsOneOff(
    bool init_bindings,
    gl::GpuPreference gpu_preference);

// Initializes GL bindings - load dlls and get proc address according to gl
// command line switch.
GL_INIT_EXPORT bool InitializeStaticGLBindingsOneOff();

// Initialize plaiform dependent extension settings, including bindings,
// capabilities, etc.
GL_INIT_EXPORT bool InitializeExtensionSettingsOneOffPlatform(
    GLDisplay* display);

// Initializes GL bindings using the provided parameters. This might be required
// for use in tests.
GL_INIT_EXPORT bool InitializeStaticGLBindingsImplementation(
    GLImplementationParts impl);

// Initializes GL platform using the provided parameters. This might be required
// for use in tests. This should be called only after GL bindings are initilzed
// successfully.
// |gpu_preference| specifies which GPU to use on a multi-GPU system.
// If its value is kDefault, use the default GPU of the system.
GL_INIT_EXPORT GLDisplay* InitializeGLOneOffPlatformImplementation(
    bool disable_gl_drawing,
    bool init_extensions,
    gl::GpuPreference gpu_preference);

// Does the same as the above, but returns a cached display if one is already
// initialized for the requested GPU.
GL_INIT_EXPORT GLDisplay* GetOrInitializeGLOneOffPlatformImplementation(
    bool fallback_to_software_gl,
    bool disable_gl_drawing,
    bool init_extensions,
    gl::GpuPreference gpu_preference);

// Clears GL bindings and resets GL implementation.
// Calling this function a second time on the same |display| is a no-op.
GL_INIT_EXPORT void ShutdownGL(GLDisplay* display, bool due_to_fallback);

// Return information about the GL window system binding implementation.
// Returns true if the information was retrieved successfully.
GL_INIT_EXPORT bool GetGLWindowSystemBindingInfo(
    const GLVersionInfo& gl_info,
    GLWindowSystemBindingInfo* info);

// Creates a GL context that is compatible with the given surface.
// |share_group|, if non-null, is a group of contexts which the internally
// created OpenGL context shares textures and other resources.
GL_INIT_EXPORT scoped_refptr<GLContext> CreateGLContext(
    GLShareGroup* share_group,
    GLSurface* compatible_surface,
    const GLContextAttribs& attribs);

// Creates a GL surface that renders directly to a view.
GL_INIT_EXPORT scoped_refptr<GLSurface> CreateViewGLSurface(
    GLDisplay* display,
    gfx::AcceleratedWidget window);

#if BUILDFLAG(IS_OZONE)
// Creates a GL surface that renders directly into a window with surfaceless
// semantics - there is no default framebuffer and the primary surface must
// be presented as an overlay. If surfaceless mode is not supported or
// enabled it will return a null pointer.
GL_INIT_EXPORT scoped_refptr<Presenter> CreateSurfacelessViewGLSurface(
    GLDisplay* display,
    gfx::AcceleratedWidget window);
#endif  // BUILDFLAG(IS_OZONE)

// Creates a GL surface used for offscreen rendering.
GL_INIT_EXPORT scoped_refptr<GLSurface> CreateOffscreenGLSurface(
    GLDisplay* display,
    const gfx::Size& size);

// Set platform dependent disabled extensions and re-initialize extension
// bindings.
GL_INIT_EXPORT void SetDisabledExtensionsPlatform(
    const std::string& disabled_extensions);

}  // namespace init
}  // namespace gl

#endif  // UI_GL_INIT_GL_FACTORY_H_