Raise exception on too big textures

This commit is contained in:
Jonas Kulla 2013-09-03 15:22:00 +02:00
parent 31c007b541
commit f81e20cc68
7 changed files with 41 additions and 43 deletions

View file

@ -20,6 +20,9 @@
*/
#include "texpool.h"
#include "exception.h"
#include "globalstate.h"
#include "glstate.h"
#include <QHash>
#include <QQueue>
@ -121,7 +124,11 @@ TexFBO TexPool::request(int width, int height)
return cobj.obj;
}
// FIXME check here that requested dimensions don't exceed OpenGL limits
int maxSize = glState.caps.maxTexSize;
if (width > maxSize || height > maxSize)
throw Exception(Exception::MKXPError,
"Texture dimensions [%s, %s] exceed hardware capabilities",
QByteArray::number(width), QByteArray::number(height));
/* Nope, create it instead */
TexFBO::init(cobj.obj);