From 8aba96f6fbb753616b0fb0a360c1a17f81a64ece Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Mon, 11 Jun 2018 15:42:45 -0700 Subject: [PATCH] Code cleanup for improved C++ conformance --- Audio/AudioEngine.cpp | 42 ++++++++++++++-------------- Audio/DynamicSoundEffectInstance.cpp | 4 +-- Audio/SoundCommon.cpp | 4 +-- Audio/SoundCommon.h | 12 ++++---- Audio/SoundEffect.cpp | 8 +++--- Audio/SoundEffectInstance.cpp | 14 +++++----- Audio/WaveBank.cpp | 8 +++--- Audio/WaveBankReader.cpp | 11 ++++---- Inc/DescriptorHeap.h | 8 +++--- Inc/DirectXHelpers.h | 4 +-- Inc/Effects.h | 20 ++++++------- Inc/Model.h | 6 ++-- Inc/PostProcess.h | 6 ++-- Inc/ScreenGrab.h | 2 +- Src/AlphaTestEffect.cpp | 2 +- Src/BasicEffect.cpp | 2 +- Src/BasicPostProcess.cpp | 2 +- Src/DDSTextureLoader.cpp | 8 +++--- Src/DebugEffect.cpp | 4 +-- Src/DescriptorHeap.cpp | 2 +- Src/DualPostProcess.cpp | 2 +- Src/DualTextureEffect.cpp | 2 +- Src/EnvironmentMapEffect.cpp | 2 +- Src/GraphicsMemory.cpp | 5 ---- Src/LinearAllocator.cpp | 4 +-- Src/LoaderHelpers.h | 4 +-- Src/Model.cpp | 4 +-- Src/ModelLoadSDKMESH.cpp | 2 +- Src/Mouse.cpp | 12 ++++---- Src/NormalMapEffect.cpp | 2 +- Src/PBREffect.cpp | 8 +++--- Src/ResourceUploadBatch.cpp | 4 +-- Src/ScreenGrab.cpp | 2 +- Src/SimpleMath.cpp | 24 ++++++++-------- Src/SkinnedEffect.cpp | 2 +- Src/ToneMapPostProcess.cpp | 2 +- Src/VertexTypes.cpp | 2 +- Src/WICTextureLoader.cpp | 4 +-- Src/pch.h | 1 + 39 files changed, 126 insertions(+), 131 deletions(-) diff --git a/Audio/AudioEngine.cpp b/Audio/AudioEngine.cpp index 128c3d0..b26039e 100644 --- a/Audio/AudioEngine.cpp +++ b/Audio/AudioEngine.cpp @@ -371,8 +371,8 @@ HRESULT AudioEngine::Impl::Reset(const WAVEFORMATEX* wfx, const wchar_t* deviceI } assert(!xaudio2); - assert(!mMasterVoice); - assert(!mReverbVoice); + assert(mMasterVoice == nullptr); + assert(mReverbVoice == nullptr); masterChannelMask = masterChannels = masterRate = 0; @@ -701,7 +701,7 @@ HRESULT AudioEngine::Impl::Reset(const WAVEFORMATEX* wfx, const wchar_t* deviceI // for (auto it = mNotifyObjects.begin(); it != mNotifyObjects.end(); ++it) { - assert(*it != 0); + assert(*it != nullptr); (*it)->OnReset(); } @@ -713,20 +713,20 @@ void AudioEngine::Impl::SetSilentMode() { for (auto it = mNotifyObjects.begin(); it != mNotifyObjects.end(); ++it) { - assert(*it != 0); + assert(*it != nullptr); (*it)->OnCriticalError(); } for (auto it = mOneShots.begin(); it != mOneShots.end(); ++it) { - assert(it->second != 0); + assert(it->second != nullptr); it->second->DestroyVoice(); } mOneShots.clear(); for (auto it = mVoicePool.begin(); it != mVoicePool.end(); ++it) { - assert(it->second != 0); + assert(it->second != nullptr); it->second->DestroyVoice(); } mVoicePool.clear(); @@ -746,7 +746,7 @@ void AudioEngine::Impl::Shutdown() { for (auto it = mNotifyObjects.begin(); it != mNotifyObjects.end(); ++it) { - assert(*it != 0); + assert(*it != nullptr); (*it)->OnDestroyEngine(); } @@ -758,14 +758,14 @@ void AudioEngine::Impl::Shutdown() for (auto it = mOneShots.begin(); it != mOneShots.end(); ++it) { - assert(it->second != 0); + assert(it->second != nullptr); it->second->DestroyVoice(); } mOneShots.clear(); for (auto it = mVoicePool.begin(); it != mVoicePool.end(); ++it) { - assert(it->second != 0); + assert(it->second != nullptr); it->second->DestroyVoice(); } mVoicePool.clear(); @@ -811,7 +811,7 @@ bool AudioEngine::Impl::Update() // Scan for completed one-shot voices for (auto it = mOneShots.begin(); it != mOneShots.end(); ) { - assert(it->second != 0); + assert(it->second != nullptr); XAUDIO2_VOICE_STATE xstate; #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) @@ -856,7 +856,7 @@ bool AudioEngine::Impl::Update() // for (auto it = mNotifyUpdates.begin(); it != mNotifyUpdates.end(); ++it) { - assert(*it != 0); + assert(*it != nullptr); (*it)->OnUpdate(); } @@ -917,7 +917,7 @@ AudioStatistics AudioEngine::Impl::GetStatistics() const for (auto it = mNotifyObjects.begin(); it != mNotifyObjects.end(); ++it) { - assert(*it != 0); + assert(*it != nullptr); (*it)->GatherStatistics(stats); } @@ -931,13 +931,13 @@ void AudioEngine::Impl::TrimVoicePool() { for (auto it = mNotifyObjects.begin(); it != mNotifyObjects.end(); ++it) { - assert(*it != 0); + assert(*it != nullptr); (*it)->OnTrim(); } for (auto it = mVoicePool.begin(); it != mVoicePool.end(); ++it) { - assert(it->second != 0); + assert(it->second != nullptr); it->second->DestroyVoice(); } mVoicePool.clear(); @@ -998,7 +998,7 @@ void AudioEngine::Impl::AllocateVoice(const WAVEFORMATEX* wfx, SOUND_EFFECT_INST if (it != mVoicePool.end()) { // Found a matching (stopped) voice to reuse - assert(it->second != 0); + assert(it->second != nullptr); *voice = it->second; mVoicePool.erase(it); @@ -1072,7 +1072,7 @@ void AudioEngine::Impl::AllocateVoice(const WAVEFORMATEX* wfx, SOUND_EFFECT_INST } } - assert(*voice != 0); + assert(*voice != nullptr); HRESULT hr = (*voice)->SetSourceSampleRate(wfx->nSamplesPerSec); if (FAILED(hr)) { @@ -1141,7 +1141,7 @@ void AudioEngine::Impl::AllocateVoice(const WAVEFORMATEX* wfx, SOUND_EFFECT_INST if (oneshot) { - assert(*voice != 0); + assert(*voice != nullptr); mOneShots.emplace_back(std::make_pair(voiceKey, *voice)); } } @@ -1180,7 +1180,7 @@ void AudioEngine::Impl::DestroyVoice(_In_ IXAudio2SourceVoice* voice) void AudioEngine::Impl::RegisterNotify(_In_ IVoiceNotify* notify, bool usesUpdate) { - assert(notify != 0); + assert(notify != nullptr); mNotifyObjects.insert(notify); if (usesUpdate) @@ -1192,7 +1192,7 @@ void AudioEngine::Impl::RegisterNotify(_In_ IVoiceNotify* notify, bool usesUpdat void AudioEngine::Impl::UnregisterNotify(_In_ IVoiceNotify* notify, bool usesOneShots, bool usesUpdate) { - assert(notify != 0); + assert(notify != nullptr); mNotifyObjects.erase(notify); // Check for any pending one-shots for this notification object @@ -1202,7 +1202,7 @@ void AudioEngine::Impl::UnregisterNotify(_In_ IVoiceNotify* notify, bool usesOne for (auto it = mOneShots.begin(); it != mOneShots.end(); ++it) { - assert(it->second != 0); + assert(it->second != nullptr); XAUDIO2_VOICE_STATE state; #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) @@ -1452,7 +1452,7 @@ int AudioEngine::GetOutputChannels() const bool AudioEngine::IsAudioDevicePresent() const { - return (pImpl->xaudio2.Get() != 0) && !pImpl->mCriticalError; + return pImpl->xaudio2 && !pImpl->mCriticalError; } diff --git a/Audio/DynamicSoundEffectInstance.cpp b/Audio/DynamicSoundEffectInstance.cpp index ba715cc..e16b126 100644 --- a/Audio/DynamicSoundEffectInstance.cpp +++ b/Audio/DynamicSoundEffectInstance.cpp @@ -61,7 +61,7 @@ public: CreateIntegerPCM(&mWaveFormat, sampleRate, channels, sampleBits); - assert(engine != 0); + assert(engine != nullptr); engine->RegisterNotify(this, true); mBase.Initialize(engine, &mWaveFormat, flags); @@ -69,7 +69,7 @@ public: mBufferNeeded = bufferNeeded; } - virtual ~Impl() + virtual ~Impl() override { mBase.DestroyVoice(); diff --git a/Audio/SoundCommon.cpp b/Audio/SoundCommon.cpp index e89ca8e..da4fba9 100644 --- a/Audio/SoundCommon.cpp +++ b/Audio/SoundCommon.cpp @@ -727,7 +727,7 @@ void SoundEffectInstanceBase::Apply3D(const AudioListener& listener, const Audio assert(mDSPSettings.DstChannelCount <= 8); mDSPSettings.pMatrixCoefficients = matrix; - assert(engine != 0); + assert(engine != nullptr); if (rhcoords) { X3DAUDIO_EMITTER lhEmitter; @@ -756,7 +756,7 @@ void SoundEffectInstanceBase::Apply3D(const AudioListener& listener, const Audio (void)voice->SetFrequencyRatio(mFreqRatio * mDSPSettings.DopplerFactor); auto direct = mDirectVoice; - assert(direct != 0); + assert(direct != nullptr); (void)voice->SetOutputMatrix(direct, mDSPSettings.SrcChannelCount, mDSPSettings.DstChannelCount, matrix); if (reverb) diff --git a/Audio/SoundCommon.h b/Audio/SoundCommon.h index 63ce3f9..0095deb 100644 --- a/Audio/SoundCommon.h +++ b/Audio/SoundCommon.h @@ -86,12 +86,12 @@ namespace DirectX ~SoundEffectInstanceBase() { - assert(!voice); + assert(voice == nullptr); } void Initialize(_In_ AudioEngine* eng, _In_ const WAVEFORMATEX* wfx, SOUND_EFFECT_INSTANCE_FLAGS flags) { - assert(eng != 0); + assert(eng != nullptr); engine = eng; mDirectVoice = eng->GetMasterVoice(); mReverbVoice = eng->GetReverbVoice(); @@ -102,7 +102,7 @@ namespace DirectX mFlags = static_cast(static_cast(flags) & ~SoundEffectInstance_UseRedirectLFE); memset(&mDSPSettings, 0, sizeof(X3DAUDIO_DSP_SETTINGS)); - assert(wfx != 0); + assert(wfx != nullptr); mDSPSettings.SrcChannelCount = wfx->nChannels; mDSPSettings.DstChannelCount = eng->GetOutputChannels(); } @@ -112,7 +112,7 @@ namespace DirectX if (voice) return; - assert(engine != 0); + assert(engine != nullptr); engine->AllocateVoice(wfx, mFlags, false, &voice); } @@ -120,7 +120,7 @@ namespace DirectX { if (voice) { - assert(engine != 0); + assert(engine != nullptr); engine->DestroyVoice(voice); voice = nullptr; } @@ -299,7 +299,7 @@ namespace DirectX void OnReset() { - assert(engine != 0); + assert(engine != nullptr); mDirectVoice = engine->GetMasterVoice(); mReverbVoice = engine->GetReverbVoice(); diff --git a/Audio/SoundEffect.cpp b/Audio/SoundEffect.cpp index 55892a4..df52a43 100644 --- a/Audio/SoundEffect.cpp +++ b/Audio/SoundEffect.cpp @@ -45,11 +45,11 @@ public: , mXMAMemory(nullptr) #endif { - assert(mEngine != 0); + assert(mEngine != nullptr); mEngine->RegisterNotify(this, false); } - virtual ~Impl() + virtual ~Impl() override { if (!mInstances.empty()) { @@ -57,7 +57,7 @@ public: for (auto it = mInstances.begin(); it != mInstances.end(); ++it) { - assert(*it != 0); + assert(*it != nullptr); (*it)->OnDestroyParent(); } @@ -474,7 +474,7 @@ void SoundEffect::Play(float volume, float pitch, float pan) std::unique_ptr SoundEffect::CreateInstance(SOUND_EFFECT_INSTANCE_FLAGS flags) { auto effect = new SoundEffectInstance(pImpl->mEngine, this, flags); - assert(effect != 0); + assert(effect != nullptr); pImpl->mInstances.emplace_back(effect); return std::unique_ptr(effect); } diff --git a/Audio/SoundEffectInstance.cpp b/Audio/SoundEffectInstance.cpp index 358bbc8..2997104 100644 --- a/Audio/SoundEffectInstance.cpp +++ b/Audio/SoundEffectInstance.cpp @@ -29,10 +29,10 @@ public: mIndex(0), mLooped(false) { - assert(engine != 0); + assert(engine != nullptr); engine->RegisterNotify(this, false); - assert(mEffect != 0); + assert(mEffect != nullptr); mBase.Initialize(engine, effect->GetFormat(), flags); } @@ -43,16 +43,16 @@ public: mIndex(index), mLooped(false) { - assert(engine != 0); + assert(engine != nullptr); engine->RegisterNotify(this, false); char buff[64] = {}; auto wfx = reinterpret_cast(buff); - assert(mWaveBank != 0); + assert(mWaveBank != nullptr); mBase.Initialize(engine, mWaveBank->GetFormat(index, wfx, sizeof(buff)), flags); } - virtual ~Impl() + virtual ~Impl() override { mBase.DestroyVoice(); @@ -123,7 +123,7 @@ void SoundEffectInstance::Impl::Play(bool loop) } else { - assert(mEffect != 0); + assert(mEffect != nullptr); mBase.AllocateVoice(mEffect->GetFormat()); } } @@ -144,7 +144,7 @@ void SoundEffectInstance::Impl::Play(bool loop) } else { - assert(mEffect != 0); + assert(mEffect != nullptr); iswma = mEffect->FillSubmitBuffer(buffer, wmaBuffer); } diff --git a/Audio/WaveBank.cpp b/Audio/WaveBank.cpp index f17f307..f4eb879 100644 --- a/Audio/WaveBank.cpp +++ b/Audio/WaveBank.cpp @@ -33,11 +33,11 @@ public: mPrepared(false), mStreaming(false) { - assert(mEngine != 0); + assert(mEngine != nullptr); mEngine->RegisterNotify(this, false); } - virtual ~Impl() + virtual ~Impl() override { if (!mInstances.empty()) { @@ -45,7 +45,7 @@ public: for (auto it = mInstances.begin(); it != mInstances.end(); ++it) { - assert(*it != 0); + assert(*it != nullptr); (*it)->OnDestroyParent(); } @@ -347,7 +347,7 @@ std::unique_ptr WaveBank::CreateInstance(int index, SOUND_E } auto effect = new SoundEffectInstance(pImpl->mEngine, this, index, flags); - assert(effect != 0); + assert(effect != nullptr); pImpl->mInstances.emplace_back(effect); return std::unique_ptr(effect); } diff --git a/Audio/WaveBankReader.cpp b/Audio/WaveBankReader.cpp index f99a083..d8c447c 100644 --- a/Audio/WaveBankReader.cpp +++ b/Audio/WaveBankReader.cpp @@ -201,7 +201,6 @@ namespace uint32_t samplesPerAdpcmBlock = AdpcmSamplesPerBlock(); return blockAlign * nSamplesPerSec / samplesPerAdpcmBlock; } - break; case TAG_WMA: { @@ -510,7 +509,7 @@ HRESULT WaveBankReader::Impl::Open(const wchar_t* szFileName) } #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) - CREATEFILE2_EXTENDED_PARAMETERS params = { sizeof(CREATEFILE2_EXTENDED_PARAMETERS), 0 }; + CREATEFILE2_EXTENDED_PARAMETERS params = { sizeof(CREATEFILE2_EXTENDED_PARAMETERS), 0, 0, 0, {}, nullptr }; params.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; params.dwFileFlags = FILE_FLAG_OVERLAPPED | FILE_FLAG_SEQUENTIAL_SCAN; ScopedHandle hFile(safe_handle(CreateFile2(szFileName, @@ -814,7 +813,7 @@ HRESULT WaveBankReader::Impl::Open(const wchar_t* szFileName) hFile.reset(); #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) - CREATEFILE2_EXTENDED_PARAMETERS params2 = { sizeof(CREATEFILE2_EXTENDED_PARAMETERS), 0 }; + CREATEFILE2_EXTENDED_PARAMETERS params2 = { sizeof(CREATEFILE2_EXTENDED_PARAMETERS), 0, 0, 0, {}, nullptr }; params2.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; params2.dwFileFlags = FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING; m_async = CreateFile2(szFileName, @@ -912,7 +911,7 @@ void WaveBankReader::Impl::Close() { if (m_async != INVALID_HANDLE_VALUE) { - if (m_request.hEvent != 0) + if (m_request.hEvent) { DWORD bytes; #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) @@ -1226,7 +1225,7 @@ bool WaveBankReader::Impl::UpdatePrepared() if (m_async == INVALID_HANDLE_VALUE) return false; - if (m_request.hEvent != 0) + if (m_request.hEvent) { #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) @@ -1294,7 +1293,7 @@ void WaveBankReader::WaitOnPrepare() if (pImpl->m_prepared) return; - if (pImpl->m_request.hEvent != 0) + if (pImpl->m_request.hEvent) { WaitForSingleObjectEx(pImpl->m_request.hEvent, INFINITE, FALSE); diff --git a/Inc/DescriptorHeap.h b/Inc/DescriptorHeap.h index 9f56983..8c47ed0 100644 --- a/Inc/DescriptorHeap.h +++ b/Inc/DescriptorHeap.h @@ -71,19 +71,19 @@ namespace DirectX D3D12_GPU_DESCRIPTOR_HANDLE GetFirstGpuHandle() const { assert(m_desc.Flags & D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE); - assert(m_pHeap != 0); + assert(m_pHeap != nullptr); return m_hGPU; } D3D12_CPU_DESCRIPTOR_HANDLE GetFirstCpuHandle() const { - assert(m_pHeap != 0); + assert(m_pHeap != nullptr); return m_hCPU; } D3D12_GPU_DESCRIPTOR_HANDLE GetGpuHandle(_In_ size_t index) const { - assert(m_pHeap != 0); + assert(m_pHeap != nullptr); if (index >= m_desc.NumDescriptors) { throw std::out_of_range("D3DX12_GPU_DESCRIPTOR_HANDLE"); @@ -94,7 +94,7 @@ namespace DirectX D3D12_CPU_DESCRIPTOR_HANDLE GetCpuHandle(_In_ size_t index) const { - assert(m_pHeap != 0); + assert(m_pHeap != nullptr); if (index >= m_desc.NumDescriptors) { throw std::out_of_range("D3DX12_CPU_DESCRIPTOR_HANDLE"); diff --git a/Inc/DirectXHelpers.h b/Inc/DirectXHelpers.h index bd96087..a3236a3 100644 --- a/Inc/DirectXHelpers.h +++ b/Inc/DirectXHelpers.h @@ -160,8 +160,8 @@ namespace DirectX D3D12_RESOURCE_STATES stateBefore, D3D12_RESOURCE_STATES stateAfter) { - assert(commandList != 0); - assert(resource != 0); + assert(commandList != nullptr); + assert(resource != nullptr); if (stateBefore == stateAfter) return; diff --git a/Inc/Effects.h b/Inc/Effects.h index af2c7ec..65c47a3 100644 --- a/Inc/Effects.h +++ b/Inc/Effects.h @@ -167,7 +167,7 @@ namespace DirectX BasicEffect(BasicEffect const&) = delete; BasicEffect& operator= (BasicEffect const&) = delete; - virtual ~BasicEffect(); + virtual ~BasicEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D12GraphicsCommandList* commandList) override; @@ -225,7 +225,7 @@ namespace DirectX AlphaTestEffect(AlphaTestEffect const&) = delete; AlphaTestEffect& operator= (AlphaTestEffect const&) = delete; - virtual ~AlphaTestEffect(); + virtual ~AlphaTestEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D12GraphicsCommandList* commandList) override; @@ -271,7 +271,7 @@ namespace DirectX DualTextureEffect(DualTextureEffect const&) = delete; DualTextureEffect& operator= (DualTextureEffect const&) = delete; - ~DualTextureEffect(); + virtual ~DualTextureEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D12GraphicsCommandList* commandList) override; @@ -315,7 +315,7 @@ namespace DirectX EnvironmentMapEffect(EnvironmentMapEffect const&) = delete; EnvironmentMapEffect& operator= (EnvironmentMapEffect const&) = delete; - virtual ~EnvironmentMapEffect(); + virtual ~EnvironmentMapEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D12GraphicsCommandList* commandList) override; @@ -377,7 +377,7 @@ namespace DirectX SkinnedEffect(SkinnedEffect const&) = delete; SkinnedEffect& operator= (SkinnedEffect const&) = delete; - virtual ~SkinnedEffect(); + virtual ~SkinnedEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D12GraphicsCommandList* commandList) override; @@ -439,7 +439,7 @@ namespace DirectX NormalMapEffect(NormalMapEffect const&) = delete; NormalMapEffect& operator= (NormalMapEffect const&) = delete; - virtual ~NormalMapEffect(); + virtual ~NormalMapEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D12GraphicsCommandList* commandList) override; @@ -499,7 +499,7 @@ namespace DirectX PBREffect(PBREffect const&) = delete; PBREffect& operator= (PBREffect const&) = delete; - virtual ~PBREffect(); + virtual ~PBREffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D12GraphicsCommandList* commandList) override; @@ -573,7 +573,7 @@ namespace DirectX DebugEffect(DebugEffect const&) = delete; DebugEffect& operator= (DebugEffect const&) = delete; - virtual ~DebugEffect(); + virtual ~DebugEffect() override; // IEffect methods. void __cdecl Apply(_In_ ID3D12GraphicsCommandList* commandList) override; @@ -637,7 +637,7 @@ namespace DirectX EffectTextureFactory(EffectTextureFactory const&) = delete; EffectTextureFactory& operator= (EffectTextureFactory const&) = delete; - virtual ~EffectTextureFactory(); + virtual ~EffectTextureFactory() override; virtual void __cdecl CreateTexture(_In_z_ const wchar_t* name, int descriptorIndex) override; @@ -753,7 +753,7 @@ namespace DirectX EffectFactory(EffectFactory const&) = delete; EffectFactory& operator= (EffectFactory const&) = delete; - virtual ~EffectFactory(); + virtual ~EffectFactory() override; // IEffectFactory methods. virtual std::shared_ptr __cdecl CreateEffect( diff --git a/Inc/Model.h b/Inc/Model.h index 1fcf1ea..9d9f076 100644 --- a/Inc/Model.h +++ b/Inc/Model.h @@ -81,7 +81,7 @@ namespace DirectX // Draw the mesh with a range of effects that mesh parts will index into. // Effects can be any IEffect pointer type (including smart pointer). Value or reference types will not compile. // The iterator passed to this method should have random access capabilities for best performance. - template + template static void DrawMeshParts( _In_ ID3D12GraphicsCommandList* commandList, _In_ const ModelMeshPart::Collection& meshParts, @@ -139,12 +139,12 @@ namespace DirectX // Draw the mesh with a range of effects that mesh parts will index into. // TEffectPtr can be any IEffect pointer type (including smart pointer). Value or reference types will not compile. - template + template void DrawOpaque(_In_ ID3D12GraphicsCommandList* commandList, TEffectIterator effects) const { ModelMeshPart::DrawMeshParts(commandList, opaqueMeshParts, effects); } - template + template void DrawAlpha(_In_ ID3D12GraphicsCommandList* commandList, TEffectIterator effects) const { ModelMeshPart::DrawMeshParts(commandList, alphaMeshParts, effects); diff --git a/Inc/PostProcess.h b/Inc/PostProcess.h index 0ed103a..d83722c 100644 --- a/Inc/PostProcess.h +++ b/Inc/PostProcess.h @@ -68,7 +68,7 @@ namespace DirectX BasicPostProcess(BasicPostProcess const&) = delete; BasicPostProcess& operator= (BasicPostProcess const&) = delete; - virtual ~BasicPostProcess(); + virtual ~BasicPostProcess() override; // IPostProcess methods. void __cdecl Process(_In_ ID3D12GraphicsCommandList* commandList) override; @@ -112,7 +112,7 @@ namespace DirectX DualPostProcess(DualPostProcess const&) = delete; DualPostProcess& operator= (DualPostProcess const&) = delete; - virtual ~DualPostProcess(); + virtual ~DualPostProcess() override; // IPostProcess methods. void __cdecl Process(_In_ ID3D12GraphicsCommandList* commandList) override; @@ -170,7 +170,7 @@ namespace DirectX ToneMapPostProcess(ToneMapPostProcess const&) = delete; ToneMapPostProcess& operator= (ToneMapPostProcess const&) = delete; - virtual ~ToneMapPostProcess(); + virtual ~ToneMapPostProcess() override; // IPostProcess methods. void __cdecl Process(_In_ ID3D12GraphicsCommandList* commandList) override; diff --git a/Inc/ScreenGrab.h b/Inc/ScreenGrab.h index 254ebd7..5d2651d 100644 --- a/Inc/ScreenGrab.h +++ b/Inc/ScreenGrab.h @@ -44,4 +44,4 @@ namespace DirectX D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET, _In_opt_ const GUID* targetFormat = nullptr, _In_opt_ std::function setCustomProps = nullptr); -} \ No newline at end of file +} diff --git a/Src/AlphaTestEffect.cpp b/Src/AlphaTestEffect.cpp index e04866f..68b6d36 100644 --- a/Src/AlphaTestEffect.cpp +++ b/Src/AlphaTestEffect.cpp @@ -183,7 +183,7 @@ AlphaTestEffect::Impl::Impl(_In_ ID3D12Device* device, mRootSignature = GetRootSignature(0, rsigDesc); } - assert(mRootSignature != 0); + assert(mRootSignature != nullptr); fog.enabled = (effectFlags & EffectFlags::Fog) != 0; diff --git a/Src/BasicEffect.cpp b/Src/BasicEffect.cpp index cb6d802..136841b 100644 --- a/Src/BasicEffect.cpp +++ b/Src/BasicEffect.cpp @@ -379,7 +379,7 @@ BasicEffect::Impl::Impl(_In_ ID3D12Device* device, int effectFlags, const Effect } } - assert(mRootSignature != 0); + assert(mRootSignature != nullptr); // Create pipeline state. int sp = GetPipelineStatePermutation( diff --git a/Src/BasicPostProcess.cpp b/Src/BasicPostProcess.cpp index bafaa3d..f2977aa 100644 --- a/Src/BasicPostProcess.cpp +++ b/Src/BasicPostProcess.cpp @@ -273,7 +273,7 @@ BasicPostProcess::Impl::Impl(_In_ ID3D12Device* device, const RenderTargetState& } } - assert(mRootSignature != 0); + assert(mRootSignature != nullptr); // Create pipeline state. EffectPipelineStateDescription psd(nullptr, diff --git a/Src/DDSTextureLoader.cpp b/Src/DDSTextureLoader.cpp index 53834ea..564a17f 100644 --- a/Src/DDSTextureLoader.cpp +++ b/Src/DDSTextureLoader.cpp @@ -595,7 +595,7 @@ HRESULT DirectX::LoadDDSTextureFromMemoryEx( return E_FAIL; } - uint32_t dwMagicNumber = *(const uint32_t*)(ddsData); + const uint32_t dwMagicNumber = *reinterpret_cast(ddsData); if (dwMagicNumber != DDS_MAGIC) { return E_FAIL; @@ -634,7 +634,7 @@ HRESULT DirectX::LoadDDSTextureFromMemoryEx( texture, subresources, isCubeMap); if (SUCCEEDED(hr)) { - if (texture != 0 && *texture != 0) + if (texture && *texture) { SetDebugObjectName(*texture, L"DDSTextureLoader"); } @@ -732,7 +732,7 @@ HRESULT DirectX::LoadDDSTextureFromFileEx( (*texture)->SetName(fileName); } #else - if (texture != 0) + if (texture) { CHAR strFileA[MAX_PATH]; int result = WideCharToMultiByte(CP_ACP, @@ -756,7 +756,7 @@ HRESULT DirectX::LoadDDSTextureFromFileEx( pstrName++; } - if (texture != 0 && *texture != 0) + if (texture && *texture) { (*texture)->SetName(pstrName); } diff --git a/Src/DebugEffect.cpp b/Src/DebugEffect.cpp index 43710de..f6f2af5 100644 --- a/Src/DebugEffect.cpp +++ b/Src/DebugEffect.cpp @@ -171,7 +171,7 @@ DebugEffect::Impl::Impl(_In_ ID3D12Device* device, int effectFlags, const Effect static_assert(_countof(EffectBase::PixelShaderBytecode) == DebugEffectTraits::PixelShaderCount, "array/max mismatch"); static_assert(_countof(EffectBase::PixelShaderIndices) == DebugEffectTraits::ShaderPermutationCount, "array/max mismatch"); - static const XMVECTORF32 s_lower = { 0.f, 0.f, 0.f, 1.f }; + static const XMVECTORF32 s_lower = { { { 0.f, 0.f, 0.f, 1.f } } }; constants.ambientDownAndAlpha = s_lower; constants.ambientRange = g_XMOne; @@ -196,7 +196,7 @@ DebugEffect::Impl::Impl(_In_ ID3D12Device* device, int effectFlags, const Effect mRootSignature = GetRootSignature(0, rsigDesc); } - assert(mRootSignature != 0); + assert(mRootSignature != nullptr); // Create pipeline state. int sp = GetPipelineStatePermutation( diff --git a/Src/DescriptorHeap.cpp b/Src/DescriptorHeap.cpp index 698979c..15ee580 100644 --- a/Src/DescriptorHeap.cpp +++ b/Src/DescriptorHeap.cpp @@ -142,7 +142,7 @@ void DescriptorHeap::Create( ID3D12Device* pDevice, const D3D12_DESCRIPTOR_HEAP_DESC* pDesc) { - assert(pDesc != 0); + assert(pDesc != nullptr); m_desc = *pDesc; m_increment = pDevice->GetDescriptorHandleIncrementSize(pDesc->Type); diff --git a/Src/DualPostProcess.cpp b/Src/DualPostProcess.cpp index a53f298..7cb10e9 100644 --- a/Src/DualPostProcess.cpp +++ b/Src/DualPostProcess.cpp @@ -210,7 +210,7 @@ DualPostProcess::Impl::Impl(_In_ ID3D12Device* device, const RenderTargetState& mRootSignature = mDeviceResources->GetRootSignature(rsigDesc); } - assert(mRootSignature != 0); + assert(mRootSignature != nullptr); // Create pipeline state. EffectPipelineStateDescription psd(nullptr, diff --git a/Src/DualTextureEffect.cpp b/Src/DualTextureEffect.cpp index 0aea737..e14b514 100644 --- a/Src/DualTextureEffect.cpp +++ b/Src/DualTextureEffect.cpp @@ -178,7 +178,7 @@ DualTextureEffect::Impl::Impl(_In_ ID3D12Device* device, int effectFlags, const mRootSignature = GetRootSignature(0, rsigDesc); } - assert(mRootSignature != 0); + assert(mRootSignature != nullptr); // Validate flags & state. fog.enabled = (effectFlags & EffectFlags::Fog) != 0; diff --git a/Src/EnvironmentMapEffect.cpp b/Src/EnvironmentMapEffect.cpp index 971af7a..2bdfeb7 100644 --- a/Src/EnvironmentMapEffect.cpp +++ b/Src/EnvironmentMapEffect.cpp @@ -273,7 +273,7 @@ EnvironmentMapEffect::Impl::Impl( mRootSignature = GetRootSignature(0, rsigDesc); } - assert(mRootSignature != 0); + assert(mRootSignature != nullptr); fog.enabled = (effectFlags & EffectFlags::Fog) != 0; diff --git a/Src/GraphicsMemory.cpp b/Src/GraphicsMemory.cpp index 5908cbc..74fc788 100644 --- a/Src/GraphicsMemory.cpp +++ b/Src/GraphicsMemory.cpp @@ -31,11 +31,6 @@ namespace static_assert((MinAllocSize & (MinAllocSize - 1)) == 0, "MinAllocSize size must be a power of 2"); static_assert(MinAllocSize >= (4 * 1024), "MinAllocSize size must be greater than 4K"); - inline constexpr bool WordSize64() - { - return sizeof(size_t) == 8; - } - inline size_t NextPow2(size_t x) { x--; diff --git a/Src/LinearAllocator.cpp b/Src/LinearAllocator.cpp index 47e08e4..44e0b0e 100644 --- a/Src/LinearAllocator.cpp +++ b/Src/LinearAllocator.cpp @@ -105,9 +105,9 @@ LinearAllocatorPage* LinearAllocator::FindPageForAlloc(_In_ size_t size, _In_ si { #ifdef _DEBUG if (size > m_increment) - throw std::out_of_range(__FUNCTION__ " size must be less or equal to the allocator's increment"); + throw std::out_of_range("Size must be less or equal to the allocator's increment"); if (alignment > m_increment) - throw std::out_of_range(__FUNCTION__ " alignment must be less or equal to the allocator's increment"); + throw std::out_of_range("Alignment must be less or equal to the allocator's increment"); if (size == 0) throw std::exception("Cannot honor zero size allocation request."); #endif diff --git a/Src/LoaderHelpers.h b/Src/LoaderHelpers.h index 09c50a3..db622c3 100644 --- a/Src/LoaderHelpers.h +++ b/Src/LoaderHelpers.h @@ -837,7 +837,7 @@ namespace DirectX } } - void clear() { m_handle = 0; } + void clear() { m_handle = nullptr; } private: HANDLE m_handle; @@ -860,7 +860,7 @@ namespace DirectX } } - void clear() { m_filename = 0; } + void clear() { m_filename = nullptr; } private: LPCWSTR m_filename; diff --git a/Src/Model.cpp b/Src/Model.cpp index ff9a425..e16b15b 100644 --- a/Src/Model.cpp +++ b/Src/Model.cpp @@ -73,7 +73,7 @@ void ModelMeshPart::DrawMeshParts(ID3D12GraphicsCommandList* commandList, const for (auto it = meshParts.cbegin(); it != meshParts.cend(); ++it) { auto part = (*it).get(); - assert(part != 0); + assert(part != nullptr); part->Draw(commandList); } @@ -89,7 +89,7 @@ void ModelMeshPart::DrawMeshParts( for (auto it = meshParts.cbegin(); it != meshParts.cend(); ++it) { auto part = (*it).get(); - assert(part != 0); + assert(part != nullptr); callback(commandList, *part); part->Draw(commandList); diff --git a/Src/ModelLoadSDKMESH.cpp b/Src/ModelLoadSDKMESH.cpp index 28face2..862f5cb 100644 --- a/Src/ModelLoadSDKMESH.cpp +++ b/Src/ModelLoadSDKMESH.cpp @@ -119,7 +119,7 @@ namespace else m.alphaValue = 1.f; - if (mh.Power) + if (mh.Power > 0) { m.specularPower = mh.Power; m.specularColor = XMFLOAT3(mh.Specular.x, mh.Specular.y, mh.Specular.z); diff --git a/Src/Mouse.cpp b/Src/Mouse.cpp index 9ced58d..3335b1c 100644 --- a/Src/Mouse.cpp +++ b/Src/Mouse.cpp @@ -1,4 +1,4 @@ -//-------------------------------------------------------------------------------------- +//-------------------------------------------------------------------------------------- // File: Mouse.cpp // // Copyright (c) Microsoft Corporation. All rights reserved. @@ -138,7 +138,7 @@ public: SetEvent((mode == MODE_ABSOLUTE) ? mAbsoluteMode.get() : mRelativeMode.get()); - assert(mWindow != 0); + assert(mWindow != nullptr); TRACKMOUSEEVENT tme; tme.cbSize = sizeof(tme); @@ -161,7 +161,7 @@ public: if (mMode == MODE_RELATIVE) return false; - CURSORINFO info = { sizeof(CURSORINFO) }; + CURSORINFO info = { sizeof(CURSORINFO), 0, nullptr, {} }; if (!GetCursorInfo(&info)) { throw std::exception("GetCursorInfo"); @@ -175,7 +175,7 @@ public: if (mMode == MODE_RELATIVE) return; - CURSORINFO info = { sizeof(CURSORINFO) }; + CURSORINFO info = { sizeof(CURSORINFO), 0, nullptr, {} }; if (!GetCursorInfo(&info)) { throw std::exception("GetCursorInfo"); @@ -193,7 +193,7 @@ public: if (mWindow == window) return; - assert(window != 0); + assert(window != nullptr); RAWINPUTDEVICE Rid; Rid.usUsagePage = 0x1 /* HID_USAGE_PAGE_GENERIC */; @@ -234,7 +234,7 @@ private: void ClipToWindow() { - assert(mWindow != 0); + assert(mWindow != nullptr); RECT rect; GetClientRect(mWindow, &rect); diff --git a/Src/NormalMapEffect.cpp b/Src/NormalMapEffect.cpp index 77d830e..9144c2b 100644 --- a/Src/NormalMapEffect.cpp +++ b/Src/NormalMapEffect.cpp @@ -252,7 +252,7 @@ NormalMapEffect::Impl::Impl(_In_ ID3D12Device* device, int effectFlags, const Ef } } - assert(mRootSignature != 0); + assert(mRootSignature != nullptr); fog.enabled = (effectFlags & EffectFlags::Fog) != 0; diff --git a/Src/PBREffect.cpp b/Src/PBREffect.cpp index 24638b7..9fd015a 100644 --- a/Src/PBREffect.cpp +++ b/Src/PBREffect.cpp @@ -192,7 +192,7 @@ PBREffect::Impl::Impl(_In_ ID3D12Device* device, static_assert(_countof(EffectBase::PixelShaderIndices) == PBREffectTraits::ShaderPermutationCount, "array/max mismatch"); // Lighting - static const XMVECTORF32 defaultLightDirection = { 0, -1, 0, 0 }; + static const XMVECTORF32 defaultLightDirection = { { { 0, -1, 0, 0 } } }; for (int i = 0; i < MaxDirectionalLights; i++) { lightColor[i] = g_XMOne; @@ -244,12 +244,12 @@ PBREffect::Impl::Impl(_In_ ID3D12Device* device, CD3DX12_DESCRIPTOR_RANGE(D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, 1, 1) }; - for (int i = 0; i < _countof(textureSRV); i++) + for (size_t i = 0; i < _countof(textureSRV); i++) { rootParameters[i].InitAsDescriptorTable(1, &textureSRV[i]); } - for (int i = 0; i < _countof(textureSampler); i++) + for (size_t i = 0; i < _countof(textureSampler); i++) { rootParameters[i + SurfaceSampler].InitAsDescriptorTable(1, &textureSampler[i]); } @@ -262,7 +262,7 @@ PBREffect::Impl::Impl(_In_ ID3D12Device* device, mRootSignature = GetRootSignature(0, rsigDesc); } - assert(mRootSignature != 0); + assert(mRootSignature != nullptr); if (effectFlags & EffectFlags::Fog) { diff --git a/Src/ResourceUploadBatch.cpp b/Src/ResourceUploadBatch.cpp index dc8b510..e8669c8 100644 --- a/Src/ResourceUploadBatch.cpp +++ b/Src/ResourceUploadBatch.cpp @@ -430,7 +430,7 @@ public: mList.Reset(); mCmdAlloc.Reset(); - return std::move(future); + return future; } private: @@ -819,6 +819,6 @@ void ResourceUploadBatch::Transition( std::future ResourceUploadBatch::End(_In_ ID3D12CommandQueue* commandQueue) { - return std::move(pImpl->End(commandQueue)); + return pImpl->End(commandQueue); } diff --git a/Src/ScreenGrab.cpp b/Src/ScreenGrab.cpp index bff0cf9..0cbc364 100644 --- a/Src/ScreenGrab.cpp +++ b/Src/ScreenGrab.cpp @@ -136,7 +136,7 @@ namespace DXGI_FORMAT fmt = EnsureNotTypeless(desc.Format); - D3D12_FEATURE_DATA_FORMAT_SUPPORT formatInfo = { fmt }; + D3D12_FEATURE_DATA_FORMAT_SUPPORT formatInfo = { fmt, D3D12_FORMAT_SUPPORT1_NONE, D3D12_FORMAT_SUPPORT2_NONE }; hr = device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &formatInfo, sizeof(formatInfo)); if (FAILED(hr)) return hr; diff --git a/Src/SimpleMath.cpp b/Src/SimpleMath.cpp index 3452c3f..b0d7c7e 100644 --- a/Src/SimpleMath.cpp +++ b/Src/SimpleMath.cpp @@ -63,22 +63,22 @@ namespace DirectX #if defined(__d3d11_h__) || defined(__d3d11_x_h__) static_assert(sizeof(DirectX::SimpleMath::Viewport) == sizeof(D3D11_VIEWPORT), "Size mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, x) == FIELD_OFFSET(D3D11_VIEWPORT, TopLeftX), "Layout mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, y) == FIELD_OFFSET(D3D11_VIEWPORT, TopLeftY), "Layout mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, width) == FIELD_OFFSET(D3D11_VIEWPORT, Width), "Layout mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, height) == FIELD_OFFSET(D3D11_VIEWPORT, Height), "Layout mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, minDepth) == FIELD_OFFSET(D3D11_VIEWPORT, MinDepth), "Layout mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, maxDepth) == FIELD_OFFSET(D3D11_VIEWPORT, MaxDepth), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, x) == offsetof(D3D11_VIEWPORT, TopLeftX), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, y) == offsetof(D3D11_VIEWPORT, TopLeftY), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, width) == offsetof(D3D11_VIEWPORT, Width), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, height) == offsetof(D3D11_VIEWPORT, Height), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, minDepth) == offsetof(D3D11_VIEWPORT, MinDepth), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, maxDepth) == offsetof(D3D11_VIEWPORT, MaxDepth), "Layout mismatch"); #endif #if defined(__d3d12_h__) || defined(__d3d12_x_h__) static_assert(sizeof(DirectX::SimpleMath::Viewport) == sizeof(D3D12_VIEWPORT), "Size mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, x) == FIELD_OFFSET(D3D12_VIEWPORT, TopLeftX), "Layout mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, y) == FIELD_OFFSET(D3D12_VIEWPORT, TopLeftY), "Layout mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, width) == FIELD_OFFSET(D3D12_VIEWPORT, Width), "Layout mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, height) == FIELD_OFFSET(D3D12_VIEWPORT, Height), "Layout mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, minDepth) == FIELD_OFFSET(D3D12_VIEWPORT, MinDepth), "Layout mismatch"); -static_assert(FIELD_OFFSET(DirectX::SimpleMath::Viewport, maxDepth) == FIELD_OFFSET(D3D12_VIEWPORT, MaxDepth), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, x) == offsetof(D3D12_VIEWPORT, TopLeftX), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, y) == offsetof(D3D12_VIEWPORT, TopLeftY), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, width) == offsetof(D3D12_VIEWPORT, Width), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, height) == offsetof(D3D12_VIEWPORT, Height), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, minDepth) == offsetof(D3D12_VIEWPORT, MinDepth), "Layout mismatch"); +static_assert(offsetof(DirectX::SimpleMath::Viewport, maxDepth) == offsetof(D3D12_VIEWPORT, MaxDepth), "Layout mismatch"); #endif RECT DirectX::SimpleMath::Viewport::ComputeDisplayArea(DXGI_SCALING scaling, UINT backBufferWidth, UINT backBufferHeight, int outputWidth, int outputHeight) diff --git a/Src/SkinnedEffect.cpp b/Src/SkinnedEffect.cpp index e6a3904..b335ced 100644 --- a/Src/SkinnedEffect.cpp +++ b/Src/SkinnedEffect.cpp @@ -274,7 +274,7 @@ SkinnedEffect::Impl::Impl(_In_ ID3D12Device* device, int effectFlags, const Effe mRootSignature = GetRootSignature(0, rsigDesc); } - assert(mRootSignature != 0); + assert(mRootSignature != nullptr); fog.enabled = (effectFlags & EffectFlags::Fog) != 0; diff --git a/Src/ToneMapPostProcess.cpp b/Src/ToneMapPostProcess.cpp index a3ac88b..e69321d 100644 --- a/Src/ToneMapPostProcess.cpp +++ b/Src/ToneMapPostProcess.cpp @@ -286,7 +286,7 @@ ToneMapPostProcess::Impl::Impl(_In_ ID3D12Device* device, const RenderTargetStat mRootSignature = mDeviceResources->GetRootSignature(rsigDesc); } - assert(mRootSignature != 0); + assert(mRootSignature != nullptr); // Determine shader permutation. #if defined(_XBOX_ONE) && defined(_TITLE) diff --git a/Src/VertexTypes.cpp b/Src/VertexTypes.cpp index bf0c3c4..dc7ca4b 100644 --- a/Src/VertexTypes.cpp +++ b/Src/VertexTypes.cpp @@ -159,4 +159,4 @@ const D3D12_INPUT_LAYOUT_DESC VertexPositionNormalColorTexture::InputLayout = //-------------------------------------------------------------------------------------- // VertexPositionNormalTangentColorTexture, VertexPositionNormalTangentColorTextureSkinning are not -// supported for DirectX 12 since they were only present for DGSL \ No newline at end of file +// supported for DirectX 12 since they were only present for DGSL diff --git a/Src/WICTextureLoader.cpp b/Src/WICTextureLoader.cpp index 060ac74..eabba3b 100644 --- a/Src/WICTextureLoader.cpp +++ b/Src/WICTextureLoader.cpp @@ -745,7 +745,7 @@ HRESULT DirectX::LoadWICTextureFromFileEx( pstrName++; } - if (texture != 0 && *texture != 0) + if (texture && *texture) { (*texture)->SetName(pstrName); } @@ -798,4 +798,4 @@ HRESULT DirectX::CreateWICTextureFromFileEx( } return hr; -} \ No newline at end of file +} diff --git a/Src/pch.h b/Src/pch.h index d80013b..56d5929 100644 --- a/Src/pch.h +++ b/Src/pch.h @@ -115,6 +115,7 @@ #pragma warning(pop) #include +#include #include #pragma warning(push)