GLES: Fix segfault on GL 2.x.

This commit is contained in:
Unknown W. Brackets authored and Henrik Rydgård committed 2018-01-27 15:10:17 +01:00
1 parent 59904c316b
commit 95bcda409d
1 file changed
+12 -4
+12 -4
View File
@@ -22,7 +22,9 @@ GLuint g_defaultFBO = 0;
void GLQueueRunner::CreateDeviceObjects() {
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropyLevel_);
glGenVertexArrays(1, &globalVAO_);
if (gl_extensions.ARB_vertex_array_object) {
glGenVertexArrays(1, &globalVAO_);
}
// An eternal optimist.
sawOutOfMemory_ = false;
@@ -47,7 +49,9 @@ void GLQueueRunner::DestroyDeviceObjects() {
glDeleteTextures((GLsizei)nameCache_.size(), &nameCache_[0]);
nameCache_.clear();
}
glDeleteVertexArrays(1, &globalVAO_);
if (gl_extensions.ARB_vertex_array_object) {
glDeleteVertexArrays(1, &globalVAO_);
}
}
void GLQueueRunner::RunInitSteps(const std::vector<GLRInitStep> &steps) {
@@ -479,7 +483,9 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
#endif
*/
glBindVertexArray(globalVAO_);
if (gl_extensions.ARB_vertex_array_object) {
glBindVertexArray(globalVAO_);
}
GLRFramebuffer *fb = step.render.framebuffer;
GLRProgram *curProgram = nullptr;
@@ -889,7 +895,9 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
// Wipe out the current state.
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindVertexArray(0);
if (gl_extensions.ARB_vertex_array_object) {
glBindVertexArray(0);
}
glDisable(GL_SCISSOR_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_STENCIL_TEST);