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() ...@@ -2810,6 +2810,9 @@ void Context::updateCaps()
void Context::initWorkarounds() void Context::initWorkarounds()
{ {
// Apply back-end workarounds.
mImplementation->applyNativeWorkarounds(&mWorkarounds);
// Lose the context upon out of memory error if the application is // Lose the context upon out of memory error if the application is
// expecting to watch for those events. // expecting to watch for those events.
mWorkarounds.loseContextOnOutOfMemory = (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT); mWorkarounds.loseContextOnOutOfMemory = (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
namespace gl namespace gl
{ {
class Path; class Path;
struct Workarounds;
} }
namespace rx namespace rx
...@@ -150,6 +151,8 @@ class ContextImpl : public GLImplFactory ...@@ -150,6 +151,8 @@ class ContextImpl : public GLImplFactory
virtual const gl::Extensions &getNativeExtensions() const = 0; virtual const gl::Extensions &getNativeExtensions() const = 0;
virtual const gl::Limitations &getNativeLimitations() const = 0; virtual const gl::Limitations &getNativeLimitations() const = 0;
virtual void applyNativeWorkarounds(gl::Workarounds *workarounds) const {}
virtual gl::Error dispatchCompute(const gl::Context *context, virtual gl::Error dispatchCompute(const gl::Context *context,
GLuint numGroupsX, GLuint numGroupsX,
GLuint numGroupsY, GLuint numGroupsY,
......
...@@ -380,6 +380,11 @@ const gl::Limitations &ContextGL::getNativeLimitations() const ...@@ -380,6 +380,11 @@ const gl::Limitations &ContextGL::getNativeLimitations() const
return mRenderer->getNativeLimitations(); return mRenderer->getNativeLimitations();
} }
void ContextGL::applyNativeWorkarounds(gl::Workarounds *workarounds) const
{
return mRenderer->applyNativeWorkarounds(workarounds);
}
const FunctionsGL *ContextGL::getFunctions() const const FunctionsGL *ContextGL::getFunctions() const
{ {
return mRenderer->getFunctions(); return mRenderer->getFunctions();
......
...@@ -183,6 +183,8 @@ class ContextGL : public ContextImpl ...@@ -183,6 +183,8 @@ class ContextGL : public ContextImpl
const gl::Extensions &getNativeExtensions() const override; const gl::Extensions &getNativeExtensions() const override;
const gl::Limitations &getNativeLimitations() const override; const gl::Limitations &getNativeLimitations() const override;
void applyNativeWorkarounds(gl::Workarounds *workarounds) const override;
// Handle helpers // Handle helpers
const FunctionsGL *getFunctions() const; const FunctionsGL *getFunctions() const;
StateManagerGL *getStateManager(); StateManagerGL *getStateManager();
......
...@@ -655,6 +655,12 @@ const gl::Limitations &RendererGL::getNativeLimitations() const ...@@ -655,6 +655,12 @@ const gl::Limitations &RendererGL::getNativeLimitations() const
return mNativeLimitations; return mNativeLimitations;
} }
void RendererGL::applyNativeWorkarounds(gl::Workarounds *workarounds) const
{
ensureCapsInitialized();
nativegl_gl::ApplyWorkarounds(mFunctions, workarounds);
}
gl::Error RendererGL::dispatchCompute(const gl::Context *context, gl::Error RendererGL::dispatchCompute(const gl::Context *context,
GLuint numGroupsX, GLuint numGroupsX,
GLuint numGroupsY, GLuint numGroupsY,
......
...@@ -19,6 +19,7 @@ namespace gl ...@@ -19,6 +19,7 @@ namespace gl
class ContextState; class ContextState;
struct IndexRange; struct IndexRange;
class Path; class Path;
struct Workarounds;
} }
namespace egl namespace egl
...@@ -165,6 +166,7 @@ class RendererGL : angle::NonCopyable ...@@ -165,6 +166,7 @@ class RendererGL : angle::NonCopyable
const gl::TextureCapsMap &getNativeTextureCaps() const; const gl::TextureCapsMap &getNativeTextureCaps() const;
const gl::Extensions &getNativeExtensions() const; const gl::Extensions &getNativeExtensions() const;
const gl::Limitations &getNativeLimitations() const; const gl::Limitations &getNativeLimitations() const;
void applyNativeWorkarounds(gl::Workarounds *workarounds) const;
gl::Error dispatchCompute(const gl::Context *context, gl::Error dispatchCompute(const gl::Context *context,
GLuint numGroupsX, GLuint numGroupsX,
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "common/mathutil.h" #include "common/mathutil.h"
#include "libANGLE/Buffer.h" #include "libANGLE/Buffer.h"
#include "libANGLE/Caps.h" #include "libANGLE/Caps.h"
#include "libANGLE/Workarounds.h"
#include "libANGLE/formatutils.h" #include "libANGLE/formatutils.h"
#include "libANGLE/renderer/gl/FunctionsGL.h" #include "libANGLE/renderer/gl/FunctionsGL.h"
#include "libANGLE/renderer/gl/QueryGL.h" #include "libANGLE/renderer/gl/QueryGL.h"
...@@ -1030,6 +1031,11 @@ void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workaround ...@@ -1030,6 +1031,11 @@ void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workaround
#endif #endif
} }
void ApplyWorkarounds(const FunctionsGL *functions, gl::Workarounds *workarounds)
{
// TODO(jmadill): Workarounds for GL.
}
} // namespace nativegl_gl } // namespace nativegl_gl
namespace nativegl namespace nativegl
......
...@@ -25,6 +25,7 @@ struct Caps; ...@@ -25,6 +25,7 @@ struct Caps;
class TextureCapsMap; class TextureCapsMap;
struct Extensions; struct Extensions;
struct Version; struct Version;
struct Workarounds;
} }
namespace rx namespace rx
...@@ -46,6 +47,7 @@ void GenerateCaps(const FunctionsGL *functions, ...@@ -46,6 +47,7 @@ void GenerateCaps(const FunctionsGL *functions,
gl::Version *maxSupportedESVersion); gl::Version *maxSupportedESVersion);
void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workarounds); void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workarounds);
void ApplyWorkarounds(const FunctionsGL *functions, gl::Workarounds *workarounds);
} }
namespace nativegl 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