Support instancing on more systems. Note that GLSL 3 may not be supported everywhere that instancing is, and love_InstanceID requires GLSL 3 (but instanced vertex attributes do not).

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-01-22 21:18:06 -04:00
parent bea7cfdaab
commit c764f9f206
+24 -1
View File
@@ -280,6 +280,28 @@ void OpenGL::initOpenGLFunctions()
else if (GLAD_NV_framebuffer_multisample)
fp_glRenderbufferStorageMultisample = fp_glRenderbufferStorageMultisampleNV;
}
if (isInstancingSupported() && !(GLAD_VERSION_3_3 || GLAD_ES_VERSION_3_0))
{
if (GLAD_ARB_instanced_arrays)
{
fp_glDrawArraysInstanced = fp_glDrawArraysInstancedARB;
fp_glDrawElementsInstanced = fp_glDrawElementsInstancedARB;
fp_glVertexAttribDivisor = fp_glVertexAttribDivisorARB;
}
else if (GLAD_EXT_instanced_arrays)
{
fp_glDrawArraysInstanced = fp_glDrawArraysInstancedEXT;
fp_glDrawElementsInstanced = fp_glDrawElementsInstancedEXT;
fp_glVertexAttribDivisor = fp_glVertexAttribDivisorEXT;
}
else if (GLAD_ANGLE_instanced_arrays)
{
fp_glDrawArraysInstanced = fp_glDrawArraysInstancedANGLE;
fp_glDrawElementsInstanced = fp_glDrawElementsInstancedANGLE;
fp_glVertexAttribDivisor = fp_glVertexAttribDivisorANGLE;
}
}
}
void OpenGL::initMaxValues()
@@ -755,7 +777,8 @@ bool OpenGL::isPixelShaderHighpSupported() const
bool OpenGL::isInstancingSupported() const
{
return GLAD_ES_VERSION_3_0 || isCoreProfile();
return GLAD_ES_VERSION_3_0 || GLAD_VERSION_3_3
|| GLAD_ARB_instanced_arrays || GLAD_EXT_instanced_arrays || GLAD_ANGLE_instanced_arrays;
}
int OpenGL::getMaxTextureSize() const