Program: Add cache samplers and type masks.
This mask cleans up some of the iteration logic in
State::syncProgramTextures. It will make it easier to optimize this
function in the future. This will also make it easier to recompute
the sampler type validation.
Leads to a 5% improvement in State::syncProgramTextures.
Bug: angleproject:2747
Bug: angleproject:2763
Change-Id: Ic9a555df843ad23b4c562e6e4a2d425bee58a856
Reviewed-on: https://chromium-review.googlesource.com/1164306
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 2ef5c2a..0d30951 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -5612,22 +5612,22 @@
program->setUniform1fv(location, count, v);
}
-void Context::uniform1i(GLint location, GLint x)
+void Context::setUniform1iImpl(Program *program, GLint location, GLsizei count, const GLint *v)
{
- Program *program = mGLState.getProgram();
- if (program->setUniform1iv(location, 1, &x) == Program::SetUniformResult::SamplerChanged)
+ if (program->setUniform1iv(location, count, v) == Program::SetUniformResult::SamplerChanged)
{
mGLState.setObjectDirty(GL_PROGRAM);
}
}
+void Context::uniform1i(GLint location, GLint x)
+{
+ setUniform1iImpl(mGLState.getProgram(), location, 1, &x);
+}
+
void Context::uniform1iv(GLint location, GLsizei count, const GLint *v)
{
- Program *program = mGLState.getProgram();
- if (program->setUniform1iv(location, count, v) == Program::SetUniformResult::SamplerChanged)
- {
- mGLState.setObjectDirty(GL_PROGRAM);
- }
+ setUniform1iImpl(mGLState.getProgram(), location, count, v);
}
void Context::uniform2f(GLint location, GLfloat x, GLfloat y)
@@ -6341,11 +6341,7 @@
{
Program *programObject = getProgram(program);
ASSERT(programObject);
- if (programObject->setUniform1iv(location, count, value) ==
- Program::SetUniformResult::SamplerChanged)
- {
- mGLState.setObjectDirty(GL_PROGRAM);
- }
+ setUniform1iImpl(programObject, location, count, value);
}
void Context::programUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)