Adds resource manager class.
TRAC #12493
The resource manager class is now in charge of allocation &
management of objects which may be shared by multiple contexts.
Signed-off-by: Andrew Lewycky
Signed-off-by: Nicolas Capens
Signed-off-by: Daniel Koch
Author: Shannon Woods
git-svn-id: https://angleproject.googlecode.com/svn/trunk@360 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Shader.cpp b/src/libGLESv2/Shader.cpp
index 13d7ea7..bc94c65 100644
--- a/src/libGLESv2/Shader.cpp
+++ b/src/libGLESv2/Shader.cpp
@@ -21,7 +21,7 @@
void *Shader::mFragmentCompiler = NULL;
void *Shader::mVertexCompiler = NULL;
-Shader::Shader(Context *context, GLuint handle) : mHandle(handle), mContext(context)
+Shader::Shader(ResourceManager *manager, GLuint handle) : mHandle(handle), mResourceManager(manager)
{
mSource = NULL;
mHlsl = NULL;
@@ -49,7 +49,7 @@
}
}
- mAttachCount = 0;
+ mRefCount = 0;
mDeleteStatus = false;
}
@@ -187,24 +187,24 @@
return mHlsl;
}
-void Shader::attach()
+void Shader::addRef()
{
- mAttachCount++;
+ mRefCount++;
}
-void Shader::detach()
+void Shader::release()
{
- mAttachCount--;
+ mRefCount--;
- if (mAttachCount == 0 && mDeleteStatus)
+ if (mRefCount == 0 && mDeleteStatus)
{
- mContext->deleteShader(mHandle);
+ mResourceManager->deleteShader(mHandle);
}
}
-bool Shader::isAttached() const
+unsigned int Shader::getRefCount() const
{
- return mAttachCount > 0;
+ return mRefCount;
}
bool Shader::isFlaggedForDeletion() const
@@ -417,7 +417,7 @@
return false;
}
-VertexShader::VertexShader(Context *context, GLuint handle) : Shader(context, handle)
+VertexShader::VertexShader(ResourceManager *manager, GLuint handle) : Shader(manager, handle)
{
}
@@ -481,7 +481,7 @@
}
}
-FragmentShader::FragmentShader(Context *context, GLuint handle) : Shader(context, handle)
+FragmentShader::FragmentShader(ResourceManager *manager, GLuint handle) : Shader(manager, handle)
{
}