Call onProgramExecutableChange in useProgram.

This cleans up the code slightly and removes a few if checks.
Also fixes a potential edge case with ProgramBinary called on a program
that is in-use.

Bug: angleproject:2763
Change-Id: Ibe0ab20ed44f593bb6c2b0612871680a7df1a15f
Reviewed-on: https://chromium-review.googlesource.com/1254041
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill 2018-10-01 10:36:24 -04:00 коммит произвёл Commit Bot
Родитель 0da73fedd9
Коммит df836ff8f1
2 изменённых файлов: 17 добавлений и 13 удалений

Просмотреть файл

@ -5715,8 +5715,11 @@ void Context::linkProgram(GLuint program)
// ProgramD3D.
if (programObject->isInUse())
{
// isLinked() which forces to resolve linking, will be called.
mGLState.onProgramExecutableChange(programObject);
if (programObject->isLinked())
{
mGLState.onProgramExecutableChange(programObject);
}
mStateCache.onProgramExecutableChange(this);
}
}
@ -5927,10 +5930,10 @@ void Context::programBinary(GLuint program, GLenum binaryFormat, const void *bin
ASSERT(programObject != nullptr);
handleError(programObject->loadBinary(this, binaryFormat, binary, length));
mStateCache.onProgramExecutableChange(this);
if (programObject->isInUse())
{
mGLState.setObjectDirty(GL_PROGRAM);
mGLState.onProgramExecutableChange(programObject);
mStateCache.onProgramExecutableChange(this);
}
}

Просмотреть файл

@ -1344,11 +1344,13 @@ void State::setProgram(const Context *context, Program *newProgram)
if (mProgram)
{
newProgram->addRef();
mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
onProgramExecutableChange(newProgram);
}
mDirtyBits.set(DIRTY_BIT_PROGRAM_EXECUTABLE);
// Note that rendering is undefined if glUseProgram(0) is called. But ANGLE will generate
// an error if the app tries to draw in this case.
mDirtyBits.set(DIRTY_BIT_PROGRAM_BINDING);
mDirtyObjects.set(DIRTY_OBJECT_PROGRAM);
}
}
@ -2879,12 +2881,11 @@ void State::onProgramExecutableChange(Program *program)
// "If LinkProgram or ProgramBinary successfully re-links a program object
// that was already in use as a result of a previous call to UseProgram, then the
// generated executable code will be installed as part of the current rendering state."
if (program->isLinked() && mProgram == program)
{
mDirtyBits.set(DIRTY_BIT_PROGRAM_EXECUTABLE);
mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
mDirtyObjects.set(DIRTY_OBJECT_PROGRAM);
}
ASSERT(program->isLinked());
mDirtyBits.set(DIRTY_BIT_PROGRAM_EXECUTABLE);
mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES);
mDirtyObjects.set(DIRTY_OBJECT_PROGRAM);
}
void State::setSamplerDirty(size_t samplerIndex)