diff --git a/DirectXTK12/DirectXTK_Desktop_2017_Win10.vcxproj b/DirectXTK12/DirectXTK_Desktop_2017_Win10.vcxproj
index 44d5461..94a0fed 100644
--- a/DirectXTK12/DirectXTK_Desktop_2017_Win10.vcxproj
+++ b/DirectXTK12/DirectXTK_Desktop_2017_Win10.vcxproj
@@ -139,6 +139,7 @@
+
@@ -295,7 +296,7 @@
Disabled
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
$(IntDir)$(TargetName).pdb
true
@@ -320,7 +321,7 @@
Disabled
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
$(IntDir)$(TargetName).pdb
true
@@ -345,7 +346,7 @@
Disabled
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
StreamingSIMDExtensions2
$(IntDir)$(TargetName).pdb
@@ -371,7 +372,7 @@
MaxSpeed
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
$(IntDir)$(TargetName).pdb
true
@@ -397,7 +398,7 @@
MaxSpeed
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
$(IntDir)$(TargetName).pdb
true
@@ -423,7 +424,7 @@
MaxSpeed
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
StreamingSIMDExtensions2
$(IntDir)$(TargetName).pdb
diff --git a/DirectXTK12/DirectXTK_Desktop_2017_Win10.vcxproj.filters b/DirectXTK12/DirectXTK_Desktop_2017_Win10.vcxproj.filters
index eb34b0c..79196c8 100644
--- a/DirectXTK12/DirectXTK_Desktop_2017_Win10.vcxproj.filters
+++ b/DirectXTK12/DirectXTK_Desktop_2017_Win10.vcxproj.filters
@@ -374,5 +374,8 @@
Src\Shaders
+
+ Src\Shaders\Shared
+
\ No newline at end of file
diff --git a/DirectXTK12/DirectXTK_Desktop_2019_Win10.vcxproj b/DirectXTK12/DirectXTK_Desktop_2019_Win10.vcxproj
index 870f7a6..1e4407e 100644
--- a/DirectXTK12/DirectXTK_Desktop_2019_Win10.vcxproj
+++ b/DirectXTK12/DirectXTK_Desktop_2019_Win10.vcxproj
@@ -139,6 +139,7 @@
+
@@ -295,7 +296,7 @@
Disabled
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
$(IntDir)$(TargetName).pdb
true
@@ -321,7 +322,7 @@
Disabled
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
$(IntDir)$(TargetName).pdb
true
@@ -347,7 +348,7 @@
Disabled
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
StreamingSIMDExtensions2
$(IntDir)$(TargetName).pdb
@@ -374,7 +375,7 @@
MaxSpeed
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
$(IntDir)$(TargetName).pdb
true
@@ -401,7 +402,7 @@
MaxSpeed
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
$(IntDir)$(TargetName).pdb
true
@@ -428,7 +429,7 @@
MaxSpeed
_WIN32_WINNT=0x0A00;_WIN7_PLATFORM_UPDATE;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)
pch.h
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
StreamingSIMDExtensions2
$(IntDir)$(TargetName).pdb
diff --git a/DirectXTK12/DirectXTK_Desktop_2019_Win10.vcxproj.filters b/DirectXTK12/DirectXTK_Desktop_2019_Win10.vcxproj.filters
index eb34b0c..79196c8 100644
--- a/DirectXTK12/DirectXTK_Desktop_2019_Win10.vcxproj.filters
+++ b/DirectXTK12/DirectXTK_Desktop_2019_Win10.vcxproj.filters
@@ -374,5 +374,8 @@
Src\Shaders
+
+ Src\Shaders\Shared
+
\ No newline at end of file
diff --git a/DirectXTK12/DirectXTK_GDK_2017.vcxproj b/DirectXTK12/DirectXTK_GDK_2017.vcxproj
index fddcd71..c93788d 100644
--- a/DirectXTK12/DirectXTK_GDK_2017.vcxproj
+++ b/DirectXTK12/DirectXTK_GDK_2017.vcxproj
@@ -259,7 +259,7 @@
true
true
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
@@ -287,7 +287,7 @@
true
true
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
@@ -313,7 +313,7 @@
true
true
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
@@ -341,7 +341,7 @@
true
true
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
@@ -364,7 +364,7 @@
true
_DEBUG;_LIB;%(PreprocessorDefinitions)
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
@@ -389,7 +389,7 @@
true
_DEBUG;_LIB;%(PreprocessorDefinitions)
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
@@ -409,7 +409,7 @@
MaxSpeed
NDEBUG;__WRL_NO_DEFAULT_LIB__;_LIB;%(PreprocessorDefinitions)
EnableAllWarnings
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
true
true
Fast
@@ -436,7 +436,7 @@
MaxSpeed
NDEBUG;__WRL_NO_DEFAULT_LIB__;_LIB;PROFILE;%(PreprocessorDefinitions)
EnableAllWarnings
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
true
true
Fast
@@ -462,7 +462,7 @@
EnableAllWarnings
Disabled
_DEBUG;__WRL_NO_DEFAULT_LIB__;_LIB;%(PreprocessorDefinitions)
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
$(IntDir)$(TargetName).pdb
true
@@ -607,6 +607,7 @@
+
diff --git a/DirectXTK12/DirectXTK_GDK_2017.vcxproj.filters b/DirectXTK12/DirectXTK_GDK_2017.vcxproj.filters
index d694dff..c5f8bc8 100644
--- a/DirectXTK12/DirectXTK_GDK_2017.vcxproj.filters
+++ b/DirectXTK12/DirectXTK_GDK_2017.vcxproj.filters
@@ -380,5 +380,8 @@
Src\Shaders
+
+ Src\Shaders\Shared
+
\ No newline at end of file
diff --git a/DirectXTK12/DirectXTK_GDK_2019.vcxproj b/DirectXTK12/DirectXTK_GDK_2019.vcxproj
index 34aa6d2..3df59ab 100644
--- a/DirectXTK12/DirectXTK_GDK_2019.vcxproj
+++ b/DirectXTK12/DirectXTK_GDK_2019.vcxproj
@@ -259,7 +259,7 @@
true
true
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
Level4
@@ -288,7 +288,7 @@
true
true
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
Level4
@@ -315,7 +315,7 @@
true
true
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
Level4
@@ -344,7 +344,7 @@
true
true
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
Level4
@@ -368,7 +368,7 @@
true
_DEBUG;_LIB;%(PreprocessorDefinitions)
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
Level4
@@ -394,7 +394,7 @@
true
_DEBUG;_LIB;%(PreprocessorDefinitions)
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
Level4
@@ -415,7 +415,7 @@
MaxSpeed
NDEBUG;__WRL_NO_DEFAULT_LIB__;_LIB;%(PreprocessorDefinitions)
EnableAllWarnings
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
true
true
Fast
@@ -443,7 +443,7 @@
MaxSpeed
NDEBUG;__WRL_NO_DEFAULT_LIB__;_LIB;PROFILE;%(PreprocessorDefinitions)
EnableAllWarnings
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
true
true
Fast
@@ -470,7 +470,7 @@
EnableAllWarnings
Disabled
_DEBUG;__WRL_NO_DEFAULT_LIB__;_LIB;%(PreprocessorDefinitions)
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
Fast
$(IntDir)$(TargetName).pdb
true
@@ -616,6 +616,7 @@
+
diff --git a/DirectXTK12/DirectXTK_GDK_2019.vcxproj.filters b/DirectXTK12/DirectXTK_GDK_2019.vcxproj.filters
index d694dff..c5f8bc8 100644
--- a/DirectXTK12/DirectXTK_GDK_2019.vcxproj.filters
+++ b/DirectXTK12/DirectXTK_GDK_2019.vcxproj.filters
@@ -380,5 +380,8 @@
Src\Shaders
+
+ Src\Shaders\Shared
+
\ No newline at end of file
diff --git a/DirectXTK12/DirectXTK_XboxOneXDK_2017.vcxproj b/DirectXTK12/DirectXTK_XboxOneXDK_2017.vcxproj
index a15f865..8d806df 100644
--- a/DirectXTK12/DirectXTK_XboxOneXDK_2017.vcxproj
+++ b/DirectXTK12/DirectXTK_XboxOneXDK_2017.vcxproj
@@ -126,6 +126,7 @@
+
@@ -191,6 +192,7 @@
v141
14.0
Native
+ 8.1
@@ -283,7 +285,7 @@
true
true
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
/Zc:twoPhase- %(AdditionalOptions)
@@ -311,7 +313,7 @@
true
true
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
/Zc:twoPhase- %(AdditionalOptions)
@@ -334,7 +336,7 @@
true
_DEBUG;__WRL_NO_DEFAULT_LIB__;_LIB;%(PreprocessorDefinitions)
false
- $(ProjectDir)Inc;$(ProjectDir)Src;%(AdditionalIncludeDirectories)
+ $(ProjectDir)Inc;$(ProjectDir)Src;$(ProjectDir)Src\Shaders\Compiled;%(AdditionalIncludeDirectories)
$(IntDir)$(TargetName).pdb
/Zc:twoPhase- %(AdditionalOptions)
false
diff --git a/DirectXTK12/DirectXTK_XboxOneXDK_2017.vcxproj.filters b/DirectXTK12/DirectXTK_XboxOneXDK_2017.vcxproj.filters
index 9c41abd..337a63b 100644
--- a/DirectXTK12/DirectXTK_XboxOneXDK_2017.vcxproj.filters
+++ b/DirectXTK12/DirectXTK_XboxOneXDK_2017.vcxproj.filters
@@ -382,5 +382,8 @@
Src\Shaders
+
+ Src\Shaders\Shared
+
\ No newline at end of file
diff --git a/DirectXTK12/Inc/CommonStates.h b/DirectXTK12/Inc/CommonStates.h
index 1acb0d9..7a2f09a 100644
--- a/DirectXTK12/Inc/CommonStates.h
+++ b/DirectXTK12/Inc/CommonStates.h
@@ -45,6 +45,8 @@ namespace DirectX
static const D3D12_DEPTH_STENCIL_DESC DepthNone;
static const D3D12_DEPTH_STENCIL_DESC DepthDefault;
static const D3D12_DEPTH_STENCIL_DESC DepthRead;
+ static const D3D12_DEPTH_STENCIL_DESC DepthReverseZ;
+ static const D3D12_DEPTH_STENCIL_DESC DepthReadReverseZ;
// Rasterizer states.
static const D3D12_RASTERIZER_DESC CullNone;
diff --git a/DirectXTK12/Inc/Effects.h b/DirectXTK12/Inc/Effects.h
index 58e10ed..65f5aba 100644
--- a/DirectXTK12/Inc/Effects.h
+++ b/DirectXTK12/Inc/Effects.h
@@ -455,7 +455,8 @@ namespace DirectX
{
public:
NormalMapEffect(_In_ ID3D12Device* device, uint32_t effectFlags,
- const EffectPipelineStateDescription& pipelineDescription);
+ const EffectPipelineStateDescription& pipelineDescription) :
+ NormalMapEffect(device, effectFlags, pipelineDescription, false) {}
NormalMapEffect(NormalMapEffect&&) noexcept;
NormalMapEffect& operator= (NormalMapEffect&&) noexcept;
@@ -503,11 +504,26 @@ namespace DirectX
void __cdecl SetNormalTexture(D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor);
void __cdecl SetSpecularTexture(D3D12_GPU_DESCRIPTOR_HANDLE srvDescriptor);
- private:
+ protected:
// Private implementation.
class Impl;
std::unique_ptr pImpl;
+
+ NormalMapEffect(_In_ ID3D12Device* device, uint32_t effectFlags,
+ const EffectPipelineStateDescription& pipelineDescription, bool skinningEnabled);
+ };
+
+ class SkinnedNormalMapEffect : public NormalMapEffect, public IEffectSkinning
+ {
+ public:
+ SkinnedNormalMapEffect(_In_ ID3D12Device* device, uint32_t effectFlags,
+ const EffectPipelineStateDescription& pipelineDescription) :
+ NormalMapEffect(device, effectFlags, pipelineDescription, true) {}
+
+ // Animation settings.
+ void __cdecl SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count) override;
+ void __cdecl ResetBoneTransforms() override;
};
@@ -517,7 +533,8 @@ namespace DirectX
{
public:
PBREffect(_In_ ID3D12Device* device, uint32_t effectFlags,
- const EffectPipelineStateDescription& pipelineDescription);
+ const EffectPipelineStateDescription& pipelineDescription) :
+ PBREffect(device, effectFlags, pipelineDescription, false) {}
PBREffect(PBREffect&&) noexcept;
PBREffect& operator= (PBREffect&&) noexcept;
@@ -571,17 +588,32 @@ namespace DirectX
// Render target size, required for velocity buffer output.
void __cdecl SetRenderTargetSizeInPixels(int width, int height);
- private:
+ protected:
// Private implementation.
class Impl;
std::unique_ptr pImpl;
+ PBREffect(_In_ ID3D12Device* device, uint32_t effectFlags,
+ const EffectPipelineStateDescription& pipelineDescription, bool skinningEnabled);
+
// Unsupported interface methods.
void XM_CALLCONV SetAmbientLightColor(FXMVECTOR value) override;
void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) override;
};
+ class SkinnedPBREffect : public PBREffect, public IEffectSkinning
+ {
+ public:
+ SkinnedPBREffect(_In_ ID3D12Device* device, uint32_t effectFlags,
+ const EffectPipelineStateDescription& pipelineDescription) :
+ PBREffect(device, effectFlags, pipelineDescription, true) {}
+
+ // Animation settings.
+ void __cdecl SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count) override;
+ void __cdecl ResetBoneTransforms() override;
+ };
+
//----------------------------------------------------------------------------------
// Built-in shader for debug visualization of normals, tangents, etc.
diff --git a/DirectXTK12/Inc/Model.h b/DirectXTK12/Inc/Model.h
index 46b5b0f..bf469ca 100644
--- a/DirectXTK12/Inc/Model.h
+++ b/DirectXTK12/Inc/Model.h
@@ -54,6 +54,7 @@ namespace DirectX
ModelLoader_MaterialColorsSRGB = 0x1,
ModelLoader_AllowLargeModels = 0x2,
ModelLoader_IncludeBones = 0x4,
+ ModelLoader_DisableSkinning = 0x8,
};
//----------------------------------------------------------------------------------
diff --git a/DirectXTK12/README.md b/DirectXTK12/README.md
index 79892fc..1dadbcc 100644
--- a/DirectXTK12/README.md
+++ b/DirectXTK12/README.md
@@ -1,4 +1,4 @@
-![DirectX Logo](https://github.com/Microsoft/DirectXTK12/wiki/X_jpg.jpg)
+![DirectX Logo](https://raw.githubusercontent.com/wiki/Microsoft/DirectXTK12/X_jpg.jpg)
# DirectX Tool Kit for DirectX 12
@@ -6,9 +6,9 @@ http://go.microsoft.com/fwlink/?LinkID=615561
Copyright (c) Microsoft Corporation.
-**September 30, 2021**
+**October 13, 2021**
-This package contains the "DirectX Tool Kit", a collection of helper classes for writing Direct3D 12 C++ code for Universal Windows Platform (UWP) apps, Win32 desktop applications for Windows 10, and Xbox.
+This package contains the "DirectX Tool Kit", a collection of helper classes for writing Direct3D 12 C++ code for Universal Windows Platform (UWP) apps for Windows 11 / Windows 10, game titles for Xbox Series X\|S / Xbox One, and Win32 desktop applications for Windows 11 / Windows 10.
This code is designed to build with Visual Studio 2017 ([15.9](https://walbourn.github.io/vs-2017-15-9-update/)), Visual Studio 2019, or clang for Windows v11 or later. Use of the Windows 10 May 2020 Update SDK ([19041](https://walbourn.github.io/windows-10-may-2020-update-sdk/)) or later is required.
diff --git a/DirectXTK12/Src/AlphaTestEffect.cpp b/DirectXTK12/Src/AlphaTestEffect.cpp
index 3a37305..4cbcfc5 100644
--- a/DirectXTK12/Src/AlphaTestEffect.cpp
+++ b/DirectXTK12/Src/AlphaTestEffect.cpp
@@ -72,45 +72,45 @@ class AlphaTestEffect::Impl : public EffectBase
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettAlphaTestEffect_VSAlphaTest.inc"
- #include "Shaders/Compiled/XboxGamingScarlettAlphaTestEffect_VSAlphaTestNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettAlphaTestEffect_VSAlphaTestVc.inc"
- #include "Shaders/Compiled/XboxGamingScarlettAlphaTestEffect_VSAlphaTestVcNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettAlphaTestEffect_PSAlphaTestLtGt.inc"
- #include "Shaders/Compiled/XboxGamingScarlettAlphaTestEffect_PSAlphaTestLtGtNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettAlphaTestEffect_PSAlphaTestEqNe.inc"
- #include "Shaders/Compiled/XboxGamingScarlettAlphaTestEffect_PSAlphaTestEqNeNoFog.inc"
+ #include "XboxGamingScarlettAlphaTestEffect_VSAlphaTest.inc"
+ #include "XboxGamingScarlettAlphaTestEffect_VSAlphaTestNoFog.inc"
+ #include "XboxGamingScarlettAlphaTestEffect_VSAlphaTestVc.inc"
+ #include "XboxGamingScarlettAlphaTestEffect_VSAlphaTestVcNoFog.inc"
+
+ #include "XboxGamingScarlettAlphaTestEffect_PSAlphaTestLtGt.inc"
+ #include "XboxGamingScarlettAlphaTestEffect_PSAlphaTestLtGtNoFog.inc"
+ #include "XboxGamingScarlettAlphaTestEffect_PSAlphaTestEqNe.inc"
+ #include "XboxGamingScarlettAlphaTestEffect_PSAlphaTestEqNeNoFog.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOneAlphaTestEffect_VSAlphaTest.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneAlphaTestEffect_VSAlphaTestNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneAlphaTestEffect_VSAlphaTestVc.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneAlphaTestEffect_VSAlphaTestVcNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneAlphaTestEffect_PSAlphaTestLtGt.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneAlphaTestEffect_PSAlphaTestLtGtNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneAlphaTestEffect_PSAlphaTestEqNe.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneAlphaTestEffect_PSAlphaTestEqNeNoFog.inc"
+ #include "XboxGamingXboxOneAlphaTestEffect_VSAlphaTest.inc"
+ #include "XboxGamingXboxOneAlphaTestEffect_VSAlphaTestNoFog.inc"
+ #include "XboxGamingXboxOneAlphaTestEffect_VSAlphaTestVc.inc"
+ #include "XboxGamingXboxOneAlphaTestEffect_VSAlphaTestVcNoFog.inc"
+
+ #include "XboxGamingXboxOneAlphaTestEffect_PSAlphaTestLtGt.inc"
+ #include "XboxGamingXboxOneAlphaTestEffect_PSAlphaTestLtGtNoFog.inc"
+ #include "XboxGamingXboxOneAlphaTestEffect_PSAlphaTestEqNe.inc"
+ #include "XboxGamingXboxOneAlphaTestEffect_PSAlphaTestEqNeNoFog.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOneAlphaTestEffect_VSAlphaTest.inc"
- #include "Shaders/Compiled/XboxOneAlphaTestEffect_VSAlphaTestNoFog.inc"
- #include "Shaders/Compiled/XboxOneAlphaTestEffect_VSAlphaTestVc.inc"
- #include "Shaders/Compiled/XboxOneAlphaTestEffect_VSAlphaTestVcNoFog.inc"
-
- #include "Shaders/Compiled/XboxOneAlphaTestEffect_PSAlphaTestLtGt.inc"
- #include "Shaders/Compiled/XboxOneAlphaTestEffect_PSAlphaTestLtGtNoFog.inc"
- #include "Shaders/Compiled/XboxOneAlphaTestEffect_PSAlphaTestEqNe.inc"
- #include "Shaders/Compiled/XboxOneAlphaTestEffect_PSAlphaTestEqNeNoFog.inc"
+ #include "XboxOneAlphaTestEffect_VSAlphaTest.inc"
+ #include "XboxOneAlphaTestEffect_VSAlphaTestNoFog.inc"
+ #include "XboxOneAlphaTestEffect_VSAlphaTestVc.inc"
+ #include "XboxOneAlphaTestEffect_VSAlphaTestVcNoFog.inc"
+
+ #include "XboxOneAlphaTestEffect_PSAlphaTestLtGt.inc"
+ #include "XboxOneAlphaTestEffect_PSAlphaTestLtGtNoFog.inc"
+ #include "XboxOneAlphaTestEffect_PSAlphaTestEqNe.inc"
+ #include "XboxOneAlphaTestEffect_PSAlphaTestEqNeNoFog.inc"
#else
- #include "Shaders/Compiled/AlphaTestEffect_VSAlphaTest.inc"
- #include "Shaders/Compiled/AlphaTestEffect_VSAlphaTestNoFog.inc"
- #include "Shaders/Compiled/AlphaTestEffect_VSAlphaTestVc.inc"
- #include "Shaders/Compiled/AlphaTestEffect_VSAlphaTestVcNoFog.inc"
-
- #include "Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGt.inc"
- #include "Shaders/Compiled/AlphaTestEffect_PSAlphaTestLtGtNoFog.inc"
- #include "Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNe.inc"
- #include "Shaders/Compiled/AlphaTestEffect_PSAlphaTestEqNeNoFog.inc"
+ #include "AlphaTestEffect_VSAlphaTest.inc"
+ #include "AlphaTestEffect_VSAlphaTestNoFog.inc"
+ #include "AlphaTestEffect_VSAlphaTestVc.inc"
+ #include "AlphaTestEffect_VSAlphaTestVcNoFog.inc"
+
+ #include "AlphaTestEffect_PSAlphaTestLtGt.inc"
+ #include "AlphaTestEffect_PSAlphaTestLtGtNoFog.inc"
+ #include "AlphaTestEffect_PSAlphaTestEqNe.inc"
+ #include "AlphaTestEffect_PSAlphaTestEqNeNoFog.inc"
#endif
}
diff --git a/DirectXTK12/Src/BasicEffect.cpp b/DirectXTK12/Src/BasicEffect.cpp
index 782a3ae..325d494 100644
--- a/DirectXTK12/Src/BasicEffect.cpp
+++ b/DirectXTK12/Src/BasicEffect.cpp
@@ -82,173 +82,173 @@ class BasicEffect::Impl : public EffectBase
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasic.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicVc.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicVcNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicTx.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicTxNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicTxVc.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicTxVcNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicVertexLighting.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicVertexLightingVc.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicVertexLightingTx.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicVertexLightingTxVc.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicPixelLighting.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicPixelLightingVc.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicPixelLightingTx.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicPixelLightingTxVc.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicVertexLightingBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicVertexLightingVcBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicVertexLightingTxBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicVertexLightingTxVcBn.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicPixelLightingBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicPixelLightingVcBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicPixelLightingTxBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_VSBasicPixelLightingTxVcBn.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_PSBasic.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_PSBasicNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_PSBasicTx.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_PSBasicTxNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_PSBasicVertexLighting.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_PSBasicVertexLightingNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_PSBasicVertexLightingTx.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_PSBasicVertexLightingTxNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_PSBasicPixelLighting.inc"
- #include "Shaders/Compiled/XboxGamingScarlettBasicEffect_PSBasicPixelLightingTx.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasic.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicNoFog.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicVc.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicVcNoFog.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicTx.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicTxNoFog.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicTxVc.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicTxVcNoFog.inc"
+
+ #include "XboxGamingScarlettBasicEffect_VSBasicVertexLighting.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicVertexLightingVc.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicVertexLightingTx.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicVertexLightingTxVc.inc"
+
+ #include "XboxGamingScarlettBasicEffect_VSBasicPixelLighting.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicPixelLightingVc.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicPixelLightingTx.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicPixelLightingTxVc.inc"
+
+ #include "XboxGamingScarlettBasicEffect_VSBasicVertexLightingBn.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicVertexLightingVcBn.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicVertexLightingTxBn.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicVertexLightingTxVcBn.inc"
+
+ #include "XboxGamingScarlettBasicEffect_VSBasicPixelLightingBn.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicPixelLightingVcBn.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicPixelLightingTxBn.inc"
+ #include "XboxGamingScarlettBasicEffect_VSBasicPixelLightingTxVcBn.inc"
+
+ #include "XboxGamingScarlettBasicEffect_PSBasic.inc"
+ #include "XboxGamingScarlettBasicEffect_PSBasicNoFog.inc"
+ #include "XboxGamingScarlettBasicEffect_PSBasicTx.inc"
+ #include "XboxGamingScarlettBasicEffect_PSBasicTxNoFog.inc"
+
+ #include "XboxGamingScarlettBasicEffect_PSBasicVertexLighting.inc"
+ #include "XboxGamingScarlettBasicEffect_PSBasicVertexLightingNoFog.inc"
+ #include "XboxGamingScarlettBasicEffect_PSBasicVertexLightingTx.inc"
+ #include "XboxGamingScarlettBasicEffect_PSBasicVertexLightingTxNoFog.inc"
+
+ #include "XboxGamingScarlettBasicEffect_PSBasicPixelLighting.inc"
+ #include "XboxGamingScarlettBasicEffect_PSBasicPixelLightingTx.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasic.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicVc.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicVcNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicTx.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicTxNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicTxVc.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicTxVcNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicVertexLighting.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicVertexLightingVc.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicVertexLightingTx.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicVertexLightingTxVc.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicPixelLighting.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicPixelLightingVc.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicPixelLightingTx.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicPixelLightingTxVc.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicVertexLightingBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicVertexLightingVcBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicVertexLightingTxBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicVertexLightingTxVcBn.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicPixelLightingBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicPixelLightingVcBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicPixelLightingTxBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_VSBasicPixelLightingTxVcBn.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_PSBasic.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_PSBasicNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_PSBasicTx.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_PSBasicTxNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_PSBasicVertexLighting.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_PSBasicVertexLightingNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_PSBasicVertexLightingTx.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_PSBasicVertexLightingTxNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_PSBasicPixelLighting.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneBasicEffect_PSBasicPixelLightingTx.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasic.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicNoFog.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicVc.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicVcNoFog.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicTx.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicTxNoFog.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicTxVc.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicTxVcNoFog.inc"
+
+ #include "XboxGamingXboxOneBasicEffect_VSBasicVertexLighting.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicVertexLightingVc.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicVertexLightingTx.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicVertexLightingTxVc.inc"
+
+ #include "XboxGamingXboxOneBasicEffect_VSBasicPixelLighting.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicPixelLightingVc.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicPixelLightingTx.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicPixelLightingTxVc.inc"
+
+ #include "XboxGamingXboxOneBasicEffect_VSBasicVertexLightingBn.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicVertexLightingVcBn.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicVertexLightingTxBn.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicVertexLightingTxVcBn.inc"
+
+ #include "XboxGamingXboxOneBasicEffect_VSBasicPixelLightingBn.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicPixelLightingVcBn.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicPixelLightingTxBn.inc"
+ #include "XboxGamingXboxOneBasicEffect_VSBasicPixelLightingTxVcBn.inc"
+
+ #include "XboxGamingXboxOneBasicEffect_PSBasic.inc"
+ #include "XboxGamingXboxOneBasicEffect_PSBasicNoFog.inc"
+ #include "XboxGamingXboxOneBasicEffect_PSBasicTx.inc"
+ #include "XboxGamingXboxOneBasicEffect_PSBasicTxNoFog.inc"
+
+ #include "XboxGamingXboxOneBasicEffect_PSBasicVertexLighting.inc"
+ #include "XboxGamingXboxOneBasicEffect_PSBasicVertexLightingNoFog.inc"
+ #include "XboxGamingXboxOneBasicEffect_PSBasicVertexLightingTx.inc"
+ #include "XboxGamingXboxOneBasicEffect_PSBasicVertexLightingTxNoFog.inc"
+
+ #include "XboxGamingXboxOneBasicEffect_PSBasicPixelLighting.inc"
+ #include "XboxGamingXboxOneBasicEffect_PSBasicPixelLightingTx.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasic.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicNoFog.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVc.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVcNoFog.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicTx.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicTxNoFog.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicTxVc.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicTxVcNoFog.inc"
-
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLighting.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLightingVc.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLightingTx.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLightingTxVc.inc"
-
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLighting.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLightingVc.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLightingTx.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLightingTxVc.inc"
-
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLightingBn.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLightingVcBn.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLightingTxBn.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicVertexLightingTxVcBn.inc"
-
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLightingBn.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLightingVcBn.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLightingTxBn.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_VSBasicPixelLightingTxVcBn.inc"
-
- #include "Shaders/Compiled/XboxOneBasicEffect_PSBasic.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicNoFog.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicTx.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicTxNoFog.inc"
-
- #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicVertexLighting.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicVertexLightingNoFog.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicVertexLightingTx.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicVertexLightingTxNoFog.inc"
-
- #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicPixelLighting.inc"
- #include "Shaders/Compiled/XboxOneBasicEffect_PSBasicPixelLightingTx.inc"
+ #include "XboxOneBasicEffect_VSBasic.inc"
+ #include "XboxOneBasicEffect_VSBasicNoFog.inc"
+ #include "XboxOneBasicEffect_VSBasicVc.inc"
+ #include "XboxOneBasicEffect_VSBasicVcNoFog.inc"
+ #include "XboxOneBasicEffect_VSBasicTx.inc"
+ #include "XboxOneBasicEffect_VSBasicTxNoFog.inc"
+ #include "XboxOneBasicEffect_VSBasicTxVc.inc"
+ #include "XboxOneBasicEffect_VSBasicTxVcNoFog.inc"
+
+ #include "XboxOneBasicEffect_VSBasicVertexLighting.inc"
+ #include "XboxOneBasicEffect_VSBasicVertexLightingVc.inc"
+ #include "XboxOneBasicEffect_VSBasicVertexLightingTx.inc"
+ #include "XboxOneBasicEffect_VSBasicVertexLightingTxVc.inc"
+
+ #include "XboxOneBasicEffect_VSBasicPixelLighting.inc"
+ #include "XboxOneBasicEffect_VSBasicPixelLightingVc.inc"
+ #include "XboxOneBasicEffect_VSBasicPixelLightingTx.inc"
+ #include "XboxOneBasicEffect_VSBasicPixelLightingTxVc.inc"
+
+ #include "XboxOneBasicEffect_VSBasicVertexLightingBn.inc"
+ #include "XboxOneBasicEffect_VSBasicVertexLightingVcBn.inc"
+ #include "XboxOneBasicEffect_VSBasicVertexLightingTxBn.inc"
+ #include "XboxOneBasicEffect_VSBasicVertexLightingTxVcBn.inc"
+
+ #include "XboxOneBasicEffect_VSBasicPixelLightingBn.inc"
+ #include "XboxOneBasicEffect_VSBasicPixelLightingVcBn.inc"
+ #include "XboxOneBasicEffect_VSBasicPixelLightingTxBn.inc"
+ #include "XboxOneBasicEffect_VSBasicPixelLightingTxVcBn.inc"
+
+ #include "XboxOneBasicEffect_PSBasic.inc"
+ #include "XboxOneBasicEffect_PSBasicNoFog.inc"
+ #include "XboxOneBasicEffect_PSBasicTx.inc"
+ #include "XboxOneBasicEffect_PSBasicTxNoFog.inc"
+
+ #include "XboxOneBasicEffect_PSBasicVertexLighting.inc"
+ #include "XboxOneBasicEffect_PSBasicVertexLightingNoFog.inc"
+ #include "XboxOneBasicEffect_PSBasicVertexLightingTx.inc"
+ #include "XboxOneBasicEffect_PSBasicVertexLightingTxNoFog.inc"
+
+ #include "XboxOneBasicEffect_PSBasicPixelLighting.inc"
+ #include "XboxOneBasicEffect_PSBasicPixelLightingTx.inc"
#else
- #include "Shaders/Compiled/BasicEffect_VSBasic.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicNoFog.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicVc.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicVcNoFog.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicTx.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicTxNoFog.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicTxVc.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicTxVcNoFog.inc"
-
- #include "Shaders/Compiled/BasicEffect_VSBasicVertexLighting.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicVertexLightingVc.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicVertexLightingTx.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicVertexLightingTxVc.inc"
-
- #include "Shaders/Compiled/BasicEffect_VSBasicPixelLighting.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicPixelLightingVc.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicPixelLightingTx.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicPixelLightingTxVc.inc"
-
- #include "Shaders/Compiled/BasicEffect_VSBasicVertexLightingBn.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicVertexLightingVcBn.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicVertexLightingTxBn.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicVertexLightingTxVcBn.inc"
-
- #include "Shaders/Compiled/BasicEffect_VSBasicPixelLightingBn.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicPixelLightingVcBn.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicPixelLightingTxBn.inc"
- #include "Shaders/Compiled/BasicEffect_VSBasicPixelLightingTxVcBn.inc"
-
- #include "Shaders/Compiled/BasicEffect_PSBasic.inc"
- #include "Shaders/Compiled/BasicEffect_PSBasicNoFog.inc"
- #include "Shaders/Compiled/BasicEffect_PSBasicTx.inc"
- #include "Shaders/Compiled/BasicEffect_PSBasicTxNoFog.inc"
-
- #include "Shaders/Compiled/BasicEffect_PSBasicVertexLighting.inc"
- #include "Shaders/Compiled/BasicEffect_PSBasicVertexLightingNoFog.inc"
- #include "Shaders/Compiled/BasicEffect_PSBasicVertexLightingTx.inc"
- #include "Shaders/Compiled/BasicEffect_PSBasicVertexLightingTxNoFog.inc"
-
- #include "Shaders/Compiled/BasicEffect_PSBasicPixelLighting.inc"
- #include "Shaders/Compiled/BasicEffect_PSBasicPixelLightingTx.inc"
+ #include "BasicEffect_VSBasic.inc"
+ #include "BasicEffect_VSBasicNoFog.inc"
+ #include "BasicEffect_VSBasicVc.inc"
+ #include "BasicEffect_VSBasicVcNoFog.inc"
+ #include "BasicEffect_VSBasicTx.inc"
+ #include "BasicEffect_VSBasicTxNoFog.inc"
+ #include "BasicEffect_VSBasicTxVc.inc"
+ #include "BasicEffect_VSBasicTxVcNoFog.inc"
+
+ #include "BasicEffect_VSBasicVertexLighting.inc"
+ #include "BasicEffect_VSBasicVertexLightingVc.inc"
+ #include "BasicEffect_VSBasicVertexLightingTx.inc"
+ #include "BasicEffect_VSBasicVertexLightingTxVc.inc"
+
+ #include "BasicEffect_VSBasicPixelLighting.inc"
+ #include "BasicEffect_VSBasicPixelLightingVc.inc"
+ #include "BasicEffect_VSBasicPixelLightingTx.inc"
+ #include "BasicEffect_VSBasicPixelLightingTxVc.inc"
+
+ #include "BasicEffect_VSBasicVertexLightingBn.inc"
+ #include "BasicEffect_VSBasicVertexLightingVcBn.inc"
+ #include "BasicEffect_VSBasicVertexLightingTxBn.inc"
+ #include "BasicEffect_VSBasicVertexLightingTxVcBn.inc"
+
+ #include "BasicEffect_VSBasicPixelLightingBn.inc"
+ #include "BasicEffect_VSBasicPixelLightingVcBn.inc"
+ #include "BasicEffect_VSBasicPixelLightingTxBn.inc"
+ #include "BasicEffect_VSBasicPixelLightingTxVcBn.inc"
+
+ #include "BasicEffect_PSBasic.inc"
+ #include "BasicEffect_PSBasicNoFog.inc"
+ #include "BasicEffect_PSBasicTx.inc"
+ #include "BasicEffect_PSBasicTxNoFog.inc"
+
+ #include "BasicEffect_PSBasicVertexLighting.inc"
+ #include "BasicEffect_PSBasicVertexLightingNoFog.inc"
+ #include "BasicEffect_PSBasicVertexLightingTx.inc"
+ #include "BasicEffect_PSBasicVertexLightingTxNoFog.inc"
+
+ #include "BasicEffect_PSBasicPixelLighting.inc"
+ #include "BasicEffect_PSBasicPixelLightingTx.inc"
#endif
}
diff --git a/DirectXTK12/Src/BasicPostProcess.cpp b/DirectXTK12/Src/BasicPostProcess.cpp
index 683f5d8..2029b75 100644
--- a/DirectXTK12/Src/BasicPostProcess.cpp
+++ b/DirectXTK12/Src/BasicPostProcess.cpp
@@ -51,53 +51,53 @@ namespace
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_VSQuadNoCB.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_VSQuad.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_PSCopy.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_PSMonochrome.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_PSSepia.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_PSDownScale2x2.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_PSDownScale4x4.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_PSGaussianBlur5x5.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_PSBloomExtract.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_PSBloomBlur.inc"
+ #include "XboxGamingScarlettPostProcess_VSQuadNoCB.inc"
+ #include "XboxGamingScarlettPostProcess_VSQuad.inc"
+
+ #include "XboxGamingScarlettPostProcess_PSCopy.inc"
+ #include "XboxGamingScarlettPostProcess_PSMonochrome.inc"
+ #include "XboxGamingScarlettPostProcess_PSSepia.inc"
+ #include "XboxGamingScarlettPostProcess_PSDownScale2x2.inc"
+ #include "XboxGamingScarlettPostProcess_PSDownScale4x4.inc"
+ #include "XboxGamingScarlettPostProcess_PSGaussianBlur5x5.inc"
+ #include "XboxGamingScarlettPostProcess_PSBloomExtract.inc"
+ #include "XboxGamingScarlettPostProcess_PSBloomBlur.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_VSQuadNoCB.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_VSQuad.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_PSCopy.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_PSMonochrome.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_PSSepia.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_PSDownScale2x2.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_PSDownScale4x4.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_PSGaussianBlur5x5.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_PSBloomExtract.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_PSBloomBlur.inc"
+ #include "XboxGamingXboxOnePostProcess_VSQuadNoCB.inc"
+ #include "XboxGamingXboxOnePostProcess_VSQuad.inc"
+
+ #include "XboxGamingXboxOnePostProcess_PSCopy.inc"
+ #include "XboxGamingXboxOnePostProcess_PSMonochrome.inc"
+ #include "XboxGamingXboxOnePostProcess_PSSepia.inc"
+ #include "XboxGamingXboxOnePostProcess_PSDownScale2x2.inc"
+ #include "XboxGamingXboxOnePostProcess_PSDownScale4x4.inc"
+ #include "XboxGamingXboxOnePostProcess_PSGaussianBlur5x5.inc"
+ #include "XboxGamingXboxOnePostProcess_PSBloomExtract.inc"
+ #include "XboxGamingXboxOnePostProcess_PSBloomBlur.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOnePostProcess_VSQuadNoCB.inc"
- #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"
+ #include "XboxOnePostProcess_VSQuadNoCB.inc"
+ #include "XboxOnePostProcess_VSQuad.inc"
+
+ #include "XboxOnePostProcess_PSCopy.inc"
+ #include "XboxOnePostProcess_PSMonochrome.inc"
+ #include "XboxOnePostProcess_PSSepia.inc"
+ #include "XboxOnePostProcess_PSDownScale2x2.inc"
+ #include "XboxOnePostProcess_PSDownScale4x4.inc"
+ #include "XboxOnePostProcess_PSGaussianBlur5x5.inc"
+ #include "XboxOnePostProcess_PSBloomExtract.inc"
+ #include "XboxOnePostProcess_PSBloomBlur.inc"
#else
- #include "Shaders/Compiled/PostProcess_VSQuadNoCB.inc"
- #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"
+ #include "PostProcess_VSQuadNoCB.inc"
+ #include "PostProcess_VSQuad.inc"
+
+ #include "PostProcess_PSCopy.inc"
+ #include "PostProcess_PSMonochrome.inc"
+ #include "PostProcess_PSSepia.inc"
+ #include "PostProcess_PSDownScale2x2.inc"
+ #include "PostProcess_PSDownScale4x4.inc"
+ #include "PostProcess_PSGaussianBlur5x5.inc"
+ #include "PostProcess_PSBloomExtract.inc"
+ #include "PostProcess_PSBloomBlur.inc"
#endif
}
@@ -152,9 +152,9 @@ namespace
ID3D12Device* GetDevice() const noexcept { return mDevice.Get(); }
protected:
- ComPtr mDevice;
- Microsoft::WRL::ComPtr mRootSignature[RootSignatureCount];
- std::mutex mMutex;
+ ComPtr mDevice;
+ ComPtr mRootSignature[RootSignatureCount];
+ std::mutex mMutex;
};
}
@@ -199,7 +199,7 @@ class BasicPostProcess::Impl : public AlignedNew
GraphicsResource mConstantBuffer;
// Per instance cache of PSOs, populated with variants for each shader & layout
- Microsoft::WRL::ComPtr mPipelineState;
+ ComPtr mPipelineState;
// Per instance root signature
ID3D12RootSignature* mRootSignature;
diff --git a/DirectXTK12/Src/CommonStates.cpp b/DirectXTK12/Src/CommonStates.cpp
index f9c32d5..fb5fdcd 100644
--- a/DirectXTK12/Src/CommonStates.cpp
+++ b/DirectXTK12/Src/CommonStates.cpp
@@ -161,6 +161,50 @@ const D3D12_DEPTH_STENCIL_DESC CommonStates::DepthRead =
} // BackFace
};
+const D3D12_DEPTH_STENCIL_DESC CommonStates::DepthReverseZ =
+{
+ TRUE, // DepthEnable
+ D3D12_DEPTH_WRITE_MASK_ALL,
+ D3D12_COMPARISON_FUNC_GREATER_EQUAL, // DepthFunc
+ FALSE, // StencilEnable
+ D3D12_DEFAULT_STENCIL_READ_MASK,
+ D3D12_DEFAULT_STENCIL_WRITE_MASK,
+ {
+ D3D12_STENCIL_OP_KEEP, // StencilFailOp
+ D3D12_STENCIL_OP_KEEP, // StencilDepthFailOp
+ D3D12_STENCIL_OP_KEEP, // StencilPassOp
+ D3D12_COMPARISON_FUNC_ALWAYS // StencilFunc
+ }, // FrontFace
+ {
+ D3D12_STENCIL_OP_KEEP, // StencilFailOp
+ D3D12_STENCIL_OP_KEEP, // StencilDepthFailOp
+ D3D12_STENCIL_OP_KEEP, // StencilPassOp
+ D3D12_COMPARISON_FUNC_ALWAYS // StencilFunc
+ } // BackFace
+};
+
+const D3D12_DEPTH_STENCIL_DESC CommonStates::DepthReadReverseZ =
+{
+ TRUE, // DepthEnable
+ D3D12_DEPTH_WRITE_MASK_ZERO,
+ D3D12_COMPARISON_FUNC_GREATER_EQUAL, // DepthFunc
+ FALSE, // StencilEnable
+ D3D12_DEFAULT_STENCIL_READ_MASK,
+ D3D12_DEFAULT_STENCIL_WRITE_MASK,
+ {
+ D3D12_STENCIL_OP_KEEP, // StencilFailOp
+ D3D12_STENCIL_OP_KEEP, // StencilDepthFailOp
+ D3D12_STENCIL_OP_KEEP, // StencilPassOp
+ D3D12_COMPARISON_FUNC_ALWAYS // StencilFunc
+ }, // FrontFace
+ {
+ D3D12_STENCIL_OP_KEEP, // StencilFailOp
+ D3D12_STENCIL_OP_KEEP, // StencilDepthFailOp
+ D3D12_STENCIL_OP_KEEP, // StencilPassOp
+ D3D12_COMPARISON_FUNC_ALWAYS // StencilFunc
+ } // BackFace
+};
+
// --------------------------------------------------------------------------
// Rasterizer States
@@ -409,7 +453,7 @@ class CommonStates::Impl
static const D3D12_SAMPLER_DESC SamplerDescs[static_cast(SamplerIndex::Count)];
- Impl(_In_ ID3D12Device* device)
+ explicit Impl(_In_ ID3D12Device* device)
: mDescriptors(device, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, static_cast(SamplerIndex::Count))
{
SetDebugObjectName(mDescriptors.Heap(), L"CommonStates");
@@ -518,9 +562,9 @@ const D3D12_SAMPLER_DESC CommonStates::Impl::SamplerDescs[] =
_Use_decl_annotations_
-CommonStates::CommonStates(ID3D12Device* device)
+CommonStates::CommonStates(ID3D12Device* device) :
+ pImpl(std::make_unique(device))
{
- pImpl = std::make_unique(device);
}
CommonStates::CommonStates(CommonStates&&) noexcept = default;
diff --git a/DirectXTK12/Src/DebugEffect.cpp b/DirectXTK12/Src/DebugEffect.cpp
index 8ad5044..4f4fb47 100644
--- a/DirectXTK12/Src/DebugEffect.cpp
+++ b/DirectXTK12/Src/DebugEffect.cpp
@@ -63,73 +63,73 @@ class DebugEffect::Impl : public EffectBase
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_VSDebug.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_VSDebugInst.inc"
+ #include "XboxGamingScarlettDebugEffect_VSDebug.inc"
+ #include "XboxGamingScarlettDebugEffect_VSDebugInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_VSDebugVc.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_VSDebugVcInst.inc"
+ #include "XboxGamingScarlettDebugEffect_VSDebugVc.inc"
+ #include "XboxGamingScarlettDebugEffect_VSDebugVcInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_VSDebugBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_VSDebugBnInst.inc"
+ #include "XboxGamingScarlettDebugEffect_VSDebugBn.inc"
+ #include "XboxGamingScarlettDebugEffect_VSDebugBnInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_VSDebugVcBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_VSDebugVcBnInst.inc"
+ #include "XboxGamingScarlettDebugEffect_VSDebugVcBn.inc"
+ #include "XboxGamingScarlettDebugEffect_VSDebugVcBnInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_PSHemiAmbient.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_PSRGBNormals.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_PSRGBTangents.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDebugEffect_PSRGBBiTangents.inc"
+ #include "XboxGamingScarlettDebugEffect_PSHemiAmbient.inc"
+ #include "XboxGamingScarlettDebugEffect_PSRGBNormals.inc"
+ #include "XboxGamingScarlettDebugEffect_PSRGBTangents.inc"
+ #include "XboxGamingScarlettDebugEffect_PSRGBBiTangents.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_VSDebug.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_VSDebugInst.inc"
+ #include "XboxGamingXboxOneDebugEffect_VSDebug.inc"
+ #include "XboxGamingXboxOneDebugEffect_VSDebugInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_VSDebugVc.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_VSDebugVcInst.inc"
+ #include "XboxGamingXboxOneDebugEffect_VSDebugVc.inc"
+ #include "XboxGamingXboxOneDebugEffect_VSDebugVcInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_VSDebugBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_VSDebugBnInst.inc"
+ #include "XboxGamingXboxOneDebugEffect_VSDebugBn.inc"
+ #include "XboxGamingXboxOneDebugEffect_VSDebugBnInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_VSDebugVcBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_VSDebugVcBnInst.inc"
+ #include "XboxGamingXboxOneDebugEffect_VSDebugVcBn.inc"
+ #include "XboxGamingXboxOneDebugEffect_VSDebugVcBnInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_PSHemiAmbient.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_PSRGBNormals.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_PSRGBTangents.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDebugEffect_PSRGBBiTangents.inc"
+ #include "XboxGamingXboxOneDebugEffect_PSHemiAmbient.inc"
+ #include "XboxGamingXboxOneDebugEffect_PSRGBNormals.inc"
+ #include "XboxGamingXboxOneDebugEffect_PSRGBTangents.inc"
+ #include "XboxGamingXboxOneDebugEffect_PSRGBBiTangents.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOneDebugEffect_VSDebug.inc"
- #include "Shaders/Compiled/XboxOneDebugEffect_VSDebugInst.inc"
+ #include "XboxOneDebugEffect_VSDebug.inc"
+ #include "XboxOneDebugEffect_VSDebugInst.inc"
- #include "Shaders/Compiled/XboxOneDebugEffect_VSDebugVc.inc"
- #include "Shaders/Compiled/XboxOneDebugEffect_VSDebugVcInst.inc"
+ #include "XboxOneDebugEffect_VSDebugVc.inc"
+ #include "XboxOneDebugEffect_VSDebugVcInst.inc"
- #include "Shaders/Compiled/XboxOneDebugEffect_VSDebugBn.inc"
- #include "Shaders/Compiled/XboxOneDebugEffect_VSDebugBnInst.inc"
+ #include "XboxOneDebugEffect_VSDebugBn.inc"
+ #include "XboxOneDebugEffect_VSDebugBnInst.inc"
- #include "Shaders/Compiled/XboxOneDebugEffect_VSDebugVcBn.inc"
- #include "Shaders/Compiled/XboxOneDebugEffect_VSDebugVcBnInst.inc"
+ #include "XboxOneDebugEffect_VSDebugVcBn.inc"
+ #include "XboxOneDebugEffect_VSDebugVcBnInst.inc"
- #include "Shaders/Compiled/XboxOneDebugEffect_PSHemiAmbient.inc"
- #include "Shaders/Compiled/XboxOneDebugEffect_PSRGBNormals.inc"
- #include "Shaders/Compiled/XboxOneDebugEffect_PSRGBTangents.inc"
- #include "Shaders/Compiled/XboxOneDebugEffect_PSRGBBiTangents.inc"
+ #include "XboxOneDebugEffect_PSHemiAmbient.inc"
+ #include "XboxOneDebugEffect_PSRGBNormals.inc"
+ #include "XboxOneDebugEffect_PSRGBTangents.inc"
+ #include "XboxOneDebugEffect_PSRGBBiTangents.inc"
#else
- #include "Shaders/Compiled/DebugEffect_VSDebug.inc"
- #include "Shaders/Compiled/DebugEffect_VSDebugInst.inc"
+ #include "DebugEffect_VSDebug.inc"
+ #include "DebugEffect_VSDebugInst.inc"
- #include "Shaders/Compiled/DebugEffect_VSDebugVc.inc"
- #include "Shaders/Compiled/DebugEffect_VSDebugVcInst.inc"
+ #include "DebugEffect_VSDebugVc.inc"
+ #include "DebugEffect_VSDebugVcInst.inc"
- #include "Shaders/Compiled/DebugEffect_VSDebugBn.inc"
- #include "Shaders/Compiled/DebugEffect_VSDebugBnInst.inc"
+ #include "DebugEffect_VSDebugBn.inc"
+ #include "DebugEffect_VSDebugBnInst.inc"
- #include "Shaders/Compiled/DebugEffect_VSDebugVcBn.inc"
- #include "Shaders/Compiled/DebugEffect_VSDebugVcBnInst.inc"
+ #include "DebugEffect_VSDebugVcBn.inc"
+ #include "DebugEffect_VSDebugVcBnInst.inc"
- #include "Shaders/Compiled/DebugEffect_PSHemiAmbient.inc"
- #include "Shaders/Compiled/DebugEffect_PSRGBNormals.inc"
- #include "Shaders/Compiled/DebugEffect_PSRGBTangents.inc"
- #include "Shaders/Compiled/DebugEffect_PSRGBBiTangents.inc"
+ #include "DebugEffect_PSHemiAmbient.inc"
+ #include "DebugEffect_PSRGBNormals.inc"
+ #include "DebugEffect_PSRGBTangents.inc"
+ #include "DebugEffect_PSRGBBiTangents.inc"
#endif
}
diff --git a/DirectXTK12/Src/DualPostProcess.cpp b/DirectXTK12/Src/DualPostProcess.cpp
index 58f9b61..148bf68 100644
--- a/DirectXTK12/Src/DualPostProcess.cpp
+++ b/DirectXTK12/Src/DualPostProcess.cpp
@@ -43,25 +43,25 @@ namespace
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_VSQuadDual.inc"
+ #include "XboxGamingScarlettPostProcess_VSQuadDual.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_PSMerge.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPostProcess_PSBloomCombine.inc"
+ #include "XboxGamingScarlettPostProcess_PSMerge.inc"
+ #include "XboxGamingScarlettPostProcess_PSBloomCombine.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_VSQuadDual.inc"
+ #include "XboxGamingXboxOnePostProcess_VSQuadDual.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_PSMerge.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePostProcess_PSBloomCombine.inc"
+ #include "XboxGamingXboxOnePostProcess_PSMerge.inc"
+ #include "XboxGamingXboxOnePostProcess_PSBloomCombine.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOnePostProcess_VSQuadDual.inc"
+ #include "XboxOnePostProcess_VSQuadDual.inc"
- #include "Shaders/Compiled/XboxOnePostProcess_PSMerge.inc"
- #include "Shaders/Compiled/XboxOnePostProcess_PSBloomCombine.inc"
+ #include "XboxOnePostProcess_PSMerge.inc"
+ #include "XboxOnePostProcess_PSBloomCombine.inc"
#else
- #include "Shaders/Compiled/PostProcess_VSQuadDual.inc"
+ #include "PostProcess_VSQuadDual.inc"
- #include "Shaders/Compiled/PostProcess_PSMerge.inc"
- #include "Shaders/Compiled/PostProcess_PSBloomCombine.inc"
+ #include "PostProcess_PSMerge.inc"
+ #include "PostProcess_PSBloomCombine.inc"
#endif
}
@@ -102,9 +102,9 @@ namespace
ID3D12Device* GetDevice() const noexcept { return mDevice.Get(); }
protected:
- ComPtr mDevice;
- Microsoft::WRL::ComPtr mRootSignature;
- std::mutex mMutex;
+ ComPtr mDevice;
+ ComPtr mRootSignature;
+ std::mutex mMutex;
};
}
diff --git a/DirectXTK12/Src/DualTextureEffect.cpp b/DirectXTK12/Src/DualTextureEffect.cpp
index 13c1a08..b8e8352 100644
--- a/DirectXTK12/Src/DualTextureEffect.cpp
+++ b/DirectXTK12/Src/DualTextureEffect.cpp
@@ -72,37 +72,37 @@ class DualTextureEffect::Impl : public EffectBase
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettDualTextureEffect_VSDualTexture.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDualTextureEffect_VSDualTextureNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDualTextureEffect_VSDualTextureVc.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDualTextureEffect_VSDualTextureVcNoFog.inc"
+ #include "XboxGamingScarlettDualTextureEffect_VSDualTexture.inc"
+ #include "XboxGamingScarlettDualTextureEffect_VSDualTextureNoFog.inc"
+ #include "XboxGamingScarlettDualTextureEffect_VSDualTextureVc.inc"
+ #include "XboxGamingScarlettDualTextureEffect_VSDualTextureVcNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDualTextureEffect_PSDualTexture.inc"
- #include "Shaders/Compiled/XboxGamingScarlettDualTextureEffect_PSDualTextureNoFog.inc"
+ #include "XboxGamingScarlettDualTextureEffect_PSDualTexture.inc"
+ #include "XboxGamingScarlettDualTextureEffect_PSDualTextureNoFog.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOneDualTextureEffect_VSDualTexture.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDualTextureEffect_VSDualTextureNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDualTextureEffect_VSDualTextureVc.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDualTextureEffect_VSDualTextureVcNoFog.inc"
+ #include "XboxGamingXboxOneDualTextureEffect_VSDualTexture.inc"
+ #include "XboxGamingXboxOneDualTextureEffect_VSDualTextureNoFog.inc"
+ #include "XboxGamingXboxOneDualTextureEffect_VSDualTextureVc.inc"
+ #include "XboxGamingXboxOneDualTextureEffect_VSDualTextureVcNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDualTextureEffect_PSDualTexture.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneDualTextureEffect_PSDualTextureNoFog.inc"
+ #include "XboxGamingXboxOneDualTextureEffect_PSDualTexture.inc"
+ #include "XboxGamingXboxOneDualTextureEffect_PSDualTextureNoFog.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOneDualTextureEffect_VSDualTexture.inc"
- #include "Shaders/Compiled/XboxOneDualTextureEffect_VSDualTextureNoFog.inc"
- #include "Shaders/Compiled/XboxOneDualTextureEffect_VSDualTextureVc.inc"
- #include "Shaders/Compiled/XboxOneDualTextureEffect_VSDualTextureVcNoFog.inc"
+ #include "XboxOneDualTextureEffect_VSDualTexture.inc"
+ #include "XboxOneDualTextureEffect_VSDualTextureNoFog.inc"
+ #include "XboxOneDualTextureEffect_VSDualTextureVc.inc"
+ #include "XboxOneDualTextureEffect_VSDualTextureVcNoFog.inc"
- #include "Shaders/Compiled/XboxOneDualTextureEffect_PSDualTexture.inc"
- #include "Shaders/Compiled/XboxOneDualTextureEffect_PSDualTextureNoFog.inc"
+ #include "XboxOneDualTextureEffect_PSDualTexture.inc"
+ #include "XboxOneDualTextureEffect_PSDualTextureNoFog.inc"
#else
- #include "Shaders/Compiled/DualTextureEffect_VSDualTexture.inc"
- #include "Shaders/Compiled/DualTextureEffect_VSDualTextureNoFog.inc"
- #include "Shaders/Compiled/DualTextureEffect_VSDualTextureVc.inc"
- #include "Shaders/Compiled/DualTextureEffect_VSDualTextureVcNoFog.inc"
+ #include "DualTextureEffect_VSDualTexture.inc"
+ #include "DualTextureEffect_VSDualTextureNoFog.inc"
+ #include "DualTextureEffect_VSDualTextureVc.inc"
+ #include "DualTextureEffect_VSDualTextureVcNoFog.inc"
- #include "Shaders/Compiled/DualTextureEffect_PSDualTexture.inc"
- #include "Shaders/Compiled/DualTextureEffect_PSDualTextureNoFog.inc"
+ #include "DualTextureEffect_PSDualTexture.inc"
+ #include "DualTextureEffect_PSDualTextureNoFog.inc"
#endif
}
diff --git a/DirectXTK12/Src/EffectCommon.cpp b/DirectXTK12/Src/EffectCommon.cpp
index 7f20d48..44ae0c7 100644
--- a/DirectXTK12/Src/EffectCommon.cpp
+++ b/DirectXTK12/Src/EffectCommon.cpp
@@ -385,7 +385,9 @@ void EffectLights::EnableDefaultLighting(_In_ IEffectLights* effect)
// Gets or lazily creates the specified root signature.
-ID3D12RootSignature* EffectDeviceResources::DemandCreateRootSig(_Inout_ Microsoft::WRL::ComPtr& rootSig, D3D12_ROOT_SIGNATURE_DESC const& desc)
+ID3D12RootSignature* EffectDeviceResources::DemandCreateRootSig(
+ _Inout_ ComPtr& rootSig,
+ D3D12_ROOT_SIGNATURE_DESC const& desc)
{
return DemandCreate(rootSig, mMutex, [&](ID3D12RootSignature** pResult) noexcept -> HRESULT
{
diff --git a/DirectXTK12/Src/EffectCommon.h b/DirectXTK12/Src/EffectCommon.h
index a7eb6f7..163ec73 100644
--- a/DirectXTK12/Src/EffectCommon.h
+++ b/DirectXTK12/Src/EffectCommon.h
@@ -173,6 +173,11 @@ namespace DirectX
return mDeviceResources->GetRootSignature(slot, rootSig);
}
+ ID3D12Device* GetDevice() const noexcept
+ {
+ return mDeviceResources->GetDevice();
+ }
+
// Fields.
EffectMatrices matrices;
EffectFog fog;
diff --git a/DirectXTK12/Src/EffectFactory.cpp b/DirectXTK12/Src/EffectFactory.cpp
index aa2c746..0ba392c 100644
--- a/DirectXTK12/Src/EffectFactory.cpp
+++ b/DirectXTK12/Src/EffectFactory.cpp
@@ -20,6 +20,39 @@
using namespace DirectX;
using Microsoft::WRL::ComPtr;
+namespace
+{
+ template
+ void SetMaterialProperties(_In_ T* effect, const EffectFactory::EffectInfo& info)
+ {
+ effect->EnableDefaultLighting();
+
+ effect->SetAlpha(info.alphaValue);
+
+ // Most DirectX Tool Kit effects do not have an ambient material color.
+
+ XMVECTOR color = XMLoadFloat3(&info.diffuseColor);
+ effect->SetDiffuseColor(color);
+
+ if (info.specularColor.x != 0 || info.specularColor.y != 0 || info.specularColor.z != 0)
+ {
+ color = XMLoadFloat3(&info.specularColor);
+ effect->SetSpecularColor(color);
+ effect->SetSpecularPower(info.specularPower);
+ }
+ else
+ {
+ effect->DisableSpecular();
+ }
+
+ if (info.emissiveColor.x != 0 || info.emissiveColor.y != 0 || info.emissiveColor.z != 0)
+ {
+ color = XMLoadFloat3(&info.emissiveColor);
+ effect->SetEmissiveColor(color);
+ }
+ }
+}
+
// Internal EffectFactory implementation class. Only one of these helpers is allocated
// per D3D device, even if there are multiple public facing EffectFactory instances.
class EffectFactory::Impl
@@ -69,6 +102,7 @@ class EffectFactory::Impl
EffectCache mEffectCacheSkinning;
EffectCache mEffectCacheDualTexture;
EffectCache mEffectCacheNormalMap;
+ EffectCache mEffectCacheNormalMapSkinned;
std::mutex mutex;
};
@@ -124,7 +158,6 @@ std::shared_ptr EffectFactory::Impl::CreateEffect(
std::wstring cacheName;
if (info.enableSkinning)
{
- // SkinnedEffect
int effectflags = (mEnablePerPixelLighting) ? EffectFlags::PerPixelLighting : EffectFlags::Lighting;
if (mEnableFog)
@@ -137,61 +170,91 @@ std::shared_ptr EffectFactory::Impl::CreateEffect(
effectflags |= EffectFlags::BiasedVertexNormals;
}
- if (mSharing && !info.name.empty())
+ if (info.enableNormalMaps && mUseNormalMapEffect)
{
- uint32_t hash = derivedPSD.ComputeHash();
- cacheName = std::to_wstring(effectflags) + info.name + std::to_wstring(hash);
+ // SkinnedNormalMapEffect
+ if (specularTextureIndex != -1)
+ {
+ effectflags |= EffectFlags::Specular;
+ }
- auto it = mEffectCacheSkinning.find(cacheName);
- if (mSharing && it != mEffectCacheSkinning.end())
+ if (mSharing && !info.name.empty())
{
- return it->second;
+ uint32_t hash = derivedPSD.ComputeHash();
+ cacheName = std::to_wstring(effectflags) + info.name + std::to_wstring(hash);
+
+ auto it = mEffectCacheNormalMapSkinned.find(cacheName);
+ if (mSharing && it != mEffectCacheNormalMapSkinned.end())
+ {
+ return it->second;
+ }
}
- }
- auto effect = std::make_shared(mDevice.Get(), effectflags, derivedPSD);
+ auto effect = std::make_shared(mDevice.Get(), effectflags, derivedPSD);
- effect->EnableDefaultLighting();
+ SetMaterialProperties(effect.get(), info);
- effect->SetAlpha(info.alphaValue);
+ if (diffuseTextureIndex != -1)
+ {
+ effect->SetTexture(
+ mTextureDescriptors->GetGpuHandle(static_cast(diffuseTextureIndex)),
+ mSamplerDescriptors->GetGpuHandle(static_cast(samplerIndex)));
+ }
- // Skinned Effect does not have an ambient material color, or per-vertex color support
+ if (specularTextureIndex != -1)
+ {
+ effect->SetSpecularTexture(mTextureDescriptors->GetGpuHandle(static_cast(specularTextureIndex)));
+ }
- XMVECTOR color = XMLoadFloat3(&info.diffuseColor);
- effect->SetDiffuseColor(color);
+ if (normalTextureIndex != -1)
+ {
+ effect->SetNormalTexture(mTextureDescriptors->GetGpuHandle(static_cast(normalTextureIndex)));
+ }
- if (info.specularColor.x != 0 || info.specularColor.y != 0 || info.specularColor.z != 0)
- {
- color = XMLoadFloat3(&info.specularColor);
- effect->SetSpecularColor(color);
- effect->SetSpecularPower(info.specularPower);
+ if (mSharing && !info.name.empty())
+ {
+ std::lock_guard lock(mutex);
+ EffectCache::value_type v(cacheName, effect);
+ mEffectCacheNormalMapSkinned.insert(v);
+ }
+
+ return std::move(effect);
}
else
{
- effect->DisableSpecular();
- }
+ // SkinnedEffect
+ if (mSharing && !info.name.empty())
+ {
+ uint32_t hash = derivedPSD.ComputeHash();
+ cacheName = std::to_wstring(effectflags) + info.name + std::to_wstring(hash);
+
+ auto it = mEffectCacheSkinning.find(cacheName);
+ if (mSharing && it != mEffectCacheSkinning.end())
+ {
+ return it->second;
+ }
+ }
- if (info.emissiveColor.x != 0 || info.emissiveColor.y != 0 || info.emissiveColor.z != 0)
- {
- color = XMLoadFloat3(&info.emissiveColor);
- effect->SetEmissiveColor(color);
- }
+ auto effect = std::make_shared(mDevice.Get(), effectflags, derivedPSD);
- if (diffuseTextureIndex != -1)
- {
- effect->SetTexture(
- mTextureDescriptors->GetGpuHandle(static_cast(diffuseTextureIndex)),
- mSamplerDescriptors->GetGpuHandle(static_cast(samplerIndex)));
- }
+ SetMaterialProperties(effect.get(), info);
- if (mSharing && !info.name.empty())
- {
- std::lock_guard lock(mutex);
- EffectCache::value_type v(cacheName, effect);
- mEffectCacheSkinning.insert(v);
- }
+ if (diffuseTextureIndex != -1)
+ {
+ effect->SetTexture(
+ mTextureDescriptors->GetGpuHandle(static_cast(diffuseTextureIndex)),
+ mSamplerDescriptors->GetGpuHandle(static_cast(samplerIndex)));
+ }
- return std::move(effect);
+ if (mSharing && !info.name.empty())
+ {
+ std::lock_guard lock(mutex);
+ EffectCache::value_type v(cacheName, effect);
+ mEffectCacheSkinning.insert(v);
+ }
+
+ return std::move(effect);
+ }
}
else if (info.enableDualTexture)
{
@@ -314,31 +377,7 @@ std::shared_ptr EffectFactory::Impl::CreateEffect(
auto effect = std::make_shared(mDevice.Get(), effectflags, derivedPSD);
- effect->EnableDefaultLighting();
-
- effect->SetAlpha(info.alphaValue);
-
- // NormalMap Effect does not have an ambient material color
-
- XMVECTOR color = XMLoadFloat3(&info.diffuseColor);
- effect->SetDiffuseColor(color);
-
- if (info.specularColor.x != 0 || info.specularColor.y != 0 || info.specularColor.z != 0)
- {
- color = XMLoadFloat3(&info.specularColor);
- effect->SetSpecularColor(color);
- effect->SetSpecularPower(info.specularPower);
- }
- else
- {
- effect->DisableSpecular();
- }
-
- if (info.emissiveColor.x != 0 || info.emissiveColor.y != 0 || info.emissiveColor.z != 0)
- {
- color = XMLoadFloat3(&info.emissiveColor);
- effect->SetEmissiveColor(color);
- }
+ SetMaterialProperties(effect.get(), info);
if (diffuseTextureIndex != -1)
{
@@ -406,30 +445,7 @@ std::shared_ptr EffectFactory::Impl::CreateEffect(
auto effect = std::make_shared(mDevice.Get(), effectflags, derivedPSD);
- effect->EnableDefaultLighting();
-
- effect->SetAlpha(info.alphaValue);
-
- // Basic Effect does not have an ambient material color
- XMVECTOR color = XMLoadFloat3(&info.diffuseColor);
- effect->SetDiffuseColor(color);
-
- if (info.specularColor.x != 0 || info.specularColor.y != 0 || info.specularColor.z != 0)
- {
- color = XMLoadFloat3(&info.specularColor);
- effect->SetSpecularColor(color);
- effect->SetSpecularPower(info.specularPower);
- }
- else
- {
- effect->DisableSpecular();
- }
-
- if (info.emissiveColor.x != 0 || info.emissiveColor.y != 0 || info.emissiveColor.z != 0)
- {
- color = XMLoadFloat3(&info.emissiveColor);
- effect->SetEmissiveColor(color);
- }
+ SetMaterialProperties(effect.get(), info);
if (diffuseTextureIndex != -1)
{
@@ -456,6 +472,7 @@ void EffectFactory::Impl::ReleaseCache()
mEffectCacheSkinning.clear();
mEffectCacheDualTexture.clear();
mEffectCacheNormalMap.clear();
+ mEffectCacheNormalMapSkinned.clear();
}
@@ -464,9 +481,9 @@ void EffectFactory::Impl::ReleaseCache()
// EffectFactory
//--------------------------------------------------------------------------------------
-EffectFactory::EffectFactory(_In_ ID3D12Device* device)
+EffectFactory::EffectFactory(_In_ ID3D12Device* device) :
+ pImpl(std::make_shared(device, nullptr, nullptr))
{
- pImpl = std::make_shared(device, nullptr, nullptr);
}
EffectFactory::EffectFactory(_In_ ID3D12DescriptorHeap* textureDescriptors, _In_ ID3D12DescriptorHeap* samplerDescriptors)
diff --git a/DirectXTK12/Src/EffectTextureFactory.cpp b/DirectXTK12/Src/EffectTextureFactory.cpp
index 499d6da..828e2c8 100644
--- a/DirectXTK12/Src/EffectTextureFactory.cpp
+++ b/DirectXTK12/Src/EffectTextureFactory.cpp
@@ -216,9 +216,9 @@ _Use_decl_annotations_
EffectTextureFactory::EffectTextureFactory(
ID3D12Device* device,
ResourceUploadBatch& resourceUploadBatch,
- ID3D12DescriptorHeap* descriptorHeap) noexcept(false)
+ ID3D12DescriptorHeap* descriptorHeap) noexcept(false) :
+ pImpl(std::make_unique(device, resourceUploadBatch, descriptorHeap))
{
- pImpl = std::make_unique(device, resourceUploadBatch, descriptorHeap);
}
_Use_decl_annotations_
@@ -226,9 +226,9 @@ EffectTextureFactory::EffectTextureFactory(
ID3D12Device* device,
ResourceUploadBatch& resourceUploadBatch,
size_t numDescriptors,
- D3D12_DESCRIPTOR_HEAP_FLAGS descriptorHeapFlags) noexcept(false)
+ D3D12_DESCRIPTOR_HEAP_FLAGS descriptorHeapFlags) noexcept(false) :
+ pImpl(std::make_unique(device, resourceUploadBatch, numDescriptors, descriptorHeapFlags))
{
- pImpl = std::make_unique(device, resourceUploadBatch, numDescriptors, descriptorHeapFlags);
}
diff --git a/DirectXTK12/Src/EnvironmentMapEffect.cpp b/DirectXTK12/Src/EnvironmentMapEffect.cpp
index 0b62711..301d7e5 100644
--- a/DirectXTK12/Src/EnvironmentMapEffect.cpp
+++ b/DirectXTK12/Src/EnvironmentMapEffect.cpp
@@ -90,113 +90,113 @@ class EnvironmentMapEffect::Impl : public EffectBase
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_VSEnvMap.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_VSEnvMapFresnel.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_VSEnvMapPixelLighting.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_VSEnvMapBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_VSEnvMapFresnelBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_VSEnvMapPixelLightingBn.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMap.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpecular.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpecularNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapPixelLighting.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapPixelLightingNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapPixelLightingFresnel.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapPixelLightingFresnelNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpherePixelLighting.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpherePixelLightingNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnel.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnelNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapDualParabolaPixelLighting.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnel.inc"
- #include "Shaders/Compiled/XboxGamingScarlettEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnelNoFog.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_VSEnvMap.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_VSEnvMapFresnel.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_VSEnvMapPixelLighting.inc"
+
+ #include "XboxGamingScarlettEnvironmentMapEffect_VSEnvMapBn.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_VSEnvMapFresnelBn.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_VSEnvMapPixelLightingBn.inc"
+
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMap.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapNoFog.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpecular.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpecularNoFog.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapPixelLighting.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapPixelLightingNoFog.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapPixelLightingFresnel.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapPixelLightingFresnelNoFog.inc"
+
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpherePixelLighting.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpherePixelLightingNoFog.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnel.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnelNoFog.inc"
+
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapDualParabolaPixelLighting.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingNoFog.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnel.inc"
+ #include "XboxGamingScarlettEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnelNoFog.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_VSEnvMap.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_VSEnvMapFresnel.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_VSEnvMapPixelLighting.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_VSEnvMapBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_VSEnvMapFresnelBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_VSEnvMapPixelLightingBn.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMap.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpecular.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpecularNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapPixelLighting.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapPixelLightingNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapPixelLightingFresnel.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapPixelLightingFresnelNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLighting.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnel.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnelNoFog.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLighting.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnel.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnelNoFog.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_VSEnvMap.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_VSEnvMapFresnel.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_VSEnvMapPixelLighting.inc"
+
+ #include "XboxGamingXboxOneEnvironmentMapEffect_VSEnvMapBn.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_VSEnvMapFresnelBn.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_VSEnvMapPixelLightingBn.inc"
+
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMap.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapNoFog.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpecular.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpecularNoFog.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapPixelLighting.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapPixelLightingNoFog.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapPixelLightingFresnel.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapPixelLightingFresnelNoFog.inc"
+
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLighting.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingNoFog.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnel.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnelNoFog.inc"
+
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLighting.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingNoFog.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnel.inc"
+ #include "XboxGamingXboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnelNoFog.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_VSEnvMap.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_VSEnvMapFresnel.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_VSEnvMapPixelLighting.inc"
-
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_VSEnvMapBn.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_VSEnvMapFresnelBn.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_VSEnvMapPixelLightingBn.inc"
-
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMap.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapNoFog.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapSpecular.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapSpecularNoFog.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapPixelLighting.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapPixelLightingNoFog.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapPixelLightingFresnel.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapPixelLightingFresnelNoFog.inc"
-
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLighting.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingNoFog.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnel.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnelNoFog.inc"
-
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLighting.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingNoFog.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnel.inc"
- #include "Shaders/Compiled/XboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnelNoFog.inc"
+ #include "XboxOneEnvironmentMapEffect_VSEnvMap.inc"
+ #include "XboxOneEnvironmentMapEffect_VSEnvMapFresnel.inc"
+ #include "XboxOneEnvironmentMapEffect_VSEnvMapPixelLighting.inc"
+
+ #include "XboxOneEnvironmentMapEffect_VSEnvMapBn.inc"
+ #include "XboxOneEnvironmentMapEffect_VSEnvMapFresnelBn.inc"
+ #include "XboxOneEnvironmentMapEffect_VSEnvMapPixelLightingBn.inc"
+
+ #include "XboxOneEnvironmentMapEffect_PSEnvMap.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapNoFog.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapSpecular.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapSpecularNoFog.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapPixelLighting.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapPixelLightingNoFog.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapPixelLightingFresnel.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapPixelLightingFresnelNoFog.inc"
+
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLighting.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingNoFog.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnel.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnelNoFog.inc"
+
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLighting.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingNoFog.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnel.inc"
+ #include "XboxOneEnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnelNoFog.inc"
#else
- #include "Shaders/Compiled/EnvironmentMapEffect_VSEnvMap.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_VSEnvMapFresnel.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_VSEnvMapPixelLighting.inc"
-
- #include "Shaders/Compiled/EnvironmentMapEffect_VSEnvMapBn.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_VSEnvMapFresnelBn.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_VSEnvMapPixelLightingBn.inc"
-
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMap.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapNoFog.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecular.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpecularNoFog.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapPixelLighting.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapPixelLightingNoFog.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapPixelLightingFresnel.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapPixelLightingFresnelNoFog.inc"
-
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpherePixelLighting.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpherePixelLightingNoFog.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnel.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnelNoFog.inc"
-
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapDualParabolaPixelLighting.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingNoFog.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnel.inc"
- #include "Shaders/Compiled/EnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnelNoFog.inc"
+ #include "EnvironmentMapEffect_VSEnvMap.inc"
+ #include "EnvironmentMapEffect_VSEnvMapFresnel.inc"
+ #include "EnvironmentMapEffect_VSEnvMapPixelLighting.inc"
+
+ #include "EnvironmentMapEffect_VSEnvMapBn.inc"
+ #include "EnvironmentMapEffect_VSEnvMapFresnelBn.inc"
+ #include "EnvironmentMapEffect_VSEnvMapPixelLightingBn.inc"
+
+ #include "EnvironmentMapEffect_PSEnvMap.inc"
+ #include "EnvironmentMapEffect_PSEnvMapNoFog.inc"
+ #include "EnvironmentMapEffect_PSEnvMapSpecular.inc"
+ #include "EnvironmentMapEffect_PSEnvMapSpecularNoFog.inc"
+ #include "EnvironmentMapEffect_PSEnvMapPixelLighting.inc"
+ #include "EnvironmentMapEffect_PSEnvMapPixelLightingNoFog.inc"
+ #include "EnvironmentMapEffect_PSEnvMapPixelLightingFresnel.inc"
+ #include "EnvironmentMapEffect_PSEnvMapPixelLightingFresnelNoFog.inc"
+
+ #include "EnvironmentMapEffect_PSEnvMapSpherePixelLighting.inc"
+ #include "EnvironmentMapEffect_PSEnvMapSpherePixelLightingNoFog.inc"
+ #include "EnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnel.inc"
+ #include "EnvironmentMapEffect_PSEnvMapSpherePixelLightingFresnelNoFog.inc"
+
+ #include "EnvironmentMapEffect_PSEnvMapDualParabolaPixelLighting.inc"
+ #include "EnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingNoFog.inc"
+ #include "EnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnel.inc"
+ #include "EnvironmentMapEffect_PSEnvMapDualParabolaPixelLightingFresnelNoFog.inc"
#endif
}
diff --git a/DirectXTK12/Src/ModelLoadCMO.cpp b/DirectXTK12/Src/ModelLoadCMO.cpp
index 542890c..4ba4f8a 100644
--- a/DirectXTK12/Src/ModelLoadCMO.cpp
+++ b/DirectXTK12/Src/ModelLoadCMO.cpp
@@ -773,7 +773,7 @@ std::unique_ptr DirectX::Model::CreateFromCMO(
}
}
- bool enableSkinning = (*nSkinVBs) != 0;
+ bool enableSkinning = (*nSkinVBs) != 0 && !(flags & ModelLoader_DisableSkinning);
// Build vertex buffers
std::vector vbs;
diff --git a/DirectXTK12/Src/ModelLoadSDKMESH.cpp b/DirectXTK12/Src/ModelLoadSDKMESH.cpp
index 2e761df..5d527ea 100644
--- a/DirectXTK12/Src/ModelLoadSDKMESH.cpp
+++ b/DirectXTK12/Src/ModelLoadSDKMESH.cpp
@@ -102,18 +102,9 @@ namespace
flags &= ~static_cast(DUAL_TEXTURE);
}
- if (flags & NORMAL_MAPS)
+ if (mh.NormalTexture[0])
{
- if (!mh.NormalTexture[0])
- {
- flags &= ~static_cast(NORMAL_MAPS);
- *normalName = 0;
- }
- }
- else if (mh.NormalTexture[0])
- {
- DebugTrace("WARNING: Material '%s' has a normal map, but vertex buffer is missing tangents\n", mh.Name);
- *normalName = 0;
+ flags |= NORMAL_MAPS;
}
m = {};
@@ -287,11 +278,6 @@ namespace
if (unk)
break;
- if (decl[index].Usage == D3DDECLUSAGE_TANGENT)
- {
- flags |= NORMAL_MAPS;
- }
-
inputDesc.push_back(desc);
}
else if (decl[index].Usage == D3DDECLUSAGE_COLOR)
@@ -520,15 +506,15 @@ std::unique_ptr DirectX::Model::CreateFromSDKMESH(
vbDecls[j] = std::make_shared();
unsigned int ilflags = GetInputLayoutDesc(vh.Decl, *vbDecls[j].get());
- if (ilflags & SKINNING)
+ if (flags & ModelLoader_DisableSkinning)
{
- ilflags &= ~static_cast(DUAL_TEXTURE | NORMAL_MAPS);
+ ilflags &= ~static_cast(SKINNING);
}
- if (ilflags & DUAL_TEXTURE)
+
+ if (ilflags & SKINNING)
{
- ilflags &= ~static_cast(NORMAL_MAPS);
+ ilflags &= ~static_cast(DUAL_TEXTURE);
}
-
if (ilflags & USES_OBSOLETE_DEC3N)
{
dec3nwarning = true;
diff --git a/DirectXTK12/Src/NormalMapEffect.cpp b/DirectXTK12/Src/NormalMapEffect.cpp
index 5ae5e2f..cc75f9d 100644
--- a/DirectXTK12/Src/NormalMapEffect.cpp
+++ b/DirectXTK12/Src/NormalMapEffect.cpp
@@ -10,6 +10,14 @@
#include "pch.h"
#include "EffectCommon.h"
+namespace DirectX
+{
+ namespace EffectDirtyFlags
+ {
+ constexpr int ConstantBufferBones = 0x100000;
+ }
+}
+
using namespace DirectX;
namespace
@@ -37,15 +45,22 @@ namespace
static_assert((sizeof(NormalMapEffectConstants) % 16) == 0, "CB size not padded correctly");
+ XM_ALIGNED_STRUCT(16) BoneConstants
+ {
+ XMVECTOR Bones[SkinnedNormalMapEffect::MaxBones][3];
+ };
+
+ static_assert((sizeof(BoneConstants) % 16) == 0, "CB size not padded correctly");
+
// Traits type describes our characteristics to the EffectBase template.
struct NormalMapEffectTraits
{
using ConstantBufferType = NormalMapEffectConstants;
- static constexpr int VertexShaderCount = 16;
+ static constexpr int VertexShaderCount = 20;
static constexpr int PixelShaderCount = 4;
- static constexpr int ShaderPermutationCount = 32;
+ static constexpr int ShaderPermutationCount = 40;
static constexpr int RootSignatureCount = 2;
};
}
@@ -54,7 +69,13 @@ namespace
class NormalMapEffect::Impl : public EffectBase
{
public:
- Impl(_In_ ID3D12Device* device, uint32_t effectFlags, const EffectPipelineStateDescription& pipelineDescription);
+ explicit Impl(_In_ ID3D12Device* device);
+
+ void Initialize(
+ _In_ ID3D12Device* device,
+ uint32_t effectFlags,
+ const EffectPipelineStateDescription& pipelineDescription,
+ bool enableSkinning);
enum RootParameterIndex
{
@@ -62,15 +83,17 @@ class NormalMapEffect::Impl : public EffectBase
TextureNormalSRV,
TextureSampler,
ConstantBuffer,
+ ConstantBufferBones,
TextureSpecularSRV,
RootParameterCount
};
+ int weightsPerVertex;
bool specularMap;
D3D12_GPU_DESCRIPTOR_HANDLE texture;
- D3D12_GPU_DESCRIPTOR_HANDLE specular;
D3D12_GPU_DESCRIPTOR_HANDLE normal;
+ D3D12_GPU_DESCRIPTOR_HANDLE specular;
D3D12_GPU_DESCRIPTOR_HANDLE sampler;
EffectLights lights;
@@ -78,6 +101,11 @@ class NormalMapEffect::Impl : public EffectBase
int GetPipelineStatePermutation(uint32_t effectFlags) const noexcept;
void Apply(_In_ ID3D12GraphicsCommandList* commandList);
+
+ BoneConstants boneConstants;
+
+private:
+ GraphicsResource mBones;
};
@@ -85,105 +113,125 @@ class NormalMapEffect::Impl : public EffectBase
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTx.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVc.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxNoSpec.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcNoSpec.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxNoSpecBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBn.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxNoSpecInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcNoSpecInst.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxBnInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcBnInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxNoSpecBnInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBnInst.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_PSNormalPixelLightingTx.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_PSNormalPixelLightingTxNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_PSNormalPixelLightingTxNoSpec.inc"
- #include "Shaders/Compiled/XboxGamingScarlettNormalMapEffect_PSNormalPixelLightingTxNoFogSpec.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTx.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVc.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxNoSpec.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcNoSpec.inc"
+
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxBn.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcBn.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxNoSpecBn.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBn.inc"
+
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxInst.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcInst.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxNoSpecInst.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcNoSpecInst.inc"
+
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxBnInst.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcBnInst.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxNoSpecBnInst.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBnInst.inc"
+
+ #include "XboxGamingScarlettNormalMapEffect_VSSkinnedPixelLightingTx.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSSkinnedPixelLightingTxBn.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSSkinnedPixelLightingTxNoSpec.inc"
+ #include "XboxGamingScarlettNormalMapEffect_VSSkinnedPixelLightingTxNoSpecBn.inc"
+
+ #include "XboxGamingScarlettNormalMapEffect_PSNormalPixelLightingTx.inc"
+ #include "XboxGamingScarlettNormalMapEffect_PSNormalPixelLightingTxNoFog.inc"
+ #include "XboxGamingScarlettNormalMapEffect_PSNormalPixelLightingTxNoSpec.inc"
+ #include "XboxGamingScarlettNormalMapEffect_PSNormalPixelLightingTxNoFogSpec.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTx.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVc.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpec.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpec.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBn.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecInst.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxBnInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcBnInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecBnInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBnInst.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_PSNormalPixelLightingTx.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_PSNormalPixelLightingTxNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_PSNormalPixelLightingTxNoSpec.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneNormalMapEffect_PSNormalPixelLightingTxNoFogSpec.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTx.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVc.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpec.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpec.inc"
+
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxBn.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcBn.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecBn.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBn.inc"
+
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxInst.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcInst.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecInst.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecInst.inc"
+
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxBnInst.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcBnInst.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecBnInst.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBnInst.inc"
+
+ #include "XboxGamingXboxOneNormalMapEffect_VSSkinnedPixelLightingTx.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSSkinnedPixelLightingTxBn.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSSkinnedPixelLightingTxNoSpec.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_VSSkinnedPixelLightingTxNoSpecBn.inc"
+
+ #include "XboxGamingXboxOneNormalMapEffect_PSNormalPixelLightingTx.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_PSNormalPixelLightingTxNoFog.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_PSNormalPixelLightingTxNoSpec.inc"
+ #include "XboxGamingXboxOneNormalMapEffect_PSNormalPixelLightingTxNoFogSpec.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTx.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxVc.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpec.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpec.inc"
-
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxBn.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxVcBn.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecBn.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBn.inc"
-
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxInst.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxVcInst.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecInst.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecInst.inc"
-
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxBnInst.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxVcBnInst.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecBnInst.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBnInst.inc"
-
- #include "Shaders/Compiled/XboxOneNormalMapEffect_PSNormalPixelLightingTx.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_PSNormalPixelLightingTxNoFog.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_PSNormalPixelLightingTxNoSpec.inc"
- #include "Shaders/Compiled/XboxOneNormalMapEffect_PSNormalPixelLightingTxNoFogSpec.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTx.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxVc.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpec.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpec.inc"
+
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxBn.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxVcBn.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecBn.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBn.inc"
+
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxInst.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxVcInst.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecInst.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecInst.inc"
+
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxBnInst.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxVcBnInst.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxNoSpecBnInst.inc"
+ #include "XboxOneNormalMapEffect_VSNormalPixelLightingTxVcNoSpecBnInst.inc"
+
+ #include "XboxOneNormalMapEffect_VSSkinnedPixelLightingTx.inc"
+ #include "XboxOneNormalMapEffect_VSSkinnedPixelLightingTxBn.inc"
+ #include "XboxOneNormalMapEffect_VSSkinnedPixelLightingTxNoSpec.inc"
+ #include "XboxOneNormalMapEffect_VSSkinnedPixelLightingTxNoSpecBn.inc"
+
+ #include "XboxOneNormalMapEffect_PSNormalPixelLightingTx.inc"
+ #include "XboxOneNormalMapEffect_PSNormalPixelLightingTxNoFog.inc"
+ #include "XboxOneNormalMapEffect_PSNormalPixelLightingTxNoSpec.inc"
+ #include "XboxOneNormalMapEffect_PSNormalPixelLightingTxNoFogSpec.inc"
#else
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTx.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxVc.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxNoSpec.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxVcNoSpec.inc"
-
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxBn.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxVcBn.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxNoSpecBn.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxVcNoSpecBn.inc"
-
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxInst.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxVcInst.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxNoSpecInst.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxVcNoSpecInst.inc"
-
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxBnInst.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxVcBnInst.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxNoSpecBnInst.inc"
- #include "Shaders/Compiled/NormalMapEffect_VSNormalPixelLightingTxVcNoSpecBnInst.inc"
-
- #include "Shaders/Compiled/NormalMapEffect_PSNormalPixelLightingTx.inc"
- #include "Shaders/Compiled/NormalMapEffect_PSNormalPixelLightingTxNoFog.inc"
- #include "Shaders/Compiled/NormalMapEffect_PSNormalPixelLightingTxNoSpec.inc"
- #include "Shaders/Compiled/NormalMapEffect_PSNormalPixelLightingTxNoFogSpec.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTx.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxVc.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxNoSpec.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxVcNoSpec.inc"
+
+ #include "NormalMapEffect_VSNormalPixelLightingTxBn.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxVcBn.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxNoSpecBn.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxVcNoSpecBn.inc"
+
+ #include "NormalMapEffect_VSNormalPixelLightingTxInst.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxVcInst.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxNoSpecInst.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxVcNoSpecInst.inc"
+
+ #include "NormalMapEffect_VSNormalPixelLightingTxBnInst.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxVcBnInst.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxNoSpecBnInst.inc"
+ #include "NormalMapEffect_VSNormalPixelLightingTxVcNoSpecBnInst.inc"
+
+ #include "NormalMapEffect_VSSkinnedPixelLightingTx.inc"
+ #include "NormalMapEffect_VSSkinnedPixelLightingTxBn.inc"
+ #include "NormalMapEffect_VSSkinnedPixelLightingTxNoSpec.inc"
+ #include "NormalMapEffect_VSSkinnedPixelLightingTxNoSpecBn.inc"
+
+ #include "NormalMapEffect_PSNormalPixelLightingTx.inc"
+ #include "NormalMapEffect_PSNormalPixelLightingTxNoFog.inc"
+ #include "NormalMapEffect_PSNormalPixelLightingTxNoSpec.inc"
+ #include "NormalMapEffect_PSNormalPixelLightingTxNoFogSpec.inc"
#endif
}
@@ -214,6 +262,11 @@ const D3D12_SHADER_BYTECODE EffectBase::VertexShaderBytec
{ NormalMapEffect_VSNormalPixelLightingTxNoSpecBnInst, sizeof(NormalMapEffect_VSNormalPixelLightingTxNoSpecBnInst) },
{ NormalMapEffect_VSNormalPixelLightingTxVcNoSpecBnInst, sizeof(NormalMapEffect_VSNormalPixelLightingTxVcNoSpecBnInst) },
+
+ { NormalMapEffect_VSSkinnedPixelLightingTx, sizeof(NormalMapEffect_VSSkinnedPixelLightingTx) },
+ { NormalMapEffect_VSSkinnedPixelLightingTxBn, sizeof(NormalMapEffect_VSSkinnedPixelLightingTxBn) },
+ { NormalMapEffect_VSSkinnedPixelLightingTxNoSpec, sizeof(NormalMapEffect_VSSkinnedPixelLightingTxNoSpec) },
+ { NormalMapEffect_VSSkinnedPixelLightingTxNoSpecBn, sizeof(NormalMapEffect_VSSkinnedPixelLightingTxNoSpecBn) },
};
@@ -222,43 +275,53 @@ const int EffectBase::VertexShaderIndices[] =
{
0, // pixel lighting + texture
0, // pixel lighting + texture, no fog
- 1, // pixel lighting + texture + vertex color
- 1, // pixel lighting + texture + vertex color, no fog
-
4, // pixel lighting + texture, no specular
4, // pixel lighting + texture, no fog or specular
- 5, // pixel lighting + texture + vertex color, no specular
- 5, // pixel lighting + texture + vertex color, no fog or specular
2, // pixel lighting (biased vertex normal) + texture
2, // pixel lighting (biased vertex normal) + texture, no fog
- 3, // pixel lighting (biased vertex normal) + texture + vertex color
- 3, // pixel lighting (biased vertex normal) + texture + vertex color, no fog
-
6, // pixel lighting (biased vertex normal) + texture, no specular
6, // pixel lighting (biased vertex normal) + texture, no fog or specular
+
+ 1, // pixel lighting + texture + vertex color
+ 1, // pixel lighting + texture + vertex color, no fog
+ 5, // pixel lighting + texture + vertex color, no specular
+ 5, // pixel lighting + texture + vertex color, no fog or specular
+
+ 3, // pixel lighting (biased vertex normal) + texture + vertex color
+ 3, // pixel lighting (biased vertex normal) + texture + vertex color, no fog
7, // pixel lighting (biased vertex normal) + texture + vertex color, no specular
7, // pixel lighting (biased vertex normal) + texture + vertex color, no fog or specular
8, // instancing + pixel lighting + texture
8, // instancing + pixel lighting + texture, no fog
- 9, // instancing + pixel lighting + texture + vertex color
- 9, // instancing + pixel lighting + texture + vertex color, no fog
-
12, // instancing + pixel lighting + texture, no specular
12, // instancing + pixel lighting + texture, no fog or specular
- 13, // instancing + pixel lighting + texture + vertex color, no specular
- 13, // instancing + pixel lighting + texture + vertex color, no fog or specular
10, // instancing + pixel lighting (biased vertex normal) + texture
10, // instancing + pixel lighting (biased vertex normal) + texture, no fog
- 11, // instancing + pixel lighting (biased vertex normal) + texture + vertex color
- 11, // instancing + pixel lighting (biased vertex normal) + texture + vertex color, no fog
-
14, // instancing + pixel lighting (biased vertex normal) + texture, no specular
14, // instancing + pixel lighting (biased vertex normal) + texture, no fog or specular
+
+ 9, // instancing + pixel lighting + texture + vertex color
+ 9, // instancing + pixel lighting + texture + vertex color, no fog
+ 13, // instancing + pixel lighting + texture + vertex color, no specular
+ 13, // instancing + pixel lighting + texture + vertex color, no fog or specular
+
+ 11, // instancing + pixel lighting (biased vertex normal) + texture + vertex color
+ 11, // instancing + pixel lighting (biased vertex normal) + texture + vertex color, no fog
15, // instancing + pixel lighting (biased vertex normal) + texture + vertex color, no specular
15, // instancing + pixel lighting (biased vertex normal) + texture + vertex color, no fog or specular
+
+ 16, // skinning + pixel lighting + texture
+ 16, // skinning + pixel lighting + texture, no fog
+ 18, // skinning + pixel lighting + texture, no specular
+ 18, // skinning + pixel lighting + texture, no fog or specular
+
+ 17, // skinning + pixel lighting (biased vertex normal) + texture
+ 17, // skinning + pixel lighting (biased vertex normal) + texture, no fog
+ 19, // skinning + pixel lighting (biased vertex normal) + texture, no specular
+ 19, // skinning + pixel lighting (biased vertex normal) + texture, no fog or specular
};
@@ -277,43 +340,53 @@ const int EffectBase::PixelShaderIndices[] =
{
0, // pixel lighting + texture
1, // pixel lighting + texture, no fog
- 0, // pixel lighting + texture + vertex color
- 1, // pixel lighting + texture + vertex color, no fog
-
2, // pixel lighting + texture, no specular
3, // pixel lighting + texture, no fog or specular
- 2, // pixel lighting + texture + vertex color, no specular
- 3, // pixel lighting + texture + vertex color, no fog or specular
0, // pixel lighting (biased vertex normal) + texture
1, // pixel lighting (biased vertex normal) + texture, no fog
- 0, // pixel lighting (biased vertex normal) + texture + vertex color
- 1, // pixel lighting (biased vertex normal) + texture + vertex color, no fog
-
2, // pixel lighting (biased vertex normal) + texture, no specular
3, // pixel lighting (biased vertex normal) + texture, no fog or specular
+
+ 0, // pixel lighting + texture + vertex color
+ 1, // pixel lighting + texture + vertex color, no fog
+ 2, // pixel lighting + texture + vertex color, no specular
+ 3, // pixel lighting + texture + vertex color, no fog or specular
+
+ 0, // pixel lighting (biased vertex normal) + texture + vertex color
+ 1, // pixel lighting (biased vertex normal) + texture + vertex color, no fog
2, // pixel lighting (biased vertex normal) + texture + vertex color, no specular
3, // pixel lighting (biased vertex normal) + texture + vertex color, no fog or specular
0, // instancing + pixel lighting + texture
1, // instancing + pixel lighting + texture, no fog
- 0, // instancing + pixel lighting + texture + vertex color
- 1, // instancing + pixel lighting + texture + vertex color, no fog
-
2, // instancing + pixel lighting + texture, no specular
3, // instancing + pixel lighting + texture, no fog or specular
- 2, // instancing + pixel lighting + texture + vertex color, no specular
- 3, // instancing + pixel lighting + texture + vertex color, no fog or specular
0, // instancing + pixel lighting (biased vertex normal) + texture
1, // instancing + pixel lighting (biased vertex normal) + texture, no fog
- 0, // instancing + pixel lighting (biased vertex normal) + texture + vertex color
- 1, // instancing + pixel lighting (biased vertex normal) + texture + vertex color, no fog
-
2, // instancing + pixel lighting (biased vertex normal) + texture, no specular
3, // instancing + pixel lighting (biased vertex normal) + texture, no fog or specular
+
+ 0, // instancing + pixel lighting + texture + vertex color
+ 1, // instancing + pixel lighting + texture + vertex color, no fog
+ 2, // instancing + pixel lighting + texture + vertex color, no specular
+ 3, // instancing + pixel lighting + texture + vertex color, no fog or specular
+
+ 0, // instancing + pixel lighting (biased vertex normal) + texture + vertex color
+ 1, // instancing + pixel lighting (biased vertex normal) + texture + vertex color, no fog
2, // instancing + pixel lighting (biased vertex normal) + texture + vertex color, no specular
3, // instancing + pixel lighting (biased vertex normal) + texture + vertex color, no fog or specular
+
+ 0, // skinning + pixel lighting + texture
+ 1, // skinning + pixel lighting + texture, no fog
+ 2, // skinning + pixel lighting + texture, no specular
+ 3, // skinning + pixel lighting + texture, no fog or specular
+
+ 0, // skinning + pixel lighting (biased vertex normal) + texture
+ 1, // skinning + pixel lighting (biased vertex normal) + texture, no fog
+ 2, // skinning + pixel lighting (biased vertex normal) + texture, no specular
+ 3, // skinning + pixel lighting (biased vertex normal) + texture, no fog or specular
};
// Global pool of per-device NormalMapEffect resources.
@@ -323,23 +396,55 @@ SharedResourcePool::DeviceResou
// Constructor.
NormalMapEffect::Impl::Impl(
- _In_ ID3D12Device* device,
- uint32_t effectFlags,
- const EffectPipelineStateDescription& pipelineDescription)
+ _In_ ID3D12Device* device)
: EffectBase(device),
- specularMap((effectFlags & EffectFlags::Specular) != 0),
+ weightsPerVertex(0),
+ specularMap(false),
texture{},
- specular{},
normal{},
- sampler{}
+ specular{},
+ sampler{},
+ boneConstants{}
{
static_assert(static_cast(std::size(EffectBase::VertexShaderIndices)) == NormalMapEffectTraits::ShaderPermutationCount, "array/max mismatch");
static_assert(static_cast(std::size(EffectBase::VertexShaderBytecode)) == NormalMapEffectTraits::VertexShaderCount, "array/max mismatch");
static_assert(static_cast(std::size(EffectBase::PixelShaderBytecode)) == NormalMapEffectTraits::PixelShaderCount, "array/max mismatch");
static_assert(static_cast(std::size(EffectBase::PixelShaderIndices)) == NormalMapEffectTraits::ShaderPermutationCount, "array/max mismatch");
+}
+
+void NormalMapEffect::Impl::Initialize(
+ _In_ ID3D12Device* device,
+ uint32_t effectFlags,
+ const EffectPipelineStateDescription& pipelineDescription,
+ bool enableSkinning)
+{
+ specularMap = (effectFlags & EffectFlags::Specular) != 0;
lights.InitializeConstants(constants.specularColorAndPower, constants.lightDirection, constants.lightDiffuseColor, constants.lightSpecularColor);
+ if (enableSkinning)
+ {
+ if (effectFlags & EffectFlags::VertexColor)
+ {
+ DebugTrace("ERROR: SkinnedNormalMapEffect does not implement EffectFlags::VertexColor\n");
+ throw std::invalid_argument("VertexColor effect flag is invalid");
+ }
+ else if (effectFlags & EffectFlags::Instancing)
+ {
+ DebugTrace("ERROR: SkinnedNormalMapEffect does not implement EffectFlags::Instancing\n");
+ throw std::invalid_argument("Instancing effect flag is invalid");
+ }
+
+ weightsPerVertex = 4;
+
+ for (size_t j = 0; j < SkinnedNormalMapEffect::MaxBones; ++j)
+ {
+ boneConstants.Bones[j][0] = g_XMIdentityR0;
+ boneConstants.Bones[j][1] = g_XMIdentityR1;
+ boneConstants.Bones[j][2] = g_XMIdentityR2;
+ }
+ }
+
// Create root signature.
{
D3D12_ROOT_SIGNATURE_FLAGS rootSignatureFlags =
@@ -358,6 +463,7 @@ NormalMapEffect::Impl::Impl(
CD3DX12_DESCRIPTOR_RANGE textureSampler(D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, 1, 0);
rootParameters[RootParameterIndex::TextureSampler].InitAsDescriptorTable(1, &textureSampler, D3D12_SHADER_VISIBILITY_PIXEL);
rootParameters[RootParameterIndex::ConstantBuffer].InitAsConstantBufferView(0, 0, D3D12_SHADER_VISIBILITY_ALL);
+ rootParameters[RootParameterIndex::ConstantBufferBones].InitAsConstantBufferView(1, 0, D3D12_SHADER_VISIBILITY_VERTEX);
CD3DX12_ROOT_SIGNATURE_DESC rsigDesc = {};
@@ -401,7 +507,14 @@ NormalMapEffect::Impl::Impl(
EffectBase::PixelShaderBytecode[pi],
mPipelineState.GetAddressOf());
- SetDebugObjectName(mPipelineState.Get(), L"NormalMapEffect");
+ if (enableSkinning)
+ {
+ SetDebugObjectName(mPipelineState.Get(), L"SkinnedNormalMapEffect");
+ }
+ else
+ {
+ SetDebugObjectName(mPipelineState.Get(), L"NormalMapEffect");
+ }
}
@@ -415,27 +528,35 @@ int NormalMapEffect::Impl::GetPipelineStatePermutation(uint32_t effectFlags) con
permutation += 1;
}
- // Support vertex coloring?
- if (effectFlags & EffectFlags::VertexColor)
+ if (!specularMap)
{
permutation += 2;
}
- if (!specularMap)
+ if (effectFlags & EffectFlags::BiasedVertexNormals)
{
+ // Compressed normals need to be scaled and biased in the vertex shader.
permutation += 4;
}
- if (effectFlags & EffectFlags::BiasedVertexNormals)
+ if (weightsPerVertex > 0)
{
- // Compressed normals need to be scaled and biased in the vertex shader.
- permutation += 8;
+ // Vertex skinning.
+ permutation += 32;
}
-
- if (effectFlags & EffectFlags::Instancing)
+ else
{
- // Vertex shader needs to use vertex matrix transform.
- permutation += 16;
+ // Support vertex coloring?
+ if (effectFlags & EffectFlags::VertexColor)
+ {
+ permutation += 8;
+ }
+
+ if (effectFlags & EffectFlags::Instancing)
+ {
+ // Vertex shader needs to use vertex matrix transform.
+ permutation += 16;
+ }
}
return permutation;
@@ -452,6 +573,15 @@ void NormalMapEffect::Impl::Apply(_In_ ID3D12GraphicsCommandList* commandList)
UpdateConstants();
+ if (weightsPerVertex > 0)
+ {
+ if (dirtyFlags & EffectDirtyFlags::ConstantBufferBones)
+ {
+ mBones = GraphicsMemory::Get(GetDevice()).AllocateConstant(boneConstants);
+ dirtyFlags &= ~EffectDirtyFlags::ConstantBufferBones;
+ }
+ }
+
// Set the root signature
commandList->SetGraphicsRootSignature(mRootSignature);
@@ -478,23 +608,30 @@ void NormalMapEffect::Impl::Apply(_In_ ID3D12GraphicsCommandList* commandList)
}
// Set constants
- commandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBuffer, GetConstantBufferGpuAddress());
+ auto cbuffer = GetConstantBufferGpuAddress();
+ commandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBuffer, cbuffer);
+ commandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBufferBones,
+ (weightsPerVertex > 0) ? mBones.GpuAddress() : cbuffer);
// Set the pipeline state
commandList->SetPipelineState(EffectBase::mPipelineState.Get());
}
-// Public constructor.
+//--------------------------------------------------------------------------------------
+// NormalMapEffect
+//--------------------------------------------------------------------------------------
+
NormalMapEffect::NormalMapEffect(
_In_ ID3D12Device* device,
uint32_t effectFlags,
- const EffectPipelineStateDescription& pipelineDescription)
- : pImpl(std::make_unique(device, effectFlags, pipelineDescription))
+ const EffectPipelineStateDescription& pipelineDescription,
+ bool skinningEnabled)
+ : pImpl(std::make_unique(device))
{
+ pImpl->Initialize(device, effectFlags, pipelineDescription, skinningEnabled);
}
-
NormalMapEffect::NormalMapEffect(NormalMapEffect&&) noexcept = default;
NormalMapEffect& NormalMapEffect::operator= (NormalMapEffect&&) noexcept = default;
NormalMapEffect::~NormalMapEffect() = default;
@@ -696,3 +833,48 @@ void NormalMapEffect::SetSpecularTexture(D3D12_GPU_DESCRIPTOR_HANDLE srvDescript
pImpl->specular = srvDescriptor;
}
+
+
+//--------------------------------------------------------------------------------------
+// SkinnedNormalMapEffect
+//--------------------------------------------------------------------------------------
+
+// Animation settings.
+void SkinnedNormalMapEffect::SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count)
+{
+ if (count > MaxBones)
+ throw std::invalid_argument("count parameter exceeds MaxBones");
+
+ auto boneConstant = pImpl->boneConstants.Bones;
+
+ for (size_t i = 0; i < count; i++)
+ {
+#if DIRECTX_MATH_VERSION >= 313
+ XMStoreFloat3x4A(reinterpret_cast(&boneConstant[i]), value[i]);
+#else
+ // Xbox One XDK has an older version of DirectXMath
+ XMMATRIX boneMatrix = XMMatrixTranspose(value[i]);
+
+ boneConstant[i][0] = boneMatrix.r[0];
+ boneConstant[i][1] = boneMatrix.r[1];
+ boneConstant[i][2] = boneMatrix.r[2];
+#endif
+ }
+
+ pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBufferBones;
+}
+
+
+void SkinnedNormalMapEffect::ResetBoneTransforms()
+{
+ auto boneConstant = pImpl->boneConstants.Bones;
+
+ for (size_t i = 0; i < MaxBones; ++i)
+ {
+ boneConstant[i][0] = g_XMIdentityR0;
+ boneConstant[i][1] = g_XMIdentityR1;
+ boneConstant[i][2] = g_XMIdentityR2;
+ }
+
+ pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBufferBones;
+}
diff --git a/DirectXTK12/Src/PBREffect.cpp b/DirectXTK12/Src/PBREffect.cpp
index 36812a1..a2258ca 100644
--- a/DirectXTK12/Src/PBREffect.cpp
+++ b/DirectXTK12/Src/PBREffect.cpp
@@ -10,6 +10,14 @@
#include "pch.h"
#include "EffectCommon.h"
+namespace DirectX
+{
+ namespace EffectDirtyFlags
+ {
+ constexpr int ConstantBufferBones = 0x100000;
+ }
+}
+
using namespace DirectX;
namespace
@@ -39,15 +47,22 @@ namespace
static_assert((sizeof(PBREffectConstants) % 16) == 0, "CB size not padded correctly");
+ XM_ALIGNED_STRUCT(16) BoneConstants
+ {
+ XMVECTOR Bones[SkinnedPBREffect::MaxBones][3];
+ };
+
+ static_assert((sizeof(BoneConstants) % 16) == 0, "CB size not padded correctly");
+
// Traits type describes our characteristics to the EffectBase template.
struct PBREffectTraits
{
using ConstantBufferType = PBREffectConstants;
- static constexpr int VertexShaderCount = 6;
+ static constexpr int VertexShaderCount = 8;
static constexpr int PixelShaderCount = 5;
- static constexpr int ShaderPermutationCount = 16;
+ static constexpr int ShaderPermutationCount = 22;
static constexpr int RootSignatureCount = 1;
};
}
@@ -56,16 +71,13 @@ namespace
class PBREffect::Impl : public EffectBase
{
public:
- Impl(_In_ ID3D12Device* device,
- uint32_t effectFlags,
- const EffectPipelineStateDescription& pipelineDescription);
-
- void Apply(_In_ ID3D12GraphicsCommandList* commandList);
-
- int GetPipelineStatePermutation(uint32_t effectFlags) const noexcept;
+ explicit Impl(_In_ ID3D12Device* device);
- bool textureEnabled;
- bool emissiveMap;
+ void Initialize(
+ _In_ ID3D12Device* device,
+ uint32_t effectFlags,
+ const EffectPipelineStateDescription& pipelineDescription,
+ bool enableSkinning);
enum RootParameterIndex
{
@@ -78,12 +90,26 @@ class PBREffect::Impl : public EffectBase
SurfaceSampler,
RadianceSampler,
ConstantBuffer,
+ ConstantBufferBones,
RootParametersCount
};
+ int weightsPerVertex;
+ bool textureEnabled;
+ bool emissiveMap;
+
D3D12_GPU_DESCRIPTOR_HANDLE descriptors[RootParametersCount];
XMVECTOR lightColor[MaxDirectionalLights];
+
+ void Apply(_In_ ID3D12GraphicsCommandList* commandList);
+
+ int GetPipelineStatePermutation(uint32_t effectFlags) const noexcept;
+
+ BoneConstants boneConstants;
+
+private:
+ GraphicsResource mBones;
};
@@ -91,65 +117,77 @@ class PBREffect::Impl : public EffectBase
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettPBREffect_VSConstant.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPBREffect_VSConstantBn.inc"
+ #include "XboxGamingScarlettPBREffect_VSConstant.inc"
+ #include "XboxGamingScarlettPBREffect_VSConstantBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPBREffect_VSConstantInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPBREffect_VSConstantBnInst.inc"
+ #include "XboxGamingScarlettPBREffect_VSConstantInst.inc"
+ #include "XboxGamingScarlettPBREffect_VSConstantBnInst.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPBREffect_VSConstantVelocity.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPBREffect_VSConstantVelocityBn.inc"
+ #include "XboxGamingScarlettPBREffect_VSConstantVelocity.inc"
+ #include "XboxGamingScarlettPBREffect_VSConstantVelocityBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPBREffect_PSConstant.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPBREffect_PSTextured.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPBREffect_PSTexturedEmissive.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPBREffect_PSTexturedVelocity.inc"
- #include "Shaders/Compiled/XboxGamingScarlettPBREffect_PSTexturedEmissiveVelocity.inc"
+ #include "XboxGamingScarlettPBREffect_VSSkinned.inc"
+ #include "XboxGamingScarlettPBREffect_VSSkinnedBn.inc"
+
+ #include "XboxGamingScarlettPBREffect_PSConstant.inc"
+ #include "XboxGamingScarlettPBREffect_PSTextured.inc"
+ #include "XboxGamingScarlettPBREffect_PSTexturedEmissive.inc"
+ #include "XboxGamingScarlettPBREffect_PSTexturedVelocity.inc"
+ #include "XboxGamingScarlettPBREffect_PSTexturedEmissiveVelocity.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOnePBREffect_VSConstant.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePBREffect_VSConstantBn.inc"
+ #include "XboxGamingXboxOnePBREffect_VSConstant.inc"
+ #include "XboxGamingXboxOnePBREffect_VSConstantBn.inc"
+
+ #include "XboxGamingXboxOnePBREffect_VSConstantInst.inc"
+ #include "XboxGamingXboxOnePBREffect_VSConstantBnInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePBREffect_VSConstantInst.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePBREffect_VSConstantBnInst.inc"
+ #include "XboxGamingXboxOnePBREffect_VSConstantVelocity.inc"
+ #include "XboxGamingXboxOnePBREffect_VSConstantVelocityBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePBREffect_VSConstantVelocity.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePBREffect_VSConstantVelocityBn.inc"
+ #include "XboxGamingXboxOnePBREffect_VSSkinned.inc"
+ #include "XboxGamingXboxOnePBREffect_VSSkinnedBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePBREffect_PSConstant.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePBREffect_PSTextured.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePBREffect_PSTexturedEmissive.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePBREffect_PSTexturedVelocity.inc"
- #include "Shaders/Compiled/XboxGamingXboxOnePBREffect_PSTexturedEmissiveVelocity.inc"
+ #include "XboxGamingXboxOnePBREffect_PSConstant.inc"
+ #include "XboxGamingXboxOnePBREffect_PSTextured.inc"
+ #include "XboxGamingXboxOnePBREffect_PSTexturedEmissive.inc"
+ #include "XboxGamingXboxOnePBREffect_PSTexturedVelocity.inc"
+ #include "XboxGamingXboxOnePBREffect_PSTexturedEmissiveVelocity.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOnePBREffect_VSConstant.inc"
- #include "Shaders/Compiled/XboxOnePBREffect_VSConstantBn.inc"
+ #include "XboxOnePBREffect_VSConstant.inc"
+ #include "XboxOnePBREffect_VSConstantBn.inc"
- #include "Shaders/Compiled/XboxOnePBREffect_VSConstantInst.inc"
- #include "Shaders/Compiled/XboxOnePBREffect_VSConstantBnInst.inc"
+ #include "XboxOnePBREffect_VSConstantInst.inc"
+ #include "XboxOnePBREffect_VSConstantBnInst.inc"
- #include "Shaders/Compiled/XboxOnePBREffect_VSConstantVelocity.inc"
- #include "Shaders/Compiled/XboxOnePBREffect_VSConstantVelocityBn.inc"
+ #include "XboxOnePBREffect_VSConstantVelocity.inc"
+ #include "XboxOnePBREffect_VSConstantVelocityBn.inc"
- #include "Shaders/Compiled/XboxOnePBREffect_PSConstant.inc"
- #include "Shaders/Compiled/XboxOnePBREffect_PSTextured.inc"
- #include "Shaders/Compiled/XboxOnePBREffect_PSTexturedEmissive.inc"
- #include "Shaders/Compiled/XboxOnePBREffect_PSTexturedVelocity.inc"
- #include "Shaders/Compiled/XboxOnePBREffect_PSTexturedEmissiveVelocity.inc"
+ #include "XboxOnePBREffect_VSSkinned.inc"
+ #include "XboxOnePBREffect_VSSkinnedBn.inc"
+
+ #include "XboxOnePBREffect_PSConstant.inc"
+ #include "XboxOnePBREffect_PSTextured.inc"
+ #include "XboxOnePBREffect_PSTexturedEmissive.inc"
+ #include "XboxOnePBREffect_PSTexturedVelocity.inc"
+ #include "XboxOnePBREffect_PSTexturedEmissiveVelocity.inc"
#else
- #include "Shaders/Compiled/PBREffect_VSConstant.inc"
- #include "Shaders/Compiled/PBREffect_VSConstantBn.inc"
+ #include "PBREffect_VSConstant.inc"
+ #include "PBREffect_VSConstantBn.inc"
+
+ #include "PBREffect_VSConstantInst.inc"
+ #include "PBREffect_VSConstantBnInst.inc"
- #include "Shaders/Compiled/PBREffect_VSConstantInst.inc"
- #include "Shaders/Compiled/PBREffect_VSConstantBnInst.inc"
+ #include "PBREffect_VSConstantVelocity.inc"
+ #include "PBREffect_VSConstantVelocityBn.inc"
- #include "Shaders/Compiled/PBREffect_VSConstantVelocity.inc"
- #include "Shaders/Compiled/PBREffect_VSConstantVelocityBn.inc"
+ #include "PBREffect_VSSkinned.inc"
+ #include "PBREffect_VSSkinnedBn.inc"
- #include "Shaders/Compiled/PBREffect_PSConstant.inc"
- #include "Shaders/Compiled/PBREffect_PSTextured.inc"
- #include "Shaders/Compiled/PBREffect_PSTexturedEmissive.inc"
- #include "Shaders/Compiled/PBREffect_PSTexturedVelocity.inc"
- #include "Shaders/Compiled/PBREffect_PSTexturedEmissiveVelocity.inc"
+ #include "PBREffect_PSConstant.inc"
+ #include "PBREffect_PSTextured.inc"
+ #include "PBREffect_PSTexturedEmissive.inc"
+ #include "PBREffect_PSTexturedVelocity.inc"
+ #include "PBREffect_PSTexturedEmissiveVelocity.inc"
#endif
}
@@ -161,8 +199,12 @@ const D3D12_SHADER_BYTECODE EffectBase::VertexShaderBytecode[]
{ PBREffect_VSConstantVelocity, sizeof(PBREffect_VSConstantVelocity) },
{ PBREffect_VSConstantBn, sizeof(PBREffect_VSConstantBn) },
{ PBREffect_VSConstantVelocityBn, sizeof(PBREffect_VSConstantVelocityBn) },
+
{ PBREffect_VSConstantInst, sizeof(PBREffect_VSConstantInst) },
{ PBREffect_VSConstantBnInst, sizeof(PBREffect_VSConstantBnInst) },
+
+ { PBREffect_VSSkinned, sizeof(PBREffect_VSSkinned) },
+ { PBREffect_VSSkinnedBn, sizeof(PBREffect_VSSkinnedBn) },
};
@@ -172,20 +214,32 @@ const int EffectBase::VertexShaderIndices[] =
0, // constant
0, // textured
0, // textured + emissive
- 1, // textured + velocity
- 1, // textured + emissive + velocity
+
4, // instancing + constant
4, // instancing + textured
4, // instancing + textured + emissive
+ 6, // skinning + constant
+ 6, // skinning + textured
+ 6, // skinning + textured + emissive
+
+ 1, // textured + velocity
+ 1, // textured + emissive + velocity
+
2, // constant (biased vertex normals)
2, // textured (biased vertex normals)
2, // textured + emissive (biased vertex normals)
- 3, // textured + velocity (biased vertex normals)
- 3, // textured + emissive + velocity (biasoed vertex normals)
+
5, // instancing + constant (biased vertex normals)
5, // instancing + textured (biased vertex normals)
5, // instancing + textured + emissive (biased vertex normals)
+
+ 7, // skinning + constant (biased vertex normals)
+ 7, // skinning + textured (biased vertex normals)
+ 7, // skinning + textured + emissive (biased vertex normals)
+
+ 3, // textured + velocity (biased vertex normals)
+ 3, // textured + emissive + velocity (biasoed vertex normals)
};
@@ -206,20 +260,32 @@ const int EffectBase::PixelShaderIndices[] =
0, // constant
1, // textured
2, // textured + emissive
- 3, // textured + velocity
- 4, // textured + emissive + velocity
+
0, // instancing + constant
1, // instancing + textured
2, // instancing + textured + emissive
+ 0, // skinning + constant
+ 1, // skinning + textured
+ 2, // skinning + textured + emissive
+
+ 3, // textured + velocity
+ 4, // textured + emissive + velocity
+
0, // constant (biased vertex normals)
1, // textured (biased vertex normals)
2, // textured + emissive (biased vertex normals)
- 3, // textured + velocity (biased vertex normals)
- 4, // textured + emissive + velocity (biased vertex normals)
+
0, // instancing + constant (biased vertex normals)
1, // instancing + textured (biased vertex normals)
2, // instancing + textured + emissive (biased vertex normals)
+
+ 0, // skinning + constant (biased vertex normals)
+ 1, // skinning + textured (biased vertex normals)
+ 2, // skinning + textured + emissive (biased vertex normals)
+
+ 3, // textured + velocity (biased vertex normals)
+ 4, // textured + emissive + velocity (biased vertex normals)
};
// Global pool of per-device PBREffect resources. Required by EffectBase<>, but not used.
@@ -227,18 +293,28 @@ template<>
SharedResourcePool::DeviceResources> EffectBase::deviceResourcesPool = {};
// Constructor.
-PBREffect::Impl::Impl(_In_ ID3D12Device* device,
- uint32_t effectFlags,
- const EffectPipelineStateDescription& pipelineDescription)
+PBREffect::Impl::Impl(_In_ ID3D12Device* device)
: EffectBase(device),
- emissiveMap((effectFlags & EffectFlags::Emissive) != 0),
+ weightsPerVertex(0),
+ textureEnabled(false),
+ emissiveMap(false),
descriptors{},
- lightColor{}
+ lightColor{},
+ boneConstants{}
{
static_assert(static_cast(std::size(EffectBase::VertexShaderIndices)) == PBREffectTraits::ShaderPermutationCount, "array/max mismatch");
static_assert(static_cast(std::size(EffectBase::VertexShaderBytecode)) == PBREffectTraits::VertexShaderCount, "array/max mismatch");
static_assert(static_cast(std::size(EffectBase::PixelShaderBytecode)) == PBREffectTraits::PixelShaderCount, "array/max mismatch");
static_assert(static_cast(std::size(EffectBase::PixelShaderIndices)) == PBREffectTraits::ShaderPermutationCount, "array/max mismatch");
+}
+
+void PBREffect::Impl::Initialize(
+ _In_ ID3D12Device* device,
+ uint32_t effectFlags,
+ const EffectPipelineStateDescription& pipelineDescription,
+ bool enableSkinning)
+{
+ emissiveMap = (effectFlags & EffectFlags::Emissive) != 0;
// Lighting
static const XMVECTORF32 defaultLightDirection = { { { 0, -1, 0, 0 } } };
@@ -270,6 +346,29 @@ PBREffect::Impl::Impl(_In_ ID3D12Device* device,
constants.Roughness = 0.2f;
constants.numRadianceMipLevels = 1;
+ if (enableSkinning)
+ {
+ if (effectFlags & EffectFlags::Instancing)
+ {
+ DebugTrace("ERROR: SkinnedPBREffect does not implement EffectFlags::Instancing\n");
+ throw std::invalid_argument("Instancing effect flag is invalid");
+ }
+ else if (effectFlags & EffectFlags::Velocity)
+ {
+ DebugTrace("ERROR: SkinnedPBREffect does not implement EffectFlags::Velocity\n");
+ throw std::invalid_argument("Velocity generation effect flag is invalid");
+ }
+
+ weightsPerVertex = 4;
+
+ for (size_t j = 0; j < SkinnedPBREffect::MaxBones; ++j)
+ {
+ boneConstants.Bones[j][0] = g_XMIdentityR0;
+ boneConstants.Bones[j][1] = g_XMIdentityR1;
+ boneConstants.Bones[j][2] = g_XMIdentityR2;
+ }
+ }
+
// Create root signature
{
D3D12_ROOT_SIGNATURE_FLAGS rootSignatureFlags =
@@ -304,6 +403,7 @@ PBREffect::Impl::Impl(_In_ ID3D12Device* device,
}
rootParameters[ConstantBuffer].InitAsConstantBufferView(0, 0, D3D12_SHADER_VISIBILITY_ALL);
+ rootParameters[RootParameterIndex::ConstantBufferBones].InitAsConstantBufferView(1, 0, D3D12_SHADER_VISIBILITY_VERTEX);
CD3DX12_ROOT_SIGNATURE_DESC rsigDesc;
rsigDesc.Init(static_cast(std::size(rootParameters)), rootParameters, 0, nullptr, rootSignatureFlags);
@@ -348,7 +448,14 @@ PBREffect::Impl::Impl(_In_ ID3D12Device* device,
EffectBase::PixelShaderBytecode[pi],
mPipelineState.ReleaseAndGetAddressOf());
- SetDebugObjectName(mPipelineState.Get(), L"PBREffect");
+ if (enableSkinning)
+ {
+ SetDebugObjectName(mPipelineState.Get(), L"SkinnedPBREffect");
+ }
+ else
+ {
+ SetDebugObjectName(mPipelineState.Get(), L"PBREffect");
+ }
}
@@ -356,32 +463,38 @@ int PBREffect::Impl::GetPipelineStatePermutation(uint32_t effectFlags) const noe
{
int permutation = 0;
- if (effectFlags & EffectFlags::Instancing)
+ // Using an emissive texture?
+ if (emissiveMap)
{
- // Vertex shader needs to use vertex matrix transform.
- permutation = (textureEnabled) ? 6 : 5;
+ permutation += 1;
}
- else if (effectFlags & EffectFlags::Velocity)
+
+ if (effectFlags & EffectFlags::BiasedVertexNormals)
{
- // Optional velocity buffer (implies textured RMA)?
- permutation = 3;
+ // Compressed normals need to be scaled and biased in the vertex shader.
+ permutation += 11;
}
- else if (textureEnabled)
+
+ if (weightsPerVertex > 0)
{
- // Textured RMA vs. constant albedo/roughness/metalness?
- permutation = 1;
+ // Vertex skinning.
+ permutation += 6;
}
-
- // Using an emissive texture?
- if (emissiveMap)
+ else if (effectFlags & EffectFlags::Instancing)
{
- permutation += 1;
+ // Vertex shader needs to use vertex matrix transform.
+ permutation += 3;
+ }
+ else if (effectFlags & EffectFlags::Velocity)
+ {
+ // Optional velocity buffer (implies textured).
+ permutation += 9;
}
- if (effectFlags & EffectFlags::BiasedVertexNormals)
+ if (textureEnabled && !(effectFlags & EffectFlags::Velocity))
{
- // Compressed normals need to be scaled and biased in the vertex shader.
- permutation += 8;
+ // Textured RMA vs. constant albedo/roughness/metalness.
+ permutation += 1;
}
return permutation;
@@ -426,6 +539,15 @@ void PBREffect::Impl::Apply(_In_ ID3D12GraphicsCommandList* commandList)
// Set constants to GPU
UpdateConstants();
+ if (weightsPerVertex > 0)
+ {
+ if (dirtyFlags & EffectDirtyFlags::ConstantBufferBones)
+ {
+ mBones = GraphicsMemory::Get(GetDevice()).AllocateConstant(boneConstants);
+ dirtyFlags &= ~EffectDirtyFlags::ConstantBufferBones;
+ }
+ }
+
// Set the root signature
commandList->SetGraphicsRootSignature(mRootSignature);
@@ -506,21 +628,30 @@ void PBREffect::Impl::Apply(_In_ ID3D12GraphicsCommandList* commandList)
}
// Set constants
- commandList->SetGraphicsRootConstantBufferView(ConstantBuffer, GetConstantBufferGpuAddress());
+ auto cbuffer = GetConstantBufferGpuAddress();
+ commandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBuffer, cbuffer);
+ commandList->SetGraphicsRootConstantBufferView(RootParameterIndex::ConstantBufferBones,
+ (weightsPerVertex > 0) ? mBones.GpuAddress() : cbuffer);
// Set the pipeline state
commandList->SetPipelineState(EffectBase::mPipelineState.Get());
}
-// Public constructor.
-PBREffect::PBREffect(_In_ ID3D12Device* device,
+
+//--------------------------------------------------------------------------------------
+// PBREffect
+//--------------------------------------------------------------------------------------
+
+PBREffect::PBREffect(
+ _In_ ID3D12Device* device,
uint32_t effectFlags,
- const EffectPipelineStateDescription& pipelineDescription)
- : pImpl(std::make_unique(device, effectFlags, pipelineDescription))
+ const EffectPipelineStateDescription& pipelineDescription,
+ bool skinningEnabled)
+ : pImpl(std::make_unique(device))
{
+ pImpl->Initialize(device, effectFlags, pipelineDescription, skinningEnabled);
}
-
PBREffect::PBREffect(PBREffect&&) noexcept = default;
PBREffect& PBREffect::operator= (PBREffect&&) noexcept = default;
PBREffect::~PBREffect() = default;
@@ -721,3 +852,48 @@ void PBREffect::SetRenderTargetSizeInPixels(int width, int height)
pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBuffer;
}
+
+
+//--------------------------------------------------------------------------------------
+// SkinnedPBREffect
+//--------------------------------------------------------------------------------------
+
+// Animation settings.
+void SkinnedPBREffect::SetBoneTransforms(_In_reads_(count) XMMATRIX const* value, size_t count)
+{
+ if (count > MaxBones)
+ throw std::invalid_argument("count parameter exceeds MaxBones");
+
+ auto boneConstant = pImpl->boneConstants.Bones;
+
+ for (size_t i = 0; i < count; i++)
+ {
+#if DIRECTX_MATH_VERSION >= 313
+ XMStoreFloat3x4A(reinterpret_cast(&boneConstant[i]), value[i]);
+#else
+ // Xbox One XDK has an older version of DirectXMath
+ XMMATRIX boneMatrix = XMMatrixTranspose(value[i]);
+
+ boneConstant[i][0] = boneMatrix.r[0];
+ boneConstant[i][1] = boneMatrix.r[1];
+ boneConstant[i][2] = boneMatrix.r[2];
+#endif
+ }
+
+ pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBufferBones;
+}
+
+
+void SkinnedPBREffect::ResetBoneTransforms()
+{
+ auto boneConstant = pImpl->boneConstants.Bones;
+
+ for (size_t i = 0; i < MaxBones; ++i)
+ {
+ boneConstant[i][0] = g_XMIdentityR0;
+ boneConstant[i][1] = g_XMIdentityR1;
+ boneConstant[i][2] = g_XMIdentityR2;
+ }
+
+ pImpl->dirtyFlags |= EffectDirtyFlags::ConstantBufferBones;
+}
diff --git a/DirectXTK12/Src/PBREffectFactory.cpp b/DirectXTK12/Src/PBREffectFactory.cpp
index 025aac4..ff1c056 100644
--- a/DirectXTK12/Src/PBREffectFactory.cpp
+++ b/DirectXTK12/Src/PBREffectFactory.cpp
@@ -20,6 +20,62 @@
using namespace DirectX;
using Microsoft::WRL::ComPtr;
+namespace
+{
+ template
+ void SetPBRProperties(
+ _In_ T* effect,
+ const EffectFactory::EffectInfo& info,
+ _In_ DescriptorHeap* textures,
+ int textureDescriptorOffset,
+ _In_ DescriptorHeap* samplers,
+ int samplerDescriptorOffset)
+ {
+ // We don't use EnableDefaultLighting generally for PBR as it uses Image-Based Lighting instead.
+
+ effect->SetAlpha(info.alphaValue);
+
+ if (info.diffuseTextureIndex != -1)
+ {
+ // Textured PBR material
+ const int albedoTextureIndex = info.diffuseTextureIndex + textureDescriptorOffset;
+ const int rmaTextureIndex = (info.specularTextureIndex != -1) ? info.specularTextureIndex + textureDescriptorOffset : -1;
+ const int normalTextureIndex = (info.normalTextureIndex != -1) ? info.normalTextureIndex + textureDescriptorOffset : -1;
+ const int samplerIndex = (info.samplerIndex != -1) ? info.samplerIndex + samplerDescriptorOffset : -1;
+
+ effect->SetSurfaceTextures(
+ textures->GetGpuHandle(static_cast(albedoTextureIndex)),
+ textures->GetGpuHandle(static_cast(normalTextureIndex)),
+ textures->GetGpuHandle(static_cast(rmaTextureIndex)),
+ samplers->GetGpuHandle(static_cast(samplerIndex)));
+
+ const int emissiveTextureIndex = (info.emissiveTextureIndex != -1) ? info.emissiveTextureIndex + textureDescriptorOffset : -1;
+
+ if (emissiveTextureIndex != -1)
+ {
+ effect->SetEmissiveTexture(textures->GetGpuHandle(static_cast(emissiveTextureIndex)));
+ }
+ }
+ else
+ {
+ // Untextured material (for PBR this still requires texture coordinates)
+ XMVECTOR color = XMLoadFloat3(&info.diffuseColor);
+ effect->SetConstantAlbedo(color);
+
+ if (info.specularColor.x != 0 || info.specularColor.y != 0 || info.specularColor.z != 0)
+ {
+ // Derived from specularPower = 2 / roughness ^ 4 - 2
+ // http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
+
+ float roughness = powf(2.f / (info.specularPower + 2.f), 1.f / 4.f);
+ effect->SetConstantRoughness(roughness);
+ }
+
+ // info.ambientColor, info.specularColor, and info.emissiveColor are unused by PBR.
+ }
+ }
+}
+
// Internal PBREffectFactory implementation class. Only one of these helpers is allocated
// per D3D device, even if there are multiple public facing PBREffectFactory instances.
class PBREffectFactory::Impl
@@ -60,6 +116,7 @@ class PBREffectFactory::Impl
using EffectCache = std::map< std::wstring, std::shared_ptr >;
EffectCache mEffectCache;
+ EffectCache mEffectCacheSkinning;
std::mutex mutex;
};
@@ -84,89 +141,109 @@ std::shared_ptr PBREffectFactory::Impl::CreateEffect(
throw std::logic_error("PBREffectFactory");
}
- int albedoTextureIndex = (info.diffuseTextureIndex != -1) ? info.diffuseTextureIndex + textureDescriptorOffset : -1;
- int rmaTextureIndex = (info.specularTextureIndex != -1) ? info.specularTextureIndex + textureDescriptorOffset : -1;
- int normalTextureIndex = (info.normalTextureIndex != -1) ? info.normalTextureIndex + textureDescriptorOffset : -1;
- int emissiveTextureIndex = (info.emissiveTextureIndex != -1) ? info.emissiveTextureIndex + textureDescriptorOffset : -1;
- int samplerIndex = (info.samplerIndex != -1) ? info.samplerIndex + samplerDescriptorOffset : -1;
-
// Modify base pipeline state
EffectPipelineStateDescription derivedPSD = (info.alphaValue < 1.0f) ? alphaPipelineState : opaquePipelineState;
derivedPSD.inputLayout = inputLayoutDesc;
// set effect flags for creation
- int effectflags = EffectFlags::Texture;
+ uint32_t effectflags = (info.diffuseTextureIndex != -1) ? EffectFlags::Texture : EffectFlags::None;
if (info.biasedVertexNormals)
{
effectflags |= EffectFlags::BiasedVertexNormals;
}
- if (emissiveTextureIndex != -1)
+ if (info.emissiveTextureIndex != -1)
{
effectflags |= EffectFlags::Emissive;
}
- if (mEnableInstancing)
- {
- effectflags |= EffectFlags::Instancing;
- }
+ // info.perVertexColor and info.enableDualTexture are ignored by PBREffectFactory
- std::wstring cacheName;
- if (mSharing && !info.name.empty())
+ if (info.enableSkinning)
{
- uint32_t hash = derivedPSD.ComputeHash();
- cacheName = std::to_wstring(effectflags) + info.name + std::to_wstring(hash);
+ // SkinnedPBREffect
+ std::wstring cacheName;
+ if (mSharing && !info.name.empty())
+ {
+ uint32_t hash = derivedPSD.ComputeHash();
+ cacheName = std::to_wstring(effectflags) + info.name + std::to_wstring(hash);
+
+ auto it = mEffectCacheSkinning.find(cacheName);
+ if (mSharing && it != mEffectCacheSkinning.end())
+ {
+ return it->second;
+ }
+ }
+
+ auto effect = std::make_shared(mDevice.Get(), effectflags, derivedPSD);
+
+ SetPBRProperties(effect.get(), info,
+ mTextureDescriptors.get(), textureDescriptorOffset,
+ mSamplerDescriptors.get(), samplerDescriptorOffset);
- auto it = mEffectCache.find(cacheName);
- if (mSharing && it != mEffectCache.end())
+ if (mSharing && !info.name.empty())
{
- return it->second;
+ std::lock_guard lock(mutex);
+ EffectCache::value_type v(cacheName, effect);
+ mEffectCacheSkinning.insert(v);
}
- }
- auto effect = std::make_shared(mDevice.Get(), effectflags, derivedPSD);
+ return std::move(effect);
+ }
+ else
+ {
+ // PBREffect
+ if (mEnableInstancing)
+ {
+ effectflags |= EffectFlags::Instancing;
+ }
- // We don't use EnableDefaultLighting generally for PBR as it uses Image-Based Lighting instead.
+ std::wstring cacheName;
+ if (mSharing && !info.name.empty())
+ {
+ uint32_t hash = derivedPSD.ComputeHash();
+ cacheName = std::to_wstring(effectflags) + info.name + std::to_wstring(hash);
+
+ auto it = mEffectCache.find(cacheName);
+ if (mSharing && it != mEffectCache.end())
+ {
+ return it->second;
+ }
+ }
- effect->SetAlpha(info.alphaValue);
+ auto effect = std::make_shared(mDevice.Get(), effectflags, derivedPSD);
- effect->SetSurfaceTextures(
- mTextureDescriptors->GetGpuHandle(static_cast(albedoTextureIndex)),
- mTextureDescriptors->GetGpuHandle(static_cast(normalTextureIndex)),
- mTextureDescriptors->GetGpuHandle(static_cast(rmaTextureIndex)),
- mSamplerDescriptors->GetGpuHandle(static_cast(samplerIndex)));
+ SetPBRProperties(effect.get(), info,
+ mTextureDescriptors.get(), textureDescriptorOffset,
+ mSamplerDescriptors.get(), samplerDescriptorOffset);
- if (emissiveTextureIndex != -1)
- {
- effect->SetEmissiveTexture(mTextureDescriptors->GetGpuHandle(static_cast(emissiveTextureIndex)));
- }
+ if (mSharing && !info.name.empty())
+ {
+ std::lock_guard lock(mutex);
+ EffectCache::value_type v(cacheName, effect);
+ mEffectCache.insert(v);
+ }
- if (mSharing && !info.name.empty())
- {
- std::lock_guard lock(mutex);
- EffectCache::value_type v(cacheName, effect);
- mEffectCache.insert(v);
+ return std::move(effect);
}
-
- return std::move(effect);
}
void PBREffectFactory::Impl::ReleaseCache()
{
std::lock_guard lock(mutex);
mEffectCache.clear();
+ mEffectCacheSkinning.clear();
}
-
//--------------------------------------------------------------------------------------
// PBREffectFactory
//--------------------------------------------------------------------------------------
-PBREffectFactory::PBREffectFactory(_In_ ID3D12Device* device) noexcept(false)
+PBREffectFactory::PBREffectFactory(_In_ ID3D12Device* device) noexcept(false) :
+ pImpl(std::make_shared(device, nullptr, nullptr))
{
- pImpl = std::make_shared(device, nullptr, nullptr);
}
PBREffectFactory::PBREffectFactory(_In_ ID3D12DescriptorHeap* textureDescriptors, _In_ ID3D12DescriptorHeap* samplerDescriptors) noexcept(false)
@@ -203,7 +280,6 @@ PBREffectFactory::PBREffectFactory(_In_ ID3D12DescriptorHeap* textureDescriptors
pImpl = std::make_shared(device.Get(), textureDescriptors, samplerDescriptors);
}
-
PBREffectFactory::PBREffectFactory(PBREffectFactory&&) noexcept = default;
PBREffectFactory& PBREffectFactory::operator= (PBREffectFactory&&) noexcept = default;
PBREffectFactory::~PBREffectFactory() = default;
diff --git a/DirectXTK12/Src/ResourceUploadBatch.cpp b/DirectXTK12/Src/ResourceUploadBatch.cpp
index 8ebf7a0..7c6423d 100644
--- a/DirectXTK12/Src/ResourceUploadBatch.cpp
+++ b/DirectXTK12/Src/ResourceUploadBatch.cpp
@@ -20,13 +20,13 @@ using Microsoft::WRL::ComPtr;
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettGenerateMips_main.inc"
+ #include "XboxGamingScarlettGenerateMips_main.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOneGenerateMips_main.inc"
+ #include "XboxGamingXboxOneGenerateMips_main.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOneGenerateMips_main.inc"
+ #include "XboxOneGenerateMips_main.inc"
#else
- #include "Shaders/Compiled/GenerateMips_main.inc"
+ #include "GenerateMips_main.inc"
#endif
bool FormatIsUAVCompatible(_In_ ID3D12Device* device, bool typedUAVLoadAdditionalFormats, DXGI_FORMAT format) noexcept
diff --git a/DirectXTK12/Src/Shaders/AlphaTestEffect.fx b/DirectXTK12/Src/Shaders/AlphaTestEffect.fx
index e031173..f084740 100644
--- a/DirectXTK12/Src/Shaders/AlphaTestEffect.fx
+++ b/DirectXTK12/Src/Shaders/AlphaTestEffect.fx
@@ -2,7 +2,6 @@
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkID=615561
-// http://create.msdn.com/en-US/education/catalog/sample/stock_effects
Texture2D Texture : register(t0);
diff --git a/DirectXTK12/Src/Shaders/BasicEffect.fx b/DirectXTK12/Src/Shaders/BasicEffect.fx
index df41289..43f3f2c 100644
--- a/DirectXTK12/Src/Shaders/BasicEffect.fx
+++ b/DirectXTK12/Src/Shaders/BasicEffect.fx
@@ -2,7 +2,6 @@
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkID=615561
-// http://create.msdn.com/en-US/education/catalog/sample/stock_effects
Texture2D Texture : register(t0);
diff --git a/DirectXTK12/Src/Shaders/Common.fxh b/DirectXTK12/Src/Shaders/Common.fxh
index d997d4e..464fd58 100644
--- a/DirectXTK12/Src/Shaders/Common.fxh
+++ b/DirectXTK12/Src/Shaders/Common.fxh
@@ -4,7 +4,6 @@
// http://go.microsoft.com/fwlink/?LinkId=248926
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
-// http://create.msdn.com/en-US/education/catalog/sample/stock_effects
float ComputeFogFactor(float4 position)
diff --git a/DirectXTK12/Src/Shaders/CompileShaders.cmd b/DirectXTK12/Src/Shaders/CompileShaders.cmd
index 1ca6241..0be45fe 100644
--- a/DirectXTK12/Src/Shaders/CompileShaders.cmd
+++ b/DirectXTK12/Src/Shaders/CompileShaders.cmd
@@ -67,7 +67,8 @@ if exist %PCFXC% goto continue
set PCFXC=fxc.exe
:continue
-@if not exist Compiled mkdir Compiled
+@if %CompileShadersOutput%.==. set CompileShadersOutput=Compiled
+@if not exist %CompileShadersOutput% mkdir %CompileShadersOutput%
call :CompileShader%1 AlphaTestEffect vs VSAlphaTest
call :CompileShader%1 AlphaTestEffect vs VSAlphaTestNoFog
call :CompileShader%1 AlphaTestEffect vs VSAlphaTestVc
@@ -182,6 +183,11 @@ call :CompileShader%1 NormalMapEffect vs VSNormalPixelLightingTxNoSpecBnInst
call :CompileShader%1 NormalMapEffect vs VSNormalPixelLightingTxVcNoSpecInst
call :CompileShader%1 NormalMapEffect vs VSNormalPixelLightingTxVcNoSpecBnInst
+call :CompileShader%1 NormalMapEffect vs VSSkinnedPixelLightingTx
+call :CompileShader%1 NormalMapEffect vs VSSkinnedPixelLightingTxBn
+call :CompileShader%1 NormalMapEffect vs VSSkinnedPixelLightingTxNoSpec
+call :CompileShader%1 NormalMapEffect vs VSSkinnedPixelLightingTxNoSpecBn
+
call :CompileShader%1 NormalMapEffect ps PSNormalPixelLightingTx
call :CompileShader%1 NormalMapEffect ps PSNormalPixelLightingTxNoFog
call :CompileShader%1 NormalMapEffect ps PSNormalPixelLightingTxNoSpec
@@ -193,6 +199,8 @@ call :CompileShader%1 PBREffect vs VSConstantVelocity
call :CompileShader%1 PBREffect vs VSConstantBn
call :CompileShader%1 PBREffect vs VSConstantBnInst
call :CompileShader%1 PBREffect vs VSConstantVelocityBn
+call :CompileShader%1 PBREffect vs VSSkinned
+call :CompileShader%1 PBREffect vs VSSkinnedBn
call :CompileShader%1 PBREffect ps PSConstant
call :CompileShader%1 PBREffect ps PSTextured
@@ -272,56 +280,56 @@ endlocal
exit /b
:CompileShader
-set fxc=%PCFXC% %1.fx %FXCOPTS% /T%2_5_1 %PCOPTS% /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3
+set fxc=%PCFXC% %1.fx %FXCOPTS% /T%2_5_1 %PCOPTS% /E%3 /Fh%CompileShadersOutput%\%1_%3.inc /Fd%CompileShadersOutput%\%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b
:CompileComputeShader
-set fxc=%PCFXC% %1.hlsl %FXCOPTS% /Tcs_5_1 %PCOPTS% /E%2 /FhCompiled\%1_%2.inc /FdCompiled\%1_%2.pdb /Vn%1_%2
+set fxc=%PCFXC% %1.hlsl %FXCOPTS% /Tcs_5_1 %PCOPTS% /E%2 /Fh%CompileShadersOutput%\%1_%2.inc /Fd%CompileShadersOutput%\%1_%2.pdb /Vn%1_%2
echo.
echo %fxc%
%fxc% || set error=1
exit /b
:CompileShaderdxil
-set dxc=%PCDXC% %1.fx %FXCOPTS% /T%2_6_0 /E%3 /FhCompiled\%1_%3.inc /FdCompiled\%1_%3.pdb /Vn%1_%3
+set dxc=%PCDXC% %1.fx %FXCOPTS% /T%2_6_0 /E%3 /Fh%CompileShadersOutput%\%1_%3.inc /Fd%CompileShadersOutput%\%1_%3.pdb /Vn%1_%3
echo.
echo %dxc%
%dxc% || set error=1
exit /b
:CompileComputeShaderdxil
-set dxc=%PCDXC% %1.hlsl %FXCOPTS% /Tcs_6_0 /E%2 /FhCompiled\%1_%2.inc /FdCompiled\%1_%2.pdb /Vn%1_%2
+set dxc=%PCDXC% %1.hlsl %FXCOPTS% /Tcs_6_0 /E%2 /Fh%CompileShadersOutput%\%1_%2.inc /Fd%CompileShadersOutput%\%1_%2.pdb /Vn%1_%2
echo.
echo %dxc%
%dxc% || set error=1
exit /b
:CompileShaderxbox
-set fxc=%XBOXFXC% %1.fx %FXCOPTS% /T%2_5_1 %XBOXOPTS% /E%3 /FhCompiled\%XBOXPREFIX%%1_%3.inc /FdCompiled\%XBOXPREFIX%%1_%3.pdb /Vn%1_%3
+set fxc=%XBOXFXC% %1.fx %FXCOPTS% /T%2_5_1 %XBOXOPTS% /E%3 /Fh%CompileShadersOutput%\%XBOXPREFIX%%1_%3.inc /Fd%CompileShadersOutput%\%XBOXPREFIX%%1_%3.pdb /Vn%1_%3
echo.
echo %fxc%
%fxc% || set error=1
exit /b
:CompileComputeShaderxbox
-set fxc==%XBOXFXC% %1.hlsl %FXCOPTS% /Tcs_5_1 %XBOXOPTS% /E%2 /FhCompiled\%XBOXPREFIX%%1_%2.inc /FdCompiled\%XBOXPREFIX%%1_%2.pdb /Vn%1_%2
+set fxc==%XBOXFXC% %1.hlsl %FXCOPTS% /Tcs_5_1 %XBOXOPTS% /E%2 /Fh%CompileShadersOutput%\%XBOXPREFIX%%1_%2.inc /Fd%CompileShadersOutput%\%XBOXPREFIX%%1_%2.pdb /Vn%1_%2
echo.
echo %fxc%
%fxc% || set error=1
exit /b
:CompileShadergxdk
-set dxc=%XBOXDXC% %1.fx %FXCOPTS% /T%2_6_0 /E%3 /FhCompiled\%XBOXPREFIX%%1_%3.inc /FdCompiled\%XBOXPREFIX%%1_%3.pdb /Vn%1_%3
+set dxc=%XBOXDXC% %1.fx %FXCOPTS% /T%2_6_0 /E%3 /Fh%CompileShadersOutput%\%XBOXPREFIX%%1_%3.inc /Fd%CompileShadersOutput%\%XBOXPREFIX%%1_%3.pdb /Vn%1_%3
echo.
echo %dxc%
%dxc% || set error=1
exit /b
:CompileComputeShadergxdk
-set dxc=%XBOXDXC% %1.hlsl %FXCOPTS% /Tcs_6_0 /E%2 /FhCompiled\%XBOXPREFIX%%1_%2.inc /FdCompiled\%XBOXPREFIX%%1_%2.pdb /Vn%1_%2
+set dxc=%XBOXDXC% %1.hlsl %FXCOPTS% /Tcs_6_0 /E%2 /Fh%CompileShadersOutput%\%XBOXPREFIX%%1_%2.inc /Fd%CompileShadersOutput%\%XBOXPREFIX%%1_%2.pdb /Vn%1_%2
echo.
echo %dxc%
%dxc% || set error=1
diff --git a/DirectXTK12/Src/Shaders/DualTextureEffect.fx b/DirectXTK12/Src/Shaders/DualTextureEffect.fx
index bb57959..8131027 100644
--- a/DirectXTK12/Src/Shaders/DualTextureEffect.fx
+++ b/DirectXTK12/Src/Shaders/DualTextureEffect.fx
@@ -2,7 +2,6 @@
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkID=615561
-// http://create.msdn.com/en-US/education/catalog/sample/stock_effects
Texture2D Texture : register(t0);
diff --git a/DirectXTK12/Src/Shaders/EnvironmentMapEffect.fx b/DirectXTK12/Src/Shaders/EnvironmentMapEffect.fx
index 8818bab..a8d1b50 100644
--- a/DirectXTK12/Src/Shaders/EnvironmentMapEffect.fx
+++ b/DirectXTK12/Src/Shaders/EnvironmentMapEffect.fx
@@ -2,7 +2,6 @@
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkID=615561
-// http://create.msdn.com/en-US/education/catalog/sample/stock_effects
Texture2D Texture : register(t0);
diff --git a/DirectXTK12/Src/Shaders/Lighting.fxh b/DirectXTK12/Src/Shaders/Lighting.fxh
index 8786735..ad915f4 100644
--- a/DirectXTK12/Src/Shaders/Lighting.fxh
+++ b/DirectXTK12/Src/Shaders/Lighting.fxh
@@ -4,7 +4,6 @@
// http://go.microsoft.com/fwlink/?LinkId=248926
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
-// http://create.msdn.com/en-US/education/catalog/sample/stock_effects
struct ColorPair
diff --git a/DirectXTK12/Src/Shaders/NormalMapEffect.fx b/DirectXTK12/Src/Shaders/NormalMapEffect.fx
index fc37d5b..63fea68 100644
--- a/DirectXTK12/Src/Shaders/NormalMapEffect.fx
+++ b/DirectXTK12/Src/Shaders/NormalMapEffect.fx
@@ -31,12 +31,19 @@ cbuffer Parameters : register(b0)
float4x4 WorldViewProj : packoffset(c22);
};
+cbuffer SkinningParameters : register(b1)
+{
+ float4x3 Bones[72];
+}
+
#include "Structures.fxh"
#include "Common.fxh"
#include "RootSig.fxh"
#include "Lighting.fxh"
#include "Utilities.fxh"
+#include "Skinning.fxh"
+
// Vertex shader: pixel lighting + texture.
[RootSignature(NormalMapRS)]
@@ -234,22 +241,70 @@ VSOutputPixelLightingTx VSNormalPixelLightingTxVcNoSpecBnInst(VSInputNmTxVcInst
}
+// Vertex shader: skinning (four bones) + pixel lighting + texture
+[RootSignature(NormalMapRS)]
+VSOutputPixelLightingTx VSSkinnedPixelLightingTx(VSInputNmTxWeights vin)
+{
+ VSOutputPixelLightingTx vout;
+
+ float3 normal = Skin(vin, vin.Normal, 4);
+
+ CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, normal);
+ SetCommonVSOutputParamsPixelLighting;
+
+ vout.Diffuse = float4(1, 1, 1, DiffuseColor.a);
+ vout.TexCoord = vin.TexCoord;
+
+ return vout;
+}
+
+[RootSignature(NormalMapRSNoSpec)]
+VSOutputPixelLightingTx VSSkinnedPixelLightingTxNoSpec(VSInputNmTxWeights vin)
+{
+ return VSSkinnedPixelLightingTx(vin);
+}
+
+[RootSignature(NormalMapRS)]
+VSOutputPixelLightingTx VSSkinnedPixelLightingTxBn(VSInputNmTxWeights vin)
+{
+ VSOutputPixelLightingTx vout;
+
+ float3 normal = BiasX2(vin.Normal);
+
+ normal = Skin(vin, normal, 4);
+
+ CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, normal);
+ SetCommonVSOutputParamsPixelLighting;
+
+ vout.Diffuse = float4(1, 1, 1, DiffuseColor.a);
+ vout.TexCoord = vin.TexCoord;
+
+ return vout;
+}
+
+[RootSignature(NormalMapRSNoSpec)]
+VSOutputPixelLightingTx VSSkinnedPixelLightingTxNoSpecBn(VSInputNmTxWeights vin)
+{
+ return VSSkinnedPixelLightingTxBn(vin);
+}
+
// Pixel shader: pixel lighting + texture + no fog
[RootSignature(NormalMapRS)]
float4 PSNormalPixelLightingTxNoFog(PSInputPixelLightingTx pin) : SV_Target0
{
+ float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse;
+
float3 eyeVector = normalize(EyePosition - pin.PositionWS.xyz);
+ float3 worldNormal = normalize(pin.NormalWS);
// Before lighting, peturb the surface's normal by the one given in normal map.
float3 localNormal = TwoChannelNormalX2(NormalTexture.Sample(Sampler, pin.TexCoord).xy);
- float3 normal = PeturbNormal(localNormal, pin.PositionWS.xyz, pin.NormalWS, pin.TexCoord);
+ float3 normal = PeturbNormal(localNormal, pin.PositionWS.xyz, worldNormal, pin.TexCoord);
// Do lighting
ColorPair lightResult = ComputeLights(eyeVector, normal, 3);
- // Get color from albedo texture
- float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse;
color.rgb *= lightResult.Diffuse;
// Apply specular, modulated by the intensity given in the specular map
@@ -264,17 +319,18 @@ float4 PSNormalPixelLightingTxNoFog(PSInputPixelLightingTx pin) : SV_Target0
[RootSignature(NormalMapRS)]
float4 PSNormalPixelLightingTx(PSInputPixelLightingTx pin) : SV_Target0
{
+ float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse;
+
float3 eyeVector = normalize(EyePosition - pin.PositionWS.xyz);
-
+ float3 worldNormal = normalize(pin.NormalWS);
+
// Before lighting, peturb the surface's normal by the one given in normal map.
float3 localNormal = TwoChannelNormalX2(NormalTexture.Sample(Sampler, pin.TexCoord).xy);
- float3 normal = PeturbNormal(localNormal, pin.PositionWS.xyz, pin.NormalWS, pin.TexCoord);
+ float3 normal = PeturbNormal(localNormal, pin.PositionWS.xyz, worldNormal, pin.TexCoord);
// Do lighting
ColorPair lightResult = ComputeLights(eyeVector, normal, 3);
- // Get color from albedo texture
- float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse;
color.rgb *= lightResult.Diffuse;
// Apply specular, modulated by the intensity given in the specular map
@@ -282,54 +338,55 @@ float4 PSNormalPixelLightingTx(PSInputPixelLightingTx pin) : SV_Target0
AddSpecular(color, lightResult.Specular * specIntensity);
ApplyFog(color, pin.PositionWS.w);
+
return color;
}
-// Pixel shader: pixel lighting + texture + no fog + no specular
+// Pixel shader: pixel lighting + texture + no fog + no specular map
[RootSignature(NormalMapRSNoSpec)]
float4 PSNormalPixelLightingTxNoFogSpec(PSInputPixelLightingTx pin) : SV_Target0
{
+ float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse;
+
float3 eyeVector = normalize(EyePosition - pin.PositionWS.xyz);
+ float3 worldNormal = normalize(pin.NormalWS);
// Before lighting, peturb the surface's normal by the one given in normal map.
float3 localNormal = TwoChannelNormalX2(NormalTexture.Sample(Sampler, pin.TexCoord).xy);
- float3 normal = PeturbNormal(localNormal, pin.PositionWS.xyz, pin.NormalWS, pin.TexCoord);
+ float3 normal = PeturbNormal(localNormal, pin.PositionWS.xyz, worldNormal, pin.TexCoord);
// Do lighting
ColorPair lightResult = ComputeLights(eyeVector, normal, 3);
- // Get color from albedo texture
- float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse;
color.rgb *= lightResult.Diffuse;
- // Apply specular
AddSpecular(color, lightResult.Specular);
return color;
}
-// Pixel shader: pixel lighting + texture + no specular
+// Pixel shader: pixel lighting + texture + no specular map
[RootSignature(NormalMapRSNoSpec)]
float4 PSNormalPixelLightingTxNoSpec(PSInputPixelLightingTx pin) : SV_Target0
{
+ float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse;
+
float3 eyeVector = normalize(EyePosition - pin.PositionWS.xyz);
+ float3 worldNormal = normalize(pin.NormalWS);
// Before lighting, peturb the surface's normal by the one given in normal map.
float3 localNormal = TwoChannelNormalX2(NormalTexture.Sample(Sampler, pin.TexCoord).xy);
- float3 normal = PeturbNormal(localNormal, pin.PositionWS.xyz, pin.NormalWS, pin.TexCoord);
+ float3 normal = PeturbNormal(localNormal, pin.PositionWS.xyz, worldNormal, pin.TexCoord);
// Do lighting
ColorPair lightResult = ComputeLights(eyeVector, normal, 3);
- // Get color from albedo texture
- float4 color = Texture.Sample(Sampler, pin.TexCoord) * pin.Diffuse;
color.rgb *= lightResult.Diffuse;
- // Apply specular
AddSpecular(color, lightResult.Specular);
-
ApplyFog(color, pin.PositionWS.w);
+
return color;
}
diff --git a/DirectXTK12/Src/Shaders/PBRCommon.fxh b/DirectXTK12/Src/Shaders/PBRCommon.fxh
index 2481f1b..95173f0 100644
--- a/DirectXTK12/Src/Shaders/PBRCommon.fxh
+++ b/DirectXTK12/Src/Shaders/PBRCommon.fxh
@@ -4,7 +4,6 @@
// http://go.microsoft.com/fwlink/?LinkId=248926
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
-// http://create.msdn.com/en-US/education/catalog/sample/stock_effects
struct CommonVSOutputPixelLighting
diff --git a/DirectXTK12/Src/Shaders/PBREffect.fx b/DirectXTK12/Src/Shaders/PBREffect.fx
index d4cf1e2..af1836c 100644
--- a/DirectXTK12/Src/Shaders/PBREffect.fx
+++ b/DirectXTK12/Src/Shaders/PBREffect.fx
@@ -39,11 +39,17 @@ cbuffer Constants : register(b0)
float TargetHeight : packoffset(c24.x);
};
+cbuffer SkinningParameters : register(b1)
+{
+ float4x3 Bones[72];
+}
+
#include "Structures.fxh"
#include "PBRCommon.fxh"
#include "RootSig.fxh"
#include "Utilities.fxh"
+#include "Skinning.fxh"
// Vertex shader: pbr
@@ -167,6 +173,48 @@ VSOut_Velocity VSConstantVelocityBn(VSInputNmTx vin)
}
+// Vertex shader: pbr + skinning (four bones)
+[RootSignature(PBREffectRS)]
+VSOutputPixelLightingTx VSSkinned(VSInputNmTxWeights vin)
+{
+ VSOutputPixelLightingTx vout;
+
+ float3 normal = Skin(vin, vin.Normal, 4);
+
+ CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, normal);
+
+ vout.PositionPS = cout.Pos_ps;
+ vout.PositionWS = float4(cout.Pos_ws, 1);
+ vout.NormalWS = cout.Normal_ws;
+ vout.Diffuse = float4(ConstantAlbedo, Alpha);
+ vout.TexCoord = vin.TexCoord;
+
+ return vout;
+}
+
+
+// Vertex shader: pbr + skinning (four bones) (biased normal)
+[RootSignature(PBREffectRS)]
+VSOutputPixelLightingTx VSSkinnedBn(VSInputNmTxWeights vin)
+{
+ VSOutputPixelLightingTx vout;
+
+ float3 normal = BiasX2(vin.Normal);
+
+ normal = Skin(vin, normal, 4);
+
+ CommonVSOutputPixelLighting cout = ComputeCommonVSOutputPixelLighting(vin.Position, normal);
+
+ vout.PositionPS = cout.Pos_ps;
+ vout.PositionWS = float4(cout.Pos_ws, 1);
+ vout.NormalWS = cout.Normal_ws;
+ vout.Diffuse = float4(ConstantAlbedo, Alpha);
+ vout.TexCoord = vin.TexCoord;
+
+ return vout;
+}
+
+
// Pixel shader: pbr (constants) + image-based lighting
[RootSignature(PBREffectRS)]
float4 PSConstant(PSInputPixelLightingTx pin) : SV_Target0
diff --git a/DirectXTK12/Src/Shaders/RootSig.fxh b/DirectXTK12/Src/Shaders/RootSig.fxh
index af711d8..a3a0bb4 100644
--- a/DirectXTK12/Src/Shaders/RootSig.fxh
+++ b/DirectXTK12/Src/Shaders/RootSig.fxh
@@ -40,6 +40,7 @@
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL )," \
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )," \
"CBV(b0)," \
+"CBV(b1, visibility = SHADER_VISIBILITY_VERTEX )," \
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL )"
#define NormalMapRSNoSpec \
@@ -50,7 +51,8 @@
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL )," \
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL )," \
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )," \
-"CBV(b0)"
+"CBV(b0)," \
+"CBV(b1, visibility = SHADER_VISIBILITY_VERTEX )"
#define GenerateMipsRS \
"RootFlags ( DENY_VERTEX_SHADER_ROOT_ACCESS |" \
@@ -159,7 +161,8 @@
"DescriptorTable ( SRV(t5) ),"\
"DescriptorTable ( Sampler(s0) ),"\
"DescriptorTable ( Sampler(s1) ),"\
-"CBV(b0)"
+"CBV(b0)," \
+"CBV(b1, visibility = SHADER_VISIBILITY_VERTEX )"
#define DebugEffectRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
diff --git a/DirectXTK12/Src/Shaders/SkinnedEffect.fx b/DirectXTK12/Src/Shaders/SkinnedEffect.fx
index 92e93a7..d638246 100644
--- a/DirectXTK12/Src/Shaders/SkinnedEffect.fx
+++ b/DirectXTK12/Src/Shaders/SkinnedEffect.fx
@@ -2,7 +2,6 @@
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkID=615561
-// http://create.msdn.com/en-US/education/catalog/sample/stock_effects
Texture2D Texture : register(t0);
@@ -38,21 +37,7 @@ cbuffer Parameters : register(b0)
#include "RootSig.fxh"
#include "Lighting.fxh"
#include "Utilities.fxh"
-
-[RootSignature(MainRS)]
-float3 Skin(inout VSInputNmTxWeights vin, float3 normal, uniform int boneCount)
-{
- float4x3 skinning = 0;
-
- [unroll]
- for (int i = 0; i < boneCount; i++)
- {
- skinning += Bones[vin.Indices[i]] * vin.Weights[i];
- }
-
- vin.Position.xyz = mul(vin.Position, skinning);
- return mul(normal, (float3x3)skinning);
-}
+#include "Skinning.fxh"
// Vertex shader: vertex lighting, one bone.
diff --git a/DirectXTK12/Src/Shaders/Skinning.fxh b/DirectXTK12/Src/Shaders/Skinning.fxh
new file mode 100644
index 0000000..1a1bc6b
--- /dev/null
+++ b/DirectXTK12/Src/Shaders/Skinning.fxh
@@ -0,0 +1,20 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+//
+// http://go.microsoft.com/fwlink/?LinkId=248929
+// http://go.microsoft.com/fwlink/?LinkID=615561
+
+
+float3 Skin(inout VSInputNmTxWeights vin, float3 normal, uniform int boneCount)
+{
+ float4x3 skinning = 0;
+
+ [unroll]
+ for (int i = 0; i < boneCount; i++)
+ {
+ skinning += Bones[vin.Indices[i]] * vin.Weights[i];
+ }
+
+ vin.Position.xyz = mul(vin.Position, skinning);
+ return mul(normal, (float3x3) skinning);
+}
diff --git a/DirectXTK12/Src/Shaders/SpriteEffect.fx b/DirectXTK12/Src/Shaders/SpriteEffect.fx
index 80067ba..953b0bc 100644
--- a/DirectXTK12/Src/Shaders/SpriteEffect.fx
+++ b/DirectXTK12/Src/Shaders/SpriteEffect.fx
@@ -2,7 +2,6 @@
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkID=615561
-// http://create.msdn.com/en-US/education/catalog/sample/stock_effects
#include "Structures.fxh"
#include "RootSig.fxh"
diff --git a/DirectXTK12/Src/Shaders/Structures.fxh b/DirectXTK12/Src/Shaders/Structures.fxh
index a2a7119..d18eb0f 100644
--- a/DirectXTK12/Src/Shaders/Structures.fxh
+++ b/DirectXTK12/Src/Shaders/Structures.fxh
@@ -4,7 +4,6 @@
// http://go.microsoft.com/fwlink/?LinkId=248926
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
-// http://create.msdn.com/en-US/education/catalog/sample/stock_effects
// Vertex shader input structures.
diff --git a/DirectXTK12/Src/SkinnedEffect.cpp b/DirectXTK12/Src/SkinnedEffect.cpp
index 38767dc..3d816f4 100644
--- a/DirectXTK12/Src/SkinnedEffect.cpp
+++ b/DirectXTK12/Src/SkinnedEffect.cpp
@@ -81,41 +81,41 @@ class SkinnedEffect::Impl : public EffectBase
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettSkinnedEffect_VSSkinnedVertexLightingFourBones.inc"
- #include "Shaders/Compiled/XboxGamingScarlettSkinnedEffect_VSSkinnedPixelLightingFourBones.inc"
- #include "Shaders/Compiled/XboxGamingScarlettSkinnedEffect_VSSkinnedVertexLightingFourBonesBn.inc"
- #include "Shaders/Compiled/XboxGamingScarlettSkinnedEffect_VSSkinnedPixelLightingFourBonesBn.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettSkinnedEffect_PSSkinnedVertexLighting.inc"
- #include "Shaders/Compiled/XboxGamingScarlettSkinnedEffect_PSSkinnedVertexLightingNoFog.inc"
- #include "Shaders/Compiled/XboxGamingScarlettSkinnedEffect_PSSkinnedPixelLighting.inc"
+ #include "XboxGamingScarlettSkinnedEffect_VSSkinnedVertexLightingFourBones.inc"
+ #include "XboxGamingScarlettSkinnedEffect_VSSkinnedPixelLightingFourBones.inc"
+ #include "XboxGamingScarlettSkinnedEffect_VSSkinnedVertexLightingFourBonesBn.inc"
+ #include "XboxGamingScarlettSkinnedEffect_VSSkinnedPixelLightingFourBonesBn.inc"
+
+ #include "XboxGamingScarlettSkinnedEffect_PSSkinnedVertexLighting.inc"
+ #include "XboxGamingScarlettSkinnedEffect_PSSkinnedVertexLightingNoFog.inc"
+ #include "XboxGamingScarlettSkinnedEffect_PSSkinnedPixelLighting.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOneSkinnedEffect_VSSkinnedVertexLightingFourBones.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneSkinnedEffect_VSSkinnedPixelLightingFourBones.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneSkinnedEffect_VSSkinnedVertexLightingFourBonesBn.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneSkinnedEffect_VSSkinnedPixelLightingFourBonesBn.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneSkinnedEffect_PSSkinnedVertexLighting.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneSkinnedEffect_PSSkinnedVertexLightingNoFog.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneSkinnedEffect_PSSkinnedPixelLighting.inc"
+ #include "XboxGamingXboxOneSkinnedEffect_VSSkinnedVertexLightingFourBones.inc"
+ #include "XboxGamingXboxOneSkinnedEffect_VSSkinnedPixelLightingFourBones.inc"
+ #include "XboxGamingXboxOneSkinnedEffect_VSSkinnedVertexLightingFourBonesBn.inc"
+ #include "XboxGamingXboxOneSkinnedEffect_VSSkinnedPixelLightingFourBonesBn.inc"
+
+ #include "XboxGamingXboxOneSkinnedEffect_PSSkinnedVertexLighting.inc"
+ #include "XboxGamingXboxOneSkinnedEffect_PSSkinnedVertexLightingNoFog.inc"
+ #include "XboxGamingXboxOneSkinnedEffect_PSSkinnedPixelLighting.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedVertexLightingFourBones.inc"
- #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedPixelLightingFourBones.inc"
- #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedVertexLightingFourBonesBn.inc"
- #include "Shaders/Compiled/XboxOneSkinnedEffect_VSSkinnedPixelLightingFourBonesBn.inc"
-
- #include "Shaders/Compiled/XboxOneSkinnedEffect_PSSkinnedVertexLighting.inc"
- #include "Shaders/Compiled/XboxOneSkinnedEffect_PSSkinnedVertexLightingNoFog.inc"
- #include "Shaders/Compiled/XboxOneSkinnedEffect_PSSkinnedPixelLighting.inc"
+ #include "XboxOneSkinnedEffect_VSSkinnedVertexLightingFourBones.inc"
+ #include "XboxOneSkinnedEffect_VSSkinnedPixelLightingFourBones.inc"
+ #include "XboxOneSkinnedEffect_VSSkinnedVertexLightingFourBonesBn.inc"
+ #include "XboxOneSkinnedEffect_VSSkinnedPixelLightingFourBonesBn.inc"
+
+ #include "XboxOneSkinnedEffect_PSSkinnedVertexLighting.inc"
+ #include "XboxOneSkinnedEffect_PSSkinnedVertexLightingNoFog.inc"
+ #include "XboxOneSkinnedEffect_PSSkinnedPixelLighting.inc"
#else
- #include "Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingFourBones.inc"
- #include "Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingFourBones.inc"
- #include "Shaders/Compiled/SkinnedEffect_VSSkinnedVertexLightingFourBonesBn.inc"
- #include "Shaders/Compiled/SkinnedEffect_VSSkinnedPixelLightingFourBonesBn.inc"
-
- #include "Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLighting.inc"
- #include "Shaders/Compiled/SkinnedEffect_PSSkinnedVertexLightingNoFog.inc"
- #include "Shaders/Compiled/SkinnedEffect_PSSkinnedPixelLighting.inc"
+ #include "SkinnedEffect_VSSkinnedVertexLightingFourBones.inc"
+ #include "SkinnedEffect_VSSkinnedPixelLightingFourBones.inc"
+ #include "SkinnedEffect_VSSkinnedVertexLightingFourBonesBn.inc"
+ #include "SkinnedEffect_VSSkinnedPixelLightingFourBonesBn.inc"
+
+ #include "SkinnedEffect_PSSkinnedVertexLighting.inc"
+ #include "SkinnedEffect_PSSkinnedVertexLightingNoFog.inc"
+ #include "SkinnedEffect_PSSkinnedPixelLighting.inc"
#endif
}
diff --git a/DirectXTK12/Src/SpriteBatch.cpp b/DirectXTK12/Src/SpriteBatch.cpp
index 51bc98a..53b380a 100644
--- a/DirectXTK12/Src/SpriteBatch.cpp
+++ b/DirectXTK12/Src/SpriteBatch.cpp
@@ -25,25 +25,25 @@ namespace
{
// Include the precompiled shader code.
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettSpriteEffect_SpriteVertexShader.inc"
- #include "Shaders/Compiled/XboxGamingScarlettSpriteEffect_SpritePixelShader.inc"
- #include "Shaders/Compiled/XboxGamingScarlettSpriteEffect_SpriteVertexShaderHeap.inc"
- #include "Shaders/Compiled/XboxGamingScarlettSpriteEffect_SpritePixelShaderHeap.inc"
+ #include "XboxGamingScarlettSpriteEffect_SpriteVertexShader.inc"
+ #include "XboxGamingScarlettSpriteEffect_SpritePixelShader.inc"
+ #include "XboxGamingScarlettSpriteEffect_SpriteVertexShaderHeap.inc"
+ #include "XboxGamingScarlettSpriteEffect_SpritePixelShaderHeap.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOneSpriteEffect_SpriteVertexShader.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneSpriteEffect_SpritePixelShader.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneSpriteEffect_SpriteVertexShaderHeap.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneSpriteEffect_SpritePixelShaderHeap.inc"
+ #include "XboxGamingXboxOneSpriteEffect_SpriteVertexShader.inc"
+ #include "XboxGamingXboxOneSpriteEffect_SpritePixelShader.inc"
+ #include "XboxGamingXboxOneSpriteEffect_SpriteVertexShaderHeap.inc"
+ #include "XboxGamingXboxOneSpriteEffect_SpritePixelShaderHeap.inc"
#elif defined(_XBOX_ONE) && defined(_TITLE)
- #include "Shaders/Compiled/XboxOneSpriteEffect_SpriteVertexShader.inc"
- #include "Shaders/Compiled/XboxOneSpriteEffect_SpritePixelShader.inc"
- #include "Shaders/Compiled/XboxOneSpriteEffect_SpriteVertexShaderHeap.inc"
- #include "Shaders/Compiled/XboxOneSpriteEffect_SpritePixelShaderHeap.inc"
+ #include "XboxOneSpriteEffect_SpriteVertexShader.inc"
+ #include "XboxOneSpriteEffect_SpritePixelShader.inc"
+ #include "XboxOneSpriteEffect_SpriteVertexShaderHeap.inc"
+ #include "XboxOneSpriteEffect_SpritePixelShaderHeap.inc"
#else
- #include "Shaders/Compiled/SpriteEffect_SpriteVertexShader.inc"
- #include "Shaders/Compiled/SpriteEffect_SpritePixelShader.inc"
- #include "Shaders/Compiled/SpriteEffect_SpriteVertexShaderHeap.inc"
- #include "Shaders/Compiled/SpriteEffect_SpritePixelShaderHeap.inc"
+ #include "SpriteEffect_SpriteVertexShader.inc"
+ #include "SpriteEffect_SpritePixelShader.inc"
+ #include "SpriteEffect_SpriteVertexShaderHeap.inc"
+ #include "SpriteEffect_SpritePixelShaderHeap.inc"
#endif
inline bool operator != (D3D12_GPU_DESCRIPTOR_HANDLE a, D3D12_GPU_DESCRIPTOR_HANDLE b) noexcept
diff --git a/DirectXTK12/Src/ToneMapPostProcess.cpp b/DirectXTK12/Src/ToneMapPostProcess.cpp
index c0ce093..fb54a37 100644
--- a/DirectXTK12/Src/ToneMapPostProcess.cpp
+++ b/DirectXTK12/Src/ToneMapPostProcess.cpp
@@ -75,71 +75,71 @@ namespace
namespace
{
#ifdef _GAMING_XBOX_SCARLETT
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_VSQuad.inc"
-
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSCopy.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSSaturate.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSReinhard.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSACESFilmic.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PS_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSSaturate_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSReinhard_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSACESFilmic_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSHDR10.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSHDR10_Saturate.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSHDR10_Reinhard.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSHDR10_ACESFilmic.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSHDR10_Saturate_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSHDR10_Reinhard_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingScarlettToneMap_PSHDR10_ACESFilmic_SRGB.inc"
+ #include "XboxGamingScarlettToneMap_VSQuad.inc"
+
+ #include "XboxGamingScarlettToneMap_PSCopy.inc"
+ #include "XboxGamingScarlettToneMap_PSSaturate.inc"
+ #include "XboxGamingScarlettToneMap_PSReinhard.inc"
+ #include "XboxGamingScarlettToneMap_PSACESFilmic.inc"
+ #include "XboxGamingScarlettToneMap_PS_SRGB.inc"
+ #include "XboxGamingScarlettToneMap_PSSaturate_SRGB.inc"
+ #include "XboxGamingScarlettToneMap_PSReinhard_SRGB.inc"
+ #include "XboxGamingScarlettToneMap_PSACESFilmic_SRGB.inc"
+ #include "XboxGamingScarlettToneMap_PSHDR10.inc"
+ #include "XboxGamingScarlettToneMap_PSHDR10_Saturate.inc"
+ #include "XboxGamingScarlettToneMap_PSHDR10_Reinhard.inc"
+ #include "XboxGamingScarlettToneMap_PSHDR10_ACESFilmic.inc"
+ #include "XboxGamingScarlettToneMap_PSHDR10_Saturate_SRGB.inc"
+ #include "XboxGamingScarlettToneMap_PSHDR10_Reinhard_SRGB.inc"
+ #include "XboxGamingScarlettToneMap_PSHDR10_ACESFilmic_SRGB.inc"
#elif defined(_GAMING_XBOX)
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_VSQuad.inc"
-
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSCopy.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSSaturate.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSReinhard.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSACESFilmic.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PS_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSSaturate_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSReinhard_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSACESFilmic_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSHDR10.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSHDR10_Saturate.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSHDR10_Reinhard.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSHDR10_ACESFilmic.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSHDR10_Saturate_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSHDR10_Reinhard_SRGB.inc"
- #include "Shaders/Compiled/XboxGamingXboxOneToneMap_PSHDR10_ACESFilmic_SRGB.inc"
+ #include "XboxGamingXboxOneToneMap_VSQuad.inc"
+
+ #include "XboxGamingXboxOneToneMap_PSCopy.inc"
+ #include "XboxGamingXboxOneToneMap_PSSaturate.inc"
+ #include "XboxGamingXboxOneToneMap_PSReinhard.inc"
+ #include "XboxGamingXboxOneToneMap_PSACESFilmic.inc"
+ #include "XboxGamingXboxOneToneMap_PS_SRGB.inc"
+ #include "XboxGamingXboxOneToneMap_PSSaturate_SRGB.inc"
+ #include "XboxGamingXboxOneToneMap_PSReinhard_SRGB.inc"
+ #include "XboxGamingXboxOneToneMap_PSACESFilmic_SRGB.inc"
+ #include "XboxGamingXboxOneToneMap_PSHDR10.inc"
+ #include "XboxGamingXboxOneToneMap_PSHDR10_Saturate.inc"
+ #include "XboxGamingXboxOneToneMap_PSHDR10_Reinhard.inc"
+ #include "XboxGamingXboxOneToneMap_PSHDR10_ACESFilmic.inc"
+ #include "XboxGamingXboxOneToneMap_PSHDR10_Saturate_SRGB.inc"
+ #include "XboxGamingXboxOneToneMap_PSHDR10_Reinhard_SRGB.inc"
+ #include "XboxGamingXboxOneToneMap_PSHDR10_ACESFilmic_SRGB.inc"
#elif 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"
+ #include "XboxOneToneMap_VSQuad.inc"
+
+ #include "XboxOneToneMap_PSCopy.inc"
+ #include "XboxOneToneMap_PSSaturate.inc"
+ #include "XboxOneToneMap_PSReinhard.inc"
+ #include "XboxOneToneMap_PSACESFilmic.inc"
+ #include "XboxOneToneMap_PS_SRGB.inc"
+ #include "XboxOneToneMap_PSSaturate_SRGB.inc"
+ #include "XboxOneToneMap_PSReinhard_SRGB.inc"
+ #include "XboxOneToneMap_PSACESFilmic_SRGB.inc"
+ #include "XboxOneToneMap_PSHDR10.inc"
+ #include "XboxOneToneMap_PSHDR10_Saturate.inc"
+ #include "XboxOneToneMap_PSHDR10_Reinhard.inc"
+ #include "XboxOneToneMap_PSHDR10_ACESFilmic.inc"
+ #include "XboxOneToneMap_PSHDR10_Saturate_SRGB.inc"
+ #include "XboxOneToneMap_PSHDR10_Reinhard_SRGB.inc"
+ #include "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"
+ #include "ToneMap_VSQuad.inc"
+
+ #include "ToneMap_PSCopy.inc"
+ #include "ToneMap_PSSaturate.inc"
+ #include "ToneMap_PSReinhard.inc"
+ #include "ToneMap_PSACESFilmic.inc"
+ #include "ToneMap_PS_SRGB.inc"
+ #include "ToneMap_PSSaturate_SRGB.inc"
+ #include "ToneMap_PSReinhard_SRGB.inc"
+ #include "ToneMap_PSACESFilmic_SRGB.inc"
+ #include "ToneMap_PSHDR10.inc"
#endif
}
@@ -240,9 +240,9 @@ namespace
ID3D12Device* GetDevice() const noexcept { return mDevice.Get(); }
protected:
- ComPtr mDevice;
- Microsoft::WRL::ComPtr mRootSignature;
- std::mutex mMutex;
+ ComPtr mDevice;
+ ComPtr mRootSignature;
+ std::mutex mMutex;
};
}
diff --git a/DirectXTKModelViewer_Desktop_2017_Win10.vcxproj b/DirectXTKModelViewer_Desktop_2017_Win10.vcxproj
index 5e0590a..5940db2 100644
--- a/DirectXTKModelViewer_Desktop_2017_Win10.vcxproj
+++ b/DirectXTKModelViewer_Desktop_2017_Win10.vcxproj
@@ -22,7 +22,7 @@
directxtk12modelviewer
{8d6aa92b-b106-4a67-9b1e-b93443577920}
Win32Proj
- 10.0.19401.0
+ 10.0.19041.0