Add helpers for checking EGL extension availablity in tests.

Also make sure that EGL_EGLEXT_PROTOTYPES is always defined so that
extension functions can be used without loading them.

BUG=angleproject:970

Change-Id: I33fa3e8ed68aeda55ad69e1bc7826646f5e3ce29
Reviewed-on: https://chromium-review.googlesource.com/287161
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
Geoff Lang 2015-07-21 12:43:50 -04:00
Родитель ea7c5c19c8
Коммит 63046e2ba2
3 изменённых файлов: 23 добавлений и 2 удалений

Просмотреть файл

@ -121,10 +121,25 @@ GLuint ANGLETest::compileShader(GLenum type, const std::string &source)
return shader;
}
static bool checkExtensionExists(const char *allExtensions, const std::string &extName)
{
return strstr(allExtensions, extName.c_str()) != nullptr;
}
bool ANGLETest::extensionEnabled(const std::string &extName)
{
const char* extString = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
return strstr(extString, extName.c_str()) != NULL;
return checkExtensionExists(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)),
extName);
}
bool ANGLETest::eglDisplayExtensionEnabled(EGLDisplay display, const std::string &extName)
{
return checkExtensionExists(eglQueryString(display, EGL_EXTENSIONS), extName);
}
bool ANGLETest::eglClientExtensionEnabled(const std::string &extName)
{
return checkExtensionExists(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS), extName);
}
void ANGLETest::setWindowWidth(int width)

Просмотреть файл

@ -7,6 +7,9 @@
#ifndef ANGLE_TESTS_ANGLE_TEST_H_
#define ANGLE_TESTS_ANGLE_TEST_H_
#define GL_GLEXT_PROTOTYPES
#define EGL_EGLEXT_PROTOTYPES
#include <gtest/gtest.h>
#include <algorithm>
@ -76,6 +79,8 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters>
static void drawQuad(GLuint program, const std::string& positionAttribName, GLfloat quadDepth, GLfloat quadScale = 1.0f);
static GLuint compileShader(GLenum type, const std::string &source);
static bool extensionEnabled(const std::string &extName);
static bool eglDisplayExtensionEnabled(EGLDisplay display, const std::string &extName);
static bool eglClientExtensionEnabled(const std::string &extName);
void setWindowWidth(int width);
void setWindowHeight(int height);

Просмотреть файл

@ -8,6 +8,7 @@
#define UTIL_EGLWINDOW_H_
#define GL_GLEXT_PROTOTYPES
#define EGL_EGLEXT_PROTOTYPES
#include <GLES3/gl3.h>
#include <GLES3/gl3ext.h>