mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix loading/unloading shaders
This commit is contained in:
parent
94277cffbb
commit
ab790f4c6d
|
@ -887,12 +887,20 @@ void PainterGL::setShaders(struct VDir* dir) {
|
|||
return;
|
||||
}
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
if (!m_started) {
|
||||
makeCurrent();
|
||||
}
|
||||
|
||||
if (m_shader.passes) {
|
||||
mGLES2ShaderDetach(reinterpret_cast<mGLES2Context*>(m_backend));
|
||||
mGLES2ShaderFree(&m_shader);
|
||||
}
|
||||
mGLES2ShaderLoad(&m_shader, dir);
|
||||
mGLES2ShaderAttach(reinterpret_cast<mGLES2Context*>(m_backend), static_cast<mGLES2Shader*>(m_shader.passes), m_shader.nPasses);
|
||||
|
||||
if (!m_started) {
|
||||
m_gl->doneCurrent();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -901,10 +909,18 @@ void PainterGL::clearShaders() {
|
|||
return;
|
||||
}
|
||||
#if defined(BUILD_GLES2) || defined(BUILD_GLES3)
|
||||
if (!m_started) {
|
||||
makeCurrent();
|
||||
}
|
||||
|
||||
if (m_shader.passes) {
|
||||
mGLES2ShaderDetach(reinterpret_cast<mGLES2Context*>(m_backend));
|
||||
mGLES2ShaderFree(&m_shader);
|
||||
}
|
||||
|
||||
if (!m_started) {
|
||||
m_gl->doneCurrent();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue