Commit a6d34af6 by Geoff Lang Committed by Commit Bot

StateManagerGL: Use arrays to store texture and sampler bindings.

The improved cache locality improves performance by 5-10% on command_buffer_perftests. BUG=angleproject:2188 Change-Id: I6cce95481e2b1ce2605bce19b0a29d56718613a1 Reviewed-on: https://chromium-review.googlesource.com/1156853Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent b8430dd7
......@@ -77,8 +77,8 @@ StateManagerGL::StateManagerGL(const FunctionsGL *functions,
mBuffers(),
mIndexedBuffers(),
mTextureUnitIndex(0),
mTextures(),
mSamplers(rendererCaps.maxCombinedTextureImageUnits, 0),
mTextures{},
mSamplers{},
mImages(rendererCaps.maxImageUnits, ImageUnitBinding()),
mTransformFeedback(0),
mCurrentTransformFeedback(nullptr),
......@@ -168,13 +168,6 @@ StateManagerGL::StateManagerGL(const FunctionsGL *functions,
ASSERT(mFunctions);
ASSERT(extensions.maxViews >= 1u);
mTextures[gl::TextureType::_2D].resize(rendererCaps.maxCombinedTextureImageUnits);
mTextures[gl::TextureType::Rectangle].resize(rendererCaps.maxCombinedTextureImageUnits);
mTextures[gl::TextureType::CubeMap].resize(rendererCaps.maxCombinedTextureImageUnits);
mTextures[gl::TextureType::_2DArray].resize(rendererCaps.maxCombinedTextureImageUnits);
mTextures[gl::TextureType::_3D].resize(rendererCaps.maxCombinedTextureImageUnits);
mTextures[gl::TextureType::_2DMultisample].resize(rendererCaps.maxCombinedTextureImageUnits);
mIndexedBuffers[gl::BufferBinding::Uniform].resize(rendererCaps.maxUniformBufferBindings);
mIndexedBuffers[gl::BufferBinding::AtomicCounter].resize(
rendererCaps.maxAtomicCounterBufferBindings);
......@@ -240,7 +233,7 @@ void StateManagerGL::deleteTexture(GLuint texture)
{
for (gl::TextureType type : angle::AllEnums<gl::TextureType>())
{
const std::vector<GLuint> &textureVector = mTextures[type];
const auto &textureVector = mTextures[type];
for (size_t textureUnitIndex = 0; textureUnitIndex < textureVector.size();
textureUnitIndex++)
{
......
......@@ -230,8 +230,8 @@ class StateManagerGL final : angle::NonCopyable
angle::PackedEnumMap<gl::BufferBinding, std::vector<IndexedBufferBinding>> mIndexedBuffers;
size_t mTextureUnitIndex;
angle::PackedEnumMap<gl::TextureType, std::vector<GLuint>> mTextures;
std::vector<GLuint> mSamplers;
angle::PackedEnumMap<gl::TextureType, gl::ActiveTextureArray<GLuint>> mTextures;
gl::ActiveTextureArray<GLuint> mSamplers;
struct ImageUnitBinding
{
......
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