diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-08-05 11:35:53 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-08-05 11:35:53 +0200 |
commit | 6bd66b1728eeddb058066edda740aaeb2ceaec23 (patch) | |
tree | 985faf01c526763515731569fa01a99f4dbef36e /gfx/angle/src/tests/test_utils/ANGLETest.cpp | |
parent | e0a8dcfed131ffa58a5e2cb1d30fe48c745c2fdc (diff) | |
parent | 559824514dc95e02fbe81f1786e6ac13ee8e9d55 (diff) | |
download | UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar.gz UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar.lz UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.tar.xz UXP-6bd66b1728eeddb058066edda740aaeb2ceaec23.zip |
Merge branch 'master' into js-modules
Diffstat (limited to 'gfx/angle/src/tests/test_utils/ANGLETest.cpp')
-rwxr-xr-x | gfx/angle/src/tests/test_utils/ANGLETest.cpp | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/gfx/angle/src/tests/test_utils/ANGLETest.cpp b/gfx/angle/src/tests/test_utils/ANGLETest.cpp index 77f1d8dec..1a9d8b50f 100755 --- a/gfx/angle/src/tests/test_utils/ANGLETest.cpp +++ b/gfx/angle/src/tests/test_utils/ANGLETest.cpp @@ -30,6 +30,8 @@ const GLColor GLColor::transparentBlack = GLColor(0u, 0u, 0u, 0u); const GLColor GLColor::white = GLColor(255u, 255u, 255u, 255u); const GLColor GLColor::yellow = GLColor(255u, 255u, 0, 255u); +const GLColor16 GLColor16::white = GLColor16(65535u, 65535u, 65535u, 65535u); + namespace { float ColorNorm(GLubyte channelValue) @@ -136,6 +138,14 @@ GLColor::GLColor(const Vector4 &floatColor) { } +GLColor::GLColor(const GLColor16 &color16) + : R(static_cast<GLubyte>(color16.R)), + G(static_cast<GLubyte>(color16.G)), + B(static_cast<GLubyte>(color16.B)), + A(static_cast<GLubyte>(color16.A)) +{ +} + GLColor::GLColor(GLuint colorValue) : R(0), G(0), B(0), A(0) { memcpy(&R, &colorValue, sizeof(GLuint)); @@ -167,6 +177,35 @@ std::ostream &operator<<(std::ostream &ostream, const GLColor &color) return ostream; } +GLColor16::GLColor16() : R(0), G(0), B(0), A(0) +{ +} + +GLColor16::GLColor16(GLushort r, GLushort g, GLushort b, GLushort a) : R(r), G(g), B(b), A(a) +{ +} + +GLColor16 ReadColor16(GLint x, GLint y) +{ + GLColor16 actual; + glReadPixels((x), (y), 1, 1, GL_RGBA, GL_UNSIGNED_SHORT, &actual.R); + EXPECT_GL_NO_ERROR(); + return actual; +} + +bool operator==(const GLColor16 &a, const GLColor16 &b) +{ + return a.R == b.R && a.G == b.G && a.B == b.B && a.A == b.A; +} + +std::ostream &operator<<(std::ostream &ostream, const GLColor16 &color) +{ + ostream << "(" << static_cast<unsigned int>(color.R) << ", " + << static_cast<unsigned int>(color.G) << ", " << static_cast<unsigned int>(color.B) + << ", " << static_cast<unsigned int>(color.A) << ")"; + return ostream; +} + } // namespace angle // static @@ -549,14 +588,6 @@ bool ANGLETest::eglClientExtensionEnabled(const std::string &extName) return checkExtensionExists(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS), extName); } -bool ANGLETest::eglDeviceExtensionEnabled(EGLDeviceEXT device, const std::string &extName) -{ - PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT = - reinterpret_cast<PFNEGLQUERYDEVICESTRINGEXTPROC>( - eglGetProcAddress("eglQueryDeviceStringEXT")); - return checkExtensionExists(eglQueryDeviceStringEXT(device, EGL_EXTENSIONS), extName); -} - void ANGLETest::setWindowWidth(int width) { mWidth = width; @@ -612,16 +643,6 @@ void ANGLETest::setNoErrorEnabled(bool enabled) mEGLWindow->setNoErrorEnabled(enabled); } -void ANGLETest::setWebGLCompatibilityEnabled(bool webglCompatibility) -{ - mEGLWindow->setWebGLCompatibilityEnabled(webglCompatibility); -} - -void ANGLETest::setBindGeneratesResource(bool bindGeneratesResource) -{ - mEGLWindow->setBindGeneratesResource(bindGeneratesResource); -} - int ANGLETest::getClientMajorVersion() const { return mEGLWindow->getClientMajorVersion(); @@ -794,20 +815,6 @@ bool IsWindows() #endif } -bool IsDebug() -{ -#if !defined(NDEBUG) - return true; -#else - return false; -#endif -} - -bool IsRelease() -{ - return !IsDebug(); -} - EGLint ANGLETest::getPlatformRenderer() const { assert(mEGLWindow); |