зеркало из https://github.com/AvaloniaUI/angle.git
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:
Родитель
ea7c5c19c8
Коммит
63046e2ba2
|
@ -121,10 +121,25 @@ GLuint ANGLETest::compileShader(GLenum type, const std::string &source)
|
||||||
return shader;
|
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)
|
bool ANGLETest::extensionEnabled(const std::string &extName)
|
||||||
{
|
{
|
||||||
const char* extString = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
|
return checkExtensionExists(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)),
|
||||||
return strstr(extString, extName.c_str()) != NULL;
|
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)
|
void ANGLETest::setWindowWidth(int width)
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
#ifndef ANGLE_TESTS_ANGLE_TEST_H_
|
#ifndef ANGLE_TESTS_ANGLE_TEST_H_
|
||||||
#define ANGLE_TESTS_ANGLE_TEST_H_
|
#define ANGLE_TESTS_ANGLE_TEST_H_
|
||||||
|
|
||||||
|
#define GL_GLEXT_PROTOTYPES
|
||||||
|
#define EGL_EGLEXT_PROTOTYPES
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <algorithm>
|
#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 void drawQuad(GLuint program, const std::string& positionAttribName, GLfloat quadDepth, GLfloat quadScale = 1.0f);
|
||||||
static GLuint compileShader(GLenum type, const std::string &source);
|
static GLuint compileShader(GLenum type, const std::string &source);
|
||||||
static bool extensionEnabled(const std::string &extName);
|
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 setWindowWidth(int width);
|
||||||
void setWindowHeight(int height);
|
void setWindowHeight(int height);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#define UTIL_EGLWINDOW_H_
|
#define UTIL_EGLWINDOW_H_
|
||||||
|
|
||||||
#define GL_GLEXT_PROTOTYPES
|
#define GL_GLEXT_PROTOTYPES
|
||||||
|
#define EGL_EGLEXT_PROTOTYPES
|
||||||
|
|
||||||
#include <GLES3/gl3.h>
|
#include <GLES3/gl3.h>
|
||||||
#include <GLES3/gl3ext.h>
|
#include <GLES3/gl3ext.h>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче