Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quellcode-Bibliothek OculusSession.cpp   Sprache: C

 
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ * License * file
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#ifndef XP_WIN
#  error "Oculus support only available for Windows"
#endif

#include <math.h>
#include <d3d11.h>

#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/dom/GamepadEventTypes.h"
#include "mozilla/dom/GamepadBinding.h"
#include "mozilla/gfx/DeviceManagerDx.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/SharedLibrary.h"
includeOculusSessionjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26

/** XXX The DX11 objects and quad blitting could be encapsulatedmozilla.
 *    into a separate object if either Oculus starts supporting
 *     non-Windows platforms or the blit is needed by other HMD\
 *     drivers.
 *     Alternately, we could remove the extra blit for
 *     Oculus as well with some more refactoring.
 */


// See CompositorD3D11Shaders.h
namespace mozilla  *    into a separate object *     non-Windows platforms or the *     Alternately, we  *     Oculus as well with some more refactoring. java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 {
struct 
const* mData
  size_t   ;

  ovr_GetVersionString;
extern ShaderBytes  ovr_TraceMessage;
}/  java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
}  

using static ovr_GetTrackerDesc;
using static pfn_ovr_Destroy ;
static ovr_GetSessionStatus;

 {

 pfn_ovr_Initializeovr_Initialize=;
static pfn_ovr_Shutdown  ovr_GetTrackingOriginType;
static ovr_GetLastErrorInfo;
static pfn_ovr_GetVersionStringpfn_ovr_SpecifyTrackingOrigin  ;
staticpfn_ovr_TraceMessage =;
static pfn_ovr_IdentifyClient  pfn_ovr_GetTrackingState=;
static  =;
static static pfn_ovr_GetTrackerPose  ;
staticpfn_ovr_GetTrackerDesc = ;
static pfn_ovr_Create static ovr_GetConnectedControllerTypesnullptr  ovr_GetTouchHapticsDesc;
static pfn_ovr_Destroypfn_ovr_SubmitControllerVibration =
static pfn_ovr_GetSessionStatus ovr_GetSessionStatus = nullptr;
static pfn_ovr_IsExtensionSupported ovr_IsExtensionSupported = nullptr;
static pfn_ovr_EnableExtensionnullptr
  ovr_SetTrackingOriginType;
static java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 12
static pfn_ovr_RecenterTrackingOrigin  =nullptr
  ovr_SpecifyTrackingOrigin;
static pfn_ovr_ClearShouldRecenterFlag static ovr_GetBoundaryGeometry;
static ovr_GetTrackingState ;
static pfn_ovr_GetDevicePoses ovr_GetDevicePoses
static   ;
static  =nullptr
  ovr_GetConnectedControllerTypes
    nullptr;
  ovr_GetTouchHapticsDesc;
static pfn_ovr_SetControllerVibration ovr_SetControllerVibration = nullptr;
static pfn_ovr_SubmitControllerVibration ovr_SubmitControllerVibration =
    nullptr;
 pfn_ovr_GetControllerVibrationState java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
    nullptr  ovr_GetPredictedDisplayTime;
static java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
    
   =;
static  pfn_ovr_GetFloatArray ;
 pfn_ovr_GetBoundaryGeometry = ;
static pfn_ovr_GetBoundaryDimensions  =;
 pfn_ovr_GetBoundaryVisible =nullptr
static pfn_ovr_RequestBoundaryVisible ovr_GetExternalCameras;
  ovr_GetTextureSwapChainLengthnullptr
#if XP_WIN  ovr_CreateTextureSwapChainDXjava.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
static pfn_ovr_GetTextureSwapChainCurrentIndex
     =nullptr
static ovr_GetTextureSwapChainBufferGL
staticnullptr
staticpfn_ovr_DestroyTextureSwapChain = ;
static  ovr_GetMirrorTextureBufferGLnullptr
staticifdef
static  define 4
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
staticdefinejava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
static pfn_ovr_EndFrameconst  =;
 pfn_ovr_SubmitFrame  nullptr
static pfn_ovr_GetPerfStats ovr_GetPerfStats [] ovrControllerType_LTouch
 pfn_ovr_ResetPerfStats =;
static pfn_ovr_GetPredictedDisplayTime ovr_GetPredictedDisplayTime = nullptr;
static pfn_ovr_GetTimeInSeconds ovr_GetTimeInSecondsconstchar[2 ={Oculus ("

static pfn_ovr_SetBool ovr_SetBool = nullptr;
 pfn_ovr_GetInt  ;
static pfn_ovr_SetInt ovr_SetIntdom::};
static pfn_ovr_GetFloat ovr_GetFloat = nullptr;
static pfn_ovr_SetFloat
static ovr_GetFloatArray;
static    (),()0,ovrButton , ,
static ovr_GetString;
static pfn_ovr_SetString ()0 ovrButton0 ovrButtonovrButton_RThumb,
  ovr_GetExternalCamerasnullptr
static pfn_ovr_SetExternalCameraProperties 
    ;

XP_WIN
static ovr_CreateTextureSwapChainDX;
static     ovrTouch_RIndexTrigger ()0 ovrTouch,
    ;
static pfn_ovr_CreateMirrorTextureDX 
staticvoid( &aInputState aHandIdx
#endif

static pfn_ovr_CreateTextureSwapChainGL ovr_CreateTextureSwapChainGL = nullptr;
 pfn_ovr_GetTextureSwapChainBufferGL =
    nullptr;
    .[]  .;
    {

#ifdef 
#  java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 3
#else
#  define BUILD_BITS.buttonTouched=(uint64_t< );
#endif

#VRFieldOfView(constovrFovPortaFOV
OVR_MAJOR_VERSION
#define OVR_MINOR_VERSION 19

static const uint32_t kNumOculusButtons =.  (aFOV8 ;
static const uint32_t kNumOculusHaptcs = 1;
  .upDegrees=atanaFOVUpTan8.  ;
ovrControllerType  (aFOV) * 100/M_PI
ovrControllerType_RTouch}
const char* OculusControllerNames[2] = {"Oculus Touch (Left)",java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
                 OculusTouch()";
dom      (nullptr),
                                            mTextureSet),

mPSConstantBuffer)
   ovrButton ovrButton ovrButton , ovrButton_X
, (ovrButton0}
    {mRemainingVibrateTime
, ()0,
};

ovrTouch OculusControllerTouches[2][kNumOculusButtons] = {
    {ovrTouch_LIndexTrigger, (ovrTouch)0, (ovrTouch
    ,ovrTouch_Y},
    {bool::(mozilla:::& ,
     , ,ovrTouch_RThumbRest
};

void UpdateButton(const ovrInputState& aInputState,  if (::dom_vr_puppet_enabled)) {
                  uint32_t aButtonIdx, VRControllerState& aControllerState) {
  if(.Buttons [aHandIdx]){
    aControllerState.buttonPressed |= ((uint64_t)1 <<     false
aControllerState[aButtonIdx  .f
  } else {
    aControllerState[aButtonIdx 00;
  }
  
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}

VRFieldOfView FromFovPort
VRFieldOfView;
  fovInfo. }
  fovInfo.rightDegrees =atanaFOVRightTan) *10.  ;
  fovInfo    returnfalse
  fovInfo
  return ;
}

}  // anonymous namespace

namespace// unnecessary D3D objects creation. But it will cause a WPT fail in Win 7
namespace {

OculusSession::OculusSession}
    :VRSession
      (nullptr
  if (!(false)
      mInitFlagsovrInitFlags,
      mTextureSet(nullptr),
      (nullptr
  if !InitStateaSystemState{
      return;
      mVSConstantBuffer(nullptrjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
      mPSConstantBuffer)java.lang.StringIndexOutOfBoundsException: Range [33, 34) out of bounds for length 33
      (nullptr
      mInputLayout(nullptr),
     mRemainingVibrateTime}java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
     mHapticPulseIntensity{},
      mIsPresenting(false) {}

OculusSession::~OculusSession() { Shutdown(); }

bool OculusSession::Initialize(mozilla// Do not immediately re-initialize with an invisible session after
java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
  if (StaticPrefs::dom_vr_puppet_enabled()) {
java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
    return false;
  }
  if    (mIsPresenting {
    return false;
  }

  if (aDetectRuntimesOnly
    if (LoadOvrLib()) {
      aSystemState
          VRDisplayCapabilityFlags;
    }
    return;
  }

  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
    return false
  }
  ;
    return
  }
  // Ideally, we should move LoadOvrLib() up to the first line to avoid
//unnecessary  objects. But itwill a WPTfail Win7
  // debug.
if!(){
     false
  }
  java.lang.StringIndexOutOfBoundsException: Range [0, 63) out of bounds for length 58
// with visible session once WebVR content starts rendering.
java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
    return
}
 !()){
    
  }

   =IntSizedisplayState. * ,
                              aSystemState;
  return;
}

void/java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
  / Render a black frame
  (&layer0sizeof))java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

  // traversal.
  if (mIsPresenting) {
    // We are currently rendering immersive content.(mSession, layers;
    
    return;
  }
vrInit_Invisible
    // We are already invisible
    ;
  }
  if (mLastPresentationEnd.IsNull()) {
    // There has been no presentation yet
    return;


  TimeDurationif =flags
java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
      StaticPrefs::java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 3
StopSession;
if((false){
      gfxWarningjava.lang.StringIndexOutOfBoundsException: Range [16, 17) out of bounds for length 0
    }
  }
}

void OculusSession:return;
/java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
  // traversal, we need to prevent the user from seeing the
  // last rendered frame.
  // We render black frames to cover up the transition.
  MOZ_ASSERTU()java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
   () java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
    // We are currently rendering immersive content.
    // Avoid interrupting the session..isConnected .HmdPresent
;
  }

s  ) 
    // We are invisible, nothing to cover up{
;
  }

 / Render a black frame
  ovrLayerEyeFov layer;
  }
  layer.Header.Type()java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
  ovrLayerHeadervoid:StartFrame::::&aSystemStatejava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
  ovr_SubmitFrame();
}

bool
  ovrInitFlagsboolOculusSessionStartPresentationjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
      (   *       VRDisplay.requestPresent() when the   *       in VRDisplayOculus::   *       Bailing out here prevents the crash but content    *       that frames are   *       See Bug    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 :dom_vr_oculus_invisible_enabled() && !bVisible) {
    flags = (java.lang.StringIndexOutOfBoundsException: Range [52, 25) out of bounds for length 54
  
  bool::(
    // The new state is the same, nothing to do:gfx& aLayer
return;
  }

  // Tear everything down
  ();
  StopSession();
  StopLib();

  // Start it back up
  if (!StartLib(flags)) {
    return     return;
  }
  if   }
    return false
  }
  return ;
}

voidint = 0
  StopRendering;
                                                        );
  StopLib;
  UnloadOvrLib();
  DestroyShaders();
}

void OculusSession::ProcessEvents(mozilla::gfx:    ("ovr_GetTextureSwapChainCurrentIndex .");
  if (!  }
    returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

 ;
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
aSystemState.isConnected .HmdPresent
    aSystemState.displayState.isMounted =  .PreScale.f/ (textureDescWidth
 .ShouldQuit

  }.(1f .fjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
   aSystemState.isConnected =false
    aSystemState  Matrix;
  }
  ();
  UpdateVisibility
  CoverTransitionsD3D11_VIEWPORT viewport
}

void OculusSession::StartFrame(mozilla::gfx::VRSystemState& aSystemState) {
  UpdateHeadsetPoseaSystemState;
  (aSystemState
  viewport =textureDesc;
    .TopLeftX;
  aSystemState.sensorState.inputFrameID++;
}

bool OculusSession::StartPresentation() {
  /**
   * XXX - We should resolve fail the promise returned by
   *       VRDisplay.requestPresent() when the DX11 resources fail allocation
   *       in VRDisplayOculus::StartPresentation().
   *       Bailing out here prevents the crash but content should be aware
   *       that frames are not being presented.
   *       See Bug 1299309.
   **/

  if (!ChangeVisibility(true)) {
     false
  }
  if!()){
    StopRendering();
    return false;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 3
mIsPresentingtrue
   true
}

 OculusSession() java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
mLastPresentationEnd ::();
  mIsPresenting 
}

bool:SubmitFrame
     mozilla::& ,
    ID3D11Texture2D*   voffset
mContext-(,,vbuffervsize, &voffset, &voffset);
    return;
  }

D3D11_TEXTURE2D_DESC  0;
    mContext-();

  int currentRenderTarget = 0;
  ovr_GetTextureSwapChainCurrentIndex ,
                                                      IASetPrimitiveTopology);
  if<ID3D11ShaderResourceView;
NS_WARNINGovr_GetTextureSwapChainCurrentIndexjava.lang.StringIndexOutOfBoundsException: Range [62, 63) out of bounds for length 62
return;
  }

  ID3D11RenderTargetView* view = mRTView[ ;

  float   ID3D11ShaderResourceView  .getjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
  mContext-ClearRenderTargetView,);
  mContext->OMSetRenderTargets(1,

  Matrix viewMatrix = Matrix::mContext-(0 ,sampler
  viewMatrix (UpdateConstantBuffers{
                  .f/(textureDescHeight;
  viewMatrix     false
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    orv = ovr_CommitTextureSwapChain(mSession, mTextureSet);

  Matrix transform2d;
  gfx(" .";

  D3D11_VIEWPORT;
  viewportjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
 .MaxDepth.f;
  .Header  ;
    .Header =
  viewport0 = mTextureSet;
  viewportTopLeftY;

  D3D11_RECT scissor;
  .left0
  .[1 =mFOVPort1;
  .top;
   .[0Pos=. *aLayer.;

  memcpy(&mVSConstants.layerTransform, &transform.[0.ize  . *aLayer.;
sizeof.layerTransform)
  memcpy(&layer[]Pos=textureDesc *aLayer.;
  .Viewport]Size=. * .rightEyeRect;
    .[1..h=. *aLayer;
   ( i  ;i<;+){
  mVSConstants.layerQuad =
      layer. [].
.[.. mFrameStartPose..;

mPSConstants[0  .fjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38

*  =mVertexBuffer
   =sizeof);
  UINTjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
>(,1&, vsize);
  mContext-/java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
  mContext-IASetInputLayoutmInputLayout
  mContext->RSSetViewports     * result is      * "health and safety warning", * OVR_UNQUALIFIED_SUCCESS) and ovr_SubmitFrame will not block * In this case, returning true would have resulted in an unthrottled
  mContext->RSSetScissorRects(1, &scissor);
  mContext-return;
    }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  i mOvrLib
  HRESULT =>CreateShaderResourceViewaTexture,
                                                 getter_AddRefs ;
  if   <> ;
    gfxWarning() << "Could
                 <
    return false requiredLength:GetSystemDirectoryW
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
erResourceView =srView)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
 >(0/* 0 == TexSlot::RGB */, 1, &viewPtr);
  // XXX Use Constant from TexSlot in CompositorD3D11.cpp?.(requiredLength

  ID3D11SamplerStatesampler mLinearSamplerState;
  mContext->PSSetSamplers(0    .SetLength);

  if (!UpdateConstantBuffers  .AppendPrintf("%d_%d.", , OVR_PRODUCT_VERSION);
java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
    return false;
  }

  mContext->  / If the env var is present, we override libName

  orv  searchPath_(LOVR_LIB_PATH
  if (libSearchPaths(0 ,searchPath
    NS_WARNINGjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    returnfalse;
  }

  ovrLayerEyeFov false
  memset(
  layer.   ( i=0 i <.Length++{
  layer.Header.Flags = 0;
  layer.ColorTexture[0] = mTextureSet;
  layer.ColorTexture[1] =    &  =libSearchPaths]
  layer.Fov[0] = mFOVPort[0];
layer[]=mFOVPort
  layerf.Assign)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
  .[.y=Height..;
  layer.Viewport
  layer.Viewport =LoadLibraryWithFlags.()java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
  layer.
  layer.Viewport[1].Pos.y = #  error "Unsupported platform
  layer.Viewportif!) 
 layer[1.ize=textureDescHeight.rightEyeRect;

  for (uint32_t
layer[]Orientation  [i..xjava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
    layer.RenderPose[i].Orientation.y = mFrameStartPose[i].java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 56
    layer.RenderPose[i].Orientationif!){\
    layer.RenderPose[i].Orientation.w = mFrameStartPose[i].Orientation.w;(_   \"
    .RenderPose].x=[i..xjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
    layer.RenderPose[i].Position.y = mFrameStartPose[i].Position.y;
    
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

  *layers layer;
  orv =();
/java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
  REQUIRE_FUNCTION)

  if (!OVR_UNQUALIFIED_SUCCESS(orv)) {
    /**
     * We wish to throttle the framerate for any case that the rendered
     * result is not visible.  In some cases, such as during the Oculus
     * "health and safety warning", orv will be > 0 (OVR_SUCCESS but not
     * OVR_UNQUALIFIED_SUCCESS) and ovr_SubmitFrame will not block.
     * In this case, returning true would have resulted in an unthrottled
     * render loop hiting excessive frame rates and consuming resources.
     */

    return false;
  }

  return true;
}

bool  REQUIRE_FUNCTIONovr_GetTrackingOriginType
  if mOvrLib
    // Already loaded, early exit
    return true;
  }
#  ()java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
 <nsString> libSearchPaths;
  nsString libName;
  nsString searchPath;

  for (;;) {
      REQUIRE_FUNCTION(vr_GetConnectedControllerTypes
        char16ptr_tsearchPathBeginWriting() .())java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
    if  ();
        ();
  ();
   ( <searchPath()){
      searchPath.Truncate(requiredLength);
      libSearchPaths.AppendElement(searchPath);
break
    }
R(ovr_GetBoundaryGeometry
  }
  libName.AppendPrintf();

  // search the path/module dir()java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
  .InsertElementsAt,u"

    REQUIRE_FUNCTION(ovr_DestroyTextureSwapChain);
  if REQUIRE_FUNCTION)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
     =_(LOVR_LIB_PATH;
    .InsertElementsAt01searchPath
  }

  if (_wgetenv();
  ();
  }

  if libName() 
    return(ovr_GetTimeInSeconds
  }

  REQUIRE_FUNCTION)
    nsString(ovr_SetInt
    nsString fullName;
    if  EQUIRE_FUNCTION);
      fullNameREQUIRE_FUNCTION);
    }else
    .(libPath+"\_ + libName)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
    }

    mOvrLib
    ifmOvrLib
      break;
    }
  }();
#else();
#e "platform"
#endif

  if (!mOvrLib) {
    return false;
(java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49

#define REQUIRE_FUNCTIONx                           
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
    if (!mOvrLib;
      printf_stderr(#_" false;
      goto fail
    }                                                  
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13

  REQUIRE_FUNCTION(ovr_Initialize);
  REQUIRE_FUNCTION(ovr_Shutdown);
  REQUIRE_FUNCTION(java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 22
 REQUIRE_FUNCTION);
  REQUIRE_FUNCTIONjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  REQUIRE_FUNCTION(ovr_IdentifyClient;
  REQUIRE_FUNCTION(ovr_GetHmdDesc);
  REQUIRE_FUNCTIONovr_GetTrackerCount
  REQUIRE_FUNCTION);
  REQUIRE_FUNCTION(ovr_Create);
  REQUIRE_FUNCTION(ovr_Destroy);
  REQUIRE_FUNCTION(ovr_GetSessionStatus);
  REQUIRE_FUNCTION(    (¶ms0 (params
  REQUIRE_FUNCTION(    paramsFlags aFlags
      params = OVR_MINOR_VERSION
  REQUIRE_FUNCTION(ovr_GetTrackingOriginTypeparams = nullptr;
  REQUIRE_FUNCTION(ovr_RecenterTrackingOrigin)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
  (ovr_SpecifyTrackingOrigin
  REQUIRE_FUNCTION(ovr_ClearShouldRecenterFlag
  REQUIRE_FUNCTION orv=) {
  REQUIRE_FUNCTION(ovr_GetDevicePoses);
  REQUIRE_FUNCTION(ovr_GetTrackerPose);
  REQUIRE_FUNCTION(ovr_GetInputState      mInitFlags;
  REQUIRE_FUNCTION       false
  REQUIRE_FUNCTION
  REQUIRE_FUNCTION  
()java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
     mInitFlags
REQUIRE_FUNCTION)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
  REQUIRE_FUNCTION(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  REQUIRE_FUNCTION(ovr_SetBoundaryLookAndFeel);
  REQUIRE_FUNCTIONovr_ResetBoundaryLookAndFeel
  REQUIRE_FUNCTION(ovr_GetBoundaryGeometry);
  REQUIRE_FUNCTION);
  REQUIRE_FUNCTION(ovr_GetBoundaryVisible);
(ovr_RequestBoundaryVisible
  REQUIRE_FUNCTIONovr_GetTextureSwapChainLength
  REQUIRE_FUNCTION/
  REQUIRE_FUNCTION(ovr_GetTextureSwapChainDesc);
(ovr_CommitTextureSwapChain
  REQUIRE_FUNCTION(ovr_DestroyTextureSwapChain =nullptr
   java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  REQUIRE_FUNCTION(java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 28
  REQUIRE_FUNCTION(ovr_GetRenderDesc2);
  REQUIRE_FUNCTION();
  REQUIRE_FUNCTION(java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 3
  REQUIRE_FUNCTION(ovr_EndFrame);
  REQUIRE_FUNCTION(ovr_SubmitFrame);
  REQUIRE_FUNCTION(ovr_GetPerfStats   luid
  REQUIRE_FUNCTION);
REQUIRE_FUNCTION);
  REQUIRE_FUNCTION(ovr_GetTimeInSeconds  (,);
  REQUIRE_FUNCTION(ovr_GetBoolorv=ovrSuccess
  REQUIRE_FUNCTION(ovr_SetTrackingOriginTypen)
  REQUIRE_FUNCTION
  REQUIRE_FUNCTION)
  REQUIRE_FUNCTIONtrue
  REQUIRE_FUNCTION(ovr_SetFloat);
  REQUIRE_FUNCTION(ovr_GetFloatArray/
  REQUIRE_FUNCTION(ovr_SetFloatArray);
  (ovr_GetString;
  REQUIRE_FUNCTION
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
REQUIRE_FUNCTION);

#ifdef XP_WIN

  REQUIRE_FUNCTION(ovr_CreateTextureSwapChainDX);RefPtr> = ::::()>();
REQUIRE_FUNCTION);
  REQUIRE_FUNCTION(  
  REQUIRE_FUNCTION if!()) 

java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

();
  REQUIRE_FUNCTION(ovr_GetTextureSwapChainBufferGL);
  REQUIRE_FUNCTION);
  REQUIRE_FUNCTION(ovr_GetMirrorTextureBufferGL(" tocreatevertex shaderforOculus")

#undef REQUIRE_FUNCTION

  java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 5

fail
       ((mDevice-(sRGBShader, sRGBShader,
  ();
        (" to createpixelshaderforOculus);
  return;
}

    }
  if (mOvrLib) {
    PR_UnloadLibrary(mOvrLib);
    mOvrLib = nullptr;
  }
}

bool::(ovrInitFlags) {
ifmInitFlags 0 
                             , );
    (&, , sizeof);
    params.Flags = aFlags;
     ifFAILED>CreateBuffer, ,
    params = nullptr
    params.ConnectionTimeoutMS = 0;

ovrResult  (&);

    if (orv == ovrSuccess)    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      mInitFlags = aFlags((mDevice-(cBufferDescnullptr
    }else
      return false;
}
  }
  MOZ_ASSERT(mInitFlags ==java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
   true
}

            ,(mLinearSamplerState{
  (){
          return false
    mInitFlags
  } )
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

bool OculusSession::StartSession() {
  // ovr_Create can be slow when no HMD is present and we wish
  // to keep the same oculus session when possible, so we detect
  
ovrHmdDesc = ovr_GetHmdDescNULL
  if desc = ovrHmd_None{
    // No HMD connected, destroy any existing session
    if (mSession) {
ovr_Destroy;
      mSession  false
    }
    return  
  }
  ifmSession nullptr
    // HMD Detected and we already have a session, let's keep using it.
return;
  }

/java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
  // try to create a new session
  ovrSession session;
  ovrGraphicsLuid luid FAILED>(&,&ata
  ovrResultgetter_AddRefs())) {
Success{
       false
    if (    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
NS_WARNINGovr_SetTrackingOriginType\"
    }
     = ;
    return  return tr;
  }

  // Failed to create a session for the HMD
 return;
}

void OculusSession::StopSession() {
  if (mSession) {
    ovr_Destroy(mSession);
    mSession nullptr;
  }
}

bool OculusSession
RefPtr>device::::()>(;
  if (!device                r);
    return;
  }
  if (!CreateD3DContext(device)}
    return false;
  }
  return;
}

bool OculusSession::CreateShaders() {
  if!) java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    if &)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
            sLayerQuadVS.mData ;
      NS_WARNING(" (*).pData =mPSConstants;
      ;
    }
  }

  if (!mQuadPS) {
if((mDevice-CreatePixelShader., .mLength
                                           ;
      NS_WARNING"tocreatepixel ";
return;
    }
  }

3D11_BUFFER_DESC(sizeof::),
                          ,
D3D11_USAGE_DYNAMIC);

  if (!mVSConstantBuffer) {
    if (FAILED(mDevice-   are is placethe and  textures
                                     
NS_WARNING    buffer)
      return false;
    }
  }

  if          for purposesBug13
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
i FAILED>(cBufferDesc,
                                     . = 1
      NS_WARNING(" . .width;
       ;
    }
  }

  if (!mLinearSamplerState) {
    CD3D11_SAMPLER_DESC. =1
if((>(
            &samplerDesc,  .  ;
NS_WARNINGFailedcreate Oculus
      return falsejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }
  }

  if (!mInputLayout) {
    D3D11_INPUT_ELEMENT_DESC layout[] = {
        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
         ,}
    };

    if (NS_WARNING ";
            layout, sizeof(layout) / sizeof(D3D11_INPUT_ELEMENT_DESC       ;
.mData.mLength
            getter_AddRefs(mInputLayout)mRTView();
      (Failedinput ";
      return;
    }
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

if!) 
    Vertex vertices[] = {
        {. .},{10 .},{. .} {.,10};
    CD3D11_BUFFER_DESC bufferDesc(sizeof(vertices), D3D11_BIND_VERTEX_BUFFER);
    data
false

    if (FAILED
                                     (mVertexBuffer){
(,
      return false;
    }
  }

  memset(&mVSConstants, 0, sizeof(mVSConstants));
  memset                                             DXGI_FORMAT_B8G8R8A8_UNORM;
  eturn;
}

void OculusSession::DestroyShaders() {}

bool OculusSession:UpdateConstantBuffers {
  HRESULT hr        NS_WARNING(
              FailedtoRenderTargetView   .)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
  resourceID3D11ShaderResourceView;

    >MapmVSConstantBuffer0D3D11_MAP_WRITE_DISCARD,
                     &resourceDXGI_FORMAT_B8G8R8A8_UNORM)java.lang.StringIndexOutOfBoundsException: Range [75, 76) out of bounds for length 75
  if (FAILEDgetter_AddRefs(rv);
    return false;
  }
  *(VertexShaderConstants        NS_WARNING
  mContext-UnmapmVSConstantBuffer );
  resource.pData = nullptr;

  hr = mContext->Map(mPSConstantBuffer,            ".)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
                     &resource);
  if (java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
    return false
  }
  *(PixelShaderConstants*)resource.pData = mPSConstants;
  mContext-Unmap, 0);

  ID3D11Buffer  = ;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  buffer
PSSetConstantBuffers )
  return true mTextureSet=;
}

bool OculusSession::StartRendering() {
   (mTextureSetjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    /**
     * The presentation format is determined by content, which describes the
     * left and right eye rectangles in the VRLayer.  The default, if no
     * coordinates are passed is to place the left and right eye textures
     * side-by-side within the buffer.
     *
     * XXX - An optimization would be to dynamically resize this buffer
     *       to accomodate sites that are choosing to render in a lower
     *       resolution or are using space outside of the left and right
     *       eye textures for other purposes.  (Bug 1291443)
     */


    ovrTextureSwapChainDesc desc;
    memset(&desc    state.capabilityFlags |= VRDisplayCapabilityFlags  }
  state.capabilityFlags |= VRDisplayCapabilityFlags:  state.capabilityFlags |= VRDisplayCapabilityFlags::  state.capabilityFlags |= VRDisplayCapabilityFlags::java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 47
    desc.  state.eyeFOV[VRDisplayState      FromFovPort(mFOVPort[VRDisplayState::Eye_Right
    desc.Format   ovrSizei texSize[2];
    desc.Width = mPresentationSize  for (uint32_t eye = 0; eye <     texSize[eye] = ovr_GetFovTextureSize(mSession                                         mFOVPort[eye], pixelsPerDisplayPixel);
    desc.Height = mPresentationSize.height;
    desc.MipLevels = 1;
    desc.SampleCount   state.nativeFramebufferScaleFactor = 1.0f;
    desc.StaticImage =  aSystemState.sensorState.pose.orientation[3] 
    desc.MiscFlags =   UpdateEyeParameters(aSystemState);
    desc.BindFlags = ovrTextureBind_DX_RenderTarget;

    ovrResult orv =
        ovr_CreateTextureSwapChainDX(mSession, mDevice, &desc, &mTextureSet);
    if (orv != ovrSuccess) {  sensorState.pose.orientation[3] = 1.0f;  // Default to an identity quaternion
      NS_WARNING(void OculusSession::UpdateStageParameters(VRDisplayState& 
      return false      ovr_GetBoundaryDimensions(mSession, ovrBoundary_PlayArea, &playArea  if (res == ovrSuccess) {
    }

    int     aState.stageSize.width = 1.0f;
    orv = ovr_GetTextureSwapChainLength(mSession
    if (orv != ovrSuccess) {
      NS_WARNING("ovr_GetTextureSwapChainLength failed"
      return false;
    }
    mTexture.SetLength(textureCount  aState.sittingToStandingTransform[3] = 0.0f;
    mRTView.SetLength(textureCount  aState.sittingToStandingTransform[4] = 0.0f;
    mSRV.SetLength  aState.sittingToStandingTransform[5] = 1.0f;
    for (  aState.sittingToStandingTransform[6] = 0.0f;
      ID3D11Texture2D* texture = nullptrjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      orv =  aState.sittingToStandingTransform[11] = 0.0f;
                                            IID_PPV_ARGS(&texture  aState.sittingToStandingTransform[13] = eyeHeight;
      if (void OculusSession::UpdateEyeParameters(VRSystemState& aState) {
        NS_WARNING(" }
          // This must be called every frame in order to
      }

        for (uint32_t eye = 0; eye < VRDisplayState    // As of Oculus 1.17 SDK, we must use the ovr_GetRenderDesc2 function to
      CD3D11_RENDER_TARGET_VIEW_DESC rtvDesc(D3D11_RTV_DIMENSION_TEXTURE2D,
                                                     renderDesc.HmdToEyePose.Position.x;
      HRESULT hr = mDevice-    aState.displayState.eyeTranslation[eye].z =
                                                   getter_AddRefs(rtView));
      if (FAILED(hr    pose.SetRotationFromQuaternion(
        NS_WARNING(
            "Failed to create RenderTargetView for Oculus texture swap chain.");
        texture->Release();
        return false                        renderDesc.HmdToEyePose.Orientation.w));
      }

      RefPtr                      renderDesc.HmdToEyePose.Position.z);
      CD3D11_SHADER_RESOURCE_VIEW_DESC  }
                                               DXGI_FORMAT_B8G8R8A8_UNORM
      hr = mDevice->         sizeof(float) * 16);
                                             getter_AddRefs(srv));
      if (FAILED(hr)) {
        NS_WARNING(
            " if (!matView[eye].Decompose(eyeTranslation, eyeRotation, eyeScale)) NS_WARNING("Failed to decompose eye pose matrix for Oculus    }
            "chain.");
        texture->Release();
        return false;
      }

      mTexture[i] = texture;
      mRTView[i
}
      texture->Release();
    }
  }
  return true;
}

bool OculusSession:    // XXX We might need to call ovr_GetPredictedDisplayTime even if we don't
  return mTextureSet !    predictedFrameTime = ovr_GetPredictedDisplayTime(mSession,   }
}

void OculusSession::StopRendering(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  mSRV
  mRTView.Clear();
  mTexture.Clear();

      aState.sensorState.pose.orientation
    ovr_DestroyTextureSwapChain(mSession, mTextureSet);
  }
  mTextureSet = nullptr;
  mIsPresenting = false;
}

bool OculusSession::InitState(VRSystemState& java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 0
  VRDisplayState& state     aState.sensorState.pose.angularAcceleration[2]  } else {
  strncpy(state.displayName.  strncpy(state.displayName.data
  state  if (trackingState.StatusFlags & ovrStatus_PositionTracked    float eyeHeight =
  state.isMounted = false;

  ovrHmdDesc desc = ovr_GetHmdDesc    aState.sensorState.pose.position[1    aState.sensorState.pose.position[2] =

  state.capabilityFlags = VRDisplayCapabilityFlags::Cap_None    aState.sensorState.pose.linearVelocity
  if (desc.AvailableTrackingCaps        VRDisplayCapabilityFlags::Cap_LinearAcceleration;
    state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_Orientation;
    aState.sensorState.pose.linearAcceleration[2] =  }
  }
  aState.sensorState.flags |= VRDisplayCapabilityFlags::Cap_MountDetection  aState.sensorState.flags |= VRDisplayCapabilityFlags}
    statevoid OculusSession::UpdateControllers(VRSystemState  if (!mSession) {
    state.capabilityFlags    return;
    state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_StageParameters;
  }
  state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_External;
  state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_MountDetection;
  state.capabilityFlags |=   if (!hasInputState) {
  state.capabilityFlags |= VRDisplayCapabilityFlags::  }
  state.blendMode = VRDisplayBlendMode::Opaque  EnumerateControllers(aState, inputState);
  state.reportsDroppedFramese, inputState);

  void OculusSession::UpdateControllerPose(VRSystemState&                                          const ovrInputState& ;aInputState) {
  mFOVPort[VRDisplayState::Eye_Right    // Left Touch Controller will always be at index 0 and

  state.eyeFOV[VRDisplayState::Eye_Left] =
      FromFovPort(mFOVPort[VRDisplayState::Eye_Left]);
  state.eyeFOV[VRDisplayState::Eye_Right] =
      FromFovPort(mFOVPort[VRDisplayState::Eye_Right]);

  float pixelsPerDisplayPixel = 1.0;
  ovrSizei texSize[2]      if (bNewController) {

  // get eye texture sizes
  for (uint32_t        controllerState.flags |=
    texSize[eye] = ovr_GetFovTextureSize(mSession        controllerState.flags |=
                                         mFOVPort[        controllerState.flags |=
  }

  // take the max of both for eye resolution      if (bNewController || trackingState.HandStatusFlags[handIdx                                ovrStatus_OrientationTracked) {
  state.eyeResolution        controllerState.pose.orientation[3] =        controllerState.pose.angularVelocity[0] = pose.AngularVelocity.x;
                                       texSize        controllerState.pose.angularAcceleration[0] =
  state            pose.AngularAcceleration.y;
                                        texSize[            pose.AngularAcceleration.z;
  state.nativeFramebufferScaleFactor      } else {

  // default to an identity quaternion
  aSystemState.sensorState.pose.orientation[3] =           trackingState.HandStatusFlags[handIdx] & ovrStatus_PositionTracked) {

  UpdateStageParameters(        controllerState.pose.position[2] = pose.ThePose        controllerState.pose.linearVelocity[0] = pose.LinearVelocity        controllerState.pose.linearVelocity[1] = pose.LinearVelocity        controllerState.pose.linearVelocity[2] =        controllerState.pose        controllerState.pose.linearAcceleration[2] = posejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  UpdateEyeParameters(aSystemState);

  VRHMDSensorState& sensorState }
  
      (VRDisplayCapabilityFlagsvoid OculusSession::EnumerateControllers(VRSystemState&&nbsp;aState,
                                     VRDisplayCapabilityFlags::Cap_Orientation |
  for (uint32_t handIdx = 0; handIdx < 2; handIdx++)     // Left Touch Controller will always be at index 0 and
  sensorState.pose.    if (aInputState.ControllerType & OculusControllerTypes[handIdx])       // Touch Controller detected

  return true;
}

void OculusSession::UpdateStageParameters(VRDisplayState& aState        controllerState.hand = OculusControllerHand[handIdx];
  ovrVector3f playArea;
  ovrResult res =
      ovr_GetBoundaryDimensions(mSession, ovrBoundary_PlayArea, &playArea);
  if (res        controllerState.type = VRControllerType::OculusTouch;
    aState.stageSize.width      // Touch Controller not detected
    aState.        // Clear any newly disconnected ontrollers
  } else {
    // If we fail, fall back to reasonable defaults.      }
    // 1m x 1m space
    aState.stageSize.width = 1.0f;
    aState.stageSize.height = 1.0f;
  }

  float eyeHeight =
      ovr_GetFloat(mSession, OVR_KEY_EYE_HEIGHT, OVR_DEFAULT_EYE_HEIGHT);

  aState.sittingToStandingTransform[0] = 1.0f;
  aState.sittingToStandingTransform[1] = 0.0f;
  aState.sittingToStandingTransform[2] = 0.0f;
  aState.sittingToStandingTransform[3] = 0.0f;

  aState.sittingToStandingTransform[4] = 0.0f;
  aState.sittingToStandingTransform[5] = 1.0f;
  aState.sittingToStandingTransform[6] = 0.0f;
  aState.sittingToStandingTransform[7] = 0.0f;

  aState.sittingToStandingTransform[8] = 0.0f;
  aState.sittingToStandingTransform[9] = 0.0f;
  aState.sittingToStandingTransform[10]  for (uint32_t handIdx = 0; handIdx < 2; handIdx++) {
  aState.    // and Right Touch Controller will always be at index 1

  aState    if (aInputState.ControllerType & OculusControllerTypes[handIdx]) {      // Update Button States
  aState.sittingToStandingTransform[13] = eyeHeight;
  aState.sittingToStandingTransform[14] = 0.0f;
  aState.sittingToStandingTransform[15] = 1.0f;
}

void OculusSession::UpdateEyeParameters      VRSession::UpdateTrigger(controllerState, buttonIdx,
  if (!mSession) {
    return;
  }
  // This must be called every frame in order to
  // account for continuous adjustments to ipd.
  gfx::Matrix4x4 headToEyeTransforms[2];
  for (uint32_t eye                                aInputState.HandTrigger[handIdx],
    // As of Oculus 1.17 SDK, we must use the ovr_GetRenderDesc2 function to
    // return the updated version of ovrEyeRenderDesc.  This is normally done by
    // the Oculus static lib shim, but we need to do this explicitly as we are
    // loading the Oculus runtime dll directly.
    ovrEyeRenderDesc renderDesc =
        ovr_GetRenderDesc2(mSession, (ovrEyeType)eye      // Button 5: B
    aState.displayState.eyeTranslation      ++buttonIdx;
        renderDesc.HmdToEyePose.Position.x;
    aState.displayState.eyeTranslation[eye].y =
        renderDesc.HmdToEyePose.Position.y;
    aState.displayState      MOZ_ASSERT(buttonIdx == kNumOculusButtons);
        renderDesc.HmdToEyePose.Position      // Update Thumbstick axis

    Matrix4x4 pose;
    pose.SetRotationFromQuaternion(
        gfx::Quaternion(-renderDesc.      // Axis 2, 3: placeholder axes for thumbstick.
                        -renderDesc      }
                        -renderDesc.HmdToEyePose      axisIdx++;
                        renderDesc.HmdToEyePose.Orientation.w
    pose.PreTranslate(renderDesc.HmdToEyePose.Position.x,
                      renderDesc.HmdToEyePose.Position.y,
                      renderDesc.HmdToEyePose.Position.z)      controllerState.axisValue[axisIdx] = axisValue;
    pose.Invert      MOZ_ASSERT(axisIdx == kNumOculusAxes);
    headToEyeTransforms[eye        controllerState, aState.displayState.lastSubmittedFrameId  }
  }
  void OculusSession::UpdateTelemetry(VRSystemState& aSystemState  if (!mSession) {

    if (ovr_GetPerfStats(mSession, &perfStats) == ovrSuccess) {
  memcpy(matView[      aSystemState.displayState.droppedFrameCount =
         sizeof(float) * 16);
  memcpy  }
         sizeof}

void OculusSession::VibrateHaptic(uint32_t aControllerIdx,
    Point3D eyeTranslation;
    Quaternion eyeRotation;
    Point3D eyeScale;
    if    return;
      NS_WARNING("Failedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }

    eyeRotation.Invert  MOZ_ASSERT(aControllerIdx >= 0 && aControllerIdx <= 1)  mHapticPulseIntensity[aControllerIdx] = aIntensity > 1.0 ? 1.0 : aIntensity;
    mFrameStartPose[eye].Orientation
    mFrameStartPose[eye].Orientation.y = eyeRotation.y;
    mFrameStartPose[eye].Orientation.zjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 31
    mFrameStartPose[eye].Orientation.w = eyeRotation  if (result != ovrSuccess) {
    mFrameStartPose[eye].Position    gfxWarning() << "ovr_SetControllerVibration failed.";
    mFrameStartPose[eye].Position.y = void OculusSession::StopVibrateHaptic(uint32_t aControllerIdx) {
    mFrameStartPose[eye].Position.z   }
  }
}

void OculusSession::UpdateHeadsetPose  mRemainingVibrateTime[aControllerIdx] = 0.0f;
  if (!mSession) 
    return  ovrResult result = ovr_SetControllerVibration(mSession, hand, 0  if (result != ovrSuccess) {
  }
  double predictedFrameTime = 0.0f;
  if (StaticPrefs::java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 23
    // XXX We might need to call ovr_GetPredictedDisplayTime even if we don't
    // use the result. If we don't call it, the Oculus driver will spew out many
    // warnings...
    predictedFrameTime = ovr_GetPredictedDisplayTime  // The Oculus API and hardware takes at least 33ms to respond
  }
  ovrTrackingState trackingState =
      ovr_GetTrackingState(mSession, predictedFrameTime, true);
  ovrPoseStatef& pose(trackingState  // we should use the buffered haptic feedback API's.

  aState.sensorState.timestamp = pose.TimeInSeconds;

  if (trackingState.StatusFlags & ovrStatus_OrientationTracked    return;
    aState.sensorState.flags |= VRDisplayCapabilityFlags:  mLastHapticUpdate = now;

    aState.sensorState.pose      continue;
    aState    mRemainingVibrateTime[i] -= deltaTime;
    aState.sensorState    if (mRemainingVibrateTime[i] > 0.0f) {
    aState.sensorState.pose.orientation[3                                                    mHapticPulseIntensity[i]);

    aState.sensorState        gfxWarning() << "ovr_SetControllerVibration failed.";
    aState      StopVibrateHaptic(i);
    aState.  }

    java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
        VRDisplayCapabilityFlags::Cap_AngularAcceleration;

    aState.sensorState.pose.angularAcceleration[0] = pose.AngularAcceleration.x;
    aState.sensorState.pose.angularAcceleration[1] = pose.AngularAcceleration.y;
    aState.sensorState.pose.angularAcceleration[2] = pose.AngularAcceleration.z;
  } else {
    // default to an identity quaternion
    aState.sensorState.pose.orientation[3] = 1.0f;
  }

  if (trackingState.StatusFlags & ovrStatus_PositionTracked) {
    float eyeHeight =
        ovr_GetFloat(mSession, OVR_KEY_EYE_HEIGHT, OVR_DEFAULT_EYE_HEIGHT);
    aState.sensorState.flags |= VRDisplayCapabilityFlags::Cap_Position;

    aState.sensorState.pose.position[0] = pose.ThePose.Position.x;
    aState.sensorState.pose.position[1] = pose.ThePose.Position.y - eyeHeight;
    aState.sensorState.pose.position[2] = pose.ThePose.Position.z;

    aState.sensorState.pose.linearVelocity[0] = pose.LinearVelocity.x;
    aState.sensorState.pose.linearVelocity[1] = pose.LinearVelocity.y;
    aState.sensorState.pose.linearVelocity[2] = pose.LinearVelocity.z;

    aState.sensorState.flags |=
        VRDisplayCapabilityFlags::Cap_LinearAcceleration;

    aState.sensorState.pose.linearAcceleration[0] = pose.LinearAcceleration.x;
    aState.sensorState.pose.linearAcceleration[1] = pose.LinearAcceleration.y;
    aState.sensorState.pose.linearAcceleration[2] = pose.LinearAcceleration.z;
  }
  aState.sensorState.flags |= VRDisplayCapabilityFlags::Cap_External;
  aState.sensorState.flags |= VRDisplayCapabilityFlags::Cap_MountDetection;
  aState.sensorState.flags |= VRDisplayCapabilityFlags::Cap_Present;
}

void OculusSession::UpdateControllers(VRSystemState& aState) {
  if (!mSession) {
    return;
  }

  ovrInputState inputState;
  bool hasInputState = ovr_GetInputState(mSession, ovrControllerType_Touch,
                                         &inputState) == ovrSuccess;

  if (!hasInputState) {
    return;
  }

  EnumerateControllers(aState, inputState);
  UpdateControllerInputs(aState, inputState);
  UpdateControllerPose(aState, inputState);
}

void OculusSession::UpdateControllerPose(VRSystemState& aState,
                                         const ovrInputState& aInputState) {
  ovrTrackingState trackingState = ovr_GetTrackingState(mSession, 0.0, false);
  for (uint32_t handIdx = 0; handIdx < 2; handIdx++) {
    // Left Touch Controller will always be at index 0 and
    // and Right Touch Controller will always be at index 1
    VRControllerState& controllerState = aState.controllerState[handIdx];
    if (aInputState.ControllerType & OculusControllerTypes[handIdx]) {
      ovrPoseStatef& pose = trackingState.HandPoses[handIdx];
      bool bNewController = !(controllerState.flags &
                              dom::GamepadCapabilityFlags::Cap_Orientation);
      if (bNewController) {
        controllerState.flags |= dom::GamepadCapabilityFlags::Cap_Orientation;
        controllerState.flags |= dom::GamepadCapabilityFlags::Cap_Position;
        controllerState.flags |=
            dom::GamepadCapabilityFlags::Cap_AngularAcceleration;
        controllerState.flags |=
            dom::GamepadCapabilityFlags::Cap_LinearAcceleration;
        controllerState.flags |=
            dom::GamepadCapabilityFlags::Cap_GripSpacePosition;
      }

      if (bNewController || trackingState.HandStatusFlags[handIdx] &
                                ovrStatus_OrientationTracked) {
        controllerState.pose.orientation[0] = pose.ThePose.Orientation.x;
        controllerState.pose.orientation[1] = pose.ThePose.Orientation.y;
        controllerState.pose.orientation[2] = pose.ThePose.Orientation.z;
        controllerState.pose.orientation[3] = pose.ThePose.Orientation.w;
        controllerState.pose.angularVelocity[0] = pose.AngularVelocity.x;
        controllerState.pose.angularVelocity[1] = pose.AngularVelocity.y;
        controllerState.pose.angularVelocity[2] = pose.AngularVelocity.z;
        controllerState.pose.angularAcceleration[0] =
            pose.AngularAcceleration.x;
        controllerState.pose.angularAcceleration[1] =
            pose.AngularAcceleration.y;
        controllerState.pose.angularAcceleration[2] =
            pose.AngularAcceleration.z;
        controllerState.isOrientationValid = true;
      } else {
        controllerState.isOrientationValid = false;
      }
      if (bNewController ||
          trackingState.HandStatusFlags[handIdx] & ovrStatus_PositionTracked) {
        controllerState.pose.position[0] = pose.ThePose.Position.x;
        controllerState.pose.position[1] = pose.ThePose.Position.y;
        controllerState.pose.position[2] = pose.ThePose.Position.z;
        controllerState.pose.linearVelocity[0] = pose.LinearVelocity.x;
        controllerState.pose.linearVelocity[1] = pose.LinearVelocity.y;
        controllerState.pose.linearVelocity[2] = pose.LinearVelocity.z;
        controllerState.pose.linearAcceleration[0] = pose.LinearAcceleration.x;
        controllerState.pose.linearAcceleration[1] = pose.LinearAcceleration.y;
        controllerState.pose.linearAcceleration[2] = pose.LinearAcceleration.z;

        float eyeHeight =
            ovr_GetFloat(mSession, OVR_KEY_EYE_HEIGHT, OVR_DEFAULT_EYE_HEIGHT);
        controllerState.pose.position[1] -= eyeHeight;
        controllerState.isPositionValid = true;
      } else {
        controllerState.isPositionValid = false;
      }
      controllerState.targetRayPose = controllerState.pose;
    }
  }
}

void OculusSession::EnumerateControllers(VRSystemState& aState,
                                         const ovrInputState& aInputState) {
  for (uint32_t handIdx = 0; handIdx < 2; handIdx++) {
    // Left Touch Controller will always be at index 0 and
    // and Right Touch Controller will always be at index 1
    VRControllerState& controllerState = aState.controllerState[handIdx];
    if (aInputState.ControllerType & OculusControllerTypes[handIdx]) {
      // Touch Controller detected
      if (controllerState.controllerName[0] == '\0') {
        // Controller has been just enumerated
        strncpy(controllerState.controllerName.data(),
                OculusControllerNames[handIdx],
                controllerState.controllerName.size());
        controllerState.hand = OculusControllerHand[handIdx];
        controllerState.targetRayMode = gfx::TargetRayMode::TrackedPointer;
        controllerState.numButtons = kNumOculusButtons;
        controllerState.numAxes = kNumOculusAxes;
        controllerState.numHaptics = kNumOculusHaptcs;
        controllerState.type = VRControllerType::OculusTouch;
      }
    } else {
      // Touch Controller not detected
      if (controllerState.controllerName[0] != '\0') {
        // Clear any newly disconnected ontrollers
        memset(&controllerState, 0, sizeof(VRControllerState));
      }
    }
  }
}

void OculusSession::UpdateControllerInputs(VRSystemState& aState,
                                           const ovrInputState& aInputState) {
  const float triggerThreshold =
      StaticPrefs::dom_vr_controller_trigger_threshold();

  for (uint32_t handIdx = 0; handIdx < 2; handIdx++) {
    // Left Touch Controller will always be at index 0 and
    // and Right Touch Controller will always be at index 1
    VRControllerState& controllerState = aState.controllerState[handIdx];
    if (aInputState.ControllerType & OculusControllerTypes[handIdx]) {
      // Update Button States
      controllerState.buttonPressed = 0;
      controllerState.buttonTouched = 0;
      uint32_t buttonIdx = 0;

      // Button 0: Trigger
      VRSession::UpdateTrigger(controllerState, buttonIdx,
                               aInputState.IndexTrigger[handIdx],
                               triggerThreshold);
      ++buttonIdx;
      // Button 1: Grip
      VRSession::UpdateTrigger(controllerState, buttonIdx,
                               aInputState.HandTrigger[handIdx],
                               triggerThreshold);
      ++buttonIdx;
      // Button 2: a placeholder button for trackpad.
      UpdateButton(aInputState, handIdx, buttonIdx, controllerState);
      ++buttonIdx;
      // Button 3: Thumbstick
      UpdateButton(aInputState, handIdx, buttonIdx, controllerState);
      ++buttonIdx;
      // Button 4: A
      UpdateButton(aInputState, handIdx, buttonIdx, controllerState);
      ++buttonIdx;
      // Button 5: B
      UpdateButton(aInputState, handIdx, buttonIdx, controllerState);
      ++buttonIdx;
      // Button 6: ThumbRest
      UpdateButton(aInputState, handIdx, buttonIdx, controllerState);
      ++buttonIdx;

      MOZ_ASSERT(buttonIdx == kNumOculusButtons);

      // Update Thumbstick axis
      uint32_t axisIdx = 0;
      // Axis 0, 1: placeholder axes for trackpad.
      axisIdx += 2;

      // Axis 2, 3: placeholder axes for thumbstick.
      float axisValue = aInputState.Thumbstick[handIdx].x;
      if (abs(axisValue) < 0.0000009f) {
        axisValue = 0.0f;  // Clear noise signal
      }
      controllerState.axisValue[axisIdx] = axisValue;
      axisIdx++;

      // Note that y axis is intentionally inverted!
      axisValue = -aInputState.Thumbstick[handIdx].y;
      if (abs(axisValue) < 0.0000009f) {
        axisValue = 0.0f;  // Clear noise signal
      }
      controllerState.axisValue[axisIdx] = axisValue;
      axisIdx++;

      MOZ_ASSERT(axisIdx == kNumOculusAxes);
    }
    SetControllerSelectionAndSqueezeFrameId(
        controllerState, aState.displayState.lastSubmittedFrameId);
  }
}

void OculusSession::UpdateTelemetry(VRSystemState& aSystemState) {
  if (!mSession) {
    return;
  }
  ovrPerfStats perfStats;
  if (ovr_GetPerfStats(mSession, &perfStats) == ovrSuccess) {
    if (perfStats.FrameStatsCount) {
      aSystemState.displayState.droppedFrameCount =
          perfStats.FrameStats[0].AppDroppedFrameCount;
    }
  }
}

void OculusSession::VibrateHaptic(uint32_t aControllerIdx,
                                  uint32_t aHapticIndex, float aIntensity,
                                  float aDuration) {
  if (!mSession) {
    return;
  }

  if (aDuration <= 0.0f) {
    StopVibrateHaptic(aControllerIdx);
    return;
  }

  // Vibration amplitude in the [0.0, 1.0] range
  MOZ_ASSERT(aControllerIdx >= 0 && aControllerIdx <= 1);
  mHapticPulseIntensity[aControllerIdx] = aIntensity > 1.0 ? 1.0 : aIntensity;
  mRemainingVibrateTime[aControllerIdx] = aDuration;
  ovrControllerType hand = OculusControllerTypes[aControllerIdx];

  // The gamepad extensions API does not yet have independent control
  // of frequency and amplitude.  We are always sending 0.0f (160hz)
  // to the frequency argument.
  ovrResult result = ovr_SetControllerVibration(
      mSession, hand, 0.0f, mHapticPulseIntensity[aControllerIdx]);
  if (result != ovrSuccess) {
    // This may happen if called when not presenting.
    gfxWarning() << "ovr_SetControllerVibration failed.";
  }
}

void OculusSession::StopVibrateHaptic(uint32_t aControllerIdx) {
  if (!mSession) {
    return;
  }
  MOZ_ASSERT(aControllerIdx >= 0 && aControllerIdx <= 1);
  ovrControllerType hand = OculusControllerTypes[aControllerIdx];
  mRemainingVibrateTime[aControllerIdx] = 0.0f;
  mHapticPulseIntensity[aControllerIdx] = 0.0f;

  ovrResult result = ovr_SetControllerVibration(mSession, hand, 0.0f, 0.0f);
  if (result != ovrSuccess) {
    // This may happen if called when not presenting.
    gfxWarning() << "ovr_SetControllerVibration failed.";
  }
}

void OculusSession::StopAllHaptics() {
  // Left Oculus Touch
  StopVibrateHaptic(0);
  // Right Oculus Touch
  StopVibrateHaptic(1);
}

void OculusSession::UpdateHaptics() {
  if (!mSession) {
    return;
  }
  // The Oculus API and hardware takes at least 33ms to respond
  // to haptic state changes, so it is not beneficial to create
  // a dedicated haptic feedback thread and update multiple
  // times per frame.
  // If we wish to support more accurate effects with sub-frame timing,
  // we should use the buffered haptic feedback API's.

  TimeStamp now = TimeStamp::Now();
  if (mLastHapticUpdate.IsNull()) {
    mLastHapticUpdate = now;
    return;
  }
  float deltaTime = (float)(now - mLastHapticUpdate).ToSeconds();
  mLastHapticUpdate = now;
  for (int i = 0; i < 2; i++) {
    if (mRemainingVibrateTime[i] <= 0.0f) {
      continue;
    }
    mRemainingVibrateTime[i] -= deltaTime;
    ovrControllerType hand = OculusControllerTypes[i];
    if (mRemainingVibrateTime[i] > 0.0f) {
      ovrResult result = ovr_SetControllerVibration(mSession, hand, 0.0f,
                                                    mHapticPulseIntensity[i]);
      if (result != ovrSuccess) {
        // This may happen if called when not presenting.
        gfxWarning() << "ovr_SetControllerVibration failed.";
      }
    } else {
      StopVibrateHaptic(i);
    }
  }
}

}  // namespace gfx
}  // namespace mozilla

Messung V0.5
C=95 H=96 G=95

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.19Bemerkung:  (vorverarbeitet)  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge