Compartilhar via


Class GraphicsBindingSimD3d11

Graphics API binding for local simulation.

This graphics binding is used to render a monoscopic remote image on a normal desktop application. With no sensors to provide head movement available, this binding requires the user to provide a current camera update each frame. The basic setup works as follow:

  1. Remote and local content is rendered onto an off-screen color / depth render target called 'proxy' using the proxy camera provided by the Update function. The proxy needs to be created matching the resolution of the back-buffer. Before any rendering takes place, InitSimulation() needs to be called with the proxy texture handles, as well as a D3D device to fully initialize the simulation.

  2. Each frame, before any rendering takes place, Update is called with the current camera transform and the returned proxy transform is applied to the proxy camera.

  3. At the start of rendering into the proxy, GraphicsBindingSimD3d11.BlitRemoteFrameToProxy needs to be called, this fills the remote color and depth information into the proxy render targets. Any local content can now be rendered onto the proxy using the proxy camera.

  4. Once the back-buffer is bound, only GraphicsBindingSimD3d11.ReprojectProxy needs to be called and no other rendering should take place.

  5. Repeat with step 2 until session ends.

  6. Call GraphicsBindingSimD3d11.DeinitSimulation after the remote session has ended.

class Microsoft::Azure::RemoteRendering::GraphicsBindingSimD3d11 final : public Microsoft::Azure::RemoteRendering::GraphicsBinding

Methods

BlitRemoteFrameToProxy

Blits the current remote frame to the currently bound render target.

When this function is executed it is assumed that the proxy color and depth buffers are bound as the current render target. This should be done as the very first thing in each frame as this function will overwrite all content in the target buffers.

auto BlitRemoteFrameToProxy() noexcept -> Microsoft::Azure::RemoteRendering::Result;

Returns

Type Description
Result Result.Success, Result.NotInitialized, Result.Fail, Result.NoConnection

DeinitSimulation

Deinitializes the simulation. Needs to be called after a remote rendering session has ended.

auto DeinitSimulation() noexcept -> Microsoft::Azure::RemoteRendering::Result;

Returns

Type Description
Result Result.Success, Result.NotInitialized, Result.Fail

GetRemoteFocusPoint

Retrieves the remote focus point.

This focus point must be explicitly set as the focus point to be used.

A Result.NoConnection error occurs if this is called while there is no connection to the server.

auto GetRemoteFocusPoint(Microsoft::Azure::RemoteRendering::Float3* position, Microsoft::Azure::RemoteRendering::Float3* normal, Microsoft::Azure::RemoteRendering::Float3* velocity) noexcept -> Microsoft::Azure::RemoteRendering::FocusPointResult;

Parameters

Name Type Description
position Float3 The focus point's position in world-space.
normal Float3 The focus point's normal in world-space.
velocity Float3 The focus point's velocity measured in units per second, in world-space.

Returns

Type Description
FocusPointResult How to interpret the point data. If FocusPointResult.Invalid is returned, the data should not be used.

InitSimulation

Initializes the simulation. Needs to be called before a remote rendering session is started.

auto InitSimulation(void* d3dDevice, void* proxyDepth, void* proxyColor, float refreshRate, bool flipBlitRemoteFrameTextureVertically, bool flipReprojectTextureVertically, bool stereo) noexcept -> Microsoft::Azure::RemoteRendering::Result;

Parameters

Name Type Description
d3dDevice System.IntPtr The d3d device that will be used to render the remote image.
proxyDepth System.IntPtr Depth texture of the proxy render-target.
proxyColor System.IntPtr Color texture of the proxy render-target. The minimum dimension of the texture is 256x256.
refreshRate float Target refresh rate at which the remote runtime should render.
flipBlitRemoteFrameTextureVertically bool If set, will flip the rendered image vertically.
flipReprojectTextureVertically bool If set, will flip the rendered image vertically.
stereo bool Simulation will use stereoscopic rendering if set to true. The proxy textures need to have two array layers in this case!

Returns

Type Description
Result Result.Success, Result.NotInitialized, Result.Fail, Result.InvalidParam, Result.UnsupportedDisplayAdapter

InitSimulation

Initializes the simulation. Needs to be called before a remote rendering session is started. This is an alternative initialization call, where no proxy targets are configured. Therefore, local pose mode will be forced and GraphicsBindingSimD3d11.ReprojectProxy will essentially become a no-op. The caller is expected to bind the final render target before calling GraphicsBindingSimD3d11.BlitRemoteFrameToProxy.

auto InitSimulation(void* d3dDevice, int32_t renderTargetWidth, int32_t renderTargetHeight, float refreshRate, bool flipBlitRemoteFrameTextureVertically, bool flipReprojectTextureVertically, bool stereo) noexcept -> Microsoft::Azure::RemoteRendering::Result;

Parameters

Name Type Description
d3dDevice System.IntPtr The d3d device that will be used to render the remote image.
renderTargetWidth int The width of the final render target (minimum: 256).
renderTargetHeight int The heigth of the final render target (minimum: 256).
refreshRate float Target refresh rate at which the remote runtime should render.
flipBlitRemoteFrameTextureVertically bool If set, will flip the rendered image vertically.
flipReprojectTextureVertically bool If set, will flip the rendered image vertically.
stereo bool Simulation will use stereoscopic rendering if set to true. The final render target needs to have two array layers in this case!

Returns

Type Description
Result Result.Success, Result.NotInitialized, Result.Fail, Result.InvalidParam, Result.UnsupportedDisplayAdapter

ReprojectProxy

Reprojects the proxy color texture onto the back-buffer.

When this function is executed it is assumed that the back-buffer color and depth buffers are bound as the current render target. This should be done as the very last thing in each frame.

auto ReprojectProxy() noexcept -> Microsoft::Azure::RemoteRendering::Result;

Returns

Type Description
Result Result.Success, Result.NotInitialized, Result.Fail, Result.NoConnection

Update

Needs to be called every frame.

Typically there are multiple frames in flight. The frame data that is received and rendered locally, is always lagging behind a bit. Therefore, when calling Update() you need to specify the latest matrices with which the server should render that frame, but the matrices that you need to use for rendering local contant have to match the ones that were used for the currently arriving video frame. Therefore ARR provides you with that information through the proxyFrameUpdate parameter, so that you don't need to keep track of old rendering matrices yourself.

auto Update(Microsoft::Azure::RemoteRendering::SimulationUpdateParameters updateParameters, Microsoft::Azure::RemoteRendering::SimulationUpdateResult* proxyFrameUpdateResult) noexcept -> Microsoft::Azure::RemoteRendering::Result;

Parameters

Name Type Description
updateParameters SimulationUpdateParameters The update parameters of the main camera. This information will be sent to the server for rendering.
proxyFrameUpdateResult SimulationUpdateResult The camera update for the proxy. Matches the current remote frame and needs to be applied locally.

Returns

Type Description
Result Result.Success, Result.NotInitialized, Result.Fail, Result.NoConnection, Result.InvalidParam

See also