-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAmdExtGpaInterfaceApi.h
112 lines (106 loc) · 4.66 KB
/
AmdExtGpaInterfaceApi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
***************************************************************************************************
*
* Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
*
***************************************************************************************************
*/
/**
***********************************************************************************************************************
* @file AmdExtGpuPerfApiInterface.h
* @brief
* AMD Gpu Perf Api Interface include file.
* This include file contains the functions that expose the perf counter
* interface in the driver for use by the AMD Gpu Perf Api (GPA).
*
* // Example code for getting access to the GpaSession
* // note: This requires to link against the driver lib and to have a stub dll in the system32/syswow64 directory.
*
* #ifdef _WIN64
* #pragma comment(lib, "amdxc64.lib")
* #else
* #pragma comment(lib, "amdxc32.lib")
* #endif
*
* extern "C" HMODULE __stdcall AmdGetDxcModuleHandle();
*
* HRESULT hr = S_OK;
* IAmdExtD3DFactory* pAmdExtObject;
* IAmdExtGpaInterface* pAmdShaderIntrinsicExt;
*
* HMODULE m_hAmdD3d12 = AmdGetDxcModuleHandle();
*
* // alternatively it's also possible to use LoadLibrary but it's not allowed on rs2 for a windows store app:
* //#ifdef _WIN64
* // HMODULE m_hAmdD3d12 = LoadLibrary(L"amdxc64.dll");
* //#else
* // HMODULE m_hAmdD3d12 = LoadLibrary("amdxc32.dll");
* //#endif
*
* if (m_hAmdD3d12 != NULL)
* {
* PFNAmdExtD3DCreateInterface pAmdExtD3dCreateFunc = (PFNAmdExtD3DCreateInterface)GetProcAddress(m_hAmdD3d12,
* "AmdExtD3DCreateInterface");
*
* if (pAmdExtD3dCreateFunc != NULL)
* {
* hr = pAmdExtD3dCreateFunc(device.Get(), __uuidof(IAmdExtD3DFactory), reinterpret_cast<void **>(&pAmdExtObject));
*
* if (hr == S_OK)
* {
* hr = pAmdExtObject->CreateInterface(device.Get(),
* __uuidof(IAmdExtGpaInterface),
* reinterpret_cast<void **>(&pAmdShaderIntrinsicExt));
* }
* }
* }
*
* IAmdExtGpaSession* gpaSession = pAmdShaderIntrinsicExt->CreateGpaSession();
* gpaSession->Begin(commandList.Get());
***********************************************************************************************************************
*/
#pragma once
#include <unknwn.h>
#include <d3d12.h>
#include "AmdExtGpaInterface.h"
/**
***********************************************************************************************************************
* @brief Gpu Perf API extension API object
***********************************************************************************************************************
*/
interface __declspec(uuid("10D00E78-DCBF-4210-BE46-94BD222A332B"))
IAmdExtGpaSession : public IUnknown
{
public:
virtual HRESULT Begin(ID3D12GraphicsCommandList* pGfxCmdList) = 0;
virtual HRESULT End(ID3D12GraphicsCommandList* pGfxCmdList) = 0;
virtual UINT32 BeginSample(ID3D12GraphicsCommandList* pGfxCmdList, const AmdExtGpaSampleConfig& config) = 0;
virtual VOID EndSample(ID3D12GraphicsCommandList* pGfxCmdList, UINT32 sampleId) = 0;
virtual bool IsReady() const = 0;
virtual HRESULT GetResults(UINT32 sampleId, size_t* pSizeInBytes, void *pData) const = 0;
virtual HRESULT Reset() = 0;
virtual VOID CopyResults(ID3D12GraphicsCommandList* pGfxCmdList) = 0;
};
interface __declspec(uuid("16AE5721-7ED4-4292-9B50-B976DF1347FE"))
IAmdExtGpaInterface : public IUnknown
{
public:
/// Queries for GPU blocks and available counters. Does not return data for counters after AmdExtGpuBlock::Rmi
virtual HRESULT GetPerfExperimentProperties(AmdExtPerfExperimentProperties* pProperties) const = 0;
/// Ability to control clocks for profiling
virtual VOID SetClockMode(const AmdExtDeviceClockMode clockModeInput,
AmdExtSetClockModeOutput* pClockModeOutput) = 0;
/// Creates a gpa session
virtual IAmdExtGpaSession* CreateGpaSession() = 0;
/// Creates and returns a copy of a GpaSession object for use with second level command lists
virtual IAmdExtGpaSession* CopyGpaSession(const IAmdExtGpaSession* pSrc) = 0;
/// Destroys and frees memory allocated for the gpa session
virtual void DestroyGpaSession(IAmdExtGpaSession* pExtGpaSession) = 0;
};
interface __declspec(uuid("802984F4-E529-4A4E-AC4D-A32B1197B55E"))
IAmdExtGpaInterface2 : public IAmdExtGpaInterface
{
public:
/// Queries for GPU blocks and available counters. Pass AmdExtGpuBlock::Count for blockCount
virtual HRESULT GetPerfExperimentProperties2(AmdExtPerfExperimentProperties* pProperties, AmdExtGpuBlock blockCount) const = 0;
};