Commit 14246813 by Jamie Madill Committed by Commit Bot

Update sampler directly on Texture change.

This saves a lot of extra work when updating a Texture. Bug: angleproject:2763 Change-Id: I87e310ef4f847713123bd24711e1166949ff95d2 Reviewed-on: https://chromium-review.googlesource.com/c/1254043Reviewed-by: 's avatarYuly Novikov <ynovikov@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent e3bb6b79
...@@ -1117,7 +1117,7 @@ void Context::bindTexture(TextureType target, GLuint handle) ...@@ -1117,7 +1117,7 @@ void Context::bindTexture(TextureType target, GLuint handle)
} }
ASSERT(texture); ASSERT(texture);
mGLState.setSamplerTexture(this, target, texture); ANGLE_CONTEXT_TRY(mGLState.setSamplerTexture(this, target, texture));
mStateCache.onActiveTextureChange(this); mStateCache.onActiveTextureChange(this);
} }
......
...@@ -1067,11 +1067,19 @@ unsigned int State::getActiveSampler() const ...@@ -1067,11 +1067,19 @@ unsigned int State::getActiveSampler() const
return static_cast<unsigned int>(mActiveSampler); return static_cast<unsigned int>(mActiveSampler);
} }
void State::setSamplerTexture(const Context *context, TextureType type, Texture *texture) Error State::setSamplerTexture(const Context *context, TextureType type, Texture *texture)
{ {
mSamplerTextures[type][mActiveSampler].set(context, texture); mSamplerTextures[type][mActiveSampler].set(context, texture);
if (mProgram && mProgram->getActiveSamplersMask()[mActiveSampler] &&
mProgram->getActiveSamplerTypes()[mActiveSampler] == type)
{
ANGLE_TRY(updateActiveTexture(context, mActiveSampler, texture));
}
mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS); mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS);
mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
return NoError();
} }
Texture *State::getTargetTexture(TextureType type) const Texture *State::getTargetTexture(TextureType type) const
......
...@@ -174,7 +174,7 @@ class State : angle::NonCopyable ...@@ -174,7 +174,7 @@ class State : angle::NonCopyable
// Texture binding & active texture unit manipulation // Texture binding & active texture unit manipulation
void setActiveSampler(unsigned int active); void setActiveSampler(unsigned int active);
unsigned int getActiveSampler() const; unsigned int getActiveSampler() const;
void setSamplerTexture(const Context *context, TextureType type, Texture *texture); Error setSamplerTexture(const Context *context, TextureType type, Texture *texture);
Texture *getTargetTexture(TextureType type) const; Texture *getTargetTexture(TextureType type) const;
Texture *getSamplerTexture(unsigned int sampler, TextureType type) const Texture *getSamplerTexture(unsigned int sampler, TextureType type) const
......
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