From acb8938e5c361742377e9a564642740cee0a7399 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Sat, 30 May 2020 21:50:30 -0700 Subject: [PATCH] functions taking std::function should not be noexcept --- Audio/DynamicSoundEffectInstance.cpp | 16 +++++++++++----- Inc/GeometricPrimitive.h | 13 +++++++++---- Inc/PostProcess.h | 13 +++++++++---- Inc/ScreenGrab.h | 2 +- Inc/SpriteBatch.h | 9 +++++++-- Src/BasicPostProcess.cpp | 8 ++++++-- Src/DualPostProcess.cpp | 8 ++++++-- Src/GeometricPrimitive.cpp | 13 ++++++++++--- Src/ScreenGrab.cpp | 2 +- Src/ToneMapPostProcess.cpp | 8 ++++++-- 10 files changed, 66 insertions(+), 26 deletions(-) diff --git a/Audio/DynamicSoundEffectInstance.cpp b/Audio/DynamicSoundEffectInstance.cpp index b8039289b..4dc9ee75c 100644 --- a/Audio/DynamicSoundEffectInstance.cpp +++ b/Audio/DynamicSoundEffectInstance.cpp @@ -23,8 +23,10 @@ class DynamicSoundEffectInstance::Impl : public IVoiceNotify { public: Impl(_In_ AudioEngine* engine, - _In_ DynamicSoundEffectInstance* object, std::function& bufferNeeded, - int sampleRate, int channels, int sampleBits, SOUND_EFFECT_INSTANCE_FLAGS flags) : + _In_ DynamicSoundEffectInstance* object, + std::function& bufferNeeded, + int sampleRate, int channels, int sampleBits, + SOUND_EFFECT_INSTANCE_FLAGS flags) : mBase(), mBufferNeeded(nullptr), mObject(object) @@ -238,9 +240,13 @@ void DynamicSoundEffectInstance::Impl::OnUpdate() // Public constructors _Use_decl_annotations_ -DynamicSoundEffectInstance::DynamicSoundEffectInstance(AudioEngine* engine, - std::function bufferNeeded, - int sampleRate, int channels, int sampleBits, SOUND_EFFECT_INSTANCE_FLAGS flags) : +DynamicSoundEffectInstance::DynamicSoundEffectInstance( + AudioEngine* engine, + std::function bufferNeeded, + int sampleRate, + int channels, + int sampleBits, + SOUND_EFFECT_INSTANCE_FLAGS flags) : pImpl(std::make_unique(engine, this, bufferNeeded, sampleRate, channels, sampleBits, flags)) { } diff --git a/Inc/GeometricPrimitive.h b/Inc/GeometricPrimitive.h index 27f968f02..55f4f8726 100644 --- a/Inc/GeometricPrimitive.h +++ b/Inc/GeometricPrimitive.h @@ -63,12 +63,17 @@ namespace DirectX static void __cdecl CreateTeapot(std::vector& vertices, std::vector& indices, float size = 1, size_t tessellation = 8, bool rhcoords = true); // Draw the primitive. - void XM_CALLCONV Draw(FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, FXMVECTOR color = Colors::White, _In_opt_ ID3D11ShaderResourceView* texture = nullptr, bool wireframe = false, - _In_opt_ std::function setCustomState = nullptr) const; + void XM_CALLCONV Draw(FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, + FXMVECTOR color = Colors::White, + _In_opt_ ID3D11ShaderResourceView* texture = nullptr, + bool wireframe = false, + _In_opt_ std::function setCustomState = nullptr) const; // Draw the primitive using a custom effect. - void __cdecl Draw(_In_ IEffect* effect, _In_ ID3D11InputLayout* inputLayout, bool alpha = false, bool wireframe = false, - _In_opt_ std::function setCustomState = nullptr) const; + void __cdecl Draw(_In_ IEffect* effect, + _In_ ID3D11InputLayout* inputLayout, + bool alpha = false, bool wireframe = false, + _In_opt_ std::function setCustomState = nullptr) const; // Create input layout for drawing with a custom effect. void __cdecl CreateInputLayout(_In_ IEffect* effect, _Outptr_ ID3D11InputLayout** inputLayout) const; diff --git a/Inc/PostProcess.h b/Inc/PostProcess.h index 07fabe2cc..deba9a16f 100644 --- a/Inc/PostProcess.h +++ b/Inc/PostProcess.h @@ -35,7 +35,8 @@ namespace DirectX IPostProcess(IPostProcess&&) = delete; IPostProcess& operator=(IPostProcess&&) = delete; - virtual void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) = 0; + virtual void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, + _In_opt_ std::function setCustomState = nullptr) = 0; protected: IPostProcess() = default; @@ -70,7 +71,9 @@ namespace DirectX ~BasicPostProcess() override; // IPostProcess methods. - void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; + void __cdecl Process( + _In_ ID3D11DeviceContext* deviceContext, + _In_opt_ std::function setCustomState = nullptr) override; // Shader control void __cdecl SetEffect(Effect fx); @@ -117,7 +120,8 @@ namespace DirectX ~DualPostProcess() override; // IPostProcess methods. - void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; + void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, + _In_opt_ std::function setCustomState = nullptr) override; // Shader control void __cdecl SetEffect(Effect fx); @@ -174,7 +178,8 @@ namespace DirectX ~ToneMapPostProcess() override; // IPostProcess methods. - void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; + void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, + _In_opt_ std::function setCustomState = nullptr) override; // Shader control void __cdecl SetOperator(Operator op); diff --git a/Inc/ScreenGrab.h b/Inc/ScreenGrab.h index 7de8765b7..81f78018f 100644 --- a/Inc/ScreenGrab.h +++ b/Inc/ScreenGrab.h @@ -44,5 +44,5 @@ namespace DirectX _In_z_ const wchar_t* fileName, _In_opt_ const GUID* targetFormat = nullptr, _In_opt_ std::function setCustomProps = nullptr, - _In_ bool forceSRGB = false) noexcept; + _In_ bool forceSRGB = false); } diff --git a/Inc/SpriteBatch.h b/Inc/SpriteBatch.h index 5d97faf09..f9bdcbaf3 100644 --- a/Inc/SpriteBatch.h +++ b/Inc/SpriteBatch.h @@ -56,8 +56,13 @@ namespace DirectX virtual ~SpriteBatch(); // Begin/End a batch of sprite drawing operations. - void XM_CALLCONV Begin(SpriteSortMode sortMode = SpriteSortMode_Deferred, _In_opt_ ID3D11BlendState* blendState = nullptr, _In_opt_ ID3D11SamplerState* samplerState = nullptr, _In_opt_ ID3D11DepthStencilState* depthStencilState = nullptr, _In_opt_ ID3D11RasterizerState* rasterizerState = nullptr, - _In_opt_ std::function setCustomShaders = nullptr, FXMMATRIX transformMatrix = MatrixIdentity); + void XM_CALLCONV Begin(SpriteSortMode sortMode = SpriteSortMode_Deferred, + _In_opt_ ID3D11BlendState* blendState = nullptr, + _In_opt_ ID3D11SamplerState* samplerState = nullptr, + _In_opt_ ID3D11DepthStencilState* depthStencilState = nullptr, + _In_opt_ ID3D11RasterizerState* rasterizerState = nullptr, + _In_opt_ std::function setCustomShaders = nullptr, + FXMMATRIX transformMatrix = MatrixIdentity); void __cdecl End(); // Draw overloads specifying position, origin and scale as XMFLOAT2. diff --git a/Src/BasicPostProcess.cpp b/Src/BasicPostProcess.cpp index 36df36233..4d2751975 100644 --- a/Src/BasicPostProcess.cpp +++ b/Src/BasicPostProcess.cpp @@ -217,7 +217,9 @@ BasicPostProcess::Impl::Impl(_In_ ID3D11Device* device) // Sets our state onto the D3D device. -void BasicPostProcess::Impl::Process(_In_ ID3D11DeviceContext* deviceContext, std::function& setCustomState) +void BasicPostProcess::Impl::Process( + _In_ ID3D11DeviceContext* deviceContext, + std::function& setCustomState) { // Set the texture. ID3D11ShaderResourceView* textures[1] = { texture.Get() }; @@ -496,7 +498,9 @@ BasicPostProcess::~BasicPostProcess() // IPostProcess methods. -void BasicPostProcess::Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState) +void BasicPostProcess::Process( + _In_ ID3D11DeviceContext* deviceContext, + _In_opt_ std::function setCustomState) { pImpl->Process(deviceContext, setCustomState); } diff --git a/Src/DualPostProcess.cpp b/Src/DualPostProcess.cpp index 3990b1ba1..05c4587bc 100644 --- a/Src/DualPostProcess.cpp +++ b/Src/DualPostProcess.cpp @@ -184,7 +184,9 @@ DualPostProcess::Impl::Impl(_In_ ID3D11Device* device) // Sets our state onto the D3D device. -void DualPostProcess::Impl::Process(_In_ ID3D11DeviceContext* deviceContext, std::function& setCustomState) +void DualPostProcess::Impl::Process( + _In_ ID3D11DeviceContext* deviceContext, + std::function& setCustomState) { // Set the texture. ID3D11ShaderResourceView* textures[2] = { texture.Get(), texture2.Get() }; @@ -294,7 +296,9 @@ DualPostProcess::~DualPostProcess() // IPostProcess methods. -void DualPostProcess::Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState) +void DualPostProcess::Process( + _In_ ID3D11DeviceContext* deviceContext, + _In_opt_ std::function setCustomState) { pImpl->Process(deviceContext, setCustomState); } diff --git a/Src/GeometricPrimitive.cpp b/Src/GeometricPrimitive.cpp index 186a7f8c0..692b18954 100644 --- a/Src/GeometricPrimitive.cpp +++ b/Src/GeometricPrimitive.cpp @@ -28,9 +28,16 @@ class GeometricPrimitive::Impl void Initialize(_In_ ID3D11DeviceContext* deviceContext, const VertexCollection& vertices, const IndexCollection& indices); - void XM_CALLCONV Draw(FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, FXMVECTOR color, _In_opt_ ID3D11ShaderResourceView* texture, bool wireframe, std::function& setCustomState) const; - - void Draw(_In_ IEffect* effect, _In_ ID3D11InputLayout* inputLayout, bool alpha, bool wireframe, std::function& setCustomState) const; + void XM_CALLCONV Draw(FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, + FXMVECTOR color, + _In_opt_ ID3D11ShaderResourceView* texture, + bool wireframe, + std::function& setCustomState) const; + + void Draw(_In_ IEffect* effect, + _In_ ID3D11InputLayout* inputLayout, + bool alpha, bool wireframe, + std::function& setCustomState) const; void CreateInputLayout(_In_ IEffect* effect, _Outptr_ ID3D11InputLayout** inputLayout) const; diff --git a/Src/ScreenGrab.cpp b/Src/ScreenGrab.cpp index 3e03b4227..8ab78b308 100644 --- a/Src/ScreenGrab.cpp +++ b/Src/ScreenGrab.cpp @@ -349,7 +349,7 @@ HRESULT DirectX::SaveWICTextureToFile( const wchar_t* fileName, const GUID* targetFormat, std::function setCustomProps, - bool forceSRGB) noexcept + bool forceSRGB) { if (!fileName) return E_INVALIDARG; diff --git a/Src/ToneMapPostProcess.cpp b/Src/ToneMapPostProcess.cpp index 418eca56b..d5da7233f 100644 --- a/Src/ToneMapPostProcess.cpp +++ b/Src/ToneMapPostProcess.cpp @@ -271,7 +271,9 @@ ToneMapPostProcess::Impl::Impl(_In_ ID3D11Device* device) // Sets our state onto the D3D device. -void ToneMapPostProcess::Impl::Process(_In_ ID3D11DeviceContext* deviceContext, std::function& setCustomState) +void ToneMapPostProcess::Impl::Process( + _In_ ID3D11DeviceContext* deviceContext, + std::function& setCustomState) { // Set the texture. ID3D11ShaderResourceView* textures[1] = { hdrTexture.Get() }; @@ -377,7 +379,9 @@ ToneMapPostProcess::~ToneMapPostProcess() // IPostProcess methods. -void ToneMapPostProcess::Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState) +void ToneMapPostProcess::Process( + _In_ ID3D11DeviceContext* deviceContext, + _In_opt_ std::function setCustomState) { pImpl->Process(deviceContext, setCustomState); }