GLES2/iOS: Fixed instancing detection.

This commit is contained in:
Branimir Karadžić 2016-03-10 23:41:33 -08:00
parent 1ae82cf9b4
commit ae254a8d0f
2 changed files with 17 additions and 9 deletions

View File

@ -493,9 +493,15 @@ GL_IMPORT_EXT__(true, PFNGLMULTIDRAWELEMENTSINDIRECTPROC, glMultiDrawEl
GL_IMPORT_OES__(true, PFNGLGETPROGRAMBINARYPROC, glGetProgramBinary); GL_IMPORT_OES__(true, PFNGLGETPROGRAMBINARYPROC, glGetProgramBinary);
GL_IMPORT_OES__(true, PFNGLPROGRAMBINARYPROC, glProgramBinary); 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, PFNGLVERTEXATTRIBDIVISORPROC, glVertexAttribDivisor);
GL_IMPORT_OES__(true, PFNGLDRAWARRAYSINSTANCEDPROC, glDrawArraysInstanced); GL_IMPORT_OES__(true, PFNGLDRAWARRAYSINSTANCEDPROC, glDrawArraysInstanced);
GL_IMPORT_OES__(true, PFNGLDRAWELEMENTSINSTANCEDPROC, glDrawElementsInstanced); GL_IMPORT_OES__(true, PFNGLDRAWELEMENTSINSTANCEDPROC, glDrawElementsInstanced);
#endif // BX_PLATFORM_IOS
GL_IMPORT_OES__(true, PFNGLBINDVERTEXARRAYPROC, glBindVertexArray); GL_IMPORT_OES__(true, PFNGLBINDVERTEXARRAYPROC, glBindVertexArray);
GL_IMPORT_OES__(true, PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays); GL_IMPORT_OES__(true, PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays);

View File

@ -534,6 +534,8 @@ namespace bgfx { namespace gl
EXT_discard_framebuffer, EXT_discard_framebuffer,
EXT_disjoint_timer_query, EXT_disjoint_timer_query,
EXT_draw_buffers, EXT_draw_buffers,
EXT_draw_instanced,
EXT_instanced_arrays,
EXT_frag_depth, EXT_frag_depth,
EXT_framebuffer_blit, EXT_framebuffer_blit,
EXT_framebuffer_object, EXT_framebuffer_object,
@ -739,6 +741,8 @@ namespace bgfx { namespace gl
{ "EXT_discard_framebuffer", false, true }, // GLES2 extension. { "EXT_discard_framebuffer", false, true }, // GLES2 extension.
{ "EXT_disjoint_timer_query", false, true }, // GLES2 extension. { "EXT_disjoint_timer_query", false, true }, // GLES2 extension.
{ "EXT_draw_buffers", 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_frag_depth", false, true }, // GLES2 extension.
{ "EXT_framebuffer_blit", BGFX_CONFIG_RENDERER_OPENGL >= 30, true }, { "EXT_framebuffer_blit", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
{ "EXT_framebuffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true }, { "EXT_framebuffer_object", BGFX_CONFIG_RENDERER_OPENGL >= 30, true },
@ -1921,17 +1925,15 @@ namespace bgfx { namespace gl
} }
else 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 if (NULL != glVertexAttribDivisor
|| s_extension[Extension::ANGLE_instanced_arrays].m_supported) && NULL != glDrawArraysInstanced
&& NULL != glDrawElementsInstanced)
{ {
if (NULL != glVertexAttribDivisor g_caps.supported |= BGFX_CAPS_INSTANCING;
&& NULL != glDrawArraysInstanced
&& NULL != glDrawElementsInstanced)
{
g_caps.supported |= BGFX_CAPS_INSTANCING;
}
} }
} }