From ae254a8d0ff0ae80ae912972f5505563ed6783fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 10 Mar 2016 23:41:33 -0800 Subject: [PATCH] GLES2/iOS: Fixed instancing detection. --- src/glimports.h | 6 ++++++ src/renderer_gl.cpp | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/glimports.h b/src/glimports.h index 527f96f12..ca5d7e87f 100644 --- a/src/glimports.h +++ b/src/glimports.h @@ -493,9 +493,15 @@ GL_IMPORT_EXT__(true, PFNGLMULTIDRAWELEMENTSINDIRECTPROC, glMultiDrawEl GL_IMPORT_OES__(true, PFNGLGETPROGRAMBINARYPROC, glGetProgramBinary); GL_IMPORT_OES__(true, PFNGLPROGRAMBINARYPROC, glProgramBinary); +#if BX_PLATFORM_IOS +GL_IMPORT_EXT__(true, PFNGLVERTEXATTRIBDIVISORPROC, glVertexAttribDivisor); +GL_IMPORT_EXT__(true, PFNGLDRAWARRAYSINSTANCEDPROC, glDrawArraysInstanced); +GL_IMPORT_EXT__(true, PFNGLDRAWELEMENTSINSTANCEDPROC, glDrawElementsInstanced); +#else GL_IMPORT_OES__(true, PFNGLVERTEXATTRIBDIVISORPROC, glVertexAttribDivisor); GL_IMPORT_OES__(true, PFNGLDRAWARRAYSINSTANCEDPROC, glDrawArraysInstanced); GL_IMPORT_OES__(true, PFNGLDRAWELEMENTSINSTANCEDPROC, glDrawElementsInstanced); +#endif // BX_PLATFORM_IOS GL_IMPORT_OES__(true, PFNGLBINDVERTEXARRAYPROC, glBindVertexArray); GL_IMPORT_OES__(true, PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays); diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 063285f19..7dab30f77 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -534,6 +534,8 @@ namespace bgfx { namespace gl EXT_discard_framebuffer, EXT_disjoint_timer_query, EXT_draw_buffers, + EXT_draw_instanced, + EXT_instanced_arrays, EXT_frag_depth, EXT_framebuffer_blit, EXT_framebuffer_object, @@ -739,6 +741,8 @@ namespace bgfx { namespace gl { "EXT_discard_framebuffer", false, true }, // GLES2 extension. { "EXT_disjoint_timer_query", false, true }, // GLES2 extension. { "EXT_draw_buffers", false, true }, // GLES2 extension. + { "EXT_draw_instanced", false, true }, // GLES2 extension. + { "EXT_instanced_arrays", false, true }, // GLES2 extension. { "EXT_frag_depth", false, true }, // GLES2 extension. { "EXT_framebuffer_blit", BGFX_CONFIG_RENDERER_OPENGL >= 30, true }, { "EXT_framebuffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true }, @@ -1921,17 +1925,15 @@ namespace bgfx { namespace gl } else { - if (!BX_ENABLED(BX_PLATFORM_IOS) ) + if (s_extension[Extension::ANGLE_instanced_arrays].m_supported + || s_extension[Extension::ARB_instanced_arrays].m_supported + || s_extension[Extension::EXT_instanced_arrays].m_supported) { - if (s_extension[Extension::ARB_instanced_arrays].m_supported - || s_extension[Extension::ANGLE_instanced_arrays].m_supported) + if (NULL != glVertexAttribDivisor + && NULL != glDrawArraysInstanced + && NULL != glDrawElementsInstanced) { - if (NULL != glVertexAttribDivisor - && NULL != glDrawArraysInstanced - && NULL != glDrawElementsInstanced) - { - g_caps.supported |= BGFX_CAPS_INSTANCING; - } + g_caps.supported |= BGFX_CAPS_INSTANCING; } }