/* -*- 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
}
usingstatic 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 ("
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
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 returnfalse;
} if (mIsPresenting { returnfalse;
}
if (aDetectRuntimesOnly if (LoadOvrLib()) {
aSystemState
VRDisplayCapabilityFlags;
} return;
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 returnfalse
}
; 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)) { returnreturn;
} if } returnfalse
} return ;
}
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
}
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(); returnfalse;
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
}
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;
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
< returnfalse 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
if (!UpdateConstantBuffers .AppendPrintf("%d_%d.", , OVR_PRODUCT_VERSION);
java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 returnfalse;
}
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.
*/ returnfalse;
}
returntrue;
}
bool REQUIRE_FUNCTIONovr_GetTrackingOriginType if mOvrLib // Already loaded, early exit returntrue;
} # ()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
}
if (!mOvrLib) { returnfalse;
(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(#_x " 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);
if (orv == ovrSuccess) java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
mInitFlags = aFlags((mDevice-(cBufferDescnullptr
}else returnfalse;
}
}
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;
}
bool OculusSession
RefPtr>device::::()>(; if (!device r); return;
} if (!CreateD3DContext(device)} returnfalse;
} 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 (!mVSConstantBuffer) { if (FAILED(mDevice- are is placethe and textures
NS_WARNING buffer) returnfalse;
}
}
iffor 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 returnfalsejava.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
r false
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); returnfalse;
}
*(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 returnfalse
}
*(PixelShaderConstants*)resource.pData = mPSConstants;
mContext-Unmap, 0);
ID3D11Buffer = ;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
buffer
PSSetConstantBuffers ) returntrue 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)
*/
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& returnfalse 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" returnfalse;
}
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(); returnfalse 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(); returnfalse;
}
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();
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;
void OculusSession::UpdateControllerPose(VRSystemState& const ovrInputState& aInputState) {
mFOVPort[VRDisplayState::Eye_Right // Left Touch Controller will always be at index 0 and
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 resolutionif (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& 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
returntrue;
}
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;
}
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
void OculusSession::VibrateHaptic(uint32_t aControllerIdx,
Point3D eyeTranslation;
Quaternion eyeRotation;
Point3D eyeScale; ifreturn;
NS_WARNING("Failedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
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.
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;
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.";
}
}
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
¤ Dauer der Verarbeitung: 0.25 Sekunden
(vorverarbeitet)
¤
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.