Merge the ProgramBinary class into Program.
BUG=angle:731
Change-Id: I2ee97155841dc62f04bb71c1f2035d210fd3883c
Reviewed-on: https://chromium-review.googlesource.com/232694
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index c02bbe6..fe85831 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -18,7 +18,6 @@
#include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/Renderbuffer.h"
#include "libANGLE/Program.h"
-#include "libANGLE/ProgramBinary.h"
#include "libANGLE/Query.h"
#include "libANGLE/ResourceManager.h"
#include "libANGLE/Sampler.h"
@@ -123,17 +122,7 @@
Context::~Context()
{
- GLuint currentProgram = mState.getCurrentProgramId();
- if (currentProgram != 0)
- {
- Program *programObject = mResourceManager->getProgram(currentProgram);
- if (programObject)
- {
- programObject->release();
- }
- currentProgram = 0;
- }
- mState.setCurrentProgram(0, NULL);
+ mState.reset();
while (!mFramebufferMap.empty())
{
@@ -623,58 +612,7 @@
void Context::useProgram(GLuint program)
{
- GLuint priorProgramId = mState.getCurrentProgramId();
- Program *priorProgram = mResourceManager->getProgram(priorProgramId);
-
- if (priorProgramId != program)
- {
- mState.setCurrentProgram(program, mResourceManager->getProgram(program));
-
- if (priorProgram)
- {
- priorProgram->release();
- }
- }
-}
-
-Error Context::linkProgram(GLuint program)
-{
- Program *programObject = mResourceManager->getProgram(program);
-
- Error error = programObject->link(getData());
- if (error.isError())
- {
- return error;
- }
-
- // if the current program was relinked successfully we
- // need to install the new executables
- if (programObject->isLinked() && program == mState.getCurrentProgramId())
- {
- mState.setCurrentProgramBinary(programObject->getProgramBinary());
- }
-
- return Error(GL_NO_ERROR);
-}
-
-Error Context::setProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLint length)
-{
- Program *programObject = mResourceManager->getProgram(program);
-
- Error error = programObject->setProgramBinary(binaryFormat, binary, length);
- if (error.isError())
- {
- return error;
- }
-
- // if the current program was reloaded successfully we
- // need to install the new executables
- if (programObject->isLinked() && program == mState.getCurrentProgramId())
- {
- mState.setCurrentProgramBinary(programObject->getProgramBinary());
- }
-
- return Error(GL_NO_ERROR);
+ mState.setProgram(getProgram(program));
}
void Context::bindTransformFeedback(GLuint transformFeedback)