Make lovrViewID signed on Oculus Mobile

The "mask" example was failing on Oculus Mobile on the line of glsl:
if (lovrViewID == 1) {
because lovrViewID was unsigned and 1 was signed. One way to fix this would be to replace 1 with 1u as that is unsigned, but this would be the wrong fix because lovrViewID is in fact signed on all platforms other than Oculus Mobile. lovrViewID was depending on platform defined to either gl_ViewportIndex (signed), a signed uniform, or gl_ViewID_OVR (unsigned). The solution is to place an explicit cast in the multiview definition of lovrViewID so that it is signed on all platforms.
This commit is contained in:
mcc 2019-09-11 18:22:06 -04:00
parent cc3a3ed302
commit 38f4204661
1 changed files with 1 additions and 1 deletions

View File

@ -40,7 +40,7 @@ const char* lovrShaderVertexPrefix = ""
"uniform lowp int lovrViewportCount; \n"
"#if defined MULTIVIEW \n"
"layout(num_views = 2) in; \n"
"#define lovrViewID gl_ViewID_OVR \n"
"#define lovrViewID (int(gl_ViewID_OVR)) \n"
"#elif defined INSTANCED_STEREO \n"
"#define lovrViewID gl_ViewportIndex \n"
"#else \n"