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

Unified Diff: src/gpu/gl/SkGLContext.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/GrGLUtil.cpp ('k') | src/gpu/gl/debug/GrGLCreateDebugInterface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/SkGLContext.cpp
===================================================================
--- src/gpu/gl/SkGLContext.cpp (revision 7868)
+++ src/gpu/gl/SkGLContext.cpp (working copy)
@@ -6,7 +6,7 @@
* found in the LICENSE file.
*/
#include "gl/SkGLContext.h"
-#include "gl/GrGLUtil.h"
+#include "GrGLUtil.h"
SK_DEFINE_INST_COUNT(SkGLContext)
@@ -29,10 +29,6 @@
SkSafeUnref(fGL);
}
-bool SkGLContext::hasExtension(const char* extensionName) const {
- return GrGLHasExtensionFromString(extensionName, fExtensionString.c_str());
-}
-
bool SkGLContext::init(int width, int height) {
if (fGL) {
fGL->unref();
@@ -43,9 +39,14 @@
if (fGL) {
const GrGLubyte* temp;
- SK_GL_RET(*this, temp, GetString(GR_GL_EXTENSIONS));
- fExtensionString = reinterpret_cast<const char*>(temp);
+ GrGLBinding bindingInUse = GrGLGetBindingInUse(this->gl());
+ if (!fGL->validate(bindingInUse) || !fExtensions.init(bindingInUse, fGL)) {
+ fGL = NULL;
+ this->destroyGLContext();
+ return false;
+ }
+
SK_GL_RET(*this, temp, GetString(GR_GL_VERSION));
const char* versionStr = reinterpret_cast<const char*>(temp);
GrGLVersion version = GrGLGetVersionFromString(versionStr);
@@ -56,8 +57,6 @@
SK_GL_RET(*this, error, GetError());
} while (GR_GL_NO_ERROR != error);
- GrGLBinding bindingInUse = GrGLGetBindingInUse(this->gl());
-
SK_GL(*this, GenFramebuffers(1, &fFBO));
SK_GL(*this, BindFramebuffer(GR_GL_FRAMEBUFFER, fFBO));
SK_GL(*this, GenRenderbuffers(1, &fColorBufferID));
@@ -83,12 +82,11 @@
// depth stencil being available.
bool supportsPackedDepthStencil;
if (kES2_GrGLBinding == bindingInUse) {
- supportsPackedDepthStencil =
- this->hasExtension("GL_OES_packed_depth_stencil");
+ supportsPackedDepthStencil = this->hasExtension("GL_OES_packed_depth_stencil");
} else {
supportsPackedDepthStencil = version >= GR_GL_VER(3,0) ||
- this->hasExtension("GL_EXT_packed_depth_stencil") ||
- this->hasExtension("GL_ARB_framebuffer_object");
+ this->hasExtension("GL_EXT_packed_depth_stencil") ||
+ this->hasExtension("GL_ARB_framebuffer_object");
}
if (supportsPackedDepthStencil) {
« no previous file with comments | « src/gpu/gl/GrGLUtil.cpp ('k') | src/gpu/gl/debug/GrGLCreateDebugInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698