Skip to content

Commit 5685e8a

Browse files
committed
Christopher's feedback
1 parent 50e3b17 commit 5685e8a

File tree

2 files changed

+35
-36
lines changed

2 files changed

+35
-36
lines changed

articles/remote-rendering/tutorials/native-cpp/hololens/integrate-arr-into-holographic-app.md

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ This tutorial focuses on adding the necessary bits to a native `Holographic App`
2727
For this tutorial you need:
2828

2929
* Your account information (account ID, account key, subscription ID). If you don't have an account, [create an account](../../../how-tos/create-an-account.md).
30-
* Windows SDK 10.0.18362.0 [(download)](https://developer.microsoft.com/windows/downloads/windows-10-sdk)
31-
* The latest version of Visual Studio 2019 [(download)](https://visualstudio.microsoft.com/vs/older-downloads/)
32-
* The Windows Mixed Reality App Templates for Visual Studio [(download)](https://marketplace.visualstudio.com/items?itemName=WindowsMixedRealityteam.WindowsMixedRealityAppTemplatesVSIX)
30+
* Windows SDK 10.0.18362.0 [(download)](https://developer.microsoft.com/windows/downloads/windows-10-sdk).
31+
* The latest version of Visual Studio 2019 [(download)](https://visualstudio.microsoft.com/vs/older-downloads/).
32+
* The Windows Mixed Reality App Templates for Visual Studio [(download)](https://marketplace.visualstudio.com/items?itemName=WindowsMixedRealityteam.WindowsMixedRealityAppTemplatesVSIX).
3333

3434
## Create a new Holographic App sample
3535

3636
As a first step, we create a stock sample that is the basis for the Remote Rendering integration. Open Visual Studio and select "Create a new project" and search for "Holographic DirectX 11 App (Universal Windows) (C++/WinRT)"
3737

3838
![Create new project](media/new-project-wizard.png)
3939

40-
Type in a project name of your choice, choose the path and select the "Create" button.
40+
Type in a project name of your choice, choose a path and select the "Create" button.
4141
In the new project, switch the configuration to **"Debug / ARM64"**. You should now be able to compile and deploy it to a connected HoloLens 2 device. If you run it on HoloLens, you should see a rotating cube in front of you.
4242

4343
## Add Remote Rendering dependencies through NuGet
@@ -52,16 +52,16 @@ In the prompted dialog, browse for the **"Azure Remote Rendering"** NuGet packag
5252
and add it to the project by selecting the package and then pressing the "Install" button.
5353

5454
The NuGet package adds the Remote Rendering dependencies to the project. Specifically:
55-
* link against the client library (RemoteRenderingClient.lib),
56-
* set up the .dll dependencies,
57-
* set the correct path to the include directory.
55+
* Link against the client library (RemoteRenderingClient.lib).
56+
* Set up the .dll dependencies.
57+
* Set the correct path to the include directory.
5858

5959
## Project preparation
6060

6161
We need make small changes to the existing project. These changes are subtle, but without them Remote Rendering would not work.
6262

63-
### Enable multithreaded protection on DirectX device
64-
The `DirectX11` device must have multithreaded protection enabled. To change that, open file DeviceResources.cpp in folder "Common", and insert the following code at the end of function `DeviceResources::CreateDeviceResources()`:
63+
### Enable multi thread protection on DirectX device
64+
The `DirectX11` device must have multi thread protection enabled. To change that, open file DeviceResources.cpp in folder "Common", and insert the following code at the end of function `DeviceResources::CreateDeviceResources()`:
6565

6666
```cpp
6767
// Enable multi thread protection as now multiple threads use the immediate context.
@@ -76,14 +76,13 @@ if (context.As(&contextMultithread) == S_OK)
7676
Network capabilities must be explicitly enabled for the deployed app. Without this being configured, connection queries will result in timeouts eventually. To enable, double-click on the `package.appxmanifest` item in the solution explorer. In the next UI, go to the **Capabilities** tab and select:
7777
* Internet (Client & Server)
7878
* Internet (Client)
79-
* Private Networks (Client & Server)
8079

8180
![Network capabilities](media/appx-manifest-caps.png)
8281

8382

8483
## Integrate Remote Rendering
8584

86-
Now that the project is prepared, we can start with the code. A good entry point into the application is class `HolographicAppMain`(file HolographicAppMain.h/cpp) because it has all the necessary hooks for initialization, de-initialization, and rendering.
85+
Now that the project is prepared, we can start with the code. A good entry point into the application is the class `HolographicAppMain`(file HolographicAppMain.h/cpp) because it has all the necessary hooks for initialization, de-initialization, and rendering.
8786

8887
### Includes
8988

@@ -138,7 +137,7 @@ Add the following code to the beginning of the constructor body in file Holograp
138137
HolographicAppMain::HolographicAppMain(std::shared_ptr<DX::DeviceResources> const& deviceResources) :
139138
m_deviceResources(deviceResources)
140139
{
141-
// 1. one time initialization
140+
// 1. One time initialization
142141
{
143142
RR::RemoteRenderingInitialization clientInit;
144143
memset(&clientInit, 0, sizeof(RR::RemoteRenderingInitialization));
@@ -155,7 +154,7 @@ HolographicAppMain::HolographicAppMain(std::shared_ptr<DX::DeviceResources> cons
155154

156155
// 2. Create front end
157156
{
158-
// users need to fill out the following with their account data and model
157+
// Users need to fill out the following with their account data and model
159158
RR::AzureFrontendAccountInfo init;
160159
memset(&init, 0, sizeof(RR::AzureFrontendAccountInfo));
161160
init.AccountId = "00000000-0000-0000-0000-000000000000";
@@ -182,13 +181,13 @@ HolographicAppMain::HolographicAppMain(std::shared_ptr<DX::DeviceResources> cons
182181
OnConnectionStatusChanged(status, error);
183182
});
184183

185-
// the following is async, but we'll get notifications via OnConnectionStatusChanged
184+
// The following is async, but we'll get notifications via OnConnectionStatusChanged
186185
RR::ConnectToRuntimeParams init;
187186
init.mode = RR::ServiceRenderMode::Default;
188187
m_session->ConnectToRuntime(init);
189188
};
190189

191-
// if we had an old (valid) session that we can recycle, we call synchronous function m_frontEnd->OpenRenderingSession
190+
// If we had an old (valid) session that we can recycle, we call synchronous function m_frontEnd->OpenRenderingSession
192191
if (!m_sessionOverride.empty())
193192
{
194193
auto openSessionRes = m_frontEnd->OpenRenderingSession(m_sessionOverride);
@@ -201,7 +200,7 @@ HolographicAppMain::HolographicAppMain(std::shared_ptr<DX::DeviceResources> cons
201200

202201
if (createNewSession)
203202
{
204-
// create a new session
203+
// Create a new session
205204
RR::RenderingSessionCreationParams init;
206205
memset(&init, 0, sizeof(RR::RenderingSessionCreationParams));
207206
init.MaxLease.minute = 10; // session is leased for 10 minutes
@@ -222,7 +221,7 @@ HolographicAppMain::HolographicAppMain(std::shared_ptr<DX::DeviceResources> cons
222221
}
223222
}
224223

225-
// rest of constructor code:
224+
// Rest of constructor code:
226225
...
227226
}
228227
```
@@ -233,20 +232,20 @@ We do the de-initialization symmetrically and in reverse order at the end of the
233232
```cpp
234233
HolographicAppMain::~HolographicAppMain()
235234
{
236-
// existing destructor code:
235+
// Existing destructor code:
237236
...
238237
239-
// destroy session:
238+
// Destroy session:
240239
if (m_session != nullptr)
241240
{
242241
m_session->DisconnectFromRuntime();
243242
m_session = nullptr;
244243
}
245244
246-
// destroy front end:
245+
// Destroy front end:
247246
m_frontEnd = nullptr;
248247
249-
// one-time de-initialization:
248+
// One-time de-initialization:
250249
RR::ShutdownRemoteRendering();
251250
}
252251
```
@@ -264,7 +263,7 @@ Add the following members and functions to the class declaration:
264263
```cpp
265264
namespace HolographicApp
266265
{
267-
// our application's possible states:
266+
// Our application's possible states:
268267
enum class AppConnectionStatus
269268
{
270269
Disconnected,
@@ -280,18 +279,18 @@ namespace HolographicApp
280279
class HolographicAppMain
281280
{
282281
...
283-
// member functions for state transition handling
282+
// Member functions for state transition handling
284283
void OnConnectionStatusChanged(RR::ConnectionStatus status, RR::Result error);
285284
void SetNewState(AppConnectionStatus state, RR::Result error);
286285
void StartModelLoading();
287286

288-
// members for state handling:
287+
// Members for state handling:
289288

290-
// model loading:
289+
// Model loading:
291290
std::string m_modelURI;
292291
RR::ApiHandle<RR::LoadModelAsync> m_loadModelAsync;
293292

294-
// connection state machine:
293+
// Connection state machine:
295294
AppConnectionStatus m_currentStatus = AppConnectionStatus::Disconnected;
296295
RR::Result m_connectionResult = RR::Result::Success;
297296
RR::Result m_modelLoadResult = RR::Result::Success;
@@ -314,7 +313,7 @@ void HolographicAppMain::StartModelLoading()
314313
params.ModelUrl = m_modelURI.c_str();
315314
params.Parent = nullptr;
316315
317-
// start the async model loading
316+
// Start the async model loading
318317
if (auto loadModel = m_api->LoadModelFromSASAsync(params))
319318
{
320319
m_loadModelAsync = *loadModel;
@@ -329,10 +328,10 @@ void HolographicAppMain::StartModelLoading()
329328
});
330329
m_loadModelAsync->ProgressUpdated([this](float progress)
331330
{
332-
// progress callback
331+
// Progress callback
333332
m_modelLoadingProgress = progress;
334333
335-
// output progress percentage to VS output
334+
// Output progress percentage to VS output
336335
char buffer[1024];
337336
sprintf_s(buffer, "Remote Rendering: Model loading progress: %.1f\n", m_modelLoadingProgress * 100.f);
338337
OutputDebugStringA(buffer);
@@ -347,7 +346,7 @@ void HolographicAppMain::SetNewState(AppConnectionStatus state, RR::Result error
347346
m_currentStatus = state;
348347
m_connectionResult = error;
349348
350-
// some log for the VS output panel:
349+
// Some log for the VS output panel:
351350
const char* appStatus = nullptr;
352351
353352
switch (state)
@@ -417,14 +416,14 @@ We have to tick the client once per simulation tick. Class `HolographicApp1Main`
417416
// Updates the application state once per frame.
418417
HolographicFrame HolographicAppMain::Update()
419418
{
420-
// tick Remote rendering:
419+
// Tick Remote rendering:
421420
if (m_session != nullptr)
422421
{
423-
// tick the client to receive messages
422+
// Tick the client to receive messages
424423
m_api->Update();
425424
}
426425

427-
// rest of the body:
426+
// Rest of the body:
428427
...
429428
}
430429
```
@@ -435,11 +434,11 @@ The last thing to do is invoking the rendering of the remote content. We have to
435434

436435
```cpp
437436
...
438-
// existing clear function:
437+
// Existing clear function:
439438
context->ClearDepthStencilView(depthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
440439

441-
// inject remote rendering: as soon as we are connected, start blitting the remote frame.
442-
// We do the blitting after the Clear, and before cube rendering
440+
// Inject remote rendering: as soon as we are connected, start blitting the remote frame.
441+
// We do the blitting after the Clear, and before cube rendering.
443442
if (m_isConnected)
444443
{
445444
m_graphicsBinding->BlitRemoteFrame();
-18.7 KB
Loading

0 commit comments

Comments
 (0)