Commit 725e8cde authored by Simon La Macchia's avatar Simon La Macchia Committed by Commit Bot

Reset GLManager so it can be reused with ES2 context

Problem: When the GLVirtualContextsTest tests are run on a device with
Open GL ES 2.0, the tests fail during initialization because it tries
to re-initialize a GLManager (gl_real_) after failing to initialize as
content type ES 3.0. The problem being theat the gl_real_ is now in
an inconsistent state and cannot be initialized again.

Solution: Reset the GLManager (gl_real_) after failing to be
initialized as ES3, so that it can be re-tried as ES2.

Bug: None
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Idb0a6947baa80c3135418504e77458171eebe1fa
Reviewed-on: https://chromium-review.googlesource.com/999268Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548838}
parent 2813d7fc
...@@ -603,4 +603,9 @@ void GLManager::SetSnapshotRequested() {} ...@@ -603,4 +603,9 @@ void GLManager::SetSnapshotRequested() {}
ContextType GLManager::GetContextType() const { ContextType GLManager::GetContextType() const {
return context_type_; return context_type_;
} }
void GLManager::Reset() {
Destroy();
SetupBaseContext();
}
} // namespace gpu } // namespace gpu
...@@ -163,6 +163,8 @@ class GLManager : private GpuControl { ...@@ -163,6 +163,8 @@ class GLManager : private GpuControl {
size_t GetSharedMemoryBytesAllocated() const; size_t GetSharedMemoryBytesAllocated() const;
ContextType GetContextType() const; ContextType GetContextType() const;
void Reset();
private: private:
void SetupBaseContext(); void SetupBaseContext();
......
...@@ -33,6 +33,7 @@ class GLVirtualContextsTest ...@@ -33,6 +33,7 @@ class GLVirtualContextsTest
// If the gl_real context is not initialised, switch to ES2 context type // If the gl_real context is not initialised, switch to ES2 context type
// and re-initialise // and re-initialise
if (!gl_real_.IsInitialized()) { if (!gl_real_.IsInitialized()) {
gl_real_.Reset(); // Must reset object before initializing again
options.context_type = CONTEXT_TYPE_OPENGLES2; options.context_type = CONTEXT_TYPE_OPENGLES2;
gl_real_.InitializeWithWorkarounds(options, workarounds); gl_real_.InitializeWithWorkarounds(options, workarounds);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment