Added noexcept annotation to public functions and fixed -Wmicrosoft-exception-spec

This commit is contained in:
Chuck Walbourn 2019-12-11 17:02:40 -08:00
parent c2d67b8d70
commit 9a8cc96fff
5 changed files with 59 additions and 61 deletions

View File

@ -23,7 +23,7 @@
#include <functional>
#include <vector>
#define UVATLAS_VERSION 160
#define UVATLAS_VERSION 170
namespace DirectX
{
@ -149,7 +149,7 @@ namespace DirectX
_Inout_opt_ std::vector<uint32_t>* pvFacePartitioning = nullptr,
_Inout_opt_ std::vector<uint32_t>* pvVertexRemapArray = nullptr,
_Out_opt_ float *maxStretchOut = nullptr,
_Out_opt_ size_t *numChartsOut = nullptr);
_Out_opt_ size_t *numChartsOut = nullptr) noexcept;
// This has the same exact arguments as Create, except that it does not perform the
// final packing step. This method allows one to get a partitioning out, and possibly
@ -196,7 +196,7 @@ namespace DirectX
_Inout_opt_ std::vector<uint32_t>* pvVertexRemapArray,
_Inout_ std::vector<uint32_t>& vPartitionResultAdjacency,
_Out_opt_ float *maxStretchOut = nullptr,
_Out_opt_ size_t *numChartsOut = nullptr);
_Out_opt_ size_t *numChartsOut = nullptr) noexcept;
// This takes the face partitioning result from Partition and packs it into an
// atlas of the given size. pPartitionResultAdjacency should be derived from
@ -210,7 +210,7 @@ namespace DirectX
_In_ float gutter,
_In_ const std::vector<uint32_t>& vPartitionResultAdjacency,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_In_ float callbackFrequency);
_In_ float callbackFrequency) noexcept;
//============================================================================
@ -252,7 +252,7 @@ namespace DirectX
_In_ size_t signalDimension,
_In_ size_t signalStride,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_Out_writes_(nFaces * 3) float* pIMTArray);
_Out_writes_(nFaces * 3) float* pIMTArray) noexcept;
// This function is used to calculate the IMT from data that varies over the
// surface of the mesh (generally at a higher frequency than vertex data).
@ -285,7 +285,7 @@ namespace DirectX
signalCallback,
_In_opt_ void *userData,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_Out_writes_(nFaces * 3) float* pIMTArray);
_Out_writes_(nFaces * 3) float* pIMTArray) noexcept;
// This function is used to calculate the IMT from texture data. Given a texture
// that maps over the surface of the mesh, the algorithm computes the IMT for
@ -309,7 +309,7 @@ namespace DirectX
_In_ size_t height,
_In_ DWORD options,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_Out_writes_(nFaces * 3) float* pIMTArray);
_Out_writes_(nFaces * 3) float* pIMTArray) noexcept;
// This function is very similar to UVAtlasComputeIMTFromTexture, but it can
// calculate higher dimensional values than 4.
@ -325,18 +325,18 @@ namespace DirectX
_In_reads_(nVerts) const XMFLOAT3* positions,
_In_reads_(nVerts) const XMFLOAT2* texcoords,
_In_ size_t nVerts,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces*sizeof(uint32_t))) const void* indices,
_When_(indexFormat == DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * sizeof(uint16_t)))
_When_(indexFormat != DXGI_FORMAT_R16_UINT, _In_reads_bytes_(nFaces * sizeof(uint32_t))) const void* indices,
_In_ DXGI_FORMAT indexFormat,
_In_ size_t nFaces,
_In_reads_(width*height*nComponents) const float *pTexelSignal,
_In_reads_(width* height* nComponents) const float* pTexelSignal,
_In_ size_t width,
_In_ size_t height,
_In_ size_t signalDimension,
_In_ size_t nComponents,
_In_ DWORD options,
_In_opt_ std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
_Out_writes_(nFaces * 3) float* pIMTArray);
_Out_writes_(nFaces * 3) float* pIMTArray) noexcept;
// This function is for applying the a vertex remap array from UVAtlasCreate/UVAtlasPartition to a vertex buffer
//
@ -344,10 +344,10 @@ namespace DirectX
// vbout - This is the output vertex buffer and is nNewVerts*stride in size
// nNewVerts - This should be >= nVerts
HRESULT __cdecl UVAtlasApplyRemap(
_In_reads_bytes_(nVerts*stride) const void* vbin,
_In_reads_bytes_(nVerts* stride) const void* vbin,
_In_ size_t stride,
_In_ size_t nVerts,
_In_ size_t nNewVerts,
_In_reads_(nNewVerts) const uint32_t* vertexRemap,
_Out_writes_bytes_(nNewVerts*stride) void* vbout );
_Out_writes_bytes_(nNewVerts* stride) void* vbout) noexcept;
}

View File

@ -586,7 +586,7 @@ HRESULT __cdecl DirectX::UVAtlasPartition(
std::vector<uint32_t>* pvVertexRemapArray,
std::vector<uint32_t>& vPartitionResultAdjacency,
float *maxStretchOut,
size_t *numChartsOut)
size_t *numChartsOut) noexcept
{
return UVAtlasPartitionInt(positions,
nVerts,
@ -626,7 +626,7 @@ HRESULT __cdecl DirectX::UVAtlasPack(
float gutter,
const std::vector<uint32_t>& vPartitionResultAdjacency,
std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
float callbackFrequency)
float callbackFrequency) noexcept
{
return UVAtlasPackInt(vMeshVertexBuffer,
vMeshIndexBuffer,
@ -666,7 +666,7 @@ HRESULT __cdecl DirectX::UVAtlasCreate(
std::vector<uint32_t>* pvFacePartitioning,
std::vector<uint32_t>* pvVertexRemapArray,
float *maxStretchOut,
size_t *numChartsOut)
size_t *numChartsOut) noexcept
{
std::vector<uint32_t> vFacePartitioning;
std::vector<uint32_t> vAdjacencyOut;
@ -733,7 +733,7 @@ HRESULT __cdecl DirectX::UVAtlasComputeIMTFromPerVertexSignal(
size_t signalDimension,
size_t signalStride,
std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
float* pIMTArray)
float* pIMTArray) noexcept
{
if (!positions || !nVerts || !indices || !nFaces || !pVertexSignal || !pIMTArray)
return E_INVALIDARG;
@ -855,7 +855,7 @@ HRESULT __cdecl DirectX::UVAtlasComputeIMTFromSignal(
std::function<HRESULT __cdecl(const DirectX::XMFLOAT2 *uv, size_t primitiveID, size_t signalDimension, void* userData, float* signalOut)> signalCallback,
void *userData,
std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
float* pIMTArray)
float* pIMTArray) noexcept
{
if (!positions || !texcoords || !nVerts || !indices || !nFaces || !pIMTArray)
return E_INVALIDARG;
@ -1241,7 +1241,7 @@ HRESULT __cdecl DirectX::UVAtlasComputeIMTFromTexture(
size_t height,
DWORD options,
std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
float* pIMTArray)
float* pIMTArray) noexcept
{
if (!positions || !texcoords || !nVerts || !indices || !nFaces || !pTexture || !pIMTArray)
return E_INVALIDARG;
@ -1644,7 +1644,7 @@ HRESULT __cdecl DirectX::UVAtlasComputeIMTFromPerTexelSignal(
size_t nComponents,
DWORD options,
std::function<HRESULT __cdecl(float percentComplete)> statusCallBack,
float* pIMTArray)
float* pIMTArray) noexcept
{
if (!positions || !texcoords || !nVerts || !indices || !nFaces || !pTexelSignal || !pIMTArray)
return E_INVALIDARG;
@ -1780,7 +1780,7 @@ HRESULT __cdecl DirectX::UVAtlasApplyRemap(
size_t nVerts,
size_t nNewVerts,
const uint32_t* vertexRemap,
void* vbout )
void* vbout ) noexcept
{
if ( !vbin || !stride || !nVerts || !nNewVerts || !vertexRemap || !vbout )
return E_INVALIDARG;

View File

@ -116,7 +116,7 @@ public:
static IIsochartEngine* CreateIsochartEngine();
static void ReleaseIsochartEngine(IIsochartEngine* pIsochartEngine);
STDMETHOD(Initialize)(
virtual HRESULT Initialize(
const void* pVertexArray,
size_t VertexCount,
size_t VertexStride,
@ -126,18 +126,18 @@ public:
const FLOAT3* pIMTArray,
const uint32_t* pOriginalAjacency,
const uint32_t* pSplitHint,
DWORD dwOptions) PURE;
DWORD dwOptions) noexcept = 0;
STDMETHOD(Free)() PURE;
virtual HRESULT Free() noexcept = 0;
STDMETHOD(Partition)(
virtual HRESULT Partition(
size_t MaxChartNumber,
float Stretch,
size_t& ChartNumberOut,
float& MaxChartStretchOut,
uint32_t* pFaceAttributeIDOut) PURE;
uint32_t* pFaceAttributeIDOut) noexcept = 0;
STDMETHOD(Pack)(
virtual HRESULT Pack(
size_t Width,
size_t Height,
float Gutter,
@ -145,31 +145,29 @@ public:
std::vector<DirectX::UVAtlasVertex>* pvVertexArrayOut,
std::vector<uint8_t>* pvFaceIndexArrayOut,
std::vector<uint32_t>* pvVertexRemapArrayOut,
_In_opt_ std::vector<uint32_t>* pvAttributeID) PURE;
_In_opt_ std::vector<uint32_t>* pvAttributeID) noexcept = 0;
STDMETHOD(SetCallback)(
virtual HRESULT SetCallback(
LPISOCHARTCALLBACK pCallback,
float Frequency) PURE;
float Frequency) noexcept = 0;
STDMETHOD(SetStage)(
virtual HRESULT SetStage(
unsigned int TotalStageCount,
unsigned int DoneStageCount) PURE;
unsigned int DoneStageCount) noexcept = 0;
STDMETHOD (ExportPartitionResult)(
virtual HRESULT ExportPartitionResult(
std::vector<DirectX::UVAtlasVertex>* pvVertexArrayOut,
std::vector<uint8_t>* pvFaceIndexArrayOut,
std::vector<uint32_t>* pvVertexRemapArrayOut,
std::vector<uint32_t>* pvAttributeIDOut,
std::vector<uint32_t>* pvAdjacencyOut) PURE;
std::vector<uint32_t>* pvAdjacencyOut) noexcept = 0;
STDMETHOD (InitializePacking)(
virtual HRESULT InitializePacking(
std::vector<DirectX::UVAtlasVertex>* pvVertexBuffer,
size_t VertexCount,
std::vector<uint8_t>* pvFaceIndexBuffer,
size_t FaceCount,
const uint32_t* pdwFaceAdjacentArrayIn) PURE;
const uint32_t* pdwFaceAdjacentArrayIn) noexcept = 0;
};
/////////////////////////////////////////////////////////////////////////

View File

@ -90,7 +90,7 @@ HRESULT CIsochartEngine::Initialize(
const FLOAT3* pIMTArray,
const uint32_t* pOriginalAjacency,
const uint32_t* pSplitHint,
DWORD dwOptions)
DWORD dwOptions) noexcept
{
DPF(1, "Initialize...");
@ -168,7 +168,7 @@ LEnd:
}
// Release all buffers and reset CIsochartEngine
HRESULT CIsochartEngine::Free()
HRESULT CIsochartEngine::Free() noexcept
{
HRESULT hr = S_OK;
@ -202,7 +202,7 @@ HRESULT CIsochartEngine::Partition(
float Stretch,
size_t& ChartNumberOut,
float& MaxChartStretchOut,
uint32_t* pFaceAttributeIDOut)
uint32_t* pFaceAttributeIDOut) noexcept
{
DPF(1, "Partition....");
@ -711,7 +711,7 @@ HRESULT CIsochartEngine::Pack(
std::vector<UVAtlasVertex>* pvVertexArrayOut,
std::vector<uint8_t>* pvFaceIndexArrayOut,
std::vector<uint32_t>* pvVertexRemapArrayOut,
_In_opt_ std::vector<uint32_t>* pvAttributeID)
_In_opt_ std::vector<uint32_t>* pvAttributeID) noexcept
{
DPF(1, "Packing Charts...");
if (!CheckPackParameters(
@ -841,7 +841,7 @@ void CIsochartEngine::ExportPackResultToOrgMesh(
//
HRESULT CIsochartEngine::SetCallback(
LPISOCHARTCALLBACK pCallback,
float Frequency)
float Frequency) noexcept
{
if (!CheckSetCallbackParameters(
pCallback,
@ -869,7 +869,7 @@ HRESULT CIsochartEngine::SetCallback(
HRESULT CIsochartEngine::SetStage(
unsigned int TotalStageCount,
unsigned int DoneStageCount)
unsigned int DoneStageCount) noexcept
{
if (TotalStageCount < DoneStageCount)
{
@ -899,7 +899,7 @@ HRESULT CIsochartEngine::ExportPartitionResult(
std::vector<uint8_t>* pvFaceIndexArrayOut,
std::vector<uint32_t>* pvVertexRemapArrayOut,
std::vector<uint32_t>* pvAttributeIDOut,
std::vector<uint32_t>* pvAdjacencyOut)
std::vector<uint32_t>* pvAdjacencyOut) noexcept
{
if (!CheckExportPartitionResultParameters(
@ -936,7 +936,7 @@ HRESULT CIsochartEngine::InitializePacking(
size_t VertexCount,
std::vector<uint8_t>* pvFaceIndexBuffer,
size_t FaceCount,
const uint32_t* pdwFaceAdjacentArrayIn)
const uint32_t* pdwFaceAdjacentArrayIn) noexcept
{
if (!CheckInitializePackingParameters(
pvVertexBuffer,

View File

@ -26,7 +26,7 @@ public:
virtual ~CIsochartEngine() override;
// IIsochartEngine
STDMETHODIMP Initialize(
virtual HRESULT Initialize(
const void* pVertexArray,
size_t VertexCount,
size_t VertexStride,
@ -36,18 +36,18 @@ public:
const FLOAT3* pIMTArray,
const uint32_t* pOriginalAjacency,
const uint32_t* pSplitHint,
DWORD dwOptions) override;
DWORD dwOptions) noexcept override;
STDMETHODIMP Free() override;
virtual HRESULT Free() noexcept override;
STDMETHODIMP Partition(
virtual HRESULT Partition(
size_t MaxChartNumber,
float Stretch,
size_t& ChartNumberOut,
float& MaxChartStretchOut,
uint32_t* pFaceAttributeIDOut) override;
uint32_t* pFaceAttributeIDOut) noexcept override;
STDMETHODIMP Pack(
virtual HRESULT Pack(
size_t Width,
size_t Height,
float Gutter,
@ -55,29 +55,29 @@ public:
std::vector<DirectX::UVAtlasVertex>* pvVertexArrayOut,
std::vector<uint8_t>* pvFaceIndexArrayOut,
std::vector<uint32_t>* pvVertexRemapArrayOut,
_In_opt_ std::vector<uint32_t>* pvAttributeID) override;
_In_opt_ std::vector<uint32_t>* pvAttributeID) noexcept override;
STDMETHODIMP SetCallback(
virtual HRESULT SetCallback(
LPISOCHARTCALLBACK pCallback,
float Frequency) override;
float Frequency) noexcept override;
STDMETHODIMP SetStage(
virtual HRESULT SetStage(
unsigned int TotalStageCount,
unsigned int DoneStageCount) override;
unsigned int DoneStageCount) noexcept override;
STDMETHODIMP ExportPartitionResult(
virtual HRESULT ExportPartitionResult(
std::vector<DirectX::UVAtlasVertex>* pvVertexArrayOut,
std::vector<uint8_t>* pvFaceIndexArrayOut,
std::vector<uint32_t>* pvVertexRemapArrayOut,
std::vector<uint32_t>* pvAttributeIDOut,
std::vector<uint32_t>* pvAdjacencyOut) override;
std::vector<uint32_t>* pvAdjacencyOut) noexcept override;
STDMETHODIMP InitializePacking(
virtual HRESULT InitializePacking(
std::vector<DirectX::UVAtlasVertex>* pvVertexBuffer,
size_t VertexCount,
std::vector<uint8_t>* pvFaceIndexBuffer,
size_t FaceCount,
const uint32_t* pdwFaceAdjacentArrayIn) override;
const uint32_t* pdwFaceAdjacentArrayIn) noexcept override;
HRESULT CreateEngineMutex();
private: