Skip to content

Commit dd4f866

Browse files
authored
Spelling fixes (#58)
* Spelling fixes * One more spelling tweak
1 parent 068e9d0 commit dd4f866

1 file changed

Lines changed: 38 additions & 38 deletions

File tree

samples/BasicXrApp/OpenXrProgram.cpp

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace {
8686
std::vector<const char*> enabledExtensions;
8787

8888
// Add a specific extension to the list of extensions to be enabled, if it is supported.
89-
auto EnableExtentionIfSupported = [&](const char* extensionName) {
89+
auto EnableExtensionIfSupported = [&](const char* extensionName) {
9090
for (uint32_t i = 0; i < extensionCount; i++) {
9191
if (strcmp(extensionProperties[i].extensionName, extensionName) == 0) {
9292
enabledExtensions.push_back(extensionName);
@@ -97,17 +97,17 @@ namespace {
9797
};
9898

9999
// D3D11 extension is required for this sample, so check if it's supported.
100-
CHECK(EnableExtentionIfSupported(XR_KHR_D3D11_ENABLE_EXTENSION_NAME));
100+
CHECK(EnableExtensionIfSupported(XR_KHR_D3D11_ENABLE_EXTENSION_NAME));
101101

102102
#if UWP
103103
// Require XR_EXT_win32_appcontainer_compatible extension when building in UWP context.
104-
CHECK(EnableExtentionIfSupported(XR_EXT_WIN32_APPCONTAINER_COMPATIBLE_EXTENSION_NAME));
104+
CHECK(EnableExtensionIfSupported(XR_EXT_WIN32_APPCONTAINER_COMPATIBLE_EXTENSION_NAME));
105105
#endif
106106

107107
// Additional optional extensions for enhanced functionality. Track whether enabled in m_optionalExtensions.
108-
m_optionalExtensions.DepthExtensionSupported = EnableExtentionIfSupported(XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME);
109-
m_optionalExtensions.UnboundedRefSpaceSupported = EnableExtentionIfSupported(XR_MSFT_UNBOUNDED_REFERENCE_SPACE_EXTENSION_NAME);
110-
m_optionalExtensions.SpatialAnchorSupported = EnableExtentionIfSupported(XR_MSFT_SPATIAL_ANCHOR_EXTENSION_NAME);
108+
m_optionalExtensions.DepthExtensionSupported = EnableExtensionIfSupported(XR_KHR_COMPOSITION_LAYER_DEPTH_EXTENSION_NAME);
109+
m_optionalExtensions.UnboundedRefSpaceSupported = EnableExtensionIfSupported(XR_MSFT_UNBOUNDED_REFERENCE_SPACE_EXTENSION_NAME);
110+
m_optionalExtensions.SpatialAnchorSupported = EnableExtensionIfSupported(XR_MSFT_SPATIAL_ANCHOR_EXTENSION_NAME);
111111

112112
return enabledExtensions;
113113
}
@@ -162,7 +162,7 @@ namespace {
162162
CHECK_XRCMD(xrCreateAction(m_actionSet.Get(), &actionInfo, m_vibrateAction.Put()));
163163
}
164164

165-
// Create an input action to exit session
165+
// Create an input action to exit the session.
166166
{
167167
XrActionCreateInfo actionInfo{XR_TYPE_ACTION_CREATE_INFO};
168168
actionInfo.actionType = XR_ACTION_TYPE_BOOLEAN_INPUT;
@@ -174,7 +174,7 @@ namespace {
174174
}
175175
}
176176

177-
// Setup suggest bindings for simple controller.
177+
// Set up suggested bindings for the simple_controller profile.
178178
{
179179
std::vector<XrActionSuggestedBinding> bindings;
180180
bindings.push_back({m_placeAction.Get(), GetXrPath("/user/hand/right/input/select/click")});
@@ -215,7 +215,7 @@ namespace {
215215

216216
// Choose an environment blend mode.
217217
{
218-
// Query the list of supported environment blend modes for the current system
218+
// Query the list of supported environment blend modes for the current system.
219219
uint32_t count;
220220
CHECK_XRCMD(xrEnumerateEnvironmentBlendModes(m_instance.Get(), m_systemId, m_primaryViewConfigType, 0, &count, nullptr));
221221
CHECK(count > 0); // A system must support at least one environment blend mode.
@@ -228,8 +228,8 @@ namespace {
228228
m_environmentBlendMode = environmentBlendModes[0];
229229
}
230230

231-
// Choose a reasonable depth range can help improve hologram visual quality.
232-
// Use reversed Z (near > far) for more uniformed Z resolution.
231+
// Choosing a reasonable depth range can help improve hologram visual quality.
232+
// Use reversed-Z (near > far) for more uniform Z resolution.
233233
m_nearFar = {20.f, 0.1f};
234234
}
235235

@@ -307,15 +307,15 @@ namespace {
307307
std::tuple<DXGI_FORMAT, DXGI_FORMAT> SelectSwapchainPixelFormats() {
308308
CHECK(m_session.Get() != XR_NULL_HANDLE);
309309

310-
// Query runtime preferred swapchain formats.
310+
// Query the runtime's preferred swapchain formats.
311311
uint32_t swapchainFormatCount;
312312
CHECK_XRCMD(xrEnumerateSwapchainFormats(m_session.Get(), 0, &swapchainFormatCount, nullptr));
313313

314314
std::vector<int64_t> swapchainFormats(swapchainFormatCount);
315315
CHECK_XRCMD(xrEnumerateSwapchainFormats(
316316
m_session.Get(), (uint32_t)swapchainFormats.size(), &swapchainFormatCount, swapchainFormats.data()));
317317

318-
// Choose the first runtime preferred format that this app supports.
318+
// Choose the first runtime-preferred format that this app supports.
319319
auto SelectPixelFormat = [](const std::vector<int64_t>& runtimePreferredFormats,
320320
const std::vector<DXGI_FORMAT>& applicationSupportedFormats) {
321321
auto found = std::find_first_of(std::begin(runtimePreferredFormats),
@@ -344,7 +344,7 @@ namespace {
344344
XrSystemProperties systemProperties{XR_TYPE_SYSTEM_PROPERTIES};
345345
CHECK_XRCMD(xrGetSystemProperties(m_instance.Get(), m_systemId, &systemProperties));
346346

347-
// Select color and depth swapchain pixel formats
347+
// Select color and depth swapchain pixel formats.
348348
const auto [colorSwapchainFormat, depthSwapchainFormat] = SelectSwapchainPixelFormats();
349349

350350
// Query and cache view configuration views.
@@ -356,7 +356,7 @@ namespace {
356356
CHECK_XRCMD(xrEnumerateViewConfigurationViews(
357357
m_instance.Get(), m_systemId, m_primaryViewConfigType, viewCount, &viewCount, m_renderResources->ConfigViews.data()));
358358

359-
// Using texture array for better performance, but requiring left/right views have identical sizes.
359+
// Using texture array for better performance, so requiring left/right views have identical sizes.
360360
const XrViewConfigurationView& view = m_renderResources->ConfigViews[0];
361361
CHECK(m_renderResources->ConfigViews[0].recommendedImageRectWidth ==
362362
m_renderResources->ConfigViews[1].recommendedImageRectWidth);
@@ -365,7 +365,7 @@ namespace {
365365
CHECK(m_renderResources->ConfigViews[0].recommendedSwapchainSampleCount ==
366366
m_renderResources->ConfigViews[1].recommendedSwapchainSampleCount);
367367

368-
// Use recommended rendering parameters for a balance between quality and performance
368+
// Use the system's recommended rendering parameters.
369369
const uint32_t imageRectWidth = view.recommendedImageRectWidth;
370370
const uint32_t imageRectHeight = view.recommendedImageRectHeight;
371371
const uint32_t swapchainSampleCount = view.recommendedSwapchainSampleCount;
@@ -473,13 +473,13 @@ namespace {
473473
break;
474474
}
475475
case XR_SESSION_STATE_EXITING: {
476-
// Do not attempt to restart because user closed this session.
476+
// Do not attempt to restart, because user closed this session.
477477
*exitRenderLoop = true;
478478
*requestRestart = false;
479479
break;
480480
}
481481
case XR_SESSION_STATE_LOSS_PENDING: {
482-
// Poll for a new systemId
482+
// Session was lost, so start over and poll for new systemId.
483483
*exitRenderLoop = true;
484484
*requestRestart = true;
485485
break;
@@ -521,7 +521,7 @@ namespace {
521521
CHECK_XRRESULT(result, "xrCreateSpatialAnchorMSFT");
522522
}
523523
} else {
524-
// If the anchor extension is not available, place it in the scene space.
524+
// If the anchor extension is not available, place hologram in the scene space.
525525
// This works fine as long as user doesn't move far away from scene space origin.
526526
XrReferenceSpaceCreateInfo createInfo{XR_TYPE_REFERENCE_SPACE_CREATE_INFO};
527527
createInfo.referenceSpaceType = m_sceneSpaceType;
@@ -564,9 +564,9 @@ namespace {
564564
CHECK_XRCMD(xrGetActionStateBoolean(m_session.Get(), &getInfo, &placeActionValue));
565565
}
566566

567-
// When select button is pressed, place the cube at the location of corresponding hand.
567+
// When select button is pressed, place the cube at the location of the corresponding hand.
568568
if (placeActionValue.isActive && placeActionValue.changedSinceLastSync && placeActionValue.currentState) {
569-
// Use the poses at the time when action happened to do the placement
569+
// Use the pose at the historical time when the action happened to do the placement.
570570
const XrTime placementTime = placeActionValue.lastChangeTime;
571571

572572
// Locate the hand in the scene.
@@ -610,18 +610,18 @@ namespace {
610610
XrFrameBeginInfo frameBeginInfo{XR_TYPE_FRAME_BEGIN_INFO};
611611
CHECK_XRCMD(xrBeginFrame(m_session.Get(), &frameBeginInfo));
612612

613-
// EndFrame can submit mutiple layers
613+
// xrEndFrame can submit multiple layers. This sample submits one.
614614
std::vector<XrCompositionLayerBaseHeader*> layers;
615615

616616
// The projection layer consists of projection layer views.
617617
XrCompositionLayerProjection layer{XR_TYPE_COMPOSITION_LAYER_PROJECTION};
618618

619-
// Inform the runtime to consider alpha channel during composition
620-
// The primary display on Hololens has additive environment blend mode. It will ignore alpha channel.
621-
// But mixed reality capture has alpha blend mode display and use alpha channel to blend content to environment.
619+
// Inform the runtime that the app's submitted alpha channel has valid data for use during composition.
620+
// The primary display on HoloLens has an additive environment blend mode. It will ignore the alpha channel.
621+
// However, mixed reality capture uses the alpha channel if this bit is set to blend content with the environment.
622622
layer.layerFlags = XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT;
623623

624-
// Only render when session is visible. otherwise submit zero layers
624+
// Only render when session is visible, otherwise submit zero layers.
625625
if (frameState.shouldRender) {
626626
// First update the viewState and views using latest predicted display time.
627627
{
@@ -630,8 +630,8 @@ namespace {
630630
viewLocateInfo.displayTime = frameState.predictedDisplayTime;
631631
viewLocateInfo.space = m_sceneSpace.Get();
632632

633-
// The output view count of xrLocateViews is always same as xrEnumerateViewConfigurationViews
634-
// Therefore Views can be preallocated and avoid two call idiom here.
633+
// The output view count of xrLocateViews is always same as xrEnumerateViewConfigurationViews.
634+
// Therefore, Views can be preallocated and avoid two call idiom here.
635635
uint32_t viewCapacityInput = (uint32_t)m_renderResources->Views.size();
636636
uint32_t viewCountOutput;
637637
CHECK_XRCMD(xrLocateViews(m_session.Get(),
@@ -647,7 +647,7 @@ namespace {
647647
CHECK(viewCountOutput == m_renderResources->DepthSwapchain.ArraySize);
648648
}
649649

650-
// Then render projection layer into each view.
650+
// Then, render projection layer into each view.
651651
if (RenderLayer(frameState.predictedDisplayTime, layer)) {
652652
layers.push_back(reinterpret_cast<XrCompositionLayerBaseHeader*>(&layer));
653653
}
@@ -662,7 +662,7 @@ namespace {
662662
CHECK_XRCMD(xrEndFrame(m_session.Get(), &frameEndInfo));
663663
}
664664

665-
uint32_t AquireAndWaitForSwapchainImage(XrSwapchain handle) {
665+
uint32_t AcquireAndWaitForSwapchainImage(XrSwapchain handle) {
666666
uint32_t swapchainImageIndex;
667667
XrSwapchainImageAcquireInfo acquireInfo{XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO};
668668
CHECK_XRCMD(xrAcquireSwapchainImage(handle, &acquireInfo, &swapchainImageIndex));
@@ -693,7 +693,7 @@ namespace {
693693
m_spinningCubeStartTime = predictedDisplayTime;
694694
}
695695

696-
// Pause spinning cube animation when app lost 3D focus
696+
// Pause spinning cube animation when app loses 3D focus
697697
if (IsSessionFocused()) {
698698
auto convertToSeconds = [](XrDuration nanoSeconds) {
699699
using namespace std::chrono;
@@ -705,7 +705,7 @@ namespace {
705705
const float angle = DirectX::XM_PIDIV2 * seconds; // Rotate 90 degrees per second
706706
const float radius = 0.5f; // Rotation radius in meters
707707

708-
// Let spinning cube rotate around the main cube at y axis.
708+
// Let spinning cube rotate around the main cube's y axis.
709709
XrPosef pose;
710710
pose.position = {radius * std::sin(angle), 0, radius * std::cos(angle)};
711711
pose.orientation = xr::math::Quaternion::RotationAxisAngle({0, 1, 0}, angle);
@@ -728,7 +728,7 @@ namespace {
728728
XrSpaceLocation cubeSpaceInScene{XR_TYPE_SPACE_LOCATION};
729729
CHECK_XRCMD(xrLocateSpace(cube.Space.Get(), m_sceneSpace.Get(), predictedDisplayTime, &cubeSpaceInScene));
730730

731-
// Update cubes location with latest space relation
731+
// Update cube's location with latest space location
732732
if (xr::math::Pose::IsPoseValid(cubeSpaceInScene)) {
733733
if (cube.PoseInSpace.has_value()) {
734734
cube.PoseInScene = xr::math::Pose::Multiply(cube.PoseInSpace.value(), cubeSpaceInScene.pose);
@@ -758,13 +758,13 @@ namespace {
758758
const SwapchainD3D11& colorSwapchain = m_renderResources->ColorSwapchain;
759759
const SwapchainD3D11& depthSwapchain = m_renderResources->DepthSwapchain;
760760

761-
// Use the full range of recommended image size to achieve optimum resolution
761+
// Use the full size of the allocated swapchain image (could render smaller some frames to hit framerate)
762762
const XrRect2Di imageRect = {{0, 0}, {(int32_t)colorSwapchain.Width, (int32_t)colorSwapchain.Height}};
763763
CHECK(colorSwapchain.Width == depthSwapchain.Width);
764764
CHECK(colorSwapchain.Height == depthSwapchain.Height);
765765

766-
const uint32_t colorSwapchainImageIndex = AquireAndWaitForSwapchainImage(colorSwapchain.Handle.Get());
767-
const uint32_t depthSwapchainImageIndex = AquireAndWaitForSwapchainImage(depthSwapchain.Handle.Get());
766+
const uint32_t colorSwapchainImageIndex = AcquireAndWaitForSwapchainImage(colorSwapchain.Handle.Get());
767+
const uint32_t depthSwapchainImageIndex = AcquireAndWaitForSwapchainImage(depthSwapchain.Handle.Get());
768768

769769
// Prepare rendering parameters of each view for swapchain texture arrays
770770
std::vector<xr::math::ViewProjection> viewProjections(viewCount);
@@ -788,12 +788,12 @@ namespace {
788788
m_renderResources->DepthInfoViews[i].subImage.imageRect = imageRect;
789789
m_renderResources->DepthInfoViews[i].subImage.imageArrayIndex = i;
790790

791-
// Chain depth info struct to the corresponding projection layer views's next
791+
// Chain depth info struct to the corresponding projection layer view's next pointer
792792
m_renderResources->ProjectionLayerViews[i].next = &m_renderResources->DepthInfoViews[i];
793793
}
794794
}
795795

796-
// For Hololens additive display, best to clear render target with transparent black color (0,0,0,0)
796+
// For HoloLens additive display, best to clear render target with transparent black color (0,0,0,0)
797797
constexpr DirectX::XMVECTORF32 opaqueColor = {0.184313729f, 0.309803933f, 0.309803933f, 1.000000000f};
798798
constexpr DirectX::XMVECTORF32 transparent = {0.000000000f, 0.000000000f, 0.000000000f, 0.000000000f};
799799
const DirectX::XMVECTORF32 renderTargetClearColor =

0 commit comments

Comments
 (0)