Deleting program does not delete shaders that are marked

TRAC #12012 Resolve the crash on context deletion. Signed-off-by: Nicolas Capens Signed-off-by: Daniel Koch Author: Andrew Lewycky git-svn-id: https://angleproject.googlecode.com/svn/trunk@213 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent a87bdf53
......@@ -319,11 +319,11 @@ GLuint Context::createShader(GLenum type)
if (type == GL_VERTEX_SHADER)
{
mShaderMap[handle] = new VertexShader(handle);
mShaderMap[handle] = new VertexShader(this, handle);
}
else if (type == GL_FRAGMENT_SHADER)
{
mShaderMap[handle] = new FragmentShader(handle);
mShaderMap[handle] = new FragmentShader(this, handle);
}
else UNREACHABLE();
......
......@@ -21,7 +21,7 @@ namespace gl
void *Shader::mFragmentCompiler = NULL;
void *Shader::mVertexCompiler = NULL;
Shader::Shader(GLuint handle) : mHandle(handle)
Shader::Shader(Context *context, GLuint handle) : mHandle(handle), mContext(context)
{
mSource = NULL;
mHlsl = NULL;
......@@ -188,7 +188,7 @@ void Shader::detach()
if (mAttachCount == 0 && mDeleteStatus)
{
getContext()->deleteShader(mHandle);
mContext->deleteShader(mHandle);
}
}
......@@ -294,7 +294,7 @@ void Shader::compileToHLSL(void *compiler)
}
}
VertexShader::VertexShader(GLuint handle) : Shader(handle)
VertexShader::VertexShader(Context *context, GLuint handle) : Shader(context, handle)
{
}
......@@ -368,7 +368,7 @@ void VertexShader::parseAttributes()
}
}
FragmentShader::FragmentShader(GLuint handle) : Shader(handle)
FragmentShader::FragmentShader(Context *context, GLuint handle) : Shader(context, handle)
{
}
......
......@@ -23,7 +23,7 @@ namespace gl
class Shader
{
public:
explicit Shader(GLuint handle);
Shader(Context *context, GLuint handle);
virtual ~Shader();
......@@ -63,6 +63,8 @@ class Shader
char *mHlsl;
char *mInfoLog;
Context *mContext;
static void *mFragmentCompiler;
static void *mVertexCompiler;
};
......@@ -76,7 +78,7 @@ struct Attribute
class VertexShader : public Shader
{
public:
explicit VertexShader(GLuint handle);
VertexShader(Context *context, GLuint handle);
~VertexShader();
......@@ -96,7 +98,7 @@ class VertexShader : public Shader
class FragmentShader : public Shader
{
public:
explicit FragmentShader(GLuint handle);
FragmentShader(Context *context, GLuint handle);
~FragmentShader();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment