summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-07-28 11:14:51 +0200
committerGitHub <noreply@github.com>2017-07-28 11:14:51 +0200
commit3ea3c2d4cbc96a1cc6e969a864bf7a98931c8e73 (patch)
tree75242386b5bd36345fdf284c53076a2b4a318fea
parenta4c150d26c43717be425273523715dac015f3b16 (diff)
parent1a03cd537ffdaf99ad8294f95322dffc43ef9de4 (diff)
Merge pull request #9916 from bruvzg/3.0-msaa-check
Add missing max. number of samples (MSAA) check
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 2a9f078d8c..89bea1e8cc 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -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);