fBindingInUse = ctx.fBindingInUse;
fGLVersion = ctx.fGLVersion;
fGLSLGeneration = ctx.fGLSLGeneration;
+ fVendor = ctx.fVendor;
fExtensionString = ctx.fExtensionString;
fGLCaps = ctx.fGLCaps;
return *this;
fBindingInUse = kNone_GrGLBinding;
fGLVersion = GR_GL_VER(0, 0);
fGLSLGeneration = static_cast<GrGLSLGeneration>(0);
+ fVendor = kOther_GrGLVendor;
fExtensionString = "";
fGLCaps.reset();
}
const GrGLubyte* ext;
GR_GL_CALL_RET(interface, ext, GetString(GR_GL_EXTENSIONS));
fExtensionString = reinterpret_cast<const char*>(ext);
-
+ fVendor = GrGLGetVendor(interface);
fGLCaps.init(*this);
return true;
}
/**
* Creates a GrGLContextInfo from a GrGLInterface and the currently
- * bound OpenGL context accesible by the GrGLInterface.
+ * bound OpenGL context accessible by the GrGLInterface.
*/
explicit GrGLContextInfo(const GrGLInterface* interface);
GrGLBinding binding() const { return fBindingInUse; }
GrGLVersion version() const { return fGLVersion; }
GrGLSLGeneration glslGeneration() const { return fGLSLGeneration; }
+ GrGLVendor vendor() const { return fVendor; }
const GrGLCaps& caps() const { return fGLCaps; }
GrGLCaps& caps() { return fGLCaps; }
GrGLBinding fBindingInUse;
GrGLVersion fGLVersion;
GrGLSLGeneration fGLSLGeneration;
+ GrGLVendor fVendor;
SkString fExtensionString;
GrGLCaps fGLCaps;
};
return false;
}
+GrGLVendor GrGLGetVendorFromString(const char* vendorString) {
+ if (NULL != vendorString) {
+ if (0 == strcmp(vendorString, "Intel")) {
+ return kIntel_GrGLVendor;
+ }
+ }
+
+ return kOther_GrGLVendor;
+}
+
bool GrGLHasExtension(const GrGLInterface* gl, const char* ext) {
const GrGLubyte* glstr;
GR_GL_CALL_RET(gl, glstr, GetString(GR_GL_EXTENSIONS));
GR_GL_CALL_RET(gl, v, GetString(GR_GL_SHADING_LANGUAGE_VERSION));
return GrGLGetGLSLVersionFromString((const char*) v);
}
+
+GrGLVendor GrGLGetVendor(const GrGLInterface* gl) {
+ const GrGLubyte* v;
+ GR_GL_CALL_RET(gl, v, GetString(GR_GL_VENDOR));
+ return GrGLGetVendorFromString((const char*) v);
+}
+
typedef uint32_t GrGLVersion;
typedef uint32_t GrGLSLVersion;
+/**
+ * This list is lazily updated as required.
+ */
+enum GrGLVendor {
+ kIntel_GrGLVendor,
+ kOther_GrGLVendor,
+};
+
#define GR_GL_VER(major, minor) ((static_cast<int>(major) << 16) | \
static_cast<int>(minor))
#define GR_GLSL_VER(major, minor) ((static_cast<int>(major) << 16) | \
GrGLBinding GrGLGetBindingInUseFromString(const char* versionString);
GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString);
bool GrGLHasExtensionFromString(const char* ext, const char* extensionString);
+GrGLVendor GrGLGetVendorFromString(const char* vendorString);
// these variants call glGetString()
bool GrGLHasExtension(const GrGLInterface*, const char* ext);
GrGLBinding GrGLGetBindingInUse(const GrGLInterface*);
GrGLVersion GrGLGetVersion(const GrGLInterface*);
GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface*);
+GrGLVendor GrGLGetVendor(const GrGLInterface*);
/**
* Helpers for glGetError()