Skip to content

Commit 3da48b1

Browse files
committed
Address comments
1 parent 62e6380 commit 3da48b1

File tree

8 files changed

+21
-26
lines changed

8 files changed

+21
-26
lines changed

Samples/WinMLSamplesGallery/WinMLSamplesGallery/Samples/DXResourceBindingORT/DXResourceBindingORT.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private async void LaunchWindow(object sender, RoutedEventArgs e)
5050
private async void ClassifyCube()
5151
{
5252
int i = 0;
53-
float[] prev_results = { };
53+
float[] previousResults = { };
5454
while (true)
5555
{
5656
if (pageExited)
@@ -60,12 +60,12 @@ private async void ClassifyCube()
6060
}
6161
float[] results = await Task.Run(() => WinMLSamplesGalleryNative.DXResourceBinding.EvalORT());
6262
if (i == 0)
63-
prev_results = results;
63+
previousResults = results;
6464
// The first evaluation may return null so move to the next iteration
6565
if (results == null)
6666
continue;
67-
UpdateClassificationResults(prev_results);
68-
prev_results = results;
67+
UpdateClassificationResults(previousResults );
68+
previousResults = results;
6969
System.Threading.Thread.Sleep(1000);
7070
i++;
7171
}

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/D3D12Quad.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void D3D12Quad::OnInit()
3939
LoadPipeline();
4040
LoadAssets();
4141
initializationSemaphore.release();
42-
copy_texture = false;
42+
copyTexture = false;
4343
}
4444

4545
// Load the rendering pipeline dependencies.
@@ -427,7 +427,7 @@ void D3D12Quad::Reset() {
427427
void D3D12Quad::OnUpdate()
428428
{
429429
justReset = false;
430-
if (copy_texture) {
430+
if (copyTexture) {
431431
Reset();
432432
LoadImageTexture();
433433
justReset = true;
@@ -493,10 +493,10 @@ void D3D12Quad::PopulateCommandList()
493493
auto render_to_present = CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_frameIndex].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT);
494494
m_commandList->ResourceBarrier(1, &render_to_present);
495495

496-
if (copy_texture)
496+
if (copyTexture)
497497
{
498498
CopyTextureIntoCurrentBuffer();
499-
copy_texture = false;
499+
copyTexture = false;
500500
}
501501

502502
ThrowIfFailed(m_commandList->Close());
@@ -826,12 +826,12 @@ ComPtr<ID3D12Resource> D3D12Quad::GetCurrentBuffer()
826826
return currentBuffer;
827827
}
828828

829-
// Schedules the next image to be shown by setting the copy_texture
829+
// Schedules the next image to be shown by setting the copyTexture
830830
// variable to true. OnUpdate will catch this variable and load the
831831
// next image then the image texture will be copied into a resource
832832
// dimension buffer at the end of PopulateCommandLists
833833
void D3D12Quad::ShowNextImage()
834834
{
835-
copy_texture = true;
835+
copyTexture = true;
836836
}
837837

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/D3D12Quad.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,6 @@ class D3D12Quad
103103
// a resource dimension buffer that will be used by ORT for inference
104104
ComPtr<ID3D12Resource> currentBuffer;
105105
int imageBytesPerRow;
106-
bool copy_texture;
106+
bool copyTexture;
107107
};
108108

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/DXResourceBinding.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#define NOMINMAX
2-
#define WIN32_LEAN_AND_MEAN
3-
41
#include "pch.h"
52
#include "DXResourceBinding.h"
63
#include "DXResourceBinding.g.cpp"

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/ORTHelpers.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "pch.h"
22
#include "ORTHelpers.h"
3-
#undef min
43

54
#define THROW_IF_FAILED(hr) {HRESULT localHr = (hr); if (FAILED(hr)) throw hr;}
65
#define RETURN_IF_FAILED(hr) {HRESULT localHr = (hr); if (FAILED(hr)) return hr;}

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/Win32Application.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "Win32Application.h"
44

55
HWND Win32Application::m_hwnd = nullptr;
6-
bool Win32Application::close_window = false;
6+
bool Win32Application::m_closeWindow = false;
77

88
// Get the HModule that will be used to spawn
99
// the HWND
@@ -65,20 +65,17 @@ int Win32Application::Run(D3D12Quad* pSample, int nCmdShow)
6565
ShowWindow(m_hwnd, nCmdShow);
6666

6767
// Main sample loop.
68-
close_window = false;
68+
m_closeWindow = false;
6969
MSG msg = {};
70-
while (msg.message != WM_QUIT)
70+
while (GetMessage(&msg, m_hwnd, 0, 0) != 0)
7171
{
72-
// Destroy the sample and window if the close_window
73-
// variable is set to true
74-
if (close_window)
72+
if (m_closeWindow)
7573
{
7674
pSample->OnDestroy();
7775
PostMessage(m_hwnd, WM_CLOSE, 0, 0);
7876
break;
7977
}
80-
// Process any messages in the queue.
81-
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
78+
else
8279
{
8380
TranslateMessage(&msg);
8481
DispatchMessage(&msg);
@@ -121,7 +118,7 @@ LRESULT CALLBACK Win32Application::WindowProc(HWND hWnd, UINT message, WPARAM wP
121118
case WM_PAINT:
122119
if (pSample)
123120
{
124-
if (!close_window)
121+
if (!m_closeWindow)
125122
{
126123
pSample->OnUpdate();
127124
pSample->OnRender();
@@ -140,7 +137,7 @@ LRESULT CALLBACK Win32Application::WindowProc(HWND hWnd, UINT message, WPARAM wP
140137

141138
void Win32Application::CloseWindow()
142139
{
143-
close_window = true;
140+
m_closeWindow = true;
144141
}
145142

146143
std::wstring Win32Application::GetAssetPath(LPCWSTR assetName)

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/Win32Application.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ class Win32Application
1414

1515
private:
1616
static HWND m_hwnd;
17-
static bool close_window;
17+
static bool m_closeWindow;
1818
};

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/stdafx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
#pragma once
1717

18+
#define NOMINMAX
19+
1820
#ifndef WIN32_LEAN_AND_MEAN
1921
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers.
2022
#endif

0 commit comments

Comments
 (0)