Fixed expected state when using different images for depth and stencil

When depth and stencil are both present, they must be the same image,
or return GL_FRAMEBUFFER_UNSUPPORTED, according to the GLES 3.0 spec,
section 4.4.4, Framebuffer Completeness.

Change-Id: I607c05617fb55743635eda987da6de523385d92b
Reviewed-on: https://swiftshader-review.googlesource.com/5262
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/libGLESv2/Framebuffer.cpp b/src/OpenGL/libGLESv2/Framebuffer.cpp
index 3390dd9..0879e3a 100644
--- a/src/OpenGL/libGLESv2/Framebuffer.cpp
+++ b/src/OpenGL/libGLESv2/Framebuffer.cpp
@@ -472,6 +472,16 @@
 		}
 	}
 
+	if((egl::getClientVersion() >= 3) && depthbuffer && stencilbuffer && (depthbuffer != stencilbuffer))
+	{
+		// In the GLES 3.0 spec, section 4.4.4, Framebuffer Completeness:
+		// "The framebuffer object target is said to be framebuffer complete if all the following conditions are true:
+		//  [...]
+		//  Depth and stencil attachments, if present, are the same image.
+		//  { FRAMEBUFFER_UNSUPPORTED }"
+		return GL_FRAMEBUFFER_UNSUPPORTED;
+	}
+
 	// We need to have at least one attachment to be complete
 	if(width == -1 || height == -1)
 	{