Merge pull request #9916 from bruvzg/3.0-msaa-check

Add missing max. number of samples (MSAA) check
This commit is contained in:
Rémi Verschelde 2017-07-28 11:14:51 +02:00 committed by GitHub
commit 3ea3c2d4cb
1 changed files with 7 additions and 0 deletions

View File

@ -5999,6 +5999,13 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
static const int msaa_value[] = { 0, 2, 4, 8, 16 };
int msaa = msaa_value[rt->msaa];
int max_samples = 0;
glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
if (msaa > max_samples) {
WARN_PRINTS("MSAA must be <= GL_MAX_SAMPLES, falling-back to GL_MAX_SAMPLES = " + itos(max_samples));
msaa = max_samples;
}
//regular fbo
glGenFramebuffers(1, &rt->buffers.fbo);
glBindFramebuffer(GL_FRAMEBUFFER, rt->buffers.fbo);