iOS SDL_GL_CreateContext: Clamp the multisample sample count when the requested value is too high, rather than failing to create the context.
authorAlex Szpakowski <slime73@gmail.com>
Tue, 15 Sep 2015 00:25:07 -0300
changeset 9866 88e9cf11b8eb
parent 9865 c1941443f59a
child 9867 bf0a56e8b606
iOS SDL_GL_CreateContext: Clamp the multisample sample count when the requested value is too high, rather than failing to create the context. This matches the SDL_GL_CreateContext behavior in OS X.
src/video/uikit/SDL_uikitopenglview.m
--- a/src/video/uikit/SDL_uikitopenglview.m	Mon Sep 14 22:50:55 2015 -0300
+++ b/src/video/uikit/SDL_uikitopenglview.m	Tue Sep 15 00:25:07 2015 -0300
@@ -88,12 +88,8 @@
             GLint maxsamples = 0;
             glGetIntegerv(GL_MAX_SAMPLES, &maxsamples);
 
-            /* Verify that the sample count is supported before creating any
-             * multisample Renderbuffers, to avoid generating GL errors. */
-            if (samples > maxsamples) {
-                SDL_SetError("Failed creating OpenGL ES framebuffer: Unsupported MSAA sample count");
-                return nil;
-            }
+            /* Clamp the samples to the max supported count. */
+            samples = MIN(samples, maxsamples);
         }
 
         if (sRGB) {