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) ...@@ -319,11 +319,11 @@ GLuint Context::createShader(GLenum type)
if (type == GL_VERTEX_SHADER) if (type == GL_VERTEX_SHADER)
{ {
mShaderMap[handle] = new VertexShader(handle); mShaderMap[handle] = new VertexShader(this, handle);
} }
else if (type == GL_FRAGMENT_SHADER) else if (type == GL_FRAGMENT_SHADER)
{ {
mShaderMap[handle] = new FragmentShader(handle); mShaderMap[handle] = new FragmentShader(this, handle);
} }
else UNREACHABLE(); else UNREACHABLE();
......
...@@ -21,7 +21,7 @@ namespace gl ...@@ -21,7 +21,7 @@ namespace gl
void *Shader::mFragmentCompiler = NULL; void *Shader::mFragmentCompiler = NULL;
void *Shader::mVertexCompiler = NULL; void *Shader::mVertexCompiler = NULL;
Shader::Shader(GLuint handle) : mHandle(handle) Shader::Shader(Context *context, GLuint handle) : mHandle(handle), mContext(context)
{ {
mSource = NULL; mSource = NULL;
mHlsl = NULL; mHlsl = NULL;
...@@ -188,7 +188,7 @@ void Shader::detach() ...@@ -188,7 +188,7 @@ void Shader::detach()
if (mAttachCount == 0 && mDeleteStatus) if (mAttachCount == 0 && mDeleteStatus)
{ {
getContext()->deleteShader(mHandle); mContext->deleteShader(mHandle);
} }
} }
...@@ -294,7 +294,7 @@ void Shader::compileToHLSL(void *compiler) ...@@ -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() ...@@ -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 ...@@ -23,7 +23,7 @@ namespace gl
class Shader class Shader
{ {
public: public:
explicit Shader(GLuint handle); Shader(Context *context, GLuint handle);
virtual ~Shader(); virtual ~Shader();
...@@ -63,6 +63,8 @@ class Shader ...@@ -63,6 +63,8 @@ class Shader
char *mHlsl; char *mHlsl;
char *mInfoLog; char *mInfoLog;
Context *mContext;
static void *mFragmentCompiler; static void *mFragmentCompiler;
static void *mVertexCompiler; static void *mVertexCompiler;
}; };
...@@ -76,7 +78,7 @@ struct Attribute ...@@ -76,7 +78,7 @@ struct Attribute
class VertexShader : public Shader class VertexShader : public Shader
{ {
public: public:
explicit VertexShader(GLuint handle); VertexShader(Context *context, GLuint handle);
~VertexShader(); ~VertexShader();
...@@ -96,7 +98,7 @@ class VertexShader : public Shader ...@@ -96,7 +98,7 @@ class VertexShader : public Shader
class FragmentShader : public Shader class FragmentShader : public Shader
{ {
public: public:
explicit FragmentShader(GLuint handle); FragmentShader(Context *context, GLuint handle);
~FragmentShader(); ~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