evas: Evas_3D - add texture units count checking.

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2023

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Dmytro Dadyka 2015-02-23 14:20:45 +01:00 committed by Cedric BAIL
parent 88fc0e0568
commit 49f350d046
2 changed files with 15 additions and 3 deletions

View File

@ -1262,10 +1262,17 @@ _mesh_draw_data_build(E3D_Draw_Data *data,
evas_normal_matrix_get(&data->matrix_normal, matrix_mv);
}
// TODO Add correct numbering
int num;
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &num);
data->smap_sampler = num - 1;
if (data->texture_count >= num)
if ((data->flags & E3D_SHADER_FLAG_SHADOWED) || (data->texture_count > num))
{
ERR("Too many textures for your graphics configuration.");
return EINA_FALSE;
}
return EINA_TRUE;
}

View File

@ -15,6 +15,7 @@ struct _E3D_Renderer
Eina_Bool vertex_attrib_enable[E3D_MAX_VERTEX_ATTRIB_COUNT];
Eina_Bool depth_test_enable;
GLuint texDepth;
GLint smap_sampler;
};
static inline GLenum
@ -173,8 +174,12 @@ _renderer_texture_bind(E3D_Renderer *renderer, E3D_Draw_Data *data)
}
}
}
glActiveTexture(GL_TEXTURE0 + data->smap_sampler);
glBindTexture(GL_TEXTURE_2D, renderer->texDepth);
if ((data->flags & E3D_SHADER_FLAG_SHADOWED) && (renderer->smap_sampler != data->smap_sampler))
{
glActiveTexture(GL_TEXTURE0 + data->smap_sampler);
glBindTexture(GL_TEXTURE_2D, renderer->texDepth);
renderer->smap_sampler = data->smap_sampler;
}
}
static inline void