Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Szepe <HG1_public@gmx.net>2015-07-27 21:34:13 +0300
committerThomas Szepe <HG1_public@gmx.net>2015-07-27 21:34:13 +0300
commit2b632dd8c2ca3fc7ad04f9c35bf1ef6f462ba5e5 (patch)
tree42000f8c235d620382f254a1c93a46a67b5f37bf /source/gameengine
parent7973363e34167501bfb0707d8d4e31a8ddd3f91b (diff)
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
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Ketsji/BL_Texture.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp
index 080bc88bdc1..8f717c05c0f 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;