mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
Fixed shader and program cleanup.
This commit is contained in:
parent
557c175e61
commit
25917d1cac
2 changed files with 18 additions and 4 deletions
|
@ -1071,8 +1071,12 @@ namespace bgfx
|
|||
}
|
||||
m_numPredefined = 0;
|
||||
|
||||
GL_CHECK(glUseProgram(0) );
|
||||
GL_CHECK(glDeleteProgram(m_id) );
|
||||
if (0 != m_id)
|
||||
{
|
||||
GL_CHECK(glUseProgram(0) );
|
||||
GL_CHECK(glDeleteProgram(m_id) );
|
||||
m_id = 0;
|
||||
}
|
||||
|
||||
m_vcref.invalidate(s_renderCtx->m_vaoStateCache);
|
||||
}
|
||||
|
|
|
@ -583,6 +583,11 @@ namespace bgfx
|
|||
|
||||
struct Shader
|
||||
{
|
||||
Shader()
|
||||
: m_id(0)
|
||||
{
|
||||
}
|
||||
|
||||
void create(GLenum _type, Memory* _mem)
|
||||
{
|
||||
m_id = glCreateShader(_type);
|
||||
|
@ -622,7 +627,11 @@ namespace bgfx
|
|||
|
||||
void destroy()
|
||||
{
|
||||
GL_CHECK(glDeleteShader(m_id) );
|
||||
if (0 != m_id)
|
||||
{
|
||||
GL_CHECK(glDeleteShader(m_id) );
|
||||
m_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
GLuint m_id;
|
||||
|
@ -657,7 +666,8 @@ namespace bgfx
|
|||
struct Program
|
||||
{
|
||||
Program()
|
||||
: m_constantBuffer(NULL)
|
||||
: m_id(0)
|
||||
, m_constantBuffer(NULL)
|
||||
, m_numPredefined(0)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue