summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/tests
diff options
context:
space:
mode:
authormarkusheintz <markusheintz@chromium.org>2016-02-19 07:49:31 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-19 15:51:50 +0000
commitbe8017a38ab65cf3e2e9692767c23f15144be686 (patch)
treeee9fc548fd1f4a00bb856462b7ba131adfde746c /gpu/command_buffer/tests
parent82369343882999c0829645d6559d4f3180c4f29e (diff)
downloadchromium_src-be8017a38ab65cf3e2e9692767c23f15144be686.zip
chromium_src-be8017a38ab65cf3e2e9692767c23f15144be686.tar.gz
chromium_src-be8017a38ab65cf3e2e9692767c23f15144be686.tar.bz2
Revert of Only call gles2::Terminate when all Display objects are deleted (patchset #3 id:40001 of )
Reason for revert: Does not compile on win c:\b\build\slave\win\build\src\gpu\command_buffer\tests\egl_test.cc(87) : error C2059: syntax error : '(' c:\b\build\slave\win\build\src\gpu\command_buffer\tests\egl_test.cc(90) : error C2061: syntax error : identifier 'glEnableProc' c:\b\build\slave\win\build\src\gpu\command_buffer\tests\egl_test.cc(91) : error C3536: 'GLES2Enable': cannot be used before it is initialized c:\b\build\slave\win\build\src\gpu\command_buffer\tests\egl_test.cc(91) : error C2064: term does not evaluate to a function taking 1 arguments https://build.chromium.org/p/chromium/builders/Win/builds/40478/steps/compile/logs/stdio Original issue's description: > Only call gles2::Terminate when all Display objects are deleted > > Implementation in command buffer EGL calls gles2::Terminate and gles2::Initialize incorrectly. If there are multiple Display objects each will call Initialize and Terminate and creates and frees the TLS allocated context key twice. It should only be created once and freed once all the Displays are deleted. > > BUG=skia:2992 > > Committed: https://crrev.com/c22b484a0aaabbfbce221b419da48bca080e7826 > Cr-Commit-Position: refs/heads/master@{#376439} TBR=piman@chromium.org,kkinnunen@nvidia.com,svaisanen@nvidia.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:2992 Review URL: https://codereview.chromium.org/1714023002 Cr-Commit-Position: refs/heads/master@{#376443}
Diffstat (limited to 'gpu/command_buffer/tests')
-rw-r--r--gpu/command_buffer/tests/egl_test.cc107
1 files changed, 1 insertions, 106 deletions
diff --git a/gpu/command_buffer/tests/egl_test.cc b/gpu/command_buffer/tests/egl_test.cc
index 4223308..bf7e30e 100644
--- a/gpu/command_buffer/tests/egl_test.cc
+++ b/gpu/command_buffer/tests/egl_test.cc
@@ -6,7 +6,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include <EGL/egl.h>
-#include <GLES2/gl2.h>
// This file tests EGL basic interface for command_buffer_gles2, the mode of
// command buffer where the code is compiled as a standalone dynamic library and
@@ -34,108 +33,4 @@ TEST_F(Test, BasicEGLInitialization) {
ASSERT_TRUE(success);
}
-class TestContext {
- public:
- TestContext() {
- display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-
- eglInitialize(display_, nullptr, nullptr);
-
- static const EGLint configAttribs[] = {
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_NONE
- };
- EGLint numConfigs;
- EGLConfig config;
- eglChooseConfig(display_, configAttribs, &config, 1, &numConfigs);
-
- static const EGLint surfaceAttribs[] = {
- EGL_WIDTH, 1,
- EGL_HEIGHT, 1,
- EGL_NONE
- };
- surface_ = eglCreatePbufferSurface(display_, config, surfaceAttribs);
-
- static const EGLint contextAttribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
- context_ = eglCreateContext(display_, config, nullptr, contextAttribs);
- }
-
- ~TestContext() {
- eglMakeCurrent(display_, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- eglDestroyContext(display_, context_);
- eglDestroySurface(display_, surface_);
- eglTerminate(display_);
- }
-
- bool IsValid() const {
- return display_ != EGL_NO_DISPLAY &&
- context_ != EGL_NO_CONTEXT &&
- surface_ != EGL_NO_SURFACE;
- }
-
- void TestCallGL() {
- eglMakeCurrent(display_, surface_, surface_, context_);
-
- typedef GL_APICALL void GL_APIENTRY (*glEnableProc)(GLenum);
-
- auto address = eglGetProcAddress("glEnable");
- auto* glEnable = reinterpret_cast<glEnableProc>(address);
- glEnable(GL_BLEND);
- }
-
- private:
- TestContext(const TestContext&) = delete;
- TestContext& operator=(const TestContext&) = delete;
-
- private:
- EGLDisplay display_;
- EGLContext context_;
- EGLSurface surface_;
-};
-
-// Test case for a workaround for an issue in gles2_conform_support.
-//
-// The problem is that every call to eglGetDisplay(EGL_DEFAULT_DISPLAY)
-// returns a new display object and the construction of each display
-// calls to establish a thread local store variable in where to store the
-// current command buffer context.
-// Likewise the destructor of display calls to free the same tls variable.
-//
-// When skia (nanobench) uses multiple instances of command buffer
-// based contexts and one display is destroyed the TLS variable
-// is also destroyed and subsequent command buffer GL calls using another
-// context instance end up accessing free'ed TLS variable.
-//
-// Note that technically there's also a problem in SkCommandBufferContext
-// since it calls eglTerminate for each display, but this is because
-// the current command buffer egl implementation requires this.
-// Overall this functionality is not aligned with the EGL spefication.
-//
-// This testcase tests that we can create multiple command buffer contexts
-// and dispose them without affecting the other.
-TEST(Test, MultipleDisplays) {
- TestContext first;
- ASSERT_TRUE(first.IsValid());
-
- first.TestCallGL();
-
- {
- TestContext second;
- ASSERT_TRUE(second.IsValid());
-
- second.TestCallGL();
- }
-
- first.TestCallGL();
-}
-
-} // namespace gpu
-
+} // namespace gpu