Commit 761b02c8 by Jamie Madill Committed by Commit Bot

Add an applyNativeWorkarounds context impl hook.

This method can allow the implementation to override the Context's workarounds. Use this design pattern now that we have access to the gl::Context everywhere - we don't need to cache a local copy in the Renderer objects. This will be used to apply a Shader Program Cache workaround on the GL level, that will only be used for the GLES back-end on Qualcomm. BUG=angleproject:2088 Change-Id: I6da25c5c29c3ba01b8820c5234d1b92dd2d2121a Reviewed-on: https://chromium-review.googlesource.com/549980Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 5fdaa2e3
......@@ -2810,6 +2810,9 @@ void Context::updateCaps()
void Context::initWorkarounds()
{
// Apply back-end workarounds.
mImplementation->applyNativeWorkarounds(&mWorkarounds);
// Lose the context upon out of memory error if the application is
// expecting to watch for those events.
mWorkarounds.loseContextOnOutOfMemory = (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
......
......@@ -19,6 +19,7 @@
namespace gl
{
class Path;
struct Workarounds;
}
namespace rx
......@@ -150,6 +151,8 @@ class ContextImpl : public GLImplFactory
virtual const gl::Extensions &getNativeExtensions() const = 0;
virtual const gl::Limitations &getNativeLimitations() const = 0;
virtual void applyNativeWorkarounds(gl::Workarounds *workarounds) const {}
virtual gl::Error dispatchCompute(const gl::Context *context,
GLuint numGroupsX,
GLuint numGroupsY,
......
......@@ -380,6 +380,11 @@ const gl::Limitations &ContextGL::getNativeLimitations() const
return mRenderer->getNativeLimitations();
}
void ContextGL::applyNativeWorkarounds(gl::Workarounds *workarounds) const
{
return mRenderer->applyNativeWorkarounds(workarounds);
}
const FunctionsGL *ContextGL::getFunctions() const
{
return mRenderer->getFunctions();
......
......@@ -183,6 +183,8 @@ class ContextGL : public ContextImpl
const gl::Extensions &getNativeExtensions() const override;
const gl::Limitations &getNativeLimitations() const override;
void applyNativeWorkarounds(gl::Workarounds *workarounds) const override;
// Handle helpers
const FunctionsGL *getFunctions() const;
StateManagerGL *getStateManager();
......
......@@ -655,6 +655,12 @@ const gl::Limitations &RendererGL::getNativeLimitations() const
return mNativeLimitations;
}
void RendererGL::applyNativeWorkarounds(gl::Workarounds *workarounds) const
{
ensureCapsInitialized();
nativegl_gl::ApplyWorkarounds(mFunctions, workarounds);
}
gl::Error RendererGL::dispatchCompute(const gl::Context *context,
GLuint numGroupsX,
GLuint numGroupsY,
......
......@@ -19,6 +19,7 @@ namespace gl
class ContextState;
struct IndexRange;
class Path;
struct Workarounds;
}
namespace egl
......@@ -165,6 +166,7 @@ class RendererGL : angle::NonCopyable
const gl::TextureCapsMap &getNativeTextureCaps() const;
const gl::Extensions &getNativeExtensions() const;
const gl::Limitations &getNativeLimitations() const;
void applyNativeWorkarounds(gl::Workarounds *workarounds) const;
gl::Error dispatchCompute(const gl::Context *context,
GLuint numGroupsX,
......
......@@ -14,6 +14,7 @@
#include "common/mathutil.h"
#include "libANGLE/Buffer.h"
#include "libANGLE/Caps.h"
#include "libANGLE/Workarounds.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/gl/FunctionsGL.h"
#include "libANGLE/renderer/gl/QueryGL.h"
......@@ -1030,6 +1031,11 @@ void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workaround
#endif
}
void ApplyWorkarounds(const FunctionsGL *functions, gl::Workarounds *workarounds)
{
// TODO(jmadill): Workarounds for GL.
}
} // namespace nativegl_gl
namespace nativegl
......
......@@ -25,6 +25,7 @@ struct Caps;
class TextureCapsMap;
struct Extensions;
struct Version;
struct Workarounds;
}
namespace rx
......@@ -46,6 +47,7 @@ void GenerateCaps(const FunctionsGL *functions,
gl::Version *maxSupportedESVersion);
void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workarounds);
void ApplyWorkarounds(const FunctionsGL *functions, gl::Workarounds *workarounds);
}
namespace nativegl
......
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