Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(678)

Unified Diff: src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp

Issue 12328111: Use glGetStringi to get extensions when available. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp ('k') | src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp
===================================================================
--- src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp (revision 7868)
+++ src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp (working copy)
@@ -7,6 +7,7 @@
*/
+#include "gl/GrGLExtensions.h"
#include "gl/GrGLInterface.h"
#include "../GrGLUtil.h"
@@ -22,10 +23,19 @@
const GrGLInterface* GrGLCreateNativeInterface() {
if (NULL != glXGetCurrentContext()) {
+
const char* versionString = (const char*) glGetString(GL_VERSION);
- const char* extString = (const char*) glGetString(GL_EXTENSIONS);
GrGLVersion glVer = GrGLGetVersionFromString(versionString);
+ // This may or may not succeed depending on the gl version.
+ GrGLGetStringiProc glGetStringi =
+ (GrGLGetStringiProc) glXGetProcAddress(reinterpret_cast<const GLubyte*>("glGetStringi"));
+
+ GrGLExtensions extensions;
+ if (!extensions.init(kDesktop_GrGLBinding, glGetString, glGetStringi, glGetIntegerv)) {
+ return NULL;
+ }
+
if (glVer < GR_GL_VER(1,5)) {
// We must have array and element_array buffer objects.
return NULL;
@@ -43,8 +53,8 @@
interface->fBlendFunc = glBlendFunc;
if (glVer >= GR_GL_VER(1,4) ||
- GrGLHasExtensionFromString("GL_ARB_imaging", extString) ||
- GrGLHasExtensionFromString("GL_EXT_blend_color", extString)) {
+ extensions.has("GL_ARB_imaging") ||
+ extensions.has("GL_EXT_blend_color")) {
GR_GL_GET_PROC(BlendColor);
}
@@ -83,12 +93,11 @@
interface->fGetIntegerv = glGetIntegerv;
GR_GL_GET_PROC(GetQueryObjectiv);
GR_GL_GET_PROC(GetQueryObjectuiv);
- if (glVer >= GR_GL_VER(3,3) ||
- GrGLHasExtensionFromString("GL_ARB_timer_query", extString)) {
+ if (glVer >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) {
GR_GL_GET_PROC(GetQueryObjecti64v);
GR_GL_GET_PROC(GetQueryObjectui64v);
GR_GL_GET_PROC(QueryCounter);
- } else if (GrGLHasExtensionFromString("GL_EXT_timer_query", extString)) {
+ } else if (extensions.has("GL_EXT_timer_query")) {
GR_GL_GET_PROC_SUFFIX(GetQueryObjecti64v, EXT);
GR_GL_GET_PROC_SUFFIX(GetQueryObjectui64v, EXT);
}
@@ -98,6 +107,7 @@
GR_GL_GET_PROC(GetShaderInfoLog);
GR_GL_GET_PROC(GetShaderiv);
interface->fGetString = glGetString;
+ GR_GL_GET_PROC(GetStringi);
interface->fGetTexLevelParameteriv = glGetTexLevelParameteriv;
GR_GL_GET_PROC(GenQueries);
interface->fGenTextures = glGenTextures;
@@ -108,8 +118,7 @@
interface->fPixelStorei = glPixelStorei;
interface->fReadBuffer = glReadBuffer;
interface->fReadPixels = glReadPixels;
- if (GrGLHasExtensionFromString("GL_NV_framebuffer_multisample_coverage",
- extString)) {
+ if (extensions.has("GL_NV_framebuffer_multisample_coverage")) {
GR_GL_GET_PROC_SUFFIX(RenderbufferStorageMultisampleCoverage, NV);
}
interface->fScissor = glScissor;
@@ -123,10 +132,9 @@
interface->fTexImage2D = glTexImage2D;
interface->fTexParameteri = glTexParameteri;
interface->fTexParameteriv = glTexParameteriv;
- if (glVer >= GR_GL_VER(4,2) ||
- GrGLHasExtensionFromString("GL_ARB_texture_storage", extString)) {
+ if (glVer >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage")) {
GR_GL_GET_PROC(TexStorage2D);
- } else if (GrGLHasExtensionFromString("GL_EXT_texture_storage", extString)) {
+ } else if (extensions.has("GL_EXT_texture_storage")) {
GR_GL_GET_PROC_SUFFIX(TexStorage2D, EXT);
}
interface->fTexSubImage2D = glTexSubImage2D;
@@ -158,9 +166,7 @@
// First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since
// GL_ARB_framebuffer_object doesn't use ARB suffix.)
- if (glVer >= GR_GL_VER(3,0) ||
- GrGLHasExtensionFromString("GL_ARB_framebuffer_object",
- extString)) {
+ if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_framebuffer_object")) {
GR_GL_GET_PROC(GenFramebuffers);
GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv);
GR_GL_GET_PROC(GetRenderbufferParameteriv);
@@ -175,8 +181,7 @@
GR_GL_GET_PROC(BindRenderbuffer);
GR_GL_GET_PROC(RenderbufferStorageMultisample);
GR_GL_GET_PROC(BlitFramebuffer);
- } else if (GrGLHasExtensionFromString("GL_EXT_framebuffer_object",
- extString)) {
+ } else if (extensions.has("GL_EXT_framebuffer_object")) {
GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT);
GR_GL_GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT);
GR_GL_GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT);
@@ -189,12 +194,10 @@
GR_GL_GET_PROC_SUFFIX(DeleteRenderbuffers, EXT);
GR_GL_GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT);
GR_GL_GET_PROC_SUFFIX(BindRenderbuffer, EXT);
- if (GrGLHasExtensionFromString("GL_EXT_framebuffer_multisample",
- extString)) {
+ if (extensions.has("GL_EXT_framebuffer_multisample")) {
GR_GL_GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT);
}
- if (GrGLHasExtensionFromString("GL_EXT_framebuffer_blit",
- extString)) {
+ if (extensions.has("GL_EXT_framebuffer_blit")) {
GR_GL_GET_PROC_SUFFIX(BlitFramebuffer, EXT);
}
} else {
« no previous file with comments | « src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp ('k') | src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698