Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
GrGLContext Class Reference

#include <GrGLContext.h>

Inheritance diagram for GrGLContext:
GrGLContextInfo

Public Member Functions

const GrGLInterfaceglInterface () const
 
 ~GrGLContext () override
 
- Public Member Functions inherited from GrGLContextInfo
 GrGLContextInfo (GrGLContextInfo &&)=default
 
GrGLContextInfooperator= (GrGLContextInfo &&)=default
 
virtual ~GrGLContextInfo ()
 
GrGLStandard standard () const
 
GrGLVersion version () const
 
SkSL::GLSLGeneration glslGeneration () const
 
GrGLVendor vendor () const
 
GrGLRenderer renderer () const
 
GrGLANGLEBackend angleBackend () const
 
GrGLDriver angleDriver () const
 
GrGLVendor angleVendor () const
 
GrGLRenderer angleRenderer () const
 
GrGLVendor webglVendor () const
 
GrGLRenderer webglRenderer () const
 
GrGLDriver driver () const
 
GrGLDriverVersion driverVersion () const
 
bool isOverCommandBuffer () const
 
bool isRunningOverVirgl () const
 
const GrGLCapscaps () const
 
GrGLCapscaps ()
 
bool hasExtension (const char *ext) const
 
const GrGLExtensionsextensions () const
 

Static Public Member Functions

static std::unique_ptr< GrGLContextMake (sk_sp< const GrGLInterface >, const GrContextOptions &)
 

Additional Inherited Members

- Protected Member Functions inherited from GrGLContextInfo
GrGLContextInfooperator= (const GrGLContextInfo &)=default
 
 GrGLContextInfo (const GrGLContextInfo &)=default
 
 GrGLContextInfo (ConstructorArgs &&)
 
- Protected Attributes inherited from GrGLContextInfo
sk_sp< const GrGLInterfacefInterface
 
GrGLDriverInfo fDriverInfo
 
SkSL::GLSLGeneration fGLSLGeneration
 
sk_sp< GrGLCapsfGLCaps
 

Detailed Description

Extension of GrGLContextInfo that also provides access to GrGLInterface.

Definition at line 100 of file GrGLContext.h.

Constructor & Destructor Documentation

◆ ~GrGLContext()

GrGLContext::~GrGLContext ( )
override

Definition at line 76 of file GrGLContext.cpp.

76{}

Member Function Documentation

◆ glInterface()

const GrGLInterface * GrGLContext::glInterface ( ) const
inline

Definition at line 108 of file GrGLContext.h.

108{ return fInterface.get(); }
sk_sp< const GrGLInterface > fInterface
Definition GrGLContext.h:91
T * get() const
Definition SkRefCnt.h:303

◆ Make()

std::unique_ptr< GrGLContext > GrGLContext::Make ( sk_sp< const GrGLInterface interface,
const GrContextOptions options 
)
static

Creates a GrGLContext from a GrGLInterface and the currently bound OpenGL context accessible by the GrGLInterface.

Definition at line 19 of file GrGLContext.cpp.

20 {
21 if (!interface->validate()) {
22 return nullptr;
23 }
24
25 ConstructorArgs args;
26 args.fDriverInfo = GrGLGetDriverInfo(interface.get());
27 if (args.fDriverInfo.fVersion == GR_GL_INVALID_VER) {
28 return nullptr;
29 }
30
31 if (!GrGLGetGLSLGeneration(args.fDriverInfo, &args.fGLSLGeneration)) {
32 return nullptr;
33 }
34
35 /*
36 * Qualcomm drivers for the 3xx series have a horrendous bug with some drivers. Though they
37 * claim to support GLES 3.00, some perfectly valid GLSL300 shaders will only compile with
38 * #version 100, and will fail to compile with #version 300 es. In the long term, we
39 * need to lock this down to a specific driver version.
40 * ?????/2019 - Qualcomm has fixed this for Android O+ devices (API 26+)
41 * ?????/2015 - This bug is still present in Lollipop pre-mr1
42 * 06/18/2015 - This bug does not affect the nexus 6 (which has an Adreno 4xx).
43 */
44#ifdef SK_BUILD_FOR_ANDROID
45 if (!options.fDisableDriverCorrectnessWorkarounds &&
46 args.fDriverInfo.fRenderer == GrGLRenderer::kAdreno3xx) {
47 char androidAPIVersion[PROP_VALUE_MAX];
48 int strLength = __system_property_get("ro.build.version.sdk", androidAPIVersion);
49 if (strLength == 0 || atoi(androidAPIVersion) < 26) {
50 args.fGLSLGeneration = SkSL::GLSLGeneration::k100es;
51 }
52 }
53#endif
54
55 // Many ES3 drivers only advertise the ES2 image_external extension, but support the _essl3
56 // extension, and require that it be enabled to work with ESSL3. Other devices require the ES2
57 // extension to be enabled, even when using ESSL3. Some devices appear to only support the ES2
58 // extension. As an extreme (optional) solution, we can fallback to using ES2 shading language
59 // if we want to prioritize external texture support. skbug.com/7713
60 if (GR_IS_GR_GL_ES(interface->fStandard) &&
61 options.fPreferExternalImagesOverES3 &&
62 !options.fDisableDriverCorrectnessWorkarounds &&
63 interface->hasExtension("GL_OES_EGL_image_external") &&
64 args.fGLSLGeneration >= SkSL::GLSLGeneration::k330 &&
65 !interface->hasExtension("GL_OES_EGL_image_external_essl3") &&
66 !interface->hasExtension("OES_EGL_image_external_essl3")) {
67 args.fGLSLGeneration = SkSL::GLSLGeneration::k100es;
68 }
69
70 args.fContextOptions = &options;
71 args.fInterface = std::move(interface);
72
73 return std::unique_ptr<GrGLContext>(new GrGLContext(std::move(args)));
74}
const char * options
bool GrGLGetGLSLGeneration(const GrGLDriverInfo &info, SkSL::GLSLGeneration *generation)
Definition GrGLGLSL.cpp:12
#define GR_IS_GR_GL_ES(standard)
Definition GrGLTypes.h:49
GrGLDriverInfo GrGLGetDriverInfo(const GrGLInterface *interface)
Definition GrGLUtil.cpp:723
#define GR_GL_INVALID_VER
Definition GrGLUtil.h:37
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
bool hasExtension(const char ext[]) const
GrGLStandard fStandard

The documentation for this class was generated from the following files: