Don't generate FBO textures too large for the platform

This commit is contained in:
ToadKing 2012-10-22 22:03:00 -04:00
parent 409a482dc5
commit 077317d94e

View File

@ -398,6 +398,8 @@ static void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height,
unsigned last_height = height;
unsigned last_max_width = gl->tex_w;
unsigned last_max_height = gl->tex_h;
GLint max_size;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_size);
// Calculate viewports for FBOs.
for (int i = 0; i < gl->fbo_pass; i++)
{
@ -439,6 +441,26 @@ static void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height,
break;
}
if (gl->fbo_rect[i].img_width > max_size)
{
gl->fbo_rect[i].img_width = max_size;
}
if (gl->fbo_rect[i].img_height > max_size)
{
gl->fbo_rect[i].img_height = max_size;
}
if (gl->fbo_rect[i].max_img_width > max_size)
{
gl->fbo_rect[i].max_img_width = max_size;
}
if (gl->fbo_rect[i].max_img_height > max_size)
{
gl->fbo_rect[i].max_img_height = max_size;
}
last_width = gl->fbo_rect[i].img_width;
last_height = gl->fbo_rect[i].img_height;
last_max_width = gl->fbo_rect[i].max_img_width;