Commit 1288aa12 by Geoff Lang Committed by Commit Bot

Update the active texture cache before changing the texture binding.

When a new texture is bound, the texture binding state is updated before updating the active texture cache. With this ordering, it is possible to delete the currently bound texture when the binding changes and then use-after-free it when updating the active texture cache. BUG=angleproject:1065186 Change-Id: Id6d56b6c6db423755b195cda1e5cf1bcb1ee7aee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2124588 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent b83b0f5e
...@@ -1386,14 +1386,14 @@ void State::setActiveSampler(unsigned int active) ...@@ -1386,14 +1386,14 @@ void State::setActiveSampler(unsigned int active)
void State::setSamplerTexture(const Context *context, TextureType type, Texture *texture) void State::setSamplerTexture(const Context *context, TextureType type, Texture *texture)
{ {
mSamplerTextures[type][mActiveSampler].set(context, texture);
if (mExecutable && mExecutable->getActiveSamplersMask()[mActiveSampler] && if (mExecutable && mExecutable->getActiveSamplersMask()[mActiveSampler] &&
IsTextureCompatibleWithSampler(type, mExecutable->getActiveSamplerTypes()[mActiveSampler])) IsTextureCompatibleWithSampler(type, mExecutable->getActiveSamplerTypes()[mActiveSampler]))
{ {
updateActiveTexture(context, mActiveSampler, texture); updateActiveTexture(context, mActiveSampler, texture);
} }
mSamplerTextures[type][mActiveSampler].set(context, texture);
mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS); mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS);
} }
......
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