Qt: Fix loading/unloading shaders

This commit is contained in:
Vicki Pfau 2022-12-12 14:31:41 -08:00
parent 94277cffbb
commit ab790f4c6d
1 changed files with 16 additions and 0 deletions

View File

@ -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
}