mirror of https://github.com/encounter/SDL.git
iOS: Avoid generating an OpenGL error (but still fail to create the context) if the specified MSAA sample count is unsupported.
This commit is contained in:
parent
6ea942dae3
commit
c344b734f4
|
@ -84,6 +84,18 @@
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (samples > 0) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sRGB) {
|
if (sRGB) {
|
||||||
/* sRGB EAGL drawable support was added in iOS 7. */
|
/* sRGB EAGL drawable support was added in iOS 7. */
|
||||||
if (UIKit_IsSystemVersionAtLeast(7.0)) {
|
if (UIKit_IsSystemVersionAtLeast(7.0)) {
|
||||||
|
@ -150,11 +162,6 @@
|
||||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, colorBufferFormat, backingWidth, backingHeight);
|
glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, colorBufferFormat, backingWidth, backingHeight);
|
||||||
|
|
||||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, msaaRenderbuffer);
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, msaaRenderbuffer);
|
||||||
|
|
||||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
|
||||||
SDL_SetError("Failed creating OpenGL ES framebuffer: Unsupported MSAA sample count");
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useDepthBuffer || useStencilBuffer) {
|
if (useDepthBuffer || useStencilBuffer) {
|
||||||
|
|
Loading…
Reference in New Issue