Bug 1426027 - Update gfxVRGVR to reflect latest GoogleVR NDK API r=kip
MozReview-Commit-ID: E082AW3V52M
--- a/gfx/vr/gfxVRGVR.cpp
+++ b/gfx/vr/gfxVRGVR.cpp
@@ -37,17 +37,17 @@
#if defined(MOZ_CHECK_GVR_ERRORS)
#define GVR_LOGTAG "GeckoWebVR"
#include <android/log.h>
#define GVR_CHECK(X) X; \
{ \
gvr_context* context = (mPresentingContext ? mPresentingContext : GetNonPresentingContext()); \
if (context && (gvr_get_error(context) != GVR_ERROR_NONE)) { \
__android_log_print(ANDROID_LOG_ERROR, GVR_LOGTAG, \
- "GVR ERROR: %s at%s:%s:%d", \
+ "GVR ERROR: %s at:%s:%s:%d", \
gvr_get_error_string(gvr_get_error(context)), \
__FILE__, __FUNCTION__, __LINE__); \
gvr_clear_error(context); \
} else if (!context) { \
__android_log_print(ANDROID_LOG_ERROR, GVR_LOGTAG, \
"UNABLE TO CHECK GVR ERROR: NO CONTEXT"); \
} \
}
@@ -271,16 +271,17 @@ bool
VRDisplayGVR::SubmitFrame(const mozilla::layers::EGLImageDescriptor* aDescriptor,
const gfx::Rect& aLeftEyeRect,
const gfx::Rect& aRightEyeRect)
{
if (!mPresentingContext) {
GVR_LOG("Unable to submit frame. No presenting context")
return false;
}
+
if (!sGLContextEGL) {
GVR_LOG("Unable to submit frame. No GL Context");
return false;
}
if (!sGLContextEGL->MakeCurrent()) {
GVR_LOG("Failed to make GL context current");
return false;
@@ -577,17 +578,17 @@ VRDisplayGVR::EnableControllers(const bo
void
VRDisplayGVR::UpdateControllers(VRSystemManager* aManager)
{
if (!mControllerContext) {
return;
}
- GVR_CHECK(gvr_controller_apply_arm_model(mControllerContext, GVR_CONTROLLER_RIGHT_HANDED,GVR_ARM_MODEL_FOLLOW_GAZE, mHeadMatrix));
+ GVR_CHECK(gvr_controller_apply_arm_model(mControllerContext, 0, mController->GetHand() == dom::GamepadHand::Right ? GVR_CONTROLLER_RIGHT_HANDED : GVR_CONTROLLER_LEFT_HANDED, GVR_ARM_MODEL_FOLLOW_GAZE, mHeadMatrix));
GVR_CHECK(gvr_controller_state_update(mControllerContext, 0, mControllerState));
mController->Update(mControllerState, aManager);
}
void
VRDisplayGVR::GetControllers(nsTArray<RefPtr<VRControllerHost> >& aControllerResult)
{