OGL: Fix binding error on shutdown
This was occurring if the imgui vertex format was bound on shutdown, which is destroyed before the vertex buffers
This commit is contained in:
parent
9577d0641b
commit
f2a594fad5
|
@ -80,6 +80,7 @@ GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
||||||
|
|
||||||
GLVertexFormat::~GLVertexFormat()
|
GLVertexFormat::~GLVertexFormat()
|
||||||
{
|
{
|
||||||
|
ProgramShaderCache::InvalidateVertexFormatIfBound(VAO);
|
||||||
glDeleteVertexArrays(1, &VAO);
|
glDeleteVertexArrays(1, &VAO);
|
||||||
}
|
}
|
||||||
} // namespace OGL
|
} // namespace OGL
|
||||||
|
|
|
@ -494,6 +494,12 @@ void ProgramShaderCache::InvalidateVertexFormat()
|
||||||
s_last_VAO = 0;
|
s_last_VAO = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProgramShaderCache::InvalidateVertexFormatIfBound(GLuint vao)
|
||||||
|
{
|
||||||
|
if (s_last_VAO == vao)
|
||||||
|
s_last_VAO = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void ProgramShaderCache::InvalidateLastProgram()
|
void ProgramShaderCache::InvalidateLastProgram()
|
||||||
{
|
{
|
||||||
CurrentProgram = 0;
|
CurrentProgram = 0;
|
||||||
|
|
|
@ -72,6 +72,7 @@ public:
|
||||||
static void BindVertexFormat(const GLVertexFormat* vertex_format);
|
static void BindVertexFormat(const GLVertexFormat* vertex_format);
|
||||||
static bool IsValidVertexFormatBound();
|
static bool IsValidVertexFormatBound();
|
||||||
static void InvalidateVertexFormat();
|
static void InvalidateVertexFormat();
|
||||||
|
static void InvalidateVertexFormatIfBound(GLuint vao);
|
||||||
static void InvalidateLastProgram();
|
static void InvalidateLastProgram();
|
||||||
|
|
||||||
static bool CompileComputeShader(SHADER& shader, const std::string& code);
|
static bool CompileComputeShader(SHADER& shader, const std::string& code);
|
||||||
|
|
Loading…
Reference in New Issue