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

Unified Diff: include/gpu/gl/GrGLExtensions.h

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
Index: include/gpu/gl/GrGLExtensions.h
===================================================================
--- include/gpu/gl/GrGLExtensions.h (revision 0)
+++ include/gpu/gl/GrGLExtensions.h (revision 0)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrGLExtensions_DEFINED
+#define GrGLExtensions_DEFINED
+
+#include "GrGLInterface.h"
+#include "SkString.h"
+#include "SkTArray.h"
+
+/**
+ * This helper queries the current GL context for its extensions, remembers them, and can be
+ * queried. It supports both glGetString- and glGetStringi-style extension string APIs and will
+ * use the latter if it is available.
+ */
+class GrGLExtensions {
+public:
+ bool init(GrGLBinding binding, const GrGLInterface* iface) {
+ GrAssert(binding & iface->fBindingsExported);
+ return this->init(binding, iface->fGetString, iface->fGetStringi, iface->fGetIntegerv);
+ }
+ /**
robertphillips 2013/02/26 21:06:07 Doesn't it expect getString to always be non-NULL
bsalomon 2013/02/26 21:32:51 Hmm... I suppose that is true in the implementatio
+ * We sometimes need to use this class without having yet created a GrGLInterface. This version
+ * of init expects that getString and getIntegerv are always non-NULL while getStringi is non-
+ * NULL if the GL context's version is 3.0 or higher. Otherwise it will fail.
+ */
+ bool init(GrGLBinding binding,
+ GrGLGetStringProc getString,
+ GrGLGetStringiProc getStringi,
robertphillips 2013/02/26 21:06:07 getIntegerv?
bsalomon 2013/02/26 21:32:51 Done.
+ GrGLGetIntegervProc getIntegeriv);
+
+ /**
+ * Queries whether an extension is present. This will fail if init() has not been called.
+ */
+ bool has(const char*) const;
+
+ void reset() { fStrings.reset(); }
+
+private:
+ SkTArray<SkString> fStrings;
+};
+
+#endif
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/gl/GrGLFunctions.h » ('j') | src/gpu/gl/GrGLExtensions.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698