Skip to content

Commit

Permalink
- fix for the infernal context loss + reset issues on holographic
Browse files Browse the repository at this point in the history
  • Loading branch information
mlfarrell committed Jan 6, 2017
1 parent e632b69 commit a1795af
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/libANGLE/renderer/d3d/d3d11/winrt/HolographicNativeWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,20 @@ __declspec(dllexport) ComPtr<ABI::Windows::Perception::IPerceptionTimestamp> Ang
namespace rx
{

//"global" camera tracking state - mlf
static std::vector<ComPtr<ABI::Windows::Graphics::Holographic::IHolographicCamera>> gHolographicCameras;

bool HolographicNativeWindow::mInitialized = false;

HolographicNativeWindow::~HolographicNativeWindow()
{
unregisterForHolographicCameraEvents();

gHolographicCameras.clear();
for(auto &swapChain : mHolographicCameras)
{
gHolographicCameras.push_back(swapChain.second->GetHolographicCamera());
}
}

bool HolographicNativeWindow::initialize(EGLNativeWindowType holographicSpace, IPropertySet *propertySet)
Expand Down Expand Up @@ -491,6 +500,24 @@ HRESULT HolographicNativeWindow::getPreferredDeviceFeatureSupport()
return hr;
}

void HolographicNativeWindow::setRenderer11(Renderer11 *renderer)
{
mRenderer = renderer;

// In the case of full context loss, we may be spun up with a holographic space that already has existing cameras
// adding those here - mlf
{
std::lock_guard<std::mutex> locker(mHolographicCamerasLock);
for(auto holographicCamera : gHolographicCameras)
{
UINT32 id;
(void)holographicCamera->get_Id(&id);
HANDLE shareHandle = (void*)0;
mHolographicCameras[id] = std::make_unique<HolographicSwapChain11>(mRenderer, this, shareHandle, holographicCamera.Get());
}
}
}

// Initializes the HolographicSpace.
HRESULT HolographicNativeWindow::setD3DDevice(ID3D11Device *device)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class HolographicNativeWindow : public InspectableNativeWindow, public std::enab

static bool IsInitialized() { return mInitialized; }

void setRenderer11(Renderer11* renderer) { mRenderer = renderer; };
void setRenderer11(Renderer11* renderer);
HRESULT setD3DDevice(ID3D11Device *device);

void addHolographicCamera(ABI::Windows::Graphics::Holographic::IHolographicCamera *holographicCamera);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ class HolographicSwapChain11 : public SwapChainD3D
float const& GetFarPlane() const { return mFarPlaneDistance; }
float const* GetDepthWeightArray() const { return mDepthWeightArray; }

//-mlf
inline ComPtr<ABI::Windows::Graphics::Holographic::IHolographicCamera> GetHolographicCamera() { return mHolographicCamera; }

private:

EGLint resetOffscreenBuffers(
Expand Down

0 comments on commit a1795af

Please sign in to comment.