Skip to content

Commit 04381be

Browse files
committed
Change picture after eval
1 parent d43dd1d commit 04381be

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/D3D12Quad.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ void D3D12Quad::CreateVertexBuffer()
253253
// Define the geometry for a quad.
254254
Vertex quadVertices[] =
255255
{
256-
{ { -0.75f, 0.75f * m_aspectRatio, 0.0f }, { 0.0f, 0.0f } }, //top left
257-
{ { 0.75f, 0.75f * m_aspectRatio, 0.0f }, { 1.0f, 0.0f } }, //top right
258-
{ { -0.75f, -0.75f * m_aspectRatio, 0.0f }, { 0.0f, 1.0f } }, //bottom left
259-
{ { 0.75f, -0.75f * m_aspectRatio, 0.0f }, { 1.0f, 1.0f } }, //bottom right
256+
{ { -1.0f, 1.0f * m_aspectRatio, 0.0f }, { 0.0f, 0.0f } }, //top left
257+
{ { 1.0f, 1.0f * m_aspectRatio, 0.0f }, { 1.0f, 0.0f } }, //top right
258+
{ { -1.0f, -1.0f * m_aspectRatio, 0.0f }, { 0.0f, 1.0f } }, //bottom left
259+
{ { 1.0f, -1.0f * m_aspectRatio, 0.0f }, { 1.0f, 1.0f } }, //bottom right
260260
};
261261

262262
const UINT vertexBufferSize = sizeof(quadVertices);
@@ -464,12 +464,18 @@ void D3D12Quad::Reset() {
464464
void D3D12Quad::OnUpdate()
465465
{
466466
// Change the image every 75 frame updates
467-
updateCounter++;
467+
//updateCounter++;
468+
//justReset = false;
469+
//if (updateCounter == 75) {
470+
// Reset();
471+
// LoadImageTexture();
472+
// updateCounter = 0;
473+
// justReset = true;
474+
//}
468475
justReset = false;
469-
if (updateCounter == 75) {
476+
if (copy_texture) {
470477
Reset();
471478
LoadImageTexture();
472-
updateCounter = 0;
473479
justReset = true;
474480
}
475481
}
@@ -857,8 +863,12 @@ ComPtr<ID3D12Resource> D3D12Quad::GetCurrentBuffer()
857863
return currentBuffer;
858864
}
859865

860-
void D3D12Quad::ScheduleTextureCopy()
866+
void D3D12Quad::ShowNextImage()
861867
{
868+
//justReset = false;
869+
//Reset();
870+
//LoadImageTexture();
871+
//justReset = true;
862872
copy_texture = true;
863873
}
864874

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/D3D12Quad.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class D3D12Quad
2222
const WCHAR* GetTitle() const { return m_title.c_str(); }
2323

2424
ComPtr<ID3D12Resource> GetCurrentBuffer();
25-
void ScheduleTextureCopy();
25+
void ShowNextImage();
2626

2727
bool is_initialized = false;
2828

@@ -104,5 +104,6 @@ class D3D12Quad
104104
ComPtr<ID3D12Resource> currentBuffer;
105105
int imageBytesPerRow;
106106
bool copy_texture;
107+
bool show_next_image;
107108
};
108109

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/DXResourceBinding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ namespace winrt::WinMLSamplesGalleryNative::implementation
222222
// Classify the image using EfficientNet and return the results
223223
winrt::com_array<float> results = Eval(*inferenceSession, preprocessedInput);
224224

225-
sample.ScheduleTextureCopy();
225+
sample.ShowNextImage();
226226

227227
return results;
228228
}

0 commit comments

Comments
 (0)