Bug 1635293 - Cherry-pick ANGLE fix: Update tex cache even if new type is InvalidEnum. r=lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D79755
This commit is contained in:
Jeff Gilbert 2020-06-15 22:07:44 +00:00
parent 50337644a0
commit 71aeba305c
3 changed files with 36 additions and 15 deletions

View File

@ -1,3 +1,3 @@
#define ANGLE_COMMIT_HASH "eabf2a79aac3"
#define ANGLE_COMMIT_HASH "6c72b64f910d"
#define ANGLE_COMMIT_HASH_SIZE 12
#define ANGLE_COMMIT_DATE "2020-05-11 10:58:02 -0700"
#define ANGLE_COMMIT_DATE "2020-06-15 13:57:21 -0700"

View File

@ -527,7 +527,7 @@ ANGLE_INLINE void State::updateActiveTextureState(const Context *context,
const Sampler *sampler,
Texture *texture)
{
if (!texture->isSamplerComplete(context, sampler))
if (!texture || !texture->isSamplerComplete(context, sampler))
{
mActiveTexturesCache[textureIndex] = nullptr;
}
@ -546,7 +546,7 @@ ANGLE_INLINE void State::updateActiveTextureState(const Context *context,
}
}
if (mProgram)
if (texture && mProgram)
{
const SamplerState &samplerState =
sampler ? sampler->getSamplerState() : texture->getSamplerState();
@ -2818,11 +2818,10 @@ void State::onActiveTextureChange(const Context *context, size_t textureUnit)
if (mProgram)
{
TextureType type = mProgram->getActiveSamplerTypes()[textureUnit];
if (type != TextureType::InvalidEnum)
{
Texture *activeTexture = mSamplerTextures[type][textureUnit].get();
updateActiveTexture(context, textureUnit, activeTexture);
}
Texture *activeTexture = (type != TextureType::InvalidEnum)
? mSamplerTextures[type][textureUnit].get()
: nullptr;
updateActiveTexture(context, textureUnit, activeTexture);
}
}
@ -2831,12 +2830,12 @@ void State::onActiveTextureStateChange(const Context *context, size_t textureUni
if (mProgram)
{
TextureType type = mProgram->getActiveSamplerTypes()[textureUnit];
if (type != TextureType::InvalidEnum)
{
Texture *activeTexture = mSamplerTextures[type][textureUnit].get();
const Sampler *sampler = mSamplers[textureUnit].get();
updateActiveTextureState(context, textureUnit, sampler, activeTexture);
}
Texture *activeTexture = (type != TextureType::InvalidEnum)
? mSamplerTextures[type][textureUnit].get()
: nullptr;
const Sampler *sampler = mSamplers[textureUnit].get();
updateActiveTextureState(context, textureUnit, sampler, activeTexture);
}
}

View File

@ -1,3 +1,25 @@
commit 6c72b64f910d0b0f81456bec26ca295c865c04da
Author: Geoff Lang <geofflang@chromium.org>
Date: Wed May 13 18:50:51 2020 -0400
Unset the ActiveTextureCache entry if the program does not reference it
When changing uniforms of a program, State::onActiveTextureChange is
called to update the ActiveTextureCache. If the sampler uniform type
changes to TextureType::InvalidEnum, the entry in ActiveTextureCache was
not cleared. This causes stale entries in ActiveTextureCache because the
cache no longer matches what textures are bound and the cache does not
add references to the textures in it.
BUG=chromium:1078375
BUG=chromium:1072406
BUG=chromium:1078866
Change-Id: If9719dcd4fc865b2301db450eb8115e7cfe46c4a
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2199654
Reviewed-by: Tim Van Patten <timvp@google.com>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
commit eabf2a79aac36223b5ab5c5b0810d5522095f0bc
Author: Jeff Muizelaar <jrmuizel@gmail.com>
Date: Mon May 11 13:01:46 2020 -0400