This commit is contained in:
REDMOND\jingf 2022-03-10 22:15:58 -08:00
Родитель 91dfc1bad3
Коммит cd3c2ed012
5 изменённых файлов: 26 добавлений и 25 удалений

Просмотреть файл

@ -120,10 +120,8 @@
<None Include="Assets\SqueezeNet.onnx" />
<None Include="packages.config" />
<None Include="PropertySheet.props" />
<None Include="readme.md" />
<Text Include="Assets\Labels.txt" />
<Text Include="readme.txt">
<DeploymentContent>false</DeploymentContent>
</Text>
</ItemGroup>
<ItemGroup>
<Image Include="Assets\kitten_224.png" />

Просмотреть файл

@ -45,9 +45,9 @@
<None Include="Assets\SqueezeNet.onnx">
<Filter>Resource Files</Filter>
</None>
<None Include="readme.md" />
</ItemGroup>
<ItemGroup>
<Text Include="readme.txt" />
<Text Include="Assets\Labels.txt">
<Filter>Resource Files</Filter>
</Text>

Просмотреть файл

@ -13,10 +13,10 @@ using namespace std;
static hstring pixCaptureFilePath = L".\\PIXCapture\\capture.wpix";
ID3D12Device* m_d3d12Device;
ID3D12CommandList* m_commandList;
ID3D12CommandQueue* m_commandQueue;
UINT m_color = PIX_COLOR(255, 0, 0);
ID3D12Device* d3d12Device;
ID3D12CommandList* commandList;
ID3D12CommandQueue* commandQueue;
UINT color = PIX_COLOR(255, 0, 0);
void GetHardwareAdapter(IDXGIFactory4* pFactory, IDXGIAdapter1** ppAdapter)
{
@ -63,32 +63,32 @@ void GetD3D12CommandAssets()
IDXGIAdapter1* hardwareAdapter;
GetHardwareAdapter(factory, &hardwareAdapter);
D3D12CreateDevice(hardwareAdapter, D3D_FEATURE_LEVEL_12_0, _uuidof(ID3D12Device), (void**)&m_d3d12Device);
D3D12CreateDevice(hardwareAdapter, D3D_FEATURE_LEVEL_12_0, _uuidof(ID3D12Device), (void**)&d3d12Device);
m_d3d12Device->CreateCommandAllocator(
d3d12Device->CreateCommandAllocator(
type,
IID_PPV_ARGS(&commandAllocator)
);
m_d3d12Device->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&m_commandQueue));
m_d3d12Device->CreateCommandList(0, type, commandAllocator, nullptr, __uuidof(ID3D12CommandList), (void**)&m_commandList);
d3d12Device->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&commandQueue));
d3d12Device->CreateCommandList(0, type, commandAllocator, nullptr, __uuidof(ID3D12CommandList), (void**)&commandList);
}
void LoadAndEvaluate(ID3D12CommandQueue* commandQueue)
{
// Setting markers for each step, these markers will split the commands into sections for easier debugging
PIXSetMarker(commandQueue, m_color, "Start loading model...");
PIXSetMarker(commandQueue, color, "Start loading model...");
LoadModel();
PIXSetMarker(commandQueue, m_color, "Start loading image...");
PIXSetMarker(commandQueue, color, "Start loading image...");
LoadImageFile(imagePath);
PIXSetMarker(commandQueue, m_color, "Start creating session...");
PIXSetMarker(commandQueue, color, "Start creating session...");
CreateSession(commandQueue);
PIXSetMarker(commandQueue, m_color, "Start binding model...");
PIXSetMarker(commandQueue, color, "Start binding model...");
BindModel();
PIXSetMarker(commandQueue, m_color, "Start evaluating model...");
PIXSetMarker(commandQueue, color, "Start evaluating model...");
EvaluateModel();
}
@ -106,16 +106,18 @@ void CaptureWithUserSetMarker()
PIXBeginCaptureRedist(PIX_CAPTURE_GPU, &capParams);
// Start PIX event, markers can only be set within Being and End event sections
PIXBeginEvent(m_commandQueue, m_color, "WinMLPIXSample");
PIXBeginEvent(commandQueue, color, "WinMLPIXSample");
// Do the ML computation
LoadAndEvaluate(m_commandQueue);
LoadAndEvaluate(commandQueue);
// End PIX event
PIXEndEvent(m_commandQueue);
PIXEndEvent(commandQueue);
// End capture
PIXEndCaptureRedist(FALSE);
printf("Capture successfully completed, please look for capture.wpix file under PIXCapture directory.\n");
}
int main()
@ -123,7 +125,7 @@ int main()
TryEnsurePIXFunctions();
init_apartment();
CaptureWithUserSetMarker();
m_commandList->Release();
m_commandQueue->Release();
m_d3d12Device->Release();
commandList->Release();
commandQueue->Release();
d3d12Device->Release();
}

Просмотреть файл

@ -13,8 +13,6 @@
#include <string>
#include <fstream>
//#include <Windows.h>
#include <d3d12.h>
#include <dxgi1_4.h>

Просмотреть файл

@ -5,6 +5,9 @@
This project demonstrates how to get started using PIX for windows to do
GPU captures as well as setting markers programmatically.
When run, the program will do a capture and save the generated .wpix file
under folder PIXCapture.
NOTE: This sample uses redist build of PIX and loads WinPixEventRuntime.dll
dynamically