Skip to content

Commit 2f20b38

Browse files
committed
Add missing SAL Annotations for improved COM API wrapping
Since the API exposed by some of these headers uses COM, annotating them with the necessary SAL annotations make it more convenient to generate comprehensive external bindings for them, such as in Rust: https://github.com/Traverse-Research/amd-ext-d3d-rs
1 parent e63b841 commit 2f20b38

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

AmdExtD3D.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
***********************************************************************************************************************
2828
* @file AmdExtD3D.h
29-
* @brief AMD D3D Exension API factory include file.
29+
* @brief AMD D3D Extension API factory include file.
3030
***********************************************************************************************************************
3131
*/
3232
#pragma once
@@ -45,10 +45,10 @@
4545
// The app must use GetProcAddress, etc. to retrieve this exported function
4646
// The associated typedef provides a convenient way to define the function pointer
4747
HRESULT __cdecl AmdExtD3DCreateInterface(
48-
IUnknown* pOuter, ///< [in] object on which to base this new interface; usually a D3D device
49-
REFIID riid, ///< ID of the requested interface
50-
void** ppvObject); ///< [out] The result interface object
51-
typedef HRESULT (__cdecl *PFNAmdExtD3DCreateInterface)(IUnknown* pOuter, REFIID riid, void** ppvObject);
48+
IUnknown* pOuter, ///< [in] object on which to base this new interface; usually a D3D device
49+
REFIID riid, ///< ID of the requested interface
50+
_COM_Outptr_ void** ppvObject); ///< [out] The result interface object
51+
typedef HRESULT (__cdecl *PFNAmdExtD3DCreateInterface)(IUnknown* pOuter, REFIID riid, _COM_Outptr_ void** ppvObject);
5252

5353
/**
5454
***********************************************************************************************************************
@@ -62,8 +62,8 @@ IAmdExtD3DFactory : public IUnknown
6262
{
6363
public:
6464
virtual HRESULT CreateInterface(
65-
IUnknown* pOuter, ///< [in] An object on which to base this new interface; the required object type
66-
///< is usually a device object but not always
67-
REFIID riid, ///< The ID of the requested interface
68-
void** ppvObject) = 0; ///< [out] The result interface object
65+
IUnknown* pOuter, ///< [in] An object on which to base this new interface; the required object type
66+
///< is usually a device object but not always
67+
REFIID riid, ///< The ID of the requested interface
68+
_COM_Outptr_ void** ppvObject) = 0; ///< [out] The result interface object
6969
};

AmdExtD3DCommandListMarkerApi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ IAmdExtD3DCommandListMarker : public IUnknown
5151
virtual VOID PopMarker() = 0;
5252
/// Set a command list marker to indicate a rendering activity
5353
virtual VOID SetMarker(const char* pMarker) = 0;
54-
};
54+
};

AmdExtD3DDeviceApi.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525
*/
2626

2727
#pragma once
28-
#include "unknwn.h"
28+
#include <unknwn.h>
2929
#include <d3d12.h>
30-
#include "AmdExtD3DDeviceApi.h"
3130

3231
/**
3332
***********************************************************************************************************************
@@ -88,7 +87,7 @@ IAmdExtD3DDevice : public IUnknown
8887
const AmdExtD3DCreateInfo* pAmdExtCreateInfo,
8988
const D3D12_GRAPHICS_PIPELINE_STATE_DESC* pDesc,
9089
REFIID riid,
91-
void** ppPipelineState) = 0;
90+
_COM_Outptr_ void** ppPipelineState) = 0;
9291
};
9392

9493
/**
@@ -103,4 +102,4 @@ IAmdExtD3DDevice1 : public IAmdExtD3DDevice
103102
virtual VOID PushMarker(ID3D12GraphicsCommandList* pGfxCmdList, const char* pMarker) = 0;
104103
virtual VOID PopMarker(ID3D12GraphicsCommandList* pGfxCmdList) = 0;
105104
virtual VOID SetMarker(ID3D12GraphicsCommandList* pGfxCmdList, const char* pMarker) = 0;
106-
};
105+
};

AmdExtGpaInterfaceApi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ IAmdExtGpaSession : public IUnknown
8181
virtual UINT32 BeginSample(ID3D12GraphicsCommandList* pGfxCmdList, const AmdExtGpaSampleConfig& config) = 0;
8282
virtual VOID EndSample(ID3D12GraphicsCommandList* pGfxCmdList, UINT32 sampleId) = 0;
8383
virtual bool IsReady() const = 0;
84-
virtual HRESULT GetResults(UINT32 sampleId, size_t* pSizeInBytes, void *pData) const = 0;
84+
virtual HRESULT GetResults(UINT32 sampleId, _Inout_ size_t* pSizeInBytes, _Out_writes_bytes_opt_(*pSizeInBytes) void *pData) const = 0;
8585
virtual HRESULT Reset() = 0;
8686
virtual VOID CopyResults(ID3D12GraphicsCommandList* pGfxCmdList) = 0;
8787
};

0 commit comments

Comments
 (0)