Skip to content

Commit

Permalink
functions taking std::function should not be noexcept
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed May 31, 2020
1 parent f4eb038 commit acb8938
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 26 deletions.
16 changes: 11 additions & 5 deletions Audio/DynamicSoundEffectInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ class DynamicSoundEffectInstance::Impl : public IVoiceNotify
{
public:
Impl(_In_ AudioEngine* engine,
_In_ DynamicSoundEffectInstance* object, std::function<void(DynamicSoundEffectInstance*)>& bufferNeeded,
int sampleRate, int channels, int sampleBits, SOUND_EFFECT_INSTANCE_FLAGS flags) :
_In_ DynamicSoundEffectInstance* object,
std::function<void(DynamicSoundEffectInstance*)>& bufferNeeded,
int sampleRate, int channels, int sampleBits,
SOUND_EFFECT_INSTANCE_FLAGS flags) :
mBase(),
mBufferNeeded(nullptr),
mObject(object)
Expand Down Expand Up @@ -238,9 +240,13 @@ void DynamicSoundEffectInstance::Impl::OnUpdate()

// Public constructors
_Use_decl_annotations_
DynamicSoundEffectInstance::DynamicSoundEffectInstance(AudioEngine* engine,
std::function<void(DynamicSoundEffectInstance*)> bufferNeeded,
int sampleRate, int channels, int sampleBits, SOUND_EFFECT_INSTANCE_FLAGS flags) :
DynamicSoundEffectInstance::DynamicSoundEffectInstance(
AudioEngine* engine,
std::function<void(DynamicSoundEffectInstance*)> bufferNeeded,
int sampleRate,
int channels,
int sampleBits,
SOUND_EFFECT_INSTANCE_FLAGS flags) :
pImpl(std::make_unique<Impl>(engine, this, bufferNeeded, sampleRate, channels, sampleBits, flags))
{
}
Expand Down
13 changes: 9 additions & 4 deletions Inc/GeometricPrimitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,17 @@ namespace DirectX
static void __cdecl CreateTeapot(std::vector<VertexType>& vertices, std::vector<uint16_t>& 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<void __cdecl()> 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<void __cdecl()> 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<void __cdecl()> setCustomState = nullptr) const;
void __cdecl Draw(_In_ IEffect* effect,
_In_ ID3D11InputLayout* inputLayout,
bool alpha = false, bool wireframe = false,
_In_opt_ std::function<void __cdecl()> setCustomState = nullptr) const;

// Create input layout for drawing with a custom effect.
void __cdecl CreateInputLayout(_In_ IEffect* effect, _Outptr_ ID3D11InputLayout** inputLayout) const;
Expand Down
13 changes: 9 additions & 4 deletions Inc/PostProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ namespace DirectX
IPostProcess(IPostProcess&&) = delete;
IPostProcess& operator=(IPostProcess&&) = delete;

virtual void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function<void __cdecl()> setCustomState = nullptr) = 0;
virtual void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext,
_In_opt_ std::function<void __cdecl()> setCustomState = nullptr) = 0;

protected:
IPostProcess() = default;
Expand Down Expand Up @@ -70,7 +71,9 @@ namespace DirectX
~BasicPostProcess() override;

// IPostProcess methods.
void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function<void __cdecl()> setCustomState = nullptr) override;
void __cdecl Process(
_In_ ID3D11DeviceContext* deviceContext,
_In_opt_ std::function<void __cdecl()> setCustomState = nullptr) override;

// Shader control
void __cdecl SetEffect(Effect fx);
Expand Down Expand Up @@ -117,7 +120,8 @@ namespace DirectX
~DualPostProcess() override;

// IPostProcess methods.
void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function<void __cdecl()> setCustomState = nullptr) override;
void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext,
_In_opt_ std::function<void __cdecl()> setCustomState = nullptr) override;

// Shader control
void __cdecl SetEffect(Effect fx);
Expand Down Expand Up @@ -174,7 +178,8 @@ namespace DirectX
~ToneMapPostProcess() override;

// IPostProcess methods.
void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function<void __cdecl()> setCustomState = nullptr) override;
void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext,
_In_opt_ std::function<void __cdecl()> setCustomState = nullptr) override;

// Shader control
void __cdecl SetOperator(Operator op);
Expand Down
2 changes: 1 addition & 1 deletion Inc/ScreenGrab.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ namespace DirectX
_In_z_ const wchar_t* fileName,
_In_opt_ const GUID* targetFormat = nullptr,
_In_opt_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr,
_In_ bool forceSRGB = false) noexcept;
_In_ bool forceSRGB = false);
}
9 changes: 7 additions & 2 deletions Inc/SpriteBatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<void __cdecl()> 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<void __cdecl()> setCustomShaders = nullptr,
FXMMATRIX transformMatrix = MatrixIdentity);
void __cdecl End();

// Draw overloads specifying position, origin and scale as XMFLOAT2.
Expand Down
8 changes: 6 additions & 2 deletions Src/BasicPostProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void __cdecl()>& setCustomState)
void BasicPostProcess::Impl::Process(
_In_ ID3D11DeviceContext* deviceContext,
std::function<void __cdecl()>& setCustomState)
{
// Set the texture.
ID3D11ShaderResourceView* textures[1] = { texture.Get() };
Expand Down Expand Up @@ -496,7 +498,9 @@ BasicPostProcess::~BasicPostProcess()


// IPostProcess methods.
void BasicPostProcess::Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function<void __cdecl()> setCustomState)
void BasicPostProcess::Process(
_In_ ID3D11DeviceContext* deviceContext,
_In_opt_ std::function<void __cdecl()> setCustomState)
{
pImpl->Process(deviceContext, setCustomState);
}
Expand Down
8 changes: 6 additions & 2 deletions Src/DualPostProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void __cdecl()>& setCustomState)
void DualPostProcess::Impl::Process(
_In_ ID3D11DeviceContext* deviceContext,
std::function<void __cdecl()>& setCustomState)
{
// Set the texture.
ID3D11ShaderResourceView* textures[2] = { texture.Get(), texture2.Get() };
Expand Down Expand Up @@ -294,7 +296,9 @@ DualPostProcess::~DualPostProcess()


// IPostProcess methods.
void DualPostProcess::Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function<void __cdecl()> setCustomState)
void DualPostProcess::Process(
_In_ ID3D11DeviceContext* deviceContext,
_In_opt_ std::function<void __cdecl()> setCustomState)
{
pImpl->Process(deviceContext, setCustomState);
}
Expand Down
13 changes: 10 additions & 3 deletions Src/GeometricPrimitive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void()>& setCustomState) const;

void Draw(_In_ IEffect* effect, _In_ ID3D11InputLayout* inputLayout, bool alpha, bool wireframe, std::function<void()>& setCustomState) const;
void XM_CALLCONV Draw(FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
FXMVECTOR color,
_In_opt_ ID3D11ShaderResourceView* texture,
bool wireframe,
std::function<void()>& setCustomState) const;

void Draw(_In_ IEffect* effect,
_In_ ID3D11InputLayout* inputLayout,
bool alpha, bool wireframe,
std::function<void()>& setCustomState) const;

void CreateInputLayout(_In_ IEffect* effect, _Outptr_ ID3D11InputLayout** inputLayout) const;

Expand Down
2 changes: 1 addition & 1 deletion Src/ScreenGrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ HRESULT DirectX::SaveWICTextureToFile(
const wchar_t* fileName,
const GUID* targetFormat,
std::function<void(IPropertyBag2*)> setCustomProps,
bool forceSRGB) noexcept
bool forceSRGB)
{
if (!fileName)
return E_INVALIDARG;
Expand Down
8 changes: 6 additions & 2 deletions Src/ToneMapPostProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void __cdecl()>& setCustomState)
void ToneMapPostProcess::Impl::Process(
_In_ ID3D11DeviceContext* deviceContext,
std::function<void __cdecl()>& setCustomState)
{
// Set the texture.
ID3D11ShaderResourceView* textures[1] = { hdrTexture.Get() };
Expand Down Expand Up @@ -377,7 +379,9 @@ ToneMapPostProcess::~ToneMapPostProcess()


// IPostProcess methods.
void ToneMapPostProcess::Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function<void __cdecl()> setCustomState)
void ToneMapPostProcess::Process(
_In_ ID3D11DeviceContext* deviceContext,
_In_opt_ std::function<void __cdecl()> setCustomState)
{
pImpl->Process(deviceContext, setCustomState);
}
Expand Down

0 comments on commit acb8938

Please sign in to comment.