From c666499beb7280e1ecbb31baf318b1c7c4b1168f Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Thu, 22 Jun 2017 18:46:13 -0700 Subject: [PATCH] Updated for June 2017 release of DirectX Tool Kit --- .../Audio/DynamicSoundEffectInstance.cpp | 2 +- DirectXTK/Audio/SoundCommon.cpp | 8 +- DirectXTK/Audio/WaveBankReader.h | 5 + DirectXTK/DirectXTK_Desktop_2013.vcxproj | 59 +- .../DirectXTK_Desktop_2013.vcxproj.filters | 147 +++++ DirectXTK/DirectXTK_Desktop_2015.vcxproj | 59 +- .../DirectXTK_Desktop_2015.vcxproj.filters | 147 +++++ DirectXTK/DirectXTK_Desktop_2017.vcxproj | 57 ++ .../DirectXTK_Desktop_2017.vcxproj.filters | 147 +++++ DirectXTK/DirectXTK_XboxOneXDK_2015.vcxproj | 71 ++- .../DirectXTK_XboxOneXDK_2015.vcxproj.filters | 183 ++++++ DirectXTK/DirectXTK_XboxOneXDK_2017.vcxproj | 71 ++- .../DirectXTK_XboxOneXDK_2017.vcxproj.filters | 183 ++++++ DirectXTK/Inc/PostProcess.h | 201 ++++++ DirectXTK/Readme.txt | 19 +- DirectXTK/Src/BasicPostProcess.cpp | 593 ++++++++++++++++++ DirectXTK/Src/CommonStates.cpp | 8 +- DirectXTK/Src/DualPostProcess.cpp | 337 ++++++++++ DirectXTK/Src/GeometricPrimitive.cpp | 8 +- DirectXTK/Src/ModelLoadSDKMESH.cpp | 31 +- DirectXTK/Src/Shaders/CompileShaders.cmd | 43 ++ .../Compiled/PostProcess_PSBloomBlur.inc | 136 ++++ .../Compiled/PostProcess_PSBloomCombine.inc | 173 +++++ .../Compiled/PostProcess_PSBloomExtract.inc | 109 ++++ .../Shaders/Compiled/PostProcess_PSCopy.inc | 81 +++ .../Compiled/PostProcess_PSDownScale2x2.inc | 136 ++++ .../Compiled/PostProcess_PSDownScale4x4.inc | 136 ++++ .../PostProcess_PSGaussianBlur5x5.inc | 136 ++++ .../Shaders/Compiled/PostProcess_PSMerge.inc | 112 ++++ .../Compiled/PostProcess_PSMonochrome.inc | 95 +++ .../Shaders/Compiled/PostProcess_PSSepia.inc | 111 ++++ .../Shaders/Compiled/PostProcess_VSQuad.inc | 119 ++++ .../Shaders/Compiled/ToneMap_PSACESFilmic.inc | 140 +++++ .../Compiled/ToneMap_PSACESFilmic_SRGB.inc | 156 +++++ .../Src/Shaders/Compiled/ToneMap_PSCopy.inc | 81 +++ .../Src/Shaders/Compiled/ToneMap_PSHDR10.inc | 189 ++++++ .../Shaders/Compiled/ToneMap_PSReinhard.inc | 113 ++++ .../Compiled/ToneMap_PSReinhard_SRGB.inc | 130 ++++ .../Shaders/Compiled/ToneMap_PSSaturate.inc | 98 +++ .../Compiled/ToneMap_PSSaturate_SRGB.inc | 114 ++++ .../Src/Shaders/Compiled/ToneMap_PS_SRGB.inc | 105 ++++ .../Src/Shaders/Compiled/ToneMap_VSQuad.inc | 119 ++++ DirectXTK/Src/Shaders/PostProcess.fx | 181 ++++++ DirectXTK/Src/Shaders/ToneMap.fx | 231 +++++++ DirectXTK/Src/Shaders/Utilities.fxh | 74 +++ DirectXTK/Src/SpriteBatch.cpp | 4 +- DirectXTK/Src/ToneMapPostProcess.cpp | 430 +++++++++++++ DirectXTKModelViewer_XDK_2017.vcxproj | 1 - 48 files changed, 5848 insertions(+), 41 deletions(-) create mode 100644 DirectXTK/Inc/PostProcess.h create mode 100644 DirectXTK/Src/BasicPostProcess.cpp create mode 100644 DirectXTK/Src/DualPostProcess.cpp create mode 100644 DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomBlur.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomCombine.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomExtract.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/PostProcess_PSCopy.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/PostProcess_PSDownScale2x2.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/PostProcess_PSDownScale4x4.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/PostProcess_PSGaussianBlur5x5.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/PostProcess_PSMerge.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/PostProcess_PSMonochrome.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/PostProcess_PSSepia.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/PostProcess_VSQuad.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/ToneMap_PSACESFilmic.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/ToneMap_PSACESFilmic_SRGB.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/ToneMap_PSCopy.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/ToneMap_PSHDR10.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/ToneMap_PSReinhard.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/ToneMap_PSReinhard_SRGB.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/ToneMap_PSSaturate.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/ToneMap_PSSaturate_SRGB.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/ToneMap_PS_SRGB.inc create mode 100644 DirectXTK/Src/Shaders/Compiled/ToneMap_VSQuad.inc create mode 100644 DirectXTK/Src/Shaders/PostProcess.fx create mode 100644 DirectXTK/Src/Shaders/ToneMap.fx create mode 100644 DirectXTK/Src/Shaders/Utilities.fxh create mode 100644 DirectXTK/Src/ToneMapPostProcess.cpp diff --git a/DirectXTK/Audio/DynamicSoundEffectInstance.cpp b/DirectXTK/Audio/DynamicSoundEffectInstance.cpp index 57be0ff..9661f74 100644 --- a/DirectXTK/Audio/DynamicSoundEffectInstance.cpp +++ b/DirectXTK/Audio/DynamicSoundEffectInstance.cpp @@ -26,7 +26,7 @@ class DynamicSoundEffectInstance::Impl : public IVoiceNotify { public: Impl( _In_ AudioEngine* engine, - _In_ DynamicSoundEffectInstance* object, _In_opt_ std::function bufferNeeded, + _In_ DynamicSoundEffectInstance* object, std::function& bufferNeeded, int sampleRate, int channels, int sampleBits, SOUND_EFFECT_INSTANCE_FLAGS flags ) : mBase(), mBufferNeeded( nullptr ), diff --git a/DirectXTK/Audio/SoundCommon.cpp b/DirectXTK/Audio/SoundCommon.cpp index fa44048..df6f1e7 100644 --- a/DirectXTK/Audio/SoundCommon.cpp +++ b/DirectXTK/Audio/SoundCommon.cpp @@ -727,7 +727,7 @@ void SoundEffectInstanceBase::Apply3D( const AudioListener& listener, const Audi dwCalcFlags |= X3DAUDIO_CALCULATE_LPF_REVERB | X3DAUDIO_CALCULATE_REVERB; } - float matrix[ XAUDIO2_MAX_AUDIO_CHANNELS * 8 ]; + float matrix[XAUDIO2_MAX_AUDIO_CHANNELS * 8] = {}; assert( mDSPSettings.SrcChannelCount <= XAUDIO2_MAX_AUDIO_CHANNELS ); assert( mDSPSettings.DstChannelCount <= 8 ); mDSPSettings.pMatrixCoefficients = matrix; @@ -766,7 +766,11 @@ void SoundEffectInstanceBase::Apply3D( const AudioListener& listener, const Audi if ( reverb ) { - (void)voice->SetOutputMatrix( reverb, 1, 1, &mDSPSettings.ReverbLevel ); + for ( size_t j = 0; j < mDSPSettings.SrcChannelCount; ++j ) + { + matrix[j] = mDSPSettings.ReverbLevel; + } + (void)voice->SetOutputMatrix( reverb, mDSPSettings.SrcChannelCount, 1, matrix ); } if ( mFlags & SoundEffectInstance_ReverbUseFilters ) diff --git a/DirectXTK/Audio/WaveBankReader.h b/DirectXTK/Audio/WaveBankReader.h index 239fa0f..3c6f814 100644 --- a/DirectXTK/Audio/WaveBankReader.h +++ b/DirectXTK/Audio/WaveBankReader.h @@ -28,6 +28,11 @@ namespace DirectX public: WaveBankReader(); +#if !defined(_MSC_VER) || _MSC_VER >= 1900 + WaveBankReader(WaveBankReader&&) = default; + WaveBankReader& operator= (WaveBankReader&&) = default; +#endif + WaveBankReader(WaveBankReader const&) = delete; WaveBankReader& operator= (WaveBankReader const&) = delete; diff --git a/DirectXTK/DirectXTK_Desktop_2013.vcxproj b/DirectXTK/DirectXTK_Desktop_2013.vcxproj index 0799e5f..10f09b1 100644 --- a/DirectXTK/DirectXTK_Desktop_2013.vcxproj +++ b/DirectXTK/DirectXTK_Desktop_2013.vcxproj @@ -29,6 +29,7 @@ + @@ -55,10 +56,12 @@ + + @@ -87,6 +90,7 @@ + @@ -297,6 +301,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -343,10 +369,31 @@ + + + + + + + + + + + + + + + + + + + + + @@ -385,6 +432,14 @@ Document + + + Document + + + Document + + $(VCTargetsPath11) @@ -532,8 +587,6 @@ - + \ No newline at end of file diff --git a/DirectXTK/DirectXTK_Desktop_2013.vcxproj.filters b/DirectXTK/DirectXTK_Desktop_2013.vcxproj.filters index 9cb24df..34cfceb 100644 --- a/DirectXTK/DirectXTK_Desktop_2013.vcxproj.filters +++ b/DirectXTK/DirectXTK_Desktop_2013.vcxproj.filters @@ -123,6 +123,9 @@ Src\Shared + + Inc + @@ -218,6 +221,15 @@ Src\Shared + + Src + + + Src + + + Src + @@ -1019,5 +1031,140 @@ Src\Shaders\Symbols + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders + + + Src\Shaders + + + Src\Shaders\Shared + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + \ No newline at end of file diff --git a/DirectXTK/DirectXTK_Desktop_2015.vcxproj b/DirectXTK/DirectXTK_Desktop_2015.vcxproj index a2717f9..aff7432 100644 --- a/DirectXTK/DirectXTK_Desktop_2015.vcxproj +++ b/DirectXTK/DirectXTK_Desktop_2015.vcxproj @@ -29,6 +29,7 @@ + @@ -55,10 +56,12 @@ + + @@ -87,6 +90,7 @@ + @@ -297,6 +301,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -343,10 +369,31 @@ + + + + + + + + + + + + + + + + + + + + + @@ -385,6 +432,14 @@ Document + + + Document + + + Document + + {E0B52AE7-E160-4D32-BF3F-910B785E5A8E} @@ -530,8 +585,6 @@ - + \ No newline at end of file diff --git a/DirectXTK/DirectXTK_Desktop_2015.vcxproj.filters b/DirectXTK/DirectXTK_Desktop_2015.vcxproj.filters index eef7b23..66e0489 100644 --- a/DirectXTK/DirectXTK_Desktop_2015.vcxproj.filters +++ b/DirectXTK/DirectXTK_Desktop_2015.vcxproj.filters @@ -123,6 +123,9 @@ Src\Shared + + Inc + @@ -218,6 +221,15 @@ Src + + Src + + + Src + + + Src + @@ -1019,5 +1031,140 @@ Src\Shaders\Symbols + + Src\Shaders + + + Src\Shaders + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Shared + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + \ No newline at end of file diff --git a/DirectXTK/DirectXTK_Desktop_2017.vcxproj b/DirectXTK/DirectXTK_Desktop_2017.vcxproj index 74289b4..5d4c017 100644 --- a/DirectXTK/DirectXTK_Desktop_2017.vcxproj +++ b/DirectXTK/DirectXTK_Desktop_2017.vcxproj @@ -29,6 +29,7 @@ + @@ -55,10 +56,12 @@ + + @@ -87,6 +90,7 @@ + @@ -297,6 +301,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -343,10 +369,31 @@ + + + + + + + + + + + + + + + + + + + + + @@ -385,6 +432,16 @@ Document + + + Document + + + + + Document + + {E0B52AE7-E160-4D32-BF3F-910B785E5A8E} diff --git a/DirectXTK/DirectXTK_Desktop_2017.vcxproj.filters b/DirectXTK/DirectXTK_Desktop_2017.vcxproj.filters index eef7b23..2812a43 100644 --- a/DirectXTK/DirectXTK_Desktop_2017.vcxproj.filters +++ b/DirectXTK/DirectXTK_Desktop_2017.vcxproj.filters @@ -123,6 +123,9 @@ Src\Shared + + Inc + @@ -218,6 +221,15 @@ Src + + Src + + + Src + + + Src + @@ -1019,5 +1031,140 @@ Src\Shaders\Symbols + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders + + + Src\Shaders\Shared + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + \ No newline at end of file diff --git a/DirectXTK/DirectXTK_XboxOneXDK_2015.vcxproj b/DirectXTK/DirectXTK_XboxOneXDK_2015.vcxproj index c1942c4..b670846 100644 --- a/DirectXTK/DirectXTK_XboxOneXDK_2015.vcxproj +++ b/DirectXTK/DirectXTK_XboxOneXDK_2015.vcxproj @@ -29,6 +29,7 @@ + @@ -63,11 +64,13 @@ + + @@ -94,6 +97,7 @@ + @@ -305,6 +309,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -351,9 +377,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -396,6 +455,14 @@ Document + + + Document + + + Document + + DirectXTK {4fdfdccd-ee2e-415c-b458-1e8fdb0d85f2} @@ -549,8 +616,6 @@ - + \ No newline at end of file diff --git a/DirectXTK/DirectXTK_XboxOneXDK_2015.vcxproj.filters b/DirectXTK/DirectXTK_XboxOneXDK_2015.vcxproj.filters index acc29aa..3546392 100644 --- a/DirectXTK/DirectXTK_XboxOneXDK_2015.vcxproj.filters +++ b/DirectXTK/DirectXTK_XboxOneXDK_2015.vcxproj.filters @@ -140,6 +140,9 @@ Src\Shared + + Inc + @@ -262,6 +265,15 @@ Src + + Src + + + Src + + + Src + @@ -1065,6 +1077,177 @@ Src\Shaders\Symbols + + Src\Shaders + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Shared + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + diff --git a/DirectXTK/DirectXTK_XboxOneXDK_2017.vcxproj b/DirectXTK/DirectXTK_XboxOneXDK_2017.vcxproj index d2512ec..ebd2fd9 100644 --- a/DirectXTK/DirectXTK_XboxOneXDK_2017.vcxproj +++ b/DirectXTK/DirectXTK_XboxOneXDK_2017.vcxproj @@ -29,6 +29,7 @@ + @@ -63,11 +64,13 @@ + + @@ -94,6 +97,7 @@ + @@ -305,6 +309,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -351,9 +377,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -396,6 +455,14 @@ Document + + + Document + + + Document + + DirectXTK {4fdfdccd-ee2e-415c-b458-1e8fdb0d85f2} @@ -549,8 +616,6 @@ - + \ No newline at end of file diff --git a/DirectXTK/DirectXTK_XboxOneXDK_2017.vcxproj.filters b/DirectXTK/DirectXTK_XboxOneXDK_2017.vcxproj.filters index acc29aa..3546392 100644 --- a/DirectXTK/DirectXTK_XboxOneXDK_2017.vcxproj.filters +++ b/DirectXTK/DirectXTK_XboxOneXDK_2017.vcxproj.filters @@ -140,6 +140,9 @@ Src\Shared + + Inc + @@ -262,6 +265,15 @@ Src + + Src + + + Src + + + Src + @@ -1065,6 +1077,177 @@ Src\Shaders\Symbols + + Src\Shaders + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Shared + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Compiled + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + + + Src\Shaders\Symbols + diff --git a/DirectXTK/Inc/PostProcess.h b/DirectXTK/Inc/PostProcess.h new file mode 100644 index 0000000..896497b --- /dev/null +++ b/DirectXTK/Inc/PostProcess.h @@ -0,0 +1,201 @@ +//-------------------------------------------------------------------------------------- +// File: PostProcess.h +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#pragma once + +#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#error Post-processing not supported for Windows Phone 8.x; requires Direct3D hardware Feature Level 10.0 or better +#endif + +#if defined(_XBOX_ONE) && defined(_TITLE) +#include +#else +#include +#endif + +#include +#include +#include + + +namespace DirectX +{ + //---------------------------------------------------------------------------------- + // Abstract interface representing a post-process pass + class IPostProcess + { + public: + virtual ~IPostProcess() { } + + virtual void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) = 0; + }; + + + //---------------------------------------------------------------------------------- + // Basic post-process + class BasicPostProcess : public IPostProcess + { + public: + enum Effect + { + Copy, + Monochrome, + Sepia, + DownScale_2x2, + DownScale_4x4, + GaussianBlur_5x5, + BloomExtract, + BloomBlur, + Effect_Max + }; + + explicit BasicPostProcess(_In_ ID3D11Device* device); + BasicPostProcess(BasicPostProcess&& moveFrom); + BasicPostProcess& operator= (BasicPostProcess&& moveFrom); + + BasicPostProcess(BasicPostProcess const&) = delete; + BasicPostProcess& operator= (BasicPostProcess const&) = delete; + + virtual ~BasicPostProcess(); + + // IPostProcess methods. + void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; + + // Shader control + void __cdecl SetEffect(Effect fx); + + // Properties + void __cdecl SetSourceTexture(_In_opt_ ID3D11ShaderResourceView* value); + + // Sets multiplier for GaussianBlur_5x5 + void __cdecl SetGaussianParameter(float multiplier); + + // Sets parameters for BloomExtract + void __cdecl SetBloomExtractParameter(float threshold); + + // Sets parameters for BloomBlur + void __cdecl SetBloomBlurParameters(bool horizontal, float size, float brightness); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; + + + //---------------------------------------------------------------------------------- + // Dual-texure post-process + class DualPostProcess : public IPostProcess + { + public: + enum Effect + { + Merge, + BloomCombine, + Effect_Max + }; + + explicit DualPostProcess(_In_ ID3D11Device* device); + DualPostProcess(DualPostProcess&& moveFrom); + DualPostProcess& operator= (DualPostProcess&& moveFrom); + + DualPostProcess(DualPostProcess const&) = delete; + DualPostProcess& operator= (DualPostProcess const&) = delete; + + virtual ~DualPostProcess(); + + // IPostProcess methods. + void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; + + // Shader control + void __cdecl SetEffect(Effect fx); + + // Properties + void __cdecl SetSourceTexture(_In_opt_ ID3D11ShaderResourceView* value); + void __cdecl SetSourceTexture2(_In_opt_ ID3D11ShaderResourceView* value); + + // Sets parameters for Merge + void __cdecl SetMergeParameters(float weight1, float weight2); + + // Sets parameters for BloomCombine + void __cdecl SetBloomCombineParameters(float bloom, float base, float bloomSaturation, float baseSaturation); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; + + + //---------------------------------------------------------------------------------- + // Tone-map post-process + class ToneMapPostProcess : public IPostProcess + { + public: + enum Operator // Tone-mapping operator + { + None, // Pass-through + Saturate, // Clamp [0,1] + Reinhard, // x/(1+x) + ACESFilmic, + Operator_Max + }; + + enum TransferFunction // Electro-Optical Transfer Function (EOTF) + { + Linear, // Pass-through + SRGB, // sRGB (Rec.709 and approximate sRGB display curve) + ST2084, // HDR10 (Rec.2020 color primaries and ST.2084 display curve) + TransferFunction_Max + }; + + explicit ToneMapPostProcess(_In_ ID3D11Device* device); + ToneMapPostProcess(ToneMapPostProcess&& moveFrom); + ToneMapPostProcess& operator= (ToneMapPostProcess&& moveFrom); + + ToneMapPostProcess(ToneMapPostProcess const&) = delete; + ToneMapPostProcess& operator= (ToneMapPostProcess const&) = delete; + + virtual ~ToneMapPostProcess(); + + // IPostProcess methods. + void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; + + // Shader control + void __cdecl SetOperator(Operator op); + + void __cdecl SetTransferFunction(TransferFunction func); + + #if defined(_XBOX_ONE) && defined(_TITLE) + // Uses Multiple Render Targets to generate both HDR10 and GameDVR SDR signals + void __cdecl SetMRTOutput(bool value = true); + #endif + + // Properties + void __cdecl SetHDRSourceTexture(_In_opt_ ID3D11ShaderResourceView* value); + + // Sets exposure value for LDR tonemap operators + void SetExposure(float exposureValue); + + // Sets ST.2084 parameter for how bright white should be in nits + void SetST2084Parameter(float paperWhiteNits); + + private: + // Private implementation. + class Impl; + + std::unique_ptr pImpl; + }; +} diff --git a/DirectXTK/Readme.txt b/DirectXTK/Readme.txt index 2379d63..5b4b60b 100644 --- a/DirectXTK/Readme.txt +++ b/DirectXTK/Readme.txt @@ -4,16 +4,18 @@ DirectXTK - the DirectX Tool Kit for DirectX 11 Copyright (c) Microsoft Corporation. All rights reserved. -April 24, 2017 +June 21, 2017 This package contains the "DirectX Tool Kit", a collection of helper classes for writing Direct3D 11 C++ code for Universal Windows Platform (UWP) apps for Windows 10, Windows Store apps, Windows phone 8.1 applications, Xbox One exclusive apps, -Windows 8.x Win32 desktop applications, Windows 7 applications, and -Windows Vista Direct3D 11.0 applications. +Windows 8.x Win32 desktop applications, Windows 7 Service Pack 1 applications, and +Windows Vista Service Pack 2 Direct3D 11.0 applications. -This code is designed to build with Visual Studio 2013 or 2015. It is recommended that you -make use of VS 2013 Update 5 or VS 2015 Update 3 and Windows 7 Service Pack 1 or later. +This code is designed to build with Visual Studio 2013 Update 5, Visual Studio 2015 Update 3, +or Visual Studio 2017. It is recommended that you make use of VS 2015 Update 3, Windows Tools +1.4.1, and the Windows 10 Anniversary Update SDK (14393) or VS 2017 with the Windows 10 +Creators Update SDK (15063). These components are designed to work without requiring any content from the DirectX SDK. For details, see "Where is the DirectX SDK?" . @@ -32,6 +34,7 @@ Inc\ Keyboard.h - keyboard state tracking helper Model.h - draws meshes loaded from .CMO, .SDKMESH, or .VBO files Mouse.h - mouse helper + PostProcess.h - set of built-in shaders for common post-processing operations PrimitiveBatch.h - simple and efficient way to draw user primitives ScreenGrab.h - light-weight screen shot saver SimpleMath.h - simplified C++ wrapper for DirectXMath @@ -79,6 +82,12 @@ https://opensource.microsoft.com/codeofconduct/ RELEASE HISTORY --------------- +June 21, 2017 + Post-processing support + SDKMESH loader fix when loading legacy files with all zero materials + DirectXTK for Audio: Minor fixes for environmental audio + Minor code cleanup + April 24, 2017 VS 2017 project updates Regenerated shaders using Windows 10 Creators Update SDK (15063) diff --git a/DirectXTK/Src/BasicPostProcess.cpp b/DirectXTK/Src/BasicPostProcess.cpp new file mode 100644 index 0000000..394cc58 --- /dev/null +++ b/DirectXTK/Src/BasicPostProcess.cpp @@ -0,0 +1,593 @@ +//-------------------------------------------------------------------------------------- +// File: BasicPostProcess.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "PostProcess.h" + +#include "AlignedNew.h" +#include "CommonStates.h" +#include "ConstantBuffer.h" +#include "DemandCreate.h" +#include "DirectXHelpers.h" +#include "SharedResourcePool.h" + +using namespace DirectX; + +using Microsoft::WRL::ComPtr; + +namespace +{ + const int c_MaxSamples = 16; + + const int Dirty_ConstantBuffer = 0x01; + const int Dirty_Parameters = 0x02; + + // Constant buffer layout. Must match the shader! + __declspec(align(16)) struct PostProcessConstants + { + XMVECTOR sampleOffsets[c_MaxSamples]; + XMVECTOR sampleWeights[c_MaxSamples]; + }; + + static_assert((sizeof(PostProcessConstants) % 16) == 0, "CB size not padded correctly"); + + // 2-parameter Gaussian distribution given standard deviation (rho) + inline float GaussianDistribution(float x, float y, float rho) + { + return expf(-(x * x + y * y) / (2 * rho * rho)) / sqrtf(2 * XM_PI * rho * rho); + } +} + +// Include the precompiled shader code. +namespace +{ +#if defined(_XBOX_ONE) && defined(_TITLE) + #include "Shaders/Compiled/XboxOnePostProcess_VSQuad.inc" + + #include "Shaders/Compiled/XboxOnePostProcess_PSCopy.inc" + #include "Shaders/Compiled/XboxOnePostProcess_PSMonochrome.inc" + #include "Shaders/Compiled/XboxOnePostProcess_PSSepia.inc" + #include "Shaders/Compiled/XboxOnePostProcess_PSDownScale2x2.inc" + #include "Shaders/Compiled/XboxOnePostProcess_PSDownScale4x4.inc" + #include "Shaders/Compiled/XboxOnePostProcess_PSGaussianBlur5x5.inc" + #include "Shaders/Compiled/XboxOnePostProcess_PSBloomExtract.inc" + #include "Shaders/Compiled/XboxOnePostProcess_PSBloomBlur.inc" +#else + #include "Shaders/Compiled/PostProcess_VSQuad.inc" + + #include "Shaders/Compiled/PostProcess_PSCopy.inc" + #include "Shaders/Compiled/PostProcess_PSMonochrome.inc" + #include "Shaders/Compiled/PostProcess_PSSepia.inc" + #include "Shaders/Compiled/PostProcess_PSDownScale2x2.inc" + #include "Shaders/Compiled/PostProcess_PSDownScale4x4.inc" + #include "Shaders/Compiled/PostProcess_PSGaussianBlur5x5.inc" + #include "Shaders/Compiled/PostProcess_PSBloomExtract.inc" + #include "Shaders/Compiled/PostProcess_PSBloomBlur.inc" +#endif +} + +namespace +{ + struct ShaderBytecode + { + void const* code; + size_t length; + }; + + const ShaderBytecode pixelShaders[] = + { + { PostProcess_PSCopy, sizeof(PostProcess_PSCopy) }, + { PostProcess_PSMonochrome, sizeof(PostProcess_PSMonochrome) }, + { PostProcess_PSSepia, sizeof(PostProcess_PSSepia) }, + { PostProcess_PSDownScale2x2, sizeof(PostProcess_PSDownScale2x2) }, + { PostProcess_PSDownScale4x4, sizeof(PostProcess_PSDownScale4x4) }, + { PostProcess_PSGaussianBlur5x5, sizeof(PostProcess_PSGaussianBlur5x5) }, + { PostProcess_PSBloomExtract, sizeof(PostProcess_PSBloomExtract) }, + { PostProcess_PSBloomBlur, sizeof(PostProcess_PSBloomBlur) }, + }; + + static_assert(_countof(pixelShaders) == BasicPostProcess::Effect_Max, "array/max mismatch"); + + // Factory for lazily instantiating shaders. + class DeviceResources + { + public: + DeviceResources(_In_ ID3D11Device* device) + : mDevice(device), + stateObjects(device) + { } + + // Gets or lazily creates the vertex shader. + ID3D11VertexShader* GetVertexShader() + { + return DemandCreate(mVertexShader, mMutex, [&](ID3D11VertexShader** pResult) -> HRESULT + { + HRESULT hr = mDevice->CreateVertexShader(PostProcess_VSQuad, sizeof(PostProcess_VSQuad), nullptr, pResult); + + if (SUCCEEDED(hr)) + SetDebugObjectName(*pResult, "BasicPostProcess"); + + return hr; + }); + } + + // Gets or lazily creates the specified pixel shader. + ID3D11PixelShader* GetPixelShader(int shaderIndex) + { + assert(shaderIndex >= 0 && shaderIndex < BasicPostProcess::Effect_Max); + _Analysis_assume_(shaderIndex >= 0 && shaderIndex < BasicPostProcess::Effect_Max); + + return DemandCreate(mPixelShaders[shaderIndex], mMutex, [&](ID3D11PixelShader** pResult) -> HRESULT + { + HRESULT hr = mDevice->CreatePixelShader(pixelShaders[shaderIndex].code, pixelShaders[shaderIndex].length, nullptr, pResult); + + if (SUCCEEDED(hr)) + SetDebugObjectName(*pResult, "BasicPostProcess"); + + return hr; + }); + } + + CommonStates stateObjects; + + protected: + ComPtr mDevice; + ComPtr mVertexShader; + ComPtr mPixelShaders[BasicPostProcess::Effect_Max]; + std::mutex mMutex; + }; +} + +class BasicPostProcess::Impl : public AlignedNew +{ +public: + Impl(_In_ ID3D11Device* device); + + void Process(_In_ ID3D11DeviceContext* deviceContext, std::function& setCustomState); + + void SetConstants(bool value = true) { mUseConstants = value; mDirtyFlags = INT_MAX; } + void SetDirtyFlag() { mDirtyFlags = INT_MAX; } + + // Fields. + BasicPostProcess::Effect fx; + PostProcessConstants constants; + ComPtr texture; + unsigned texWidth; + unsigned texHeight; + float guassianMultiplier; + float bloomSize; + float bloomBrightness; + float bloomThreshold; + bool bloomHorizontal; + +private: + bool mUseConstants; + int mDirtyFlags; + + void DownScale2x2(); + void DownScale4x4(); + void GaussianBlur5x5(float multiplier); + void Bloom(bool horizontal, float size, float brightness); + + ConstantBuffer mConstantBuffer; + + // Per-device resources. + std::shared_ptr mDeviceResources; + + static SharedResourcePool deviceResourcesPool; +}; + + +// Global pool of per-device BasicPostProcess resources. +SharedResourcePool BasicPostProcess::Impl::deviceResourcesPool; + + +// Constructor. +BasicPostProcess::Impl::Impl(_In_ ID3D11Device* device) + : mConstantBuffer(device), + mDeviceResources(deviceResourcesPool.DemandCreate(device)), + fx(BasicPostProcess::Copy), + texWidth(0), + texHeight(0), + guassianMultiplier(1.f), + bloomSize(1.f), + bloomBrightness(1.f), + bloomThreshold(0.25f), + bloomHorizontal(true), + mUseConstants(false), + mDirtyFlags(INT_MAX), + constants{} +{ + if (device->GetFeatureLevel() < D3D_FEATURE_LEVEL_10_0) + { + throw std::exception("BasicPostProcess requires Feature Level 10.0 or later"); + } +} + + +// Sets our state onto the D3D device. +void BasicPostProcess::Impl::Process(_In_ ID3D11DeviceContext* deviceContext, std::function& setCustomState) +{ + // Set the texture. + ID3D11ShaderResourceView* textures[1] = { texture.Get() }; + deviceContext->PSSetShaderResources(0, 1, textures); + + auto sampler = mDeviceResources->stateObjects.LinearClamp(); + deviceContext->PSSetSamplers(0, 1, &sampler); + + // Set state objects. + deviceContext->OMSetBlendState(mDeviceResources->stateObjects.Opaque(), nullptr, 0xffffffff); + deviceContext->OMSetDepthStencilState(mDeviceResources->stateObjects.DepthNone(), 0); + deviceContext->RSSetState(mDeviceResources->stateObjects.CullNone()); + + // Set shaders. + auto vertexShader = mDeviceResources->GetVertexShader(); + auto pixelShader = mDeviceResources->GetPixelShader(fx); + + deviceContext->VSSetShader(vertexShader, nullptr, 0); + deviceContext->PSSetShader(pixelShader, nullptr, 0); + + // Set constants. + if (mUseConstants) + { + if (mDirtyFlags & Dirty_Parameters) + { + mDirtyFlags &= ~Dirty_Parameters; + mDirtyFlags |= Dirty_ConstantBuffer; + + switch (fx) + { + case DownScale_2x2: + DownScale2x2(); + break; + + case DownScale_4x4: + DownScale4x4(); + break; + + case GaussianBlur_5x5: + GaussianBlur5x5(guassianMultiplier); + break; + + case BloomExtract: + constants.sampleWeights[0] = XMVectorReplicate(bloomThreshold); + break; + + case BloomBlur: + Bloom(bloomHorizontal, bloomSize, bloomBrightness); + break; + } + } + +#if defined(_XBOX_ONE) && defined(_TITLE) + void *grfxMemory; + mConstantBuffer.SetData(deviceContext, constants, &grfxMemory); + + Microsoft::WRL::ComPtr deviceContextX; + ThrowIfFailed(deviceContext->QueryInterface(IID_GRAPHICS_PPV_ARGS(deviceContextX.GetAddressOf()))); + + auto buffer = mConstantBuffer.GetBuffer(); + + deviceContextX->PSSetPlacementConstantBuffer(0, buffer, grfxMemory); +#else + if (mDirtyFlags & Dirty_ConstantBuffer) + { + mDirtyFlags &= ~Dirty_ConstantBuffer; + mConstantBuffer.SetData(deviceContext, constants); + } + + // Set the constant buffer. + auto buffer = mConstantBuffer.GetBuffer(); + + deviceContext->PSSetConstantBuffers(0, 1, &buffer); +#endif + } + + if (setCustomState) + { + setCustomState(); + } + + // Draw quad. + deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + + deviceContext->Draw(4, 0); +} + + +void BasicPostProcess::Impl::DownScale2x2() +{ + mUseConstants = true; + + if ( !texWidth || !texHeight) + { + throw std::exception("Call SetSourceTexture before setting post-process effect"); + } + + float tu = 1.0f / float(texWidth); + float tv = 1.0f / float(texHeight); + + // Sample from the 4 surrounding points. Since the center point will be in the exact + // center of 4 texels, a 0.5f offset is needed to specify a texel center. + auto ptr = reinterpret_cast(constants.sampleOffsets); + for (int y = 0; y < 2; ++y) + { + for (int x = 0; x < 2; ++x) + { + ptr->x = (float(x) - 0.5f) * tu; + ptr->y = (float(y) - 0.5f) * tv; + ++ptr; + } + } + +} + + +void BasicPostProcess::Impl::DownScale4x4() +{ + mUseConstants = true; + + if (!texWidth || !texHeight) + { + throw std::exception("Call SetSourceTexture before setting post-process effect"); + } + + float tu = 1.0f / float(texWidth); + float tv = 1.0f / float(texHeight); + + // Sample from the 16 surrounding points. Since the center point will be in the + // exact center of 16 texels, a 1.5f offset is needed to specify a texel center. + auto ptr = reinterpret_cast(constants.sampleOffsets); + for (int y = 0; y < 4; ++y) + { + for (int x = 0; x < 4; ++x) + { + ptr->x = (float(x) - 1.5f) * tu; + ptr->y = (float(y) - 1.5f) * tv; + ++ptr; + } + } + +} + + +void BasicPostProcess::Impl::GaussianBlur5x5(float multiplier) +{ + mUseConstants = true; + + if (!texWidth || !texHeight) + { + throw std::exception("Call SetSourceTexture before setting post-process effect"); + } + + float tu = 1.0f / float(texWidth); + float tv = 1.0f / float(texHeight); + + float totalWeight = 0.0f; + size_t index = 0; + auto offsets = reinterpret_cast(constants.sampleOffsets); + auto weights = constants.sampleWeights; + for (int x = -2; x <= 2; ++x) + { + for (int y = -2; y <= 2; ++y) + { + // Exclude pixels with a block distance greater than 2. This will + // create a kernel which approximates a 5x5 kernel using only 13 + // sample points instead of 25; this is necessary since 2.0 shaders + // only support 16 texture grabs. + if (fabs(float(x)) + fabs(float(y)) > 2.0f) + continue; + + // Get the unscaled Gaussian intensity for this offset + offsets[index].x = float(x) * tu; + offsets[index].y = float(y) * tv; + offsets[index].z = 0.0f; + offsets[index].w = 0.0f; + + float g = GaussianDistribution(float(x), float(y), 1.0f); + weights[index] = XMVectorReplicate(g); + + totalWeight += XMVectorGetX(weights[index]); + + ++index; + } + } + + // Divide the current weight by the total weight of all the samples; Gaussian + // blur kernels add to 1.0f to ensure that the intensity of the image isn't + // changed when the blur occurs. An optional multiplier variable is used to + // add or remove image intensity during the blur. + for (size_t i = 0; i < index; ++i) + { + weights[i] /= totalWeight; + weights[i] *= multiplier; + } +} + + +void BasicPostProcess::Impl::Bloom(bool horizontal, float size, float brightness) +{ + mUseConstants = true; + + if (!texWidth || !texHeight) + { + throw std::exception("Call SetSourceTexture before setting post-process effect"); + } + + float tu = 0.f; + float tv = 0.f; + if (horizontal) + { + tu = 1.f / float(texWidth); + } + else + { + tv = 1.f / float(texHeight); + } + + auto weights = reinterpret_cast(constants.sampleWeights); + auto offsets = reinterpret_cast(constants.sampleOffsets); + + // Fill the center texel + float weight = brightness * GaussianDistribution(0, 0, size); + weights[0] = XMFLOAT4(weight, weight, weight, 1.0f); + offsets[0].x = offsets[0].y = offsets[0].z = offsets[0].w = 0.f; + + // Fill the first half + for (int i = 1; i < 8; ++i) + { + // Get the Gaussian intensity for this offset + weight = brightness * GaussianDistribution(float(i), 0, size); + weights[i] = XMFLOAT4(weight, weight, weight, 1.0f); + offsets[i] = XMFLOAT4(float(i) * tu, float(i) * tv, 0.f, 0.f); + } + + // Mirror to the second half + for (int i = 8; i < 15; i++) + { + weights[i] = weights[i - 7]; + offsets[i] = XMFLOAT4(-offsets[i - 7].x, -offsets[i - 7].y, 0.f, 0.f); + } +} + + +// Public constructor. +BasicPostProcess::BasicPostProcess(_In_ ID3D11Device* device) + : pImpl(new Impl(device)) +{ +} + + +// Move constructor. +BasicPostProcess::BasicPostProcess(BasicPostProcess&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +BasicPostProcess& BasicPostProcess::operator= (BasicPostProcess&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +BasicPostProcess::~BasicPostProcess() +{ +} + + +// IPostProcess methods. +void BasicPostProcess::Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState) +{ + pImpl->Process(deviceContext, setCustomState); +} + + +// Shader control. +void BasicPostProcess::SetEffect(Effect fx) +{ + if (fx < 0 || fx >= Effect_Max) + throw std::out_of_range("Effect not defined"); + + pImpl->fx = fx; + + switch (fx) + { + case Copy: + case Monochrome: + case Sepia: + // These shaders don't use the constant buffer + pImpl->SetConstants(false); + break; + + default: + pImpl->SetConstants(true); + break; + } +} + + +// Properties +void BasicPostProcess::SetSourceTexture(_In_opt_ ID3D11ShaderResourceView* value) +{ + pImpl->texture = value; + + if (value) + { + ComPtr res; + value->GetResource(res.GetAddressOf()); + + D3D11_RESOURCE_DIMENSION resType = D3D11_RESOURCE_DIMENSION_UNKNOWN; + res->GetType(&resType); + + switch (resType) + { + case D3D11_RESOURCE_DIMENSION_TEXTURE1D: + { + ComPtr tex; + ThrowIfFailed(res.As(&tex)); + + D3D11_TEXTURE1D_DESC desc = {}; + tex->GetDesc(&desc); + pImpl->texWidth = desc.Width; + pImpl->texHeight = 1; + break; + } + + case D3D11_RESOURCE_DIMENSION_TEXTURE2D: + { + ComPtr tex; + ThrowIfFailed(res.As(&tex)); + + D3D11_TEXTURE2D_DESC desc = {}; + tex->GetDesc(&desc); + pImpl->texWidth = desc.Width; + pImpl->texHeight = desc.Height; + break; + } + + default: + throw std::exception("Unsupported texture type"); + } + } + else + { + pImpl->texWidth = pImpl->texHeight = 0; + } +} + + +void BasicPostProcess::SetGaussianParameter(float multiplier) +{ + pImpl->guassianMultiplier = multiplier; + pImpl->SetDirtyFlag(); +} + + +void BasicPostProcess::SetBloomExtractParameter(float threshold) +{ + pImpl->bloomThreshold = threshold; + pImpl->SetDirtyFlag(); +} + + +void BasicPostProcess::SetBloomBlurParameters(bool horizontal, float size, float brightness) +{ + pImpl->bloomSize = size; + pImpl->bloomBrightness = brightness; + pImpl->bloomHorizontal = horizontal; + pImpl->SetDirtyFlag(); +} \ No newline at end of file diff --git a/DirectXTK/Src/CommonStates.cpp b/DirectXTK/Src/CommonStates.cpp index 683c3fc..e4182cb 100644 --- a/DirectXTK/Src/CommonStates.cpp +++ b/DirectXTK/Src/CommonStates.cpp @@ -96,11 +96,11 @@ HRESULT CommonStates::Impl::CreateDepthStencilState(bool enable, bool writeEnabl { D3D11_DEPTH_STENCIL_DESC desc = {}; - desc.DepthEnable = enable; + desc.DepthEnable = enable ? TRUE : FALSE; desc.DepthWriteMask = writeEnable ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO; desc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; - desc.StencilEnable = false; + desc.StencilEnable = FALSE; desc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK; desc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK; @@ -127,8 +127,8 @@ HRESULT CommonStates::Impl::CreateRasterizerState(D3D11_CULL_MODE cullMode, D3D1 desc.CullMode = cullMode; desc.FillMode = fillMode; - desc.DepthClipEnable = true; - desc.MultisampleEnable = true; + desc.DepthClipEnable = TRUE; + desc.MultisampleEnable = TRUE; HRESULT hr = device->CreateRasterizerState(&desc, pResult); diff --git a/DirectXTK/Src/DualPostProcess.cpp b/DirectXTK/Src/DualPostProcess.cpp new file mode 100644 index 0000000..08e6795 --- /dev/null +++ b/DirectXTK/Src/DualPostProcess.cpp @@ -0,0 +1,337 @@ +//-------------------------------------------------------------------------------------- +// File: DualPostProcess.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "PostProcess.h" + +#include "AlignedNew.h" +#include "CommonStates.h" +#include "ConstantBuffer.h" +#include "DemandCreate.h" +#include "DirectXHelpers.h" +#include "SharedResourcePool.h" + +using namespace DirectX; + +using Microsoft::WRL::ComPtr; + +namespace +{ + const int c_MaxSamples = 16; + + const int Dirty_ConstantBuffer = 0x01; + const int Dirty_Parameters = 0x02; + + // Constant buffer layout. Must match the shader! + __declspec(align(16)) struct PostProcessConstants + { + XMVECTOR sampleOffsets[c_MaxSamples]; + XMVECTOR sampleWeights[c_MaxSamples]; + }; + + static_assert((sizeof(PostProcessConstants) % 16) == 0, "CB size not padded correctly"); +} + +// Include the precompiled shader code. +namespace +{ +#if defined(_XBOX_ONE) && defined(_TITLE) + #include "Shaders/Compiled/XboxOnePostProcess_VSQuad.inc" + + #include "Shaders/Compiled/XboxOnePostProcess_PSMerge.inc" + #include "Shaders/Compiled/XboxOnePostProcess_PSBloomCombine.inc" +#else + #include "Shaders/Compiled/PostProcess_VSQuad.inc" + + #include "Shaders/Compiled/PostProcess_PSMerge.inc" + #include "Shaders/Compiled/PostProcess_PSBloomCombine.inc" +#endif +} + +namespace +{ + struct ShaderBytecode + { + void const* code; + size_t length; + }; + + const ShaderBytecode pixelShaders[] = + { + { PostProcess_PSMerge, sizeof(PostProcess_PSMerge) }, + { PostProcess_PSBloomCombine, sizeof(PostProcess_PSBloomCombine) }, + }; + + static_assert(_countof(pixelShaders) == DualPostProcess::Effect_Max, "array/max mismatch"); + + // Factory for lazily instantiating shaders. + class DeviceResources + { + public: + DeviceResources(_In_ ID3D11Device* device) + : mDevice(device), + stateObjects(device) + { } + + // Gets or lazily creates the vertex shader. + ID3D11VertexShader* GetVertexShader() + { + return DemandCreate(mVertexShader, mMutex, [&](ID3D11VertexShader** pResult) -> HRESULT + { + HRESULT hr = mDevice->CreateVertexShader(PostProcess_VSQuad, sizeof(PostProcess_VSQuad), nullptr, pResult); + + if (SUCCEEDED(hr)) + SetDebugObjectName(*pResult, "DualPostProcess"); + + return hr; + }); + } + + // Gets or lazily creates the specified pixel shader. + ID3D11PixelShader* GetPixelShader(int shaderIndex) + { + assert(shaderIndex >= 0 && shaderIndex < DualPostProcess::Effect_Max); + _Analysis_assume_(shaderIndex >= 0 && shaderIndex < DualPostProcess::Effect_Max); + + return DemandCreate(mPixelShaders[shaderIndex], mMutex, [&](ID3D11PixelShader** pResult) -> HRESULT + { + HRESULT hr = mDevice->CreatePixelShader(pixelShaders[shaderIndex].code, pixelShaders[shaderIndex].length, nullptr, pResult); + + if (SUCCEEDED(hr)) + SetDebugObjectName(*pResult, "DualPostProcess"); + + return hr; + }); + } + + CommonStates stateObjects; + + protected: + ComPtr mDevice; + ComPtr mVertexShader; + ComPtr mPixelShaders[DualPostProcess::Effect_Max]; + std::mutex mMutex; + }; +} + +class DualPostProcess::Impl : public AlignedNew +{ +public: + Impl(_In_ ID3D11Device* device); + + void Process(_In_ ID3D11DeviceContext* deviceContext, std::function& setCustomState); + + void SetDirtyFlag() { mDirtyFlags = INT_MAX; } + + // Fields. + DualPostProcess::Effect fx; + PostProcessConstants constants; + ComPtr texture; + ComPtr texture2; + float mergeWeight1; + float mergeWeight2; + float bloomIntensity; + float bloomBaseIntensity; + float bloomSaturation; + float bloomBaseSaturation; + +private: + int mDirtyFlags; + + ConstantBuffer mConstantBuffer; + + // Per-device resources. + std::shared_ptr mDeviceResources; + + static SharedResourcePool deviceResourcesPool; +}; + + +// Global pool of per-device DualPostProcess resources. +SharedResourcePool DualPostProcess::Impl::deviceResourcesPool; + + +// Constructor. +DualPostProcess::Impl::Impl(_In_ ID3D11Device* device) + : mConstantBuffer(device), + mDeviceResources(deviceResourcesPool.DemandCreate(device)), + fx(DualPostProcess::Merge), + mergeWeight1(0.5f), + mergeWeight2(0.5f), + bloomIntensity(1.25f), + bloomBaseIntensity(1.f), + bloomSaturation(1.f), + bloomBaseSaturation(1.f), + mDirtyFlags(INT_MAX), + constants{} +{ + if (device->GetFeatureLevel() < D3D_FEATURE_LEVEL_10_0) + { + throw std::exception("DualPostProcess requires Feature Level 10.0 or later"); + } +} + + +// Sets our state onto the D3D device. +void DualPostProcess::Impl::Process(_In_ ID3D11DeviceContext* deviceContext, std::function& setCustomState) +{ + // Set the texture. + ID3D11ShaderResourceView* textures[2] = { texture.Get(), texture2.Get() }; + deviceContext->PSSetShaderResources(0, 2, textures); + + auto sampler = mDeviceResources->stateObjects.LinearClamp(); + deviceContext->PSSetSamplers(0, 1, &sampler); + + // Set state objects. + deviceContext->OMSetBlendState(mDeviceResources->stateObjects.Opaque(), nullptr, 0xffffffff); + deviceContext->OMSetDepthStencilState(mDeviceResources->stateObjects.DepthNone(), 0); + deviceContext->RSSetState(mDeviceResources->stateObjects.CullNone()); + + // Set shaders. + auto vertexShader = mDeviceResources->GetVertexShader(); + auto pixelShader = mDeviceResources->GetPixelShader(fx); + + deviceContext->VSSetShader(vertexShader, nullptr, 0); + deviceContext->PSSetShader(pixelShader, nullptr, 0); + + // Set constants. + if (mDirtyFlags & Dirty_Parameters) + { + mDirtyFlags &= ~Dirty_Parameters; + mDirtyFlags |= Dirty_ConstantBuffer; + + switch (fx) + { + case Merge: + constants.sampleWeights[0] = XMVectorReplicate(mergeWeight1); + constants.sampleWeights[1] = XMVectorReplicate(mergeWeight2); + break; + + case BloomCombine: + constants.sampleWeights[0] = XMVectorSet(bloomBaseSaturation, bloomSaturation, 0.f, 0.f); + constants.sampleWeights[1] = XMVectorReplicate(bloomBaseIntensity); + constants.sampleWeights[2] = XMVectorReplicate(bloomIntensity); + break; + } + } + +#if defined(_XBOX_ONE) && defined(_TITLE) + void *grfxMemory; + mConstantBuffer.SetData(deviceContext, constants, &grfxMemory); + + Microsoft::WRL::ComPtr deviceContextX; + ThrowIfFailed(deviceContext->QueryInterface(IID_GRAPHICS_PPV_ARGS(deviceContextX.GetAddressOf()))); + + auto buffer = mConstantBuffer.GetBuffer(); + + deviceContextX->PSSetPlacementConstantBuffer(0, buffer, grfxMemory); +#else + if (mDirtyFlags & Dirty_ConstantBuffer) + { + mDirtyFlags &= ~Dirty_ConstantBuffer; + mConstantBuffer.SetData(deviceContext, constants); + } + + // Set the constant buffer. + auto buffer = mConstantBuffer.GetBuffer(); + + deviceContext->PSSetConstantBuffers(0, 1, &buffer); +#endif + + if (setCustomState) + { + setCustomState(); + } + + // Draw quad. + deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + + deviceContext->Draw(4, 0); +} + + +// Public constructor. +DualPostProcess::DualPostProcess(_In_ ID3D11Device* device) + : pImpl(new Impl(device)) +{ +} + + +// Move constructor. +DualPostProcess::DualPostProcess(DualPostProcess&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +DualPostProcess& DualPostProcess::operator= (DualPostProcess&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +DualPostProcess::~DualPostProcess() +{ +} + + +// IPostProcess methods. +void DualPostProcess::Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState) +{ + pImpl->Process(deviceContext, setCustomState); +} + + +// Shader control. +void DualPostProcess::SetEffect(Effect fx) +{ + if (fx < 0 || fx >= Effect_Max) + throw std::out_of_range("Effect not defined"); + + pImpl->fx = fx; + pImpl->SetDirtyFlag(); +} + + +// Properties +void DualPostProcess::SetSourceTexture(_In_opt_ ID3D11ShaderResourceView* value) +{ + pImpl->texture = value; +} + + +void DualPostProcess::SetSourceTexture2(_In_opt_ ID3D11ShaderResourceView* value) +{ + pImpl->texture2 = value; +} + + +void DualPostProcess::SetMergeParameters(float weight1, float weight2) +{ + pImpl->mergeWeight1 = weight1; + pImpl->mergeWeight2 = weight2; + pImpl->SetDirtyFlag(); +} + + +void DualPostProcess::SetBloomCombineParameters(float bloom, float base, float bloomSaturation, float baseSaturation) +{ + pImpl->bloomIntensity = bloom; + pImpl->bloomBaseIntensity = base; + pImpl->bloomSaturation = bloomSaturation; + pImpl->bloomBaseSaturation = baseSaturation; + pImpl->SetDirtyFlag(); +} diff --git a/DirectXTK/Src/GeometricPrimitive.cpp b/DirectXTK/Src/GeometricPrimitive.cpp index b93b5eb..70df3c6 100644 --- a/DirectXTK/Src/GeometricPrimitive.cpp +++ b/DirectXTK/Src/GeometricPrimitive.cpp @@ -81,9 +81,9 @@ class GeometricPrimitive::Impl public: 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, _In_opt_ 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, _In_opt_ 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; @@ -209,7 +209,7 @@ void XM_CALLCONV GeometricPrimitive::Impl::Draw( FXMVECTOR color, ID3D11ShaderResourceView* texture, bool wireframe, - std::function setCustomState) const + std::function& setCustomState) const { assert(mResources != 0); auto effect = mResources->effect.get(); @@ -247,7 +247,7 @@ void GeometricPrimitive::Impl::Draw( ID3D11InputLayout* inputLayout, bool alpha, bool wireframe, - std::function setCustomState) const + std::function& setCustomState) const { assert(mResources != 0); auto deviceContext = mResources->deviceContext.Get(); diff --git a/DirectXTK/Src/ModelLoadSDKMESH.cpp b/DirectXTK/Src/ModelLoadSDKMESH.cpp index e450434..06b24ec 100644 --- a/DirectXTK/Src/ModelLoadSDKMESH.cpp +++ b/DirectXTK/Src/ModelLoadSDKMESH.cpp @@ -87,21 +87,32 @@ namespace info.enableDualTexture = (flags & DUAL_TEXTURE) != 0; info.enableNormalMaps = (flags & NORMAL_MAPS) != 0; info.biasedVertexNormals = (flags & BIASED_VERTEX_NORMALS) != 0; - info.ambientColor = XMFLOAT3(mh.Ambient.x, mh.Ambient.y, mh.Ambient.z); - info.diffuseColor = XMFLOAT3(mh.Diffuse.x, mh.Diffuse.y, mh.Diffuse.z); - info.emissiveColor = XMFLOAT3(mh.Emissive.x, mh.Emissive.y, mh.Emissive.z); - if (mh.Diffuse.w != 1.f && mh.Diffuse.w != 0.f) + if (mh.Ambient.x == 0 && mh.Ambient.y == 0 && mh.Ambient.z == 0 && mh.Ambient.w == 0 + && mh.Diffuse.x == 0 && mh.Diffuse.y == 0 && mh.Diffuse.z == 0 && mh.Diffuse.w == 0) { - info.alpha = mh.Diffuse.w; + // SDKMESH material color block is uninitalized; assume defaults + info.diffuseColor = XMFLOAT3(1.f, 1.f, 1.f); + info.alpha = 1.f; } else - info.alpha = 1.f; - - if (mh.Power) { - info.specularPower = mh.Power; - info.specularColor = XMFLOAT3(mh.Specular.x, mh.Specular.y, mh.Specular.z); + info.ambientColor = XMFLOAT3(mh.Ambient.x, mh.Ambient.y, mh.Ambient.z); + info.diffuseColor = XMFLOAT3(mh.Diffuse.x, mh.Diffuse.y, mh.Diffuse.z); + info.emissiveColor = XMFLOAT3(mh.Emissive.x, mh.Emissive.y, mh.Emissive.z); + + if (mh.Diffuse.w != 1.f && mh.Diffuse.w != 0.f) + { + info.alpha = mh.Diffuse.w; + } + else + info.alpha = 1.f; + + if (mh.Power) + { + info.specularPower = mh.Power; + info.specularColor = XMFLOAT3(mh.Specular.x, mh.Specular.y, mh.Specular.z); + } } info.diffuseTexture = diffuseName; diff --git a/DirectXTK/Src/Shaders/CompileShaders.cmd b/DirectXTK/Src/Shaders/CompileShaders.cmd index 2c7b340..50b22ef 100644 --- a/DirectXTK/Src/Shaders/CompileShaders.cmd +++ b/DirectXTK/Src/Shaders/CompileShaders.cmd @@ -173,6 +173,41 @@ call :CompileShaderHLSL%1 DGSLPhong ps mainTx call :CompileShaderHLSL%1 DGSLUnlit ps mainTxTk call :CompileShaderHLSL%1 DGSLLambert ps mainTxTk call :CompileShaderHLSL%1 DGSLPhong ps mainTxTk + +call :CompileShaderSM4%1 PostProcess vs VSQuad +call :CompileShaderSM4%1 PostProcess ps PSCopy +call :CompileShaderSM4%1 PostProcess ps PSMonochrome +call :CompileShaderSM4%1 PostProcess ps PSSepia +call :CompileShaderSM4%1 PostProcess ps PSDownScale2x2 +call :CompileShaderSM4%1 PostProcess ps PSDownScale4x4 +call :CompileShaderSM4%1 PostProcess ps PSGaussianBlur5x5 +call :CompileShaderSM4%1 PostProcess ps PSBloomExtract +call :CompileShaderSM4%1 PostProcess ps PSBloomBlur +call :CompileShaderSM4%1 PostProcess ps PSMerge +call :CompileShaderSM4%1 PostProcess ps PSBloomCombine + +call :CompileShaderSM4%1 ToneMap vs VSQuad +call :CompileShaderSM4%1 ToneMap ps PSCopy +call :CompileShaderSM4%1 ToneMap ps PSSaturate +call :CompileShaderSM4%1 ToneMap ps PSReinhard +call :CompileShaderSM4%1 ToneMap ps PSACESFilmic +call :CompileShaderSM4%1 ToneMap ps PS_SRGB +call :CompileShaderSM4%1 ToneMap ps PSSaturate_SRGB +call :CompileShaderSM4%1 ToneMap ps PSReinhard_SRGB +call :CompileShaderSM4%1 ToneMap ps PSACESFilmic_SRGB +call :CompileShaderSM4%1 ToneMap ps PSHDR10 + +if NOT %1.==xbox. goto skipxboxonly + +call :CompileShaderSM4xbox ToneMap ps PSHDR10_Saturate +call :CompileShaderSM4xbox ToneMap ps PSHDR10_Reinhard +call :CompileShaderSM4xbox ToneMap ps PSHDR10_ACESFilmic +call :CompileShaderSM4xbox ToneMap ps PSHDR10_Saturate_SRGB +call :CompileShaderSM4xbox ToneMap ps PSHDR10_Reinhard_SRGB +call :CompileShaderSM4xbox ToneMap ps PSHDR10_ACESFilmic_SRGB + +:skipxboxonly + echo. if %error% == 0 ( @@ -191,6 +226,13 @@ echo %fxc% %fxc% || set error=1 exit /b +:CompileShaderSM4 +set fxc=fxc /nologo %1.fx /T%2_4_0 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3 +echo. +echo %fxc% +%fxc% || set error=1 +exit /b + :CompileShaderHLSL set fxc=fxc /nologo %1.hlsl /T%2_4_0_level_9_1 /Zi /Zpc /Qstrip_reflect /Qstrip_debug /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3 echo. @@ -199,6 +241,7 @@ echo %fxc% exit /b :CompileShaderxbox +:CompileShaderSM4xbox set fxc=%XBOXFXC% /nologo %1.fx /T%2_5_0 /Zpc /Zi /Qstrip_reflect /Qstrip_debug /D__XBOX_DISABLE_SHADER_NAME_EMPLACEMENT /E%3 /FhCompiled\XboxOne%1_%3.inc /FdCompiled\XboxOne%1_%3.pdb /Vn%1_%3 echo. echo %fxc% diff --git a/DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomBlur.inc b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomBlur.inc new file mode 100644 index 0000000..0fc2fb9 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomBlur.inc @@ -0,0 +1,136 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[32], dynamicIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 3 +mov r0.xyzw, l(0,0,0,0) +mov r1.x, l(0) +loop + ige r1.y, r1.x, l(15) + breakc_nz r1.y + add r1.yz, v1.xxyx, cb0[r1.x + 0].xxyx + sample r2.xyzw, r1.yzyy, t0.xyzw, s0 + mad r0.xyzw, cb0[r1.x + 16].xyzw, r2.xyzw, r0.xyzw + iadd r1.x, r1.x, l(1) +endloop +mov o0.xyzw, r0.xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE PostProcess_PSBloomBlur[] = +{ + 68, 88, 66, 67, 172, 241, + 144, 218, 164, 236, 105, 55, + 200, 120, 50, 4, 73, 105, + 155, 1, 1, 0, 0, 0, + 36, 2, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 100, 1, 0, 0, + 64, 0, 0, 0, 89, 0, + 0, 0, 89, 8, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 32, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 54, 0, 0, 8, 242, 0, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 18, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 1, 33, 0, 0, 7, + 34, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 15, 0, 0, 0, + 3, 0, 4, 3, 26, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 98, 0, + 16, 0, 1, 0, 0, 0, + 6, 17, 16, 0, 1, 0, + 0, 0, 6, 129, 32, 4, + 0, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 2, 0, 0, 0, + 150, 5, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 12, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 16, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 30, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 1, 0, 0, 0, 22, 0, + 0, 1, 54, 0, 0, 5, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomCombine.inc b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomCombine.inc new file mode 100644 index 0000000..3dc96ac --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomCombine.inc @@ -0,0 +1,173 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[19], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texture2d (float,float,float,float) t1 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 3 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +dp3 r1.x, r0.xyzx, l(0.212500, 0.715400, 0.072100, 0.000000) +add r0.xyzw, r0.xyzw, -r1.xxxx +mad r0.xyzw, cb0[16].xxxx, r0.xyzw, r1.xxxx +mul r0.xyzw, r0.xyzw, cb0[17].xyzw +sample r1.xyzw, v1.xyxx, t1.xyzw, s0 +dp3 r2.x, r1.xyzx, l(0.212500, 0.715400, 0.072100, 0.000000) +add r1.xyzw, r1.xyzw, -r2.xxxx +mad r1.xyzw, cb0[16].yyyy, r1.xyzw, r2.xxxx +mul r1.xyzw, r1.xyzw, cb0[18].xyzw +mov_sat r2.xyzw, r1.xyzw +add r2.xyzw, -r2.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000) +mad o0.xyzw, r0.xyzw, r2.xyzw, r1.xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE PostProcess_PSBloomCombine[] = +{ + 68, 88, 66, 67, 242, 178, + 55, 62, 204, 88, 89, 93, + 56, 103, 128, 16, 10, 110, + 154, 166, 1, 0, 0, 0, + 244, 2, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 52, 2, 0, 0, + 64, 0, 0, 0, 141, 0, + 0, 0, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 19, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 88, 24, + 0, 4, 0, 112, 16, 0, + 1, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 50, 16, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 104, 0, 0, 2, + 3, 0, 0, 0, 69, 0, + 0, 9, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 10, 18, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 154, 153, + 89, 62, 116, 36, 55, 63, + 42, 169, 147, 61, 0, 0, + 0, 0, 0, 0, 0, 8, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 6, 0, + 16, 128, 65, 0, 0, 0, + 1, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 0, 0, 0, 0, 6, 128, + 32, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 6, 0, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 8, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 69, 0, + 0, 9, 242, 0, 16, 0, + 1, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 70, 126, 16, 0, 1, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 10, 18, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 154, 153, + 89, 62, 116, 36, 55, 63, + 42, 169, 147, 61, 0, 0, + 0, 0, 0, 0, 0, 8, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 6, 0, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 50, 0, + 0, 10, 242, 0, 16, 0, + 1, 0, 0, 0, 86, 133, + 32, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 6, 0, 16, 0, 2, 0, + 0, 0, 56, 0, 0, 8, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 70, 142, + 32, 0, 0, 0, 0, 0, + 18, 0, 0, 0, 54, 32, + 0, 5, 242, 0, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 11, 242, 0, + 16, 0, 2, 0, 0, 0, + 70, 14, 16, 128, 65, 0, + 0, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 128, 63, 50, 0, 0, 9, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 2, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomExtract.inc b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomExtract.inc new file mode 100644 index 0000000..9f359de --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSBloomExtract.inc @@ -0,0 +1,109 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[17], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 2 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +add r0.xyzw, r0.xyzw, -cb0[16].xyzw +add r1.xyzw, -cb0[16].xyzw, l(1.000000, 1.000000, 1.000000, 1.000000) +div_sat o0.xyzw, r0.xyzw, r1.xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE PostProcess_PSBloomExtract[] = +{ + 68, 88, 66, 67, 171, 18, + 55, 97, 179, 14, 173, 230, + 133, 86, 96, 193, 26, 35, + 69, 7, 1, 0, 0, 0, + 172, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 236, 0, 0, 0, + 64, 0, 0, 0, 59, 0, + 0, 0, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 70, 142, 32, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 0, 0, 0, 12, 242, 0, + 16, 0, 1, 0, 0, 0, + 70, 142, 32, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 14, 32, 0, 7, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 1, 0, 0, 0, 62, 0, + 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/PostProcess_PSCopy.inc b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSCopy.inc new file mode 100644 index 0000000..3e1851b --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSCopy.inc @@ -0,0 +1,81 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +sample o0.xyzw, v1.xyxx, t0.xyzw, s0 +ret +// Approximately 0 instruction slots used +#endif + +const BYTE PostProcess_PSCopy[] = +{ + 68, 88, 66, 67, 108, 129, + 30, 239, 130, 190, 108, 21, + 28, 176, 127, 137, 202, 107, + 77, 84, 1, 0, 0, 0, + 36, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 100, 0, 0, 0, + 64, 0, 0, 0, 25, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 69, 0, 0, 9, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/PostProcess_PSDownScale2x2.inc b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSDownScale2x2.inc new file mode 100644 index 0000000..6680ce5 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSDownScale2x2.inc @@ -0,0 +1,136 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[5], dynamicIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 3 +mov r0.xyzw, l(0,0,0,0) +mov r1.x, l(0) +loop + ige r1.y, r1.x, l(4) + breakc_nz r1.y + add r1.yz, v1.xxyx, cb0[r1.x + 0].xxyx + sample r2.xyzw, r1.yzyy, t0.xyzw, s0 + add r0.xyzw, r0.xyzw, r2.xyzw + iadd r1.x, r1.x, l(1) +endloop +mul o0.xyzw, r0.xyzw, l(0.250000, 0.250000, 0.250000, 0.250000) +ret +// Approximately 0 instruction slots used +#endif + +const BYTE PostProcess_PSDownScale2x2[] = +{ + 68, 88, 66, 67, 7, 104, + 225, 181, 190, 194, 1, 95, + 237, 110, 147, 78, 75, 13, + 110, 60, 1, 0, 0, 0, + 36, 2, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 100, 1, 0, 0, + 64, 0, 0, 0, 89, 0, + 0, 0, 89, 8, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 5, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 54, 0, 0, 8, 242, 0, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 18, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 1, 33, 0, 0, 7, + 34, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 4, 0, 0, 0, + 3, 0, 4, 3, 26, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 98, 0, + 16, 0, 1, 0, 0, 0, + 6, 17, 16, 0, 1, 0, + 0, 0, 6, 129, 32, 4, + 0, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 2, 0, 0, 0, + 150, 5, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 30, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 1, 0, + 0, 0, 22, 0, 0, 1, + 56, 0, 0, 10, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 62, 0, 0, + 128, 62, 0, 0, 128, 62, + 0, 0, 128, 62, 62, 0, + 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/PostProcess_PSDownScale4x4.inc b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSDownScale4x4.inc new file mode 100644 index 0000000..9e95dc9 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSDownScale4x4.inc @@ -0,0 +1,136 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[16], dynamicIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 3 +mov r0.xyzw, l(0,0,0,0) +mov r1.x, l(0) +loop + ige r1.y, r1.x, l(16) + breakc_nz r1.y + add r1.yz, v1.xxyx, cb0[r1.x + 0].xxyx + sample r2.xyzw, r1.yzyy, t0.xyzw, s0 + add r0.xyzw, r0.xyzw, r2.xyzw + iadd r1.x, r1.x, l(1) +endloop +mul o0.xyzw, r0.xyzw, l(0.062500, 0.062500, 0.062500, 0.062500) +ret +// Approximately 0 instruction slots used +#endif + +const BYTE PostProcess_PSDownScale4x4[] = +{ + 68, 88, 66, 67, 87, 14, + 245, 134, 119, 2, 187, 63, + 77, 159, 202, 100, 38, 237, + 73, 148, 1, 0, 0, 0, + 36, 2, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 100, 1, 0, 0, + 64, 0, 0, 0, 89, 0, + 0, 0, 89, 8, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 54, 0, 0, 8, 242, 0, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 18, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 1, 33, 0, 0, 7, + 34, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 16, 0, 0, 0, + 3, 0, 4, 3, 26, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 98, 0, + 16, 0, 1, 0, 0, 0, + 6, 17, 16, 0, 1, 0, + 0, 0, 6, 129, 32, 4, + 0, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 2, 0, 0, 0, + 150, 5, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 30, 0, + 0, 7, 18, 0, 16, 0, + 1, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 1, 64, 0, 0, 1, 0, + 0, 0, 22, 0, 0, 1, + 56, 0, 0, 10, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 14, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 61, 0, 0, + 128, 61, 0, 0, 128, 61, + 0, 0, 128, 61, 62, 0, + 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/PostProcess_PSGaussianBlur5x5.inc b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSGaussianBlur5x5.inc new file mode 100644 index 0000000..55c29df --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSGaussianBlur5x5.inc @@ -0,0 +1,136 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[30], dynamicIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 3 +mov r0.xyzw, l(0,0,0,0) +mov r1.x, l(0) +loop + ige r1.y, r1.x, l(13) + breakc_nz r1.y + add r1.yz, v1.xxyx, cb0[r1.x + 0].xxyx + sample r2.xyzw, r1.yzyy, t0.xyzw, s0 + mad r0.xyzw, cb0[r1.x + 16].xyzw, r2.xyzw, r0.xyzw + iadd r1.x, r1.x, l(1) +endloop +mov o0.xyzw, r0.xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE PostProcess_PSGaussianBlur5x5[] = +{ + 68, 88, 66, 67, 144, 251, + 222, 235, 96, 204, 56, 54, + 127, 250, 246, 200, 224, 60, + 209, 131, 1, 0, 0, 0, + 36, 2, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 100, 1, 0, 0, + 64, 0, 0, 0, 89, 0, + 0, 0, 89, 8, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 30, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 54, 0, 0, 8, 242, 0, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 18, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 48, 0, + 0, 1, 33, 0, 0, 7, + 34, 0, 16, 0, 1, 0, + 0, 0, 10, 0, 16, 0, + 1, 0, 0, 0, 1, 64, + 0, 0, 13, 0, 0, 0, + 3, 0, 4, 3, 26, 0, + 16, 0, 1, 0, 0, 0, + 0, 0, 0, 9, 98, 0, + 16, 0, 1, 0, 0, 0, + 6, 17, 16, 0, 1, 0, + 0, 0, 6, 129, 32, 4, + 0, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 2, 0, 0, 0, + 150, 5, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 12, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 6, 0, 0, + 0, 0, 16, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 2, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 30, 0, 0, 7, 18, 0, + 16, 0, 1, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 1, 0, 0, 0, 22, 0, + 0, 1, 54, 0, 0, 5, + 242, 32, 16, 0, 0, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/PostProcess_PSMerge.inc b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSMerge.inc new file mode 100644 index 0000000..deac164 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSMerge.inc @@ -0,0 +1,112 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[18], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_resource_texture2d (float,float,float,float) t1 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 2 +sample r0.xyzw, v1.xyxx, t1.xyzw, s0 +mul r0.xyzw, r0.xyzw, cb0[17].xyzw +sample r1.xyzw, v1.xyxx, t0.xyzw, s0 +mad o0.xyzw, cb0[16].xyzw, r1.xyzw, r0.xyzw +ret +// Approximately 0 instruction slots used +#endif + +const BYTE PostProcess_PSMerge[] = +{ + 68, 88, 66, 67, 111, 53, + 218, 89, 135, 6, 8, 132, + 24, 252, 103, 90, 171, 120, + 13, 182, 1, 0, 0, 0, + 184, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 248, 0, 0, 0, + 64, 0, 0, 0, 62, 0, + 0, 0, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 18, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 88, 24, + 0, 4, 0, 112, 16, 0, + 1, 0, 0, 0, 85, 85, + 0, 0, 98, 16, 0, 3, + 50, 16, 16, 0, 1, 0, + 0, 0, 101, 0, 0, 3, + 242, 32, 16, 0, 0, 0, + 0, 0, 104, 0, 0, 2, + 2, 0, 0, 0, 69, 0, + 0, 9, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 70, 126, 16, 0, 1, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 242, 0, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 17, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 1, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 10, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 142, 32, 0, 0, 0, + 0, 0, 16, 0, 0, 0, + 70, 14, 16, 0, 1, 0, + 0, 0, 70, 14, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/PostProcess_PSMonochrome.inc b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSMonochrome.inc new file mode 100644 index 0000000..f719f0a --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSMonochrome.inc @@ -0,0 +1,95 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 1 +sample r0.xyzw, v1.xyxx, t0.xwyz, s0 +dp3 r0.x, r0.xzwx, l(0.212500, 0.715400, 0.072100, 0.000000) +mov o0.xyzw, r0.xxxy +ret +// Approximately 0 instruction slots used +#endif + +const BYTE PostProcess_PSMonochrome[] = +{ + 68, 88, 66, 67, 223, 136, + 63, 187, 209, 86, 5, 50, + 228, 92, 107, 23, 87, 189, + 42, 225, 1, 0, 0, 0, + 104, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 168, 0, 0, 0, + 64, 0, 0, 0, 42, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 104, 0, 0, 2, 1, 0, + 0, 0, 69, 0, 0, 9, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 198, 121, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 10, + 18, 0, 16, 0, 0, 0, + 0, 0, 134, 3, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 154, 153, 89, 62, + 116, 36, 55, 63, 42, 169, + 147, 61, 0, 0, 0, 0, + 54, 0, 0, 5, 242, 32, + 16, 0, 0, 0, 0, 0, + 6, 4, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/PostProcess_PSSepia.inc b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSSepia.inc new file mode 100644 index 0000000..44940c9 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/PostProcess_PSSepia.inc @@ -0,0 +1,111 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 1 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +dp3 o0.x, r0.xyzx, l(0.393000, 0.769000, 0.189000, 0.000000) +dp3 o0.y, r0.xyzx, l(0.349000, 0.686000, 0.168000, 0.000000) +dp3 o0.z, r0.xyzx, l(0.272000, 0.534000, 0.131000, 0.000000) +mov o0.w, r0.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE PostProcess_PSSepia[] = +{ + 68, 88, 66, 67, 128, 113, + 162, 217, 39, 7, 231, 30, + 114, 101, 237, 124, 70, 126, + 192, 247, 1, 0, 0, 0, + 184, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 248, 0, 0, 0, + 64, 0, 0, 0, 62, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 104, 0, 0, 2, 1, 0, + 0, 0, 69, 0, 0, 9, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 10, + 18, 32, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 76, 55, 201, 62, + 47, 221, 68, 63, 55, 137, + 65, 62, 0, 0, 0, 0, + 16, 0, 0, 10, 34, 32, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 33, 176, 178, 62, 178, 157, + 47, 63, 49, 8, 44, 62, + 0, 0, 0, 0, 16, 0, + 0, 10, 66, 32, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 150, 67, + 139, 62, 57, 180, 8, 63, + 221, 36, 6, 62, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/PostProcess_VSQuad.inc b/DirectXTK/Src/Shaders/Compiled/PostProcess_VSQuad.inc new file mode 100644 index 0000000..dd02a2b --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/PostProcess_VSQuad.inc @@ -0,0 +1,119 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_VertexId 0 x 0 VERTID uint x +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +vs_4_0 +dcl_input_sgv v0.x, vertex_id +dcl_output_siv o0.xyzw, position +dcl_output o1.xy +dcl_temps 1 +mov o0.zw, l(0,0,0,1.000000) +and r0.x, v0.x, l(1) +ushr r0.z, v0.x, l(1) +utof r0.xy, r0.xzxx +add r0.zw, r0.xxxy, l(0.000000, 0.000000, -0.500000, -0.500000) +mov o1.xy, r0.xyxx +add o0.x, r0.z, r0.z +mul o0.y, r0.w, l(-2.000000) +ret +// Approximately 0 instruction slots used +#endif + +const BYTE PostProcess_VSQuad[] = +{ + 68, 88, 66, 67, 141, 120, + 239, 206, 52, 223, 131, 56, + 184, 188, 219, 176, 80, 69, + 20, 97, 1, 0, 0, 0, + 224, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 96, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 0, 0, + 83, 86, 95, 86, 101, 114, + 116, 101, 120, 73, 100, 0, + 79, 83, 71, 78, 80, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 12, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 83, 72, + 68, 82, 32, 1, 0, 0, + 64, 0, 1, 0, 72, 0, + 0, 0, 96, 0, 0, 4, + 18, 16, 16, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 1, 0, 0, 0, 104, 0, + 0, 2, 1, 0, 0, 0, + 54, 0, 0, 8, 194, 32, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 128, 63, 1, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 16, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 1, 0, 0, 0, + 85, 0, 0, 7, 66, 0, + 16, 0, 0, 0, 0, 0, + 10, 16, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 1, 0, 0, 0, 86, 0, + 0, 5, 50, 0, 16, 0, + 0, 0, 0, 0, 134, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 10, 194, 0, + 16, 0, 0, 0, 0, 0, + 6, 4, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 191, + 0, 0, 0, 191, 54, 0, + 0, 5, 50, 32, 16, 0, + 1, 0, 0, 0, 70, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 18, 32, + 16, 0, 0, 0, 0, 0, + 42, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 34, 32, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 192, 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/ToneMap_PSACESFilmic.inc b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSACESFilmic.inc new file mode 100644 index 0000000..0865bb4 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSACESFilmic.inc @@ -0,0 +1,140 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 3 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +mul r0.xyz, r0.xyzx, cb0[0].xxxx +mov o0.w, r0.w +mad r1.xyz, r0.xyzx, l(2.510000, 2.510000, 2.510000, 0.000000), l(0.030000, 0.030000, 0.030000, 0.000000) +mul r1.xyz, r0.xyzx, r1.xyzx +mad r2.xyz, r0.xyzx, l(2.430000, 2.430000, 2.430000, 0.000000), l(0.590000, 0.590000, 0.590000, 0.000000) +mad r0.xyz, r0.xyzx, r2.xyzx, l(0.140000, 0.140000, 0.140000, 0.000000) +div_sat o0.xyz, r1.xyzx, r0.xyzx +ret +// Approximately 0 instruction slots used +#endif + +const BYTE ToneMap_PSACESFilmic[] = +{ + 68, 88, 66, 67, 64, 246, + 93, 24, 102, 253, 15, 247, + 109, 62, 229, 230, 5, 254, + 203, 169, 1, 0, 0, 0, + 80, 2, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 144, 1, 0, 0, + 64, 0, 0, 0, 100, 0, + 0, 0, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 15, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 215, 163, + 32, 64, 215, 163, 32, 64, + 215, 163, 32, 64, 0, 0, + 0, 0, 2, 64, 0, 0, + 143, 194, 245, 60, 143, 194, + 245, 60, 143, 194, 245, 60, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 15, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 31, 133, 27, 64, + 31, 133, 27, 64, 31, 133, + 27, 64, 0, 0, 0, 0, + 2, 64, 0, 0, 61, 10, + 23, 63, 61, 10, 23, 63, + 61, 10, 23, 63, 0, 0, + 0, 0, 50, 0, 0, 12, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 41, 92, + 15, 62, 41, 92, 15, 62, + 41, 92, 15, 62, 0, 0, + 0, 0, 14, 32, 0, 7, + 114, 32, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/ToneMap_PSACESFilmic_SRGB.inc b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSACESFilmic_SRGB.inc new file mode 100644 index 0000000..389a495 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSACESFilmic_SRGB.inc @@ -0,0 +1,156 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 3 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +mul r0.xyz, r0.xyzx, cb0[0].xxxx +mov o0.w, r0.w +mad r1.xyz, r0.xyzx, l(2.510000, 2.510000, 2.510000, 0.000000), l(0.030000, 0.030000, 0.030000, 0.000000) +mul r1.xyz, r0.xyzx, r1.xyzx +mad r2.xyz, r0.xyzx, l(2.430000, 2.430000, 2.430000, 0.000000), l(0.590000, 0.590000, 0.590000, 0.000000) +mad r0.xyz, r0.xyzx, r2.xyzx, l(0.140000, 0.140000, 0.140000, 0.000000) +div_sat r0.xyz, r1.xyzx, r0.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000) +exp o0.xyz, r0.xyzx +ret +// Approximately 0 instruction slots used +#endif + +const BYTE ToneMap_PSACESFilmic_SRGB[] = +{ + 68, 88, 66, 67, 173, 239, + 88, 1, 231, 89, 20, 11, + 118, 182, 104, 134, 53, 174, + 14, 103, 1, 0, 0, 0, + 160, 2, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 224, 1, 0, 0, + 64, 0, 0, 0, 120, 0, + 0, 0, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 3, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 50, 0, + 0, 15, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 215, 163, + 32, 64, 215, 163, 32, 64, + 215, 163, 32, 64, 0, 0, + 0, 0, 2, 64, 0, 0, + 143, 194, 245, 60, 143, 194, + 245, 60, 143, 194, 245, 60, + 0, 0, 0, 0, 56, 0, + 0, 7, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 50, 0, 0, 15, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 31, 133, 27, 64, + 31, 133, 27, 64, 31, 133, + 27, 64, 0, 0, 0, 0, + 2, 64, 0, 0, 61, 10, + 23, 63, 61, 10, 23, 63, + 61, 10, 23, 63, 0, 0, + 0, 0, 50, 0, 0, 12, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 41, 92, + 15, 62, 41, 92, 15, 62, + 41, 92, 15, 62, 0, 0, + 0, 0, 14, 32, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 47, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 47, 186, 232, 62, + 47, 186, 232, 62, 47, 186, + 232, 62, 0, 0, 0, 0, + 25, 0, 0, 5, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/ToneMap_PSCopy.inc b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSCopy.inc new file mode 100644 index 0000000..cc2b52f --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSCopy.inc @@ -0,0 +1,81 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +sample o0.xyzw, v1.xyxx, t0.xyzw, s0 +ret +// Approximately 0 instruction slots used +#endif + +const BYTE ToneMap_PSCopy[] = +{ + 68, 88, 66, 67, 108, 129, + 30, 239, 130, 190, 108, 21, + 28, 176, 127, 137, 202, 107, + 77, 84, 1, 0, 0, 0, + 36, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 100, 0, 0, 0, + 64, 0, 0, 0, 25, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 69, 0, 0, 9, 242, 32, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/ToneMap_PSHDR10.inc b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSHDR10.inc new file mode 100644 index 0000000..ff06990 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSHDR10.inc @@ -0,0 +1,189 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 2 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +dp3 r1.x, l(0.627404, 0.329282, 0.043314, 0.000000), r0.xyzx +dp3 r1.y, l(0.069097, 0.919540, 0.011361, 0.000000), r0.xyzx +dp3 r1.z, l(0.016392, 0.088013, 0.895595, 0.000000), r0.xyzx +mov o0.w, r0.w +mul r0.xyz, r1.xyzx, cb0[0].yyyy +mul r0.xyz, r0.xyzx, l(0.000100, 0.000100, 0.000100, 0.000000) +log r0.xyz, |r0.xyzx| +mul r0.xyz, r0.xyzx, l(0.159302, 0.159302, 0.159302, 0.000000) +exp r0.xyz, r0.xyzx +mad r1.xyz, r0.xyzx, l(18.851563, 18.851563, 18.851563, 0.000000), l(0.835938, 0.835938, 0.835938, 0.000000) +mad r0.xyz, r0.xyzx, l(18.687500, 18.687500, 18.687500, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000) +div r0.xyz, r1.xyzx, r0.xyzx +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, l(78.843750, 78.843750, 78.843750, 0.000000) +exp o0.xyz, r0.xyzx +ret +// Approximately 0 instruction slots used +#endif + +const BYTE ToneMap_PSHDR10[] = +{ + 68, 88, 66, 67, 134, 120, + 193, 176, 6, 217, 254, 46, + 47, 155, 215, 110, 125, 224, + 213, 122, 1, 0, 0, 0, + 72, 3, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 136, 2, 0, 0, + 64, 0, 0, 0, 162, 0, + 0, 0, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 10, 18, 0, + 16, 0, 1, 0, 0, 0, + 2, 64, 0, 0, 140, 157, + 32, 63, 166, 151, 168, 62, + 154, 105, 49, 61, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 16, 0, + 0, 10, 34, 0, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 186, 130, 141, 61, + 249, 102, 107, 63, 84, 36, + 58, 60, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 10, + 66, 0, 16, 0, 1, 0, + 0, 0, 2, 64, 0, 0, + 173, 71, 134, 60, 68, 64, + 180, 61, 183, 69, 101, 63, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 86, 133, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 23, 183, + 209, 56, 23, 183, 209, 56, + 23, 183, 209, 56, 0, 0, + 0, 0, 47, 0, 0, 6, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 128, + 129, 0, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 32, 35, 62, + 0, 32, 35, 62, 0, 32, + 35, 62, 0, 0, 0, 0, + 25, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 50, 0, 0, 15, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 208, 150, 65, + 0, 208, 150, 65, 0, 208, + 150, 65, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 86, 63, 0, 0, 86, 63, + 0, 0, 86, 63, 0, 0, + 0, 0, 50, 0, 0, 15, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 128, 149, 65, + 0, 128, 149, 65, 0, 128, + 149, 65, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 0, 0, 14, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 47, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 176, 157, 66, + 0, 176, 157, 66, 0, 176, + 157, 66, 0, 0, 0, 0, + 25, 0, 0, 5, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/ToneMap_PSReinhard.inc b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSReinhard.inc new file mode 100644 index 0000000..69fb6c3 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSReinhard.inc @@ -0,0 +1,113 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 2 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +mul r1.xyz, r0.xyzx, cb0[0].xxxx +mad r0.xyz, r0.xyzx, cb0[0].xxxx, l(1.000000, 1.000000, 1.000000, 0.000000) +mov o0.w, r0.w +div o0.xyz, r1.xyzx, r0.xyzx +ret +// Approximately 0 instruction slots used +#endif + +const BYTE ToneMap_PSReinhard[] = +{ + 68, 88, 66, 67, 115, 103, + 22, 225, 226, 48, 165, 189, + 78, 48, 254, 136, 10, 133, + 40, 112, 1, 0, 0, 0, + 192, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 0, 1, 0, 0, + 64, 0, 0, 0, 64, 0, + 0, 0, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 13, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 6, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 14, 0, 0, 7, + 114, 32, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/ToneMap_PSReinhard_SRGB.inc b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSReinhard_SRGB.inc new file mode 100644 index 0000000..a57abdf --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSReinhard_SRGB.inc @@ -0,0 +1,130 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 2 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +mul r1.xyz, r0.xyzx, cb0[0].xxxx +mad r0.xyz, r0.xyzx, cb0[0].xxxx, l(1.000000, 1.000000, 1.000000, 0.000000) +mov o0.w, r0.w +div r0.xyz, r1.xyzx, r0.xyzx +log r0.xyz, |r0.xyzx| +mul r0.xyz, r0.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000) +exp o0.xyz, r0.xyzx +ret +// Approximately 0 instruction slots used +#endif + +const BYTE ToneMap_PSReinhard_SRGB[] = +{ + 68, 88, 66, 67, 57, 227, + 234, 239, 176, 217, 183, 250, + 229, 25, 59, 13, 250, 49, + 198, 13, 1, 0, 0, 0, + 20, 2, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 84, 1, 0, 0, + 64, 0, 0, 0, 85, 0, + 0, 0, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 2, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 8, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 50, 0, 0, 13, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 6, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 0, 0, + 54, 0, 0, 5, 130, 32, + 16, 0, 0, 0, 0, 0, + 58, 0, 16, 0, 0, 0, + 0, 0, 14, 0, 0, 7, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 47, 0, 0, 6, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 128, 129, 0, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 47, 186, 232, 62, 47, 186, + 232, 62, 47, 186, 232, 62, + 0, 0, 0, 0, 25, 0, + 0, 5, 114, 32, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/ToneMap_PSSaturate.inc b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSSaturate.inc new file mode 100644 index 0000000..052cc96 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSSaturate.inc @@ -0,0 +1,98 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 1 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +mul_sat o0.xyz, r0.xyzx, cb0[0].xxxx +mov o0.w, r0.w +ret +// Approximately 0 instruction slots used +#endif + +const BYTE ToneMap_PSSaturate[] = +{ + 68, 88, 66, 67, 74, 164, + 55, 248, 55, 5, 223, 243, + 66, 186, 89, 42, 66, 172, + 83, 127, 1, 0, 0, 0, + 112, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 176, 0, 0, 0, + 64, 0, 0, 0, 44, 0, + 0, 0, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 1, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 56, 32, 0, 8, 114, 32, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/ToneMap_PSSaturate_SRGB.inc b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSSaturate_SRGB.inc new file mode 100644 index 0000000..fef9b26 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/ToneMap_PSSaturate_SRGB.inc @@ -0,0 +1,114 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_constantbuffer CB0[1], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 1 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +mul_sat r0.xyz, r0.xyzx, cb0[0].xxxx +mov o0.w, r0.w +log r0.xyz, r0.xyzx +mul r0.xyz, r0.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000) +exp o0.xyz, r0.xyzx +ret +// Approximately 0 instruction slots used +#endif + +const BYTE ToneMap_PSSaturate_SRGB[] = +{ + 68, 88, 66, 67, 178, 67, + 199, 228, 117, 215, 182, 102, + 49, 24, 196, 144, 159, 179, + 114, 157, 1, 0, 0, 0, + 192, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 0, 1, 0, 0, + 64, 0, 0, 0, 64, 0, + 0, 0, 89, 0, 0, 4, + 70, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 90, 0, 0, 3, 0, 96, + 16, 0, 0, 0, 0, 0, + 88, 24, 0, 4, 0, 112, + 16, 0, 0, 0, 0, 0, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 1, 0, 0, 0, + 69, 0, 0, 9, 242, 0, + 16, 0, 0, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 56, 32, 0, 8, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 6, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 47, 0, + 0, 5, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 0, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 47, 186, 232, 62, 47, 186, + 232, 62, 47, 186, 232, 62, + 0, 0, 0, 0, 25, 0, + 0, 5, 114, 32, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/ToneMap_PS_SRGB.inc b/DirectXTK/Src/Shaders/Compiled/ToneMap_PS_SRGB.inc new file mode 100644 index 0000000..9a5012c --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/ToneMap_PS_SRGB.inc @@ -0,0 +1,105 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_4_0 +dcl_sampler s0, mode_default +dcl_resource_texture2d (float,float,float,float) t0 +dcl_input_ps linear v1.xy +dcl_output o0.xyzw +dcl_temps 1 +sample r0.xyzw, v1.xyxx, t0.xyzw, s0 +log r0.xyz, |r0.xyzx| +mov o0.w, r0.w +mul r0.xyz, r0.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000) +exp o0.xyz, r0.xyzx +ret +// Approximately 0 instruction slots used +#endif + +const BYTE ToneMap_PS_SRGB[] = +{ + 68, 88, 66, 67, 162, 217, + 196, 65, 176, 181, 217, 116, + 30, 75, 91, 141, 251, 6, + 236, 10, 1, 0, 0, 0, + 148, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 132, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 80, 0, 0, 0, 2, 0, + 0, 0, 8, 0, 0, 0, + 56, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, + 68, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 1, 0, + 0, 0, 3, 3, 0, 0, + 83, 86, 95, 80, 111, 115, + 105, 116, 105, 111, 110, 0, + 84, 69, 88, 67, 79, 79, + 82, 68, 0, 171, 171, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 97, 114, 103, 101, + 116, 0, 171, 171, 83, 72, + 68, 82, 212, 0, 0, 0, + 64, 0, 0, 0, 53, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 24, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 1, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 104, 0, 0, 2, 1, 0, + 0, 0, 69, 0, 0, 9, + 242, 0, 16, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 1, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 47, 0, 0, 6, + 114, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 128, + 129, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 130, 32, 16, 0, 0, 0, + 0, 0, 58, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 70, 2, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 47, 186, + 232, 62, 47, 186, 232, 62, + 47, 186, 232, 62, 0, 0, + 0, 0, 25, 0, 0, 5, + 114, 32, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 0, 0, 0, 0, 62, 0, + 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/Compiled/ToneMap_VSQuad.inc b/DirectXTK/Src/Shaders/Compiled/ToneMap_VSQuad.inc new file mode 100644 index 0000000..9190593 --- /dev/null +++ b/DirectXTK/Src/Shaders/Compiled/ToneMap_VSQuad.inc @@ -0,0 +1,119 @@ +#if 0 +// +// Generated by Microsoft (R) D3D Shader Disassembler +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_VertexId 0 x 0 VERTID uint x +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// +vs_4_0 +dcl_input_sgv v0.x, vertex_id +dcl_output_siv o0.xyzw, position +dcl_output o1.xy +dcl_temps 1 +mov o0.zw, l(0,0,0,1.000000) +and r0.x, v0.x, l(1) +ushr r0.z, v0.x, l(1) +utof r0.xy, r0.xzxx +add r0.zw, r0.xxxy, l(0.000000, 0.000000, -0.500000, -0.500000) +mov o1.xy, r0.xyxx +add o0.x, r0.z, r0.z +mul o0.y, r0.w, l(-2.000000) +ret +// Approximately 0 instruction slots used +#endif + +const BYTE ToneMap_VSQuad[] = +{ + 68, 88, 66, 67, 141, 120, + 239, 206, 52, 223, 131, 56, + 184, 188, 219, 176, 80, 69, + 20, 97, 1, 0, 0, 0, + 224, 1, 0, 0, 3, 0, + 0, 0, 44, 0, 0, 0, + 96, 0, 0, 0, 184, 0, + 0, 0, 73, 83, 71, 78, + 44, 0, 0, 0, 1, 0, + 0, 0, 8, 0, 0, 0, + 32, 0, 0, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 0, 0, + 83, 86, 95, 86, 101, 114, + 116, 101, 120, 73, 100, 0, + 79, 83, 71, 78, 80, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 68, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 3, 12, 0, 0, 83, 86, + 95, 80, 111, 115, 105, 116, + 105, 111, 110, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 171, 171, 171, 83, 72, + 68, 82, 32, 1, 0, 0, + 64, 0, 1, 0, 72, 0, + 0, 0, 96, 0, 0, 4, + 18, 16, 16, 0, 0, 0, + 0, 0, 6, 0, 0, 0, + 103, 0, 0, 4, 242, 32, + 16, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 101, 0, + 0, 3, 50, 32, 16, 0, + 1, 0, 0, 0, 104, 0, + 0, 2, 1, 0, 0, 0, + 54, 0, 0, 8, 194, 32, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 128, 63, 1, 0, 0, 7, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 16, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 1, 0, 0, 0, + 85, 0, 0, 7, 66, 0, + 16, 0, 0, 0, 0, 0, + 10, 16, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 1, 0, 0, 0, 86, 0, + 0, 5, 50, 0, 16, 0, + 0, 0, 0, 0, 134, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 10, 194, 0, + 16, 0, 0, 0, 0, 0, + 6, 4, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 191, + 0, 0, 0, 191, 54, 0, + 0, 5, 50, 32, 16, 0, + 1, 0, 0, 0, 70, 0, + 16, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 18, 32, + 16, 0, 0, 0, 0, 0, + 42, 0, 16, 0, 0, 0, + 0, 0, 42, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 34, 32, 16, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 0, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 192, 62, 0, 0, 1 +}; diff --git a/DirectXTK/Src/Shaders/PostProcess.fx b/DirectXTK/Src/Shaders/PostProcess.fx new file mode 100644 index 0000000..7eab775 --- /dev/null +++ b/DirectXTK/Src/Shaders/PostProcess.fx @@ -0,0 +1,181 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 + +static const int MAX_SAMPLES = 16; + + +Texture2D Texture : register(t0); +sampler Sampler : register(s0); + + +cbuffer Parameters : register(b0) +{ + float4 sampleOffsets[MAX_SAMPLES]; + float4 sampleWeights[MAX_SAMPLES]; +}; + + +#include "Structures.fxh" + + +// Vertex shader: self-created quad. +VSInputTx VSQuad(uint vI : SV_VertexId) +{ + VSInputTx vout; + + float2 texcoord = float2(vI & 1, vI >> 1); + vout.TexCoord = texcoord; + + vout.Position = float4((texcoord.x - 0.5f) * 2, -(texcoord.y - 0.5f) * 2, 0, 1); + return vout; +} + + +//-------------------------------------------------------------------------------------- +// Pixel shader: copy. +float4 PSCopy(VSInputTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord); + return color; +} + + +// Pixel shader: monochrome. +float4 PSMonochrome(VSInputTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord); + float3 grayscale = float3(0.2125f, 0.7154f, 0.0721f); + float3 output = dot(color.rgb, grayscale); + return float4(output, color.a); +} + + +// Pixel shader: sepia. +float4 PSSepia(VSInputTx pin) : SV_Target0 +{ + float4 color = Texture.Sample(Sampler, pin.TexCoord); + + float3 red = float3(0.393f, 0.769f, 0.189f); + float3 green = float3(0.349f, 0.686f, 0.168f); + float3 blue = float3(0.272f, 0.534f, 0.131f); + + float3 output; + output.r = dot(color.rgb, red); + output.g = dot(color.rgb, green); + output.b = dot(color.rgb, blue); + return float4(output, color.a); +} + + +// Pixel shader: down-sample 2x2. +float4 PSDownScale2x2(VSInputTx pin) : SV_Target0 +{ + const int NUM_SAMPLES = 4; + float4 vColor = 0.0f; + + for( int i=0; i < NUM_SAMPLES; i++ ) + { + vColor += Texture.Sample(Sampler, pin.TexCoord + sampleOffsets[i].xy); + } + + return vColor / NUM_SAMPLES; +} + + +// Pixel shader: down-sample 4x4. +float4 PSDownScale4x4(VSInputTx pin) : SV_Target0 +{ + const int NUM_SAMPLES = 16; + float4 vColor = 0.0f; + + for (int i = 0; i < NUM_SAMPLES; i++) + { + vColor += Texture.Sample(Sampler, pin.TexCoord + sampleOffsets[i].xy); + } + + return vColor / NUM_SAMPLES; +} + + +// Pixel shader: gaussian blur 5x5. +float4 PSGaussianBlur5x5(VSInputTx pin) : SV_Target0 +{ + float4 vColor = 0.0f; + + for (int i = 0; i < 13; i++) + { + vColor += sampleWeights[i] * Texture.Sample(Sampler, pin.TexCoord + sampleOffsets[i].xy); + } + + return vColor; +} + + +// Pixel shader: bloom (extract) +float4 PSBloomExtract(VSInputTx pin) : SV_Target0 +{ + // Uses sampleWeights[0] as 'bloom threshold' + float4 c = Texture.Sample(Sampler, pin.TexCoord); + return saturate((c - sampleWeights[0]) / (1 - sampleWeights[0])); +} + + +// Pixel shader: bloom (blur) +float4 PSBloomBlur(VSInputTx pin) : SV_Target0 +{ + float4 vColor = 0.0f; + + // Perform a one-directional gaussian blur + for (int i = 0; i < 15; i++) + { + vColor += sampleWeights[i] * Texture.Sample(Sampler, pin.TexCoord + sampleOffsets[i].xy); + } + + return vColor; +} + + +//-------------------------------------------------------------------------------------- +Texture2D Texture2 : register(t1); + +// Pixel shader: merge +float4 PSMerge(VSInputTx pin) : SV_Target0 +{ + float4 vColor = sampleWeights[0] * Texture.Sample(Sampler, pin.TexCoord); + vColor += sampleWeights[1] * Texture2.Sample(Sampler, pin.TexCoord); + return vColor; +} + + +// Pixel shader: bloom (combine) +float4 AdjustSaturation(float4 color, float saturation) +{ + float3 grayscale = float3(0.2125f, 0.7154f, 0.0721f); + float gray = dot(color.rgb, grayscale); + return lerp(gray, color, saturation); +} + +float4 PSBloomCombine(VSInputTx pin) : SV_Target0 +{ + // Uses sampleWeights[0].x as base saturation, sampleWeights[0].y as bloom saturation + // Uses sampleWeights[1] as base intensity; sampleWeights[2] as bloom intensity + float4 base = Texture.Sample(Sampler, pin.TexCoord); + float4 bloom = Texture2.Sample(Sampler, pin.TexCoord); + + // Adjust color saturation and intensity. + base = AdjustSaturation(base, sampleWeights[0].x) * sampleWeights[1]; + bloom = AdjustSaturation(bloom, sampleWeights[0].y) * sampleWeights[2]; + + // Darken down the base image in areas where there is a lot of bloom, + // to prevent things looking excessively burned-out. + base *= (1 - saturate(bloom)); + + // Combine the two images. + return base + bloom; +} diff --git a/DirectXTK/Src/Shaders/ToneMap.fx b/DirectXTK/Src/Shaders/ToneMap.fx new file mode 100644 index 0000000..8b5f097 --- /dev/null +++ b/DirectXTK/Src/Shaders/ToneMap.fx @@ -0,0 +1,231 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 + +Texture2D HDRTexture : register(t0); +sampler Sampler : register(s0); + + +cbuffer Parameters : register(b0) +{ + float linearExposure : packoffset(c0.x); + float paperWhiteNits : packoffset(c0.y); +}; + + + +#include "Structures.fxh" +#include "Utilities.fxh" + + +// Vertex shader: self-created quad. +VSInputTx VSQuad(uint vI : SV_VertexId) +{ + VSInputTx vout; + + float2 texcoord = float2(vI & 1, vI >> 1); + vout.TexCoord = texcoord; + + vout.Position = float4((texcoord.x - 0.5f) * 2, -(texcoord.y - 0.5f) * 2, 0, 1); + return vout; +} + + +//-------------------------------------------------------------------------------------- +// Pixel shader: pass-through +float4 PSCopy(VSInputTx pin) : SV_Target0 +{ + return HDRTexture.Sample(Sampler, pin.TexCoord); +} + + +// Pixel shader: saturate (clips above 1.0) +float4 PSSaturate(VSInputTx pin) : SV_Target0 +{ + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 sdr = saturate(hdr.xyz * linearExposure); + return float4(sdr, hdr.a); +} + + +// Pixel shader: reinhard operator +float4 PSReinhard(VSInputTx pin) : SV_Target0 +{ + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 sdr = ToneMapReinhard(hdr.xyz * linearExposure); + return float4(sdr, hdr.a); +} + + +// Pixel shader: ACES filmic operator +float4 PSACESFilmic(VSInputTx pin) : SV_Target0 +{ + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 sdr = ToneMapACESFilmic(hdr.xyz * linearExposure); + return float4(sdr, hdr.a); +} + + +//-------------------------------------------------------------------------------------- +// SRGB, using Rec.709 color primaries and a gamma 2.2 curve + +// Pixel shader: sRGB +float4 PS_SRGB(VSInputTx pin) : SV_Target0 +{ + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 srgb = LinearToSRGBEst(hdr.xyz); + return float4(srgb, hdr.a); +} + + +// Pixel shader: saturate (clips above 1.0) +float4 PSSaturate_SRGB(VSInputTx pin) : SV_Target0 +{ + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 sdr = saturate(hdr.xyz * linearExposure); + float3 srgb = LinearToSRGBEst(sdr); + return float4(srgb, hdr.a); +} + + +// Pixel shader: reinhard operator +float4 PSReinhard_SRGB(VSInputTx pin) : SV_Target0 +{ + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 sdr = ToneMapReinhard(hdr.xyz * linearExposure); + float3 srgb = LinearToSRGBEst(sdr); + return float4(srgb, hdr.a); +} + + +// Pixel shader: ACES filmic operator +float4 PSACESFilmic_SRGB(VSInputTx pin) : SV_Target0 +{ + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 sdr = ToneMapACESFilmic(hdr.xyz * linearExposure); + float3 srgb = LinearToSRGBEst(sdr); + return float4(srgb, hdr.a); +} + + +//-------------------------------------------------------------------------------------- +// HDR10, using Rec.2020 color primaries and ST.2084 curve + +float3 HDR10(float3 color) +{ + // Rotate from Rec.709 to Rec.2020 primaries + float3 rgb = mul(from709to2020, color); + + // ST.2084 spec defines max nits as 10,000 nits + float3 normalized = rgb * paperWhiteNits / 10000.f; + + // Apply ST.2084 curve + return LinearToST2084(normalized); +} + +float4 PSHDR10(VSInputTx pin) : SV_Target0 +{ + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 rgb = HDR10(hdr.xyz); + return float4(rgb, hdr.a); +} + + +//-------------------------------------------------------------------------------------- +struct MRTOut +{ + float4 hdr : SV_Target0; + float4 sdr : SV_Target1; +}; + +MRTOut PSHDR10_Saturate(VSInputTx pin) +{ + MRTOut output; + + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 rgb = HDR10(hdr.xyz); + output.hdr = float4(rgb, hdr.a); + + float3 sdr = saturate(hdr.xyz * linearExposure); + output.sdr = float4(sdr, hdr.a); + + return output; +} + +MRTOut PSHDR10_Reinhard(VSInputTx pin) +{ + MRTOut output; + + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 rgb = HDR10(hdr.xyz); + output.hdr = float4(rgb, hdr.a); + + float3 sdr = ToneMapReinhard(hdr.xyz * linearExposure); + output.sdr = float4(sdr, hdr.a); + + return output; +} + +MRTOut PSHDR10_ACESFilmic(VSInputTx pin) +{ + MRTOut output; + + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 rgb = HDR10(hdr.xyz); + output.hdr = float4(rgb, hdr.a); + + float3 sdr = ToneMapACESFilmic(hdr.xyz * linearExposure); + output.sdr = float4(sdr, hdr.a); + + return output; +} + +MRTOut PSHDR10_Saturate_SRGB(VSInputTx pin) +{ + MRTOut output; + + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 rgb = HDR10(hdr.xyz); + output.hdr = float4(rgb, hdr.a); + + float3 sdr = saturate(hdr.xyz * linearExposure); + float3 srgb = LinearToSRGBEst(sdr); + output.sdr = float4(srgb, hdr.a); + + return output; +} + +MRTOut PSHDR10_Reinhard_SRGB(VSInputTx pin) +{ + MRTOut output; + + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 rgb = HDR10(hdr.xyz); + output.hdr = float4(rgb, hdr.a); + + float3 sdr = ToneMapReinhard(hdr.xyz * linearExposure); + float3 srgb = LinearToSRGBEst(sdr); + output.sdr = float4(srgb, hdr.a); + + return output; +} + +MRTOut PSHDR10_ACESFilmic_SRGB(VSInputTx pin) +{ + MRTOut output; + + float4 hdr = HDRTexture.Sample(Sampler, pin.TexCoord); + float3 rgb = HDR10(hdr.xyz); + output.hdr = float4(rgb, hdr.a); + + float3 sdr = ToneMapACESFilmic(hdr.xyz * linearExposure); + float3 srgb = LinearToSRGBEst(sdr); + output.sdr = float4(srgb, hdr.a); + + return output; +} diff --git a/DirectXTK/Src/Shaders/Utilities.fxh b/DirectXTK/Src/Shaders/Utilities.fxh new file mode 100644 index 0000000..908d95d --- /dev/null +++ b/DirectXTK/Src/Shaders/Utilities.fxh @@ -0,0 +1,74 @@ +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 + + +// sRGB +// https://en.wikipedia.org/wiki/SRGB + +// Apply the (approximate) sRGB curve to linear values +float3 LinearToSRGBEst(float3 color) +{ + return pow(abs(color), 1/2.2f); +} + + +// (Approximate) sRGB to linear +float3 SRGBToLinearEst(float3 srgb) +{ + return pow(abs(srgb), 2.2f); +} + + +// HDR10 Media Profile +// https://en.wikipedia.org/wiki/High-dynamic-range_video#HDR10 + + +// Color rotation matrix to rotate Rec.709 color primaries into Rec.2020 +static const float3x3 from709to2020 = +{ + { 0.6274040f, 0.3292820f, 0.0433136f }, + { 0.0690970f, 0.9195400f, 0.0113612f }, + { 0.0163916f, 0.0880132f, 0.8955950f } +}; + + +// Apply the ST.2084 curve to normalized linear values and outputs normalized non-linear values +float3 LinearToST2084(float3 normalizedLinearValue) +{ + return pow((0.8359375f + 18.8515625f * pow(abs(normalizedLinearValue), 0.1593017578f)) / (1.0f + 18.6875f * pow(abs(normalizedLinearValue), 0.1593017578f)), 78.84375f); +} + + +// ST.2084 to linear, resulting in a linear normalized value +float3 ST2084ToLinear(float3 ST2084) +{ + return pow(max(pow(abs(ST2084), 1.0f / 78.84375f) - 0.8359375f, 0.0f) / (18.8515625f - 18.6875f * pow(abs(ST2084), 1.0f / 78.84375f)), 1.0f / 0.1593017578f); +} + + +// Reinhard tonemap operator +// Reinhard et al. "Photographic tone reproduction for digital images." ACM Transactions on Graphics. 21. 2002. +// http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf +float3 ToneMapReinhard(float3 color) +{ + return color / (1.0f + color); +} + + +// ACES Filmic tonemap operator +// https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ +float3 ToneMapACESFilmic(float3 x) +{ + float a = 2.51f; + float b = 0.03f; + float c = 2.43f; + float d = 0.59f; + float e = 0.14f; + return saturate((x*(a*x+b))/(x*(c*x+d)+e)); +} diff --git a/DirectXTK/Src/SpriteBatch.cpp b/DirectXTK/Src/SpriteBatch.cpp index 54f3448..6d747fb 100644 --- a/DirectXTK/Src/SpriteBatch.cpp +++ b/DirectXTK/Src/SpriteBatch.cpp @@ -72,7 +72,7 @@ __declspec(align(16)) class SpriteBatch::Impl : public AlignedNew setCustomShaders, + std::function& setCustomShaders, FXMMATRIX transformMatrix); void End(); @@ -392,7 +392,7 @@ void XM_CALLCONV SpriteBatch::Impl::Begin(SpriteSortMode sortMode, ID3D11SamplerState* samplerState, ID3D11DepthStencilState* depthStencilState, ID3D11RasterizerState* rasterizerState, - std::function setCustomShaders, + std::function& setCustomShaders, FXMMATRIX transformMatrix) { if (mInBeginEndPair) diff --git a/DirectXTK/Src/ToneMapPostProcess.cpp b/DirectXTK/Src/ToneMapPostProcess.cpp new file mode 100644 index 0000000..875fb39 --- /dev/null +++ b/DirectXTK/Src/ToneMapPostProcess.cpp @@ -0,0 +1,430 @@ +//-------------------------------------------------------------------------------------- +// File: ToneMapPostProcess.cpp +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +// PARTICULAR PURPOSE. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// http://go.microsoft.com/fwlink/?LinkId=248929 +//-------------------------------------------------------------------------------------- + +#include "pch.h" +#include "PostProcess.h" + +#include "AlignedNew.h" +#include "CommonStates.h" +#include "ConstantBuffer.h" +#include "DemandCreate.h" +#include "DirectXHelpers.h" +#include "SharedResourcePool.h" + +using namespace DirectX; + +using Microsoft::WRL::ComPtr; + +namespace +{ + const int Dirty_ConstantBuffer = 0x01; + const int Dirty_Parameters = 0x02; + +#if defined(_XBOX_ONE) && defined(_TITLE) + const int PixelShaderCount = 15; + const int ShaderPermutationCount = 24; +#else + const int PixelShaderCount = 9; + const int ShaderPermutationCount = 12; +#endif + + // Constant buffer layout. Must match the shader! + __declspec(align(16)) struct ToneMapConstants + { + // linearExposure is .x + // paperWhiteNits is .y + XMVECTOR parameters; + }; + + static_assert((sizeof(ToneMapConstants) % 16) == 0, "CB size not padded correctly"); +} + +// Include the precompiled shader code. +namespace +{ +#if defined(_XBOX_ONE) && defined(_TITLE) + #include "Shaders/Compiled/XboxOneToneMap_VSQuad.inc" + + #include "Shaders/Compiled/XboxOneToneMap_PSCopy.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSSaturate.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSReinhard.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSACESFilmic.inc" + #include "Shaders/Compiled/XboxOneToneMap_PS_SRGB.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSSaturate_SRGB.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSReinhard_SRGB.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSACESFilmic_SRGB.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSHDR10.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSHDR10_Saturate.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSHDR10_Reinhard.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSHDR10_ACESFilmic.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSHDR10_Saturate_SRGB.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSHDR10_Reinhard_SRGB.inc" + #include "Shaders/Compiled/XboxOneToneMap_PSHDR10_ACESFilmic_SRGB.inc" +#else + #include "Shaders/Compiled/ToneMap_VSQuad.inc" + + #include "Shaders/Compiled/ToneMap_PSCopy.inc" + #include "Shaders/Compiled/ToneMap_PSSaturate.inc" + #include "Shaders/Compiled/ToneMap_PSReinhard.inc" + #include "Shaders/Compiled/ToneMap_PSACESFilmic.inc" + #include "Shaders/Compiled/ToneMap_PS_SRGB.inc" + #include "Shaders/Compiled/ToneMap_PSSaturate_SRGB.inc" + #include "Shaders/Compiled/ToneMap_PSReinhard_SRGB.inc" + #include "Shaders/Compiled/ToneMap_PSACESFilmic_SRGB.inc" + #include "Shaders/Compiled/ToneMap_PSHDR10.inc" +#endif +} + +namespace +{ + struct ShaderBytecode + { + void const* code; + size_t length; + }; + + const ShaderBytecode pixelShaders[] = + { + { ToneMap_PSCopy, sizeof(ToneMap_PSCopy) }, + { ToneMap_PSSaturate, sizeof(ToneMap_PSSaturate) }, + { ToneMap_PSReinhard, sizeof(ToneMap_PSReinhard) }, + { ToneMap_PSACESFilmic, sizeof(ToneMap_PSACESFilmic) }, + { ToneMap_PS_SRGB, sizeof(ToneMap_PS_SRGB) }, + { ToneMap_PSSaturate_SRGB, sizeof(ToneMap_PSSaturate_SRGB) }, + { ToneMap_PSReinhard_SRGB, sizeof(ToneMap_PSReinhard_SRGB) }, + { ToneMap_PSACESFilmic_SRGB, sizeof(ToneMap_PSACESFilmic_SRGB) }, + { ToneMap_PSHDR10, sizeof(ToneMap_PSHDR10) }, + +#if defined(_XBOX_ONE) && defined(_TITLE) + // Shaders that generate both HDR10 and GameDVR SDR signals via Multiple Render Targets. + { ToneMap_PSHDR10_Saturate, sizeof(ToneMap_PSHDR10_Saturate) }, + { ToneMap_PSHDR10_Reinhard, sizeof(ToneMap_PSHDR10_Reinhard) }, + { ToneMap_PSHDR10_ACESFilmic, sizeof(ToneMap_PSHDR10_ACESFilmic) }, + { ToneMap_PSHDR10_Saturate_SRGB, sizeof(ToneMap_PSHDR10_Saturate_SRGB) }, + { ToneMap_PSHDR10_Reinhard_SRGB, sizeof(ToneMap_PSHDR10_Reinhard_SRGB) }, + { ToneMap_PSHDR10_ACESFilmic_SRGB, sizeof(ToneMap_PSHDR10_ACESFilmic_SRGB) }, +#endif + }; + + static_assert(_countof(pixelShaders) == PixelShaderCount, "array/max mismatch"); + + const int pixelShaderIndices[] = + { + // Linear EOTF + 0, // Copy + 1, // Saturate + 2, // Reinhard + 3, // ACES Filmic + + // Gamam22 EOTF + 4, // SRGB + 5, // Saturate_SRGB + 6, // Reinhard_SRGB + 7, // ACES Filmic + + // ST.2084 EOTF + 8, // HDR10 + 8, // HDR10 + 8, // HDR10 + 8, // HDR10 + +#if defined(_XBOX_ONE) && defined(_TITLE) + // MRT Linear EOTF + 9, // HDR10+Saturate + 9, // HDR10+Saturate + 10, // HDR10+Reinhard + 11, // HDR10+ACESFilmic + + // MRT Gamma22 EOTF + 12, // HDR10+Saturate_SRGB + 12, // HDR10+Saturate_SRGB + 13, // HDR10+Reinhard_SRGB + 14, // HDR10+ACESFilmic + + // MRT ST.2084 EOTF + 9, // HDR10+Saturate + 9, // HDR10+Saturate + 10, // HDR10+Reinhard + 11, // HDR10+ACESFilmic +#endif + }; + + static_assert(_countof(pixelShaderIndices) == ShaderPermutationCount, "array/max mismatch"); + + // Factory for lazily instantiating shaders. + class DeviceResources + { + public: + DeviceResources(_In_ ID3D11Device* device) + : mDevice(device), + stateObjects(device) + { } + + // Gets or lazily creates the vertex shader. + ID3D11VertexShader* GetVertexShader() + { + return DemandCreate(mVertexShader, mMutex, [&](ID3D11VertexShader** pResult) -> HRESULT + { + HRESULT hr = mDevice->CreateVertexShader(ToneMap_VSQuad, sizeof(ToneMap_VSQuad), nullptr, pResult); + + if (SUCCEEDED(hr)) + SetDebugObjectName(*pResult, "ToneMapPostProcess"); + + return hr; + }); + } + + // Gets or lazily creates the specified pixel shader. + ID3D11PixelShader* GetPixelShader(int permutation) + { + assert(permutation >= 0 && permutation < ShaderPermutationCount); + _Analysis_assume_(permutation >= 0 && permutation < ShaderPermutationCount); + int shaderIndex = pixelShaderIndices[permutation]; + assert(shaderIndex >= 0 && shaderIndex < PixelShaderCount); + _Analysis_assume_(shaderIndex >= 0 && shaderIndex < PixelShaderCount); + + return DemandCreate(mPixelShaders[shaderIndex], mMutex, [&](ID3D11PixelShader** pResult) -> HRESULT + { + HRESULT hr = mDevice->CreatePixelShader(pixelShaders[shaderIndex].code, pixelShaders[shaderIndex].length, nullptr, pResult); + + if (SUCCEEDED(hr)) + SetDebugObjectName(*pResult, "ToneMapPostProcess"); + + return hr; + }); + } + + CommonStates stateObjects; + + protected: + ComPtr mDevice; + ComPtr mVertexShader; + ComPtr mPixelShaders[PixelShaderCount]; + std::mutex mMutex; + }; +} + +class ToneMapPostProcess::Impl : public AlignedNew +{ +public: + Impl(_In_ ID3D11Device* device); + + void Process(_In_ ID3D11DeviceContext* deviceContext, std::function& setCustomState); + + void SetDirtyFlag() { mDirtyFlags = INT_MAX; } + + int GetCurrentShaderPermutation() const; + + // Fields. + ToneMapConstants constants; + ComPtr hdrTexture; + float linearExposure; + float paperWhiteNits; + + Operator op; + TransferFunction func; + bool mrt; + +private: + int mDirtyFlags; + + ConstantBuffer mConstantBuffer; + + // Per-device resources. + std::shared_ptr mDeviceResources; + + static SharedResourcePool deviceResourcesPool; +}; + + +// Global pool of per-device ToneMapPostProcess resources. +SharedResourcePool ToneMapPostProcess::Impl::deviceResourcesPool; + + +// Constructor. +ToneMapPostProcess::Impl::Impl(_In_ ID3D11Device* device) + : mConstantBuffer(device), + mDeviceResources(deviceResourcesPool.DemandCreate(device)), + linearExposure(1.f), + paperWhiteNits(200.f), + op(None), + func(Linear), + mrt(false), + mDirtyFlags(INT_MAX), + constants{} +{ + if (device->GetFeatureLevel() < D3D_FEATURE_LEVEL_10_0) + { + throw std::exception("ToneMapPostProcess requires Feature Level 10.0 or later"); + } +} + + +// Sets our state onto the D3D device. +void ToneMapPostProcess::Impl::Process(_In_ ID3D11DeviceContext* deviceContext, std::function& setCustomState) +{ + // Set the texture. + ID3D11ShaderResourceView* textures[1] = { hdrTexture.Get() }; + deviceContext->PSSetShaderResources(0, 1, textures); + + auto sampler = mDeviceResources->stateObjects.PointClamp(); + deviceContext->PSSetSamplers(0, 1, &sampler); + + // Set state objects. + deviceContext->OMSetBlendState(mDeviceResources->stateObjects.Opaque(), nullptr, 0xffffffff); + deviceContext->OMSetDepthStencilState(mDeviceResources->stateObjects.DepthNone(), 0); + deviceContext->RSSetState(mDeviceResources->stateObjects.CullNone()); + + // Set shaders. + auto vertexShader = mDeviceResources->GetVertexShader(); + auto pixelShader = mDeviceResources->GetPixelShader(GetCurrentShaderPermutation()); + + deviceContext->VSSetShader(vertexShader, nullptr, 0); + deviceContext->PSSetShader(pixelShader, nullptr, 0); + + // Set constants. + if (mDirtyFlags & Dirty_Parameters) + { + mDirtyFlags &= ~Dirty_Parameters; + mDirtyFlags |= Dirty_ConstantBuffer; + + constants.parameters = XMVectorSet(linearExposure, paperWhiteNits, 0.f, 0.f); + } + +#if defined(_XBOX_ONE) && defined(_TITLE) + void *grfxMemory; + mConstantBuffer.SetData(deviceContext, constants, &grfxMemory); + + Microsoft::WRL::ComPtr deviceContextX; + ThrowIfFailed(deviceContext->QueryInterface(IID_GRAPHICS_PPV_ARGS(deviceContextX.GetAddressOf()))); + + auto buffer = mConstantBuffer.GetBuffer(); + + deviceContextX->PSSetPlacementConstantBuffer(0, buffer, grfxMemory); +#else + if (mDirtyFlags & Dirty_ConstantBuffer) + { + mDirtyFlags &= ~Dirty_ConstantBuffer; + mConstantBuffer.SetData(deviceContext, constants); + } + + // Set the constant buffer. + auto buffer = mConstantBuffer.GetBuffer(); + + deviceContext->PSSetConstantBuffers(0, 1, &buffer); +#endif + + if (setCustomState) + { + setCustomState(); + } + + // Draw quad. + deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + + deviceContext->Draw(4, 0); +} + + +int ToneMapPostProcess::Impl::GetCurrentShaderPermutation() const +{ +#if defined(_XBOX_ONE) && defined(_TITLE) + int permutation = (mrt) ? 12 : 0; + return permutation + (static_cast(func) * static_cast(Operator_Max)) + static_cast(op); +#else + return (static_cast(func) * static_cast(Operator_Max)) + static_cast(op); +#endif +} + + +// Public constructor. +ToneMapPostProcess::ToneMapPostProcess(_In_ ID3D11Device* device) + : pImpl(new Impl(device)) +{ +} + + +// Move constructor. +ToneMapPostProcess::ToneMapPostProcess(ToneMapPostProcess&& moveFrom) + : pImpl(std::move(moveFrom.pImpl)) +{ +} + + +// Move assignment. +ToneMapPostProcess& ToneMapPostProcess::operator= (ToneMapPostProcess&& moveFrom) +{ + pImpl = std::move(moveFrom.pImpl); + return *this; +} + + +// Public destructor. +ToneMapPostProcess::~ToneMapPostProcess() +{ +} + + +// IPostProcess methods. +void ToneMapPostProcess::Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState) +{ + pImpl->Process(deviceContext, setCustomState); +} + + +// Shader control. +void ToneMapPostProcess::SetOperator(Operator op) +{ + if (op < 0 || op >= Operator_Max) + throw std::out_of_range("Tonemap operator not defined"); + + pImpl->op = op; +} + + +void ToneMapPostProcess::SetTransferFunction(TransferFunction func) +{ + if (func < 0 || func >= TransferFunction_Max) + throw std::out_of_range("Electro-optical transfer function not defined"); + + pImpl->func = func; +} + + +#if defined(_XBOX_ONE) && defined(_TITLE) +void ToneMapPostProcess::SetMRTOutput(bool value) +{ + pImpl->mrt = value; +} +#endif + + +// Properties +void ToneMapPostProcess::SetHDRSourceTexture(_In_opt_ ID3D11ShaderResourceView* value) +{ + pImpl->hdrTexture = value; +} + + +void ToneMapPostProcess::SetExposure(float exposureValue) +{ + pImpl->linearExposure = powf(2.f, exposureValue); + pImpl->SetDirtyFlag(); +} + + +void ToneMapPostProcess::SetST2084Parameter(float paperWhiteNits) +{ + pImpl->paperWhiteNits = paperWhiteNits; + pImpl->SetDirtyFlag(); +} diff --git a/DirectXTKModelViewer_XDK_2017.vcxproj b/DirectXTKModelViewer_XDK_2017.vcxproj index da73856..51ad9a0 100644 --- a/DirectXTKModelViewer_XDK_2017.vcxproj +++ b/DirectXTKModelViewer_XDK_2017.vcxproj @@ -21,7 +21,6 @@ Win32Proj title - v140 14.0 Native