Commit c185cb8d by Jamie Madill

Cache gl::Data in Context to speed up validation.

This avoids creating a new Data object and copying it around. Gives a noticable performance increase in the benchmark which tests validation-only draw calls. Gives about a 8% increase in the benchmark. BUG=angleproject:959 Change-Id: Id3a7459753b1b466a06da89f3f8b03b2c2c7a5c1 Reviewed-on: https://chromium-review.googlesource.com/267752Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org>
parent aebf9dde
...@@ -37,7 +37,8 @@ namespace gl ...@@ -37,7 +37,8 @@ namespace gl
{ {
Context::Context(const egl::Config *config, int clientVersion, const Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess) Context::Context(const egl::Config *config, int clientVersion, const Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess)
: mRenderer(renderer) : mRenderer(renderer),
mData(clientVersion, mState, mCaps, mTextureCaps, mExtensions, nullptr)
{ {
ASSERT(robustAccess == false); // Unimplemented ASSERT(robustAccess == false); // Unimplemented
...@@ -62,6 +63,8 @@ Context::Context(const egl::Config *config, int clientVersion, const Context *sh ...@@ -62,6 +63,8 @@ Context::Context(const egl::Config *config, int clientVersion, const Context *sh
mResourceManager = new ResourceManager(mRenderer); mResourceManager = new ResourceManager(mRenderer);
} }
mData.resourceManager = mResourceManager;
// [OpenGL ES 2.0.24] section 3.7 page 83: // [OpenGL ES 2.0.24] section 3.7 page 83:
// In the initial state, TEXTURE_2D and TEXTURE_CUBE_MAP have twodimensional // In the initial state, TEXTURE_2D and TEXTURE_CUBE_MAP have twodimensional
// and cube map texture state vectors respectively associated with them. // and cube map texture state vectors respectively associated with them.
...@@ -1578,9 +1581,4 @@ void Context::initCaps(GLuint clientVersion) ...@@ -1578,9 +1581,4 @@ void Context::initCaps(GLuint clientVersion)
} }
} }
Data Context::getData() const
{
return Data(mClientVersion, mState, mCaps, mTextureCaps, mExtensions, mResourceManager);
}
} }
...@@ -200,7 +200,7 @@ class Context final : angle::NonCopyable ...@@ -200,7 +200,7 @@ class Context final : angle::NonCopyable
State &getState() { return mState; } State &getState() { return mState; }
const State &getState() const { return mState; } const State &getState() const { return mState; }
Data getData() const; const Data &getData() const { return mData; }
private: private:
void detachBuffer(GLuint buffer); void detachBuffer(GLuint buffer);
...@@ -272,7 +272,11 @@ class Context final : angle::NonCopyable ...@@ -272,7 +272,11 @@ class Context final : angle::NonCopyable
bool mRobustAccess; bool mRobustAccess;
ResourceManager *mResourceManager; ResourceManager *mResourceManager;
// Cache the Data object to avoid re-calling the constructor
Data mData;
}; };
} }
#endif // LIBANGLE_CONTEXT_H_ #endif // LIBANGLE_CONTEXT_H_
...@@ -30,7 +30,7 @@ State::~State() ...@@ -30,7 +30,7 @@ State::~State()
reset(); reset();
} }
void State::initialize(const Caps& caps, GLuint clientVersion) void State::initialize(const Caps &caps, GLuint clientVersion)
{ {
mMaxDrawBuffers = caps.maxDrawBuffers; mMaxDrawBuffers = caps.maxDrawBuffers;
mMaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits; mMaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits;
......
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