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
This commit is contained in:
parent
7973363e34
commit
2b632dd8c2
Notes:
blender-bot
2023-02-14 11:43:48 +01:00
Referenced by issue #37074, shader.setSampler: limited to 4 samplers
|
@ -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) {
|
||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &unit);
|
||||
g_max_units = (MAXTEX>=unit)?unit:MAXTEX;
|
||||
} else {
|
||||
g_max_units = 0;
|
||||
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;
|
||||
}
|
||||
|
||||
return g_max_units;
|
||||
|
|
Loading…
Reference in New Issue