aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-23 13:52:43 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-23 13:52:43 +0000
commit0b1e481709ef9b86261f46e9fd44d8cdec7c2d8e (patch)
treea2c404cc3e4e5f95214398c7dfdf68877693a030
parent195952f0aee6e2dedf29d095e8be2edc2496dc18 (diff)
Add vendor to context info.
R=robertphillips@google.com Review URL: https://codereview.appspot.com/6741062 git-svn-id: http://skia.googlecode.com/svn/trunk@6043 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/gpu/gl/GrGLContextInfo.cpp4
-rw-r--r--src/gpu/gl/GrGLContextInfo.h4
-rw-r--r--src/gpu/gl/GrGLUtil.cpp17
-rw-r--r--src/gpu/gl/GrGLUtil.h10
4 files changed, 33 insertions, 2 deletions
diff --git a/src/gpu/gl/GrGLContextInfo.cpp b/src/gpu/gl/GrGLContextInfo.cpp
index 9802e65985..060d236b22 100644
--- a/src/gpu/gl/GrGLContextInfo.cpp
+++ b/src/gpu/gl/GrGLContextInfo.cpp
@@ -30,6 +30,7 @@ GrGLContextInfo& GrGLContextInfo::operator = (const GrGLContextInfo& ctx) {
fBindingInUse = ctx.fBindingInUse;
fGLVersion = ctx.fGLVersion;
fGLSLGeneration = ctx.fGLSLGeneration;
+ fVendor = ctx.fVendor;
fExtensionString = ctx.fExtensionString;
fGLCaps = ctx.fGLCaps;
return *this;
@@ -40,6 +41,7 @@ void GrGLContextInfo::reset() {
fBindingInUse = kNone_GrGLBinding;
fGLVersion = GR_GL_VER(0, 0);
fGLSLGeneration = static_cast<GrGLSLGeneration>(0);
+ fVendor = kOther_GrGLVendor;
fExtensionString = "";
fGLCaps.reset();
}
@@ -70,7 +72,7 @@ bool GrGLContextInfo::initialize(const GrGLInterface* interface) {
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;
}
diff --git a/src/gpu/gl/GrGLContextInfo.h b/src/gpu/gl/GrGLContextInfo.h
index 44fc98555f..a6c997f5a2 100644
--- a/src/gpu/gl/GrGLContextInfo.h
+++ b/src/gpu/gl/GrGLContextInfo.h
@@ -31,7 +31,7 @@ public:
/**
* 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);
@@ -58,6 +58,7 @@ public:
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; }
@@ -79,6 +80,7 @@ private:
GrGLBinding fBindingInUse;
GrGLVersion fGLVersion;
GrGLSLGeneration fGLSLGeneration;
+ GrGLVendor fVendor;
SkString fExtensionString;
GrGLCaps fGLCaps;
};
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
index 0e9e21fb2f..55236aab14 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -166,6 +166,16 @@ bool GrGLHasExtensionFromString(const char* ext, const char* extensionString) {
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));
@@ -189,3 +199,10 @@ GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface* gl) {
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);
+}
+
diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h
index 17d5a6320e..997207a1c7 100644
--- a/src/gpu/gl/GrGLUtil.h
+++ b/src/gpu/gl/GrGLUtil.h
@@ -16,6 +16,14 @@
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) | \
@@ -61,12 +69,14 @@ GrGLVersion GrGLGetVersionFromString(const char* versionString);
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()