[Gear VR] Engine Changes Requested (for Mobile VR Jam)

  1. MSAA patch below. I’ve had issues with the patch and devices running Lollipop, but that’s been hit or miss. We’re still working on a real solution for this.
  2. Virtual head model is on the short list, and should be simple enough to patch into 4.7. I’ll update this as soon as we get something in.
  3. Yes, there’s a JNI threading issue that cropped up. I’m working on a fix as we speak.
  4. This is a bit further down the list and I need to do a bit of investigation to see how involved gesture support will be. I’ll update once I have a better idea.

For a temporary hacked 2X MSAA, replace FramebufferTexture2D() in OpenGLES2.h with this:



	static FORCEINLINE void FramebufferTexture2D(GLenum Target, GLenum Attachment, GLenum TexTarget, GLuint Texture, GLint Level)
	{
		check(Attachment == GL_COLOR_ATTACHMENT0 || Attachment == GL_DEPTH_ATTACHMENT);
#if 1
		static bool Init = false;
		static GLuint DepthBuffer;

		if (!SupportsMultisampledRenderToTexture())
		{
			glFramebufferTexture2D(Target, Attachment, TexTarget, Texture, Level);
		}
		else
		{
			if (Attachment == GL_DEPTH_ATTACHMENT)
			{
				if (!Init)
				{
					glGenRenderbuffers(1, &DepthBuffer);
					glBindRenderbuffer(GL_RENDERBUFFER, DepthBuffer);
					glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 2, GL_DEPTH_COMPONENT24, 2048, 1024);
					glBindRenderbuffer(GL_RENDERBUFFER, 0);
					Init = true;
				}

				glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DepthBuffer);
			}
			else
			{
				glFramebufferTexture2DMultisampleEXT(Target, Attachment, TexTarget, Texture, Level, 2);
			}
		}
#else
		glFramebufferTexture2D(Target, Attachment, TexTarget, Texture, Level);
#endif
		VERIFY_GL(FramebufferTexture_2D)
	}