Commit 94b3a078 by Corentin Wallez

Factor GL extension parsing in renderergl_utils.cpp

DisplayGLX will use it for the GLX extensions too. BUG=angleproject:892 Change-Id: I5e4f80776a558fcdcc7e7b83767145112bcfee98 Reviewed-on: https://chromium-review.googlesource.com/269461Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 06e24a7e
...@@ -40,20 +40,6 @@ static void GetGLVersion(PFNGLGETSTRINGPROC getStringFunction, GLuint *outMajorV ...@@ -40,20 +40,6 @@ static void GetGLVersion(PFNGLGETSTRINGPROC getStringFunction, GLuint *outMajorV
} }
} }
static std::vector<std::string> GetNonIndexedExtensions(PFNGLGETSTRINGPROC getStringFunction)
{
std::vector<std::string> result;
std::istringstream stream(reinterpret_cast<const char*>(getStringFunction(GL_EXTENSIONS)));
std::string extension;
while (std::getline(stream, extension, ' '))
{
result.push_back(extension);
}
return result;
}
static std::vector<std::string> GetIndexedExtensions(PFNGLGETINTEGERVPROC getIntegerFunction, PFNGLGETSTRINGIPROC getStringIFunction) static std::vector<std::string> GetIndexedExtensions(PFNGLGETINTEGERVPROC getIntegerFunction, PFNGLGETSTRINGIPROC getStringIFunction)
{ {
std::vector<std::string> result; std::vector<std::string> result;
...@@ -792,7 +778,8 @@ void FunctionsGL::initialize() ...@@ -792,7 +778,8 @@ void FunctionsGL::initialize()
} }
else else
{ {
extensions = GetNonIndexedExtensions(getString); const char *exts = reinterpret_cast<const char*>(getString(GL_EXTENSIONS));
extensions = TokenizeExtensionsString(exts);
} }
// 1.0 // 1.0
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "libANGLE/renderer/gl/formatutilsgl.h" #include "libANGLE/renderer/gl/formatutilsgl.h"
#include <algorithm> #include <algorithm>
#include <sstream>
namespace rx namespace rx
{ {
...@@ -160,4 +161,18 @@ void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsM ...@@ -160,4 +161,18 @@ void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsM
} }
std::vector<std::string> TokenizeExtensionsString(const char *extensions)
{
std::vector<std::string> result;
std::istringstream stream(extensions);
std::string extension;
while (std::getline(stream, extension, ' '))
{
result.push_back(extension);
}
return result;
}
} }
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "libANGLE/renderer/gl/functionsgl_typedefs.h" #include "libANGLE/renderer/gl/functionsgl_typedefs.h"
#include <string>
#include <vector> #include <vector>
namespace gl namespace gl
...@@ -30,9 +31,9 @@ namespace nativegl_gl ...@@ -30,9 +31,9 @@ namespace nativegl_gl
void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap, void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap,
gl::Extensions *extensions); gl::Extensions *extensions);
} }
std::vector<std::string> TokenizeExtensionsString(const char *extensions);
} }
#endif // LIBANGLE_RENDERER_GL_RENDERERGLUTILS_H_ #endif // LIBANGLE_RENDERER_GL_RENDERERGLUTILS_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment