Commit: 2b632dd8c2ca3fc7ad04f9c35bf1ef6f462ba5e5 Author: Thomas Szepe Date: Mon Jul 27 20:34:13 2015 +0200 Branches: master https://developer.blender.org/rB2b632dd8c2ca3fc7ad04f9c35bf1ef6f462ba5e5
BGE: Fix T37074: GLSL max texture units limit Actually for the the amount of GLSL textures units is limited by the amount of multitexture units (GL_MAX_TEXTURE_UNITS_ARB). Most of the Nvidia graphic cards supports only 4 multitexture units, so Nvidia users can not use more then 4 GLSL textures for a custom shader. This patch removes this limitation by using GL_MAX_TEXTURE_IMAGE_UNITS_ARB if GLSL is supported, but still limit the amount to the maximum texture limit of 8. Reviewers: lordloki, agoose77, danielstokes, panzergame, sybren, moguri Reviewed By: panzergame, sybren, moguri Projects: #game_engine, #game_rendering Maniphest Tasks: T37074 Differential Revision: https://developer.blender.org/D1389 =================================================================== M source/gameengine/Ketsji/BL_Texture.cpp =================================================================== diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp index 080bc88..8f717c0 100644 --- a/source/gameengine/Ketsji/BL_Texture.cpp +++ b/source/gameengine/Ketsji/BL_Texture.cpp @@ -420,13 +420,16 @@ unsigned int BL_Texture::GetTextureType() const int BL_Texture::GetMaxUnits() { if (g_max_units < 0) { - GLint unit; - if (GLEW_ARB_multitexture) { + GLint unit = 0; + + if (GPU_glsl_support()) { + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &unit); + } + else if (GLEW_ARB_multitexture) { glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &unit); - g_max_units = (MAXTEX>=unit)?unit:MAXTEX; - } else { - g_max_units = 0; } + + g_max_units = (MAXTEX >= unit) ? unit : MAXTEX; } return g_max_units; _______________________________________________ Bf-blender-cvs mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-blender-cvs
