Add destroy hooks for several GL objects.
These hooks allow the back-end renderer to free object resources
without having to store pointers to shared device handles for
each and every object. This will allow us to save memory on
back-ends that really care about memory overhead.
There is a downside in that there is more boilerplate in passing
gl::Context handles around everywhere.
BUG=angleproject:1684
Change-Id: I89463bba8d23f92920e8956650cb73c7fc6d66b7
Reviewed-on: https://chromium-review.googlesource.com/426401
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/State.cpp b/src/libANGLE/State.cpp
index 9bc670f..34a87fb 100644
--- a/src/libANGLE/State.cpp
+++ b/src/libANGLE/State.cpp
@@ -67,7 +67,6 @@
State::~State()
{
- reset();
}
void State::initialize(const Caps &caps,
@@ -212,7 +211,7 @@
mPathStencilMask = std::numeric_limits<GLuint>::max();
}
-void State::reset()
+void State::reset(const Context *context)
{
for (TextureBindingMap::iterator bindingVec = mSamplerTextures.begin(); bindingVec != mSamplerTextures.end(); bindingVec++)
{
@@ -233,7 +232,7 @@
if (mProgram)
{
- mProgram->release();
+ mProgram->release(context);
}
mProgram = NULL;
@@ -1018,13 +1017,13 @@
return false;
}
-void State::setProgram(Program *newProgram)
+void State::setProgram(const Context *context, Program *newProgram)
{
if (mProgram != newProgram)
{
if (mProgram)
{
- mProgram->release();
+ mProgram->release(context);
}
mProgram = newProgram;