“NEVER EVER MAKE A STENCIL buffer. All GPUs and all drivers do not support an independent stencil buffer. If you need a stencil buffer, then you need to make a Depth=24, Stencil=8 buffer, also called D24S8. Please search for the example about GL_EXT_packed_depth_stencil on this page.”
Actually, that’s not the reason. Drivers can ignore specific formats, but only by using GL_UNSUPPORTED. If it actually comes back as GL_INCOMPLETE_ATTACHMENT, then that means you have done something that can’t be done.
What likely happened is that “glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, 8, GL_STENCIL_INDEX, sx, sy);” failed with a glError. Thus, the stencil buffer could not be created, and when you bind it, it isn’t of stencil type.
Changing the internal format for glRenderbufferStorageMultisample to GL_DEPTH24_STENCIL8_EXT, and the attachment point for glFramebufferRenderbufferEXT to DEPTH rather than STENCIL works.