Commit 4c32feb1 by Yuly Novikov Committed by Commit Bot

Pause TransformFeedback before eglMakeCurrent.

On Android Adreno eglMakeCurrent resets TransformFeedback position. Workaround is to pause TransformFeedback before eglMakeCurrent and resume afterwards. BUG=angleproject:1426 TEST=TransformFeedbackTest.MultiContext Change-Id: I4fdb9edbd28b4b16c01d1a94419e78160b31b79f Reviewed-on: https://chromium-review.googlesource.com/355676Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
parent 3f23406a
...@@ -9,10 +9,12 @@ ...@@ -9,10 +9,12 @@
#include "libANGLE/renderer/gl/DisplayGL.h" #include "libANGLE/renderer/gl/DisplayGL.h"
#include "libANGLE/AttributeMap.h" #include "libANGLE/AttributeMap.h"
#include "libANGLE/Context.h"
#include "libANGLE/Display.h" #include "libANGLE/Display.h"
#include "libANGLE/Surface.h" #include "libANGLE/Surface.h"
#include "libANGLE/renderer/gl/ContextGL.h" #include "libANGLE/renderer/gl/ContextGL.h"
#include "libANGLE/renderer/gl/RendererGL.h" #include "libANGLE/renderer/gl/RendererGL.h"
#include "libANGLE/renderer/gl/StateManagerGL.h"
#include "libANGLE/renderer/gl/SurfaceGL.h" #include "libANGLE/renderer/gl/SurfaceGL.h"
#include <EGL/eglext.h> #include <EGL/eglext.h>
...@@ -76,6 +78,10 @@ egl::Error DisplayGL::makeCurrent(egl::Surface *drawSurface, egl::Surface *readS ...@@ -76,6 +78,10 @@ egl::Error DisplayGL::makeCurrent(egl::Surface *drawSurface, egl::Surface *readS
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
// Pause transform feedback before making a new surface current, to workaround anglebug.com/1426
ContextGL *glContext = GetImplAs<ContextGL>(context);
glContext->getStateManager()->pauseTransformFeedback(context->getContextState());
SurfaceGL *glDrawSurface = GetImplAs<SurfaceGL>(drawSurface); SurfaceGL *glDrawSurface = GetImplAs<SurfaceGL>(drawSurface);
return glDrawSurface->makeCurrent(); return glDrawSurface->makeCurrent();
} }
......
...@@ -658,18 +658,26 @@ gl::Error StateManagerGL::setDrawElementsState(const gl::ContextState &data, ...@@ -658,18 +658,26 @@ gl::Error StateManagerGL::setDrawElementsState(const gl::ContextState &data,
return setGenericDrawState(data); return setGenericDrawState(data);
} }
gl::Error StateManagerGL::onMakeCurrent(const gl::ContextState &data) gl::Error StateManagerGL::pauseTransformFeedback(const gl::ContextState &data)
{ {
const gl::State &state = data.getState(); // If the context is going to be changed, pause the previous context's transform feedback
// If the context has changed, pause the previous context's transform feedback and queries
if (data.getContext() != mPrevDrawContext) if (data.getContext() != mPrevDrawContext)
{ {
if (mPrevDrawTransformFeedback != nullptr) if (mPrevDrawTransformFeedback != nullptr)
{ {
mPrevDrawTransformFeedback->syncPausedState(true); mPrevDrawTransformFeedback->syncPausedState(true);
} }
}
return gl::Error(GL_NO_ERROR);
}
gl::Error StateManagerGL::onMakeCurrent(const gl::ContextState &data)
{
const gl::State &state = data.getState();
// If the context has changed, pause the previous context's queries
if (data.getContext() != mPrevDrawContext)
{
for (QueryGL *prevQuery : mCurrentQueries) for (QueryGL *prevQuery : mCurrentQueries)
{ {
prevQuery->pause(); prevQuery->pause();
......
...@@ -146,6 +146,7 @@ class StateManagerGL final : angle::NonCopyable ...@@ -146,6 +146,7 @@ class StateManagerGL final : angle::NonCopyable
GLsizei instanceCount, GLsizei instanceCount,
const GLvoid **outIndices); const GLvoid **outIndices);
gl::Error pauseTransformFeedback(const gl::ContextState &data);
gl::Error onMakeCurrent(const gl::ContextState &data); gl::Error onMakeCurrent(const gl::ContextState &data);
void syncState(const gl::State &state, const gl::State::DirtyBits &glDirtyBits); void syncState(const gl::State &state, const gl::State::DirtyBits &glDirtyBits);
......
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