sampler2DMultiview; textureMultiview;
@@ -94,6 +94,18 @@ const char* lovrShaderFragmentPrefix = ""
"#else \n"
"uniform lowp int lovrViewID; \n"
"#endif \n"
+"#ifdef MULTIVIEW \n"
+"#define sampler2DMultiview sampler2DArray \n"
+"vec4 textureMultiview(sampler2DMultiview t, vec2 uv) { \n"
+" return texture(t, vec3(uv, lovrViewID)); \n"
+"} \n"
+"#else \n"
+"#define sampler2DMultiview sampler2D \n"
+"vec4 textureMultiview(sampler2DMultiview t, vec2 uv) { \n"
+" uv = clamp(uv, 0., 1.) * vec2(.5, 1.) + lovrViewID * vec2(.5, 0.); \n"
+" return texture(t, uv); \n"
+"} \n"
+"#endif \n"
"#line 0 \n";
const char* lovrShaderFragmentSuffix = ""
