diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-11 23:29:50 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-11 23:31:02 +0200 |
commit | 70dd5e7c66b1fe3f82e5b4db2406050baba15f05 (patch) | |
tree | 3f012200ef3c934f33db1a4ef2b790fae3141860 /gfx/angle/src/tests/test_utils/ANGLETest.cpp | |
parent | 3b7ffb477eec078c7036c92c6a51bb5de6de4f28 (diff) | |
parent | 8481fa25d246f1968d0a254ee3c6cdd82c60781a (diff) | |
download | UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.gz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.lz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.xz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.zip |
Merge branch 'ANGLE-rollback'
This resolves #624
Note: Cherry-picked some fixes on top of the ANGLE version that we want to keep.
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); |