gecko-dev/gfx/vr/FxROutputHandler.h
thomasmo ab2f648351 Bug 1581855:Part 2 - Present VR output to VR Host r=kip,jrmuizel,sotaro,bryce
This change is a continuation of Part 1 (Bug 1570128), where the 2D content rendered by Firefox for Firefox Reality on Desktop is marshalled through VRHost so that it can be presented in a VR environment.
A new class, FxrOutputHandler, is created to manage creating a sharable texture, sharing it through VRShMem, and updating it when content updates. This class updates content with both WebRender and conventional rendering output.
This initial iteration of FxrOutputHandler does not have synchronization between reading and writing this shared texture across processes. A subsequent fix (Bug 1581881) is pending, which will reuse WebVR code to manage writing to and reading from a pool of textures.
This also presents issues with rendering protected media, so an additional class, FxrWindowManager, is created to manage all windows created for Firefox Reality on Desktop so that it can inform whether or not protected media can be presented.
The automated manual tests in vrhosttest.cpp now show the real shared texture handle rather than a fake value, which shows that marshaling succeeded.

Differential Revision: https://phabricator.services.mozilla.com/D46179

--HG--
extra : moz-landing-system : lando
2019-09-26 12:50:44 +00:00

30 lines
976 B
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#pragma once
struct ID3D11Texture2D;
struct IDXGISwapChain;
struct ID3D11DeviceContext;
struct ID3D11Device;
#include <windows.h>
#include <d3d11_1.h>
#include "mozilla/RefPtr.h"
// FxROutputHandler is responsible for managing resources to share a Desktop
// browser window with a Firefox Reality VR window.
// Note: this object is created on the Compositor thread, but its usage should
// only be on the RenderThread.
class FxROutputHandler final {
public:
bool TryInitialize(IDXGISwapChain* aSwapChain, ID3D11Device* aDevice);
void UpdateOutput(ID3D11DeviceContext* aCtx);
private:
RefPtr<IDXGISwapChain> mSwapChain = nullptr;
RefPtr<ID3D11Texture2D> mTexCopy = nullptr;
};