Make Context handle dirty texture events.
Moving from State to Context allows the Context to update the State
Cache class directly. It also calls through to the State class to
update the Texture cache. This consolidates notification events into
the Context class. This is also in line with how we handle state event
updates in other gl classes.
Bug: angleproject:2747
Bug: angleproject:2763
Change-Id: Iff7dc7e46ee8768819235ebd151707cd2a03dfc9
Reviewed-on: https://chromium-review.googlesource.com/1166143
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/State.cpp b/src/libANGLE/State.cpp
index bb813ff..27d7e93 100644
--- a/src/libANGLE/State.cpp
+++ b/src/libANGLE/State.cpp
@@ -123,7 +123,7 @@
{
}
-void State::initialize(const Context *context)
+void State::initialize(Context *context)
{
const Caps &caps = context->getCaps();
const Extensions &extensions = context->getExtensions();
@@ -218,7 +218,7 @@
for (uint32_t textureIndex = 0; textureIndex < caps.maxCombinedTextureImageUnits;
++textureIndex)
{
- mCompleteTextureBindings.emplace_back(this, textureIndex);
+ mCompleteTextureBindings.emplace_back(context, textureIndex);
}
mSamplers.resize(caps.maxCombinedTextureImageUnits);
@@ -2796,16 +2796,14 @@
}
// Handle a dirty texture event.
-void State::onSubjectStateChange(const Context *context,
- angle::SubjectIndex index,
- angle::SubjectMessage message)
+void State::onActiveTextureStateChange(size_t textureIndex)
{
// Conservatively assume all textures are dirty.
// TODO(jmadill): More fine-grained update.
mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
- if (!mActiveTexturesCache[index] ||
- mActiveTexturesCache[index]->initState() == InitState::MayNeedInit)
+ if (!mActiveTexturesCache[textureIndex] ||
+ mActiveTexturesCache[textureIndex]->initState() == InitState::MayNeedInit)
{
mCachedTexturesInitState = InitState::MayNeedInit;
}