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

Unified Diff: src/gpu/gl/mac/GrGLCreateNativeInterface_mac.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/debug/GrGLCreateDebugInterface.cpp ('k') | src/gpu/gl/mac/SkNativeGLContext_mac.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
===================================================================
--- src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp (revision 7868)
+++ src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp (working copy)
@@ -8,7 +8,8 @@
#include "gl/GrGLInterface.h"
-#include "../GrGLUtil.h"
+#include "gl/GrGLExtensions.h"
+#include "GrGLUtil.h"
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
@@ -31,8 +32,12 @@
glInterface.reset(interface);
const char* verStr = (const char*) glGetString(GL_VERSION);
GrGLVersion ver = GrGLGetVersionFromString(verStr);
- const char* extStr = (const char*) glGetString(GL_EXTENSIONS);
-
+ GrGLExtensions extensions;
+ GrGLGetStringiProc glGetStringi = (GrGLGetStringiProc) GetProcAddress("glGetStringi");
+ if (!extensions.init(kDesktop_GrGLBinding, glGetString, glGetStringi, glGetIntegerv)) {
+ glInterface.reset(NULL);
+ return NULL;
+ }
interface->fBindingsExported = kDesktop_GrGLBinding;
interface->fActiveTexture = glActiveTexture;
interface->fAttachShader = glAttachShader;
@@ -51,8 +56,8 @@
if (ver >= GR_GL_VER(1,4)) {
interface->fBlendColor = glBlendColor;
- } else if (GrGLHasExtensionFromString("GL_ARB_imaging", extStr) ||
- GrGLHasExtensionFromString("GL_EXT_blend_color", extStr)) {
+ } else if (extensions.has("GL_ARB_imaging") ||
+ extensions.has("GL_EXT_blend_color")) {
GET_PROC(BlendColor);
}
@@ -74,8 +79,7 @@
interface->fDeleteTextures = glDeleteTextures;
interface->fDepthMask = glDepthMask;
interface->fDisable = glDisable;
- interface->fDisableVertexAttribArray =
- glDisableVertexAttribArray;
+ interface->fDisableVertexAttribArray = glDisableVertexAttribArray;
interface->fDrawArrays = glDrawArrays;
interface->fDrawBuffer = glDrawBuffer;
interface->fDrawBuffers = glDrawBuffers;
@@ -99,6 +103,7 @@
interface->fGetShaderInfoLog = glGetShaderInfoLog;
interface->fGetShaderiv = glGetShaderiv;
interface->fGetString = glGetString;
+ interface->fGetStringi = glGetStringi;
interface->fGetTexLevelParameteriv = glGetTexLevelParameteriv;
interface->fGenTextures = glGenTextures;
interface->fGetUniformLocation = glGetUniformLocation;
@@ -131,10 +136,9 @@
#elif GL_EXT_texture_storage
interface->fTexStorage2D = glTexStorage2DEXT;
#else
- if (ver >= GR_GL_VER(4,2) ||
- GrGLHasExtensionFromString("GL_ARB_texture_storage", extStr)) {
+ if (ver >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage")) {
GET_PROC(TexStorage2D);
- } else if (GrGLHasExtensionFromString("GL_EXT_texture_storage", extStr)) {
+ } else if (extensions.has("GL_EXT_texture_storage")) {
GET_PROC_SUFFIX(TexStorage2D, EXT);
}
#endif
@@ -165,7 +169,7 @@
interface->fVertexAttribPointer = glVertexAttribPointer;
interface->fViewport = glViewport;
- if (ver >= GR_GL_VER(3,3) || GrGLHasExtensionFromString("GL_ARB_timer_query", extStr)) {
+ if (ver >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) {
// ARB extension doesn't use the ARB suffix on the function name
#if GL_ARB_timer_query || GL_VERSION_3_3
interface->fQueryCounter = glQueryCounter;
@@ -176,7 +180,7 @@
interface->fGetQueryObjecti64v = GET_PROC(GetQueryObjecti64v);
interface->fGetQueryObjectui64v = GET_PROC(GetQueryObjectui64v);
#endif
- } else if (GrGLHasExtensionFromString("GL_EXT_timer_query", extStr)) {
+ } else if (extensions.has("GL_EXT_timer_query")) {
#if GL_EXT_timer_query
interface->fGetQueryObjecti64v = glGetQueryObjecti64vEXT;
interface->fGetQueryObjectui64v = glGetQueryObjectui64vEXT;
@@ -186,7 +190,7 @@
#endif
}
- if (ver >= GR_GL_VER(3,0) || GrGLHasExtensionFromString("GL_ARB_framebuffer_object", extStr)) {
+ if (ver >= GR_GL_VER(3,0) || extensions.has("GL_ARB_framebuffer_object")) {
// ARB extension doesn't use the ARB suffix on the function names
#if GL_VERSION_3_0 || GL_ARB_framebuffer_object
interface->fGenFramebuffers = glGenFramebuffers;
@@ -220,7 +224,7 @@
interface->fBlitFramebuffer = GET_PROC(BlitFramebuffer);
#endif
} else {
- if (GrGLHasExtensionFromString("GL_EXT_framebuffer_object", extStr)) {
+ if (extensions.has("GL_EXT_framebuffer_object")) {
#if GL_EXT_framebuffer_object
interface->fGenFramebuffers = glGenFramebuffersEXT;
interface->fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT;
@@ -249,14 +253,14 @@
interface->fBindRenderbuffer = GET_PROC_SUFFIX(BindRenderbuffer, EXT);
#endif
}
- if (GrGLHasExtensionFromString("GL_EXT_framebuffer_multisample", extStr)) {
+ if (extensions.has("GL_EXT_framebuffer_multisample")) {
#if GL_EXT_framebuffer_multisample
interface->fRenderbufferStorageMultisample = glRenderbufferStorageMultisampleEXT;
#else
interface->fRenderbufferStorageMultisample = GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT);
#endif
}
- if (GrGLHasExtensionFromString("", extStr)) {
+ if (extensions.has("GL_EXT_framebuffer_blit")) {
#if GL_EXT_framebuffer_blit
interface->fBlitFramebuffer = glBlitFramebufferEXT;
#else
@@ -264,7 +268,7 @@
#endif
}
}
- if (ver >= GR_GL_VER(3,3) || GrGLHasExtensionFromString("GL_ARB_blend_func_extended", extStr)) {
+ if (ver >= GR_GL_VER(3,3) || extensions.has("GL_ARB_blend_func_extended")) {
// ARB extension doesn't use the ARB suffix on the function name
#if GL_VERSION_3_3 || GL_ARB_blend_func_extended
interface->fBindFragDataLocationIndexed = glBindFragDataLocationIndexed;
@@ -272,8 +276,6 @@
interface->fBindFragDataLocationIndexed = GET_PROC(BindFragDataLocationIndexed);
#endif
}
-
- interface->fBindingsExported = kDesktop_GrGLBinding;
}
glInterface.get()->ref();
return glInterface.get();
« no previous file with comments | « src/gpu/gl/debug/GrGLCreateDebugInterface.cpp ('k') | src/gpu/gl/mac/SkNativeGLContext_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698