Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrGLContext.h
Go to the documentation of this file.
1/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
9#ifndef GrGLContext_DEFINED
10#define GrGLContext_DEFINED
11
16
17struct GrContextOptions;
18
19/**
20 * Encapsulates information about an OpenGL context including the OpenGL
21 * version, the GrGLStandard type of the context, and GLSL version.
22 */
24public:
27
28 virtual ~GrGLContextInfo() {}
29
33 /**
34 * We've accumlated a lot of GL driver workarounds and performance preferences based on vendor
35 * and renderer. When we have GL sitting on top of Angle it is not clear which of these are
36 * necessary and which are handle by Angle. Thus to be safe we get the underlying GL vendor and
37 * renderer from Angle so we can enable these workarounds. It may mean that the same workaround
38 * is implemented both in Skia and Angle, but that is better than missing out on one.
39 */
42 return this->angleVendor();
43 } else {
44 return fDriverInfo.fVendor;
45 }
46 }
49 return this->angleRenderer();
50 } else {
52 }
53 }
58
61
62 /** What driver is running our GL implementation? This is not necessarily related to the vendor.
63 (e.g. Intel GPU being driven by Mesa) */
68
69 const GrGLCaps* caps() const { return fGLCaps.get(); }
70 GrGLCaps* caps() { return fGLCaps.get(); }
71
72 bool hasExtension(const char* ext) const {
73 return fInterface->hasExtension(ext);
74 }
75
76 const GrGLExtensions& extensions() const { return fInterface->fExtensions; }
77
78protected:
81
88
90
95};
96
97/**
98 * Extension of GrGLContextInfo that also provides access to GrGLInterface.
99 */
101public:
102 /**
103 * Creates a GrGLContext from a GrGLInterface and the currently
104 * bound OpenGL context accessible by the GrGLInterface.
105 */
106 static std::unique_ptr<GrGLContext> Make(sk_sp<const GrGLInterface>, const GrContextOptions&);
107
108 const GrGLInterface* glInterface() const { return fInterface.get(); }
109
110 ~GrGLContext() override;
111
112private:
113 GrGLContext(ConstructorArgs&& args) : INHERITED(std::move(args)) {}
114
115 using INHERITED = GrGLContextInfo;
116};
117
118#endif
GrGLStandard
Definition GrGLTypes.h:19
GrGLDriver
Definition GrGLUtil.h:218
GrGLVendor
Definition GrGLUtil.h:137
uint64_t GrGLDriverVersion
Definition GrGLUtil.h:24
GrGLANGLEBackend
Definition GrGLUtil.h:231
GrGLRenderer
Definition GrGLUtil.h:150
uint32_t GrGLVersion
Definition GrGLUtil.h:22
virtual ~GrGLContextInfo()
Definition GrGLContext.h:28
GrGLContextInfo(const GrGLContextInfo &)=default
GrGLRenderer webglRenderer() const
Definition GrGLContext.h:60
bool isRunningOverVirgl() const
Definition GrGLContext.h:67
GrGLDriverInfo fDriverInfo
Definition GrGLContext.h:92
GrGLVendor angleVendor() const
Definition GrGLContext.h:56
GrGLANGLEBackend angleBackend() const
Definition GrGLContext.h:54
GrGLDriver driver() const
Definition GrGLContext.h:64
GrGLVendor vendor() const
Definition GrGLContext.h:40
GrGLContextInfo(GrGLContextInfo &&)=default
SkSL::GLSLGeneration glslGeneration() const
Definition GrGLContext.h:32
GrGLVersion version() const
Definition GrGLContext.h:31
sk_sp< const GrGLInterface > fInterface
Definition GrGLContext.h:91
GrGLVendor webglVendor() const
Definition GrGLContext.h:59
SkSL::GLSLGeneration fGLSLGeneration
Definition GrGLContext.h:93
bool isOverCommandBuffer() const
Definition GrGLContext.h:66
GrGLCaps * caps()
Definition GrGLContext.h:70
const GrGLCaps * caps() const
Definition GrGLContext.h:69
GrGLContextInfo & operator=(GrGLContextInfo &&)=default
GrGLRenderer renderer() const
Definition GrGLContext.h:47
GrGLDriver angleDriver() const
Definition GrGLContext.h:55
GrGLContextInfo & operator=(const GrGLContextInfo &)=default
bool hasExtension(const char *ext) const
Definition GrGLContext.h:72
sk_sp< GrGLCaps > fGLCaps
Definition GrGLContext.h:94
GrGLRenderer angleRenderer() const
Definition GrGLContext.h:57
GrGLDriverVersion driverVersion() const
Definition GrGLContext.h:65
const GrGLExtensions & extensions() const
Definition GrGLContext.h:76
GrGLStandard standard() const
Definition GrGLContext.h:30
~GrGLContext() override
const GrGLInterface * glInterface() const
static std::unique_ptr< GrGLContext > Make(sk_sp< const GrGLInterface >, const GrContextOptions &)
T * get() const
Definition SkRefCnt.h:303
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
GLSLGeneration
Definition SkSLGLSL.h:15
Definition ref_ptr.h:256
const GrContextOptions * fContextOptions
Definition GrGLContext.h:86
sk_sp< const GrGLInterface > fInterface
Definition GrGLContext.h:83
SkSL::GLSLGeneration fGLSLGeneration
Definition GrGLContext.h:85
GrGLANGLEBackend fANGLEBackend
Definition GrGLUtil.h:310
bool fIsOverCommandBuffer
Definition GrGLUtil.h:320
GrGLDriver fANGLEDriver
Definition GrGLUtil.h:313
GrGLDriver fDriver
Definition GrGLUtil.h:307
GrGLVendor fWebGLVendor
Definition GrGLUtil.h:316
GrGLDriverVersion fDriverVersion
Definition GrGLUtil.h:308
GrGLRenderer fANGLERenderer
Definition GrGLUtil.h:312
bool fIsRunningOverVirgl
Definition GrGLUtil.h:323
GrGLRenderer fWebGLRenderer
Definition GrGLUtil.h:317
GrGLVersion fVersion
Definition GrGLUtil.h:303
GrGLVendor fANGLEVendor
Definition GrGLUtil.h:311
GrGLVendor fVendor
Definition GrGLUtil.h:305
GrGLRenderer fRenderer
Definition GrGLUtil.h:306
bool hasExtension(const char ext[]) const
GrGLExtensions fExtensions
GrGLStandard fStandard