3 Commits

Author SHA1 Message Date
Dmitry 57748f8026 UpTo5.3_PixelStreamingVersion 2026-04-07 17:09:43 +05:00
GRAFF aba033df3d s 2023-06-21 16:42:46 +05:00
GRAFF 8418c87110 asd 2023-06-21 15:02:25 +05:00
115 changed files with 467 additions and 11953 deletions
+8
View File
@@ -0,0 +1,8 @@
[Windows DeviceProfile]
DeviceType=Windows
BaseProfileName=
bIsVisibleForAssets=True
+TextureLODGroups=(Group=TEXTUREGROUP_World,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,MaxLODSize_VT=0,OptionalLODBias=0,OptionalMaxLODSize=4096,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_WorldNormalMap,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,MaxLODSize_VT=0,OptionalLODBias=0,OptionalMaxLODSize=4096,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Character,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,MaxLODSize_VT=0,OptionalLODBias=0,OptionalMaxLODSize=4096,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_CharacterNormalMap,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,MaxLODSize_VT=0,OptionalLODBias=0,OptionalMaxLODSize=4096,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
-53
View File
@@ -1,53 +0,0 @@
[WindowsNoEditor DeviceProfile]
DeviceType=Windows
BaseProfileName=Windows
+TextureLODGroups=(Group=TEXTUREGROUP_World,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_WorldNormalMap,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_WorldSpecular,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Character,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_CharacterNormalMap,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_CharacterSpecular,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Weapon,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_WeaponNormalMap,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_WeaponSpecular,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Vehicle,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_VehicleNormalMap,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_VehicleSpecular,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Cinematic,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Effects,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="linear",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_EffectsNotFiltered,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Skybox,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=8192,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=8192,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_UI,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_NoMipmaps,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Lightmap,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_RenderTarget,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_MobileFlattened,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_ProcBuilding_Face,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_ProcBuilding_LightMap,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Shadowmap,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=3,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_ColorLookupTable,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Terrain_Heightmap,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Terrain_Weightmap,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="aniso",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Bokeh,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="linear",MipFilter="linear",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_IESLightProfile,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Pixels2D,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="point",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_HierarchicalLOD,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Impostor,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_ImpostorNormalDepth,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_8BitData,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_NoMipmaps,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="point",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_16BitData,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_NoMipmaps,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="point",MipFilter="point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project01,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project02,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project03,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project04,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project05,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project06,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project07,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project08,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project09,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project10,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project11,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project12,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project13,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project14,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+TextureLODGroups=(Group=TEXTUREGROUP_Project15,LODBias=0,LODBias_Smaller=-1,LODBias_Smallest=-1,NumStreamedMips=-1,MipGenSettings=TMGS_SimpleAverage,MinLODSize=1,MaxLODSize=1024,MaxLODSize_Smaller=-1,MaxLODSize_Smallest=-1,OptionalLODBias=0,OptionalMaxLODSize=1024,MinMagFilter="Aniso",MipFilter="Point",MipLoadOptions=AllMips,HighPriorityLoad=False,DuplicateNonOptionalMips=False,Downscale=1.000000,DownscaleOptions=SimpleAverage,VirtualTextureTileCountBias=0,VirtualTextureTileSizeBias=0,LossyCompressionAmount=TLCA_Default)
+1
View File
@@ -1 +1,2 @@
[/Script/AdvancedPreviewScene.SharedProfiles]
+14
View File
@@ -39,3 +39,17 @@ bAutoDestroyWhenNoNavigation=False
[/Script/NavigationSystem.NavigationSystemV1]
bGenerateNavigationOnlyAroundNavigationInvokers=True
[/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings]
bEnablePlugin=True
bAllowNetworkConnection=True
SecurityToken=544B5A6D441F4667CB570E8F83716DBD
bIncludeInShipping=False
bAllowExternalStartInShipping=False
bCompileAFSProject=False
bUseCompression=False
bLogFiles=False
bReportStats=False
ConnectionType=USBOnly
bUseManualIPAddress=False
ManualIPAddress=
+24 -24
View File
@@ -45,30 +45,30 @@ bCookAll=True
bCookMapsOnly=True
bSkipEditorContent=False
bSkipMovies=False
-IniKeyBlacklist=KeyStorePassword
-IniKeyBlacklist=KeyPassword
-IniKeyBlacklist=rsa.privateexp
-IniKeyBlacklist=rsa.modulus
-IniKeyBlacklist=rsa.publicexp
-IniKeyBlacklist=aes.key
-IniKeyBlacklist=SigningPublicExponent
-IniKeyBlacklist=SigningModulus
-IniKeyBlacklist=SigningPrivateExponent
-IniKeyBlacklist=EncryptionKey
-IniKeyBlacklist=IniKeyBlacklist
-IniKeyBlacklist=IniSectionBlacklist
+IniKeyBlacklist=KeyStorePassword
+IniKeyBlacklist=KeyPassword
+IniKeyBlacklist=rsa.privateexp
+IniKeyBlacklist=rsa.modulus
+IniKeyBlacklist=rsa.publicexp
+IniKeyBlacklist=aes.key
+IniKeyBlacklist=SigningPublicExponent
+IniKeyBlacklist=SigningModulus
+IniKeyBlacklist=SigningPrivateExponent
+IniKeyBlacklist=EncryptionKey
+IniKeyBlacklist=IniKeyBlacklist
+IniKeyBlacklist=IniSectionBlacklist
-IniKeyDenylist=KeyStorePassword
-IniKeyDenylist=KeyPassword
-IniKeyDenylist=rsa.privateexp
-IniKeyDenylist=rsa.modulus
-IniKeyDenylist=rsa.publicexp
-IniKeyDenylist=aes.key
-IniKeyDenylist=SigningPublicExponent
-IniKeyDenylist=SigningModulus
-IniKeyDenylist=SigningPrivateExponent
-IniKeyDenylist=EncryptionKey
-IniKeyDenylist=IniKeyBlacklist
-IniKeyDenylist=IniSectionBlacklist
+IniKeyDenylist=KeyStorePassword
+IniKeyDenylist=KeyPassword
+IniKeyDenylist=rsa.privateexp
+IniKeyDenylist=rsa.modulus
+IniKeyDenylist=rsa.publicexp
+IniKeyDenylist=aes.key
+IniKeyDenylist=SigningPublicExponent
+IniKeyDenylist=SigningModulus
+IniKeyDenylist=SigningPrivateExponent
+IniKeyDenylist=EncryptionKey
+IniKeyDenylist=IniKeyBlacklist
+IniKeyDenylist=IniSectionBlacklist
+DirectoriesToAlwaysCook=(Path="/Game/Maps/Interior")
[/Script/EngineSettings.GeneralProjectSettings]
+7 -2
View File
@@ -76,6 +76,11 @@ bUseMouseForTouch=True
bEnableMouseSmoothing=False
bEnableFOVScaling=False
bCaptureMouseOnLaunch=True
bEnableLegacyInputScales=True
bEnableMotionControls=True
bFilterInputByPlatformUser=False
bShouldFlushPressedKeysOnViewportFocusLost=True
bEnableDynamicComponentInputBinding=True
bAlwaysShowTouchInterface=False
bShowConsoleOnFourFingerTap=True
bEnableGestureRecognizer=False
@@ -92,8 +97,8 @@ DoubleClickTime=0.200000
+AxisMappings=(AxisName="forward",Scale=-1.000000,Key=Down)
+AxisMappings=(AxisName="forward",Scale=1.000000,Key=W)
+AxisMappings=(AxisName="forward",Scale=-1.000000,Key=S)
DefaultPlayerInputClass=/Script/Engine.PlayerInput
DefaultInputComponentClass=/Script/Engine.InputComponent
DefaultPlayerInputClass=/Script/EnhancedInput.EnhancedPlayerInput
DefaultInputComponentClass=/Script/EnhancedInput.EnhancedInputComponent
DefaultTouchInterface=None
-ConsoleKeys=Tilde
+ConsoleKeys=Tilde
Binary file not shown.
@@ -0,0 +1,32 @@
[/Script/HoloLensPlatformEditor.HoloLensTargetSettings]
bBuildForEmulation=False
bBuildForDevice=True
bUseNameForLogo=True
bBuildForRetailWindowsStore=False
bAutoIncrementVersion=False
bShouldCreateAppInstaller=False
AppInstallerInstallationURL=
HoursBetweenUpdateChecks=0
bEnablePIXProfiling=False
TileBackgroundColor=(B=64,G=0,R=0,A=255)
SplashScreenBackgroundColor=(B=64,G=0,R=0,A=255)
+PerCultureResources=(CultureId="",Strings=(PackageDisplayName="",PublisherDisplayName="",PackageDescription="",ApplicationDisplayName="",ApplicationDescription=""),Images=())
TargetDeviceFamily=Windows.Holographic
MinimumPlatformVersion=
MaximumPlatformVersionTested=10.0.18362.0
MaxTrianglesPerCubicMeter=500.000000
SpatialMeshingVolumeSize=20.000000
CompilerVersion=Default
Windows10SDKVersion=10.0.18362.0
+CapabilityList=internetClientServer
+CapabilityList=privateNetworkClientServer
+Uap2CapabilityList=spatialPerception
bSetDefaultCapabilities=False
SpatializationPlugin=
SourceDataOverridePlugin=
ReverbPlugin=
OcclusionPlugin=
SoundCueCookQualityIndex=-1
-23
View File
@@ -1,23 +0,0 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.22",
"FriendlyName": "Character Creator & iClone Auto Setup",
"Description": "Automatic shader and skeletal assignment for CC Characters and iClone Assets, including Blueprint generation for material properties, texture settings and model configurations. ",
"Category": "Reallusion",
"CreatedBy": "Reallusion",
"CreatedByURL": "",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"EngineVersion": "4.27.0",
"CanContainContent": false,
"Installed": true,
"Modules": [
{
"Name": "RLPlugin",
"Type": "Editor",
"LoadingPhase": "PreDefault"
}
]
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

@@ -1,29 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Factories/FbxFactory.h"
#include "Runtime/SlateCore/Public/Styling/SlateTypes.h"
//#include "SlateBasics.h"
#include "Factories/Factory.h"
#include "UObject/ObjectMacros.h"
#include "CCImportUI.h"
#include "CCFbxFactory.generated.h"
class UTextureFactory;
UCLASS(hidecategories = Object)
class UCCFbxFactory : public UFbxFactory
{
GENERATED_UCLASS_BODY()
public:
//~ UFactory Interface
virtual UObject* FactoryCreateFile( UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, const FString& InFilename, const TCHAR* Parms, FFeedbackContext* Warn, bool& bOutOperationCanceled );
virtual void PostInitProperties() override;
void ImportTextureFolder( FString& fbxRootPath, FString& rootGamePath, TArray< TCHAR* > kFileExtension, FString &fbxName, TArray<FString> &kTextureList );
TArray<FString> GetLODPaths( FString &targetFolderPath, FString &FbxName );
void SetShaderType( FString shaderType );
private:
FString m_ShaderType = "Standard";
};
@@ -1,33 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "CCImportUI.generated.h"
/**
* TODO:
*/
UCLASS( config = EditorPerProjectUserSettings, AutoExpandCategories = ( FTransform ), HideCategories = Object, MinimalAPI )
class UCCImportUI : public UObject
{
GENERATED_BODY()
public:
UCCImportUI( const FObjectInitializer& kObjectInitializer );
void WriteConfig();
private:
void ReadConfig();
public:
bool isCCAutoSetup;
bool isHQSkin;
bool isLWSkin;
bool isStandardSkin;
bool isCanceled;
bool isCanChangeAutoEnable;
bool hasCCShader;
bool isLiveLink;
};
@@ -1,405 +0,0 @@
#pragma once
#include "CoreMinimal.h"
TMap< FString, FString > g_kTeethMap =
{
{ "Gums Mask", "Teeth Mask Map" },
{ "Gradient AO", "Gradient AO Map" },
{ "MicroNormal", "MicroNormal Map" },
// MicroNormal
{ "Flip MicroNormal Y", "Flip Micro Normal Y" },
{ "Teeth MicroNormal Tiling", "Teeth MicroNormal Tiling" },
{ "Teeth MicroNormal Strength", "Teeth MicroNormal Strength" },
{ "Gums MicroNormal Tiling", "Flesh MicroNormal Tiling" },
{ "Gums MicroNormal Strength", "Flesh MicroNormal Strength" },
// TeethGum
{ "Teeth Edge Color", "Teeth Edge Color" },
{ "Is Upper Teeth", "Is Upper Teeth" },
{ "Teeth Brightness", "Teeth Diffuse Brightness" },
{ "Teeth Desaturation", "Teeth Desaturation" },
{ "Gums Brightness", "Flesh Brightness" },
{ "Gums Desaturation", "Flesh Desaturation" },
{ "Front Roughness", "TeethGum Front Roughness" },
{ "Front Specular", "TeethGum Front Specular" },
// TeethGum-Adv
{ "Front AO", "TeethGum Front AO" },
{ "Back AO", "TeethGum Back AO" },
{ "Back Roughness", "TeethGum Back Roughness" },
{ "Back Specular", "TeethGum Back Specular" },
// SSS
{ "Gums Scatter", "Flesh Scatter" },
{ "Teeth Scatter", "Teeth Scatter" }
};
TMap< FString, FString > g_kTongueMap =
{
{ "MicroNormal", "MicroNormal Map" },
{ "Gradient AO", "Gradient AO Map" },
// MicroNormal
{ "Flip MicroNormal Y", "Flip Micro Normal Y" },
{ "MicroNormal Tiling", "Flesh MicroNormal Tiling" },
{ "MicroNormal Strength", "Flesh MicroNormal Strength" },
// Tongue
{ "_Brightness", "Flesh Brightness" },
{ "_Desaturation", "Flesh Desaturation" },
{ "Front Roughness", "Tongue Front Roughness" },
{ "Front Specular", "Tongue Front Specular" },
// Tongue-Adv
{ "Back Roughness", "Tongue Back Roughness" },
{ "Back Specular", "Tongue Back Specular" },
{ "Front AO", "Tongue Front AO" },
{ "Back AO", "Tongue Back AO" },
// SSS
{ "_Scatter", "Flesh Scatter" }
};
TMap< FString, FString > g_kSkinMap =
{
{ "SSS Map", "SSS Map" },
{ "MicroNormalMask", "MicroNormal Mask Map" },
{ "MicroNormal", "MicroNormal Map" },
{ "RGBA Area Mask", "RGBA Area Mask Map" },
{ "_BaseColorMap Brightness", "BaseColorMap_Brightness" },
{ "_BaseColorMap Saturation", "BaseColorMap_Saturation" },
// MicroNormal
{ "Flip MicroNormal Y", "Flip Micro Normal Y" },
{ "MicroNormal Tiling", "MicroNormal Tiling Value" },
{ "MicroNormal Strength", "MicroNormal Strength" },
// Roughness
{ "Micro Roughness Scale", "Micro Roughness Scale" },
{ "R Channel Roughness Scale", "R Channel Roughness Scale" },
{ "G Channel Roughness Scale", "G Channel Roughness Scale" },
{ "B Channel Roughness Scale", "B Channel Roughness Scale" },
{ "A Channel Roughness Scale", "A Channel Roughness Scale" },
{ "Unmasked Roughness Scale", "Unmask Roughness Scale" },
{ "Edge Roughness Multiplier", "Edge Roughness Multiplier" },
// Specular Metallic
{ "_Specular", "Specular" },
{ "SSS Metallic Threshold", "Metallic SSS Threshold" },
// SSS
{ "G Channel Scatter Scale", "G Channel Scatter" },
{ "R Channel Scatter Scale", "R Channel Scatter" },
{ "B Channel Scatter Scale", "B Channel Scatter" },
{ "A Channel Scatter Scale", "A Channel Scatter" },
{ "Unmasked Scatter Scale", "SSS Unmasked Scale" }
};
TMap< FString, FString > g_kHeadMap =
{
{ "BaseColor Blend2", "Blend Map_2" },
{ "NormalMap Blend", "NormalMap_Blend" },
{ "SSS Map", "SSS Map" },
{ "MicroNormalMask", "MicroNormal Mask Map" },
{ "MicroNormal", "MicroNormal Map" },
{ "Specular Mask", "Specular Cavity Map" },
{ "Mouth Cavity Mask and AO", "Mouth Cavity And AO Map" },
{ "Nose Mouth UpperInnerLid Mask", "NLML Mask Map" },
{ "Cheek Fore UpperLip Chin Mask", "CFUC Mask Map" },
{ "Ear Neck Mask", "EN Mask Map" },
// Blend Map
{ "BaseColor Blend2 Strength", "BaseColor_Blend2_Strength" },
{ "NormalMap Blend Strength", "NormalMap_Blend_Strength" },
{ "_BaseColorMap Brightness", "BaseColorMap_Brightness" },
{ "_BaseColorMap Saturation", "BaseColorMap_Saturation" },
// MicroNormal
{ "Flip MicroNormal Y", "Flip Micro Normal Y" },
{ "MicroNormal Tiling", "MicroNormal Tiling Value" },
{ "MicroNormal Strength", "MicroNormal Strength" },
// Roughness
{ "Micro Roughness Scale", "Micro Roughness Scale" },
{ "Nose Roughness Scale", "Nose Roughness Scale" },
{ "Mouth Roughness Scale", "Mouth Roughness Scale" },
{ "UpperLid Roughness Scale", "UpperLid Roughness Scale" },
{ "InnerLid Roughness Scale", "InnerLid Roughness Scale" },
{ "Ear Roughness Scale", "Ear Roughness Scale" },
{ "Neck Roughness Scale", "Neck Roughness Scale" },
{ "Cheek Roughness Scale", "Cheek Roughness Scale" },
{ "Forehead Roughness Scale", "Forehead Roughness Scale" },
{ "UpperLip Roughness Scale", "UpperLips Roughness Scale" },
{ "Chin Roughness Scale", "Chin Roughness Scale" },
{ "Unmasked Roughness Scale", "Unmask Roughness Scale" },
{ "Edge Roughness Multiplier", "Edge Roughness Multiplier" },
// Specular Metallic
{ "_Specular", "Head Specular" },
{ "SSS Metallic Threshold", "Metallic SSS Threshold" },
{ "Inner Mouth AO", "Inner Mouth AO" },
{ "Nostril AO", "Nostril AO" },
{ "Lips Gap AO", "Lips_Gap_AO" },
// SSS
{ "Nose Scatter Scale", "Nose Scatter Scale" },
{ "Mouth Scatter Scale", "Mouth Scatter Scale" },
{ "UpperLid Scatter Scale", "UpperLid Scatter Scale" },
{ "InnerLid Scatter Scale", "InnerLid Scatter Scale" },
{ "Ear Scatter Scale", "Ear Scatter Scale" },
{ "Neck Scatter Scale", "Neck Scatter Scale" },
{ "Cheek Scatter Scale", "Cheek Scatter Scale" },
{ "Forehead Scatter Scale", "Forehead Scatter Scale" },
{ "UpperLip Scatter Scale", "UpperLips Scatter Scale" },
{ "Chin Scatter Scale", "Chin Scatter Scale" },
{ "Unmasked Scatter Scale", "SSS Unmasked Scale" }
};
TMap< FString, FString > g_kEyeMap =
{
{ "Iris Normal", "Iris Normal Map" },
{ "Sclera Normal", "Normal Map" },
{ "EyeBlendMap2", "EyeBlendMap2" },
{ "Inner Iris Mask", "Inner Iris Mask" },
{ "Sclera", "Sclera Map" },
// Eye
{ "BlendMap2 Strength", "BlendMap2_Strength" },
{ "Shadow Radius", "Shadow Radius" },
{ "Shadow Hardness", "Shadow Hardness" },
{ "Specular Scale", "Specular Multiplier" },
// Eye-Adv
{ "Is Left Eye", "Is Left Eye" },
{ "Eye Corner Darkness Color", "Eye Corner Darkness Color" },
// Iris
{ "Iris Depth Scale", "Iris Depth Scale" },
{ "_Iris Roughness", "Iris Roughness" },
{ "Iris Color Brightness", "Iris Color Brightness" },
{ "Pupil Scale", "Pupil Scale" },
// Iris-Adv
{ "_IoR", "Ior" },
{ "Iris Cloudy Color", "Iris Cloudy Color" },
{ "Iris Inner Color", "Iris Inner Color" },
{ "Iris Inner Scale", "Iris Inner Scale" },
{ "Iris UV Radius", "Iris UV Radius" },
{ "Iris Color", "Iris Color" },
// Limbus
{ "Limbus UV Width Color", "Limbus UV Width Color" },
{ "Limbus Dark Scale", "Limbus Dark Scale" },
// Sclera
{ "ScleraBrightness", "Sclera Brightness" },
{ "Sclera Roughness", "Sclera Roughness" },
// Sclera-Adv
{ "Sclera Flatten Normal", "Sclera Normal" },
{ "Sclera Normal UV Scale", "Sclera Normal UV Scale" },
{ "Sclera UV Radius", "Sclera UV Radius" },
};
#define FLIP_TANGENT_Y "Flip Tangent Y"
#define ACTIVATE_HAIR_COLOR "Activate Hair Color"
TMap< FString, FString > g_kHairMap =
{
{ "Hair Tangent Map" , "Tangent Map" },
{ "Hair Flow Map" , "Flow Map" },
{ "Hair Specular Mask Map", "Specular Map" },
{ "Hair Root Map" , "Root Map" },
{ "Hair ID Map" , "ID Map" },
{ "TangentMapFlipGreen", FLIP_TANGENT_Y },
{ "AO Map Occlude All Lighting", "AO Map Occlude All Lighting" },
{ "Diffuse Strength", "Scatter" },
{ "Hair Roughness Map Strength", "Roughness Multiplier" },
{ "Hair Specular Map Strength", "Specular Multiplier" },
{ "VertexGrayToColor" , "Vertex Color" },
{ "VertexColorStrength" , "Vertex Color Strength" },
{ "ActiveChangeHairColor" , ACTIVATE_HAIR_COLOR },
{ "BaseColorMapStrength" , "Base Color Map Strength" },
// Strand Color
{ "RootColor" , "Root Color" },
{ "TipColor" , "End Color" },
{ "RootTipBlendMode" , "Root End Blend Mode" },
{ "UseRootTipColor" , "Global Strength" },
{ "RootColorStrength" , "Root Color Strength" },
{ "TipColorStrength" , "End Color Strength" },
{ "InvertRootTip" , "Invert Root and End Color" },
// highlight A
{ "_1st Dye Color" , "Highlight A Color" },
{ "_1st Dye Strength" , "Highlight A Strength" },
{ "_1st Dye Distribution from Grayscale", "Highlight A Affected Range" },
{ "_1st BlendMode" , "Highlight A Blend Mode" },
{ "Mask 1st Dye by RootMap" , "Highlight A Overlap End Color" },
{ "Invert 1st Dye RootMap Mask" , "Highlight A Invert End to Root Color" },
{ "_1st Dye add Specular" , "Highlight A Specular Strength" },
// hightlight B
{ "_2nd Dye Color" , "Highlight B Color" },
{ "_2nd Dye Strength" , "Highlight B Strength" },
{ "_2nd Dye Distribution from Grayscale", "Highlight B Affected Range" },
{ "_2nd BlendMode" , "Highlight B Blend Mode" },
{ "Mask 2nd Dye by RootMap" , "Highlight B Overlap End Color" },
{ "Invert 2nd Dye RootMap Mask" , "Highlight B Invert End to Root Color" },
{ "_2nd Dye add Specular" , "Highlight B Specular Strength" },
//
{ "BlackColor Reflection Offset X", "Rotate Vertical by Black ID" },
{ "BlackColor Reflection Offset Y", "Rotate Horizontal by Black ID" },
{ "BlackColor Reflection Offset Z", "Shift by Black ID" },
{ "WhiteColor Reflection Offset X", "Rotate Vertical by White ID" },
{ "WhiteColor Reflection Offset Y", "Rotate Horizontal by White ID" },
{ "WhiteColor Reflection Offset Z", "Shift by White ID" },
};
TMap< FString, FString > g_kEyeOccusionMap =
{
{ "Display Blur Range", "Blur Color" },
{ "Blur Strength", "Blur Strength" },
{ "_Expand", "Expand" },
{ "Top Blur Range", "Top Blur Range" },
{ "Top Blur Contrast", "Top Blur Contrast" },
{ "Bottom Blur Range", "Bottom Blur Range" },
{ "Bottom Blur Contrast", "Bottom Blur Contrast" },
{ "Outer Corner Blur Range", "Outer Corner Blur Range" },
{ "Outer Corner Blur Contrast", "Outer Corner Blur Contrast" },
{ "Tear Duct Position", "Tear Duct Position" },
{ "Tear Duct Contrast", "Tear Duct Contrast" },
{ "Tear Duct Shadow Offset", "Tear Duct Shadow Offset" },
// 1st layer shadow
{ "Shadow Color", "Shadow 1 Color" },
{ "Shadow Strength", "Shadow 1 Strength" },
{ "Shadow Top", "Shadow 1 Top" },
{ "Shadow Top Range", "Shadow 1 Top Range" },
{ "Shadow Top Arc", "Shadow 1 Top Edge" },
{ "Shadow Bottom", "Shadow 1 Bottom" },
{ "Shadow Bottom Range", "Shadow 1 Bottom Range" },
{ "Shadow Bottom Arc", "Shadow 1 Bottom Edge" },
{ "Shadow Inner Corner", "Shadow 1 Inner Corner" },
{ "Shadow Inner Corner Range", "Shadow 1 Inner Corner Range" },
{ "Shadow Outer Corner", "Shadow 1 Outer Corner" },
{ "Shadow Outer Corner Range", "Shadow 1 Outer Corner Range" },
// 2nd_Layer_Shadow
{ "Shadow2 Color", "Shadow 2 Color" },
{ "Shadow2 Strength", "Shadow 2 Strength" },
{ "Shadow2 Top", "Shadow 2 Top" },
{ "Shadow2 Top Range", "Shadow 2 Top Range" },
// Vertex_Offset
{ "Depth Offset", "Depth Offset" },
{ "Fade Distance", "Fade Distance" }, // depth fade distance
{ "Top Offset", "Top Offset" },
{ "Bottom Offset", "Bottom Offset" },
{ "Inner Corner Offset", "Inner Corner Offset" },
{ "Outer Corner Offset", "Outer Corner Offset" },
};
TMap< FString, FString > g_kTearLineMap =
{
{ "Depth Offset", "DepthOffset" },
{ "Detail Amount", "DetailAmount" },
{ "Detail Scale U", "DetailScale_U" },
{ "Detail Scale V", "DetailScale_V" },
{ "Edge Fadeout", "Edge_fadeout" },
{ "_Roughness", "Roughness" }
};
#define AO_MAP_OCCLUDE_ALL_LIGHTS "Occlude All Lighting"
#define FLIP_MICRO_NORMAL_Y "Flip Micro Normal Y"
TMap< FString, FString > g_kGeneralMap =
{
{ "SSS Map", "SSS Map" },
{ "MicroNormalMask", "MicroNormal Mask Map" },
{ "MicroNormal", "MicroNormal Map" },
{ "RGBA Area Mask", "RGBA Area Mask Map" },
{ "_BaseColorMap Brightness", "BaseColorMap_Brightness" },
{ "_BaseColorMap Saturation", "BaseColorMap_Saturation" },
{ "AO Map Affect All Lights", AO_MAP_OCCLUDE_ALL_LIGHTS },
// Micro_Normal
{ "Flip MicroNormal Y", FLIP_MICRO_NORMAL_Y },
{ "MicroNormal Tiling", "MicroNormal Tiling Value" },
{ "MicroNormal Strength", "MicroNormal Strength" },
// _Specular_Roughness
{ "_Specular", "Specular" },
{ "Micro Roughness Scale", "Micro Roughness Scale" },
// _Specular_Roughness-Adv
{ "R Channel Roughness Scale", "R Channel Roughness Scale" },
{ "G Channel Roughness Scale", "G Channel Roughness Scale" },
{ "B Channel Roughness Scale", "B Channel Roughness Scale" },
{ "A Channel Roughness Scale", "A Channel Roughness Scale" },
{ "Unmasked Roughness Scale", "Unmask Roughness Scale" },
{ "Edge Roughness Multiplier", "Edge Roughness Multiplier" },
// SSS
{ "R Channel Scatter Scale", "R Channel Scatter" },
{ "G Channel Scatter Scale", "G Channel Scatter" },
{ "B Channel Scatter Scale", "B Channel Scatter" },
{ "A Channel Scatter Scale", "A Channel Scatter" },
{ "Unmasked Scatter Scale", "SSS Unmasked Scale" },
};
class RLShaderData
{
public:
RLShaderData() {}
~RLShaderData() {}
FString m_strShaderName;
TMap< FString, FString > m_kTexture;
TMap< FString, float > m_kParameter;
TMap< FString, TArray< float > > m_kColorParameter;
};
class RLScatter
{
public:
RLScatter() {}
~RLScatter() {}
RLScatter( FLinearColor sss,
FLinearColor falloff,
float radius,
float distribution,
float IOR,
float extinction,
float normalScale,
float roughness1,
float roughness2,
float lobeMix )
:m_kFalloff( falloff ),
m_fRadius(radius),
m_fDistribution(distribution),
m_fIOR(IOR),
m_kSubsurfaceColor( sss ),
m_fExtinctionScale(extinction),
m_fNormalScale(normalScale),
m_fRoughness0(roughness1),
m_fRoughness1(roughness2),
m_fLobeMix(lobeMix)
{
}
void SetDefaultParameter( FLinearColor kSubsurfaceColor,
float fDistribution,
float fIOR,
float fExtinctionScale,
float fNormalScale,
float fRoughness0,
float fRoughness1,
float fLobeMix )
{
m_kSubsurfaceColor = kSubsurfaceColor;
m_fDistribution = fDistribution;
m_fIOR = fIOR;
m_fExtinctionScale = fExtinctionScale;
m_fNormalScale = fNormalScale;
m_fRoughness0 = fRoughness0;
m_fRoughness1 = fRoughness1;
m_fLobeMix = fLobeMix;
}
FLinearColor m_kFalloff;
float m_fRadius = 0.0f;
float m_fDistribution = 0.0f;
float m_fIOR = 0.0f;
FLinearColor m_kSubsurfaceColor;
float m_fExtinctionScale = 0.0f;
float m_fNormalScale = 0.0f;
float m_fRoughness0 = 0.0f;
float m_fRoughness1 = 0.0f;
float m_fLobeMix = 0.0f;
};
@@ -1,4 +0,0 @@
#pragma once
#define Version_Error_Message "The current procedure has come to a stop because auto-setup is not support for this version of CC / iClone. Please update to the appropriate version."
#define Version_Not_Suitable "Auto-setup is not support for this version of CC / iClone and some issues may occur as a result. Please update to the appropriate version."
@@ -1,53 +0,0 @@
#pragma once
//#include "SlateBasics.h"
class UCCImportUI;
class SCCImportWindow : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SCCImportWindow)
: _ImportUI(NULL)
, _WidgetWindow()
//, _SourcePath()
//, _TargetPath()
{}
SLATE_ARGUMENT(UCCImportUI*, ImportUI)
SLATE_ARGUMENT(TSharedPtr<SWindow>, WidgetWindow)
// SLATE_ARGUMENT(FText, SourcePath)
//SLATE_ARGUMENT(FText, TargetPath)
SLATE_END_ARGS()
public:
void Construct(const FArguments& InArgs);
private:
UCCImportUI* ccImportUI;
TWeakPtr< SWindow > WidgetWindow;
TSharedPtr< SButton > ImportButton;
//FString TargetPath;
bool isCCAutoSetup;
bool isHQSkin;
bool isLWSkin;
bool isStandardSkin;
bool isliveLink;
//TSharedRef<SWidget> GetTestContent() const;
FString skinType = "Standard";
ECheckBoxState IsStandardActive() const;
ECheckBoxState IsHQActive() const;
ECheckBoxState IsLWActive() const;
void OnCCLiveLinkChanged(ECheckBoxState InCheckedState);
void OnCCAutoSetupChanged(ECheckBoxState InCheckedState);
void OnStandardChanged(ECheckBoxState InCheckedState);
void OnHQChanged(ECheckBoxState InCheckedState);
void OnLWChanged(ECheckBoxState InCheckedState);
TSharedPtr< SCheckBox > Standard_CheckBox;
TSharedPtr< SCheckBox > HQ_CheckBox;
TSharedPtr< SCheckBox > LW_CheckBox;
TSharedPtr< SCheckBox > CCAutoSetup_CheckBox;
FReply OnCancel();
FReply OnNext();
FReply OnMore();
};
@@ -1,43 +0,0 @@
#pragma once
#include "RLTextureData.h"
#include "RLPhysicClothData.h"
#include "RLShaderData.h"
enum class ENodeType
{
None,
Hair,
Accessory
};
class RLMaterialData
{
public:
RLMaterialData() {}
~RLMaterialData() {}
void SetShaderData( TSharedPtr< RLShaderData > spShaderData ) { m_spShaderData = spShaderData; }
const RLShaderData* GetShaderData() const { return m_spShaderData ? m_spShaderData.Get() : nullptr; }
RLShaderData* GetShaderData() { return m_spShaderData ? m_spShaderData.Get() : nullptr; }
void SetScatter( TSharedPtr< RLScatter > spScatter ) { m_spScatter = spScatter; }
RLScatter* GetScatter() { return m_spScatter ? m_spScatter.Get() : nullptr; }
bool m_bIsPbr = false;
ENodeType m_eNodeType = ENodeType::None;
bool m_bTwoSide = false;
int m_iUvChannelIndex = 0;
TArray< float > m_kDiffuseColor = { 255.f, 255.f, 255.f };
TArray< float > m_kAmbientColor = { 50.f, 50.f, 50.f };
TArray< float > m_kSpecularColor = { 229.f, 229.f, 229.f };
float m_fOpacity = 1.f;
float m_fSelfIllumination = 0.f;
float m_fSpecular = 0.f;
float m_fGlossiness = 0.f;
TMap< FString, RLTextureData > m_kTextureDatas;
TSharedPtr< RLPhysicClothData > m_spPhysicClothData = nullptr;
private:
TSharedPtr< RLShaderData > m_spShaderData;
TSharedPtr< RLScatter > m_spScatter;
};
@@ -1,28 +0,0 @@
#pragma once
#include "CoreMinimal.h"
class RLPhysicClothData
{
public:
RLPhysicClothData() {}
~RLPhysicClothData() {}
bool m_bActivate = false;
bool m_bUseGlobalGravity = false;
FString m_strWeightMapPath = "";
float m_fMass = 0.f;
float m_fFriction = 0.f;
float m_fDamping = 0.f;
float m_fDrag = 0.f;
float m_fSolverFrequency = 0.f;
float m_fTetherLimit = 0.f;
float m_fElasticity = 0.f;
float m_fStretch = 0.f;
float m_fBending = 0.f;
TArray< float > m_kInertia = { 6.0, 6.0, 6.0 };
bool m_bSoftVsRigidCollision = false;
float m_fSoftVsRigidCollisionMargin = 0.f;
bool m_bSelfCollision = false;
float m_fSelfCollisionMargin = 0.f;
float m_fStiffnessFrequency = 0.f;
};
@@ -1,27 +0,0 @@
#pragma once
#include "CoreMinimal.h"
class RLPhysicsCollisionShapeData
{
public:
RLPhysicsCollisionShapeData() {}
~RLPhysicsCollisionShapeData() {}
FString m_strName = "";
bool m_bBoneActivate = false;
bool m_bIsCCStdBoneAxis = false;
FString m_strBoundType = "";
FString m_strBoundAxis = "";
float m_fMargin = 0.f;
float m_fFriction = 0.f;
float m_fElasticity = 0.f;
TArray< float > m_kWorldTranslate = { 0.0, 0.0, 0.0 };
TArray< float > m_kWorldRotation = { 0.0, 0.0, 0.0, 0.0 };
TArray< float > m_kWorldScale = { 0.0, 0.0, 0.0 };
TArray< float > m_kShapeLocalPosition = { 0.0, 0.0, 0.0 };
TArray< float > m_kExtent = { 0.0, 0.0, 0.0 };
float m_fRadius = 0.f;
float m_fCapsuleLength = 0.f;
};
@@ -1,160 +0,0 @@
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
#include "AssetRegistryModule.h"
#include "ObjectTools.h"
#include "PackageTools.h"
#include "CCImportUI.h"
#include "Editor/UnrealEd/Classes/Factories/FbxFactory.h"
#include "Editor/UnrealEd/Public/Editor.h"
#include "Runtime/Engine/Classes/Engine/Selection.h"
#include "Runtime/Engine/Classes/Materials/MaterialInstanceConstant.h"
#include "Runtime/Engine/Classes/Engine/SkeletalMesh.h"
#include "Runtime/JSon/Public/Dom/JsonObject.h"
#include "RLTextureData.h"
#include "RLMaterialData.h"
#include "RLPhysicCollisionShapeData.h"
#include "Runtime/Engine/Classes/Animation/Rig.h"
#include "Runtime/Launch/Resources/Version.h"
#include <functional>
class FToolBarBuilder;
class FMenuBuilder;
class UClothingAssetCommon;
class UClothLODDataBase;
class CMaterialType
{
public:
CMaterialType( FString strMaterialName, FString strBoneType = "" );
FString GetType() { return m_strMaterialType; }
float GetTilingValue() { return m_fTilingValue; }
private:
FString m_strMaterialType;
float m_fTilingValue = 0.0f;
};
enum class EShaderType
{
Teeth,
Scalp,
Eyelash,
Eye,
Tearline,
Occulsion,
Head,
Skin,
Hair,
GeneralSSS,
PBR,
TRA,
};
class FRLPluginModule : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
/** This function will be bound to Command. */
void PluginButtonClicked();
void AutoSetup( TArray<FAssetData>& kAssetDatas,
FString strShaderType,
TArray<FString>& kLODPathList,
bool bIsDragFbx );
bool CheckAutoSetupVersionPass( FString strJsonFilePath );
private:
void AddToolbarExtension( FToolBarBuilder& kBuilder );
void AddMenuExtension( FMenuBuilder& kBuilder );
void CheckWorldGridMaterial(FString &strFbxName, FString &rootGamePath, FString ccMaterialFolderGamePath, UStaticMesh *pMesh, bool isMaterialInstance);
bool CheckShaderTypeChange(FString &strfbxName, FString shaderType, USkeletalMesh *mesh, UMaterial* material, UMaterialInterface* MaterialInterface, RLMaterialData* pMaterialData, int slotID, FString &rootGamePath, bool isMaterialInstance, FString strBoneType );
void DeleteTextureFile( const FString& strDeleteFloderPath, const FString& strCheckFolderPath );
void ShowInfo( const FString& strMessage, const float& fExpireDuration );
FString GetBoneType( const FAssetData& kAssetData );
USkeleton* GetAssetSkeleton( const FAssetData& kAssetData );
bool CreateFolder( FString &path );
void CreateTexturesPathList( const FString &strRootGamePath, TArray <FString> &kTexturesPathList );
void RemoveInvalidTexture( TMap< FString, RLMaterialData >& kMaterialMap, const FString& strTexturePath, const FString& strFbmTexturePath, TArray< FString >& kTexturesPathList );
bool CheckTextureShouldImport( const FString& strFilePath, bool bPbr );
#if ENGINE_MAJOR_VERSION <= 4 && ENGINE_MINOR_VERSION == 24
bool RLPluginImportToLodInternal( USkeletalMesh* SourceMesh, int32 SourceLodIndex, int32 SourceSectionIndex, UClothingAssetCommon* DestAsset, UClothLODDataBase* DestLod, UClothLODDataBase* InParameterRemapSource );
#endif
FString GetMaterialPackagePath( const FString& strRootGamePath, const FString& strMaterialName, const FString& strFbxName, bool bIsMaterialInstance );
void ReplaceMaterial( UMaterialInterface* pMaterialInterface, const FString &strPackagePath, std::function< void( UMaterialInterface* ) > fnReplaceMaterial );
void DeleteUnrealMaterial( const FString &strSourceFolderPath, const FString &strTargetFolderPath, const FString &strFbxName, const FString &strRootGamePath, bool bIsMaterialInstance, std::function< void() > fnReplaceMeshMaterial );
void DeleteDefaultSkeletalMaterial( const FString &strSourceFolderPath, const FString &strTargetFolderPath, const FString &strFbxName, const FString &strRootGamePath, USkeletalMesh *pMesh, bool bIsMaterialInstance );
void DeleteDefaultStaticMaterial( const FString &strSourceFolderPath, const FString &strTargetFolderPath, const FString &strFbxName, const FString &strRootGamePath, UStaticMesh *pMesh, bool bIsMaterialInstance );
void MoveTextureFile( FString& strTargetFolderPath );
void findLODGroupMaterialJson(TMap< FString, RLMaterialData > &kMaterialMap, FString &strFbxName, FString &strRootGamePath, USkeletalMesh *kMesh, bool bIsMaterialInstance);
void findLODGroupMaterial(FString &rootGamePath, USkeletalMesh *mesh );
void SetOrmTextureSetting( UMaterialInstanceConstant* pMaterialInstance, const FString& strTexturePath, const bool bSkin = false );
void ProcessMaterialInstanceConstant( UMaterialInstanceConstant*& pMaterialInstance, UMaterial* pMaterial, UMaterialInterface* pMeshMaterialInterface, UMaterialInterface* pParentInterface, const FString& strCCMaterialFolderPath, std::function< void( UMaterialInstanceConstant* ) > fnMaterialSetting );
void AssignMaterialInstanceJson( UMaterialInstanceConstant*& pInstUMaterialInterface,
const FString& strMaterialName,
RLMaterialData* pMaterialData,
TArray <FString> & texturesPathList,
UMaterial* material,
UMaterialInterface* MaterialInterface,
FString texturesFilesGamePath,
FString texturesFilesGamePathFbm,
FString ccMaterialFolderGamePath,
const FString& strSubsurfaceProfilePath,
FString boneType,
FString shaderType );
void AssignGeneralSss( RLMaterialData* pMaterialData, TArray<FString> &kTexturesPathList, FString strTexturesFilesGamePathFbm, const FString& strMaterialName, FString texturesFilesGamePath, bool bIsHQSkin, const FString& strSubsurfaceProfilePath, FString strTexturePathToLoad, UMaterialInstanceConstant*& pInstUMaterialInterface, UMaterial* pMaterial, UMaterialInterface* pMaterialInterface, FString strCCMaterialFolderGamePath );
void PhysicIniPaser( FString iniPath );
FString GetTexturePath( RLMaterialData *pMaterialData, const FString& strKey, const FString& strTexturesFolderPath, const FString& strMaterialName );
void SetTextureParameter( RLMaterialData *pMaterialData, const FString& strKey, UMaterialInstanceConstant* pMaterialInstance );
void UpdateStaticParameter( UMaterialInstanceConstant* pMaterialInstance, const FString& strParameter, bool bEnable, bool bMarkChanged );
void SetMultiUvIndex( RLMaterialData *pMaterialData, UMaterialInstanceConstant* pMaterialInstance );
void SetBaseColor( RLMaterialData *pMaterialData, UMaterialInstanceConstant* pMaterialInstance, TArray<FString> kTexturesPathList, FString strTexturesFilesGamePathsFbm[2], FString strMaterialName );
void SetNormal( RLMaterialData *pMaterialData, UMaterialInstanceConstant* pMaterialInstance, TArray<FString> kTexturesPathList, FString strTexturesFilesGamePathsFbm[2], FString strMaterialName );
void SetSpecular( RLMaterialData *pMaterialData, UMaterialInstanceConstant* pMaterialInstance, TArray<FString> kTexturesPathList, FString strTexturesFilesGamePathsFbm[2], FString strMaterialName, bool bIsPBR );
void SetOpacity( RLMaterialData *pMaterialData, UMaterialInstanceConstant* pMaterialInstance, TArray<FString> kTexturesPathList, FString strTexturesFilesGamePathsFbm[2], FString strMaterialName );
void SetGlow( RLMaterialData *pMaterialData, UMaterialInstanceConstant* pMaterialInstance, TArray<FString> kTexturesPathList, FString strTexturesFilesGamePaths[2], FString strMaterialName );
void SetBlend( RLMaterialData *pMaterialData, UMaterialInstanceConstant* pMaterialInstance, TArray<FString> kTexturesPathList, FString kTexturesFilesGamePaths[2], FString strMaterialName );
void SetBlendToHairDepthMap( RLMaterialData *pMaterialData, UMaterialInstanceConstant* pMaterialInstance, TArray<FString> kTexturesPathList, FString kTexturesFilesGamePaths[2], FString strMaterialName );
void SetDisplacement( RLMaterialData* pMaterialData, UMaterialInstanceConstant* pMaterialInstance, TArray<FString> kTexturesPathList, FString strTexturesFilesGamePaths[2], FString strMaterialName );
void SetAO( RLMaterialData *pMaterialData, UMaterialInstanceConstant* pMaterialInstance, TArray<FString> kTexturesPathList, FString strTexturesFilesGamePaths[2], FString strMaterialName );
void SetRoughness( RLMaterialData *kMaterialData, UMaterialInstanceConstant* kMaterialInstance, TArray<FString> texturesPathList, FString texturesFilesGamePaths[2], FString materialName, bool isPBR );
void SetMetallic( RLMaterialData *kMaterialData, UMaterialInstanceConstant* kMaterialInstance, TArray<FString> texturesPathList, FString texturesFilesGamePaths[2], FString materialName, bool isPBR );
void CreateCollisionShape(FName strBoneName, FVector kBoundMin, FVector kBoundMax, FVector kScale, FVector kOffset, UBodySetup* pBodySetup, int nShapeType, int nBoundAxis);
void CreateCollisionShapeFromData( RLPhysicsCollisionShapeData* pCollisionShapeData, UBodySetup* pBodySetup, const FTransform* kBoneParentWorldTransform );
void CreateConstraint(FName strBoneName, int nBoneID, USkeletalMesh* pMesh, UPhysicsAsset* pPhysicsAsset);
static bool SetShaderTextureSrgbCompression( UTexture* pTexture, FString strName );
void SetShaderData( RLShaderData* pShaderData, UMaterialInstanceConstant* pMaterialInstance, const FString& strFolder );
void SetScatter( const RLScatter* pScatter, UMaterialInstanceConstant* pMaterialInstance, const FString& strMaterialName, FString strSubsurfaceProfilePath, EShaderType eShaderType );
void GetShaderRenameMap( FString strMaterialName, EShaderType eType, RLShaderData* pShaderData, ENodeType eNodeType, TMap< FString, FString >& kRenameMap );
void ParseJson( const FString& strJsonFilePath, FString& strGeneration, FString& strBoneType, bool& bSupportShaderSelect, TMap< FString, RLMaterialData >& kMaterialMap, TMap< FString, TArray<RLPhysicsCollisionShapeData> >& kCollisionShapeMap );
void ParseJsonShaderData( TSharedPtr< RLMaterialData > spMaterialData, TSharedPtr< FJsonObject > spJsonObject, FString strMaterialName, FString strBoneType );
void ParseJsonScatterData( TSharedPtr< RLMaterialData > spMaterialData, TSharedPtr< FJsonObject > spJsonObject );
void ParseJsonPhysicsData( TSharedPtr<FJsonObject> spPhysicsRoot, TMap< FString, RLMaterialData >& kMaterialMap, TMap< FString, TArray<RLPhysicsCollisionShapeData> >& kCollisionShapeMap, bool bIsCCStdBoneAxis );
void ConvertEyeMaterialName( FString& strMaterialName );
UObject* RLCreatePhysicsAsset( FName InAssetName, UObject* InParent, USkeletalMesh* SkelMesh );
FString GetMaterialTypeByName( FString strName );
EShaderType GetShaderType( RLMaterialData* pMaterialData, FString strMaterialName, FString strBoneType );
EShaderType GetPbrShaderType( const RLShaderData* pShaderData, FString strMaterialName, FString strBoneType );
void UpdateWorld( int32 BoneIndex, FTransform ParentWorld, USkeleton* pSkeleton, const TArray<FTransform>& kBoneTransform, TArray<FTransform>& kBoneWorld );
void CreatePhysicCollisionShape( UPhysicsAsset* pPhysicsAsset, USkeletalMesh* pMesh, USkeleton* pSkeleton, const TMap< FString, TArray<RLPhysicsCollisionShapeData> >& kCollisionShapeMap );
void CreatePhysicSoftCloth( UPhysicsAsset* pPhysicsAsset, USkeletalMesh* pMesh, TMap< FString, RLMaterialData >& kMaterialMap );
TSharedPtr< class FUICommandList > m_kPluginCommands;
static URig* m_pEngineHumanoidRig;
bool m_bIsMaterialInstance = true;
//FString const MATERIAL_FLODER_NAME = "RL_Materials";
};
@@ -1,26 +0,0 @@
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Framework/Commands/Commands.h"
#include "RLPluginStyle.h"
class FRLPluginCommands : public TCommands<FRLPluginCommands>
{
public:
FRLPluginCommands()
: TCommands<FRLPluginCommands>( TEXT( "RLPlugin" ),
NSLOCTEXT( "Contexts", "RLPlugin", "RLPlugin Plugin" ),
NAME_None,
FRLPluginStyle::GetStyleSetName() )
{
}
// TCommands<> interface
virtual void RegisterCommands() override;
public:
TSharedPtr< FUICommandInfo > PluginAction;
};
@@ -1,31 +0,0 @@
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Styling/SlateStyle.h"
class FRLPluginStyle
{
public:
static void Initialize();
static void Shutdown();
/** reloads textures used by slate renderer */
static void ReloadTextures();
/** @return The Slate style set for the Shooter game */
static const ISlateStyle& Get();
static FName GetStyleSetName();
private:
static TSharedRef< class FSlateStyleSet > Create();
private:
static TSharedPtr< class FSlateStyleSet > StyleInstance;
};
@@ -1,20 +0,0 @@
#pragma once
#include "CoreMinimal.h"
class RLTextureData
{
public:
RLTextureData() {}
~RLTextureData() {}
FString m_strTexturePath = "";
bool m_bShareImage = false;
float m_fStrength = 100.f;
TArray< float > m_kOffset = { 0.f, 0.f };
TArray< float > m_kTiling = { 1.f, 1.f };
float m_fTessellationLevel = 0.f;
float m_fTessellationMulitiplier = 0.f;
float m_fGrayScaleBaseValue = 0.f;
FString m_strDisplacementMapType = "";
FString m_strBlendMode = "Multiply";
};
@@ -1,85 +0,0 @@
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class RLPlugin : ModuleRules
{
public RLPlugin(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
bUsePrecompiled = true;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Projects",
"InputCore",
"UnrealEd",
"LevelEditor",
"CoreUObject",
"RenderCore",
"Engine",
"Slate",
"SlateCore",
"ContentBrowser",
"DesktopPlatform",
"MaterialEditor",
"ImageWrapper",
"EditorStyle",
"RawMesh",
"ClothingSystemEditorInterface",
"SkeletalMeshEditor",
"Json",
"JsonUtilities",
}
);
if( Target.Version.MajorVersion == 4 && Target.Version.MinorVersion <= 23 )
{
PrivateDependencyModuleNames.AddRange(
new string[]
{
"ClothingSystemRuntime"
} );
}
if( Target.Version.MajorVersion == 4 && Target.Version.MinorVersion >= 24 )
{
PrivateDependencyModuleNames.AddRange(
new string[]
{
"ClothingSystemEditor",
"ClothingSystemRuntimeCommon",
"SkeletalMeshUtilitiesCommon",
"ClothingSystemRuntimeInterface",
"ClothingSystemRuntimeNv"
} );
}
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
-15
View File
@@ -1,15 +0,0 @@
[FilterPlugin]
; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and
; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
;
; Examples:
; /README.txt
; /Extras/...
; /Binaries/ThirdParty/*.dll
/*.md
/*.pdf
/Config/...
/Images/...
-87
View File
@@ -1,87 +0,0 @@
{
"FileVersion": 3,
"Version": 10,
"VersionName": "2.3.3",
"FriendlyName": "NVIDIA DLSS",
"Description": "NVIDIA Deep Learning Super Sampling",
"Category": "Rendering",
"CreatedBy": "NVIDIA",
"CreatedByURL": "https://developer.nvidia.com/dlss",
"DocsURL": "",
"MarketplaceURL": "https://www.unrealengine.com/marketplace/en-US/product/nvidia-dlss",
"SupportURL": "mailto:DLSS-Support@nvidia.com",
"EngineVersion": "4.27.0",
"CanContainContent": true,
"Installed": true,
"Modules": [
{
"Name": "DLSSUtility",
"Type": "Runtime",
"LoadingPhase": "PostConfigInit",
"WhitelistPlatforms": [
"Win64"
]
},
{
"Name": "DLSS",
"Type": "Runtime",
"LoadingPhase": "PostEngineInit",
"WhitelistPlatforms": [
"Win64"
]
},
{
"Name": "DLSSBlueprint",
"Type": "Runtime",
"LoadingPhase": "PostConfigInit"
},
{
"Name": "NGXRHI",
"Type": "Runtime",
"LoadingPhase": "PostEngineInit",
"WhitelistPlatforms": [
"Win64"
]
},
{
"Name": "NGXD3D11RHI",
"Type": "Runtime",
"LoadingPhase": "PostEngineInit",
"WhitelistPlatforms": [
"Win64"
]
},
{
"Name": "NGXD3D12RHI",
"Type": "Runtime",
"LoadingPhase": "PostEngineInit",
"WhitelistPlatforms": [
"Win64"
]
},
{
"Name": "NGXVulkanRHIPreInit",
"Type": "Runtime",
"LoadingPhase": "PostConfigInit",
"WhitelistPlatforms": [
"Win64"
]
},
{
"Name": "NGXVulkanRHI",
"Type": "Runtime",
"LoadingPhase": "PostEngineInit",
"WhitelistPlatforms": [
"Win64"
]
},
{
"Name": "DLSSEditor",
"Type": "Editor",
"LoadingPhase": "PostEngineInit",
"WhitelistPlatforms": [
"Win64"
]
}
]
}
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

-439
View File
@@ -1,439 +0,0 @@
![NVIDIA Logo](Images/nv-logo.png)
NVIDIA Unreal Engine DLSS/DLAA Plugin
=====================================
The NVIDIA *DLSS/DLAA* plugin is part of a wider suite of related NVIDIA performance and image quality improving technologies and corresponding NVIDIA Unreal Engine plugins:
- NVIDIA *Deep Learning Supersampling (DLSS)* is used to provide the highest possible frame rates at maximum graphics settings. *DLSS* requires an NVIDIA RTX graphics card.
- NVIDIA *Deep Learning Anti-Aliasing (DLAA)* is used to improve image quality. *DLAA* requires an NVIDIA RTX graphics card.
- NVIDIA *Image Scaling (NIS)* provides best-in class upscaling and sharpening for non-RTX GPUs, both NVIDIA or 3rd party. Please refer to the NVIDIA *Image Scaling* Unreal Engine plugin for further details.
# Quickstart
Please refer to the relevant section in this document for additional details.
1. Enable the *DLSS* plugin in the Editor, then restart the editor
2. DLSS in the Editor: enable the following settings in the Project Plugin settings
1. Enable DLSS to be turned on in Editor viewports (it should be set by default)
2. In the Viewport Options (downwards pointing arrow in the top left corner), use the DLSS Settings menu to toggle the different DLSS quality modes
3. DLSS/DLAA in [Blueprint](#dlss-blueprints):
The `SetDLSSMode` and `EnableDLAA` functions of the DLSS blueprint library provide convenient functions for setting those console variables and are recommended to be used when integrating support into a project's user interface and settings.
4. DLSS in Game: make sure that the following [console variables](#command-line-options-and-console-variables-and-commands) are set to enable DLSS:
1. r.NGX.Enable 1 (can be overriden on the command line with -ngxenable)
2. r.NGX.DLSS.Enable 1
3. r.NGX.DLSS.Quality -1
4. r.NGX.DLSS.Quality.Auto false
5. r.NGX.DLAA.Enable 0
5. DLAA in Game: make sure that the following [console variables](#command-line-options-and-console-variables-and-commands) are set to enable DLAA
1. r.NGX.Enable 1 (can be overriden on the command line with -ngxenable)
2. r.NGX.DLAA.Enable 1
6. Check the log for `LogDLSS: NVIDIA NGX DLSS supported 1`
7. (Optionally) Enable the DLSS on screen indicator in the bottom left of the screen via `\DLSS\Source\ThirdParty\NGX\Utils\ngx_driver_onscreenindicator.reg` to verify that DLSS is active
# Troubleshooting
## System requirements
- Windows 10, 64 bit
- at least version v1709, Windows 10 Fall 2017 Creators Update 64-bit.
- NVIDIA Geforce Driver
- Recommended: version 461.40 or higher
- Required: version 445.00 or higher
- NVIDIA RTX GPU (GeForce, Titan or Quadro) with [DLSS](https://www.nvidia.com/en-us/geforce/technologies/dlss/) support
- UE project using either
- Vulkan
- DX11
- DX12
## Diagnosing DLSS Issues in the Editor
The DLSS plugin shows various common reasons why DLSS might not be working at the top of the screen (in non-Shipping build configurations). This message can also be turned off in the DLSS plugin settings, as discussed in the "DLSS Plugin Settings" section in this document.
![DLSS Editor Developer messages](Images/DLSSDeveloperMessages.png)
Additionally, the DLSS plugin modules write various information into the following UE log categories:
* LogDLSS
* LogDLSSEditor
* LogDLSSBlueprint
* LogDLSSNGXRHI
* LogDLSSNGXD3D11RHI
* LogDLSSNGXD3D12RHI
* LogDLSSNGXVulkanRHIPreInit
* LogDLSSNGXVulkanRHI
* LogDLSSNGX
Those can be accessed in the Editor under `Window -> Developer Tools -> Message Log`
![DLSS Editor Output log menu](Images/DLSSOutputLogMenu.png)
The Message log then can be filtered to show only the DLSS related messages to get more information on why DLSS might not be functioning as expected, as shown in those examples.
![DLSS Editor Output log disabled](Images/DLSSOutputLogNotWorking.png)
![DLSS Editor Output log driver out of date](Images/DLSSOutputLogNotWorkingDriverOutOfDate.png)
## Incompatibilities with API Capture Tools such as RenderDoc
The Editor will show a warning at startup if DLSS incompatible API capture tools (such as RenderDoc) or plugins are used. To enable DLSS, please use an API capture tool such as [NVIDIA NSIGHT Graphics](https://developer.nvidia.com/nsight-graphics), which support the NGX APIs required by DLSS.
![DLSS Editor incompatible tools and plugins](Images/DLSSIncompatibleCaptureToolsPlugins.png)
## Incompatibilities with Screenpercentage override in Post Procssing Volumes
When DLSS is active, the DLSS quality mode determines the effective screen percentage. As such screen percentage overrides specified in postprocessing volumes are ignored. This can lead to unexpected performance behavior when DLSS is turned on, compared to when DLSS is turned off.
## Incompatibilities with Depth of Field
As DLSS workload occurs in the same spot as TAAU in the pipeline, visual differences in DoF are expected.
To minimize the differences, it is recommended to use DLSS in 'Quality' or 'Ultra Quality' modes.
It is possible to tweak the DoF settings in the camera actor to compensate for the differences.
Please keep in mind this is content dependent. Thus for some scenes the differences can be minimal and avoided while in other cases it might be more challenging.
## Verify Engine side plugin hooks
The following cvars should be set to those values by default:
- r.DefaultFeature.Antialiasing 2
- r.TemporalAA.Upscaler 1
- r.Reflections.Denoiser 2
## Enabling NGX DLSS Logging on End User machines
The DLSS plugin also pipes the NGX DLSS logs into the UE logging system into the `LogDLSSNGX` log category. It is enabled by default and can be tweaked with the `r.NGX.LogLevel` console variable, or set with the -NGXLogLevel=X command line option.
This requires an NVIDIA GeForce **driver version 461.36** or later.
## Enabling NGX DLSS Logging during Development
If r.NGX.EnableOtherLoggingSinks is set then additional NGX logging of the NVIDIA NGX software stack to files can be used as well, as discussed in the "NGX logging" chapter of the [DLSS Programming Guide](DLSS_Programming_Guide_Release.pdf) for details. The -NGXLogFileEnable and -NGXLogFileDisable command line options can also override the default setting.
The DLSS SDK provides registry keys which can be set with the following .reg files which can be found in the plugin folder under `\DLSS\Source\ThirdParty\NGX\Utils\`:
* `ngx_log_on.reg`
* `ngx_log_off.reg`
* `ngx_log_verbose.reg`
The DLSS plugin will write those into subfolder under `$(ProjectDir)\Saved\Logs\` with a `NGX_$(TimeStamp)_$(GUID)` pattern
* `nvngx.log`
* `nvngx_dlss_2_1_34.log`
* `nvsdk_ngx.log`
## DLSS On-Screen Indicator
The DLSS SDK provides registry keys which can be set with the following .reg files which can be found in the plugin folder under `\DLSS\Source\ThirdParty\NGX\Utils\`:
* `ngx_driver_onscreenindicator.reg`
* `ngx_driver_off_screenindicator.reg`
With the first registry key set, DLSS will display an indicator on-screen when it is enabled, enabling easier troubleshooting. The second registry key can be used to disable this indicator again.
Please see the [DLSS Programming Guide](DLSS_Programming_Guide_Release.pdf) for further details.
# Command Line Options And Console Variables and Commands
## Enabling DLSS (Engine Side)
The DLSS plugin uses various engine side hooks, which can be configured by the following cvars. Their default values
- r.DefaultFeature.Antialiasing (2, default)
- Enable Temporal Anti-Aliasing
- r.TemporalAA.Upscaler (1, default)
- Enable a custom TAAU upscaling plugin, such as the DLSS plugin
- r.Reflections.Denoiser (2, default)
- Enable a custom denoising plugin. The DLSS plugin makes use of this to improve image quality for raytraced reflections by adding additionial TAA passes
## Enabling Motion vectors for DLSS
DLSS requires correct motion vectors to function properly. The following console variable can be used to render motion vectors for all objects, and not just the ones with dynamic geometry. This can be useful if it's infeasible to e.g. change all meshes to stationary or dynamic.
- r.BasePassForceOutputsVelocity (0, default)
- Force the base pass to compute motion vector, regardless of FPrimitiveUniformShaderParameters.
- 0: Disabled
- 1: Enabled
## Enabling DLSS/DLAA (Plugin Side)
- r.NGX.Enable (1, default) can also be overriden on the command line with **-ngxenable** and **-ngxdisable**
- Whether the NGX library should be loaded. This allow to have the DLSS plugin enabled but avoiding potential incompatibilities by skipping the driver side NGX parts of DLSS.
- r.NGX.DLSS.Enable (1, default)
- Enable/Disable DLSS entirely.
- r.NGX.DLSS.Quality (-1, default)
- DLSS Performance/Quality setting. **Note:** Not all modes might be supported at runtime, in this case Balanced mode is used
- -2: Ultra Performance
- -1: Performance (default)
- 0: Balanced
- 1: Quality
- 2: Ultra Quality
- r.NGX.DLSS.Quality.Auto (false, default)
- Whether the DLSS quality mode should be chosen dynamically based on viewport size. Overrides r.NGX.DLSS.Quality
- r.NGX.DLAA.Enable (false, default)
- Enable/Disable DLAA. DLSS will be disabled while DLAA is enabled
**Blueprint** functions:
- `SetDLSSMode`, `GetDLSSMode`
- `IsDLSSSupported`, `QueryDLSSSupport`, `GetDLSSMinimumDriverVersion`, `GetDefaultDLSSMode`
- `IsDLSSModeSupported`, `GetSupportedDLSSModes`,`GetDLSSModeInformation`, `GetDLSSScreenPercentageRange`
- `EnableDLAA`, `IsDLAAEnabled`
## DLSS Runtime Image Quality Tweaks
- r.NGX.DLSS.DilateMotionVectors (1, default)
- 0: pass low resolution motion vectors into DLSS
- 1: pass dilated high resolution motion vectors into DLSS. This can help with improving image quality of thin details.
- r.NGX.DLSS.Reflections.TemporalAA (1, default)
- Apply a temporal AA pass on the denoised reflections
- r.NGX.DLSS.WaterReflections.TemporalAA (1, default)
- Apply a temporal AA pass on the denoised water reflections
- r.NGX.DLSS.Sharpness (0.0f off, default)
- -1.0 to 1.0: Softening/sharpening to apply to the DLSS pass. Negative values soften the image, positive values sharpen.
- r.NGX.DLSS.EnableAutoExposure
- 0: Use the engine-computed exposure value for input images to DLSS
- 1: Enable DLSS internal auto-exposure instead of the application provided one - enabling this can alleviate effects such as ghosting in darker scenes (default)
- r.NGX.DLSS.PreferNISSharpen (2,default)
- Prefer sharpening with an extra NIS plugin sharpening pass instead of DLSS sharpening if the NIS plugin is also enabled for the project.
- Requires UE4.27.1 and the NIS plugin to be enabled, DLSS sharpening will be used otherwise.
- 0: Softening/sharpening with the DLSS pass.
- 1: Sharpen with the NIS plugin. Softening is not supported. Requires the NIS plugin to be enabled.
- 2: Sharpen with the NIS plugin. Softening (i.e. negative sharpness) with the DLSS plugin . Requires the NIS plugin to be enabled.
**Note** This cvar is only evaluated when using the `SetDLSSSharpness` Blueprint function, from either C++ or a Blueprint event graph!
**Blueprint** functions:
- `SetDLSSSharpness`, `GetDLSSSharpness`
## DLSS Binaries
- r.NGX.BinarySearchOrder (0, default)
- 0: automatic
- use custom binaries from project and launch folder $(ProjectDir)/Binaries/ThirdParty/NVIDIA/NGX/$(Platform) if present
- fallback to generic binaries from plugin folder
- 1: force generic binaries from plugin folder, fail if not found
- 2: force custom binaries from project or launch folder, fail if not found
- 3: force generic development binaries from plugin folder, fail if not found. This is only supported in non-shipping build configurations
## DLSS memory usage
- `stat DLSS`
- shows how much GPU memory DLSS uses and how many DLSS features, i.e. instances of DLSS are allocated.
- In steady state there should be 1 DLSS feature allocated per view. This value can increase temporarily, typically after changing the DLSS quality mode or resizing the window. This can be configured with the `r.NGX.FramesUntilFeatureDestruction` console variable
## NGX Project ID
The DLSS plugin by default uses the project identifier to initialize NGX and DLSS. On rare occasion, NVIDIA might provide a special NVIDIA NGX application ID. The following console variable determines which one is used.
r.NGX.ProjectIdentifier (0, default)
- 0: automatic:
- use NVIDIA NGX Application ID if non-zero, otherwise use UE Project ID
- 1: force UE Project ID
- 2: force NVIDIA NGX Application ID (set via the Project Settings -> NVIDIA DLSS plugin)
Please refer to the "Distributing DLSS" section for further details.
## Multi GPU Support (Experimental)
The DLSS plugin supports multiple GPUs in certain circumstances, as shown in the following table.
There AFR stands for Alternate-Frame-Rendering, i.e. SLI or CrossFire, and SFR stands for Split-Frame-Rendering, which is what the nDisplay plugin uses.
| RHI | AFR | SFR|
| --- | --- | --- |
| D3D12RHI | no | conditionally|
| D3D11RHI| yes| no|
| VulkanRHI| no | no|
Notes:
- D3D12RHI
- AFR is not supported
- Primarily due to higher level renderer code not maintaining TAA (and thus DLSS) history across non-consecutive frames on the same GPU
- SFR is conditionally supported
- Support requires a custom nDisplay plugin to enable calling into the DLSS plugin
- Please refer to the [NvRTX](https://github.com/NvRTX/UnrealEngine) GitHub repository
- GPUs are expected to be in Linked Display Adapter (LDA) mode
- **This will not work with unmodified engine distributions, such as those from the Epic Games Launcher**
- D3D11RHI
- AFR is supported via driver based, automatic SLI support
- VulkanRHI
- The VulkanRHI (as of UE 4.27) does not implement explicit MGPU, and thus neither AFR nor SFR are available
The following console variables can be used to adjust how DLSS interacts with the GPU nodes
- r.NGX.DLSS.FeatureCreationNode (-1, default)
- Determines which GPU the DLSS feature is getting created on
- -1: Create on the GPU the command list is getting executed on
- 0: Create on GPU node 0
- 1: Create on GPU node 1
- r.NGX.DLSS.FeatureVisibilityMask (-1, default)
- Determines which GPU the DLSS feature is visible to
- -1: Visible to the GPU the command list is getting executed on
- 1: visible to GPU node 0
- 2: visible to GPU node 1
- 3: visible to GPU node 0 and GPU node 1
## Miscellaneous
- r.NGX.DLSS.AutomationTesting (0, default)
- Whether the NGX library should be loaded when GIsAutomationTesting is true.(default is false)
- Must be set to true before startup. This can be enabled for cases where running automation testing with DLSS is desired
- r.NGX.Automation.Enable (0, default)
- Enable automation for NGX DLSS image quality and performance evaluation.
- r.NGX.Automation.ViewIndex (0, default)
- Select which view to use with NGX DLSS image quality and performance automation.
- r.NGX.Automation.NonGameViews (0,default)
- Enable non-game views for NGX DLSS image quality and performance automation.
- r.NGX.FramesUntilFeatureDestruction (3, default)
- Number of frames until an unused NGX feature gets destroyed
- r.NGX.DLSS.MinimumWindowsBuildVersion (16299, default for v1709)
- Sets the minimum Windows 10 build version required to enable DLSS
- r.NGX.LogLevel (1, default)
- Determines the minimal amount of logging the NGX implementation. Please refer to the DLSS plugin documentation on other ways to change the logging level.
- 0: off
- 1: on
- 2: verbose
- r.NGX.EnableOtherLoggingSinks (0, default)
- Determines whether the NGX implementation will turn on additional log sinks LogDLSSNGXRHI
- 0: off
- 1: on
- r.NGX.RenameNGXLogSeverities (1, default)
- Renames 'error' and 'warning' in messages returned by the NGX log callback to 'e_rror' and 'w_arning' before passing them to the UE log system
- 0: off
- 1: on, for select messages during initalization
- 2: on, for all messages
- r.NGX.DLSS.ReleaseMemoryOnDelete (1, default)
- Enable/disable releasing DLSS related memory on the NGX side when DLSS features get released
# DLSS and the NIS NVIDIA Image Scaling plugin (UE 4.27.1+)
The *DLSS* plugin and NVIDIA Image Scaling (*NIS*) plugins can be enabled together for the same project. Please see the `RTX UI Developer Guidelines` document for suggested UI implementations.
When both the *DLSS* and *NIS* plugins are enabled for a project, NIS will be used instead of DLSS sharpening. See `r.NGX.DLSS.PreferNISSharpen` for details.
# DLSS in the Editor
## Enabling DLSS for a project
![DLSS Plugin](Images/DLSSPlugin.png)
## Enabling DLSS in Level Editor Viewports
With "Enable DLSS to be turned on in Editor viewports" set in the project plugin settings, (on by default), the DLSS mode can be turned on in level editor viewports like this. Each viewport can have a different DLSS mode.
![DLSS Viewport On](Images/DLSSViewportSettingsDLSSOn.png)
## DLSS Plugin Settings
Some of the "Level Editor - Viewport" settings are split across two config files and settings pages to tailor how DLSS is interacting with the editor user experience.
For example, a cross-platform game project might find it more practical by default to only have DLSS enabled in "Play In Editor Viewports" or in "game mode" in order to maintain a consistent content authoring experience across the range of supported platforms.
However projects (e.g. an architecture visualization project with notable raytracing workloads), might find it more useful to have DLSS enabled during the content authoring. Either way each user can override those settings locally:
- `Project Settings -> Plugins -> NVIDIA DLSS`
- stored in DefaultEngine.ini
- typically resides in source control.
- settings here are shared between users
- `Project Settings -> Plugins -> NVIDIA DLSS (Local)`
- stored UserEngine.ini
- not recommended to be checked into source control.
- allow a user to override project wide settings if desired. Defaults to "use project settings"
![DLSS plugin project settings](Images/DLSSPluginProjectSettings.png)
![DLSS plugin local project settings](Images/DLSSPluginProjectSettingsLocal.png)
## DLSS Blueprints
The UDLSSLibrary blueprint library provides functionality to query whether DLSS and which modes are supported. It also provides convenient functions to enable the underlying DLSS console variables. The tooltips of each function provide additional information.
Using the UDLSSLibrary via blueprint or C++ (by including the DLSSBlueprint module in a game project) is recommended over setting the console variables directly. This will make sure that any future updates will be picked up by simply updating the DLSS plugin, without having to update the game logic.
![DLSS Blueprint library](Images/DLSSBlueprintLibrary.png)
## DLSS Movie Render Queue Support (UE 4.27)
Starting with UE4.27 DLSS supports the DLSS when rendering movies with the Movie Render Queue plugin.
0. Enable the *Movie Render Queue* and *DLSS* plugins in the Editor
1. Enable the *Movie Render Queue DLSS Support* plugin in the Editor, then restart the editor
2. In the configuration, add the `Settings -> DLSS` page
3. In the DLSS settings page, change the desired DLSS quality mode
1. Note: Unsupported DLSS modes will show a warning at the bottom of the window
4. Optional: The `Settings -> Output -> File Name Format` page supports a `{dlss_quality}` format tag
**Note:** Only the *Deferred Rendering* render pass is supported with DLSS, all other passes use the built-in TAA
![DLSS Movie Scene Support Plugin](Images/DLSSMoviePipelineSupportPlugin.png)
![DLSS Movie Scene Support DLSS Setting](Images/DLSSMoviePipelineSupportDLSSetting.png)
![DLSS Movie Scene Support DLSS Setting Options](Images/DLSSMoviePipelineSupportDLSSOptions.png)
![DLSS Movie Scene Support DLSS Setting Options](Images/DLSSMoviePipelineSupportDLSSFormatFlags.png)
## DLSS nDisplay support (NVRTX only)
**Unmodified engine distributions, such as those from the Epic Games Launcher do not support DLSS with the nDisplay plugin.**
The [NvRTX](https://github.com/NvRTX/UnrealEngine) GitHub repository hosts a modified version of the nDisplay plugin that has those changes to the nDisplay plugin:
At the top of `\Engine\Plugins\Runtime\nDisplay\Source\DisplayCluster\Private\Game\EngineClasses\Basics\DisplayClusterViewportClient.cpp`, right after the existing header includes around line 50, add this block:
```
#include "CustomStaticScreenPercentage.h"
static TAutoConsoleVariable<int32> CVarAllowTemporalUpsampling(
TEXT("nDisplay.render.TemporalUpsampling"),
1,
TEXT("Allow custom upscaler plugins when rendering with nDisplay"),
ECVF_Default
);
```
And in `UDisplayClusterViewportClient::Draw`, around line 510, add this before the block that checks whether the view family has a screenpercentage interface set or not:
```
if (CVarAllowTemporalUpsampling.GetValueOnGameThread() && GCustomStaticScreenPercentage && ViewFamily.ViewMode == EViewModeIndex::VMI_Lit)
{
GCustomStaticScreenPercentage->SetupMainGameViewFamily(ViewFamily);
// Regular GameViewport set the primary screenpercentage mode elsewhere
if (ViewFamily.GetTemporalUpscalerInterface())
{
for (FSceneView* View : Views)
{
View->PrimaryScreenPercentageMethod = EPrimaryScreenPercentageMethod::TemporalUpscale;
}
}
}
```
The `nDisplay.render.TemporalUpsampling` console variable then can be used to enable/disable calling into the DLSS plugin.
The usual DLSS blueprint functionality can then be used to configure DLSS.
# Distributing DLSS
The DLSS plugin ships with a ready-to-use production DLSS binary (without watermarks) and uses the project identifier to initialize NGX and DLSS. This is the common case for distribution to end users and does not require further actions from either your or NVIDIA's side.
On rare occasion NVIDIA however might provide:
1. a custom project specific DLSS binary
2. an NVIDIA application ID
In that case those can be configured in the advanced plugin settings. Additionally please also ensure that the r.NGX.ProjectIdentifier console variable is set to either 0 (the default) or 2.
The project plugin settings can be used to configure those (please see above).
1. The custom, project specific DLSS binary `nvngx_dlss.dll` should be put into the project under `$(ProjectDir)/Binaries/ThirdParty/NVIDIA/NGX/$(Platform)`
2. Setting the NVIDIA NGX application ID for the project.
![DLSS Plugin Project Settings](Images/DLSSPluginProjectSettings.png)
Please refer to "Chapter 4 Distributing DLSS in a Game" in the the [DLSS Programming Guide](DLSS_Programming_Guide_Release.pdf) for details.
# DLSS API and UI Documentation
The [DLSS Programming Guide](DLSS_Programming_Guide_Release.pdf) provides details about the NVIDIA NGX APIs which are used by the plugin to implement DLSS.
The [RTX UI Developer Guidelines](RTX UI Developer Guidelines.pdf) ([Chinese](RTX UI Developer Guidelines Chinese Version.pdf)) provides details about recommended game settings and UI for DLSS.
The NVIDIA Developer Blog [Tips: Getting the Most out of the DLSS Unreal Engine 4 Plugin](https://developer.nvidia.com/blog/tips-getting-the-most-out-of-the-dlss-unreal-engine-4-plugin/) provides best practices along with other tips and tricks to use NVIDIA DLSS in Unreal Engine games and applications.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

@@ -1,199 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include "/Engine/Private/Common.ush"
#include "/Engine/Private/FastMath.ush"
#include "/Engine/Private/ScreenPass.ush"
#ifndef THREADGROUP_SIZEX
#define THREADGROUP_SIZEX 8
#endif
#ifndef THREADGROUP_SIZEY
#define THREADGROUP_SIZEY 8
#endif
#define THREADGROUP_TOTALSIZE (THREADGROUP_SIZEX * THREADGROUP_SIZEY)
#ifndef DILATE_MOTION_VECTORS
#define DILATE_MOTION_VECTORS 0
#endif
#if DILATE_MOTION_VECTORS
#define AA_CROSS 1
float2 TemporalJitterPixels;
#else
#endif
Texture2D VelocityTexture;
SamplerState VelocityTextureSampler;
SCREEN_PASS_TEXTURE_VIEWPORT(Velocity)
Texture2D DepthTexture;
SamplerState DepthTextureSampler;
RWTexture2D<float2> OutVelocityCombinedTexture;
SCREEN_PASS_TEXTURE_VIEWPORT(CombinedVelocity)
[numthreads(THREADGROUP_SIZEX, THREADGROUP_SIZEY, 1)]
void VelocityCombineMain(
uint2 GroupId : SV_GroupID,
uint2 DispatchThreadId : SV_DispatchThreadID,
uint2 GroupThreadId : SV_GroupThreadID,
uint GroupIndex : SV_GroupIndex)
{
uint2 PixelPos = min(DispatchThreadId + Velocity_ViewportMin, Velocity_ViewportMax - 1);
// CombinedVelocity_ViewportMin is expected to be 0, but in case it is not
uint2 OutputPixelPos = CombinedVelocity_ViewportMin + DispatchThreadId;
const bool bInsideViewport = all(PixelPos.xy < Velocity_ViewportMax);
BRANCH
if (!bInsideViewport)
return;
#if DILATE_MOTION_VECTORS // TODO: 2x2.
// Screen position of minimum depth.
float2 VelocityOffset = float2(0.0, 0.0);
float2 NearestBufferUV = (PixelPos + 0.5f) * Velocity_ViewportSizeInverse;
//float2 ViewportUV = NearestBufferUV;
float2 ViewportUV = (float2(DispatchThreadId) + 0.5f) * CombinedVelocity_ViewportSizeInverse;
// Pixel coordinate of the center of output pixel O in the input viewport.
float2 PPCo = ViewportUV * Velocity_ViewportSize + TemporalJitterPixels;
// Pixel coordinate of the center of the nearest input pixel K.
float2 PPCk = floor(PPCo) + 0.5;
// Pixel coordinate of the center of the nearest top left input pixel T.
float2 PPCt = floor(PPCo - 0.5) + 0.5;
NearestBufferUV = Velocity_ExtentInverse * (Velocity_ViewportMin + PPCk);
// FIND MOTION OF PIXEL AND NEAREST IN NEIGHBORHOOD
// ------------------------------------------------
float3 PosN; // Position of this pixel, possibly later nearest pixel in neighborhood.
PosN.xy = ViewportUVToScreenPos(ViewportUV);
PosN.z = DepthTexture.SampleLevel(DepthTextureSampler, NearestBufferUV, 0).x;
{
// For motion vector, use camera/dynamic motion from min depth pixel in pattern around pixel.
// This enables better quality outline on foreground against different motion background.
// Larger 2 pixel distance "x" works best (because AA dilates surface).
float4 Depths;
Depths.x = DepthTexture.SampleLevel(DepthTextureSampler, NearestBufferUV, 0, int2(-AA_CROSS, -AA_CROSS)).x;
Depths.y = DepthTexture.SampleLevel(DepthTextureSampler, NearestBufferUV, 0, int2(AA_CROSS, -AA_CROSS)).x;
Depths.z = DepthTexture.SampleLevel(DepthTextureSampler, NearestBufferUV, 0, int2(-AA_CROSS, AA_CROSS)).x;
Depths.w = DepthTexture.SampleLevel(DepthTextureSampler, NearestBufferUV, 0, int2(AA_CROSS, AA_CROSS)).x;
float2 DepthOffset = float2(AA_CROSS, AA_CROSS);
float DepthOffsetXx = float(AA_CROSS);
#if HAS_INVERTED_Z_BUFFER
// Nearest depth is the largest depth (depth surface 0=far, 1=near).
if (Depths.x > Depths.y)
{
DepthOffsetXx = -AA_CROSS;
}
if (Depths.z > Depths.w)
{
DepthOffset.x = -AA_CROSS;
}
float DepthsXY = max(Depths.x, Depths.y);
float DepthsZW = max(Depths.z, Depths.w);
if (DepthsXY > DepthsZW)
{
DepthOffset.y = -AA_CROSS;
DepthOffset.x = DepthOffsetXx;
}
float DepthsXYZW = max(DepthsXY, DepthsZW);
if (DepthsXYZW > PosN.z)
{
// This is offset for reading from velocity texture.
// This supports half or fractional resolution velocity textures.
// With the assumption that UV position scales between velocity and color.
VelocityOffset = DepthOffset * Velocity_ExtentInverse;
// This is [0 to 1] flipped in Y.
//PosN.xy = ScreenPos + DepthOffset * ViewportSize.zw * 2.0;
PosN.z = DepthsXYZW;
}
#else // !HAS_INVERTED_Z_BUFFER
#error Fix me!
#endif // !HAS_INVERTED_Z_BUFFER
}
// Camera motion for pixel or nearest pixel (in ScreenPos space).
bool OffScreen = false;
float Velocity = 0;
float HistoryBlur = 0;
float4 ThisClip = float4(PosN.xy, PosN.z, 1);
float4 PrevClip = mul(ThisClip, View.ClipToPrevClip);
float2 PrevScreen = PrevClip.xy / PrevClip.w;
float2 BackN = PosN.xy - PrevScreen;
float2 BackTemp = BackN * Velocity_ViewportSize;
float4 VelocityN = VelocityTexture.SampleLevel(VelocityTextureSampler, NearestBufferUV + VelocityOffset, 0);
bool DynamicN = VelocityN.x > 0.0;
if (DynamicN)
{
BackN = DecodeVelocityFromTexture(VelocityN).xy;
}
BackTemp = BackN * CombinedVelocity_ViewportSize;
OutVelocityCombinedTexture[OutputPixelPos].xy = -BackTemp * float2(0.5, -0.5);
#else
float4 EncodedVelocity = VelocityTexture[PixelPos];
float Depth = DepthTexture[PixelPos].x;
float2 Velocity;
if (all(EncodedVelocity.xy > 0))
{
Velocity = DecodeVelocityFromTexture(EncodedVelocity).xy;
}
else
{
float4 ClipPos;
ClipPos.xy = SvPositionToScreenPosition(float4(PixelPos.xy, 0, 1)).xy;
ClipPos.z = Depth;
ClipPos.w = 1;
float4 PrevClipPos = mul(ClipPos, View.ClipToPrevClip);
if (PrevClipPos.w > 0)
{
float2 PrevScreen = PrevClipPos.xy / PrevClipPos.w;
Velocity = ClipPos.xy - PrevScreen.xy;
}
else
{
Velocity = EncodedVelocity.xy;
}
}
float2 OutVelocity = Velocity * float2(0.5, -0.5) * View.ViewSizeAndInvSize.xy;
OutVelocityCombinedTexture[OutputPixelPos].xy = -OutVelocity;
#endif
}
-103
View File
@@ -1,103 +0,0 @@
/*
* Copyright (c) 2020 - 2022 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
using UnrealBuildTool;
public class DLSS : ModuleRules
{
public virtual string [] SupportedDynamicallyLoadedNGXRHIModules(ReadOnlyTargetRules Target)
{
if(Target.Platform == UnrealTargetPlatform.Win64 )
{
return new string[]
{
"NGXD3D11RHI",
"NGXD3D12RHI",
"NGXVulkanRHI"
};
}
return new string[] { "" };
}
public DLSS(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
EngineDirectory + "/Source/Runtime/Renderer/Private",
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"EngineSettings",
"Engine",
"RenderCore",
"Renderer",
"RHI",
"NGX",
"Projects",
"DeveloperSettings",
"DLSSUtility",
"NGXRHI",
// ... add private dependencies that you statically link with here ...
}
);
if (ReadOnlyBuildVersion.Current.MajorVersion == 5)
{
PrivateDependencyModuleNames.Add("RHICore");
}
DynamicallyLoadedModuleNames.AddRange(SupportedDynamicallyLoadedNGXRHIModules(Target));
// We can't quite check whether we have CL 16848904 (in UE5-Main) so we do this in a round about way
bool bSupportsPostProcessingScreenPercentage = (Target.Version.MajorVersion == 4) ||
((Target.Version.MajorVersion == 5) && (Target.Version.BranchName == "++UE5+Release-5.0-EarlyAccess"))
;
PrivateDefinitions.Add(string.Format("SUPPORTS_POSTPROCESSING_SCREEN_PERCENTAGE={0}", bSupportsPostProcessingScreenPercentage ? "1" : "0"));
// this is a public definition so the DLSSMoviePipelineSupport modules (if compiled against that branch) see it
bool bSupportsCustomStaticScreenpercentageSetupViewFamily = ((Target.Version.MajorVersion == 4) && (Target.Version.MinorVersion >= 27)) || ((Target.Version.MajorVersion == 5) && (Target.Version.BranchName != "++UE5+Release-5.0-EarlyAccess"));
PublicDefinitions.Add(string.Format("DLSS_ENGINE_SUPPORTS_CSSPD={0}", bSupportsCustomStaticScreenpercentageSetupViewFamily ? "1" : "0"));
// We can't quite check whether we have CL 16758229 so we do this in a round about way
bool bEngineHasAAM_TSR = (Target.Version.MajorVersion == 5) && (Target.Version.BranchName != "++UE5+Release-5.0-EarlyAccess");
PrivateDefinitions.Add(string.Format("DLSS_ENGINE_HAS_AAM_TSR={0}", bEngineHasAAM_TSR ? "1" : "0"));
// 4.x and early access 5.0 engines had GTemporalUpscaler interface
bool bEngineHasGTemporalUpscaler = (Target.Version.MajorVersion == 4) || (Target.Version.BranchName == "++UE5+Release-5.0-EarlyAccess");
PrivateDefinitions.Add(string.Format("DLSS_ENGINE_HAS_GTEMPORALUPSCALER={0}", bEngineHasGTemporalUpscaler ? "1" : "0"));
// 4.x and early access 5.0 engines, ITemporalUpscaler::AddPasses returns values through pointers passed into the function
bool bEngineAddPassesReturnThroughParams = (Target.Version.MajorVersion == 4) || (Target.Version.BranchName == "++UE5+Release-5.0-EarlyAccess");
PublicDefinitions.Add(string.Format("DLSS_ENGINE_ADDPASSES_RETURN_THROUGH_PARAMS={0}", bEngineAddPassesReturnThroughParams ? "1" : "0"));
}
}
-527
View File
@@ -1,527 +0,0 @@
/*
* Copyright (c) 2020 - 2022 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
#include "DLSS.h"
#include "CoreMinimal.h"
#include "DLSSUpscalerPrivate.h"
#include "DLSSUpscaler.h"
#include "DLSSDenoiser.h"
#include "NGXRHI.h"
#include "Modules/ModuleManager.h"
#include "Interfaces/IPluginManager.h"
#include "GeneralProjectSettings.h"
#include "DLSSSettings.h"
#include "SceneViewExtension.h"
#include "SceneView.h"
#include "Misc/MessageDialog.h"
#define LOCTEXT_NAMESPACE "FDLSSModule"
DEFINE_LOG_CATEGORY(LogDLSS);
static TAutoConsoleVariable<int32> CVarNGXBinarySearchOrder(
TEXT("r.NGX.BinarySearchOrder"),
0,
TEXT("0: automatic: (default)\n")
TEXT(" use custom binaries from project and launch folder $(ProjectDir)/Binaries/ThirdParty/NVIDIA/NGX/$(Platform) if present\n")
TEXT(" fallback to generic binaries from plugin folder\n")
TEXT("1: force generic binaries from plugin folder, fail if not found\n")
TEXT("2: force custom binaries from project or launch folder, fail if not found\n")
TEXT("3: force generic development binaries from plugin folder, fail if not found. This is only supported in non-shipping build configurations\n"),
ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarNGXEnable(
TEXT("r.NGX.Enable"), 1,
TEXT("Whether the NGX library should be loaded. This allow to have the DLSS plugin enabled but avoiding potential ")
TEXT("incompatibilities by skipping the driver side NGX parts of DLSS. Can also be set on the command line via -ngxenable and -ngxdisable"),
ECVF_Default);
static TAutoConsoleVariable<int32> CVarNGXDLSSMinimumWindowsBuildVersion(
TEXT("r.NGX.DLSS.MinimumWindowsBuildVersion"), 16299,
TEXT("Sets the minimum Windows 10 build version required to enable DLSS. (default: 16299 for v1709, Windows 10 Fall 2017 Creators Update 64-bit)"),
ECVF_Default
);
static TAutoConsoleVariable<int32> CVarNGXProjectIdentifier(
TEXT("r.NGX.ProjectIdentifier"),
0,
TEXT("0: automatic: (default)\n")
TEXT(" use NVIDIA NGX Application ID if non-zero, otherwise use UE Project ID)\n")
TEXT("1: force UE Project ID\n")
TEXT("2: force NVIDIA NGX Application ID (set via the Project Settings -> NVIDIA DLSS plugin)\n"),
ECVF_ReadOnly);
static TAutoConsoleVariable<bool> CVarNGXAutomationEnable(
TEXT("r.NGX.Automation.Enable"),
false,
TEXT("Enable automation for NGX DLSS image quality and performance evaluation. (default = 0)\n"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int> CVarNGXAutomationViewIndex(
TEXT("r.NGX.Automation.ViewIndex"),
0,
TEXT("Select which view to use with NGX DLSS image quality and performance automation. (default = 0). \n"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int> CVarNGXAutomationNonGameViews(
TEXT("r.NGX.Automation.NonGameViews"),
0,
TEXT("Enable NGX DLSS image quality and performance automation for non-game views. (default = 0). \n"),
ECVF_RenderThreadSafe);
class FNGXAutomationViewExtension final : public FSceneViewExtensionBase
{
public:
FNGXAutomationViewExtension(const FAutoRegister& AutoRegister): FSceneViewExtensionBase(AutoRegister)
{
FSceneViewExtensionIsActiveFunctor IsActiveFunctor;
IsActiveFunctor.IsActiveFunction = [](const ISceneViewExtension* SceneViewExtension, const FSceneViewExtensionContext& Context)
{
return CVarNGXAutomationEnable.GetValueOnAnyThread();
};
IsActiveThisFrameFunctions.Add(IsActiveFunctor);
}
virtual void SetupViewFamily(FSceneViewFamily& InViewFamily) {}
virtual void SetupView(FSceneViewFamily& InViewFamily, FSceneView& InView) {}
virtual void SetupViewPoint(APlayerController* Player, FMinimalViewInfo& InViewInfo) {}
virtual void BeginRenderViewFamily(FSceneViewFamily& InViewFamily) {}
virtual void PreRenderView_RenderThread(FRHICommandListImmediate& RHICmdList, FSceneView& InView) final {}
virtual void PreRenderViewFamily_RenderThread(FRHICommandListImmediate& RHICmdList, FSceneViewFamily& InViewFamily) final
{
int32 ViewIndex = CVarNGXAutomationViewIndex.GetValueOnRenderThread();
if (InViewFamily.Views.IsValidIndex(ViewIndex))
{
const FSceneView* View = InViewFamily.Views[ViewIndex];
if (View->bIsGameView || CVarNGXAutomationNonGameViews.GetValueOnRenderThread())
{
const FString AiAgentMarker = FString::Printf(TEXT("{\"camera\":{\"position\":{\"x\": %f, \"y\": %f, \"z\": %f},\"rotation\":{\"pitch\": %f, \"roll\": %f, \"yaw\": %f}}}"),
View->ViewLocation.X, View->ViewLocation.Y, View->ViewLocation.Z,
View->ViewRotation.Pitch, View->ViewRotation.Roll, View->ViewRotation.Yaw);
static FColor ColorMarker = FColor::FromHex("0xA1A5E87");
RHICmdList.PushEvent(*AiAgentMarker, ColorMarker);
RHICmdList.PopEvent();
}
}
}
};
static bool IsCompatibleEngineVersion(FString& OutPluginVersion, FString& OutEngineVersion)
{
// Binary incompatibility between 4.26.0 and 4.26.1, so check for the engine patch version at runtime here
// Engine loading code already checks for compatibility for major/minor/changelist
// Written so that no code change will be needed for future engine versions if compatibility isn't broken again
FEngineVersion Version = FEngineVersion::Current();
OutEngineVersion = FString::Printf(TEXT("%u.%u.%u"), Version.GetMajor(), Version.GetMinor(), Version.GetPatch());
OutPluginVersion = FString::Printf(TEXT("%u.%u.%u"), ENGINE_MAJOR_VERSION, ENGINE_MINOR_VERSION, ENGINE_PATCH_VERSION);
#if ENGINE_MAJOR_VERSION == 4
#if ENGINE_MINOR_VERSION == 26
#if ENGINE_PATCH_VERSION == 0
// 4.26.0
return Version.GetPatch() == 0;
#else
// 4.26.x, x > 0
return Version.GetPatch() >= 1;
#endif
#else
// 4.x._, x > 26
return true;
#endif
#elif ENGINE_MAJOR_VERSION == 5
return true;
#else
#error "ENGINE_MAJOR_VERSION must be either 4 or 5"
#endif
}
void FDLSSModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
UE_LOG(LogDLSS, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
// Get the base directory of this plugin
const FString PluginBaseDir = IPluginManager::Get().FindPlugin(TEXT("DLSS"))->GetBaseDir();
const FString NGXBinariesDir = FPaths::Combine(*PluginBaseDir, TEXT("Binaries/ThirdParty/Win64/"));
const FString RHIName = GDynamicRHI->GetName();
UE_LOG(LogDLSS, Log, TEXT("PluginBaseDir %s"), *PluginBaseDir);
UE_LOG(LogDLSS, Log, TEXT("NGXBinariesDir %s"), *NGXBinariesDir);
UE_LOG(LogDLSS, Log, TEXT("GDynamicRHIName %s %s"), RHIVendorIdToString(), *RHIName );
bool bLoadLibraries = CVarNGXEnable.GetValueOnAnyThread() != 0;
if (FParse::Param(FCommandLine::Get(), TEXT("ngxenable")))
{
bLoadLibraries = true;
}
else if (FParse::Param(FCommandLine::Get(), TEXT("ngxdisable")))
{
bLoadLibraries = false;
}
const int32 NGXDLSSMinimumWindowsBuildVersion = CVarNGXDLSSMinimumWindowsBuildVersion.GetValueOnAnyThread();
FString PluginVersion;
FString EngineVersion;
if (!IsCompatibleEngineVersion(PluginVersion, EngineVersion))
{
FEngineVersion Version = FEngineVersion::Current();
UE_LOG(LogDLSS, Error,
TEXT("This prebuilt binary distribution version %s of the NVIDIA DLSS plugin is not compatible with the current engine version %s"),
*PluginVersion, *EngineVersion);
UE_LOG(LogDLSS, Error, TEXT("Build the DLSS plugin from source (e.g. via the Editor -> Plugins -> NVIDIA DLSS -> Package)"));
DLSSSupport = EDLSSSupport::NotSupported;
// we don't want this ever show up in packaged builds
#if WITH_EDITOR
const bool IsUnattended = FApp::IsUnattended() || IsRunningCommandlet() || GIsRunningUnattendedScript;
if (!IsUnattended )
{
const FText DialogTitle(LOCTEXT("DLSSIncompatibleEngineVersionTitle", "Error - DLSS plugin incompatible with engine"));
const FTextFormat Format(LOCTEXT("DLSSIncompatibleEngineVersion",
"The binary version {0} of this DLSS Unreal Engine Plugin is not compatible with the binary version {1} of this Unreal Engine installation. \n\n"
"Please build the DLSS plugin from source (e.g. via the Editor -> Plugins -> NVIDIA DLSS -> Package)"));
const FText WarningMessage = FText::Format(Format, FText::FromString(PluginVersion), FText::FromString(EngineVersion));
FMessageDialog::Open(EAppMsgType::Ok,WarningMessage, &DialogTitle);
}
#endif //WITH_EDITOR
}
else if (!IsRHIDeviceNVIDIA())
{
UE_LOG(LogDLSS, Log, TEXT("NVIDIA NGX DLSS requires an NVIDIA RTX series graphics card"));
DLSSSupport = EDLSSSupport::NotSupportedIncompatibleHardware;
}
#if PLATFORM_WINDOWS
else if (NGXDLSSMinimumWindowsBuildVersion > 0 && !FPlatformMisc::VerifyWindowsVersion(10, 0
#if PLATFORM_DESKTOP
, NGXDLSSMinimumWindowsBuildVersion
#endif
))
{
// From https://docs.microsoft.com/en-us/windows/release-information/
UE_LOG(LogDLSS, Log, TEXT("NVIDIA NGX DLSS requires at least Windows 10, build %u "), NGXDLSSMinimumWindowsBuildVersion);
DLSSSupport = EDLSSSupport::NotSupportedOperatingSystemOutOfDate;
}
#endif
else if (!bLoadLibraries)
{
UE_LOG(LogDLSS, Log, TEXT("NVIDIA NGX library loading has been disabled with r.NGX.Enable=0"));
DLSSSupport = EDLSSSupport::NotSupported;
}
else
{
const bool bIsDX12 = (RHIName == TEXT("D3D12")) && GetDefault<UDLSSSettings>()->bEnableDLSSD3D12;
const bool bIsDX11 = (RHIName == TEXT("D3D11")) && GetDefault<UDLSSSettings>()->bEnableDLSSD3D11;
const bool bIsVulkan = (RHIName == TEXT("Vulkan")) && GetDefault<UDLSSSettings>()->bEnableDLSSVulkan;
const TCHAR* NGXRHIModuleName = nullptr;
DLSSSupport = (bIsDX11 || bIsDX12 || bIsVulkan) ? EDLSSSupport::Supported : EDLSSSupport::NotSupported;
if (DLSSSupport == EDLSSSupport::Supported)
{
if (bIsDX11)
{
NGXRHIModuleName = TEXT("NGXD3D11RHI");
}
else if (bIsDX12)
{
NGXRHIModuleName = TEXT("NGXD3D12RHI");
}
else if (bIsVulkan)
{
// TODO Vulkan (which might need a second, pre RHI init module to route the required vulkan extensions to the VulkanRHI, similar to the HMD stuff
NGXRHIModuleName = TEXT("NGXVulkanRHI");
}
uint32 NGXAppID = GetDefault<UDLSSSettings>()->NVIDIANGXApplicationId;
UE_LOG(LogDLSS, Log, TEXT("Plugin settings: NGXAppId = %u"), NGXAppID);
if (NGXAppID != 0)
{
UE_LOG(LogDLSS, Warning, TEXT("NGX Application ID is specified, overriding the Project ID. Please refer to https://developer.nvidia.com/dlss."));
}
else
{
UE_LOG(LogDLSS, Warning, TEXT("NGX Application ID not specified, using the Project ID by default."));
}
FNGXRHICreateArguments Arguments;
Arguments.PluginBaseDir = PluginBaseDir;
Arguments.DynamicRHI = GDynamicRHI;
Arguments.NGXBinariesSearchOrder = ENGXBinariesSearchOrder(FMath::Clamp(CVarNGXBinarySearchOrder.GetValueOnAnyThread(), int32(ENGXBinariesSearchOrder::MinValue), int32(ENGXBinariesSearchOrder::MaxValue)));
Arguments.ProjectIdentifier = ENGXProjectIdentifier(FMath::Clamp(CVarNGXProjectIdentifier.GetValueOnAnyThread(), int32(ENGXProjectIdentifier::MinValue), int32(ENGXProjectIdentifier::MaxValue)));
Arguments.NGXAppId = NGXAppID;
Arguments.UnrealEngineVersion = FString::Printf(TEXT("%u.%u"), FEngineVersion::Current().GetMajor(), FEngineVersion::Current().GetMinor());
Arguments.UnrealProjectID = GetDefault<UGeneralProjectSettings>()->ProjectID.ToString();
INGXRHIModule* NGXRHIModule = &FModuleManager::LoadModuleChecked<INGXRHIModule>(NGXRHIModuleName);
NGXRHIExtensions = NGXRHIModule->CreateNGXRHI(Arguments);
const bool bRenderDocPluginFound = FModuleManager::Get().ModuleExists(TEXT("RenderDocPlugin"));
const bool bDLSSUnavailable = (!NGXRHIExtensions || !NGXRHIExtensions->IsDLSSAvailable());
const bool bIncompatibleAPICaptureToolActive = (bRenderDocPluginFound || NGXRHI::IsIncompatibleAPICaptureToolActive());
if (bDLSSUnavailable && bIncompatibleAPICaptureToolActive)
{
if (bRenderDocPluginFound)
{
UE_LOG(LogDLSS, Warning, TEXT("DLSS is not compatible with the RenderDoc plugin. To enable DLSS please disable the RenderDoc plugin."));
}
if (NGXRHI::IsIncompatibleAPICaptureToolActive())
{
UE_LOG(LogDLSS, Warning, TEXT("DLSS is not compatible with some API capture tools, such as RenderDoc. To enable DLSS please use an API capture tool such as NVIDIA NSIGHT graphics, which support the APIs required by DLSS."));
}
// we don't want this ever show up in packaged builds
#if WITH_EDITOR
const bool IsUnattended = FApp::IsUnattended() || IsRunningCommandlet() || GIsRunningUnattendedScript;
auto LocalSettings = GetMutableDefault<UDLSSOverrideSettings>();
if (!IsUnattended && LocalSettings->bShowDLSSIncompatiblePluginsToolsWarnings)
{
const FText DialogTitle(LOCTEXT("DLSSIncompatibleWithCaptureToolTitle", "Warning -- DLSS incompatible with plugins and/or API capture tools"));
const FText WarningMessage(LOCTEXT("DLSSIncompatibleWithCaptureTool",
"To enable DLSS, please disable the RenderDoc plugin and/or use an API capture tool such as NVIDIA NSIGHT graphics, which supports the APIs required by DLSS.\n\n"
"Would you like to continue to see this message for this project? It can also be disabled in the NVIDIA DLSS Overrides (Local) plugin settings."));
EAppReturnType::Type YesNoCancelReply = FMessageDialog::Open(EAppMsgType::YesNoCancel, EAppReturnType::Yes, WarningMessage, &DialogTitle);
if(YesNoCancelReply == EAppReturnType::No)
{
LocalSettings->bShowDLSSIncompatiblePluginsToolsWarnings = false;
}
else if (YesNoCancelReply == EAppReturnType::Cancel)
{
FPlatformMisc::RequestExit(true);
}
}
#endif //WITH_EDITOR
}
if (NGXRHIExtensions)
{
if (NGXRHIExtensions->IsDLSSAvailable())
{
check(NVSDK_NGX_SUCCEED(NGXRHIExtensions->GetDLSSInitResult()));
DLSSSupport = EDLSSSupport::Supported;
}
else
{
// map some of the NGX error codes to something that the UI/gameplay could suggest the end user to do something about
if (bIncompatibleAPICaptureToolActive)
{
DLSSSupport = EDLSSSupport::NotSupportedIncompatibleAPICaptureToolActive;
}
else if (NVSDK_NGX_Result_FAIL_OutOfDate == NGXRHIExtensions->GetDLSSInitResult())
{
DLSSSupport = EDLSSSupport::NotSupportedDriverOutOfDate;
}
else if (NVSDK_NGX_Result_FAIL_FeatureNotSupported == NGXRHIExtensions->GetDLSSInitResult())
{
DLSSSupport = EDLSSSupport::NotSupportedIncompatibleHardware;
}
else
{
DLSSSupport = EDLSSSupport::NotSupported;
}
}
const FNGXDriverRequirements DriverRequirements = NGXRHIExtensions->GetDLSSDriverRequirements();
if (DriverRequirements.DriverUpdateRequired)
{
if (DLSSSupport == EDLSSSupport::Supported)
{
UE_LOG(LogDLSS, Log, TEXT("NVIDIA NGX DLSS could be loaded properly. However it is recommended to update the version to at least: %u.%u"), DriverRequirements.MinDriverVersionMajor, DriverRequirements.MinDriverVersionMinor);
}
else
{
UE_LOG(LogDLSS, Log, TEXT("NVIDIA NGX DLSS cannot be loaded properly. Please verify that at least this driver version is installed: %u.%u"), DriverRequirements.MinDriverVersionMajor, DriverRequirements.MinDriverVersionMinor);
DLSSSupport = EDLSSSupport::NotSupportedDriverOutOfDate;
MinDriverVersionMajor = DriverRequirements.MinDriverVersionMajor;
MinDriverVersionMinor = DriverRequirements.MinDriverVersionMinor;
}
}
}
else
{
UE_LOG(LogDLSS, Log, TEXT("Could not load %s module"), NGXRHIModuleName);
DLSSSupport = EDLSSSupport::NotSupported;
}
if (DLSSSupport != EDLSSSupport::Supported)
{
UE_LOG(LogDLSS, Log, TEXT("DLSS not supported by the %s %s RHI in the %s module at runtime"), RHIVendorIdToString(), *RHIName, NGXRHIModuleName);
}
}
else
{
UE_LOG(LogDLSS, Log, TEXT("DLSS not implemented for the %s RHI, or disabled in the project settings"), *RHIName);
DLSSSupport = EDLSSSupport::NotSupported;
}
}
if (DLSSSupport == EDLSSSupport::Supported)
{
// set the upscaler
{
DLSSUpscaler.Reset(new FDLSSUpscaler(NGXRHIExtensions.Get()));
check(DLSSUpscaler);
if (DLSSUpscaler->GetNumRuntimeQualityModes() == 0)
{
UE_LOG(LogDLSS, Log, TEXT("DLSS not available due to not supporting any quality modes at runtime"));
DLSSSupport = EDLSSSupport::NotSupported;
DLSSUpscaler.Reset();
NGXRHIExtensions.Reset();
}
#if DLSS_ENGINE_HAS_GTEMPORALUPSCALER
else
{
checkf(GTemporalUpscaler == ITemporalUpscaler::GetDefaultTemporalUpscaler(), TEXT("GTemporalUpscaler is not set to the default upscaler. Please check that only one upscaling plugin is active."));
GTemporalUpscaler = DLSSUpscaler.Get();
}
#endif
}
}
UE_LOG(LogDLSS, Log, TEXT("NVIDIA NGX DLSS supported %u"), QueryDLSSSupport() == EDLSSSupport::Supported);
// and the other related interfaces
if (DLSSSupport == EDLSSSupport::Supported)
{
// set the denoiser
{
static const auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Reflections.Denoiser"));
if (CVar && (CVar->GetInt() != 2))
{
UE_LOG(LogDLSS, Warning, TEXT("For optimal results NVIDIA NGX DLSS requires the use of a custom denoiser plugin, which currently is disabled. To enable, set r.Reflections.Denoiser=2"));
}
DLSSDenoiser.Reset(new FDLSSDenoiser(GScreenSpaceDenoiser, DLSSUpscaler.Get()));
GScreenSpaceDenoiser = DLSSDenoiser.Get();
UE_LOG(LogDLSS, Log, TEXT("%s wrapping %s"), DLSSDenoiser->GetDebugName(), DLSSDenoiser->GetWrappedDenoiser()->GetDebugName());
}
// set the screen percentage driver for game views
{
checkf(GCustomStaticScreenPercentage == nullptr, TEXT("GCustomStaticScreenPercentage is already in use. Please check that only one upscaling plugin is active."));
GCustomStaticScreenPercentage = DLSSUpscaler.Get();
}
// set the resource pool
{
checkf(GCustomResourcePool == nullptr, TEXT("GCustomResourcePool is already in use. Please check that only one upscaling plugin is active."));
GCustomResourcePool = DLSSUpscaler.Get();
}
}
// setup DLSS image quality and performance automation hooks
{
NGXAutomationViewExtension = FSceneViewExtensions::NewExtension<FNGXAutomationViewExtension>();
}
UE_LOG(LogDLSS, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
void FDLSSModule::ShutdownModule()
{
UE_LOG(LogDLSS, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
// reset DLSS image quality and performance automation hooks
{
NGXAutomationViewExtension = nullptr;
}
if (QueryDLSSSupport() == EDLSSSupport::Supported)
{
// reset the resource pool
{
GCustomResourcePool = nullptr;
}
// reset the screen percentage driver for game views
{
GCustomStaticScreenPercentage = nullptr;
}
// reset the denoiser
{
UE_LOG(LogDLSS, Log, TEXT("%s unwrapping %s"), DLSSDenoiser->GetDebugName(), DLSSDenoiser->GetWrappedDenoiser()->GetDebugName());
GScreenSpaceDenoiser = DLSSDenoiser->GetWrappedDenoiser();
DLSSDenoiser.Reset();
}
// reset the upscaler
{
#if DLSS_ENGINE_HAS_GTEMPORALUPSCALER
GTemporalUpscaler = ITemporalUpscaler::GetDefaultTemporalUpscaler();
#endif
FDLSSUpscaler::ReleaseStaticResources();
DLSSUpscaler.Reset();
}
NGXRHIExtensions.Reset();
}
UE_LOG(LogDLSS, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
EDLSSSupport FDLSSModule::QueryDLSSSupport() const
{
return DLSSSupport;
}
void FDLSSModule::GetDLSSMinDriverVersion(int32& OutMajorVersion, int32& OutMinorVersion) const
{
OutMajorVersion = MinDriverVersionMajor;
OutMinorVersion = MinDriverVersionMinor;
}
float FDLSSModule::GetResolutionFractionForQuality(int32 Quality) const
{
checkf(QueryDLSSSupport() == EDLSSSupport::Supported,TEXT("GetResolutionFractionForQuality should only be called when DLSS is supported"));
checkf(Quality >= int32(EDLSSQualityMode::MinValue) && Quality <= int32(EDLSSQualityMode::MaxValue),TEXT("The Quality %d argument of GetResolutionFractionForQuality is out of range and/or an unsupported DLSS quality mode"), Quality);
return DLSSUpscaler->GetOptimalResolutionFractionForQuality(EDLSSQualityMode(Quality));
}
FDLSSUpscaler* FDLSSModule::GetDLSSUpscaler() const
{
return DLSSUpscaler.Get();
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FDLSSModule, DLSS)
@@ -1,201 +0,0 @@
/*
* Copyright (c) 2020 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
#include "DLSSDenoiser.h"
#include "DLSSUpscaler.h"
#include "PostProcess/TemporalAA.h"
#include "SceneTextureParameters.h"
#include "ScenePrivate.h"
static TAutoConsoleVariable<int32> CVarNGXDLSSReflectionsTemporalAA(
TEXT("r.NGX.DLSS.Reflections.TemporalAA"),
1,
TEXT("Apply a temporal AA pass on the denoised reflections"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarNGXDLSSWaterReflectionsTemporalAA(
TEXT("r.NGX.DLSS.WaterReflections.TemporalAA"),
1,
TEXT("Apply a temporal AA pass on the denoised water reflections"),
ECVF_RenderThreadSafe
);
// defined in Buid.cs since it depends on the branch and engine version
#if !DLSS_ENGINE_HAS_AAM_TSR
/** Returns whether the anti-aliasing method use a temporal accumulation */
static inline bool IsTemporalAccumulationBasedMethod(EAntiAliasingMethod AntiAliasingMethod)
{
return AntiAliasingMethod == AAM_TemporalAA;
}
#endif
FDLSSDenoiser::FDLSSDenoiser(const IScreenSpaceDenoiser* InWrappedDenoiser, const FDLSSUpscaler* InUpscaler)
: WrappedDenoiser(InWrappedDenoiser)
, Upscaler(InUpscaler)
{
check(Upscaler);
check(WrappedDenoiser);
}
const TCHAR* FDLSSDenoiser::GetDebugName() const
{
if (Upscaler->IsDLSSActive())
{
// we don't have the View here to check whether we have a valid GetTemporalUpscalerInterface, which we'll do when we actually get called to denoise/add TAA
// and this is only for profilegpu anyways so OK if it's not 100% accurate
if (Upscaler->IsAutoQualityMode())
{
return TEXT("FDLSSDenoiserWrapper(Auto)");
}
else
{
return TEXT("FDLSSDenoiserWrapper(Active)");
}
}
else
{
return TEXT("FDLSSDenoiserWrapper(Inactive)");
}
}
IScreenSpaceDenoiser::EShadowRequirements FDLSSDenoiser::GetShadowRequirements(const FViewInfo& View, const FLightSceneInfo& LightSceneInfo, const FShadowRayTracingConfig& RayTracingConfig) const
{
return WrappedDenoiser->GetShadowRequirements(View, LightSceneInfo, RayTracingConfig);
}
void FDLSSDenoiser::DenoiseShadowVisibilityMasks(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const TStaticArray<FShadowVisibilityParameters, IScreenSpaceDenoiser::kMaxBatchSize>& InputParameters, const int32 InputParameterCount, TStaticArray<FShadowVisibilityOutputs, IScreenSpaceDenoiser::kMaxBatchSize>& Outputs) const
{
WrappedDenoiser->DenoiseShadowVisibilityMasks(GraphBuilder, View, PreviousViewInfos, SceneTextures, InputParameters, InputParameterCount, Outputs);
}
IScreenSpaceDenoiser::FPolychromaticPenumbraOutputs FDLSSDenoiser::DenoisePolychromaticPenumbraHarmonics(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FPolychromaticPenumbraHarmonics& Inputs) const
{
return WrappedDenoiser->DenoisePolychromaticPenumbraHarmonics(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs);
}
IScreenSpaceDenoiser::FReflectionsOutputs FDLSSDenoiser::DenoiseReflections(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FReflectionsInputs& Inputs, const FReflectionsRayTracingConfig Config) const
{
FReflectionsOutputs Outputs = WrappedDenoiser->DenoiseReflections(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs, Config);
const bool bIsDLSSActive = Upscaler->IsDLSSActive() && View.Family && Upscaler->IsValidUpscalerInstance(View.Family->GetTemporalUpscalerInterface());
const bool bApplyTemporalAA = bIsDLSSActive && CVarNGXDLSSReflectionsTemporalAA.GetValueOnRenderThread() && View.ViewState && IsTemporalAccumulationBasedMethod(View.AntiAliasingMethod);
if(bApplyTemporalAA)
{
check(View.ViewState);
FTAAPassParameters TAASettings(View);
TAASettings.Pass = ETAAPassConfig::ScreenSpaceReflections;
TAASettings.SceneDepthTexture = SceneTextures.SceneDepthTexture;
TAASettings.SceneVelocityTexture = SceneTextures.GBufferVelocityTexture;
TAASettings.SceneColorInput = Outputs.Color;
TAASettings.bOutputRenderTargetable = true;
FTAAOutputs TAAOutputs = AddTemporalAAPass(
GraphBuilder,
View,
TAASettings,
View.PrevViewInfo.SSRHistory,
&View.ViewState->PrevFrameViewInfo.SSRHistory);
Outputs.Color = TAAOutputs.SceneColor;
}
return Outputs;
}
IScreenSpaceDenoiser::FReflectionsOutputs FDLSSDenoiser::DenoiseWaterReflections(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FReflectionsInputs& Inputs, const FReflectionsRayTracingConfig Config) const
{
FReflectionsOutputs Outputs = WrappedDenoiser->DenoiseWaterReflections(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs, Config);
const bool bIsDLSSActive = Upscaler->IsDLSSActive() && View.Family && Upscaler->IsValidUpscalerInstance(View.Family->GetTemporalUpscalerInterface());
const bool bApplyTemporalAA = bIsDLSSActive && Upscaler->IsDLSSActive() && CVarNGXDLSSWaterReflectionsTemporalAA.GetValueOnRenderThread() && View.ViewState && IsTemporalAccumulationBasedMethod(View.AntiAliasingMethod);
if (bApplyTemporalAA)
{
check(View.ViewState);
FTAAPassParameters TAASettings(View);
TAASettings.Pass = ETAAPassConfig::ScreenSpaceReflections;
TAASettings.SceneDepthTexture = SceneTextures.SceneDepthTexture;
TAASettings.SceneVelocityTexture = SceneTextures.GBufferVelocityTexture;
TAASettings.SceneColorInput = Outputs.Color;
TAASettings.bOutputRenderTargetable = true;
FTAAOutputs TAAOutputs = AddTemporalAAPass(
GraphBuilder,
View,
TAASettings,
View.PrevViewInfo.WaterSSRHistory,
&View.ViewState->PrevFrameViewInfo.WaterSSRHistory);
Outputs.Color = TAAOutputs.SceneColor;
}
return Outputs;
}
IScreenSpaceDenoiser::FAmbientOcclusionOutputs FDLSSDenoiser::DenoiseAmbientOcclusion(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FAmbientOcclusionInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const
{
return WrappedDenoiser->DenoiseAmbientOcclusion(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs, Config);
}
#if ENGINE_MAJOR_VERSION == 4
IScreenSpaceDenoiser::FDiffuseIndirectOutputs FDLSSDenoiser::DenoiseDiffuseIndirect(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const
{
return WrappedDenoiser->DenoiseDiffuseIndirect(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs, Config);
}
IScreenSpaceDenoiser::FDiffuseIndirectOutputs FDLSSDenoiser::DenoiseScreenSpaceDiffuseIndirect(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const
{
return WrappedDenoiser->DenoiseScreenSpaceDiffuseIndirect(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs, Config);
}
IScreenSpaceDenoiser::FDiffuseIndirectHarmonic FDLSSDenoiser::DenoiseDiffuseIndirectHarmonic(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectHarmonic& Inputs, const FAmbientOcclusionRayTracingConfig Config) const
{
return WrappedDenoiser->DenoiseDiffuseIndirectHarmonic(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs, Config);
}
#elif ENGINE_MAJOR_VERSION == 5
FSSDSignalTextures FDLSSDenoiser::DenoiseDiffuseIndirect(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const
{
return WrappedDenoiser->DenoiseDiffuseIndirect(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs, Config);
}
FSSDSignalTextures FDLSSDenoiser::DenoiseScreenSpaceDiffuseIndirect(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const
{
return WrappedDenoiser->DenoiseScreenSpaceDiffuseIndirect(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs, Config);
}
FSSDSignalTextures FDLSSDenoiser::DenoiseDiffuseIndirectHarmonic(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectHarmonic& Inputs, const HybridIndirectLighting::FCommonParameters& CommonDiffuseParameters) const
{
return WrappedDenoiser->DenoiseDiffuseIndirectHarmonic(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs, CommonDiffuseParameters);
}
#else
#error "ENGINE_MAJOR_VERSION must be either 4 or 5"
#endif
IScreenSpaceDenoiser::FDiffuseIndirectOutputs FDLSSDenoiser::DenoiseSkyLight(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const
{
return WrappedDenoiser->DenoiseSkyLight(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs, Config);
}
IScreenSpaceDenoiser::FDiffuseIndirectOutputs FDLSSDenoiser::DenoiseReflectedSkyLight(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const
{
return WrappedDenoiser->DenoiseReflectedSkyLight(GraphBuilder, View, PreviousViewInfos, SceneTextures, Inputs, Config);
}
bool FDLSSDenoiser::SupportsScreenSpaceDiffuseIndirectDenoiser(EShaderPlatform Platform) const
{
return WrappedDenoiser->SupportsScreenSpaceDiffuseIndirectDenoiser(Platform);
}
const IScreenSpaceDenoiser* FDLSSDenoiser::GetWrappedDenoiser() const
{
return WrappedDenoiser;
}
@@ -1,65 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "CoreMinimal.h"
#include "ScreenSpaceDenoise.h"
// for ENGINE_MAJOR_VERSION
#include "Launch/Resources/Version.h"
class FDLSSUpscaler;
// wrapper for the default denoiser to add TAA after some passes
class DLSS_API FDLSSDenoiser final : public IScreenSpaceDenoiser
{
public:
FDLSSDenoiser(const IScreenSpaceDenoiser* InWrappedDenoiser, const FDLSSUpscaler* InUpscaler);
// Inherited via IScreenSpaceDenoiser
virtual const TCHAR* GetDebugName() const final;
virtual EShadowRequirements GetShadowRequirements(const FViewInfo& View, const FLightSceneInfo& LightSceneInfo, const FShadowRayTracingConfig& RayTracingConfig) const final;
virtual void DenoiseShadowVisibilityMasks(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const TStaticArray<FShadowVisibilityParameters, IScreenSpaceDenoiser::kMaxBatchSize>& InputParameters, const int32 InputParameterCount, TStaticArray<FShadowVisibilityOutputs, IScreenSpaceDenoiser::kMaxBatchSize>& Outputs) const final;
virtual FPolychromaticPenumbraOutputs DenoisePolychromaticPenumbraHarmonics(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FPolychromaticPenumbraHarmonics& Inputs) const final;
virtual FReflectionsOutputs DenoiseReflections(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FReflectionsInputs& Inputs, const FReflectionsRayTracingConfig Config) const final;
virtual FReflectionsOutputs DenoiseWaterReflections(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FReflectionsInputs& Inputs, const FReflectionsRayTracingConfig Config) const override;
virtual FAmbientOcclusionOutputs DenoiseAmbientOcclusion(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FAmbientOcclusionInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const final;
#if ENGINE_MAJOR_VERSION == 4
virtual FDiffuseIndirectOutputs DenoiseDiffuseIndirect(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const final;
virtual FDiffuseIndirectHarmonic DenoiseDiffuseIndirectHarmonic(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectHarmonic& Inputs, const FAmbientOcclusionRayTracingConfig Config) const final;
virtual FDiffuseIndirectOutputs DenoiseScreenSpaceDiffuseIndirect(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const final;
#elif ENGINE_MAJOR_VERSION == 5
virtual FSSDSignalTextures DenoiseDiffuseIndirect(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const final;
virtual FSSDSignalTextures DenoiseScreenSpaceDiffuseIndirect(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const final;
virtual FSSDSignalTextures DenoiseDiffuseIndirectHarmonic(FRDGBuilder& GraphBuilder,const FViewInfo& View,FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectHarmonic& Inputs, const HybridIndirectLighting::FCommonParameters& CommonDiffuseParameters) const final;
#else
#error "ENGINE_MAJOR_VERSION must be either 4 or 5"
#endif
virtual FDiffuseIndirectOutputs DenoiseSkyLight(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const final;
virtual FDiffuseIndirectOutputs DenoiseReflectedSkyLight(FRDGBuilder& GraphBuilder, const FViewInfo& View, FPreviousViewInfo* PreviousViewInfos, const FSceneTextureParameters& SceneTextures, const FDiffuseIndirectInputs& Inputs, const FAmbientOcclusionRayTracingConfig Config) const final;
virtual bool SupportsScreenSpaceDiffuseIndirectDenoiser(EShaderPlatform Platform) const final;
const IScreenSpaceDenoiser* GetWrappedDenoiser() const;
private:
const IScreenSpaceDenoiser* WrappedDenoiser;
const FDLSSUpscaler* Upscaler;
};
@@ -1,22 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include "DLSSSettings.h"
#define LOCTEXT_NAMESPACE "FDLSSModule"
@@ -1,790 +0,0 @@
/*
* Copyright (c) 2020 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
#include "DLSSUpscaler.h"
#include "DLSSUpscalerPrivate.h"
#include "DLSSUpscalerHistory.h"
#include "DLSSSettings.h"
#include "VelocityCombinePass.h"
#include "PostProcess/SceneRenderTargets.h"
#include "PostProcess/PostProcessing.h"
#include "SceneTextureParameters.h"
#include "ScreenPass.h"
#include "RayTracing/RaytracingOptions.h"
#include "LegacyScreenPercentageDriver.h"
#define LOCTEXT_NAMESPACE "FDLSSModule"
#ifndef SUPPORTS_POSTPROCESSING_SCREEN_PERCENTAGE
#define SUPPORTS_POSTPROCESSING_SCREEN_PERCENTAGE 1
#endif
static TAutoConsoleVariable<int32> CVarNGXDLSSEnable(
TEXT("r.NGX.DLSS.Enable"), 1,
TEXT("Enable/Disable DLSS entirely."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<bool> CVarNGXDLAAEnable(
TEXT("r.NGX.DLAA.Enable"), false,
TEXT("Enable/Disable DLAA"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarNGXDLSSAutomationTesting(
TEXT("r.NGX.DLSS.AutomationTesting"), 0,
TEXT("Whether the NGX library should be loaded when GIsAutomationTesting is true.(default is false)\n")
TEXT("Must be set to true before startup. This can be enabled for cases where running automation testing with DLSS desired"),
ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarNGXDLSSPerfQualitySetting(
TEXT("r.NGX.DLSS.Quality"),
-1,
TEXT("DLSS Performance/Quality setting. Not all modes might be supported at runtime, in this case Balanced mode is used as a fallback\n")
TEXT(" -2: Ultra Performance\n")
TEXT(" -1: Performance (default)\n")
TEXT(" 0: Balanced\n")
TEXT(" 1: Quality\n")
TEXT(" 2: Ultra Quality\n"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<bool> CVarNGXDLSSAutoQualitySetting(
TEXT("r.NGX.DLSS.Quality.Auto"), 0,
TEXT("Enable/Disable DLSS automatically selecting the DLSS quality mode based on the render resolution"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarNGXDLSSSharpness(
TEXT("r.NGX.DLSS.Sharpness"),
0.0f,
TEXT("-1.0 to 1.0: Softening/sharpening to apply to the DLSS pass. Negative values soften the image, positive values sharpen. (default: 0.0f)"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarNGXDLSSDilateMotionVectors(
TEXT("r.NGX.DLSS.DilateMotionVectors"),
1,
TEXT(" 0: pass low resolution motion vectors into DLSS\n")
TEXT(" 1: pass dilated high resolution motion vectors into DLSS. This can help with improving image quality of thin details. (default)"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarNGXDLSSAutoExposure(
TEXT("r.NGX.DLSS.AutoExposure"), 1,
TEXT("0: Use the engine-computed exposure value for input images to DLSS - in some cases this may reduce artifacts\n")
TEXT("1: Enable DLSS internal auto-exposure instead of the application provided one (default)\n"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarNGXDLSSReleaseMemoryOnDelete(
TEXT("r.NGX.DLSS.ReleaseMemoryOnDelete"),
1,
TEXT("Enabling/disable releasing DLSS related memory on the NGX side when DLSS features get released.(default=1)"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarNGXDLSSFeatureCreationNode(
TEXT("r.NGX.DLSS.FeatureCreationNode"), -1,
TEXT("Determines which GPU the DLSS feature is getting created on\n")
TEXT("-1: Create on the GPU the command list is getting executed on (default)\n")
TEXT(" 0: Create on GPU node 0 \n")
TEXT(" 1: Create on GPU node 1 \n"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarNGXDLSSFeatureVisibilityMask(
TEXT("r.NGX.DLSS.FeatureVisibilityMask"), -1,
TEXT("Determines which GPU the DLSS feature is visible to\n")
TEXT("-1: Visible to the GPU the command list is getting executed on (default)\n")
TEXT(" 1: visible to GPU node 0 \n")
TEXT(" 2: visible to GPU node 1 \n")
TEXT(" 3: visible to GPU node 0 and GPU node 1\n"),
ECVF_RenderThreadSafe);
DECLARE_GPU_STAT(DLSS)
BEGIN_SHADER_PARAMETER_STRUCT(FDLSSShaderParameters, )
// Input images
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, SceneColorInput)
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, SceneDepthInput)
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, EyeAdaptation)
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, SceneVelocityInput)
// Output images
RDG_TEXTURE_ACCESS(SceneColorOutput, ERHIAccess::UAVCompute)
END_SHADER_PARAMETER_STRUCT()
FIntPoint FDLSSPassParameters::GetOutputExtent() const
{
check(Validate());
check(SceneColorInput);
FIntPoint InputExtent = SceneColorInput->Desc.Extent;
FIntPoint QuantizedPrimaryUpscaleViewSize;
QuantizeSceneBufferSize(OutputViewRect.Size(), QuantizedPrimaryUpscaleViewSize);
return FIntPoint(
FMath::Max(InputExtent.X, QuantizedPrimaryUpscaleViewSize.X),
FMath::Max(InputExtent.Y, QuantizedPrimaryUpscaleViewSize.Y));
}
bool FDLSSPassParameters::Validate() const
{
checkf(OutputViewRect.Min == FIntPoint::ZeroValue,TEXT("The DLSS OutputViewRect %dx%d must be non-zero"), OutputViewRect.Min.X, OutputViewRect.Min.Y);
return true;
}
const TCHAR* FDLSSUpscaler::GetDebugName() const
{
return TEXT("FDLSSUpscaler");
}
static NVSDK_NGX_PerfQuality_Value ToNGXQuality(EDLSSQualityMode Quality)
{
static_assert(int32(EDLSSQualityMode::NumValues) == 5, "dear DLSS plugin NVIDIA developer, please update this code to handle the new EDLSSQualityMode enum values");
switch (Quality)
{
case EDLSSQualityMode::UltraPerformance:
return NVSDK_NGX_PerfQuality_Value_UltraPerformance;
default:
checkf(false, TEXT("ToNGXQuality should not be called with an out of range EDLSSQualityMode from the higher level code"));
case EDLSSQualityMode::Performance:
return NVSDK_NGX_PerfQuality_Value_MaxPerf;
case EDLSSQualityMode::Balanced:
return NVSDK_NGX_PerfQuality_Value_Balanced;
case EDLSSQualityMode::Quality:
return NVSDK_NGX_PerfQuality_Value_MaxQuality;
case EDLSSQualityMode::UltraQuality:
return NVSDK_NGX_PerfQuality_Value_UltraQuality;
}
}
NGXRHI* FDLSSUpscaler::NGXRHIExtensions;
TStaticArray <TSharedPtr<FDLSSUpscaler>, uint32(EDLSSQualityMode::NumValues)> FDLSSUpscaler::DLSSUpscalerInstancesPerViewFamily;
float FDLSSUpscaler::MinResolutionFraction = TNumericLimits <float>::Max();
float FDLSSUpscaler::MaxResolutionFraction = TNumericLimits <float>::Min();
uint32 FDLSSUpscaler::NumRuntimeQualityModes = 0;
TArray<FDLSSOptimalSettings> FDLSSUpscaler::ResolutionSettings;
FDLSSUpscaler* FDLSSUpscaler::GetUpscalerInstanceForViewFamily(const FDLSSUpscaler* InUpscaler, EDLSSQualityMode InQualityMode)
{
uint32 ArrayIndex = (int32)ToNGXQuality(InQualityMode);
if (!DLSSUpscalerInstancesPerViewFamily[ArrayIndex])
{
DLSSUpscalerInstancesPerViewFamily[ArrayIndex] = MakeShared<FDLSSUpscaler>(InUpscaler, InQualityMode);
}
return DLSSUpscalerInstancesPerViewFamily[ArrayIndex].Get();
}
bool FDLSSUpscaler::IsValidUpscalerInstance(const ITemporalUpscaler* InUpscaler)
{
// DLSSUpscalerInstancesPerViewFamily gets lazily initialized, but we don't want to accidentally treat nullptr as a valid
// upscaler instance, when we want to check (e.g. in the denoiser) whether DLSS is actually active for the viewfamily
if (InUpscaler == nullptr)
{
return false;
}
for (auto UpscalerInstance : DLSSUpscalerInstancesPerViewFamily)
{
if (UpscalerInstance.Get() == InUpscaler)
{
return true;
}
}
return false;
}
bool FDLSSUpscaler::IsAutoQualityMode()
{
return CVarNGXDLSSAutoQualitySetting.GetValueOnAnyThread();
}
bool FDLSSUpscaler::IsDLAAMode()
{
return CVarNGXDLAAEnable.GetValueOnAnyThread();
}
void FDLSSUpscaler::SetAutoQualityMode(bool bAutoQualityMode)
{
check(IsInGameThread());
CVarNGXDLSSAutoQualitySetting->Set(bAutoQualityMode, ECVF_SetByCommandline);
}
// make copy & assign quality mode
FDLSSUpscaler::FDLSSUpscaler(const FDLSSUpscaler* InUpscaler, EDLSSQualityMode InQualityMode)
: FDLSSUpscaler(*InUpscaler)
{
DLSSQualityMode = InQualityMode;
check(NGXRHIExtensions);
}
FDLSSUpscaler::FDLSSUpscaler(NGXRHI* InNGXRHIExtensions)
{
UE_LOG(LogDLSS, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
checkf(!NGXRHIExtensions, TEXT("static member NGXRHIExtensions should only be assigned once by this ctor when called during module startup") );
NGXRHIExtensions = InNGXRHIExtensions;
ResolutionSettings.Init(FDLSSOptimalSettings(), int32(EDLSSQualityMode::NumValues));
static_assert(int32(EDLSSQualityMode::NumValues) == 5, "dear DLSS plugin NVIDIA developer, please update this code to handle the new EDLSSQualityMode enum values");
for (auto QualityMode : { EDLSSQualityMode::UltraPerformance, EDLSSQualityMode::Performance , EDLSSQualityMode::Balanced, EDLSSQualityMode::Quality, EDLSSQualityMode::UltraQuality })
{
check(ToNGXQuality(QualityMode) < ResolutionSettings.Num());
check(ToNGXQuality(QualityMode) >= 0);
FDLSSOptimalSettings OptimalSettings = NGXRHIExtensions->GetDLSSOptimalSettings(ToNGXQuality(QualityMode));
ResolutionSettings[ToNGXQuality(QualityMode)] = OptimalSettings;
// we only consider non-fixed resolutions for the overall min / max resolution fraction
if (OptimalSettings.bIsSupported && !OptimalSettings.IsFixedResolution())
{
// We use OptimalSettings.OptimalResolutionFraction to avoid getting to "floating point close" to OptimalSettings.{MinMax}ResolutionFraction)
MinResolutionFraction = FMath::Min(MinResolutionFraction, OptimalSettings.OptimalResolutionFraction);
MaxResolutionFraction = FMath::Max(MaxResolutionFraction, OptimalSettings.OptimalResolutionFraction);
++NumRuntimeQualityModes;
}
UE_LOG(LogDLSS, Log, TEXT("QualityMode %d: bSupported = %u, ResolutionFraction = %.4f. MinResolutionFraction=%.4f, MaxResolutionFraction %.4f"),
QualityMode, OptimalSettings.bIsSupported, OptimalSettings.OptimalResolutionFraction, OptimalSettings.MinResolutionFraction, OptimalSettings.MaxResolutionFraction);
}
// the DLSS module will report DLSS as not supported if there are no supported quality modes at runtime
UE_LOG(LogDLSS, Log, TEXT("NumRuntimeQualityModes=%u, MinResolutionFraction=%.4f, MaxResolutionFraction=%.4f"), NumRuntimeQualityModes, MinResolutionFraction, MaxResolutionFraction);
// Higher levels of the code (e.g. UI) should check whether each mode is actually supported
// But for now verify early that the DLSS 2.0 modes are supported. Those checks could be removed in the future
check(IsQualityModeSupported(EDLSSQualityMode::Performance));
check(IsQualityModeSupported(EDLSSQualityMode::Balanced));
check(IsQualityModeSupported(EDLSSQualityMode::Quality));
UE_LOG(LogDLSS, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
FDLSSUpscaler::~FDLSSUpscaler()
{
UE_LOG(LogDLSS, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
UE_LOG(LogDLSS, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
// this gets explicitly called during module shutdown
void FDLSSUpscaler::ReleaseStaticResources()
{
UE_LOG(LogDLSS, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
ResolutionSettings.Empty();
for (auto& UpscalerInstance : DLSSUpscalerInstancesPerViewFamily)
{
UpscalerInstance.Reset();
}
UE_LOG(LogDLSS, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
#if DLSS_ENGINE_ADDPASSES_RETURN_THROUGH_PARAMS
void FDLSSUpscaler::AddPasses(
#else
ITemporalUpscaler::FOutputs FDLSSUpscaler::AddPasses(
#endif
FRDGBuilder& GraphBuilder,
const FViewInfo& View,
const FPassInputs& PassInputs
#if DLSS_ENGINE_ADDPASSES_RETURN_THROUGH_PARAMS
, FRDGTextureRef* OutSceneColorTexture
, FIntRect* OutSceneColorViewRect
, FRDGTextureRef* OutSceneColorHalfResTexture
, FIntRect* OutSceneColorHalfResViewRect
#endif
) const
{
#if ENGINE_MAJOR_VERSION < 5
// For TAAU, this can happen with screen percentages larger than 100%, so not something that DLSS viewports are setup with
checkf(!PassInputs.bAllowDownsampleSceneColor,TEXT("The DLSS plugin does not support downsampling the scenecolor. Please set r.TemporalAA.AllowDownsampling=0"));
#endif
checkf(View.PrimaryScreenPercentageMethod == EPrimaryScreenPercentageMethod::TemporalUpscale, TEXT("DLSS requires TemporalUpscale. If you hit this assert, please set r.TemporalAA.Upscale=1"));
const FTemporalAAHistory& InputHistory = View.PrevViewInfo.TemporalAAHistory;
const TRefCountPtr<ICustomTemporalAAHistory> InputCustomHistory = View.PrevViewInfo.CustomTemporalAAHistory;
FTemporalAAHistory* OutputHistory = View.ViewState ? &(View.ViewState->PrevFrameViewInfo.TemporalAAHistory) : nullptr;
TRefCountPtr < ICustomTemporalAAHistory >* OutputCustomHistory = View.ViewState ? &(View.ViewState->PrevFrameViewInfo.CustomTemporalAAHistory) : nullptr;
FDLSSPassParameters DLSSParameters(View);
const FIntRect SecondaryViewRect = DLSSParameters.OutputViewRect;
#if !DLSS_ENGINE_ADDPASSES_RETURN_THROUGH_PARAMS
ITemporalUpscaler::FOutputs Outputs;
#endif
{
RDG_GPU_STAT_SCOPE(GraphBuilder, DLSS);
RDG_EVENT_SCOPE(GraphBuilder, "DLSS");
const bool bDilateMotionVectors = CVarNGXDLSSDilateMotionVectors.GetValueOnRenderThread() != 0;
FRDGTextureRef CombinedVelocityTexture = AddVelocityCombinePass(GraphBuilder, View, PassInputs.SceneDepthTexture, PassInputs.SceneVelocityTexture, bDilateMotionVectors);
DLSSParameters.SceneColorInput = PassInputs.SceneColorTexture;
DLSSParameters.SceneVelocityInput = CombinedVelocityTexture;
DLSSParameters.SceneDepthInput = PassInputs.SceneDepthTexture;
DLSSParameters.bHighResolutionMotionVectors = bDilateMotionVectors;
const FDLSSOutputs DLSSOutputs = AddDLSSPass(
GraphBuilder,
View,
DLSSParameters,
InputHistory,
OutputHistory,
InputCustomHistory,
OutputCustomHistory
);
#if DLSS_ENGINE_ADDPASSES_RETURN_THROUGH_PARAMS
FRDGTextureRef SceneColorTexture = DLSSOutputs.SceneColor;
*OutSceneColorTexture = SceneColorTexture;
*OutSceneColorViewRect = SecondaryViewRect;
*OutSceneColorHalfResTexture = nullptr;
*OutSceneColorHalfResViewRect = FIntRect(FIntPoint::ZeroValue, FIntPoint::ZeroValue);
#else
Outputs.FullRes.Texture = DLSSOutputs.SceneColor;
Outputs.FullRes.ViewRect = SecondaryViewRect;
#endif
}
#if !DLSS_ENGINE_ADDPASSES_RETURN_THROUGH_PARAMS
return Outputs;
#endif
}
FDLSSOutputs FDLSSUpscaler::AddDLSSPass(
FRDGBuilder& GraphBuilder,
const FViewInfo& View,
const FDLSSPassParameters& Inputs,
const FTemporalAAHistory& InputHistory,
FTemporalAAHistory* OutputHistory,
const TRefCountPtr<ICustomTemporalAAHistory> InputCustomHistoryInterface,
TRefCountPtr<ICustomTemporalAAHistory>* OutputCustomHistoryInterface
) const
{
check(IsValidUpscalerInstance(this));
check(IsDLSSActive());
const FDLSSUpscalerHistory* InputCustomHistory = static_cast<const FDLSSUpscalerHistory*>(InputCustomHistoryInterface.GetReference());
const bool bCameraCut = !InputHistory.IsValid() || View.bCameraCut || !OutputHistory;
const FIntPoint OutputExtent = Inputs.GetOutputExtent();
const FIntRect SrcRect = Inputs.InputViewRect;
const FIntRect DestRect = Inputs.OutputViewRect;
const float ScaleX = float(SrcRect.Width()) / float(DestRect.Width());
const float ScaleY = float(SrcRect.Height()) / float(DestRect.Height());
// FDLSSUpscaler::SetupMainGameViewFamily or FDLSSUpscalerEditor::SetupEditorViewFamily
// set DLSSQualityMode by setting an FDLSSUpscaler on the ViewFamily (from the pool in DLSSUpscalerInstancesPerViewFamily)
checkf(DLSSQualityMode != EDLSSQualityMode::NumValues, TEXT("Invalid Quality mode, not initialized"));
checkf(IsQualityModeSupported(DLSSQualityMode), TEXT("%u is not a valid Quality mode"), DLSSQualityMode);
// This assert can accidentally hit with small viewrect dimensions (e.g. when resizing an editor view) due to floating point rounding & quantization issues
// e.g. with 33% screen percentage at 1000 DestRect dimension we get 333/1000 = 0.33 but at 10 DestRect dimension we get 3/10 0.3, thus the assert hits
checkf(DestRect.Width() < 100 || GetMinResolutionFractionForQuality(DLSSQualityMode) - 0.01f <= ScaleX && ScaleX <= GetMaxResolutionFractionForQuality(DLSSQualityMode) + 0.01f, TEXT("The current resolution fraction %f is out of the supported DLSS range [%f ... %f] for quality mode %d."), ScaleX, GetMinResolutionFractionForQuality(DLSSQualityMode), GetMaxResolutionFractionForQuality(DLSSQualityMode), DLSSQualityMode);
checkf(DestRect.Height() < 100 || GetMinResolutionFractionForQuality(DLSSQualityMode) - 0.01f <= ScaleY && ScaleY <= GetMaxResolutionFractionForQuality(DLSSQualityMode) + 0.01f, TEXT("The current resolution fraction %f is out of the supported DLSS range [%f ... %f] for quality mode %d."), ScaleY, GetMinResolutionFractionForQuality(DLSSQualityMode), GetMaxResolutionFractionForQuality(DLSSQualityMode), DLSSQualityMode);
const TCHAR* PassName = TEXT("MainUpsampling");
// Create outputs
FDLSSOutputs Outputs;
{
FRDGTextureDesc SceneColorDesc = FRDGTextureDesc::Create2D(
OutputExtent,
PF_FloatRGBA,
FClearValueBinding::Black,
TexCreate_ShaderResource | TexCreate_UAV);
const TCHAR* OutputName = TEXT("DLSSOutputSceneColor");
Outputs.SceneColor = GraphBuilder.CreateTexture(
SceneColorDesc,
OutputName);
}
FDLSSStateRef DLSSState = (InputCustomHistory && InputCustomHistory->DLSSState) ? InputCustomHistory->DLSSState : MakeShared<FDLSSState, ESPMode::ThreadSafe>();
{
FDLSSShaderParameters* PassParameters = GraphBuilder.AllocParameters<FDLSSShaderParameters>();
// Set up common shader parameters
const FIntPoint InputExtent = Inputs.SceneColorInput->Desc.Extent;
const FIntRect InputViewRect = Inputs.InputViewRect;
const FIntRect OutputViewRect = Inputs.OutputViewRect;
// Input buffer shader parameters
{
PassParameters->SceneColorInput = Inputs.SceneColorInput;
PassParameters->SceneDepthInput = Inputs.SceneDepthInput;
PassParameters->SceneVelocityInput = Inputs.SceneVelocityInput;
PassParameters->EyeAdaptation = GetEyeAdaptationTexture(GraphBuilder, View);
}
// Outputs
{
PassParameters->SceneColorOutput = Outputs.SceneColor;
}
const FVector2D JitterOffset = View.TemporalJitterPixels;
#if ENGINE_MAJOR_VERSION < 5
const float DeltaWorldTime = View.Family->DeltaWorldTime;
#else
const float DeltaWorldTime = View.Family->Time.GetDeltaWorldTimeSeconds();
#endif
const float PreExposure = View.PreExposure;
const bool bUseAutoExposure = CVarNGXDLSSAutoExposure.GetValueOnRenderThread() != 0;
const bool bReleaseMemoryOnDelete = CVarNGXDLSSReleaseMemoryOnDelete.GetValueOnRenderThread() != 0;
const float Sharpness = FMath::Clamp(CVarNGXDLSSSharpness.GetValueOnRenderThread(), -1.0f, 1.0f);
NGXRHI* LocalNGXRHIExtensions = this->NGXRHIExtensions;
const int32 NGXPerfQuality = ToNGXQuality(DLSSQualityMode);
GraphBuilder.AddPass(
RDG_EVENT_NAME("DLSS %s%s %dx%d -> %dx%d",
PassName,
Sharpness != 0.0f ? TEXT(" Sharpen") : TEXT(""),
SrcRect.Width(), SrcRect.Height(),
DestRect.Width(), DestRect.Height()),
PassParameters,
ERDGPassFlags::Compute | ERDGPassFlags::Raster | ERDGPassFlags::SkipRenderPass,
[LocalNGXRHIExtensions, PassParameters, Inputs, bCameraCut, JitterOffset, DeltaWorldTime, PreExposure, Sharpness, NGXPerfQuality, DLSSState, bUseAutoExposure, bReleaseMemoryOnDelete](FRHICommandListImmediate& RHICmdList)
{
FRHIDLSSArguments DLSSArguments;
FMemory::Memzero(&DLSSArguments, sizeof(DLSSArguments));
// input parameters
DLSSArguments.SrcRect = Inputs.InputViewRect;
DLSSArguments.DestRect = Inputs.OutputViewRect;
DLSSArguments.Sharpness = Sharpness;
DLSSArguments.bReset = bCameraCut;
#if ENGINE_MAJOR_VERSION < 5
DLSSArguments.JitterOffset = JitterOffset;
DLSSArguments.MotionVectorScale = FVector2D(1.0f, 1.0f);
#else
DLSSArguments.JitterOffset = FVector2f(JitterOffset); // LWC_TODO: Precision loss
DLSSArguments.MotionVectorScale = FVector2f::UnitVector;
#endif ENGINE_MAJOR_VERSION
DLSSArguments.bHighResolutionMotionVectors = Inputs.bHighResolutionMotionVectors;
DLSSArguments.DeltaTime = DeltaWorldTime;
DLSSArguments.bReleaseMemoryOnDelete = bReleaseMemoryOnDelete;
DLSSArguments.PerfQuality = NGXPerfQuality;
check(PassParameters->SceneColorInput);
PassParameters->SceneColorInput->MarkResourceAsUsed();
DLSSArguments.InputColor = PassParameters->SceneColorInput->GetRHI();
check(PassParameters->SceneVelocityInput);
PassParameters->SceneVelocityInput->MarkResourceAsUsed();
DLSSArguments.InputMotionVectors = PassParameters->SceneVelocityInput->GetRHI();
check(PassParameters->SceneDepthInput);
PassParameters->SceneDepthInput->MarkResourceAsUsed();
DLSSArguments.InputDepth = PassParameters->SceneDepthInput->GetRHI();
check(PassParameters->EyeAdaptation);
PassParameters->EyeAdaptation->MarkResourceAsUsed();
DLSSArguments.InputExposure = PassParameters->EyeAdaptation->GetRHI();
DLSSArguments.PreExposure = PreExposure;
DLSSArguments.bUseAutoExposure = bUseAutoExposure;
// output images
check(PassParameters->SceneColorOutput);
PassParameters->SceneColorOutput->MarkResourceAsUsed();
DLSSArguments.OutputColor = PassParameters->SceneColorOutput->GetRHI();
RHICmdList.TransitionResource(ERHIAccess::UAVMask, DLSSArguments.OutputColor);
RHICmdList.EnqueueLambda(
[LocalNGXRHIExtensions, DLSSArguments, DLSSState](FRHICommandListImmediate& Cmd) mutable
{
const uint32 FeatureCreationNode = CVarNGXDLSSFeatureCreationNode.GetValueOnRenderThread();
const uint32 FeatureVisibilityMask = CVarNGXDLSSFeatureVisibilityMask.GetValueOnRenderThread();
DLSSArguments.GPUNode = FeatureCreationNode == -1 ? Cmd.GetGPUMask().ToIndex() : FMath::Clamp(FeatureCreationNode, 0u, GNumExplicitGPUsForRendering - 1);
DLSSArguments.GPUVisibility = FeatureVisibilityMask == -1 ? Cmd.GetGPUMask().GetNative() : (Cmd.GetGPUMask().All().GetNative() & FeatureVisibilityMask) ;
LocalNGXRHIExtensions->ExecuteDLSS(Cmd, DLSSArguments, DLSSState);
});
});
}
if (!View.bStatePrevViewInfoIsReadOnly && OutputHistory)
{
OutputHistory->SafeRelease();
GraphBuilder.QueueTextureExtraction(Outputs.SceneColor, &OutputHistory->RT[0]);
OutputHistory->ViewportRect = DestRect;
OutputHistory->ReferenceBufferSize = OutputExtent;
}
if (!View.bStatePrevViewInfoIsReadOnly && OutputCustomHistoryInterface)
{
if (!OutputCustomHistoryInterface->GetReference())
{
(*OutputCustomHistoryInterface) = new FDLSSUpscalerHistory(DLSSState);
}
}
return Outputs;
}
void FDLSSUpscaler::Tick(FRHICommandListImmediate& RHICmdList)
{
check(NGXRHIExtensions);
check(IsInRenderingThread());
// Pass it over to the RHI thread which handles the lifetime of the NGX DLSS resources
RHICmdList.EnqueueLambda(
[this](FRHICommandListImmediate& Cmd)
{
NGXRHIExtensions->TickPoolElements();
});
}
bool FDLSSUpscaler::IsQualityModeSupported(EDLSSQualityMode InQualityMode) const
{
return ResolutionSettings[ToNGXQuality(InQualityMode)].bIsSupported;
}
bool FDLSSUpscaler::IsDLSSActive() const
{
static const auto CVarTemporalAAUpscaler = IConsoleManager::Get().FindConsoleVariable(TEXT("r.TemporalAA.Upscaler"));
const bool bDLSSActive =
#if DLSS_ENGINE_HAS_GTEMPORALUPSCALER
((GTemporalUpscaler == this) || IsValidUpscalerInstance(this)) &&
#else
((GCustomStaticScreenPercentage == this) || IsValidUpscalerInstance(this)) &&
#endif
CVarTemporalAAUpscaler && (CVarTemporalAAUpscaler->GetInt() != 0) &&
((CVarNGXDLSSEnable.GetValueOnAnyThread() != 0) || CVarNGXDLAAEnable.GetValueOnAnyThread());
return bDLSSActive;
}
void FDLSSUpscaler::SetupMainGameViewFamily(FSceneViewFamily& ViewFamily)
{
const bool bDLSSActiveWithAutomation = !GIsAutomationTesting || (GIsAutomationTesting && (CVarNGXDLSSAutomationTesting.GetValueOnAnyThread() != 0));
if (IsDLSSActive() && bDLSSActiveWithAutomation)
{
#if DLSS_ENGINE_HAS_GTEMPORALUPSCALER
checkf(GTemporalUpscaler == this, TEXT("GTemporalUpscaler is not set to a DLSS upscaler . Please check that only one upscaling plugin is active."));
#endif
checkf(GCustomStaticScreenPercentage == this, TEXT("GCustomStaticScreenPercentage is not set to a DLSS upscaler. Please check that only one upscaling plugin is active."));
if (!GIsEditor || (GIsEditor && GIsPlayInEditorWorld && EnableDLSSInPlayInEditorViewports()))
{
bool bIsDLAAMode = IsDLAAMode();
EDLSSQualityMode DLSSQuality;
if (bIsDLAAMode)
{
DLSSQuality = EDLSSQualityMode::Quality;
}
else if (IsAutoQualityMode())
{
TOptional<EDLSSQualityMode> MaybeDLSSQuality = GetAutoQualityModeFromViewFamily(ViewFamily);
if (!MaybeDLSSQuality.IsSet())
{
return;
}
else
{
DLSSQuality = MaybeDLSSQuality.GetValue();
}
}
else
{
DLSSQuality = GetSupportedQualityModeFromCVarValue(CVarNGXDLSSPerfQualitySetting.GetValueOnGameThread());
}
ViewFamily.SetTemporalUpscalerInterface(GetUpscalerInstanceForViewFamily(this, DLSSQuality));
if (ViewFamily.EngineShowFlags.ScreenPercentage && !ViewFamily.GetScreenPercentageInterface())
{
// DLSS uses recommended resolution fraction, DLAA forces a 1.0 scale
float ResolutionFraction = 1.0f;
if (!bIsDLAAMode)
{
ResolutionFraction = GetOptimalResolutionFractionForQuality(DLSSQuality);
}
ViewFamily.SetScreenPercentageInterface(new FLegacyScreenPercentageDriver(
ViewFamily, ResolutionFraction
#if SUPPORTS_POSTPROCESSING_SCREEN_PERCENTAGE
/* AllowPostProcessSettingsScreenPercentage = */ , false
#endif
));
}
}
}
}
#if DLSS_ENGINE_SUPPORTS_CSSPD
void FDLSSUpscaler::SetupViewFamily(FSceneViewFamily& ViewFamily, TSharedPtr<ICustomStaticScreenPercentageData> InScreenPercentageDataInterface)
{
check(InScreenPercentageDataInterface.IsValid());
TSharedPtr<FDLSSViewportQualitySetting> ScreenPercentageData = StaticCastSharedPtr<FDLSSViewportQualitySetting>(InScreenPercentageDataInterface);
EDLSSQualityMode Quality = static_cast<EDLSSQualityMode>(ScreenPercentageData->QualitySetting);
const bool bIsDLAAMode = ScreenPercentageData->bDLAAEnabled;
if (bIsDLAAMode)
{
Quality = EDLSSQualityMode::Quality;
}
if (!IsQualityModeSupported(Quality))
{
UE_LOG(LogDLSS, Warning, TEXT("DLSS Quality mode is not supported %d"), Quality);
return;
}
const bool bDLSSActiveWithAutomation = !GIsAutomationTesting || (GIsAutomationTesting && (CVarNGXDLSSAutomationTesting.GetValueOnAnyThread() != 0));
if (IsDLSSActive() && bDLSSActiveWithAutomation)
{
#if DLSS_ENGINE_HAS_GTEMPORALUPSCALER
checkf(GTemporalUpscaler == this, TEXT("GTemporalUpscaler is not set to a DLSS upscaler . Please check that only one upscaling plugin is active."));
#endif
checkf(GCustomStaticScreenPercentage == this, TEXT("GCustomStaticScreenPercentage is not set to a DLSS upscaler. Please check that only one upscaling plugin is active."));
ViewFamily.SetTemporalUpscalerInterface(GetUpscalerInstanceForViewFamily(this, Quality));
if (ViewFamily.EngineShowFlags.ScreenPercentage && !ViewFamily.GetScreenPercentageInterface())
{
const float ResolutionFraction = bIsDLAAMode ? 1.0f : GetOptimalResolutionFractionForQuality(Quality);
ViewFamily.SetScreenPercentageInterface(new FLegacyScreenPercentageDriver(
ViewFamily, ResolutionFraction
#if SUPPORTS_POSTPROCESSING_SCREEN_PERCENTAGE
/* AllowPostProcessSettingsScreenPercentage = */ , false
#endif
));
}
}
}
#endif
TOptional<EDLSSQualityMode> FDLSSUpscaler::GetAutoQualityModeFromViewFamily(const FSceneViewFamily& ViewFamily) const
{
if (ensure(ViewFamily.RenderTarget != nullptr))
{
FIntPoint ViewSize = ViewFamily.RenderTarget->GetSizeXY();
int32 Pixels = ViewSize.X * ViewSize.Y;
return GetAutoQualityModeFromPixels(Pixels);
}
return TOptional<EDLSSQualityMode> {};
}
TOptional<EDLSSQualityMode> FDLSSUpscaler::GetAutoQualityModeFromPixels(int PixelCount) const
{
if (PixelCount >= 8'300'000 && IsQualityModeSupported(EDLSSQualityMode::UltraPerformance))
{
return EDLSSQualityMode::UltraPerformance;
}
else if (PixelCount >= 3'690'000 && IsQualityModeSupported(EDLSSQualityMode::Performance))
{
return EDLSSQualityMode::Performance;
}
else if (PixelCount >= 2'030'000 && IsQualityModeSupported(EDLSSQualityMode::Quality))
{
return EDLSSQualityMode::Quality;
}
return TOptional<EDLSSQualityMode> {};
}
bool FDLSSUpscaler::EnableDLSSInPlayInEditorViewports() const
{
if (GetDefault<UDLSSOverrideSettings>()->EnableDLSSInPlayInEditorViewportsOverride == EDLSSSettingOverride::UseProjectSettings)
{
return GetDefault<UDLSSSettings>()->bEnableDLSSInPlayInEditorViewports;
}
else
{
return GetDefault<UDLSSOverrideSettings>()->EnableDLSSInPlayInEditorViewportsOverride == EDLSSSettingOverride::Enabled;
}
}
float FDLSSUpscaler::GetMinUpsampleResolutionFraction() const
{
return MinResolutionFraction;
}
float FDLSSUpscaler::GetMaxUpsampleResolutionFraction() const
{
return MaxResolutionFraction;
}
float FDLSSUpscaler::GetOptimalResolutionFractionForQuality(EDLSSQualityMode Quality) const
{
checkf(IsQualityModeSupported(Quality),TEXT("%u is not a valid Quality mode"), Quality);
return ResolutionSettings[ToNGXQuality(Quality)].OptimalResolutionFraction;
}
float FDLSSUpscaler::GetOptimalSharpnessForQuality(EDLSSQualityMode Quality) const
{
checkf(IsQualityModeSupported(Quality), TEXT("%u is not a valid Quality mode"), Quality);
return ResolutionSettings[ToNGXQuality(Quality)].Sharpness;
}
float FDLSSUpscaler::GetMinResolutionFractionForQuality(EDLSSQualityMode Quality) const
{
checkf(IsQualityModeSupported(Quality), TEXT("%u is not a valid Quality mode"), Quality);
return ResolutionSettings[ToNGXQuality(Quality)].MinResolutionFraction;
}
float FDLSSUpscaler::GetMaxResolutionFractionForQuality(EDLSSQualityMode Quality) const
{
checkf(IsQualityModeSupported(Quality), TEXT("%u is not a valid Quality mode"), Quality);
return ResolutionSettings[ToNGXQuality(Quality)].MaxResolutionFraction;
}
bool FDLSSUpscaler::IsFixedResolutionFraction(EDLSSQualityMode Quality) const
{
checkf(IsQualityModeSupported(Quality), TEXT("%u is not a valid Quality mode"), Quality);
return ResolutionSettings[ToNGXQuality(Quality)].IsFixedResolution();
}
#undef LOCTEXT_NAMESPACE
@@ -1,189 +0,0 @@
/*
* Copyright (c) 2020 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
#pragma once
#include "CoreMinimal.h"
#include "RendererInterface.h"
#include "PostProcess/TemporalAA.h"
#include "ScreenPass.h"
#include "NGXRHI.h"
#include "DLSSSettings.h"
#include "CustomStaticScreenPercentage.h"
#include "CustomResourcePool.h"
class FSceneTextureParameters;
struct FTemporalAAHistory;
class FRHITexture;
class NGXRHI;
struct FDLSSOptimalSettings;
struct FDLSSPassParameters
{
FIntRect InputViewRect;
FIntRect OutputViewRect;
bool bHighResolutionMotionVectors = false;
FRDGTexture* SceneColorInput = nullptr;
FRDGTexture* SceneVelocityInput = nullptr;
FRDGTexture* SceneDepthInput = nullptr;
FDLSSPassParameters(const FViewInfo& View)
: InputViewRect(View.ViewRect)
, OutputViewRect(FIntPoint::ZeroValue, View.GetSecondaryViewRectSize())
{
}
/** Returns the texture resolution that will be output. */
FIntPoint GetOutputExtent() const;
/** Validate the settings of TAA, to make sure there is no issue. */
bool Validate() const;
};
struct FDLSSOutputs
{
FRDGTexture* SceneColor = nullptr;
};
enum class EDLSSQualityMode
{
MinValue = -2,
UltraPerformance = -2,
Performance = -1,
Balanced = 0,
Quality = 1,
UltraQuality = 2,
MaxValue = UltraQuality,
NumValues = 5
};
class DLSS_API FDLSSUpscaler final : public ITemporalUpscaler, public ICustomStaticScreenPercentage, public ICustomResourcePool
{
friend class FDLSSModule;
public:
FDLSSUpscaler(const FDLSSUpscaler* InUpscaler, EDLSSQualityMode InQualityMode);
virtual ~FDLSSUpscaler();
// Inherited via ITemporalUpscaler
virtual const TCHAR* GetDebugName() const final;
#if DLSS_ENGINE_ADDPASSES_RETURN_THROUGH_PARAMS
virtual void AddPasses(
#else
virtual ITemporalUpscaler::FOutputs AddPasses(
#endif
FRDGBuilder& GraphBuilder,
const FViewInfo& View,
const FPassInputs& PassInputs
#if DLSS_ENGINE_ADDPASSES_RETURN_THROUGH_PARAMS
, FRDGTextureRef* OutSceneColorTexture
, FIntRect* OutSceneColorViewRect
, FRDGTextureRef* OutSceneColorHalfResTexture
, FIntRect* OutSceneColorHalfResViewRect
#endif
) const final;
// Inherited via ICustomStaticScreenPercentage
virtual void SetupMainGameViewFamily(FSceneViewFamily& ViewFamily) final;
#if DLSS_ENGINE_SUPPORTS_CSSPD
/** Allows to setup View Family directly. To be used by modules that are aware of DLSS Plugin. */
virtual void SetupViewFamily(FSceneViewFamily& ViewFamily, TSharedPtr<ICustomStaticScreenPercentageData> InScreenPercentageDataInterface) final;
#endif
virtual float GetMinUpsampleResolutionFraction() const final;
virtual float GetMaxUpsampleResolutionFraction() const final;
float GetOptimalResolutionFractionForQuality(EDLSSQualityMode Quality) const;
float GetOptimalSharpnessForQuality(EDLSSQualityMode Quality) const;
float GetMinResolutionFractionForQuality(EDLSSQualityMode Quality) const;
float GetMaxResolutionFractionForQuality(EDLSSQualityMode Quality) const;
bool IsFixedResolutionFraction(EDLSSQualityMode Quality) const;
const NGXRHI* GetNGXRHI() const
{
return NGXRHIExtensions;
}
// Inherited via ICustomResourcePool
virtual void Tick(FRHICommandListImmediate& RHICmdList) override;
bool IsQualityModeSupported(EDLSSQualityMode InQualityMode) const;
uint32 GetNumRuntimeQualityModes() const
{
return NumRuntimeQualityModes;
}
bool IsDLSSActive() const;
static FDLSSUpscaler* GetUpscalerInstanceForViewFamily(const FDLSSUpscaler* InUpscaler, EDLSSQualityMode InQualityMode);
static bool IsValidUpscalerInstance(const ITemporalUpscaler* InUpscaler);
static bool IsDLAAMode();
static bool IsAutoQualityMode();
static void SetAutoQualityMode(bool bAutoQualityMode);
// Give the suggested EDLSSQualityMode if one is appropriate for the given pixel count, or nothing if DLSS should be disabled
TOptional<EDLSSQualityMode> GetAutoQualityModeFromPixels(int PixelCount) const;
static void ReleaseStaticResources();
private:
FDLSSUpscaler(NGXRHI* InNGXRHIExtensions);
FDLSSUpscaler(const FDLSSUpscaler&) = default;
EDLSSQualityMode GetSupportedQualityModeFromCVarValue(int32 InCVarValue) const
{
checkf(NumRuntimeQualityModes, TEXT("This should only be called from the higher level code when DLSS is supported") );
static_assert(int32(EDLSSQualityMode::NumValues) == 5, "dear DLSS plugin NVIDIA developer, please update this code to handle the new EDLSSQualityMode enum values");
for (auto QualityMode : { EDLSSQualityMode::UltraPerformance, EDLSSQualityMode::Performance , EDLSSQualityMode::Balanced, EDLSSQualityMode::Quality, EDLSSQualityMode::UltraQuality })
{
if (InCVarValue == static_cast<int32>(QualityMode) && IsQualityModeSupported(QualityMode))
{
return QualityMode;
}
}
return EDLSSQualityMode::Balanced;
}
TOptional<EDLSSQualityMode> GetAutoQualityModeFromViewFamily(const FSceneViewFamily& ViewFamily) const;
bool EnableDLSSInPlayInEditorViewports() const;
FDLSSOutputs AddDLSSPass(
FRDGBuilder& GraphBuilder,
const FViewInfo& View,
const FDLSSPassParameters& Inputs,
const FTemporalAAHistory& InputHistory,
FTemporalAAHistory* OutputHistory,
const TRefCountPtr<ICustomTemporalAAHistory> InputCustomHistoryInterface,
TRefCountPtr<ICustomTemporalAAHistory>* OutputCustomHistoryInterface
) const;
EDLSSQualityMode DLSSQualityMode = EDLSSQualityMode::NumValues;
// The FDLSSUpscaler(NGXRHI*) will update those once
static NGXRHI* NGXRHIExtensions;
static float MinResolutionFraction;
static float MaxResolutionFraction;
static uint32 NumRuntimeQualityModes;
static TArray<FDLSSOptimalSettings> ResolutionSettings;
static TStaticArray <TSharedPtr<FDLSSUpscaler>, uint32(EDLSSQualityMode::NumValues)> DLSSUpscalerInstancesPerViewFamily;
};
@@ -1,44 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include "DLSSUpscalerHistory.h"
#include "DLSSUpscalerPrivate.h"
#include "NGXRHI.h"
#include "PostProcess/SceneRenderTargets.h"
#include "PostProcess/PostProcessing.h"
#define LOCTEXT_NAMESPACE "FDLSSModule"
FDLSSUpscalerHistory::FDLSSUpscalerHistory(FDLSSStateRef InDLSSState)
: DLSSState(InDLSSState)
{
}
FDLSSUpscalerHistory::~FDLSSUpscalerHistory()
{
}
#undef LOCTEXT_NAMESPACE
@@ -1,53 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "CoreMinimal.h"
#include "SceneRendering.h"
#include "NGXRHI.h"
class DLSS_API FDLSSUpscalerHistory final : public ICustomTemporalAAHistory, public FRefCountBase
{
friend class FDLSSUpscaler;
FDLSSStateRef DLSSState;
virtual uint32 AddRef() const final
{
return FRefCountBase::AddRef();
}
virtual uint32 Release() const final
{
return FRefCountBase::Release();
}
virtual uint32 GetRefCount() const final
{
return FRefCountBase::GetRefCount();
}
FDLSSUpscalerHistory(FDLSSStateRef InDLSSState);
~FDLSSUpscalerHistory();
};
@@ -1,26 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "CoreMinimal.h"
DECLARE_LOG_CATEGORY_EXTERN(LogDLSS, Verbose, All);
-74
View File
@@ -1,74 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "Modules/ModuleManager.h"
class FDLSSUpscaler;
class FDLSSDenoiser;
class FNGXAutomationViewExtension;
class NGXRHI;
enum class EDLSSSupport : uint8
{
Supported,
NotSupported,
NotSupportedIncompatibleHardware,
NotSupportedDriverOutOfDate,
NotSupportedOperatingSystemOutOfDate,
NotSupportedIncompatibleAPICaptureToolActive,
};
class IDLSSModuleInterface : public IModuleInterface
{
public:
virtual EDLSSSupport QueryDLSSSupport() const = 0;
virtual void GetDLSSMinDriverVersion(int32& MajorVersion, int32& MinorVersion) const = 0;
virtual float GetResolutionFractionForQuality(int32 Quality) const = 0;
virtual FDLSSUpscaler* GetDLSSUpscaler() const = 0;
};
class FDLSSModule final: public IDLSSModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule();
virtual void ShutdownModule();
// Inherited via IDLSSModuleInterface
virtual EDLSSSupport QueryDLSSSupport() const;
virtual void GetDLSSMinDriverVersion(int32& MajorVersion, int32& MinorVersion) const;
virtual float GetResolutionFractionForQuality(int32 Quality) const;
virtual FDLSSUpscaler* GetDLSSUpscaler() const ;
private:
TUniquePtr<FDLSSUpscaler> DLSSUpscaler;
TUniquePtr<FDLSSDenoiser> DLSSDenoiser;
TUniquePtr<NGXRHI> NGXRHIExtensions;
TSharedPtr< FNGXAutomationViewExtension, ESPMode::ThreadSafe> NGXAutomationViewExtension;
EDLSSSupport DLSSSupport = EDLSSSupport::NotSupported;
int32 MinDriverVersionMinor;
int32 MinDriverVersionMajor;
};
@@ -1,121 +0,0 @@
/*
* Copyright (c) 2020 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
#pragma once
#include "UObject/ObjectMacros.h"
#include "UObject/Object.h"
#include "Engine/DeveloperSettings.h"
#include "CustomStaticScreenPercentage.h"
#include "Runtime/Launch/Resources/Version.h"
#include "DLSSSettings.generated.h"
UENUM()
enum class EDLSSSettingOverride : uint8
{
Enabled UMETA(DisplayName = "True"),
Disabled UMETA(DisplayName = "False"),
UseProjectSettings UMETA(DisplayName = "Use project settings"),
};
UCLASS(Config = Engine, ProjectUserConfig)
class DLSS_API UDLSSOverrideSettings : public UObject
{
public:
GENERATED_BODY()
/** This enables DLSS in editor viewports. Saved to local user config only.*/
UPROPERTY(Config, EditAnywhere, Category = "Level Editor - Viewport (Local)", DisplayName = "Enable DLSS to be turned on in Editor viewports")
EDLSSSettingOverride EnableDLSSInEditorViewportsOverride = EDLSSSettingOverride::UseProjectSettings;
/** This setting enables adjusting the screenpercentage directly in the editor, outside of the optimized DLSS quality modes. Saved to local user config only.*/
UPROPERTY(Config, EditAnywhere, Category = "Level Editor - Viewport (Local)", DisplayName = "Enable Screenpercentage Manipulation in DLSS Editor Viewports")
EDLSSSettingOverride EnableScreenpercentageManipulationInDLSSEditorViewportsOverride = EDLSSSettingOverride::UseProjectSettings;
/** This enables DLSS in play in editor viewports. Saved to local user config only. */
UPROPERTY(Config, EditAnywhere, Category = "Level Editor - Viewport (Local)", DisplayName = "Enable DLSS in Play In Editor viewports")
EDLSSSettingOverride EnableDLSSInPlayInEditorViewportsOverride = EDLSSSettingOverride::UseProjectSettings;
/** This enables warnings about plugins & tools that are incompatible with DLSS in the editor. Saved to local user config only. */
UPROPERTY(Config, EditAnywhere, Category = "Editor (Local)", DisplayName = "Warn about incompatible plugins and tools")
bool bShowDLSSIncompatiblePluginsToolsWarnings = true;
/** This enables on screen warnings and errors about DLSS */
UPROPERTY(Config, EditAnywhere, Category = "Editor (Local)", DisplayName = "Show various DLSS on screen debug messages")
EDLSSSettingOverride ShowDLSSSDebugOnScreenMessages = EDLSSSettingOverride::UseProjectSettings;
};
UCLASS(Config = Engine, DefaultConfig, DisplayName="NVIDIA DLSS")
class DLSS_API UDLSSSettings: public UObject
{
GENERATED_BODY()
private:
public:
/** Enable DLSS for D3D12, if the driver supports it at runtime */
UPROPERTY(Config, EditAnywhere, Category = "Platforms", DisplayName = "Enable DLSS for the D3D12RHI")
bool bEnableDLSSD3D12 = PLATFORM_WINDOWS;
/** Enable DLSS for D3D11, if the driver supports it at runtime */
UPROPERTY(Config, EditAnywhere, Category = "Platforms", DisplayName = "Enable DLSS for the D3D11RHI")
bool bEnableDLSSD3D11 = PLATFORM_WINDOWS;
/** Enable DLSS for Vulkan, if the driver supports it at runtime */
UPROPERTY(Config, EditAnywhere, Category = "Platforms", DisplayName = "Enable DLSS for the VulkanRHI")
bool bEnableDLSSVulkan = PLATFORM_WINDOWS;
/** This enables DLSS in editor viewports. This project wide setting can be locally overridden in the NVIDIA DLSS (Local) settings.*/
UPROPERTY(Config, EditAnywhere, Category = "Level Editor - Viewport", DisplayName = "Enable DLSS to be turned on in Editor viewports")
bool bEnableDLSSInEditorViewports = true;
/** This setting enables adjusting the screenpercentage directly in the editor, outside of the optimized DLSS quality modes. This project wide setting can be locally overridden in the NVIDIA DLSS (Local) settings.*/
UPROPERTY(Config = Editor, EditAnywhere, Category = "Level Editor - Viewport", DisplayName = "Enable Screenpercentage Manipulation in DLSS Editor Viewports")
bool bEnableScreenpercentageManipulationInDLSSEditorViewports = false;
/** This enables DLSS in play in editor viewports. This project wide setting can be locally overridden in in the NVIDIA DLSS (Local) settings.*/
UPROPERTY(Config, EditAnywhere, Category = "Level Editor - Viewport", DisplayName = "Enable DLSS in Play In Editor viewports")
bool bEnableDLSSInPlayInEditorViewports = true;
/** This enables on screen warnings and errors about DLSS. This project wide setting can be locally overridden in the NVIDIA DLSS (Local) settings. */
UPROPERTY(Config, EditAnywhere, Category = "Level Editor - Viewport", DisplayName = "Show various DLSS on screen debug messages")
bool bShowDLSSSDebugOnScreenMessages = true;
/** This is part of the DLSS plugin and used by most projects*/
UPROPERTY(VisibleAnywhere, Config, Category = "General Settings", DisplayName = "Generic DLSS Binary Path")
FString GenericDLSSBinaryPath;
UPROPERTY(VisibleAnywhere, Config, Category = "General Settings", DisplayName = "Exists")
bool bGenericDLSSBinaryExists;
/** By default the DLSS plugin uses the UE Project ID to initalize DLSS. In some cases NVIDIA might provide a separate NVIDIA Application ID, which should be put here. Please refer to https://developer.nvidia.com/dlss for details*/
UPROPERTY(Config, EditAnywhere, Category = "General Settings", DisplayName = "NVIDIA NGX Application ID", AdvancedDisplay)
uint32 NVIDIANGXApplicationId;
/** In some cases NVIDIA might provide a project specific DLSS binary for your project. Please refer to https://developer.nvidia.com/dlss for details*/
UPROPERTY(VisibleAnywhere, Config, Category = "General Settings", DisplayName = "Custom DLSS Binary Path", AdvancedDisplay)
FString CustomDLSSBinaryPath;
UPROPERTY(VisibleAnywhere, Config, Category = "General Settings", DisplayName = "Exists", AdvancedDisplay)
bool bCustomDLSSBinaryExists;
};
// This is publically defined in the .Build.cs so it can key off branch names, which is not feasible to do with the preprocessor
#if DLSS_ENGINE_SUPPORTS_CSSPD
class FDLSSViewportQualitySetting final : public ICustomStaticScreenPercentageData
{
public:
int32 QualitySetting = 0;
bool bDLAAEnabled = false;
};
#endif
@@ -1,95 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
using UnrealBuildTool;
using System.IO;
public class DLSSBlueprint : ModuleRules
{
protected virtual bool IsSupportedPlatform(ReadOnlyTargetRules Target)
{
return Target.Platform == UnrealTargetPlatform.Win64;
}
public DLSSBlueprint(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"Engine",
"RenderCore",
"Renderer",
"Projects",
}
);
// for ITemporalUpscaler in PostProcess/TemporalAA.h
PrivateIncludePaths.AddRange(
new string[] {
EngineDirectory + "/Source/Runtime/Renderer/Private",
// ... add other private include paths required here ...
}
);
bool bPlatformSupportsDLSS = IsSupportedPlatform(Target);
PublicDefinitions.Add("WITH_DLSS=" + (bPlatformSupportsDLSS ? '1' : '0'));
if (bPlatformSupportsDLSS)
{
PublicIncludePaths.AddRange(
new string[]
{
Path.Combine(ModuleDirectory, "../DLSS/Public"),
}
);
PrivateIncludePaths.AddRange(
new string[]
{
Path.Combine(EngineDirectory,"Source/Runtime/Renderer/Private"),
Path.Combine(ModuleDirectory, "../DLSS/Private")
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"NGX",
"NGXRHI",
"DLSS",
}
);
}
}
}
@@ -1,725 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include "DLSSLibrary.h"
#if WITH_DLSS
#include "DLSS.h"
#include "DLSSSettings.h"
#include "DLSSUpscaler.h"
#include "NGXRHI.h"
#endif
#include "PostProcess/TemporalAA.h"
#include "Modules/ModuleManager.h"
#include "Interfaces/IPluginManager.h"
#include "ShaderCore.h"
#define LOCTEXT_NAMESPACE "FDLSSBlueprintModule"
DEFINE_LOG_CATEGORY_STATIC(LogDLSSBlueprint, Log, All);
static TAutoConsoleVariable<int32> CVarNGXDLSSPreferNISSharpen(
TEXT("r.NGX.DLSS.PreferNISSharpen"),
2,
TEXT("Prefer sharpening with an extra NIS plugin sharpening pass instead of DLSS sharpening if the NIS plugin is also enabled for the project. (default: true)\n")
TEXT("Requires UE4.27.1 and the NIS plugin to be enabled, DLSS sharpening will be used otherwise \n")
TEXT(" 0: Softening/sharpening with the DLSS pass.\n")
TEXT(" 1: Sharpen with the NIS plugin. Softening is not supported. Requires the NIS plugin to be enabled.\n")
TEXT(" 2: Sharpen with the NIS plugin. Softening (i.e. negative sharpness)with the DLSS plugin. Requires the NIS plugin to be enabled.\n")
TEXT("Note: This cvar is only evaluated when using the `SetDLSSSharpness` Blueprint function, from either C++ or a Blueprint event graph!"),
ECVF_RenderThreadSafe);
static const FName SetDLSSModeInvalidEnumValueError= FName("SetDLSSModeInvalidEnumValueError");
static const FName IsDLSSModeSupportedInvalidEnumValueError = FName("IsDLSSModeSupportedInvalidEnumValueError");
UDLSSSupport UDLSSLibrary::DLSSSupport = UDLSSSupport::NotSupportedByPlatformAtBuildTime;
#if WITH_DLSS
int32 UDLSSLibrary::MinDLSSDriverVersionMajor = 0;
int32 UDLSSLibrary::MinDLSSDriverVersionMinor = 0;
FDLSSUpscaler* UDLSSLibrary::DLSSUpscaler = nullptr;
bool UDLSSLibrary::bDLSSLibraryInitialized = false;
static bool ShowDLSSSDebugOnScreenMessages()
{
if (GetDefault<UDLSSOverrideSettings>()->ShowDLSSSDebugOnScreenMessages == EDLSSSettingOverride::UseProjectSettings)
{
return GetDefault<UDLSSSettings>()->bShowDLSSSDebugOnScreenMessages;
}
else
{
return GetDefault<UDLSSOverrideSettings>()->ShowDLSSSDebugOnScreenMessages == EDLSSSettingOverride::Enabled;
}
}
#if !UE_BUILD_SHIPPING
UDLSSLibrary::FDLSSErrorState UDLSSLibrary::DLSSErrorState;
FDelegateHandle UDLSSLibrary::DLSSOnScreenMessagesDelegateHandle;
void UDLSSLibrary::GetDLSSOnScreenMessages(TMultiMap<FCoreDelegates::EOnScreenMessageSeverity, FText>& OutMessages)
{
check(IsInGameThread());
// We need a valid DLSSSupport, so calling this here in case other UDLSSLibrary functions which call TryInitDLSSLibrary() haven't been called
if (!TryInitDLSSLibrary())
{
return;
}
if(ShowDLSSSDebugOnScreenMessages())
{
if (DLSSErrorState.bIsDLSSModeUnsupported)
{
const FTextFormat Format(LOCTEXT("DLSSOnScreenDebugSetModeUnsupportedDLSSMode",
"DLSS Error: The DLSS mode \"{0}\" is not supported. This error can be avoided by calling SetDLSSMode({0}) only if IsDLSSModeSupported({0}) returns true."));
const FText Message = FText::Format(Format, StaticEnum<UDLSSMode>()->GetDisplayNameTextByValue(int64(DLSSErrorState.InvalidDLSSMode)));
OutMessages.Add(FCoreDelegates::EOnScreenMessageSeverity::Error, Message);
}
// Checking for "contains" in case virtualization is changing the GPU string
const bool bIsNVIDIA = FWindowsPlatformMisc::GetPrimaryGPUBrand().Contains(TEXT("NVIDIA"));
bool bShowNotSupportedMessage = bIsNVIDIA && (UDLSSSupport::Supported != DLSSSupport);
if ((UDLSSSupport::NotSupportedIncompatibleAPICaptureToolActive == DLSSSupport) && !GetMutableDefault<UDLSSOverrideSettings>()->bShowDLSSIncompatiblePluginsToolsWarnings )
{
bShowNotSupportedMessage = false;
}
if (bShowNotSupportedMessage)
{
const FTextFormat Format(LOCTEXT("DLSSOnScreenDebugDLSSNotSupported",
"DLSS Information: DLSS is not supported due to {0}.Please see the various LogDLSS* categories in the Developer Tools -> Output Log for further detail."));
const FText Message = FText::Format(Format, StaticEnum<UDLSSSupport>()->GetDisplayNameTextByValue(int64(DLSSSupport)));
OutMessages.Add(FCoreDelegates::EOnScreenMessageSeverity::Warning, Message);
}
}
}
#endif
static EDLSSQualityMode ToEDLSSQualityMode(UDLSSMode InDLSSQualityMode)
{
static_assert(int32(EDLSSQualityMode::NumValues) == 5, "dear DLSS plugin NVIDIA developer, please update this code to translate the new EDLSSQualityMode enum values to UDLSSMode");
switch (InDLSSQualityMode)
{
case UDLSSMode::UltraPerformance:
return EDLSSQualityMode::UltraPerformance;
// the higher level code should catch this...
case UDLSSMode::Off:
checkf(InDLSSQualityMode != UDLSSMode::Off, TEXT("ToEDLSSQualityMode should not be called with an InDLSSQualityMode of UDLSSMode::Off from the higher level code"));
default:
checkf(false, TEXT("ToEDLSSQualityMode should not be called with an out of range InDLSSQualityMode %d InDLSSQualityMode from the higher level code"), InDLSSQualityMode);
case UDLSSMode::Performance:
return EDLSSQualityMode::Performance;
case UDLSSMode::Balanced:
return EDLSSQualityMode::Balanced;
case UDLSSMode::Quality:
return EDLSSQualityMode::Quality;
case UDLSSMode::UltraQuality:
return EDLSSQualityMode::UltraQuality;
}
}
int32 UDLSSLibrary::ToDLSSQualityCVarValue(UDLSSMode DLSSMode)
{
return static_cast<int32>(ToEDLSSQualityMode(DLSSMode));
}
#endif
bool UDLSSLibrary::IsDLSSModeSupported(UDLSSMode DLSSMode)
{
const UEnum* Enum = StaticEnum<UDLSSMode>();
// UEnums are strongly typed, but then one can also cast a byte to an UEnum ...
if (Enum->IsValidEnumValue(int64(DLSSMode)) && (Enum->GetMaxEnumValue() != int64(DLSSMode)))
{
if (DLSSMode == UDLSSMode::Off)
{
return true;
}
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("IsDLSSModeSupported should not be called before PostEngineInit"));
return false;
}
if (!IsDLSSSupported())
{
return false;
}
else if (DLSSMode == UDLSSMode::Auto)
{
return true;
}
else
{
return DLSSUpscaler->IsQualityModeSupported(ToEDLSSQualityMode(DLSSMode));
}
#else
return false;
#endif
}
else
{
#if !UE_BUILD_SHIPPING
FFrame::KismetExecutionMessage(*FString::Printf(
TEXT("IsDLSSModeSupported should not be called with an invalid DLSSMode enum value (%d) \"%s\""),
int64(DLSSMode), *StaticEnum<UDLSSMode>()->GetDisplayNameTextByValue(int64(DLSSMode)).ToString()),
ELogVerbosity::Error, IsDLSSModeSupportedInvalidEnumValueError);
#endif
return false;
}
}
void UDLSSLibrary::GetDLSSModeInformation(UDLSSMode DLSSMode, FVector2D ScreenResolution, bool& bIsSupported, float& OptimalScreenPercentage, bool& bIsFixedScreenPercentage, float& MinScreenPercentage, float& MaxScreenPercentage, float& OptimalSharpness)
{
// fall back to TAA for unsupported or DLSS off
OptimalScreenPercentage = 0.0f;
bIsFixedScreenPercentage = false;
MinScreenPercentage = 100.0f * ITemporalUpscaler::GetDefaultTemporalUpscaler()->GetMinUpsampleResolutionFraction();
MaxScreenPercentage = 100.0f * ITemporalUpscaler::GetDefaultTemporalUpscaler()->GetMaxUpsampleResolutionFraction();
OptimalSharpness = 0.0f;
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("GetDLSSModeInformation should not be called before PostEngineInit"));
bIsSupported = false;
return;
}
#endif
bIsSupported = IsDLSSModeSupported(DLSSMode);
#if WITH_DLSS
if ((DLSSMode != UDLSSMode::Off) && bIsSupported)
{
EDLSSQualityMode EDLSSMode;
if (DLSSMode != UDLSSMode::Auto)
{
EDLSSMode = ToEDLSSQualityMode(DLSSMode);
}
else
{
// Auto DLSS mode is based on total pixels
float PixelsFloat = ScreenResolution.X * ScreenResolution.Y;
int32 PixelsInt = (PixelsFloat < static_cast<float>(MAX_int32)) ? static_cast<int32>(PixelsFloat) : MAX_int32;
TOptional<EDLSSQualityMode> MaybeDLSSMode = DLSSUpscaler->GetAutoQualityModeFromPixels(PixelsInt);
if (!MaybeDLSSMode.IsSet())
{
// DLSS Off
return;
}
EDLSSMode = MaybeDLSSMode.GetValue();
}
bIsFixedScreenPercentage = DLSSUpscaler->IsFixedResolutionFraction(EDLSSMode);
OptimalScreenPercentage = 100.0f * DLSSUpscaler->GetOptimalResolutionFractionForQuality(EDLSSMode);
MinScreenPercentage = 100.0f * DLSSUpscaler->GetMinResolutionFractionForQuality(EDLSSMode);
MaxScreenPercentage = 100.0f * DLSSUpscaler->GetMaxResolutionFractionForQuality(EDLSSMode);
OptimalSharpness = DLSSUpscaler->GetOptimalSharpnessForQuality(EDLSSMode);
}
#endif
}
void UDLSSLibrary::GetDLSSScreenPercentageRange(float& MinScreenPercentage, float& MaxScreenPercentage)
{
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("GetDLSSScreenPercentageRange should not be called before PostEngineInit"));
MinScreenPercentage = 100.0f;
MaxScreenPercentage = 100.0f;
return;
}
if (IsDLSSSupported())
{
MinScreenPercentage = 100.0f * DLSSUpscaler->GetMinUpsampleResolutionFraction();
MaxScreenPercentage = 100.0f * DLSSUpscaler->GetMaxUpsampleResolutionFraction();
}
else
#endif
{
MinScreenPercentage = 100.0f;
MaxScreenPercentage = 100.0f;
}
}
TArray<UDLSSMode> UDLSSLibrary::GetSupportedDLSSModes()
{
TArray<UDLSSMode> SupportedQualityModes;
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("GetSupportedDLSSModes should not be called before PostEngineInit"));
return SupportedQualityModes;
}
#endif
{
const UEnum* Enum = StaticEnum<UDLSSMode>();
for (int32 EnumIndex = 0; EnumIndex < Enum->NumEnums(); ++EnumIndex)
{
const int64 EnumValue = Enum->GetValueByIndex(EnumIndex);
if (EnumValue != Enum->GetMaxEnumValue())
{
const UDLSSMode QualityMode = UDLSSMode(EnumValue);
if (IsDLSSModeSupported(QualityMode))
{
SupportedQualityModes.Add(QualityMode);
}
}
}
}
return SupportedQualityModes;
}
bool UDLSSLibrary::IsDLSSSupported()
{
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("IsDLSSSupported should not be called before PostEngineInit"));
return false;
}
return QueryDLSSSupport() == UDLSSSupport::Supported;
#else
return false;
#endif
}
UDLSSSupport UDLSSLibrary::QueryDLSSSupport()
{
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("QueryDLSSSupport should not be called before PostEngineInit"));
return UDLSSSupport::NotSupported;
}
#endif
return DLSSSupport;
}
void UDLSSLibrary::GetDLSSMinimumDriverVersion(int32& MinDriverVersionMajor, int32& MinDriverVersionMinor)
{
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("GetDLSSMinimumDriverVersion should not be called before PostEngineInit"));
}
MinDriverVersionMajor = MinDLSSDriverVersionMajor;
MinDriverVersionMinor = MinDLSSDriverVersionMinor;
#else
MinDriverVersionMajor = 0;
MinDriverVersionMinor = 0;
#endif
}
void UDLSSLibrary::EnableDLAA(bool bEnabled)
{
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("EnableDLAA should not be called before PostEngineInit"));
return;
}
static const auto CVarNGXEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.Enable"));
bool bNGXEnabled = CVarNGXEnable && (CVarNGXEnable->GetInt() != 0);
static auto CVarDLAAEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLAA.Enable"));
if (CVarDLAAEnable)
{
// r.NGX.Enable might be set to 0 via hotfix so disable DLAA too (in case it might come from saved settings)
bool bDLAAEnabled = bNGXEnabled && bEnabled;
CVarDLAAEnable->Set(bDLAAEnabled, ECVF_SetByCommandline);
if (bDLAAEnabled)
{
// DLAA needs to override the temporal upscaler
static const auto CVarUseTemporalAAUpscaler = IConsoleManager::Get().FindConsoleVariable(TEXT("r.TemporalAA.Upscaler"));
CVarUseTemporalAAUpscaler->SetWithCurrentPriority(1);
}
}
#endif
}
bool UDLSSLibrary::IsDLAAEnabled()
{
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("IsDLAAEnabled should not be called before PostEngineInit"));
return false;
}
static const auto CVarNGXEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.Enable"));
const bool bNGXEnabled = CVarNGXEnable && (CVarNGXEnable->GetInt() != 0);
const bool bDLAAEnabled = (DLSSUpscaler != nullptr) && DLSSUpscaler->IsDLAAMode();
return bNGXEnabled && bDLAAEnabled;
#else
return false;
#endif
}
void UDLSSLibrary::SetDLSSMode(UDLSSMode DLSSMode)
{
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("SetDLSSMode should not be called before PostEngineInit"));
return;
}
const UEnum* Enum = StaticEnum<UDLSSMode>();
// UEnums are strongly typed, but then one can also cast a byte to an UEnum ...
if(Enum->IsValidEnumValue(int64(DLSSMode)) && (Enum->GetMaxEnumValue() != int64(DLSSMode)))
{
static const auto CVarNGXEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.Enable"));
const bool bNGXEnabled = CVarNGXEnable && CVarNGXEnable->GetInt();
static auto CVarDLSSEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLSS.Enable"));
if (CVarDLSSEnable)
{
// r.NGX.Enable might be set to 0 via hotfix so set r.NGX.DLSS.Enable to 0 too (in case it might come from saved settings)
const bool bDLSSEnabled = bNGXEnabled && (DLSSMode != UDLSSMode::Off);
CVarDLSSEnable->Set(bDLSSEnabled ? 1 : 0, ECVF_SetByCommandline);
// Spatial upscalers such as NIS might set this to 0, but we need r.TemporalAA.Upscaler to be 1 for DLSS to work.
// but we don't want to change the Cvar if DLSS is not active as to avoid impacting other code paths
// we don't need to set r.TemporalAA.Upsampling since r.TemporalAA.Upscaler implies that
if (bDLSSEnabled)
{
static const auto CVarTemporalAAUpscaler = IConsoleManager::Get().FindConsoleVariable(TEXT("r.TemporalAA.Upscaler"));
CVarTemporalAAUpscaler->Set(1, ECVF_SetByCommandline);
}
}
static auto CVarDLSSAutoQualityMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLSS.Quality.Auto"));
if (CVarDLSSAutoQualityMode)
{
bool bIsAutoQualityMode = bNGXEnabled && (DLSSMode == UDLSSMode::Auto);
CVarDLSSAutoQualityMode->Set(bIsAutoQualityMode, ECVF_SetByCommandline);
}
static auto CVarDLSSQuality = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLSS.Quality"));
if (CVarDLSSQuality && (DLSSMode != UDLSSMode::Off) && (DLSSMode != UDLSSMode::Auto))
{
#if !UE_BUILD_SHIPPING
check(IsInGameThread());
DLSSErrorState.bIsDLSSModeUnsupported = !IsDLSSModeSupported(DLSSMode);
DLSSErrorState.InvalidDLSSMode = DLSSMode;
#endif
CVarDLSSQuality->Set(ToDLSSQualityCVarValue(DLSSMode), ECVF_SetByCommandline);
}
}
else
{
#if !UE_BUILD_SHIPPING
FFrame::KismetExecutionMessage(*FString::Printf(
TEXT("SetDLSSMode should not be called with an invalid DLSSMode enum value (%d) \"%s\""),
int64(DLSSMode), *StaticEnum<UDLSSMode>()->GetDisplayNameTextByValue(int64(DLSSMode)).ToString()),
ELogVerbosity::Error, SetDLSSModeInvalidEnumValueError);
#endif
}
#endif // WITH_DLSS
}
UDLSSMode UDLSSLibrary::GetDLSSMode()
{
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("GetDLSSMode should not be called before PostEngineInit"));
return UDLSSMode::Off;
}
static const auto CVarTemporalAAUpscaler = IConsoleManager::Get().FindConsoleVariable(TEXT("r.TemporalAA.Upscaler"));
const bool bTemporalUpscalerActive = CVarTemporalAAUpscaler && CVarTemporalAAUpscaler->GetInt() != 0;
static const auto CVarNGXEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.Enable"));
const bool bNGXEnabled = CVarNGXEnable && CVarNGXEnable->GetInt();
static const auto CVarDLSSEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLSS.Enable"));
const bool bDLSSEnabled = CVarDLSSEnable && CVarDLSSEnable->GetInt();
static const auto CVarDLSSQuality = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLSS.Quality"));
const int32 DLSSQuality = CVarDLSSQuality ? CVarDLSSQuality->GetInt() : 0;
static const auto CVarDLSSAutoQualityMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLSS.Quality.Auto"));
const bool bIsAutoQualityMode = CVarDLSSAutoQualityMode ? CVarDLSSAutoQualityMode->GetBool() : false;
const bool bDLAAEnabled = (DLSSUpscaler != nullptr) && DLSSUpscaler->IsDLAAMode();
if (bDLAAEnabled)
{
// DLSS is mutually exclusive with DLAA, DLAA wins
return UDLSSMode::Off;
}
else if (bTemporalUpscalerActive && bNGXEnabled && bDLSSEnabled && bIsAutoQualityMode)
{
return UDLSSMode::Auto;
}
else if (bTemporalUpscalerActive && bNGXEnabled && bDLSSEnabled && CVarDLSSQuality)
{
static_assert(int32(EDLSSQualityMode::NumValues) == 5, "dear DLSS plugin NVIDIA developer, please update this code to handle the new enum values");
switch (EDLSSQualityMode(DLSSQuality))
{
case EDLSSQualityMode::UltraPerformance:
return UDLSSMode::UltraPerformance;
default:
UE_LOG(LogDLSSBlueprint , Error, TEXT("r.NGX.DLSS.Quality is set to %d, which is outside of the valid range [%d, %d])"), DLSSQuality, EDLSSQualityMode::MinValue, EDLSSQualityMode::MaxValue);
case EDLSSQualityMode::Performance:
return UDLSSMode::Performance;
case EDLSSQualityMode::Balanced:
return UDLSSMode::Balanced;
case EDLSSQualityMode::Quality:
return UDLSSMode::Quality;
case EDLSSQualityMode::UltraQuality:
return UDLSSMode::UltraQuality;
};
}
#endif
return UDLSSMode::Off;
}
#ifndef ENGINE_CAN_SUPPORT_NIS_PLUGIN
#define ENGINE_CAN_SUPPORT_NIS_PLUGIN (ENGINE_MAJOR_VERSION == 5 || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION ==27 && ENGINE_PATCH_VERSION >=1 ))
#endif
void UDLSSLibrary::SetDLSSSharpness(float Sharpness)
{
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("SetDLSSSharpness should not be called before PostEngineInit"));
return;
}
static const auto CVarNGXDLSSharpness = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLSS.Sharpness"));
if (CVarNGXDLSSharpness)
{
#if ENGINE_CAN_SUPPORT_NIS_PLUGIN
static const auto CVarNISSharpness = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NIS.Sharpness"));
static const auto CVarNISEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NIS.Enable"));
const bool bHasNISPlugin = CVarNISSharpness != nullptr && CVarNISEnable != nullptr;
const bool bIsNISEnabled = bHasNISPlugin && CVarNISEnable->GetBool();
if (bHasNISPlugin && bIsNISEnabled)
{
const int32 PreferNISSharpen = CVarNGXDLSSPreferNISSharpen.GetValueOnAnyThread();
const bool bUseNISSharpen = PreferNISSharpen == 1 || (PreferNISSharpen == 2 && Sharpness > 0);
if (bUseNISSharpen)
{
Sharpness = FMath::Clamp(Sharpness, 0.0f, 1.0f);
}
// Quantize here so we can have sharpness snap to 0, which downstream is used to turn off the NGX sharpening flag
// CVarNGXDLSSharpness->Set(Sharpness, ECVF_SetByCommandline) internally uses Set(*FString::Printf(TEXT("%g"), InValue), SetBy);
CVarNGXDLSSharpness->Set(*FString::Printf(TEXT("%2.2f"), bUseNISSharpen ? 0.0f : Sharpness), ECVF_SetByCommandline);
CVarNISSharpness->Set( *FString::Printf(TEXT("%2.2f"), bUseNISSharpen ? Sharpness : 0.0f), ECVF_SetByCommandline);
}
else
#endif // ENGINE_CAN_SUPPORT_NIS_PLUGIN
{
// Quantize here so we can have sharpness snap to 0, which downstream is used to turn off the NGX sharpening flag
// CVarNGXDLSSharpness->Set(Sharpness, ECVF_SetByCommandline) internally uses Set(*FString::Printf(TEXT("%g"), InValue), SetBy);
CVarNGXDLSSharpness->Set(*FString::Printf(TEXT("%2.2f"), Sharpness), ECVF_SetByCommandline);
}
}
#endif
}
float UDLSSLibrary::GetDLSSSharpness()
{
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("GetDLSSSharpness should not be called before PostEngineInit"));
return 0.0f;
}
static const auto CVarNGXDLSSharpness = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLSS.Sharpness"));
if (CVarNGXDLSSharpness)
{
#if ENGINE_CAN_SUPPORT_NIS_PLUGIN
static const auto CVarNISSharpness = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NIS.Sharpness"));
static const auto CVarNISEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NIS.Enable"));
const bool bHasNISPlugin = CVarNISSharpness != nullptr && CVarNISEnable != nullptr;
const bool bIsNISEnabled = bHasNISPlugin && CVarNISEnable->GetBool();
const int32 PreferNISSharpen = CVarNGXDLSSPreferNISSharpen.GetValueOnAnyThread();
if (bHasNISPlugin && bIsNISEnabled && (PreferNISSharpen == 1))
{
return CVarNISSharpness->GetFloat();
}
else if (bHasNISPlugin && bIsNISEnabled && (PreferNISSharpen == 2))
{
const float DLSSSharpness = CVarNGXDLSSharpness->GetFloat();
if (DLSSSharpness < 0)
{
return DLSSSharpness;
}
else
{
return CVarNISSharpness->GetFloat();
}
}
else
#endif
{
return CVarNGXDLSSharpness->GetFloat();
}
}
#endif
return 0.0f;
}
UDLSSMode UDLSSLibrary::GetDefaultDLSSMode()
{
#if WITH_DLSS
if (!TryInitDLSSLibrary())
{
UE_LOG(LogDLSSBlueprint, Error, TEXT("GetDefaultDLSSMode should not be called before PostEngineInit"));
return UDLSSMode::Off;
}
#endif
if (UDLSSLibrary::IsDLSSSupported())
{
return UDLSSMode::Auto;
}
else
{
return UDLSSMode::Off;
}
}
#if WITH_DLSS
static UDLSSSupport ToUDLSSSupport(EDLSSSupport InDLSSSupport)
{
switch (InDLSSSupport)
{
case EDLSSSupport::Supported:
return UDLSSSupport::Supported;
// this should be resolved at development time
default:
checkf(false, TEXT("ToUDLSSSupport should not be called with an out of range InDLSSSupport from the higher level code"));
case EDLSSSupport::NotSupported:
return UDLSSSupport::NotSupported;
case EDLSSSupport::NotSupportedIncompatibleHardware:
return UDLSSSupport::NotSupportedIncompatibleHardware;
case EDLSSSupport::NotSupportedDriverOutOfDate:
return UDLSSSupport::NotSupportedDriverOutOfDate;
case EDLSSSupport::NotSupportedOperatingSystemOutOfDate:
return UDLSSSupport::NotSupportedOperatingSystemOutOfDate;
case EDLSSSupport::NotSupportedIncompatibleAPICaptureToolActive:
return UDLSSSupport::NotSupportedIncompatibleAPICaptureToolActive;
}
}
// Delayed initialization, which allows this module to be available early so blueprints can be loaded before DLSS is available in PostEngineInit
bool UDLSSLibrary::TryInitDLSSLibrary()
{
if (bDLSSLibraryInitialized)
{
return true;
}
// Register this before we bail out so we can show error messages
#if !UE_BUILD_SHIPPING
if (!DLSSOnScreenMessagesDelegateHandle.IsValid())
{
DLSSOnScreenMessagesDelegateHandle = FCoreDelegates::OnGetOnScreenMessages.AddStatic(&GetDLSSOnScreenMessages);
}
#endif
IDLSSModuleInterface* DLSSModule = FModuleManager::GetModulePtr<IDLSSModuleInterface>(TEXT("DLSS"));
if (DLSSModule == nullptr)
{
return false;
}
DLSSUpscaler = DLSSModule->GetDLSSUpscaler();
DLSSSupport = ToUDLSSSupport(DLSSModule->QueryDLSSSupport());
DLSSModule->GetDLSSMinDriverVersion(MinDLSSDriverVersionMajor, MinDLSSDriverVersionMinor);
checkf((DLSSModule->GetDLSSUpscaler() != nullptr) || (DLSSModule->QueryDLSSSupport() != EDLSSSupport::Supported), TEXT("mismatch between not having a valid DLSSModule->GetDLSSUpscaler() while also reporting DLSS as being supported by DLSSModule->QueryDLSSSupport() %u "), DLSSModule->QueryDLSSSupport());
bDLSSLibraryInitialized = true;
return true;
}
#endif // WITH_DLSS
void FDLSSBlueprintModule::StartupModule()
{
#if WITH_DLSS
// This initialization will likely not succeed unless this module has been moved to PostEngineInit, and that's ok
UDLSSLibrary::TryInitDLSSLibrary();
#else
UE_LOG(LogDLSSBlueprint, Log, TEXT("DLSS is not supported on this platform at build time. The DLSS Blueprint library however is supported and stubbed out to ignore any calls to enable DLSS and will always return UDLSSSupport::NotSupportedByPlatformAtBuildTime, regardless of the underlying hardware. This can be used to e.g. to turn off DLSS related UI elements."));
UDLSSLibrary::DLSSSupport = UDLSSSupport::NotSupportedByPlatformAtBuildTime;
#endif
}
void FDLSSBlueprintModule::ShutdownModule()
{
#if WITH_DLSS && !UE_BUILD_SHIPPING
if (UDLSSLibrary::DLSSOnScreenMessagesDelegateHandle.IsValid())
{
FCoreDelegates::OnGetOnScreenMessages.Remove(UDLSSLibrary::DLSSOnScreenMessagesDelegateHandle);
UDLSSLibrary::DLSSOnScreenMessagesDelegateHandle.Reset();
}
#endif
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FDLSSBlueprintModule, DLSSBlueprint)
@@ -1,166 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "Modules/ModuleManager.h"
#include "UObject/ObjectMacros.h"
#include "UObject/Object.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Misc/CoreDelegates.h"
#include "DLSSLibrary.generated.h"
class FDLSSUpscaler;
class FDelegateHandle;
#ifndef WITH_DLSS
#define WITH_DLSS 0
#endif
UENUM(BlueprintType)
enum class UDLSSSupport : uint8
{
Supported UMETA(DisplayName = "Supported"),
NotSupported UMETA(DisplayName = "Not Supported"),
NotSupportedIncompatibleHardware UMETA(DisplayName = "Incompatible Hardware", ToolTip = "DLSS requires an NVIDIA RTX GPU"),
NotSupportedDriverOutOfDate UMETA(DisplayName = "Driver Out of Date", ToolTip = "The driver is outdated. Also see GetDLSSMinimumDriverVersion"),
NotSupportedOperatingSystemOutOfDate UMETA(DisplayName = "Operating System Out of Date", ToolTip = "DLSS requires at least Windows 10 Fall 2017 Creators Update 64-bit, (v1709, build 16299)"),
NotSupportedByPlatformAtBuildTime UMETA(DisplayName = "Platform Not Supported At Build Time", ToolTip = "This platform doesn't not support DLSS at build time. Currently DLSS is only supported on Windows 64"),
NotSupportedIncompatibleAPICaptureToolActive UMETA(DisplayName = "Incompatible API Capture Tool Active", ToolTip = "DLSS is not compatible with an active API capture tool such as RenderDoc.")
};
UENUM(BlueprintType)
enum class UDLSSMode : uint8
{
Off UMETA(DisplayName = "Off"),
Auto UMETA(DisplayName = "Auto"),
UltraQuality UMETA(DisplayName = "Ultra Quality"),
Quality UMETA(DisplayName = "Quality"),
Balanced UMETA(DisplayName = "Balanced"),
Performance UMETA(DisplayName = "Performance"),
UltraPerformance UMETA(DisplayName = "Ultra Performance")
};
UCLASS(MinimalAPI)
class UDLSSLibrary : public UBlueprintFunctionLibrary
{
friend class FDLSSBlueprintModule;
GENERATED_BODY()
public:
/** Checks whether DLSS/DLAA is supported by the current GPU. Further details can be retrieved via QueryDLSSSupport*/
UFUNCTION(BlueprintPure, Category = "DLSS", meta = (DisplayName = "Is NVIDIA DLSS Supported"))
static DLSSBLUEPRINT_API bool IsDLSSSupported();
/** Checks whether DLSS/DLAA is supported by the current GPU */
UFUNCTION(BlueprintPure, Category = "DLSS", meta = (DisplayName = "Query NVIDIA DLSS Support"))
static DLSSBLUEPRINT_API UDLSSSupport QueryDLSSSupport();
/** If QueryDLSSSupport returns "NotSupportedDriverOutOfDate", then MinDriverVersionMajor and MinDriverVersionMinor contains the required driver version.*/
UFUNCTION(BlueprintPure, Category = "DLSS", meta = (DisplayName = "Get DLSS Minimum DriverVersion"))
static DLSSBLUEPRINT_API void GetDLSSMinimumDriverVersion(int32& MinDriverVersionMajor, int32& MinDriverVersionMinor);
/** Enable/disable DLAA. Note that while DLAA is enabled, DLSS will be automatically disabled */
UFUNCTION(BlueprintCallable, Category = "DLSS", meta = (DisplayName = "Enable DLAA"))
static DLSSBLUEPRINT_API void EnableDLAA(bool bEnabled);
/** Checks whether DLAA is enabled */
UFUNCTION(BlueprintPure, Category = "DLSS", meta = (DisplayName = "Is DLAA Enabled"))
static DLSSBLUEPRINT_API bool IsDLAAEnabled();
/** Checks whether a DLSS mode is supported */
UFUNCTION(BlueprintPure, Category = "DLSS", meta = (DisplayName = "Is DLSS Mode Supported"))
static DLSSBLUEPRINT_API bool IsDLSSModeSupported(UDLSSMode DLSSMode);
/** Retrieves all supported DLSS modes. Can be used to populate UI */
UFUNCTION(BlueprintPure, Category = "DLSS", meta = (DisplayName = "Get Supported DLSS Modes"))
static DLSSBLUEPRINT_API TArray<UDLSSMode> GetSupportedDLSSModes();
/** Provides additional details (such as screen percentage ranges) about a DLSS mode. Screen Resolution is required for Auto mode */
UFUNCTION(BlueprintPure, Category = "DLSS", meta = (DisplayName = "Get DLSS Mode Information"))
static DLSSBLUEPRINT_API void GetDLSSModeInformation(UDLSSMode DLSSMode, FVector2D ScreenResolution, bool& bIsSupported, float& OptimalScreenPercentage, bool& bIsFixedScreenPercentage, float& MinScreenPercentage, float& MaxScreenPercentage, float& OptimalSharpness);
/** The global screen percentage range that DLSS supports. Excludes DLSS modes with fixed screen percentage. Also see GetDLSSModeInformation*/
UFUNCTION(BlueprintPure, Category = "DLSS", meta = (DisplayName = "Get DLSS Screenpercentage Range"))
static DLSSBLUEPRINT_API void GetDLSSScreenPercentageRange(float& MinScreenPercentage, float& MaxScreenPercentage);
/** Sets the console variables to enable/disable DLSS (r.NGX.DLSS.Enable, r.NGX.DLSS.Quality)*/
UFUNCTION(BlueprintCallable, Category = "DLSS", meta = (DisplayName = "Set DLSS Mode"))
static DLSSBLUEPRINT_API void SetDLSSMode(UDLSSMode DLSSMode);
/* Reads the console variables to infer the current DLSS mode (r.NGX.DLSS.Enable, r.NGX.DLSS.Quality, r.TemporalAA.Upscaler)*/
UFUNCTION(BlueprintPure, Category = "DLSS", meta = (DisplayName = "Get DLSS Mode"))
static DLSSBLUEPRINT_API UDLSSMode GetDLSSMode();
/* Sets the console variables to enable additional DLSS sharpening. Set to 0 to disable (r.NGX.DLSS.Sharpness) */
UFUNCTION(BlueprintCallable, Category = "DLSS", meta = (DisplayName = "Set DLSS Sharpness"))
static DLSSBLUEPRINT_API void SetDLSSSharpness(float Sharpness);
/*Reads the console variables to infer the current DLSS sharpness (r.NGX.DLSS.Sharpness) */
UFUNCTION(BlueprintPure, Category = "DLSS", meta = (DisplayName = "Get DLSS Sharpness"))
static DLSSBLUEPRINT_API float GetDLSSSharpness();
/* Find a reasonable default DLSS mode based on current hardware */
UFUNCTION(BlueprintPure, Category = "DLSS", meta = (DisplayName = "Get Default DLSS Mode"))
static DLSSBLUEPRINT_API UDLSSMode GetDefaultDLSSMode();
/* Allows conversion from BlueprintType enums. */
static DLSSBLUEPRINT_API int32 ToDLSSQualityCVarValue(UDLSSMode InDLSSQualityMode);
private:
static UDLSSSupport DLSSSupport;
#if WITH_DLSS
static int32 MinDLSSDriverVersionMinor;
static int32 MinDLSSDriverVersionMajor;
static FDLSSUpscaler* DLSSUpscaler;
static bool bDLSSLibraryInitialized;
static bool TryInitDLSSLibrary();
#if !UE_BUILD_SHIPPING
struct FDLSSErrorState
{
bool bIsDLSSModeUnsupported = false;
UDLSSMode InvalidDLSSMode = UDLSSMode::Off;
};
static FDLSSErrorState DLSSErrorState;
static void GetDLSSOnScreenMessages(TMultiMap<FCoreDelegates::EOnScreenMessageSeverity, FText>& OutMessages);
static FDelegateHandle DLSSOnScreenMessagesDelegateHandle;
#endif
#endif
};
class FDLSSBlueprintModule final : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
private:
};
@@ -1,84 +0,0 @@
/*
* Copyright (c) 2020 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
using UnrealBuildTool;
using System.IO;
public class DLSSEditor : ModuleRules
{
public DLSSEditor(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
}
);
PrivateIncludePaths.AddRange(
new string[] {
Path.Combine(EngineDirectory,"Source/Runtime/Renderer/Private"),
Path.Combine(EngineDirectory,"Source/Editor/LevelEditor/Private"),
Path.Combine(ModuleDirectory, "../DLSS/Private")
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"DLSS",
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"Engine",
"RenderCore",
"Renderer",
"RHI",
"Settings",
"LevelEditor",
"ToolMenus",
"Slate",
"SlateCore",
"EditorWidgets",
"EditorStyle",
"InputCore",
"UnrealEd",
"Projects",
"NGX",
"DLSS",
"NGXRHI",
}
);
// We can't quite check whether we have CL 16509387 (in UE5-Release) so we do this in a round about way
bool bUseSlotsArgumentsAPI = (Target.Version.MajorVersion == 5) && (Target.Version.BranchName != "++UE5+Release-5.0-EarlyAccess");
PrivateDefinitions.Add(string.Format("USE_SLOT_SLOT_ARGUMENTS_API={0}", bUseSlotsArgumentsAPI ? "1" : "0"));
// We can't quite check whether we have CL 16848904 (in UE5-Main) so we do this in a round about way
bool bSupportsPostProcessingScreenPercentage = (Target.Version.MajorVersion == 4) ||
((Target.Version.MajorVersion == 5) && (Target.Version.BranchName == "++UE5+Release-5.0-EarlyAccess"))
;
PrivateDefinitions.Add(string.Format("SUPPORTS_POSTPROCESSING_SCREEN_PERCENTAGE={0}", bSupportsPostProcessingScreenPercentage ? "1" : "0"));
// 4.x and early access 5.0 engines had GTemporalUpscaler interface
bool bEngineHasGTemporalUpscaler = (Target.Version.MajorVersion == 4) || (Target.Version.BranchName == "++UE5+Release-5.0-EarlyAccess");
PrivateDefinitions.Add(string.Format("DLSS_ENGINE_HAS_GTEMPORALUPSCALER={0}", bEngineHasGTemporalUpscaler ? "1" : "0"));
}
}
@@ -1,124 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include "DLSSEditor.h"
#include "DLSSUpscaler.h"
#include "DLSSUpscalerEditor.h"
#include "DLSS.h"
#include "DLSSSettings.h"
#include "NGXRHI.h"
#include "CoreMinimal.h"
#include "ISettingsModule.h"
#include "ISettingsSection.h"
#include "UObject/Class.h"
#include "UObject/WeakObjectPtr.h"
#define LOCTEXT_NAMESPACE "FDLSSEditorModule"
DEFINE_LOG_CATEGORY(LogDLSSEditor);
void FDLSSEditorModule::StartupModule()
{
UE_LOG(LogDLSSEditor, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
check(GIsEditor);
// verify that the other DLSS modules are correctly hooked up
{
IDLSSModuleInterface* DLSSModule = &FModuleManager::LoadModuleChecked<IDLSSModuleInterface>(TEXT("DLSS"));
UE_LOG(LogDLSSEditor, Log, TEXT("DLSS module %p, QueryDLSSSupport = %u DLSSUpscaler = %p"), DLSSModule, DLSSModule->QueryDLSSSupport(), DLSSModule->GetDLSSUpscaler());
bIsDLSSAvailable = DLSSModule->QueryDLSSSupport() == EDLSSSupport::Supported;
if (bIsDLSSAvailable)
{
checkf(GCustomStaticScreenPercentage == DLSSModule->GetDLSSUpscaler(),TEXT("GCustomStaticScreenPercentage is not set to the DLSS upscaler. Please check that only one upscaling plugin is active."));
DLSSUpscalerEditor = MakeShared<FDLSSUpscalerEditor>(DLSSModule->GetDLSSUpscaler());
checkf(GCustomEditorStaticScreenPercentage == nullptr, TEXT("GCustomEditorStaticScreenPercentage is already in use. Please check that only one upscaling active is active."));
GCustomEditorStaticScreenPercentage = DLSSUpscalerEditor.Get();
}
}
// register settings
{
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
if (SettingsModule != nullptr)
{
{
auto Settings = GetMutableDefault<UDLSSSettings>();
if(bIsDLSSAvailable)
{
IDLSSModuleInterface* DLSSModule = &FModuleManager::LoadModuleChecked<IDLSSModuleInterface>(TEXT("DLSS"));
const NGXRHI* NGXRHIExtensions = DLSSModule->GetDLSSUpscaler()->GetNGXRHI();
Settings->GenericDLSSBinaryPath = NGXRHIExtensions->GetDLSSGenericBinaryInfo().Get<0>();
Settings->bGenericDLSSBinaryExists = NGXRHIExtensions->GetDLSSGenericBinaryInfo().Get<1>();
Settings->CustomDLSSBinaryPath = NGXRHIExtensions->GetDLSSCustomBinaryInfo().Get<0>();
Settings->bCustomDLSSBinaryExists = NGXRHIExtensions->GetDLSSCustomBinaryInfo().Get<1>();
}
ISettingsSectionPtr SettingsSection = SettingsModule->RegisterSettings("Project", "Plugins", "DLSS",
LOCTEXT("DLSSSettingsName", "NVIDIA DLSS"),
LOCTEXT("DLSSSettingsDescription", "Configure the NVIDIA DLSS plug-in."),
Settings
);
}
{
auto Settings = GetMutableDefault<UDLSSOverrideSettings>();
ISettingsSectionPtr SettingsSection = SettingsModule->RegisterSettings("Project", "Plugins", "DLSSOverride",
LOCTEXT("DLSSOverrideSettingsName", "NVIDIA DLSS Overrides (Local)"),
LOCTEXT("DLSSOverrideSettingsDescription", "Configure the local settings for the NVIDIA DLSS plug-in."),
Settings
);
}
}
}
UE_LOG(LogDLSSEditor, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
void FDLSSEditorModule::ShutdownModule()
{
UE_LOG(LogDLSSEditor, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
if (bIsDLSSAvailable)
{
GCustomEditorStaticScreenPercentage = nullptr;
DLSSUpscalerEditor = nullptr;
}
UE_LOG(LogDLSSEditor, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
FDLSSUpscalerEditor* FDLSSEditorModule::GetDLSSUpscalerEditor() const
{
return DLSSUpscalerEditor.Get();
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FDLSSEditorModule, DLSSEditor)
@@ -1,549 +0,0 @@
/*
* Copyright (c) 2020 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
#include "DLSSUpscalerEditor.h"
#include "DLSSUpscaler.h"
#include "LegacyScreenPercentageDriver.h"
#include "DLSSSettings.h"
#include "Editor.h"
#include "SLevelViewportToolBar.h"
#include "ToolMenus.h"
#include "Widgets/Layout/SBox.h"
#include "Widgets/Input/SSpinBox.h"
#include "Framework/Commands/Commands.h"
#include "ISettingsModule.h"
#include "ISettingsSection.h"
#include "UObject/Class.h"
#include "UObject/WeakObjectPtr.h"
#include "Widgets/SBoxPanel.h"
#include "Widgets/SNullWidget.h"
#include "Styling/SlateTypes.h"
#include "Widgets/Layout/SBorder.h"
#include "Widgets/Text/STextBlock.h"
#include "Widgets/Input/SButton.h"
#include "Widgets/Input/SCheckBox.h"
#include "Widgets/Input/SSlider.h"
#include "Widgets/Layout/SGridPanel.h"
#include "EditorStyleSet.h"
#include "Editor.h"
#include "Settings/EditorSettings.h"
#include "Editor/EditorPerformanceSettings.h"
#define LOCTEXT_NAMESPACE "FDLSSEditorModule"
// We can't quite check whether we have CL 16509387 in UE5-Release-5.0 so we do this in a round about way by branch name
// We also can't do a preprocessor string compare in C++ so we resolve this in DLSSEditor.Build.cs;
#ifndef USE_SLOT_SLOT_ARGUMENTS_API
#define USE_SLOT_SLOT_ARGUMENTS_API 1
#endif
// We can't quite check whether we have CL 16848904 (in UE5-Main) so we do this in a round about way
#ifndef SUPPORTS_POSTPROCESSING_SCREEN_PERCENTAGE
#define SUPPORTS_POSTPROCESSING_SCREEN_PERCENTAGE 1
#endif
// DLSS_TODO move the implementation of this to FDLSSUpscalerEditor?
class DLSSEDITOR_API SDLSSSettings : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SDLSSSettings)
{}
SLATE_ARGUMENT(FDLSSUpscalerEditor*, UpscalerEditor)
SLATE_ARGUMENT(ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments,ViewportMenuEntryArguments)
SLATE_END_ARGS()
// Widget construction
void Construct(const FArguments& InArgs);
~SDLSSSettings();
private:
// Makes a general quality level header button widget
TSharedRef<SWidget> MakeHeaderButtonWidget(const FText& InName, EDLSSQualityMode InQualityLevel, const FText& InToolTip);
// Callback for when a quality level header button is pressed
FReply OnHeaderClicked(EDLSSQualityMode InQualityLevel);
// Create a gridslot for the group quality level with all the required formatting
#if USE_SLOT_SLOT_ARGUMENTS_API
SGridPanel::FSlot::FSlotArguments MakeGridSlot(int32 InCol, int32 InRow, int32 InColSpan = 1, int32 InRowSpan = 1);
#else
SGridPanel::FSlot& MakeGridSlot(int32 InCol, int32 InRow, int32 InColSpan = 1, int32 InRowSpan = 1);
#endif
private:
FDLSSUpscalerEditor* UpscalerEditor;
ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments ViewportMenuEntryArguments;
};
TSharedRef<SWidget> SDLSSSettings::MakeHeaderButtonWidget(const FText& InName, EDLSSQualityMode InQualityLevel, const FText& InToolTip)
{
return SNew(SButton)
.OnClicked(this, &SDLSSSettings::OnHeaderClicked, InQualityLevel)
.ToolTipText(InToolTip)
.Content()
[
SNew(STextBlock)
.Text(InName)
];
}
FReply SDLSSSettings::OnHeaderClicked(EDLSSQualityMode InQualityLevel)
{
UE_LOG(LogDLSSEditor, Log, TEXT("%s InQualityLevel = %d"), ANSI_TO_TCHAR(__FUNCTION__), InQualityLevel);
if (InQualityLevel != EDLSSQualityMode::NumValues)
{
const int32 ScreenPercentage = UpscalerEditor->DLSSUpscaler->GetOptimalResolutionFractionForQuality(InQualityLevel) * 100.0f;
UpscalerEditor->OnQualityModeSelected(InQualityLevel, ViewportMenuEntryArguments);
UpscalerEditor->OnScreenPercentageValueChanged(ScreenPercentage, ViewportMenuEntryArguments);
UpscalerEditor->OnSetPreviewCustomTemporalUpscaler(true, ViewportMenuEntryArguments);
}
else
{
UpscalerEditor->OnSetPreviewCustomTemporalUpscaler(false, ViewportMenuEntryArguments);
}
return FReply::Handled();
}
#if USE_SLOT_SLOT_ARGUMENTS_API
SGridPanel::FSlot::FSlotArguments SDLSSSettings::MakeGridSlot(int32 InCol, int32 InRow, int32 InColSpan /*= 1*/, int32 InRowSpan /*= 1*/)
{
float PaddingH = 2.0f;
float PaddingV = InRow == 0 ? 8.0f : 2.0f;
return MoveTemp(SGridPanel::Slot(InCol, InRow)
.Padding(PaddingH, PaddingV)
.RowSpan(InRowSpan)
.ColumnSpan(InColSpan));
}
#else
SGridPanel::FSlot& SDLSSSettings::MakeGridSlot(int32 InCol, int32 InRow, int32 InColSpan /*= 1*/, int32 InRowSpan /*= 1*/)
{
float PaddingH = 2.0f;
float PaddingV = InRow == 0 ? 8.0f : 2.0f;
return SGridPanel::Slot(InCol, InRow)
.Padding(PaddingH, PaddingV)
.RowSpan(InRowSpan)
.ColumnSpan(InColSpan);
}
#endif
void SDLSSSettings::Construct(const FArguments& InArgs)
{
this->UpscalerEditor = InArgs._UpscalerEditor;
this->ViewportMenuEntryArguments = InArgs._ViewportMenuEntryArguments;
auto TitleFont = FEditorStyle::GetFontStyle(TEXT("MenuItem.Font"));
static float QualityColumnCoeff = 1.0f;
static_assert(int32(EDLSSQualityMode::NumValues) == 5, "dear DLSS plugin NVIDIA developer, please update this code to handle the new enum values");
auto MakeWidget = [this](EDLSSQualityMode QualityMode, const FText& InName, const FText& InToolTip)
{
const bool bSupported = UpscalerEditor->DLSSUpscaler->IsQualityModeSupported(QualityMode);
if (!bSupported)
{
return SNullWidget::NullWidget;
}
else
{
return MakeHeaderButtonWidget(InName, QualityMode, InToolTip);
}
};
TSharedRef<SGridPanel> ButtonMatrix =
SNew(SGridPanel)
.FillColumn(0, QualityColumnCoeff)
+ MakeGridSlot(0, 0).VAlign(VAlign_Center)[SNew(STextBlock).Text(LOCTEXT("DLSSModeLabel" , "DLSS Mode")).Font(TitleFont)]
+ MakeGridSlot(1, 0)[MakeHeaderButtonWidget(LOCTEXT("DLSSModeOffLabel", "Off"), EDLSSQualityMode::NumValues, LOCTEXT("DLSSModeOff" , "Turn DLSS off and use built-in TAA"))]
+ MakeGridSlot(2, 0)[MakeWidget(EDLSSQualityMode::UltraQuality, LOCTEXT("DLSSModeUltraQualityLabel", "Ultra Quality"), LOCTEXT("DLSSModeUltraQuality", "Set DLSS mode to Ultra Quality"))]
+ MakeGridSlot(3, 0)[MakeWidget(EDLSSQualityMode::Quality, LOCTEXT("DLSSModeQualityLabel", "Quality"), LOCTEXT("DLSSModeQuality", "Set DLSS mode to Quality"))]
+ MakeGridSlot(4, 0)[MakeWidget(EDLSSQualityMode::Balanced, LOCTEXT("DLSSModeBalancedLabel", "Balanced"), LOCTEXT("DLSSModeBalanced", "Set DLSS mode to Balanced"))]
+ MakeGridSlot(5, 0)[MakeWidget(EDLSSQualityMode::Performance, LOCTEXT("DLSSModePerformanceLabel", "Performance"), LOCTEXT("DLSSModePerformance", "Set DLSS mode to Performance"))]
+ MakeGridSlot(6, 0)[MakeWidget(EDLSSQualityMode::UltraPerformance, LOCTEXT("DLSSModeUltraPerformanceLabel", "Ultra Performance"), LOCTEXT("DLSSModeUltraPerformance", "Set DLSS mode to Ultra Performance"))];
this->ChildSlot
.HAlign(EHorizontalAlignment::HAlign_Fill)
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
[
ButtonMatrix
]
];
}
SDLSSSettings::~SDLSSSettings()
{
}
static void MakeDLSSQualitySettingsMenu(UToolMenu* InMenu, FDLSSUpscalerEditor* DLSSUpscalerEditor, const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments)
{
{
FToolMenuSection& Section = InMenu->AddSection("Section");
Section.AddEntry(FToolMenuEntry::InitWidget("DLSSQualitySettings", SNew(SDLSSSettings).UpscalerEditor(DLSSUpscalerEditor).ViewportMenuEntryArguments(Arguments), FText(), true));
}
}
class DLSSEDITOR_API FFDLSSEditorViewportClientData final : public FEditorViewportClient::ICustomTemporalUpscalerData
{
public:
bool bIsDLSSEnabled;
float ResolutionFraction;
EDLSSQualityMode DLSSQualityMode = EDLSSQualityMode::NumValues;
float MinResolutionFraction = 0.0f;
float MaxResolutionFraction = 1.0f;
bool bIsFixedResolutionFraction = false;
};
TSharedPtr<FFDLSSEditorViewportClientData> FDLSSUpscalerEditor::GetOrCreateDLSSViewportData(FEditorViewportClient* ViewportClient)
{
check(ViewportClient);
TSharedPtr<FEditorViewportClient::ICustomTemporalUpscalerData> CustomData = ViewportClient->GetCustomTemporalUpscalerData();
TSharedPtr<FFDLSSEditorViewportClientData> DLSSViewportData;
if (CustomData)
{
DLSSViewportData = StaticCastSharedPtr<FFDLSSEditorViewportClientData>(CustomData);
check(DLSSViewportData);
}
else
{
DLSSViewportData = MakeShared< FFDLSSEditorViewportClientData>();
ViewportClient->SetCustomTemporalUpscalerData(DLSSViewportData);
}
return DLSSViewportData;
}
FDLSSUpscalerEditor::FDLSSUpscalerEditor(FDLSSUpscaler* InDLSSUpscaler)
: DLSSUpscaler(InDLSSUpscaler)
{
}
FDLSSUpscalerEditor::~FDLSSUpscalerEditor()
{
UE_LOG(LogDLSSEditor, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
UE_LOG(LogDLSSEditor, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
void FDLSSUpscalerEditor::SetupEditorViewFamily(FSceneViewFamily& ViewFamily, FEditorViewportClient* ViewportClient)
{
// this purpusefully does not check "r.TemporalAA.Upscaler", which is used at runtime since the enable/disable comes from DLSSViewportData->bIsDLSSEnabled
// however make sure that the upscaler is "ours"
static const auto CVarDLSSEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLSS.Enable"));
const bool bDLSSActive = CVarDLSSEnable && (CVarDLSSEnable->GetInt() != 0);
static const auto CVarDLSSAutomationTesting = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLSS.AutomationTesting"));
const bool bDLSSActiveWithAutomation = !GIsAutomationTesting || (GIsAutomationTesting && CVarDLSSAutomationTesting && (CVarDLSSAutomationTesting->GetInt() != 0));
#if DLSS_ENGINE_HAS_GTEMPORALUPSCALER
if ((GTemporalUpscaler == DLSSUpscaler) && bDLSSActive && bDLSSActiveWithAutomation)
#else
if (bDLSSActive && bDLSSActiveWithAutomation)
#endif
{
check(GIsEditor);
checkf(GCustomStaticScreenPercentage == DLSSUpscaler, TEXT("GCustomStaticScreenPercentage is not set to the DLSS upscaler. Please check that only one upscaling plugin is active."));
checkf(GCustomEditorStaticScreenPercentage == this, TEXT("GCustomEditorStaticScreenPercentage is not set to the DLSS upscaler. Please check that only one upscaling plugin is active."));
check(ViewportClient);
TSharedPtr<FFDLSSEditorViewportClientData> DLSSViewportData = GetOrCreateDLSSViewportData(ViewportClient);
if(DLSSViewportData->bIsDLSSEnabled && EnableDLSSInEditorViewports())
{
ViewFamily.SetTemporalUpscalerInterface(DLSSUpscaler->GetUpscalerInstanceForViewFamily(DLSSUpscaler, DLSSViewportData->DLSSQualityMode));
// DLSS_TODO figure out what to do, should this ever be the case
checkf(ViewFamily.GetScreenPercentageInterface() == nullptr, TEXT("ViewFamily.GetScreenPercentageInterface() is already in use. Please check that only one upscaling plugin active is active."));
ViewFamily.EngineShowFlags.ScreenPercentage = true;
const float ResolutionFraction = DLSSViewportData->ResolutionFraction;
ViewFamily.SetScreenPercentageInterface(new FLegacyScreenPercentageDriver(
ViewFamily, ResolutionFraction
#if SUPPORTS_POSTPROCESSING_SCREEN_PERCENTAGE
/* AllowPostProcessSettingsScreenPercentage = */, false
#endif
));
}
}
}
bool FDLSSUpscalerEditor::GenerateEditorViewportOptionsMenuEntry(const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments& Arguments)
{
// this purpusefully does not check "r.TemporalAA.Upscaler", which is used at runtime since the enable/disable comes from DLSSViewportData->bIsDLSSEnabled
// however make sure that the upscaler is "ours"
static const auto CVarDLSSEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.DLSS.Enable"));
#if DLSS_ENGINE_HAS_GTEMPORALUPSCALER
if ((GTemporalUpscaler == DLSSUpscaler) && CVarDLSSEnable && (CVarDLSSEnable->GetInt() != 0))
#else
if (CVarDLSSEnable && (CVarDLSSEnable->GetInt() != 0))
#endif
{
check(GIsEditor);
checkf(GCustomStaticScreenPercentage == DLSSUpscaler, TEXT("GCustomStaticScreenPercentage is not set to the DLSS upscaler. Please check that only one upscaling plugin is active."));
checkf(GCustomEditorStaticScreenPercentage == this, TEXT("GCustomEditorStaticScreenPercentage is not set to the DLSS upscaler. Please check that only one upscaling plugin is active."));
FLevelEditorViewportClient& Levelviewport = Arguments.Viewport->GetLevelViewportClient();
FEngineShowFlags ShowFlags = Levelviewport.EngineShowFlags;
// DLSS_TODO is there a better way to detect whether TAA (and thus DLSS) is turned off?
// maybe pass this in as a flag or have the callsite do this
// FEditorViewportClient::Draw calls EngineShowFlagOrthographicOverride(IsPerspective(), ViewFamily.EngineShowFlags); which turns TAA off. And DLSS is a TAA flavor
// EngineShowFlags.TemporalAA = 0;
// EngineShowFlags.MotionBlur = 0;
// but that well only be called later so emulate this here.
if (!ShowFlags.Lighting)
{
return false;
}
if (!Levelviewport.IsPerspective())
{
return false;
}
if (!EnableDLSSInEditorViewports())
{
return false;
}
const bool bUseSubmenuForDLSSSettings = true;
if(bUseSubmenuForDLSSSettings)
{
Arguments.Section->AddSubMenu(
"DLSSSettings",
LOCTEXT("DLSSSettingsSubMenu", "DLSS Settings"),
LOCTEXT("DLSSSettingsSubMenu_ToolTip", "Open the DLSS settings"),
FNewToolMenuDelegate::CreateStatic(&MakeDLSSQualitySettingsMenu, this, Arguments));
}
else
{
Arguments.Section->AddEntry(FToolMenuEntry::InitWidget("DLSSSettings", SNew(SDLSSSettings).UpscalerEditor(this).ViewportMenuEntryArguments(Arguments), FText(), true));
}
TSharedPtr<FFDLSSEditorViewportClientData> DLSSViewportData = GetOrCreateDLSSViewportData(&Arguments.Viewport->GetLevelViewportClient());
if (DLSSViewportData->bIsDLSSEnabled)
{
Arguments.Section->AddEntry(FToolMenuEntry::InitWidget("DLSSScreenPercentage", GenerateScreenPercentageMenu(Arguments), LOCTEXT("DLSSScreenPercentage", "Screen Percentage (DLSS)")));
const int32 PreviewScreenPercentageMin = DLSSViewportData->MinResolutionFraction * 100.0f;
const int32 PreviewScreenPercentageMax = DLSSViewportData->MaxResolutionFraction * 100.0f;
// clamp the current preview screen percentage (which might be 100%) to the supported DLSS range
this->OnScreenPercentageValueChanged(FMath::Clamp(this->OnGetScreenPercentageValue(Arguments), PreviewScreenPercentageMin, PreviewScreenPercentageMax), Arguments);
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
TSharedRef<SWidget> FDLSSUpscalerEditor::GenerateScreenPercentageMenu(const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments& Arguments) const
{
TSharedPtr<FFDLSSEditorViewportClientData> DLSSViewportData = GetOrCreateDLSSViewportData(&Arguments.Viewport->GetLevelViewportClient());
const int32 PreviewScreenPercentageMin = DLSSViewportData->MinResolutionFraction * 100.0f;
const int32 PreviewScreenPercentageMax = DLSSViewportData->MaxResolutionFraction * 100.0f;
#if ENGINE_MAJOR_VERSION==4
return
SNew(SBox)
.HAlign(HAlign_Right)
.IsEnabled(this, &FDLSSUpscalerEditor::OnScreenPercentageIsEnabled, Arguments)
[
SNew(SBox)
.Padding(FMargin(4.0f, 0.0f, 0.0f, 0.0f))
.WidthOverride(100.0f)
[
SNew(SSpinBox<int32>)
.Font(FEditorStyle::GetFontStyle(TEXT("MenuItem.Font")))
.MinValue(PreviewScreenPercentageMin)
.MaxValue(PreviewScreenPercentageMax)
.Value(this, &FDLSSUpscalerEditor::OnGetScreenPercentageValue, Arguments)
.OnValueChanged(this, &FDLSSUpscalerEditor::OnScreenPercentageValueChanged, Arguments)
.ToolTipText(
DLSSViewportData->bIsFixedResolutionFraction ?
FText(LOCTEXT("DLSSScreenPercentageTooltipFixedResolution", "This DLSS quality mode has a fixed screen percentage and cannot be adjusted at runtime.")) :
FText( LOCTEXT("DLSSScreenPercentageTooltip",
"At runtime, the screen percentage is controlled by the r.NGX.DLSS.Quality cvar. To enable adjusting the screenpercentage directly in the editor, set the \"Enable Screenpercentage Manipulation In DLSS Editor Viewports\" setting under Editor Preferences -> Plugins -> NVIDIA DLSS"))
)
]
];
#elif ENGINE_MAJOR_VERSION==5
return
SNew(SBox)
.HAlign(HAlign_Right)
.IsEnabled(this, &FDLSSUpscalerEditor::OnScreenPercentageIsEnabled, Arguments)
[
SNew(SBox)
.Padding(FMargin(4.0f, 0.0f, 0.0f, 0.0f))
.WidthOverride(100.0f)
[
SNew(SBorder)
.BorderImage(FAppStyle::Get().GetBrush("Menu.WidgetBorder"))
.Padding(FMargin(1.0f))
[
SNew(SSpinBox<int32>)
.Style(&FAppStyle::Get(), "Menu.SpinBox")
.Font(FEditorStyle::GetFontStyle(TEXT("MenuItem.Font")))
.MinValue(PreviewScreenPercentageMin)
.MaxValue(PreviewScreenPercentageMax)
.Value(this, &FDLSSUpscalerEditor::OnGetScreenPercentageValue, Arguments)
.OnValueChanged(this, &FDLSSUpscalerEditor::OnScreenPercentageValueChanged, Arguments)
.ToolTipText(
DLSSViewportData->bIsFixedResolutionFraction ?
FText(LOCTEXT("DLSSScreenPercentageTooltipFixedResolution", "This DLSS quality mode has a fixed screen percentage and cannot be adjusted at runtime.")) :
FText(LOCTEXT("DLSSScreenPercentageTooltip",
"At runtime, the screen percentage is controlled by the r.NGX.DLSS.Quality cvar. To enable adjusting the screenpercentage directly in the editor, set the \"Enable Screenpercentage Manipulation In DLSS Editor Viewports\" setting under Editor Preferences -> Plugins -> NVIDIA DLSS"))
)
]
]
];
#else
#error "ENGINE_MAJOR_VERSION must be either 4 or 5"
#endif
}
bool FDLSSUpscalerEditor::EnableScreenpercentageInEditorViewports() const
{
if (GetDefault<UDLSSOverrideSettings>()->EnableScreenpercentageManipulationInDLSSEditorViewportsOverride == EDLSSSettingOverride::UseProjectSettings)
{
return GetDefault<UDLSSSettings>()->bEnableScreenpercentageManipulationInDLSSEditorViewports;
}
else
{
return GetDefault<UDLSSOverrideSettings>()->EnableScreenpercentageManipulationInDLSSEditorViewportsOverride == EDLSSSettingOverride::Enabled;
}
}
bool FDLSSUpscalerEditor::EnableDLSSInEditorViewports() const
{
if (GetDefault<UDLSSOverrideSettings>()->EnableDLSSInEditorViewportsOverride == EDLSSSettingOverride::UseProjectSettings)
{
return GetDefault<UDLSSSettings>()->bEnableDLSSInEditorViewports;
}
else
{
return GetDefault<UDLSSOverrideSettings>()->EnableDLSSInEditorViewportsOverride == EDLSSSettingOverride::Enabled;
}
}
bool FDLSSUpscalerEditor::OnScreenPercentageIsEnabled(const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const
{
check(DLSSUpscaler);
TSharedPtr<FFDLSSEditorViewportClientData> DLSSViewportData = GetOrCreateDLSSViewportData(&Arguments.Viewport->GetLevelViewportClient());
// adapted from SLevelViewportToolBar::OnScreenPercentageIsEnabled()
return EnableScreenpercentageInEditorViewports() && !DLSSViewportData->bIsFixedResolutionFraction && Arguments.Viewport->GetLevelViewportClient().SupportsPreviewResolutionFraction();
}
int32 FDLSSUpscalerEditor::OnGetScreenPercentageValue(const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const
{
// adapted from SLevelViewportToolBar::OnGetScreenPercentageValue(), using DLSSViewportData->ResolutionFraction
// We expose the resolution fraction derived from DPI, to not lie to the artist when screen percentage = 100%.
TSharedPtr<FFDLSSEditorViewportClientData> DLSSViewportData = GetOrCreateDLSSViewportData(&Arguments.Viewport->GetLevelViewportClient());
return FMath::RoundToInt(FMath::Clamp(
DLSSViewportData->ResolutionFraction,
DLSSViewportData->MinResolutionFraction,
DLSSViewportData->MaxResolutionFraction) * 100.0f);
}
void FDLSSUpscalerEditor::OnScreenPercentageValueChanged(int32 NewValue, const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const
{
// adapted from SLevelViewportToolBar::OnScreenPercentageValueChanged() and SetPreviewScreenPercentage()
FLevelEditorViewportClient& ViewportClient = Arguments.Viewport->GetLevelViewportClient();
TSharedPtr<FFDLSSEditorViewportClientData> DLSSViewportData = GetOrCreateDLSSViewportData(&ViewportClient);
DLSSViewportData->ResolutionFraction = (NewValue / 100.0f);
ViewportClient.Invalidate();
}
bool FDLSSUpscalerEditor::OnGetPreviewCustomTemporalUpscaler(const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const
{
return GetOrCreateDLSSViewportData(&Arguments.Viewport->GetLevelViewportClient())->bIsDLSSEnabled;
}
void FDLSSUpscalerEditor::OnSetPreviewCustomTemporalUpscaler(bool NewValue, const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const
{
FLevelEditorViewportClient& ViewportClient = Arguments.Viewport->GetLevelViewportClient();
TSharedPtr<FFDLSSEditorViewportClientData> DLSSViewportData = GetOrCreateDLSSViewportData(&ViewportClient);
DLSSViewportData->bIsDLSSEnabled = NewValue;
ViewportClient.Invalidate();
}
void FDLSSUpscalerEditor::OnPreviewCustomTemporalUpscalerChanged(bool NewValue, const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const
{
FLevelEditorViewportClient& ViewportClient = Arguments.Viewport->GetLevelViewportClient();
TSharedPtr<FFDLSSEditorViewportClientData> DLSSViewportData = GetOrCreateDLSSViewportData(&ViewportClient);
DLSSViewportData->bIsDLSSEnabled = NewValue;
ViewportClient.Invalidate();
}
void FDLSSUpscalerEditor::OnQualityModeSelected(EDLSSQualityMode InQualityLevel, const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments)
{
TSharedPtr<FFDLSSEditorViewportClientData> DLSSViewportData = GetOrCreateDLSSViewportData(&Arguments.Viewport->GetLevelViewportClient());
DLSSViewportData->bIsFixedResolutionFraction = DLSSUpscaler->IsFixedResolutionFraction(InQualityLevel);
DLSSViewportData->DLSSQualityMode = InQualityLevel;
if (DLSSViewportData->bIsFixedResolutionFraction)
{
DLSSViewportData->MinResolutionFraction = DLSSUpscaler->GetOptimalResolutionFractionForQuality(InQualityLevel);
DLSSViewportData->MaxResolutionFraction = DLSSUpscaler->GetOptimalResolutionFractionForQuality(InQualityLevel);
}
else
{
DLSSViewportData->MinResolutionFraction = DLSSUpscaler->GetMinUpsampleResolutionFraction();
DLSSViewportData->MaxResolutionFraction = DLSSUpscaler->GetMaxUpsampleResolutionFraction();
}
}
#undef LOCTEXT_NAMESPACE
@@ -1,50 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "Modules/ModuleManager.h"
class FDLSSUpscalerEditor;
class IDLSSEditorModuleInterface : public IModuleInterface
{
public:
virtual FDLSSUpscalerEditor* GetDLSSUpscalerEditor() const = 0;
};
class FDLSSEditorModule final : public IDLSSEditorModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() final;
virtual void ShutdownModule() final;
// Inherited via IDLSSEditorModuleInterface
virtual FDLSSUpscalerEditor* GetDLSSUpscalerEditor() const ;
private:
TSharedPtr<FDLSSUpscalerEditor> DLSSUpscalerEditor;
bool bIsDLSSAvailable = false;
};
@@ -1,70 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "CustomEditorStaticScreenPercentage.h"
DECLARE_LOG_CATEGORY_EXTERN(LogDLSSEditor, Log, All);
class FDLSSUpscaler;
enum class EDLSSQualityMode;
class SWidget;
class SLevelViewportToolBar;
class SDLSSSettings;
class FFDLSSEditorViewportClientData;
class FEditorViewportClient;
class DLSSEDITOR_API FDLSSUpscalerEditor : public TSharedFromThis<FDLSSUpscalerEditor>, public ICustomEditorStaticScreenPercentage
{
friend class SDLSSSettings;
public:
FDLSSUpscalerEditor(FDLSSUpscaler* InDLSSUpscaler);
virtual ~FDLSSUpscalerEditor();
// Inherited via ICustomEditorStaticScreenPercentage
virtual bool GenerateEditorViewportOptionsMenuEntry(const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments& Arguments) final;
virtual void SetupEditorViewFamily(FSceneViewFamily& ViewFamily, FEditorViewportClient* ViewportClient) final;
private:
bool OnScreenPercentageIsEnabled(const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const;
int32 OnGetScreenPercentageValue(const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const;
void OnScreenPercentageValueChanged(int32 NewValue, const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const;
bool OnGetPreviewCustomTemporalUpscaler(const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const;
void OnSetPreviewCustomTemporalUpscaler(bool NewValue, const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const;
void OnPreviewCustomTemporalUpscalerChanged(bool NewValue, const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments) const;
bool EnableScreenpercentageInEditorViewports() const;
bool EnableDLSSInEditorViewports() const;
TSharedRef<SWidget> GenerateScreenPercentageMenu(const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments& Arguments) const;
FDLSSUpscaler* DLSSUpscaler;
void OnQualityModeSelected(EDLSSQualityMode InQualityLevel, const ICustomEditorStaticScreenPercentage::FViewportMenuEntryArguments Arguments);
static TSharedPtr<FFDLSSEditorViewportClientData> GetOrCreateDLSSViewportData(FEditorViewportClient* ViewportClient);
};
@@ -1,57 +0,0 @@
/*
* Copyright (c) 2020 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
using UnrealBuildTool;
using System.IO;
public class DLSSUtility : ModuleRules
{
public DLSSUtility(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
}
);
PrivateIncludePaths.AddRange(
new string[] {
Path.Combine(EngineDirectory,"Source/Runtime/Renderer/Private"),
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"RenderCore",
"Renderer",
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Engine",
"RHI",
"Projects"
}
);
// 4.x and early access 5.0 engines used FVector2D type instead of FVector2f type for shader parameters
bool bEngineUsesFVector2D = (Target.Version.MajorVersion == 4) || (Target.Version.BranchName == "++UE5+Release-5.0-EarlyAccess");
PrivateDefinitions.Add(string.Format("DLSS_ENGINE_USES_FVECTOR2D={0}", bEngineUsesFVector2D ? "1" : "0"));
}
}
@@ -1,42 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include "DLSSUtility.h"
#include "Modules/ModuleManager.h"
#include "Interfaces/IPluginManager.h"
#include "ShaderCore.h"
#define LOCTEXT_NAMESPACE "FDLSSUtilityModule"
void FDLSSUtilityModule::StartupModule()
{
FString PluginShaderDir = FPaths::Combine(IPluginManager::Get().FindPlugin(TEXT("DLSS"))->GetBaseDir(), TEXT("Shaders"));
AddShaderSourceDirectoryMapping(TEXT("/Plugin/DLSS"), PluginShaderDir);
}
void FDLSSUtilityModule::ShutdownModule()
{
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FDLSSUtilityModule, DLSSUtility)
@@ -1,153 +0,0 @@
/*
* Copyright (c) 2020 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
#include "VelocityCombinePass.h"
const int32 kVelocityCombineComputeTileSizeX = FComputeShaderUtils::kGolden2DGroupSize;
const int32 kVelocityCombineComputeTileSizeY = FComputeShaderUtils::kGolden2DGroupSize;
class FDilateMotionVectorsDim : SHADER_PERMUTATION_BOOL("DILATE_MOTION_VECTORS");
class FVelocityCombineCS : public FGlobalShader
{
public:
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
{
// Only cook for the platforms/RHIs where DLSS is supported, which is DX11,DX12 and Vulkan [on Win64]
return IsFeatureLevelSupported(Parameters.Platform, ERHIFeatureLevel::SM5) &&
IsPCPlatform(Parameters.Platform) && (
IsVulkanSM5Platform(Parameters.Platform) ||
#if (ENGINE_MAJOR_VERSION == 4) && (ENGINE_MINOR_VERSION == 26)
IsD3DPlatform(Parameters.Platform, false));
#else
IsD3DPlatform(Parameters.Platform));
#endif
}
static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
{
FGlobalShader::ModifyCompilationEnvironment(Parameters, OutEnvironment);
OutEnvironment.SetDefine(TEXT("THREADGROUP_SIZEX"), kVelocityCombineComputeTileSizeX);
OutEnvironment.SetDefine(TEXT("THREADGROUP_SIZEY"), kVelocityCombineComputeTileSizeY);
}
using FPermutationDomain = TShaderPermutationDomain<FDilateMotionVectorsDim>;
DECLARE_GLOBAL_SHADER(FVelocityCombineCS);
SHADER_USE_PARAMETER_STRUCT(FVelocityCombineCS, FGlobalShader);
BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
// Input images
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, VelocityTexture)
SHADER_PARAMETER_SAMPLER(SamplerState, VelocityTextureSampler)
SHADER_PARAMETER_STRUCT(FScreenPassTextureViewportParameters, Velocity)
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, DepthTexture)
SHADER_PARAMETER_SAMPLER(SamplerState, DepthTextureSampler)
#if DLSS_ENGINE_USES_FVECTOR2D
SHADER_PARAMETER(FVector2D, TemporalJitterPixels)
#else
SHADER_PARAMETER(FVector2f, TemporalJitterPixels)
#endif
SHADER_PARAMETER_STRUCT_REF(FViewUniformShaderParameters, View)
// Output images
SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D, OutVelocityCombinedTexture)
SHADER_PARAMETER_STRUCT(FScreenPassTextureViewportParameters, CombinedVelocity)
END_SHADER_PARAMETER_STRUCT()
};
IMPLEMENT_GLOBAL_SHADER(FVelocityCombineCS, "/Plugin/DLSS/Private/VelocityCombine.usf", "VelocityCombineMain", SF_Compute);
FRDGTextureRef AddVelocityCombinePass(
FRDGBuilder& GraphBuilder,
const FViewInfo& View,
FRDGTextureRef InSceneDepthTexture,
FRDGTextureRef InVelocityTexture,
bool bDilateMotionVectors
)
{
const FIntRect InputViewRect = View.ViewRect;
const FIntRect OutputViewRect = FIntRect( FIntPoint::ZeroValue, bDilateMotionVectors ? View.GetSecondaryViewRectSize() : View.ViewRect.Size());
FRDGTextureDesc CombinedVelocityDesc = FRDGTextureDesc::Create2D(
OutputViewRect.Size(),
PF_G16R16F,
FClearValueBinding::Black,
TexCreate_ShaderResource | TexCreate_UAV);
const TCHAR* OutputName = TEXT("DLSSCombinedVelocity");
FRDGTextureRef CombinedVelocityTexture = GraphBuilder.CreateTexture(
CombinedVelocityDesc,
OutputName);
FVelocityCombineCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FVelocityCombineCS::FParameters>();
// input velocity
{
PassParameters->VelocityTexture = InVelocityTexture;
PassParameters->VelocityTextureSampler = TStaticSamplerState<SF_Point>::GetRHI();
// we use InSceneDepthTexture here and not InVelocityTexture since the latter can be a 1x1 black texture
check(InVelocityTexture->Desc.Extent == FIntPoint(1, 1) || InVelocityTexture->Desc.Extent == InSceneDepthTexture->Desc.Extent);
FScreenPassTextureViewport velocityViewport(InSceneDepthTexture, InputViewRect);
FScreenPassTextureViewportParameters velocityViewportParameters = GetScreenPassTextureViewportParameters(velocityViewport);
PassParameters->Velocity = velocityViewportParameters;
}
// input depth
{
PassParameters->DepthTexture = InSceneDepthTexture;
PassParameters->DepthTextureSampler = TStaticSamplerState<SF_Point>::GetRHI();
}
// output combined velocity
{
PassParameters->OutVelocityCombinedTexture = GraphBuilder.CreateUAV(CombinedVelocityTexture);
FScreenPassTextureViewport CombinedVelocityViewport(CombinedVelocityTexture, OutputViewRect);
FScreenPassTextureViewportParameters CombinedVelocityViewportParameters = GetScreenPassTextureViewportParameters(CombinedVelocityViewport);
PassParameters->CombinedVelocity = CombinedVelocityViewportParameters;
}
// various state
{
#if ENGINE_MAJOR_VERSION < 5
PassParameters->TemporalJitterPixels = View.TemporalJitterPixels;
#else
PassParameters->TemporalJitterPixels = FVector2f(View.TemporalJitterPixels); // LWC_TODO: Precision loss
#endif
PassParameters->View = View.ViewUniformBuffer;
}
FVelocityCombineCS::FPermutationDomain PermutationVector;
PermutationVector.Set<FDilateMotionVectorsDim>(bDilateMotionVectors);
TShaderMapRef<FVelocityCombineCS> ComputeShader(View.ShaderMap, PermutationVector);
FComputeShaderUtils::AddPass(
GraphBuilder,
RDG_EVENT_NAME("Velocity Combine%s (%dx%d -> %dx%d)",
bDilateMotionVectors ? TEXT(" Dilate") : TEXT(""),
InputViewRect.Width(), InputViewRect.Height(),
OutputViewRect.Width(), OutputViewRect.Height()
),
ComputeShader,
PassParameters,
FComputeShaderUtils::GetGroupCount(OutputViewRect.Size(), FComputeShaderUtils::kGolden2DGroupSize));
return CombinedVelocityTexture;
}
@@ -1,35 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "Modules/ModuleManager.h"
class FDLSSUtilityModule final : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
private:
};
@@ -1,34 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "CoreMinimal.h"
#include "RendererInterface.h"
#include "ScreenPass.h"
extern DLSSUTILITY_API FRDGTextureRef AddVelocityCombinePass(
FRDGBuilder& GraphBuilder,
const FViewInfo& View,
FRDGTextureRef InSceneDepthTexture,
FRDGTextureRef InVelocityTexture,
bool bDilateMotionVectors
);
@@ -1,79 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
using UnrealBuildTool;
using System.IO;
public class NGXD3D11RHI : ModuleRules
{
public NGXD3D11RHI(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
}
);
PrivateIncludePaths.AddRange(
new string[] {
Path.Combine(EngineDirectory,"Source/Runtime/Windows/D3D11RHI/Private"),
Path.Combine(EngineDirectory,"Source/Runtime/Windows/D3D11RHI/Private/Windows"),
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Core",
"Engine",
"RenderCore",
"RHI",
"D3D11RHI",
"NGX",
"NGXRHI",
}
);
if (ReadOnlyBuildVersion.Current.MajorVersion == 5)
{
PrivateDependencyModuleNames.Add("RHICore");
}
// those come from the D3D11RHI
AddEngineThirdPartyPrivateStaticDependencies(Target, "DX11");
AddEngineThirdPartyPrivateStaticDependencies(Target, "NVAPI");
AddEngineThirdPartyPrivateStaticDependencies(Target, "NVAftermath");
AddEngineThirdPartyPrivateStaticDependencies(Target, "IntelMetricsDiscovery");
AddEngineThirdPartyPrivateStaticDependencies(Target, "IntelExtensionsFramework");
}
}
@@ -1,330 +0,0 @@
/*
* Copyright (c) 2020 - 2021 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include "NGXD3D11RHI.h"
#include "nvsdk_ngx.h"
#include "nvsdk_ngx_helpers.h"
#include "D3D11RHIPrivate.h"
#include "D3D11Util.h"
#include "D3D11State.h"
#include "D3D11Resources.h"
#include "D3D11Viewport.h"
#include "D3D11ConstantBuffer.h"
#include "D3D11StateCache.h"
#include "RHIValidationCommon.h"
#include "GenericPlatform/GenericPlatformFile.h"
DEFINE_LOG_CATEGORY_STATIC(LogDLSSNGXD3D11RHI, Log, All);
#define LOCTEXT_NAMESPACE "FNGXD3D11RHIModule"
class FD3D11NGXFeatureHandle final : public NGXDLSSFeature
{
public:
using NGXDLSSFeature::NGXDLSSFeature;
virtual ~FD3D11NGXFeatureHandle()
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
check(NGXRHI::NGXInitialized());
NVSDK_NGX_Result ResultReleaseFeature = NVSDK_NGX_D3D11_ReleaseFeature(Feature);
checkf(NVSDK_NGX_SUCCEED(ResultReleaseFeature), TEXT("NVSDK_NGX_D3D11_ReleaseFeature failed! (%u %s), %s"), ResultReleaseFeature, GetNGXResultAsString(ResultReleaseFeature), *Desc.GetDebugDescription());
if (NGXRHI::SupportsAllocateParameters())
{
NVSDK_NGX_Result ResultDestroyParameter = NVSDK_NGX_D3D11_DestroyParameters(Parameter);
checkf(NVSDK_NGX_SUCCEED(ResultDestroyParameter), TEXT("NVSDK_NGX_D3D11_DestroyParameters failed! (%u %s), %s"), ResultDestroyParameter, GetNGXResultAsString(ResultDestroyParameter), *Desc.GetDebugDescription());
}
}
};
class FNGXD3D11RHI final : public NGXRHI
{
public:
FNGXD3D11RHI(const FNGXRHICreateArguments& Arguments);
virtual void ExecuteDLSS(FRHICommandList& CmdList, const FRHIDLSSArguments& InArguments, FDLSSStateRef InDLSSState) final;
virtual ~FNGXD3D11RHI();
private:
FD3D11DynamicRHI* D3D11RHI = nullptr;
ID3D11Device* Direct3DDevice = nullptr;
ID3D11DeviceContext* Direct3DDeviceIMContext = nullptr;
NVSDK_NGX_Result Init_NGX_D3D11(const FNGXRHICreateArguments& InArguments, const wchar_t* InApplicationDataPath, ID3D11Device* InHandle, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo);
static bool IsIncompatibleAPICaptureToolActive(ID3D11Device* InDirect3DDevice);
};
bool FNGXD3D11RHI::IsIncompatibleAPICaptureToolActive(ID3D11Device* InDirect3DDevice)
{
// RenderDoc
{
IID RenderDocID;
if (SUCCEEDED(IIDFromString(L"{A7AA6116-9C8D-4BBA-9083-B4D816B71B78}", &RenderDocID)))
{
TRefCountPtr<IUnknown> RenderDoc;
if (SUCCEEDED(InDirect3DDevice->QueryInterface(RenderDocID, (void**)RenderDoc.GetInitReference())))
{
return true;
}
}
}
return false;
}
NVSDK_NGX_Result FNGXD3D11RHI::Init_NGX_D3D11(const FNGXRHICreateArguments& InArguments, const wchar_t* InApplicationDataPath, ID3D11Device* InHandle, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo)
{
NVSDK_NGX_Result Result = NVSDK_NGX_Result_Fail;
int32 APIVersion = NVSDK_NGX_VERSION_API_MACRO;
do
{
if (InArguments.InitializeNGXWithNGXApplicationID())
{
Result = NVSDK_NGX_D3D11_Init(InArguments.NGXAppId, InApplicationDataPath, InHandle, InFeatureInfo, static_cast<NVSDK_NGX_Version>(APIVersion));
UE_LOG(LogDLSSNGXD3D11RHI, Log, TEXT("NVSDK_NGX_D3D11_Init(AppID= %u, APIVersion = 0x%x) -> (%u %s)"), InArguments.NGXAppId, APIVersion, Result, GetNGXResultAsString(Result));
}
else
{
Result = NVSDK_NGX_D3D11_Init_with_ProjectID(TCHAR_TO_UTF8(*InArguments.UnrealProjectID), NVSDK_NGX_ENGINE_TYPE_UNREAL, TCHAR_TO_UTF8(*InArguments.UnrealEngineVersion), InApplicationDataPath, InHandle, InFeatureInfo, static_cast<NVSDK_NGX_Version>(APIVersion));
UE_LOG(LogDLSSNGXD3D11RHI, Log, TEXT("NVSDK_NGX_D3D11_Init_with_ProjectID(ProjectID = %s, EngineVersion=%s, APIVersion = 0x%x) -> (%u %s)"), *InArguments.UnrealProjectID, *InArguments.UnrealEngineVersion, APIVersion, Result, GetNGXResultAsString(Result));
}
if (NVSDK_NGX_FAILED(Result))
{
NVSDK_NGX_D3D11_Shutdown();
}
--APIVersion;
} while (NVSDK_NGX_FAILED(Result) && APIVersion >= NVSDK_NGX_VERSION_API_MACRO_BASE_LINE);
if (!NVSDK_NGX_FAILED(Result) && (APIVersion + 1 < NVSDK_NGX_VERSION_API_MACRO_WITH_LOGGING))
{
UE_LOG(LogDLSSNGXD3D11RHI, Log, TEXT("Warning: NVSDK_NGX_D3D11_Init succeeded, but the driver installed on this system is too old the support the NGX logging API. The console variables r.NGX.LogLevel and r.NGX.EnableOtherLoggingSinks will have no effect and NGX logs will only show up in their own log files, and not in UE's log files."));
}
return Result;
}
FNGXD3D11RHI::FNGXD3D11RHI(const FNGXRHICreateArguments& Arguments)
: NGXRHI(Arguments)
, D3D11RHI(static_cast<FD3D11DynamicRHI*>(Arguments.DynamicRHI))
, Direct3DDevice(D3D11RHI->GetDevice())
, Direct3DDeviceIMContext(D3D11RHI->GetDeviceContext())
{
ensure(D3D11RHI);
ensure(Direct3DDevice);
bIsIncompatibleAPICaptureToolActive = IsIncompatibleAPICaptureToolActive(Direct3DDevice);
const FString NGXLogDir = GetNGXLogDirectory();
IPlatformFile::GetPlatformPhysical().CreateDirectoryTree(*NGXLogDir);
NVSDK_NGX_Result ResultInit = Init_NGX_D3D11(Arguments, *NGXLogDir, Direct3DDevice, CommonFeatureInfo());
UE_LOG(LogDLSSNGXD3D11RHI, Log, TEXT("NVSDK_NGX_D3D11_Init (Log %s) -> (%u %s)"), *NGXLogDir, ResultInit, GetNGXResultAsString(ResultInit));
// store for the higher level code interpret
DLSSQueryFeature.DLSSInitResult = ResultInit;
if (NVSDK_NGX_Result_FAIL_OutOfDate == ResultInit)
{
DLSSQueryFeature.DriverRequirements.DriverUpdateRequired = true;
}
else if (NVSDK_NGX_SUCCEED(ResultInit))
{
bNGXInitialized = true;
NVSDK_NGX_Result ResultGetParameters = NVSDK_NGX_D3D11_GetCapabilityParameters(&DLSSQueryFeature.CapabilityParameters);
UE_LOG(LogDLSSNGXD3D11RHI, Log, TEXT("NVSDK_NGX_D3D11_GetCapabilityParameters -> (%u %s)"), ResultGetParameters, GetNGXResultAsString(ResultGetParameters));
if (NVSDK_NGX_Result_FAIL_OutOfDate == ResultGetParameters)
{
DLSSQueryFeature.DriverRequirements.DriverUpdateRequired = true;
}
if (NVSDK_NGX_FAILED(ResultGetParameters))
{
ResultGetParameters = NVSDK_NGX_D3D11_GetParameters(&DLSSQueryFeature.CapabilityParameters);
UE_LOG(LogDLSSNGXD3D11RHI, Log, TEXT("NVSDK_NGX_D3D11_GetParameters -> (%u %s)"), ResultGetParameters, GetNGXResultAsString(ResultGetParameters));
bSupportsAllocateParameters = false;
}
if (NVSDK_NGX_SUCCEED(ResultGetParameters))
{
DLSSQueryFeature.QueryDLSSSupport();
}
}
}
FNGXD3D11RHI::~FNGXD3D11RHI()
{
UE_LOG(LogDLSSNGXD3D11RHI, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
if(bNGXInitialized)
{
// Destroy the parameters and features before we call NVSDK_NGX_D3D11_Shutdown
ReleaseAllocatedFeatures();
NVSDK_NGX_Result Result;
if (bSupportsAllocateParameters && DLSSQueryFeature.CapabilityParameters)
{
Result = NVSDK_NGX_D3D11_DestroyParameters(DLSSQueryFeature.CapabilityParameters);
UE_LOG(LogDLSSNGXD3D11RHI, Log, TEXT("NVSDK_NGX_D3D11_DestroyParameters -> (%u %s)"), Result, GetNGXResultAsString(Result));
}
Result = NVSDK_NGX_D3D11_Shutdown();
UE_LOG(LogDLSSNGXD3D11RHI, Log, TEXT("NVSDK_NGX_D3D11_Shutdown -> (%u %s)"), Result, GetNGXResultAsString(Result));
bNGXInitialized = false;
}
UE_LOG(LogDLSSNGXD3D11RHI, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
void FNGXD3D11RHI::ExecuteDLSS(FRHICommandList& CmdList, const FRHIDLSSArguments& InArguments, FDLSSStateRef InDLSSState)
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
check(IsDLSSAvailable());
if (!IsDLSSAvailable())
return;
InArguments.Validate();
if (InDLSSState->RequiresFeatureRecreation(InArguments))
{
check(!InDLSSState->DLSSFeature || InDLSSState->HasValidFeature());
InDLSSState->DLSSFeature = nullptr;
}
if (InArguments.bReset)
{
check(!InDLSSState->DLSSFeature);
InDLSSState->DLSSFeature = FindFreeFeature(InArguments);
}
if (!InDLSSState->DLSSFeature)
{
NVSDK_NGX_Parameter* NewNGXParameterHandle = nullptr;
if (NGXRHI::SupportsAllocateParameters())
{
NVSDK_NGX_Result Result = NVSDK_NGX_D3D11_AllocateParameters(&NewNGXParameterHandle);
checkf(NVSDK_NGX_SUCCEED(Result), TEXT("NVSDK_NGX_D3D11_AllocateParameters failed! (%u %s)"), Result, GetNGXResultAsString(Result));
}
else
{
NVSDK_NGX_Result Result = NVSDK_NGX_D3D11_GetParameters(&NewNGXParameterHandle);
checkf(NVSDK_NGX_SUCCEED(Result), TEXT("NVSDK_NGX_D3D11_GetParameters failed! (%u %s)"), Result, GetNGXResultAsString(Result));
}
ApplyCommonNGXParameterSettings(NewNGXParameterHandle, InArguments);
NVSDK_NGX_DLSS_Create_Params DlssCreateParams = InArguments.GetNGXDLSSCreateParams();
NVSDK_NGX_Handle* NewNGXHandle = nullptr;
NVSDK_NGX_Result ResultCreate = NGX_D3D11_CREATE_DLSS_EXT(
Direct3DDeviceIMContext,
&NewNGXHandle,
NewNGXParameterHandle,
&DlssCreateParams);
checkf(NVSDK_NGX_SUCCEED(ResultCreate), TEXT("NGX_D3D11_CREATE_DLSS failed! (%u %s), %s"), ResultCreate, GetNGXResultAsString(ResultCreate), *InArguments.GetFeatureDesc().GetDebugDescription());
InDLSSState->DLSSFeature = MakeShared<FD3D11NGXFeatureHandle>(NewNGXHandle, NewNGXParameterHandle, InArguments.GetFeatureDesc(), FrameCounter);
RegisterFeature(InDLSSState->DLSSFeature);
}
check(InDLSSState->HasValidFeature());
// execute
D3D11RHI->RegisterGPUWork(1);
NVSDK_NGX_D3D11_DLSS_Eval_Params DlssEvalParams;
FMemory::Memzero(DlssEvalParams);
DlssEvalParams.Feature.pInOutput = GetD3D11TextureFromRHITexture(InArguments.OutputColor)->GetResource();
DlssEvalParams.InOutputSubrectBase.X = InArguments.DestRect.Min.X;
DlssEvalParams.InOutputSubrectBase.Y = InArguments.DestRect.Min.Y;
DlssEvalParams.InRenderSubrectDimensions.Width = InArguments.SrcRect.Width();
DlssEvalParams.InRenderSubrectDimensions.Height = InArguments.SrcRect.Height();
DlssEvalParams.Feature.pInColor = GetD3D11TextureFromRHITexture(InArguments.InputColor)->GetResource();
DlssEvalParams.InColorSubrectBase.X = InArguments.SrcRect.Min.X;
DlssEvalParams.InColorSubrectBase.Y = InArguments.SrcRect.Min.Y;
DlssEvalParams.pInDepth = GetD3D11TextureFromRHITexture(InArguments.InputDepth)->GetResource();
DlssEvalParams.InDepthSubrectBase.X = InArguments.SrcRect.Min.X;
DlssEvalParams.InDepthSubrectBase.Y = InArguments.SrcRect.Min.Y;
// The VelocityCombine pass puts the motion vectors into the top left corner
DlssEvalParams.pInMotionVectors = GetD3D11TextureFromRHITexture(InArguments.InputMotionVectors)->GetResource();
DlssEvalParams.InMVSubrectBase.X = 0;
DlssEvalParams.InMVSubrectBase.Y = 0;
DlssEvalParams.pInExposureTexture = InArguments.bUseAutoExposure ? nullptr : GetD3D11TextureFromRHITexture(InArguments.InputExposure)->GetResource();
DlssEvalParams.InPreExposure = InArguments.PreExposure;
DlssEvalParams.Feature.InSharpness = InArguments.Sharpness;
DlssEvalParams.InJitterOffsetX = InArguments.JitterOffset.X;
DlssEvalParams.InJitterOffsetY = InArguments.JitterOffset.Y;
DlssEvalParams.InMVScaleX = InArguments.MotionVectorScale.X;
DlssEvalParams.InMVScaleY = InArguments.MotionVectorScale.Y;
DlssEvalParams.InReset = InArguments.bReset;
DlssEvalParams.InFrameTimeDeltaInMsec = InArguments.DeltaTime;
NVSDK_NGX_Result ResultEvaluate = NGX_D3D11_EVALUATE_DLSS_EXT(
Direct3DDeviceIMContext,
InDLSSState->DLSSFeature->Feature,
InDLSSState->DLSSFeature->Parameter,
&DlssEvalParams
);
checkf(NVSDK_NGX_SUCCEED(ResultEvaluate), TEXT("NGX_D3D11_EVALUATE_DLSS_EXT failed! (%u %s), %s"), ResultEvaluate, GetNGXResultAsString(ResultEvaluate), *InDLSSState->DLSSFeature->Desc.GetDebugDescription());
InDLSSState->DLSSFeature->Tick(FrameCounter);
}
/** IModuleInterface implementation */
void FNGXD3D11RHIModule::StartupModule()
{
// NGXRHI module should be loaded to ensure logging state is initialized
FModuleManager::LoadModuleChecked<INGXRHIModule>(TEXT("NGXRHI"));
}
void FNGXD3D11RHIModule::ShutdownModule()
{
}
TUniquePtr<NGXRHI> FNGXD3D11RHIModule::CreateNGXRHI(const FNGXRHICreateArguments& Arguments)
{
TUniquePtr<NGXRHI> Result(new FNGXD3D11RHI(Arguments));
return Result;
}
IMPLEMENT_MODULE(FNGXD3D11RHIModule, NGXD3D11RHI)
#undef LOCTEXT_NAMESPACE
@@ -1,36 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "Modules/ModuleManager.h"
#include "NGXRHI.h"
class FNGXD3D11RHIModule final : public INGXRHIModule
{
public:
/** IModuleInterface implementation */
virtual void StartupModule();
virtual void ShutdownModule();
/** INGXRHIModule implementation */
virtual TUniquePtr<NGXRHI> CreateNGXRHI(const FNGXRHICreateArguments& Arguments);
};
@@ -1,73 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
using UnrealBuildTool;
using System.IO;
public class NGXD3D12RHI : ModuleRules
{
public NGXD3D12RHI(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
}
);
PrivateIncludePaths.AddRange(
new string[] {
Path.Combine(EngineDirectory,"Source/Runtime/D3D12RHI/Private"),
Path.Combine(EngineDirectory,"Source/Runtime/D3D12RHI/Private/Windows"),
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Core",
"Engine",
"RenderCore",
"RHI",
"D3D12RHI",
"NGX",
"NGXRHI",
}
);
if (ReadOnlyBuildVersion.Current.MajorVersion == 5)
{
PrivateDependencyModuleNames.Add("RHICore");
}
// those come from the D3D12RHI
AddEngineThirdPartyPrivateStaticDependencies(Target, "DX12");
AddEngineThirdPartyPrivateStaticDependencies(Target, "NVAPI");
AddEngineThirdPartyPrivateStaticDependencies(Target, "NVAftermath");
AddEngineThirdPartyPrivateStaticDependencies(Target, "IntelMetricsDiscovery");
AddEngineThirdPartyPrivateStaticDependencies(Target, "IntelExtensionsFramework");
}
}
@@ -1,343 +0,0 @@
/*
* Copyright (c) 2020 - 2021 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include "NGXD3D12RHI.h"
#include "nvsdk_ngx.h"
#include "nvsdk_ngx_helpers.h"
#include "D3D12RHIPrivate.h"
#include "D3D12Util.h"
#include "D3D12State.h"
#include "D3D12Resources.h"
#include "D3D12Viewport.h"
#include "D3D12ConstantBuffer.h"
#include "RHIValidationCommon.h"
#include "GenericPlatform/GenericPlatformFile.h"
DEFINE_LOG_CATEGORY_STATIC(LogDLSSNGXD3D12RHI, Log, All);
#define LOCTEXT_NAMESPACE "FNGXD3D12RHIModule"
class FD3D12NGXDLSSFeature final : public NGXDLSSFeature
{
public:
using NGXDLSSFeature::NGXDLSSFeature;
virtual ~FD3D12NGXDLSSFeature()
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
check(NGXRHI::NGXInitialized());
NVSDK_NGX_Result ResultReleaseFeature = NVSDK_NGX_D3D12_ReleaseFeature(Feature);
checkf(NVSDK_NGX_SUCCEED(ResultReleaseFeature), TEXT("NVSDK_NGX_D3D12_ReleaseFeature failed! (%u %s), %s"), ResultReleaseFeature, GetNGXResultAsString(ResultReleaseFeature), *Desc.GetDebugDescription());
if (NGXRHI::SupportsAllocateParameters())
{
NVSDK_NGX_Result ResultDestroyParameter = NVSDK_NGX_D3D12_DestroyParameters(Parameter);
checkf(NVSDK_NGX_SUCCEED(ResultDestroyParameter), TEXT("NVSDK_NGX_D3D12_DestroyParameters failed! (%u %s), %s"), ResultDestroyParameter, GetNGXResultAsString(ResultDestroyParameter), *Desc.GetDebugDescription());
}
}
};
class FNGXD3D12RHI final : public NGXRHI
{
public:
FNGXD3D12RHI(const FNGXRHICreateArguments& Arguments);
virtual void ExecuteDLSS(FRHICommandList& CmdList, const FRHIDLSSArguments& InArguments, FDLSSStateRef InDLSSState) final;
virtual ~FNGXD3D12RHI();
private:
NVSDK_NGX_Result Init_NGX_D3D12(const FNGXRHICreateArguments& InArguments, const wchar_t* InApplicationDataPath, ID3D12Device* InHandle, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo);
static bool IsIncompatibleAPICaptureToolActive(ID3D12Device* InDirect3DDevice);
FD3D12DynamicRHI* D3D12RHI = nullptr;
};
bool FNGXD3D12RHI::IsIncompatibleAPICaptureToolActive(ID3D12Device* InDirect3DDevice)
{
// RenderDoc
{
IID RenderDocID;
if (SUCCEEDED(IIDFromString(L"{A7AA6116-9C8D-4BBA-9083-B4D816B71B78}", &RenderDocID)))
{
TRefCountPtr<IUnknown> RenderDoc;
if (SUCCEEDED(InDirect3DDevice->QueryInterface(RenderDocID, (void**)RenderDoc.GetInitReference())))
{
return true;
}
}
}
return false;
}
NVSDK_NGX_Result FNGXD3D12RHI::Init_NGX_D3D12(const FNGXRHICreateArguments& InArguments, const wchar_t* InApplicationDataPath, ID3D12Device* InHandle, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo)
{
NVSDK_NGX_Result Result = NVSDK_NGX_Result_Fail;
int32 APIVersion = NVSDK_NGX_VERSION_API_MACRO;
do
{
if (InArguments.InitializeNGXWithNGXApplicationID())
{
Result = NVSDK_NGX_D3D12_Init(InArguments.NGXAppId, InApplicationDataPath, InHandle, InFeatureInfo, static_cast<NVSDK_NGX_Version>(APIVersion));
UE_LOG(LogDLSSNGXD3D12RHI, Log, TEXT("NVSDK_NGX_D3D12_Init(AppID= %u, APIVersion = 0x%x, Device=%p) -> (%u %s)"), InArguments.NGXAppId, APIVersion, InHandle, Result, GetNGXResultAsString(Result));
}
else
{
Result = NVSDK_NGX_D3D12_Init_with_ProjectID(TCHAR_TO_UTF8(*InArguments.UnrealProjectID), NVSDK_NGX_ENGINE_TYPE_UNREAL, TCHAR_TO_UTF8(*InArguments.UnrealEngineVersion), InApplicationDataPath, InHandle, InFeatureInfo, static_cast<NVSDK_NGX_Version>(APIVersion));
UE_LOG(LogDLSSNGXD3D12RHI, Log, TEXT("NVSDK_NGX_D3D12_Init_with_ProjectID(ProjectID = %s, EngineVersion=%s, APIVersion = 0x%x, Device=%p) -> (%u %s)"), *InArguments.UnrealProjectID, *InArguments.UnrealEngineVersion, APIVersion, InHandle, Result, GetNGXResultAsString(Result));
}
if (NVSDK_NGX_FAILED(Result))
{
NVSDK_NGX_D3D12_Shutdown();
}
--APIVersion;
} while (NVSDK_NGX_FAILED(Result) && APIVersion >= NVSDK_NGX_VERSION_API_MACRO_BASE_LINE);
if (NVSDK_NGX_SUCCEED(Result) && (APIVersion + 1 < NVSDK_NGX_VERSION_API_MACRO_WITH_LOGGING))
{
UE_LOG(LogDLSSNGXD3D12RHI, Log, TEXT("Warning: NVSDK_NGX_D3D12_Init succeeded, but the driver installed on this system is too old the support the NGX logging API. The console variables r.NGX.LogLevel and r.NGX.EnableOtherLoggingSinks will have no effect and NGX logs will only show up in their own log files, and not in UE's log files."));
}
return Result;
}
FNGXD3D12RHI::FNGXD3D12RHI(const FNGXRHICreateArguments& Arguments)
: NGXRHI(Arguments)
, D3D12RHI(static_cast<FD3D12DynamicRHI*>(Arguments.DynamicRHI))
{
ID3D12Device* Direct3DDevice = D3D12RHI->GetAdapter().GetD3DDevice();
ensure(D3D12RHI);
ensure(Direct3DDevice);
bIsIncompatibleAPICaptureToolActive = IsIncompatibleAPICaptureToolActive(Direct3DDevice);
const FString NGXLogDir = GetNGXLogDirectory();
IPlatformFile::GetPlatformPhysical().CreateDirectoryTree(*NGXLogDir);
NVSDK_NGX_Result ResultInit = Init_NGX_D3D12(Arguments, *NGXLogDir, Direct3DDevice, CommonFeatureInfo());
UE_LOG(LogDLSSNGXD3D12RHI, Log, TEXT("NVSDK_NGX_D3D12_Init (Log %s) -> (%u %s)"), *NGXLogDir, ResultInit, GetNGXResultAsString(ResultInit));
// store for the higher level code interpret
DLSSQueryFeature.DLSSInitResult = ResultInit;
if (NVSDK_NGX_Result_FAIL_OutOfDate == ResultInit)
{
DLSSQueryFeature.DriverRequirements.DriverUpdateRequired = true;
}
else if (NVSDK_NGX_SUCCEED(ResultInit))
{
bNGXInitialized = true;
NVSDK_NGX_Result ResultGetParameters = NVSDK_NGX_D3D12_GetCapabilityParameters(&DLSSQueryFeature.CapabilityParameters);
UE_LOG(LogDLSSNGXD3D12RHI, Log, TEXT("NVSDK_NGX_D3D12_GetCapabilityParameters -> (%u %s)"), ResultGetParameters, GetNGXResultAsString(ResultGetParameters));
if (NVSDK_NGX_Result_FAIL_OutOfDate == ResultGetParameters)
{
DLSSQueryFeature.DriverRequirements.DriverUpdateRequired = true;
}
if (NVSDK_NGX_FAILED(ResultGetParameters))
{
ResultGetParameters = NVSDK_NGX_D3D12_GetParameters(&DLSSQueryFeature.CapabilityParameters);
UE_LOG(LogDLSSNGXD3D12RHI, Log, TEXT("NVSDK_NGX_D3D12_GetParameters -> (%u %s)"), ResultGetParameters, GetNGXResultAsString(ResultGetParameters));
bSupportsAllocateParameters = false;
}
if (NVSDK_NGX_SUCCEED(ResultGetParameters))
{
DLSSQueryFeature.QueryDLSSSupport();
}
}
}
FNGXD3D12RHI::~FNGXD3D12RHI()
{
UE_LOG(LogDLSSNGXD3D12RHI, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
if (bNGXInitialized)
{
// Destroy the parameters and features before we call NVSDK_NGX_D3D11_Shutdown
ReleaseAllocatedFeatures();
NVSDK_NGX_Result Result;
if (bSupportsAllocateParameters && DLSSQueryFeature.CapabilityParameters)
{
Result = NVSDK_NGX_D3D12_DestroyParameters(DLSSQueryFeature.CapabilityParameters);
UE_LOG(LogDLSSNGXD3D12RHI, Log, TEXT("NVSDK_NGX_D3D12_DestroyParameters -> (%u %s)"), Result, GetNGXResultAsString(Result));
}
Result = NVSDK_NGX_D3D12_Shutdown();
UE_LOG(LogDLSSNGXD3D12RHI, Log, TEXT("NVSDK_NGX_D3D12_Shutdown -> (%u %s)"), Result, GetNGXResultAsString(Result));
bNGXInitialized = false;
}
UE_LOG(LogDLSSNGXD3D12RHI, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
void FNGXD3D12RHI::ExecuteDLSS(FRHICommandList& CmdList, const FRHIDLSSArguments& InArguments, FDLSSStateRef InDLSSState)
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
check(IsDLSSAvailable());
if (!IsDLSSAvailable()) return;
InArguments.Validate();
FD3D12Device* Device = D3D12RHI->GetAdapter().GetDevice(CmdList.GetGPUMask().ToIndex());
ID3D12GraphicsCommandList* D3DGraphicsCommandList = Device->GetCommandContext().CommandListHandle.GraphicsCommandList();
if (InDLSSState->RequiresFeatureRecreation(InArguments))
{
check(!InDLSSState->DLSSFeature || InDLSSState->HasValidFeature());
InDLSSState->DLSSFeature = nullptr;
}
if (InArguments.bReset)
{
check(!InDLSSState->DLSSFeature);
InDLSSState->DLSSFeature = FindFreeFeature(InArguments);
}
if (!InDLSSState->DLSSFeature)
{
NVSDK_NGX_Parameter* NewNGXParameterHandle = nullptr;
if (NGXRHI::SupportsAllocateParameters())
{
NVSDK_NGX_Result Result = NVSDK_NGX_D3D12_AllocateParameters(&NewNGXParameterHandle);
checkf(NVSDK_NGX_SUCCEED(Result), TEXT("NVSDK_NGX_D3D12_AllocateParameters failed! (%u %s)"), Result, GetNGXResultAsString(Result));
}
else
{
NVSDK_NGX_Result Result = NVSDK_NGX_D3D12_GetParameters(&NewNGXParameterHandle);
checkf(NVSDK_NGX_SUCCEED(Result), TEXT("NVSDK_NGX_D3D12_GetParameters failed! (%u %s)"), Result, GetNGXResultAsString(Result));
}
ApplyCommonNGXParameterSettings(NewNGXParameterHandle, InArguments);
NVSDK_NGX_DLSS_Create_Params DlssCreateParams = InArguments.GetNGXDLSSCreateParams();
NVSDK_NGX_Handle* NewNGXFeatureHandle = nullptr;
const uint32 CreationNodeMask = 1 << InArguments.GPUNode;
const uint32 VisibilityNodeMask = InArguments.GPUVisibility;
NVSDK_NGX_Result ResultCreate = NGX_D3D12_CREATE_DLSS_EXT(
D3DGraphicsCommandList,
CreationNodeMask,
VisibilityNodeMask,
&NewNGXFeatureHandle,
NewNGXParameterHandle,
&DlssCreateParams
);
checkf(NVSDK_NGX_SUCCEED(ResultCreate), TEXT("NGX_D3D12_CREATE_DLSS_EXT (CreationNodeMask=0x%x VisibilityNodeMask=0x%x) failed! (%u %s), %s"), CreationNodeMask, VisibilityNodeMask, ResultCreate, GetNGXResultAsString(ResultCreate), *InArguments.GetFeatureDesc().GetDebugDescription());
InDLSSState->DLSSFeature = MakeShared<FD3D12NGXDLSSFeature>(NewNGXFeatureHandle, NewNGXParameterHandle, InArguments.GetFeatureDesc(), FrameCounter);
RegisterFeature(InDLSSState->DLSSFeature);
}
check(InDLSSState->HasValidFeature());
// execute
if (Device->GetCommandContext().IsDefaultContext())
{
Device->RegisterGPUWork(1);
}
NVSDK_NGX_D3D12_DLSS_Eval_Params DlssEvalParams;
FMemory::Memzero(DlssEvalParams);
DlssEvalParams.Feature.pInOutput = GetD3D12TextureFromRHITexture(InArguments.OutputColor, InArguments.GPUNode)->GetResource()->GetResource();
DlssEvalParams.InOutputSubrectBase.X = InArguments.DestRect.Min.X;
DlssEvalParams.InOutputSubrectBase.Y = InArguments.DestRect.Min.Y;
DlssEvalParams.InRenderSubrectDimensions.Width = InArguments.SrcRect.Width();
DlssEvalParams.InRenderSubrectDimensions.Height = InArguments.SrcRect.Height();
DlssEvalParams.Feature.pInColor = GetD3D12TextureFromRHITexture(InArguments.InputColor, InArguments.GPUNode)->GetResource()->GetResource();
DlssEvalParams.InColorSubrectBase.X = InArguments.SrcRect.Min.X;
DlssEvalParams.InColorSubrectBase.Y = InArguments.SrcRect.Min.Y;
DlssEvalParams.pInDepth = GetD3D12TextureFromRHITexture(InArguments.InputDepth, InArguments.GPUNode)->GetResource()->GetResource();
DlssEvalParams.InDepthSubrectBase.X = InArguments.SrcRect.Min.X;
DlssEvalParams.InDepthSubrectBase.Y = InArguments.SrcRect.Min.Y;
DlssEvalParams.pInMotionVectors = GetD3D12TextureFromRHITexture(InArguments.InputMotionVectors, InArguments.GPUNode)->GetResource()->GetResource();
// The VelocityCombine pass puts the motion vectors into the top left corner
DlssEvalParams.InMVSubrectBase.X = 0;
DlssEvalParams.InMVSubrectBase.Y = 0;
DlssEvalParams.pInExposureTexture = InArguments.bUseAutoExposure ? nullptr : GetD3D12TextureFromRHITexture(InArguments.InputExposure, InArguments.GPUNode)->GetResource()->GetResource();
DlssEvalParams.InPreExposure = InArguments.PreExposure;
DlssEvalParams.Feature.InSharpness = InArguments.Sharpness;
DlssEvalParams.InJitterOffsetX = InArguments.JitterOffset.X;
DlssEvalParams.InJitterOffsetY = InArguments.JitterOffset.Y;
DlssEvalParams.InMVScaleX = InArguments.MotionVectorScale.X;
DlssEvalParams.InMVScaleY = InArguments.MotionVectorScale.Y;
DlssEvalParams.InReset = InArguments.bReset;
DlssEvalParams.InFrameTimeDeltaInMsec = InArguments.DeltaTime;
NVSDK_NGX_Result ResultEvaluate = NGX_D3D12_EVALUATE_DLSS_EXT(
D3DGraphicsCommandList,
InDLSSState->DLSSFeature->Feature,
InDLSSState->DLSSFeature->Parameter,
&DlssEvalParams
);
checkf(NVSDK_NGX_SUCCEED(ResultEvaluate), TEXT("NGX_D3D12_EVALUATE_DLSS_EXT failed! (%u %s), %s"), ResultEvaluate, GetNGXResultAsString(ResultEvaluate), *InDLSSState->DLSSFeature->Desc.GetDebugDescription());
InDLSSState->DLSSFeature->Tick(FrameCounter);
Device->GetCommandContext().StateCache.ForceSetComputeRootSignature();
Device->GetCommandContext().StateCache.GetDescriptorCache()->SetCurrentCommandList(Device->GetCommandContext().CommandListHandle);
}
/** IModuleInterface implementation */
void FNGXD3D12RHIModule::StartupModule()
{
// NGXRHI module should be loaded to ensure logging state is initialized
FModuleManager::LoadModuleChecked<INGXRHIModule>(TEXT("NGXRHI"));
}
void FNGXD3D12RHIModule::ShutdownModule()
{
}
TUniquePtr<NGXRHI> FNGXD3D12RHIModule::CreateNGXRHI(const FNGXRHICreateArguments& Arguments)
{
TUniquePtr<NGXRHI> Result(new FNGXD3D12RHI(Arguments));
return Result;
}
IMPLEMENT_MODULE(FNGXD3D12RHIModule, NGXD3D12RHI)
#undef LOCTEXT_NAMESPACE
@@ -1,37 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "Modules/ModuleManager.h"
#include "NGXRHI.h"
class FNGXD3D12RHIModule final : public INGXRHIModule
{
public:
/** IModuleInterface implementation */
virtual void StartupModule();
virtual void ShutdownModule();
/** INGXRHIModule implementation */
virtual TUniquePtr<NGXRHI> CreateNGXRHI(const FNGXRHICreateArguments& Arguments);
};
@@ -1,68 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
using UnrealBuildTool;
using System.IO;
public class NGXRHI : ModuleRules
{
public NGXRHI(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
}
);
PrivateIncludePaths.AddRange(
new string[] {
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Core",
"Engine",
"RenderCore",
"RHI",
"NGX",
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
}
);
}
}
@@ -1,530 +0,0 @@
/*
* Copyright (c) 2020 - 2021 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include "NGXRHI.h"
#include "Misc/Paths.h"
#include "GenericPlatform/GenericPlatformFile.h"
#include "nvsdk_ngx.h"
#include "nvsdk_ngx_params.h"
#include "nvsdk_ngx_helpers.h"
// NGX software stack
DEFINE_LOG_CATEGORY_STATIC(LogDLSSNGX, Log, All);
// The UE module
DEFINE_LOG_CATEGORY_STATIC(LogDLSSNGXRHI, Log, All);
DECLARE_STATS_GROUP(TEXT("DLSS"), STATGROUP_DLSS, STATCAT_Advanced);
DECLARE_MEMORY_STAT_POOL(TEXT("DLSS: Video memory"), STAT_DLSSInternalGPUMemory, STATGROUP_DLSS, FPlatformMemory::MCR_GPU);
DECLARE_DWORD_COUNTER_STAT(TEXT("DLSS: Num DLSS features"), STAT_DLSSNumFeatures, STATGROUP_DLSS);
#define LOCTEXT_NAMESPACE "NGXRHI"
static TAutoConsoleVariable<int32> CVarNGXLogLevel(
TEXT("r.NGX.LogLevel"), 1,
TEXT("Determines the minimal amount of logging the NGX implementation pipes into LogDLSSNGX. Can be overridden by the -NGXLogLevel= command line option\n")
TEXT("Please refer to the DLSS plugin documentation on other ways to change the logging level.\n")
TEXT("0: off \n")
TEXT("1: on (default)\n")
TEXT("2: verbose "),
ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarNGXEnableOtherLoggingSinks(
TEXT("r.NGX.EnableOtherLoggingSinks"), 0,
TEXT("Determines whether the NGX implementation will write logs to files. Can also be set on the command line via -NGXLogFileEnable and -NGXLogFileDisable\n")
TEXT("0: off (default)\n")
TEXT("1: on \n"),
ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarNGXFramesUntilFeatureDestruction(
TEXT("r.NGX.FramesUntilFeatureDestruction"), 3,
TEXT("Number of frames until an unused NGX feature gets destroyed. (default=3)"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarNGXRenameLogSeverities(
TEXT("r.NGX.RenameNGXLogSeverities"), 1,
TEXT("Renames 'error' and 'warning' in messages returned by the NGX log callback to 'e_rror' and 'w_arning' before passing them to the UE log system\n")
TEXT("0: off \n")
TEXT("1: on, for select messages during initalization (default)\n")
TEXT("2: on, for all messages\n"),
ECVF_Default);
void FRHIDLSSArguments::Validate() const
{
check(InputColor);
check(InputDepth);
check(InputMotionVectors);
check(InputExposure);
check(OutputColor);
}
NGXDLSSFeature::~NGXDLSSFeature()
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
UE_LOG(LogDLSSNGXRHI, Log, TEXT("Destroying NGX DLSS Feature %s "), *Desc.GetDebugDescription());
}
void NVSDK_CONV NGXLogSink(const char* InNGXMessage, NVSDK_NGX_Logging_Level InLoggingLevel, NVSDK_NGX_Feature InSourceComponent)
{
FString Message(FString(UTF8_TO_TCHAR(InNGXMessage)).TrimEnd());
const TCHAR* NGXComponent = TEXT("Unknown");
switch (InSourceComponent)
{
case NVSDK_NGX_Feature_SuperSampling: NGXComponent = TEXT("DLSS"); break;
case NVSDK_NGX_Feature_Reserved_SDK : NGXComponent = TEXT("SDK"); break;
case NVSDK_NGX_Feature_Reserved_Core: NGXComponent = TEXT("Core"); break;
}
const bool bIsVerboseStartupMessage =
(Message.Contains(TEXT(" doesn't exist in any of the search paths")) && !Message.Contains(TEXT("nvngx_dlss.dll"))) || // we want to know if the DLSS binary is missing
Message.Contains(TEXT("warning: UWP compliant mode enabled"));
if ((CVarNGXRenameLogSeverities.GetValueOnAnyThread() == 2) || ((CVarNGXRenameLogSeverities.GetValueOnAnyThread() == 1) && bIsVerboseStartupMessage))
{
Message = Message.Replace(TEXT("error:"), TEXT("e_rror:"));
Message = Message.Replace(TEXT("Warning:"), TEXT("w_arning:"));
UE_LOG(LogDLSSNGX, Verbose, TEXT("[%s]: %s"), NGXComponent, *Message);
}
else
{
UE_LOG(LogDLSSNGX, Log, TEXT("[%s]: %s"), NGXComponent, *Message);
}
}
// the derived RHIs will set this to false based on runtime support
bool NGXRHI::bSupportsAllocateParameters = true;
bool NGXRHI::bNGXInitialized = false;
// the derived RHIs will set this to true during their initialization
bool NGXRHI::bIsIncompatibleAPICaptureToolActive = false;
NGXRHI::NGXRHI(const FNGXRHICreateArguments& Arguments)
: DynamicRHI(Arguments.DynamicRHI)
{
FString PluginNGXProductionBinariesDir = FPaths::Combine(Arguments.PluginBaseDir, TEXT("Binaries/ThirdParty/Win64/"));
FString PluginNGXDevelopmentBinariesDir = FPaths::Combine(Arguments.PluginBaseDir, TEXT("Binaries/ThirdParty/Win64/Development/"));
FString PluginNGXBinariesDir = PluginNGXProductionBinariesDir;
// Thee paths can be different depending on the project type (source, no source) and how the project is packaged, thus we have both
FString ProjectNGXBinariesDir = FPaths::Combine(FPaths::ProjectDir(), TEXT("Binaries/ThirdParty/NVIDIA/NGX/Win64/"));
FString LaunchNGXBinariesDir = FPaths::Combine(FPaths::LaunchDir(), TEXT("Binaries/ThirdParty/NVIDIA/NGX/Win64/"));
switch (Arguments.NGXBinariesSearchOrder)
{
default:
case ENGXBinariesSearchOrder::CustomThenGeneric:
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("Searching for custom and generic DLSS binaries"));
NGXDLLSearchPaths.Append({ ProjectNGXBinariesDir, LaunchNGXBinariesDir, PluginNGXProductionBinariesDir });
break;
}
case ENGXBinariesSearchOrder::ForceGeneric:
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("Searching only for generic binaries from the plugin folder"));
NGXDLLSearchPaths.Append({ PluginNGXProductionBinariesDir });
break;
}
case ENGXBinariesSearchOrder::ForceCustom:
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("Searching only for custom DLSS binaries from the DLSS plugin"));
NGXDLLSearchPaths.Append({ ProjectNGXBinariesDir, LaunchNGXBinariesDir });
break;
}
case ENGXBinariesSearchOrder::ForceDevelopmentGeneric:
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("Searching only for generic development DLSS binaries from the DLSS plugin. This binary is only packaged for non-shipping build configurations"));
NGXDLLSearchPaths.Append({ PluginNGXDevelopmentBinariesDir });
PluginNGXBinariesDir = PluginNGXDevelopmentBinariesDir;
break;
}
}
for (int32 i = 0; i < NGXDLLSearchPaths.Num(); ++i)
{
NGXDLLSearchPaths[i] = FPaths::ConvertRelativePathToFull(NGXDLLSearchPaths[i]);
FPaths::RemoveDuplicateSlashes(NGXDLLSearchPaths[i]);
FPaths::MakePlatformFilename(NGXDLLSearchPaths[i]);
// After this we should not touch NGXDLLSearchPaths since that provides the backing store for NGXDLLSearchPathRawStrings
NGXDLLSearchPathRawStrings.Add(*NGXDLLSearchPaths[i]);
const bool bHasDLSSBinary = IPlatformFile::GetPlatformPhysical().FileExists(*FPaths::Combine(NGXDLLSearchPaths[i], NGX_DLSS_BINARY_NAME));
UE_LOG(LogDLSSNGXRHI, Log, TEXT("NVIDIA NGX DLSS binary %s %s in search path %s"), NGX_DLSS_BINARY_NAME, bHasDLSSBinary ? TEXT("found") : TEXT("not found"), *NGXDLLSearchPaths[i]);
}
// we do this separately here so we can show relative paths in the UI later
DLSSGenericBinaryInfo.Get<0>() = FPaths::Combine(PluginNGXBinariesDir, NGX_DLSS_BINARY_NAME);
DLSSGenericBinaryInfo.Get<1>() = IPlatformFile::GetPlatformPhysical().FileExists(*DLSSGenericBinaryInfo.Get<0>());
DLSSCustomBinaryInfo.Get<0>() = FPaths::Combine(ProjectNGXBinariesDir, NGX_DLSS_BINARY_NAME);
DLSSCustomBinaryInfo.Get<1>() = IPlatformFile::GetPlatformPhysical().FileExists(*DLSSCustomBinaryInfo.Get<0>());
FeatureInfo.PathListInfo.Path = const_cast<wchar_t**>(NGXDLLSearchPathRawStrings.GetData());
FeatureInfo.PathListInfo.Length = NGXDLLSearchPathRawStrings.Num();
// logging
{
FeatureInfo.LoggingInfo.DisableOtherLoggingSinks = 1 != CVarNGXEnableOtherLoggingSinks.GetValueOnAnyThread();
FeatureInfo.LoggingInfo.LoggingCallback = &NGXLogSink;
switch (CVarNGXLogLevel.GetValueOnAnyThread())
{
case 0:
FeatureInfo.LoggingInfo.MinimumLoggingLevel = NVSDK_NGX_LOGGING_LEVEL_OFF;
break;
// should match the CVarNGXLogLevel default value
default:
case 1:
FeatureInfo.LoggingInfo.MinimumLoggingLevel = NVSDK_NGX_LOGGING_LEVEL_ON;
break;
case 2:
FeatureInfo.LoggingInfo.MinimumLoggingLevel = NVSDK_NGX_LOGGING_LEVEL_VERBOSE;
break;
}
}
}
TTuple<FString, bool> NGXRHI::GetDLSSGenericBinaryInfo() const
{
return DLSSGenericBinaryInfo;
}
TTuple<FString, bool> NGXRHI::GetDLSSCustomBinaryInfo() const
{
return DLSSCustomBinaryInfo;
}
NGXRHI::~NGXRHI()
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
UE_LOG(LogDLSSNGXRHI, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
void NGXRHI::FDLSSQueryFeature::QueryDLSSSupport()
{
int32 bNeedsUpdatedDriver = 0;
int32 MinDriverVersionMajor = 0;
int32 MinDriverVersionMinor = 0;
// Centralize this here instead during NGXRHI init. This should not happen but if we don't have a a valid CapabilityParameters, then we also don't have DLSS.
if (!CapabilityParameters)
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("NVIDIA NGX DLSS cannot be loaded possibly due to issues initializing NGX."));
DLSSInitResult = NVSDK_NGX_Result_Fail;
bIsAvailable = false;
return;
}
check(CapabilityParameters);
NVSDK_NGX_Result ResultUpdatedDriver = CapabilityParameters->Get(NVSDK_NGX_Parameter_SuperSampling_NeedsUpdatedDriver, &bNeedsUpdatedDriver);
NVSDK_NGX_Result ResultMinDriverVersionMajor = CapabilityParameters->Get(NVSDK_NGX_Parameter_SuperSampling_MinDriverVersionMajor, &MinDriverVersionMajor);
NVSDK_NGX_Result ResultMinDriverVersionMinor = CapabilityParameters->Get(NVSDK_NGX_Parameter_SuperSampling_MinDriverVersionMinor, &MinDriverVersionMinor);
UE_LOG(LogDLSSNGXRHI, Log, TEXT("Get NVSDK_NGX_Parameter_SuperSampling_NeedsUpdatedDriver -> (%u %s), bNeedsUpdatedDriver = %d"), ResultUpdatedDriver, GetNGXResultAsString(ResultUpdatedDriver), bNeedsUpdatedDriver);
UE_LOG(LogDLSSNGXRHI, Log, TEXT("Get NVSDK_NGX_Parameter_SuperSampling_MinDriverVersionMajor -> (%u %s), MinDriverVersionMajor = %d"), ResultMinDriverVersionMajor, GetNGXResultAsString(ResultMinDriverVersionMajor), MinDriverVersionMajor);
UE_LOG(LogDLSSNGXRHI, Log, TEXT("Get NVSDK_NGX_Parameter_SuperSampling_MinDriverVersionMinor -> (%u %s), MinDriverVersionMinor = %d"), ResultMinDriverVersionMinor, GetNGXResultAsString(ResultMinDriverVersionMinor), MinDriverVersionMinor);
if (NVSDK_NGX_SUCCEED(ResultUpdatedDriver) && NVSDK_NGX_SUCCEED(ResultMinDriverVersionMajor) && NVSDK_NGX_SUCCEED(ResultMinDriverVersionMinor))
{
DriverRequirements.DriverUpdateRequired = DriverRequirements.DriverUpdateRequired || bNeedsUpdatedDriver != 0;
// ignore 0.0 and fall back to the what's baked into FNGXDriverRequirements;
if (MinDriverVersionMajor)
{
DriverRequirements.MinDriverVersionMajor = MinDriverVersionMajor;
}
if (MinDriverVersionMinor)
{
DriverRequirements.MinDriverVersionMinor = MinDriverVersionMinor;
}
if (bNeedsUpdatedDriver)
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("NVIDIA NGX DLSS cannot be loaded due to an outdated driver. Minimum Driver Version required : %u.%u"), MinDriverVersionMajor, MinDriverVersionMinor);
}
else
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("NVIDIA NGX DLSS is supported by the currently installed driver. Minimum driver version was reported as: %u.%u"), MinDriverVersionMajor, MinDriverVersionMinor);
}
}
else
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("NVIDIA NGX DLSS Minimum driver version was not reported"));
}
// determine if DLSS is available
int DlssAvailable = 0;
NVSDK_NGX_Result ResultAvailable = CapabilityParameters->Get(NVSDK_NGX_EParameter_SuperSampling_Available, &DlssAvailable);
UE_LOG(LogDLSSNGXRHI, Log, TEXT("Get NVSDK_NGX_EParameter_SuperSampling_Available -> (%u %s), DlssAvailable = %d"), ResultAvailable, GetNGXResultAsString(ResultAvailable), DlssAvailable);
if (NVSDK_NGX_SUCCEED(ResultAvailable) && DlssAvailable)
{
bIsAvailable = true;
// store for the higher level code interpret
DLSSInitResult = ResultAvailable;
}
// DLSS_TODO verify this
if(!DlssAvailable)
{
// and try to find out more details on why it might have failed
NVSDK_NGX_Result DlssFeatureInitResult = NVSDK_NGX_Result_Fail;
NVSDK_NGX_Result ResultDlssFeatureInitResult = CapabilityParameters->Get(NVSDK_NGX_Parameter_SuperSampling_FeatureInitResult, (int*)&DlssFeatureInitResult);
UE_LOG(LogDLSSNGXRHI, Log, TEXT("Get NVSDK_NGX_Parameter_SuperSampling_FeatureInitResult -> (%u %s), NVSDK_NGX_Parameter_SuperSampling_FeatureInitResult = (%u %s)"), ResultDlssFeatureInitResult, GetNGXResultAsString(ResultDlssFeatureInitResult), DlssFeatureInitResult, GetNGXResultAsString(DlssFeatureInitResult));
// store for the higher level code interpret
DLSSInitResult = NVSDK_NGX_SUCCEED(ResultDlssFeatureInitResult) ? DlssFeatureInitResult : NVSDK_NGX_Result_Fail;
}
}
FDLSSOptimalSettings NGXRHI::FDLSSQueryFeature::GetDLSSOptimalSettings(const FDLSSResolutionParameters& InResolution) const
{
check(CapabilityParameters);
FDLSSOptimalSettings OptimalSettings;
const NVSDK_NGX_Result ResultGetOptimalSettings = NGX_DLSS_GET_OPTIMAL_SETTINGS(
CapabilityParameters,
InResolution.Width,
InResolution.Height,
InResolution.PerfQuality,
reinterpret_cast<unsigned int*>(&OptimalSettings.RenderSize.X),
reinterpret_cast<unsigned int*>(&OptimalSettings.RenderSize.Y),
reinterpret_cast<unsigned int*>(&OptimalSettings.RenderSizeMax.X),
reinterpret_cast<unsigned int*>(&OptimalSettings.RenderSizeMax.Y),
reinterpret_cast<unsigned int*>(&OptimalSettings.RenderSizeMin.X),
reinterpret_cast<unsigned int*>(&OptimalSettings.RenderSizeMin.Y),
&OptimalSettings.Sharpness
);
UE_LOG(LogDLSSNGXRHI, Log, TEXT("NGX_DLSS_GET_OPTIMAL_SETTINGS -> (%u %s)"), ResultGetOptimalSettings, GetNGXResultAsString(ResultGetOptimalSettings));
checkf(NVSDK_NGX_SUCCEED(ResultGetOptimalSettings), TEXT("failed to query supported DLSS modes"));
OptimalSettings.bIsSupported = (OptimalSettings.RenderSize.X > 0) && (OptimalSettings.RenderSize.Y > 0);
auto ComputeResolutionFraction = [&InResolution](int32 RenderSizeX, int32 RenderSizeY)
{
float XScale = float(RenderSizeX) / float(InResolution.Width);
float YScale = float(RenderSizeY) / float(InResolution.Height);
return FMath::Min(XScale, YScale);
};
OptimalSettings.MinResolutionFraction = ComputeResolutionFraction(OptimalSettings.RenderSizeMin.X, OptimalSettings.RenderSizeMin.Y);
OptimalSettings.MaxResolutionFraction = ComputeResolutionFraction(OptimalSettings.RenderSizeMax.X, OptimalSettings.RenderSizeMax.Y);
// restrict to range since floating point numbers are gonna floating point
OptimalSettings.OptimalResolutionFraction = FMath::Clamp<float>(ComputeResolutionFraction(OptimalSettings.RenderSize.X, OptimalSettings.RenderSize.Y), OptimalSettings.MinResolutionFraction, OptimalSettings.MaxResolutionFraction);
return OptimalSettings;
}
FString NGXRHI::GetNGXLogDirectory()
{
// encode the time and instance id to handle cases like PIE standalone game where multiple processe are running at the same time.
FString AbsoluteProjectLogDir = FPaths::ConvertRelativePathToFull(FPaths::ProjectLogDir());
FString NGXLogDir = FPaths::Combine(AbsoluteProjectLogDir, TEXT("NGX"), FString::Printf(TEXT("NGX_%s_%s"), *FDateTime::Now().ToString(), *FApp::GetInstanceId().ToString()));
return NGXLogDir;
}
uint32 FRHIDLSSArguments::GetNGXCommonDLSSFeatureFlags() const
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
uint32 DLSSFeatureFlags = NVSDK_NGX_DLSS_Feature_Flags_None;
DLSSFeatureFlags |= NVSDK_NGX_DLSS_Feature_Flags_IsHDR;
DLSSFeatureFlags |= bool(ERHIZBuffer::IsInverted) ? NVSDK_NGX_DLSS_Feature_Flags_DepthInverted : 0;
DLSSFeatureFlags |= !bHighResolutionMotionVectors ? NVSDK_NGX_DLSS_Feature_Flags_MVLowRes : 0;
DLSSFeatureFlags |= Sharpness != 0.0f ? NVSDK_NGX_DLSS_Feature_Flags_DoSharpening : 0;
DLSSFeatureFlags |= bUseAutoExposure ? NVSDK_NGX_DLSS_Feature_Flags_AutoExposure : 0;
return DLSSFeatureFlags;
}
NVSDK_NGX_DLSS_Create_Params FRHIDLSSArguments::GetNGXDLSSCreateParams() const
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
NVSDK_NGX_DLSS_Create_Params Result;
FMemory::Memzero(Result);
Result.Feature.InWidth = SrcRect.Width();
Result.Feature.InHeight = SrcRect.Height();
Result.Feature.InTargetWidth = DestRect.Width();
Result.Feature.InTargetHeight = DestRect.Height();
Result.Feature.InPerfQualityValue = static_cast<NVSDK_NGX_PerfQuality_Value>(PerfQuality);
check((Result.Feature.InPerfQualityValue >= NVSDK_NGX_PerfQuality_Value_MaxPerf) && (Result.Feature.InPerfQualityValue <= NVSDK_NGX_PerfQuality_Value_UltraQuality));
Result.InFeatureCreateFlags = GetNGXCommonDLSSFeatureFlags();
Result.InEnableOutputSubrects = OutputColor->GetTexture2D()->GetSizeXY() != DestRect.Size();
return Result;
}
// this is used by the RHIs to see whether they need to recreate the NGX feature
bool FDLSSState::RequiresFeatureRecreation(const FRHIDLSSArguments& InArguments)
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
return !DLSSFeature || DLSSFeature->Desc != InArguments.GetFeatureDesc();
}
void NGXRHI::RegisterFeature(TSharedPtr<NGXDLSSFeature> InFeature)
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
UE_LOG(LogDLSSNGXRHI, Log, TEXT("Creating NGX DLSS Feature %s "), *InFeature->Desc.GetDebugDescription());
AllocatedDLSSFeatures.Add(InFeature);
}
TSharedPtr<NGXDLSSFeature> NGXRHI::FindFreeFeature(const FRHIDLSSArguments& InArguments)
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
TSharedPtr<NGXDLSSFeature> OutFeature;
for (int FeatureIndex = 0; FeatureIndex < AllocatedDLSSFeatures.Num(); ++FeatureIndex)
{
// another view already uses this (1 reference from AllocatedDLSSFeatures, another refernces held by FDLSState
if (AllocatedDLSSFeatures[FeatureIndex].GetSharedReferenceCount() > 1)
{
continue;
}
if (AllocatedDLSSFeatures[FeatureIndex]->Desc == InArguments.GetFeatureDesc())
{
OutFeature = AllocatedDLSSFeatures[FeatureIndex];
OutFeature->LastUsedFrame = FrameCounter;
break;
}
}
return OutFeature;
}
void NGXRHI::ReleaseAllocatedFeatures()
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
// There should be no FDLSSState::DLSSFeature anymore when we shut down
for (int FeatureIndex = 0; FeatureIndex < AllocatedDLSSFeatures.Num(); ++FeatureIndex)
{
checkf(AllocatedDLSSFeatures[FeatureIndex].GetSharedReferenceCount() == 1,TEXT("There should be no FDLSSState::DLSSFeature references elsewhere."));
}
AllocatedDLSSFeatures.Empty();
SET_DWORD_STAT(STAT_DLSSNumFeatures, AllocatedDLSSFeatures.Num());
UE_LOG(LogDLSSNGXRHI, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
void NGXRHI::ApplyCommonNGXParameterSettings(NVSDK_NGX_Parameter* InOutParameter, const FRHIDLSSArguments& InArguments)
{
NVSDK_NGX_Parameter_SetI(InOutParameter, NVSDK_NGX_Parameter_FreeMemOnReleaseFeature, InArguments.bReleaseMemoryOnDelete ? 1 : 0);
}
void NGXRHI::TickPoolElements()
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
const uint32 kFramesUntilRelease = CVarNGXFramesUntilFeatureDestruction.GetValueOnAnyThread();
int32 FeatureIndex = 0;
while (FeatureIndex < AllocatedDLSSFeatures.Num())
{
TSharedPtr<NGXDLSSFeature>& Feature = AllocatedDLSSFeatures[FeatureIndex];
const bool bIsUnused = Feature.GetSharedReferenceCount() == 1;
const bool bNotRequestedRecently = (FrameCounter - Feature->LastUsedFrame) > kFramesUntilRelease;
if (bIsUnused && bNotRequestedRecently)
{
Swap(Feature, AllocatedDLSSFeatures.Last());
AllocatedDLSSFeatures.Pop();
}
else
{
++FeatureIndex;
}
}
SET_DWORD_STAT(STAT_DLSSNumFeatures, AllocatedDLSSFeatures.Num());
// if r.NGX.Enable is 0 then this should be nullptr
if(DLSSQueryFeature.CapabilityParameters)
{
static const auto CVarNGXDLSSEnable = IConsoleManager::Get().FindConsoleVariable(TEXT("r.NGX.Enable"));
check(CVarNGXDLSSEnable && CVarNGXDLSSEnable->GetInt() != 0);
unsigned long long VRAM = 0;
NVSDK_NGX_Result ResultGetStats = NGX_DLSS_GET_STATS(DLSSQueryFeature.CapabilityParameters, &VRAM);
checkf(NVSDK_NGX_SUCCEED(ResultGetStats), TEXT("Failed to retrieve DLSS memory statistics via NGX_DLSS_GET_STATS -> (%u %s)"), ResultGetStats, GetNGXResultAsString(ResultGetStats));
if (NVSDK_NGX_SUCCEED(ResultGetStats))
{
SET_DWORD_STAT(STAT_DLSSInternalGPUMemory, VRAM);
}
}
++FrameCounter;
}
IMPLEMENT_MODULE(FNGXRHIModule, NGXRHI)
#undef LOCTEXT_NAMESPACE
/** IModuleInterface implementation */
void FNGXRHIModule::StartupModule()
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
int32 NGXLogLevel = CVarNGXLogLevel.GetValueOnAnyThread();
if (FParse::Value(FCommandLine::Get(), TEXT("ngxloglevel="), NGXLogLevel))
{
CVarNGXLogLevel->Set(NGXLogLevel, ECVF_SetByCommandline);
}
if (FParse::Param(FCommandLine::Get(), TEXT("ngxlogfileenable")))
{
CVarNGXEnableOtherLoggingSinks->Set(1, ECVF_SetByCommandline);
}
else if (FParse::Param(FCommandLine::Get(), TEXT("ngxlogfiledisable")))
{
CVarNGXEnableOtherLoggingSinks->Set(0, ECVF_SetByCommandline);
}
UE_LOG(LogDLSSNGXRHI, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
void FNGXRHIModule::ShutdownModule()
{
UE_LOG(LogDLSSNGXRHI, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
UE_LOG(LogDLSSNGXRHI, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
-409
View File
@@ -1,409 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "Modules/ModuleManager.h"
#include "CoreMinimal.h"
#include "RendererInterface.h"
#include "Runtime/Launch/Resources/Version.h"
#include "nvsdk_ngx_params.h"
#define NVSDK_NGX_VERSION_API_MACRO_BASE_LINE (0x0000013)
#define NVSDK_NGX_VERSION_API_MACRO_WITH_LOGGING (0x0000014)
struct FDLSSState;
struct FDLSSFeatureDesc
{
bool operator != (const FDLSSFeatureDesc& Other) const
{
return DestRect.Size() != Other.DestRect.Size()
|| PerfQuality != Other.PerfQuality
|| bHighResolutionMotionVectors != Other.bHighResolutionMotionVectors
|| bNonZeroSharpness != Other.bNonZeroSharpness
|| bUseAutoExposure != Other.bUseAutoExposure
|| bReleaseMemoryOnDelete != Other.bReleaseMemoryOnDelete
|| GPUNode != Other.GPUNode
|| GPUVisibility != Other.GPUVisibility;
}
bool operator == (const FDLSSFeatureDesc& Other) const
{
return !operator !=(Other);
}
FIntRect SrcRect = FIntRect(FIntPoint::NoneValue, FIntPoint::NoneValue);
FIntRect DestRect = FIntRect(FIntPoint::NoneValue, FIntPoint::NoneValue);
int32 PerfQuality = -1;
bool bHighResolutionMotionVectors = false;
bool bNonZeroSharpness = false;
bool bUseAutoExposure = false;
bool bReleaseMemoryOnDelete = false;
uint32 GPUNode = 0;
uint32 GPUVisibility = 0;
FString GetDebugDescription() const
{
auto NGXPerfQualityString = [] (int NGXPerfQuality)
{
switch (NGXPerfQuality)
{
case NVSDK_NGX_PerfQuality_Value_MaxPerf:return TEXT("MaxPerf");
case NVSDK_NGX_PerfQuality_Value_Balanced:return TEXT("Balanced");
case NVSDK_NGX_PerfQuality_Value_MaxQuality:return TEXT("MaxQuality");
case NVSDK_NGX_PerfQuality_Value_UltraPerformance:return TEXT("UltraPerformance");
case NVSDK_NGX_PerfQuality_Value_UltraQuality:return TEXT("UltraQuality");
default:return TEXT("Invalid NVSDK_NGX_PerfQuality_Value");
}
};
return FString::Printf(TEXT("SrcRect=[%dx%d->%dx%d], DestRect=[%dx%d->%dx%d], ScaleX=%f, ScaleY=%f, NGXPerfQuality=%s(%d), bHighResolutionMotionVectors=%d, bNonZeroSharpness=%d, bUseAutoExposure=%d, bReleaseMemoryOnDelete=%d, GPUNode=%u, GPUVisibility=0x%x"),
SrcRect.Min.X, SrcRect.Min.Y, SrcRect.Max.X, SrcRect.Max.Y,
DestRect.Min.X, DestRect.Min.Y, DestRect.Max.X, DestRect.Max.Y,
float(SrcRect.Width()) / float(DestRect.Width()),
float(SrcRect.Height()) / float(DestRect.Height()),
NGXPerfQualityString(PerfQuality),
PerfQuality,
bHighResolutionMotionVectors,
bNonZeroSharpness,
bUseAutoExposure,
bReleaseMemoryOnDelete,
GPUNode,
GPUVisibility);
}
};
struct NGXRHI_API FRHIDLSSArguments
{
FRHITexture* InputColor = nullptr;
FRHITexture* InputDepth = nullptr;
FRHITexture* InputMotionVectors = nullptr;
FRHITexture* InputExposure = nullptr;
FRHITexture* OutputColor = nullptr;
FIntRect SrcRect = FIntRect(FIntPoint::ZeroValue, FIntPoint::ZeroValue);
FIntRect DestRect = FIntRect(FIntPoint::ZeroValue, FIntPoint::ZeroValue);
#if ENGINE_MAJOR_VERSION < 5
FVector2D JitterOffset= FVector2D::ZeroVector;
FVector2D MotionVectorScale{ 1.0f,1.0f };
#else
FVector2f JitterOffset = FVector2f::ZeroVector;
FVector2f MotionVectorScale = FVector2f::UnitVector;
#endif
bool bHighResolutionMotionVectors = false;
float Sharpness = 0.0f;
bool bReset = false;
int32 PerfQuality = 0;
float DeltaTime = 0.0f;
float PreExposure = 1.0f;
bool bUseAutoExposure = false;
bool bReleaseMemoryOnDelete = false;
uint32 GPUNode = 0;
uint32 GPUVisibility = 0;
void Validate() const;
inline FDLSSFeatureDesc GetFeatureDesc() const
{
return FDLSSFeatureDesc{ SrcRect, DestRect, PerfQuality, bHighResolutionMotionVectors, Sharpness != 0.0f, bUseAutoExposure, bReleaseMemoryOnDelete, GPUNode, GPUVisibility};
}
uint32 GetNGXCommonDLSSFeatureFlags() const;
NVSDK_NGX_DLSS_Create_Params GetNGXDLSSCreateParams() const;
};
struct FNGXDriverRequirements
{
bool DriverUpdateRequired = false;
int32 MinDriverVersionMajor = 470;
int32 MinDriverVersionMinor = 0;
};
// the API specic RHI extensions derive from this to handle the lifetime
class NGXRHI_API NGXDLSSFeature
{
public:
virtual ~NGXDLSSFeature() = 0;
FDLSSFeatureDesc Desc;
NVSDK_NGX_Handle* Feature = nullptr;
NVSDK_NGX_Parameter* Parameter = nullptr;
uint32 LastUsedFrame = 0;
void Tick(uint32 InFrameNumber)
{
check(Feature);
check(Parameter);
LastUsedFrame = InFrameNumber;
}
NGXDLSSFeature(NVSDK_NGX_Handle* InFeature, NVSDK_NGX_Parameter* InParameter, const FDLSSFeatureDesc& InFeatureDesc, uint32 InLastUsedEvaluation)
: Desc(InFeatureDesc)
, Feature(InFeature)
, Parameter(InParameter)
, LastUsedFrame(InLastUsedEvaluation)
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
check(Feature);
check(Parameter);
}
bool IsValid() const
{
return Feature && Parameter;
}
};
struct NGXRHI_API FDLSSState
{
// this is used by the RHIs to see whether they need to recreate the NGX feature
bool RequiresFeatureRecreation(const FRHIDLSSArguments& InArguments);
bool HasValidFeature() const
{
return DLSSFeature && DLSSFeature->IsValid();
}
// this is stored via pointer to allow the NGXRHIs use the API specific functions to create & release
TSharedPtr<NGXDLSSFeature> DLSSFeature;
};
using FDLSSStateRef = TSharedPtr<FDLSSState, ESPMode::ThreadSafe>;
enum class ENGXBinariesSearchOrder
{
MinValue = 0,
CustomThenGeneric = 0,
ForceGeneric = 1,
ForceCustom = 2,
ForceDevelopmentGeneric = 3,
MaxValue = ForceDevelopmentGeneric
};
enum class ENGXProjectIdentifier
{
MinValue = 0,
NGXApplicationIDThenUEProjectID = 0,
ForceUEProjectID = 1,
ForceNGXApplicationID = 2,
MaxValue = ForceNGXApplicationID
};
struct FNGXRHICreateArguments
{
FString PluginBaseDir;
FDynamicRHI* DynamicRHI = nullptr;
ENGXBinariesSearchOrder NGXBinariesSearchOrder = ENGXBinariesSearchOrder::CustomThenGeneric;
ENGXProjectIdentifier ProjectIdentifier = ENGXProjectIdentifier::NGXApplicationIDThenUEProjectID;
uint32 NGXAppId = 0;
FString UnrealEngineVersion;
FString UnrealProjectID;
// centralize that logic here for the derived NGXRHIs
bool InitializeNGXWithNGXApplicationID() const
{
if ((ProjectIdentifier == ENGXProjectIdentifier::NGXApplicationIDThenUEProjectID) && (NGXAppId != 0))
{
return true;
}
else if (ProjectIdentifier == ENGXProjectIdentifier::ForceNGXApplicationID)
{
return true;
}
else
{
return false;
}
}
};
struct FDLSSOptimalSettings
{
FIntPoint RenderSize;
FIntPoint RenderSizeMin;
FIntPoint RenderSizeMax;
float Sharpness;
bool bIsSupported;
float OptimalResolutionFraction;
float MinResolutionFraction;
float MaxResolutionFraction;
bool IsFixedResolution() const
{
return MinResolutionFraction == MaxResolutionFraction;
}
};
class NGXRHI_API NGXRHI
{
struct NGXRHI_API FDLSSQueryFeature
{
struct FDLSSResolutionParameters
{
uint32 Width = 0;
uint32 Height = 0;
NVSDK_NGX_PerfQuality_Value PerfQuality = NVSDK_NGX_PerfQuality_Value_MaxPerf;
FDLSSResolutionParameters(uint32 InWidth, uint32 InHeight, NVSDK_NGX_PerfQuality_Value InPerfQuality)
: Width(InWidth)
, Height(InHeight)
, PerfQuality(InPerfQuality)
{}
};
void QueryDLSSSupport();
FDLSSOptimalSettings GetDLSSOptimalSettings(const FDLSSResolutionParameters& InResolution) const;
// the lifetime of this is managed directly by the encompassing derived RHI
NVSDK_NGX_Parameter* CapabilityParameters = nullptr;
bool bIsAvailable = false;
FNGXDriverRequirements DriverRequirements;
NVSDK_NGX_Result DLSSInitResult = NVSDK_NGX_Result_Fail;
};
public:
virtual ~NGXRHI();
virtual void ExecuteDLSS(FRHICommandList& CmdList, const FRHIDLSSArguments& InArguments, FDLSSStateRef InDLSSState) = 0;
bool IsDLSSAvailable() const
{
return DLSSQueryFeature.bIsAvailable;
}
NVSDK_NGX_Result GetDLSSInitResult() const
{
return DLSSQueryFeature.DLSSInitResult;
}
const FNGXDriverRequirements& GetDLSSDriverRequirements() const
{
return DLSSQueryFeature.DriverRequirements;
}
FDLSSOptimalSettings GetDLSSOptimalSettings(const FDLSSQueryFeature::FDLSSResolutionParameters& InResolution) const
{
return DLSSQueryFeature.GetDLSSOptimalSettings(InResolution);
}
FDLSSOptimalSettings GetDLSSOptimalSettings(NVSDK_NGX_PerfQuality_Value QualityLevel) const
{
return DLSSQueryFeature.GetDLSSOptimalSettings(FDLSSQueryFeature::FDLSSResolutionParameters(1000, 1000, QualityLevel));
}
float GetDLSSResolutionFraction(NVSDK_NGX_PerfQuality_Value QualityLevel) const
{
return GetDLSSOptimalSettings(QualityLevel).OptimalResolutionFraction;
}
TPair<FString, bool> GetDLSSGenericBinaryInfo() const;
TPair<FString, bool> GetDLSSCustomBinaryInfo() const;
void TickPoolElements();
static bool SupportsAllocateParameters()
{
return bSupportsAllocateParameters;
}
static bool NGXInitialized()
{
return bNGXInitialized;
}
static bool IsIncompatibleAPICaptureToolActive()
{
return bIsIncompatibleAPICaptureToolActive;
}
protected:
NGXRHI(const FNGXRHICreateArguments& Arguments);
const NVSDK_NGX_FeatureCommonInfo* CommonFeatureInfo() const
{
return &FeatureInfo;
}
void RegisterFeature(TSharedPtr<NGXDLSSFeature> InFeature);
TSharedPtr<NGXDLSSFeature> FindFreeFeature(const FRHIDLSSArguments& InArguments);
void ReleaseAllocatedFeatures();
void ApplyCommonNGXParameterSettings(NVSDK_NGX_Parameter* Parameter, const FRHIDLSSArguments& InArguments);
static FString GetNGXLogDirectory();
FDynamicRHI* DynamicRHI = nullptr;
FDLSSQueryFeature DLSSQueryFeature;
uint32 FrameCounter = 1;
static bool bNGXInitialized;
static bool bSupportsAllocateParameters;
static bool bIsIncompatibleAPICaptureToolActive;
private:
TArray< TSharedPtr<NGXDLSSFeature>> AllocatedDLSSFeatures;
TTuple<FString, bool> DLSSGenericBinaryInfo;
TTuple<FString, bool> DLSSCustomBinaryInfo;
TArray<FString> NGXDLLSearchPaths;
TArray<const wchar_t*> NGXDLLSearchPathRawStrings;
NVSDK_NGX_FeatureCommonInfo FeatureInfo = {{0}};
};
// Implemented by the API specific modules
class INGXRHIModule : public IModuleInterface
{
public:
virtual TUniquePtr<NGXRHI> CreateNGXRHI(const FNGXRHICreateArguments& Arguments) = 0;
};
class FNGXRHIModule final : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule();
virtual void ShutdownModule();
};
@@ -1,75 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
using UnrealBuildTool;
using System.IO;
public class NGXVulkanRHI : ModuleRules
{
public NGXVulkanRHI(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
}
);
PrivateIncludePaths.AddRange(
new string[] {
Path.Combine(EngineDirectory,"Source/Runtime/VulkanRHI/Private"),
Path.Combine(EngineDirectory,"Source/Runtime/VulkanRHI/Private/Windows"),
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Core",
"Engine",
"RenderCore",
"RHI",
"VulkanRHI",
"NGX",
"NGXRHI",
}
);
if (ReadOnlyBuildVersion.Current.MajorVersion == 5)
{
PrivateDependencyModuleNames.Add("RHICore");
}
// those come from the VulkanRHI
AddEngineThirdPartyPrivateStaticDependencies(Target, "Vulkan");
}
}
@@ -1,371 +0,0 @@
/*
* Copyright (c) 2020 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
#include "NGXVulkanRHI.h"
#include "VulkanRHIPrivate.h"
#include "VulkanPendingState.h"
#include "VulkanRHIBridge.h"
#include "VulkanContext.h"
#include "nvsdk_ngx_vk.h"
#include "nvsdk_ngx_helpers_vk.h"
#include "GenericPlatform/GenericPlatformFile.h"
DEFINE_LOG_CATEGORY_STATIC(LogDLSSNGXVulkanRHI, Log, All);
#define LOCTEXT_NAMESPACE "FNGXVulkanRHIModule"
class FVulkanNGXDLSSFeature final : public NGXDLSSFeature
{
public:
using NGXDLSSFeature::NGXDLSSFeature;
virtual ~FVulkanNGXDLSSFeature()
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
check(NGXRHI::NGXInitialized());
NVSDK_NGX_Result ResultReleaseFeature = NVSDK_NGX_VULKAN_ReleaseFeature(Feature);
checkf(NVSDK_NGX_SUCCEED(ResultReleaseFeature), TEXT("NVSDK_NGX_VULKAN_ReleaseFeature failed! (%u %s), %s"), ResultReleaseFeature, GetNGXResultAsString(ResultReleaseFeature), *Desc.GetDebugDescription());
if (NGXRHI::SupportsAllocateParameters())
{
NVSDK_NGX_Result ResultDestroyParameter = NVSDK_NGX_VULKAN_DestroyParameters(Parameter);
checkf(NVSDK_NGX_SUCCEED(ResultDestroyParameter), TEXT("NVSDK_NGX_VULKAN_DestroyParameters failed! (%u %s), %s"), ResultDestroyParameter, GetNGXResultAsString(ResultDestroyParameter), *Desc.GetDebugDescription());
}
}
};
class FNGXVulkanRHI final : public NGXRHI
{
public:
FNGXVulkanRHI(const FNGXRHICreateArguments& Arguments);
virtual void ExecuteDLSS(FRHICommandList& CmdList, const FRHIDLSSArguments& InArguments, FDLSSStateRef InDLSSState) final;
virtual ~FNGXVulkanRHI();
private:
FVulkanDynamicRHI* VulkanRHI = nullptr;
FVulkanDevice* VulkanDevice = nullptr;
NVSDK_NGX_Result Init_NGX_VK(const FNGXRHICreateArguments& InArguments, const wchar_t* InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo);
static bool IsIncompatibleAPICaptureToolActive();
};
bool FNGXVulkanRHI::IsIncompatibleAPICaptureToolActive()
{
// TODO figure out whether the renderdoc layer is active, either here or in the PreInit module
return false;
}
NVSDK_NGX_Result FNGXVulkanRHI::Init_NGX_VK(const FNGXRHICreateArguments& InArguments, const wchar_t* InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, const NVSDK_NGX_FeatureCommonInfo* InFeatureInfo)
{
NVSDK_NGX_Result Result = NVSDK_NGX_Result_Fail;
int32 APIVersion = NVSDK_NGX_VERSION_API_MACRO;
do
{
if (InArguments.InitializeNGXWithNGXApplicationID())
{
Result = NVSDK_NGX_VULKAN_Init(InArguments.NGXAppId, InApplicationDataPath, InInstance, InPD, InDevice, InFeatureInfo, static_cast<NVSDK_NGX_Version>(APIVersion));
UE_LOG(LogDLSSNGXVulkanRHI, Log, TEXT("NVSDK_NGX_VULKAN_Init(AppID= %u, APIVersion = 0x%x) -> (%u %s)"), InArguments.NGXAppId, APIVersion, Result, GetNGXResultAsString(Result));
}
else
{
Result = NVSDK_NGX_VULKAN_Init_with_ProjectID(TCHAR_TO_UTF8(*InArguments.UnrealProjectID), NVSDK_NGX_ENGINE_TYPE_UNREAL, TCHAR_TO_UTF8(*InArguments.UnrealEngineVersion), InApplicationDataPath, InInstance, InPD, InDevice, InFeatureInfo, static_cast<NVSDK_NGX_Version>(APIVersion));
UE_LOG(LogDLSSNGXVulkanRHI, Log, TEXT("NVSDK_NGX_VULKAN_Init(ProjectID = %s, EngineVersion=%s, APIVersion = 0x%x) -> (%u %s)"), *InArguments.UnrealProjectID, *InArguments.UnrealEngineVersion, APIVersion, Result, GetNGXResultAsString(Result));
}
if (NVSDK_NGX_FAILED(Result))
{
NVSDK_NGX_VULKAN_Shutdown();
}
--APIVersion;
} while (NVSDK_NGX_FAILED(Result) && APIVersion >= NVSDK_NGX_VERSION_API_MACRO_BASE_LINE);
if (NVSDK_NGX_SUCCEED(Result) && (APIVersion + 1 < NVSDK_NGX_VERSION_API_MACRO_WITH_LOGGING))
{
UE_LOG(LogDLSSNGXVulkanRHI, Log, TEXT("Warning: NVSDK_NGX_VULKAN_Init succeeded, but the driver installed on this system is too old the support the NGX logging API. The console variables r.NGX.LogLevel and r.NGX.EnableOtherLoggingSinks will have no effect and NGX logs will only show up in their own log files, and not in UE's log files."));
}
return Result;
}
FNGXVulkanRHI::FNGXVulkanRHI(const FNGXRHICreateArguments& Arguments)
: NGXRHI(Arguments)
, VulkanRHI(static_cast<FVulkanDynamicRHI*>(Arguments.DynamicRHI))
, VulkanDevice(VulkanRHIBridge::GetDevice(VulkanRHI)
)
{
ensure(VulkanRHI);
const FString NGXLogDir = GetNGXLogDirectory();
IPlatformFile::GetPlatformPhysical().CreateDirectoryTree(*NGXLogDir);
bIsIncompatibleAPICaptureToolActive = IsIncompatibleAPICaptureToolActive();
VkInstance VulkanInstance = reinterpret_cast<VkInstance>(VulkanRHIBridge::GetInstance(VulkanRHI));
VkPhysicalDevice VulkanPhysicalDevice = reinterpret_cast<VkPhysicalDevice>(VulkanRHIBridge::GetPhysicalDevice(VulkanDevice));
VkDevice VulkanLogicalDevice = reinterpret_cast<VkDevice>(VulkanRHIBridge::GetLogicalDevice(VulkanDevice));
NVSDK_NGX_Result ResultInit = Init_NGX_VK(Arguments, *NGXLogDir, VulkanInstance, VulkanPhysicalDevice, VulkanLogicalDevice, CommonFeatureInfo());
UE_LOG(LogDLSSNGXVulkanRHI, Log, TEXT("NVSDK_NGX_VULKAN_Init (Log %s) -> (%u %s)"), *NGXLogDir, ResultInit, GetNGXResultAsString(ResultInit));
// store for the higher level code interpret
DLSSQueryFeature.DLSSInitResult = ResultInit;
if (NVSDK_NGX_Result_FAIL_OutOfDate == ResultInit)
{
DLSSQueryFeature.DriverRequirements.DriverUpdateRequired = true;
}
else if (NVSDK_NGX_SUCCEED(ResultInit))
{
bNGXInitialized = true;
NVSDK_NGX_Result ResultGetParameters = NVSDK_NGX_VULKAN_GetCapabilityParameters(&DLSSQueryFeature.CapabilityParameters);
UE_LOG(LogDLSSNGXVulkanRHI, Log, TEXT("NVSDK_NGX_VULKAN_GetCapabilityParameters -> (%u %s)"), ResultGetParameters, GetNGXResultAsString(ResultGetParameters));
if (NVSDK_NGX_Result_FAIL_OutOfDate == ResultGetParameters)
{
DLSSQueryFeature.DriverRequirements.DriverUpdateRequired = true;
}
if (NVSDK_NGX_FAILED(ResultGetParameters))
{
ResultGetParameters = NVSDK_NGX_VULKAN_GetParameters(&DLSSQueryFeature.CapabilityParameters);
UE_LOG(LogDLSSNGXVulkanRHI, Log, TEXT("NVSDK_NGX_VULKAN_GetParameters -> (%u %s)"), ResultGetParameters, GetNGXResultAsString(ResultGetParameters));
bSupportsAllocateParameters = false;
}
if (NVSDK_NGX_SUCCEED(ResultGetParameters))
{
DLSSQueryFeature.QueryDLSSSupport();
}
}
}
FNGXVulkanRHI::~FNGXVulkanRHI()
{
UE_LOG(LogDLSSNGXVulkanRHI, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
if (bNGXInitialized)
{
// Destroy the parameters and features before we call NVSDK_NGX_D3D11_Shutdown
ReleaseAllocatedFeatures();
NVSDK_NGX_Result Result;
if (bSupportsAllocateParameters && DLSSQueryFeature.CapabilityParameters)
{
Result = NVSDK_NGX_VULKAN_DestroyParameters(DLSSQueryFeature.CapabilityParameters);
UE_LOG(LogDLSSNGXVulkanRHI, Log, TEXT("NVSDK_NGX_VULKAN_DestroyParameters -> (%u %s)"), Result, GetNGXResultAsString(Result));
}
Result = NVSDK_NGX_VULKAN_Shutdown();
UE_LOG(LogDLSSNGXVulkanRHI, Log, TEXT("NVSDK_NGX_VULKAN_Shutdown -> (%u %s)"), Result, GetNGXResultAsString(Result));
bNGXInitialized = false;
}
UE_LOG(LogDLSSNGXVulkanRHI, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
void FNGXVulkanRHI::ExecuteDLSS(FRHICommandList& CmdList, const FRHIDLSSArguments& InArguments, FDLSSStateRef InDLSSState)
{
check(!IsRunningRHIInSeparateThread() || IsInRHIThread());
check(IsDLSSAvailable());
if (!IsDLSSAvailable()) return;
InArguments.Validate();
FVulkanCommandListContextImmediate& ImmediateContext = VulkanDevice->GetImmediateContext();
VkCommandBuffer VulkanCommandBuffer = ImmediateContext.GetCommandBufferManager()->GetActiveCmdBuffer()->GetHandle();
if (InDLSSState->RequiresFeatureRecreation(InArguments))
{
check(!InDLSSState->DLSSFeature || InDLSSState->HasValidFeature());
InDLSSState->DLSSFeature = nullptr;
}
if (InArguments.bReset)
{
check(!InDLSSState->DLSSFeature);
InDLSSState->DLSSFeature = FindFreeFeature(InArguments);
}
if (!InDLSSState->DLSSFeature)
{
NVSDK_NGX_Parameter* NewNGXParameterHandle = nullptr;
if (NGXRHI::SupportsAllocateParameters())
{
NVSDK_NGX_Result Result = NVSDK_NGX_VULKAN_AllocateParameters(&NewNGXParameterHandle);
checkf(NVSDK_NGX_SUCCEED(Result), TEXT("NVSDK_NGX_VULKAN_AllocateParameters failed! (%u %s)"), Result, GetNGXResultAsString(Result));
}
else
{
NVSDK_NGX_Result Result = NVSDK_NGX_VULKAN_GetParameters(&NewNGXParameterHandle);
checkf(NVSDK_NGX_SUCCEED(Result), TEXT("NVSDK_NGX_VULKAN_GetParameters failed! (%u %s)"), Result, GetNGXResultAsString(Result));
}
ApplyCommonNGXParameterSettings(NewNGXParameterHandle, InArguments);
NVSDK_NGX_DLSS_Create_Params DlssCreateParams = InArguments.GetNGXDLSSCreateParams();
NVSDK_NGX_Handle* NewNGXHandle = nullptr;
const uint32 CreationNodeMask = 1 << InArguments.GPUNode;
const uint32 VisibilityNodeMask = InArguments.GPUVisibility;
NVSDK_NGX_Result ResultCreate = NGX_VULKAN_CREATE_DLSS_EXT(
VulkanCommandBuffer,
CreationNodeMask,
VisibilityNodeMask,
&NewNGXHandle,
NewNGXParameterHandle,
&DlssCreateParams);
checkf(NVSDK_NGX_SUCCEED(ResultCreate), TEXT("NGX_VULKAN_CREATE_DLSS failed! (CreationNodeMask=0x%x VisibilityNodeMask=0x%x) (%u %s), %s"), CreationNodeMask, VisibilityNodeMask, ResultCreate, GetNGXResultAsString(ResultCreate), *InArguments.GetFeatureDesc().GetDebugDescription());
InDLSSState->DLSSFeature = MakeShared<FVulkanNGXDLSSFeature>(NewNGXHandle, NewNGXParameterHandle, InArguments.GetFeatureDesc(), FrameCounter);
RegisterFeature(InDLSSState->DLSSFeature);
}
check(InDLSSState->HasValidFeature());
// execute
NVSDK_NGX_VK_DLSS_Eval_Params DlssEvalParams;
FMemory::Memzero(DlssEvalParams);
auto NGXVulkanResourceFromRHITexture = [](FRHITexture* InRHITexture)
{
check(InRHITexture);
if (FRHITextureReference* TexRef = InRHITexture->GetTextureReference())
{
InRHITexture = TexRef->GetReferencedTexture();
check(InRHITexture);
}
FVulkanTextureBase* VulkanTexture = static_cast<FVulkanTextureBase*>(InRHITexture->GetTextureBaseRHI());
NVSDK_NGX_Resource_VK NGXTexture;
FMemory::Memzero(NGXTexture);
NGXTexture.Type = NVSDK_NGX_RESOURCE_VK_TYPE_VK_IMAGEVIEW;
// Check for VK_IMAGE_USAGE_STORAGE_BIT. Those are not directly stored but FVulkanSurface::GenerateImageCreateInfo sets the VK flag based on those UEFlags
NGXTexture.ReadWrite = EnumHasAnyFlags(VulkanTexture->Surface.UEFlags, TexCreate_Presentable | TexCreate_UAV);
NGXTexture.Resource.ImageViewInfo.ImageView = VulkanTexture->DefaultView.View;
NGXTexture.Resource.ImageViewInfo.Image = VulkanTexture->DefaultView.Image;
NGXTexture.Resource.ImageViewInfo.Format = VulkanTexture->Surface.ViewFormat;
NGXTexture.Resource.ImageViewInfo.Width = VulkanTexture->Surface.Width;
NGXTexture.Resource.ImageViewInfo.Height = VulkanTexture->Surface.Height;
check(VulkanTexture->Surface.Depth == 1);
NGXTexture.Resource.ImageViewInfo.SubresourceRange.aspectMask = VulkanTexture->Surface.GetFullAspectMask();
NGXTexture.Resource.ImageViewInfo.SubresourceRange.layerCount = VulkanTexture->Surface.GetNumberOfArrayLevels();
NGXTexture.Resource.ImageViewInfo.SubresourceRange.levelCount = VulkanTexture->Surface.GetNumMips();
// DLSS_TODO Figure out where to get those from if the textures are arrayed or mipped.
check(VulkanTexture->Surface.GetNumberOfArrayLevels() == 1);
check(VulkanTexture->Surface.GetNumMips() == 1);
NGXTexture.Resource.ImageViewInfo.SubresourceRange.baseMipLevel = 0;
NGXTexture.Resource.ImageViewInfo.SubresourceRange.baseArrayLayer = 0;
return NGXTexture;
};
NVSDK_NGX_Resource_VK InOutput = NGXVulkanResourceFromRHITexture(InArguments.OutputColor);
DlssEvalParams.Feature.pInOutput = &InOutput;
check(InArguments.OutputColor->GetFlags() & ( TexCreate_UAV | TexCreate_Presentable));
check(InOutput.ReadWrite == true);
DlssEvalParams.InOutputSubrectBase.X = InArguments.DestRect.Min.X;
DlssEvalParams.InOutputSubrectBase.Y = InArguments.DestRect.Min.Y;
DlssEvalParams.InRenderSubrectDimensions.Width = InArguments.SrcRect.Width();
DlssEvalParams.InRenderSubrectDimensions.Height = InArguments.SrcRect.Height();
NVSDK_NGX_Resource_VK InColor = NGXVulkanResourceFromRHITexture(InArguments.InputColor);
DlssEvalParams.Feature.pInColor = &InColor;
DlssEvalParams.InColorSubrectBase.X = InArguments.SrcRect.Min.X;
DlssEvalParams.InColorSubrectBase.Y = InArguments.SrcRect.Min.Y;
NVSDK_NGX_Resource_VK InDepth = NGXVulkanResourceFromRHITexture(InArguments.InputDepth);
DlssEvalParams.pInDepth = &InDepth;
DlssEvalParams.InDepthSubrectBase.X = InArguments.SrcRect.Min.X;
DlssEvalParams.InDepthSubrectBase.Y = InArguments.SrcRect.Min.Y;
NVSDK_NGX_Resource_VK InMotionVectors = NGXVulkanResourceFromRHITexture(InArguments.InputMotionVectors);
DlssEvalParams.pInMotionVectors = &InMotionVectors;
// The VelocityCombine pass puts the motion vectors into the top left corner
DlssEvalParams.InMVSubrectBase.X = 0;
DlssEvalParams.InMVSubrectBase.Y = 0;
NVSDK_NGX_Resource_VK InExposureTexture = NGXVulkanResourceFromRHITexture(InArguments.InputExposure);
DlssEvalParams.pInExposureTexture = InArguments.bUseAutoExposure ? nullptr : &InExposureTexture;
DlssEvalParams.InPreExposure = InArguments.PreExposure;
DlssEvalParams.Feature.InSharpness = InArguments.Sharpness;
DlssEvalParams.InJitterOffsetX = InArguments.JitterOffset.X;
DlssEvalParams.InJitterOffsetY = InArguments.JitterOffset.Y;
DlssEvalParams.InMVScaleX = InArguments.MotionVectorScale.X;
DlssEvalParams.InMVScaleY = InArguments.MotionVectorScale.Y;
DlssEvalParams.InReset = InArguments.bReset;
DlssEvalParams.InFrameTimeDeltaInMsec = InArguments.DeltaTime;
NVSDK_NGX_Result ResultEvaluate = NGX_VULKAN_EVALUATE_DLSS_EXT(
VulkanCommandBuffer,
InDLSSState->DLSSFeature->Feature,
InDLSSState->DLSSFeature->Parameter,
&DlssEvalParams
);
checkf(NVSDK_NGX_SUCCEED(ResultEvaluate), TEXT("NGX_Vulkan_EVALUATE_DLSS_EXT failed! (%u %s), %s"), ResultEvaluate, GetNGXResultAsString(ResultEvaluate), *InDLSSState->DLSSFeature->Desc.GetDebugDescription());
InDLSSState->DLSSFeature->Tick(FrameCounter);
if (FVulkanPlatform::RegisterGPUWork() && ImmediateContext.IsImmediate())
{
ImmediateContext.GetGPUProfiler().RegisterGPUWork(1);
}
ImmediateContext.GetPendingComputeState()->Reset();
ImmediateContext.GetPendingGfxState()->Reset();
}
/** IModuleInterface implementation */
void FNGXVulkanRHIModule::StartupModule()
{
// NGXRHI module should be loaded to ensure logging state is initialized
FModuleManager::LoadModuleChecked<INGXRHIModule>(TEXT("NGXRHI"));
}
void FNGXVulkanRHIModule::ShutdownModule()
{
}
TUniquePtr<NGXRHI> FNGXVulkanRHIModule::CreateNGXRHI(const FNGXRHICreateArguments& Arguments)
{
TUniquePtr<NGXRHI> Result(new FNGXVulkanRHI(Arguments));
return Result;
}
IMPLEMENT_MODULE(FNGXVulkanRHIModule, NGXVulkanRHI)
#undef LOCTEXT_NAMESPACE
@@ -1,36 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "Modules/ModuleManager.h"
#include "NGXRHI.h"
class FNGXVulkanRHIModule final : public INGXRHIModule
{
public:
/** IModuleInterface implementation */
virtual void StartupModule();
virtual void ShutdownModule();
/** INGXRHIModule implementation */
virtual TUniquePtr<NGXRHI> CreateNGXRHI(const FNGXRHICreateArguments& Arguments);
};
@@ -1,71 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
using UnrealBuildTool;
using System.IO;
public class NGXVulkanRHIPreInit : ModuleRules
{
public NGXVulkanRHIPreInit(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
Path.Combine(EngineDirectory,"Source/Runtime/VulkanRHI/Private"),
Path.Combine(EngineDirectory,"Source/Runtime/VulkanRHI/Private/Windows"),
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Core",
"Engine",
"RenderCore",
"RHI",
"VulkanRHI",
"NGX",
}
);
if (ReadOnlyBuildVersion.Current.MajorVersion == 5)
{
PrivateDependencyModuleNames.Add("RHICore");
}
// those come from the VulkanRHI
AddEngineThirdPartyPrivateStaticDependencies(Target, "Vulkan");
}
}
@@ -1,96 +0,0 @@
/*
* Copyright (c) 2020 - 2021 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#include "NGXVulkanRHIPreInit.h"
#include "VulkanRHIPrivate.h"
#include "VulkanRHIBridge.h"
#include "DynamicRHI.h"
#include "nvsdk_ngx_vk.h"
DEFINE_LOG_CATEGORY_STATIC(LogDLSSNGXVulkanRHIPreInit, Log, All);
#define LOCTEXT_NAMESPACE "FNGXVulkanRHIPreInitModule"
void FNGXVulkanRHIPreInitModule::StartupModule()
{
UE_LOG(LogDLSSNGXVulkanRHIPreInit, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
if(FApp::CanEverRender())
{
const TCHAR* VulkanRHIModuleName = TEXT("VulkanRHI");
// don't cleanup since the same module gets loaded shortly thereafter anyways
const TCHAR* DynamicRHIModuleName = GetSelectedDynamicRHIModuleName(false);
UE_LOG(LogDLSSNGXVulkanRHIPreInit, Log, TEXT("GetSelectedDynamicRHIModuleName = %s"), DynamicRHIModuleName);
if(FString(VulkanRHIModuleName) == FString(DynamicRHIModuleName))
{
IDynamicRHIModule* VulkanRHIModule = FModuleManager::GetModulePtr<IDynamicRHIModule>(VulkanRHIModuleName);
if(VulkanRHIModule && VulkanRHIModule->IsSupported())
{
unsigned int NumInstanceExtensions = 0 ;
const char** InstanceExtensions = nullptr;
unsigned int NumDeviceExtensions = 0;
const char** DeviceExtensions = nullptr;
const NVSDK_NGX_Result ResultRequiredExtensions = NVSDK_NGX_VULKAN_RequiredExtensions(&NumInstanceExtensions, &InstanceExtensions, &NumDeviceExtensions, &DeviceExtensions);
UE_LOG(LogDLSSNGXVulkanRHIPreInit, Log, TEXT("NVSDK_NGX_VULKAN_RequiredExtensions -> (%u %s)"), ResultRequiredExtensions, GetNGXResultAsString(ResultRequiredExtensions));
const TArray<const ANSICHAR*> RHIBridgeInstanceExtensions(InstanceExtensions, NumInstanceExtensions);
VulkanRHIBridge::AddEnabledInstanceExtensionsAndLayers(RHIBridgeInstanceExtensions, TArray<const ANSICHAR*>());
const TArray<const ANSICHAR*> RHIBridgeDeviceExtensions(DeviceExtensions, NumDeviceExtensions);
VulkanRHIBridge::AddEnabledDeviceExtensionsAndLayers(RHIBridgeDeviceExtensions, TArray<const ANSICHAR*>());
UE_LOG(LogDLSSNGXVulkanRHIPreInit, Log, TEXT("Preregistered the required NGX DLSS Vulkan device extensions (%u) and instance extensions (%u) via the VulkanRHIBridge"), NumDeviceExtensions, NumInstanceExtensions);
}
else
{
UE_LOG(LogDLSSNGXVulkanRHIPreInit, Log, TEXT("Failed to load the VulkanRHI module and/or Vulkan is not supported; skipping of pregistering the required NGX DLSS Vulkan device and instance extensions via the VulkanRHIBridge"));
}
}
else
{
UE_LOG(LogDLSSNGXVulkanRHIPreInit, Log, TEXT("VulkanRHI is not the active DynamicRHI; skipping of pregistering the required NGX DLSS Vulkan device and instance extensions via the VulkanRHIBridge"));
}
}
else
{
UE_LOG(LogDLSSNGXVulkanRHIPreInit, Log, TEXT("This UE instance does not render; skipping of pregistering the required NGX DLSS Vulkan device and instance extensions via the VulkanRHIBridge"));
}
UE_LOG(LogDLSSNGXVulkanRHIPreInit, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
void FNGXVulkanRHIPreInitModule::ShutdownModule()
{
UE_LOG(LogDLSSNGXVulkanRHIPreInit, Log, TEXT("%s Enter"), ANSI_TO_TCHAR(__FUNCTION__));
UE_LOG(LogDLSSNGXVulkanRHIPreInit, Log, TEXT("%s Leave"), ANSI_TO_TCHAR(__FUNCTION__));
}
IMPLEMENT_MODULE(FNGXVulkanRHIPreInitModule, NGXVulkanRHIPreInit)
#undef LOCTEXT_NAMESPACE
@@ -1,31 +0,0 @@
/*
* Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#pragma once
#include "Modules/ModuleManager.h"
class FNGXVulkanRHIPreInitModule final : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule();
virtual void ShutdownModule();
};
-437
View File
@@ -1,437 +0,0 @@
/*
* Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
/*
* HOW TO USE:
*
* IMPORTANT: FOR DLSS/DLISP PLEASE SEE THE PROGRAMMING GUIDE
*
* IMPORTANT: Methods in this library are NOT thread safe. It is up to the
* client to ensure that thread safety is enforced as needed.
*
* 1) Call NVSDK_CONV NVSDK_NGX_D3D11/D3D12/CUDA_Init and pass your app Id
* and other parameters. This will initialize SDK or return an error code
* if SDK cannot run on target machine. Depending on error user might
* need to update drivers. Please note that application Id is provided
* by NVIDIA so if you do not have one please contact us.
*
* 2) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetParameters to obtain pointer to
* interface used to pass parameters to SDK. Interface instance is
* allocated and released by SDK so there is no need to do any memory
* management on client side.
*
* 3) Set key parameters for the feature you want to use. For example,
* width and height are required for all features and they can be
* set like this:
* Params->Set(NVSDK_NGX_Parameter_Width,MY_WIDTH);
* Params->Set(NVSDK_NGX_Parameter_Height,MY_HEIGHT);
*
* You can also provide hints like NVSDK_NGX_Parameter_Hint_HDR to tell
* SDK that it should expect HDR color space is needed. Please refer to
* samples since different features need different parameters and hints.
*
* 4) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetScratchBufferSize to obtain size of
* the scratch buffer needed by specific feature. This D3D or CUDA buffer
* should be allocated by client and passed as:
* Params->Set(NVSDK_NGX_Parameter_Scratch,MY_SCRATCH_POINTER)
* Params->Set(NVSDK_NGX_Parameter_Scratch_SizeInBytes,MY_SCRATCH_SIZE_IN_BYTES)
* NOTE: Returned size can be 0 if feature does not use any scratch buffer.
* It is OK to use bigger buffer or reuse buffers across features as long
* as minimum size requirement is met.
*
* 5) Call NVSDK_NGX_D3D11/D3D12/CUDA_CreateFeature to create feature you need.
* On success SDK will return a handle which must be used in any successive
* calls to SDK which require feature handle. SDK will use all parameters
* and hints provided by client to generate feature. If feature with the same
* parameters already exists and error code will be returned.
*
* 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_EvaluateFeature to invoke execution of
* specific feature. Before feature can be evaluated input parameters must
* be specified (like for example color/albedo buffer, motion vectors etc)
*
* 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_ReleaseFeature when feature is no longer
* needed. After this call feature handle becomes invalid and cannot be used.
*
* 7) Call NVSDK_NGX_D3D11/D3D12/CUDA_Shutdown when SDK is no longer needed to
* release all resources.
* Contact: ngxsupport@nvidia.com
*/
#ifndef NVSDK_NGX_H
#define NVSDK_NGX_H
#include <stddef.h> // For size_t
#include "nvsdk_ngx_defs.h"
#include "nvsdk_ngx_params.h"
#ifndef __cplusplus
#include <stdbool.h>
#include <wchar.h>
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct IUnknown IUnknown;
typedef struct ID3D11Device ID3D11Device;
typedef struct ID3D11Resource ID3D11Resource;
typedef struct ID3D11DeviceContext ID3D11DeviceContext;
typedef struct D3D11_TEXTURE2D_DESC D3D11_TEXTURE2D_DESC;
typedef struct D3D11_BUFFER_DESC D3D11_BUFFER_DESC;
typedef struct ID3D11Buffer ID3D11Buffer;
typedef struct ID3D11Texture2D ID3D11Texture2D;
typedef struct ID3D12Device ID3D12Device;
typedef struct ID3D12Resource ID3D12Resource;
typedef struct ID3D12GraphicsCommandList ID3D12GraphicsCommandList;
typedef struct D3D12_RESOURCE_DESC D3D12_RESOURCE_DESC;
typedef struct CD3DX12_HEAP_PROPERTIES CD3DX12_HEAP_PROPERTIES;
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_D3D12_ResourceAllocCallback)(D3D12_RESOURCE_DESC *InDesc, int InState, CD3DX12_HEAP_PROPERTIES *InHeap, ID3D12Resource **OutResource);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_D3D11_BufferAllocCallback)(D3D11_BUFFER_DESC *InDesc, ID3D11Buffer **OutResource);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_D3D11_Tex2DAllocCallback)(D3D11_TEXTURE2D_DESC *InDesc, ID3D11Texture2D **OutResource);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ResourceReleaseCallback)(IUnknown *InResource);
typedef unsigned long long CUtexObject;
///////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Init
// -------------------------------------
//
// InApplicationId:
// Unique Id provided by NVIDIA
//
// InApplicationDataPath:
// Folder to store logs and other temporary files (write access required),
// Normally this would be a location in Documents or ProgramData.
//
// InDevice: [d3d11/12 only]
// DirectX device to use
//
// InFeatureInfo:
// Contains information common to all features, presently only a list of all paths
// feature dlls can be located in, other than the default path - application directory.
//
// DESCRIPTION:
// Initializes new SDK instance.
//
#ifdef __cplusplus
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
#else
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Init_with_ProjectID
// -------------------------------------
//
// InProjectId:
// Unique Id provided by the rendering engine used
//
// InEngineType:
// Rendering engine used by the application / plugin.
// Use NVSDK_NGX_ENGINE_TYPE_CUSTOM if the specific engine type is not supported explicitly
//
// InEngineVersion:
// Version number of the rendering engine used by the application / plugin.
//
// InApplicationDataPath:
// Folder to store logs and other temporary files (write access required),
// Normally this would be a location in Documents or ProgramData.
//
// InDevice: [d3d11/12 only]
// DirectX device to use
//
// InFeatureInfo:
// Contains information common to all features, presently only a list of all paths
// feature dlls can be located in, other than the default path - application directory.
//
// DESCRIPTION:
// Initializes new SDK instance.
//
#ifdef __cplusplus
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
#else
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Shutdown
// -------------------------------------
//
// DESCRIPTION:
// Shuts down the current SDK instance and releases all resources.
// Shutdown1(Device) only affects specified device
// Shutdown1(nullptr) = Shutdown() and shuts down all devices
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Shutdown(void);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Shutdown1(ID3D11Device *InDevice);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Shutdown(void);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Shutdown1(ID3D12Device *InDevice);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Shutdown(void);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_GetParameters
// ----------------------------------------------------------
//
// OutParameters:
// Parameters interface used to set any parameter needed by the SDK
//
// DESCRIPTION:
// This interface allows simple parameter setup using named fields.
// For example one can set width by calling Set(NVSDK_NGX_Parameter_Denoiser_Width,100) or
// provide CUDA buffer pointer by calling Set(NVSDK_NGX_Parameter_Denoiser_Color,cudaBuffer)
// For more details please see sample code. Please note that allocated memory
// will be freed by NGX so free/delete operator should NOT be called.
// Parameter maps output by NVSDK_NGX_GetParameters are also pre-populated
// with NGX capabilities and available features.
// Unlike with NVSDK_NGX_AllocateParameters, parameter maps output by NVSDK_NGX_GetParameters
// have their lifetimes managed by NGX, and must not
// be destroyed by the app using NVSDK_NGX_DestroyParameters.
// NVSDK_NGX_GetParameters is soon to be deprecated and apps should move to using
// NVSDK_NGX_AllocateParameters and NVSDK_NGX_GetCapabilityParameters when possible.
// Nevertheless, due to the possibility that the user will be using an older driver version,
// NVSDK_NGX_GetParameters should still be used as a fallback if NVSDK_NGX_AllocateParameters
// or NVSDK_NGX_GetCapabilityParameters return NVSDK_NGX_Result_FAIL_OutOfDate.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_GetParameters(NVSDK_NGX_Parameter **OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_GetParameters(NVSDK_NGX_Parameter **OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_GetParameters(NVSDK_NGX_Parameter **OutParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_AllocateParameters
// ----------------------------------------------------------
//
// OutParameters:
// Parameters interface used to set any parameter needed by the SDK
//
// DESCRIPTION:
// This interface allows allocating a simple parameter setup using named fields, whose
// lifetime the app must manage.
// For example one can set width by calling Set(NVSDK_NGX_Parameter_Denoiser_Width,100) or
// provide CUDA buffer pointer by calling Set(NVSDK_NGX_Parameter_Denoiser_Color,cudaBuffer)
// For more details please see sample code.
// Parameter maps output by NVSDK_NGX_AllocateParameters must NOT be freed using
// the free/delete operator; to free a parameter map
// output by NVSDK_NGX_AllocateParameters, NVSDK_NGX_DestroyParameters should be used.
// Unlike with NVSDK_NGX_GetParameters, parameter maps allocated with NVSDK_NGX_AllocateParameters
// must be destroyed by the app using NVSDK_NGX_DestroyParameters.
// Also unlike with NVSDK_NGX_GetParameters, parameter maps output by NVSDK_NGX_AllocateParameters
// do not come pre-populated with NGX capabilities and available features.
// To create a new parameter map pre-populated with such information, NVSDK_NGX_GetCapabilityParameters
// should be used.
// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
// does not support this API call is being used. In such a case, NVSDK_NGX_GetParameters
// may be used as a fallback.
// This function may only be called after a successful call into NVSDK_NGX_Init.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_GetCapabilityParameters
// ----------------------------------------------------------
//
// OutParameters:
// The parameters interface populated with NGX and feature capabilities
//
// DESCRIPTION:
// This interface allows the app to create a new parameter map
// pre-populated with NGX capabilities and available features.
// The output parameter map can also be used for any purpose
// parameter maps output by NVSDK_NGX_AllocateParameters can be used for
// but it is not recommended to use NVSDK_NGX_GetCapabilityParameters
// unless querying NGX capabilities and available features
// due to the overhead associated with pre-populating the parameter map.
// Parameter maps output by NVSDK_NGX_GetCapabilityParameters must NOT be freed using
// the free/delete operator; to free a parameter map
// output by NVSDK_NGX_GetCapabilityParameters, NVSDK_NGX_DestroyParameters should be used.
// Unlike with NVSDK_NGX_GetParameters, parameter maps allocated with NVSDK_NGX_GetCapabilityParameters
// must be destroyed by the app using NVSDK_NGX_DestroyParameters.
// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
// does not support this API call is being used. This function may only be called
// after a successful call into NVSDK_NGX_Init.
// If NVSDK_NGX_GetCapabilityParameters fails with NVSDK_NGX_Result_FAIL_OutOfDate,
// NVSDK_NGX_GetParameters may be used as a fallback, to get a parameter map pre-populated
// with NGX capabilities and available features.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_DestroyParameters
// ----------------------------------------------------------
//
// InParameters:
// The parameters interface to be destroyed
//
// DESCRIPTION:
// This interface allows the app to destroy the parameter map passed in. Once
// NVSDK_NGX_DestroyParameters is called on a parameter map, it
// must not be used again.
// NVSDK_NGX_DestroyParameters must not be called on any parameter map returned
// by NVSDK_NGX_GetParameters; NGX will manage the lifetime of those
// parameter maps.
// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
// does not support this API call is being used. This function may only be called
// after a successful call into NVSDK_NGX_Init.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_GetScratchBufferSize
// ----------------------------------------------------------
//
// InFeatureId:
// AI feature in question
//
// InParameters:
// Parameters used by the feature to help estimate scratch buffer size
//
// OutSizeInBytes:
// Number of bytes needed for the scratch buffer for the specified feature.
//
// DESCRIPTION:
// SDK needs a buffer of a certain size provided by the client in
// order to initialize AI feature. Once feature is no longer
// needed buffer can be released. It is safe to reuse the same
// scratch buffer for different features as long as minimum size
// requirement is met for all features. Please note that some
// features might not need a scratch buffer so return size of 0
// is completely valid.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
/////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_CreateFeature
// -------------------------------------
//
// InCmdList:[d3d12 only]
// Command list to use to execute GPU commands. Must be:
// - Open and recording
// - With node mask including the device provided in NVSDK_NGX_D3D12_Init
// - Execute on non-copy command queue.
// InDevCtx: [d3d11 only]
// Device context to use to execute GPU commands
//
// InFeatureID:
// AI feature to initialize
//
// InParameters:
// List of parameters
//
// OutHandle:
// Handle which uniquely identifies the feature. If feature with
// provided parameters already exists the "already exists" error code is returned.
//
// DESCRIPTION:
// Each feature needs to be created before it can be used.
// Refer to the sample code to find out which input parameters
// are needed to create specific feature.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_CreateFeature(ID3D11DeviceContext *InDevCtx, NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_CreateFeature(ID3D12GraphicsCommandList *InCmdList, NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_CreateFeature(NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
/////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Release
// -------------------------------------
//
// InHandle:
// Handle to feature to be released
//
// DESCRIPTION:
// Releases feature with a given handle.
// Handles are not reference counted so
// after this call it is invalid to use provided handle.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
/////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_EvaluateFeature
// -------------------------------------
//
// InCmdList:[d3d12 only]
// Command list to use to execute GPU commands. Must be:
// - Open and recording
// - With node mask including the device provided in NVSDK_NGX_D3D12_Init
// - Execute on non-copy command queue.
// InDevCtx: [d3d11 only]
// Device context to use to execute GPU commands
//
// InFeatureHandle:
// Handle representing feature to be evaluated
//
// InParameters:
// List of parameters required to evaluate feature
//
// InCallback:
// Optional callback for features which might take longer
// to execture. If specified SDK will call it with progress
// values in range 0.0f - 1.0f
//
// DESCRIPTION:
// Evaluates given feature using the provided parameters and
// pre-trained NN. Please note that for most features
// it can be benefitials to pass as many input buffers and parameters
// as possible (for example provide all render targets like color, albedo, normals, depth etc)
//
#ifdef __cplusplus
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback)(float InCurrentProgress, bool &OutShouldCancel);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceContext *InDevCtx, const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback InCallback = NULL);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCommandList *InCmdList, const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback InCallback = NULL);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_EvaluateFeature(const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback InCallback = NULL);
#endif
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback_C)(float InCurrentProgress, bool *OutShouldCancel);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_EvaluateFeature_C(ID3D11DeviceContext *InDevCtx, const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback_C InCallback);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_EvaluateFeature_C(ID3D12GraphicsCommandList *InCmdList, const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback_C InCallback);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_EvaluateFeature_C(const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback_C InCallback);
// NGX return-code conversion-to-string utility only as a helper for debugging/logging - not for official use.
const wchar_t* NVSDK_CONV GetNGXResultAsString(NVSDK_NGX_Result InNGXResult);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // #define NVSDK_NGX_H
@@ -1,597 +0,0 @@
/*
* Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#ifndef NVSDK_NGX_DEFS_H
#define NVSDK_NGX_DEFS_H
#pragma once
#ifndef __cplusplus
#include <stddef.h> // For size_t
#include <stdbool.h>
#include <wchar.h>
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
#if defined(NVSDK_NGX) && defined(NV_WINDOWS)
#define NVSDK_NGX_API extern "C" __declspec(dllexport)
#else
#define NVSDK_NGX_API extern "C"
#endif
#else
#if defined(NVSDK_NGX) && defined(NV_WINDOWS)
#define NVSDK_NGX_API __declspec(dllexport)
#else
#define NVSDK_NGX_API
#endif
#endif
#ifdef __GNUC__
#define NVSDK_CONV
#else
#define NVSDK_CONV __cdecl
#endif
#define NVSDK_NGX_ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0]))
// Version Notes:
// Version 0x0000014:
// * Added a logging callback that the app may pass in on init
// * Added ability for the app to override the logging level
// Version 0x0000015:
// * Support multiple GPUs (bug 3270533)
#define NVSDK_NGX_VERSION_API_MACRO 0x0000014 // NGX_VERSION_DOT 1.4.0
typedef struct NVSDK_NGX_FeatureCommonInfo_Internal NVSDK_NGX_FeatureCommonInfo_Internal;
typedef enum NVSDK_NGX_Version { NVSDK_NGX_Version_API = NVSDK_NGX_VERSION_API_MACRO } NVSDK_NGX_Version;
typedef enum NVSDK_NGX_Result
{
NVSDK_NGX_Result_Success = 0x1,
NVSDK_NGX_Result_Fail = 0xBAD00000,
// Feature is not supported on current hardware
NVSDK_NGX_Result_FAIL_FeatureNotSupported = NVSDK_NGX_Result_Fail | 1,
// Platform error - for example - check d3d12 debug layer log for more information
NVSDK_NGX_Result_FAIL_PlatformError = NVSDK_NGX_Result_Fail | 2,
// Feature with given parameters already exists
NVSDK_NGX_Result_FAIL_FeatureAlreadyExists = NVSDK_NGX_Result_Fail | 3,
// Feature with provided handle does not exist
NVSDK_NGX_Result_FAIL_FeatureNotFound = NVSDK_NGX_Result_Fail | 4,
// Invalid parameter was provided
NVSDK_NGX_Result_FAIL_InvalidParameter = NVSDK_NGX_Result_Fail | 5,
// Provided buffer is too small, please use size provided by NVSDK_NGX_GetScratchBufferSize
NVSDK_NGX_Result_FAIL_ScratchBufferTooSmall = NVSDK_NGX_Result_Fail | 6,
// SDK was not initialized properly
NVSDK_NGX_Result_FAIL_NotInitialized = NVSDK_NGX_Result_Fail | 7,
// Unsupported format used for input/output buffers
NVSDK_NGX_Result_FAIL_UnsupportedInputFormat = NVSDK_NGX_Result_Fail | 8,
// Feature input/output needs RW access (UAV) (d3d11/d3d12 specific)
NVSDK_NGX_Result_FAIL_RWFlagMissing = NVSDK_NGX_Result_Fail | 9,
// Feature was created with specific input but none is provided at evaluation
NVSDK_NGX_Result_FAIL_MissingInput = NVSDK_NGX_Result_Fail | 10,
// Feature is not available on the system
NVSDK_NGX_Result_FAIL_UnableToInitializeFeature = NVSDK_NGX_Result_Fail | 11,
// NGX system libraries are old and need an update
NVSDK_NGX_Result_FAIL_OutOfDate = NVSDK_NGX_Result_Fail | 12,
// Feature requires more GPU memory than it is available on system
NVSDK_NGX_Result_FAIL_OutOfGPUMemory = NVSDK_NGX_Result_Fail | 13,
// Format used in input buffer(s) is not supported by feature
NVSDK_NGX_Result_FAIL_UnsupportedFormat = NVSDK_NGX_Result_Fail | 14,
// Path provided in InApplicationDataPath cannot be written to
NVSDK_NGX_Result_FAIL_UnableToWriteToAppDataPath = NVSDK_NGX_Result_Fail | 15,
// Unsupported parameter was provided (e.g. specific scaling factor is unsupported)
NVSDK_NGX_Result_FAIL_UnsupportedParameter = NVSDK_NGX_Result_Fail | 16,
// The feature or application was denied (contact NVIDIA for further details)
NVSDK_NGX_Result_FAIL_Denied = NVSDK_NGX_Result_Fail | 17
} NVSDK_NGX_Result;
#define NVSDK_NGX_SUCCEED(value) (((value) & 0xFFF00000) != NVSDK_NGX_Result_Fail)
#define NVSDK_NGX_FAILED(value) (((value) & 0xFFF00000) == NVSDK_NGX_Result_Fail)
typedef enum NVSDK_NGX_Feature
{
NVSDK_NGX_Feature_Reserved0,
NVSDK_NGX_Feature_SuperSampling,
NVSDK_NGX_Feature_InPainting,
NVSDK_NGX_Feature_ImageSuperResolution,
NVSDK_NGX_Feature_SlowMotion,
NVSDK_NGX_Feature_VideoSuperResolution,
NVSDK_NGX_Feature_Reserved1,
NVSDK_NGX_Feature_Reserved2,
NVSDK_NGX_Feature_Reserved3,
NVSDK_NGX_Feature_ImageSignalProcessing,
NVSDK_NGX_Feature_DeepResolve,
NVSDK_NGX_Feature_Reserved4,
// New features go here
NVSDK_NGX_Feature_Count,
// These members are not strictly NGX features, but are
// components of the NGX system, and it may sometimes
// be useful to identify them using the same enum
NVSDK_NGX_Feature_Reserved_SDK = 32764,
NVSDK_NGX_Feature_Reserved_Core,
NVSDK_NGX_Feature_Reserved_Unknown
} NVSDK_NGX_Feature;
//TODO create grayscale format (R32F?)
typedef enum NVSDK_NGX_Buffer_Format
{
NVSDK_NGX_Buffer_Format_Unknown,
NVSDK_NGX_Buffer_Format_RGB8UI,
NVSDK_NGX_Buffer_Format_RGB16F,
NVSDK_NGX_Buffer_Format_RGB32F,
NVSDK_NGX_Buffer_Format_RGBA8UI,
NVSDK_NGX_Buffer_Format_RGBA16F,
NVSDK_NGX_Buffer_Format_RGBA32F,
} NVSDK_NGX_Buffer_Format;
typedef enum NVSDK_NGX_PerfQuality_Value
{
NVSDK_NGX_PerfQuality_Value_MaxPerf,
NVSDK_NGX_PerfQuality_Value_Balanced,
NVSDK_NGX_PerfQuality_Value_MaxQuality,
// Extended PerfQuality modes
NVSDK_NGX_PerfQuality_Value_UltraPerformance,
NVSDK_NGX_PerfQuality_Value_UltraQuality,
} NVSDK_NGX_PerfQuality_Value;
typedef enum NVSDK_NGX_RTX_Value
{
NVSDK_NGX_RTX_Value_Off,
NVSDK_NGX_RTX_Value_On,
} NVSDK_NGX_RTX_Value;
typedef enum NVSDK_NGX_DLSS_Mode
{
NVSDK_NGX_DLSS_Mode_Off, // use existing in-engine AA + upscale solution
NVSDK_NGX_DLSS_Mode_DLSS_DLISP,
NVSDK_NGX_DLSS_Mode_DLISP_Only, // use existing in-engine AA solution
NVSDK_NGX_DLSS_Mode_DLSS, // DLSS will apply AA and upsample at the same time
} NVSDK_NGX_DLSS_Mode;
typedef struct NVSDK_NGX_Handle { unsigned int Id; } NVSDK_NGX_Handle;
typedef enum NSDK_NGX_GPU_Arch
{
NVSDK_NGX_GPU_Arch_NotSupported = 0,
// Match NvAPI's NV_GPU_ARCHITECTURE_ID values for GV100 and TU100 for
// backwards compatibility with snippets built against NvAPI
NVSDK_NGX_GPU_Arch_Volta = 0x0140,
NVSDK_NGX_GPU_Arch_Turing = 0x0160,
// Presumably something newer
NVSDK_NGX_GPU_Arch_Unknown = 0x7FFFFFF
} NVSDK_NGX_GPU_Arch;
typedef enum NVSDK_NGX_DLSS_Feature_Flags
{
NVSDK_NGX_DLSS_Feature_Flags_IsInvalid = 1 << 31,
NVSDK_NGX_DLSS_Feature_Flags_None = 0,
NVSDK_NGX_DLSS_Feature_Flags_IsHDR = 1 << 0,
NVSDK_NGX_DLSS_Feature_Flags_MVLowRes = 1 << 1,
NVSDK_NGX_DLSS_Feature_Flags_MVJittered = 1 << 2,
NVSDK_NGX_DLSS_Feature_Flags_DepthInverted = 1 << 3,
NVSDK_NGX_DLSS_Feature_Flags_Reserved_0 = 1 << 4,
NVSDK_NGX_DLSS_Feature_Flags_DoSharpening = 1 << 5,
NVSDK_NGX_DLSS_Feature_Flags_AutoExposure = 1 << 6,
} NVSDK_NGX_DLSS_Feature_Flags;
typedef enum NVSDK_NGX_ToneMapperType
{
NVSDK_NGX_TONEMAPPER_STRING = 0,
NVSDK_NGX_TONEMAPPER_REINHARD,
NVSDK_NGX_TONEMAPPER_ONEOVERLUMA,
NVSDK_NGX_TONEMAPPER_ACES,
NVSDK_NGX_TONEMAPPERTYPE_NUM
} NVSDK_NGX_ToneMapperType;
typedef enum NVSDK_NGX_GBufferType
{
NVSDK_NGX_GBUFFER_ALBEDO = 0,
NVSDK_NGX_GBUFFER_ROUGHNESS,
NVSDK_NGX_GBUFFER_METALLIC,
NVSDK_NGX_GBUFFER_SPECULAR,
NVSDK_NGX_GBUFFER_SUBSURFACE,
NVSDK_NGX_GBUFFER_NORMALS,
NVSDK_NGX_GBUFFER_SHADINGMODELID, /* unique identifier for drawn object or how the object is drawn */
NVSDK_NGX_GBUFFER_MATERIALID, /* unique identifier for material */
NVSDK_NGX_GBUFFERTYPE_NUM = 16
} NVSDK_NGX_GBufferType;
typedef struct NVSDK_NGX_Coordinates
{
unsigned int X;
unsigned int Y;
} NVSDK_NGX_Coordinates;
typedef struct NVSDK_NGX_Dimensions
{
unsigned int Width;
unsigned int Height;
} NVSDK_NGX_Dimensions;
typedef struct NVSDK_NGX_PathListInfo
{
wchar_t **Path;
// Path-list length
unsigned int Length;
} NVSDK_NGX_PathListInfo;
typedef enum NVSDK_NGX_Logging_Level
{
NVSDK_NGX_LOGGING_LEVEL_OFF = 0,
NVSDK_NGX_LOGGING_LEVEL_ON,
NVSDK_NGX_LOGGING_LEVEL_VERBOSE,
NVSDK_NGX_LOGGING_LEVEL_NUM
} NVSDK_NGX_Logging_Level;
// A logging callback provided by the app to allow piping log lines back to the app.
// Please take careful note of the signature and calling convention.
// The callback must be able to be called from any thread.
// It must also be fully thread-safe and any number of threads may call into it concurrently.
// It must fully process message by the time it returns, and there is no guarantee that
// message will still be valid or allocated after it returns.
// message will be a null-terminated string and may contain multibyte characters.
#if defined(__GNUC__) || defined(__clang__)
typedef void NVSDK_CONV(*NVSDK_NGX_AppLogCallback)(const char* message, NVSDK_NGX_Logging_Level loggingLevel, NVSDK_NGX_Feature sourceComponent);
#else
typedef void(NVSDK_CONV* NVSDK_NGX_AppLogCallback)(const char* message, NVSDK_NGX_Logging_Level loggingLevel, NVSDK_NGX_Feature sourceComponent);
#endif
typedef struct NGSDK_NGX_LoggingInfo
{
// Fields below were introduced in SDK version 0x0000014
// App-provided logging callback
NVSDK_NGX_AppLogCallback LoggingCallback;
// The minimum logging level to use. If this is higher
// than the logging level otherwise configured, this will override
// that logging level. Otherwise, that logging level will be used.
NVSDK_NGX_Logging_Level MinimumLoggingLevel;
// Whether or not to disable writing log lines to sinks other than the app log callback. This
// may be useful if the app provides a logging callback. LoggingCallback must be non-null and point
// to a valid logging callback if this is set to true.
bool DisableOtherLoggingSinks;
} NGSDK_NGX_LoggingInfo;
typedef struct NVSDK_NGX_FeatureCommonInfo
{
// List of all paths in descending order of search sequence to locate a feature dll in, other than the default path - application folder.
NVSDK_NGX_PathListInfo PathListInfo;
// Used internally by NGX
NVSDK_NGX_FeatureCommonInfo_Internal* InternalData; // Introduced in SDK version 0x0000013
// Fields below were introduced in SDK version 0x0000014
NGSDK_NGX_LoggingInfo LoggingInfo;
} NVSDK_NGX_FeatureCommonInfo;
typedef enum NVSDK_NGX_Resource_VK_Type
{
NVSDK_NGX_RESOURCE_VK_TYPE_VK_IMAGEVIEW,
NVSDK_NGX_RESOURCE_VK_TYPE_VK_BUFFER
} NVSDK_NGX_Resource_VK_Type;
typedef enum NVSDK_NGX_Opt_Level
{
NVSDK_NGX_OPT_LEVEL_UNDEFINED = 0,
NVSDK_NGX_OPT_LEVEL_DEBUG = 20,
NVSDK_NGX_OPT_LEVEL_DEVELOP = 30,
NVSDK_NGX_OPT_LEVEL_RELEASE = 40
} NVSDK_NGX_Opt_Level;
typedef enum NVSDK_NGX_EngineType
{
NVSDK_NGX_ENGINE_TYPE_CUSTOM = 0,
NVSDK_NGX_ENGINE_TYPE_UNREAL,
NVSDK_NGX_ENGINE_TYPE_UNITY,
NVSDK_NGX_ENGINE_TYPE_OMNIVERSE,
NVSDK_NGX_ENGINE_COUNT
} NVSDK_NGX_EngineType;
// Read-only parameters provided by NGX
#define NVSDK_NGX_EParameter_Reserved00 "#\x00"
#define NVSDK_NGX_EParameter_SuperSampling_Available "#\x01"
#define NVSDK_NGX_EParameter_InPainting_Available "#\x02"
#define NVSDK_NGX_EParameter_ImageSuperResolution_Available "#\x03"
#define NVSDK_NGX_EParameter_SlowMotion_Available "#\x04"
#define NVSDK_NGX_EParameter_VideoSuperResolution_Available "#\x05"
#define NVSDK_NGX_EParameter_Reserved06 "#\x06"
#define NVSDK_NGX_EParameter_Reserved07 "#\x07"
#define NVSDK_NGX_EParameter_Reserved08 "#\x08"
#define NVSDK_NGX_EParameter_ImageSignalProcessing_Available "#\x09"
#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_2_1 "#\x0a"
#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_3_1 "#\x0b"
#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_3_2 "#\x0c"
#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_4_3 "#\x0d"
#define NVSDK_NGX_EParameter_NumFrames "#\x0e"
#define NVSDK_NGX_EParameter_Scale "#\x0f"
#define NVSDK_NGX_EParameter_Width "#\x10"
#define NVSDK_NGX_EParameter_Height "#\x11"
#define NVSDK_NGX_EParameter_OutWidth "#\x12"
#define NVSDK_NGX_EParameter_OutHeight "#\x13"
#define NVSDK_NGX_EParameter_Sharpness "#\x14"
#define NVSDK_NGX_EParameter_Scratch "#\x15"
#define NVSDK_NGX_EParameter_Scratch_SizeInBytes "#\x16"
#define NVSDK_NGX_EParameter_Deprecated_17 "#\x17"
#define NVSDK_NGX_EParameter_Input1 "#\x18"
#define NVSDK_NGX_EParameter_Input1_Format "#\x19"
#define NVSDK_NGX_EParameter_Input1_SizeInBytes "#\x1a"
#define NVSDK_NGX_EParameter_Input2 "#\x1b"
#define NVSDK_NGX_EParameter_Input2_Format "#\x1c"
#define NVSDK_NGX_EParameter_Input2_SizeInBytes "#\x1d"
#define NVSDK_NGX_EParameter_Color "#\x1e"
#define NVSDK_NGX_EParameter_Color_Format "#\x1f"
#define NVSDK_NGX_EParameter_Color_SizeInBytes "#\x20"
#define NVSDK_NGX_EParameter_Albedo "#\x21"
#define NVSDK_NGX_EParameter_Output "#\x22"
#define NVSDK_NGX_EParameter_Output_Format "#\x23"
#define NVSDK_NGX_EParameter_Output_SizeInBytes "#\x24"
#define NVSDK_NGX_EParameter_Reset "#\x25"
#define NVSDK_NGX_EParameter_BlendFactor "#\x26"
#define NVSDK_NGX_EParameter_MotionVectors "#\x27"
#define NVSDK_NGX_EParameter_Rect_X "#\x28"
#define NVSDK_NGX_EParameter_Rect_Y "#\x29"
#define NVSDK_NGX_EParameter_Rect_W "#\x2a"
#define NVSDK_NGX_EParameter_Rect_H "#\x2b"
#define NVSDK_NGX_EParameter_MV_Scale_X "#\x2c"
#define NVSDK_NGX_EParameter_MV_Scale_Y "#\x2d"
#define NVSDK_NGX_EParameter_Model "#\x2e"
#define NVSDK_NGX_EParameter_Format "#\x2f"
#define NVSDK_NGX_EParameter_SizeInBytes "#\x30"
#define NVSDK_NGX_EParameter_ResourceAllocCallback "#\x31"
#define NVSDK_NGX_EParameter_BufferAllocCallback "#\x32"
#define NVSDK_NGX_EParameter_Tex2DAllocCallback "#\x33"
#define NVSDK_NGX_EParameter_ResourceReleaseCallback "#\x34"
#define NVSDK_NGX_EParameter_CreationNodeMask "#\x35"
#define NVSDK_NGX_EParameter_VisibilityNodeMask "#\x36"
#define NVSDK_NGX_EParameter_PreviousOutput "#\x37"
#define NVSDK_NGX_EParameter_MV_Offset_X "#\x38"
#define NVSDK_NGX_EParameter_MV_Offset_Y "#\x39"
#define NVSDK_NGX_EParameter_Hint_UseFireflySwatter "#\x3a"
#define NVSDK_NGX_EParameter_Resource_Width "#\x3b"
#define NVSDK_NGX_EParameter_Resource_Height "#\x3c"
#define NVSDK_NGX_EParameter_Depth "#\x3d"
#define NVSDK_NGX_EParameter_DLSSOptimalSettingsCallback "#\x3e"
#define NVSDK_NGX_EParameter_PerfQualityValue "#\x3f"
#define NVSDK_NGX_EParameter_RTXValue "#\x40"
#define NVSDK_NGX_EParameter_DLSSMode "#\x41"
#define NVSDK_NGX_EParameter_DeepResolve_Available "#\x42"
#define NVSDK_NGX_EParameter_Deprecated_43 "#\x43"
#define NVSDK_NGX_EParameter_OptLevel "#\x44"
#define NVSDK_NGX_EParameter_IsDevSnippetBranch "#\x45"
#define NVSDK_NGX_Parameter_OptLevel "Snippet.OptLevel"
#define NVSDK_NGX_Parameter_IsDevSnippetBranch "Snippet.IsDevBranch"
#define NVSDK_NGX_Parameter_SuperSampling_ScaleFactor "SuperSampling.ScaleFactor"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_ScaleFactor "ImageSignalProcessing.ScaleFactor"
#define NVSDK_NGX_Parameter_SuperSampling_Available "SuperSampling.Available"
#define NVSDK_NGX_Parameter_InPainting_Available "InPainting.Available"
#define NVSDK_NGX_Parameter_ImageSuperResolution_Available "ImageSuperResolution.Available"
#define NVSDK_NGX_Parameter_SlowMotion_Available "SlowMotion.Available"
#define NVSDK_NGX_Parameter_VideoSuperResolution_Available "VideoSuperResolution.Available"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_Available "ImageSignalProcessing.Available"
#define NVSDK_NGX_Parameter_DeepResolve_Available "DeepResolve.Available"
#define NVSDK_NGX_Parameter_SuperSampling_NeedsUpdatedDriver "SuperSampling.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_InPainting_NeedsUpdatedDriver "InPainting.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_ImageSuperResolution_NeedsUpdatedDriver "ImageSuperResolution.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_SlowMotion_NeedsUpdatedDriver "SlowMotion.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_VideoSuperResolution_NeedsUpdatedDriver "VideoSuperResolution.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_NeedsUpdatedDriver "ImageSignalProcessing.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_DeepResolve_NeedsUpdatedDriver "DeepResolve.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_FrameInterpolation_NeedsUpdatedDriver "FrameInterpolation.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_SuperSampling_MinDriverVersionMajor "SuperSampling.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_InPainting_MinDriverVersionMajor "InPainting.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_ImageSuperResolution_MinDriverVersionMajor "ImageSuperResolution.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_SlowMotion_MinDriverVersionMajor "SlowMotion.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_VideoSuperResolution_MinDriverVersionMajor "VideoSuperResolution.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_MinDriverVersionMajor "ImageSignalProcessing.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_DeepResolve_MinDriverVersionMajor "DeepResolve.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_FrameInterpolation_MinDriverVersionMajor "FrameInterpolation.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_SuperSampling_MinDriverVersionMinor "SuperSampling.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_InPainting_MinDriverVersionMinor "InPainting.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_ImageSuperResolution_MinDriverVersionMinor "ImageSuperResolution.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_SlowMotion_MinDriverVersionMinor "SlowMotion.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_VideoSuperResolution_MinDriverVersionMinor "VideoSuperResolution.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_MinDriverVersionMinor "ImageSignalProcessing.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_DeepResolve_MinDriverVersionMinor "DeepResolve.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_SuperSampling_FeatureInitResult "SuperSampling.FeatureInitResult"
#define NVSDK_NGX_Parameter_InPainting_FeatureInitResult "InPainting.FeatureInitResult"
#define NVSDK_NGX_Parameter_ImageSuperResolution_FeatureInitResult "ImageSuperResolution.FeatureInitResult"
#define NVSDK_NGX_Parameter_SlowMotion_FeatureInitResult "SlowMotion.FeatureInitResult"
#define NVSDK_NGX_Parameter_VideoSuperResolution_FeatureInitResult "VideoSuperResolution.FeatureInitResult"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_FeatureInitResult "ImageSignalProcessing.FeatureInitResult"
#define NVSDK_NGX_Parameter_DeepResolve_FeatureInitResult "DeepResolve.FeatureInitResult"
#define NVSDK_NGX_Parameter_FrameInterpolation_FeatureInitResult "FrameInterpolation.FeatureInitResult"
#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_2_1 "ImageSuperResolution.ScaleFactor.2.1"
#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_3_1 "ImageSuperResolution.ScaleFactor.3.1"
#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_3_2 "ImageSuperResolution.ScaleFactor.3.2"
#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_4_3 "ImageSuperResolution.ScaleFactor.4.3"
#define NVSDK_NGX_Parameter_NumFrames "NumFrames"
#define NVSDK_NGX_Parameter_Scale "Scale"
#define NVSDK_NGX_Parameter_Width "Width"
#define NVSDK_NGX_Parameter_Height "Height"
#define NVSDK_NGX_Parameter_OutWidth "OutWidth"
#define NVSDK_NGX_Parameter_OutHeight "OutHeight"
#define NVSDK_NGX_Parameter_Sharpness "Sharpness"
#define NVSDK_NGX_Parameter_Scratch "Scratch"
#define NVSDK_NGX_Parameter_Scratch_SizeInBytes "Scratch.SizeInBytes"
#define NVSDK_NGX_Parameter_Input1 "Input1"
#define NVSDK_NGX_Parameter_Input1_Format "Input1.Format"
#define NVSDK_NGX_Parameter_Input1_SizeInBytes "Input1.SizeInBytes"
#define NVSDK_NGX_Parameter_Input2 "Input2"
#define NVSDK_NGX_Parameter_Input2_Format "Input2.Format"
#define NVSDK_NGX_Parameter_Input2_SizeInBytes "Input2.SizeInBytes"
#define NVSDK_NGX_Parameter_Color "Color"
#define NVSDK_NGX_Parameter_Color_Format "Color.Format"
#define NVSDK_NGX_Parameter_Color_SizeInBytes "Color.SizeInBytes"
#define NVSDK_NGX_Parameter_FI_Color1 "Color1"
#define NVSDK_NGX_Parameter_FI_Color2 "Color2"
#define NVSDK_NGX_Parameter_Albedo "Albedo"
#define NVSDK_NGX_Parameter_Output "Output"
#define NVSDK_NGX_Parameter_Output_SizeInBytes "Output.SizeInBytes"
#define NVSDK_NGX_Parameter_FI_Output1 "Output1"
#define NVSDK_NGX_Parameter_FI_Output2 "Output2"
#define NVSDK_NGX_Parameter_FI_Output3 "Output3"
#define NVSDK_NGX_Parameter_Reset "Reset"
#define NVSDK_NGX_Parameter_BlendFactor "BlendFactor"
#define NVSDK_NGX_Parameter_MotionVectors "MotionVectors"
#define NVSDK_NGX_Parameter_FI_MotionVectors1 "MotionVectors1"
#define NVSDK_NGX_Parameter_FI_MotionVectors2 "MotionVectors2"
#define NVSDK_NGX_Parameter_Rect_X "Rect.X"
#define NVSDK_NGX_Parameter_Rect_Y "Rect.Y"
#define NVSDK_NGX_Parameter_Rect_W "Rect.W"
#define NVSDK_NGX_Parameter_Rect_H "Rect.H"
#define NVSDK_NGX_Parameter_MV_Scale_X "MV.Scale.X"
#define NVSDK_NGX_Parameter_MV_Scale_Y "MV.Scale.Y"
#define NVSDK_NGX_Parameter_Model "Model"
#define NVSDK_NGX_Parameter_Format "Format"
#define NVSDK_NGX_Parameter_SizeInBytes "SizeInBytes"
#define NVSDK_NGX_Parameter_ResourceAllocCallback "ResourceAllocCallback"
#define NVSDK_NGX_Parameter_BufferAllocCallback "BufferAllocCallback"
#define NVSDK_NGX_Parameter_Tex2DAllocCallback "Tex2DAllocCallback"
#define NVSDK_NGX_Parameter_ResourceReleaseCallback "ResourceReleaseCallback"
#define NVSDK_NGX_Parameter_CreationNodeMask "CreationNodeMask"
#define NVSDK_NGX_Parameter_VisibilityNodeMask "VisibilityNodeMask"
#define NVSDK_NGX_Parameter_MV_Offset_X "MV.Offset.X"
#define NVSDK_NGX_Parameter_MV_Offset_Y "MV.Offset.Y"
#define NVSDK_NGX_Parameter_Hint_UseFireflySwatter "Hint.UseFireflySwatter"
#define NVSDK_NGX_Parameter_Resource_Width "ResourceWidth"
#define NVSDK_NGX_Parameter_Resource_Height "ResourceHeight"
#define NVSDK_NGX_Parameter_Resource_OutWidth "ResourceOutWidth"
#define NVSDK_NGX_Parameter_Resource_OutHeight "ResourceOutHeight"
#define NVSDK_NGX_Parameter_Depth "Depth"
#define NVSDK_NGX_Parameter_FI_Depth1 "Depth1"
#define NVSDK_NGX_Parameter_FI_Depth2 "Depth2"
#define NVSDK_NGX_Parameter_DLSSOptimalSettingsCallback "DLSSOptimalSettingsCallback"
#define NVSDK_NGX_Parameter_DLSSGetStatsCallback "DLSSGetStatsCallback"
#define NVSDK_NGX_Parameter_PerfQualityValue "PerfQualityValue"
#define NVSDK_NGX_Parameter_RTXValue "RTXValue"
#define NVSDK_NGX_Parameter_DLSSMode "DLSSMode"
#define NVSDK_NGX_Parameter_FI_Mode "FIMode"
#define NVSDK_NGX_Parameter_FI_OF_Preset "FIOFPreset"
#define NVSDK_NGX_Parameter_FI_OF_GridSize "FIOFGridSize"
#define NVSDK_NGX_Parameter_Jitter_Offset_X "Jitter.Offset.X"
#define NVSDK_NGX_Parameter_Jitter_Offset_Y "Jitter.Offset.Y"
#define NVSDK_NGX_Parameter_Denoise "Denoise"
#define NVSDK_NGX_Parameter_TransparencyMask "TransparencyMask"
#define NVSDK_NGX_Parameter_ExposureTexture "ExposureTexture" // a 1x1 texture containing the final exposure scale
#define NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags "DLSS.Feature.Create.Flags"
#define NVSDK_NGX_Parameter_DLSS_Checkerboard_Jitter_Hack "DLSS.Checkerboard.Jitter.Hack"
#define NVSDK_NGX_Parameter_GBuffer_Albedo "GBuffer.Albedo"
#define NVSDK_NGX_Parameter_GBuffer_Roughness "GBuffer.Roughness"
#define NVSDK_NGX_Parameter_GBuffer_Metallic "GBuffer.Metallic"
#define NVSDK_NGX_Parameter_GBuffer_Specular "GBuffer.Specular"
#define NVSDK_NGX_Parameter_GBuffer_Subsurface "GBuffer.Subsurface"
#define NVSDK_NGX_Parameter_GBuffer_Normals "GBuffer.Normals"
#define NVSDK_NGX_Parameter_GBuffer_ShadingModelId "GBuffer.ShadingModelId"
#define NVSDK_NGX_Parameter_GBuffer_MaterialId "GBuffer.MaterialId"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_8 "GBuffer.Attrib.8"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_9 "GBuffer.Attrib.9"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_10 "GBuffer.Attrib.10"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_11 "GBuffer.Attrib.11"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_12 "GBuffer.Attrib.12"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_13 "GBuffer.Attrib.13"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_14 "GBuffer.Attrib.14"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_15 "GBuffer.Attrib.15"
#define NVSDK_NGX_Parameter_TonemapperType "TonemapperType"
#define NVSDK_NGX_Parameter_FreeMemOnReleaseFeature "FreeMemOnReleaseFeature"
#define NVSDK_NGX_Parameter_MotionVectors3D "MotionVectors3D"
#define NVSDK_NGX_Parameter_IsParticleMask "IsParticleMask"
#define NVSDK_NGX_Parameter_AnimatedTextureMask "AnimatedTextureMask"
#define NVSDK_NGX_Parameter_DepthHighRes "DepthHighRes"
#define NVSDK_NGX_Parameter_Position_ViewSpace "Position.ViewSpace"
#define NVSDK_NGX_Parameter_FrameTimeDeltaInMsec "FrameTimeDeltaInMsec"
#define NVSDK_NGX_Parameter_RayTracingHitDistance "RayTracingHitDistance"
#define NVSDK_NGX_Parameter_MotionVectorsReflection "MotionVectorsReflection"
#define NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects "DLSS.Enable.Output.Subrects"
#define NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X "DLSS.Input.Color.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y "DLSS.Input.Color.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X "DLSS.Input.Depth.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y "DLSS.Input.Depth.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X "DLSS.Input.MV.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y "DLSS.Input.MV.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X "DLSS.Input.Translucency.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y "DLSS.Input.Translucency.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X "DLSS.Output.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y "DLSS.Output.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width "DLSS.Render.Subrect.Dimensions.Width"
#define NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height "DLSS.Render.Subrect.Dimensions.Height"
#define NVSDK_NGX_Parameter_DLSS_Pre_Exposure "DLSS.Pre.Exposure"
#define NVSDK_NGX_Parameter_DLSS_Exposure_Scale "DLSS.Exposure.Scale"
#define NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask "DLSS.Input.Bias.Current.Color.Mask"
#define NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X "DLSS.Input.Bias.Current.Color.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y "DLSS.Input.Bias.Current.Color.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis "DLSS.Indicator.Invert.Y.Axis"
#define NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis "DLSS.Indicator.Invert.X.Axis"
#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Width "DLSS.Get.Dynamic.Max.Render.Width"
#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Height "DLSS.Get.Dynamic.Max.Render.Height"
#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Width "DLSS.Get.Dynamic.Min.Render.Width"
#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Height "DLSS.Get.Dynamic.Min.Render.Height"
#ifdef __cplusplus
} // extern "C"
#endif
#endif
@@ -1,629 +0,0 @@
/*
* Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#ifndef NVSDK_NGX_HELPERS_H
#define NVSDK_NGX_HELPERS_H
#pragma once
#include "nvsdk_ngx.h"
#include "nvsdk_ngx_defs.h"
typedef NVSDK_NGX_Result(NVSDK_CONV *PFN_NVSDK_NGX_DLSS_GetStatsCallback)(NVSDK_NGX_Parameter *InParams);
static inline NVSDK_NGX_Result NGX_DLSS_GET_STATS_2(
NVSDK_NGX_Parameter *pInParams,
unsigned long long *pVRAMAllocatedBytes,
unsigned int *pOptLevel, unsigned int *IsDevSnippetBranch)
{
void *Callback = NULL;
NVSDK_NGX_Parameter_GetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSGetStatsCallback, &Callback);
if (!Callback)
{
// Possible reasons for this:
// - Installed DLSS is out of date and does not support the feature we need
// - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
return NVSDK_NGX_Result_FAIL_OutOfDate;
}
NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
PFN_NVSDK_NGX_DLSS_GetStatsCallback PFNCallback = (PFN_NVSDK_NGX_DLSS_GetStatsCallback)Callback;
Res = PFNCallback(pInParams);
if (NVSDK_NGX_FAILED(Res))
{
return Res;
}
NVSDK_NGX_Parameter_GetULL(pInParams, NVSDK_NGX_Parameter_SizeInBytes, pVRAMAllocatedBytes);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_EParameter_OptLevel, pOptLevel);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_EParameter_IsDevSnippetBranch, IsDevSnippetBranch);
return Res;
}
static inline NVSDK_NGX_Result NGX_DLSS_GET_STATS_1(
NVSDK_NGX_Parameter *pInParams,
unsigned long long *pVRAMAllocatedBytes,
unsigned int *pOptLevel)
{
unsigned int dummy = 0;
return NGX_DLSS_GET_STATS_2(pInParams, pVRAMAllocatedBytes, pOptLevel, &dummy);
}
static inline NVSDK_NGX_Result NGX_DLSS_GET_STATS(
NVSDK_NGX_Parameter *pInParams,
unsigned long long *pVRAMAllocatedBytes)
{
unsigned int dummy = 0;
return NGX_DLSS_GET_STATS_2(pInParams, pVRAMAllocatedBytes, &dummy, &dummy);
}
typedef NVSDK_NGX_Result(NVSDK_CONV *PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback)(NVSDK_NGX_Parameter *InParams);
static inline NVSDK_NGX_Result NGX_DLSS_GET_OPTIMAL_SETTINGS(
NVSDK_NGX_Parameter *pInParams,
unsigned int InUserSelectedWidth,
unsigned int InUserSelectedHeight,
NVSDK_NGX_PerfQuality_Value InPerfQualityValue,
unsigned int *pOutRenderOptimalWidth,
unsigned int *pOutRenderOptimalHeight,
unsigned int *pOutRenderMaxWidth,
unsigned int *pOutRenderMaxHeight,
unsigned int *pOutRenderMinWidth,
unsigned int *pOutRenderMinHeight,
float *pOutSharpness)
{
void *Callback = NULL;
NVSDK_NGX_Parameter_GetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSOptimalSettingsCallback, &Callback);
if (!Callback)
{
// Possible reasons for this:
// - Installed DLSS is out of date and does not support the feature we need
// - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
return NVSDK_NGX_Result_FAIL_OutOfDate;
}
// These are selections made by user in UI
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, InUserSelectedWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, InUserSelectedHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, InPerfQualityValue);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_RTXValue, false); // Some older DLSS dlls still expect this value to be set
NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback PFNCallback = (PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback)Callback;
Res = PFNCallback(pInParams);
if (NVSDK_NGX_FAILED(Res))
{
return Res;
}
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pOutRenderOptimalWidth);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pOutRenderOptimalHeight);
// If we have an older DLSS Dll those might need to be set to the optimal dimensions instead
*pOutRenderMaxWidth = *pOutRenderOptimalWidth;
*pOutRenderMaxHeight = *pOutRenderOptimalHeight;
*pOutRenderMinWidth = *pOutRenderOptimalWidth;
*pOutRenderMinHeight = *pOutRenderOptimalHeight;
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Width, pOutRenderMaxWidth);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Height, pOutRenderMaxHeight);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Width, pOutRenderMinWidth);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Height, pOutRenderMinHeight);
NVSDK_NGX_Parameter_GetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pOutSharpness);
return Res;
}
/*** D3D11 ***/
typedef struct NVSDK_NGX_D3D11_Feature_Eval_Params
{
ID3D11Resource* pInColor;
ID3D11Resource* pInOutput;
/*** OPTIONAL for DLSS ***/
float InSharpness;
} NVSDK_NGX_D3D11_Feature_Eval_Params;
typedef struct NVSDK_NGX_CUDA_Feature_Eval_Params
{
CUtexObject* pInColor;
CUtexObject* pInOutput;
/*** OPTIONAL for DLSS ***/
float InSharpness;
} NVSDK_NGX_CUDA_Feature_Eval_Params;
typedef struct NVSDK_NGX_D3D11_GBuffer
{
ID3D11Resource* pInAttrib[NVSDK_NGX_GBUFFERTYPE_NUM];
} NVSDK_NGX_D3D11_GBuffer;
typedef struct NVSDK_NGX_D3D11_DLSS_Eval_Params
{
NVSDK_NGX_D3D11_Feature_Eval_Params Feature;
ID3D11Resource* pInDepth;
ID3D11Resource* pInMotionVectors;
float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
float InJitterOffsetY;
NVSDK_NGX_Dimensions InRenderSubrectDimensions;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
int InReset; /* Set to 1 when scene changes completely (new level etc) */
float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
float InMVScaleY;
ID3D11Resource* pInTransparencyMask; /* Unused/Reserved for future use */
ID3D11Resource* pInExposureTexture;
ID3D11Resource* pInBiasCurrentColorMask;
NVSDK_NGX_Coordinates InColorSubrectBase;
NVSDK_NGX_Coordinates InDepthSubrectBase;
NVSDK_NGX_Coordinates InMVSubrectBase;
NVSDK_NGX_Coordinates InTranslucencySubrectBase;
NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
NVSDK_NGX_Coordinates InOutputSubrectBase;
float InPreExposure;
int InIndicatorInvertXAxis;
int InIndicatorInvertYAxis;
/*** OPTIONAL - only for research purposes ***/
NVSDK_NGX_D3D11_GBuffer GBufferSurface;
NVSDK_NGX_ToneMapperType InToneMapperType;
ID3D11Resource* pInMotionVectors3D;
ID3D11Resource* pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
ID3D11Resource* pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
ID3D11Resource* pInDepthHighRes;
ID3D11Resource* pInPositionViewSpace;
float InFrameTimeDeltaInMsec; /* helps in determining the amount to denoise or anti-alias based on the speed of the object from motion vector magnitudes and fps as determined by this delta */
ID3D11Resource* pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
ID3D11Resource* pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
} NVSDK_NGX_D3D11_DLSS_Eval_Params;
typedef struct NVSDK_NGX_D3D11_DLISP_Eval_Params
{
NVSDK_NGX_D3D11_Feature_Eval_Params Feature;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
unsigned int InRectX;
unsigned int InRectY;
unsigned int InRectW;
unsigned int InRectH;
float InDenoise;
} NVSDK_NGX_D3D11_DLISP_Eval_Params;
typedef struct NVSDK_NGX_CUDA_DLISP_Eval_Params
{
NVSDK_NGX_CUDA_Feature_Eval_Params Feature;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
unsigned int InRectX;
unsigned int InRectY;
unsigned int InRectW;
unsigned int InRectH;
float InDenoise;
} NVSDK_NGX_CUDA_DLISP_Eval_Params;
static inline NVSDK_NGX_Result NGX_D3D11_CREATE_DLSS_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssCreateParams->Feature.InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssCreateParams->Feature.InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssCreateParams->Feature.InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssCreateParams->Feature.InTargetHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssCreateParams->Feature.InPerfQualityValue);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssCreateParams->InFeatureCreateFlags);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssCreateParams->InEnableOutputSubrects ? 1 : 0);
return NVSDK_NGX_D3D11_CreateFeature(pInCtx, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D11_EVALUATE_DLSS_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D11_DLSS_Eval_Params *pInDlssEvalParams)
{
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Color, pInDlssEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Output, pInDlssEvalParams->Feature.pInOutput);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssEvalParams->pInDepth);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssEvalParams->pInMotionVectors);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssEvalParams->InJitterOffsetX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssEvalParams->InJitterOffsetY);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlssEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssEvalParams->InReset);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleY);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssEvalParams->pInTransparencyMask);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssEvalParams->pInExposureTexture);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssEvalParams->pInBiasCurrentColorMask);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssEvalParams->GBufferSurface.pInAttrib[8]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssEvalParams->GBufferSurface.pInAttrib[9]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_10, pInDlssEvalParams->GBufferSurface.pInAttrib[10]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssEvalParams->GBufferSurface.pInAttrib[11]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssEvalParams->GBufferSurface.pInAttrib[12]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssEvalParams->GBufferSurface.pInAttrib[13]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssEvalParams->GBufferSurface.pInAttrib[14]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssEvalParams->GBufferSurface.pInAttrib[15]);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssEvalParams->InToneMapperType);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssEvalParams->pInMotionVectors3D);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssEvalParams->pInIsParticleMask);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssEvalParams->pInAnimatedTextureMask);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssEvalParams->pInDepthHighRes);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssEvalParams->pInPositionViewSpace);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssEvalParams->InFrameTimeDeltaInMsec);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssEvalParams->pInRayTracingHitDistance);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_MotionVectorsReflection, pInDlssEvalParams->pInMotionVectorsReflections);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssEvalParams->InColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssEvalParams->InColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssEvalParams->InDepthSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssEvalParams->InDepthSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssEvalParams->InMVSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssEvalParams->InMVSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssEvalParams->InTranslucencySubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssEvalParams->InTranslucencySubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssEvalParams->InBiasCurrentColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssEvalParams->InBiasCurrentColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssEvalParams->InOutputSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssEvalParams->InOutputSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssEvalParams->InRenderSubrectDimensions.Width);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssEvalParams->InRenderSubrectDimensions.Height);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssEvalParams->InPreExposure);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssEvalParams->InIndicatorInvertXAxis);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssEvalParams->InIndicatorInvertYAxis);
return NVSDK_NGX_D3D11_EvaluateFeature_C(pInCtx, pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_D3D11_CREATE_DLISP_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pDlispCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlispCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlispCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlispCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlispCreateParams->InTargetHeight);
return NVSDK_NGX_D3D11_CreateFeature(pInCtx, NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_CUDA_CREATE_DLISP_EXT(
NVSDK_NGX_Handle** ppOutHandle,
NVSDK_NGX_Parameter* pInParams,
NVSDK_NGX_Feature_Create_Params* pDlispCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlispCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlispCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlispCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlispCreateParams->InTargetHeight);
return NVSDK_NGX_CUDA_CreateFeature(NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D11_EVALUATE_DLISP_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D11_DLISP_Eval_Params *pDlispEvalParams)
{
if (pDlispEvalParams->Feature.InSharpness < 0.0f || pDlispEvalParams->Feature.InSharpness > 1.0f || pDlispEvalParams->InDenoise < 0.0f || pDlispEvalParams->InDenoise > 1.0f)
{
return NVSDK_NGX_Result_FAIL_InvalidParameter;
}
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlispEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlispEvalParams->Feature.pInOutput);
// Both sharpness and denoise in range [0.0f,1.0f]
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlispEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pDlispEvalParams->InDenoise);
// If input is atlas - use RECT to upscale only the required area
if (pDlispEvalParams->InRectW)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pDlispEvalParams->InRectX);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pDlispEvalParams->InRectY);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pDlispEvalParams->InRectW);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pDlispEvalParams->InRectH);
}
return NVSDK_NGX_D3D11_EvaluateFeature_C(pInCtx, pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_CUDA_EVALUATE_DLISP_EXT(
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_CUDA_DLISP_Eval_Params *pDlispEvalParams)
{
if (pDlispEvalParams->Feature.InSharpness < 0.0f || pDlispEvalParams->Feature.InSharpness > 1.0f || pDlispEvalParams->InDenoise < 0.0f || pDlispEvalParams->InDenoise > 1.0f)
{
return NVSDK_NGX_Result_FAIL_InvalidParameter;
}
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pDlispEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pDlispEvalParams->Feature.pInOutput);
// Both sharpness and denoise in range [0.0f,1.0f]
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlispEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pDlispEvalParams->InDenoise);
// If input is atlas - use RECT to upscale only the required area
if (pDlispEvalParams->InRectW)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pDlispEvalParams->InRectX);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pDlispEvalParams->InRectY);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pDlispEvalParams->InRectW);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pDlispEvalParams->InRectH);
}
return NVSDK_NGX_CUDA_EvaluateFeature_C(pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_D3D11_CREATE_DLRESOLVE_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pDlresolveCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlresolveCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlresolveCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlresolveCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlresolveCreateParams->InTargetHeight);
return NVSDK_NGX_D3D11_CreateFeature(pInCtx, NVSDK_NGX_Feature_DeepResolve, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D11_EVALUATE_DLRESOLVE_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle *InHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D11_Feature_Eval_Params *pDlresolveEvalParams)
{
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlresolveEvalParams->pInColor);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlresolveEvalParams->pInOutput);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlresolveEvalParams->InSharpness);
return NVSDK_NGX_D3D11_EvaluateFeature_C(pInCtx, InHandle, pInParams, NULL);
}
/*** D3D12 ***/
typedef struct NVSDK_NGX_D3D12_Feature_Eval_Params
{
ID3D12Resource* pInColor;
ID3D12Resource* pInOutput;
/*** OPTIONAL for DLSS ***/
float InSharpness;
} NVSDK_NGX_D3D12_Feature_Eval_Params;
typedef struct NVSDK_NGX_D3D12_GBuffer
{
ID3D12Resource* pInAttrib[NVSDK_NGX_GBUFFERTYPE_NUM];
} NVSDK_NGX_D3D12_GBuffer;
typedef struct NVSDK_NGX_D3D12_DLSS_Eval_Params
{
NVSDK_NGX_D3D12_Feature_Eval_Params Feature;
ID3D12Resource* pInDepth;
ID3D12Resource* pInMotionVectors;
float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
float InJitterOffsetY;
NVSDK_NGX_Dimensions InRenderSubrectDimensions;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
int InReset; /* Set to 1 when scene changes completely (new level etc) */
float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
float InMVScaleY;
ID3D12Resource* pInTransparencyMask; /* Unused/Reserved for future use */
ID3D12Resource* pInExposureTexture;
ID3D12Resource* pInBiasCurrentColorMask;
NVSDK_NGX_Coordinates InColorSubrectBase;
NVSDK_NGX_Coordinates InDepthSubrectBase;
NVSDK_NGX_Coordinates InMVSubrectBase;
NVSDK_NGX_Coordinates InTranslucencySubrectBase;
NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
NVSDK_NGX_Coordinates InOutputSubrectBase;
float InPreExposure;
int InIndicatorInvertXAxis;
int InIndicatorInvertYAxis;
/*** OPTIONAL - only for research purposes ***/
NVSDK_NGX_D3D12_GBuffer GBufferSurface;
NVSDK_NGX_ToneMapperType InToneMapperType;
ID3D12Resource* pInMotionVectors3D;
ID3D12Resource* pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
ID3D12Resource* pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
ID3D12Resource* pInDepthHighRes;
ID3D12Resource* pInPositionViewSpace;
float InFrameTimeDeltaInMsec; /* helps in determining the amount to denoise or anti-alias based on the speed of the object from motion vector magnitudes and fps as determined by this delta */
ID3D12Resource* pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
ID3D12Resource* pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
} NVSDK_NGX_D3D12_DLSS_Eval_Params;
typedef struct NVSDK_NGX_D3D12_DLISP_Eval_Params
{
NVSDK_NGX_D3D12_Feature_Eval_Params Feature;
/*** OPTIONAL ***/
unsigned int InRectX;
unsigned int InRectY;
unsigned int InRectW;
unsigned int InRectH;
float InDenoise;
} NVSDK_NGX_D3D12_DLISP_Eval_Params;
static inline NVSDK_NGX_Result NGX_D3D12_CREATE_DLSS_EXT(
ID3D12GraphicsCommandList *pInCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssCreateParams->Feature.InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssCreateParams->Feature.InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssCreateParams->Feature.InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssCreateParams->Feature.InTargetHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssCreateParams->Feature.InPerfQualityValue);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssCreateParams->InFeatureCreateFlags);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssCreateParams->InEnableOutputSubrects ? 1 : 0);
return NVSDK_NGX_D3D12_CreateFeature(pInCmdList, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D12_EVALUATE_DLSS_EXT(
ID3D12GraphicsCommandList *pInCmdList,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D12_DLSS_Eval_Params *pInDlssEvalParams)
{
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Color, pInDlssEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Output, pInDlssEvalParams->Feature.pInOutput);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssEvalParams->pInDepth);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssEvalParams->pInMotionVectors);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssEvalParams->InJitterOffsetX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssEvalParams->InJitterOffsetY);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlssEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssEvalParams->InReset);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleY);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssEvalParams->pInTransparencyMask);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssEvalParams->pInExposureTexture);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssEvalParams->pInBiasCurrentColorMask);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssEvalParams->GBufferSurface.pInAttrib[8]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssEvalParams->GBufferSurface.pInAttrib[9]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_10, pInDlssEvalParams->GBufferSurface.pInAttrib[10]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssEvalParams->GBufferSurface.pInAttrib[11]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssEvalParams->GBufferSurface.pInAttrib[12]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssEvalParams->GBufferSurface.pInAttrib[13]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssEvalParams->GBufferSurface.pInAttrib[14]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssEvalParams->GBufferSurface.pInAttrib[15]);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssEvalParams->InToneMapperType);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssEvalParams->pInMotionVectors3D);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssEvalParams->pInIsParticleMask);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssEvalParams->pInAnimatedTextureMask);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssEvalParams->pInDepthHighRes);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssEvalParams->pInPositionViewSpace);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssEvalParams->InFrameTimeDeltaInMsec);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssEvalParams->pInRayTracingHitDistance);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_MotionVectorsReflection, pInDlssEvalParams->pInMotionVectorsReflections);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssEvalParams->InColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssEvalParams->InColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssEvalParams->InDepthSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssEvalParams->InDepthSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssEvalParams->InMVSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssEvalParams->InMVSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssEvalParams->InTranslucencySubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssEvalParams->InTranslucencySubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssEvalParams->InBiasCurrentColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssEvalParams->InBiasCurrentColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssEvalParams->InOutputSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssEvalParams->InOutputSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssEvalParams->InRenderSubrectDimensions.Width);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssEvalParams->InRenderSubrectDimensions.Height);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssEvalParams->InPreExposure);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssEvalParams->InIndicatorInvertXAxis);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssEvalParams->InIndicatorInvertYAxis);
return NVSDK_NGX_D3D12_EvaluateFeature_C(pInCmdList, pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_D3D12_CREATE_DLISP_EXT(
ID3D12GraphicsCommandList *InCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pDlispCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlispCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlispCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlispCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlispCreateParams->InTargetHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pDlispCreateParams->InPerfQualityValue);
return NVSDK_NGX_D3D12_CreateFeature(InCmdList, NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D12_EVALUATE_DLISP_EXT(
ID3D12GraphicsCommandList *pInCmdList,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D12_DLISP_Eval_Params *pDlispEvalParams)
{
if (pDlispEvalParams->Feature.InSharpness < 0.0f || pDlispEvalParams->Feature.InSharpness > 1.0f || pDlispEvalParams->InDenoise < 0.0f || pDlispEvalParams->InDenoise > 1.0f)
{
return NVSDK_NGX_Result_FAIL_InvalidParameter;
}
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlispEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlispEvalParams->Feature.pInOutput);
// Both sharpness and denoise in range [0.0f,1.0f]
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlispEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pDlispEvalParams->InDenoise);
// If input is atlas - use RECT to upscale only the required area
if (pDlispEvalParams->InRectW)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pDlispEvalParams->InRectX);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pDlispEvalParams->InRectY);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pDlispEvalParams->InRectW);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pDlispEvalParams->InRectH);
}
return NVSDK_NGX_D3D12_EvaluateFeature_C(pInCmdList, pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_D3D12_CREATE_DLRESOLVE_EXT(
ID3D12GraphicsCommandList *pInCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pDlresolveCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlresolveCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlresolveCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlresolveCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlresolveCreateParams->InTargetHeight);
return NVSDK_NGX_D3D12_CreateFeature(pInCmdList, NVSDK_NGX_Feature_DeepResolve, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D12_EVALUATE_DLRESOLVE_EXT(
ID3D12GraphicsCommandList *pInCmdList,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D12_Feature_Eval_Params *pDlresolveEvalParams)
{
// This call to NVSDK_NGX_Parameter_SetXXX() is equivalent to the Params->Set below functionally
// but to work around the lack of virtual functions and polymorphism in a C only project
// we introduced this new way to set params.
// The test should enforce that both paths work.
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlresolveEvalParams->pInColor);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlresolveEvalParams->pInOutput);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlresolveEvalParams->InSharpness);
return NVSDK_NGX_D3D12_EvaluateFeature_C(pInCmdList, pInHandle, pInParams, NULL);
}
#endif
@@ -1,318 +0,0 @@
/*
* Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#ifndef NVSDK_NGX_HELPERS_VK_H
#define NVSDK_NGX_HELPERS_VK_H
#pragma once
#include "nvsdk_ngx_vk.h"
#define NVSDK_NGX_ENSURE_VK_IMAGEVIEW(InResource) if ((InResource) && (InResource)->Type != NVSDK_NGX_RESOURCE_VK_TYPE_VK_IMAGEVIEW) { return NVSDK_NGX_Result_FAIL_InvalidParameter; }
static inline NVSDK_NGX_Resource_VK NVSDK_NGX_Create_ImageView_Resource_VK(VkImageView imageView, VkImage image, VkImageSubresourceRange subresourceRange, VkFormat format, unsigned int width, unsigned int height, bool readWrite)
{
NVSDK_NGX_Resource_VK resourceVK = {0};
resourceVK.Type = NVSDK_NGX_RESOURCE_VK_TYPE_VK_IMAGEVIEW;
resourceVK.Resource.ImageViewInfo.ImageView = imageView;
resourceVK.Resource.ImageViewInfo.Image = image;
resourceVK.Resource.ImageViewInfo.SubresourceRange = subresourceRange;
resourceVK.Resource.ImageViewInfo.Height = height;
resourceVK.Resource.ImageViewInfo.Width = width;
resourceVK.Resource.ImageViewInfo.Format = format;
resourceVK.ReadWrite = readWrite;
return resourceVK;
}
static inline NVSDK_NGX_Resource_VK NVSDK_NGX_Create_Buffer_Resource_VK(VkBuffer buffer, unsigned int sizeInBytes, bool readWrite)
{
NVSDK_NGX_Resource_VK resourceVK = {0};
resourceVK.Type = NVSDK_NGX_RESOURCE_VK_TYPE_VK_BUFFER;
resourceVK.Resource.BufferInfo.Buffer = buffer;
resourceVK.Resource.BufferInfo.SizeInBytes = sizeInBytes;
resourceVK.ReadWrite = readWrite;
return resourceVK;
}
typedef struct NVSDK_NGX_VK_Feature_Eval_Params
{
NVSDK_NGX_Resource_VK *pInColor;
NVSDK_NGX_Resource_VK *pInOutput;
/*** OPTIONAL for DLSS ***/
float InSharpness;
} NVSDK_NGX_VK_Feature_Eval_Params;
typedef struct NVSDK_NGX_VK_GBuffer
{
NVSDK_NGX_Resource_VK *pInAttrib[NVSDK_NGX_GBUFFERTYPE_NUM];
} NVSDK_NGX_VK_GBuffer;
typedef struct NVSDK_NGX_Coordinates_VK
{
unsigned int X;
unsigned int Y;
} NVSDK_NGX_Coordinates_VK;
typedef struct NVSDK_NGX_VK_DLSS_Eval_Params
{
NVSDK_NGX_VK_Feature_Eval_Params Feature;
NVSDK_NGX_Resource_VK * pInDepth;
NVSDK_NGX_Resource_VK * pInMotionVectors;
float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
float InJitterOffsetY;
NVSDK_NGX_Dimensions InRenderSubrectDimensions;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
int InReset; /* Set to 1 when scene changes completely (new level etc) */
float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
float InMVScaleY;
NVSDK_NGX_Resource_VK * pInTransparencyMask; /* Unused/Reserved for future use */
NVSDK_NGX_Resource_VK * pInExposureTexture;
NVSDK_NGX_Resource_VK * pInBiasCurrentColorMask;
NVSDK_NGX_Coordinates InColorSubrectBase;
NVSDK_NGX_Coordinates InDepthSubrectBase;
NVSDK_NGX_Coordinates InMVSubrectBase;
NVSDK_NGX_Coordinates InTranslucencySubrectBase;
NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
NVSDK_NGX_Coordinates InOutputSubrectBase;
float InPreExposure;
int InIndicatorInvertXAxis;
int InIndicatorInvertYAxis;
/*** OPTIONAL - only for research purposes ***/
NVSDK_NGX_VK_GBuffer GBufferSurface;
NVSDK_NGX_ToneMapperType InToneMapperType;
NVSDK_NGX_Resource_VK * pInMotionVectors3D;
NVSDK_NGX_Resource_VK * pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
NVSDK_NGX_Resource_VK * pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
NVSDK_NGX_Resource_VK * pInDepthHighRes;
NVSDK_NGX_Resource_VK * pInPositionViewSpace;
float InFrameTimeDeltaInMsec; /* helps in determining the amount to denoise or anti-alias based on the speed of the object from motion vector magnitudes and fps as determined by this delta */
NVSDK_NGX_Resource_VK * pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
NVSDK_NGX_Resource_VK * pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
} NVSDK_NGX_VK_DLSS_Eval_Params;
typedef struct NVSDK_NGX_VK_DLISP_Eval_Params
{
NVSDK_NGX_VK_Feature_Eval_Params Feature;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
unsigned int InRectX;
unsigned int InRectY;
unsigned int InRectW;
unsigned int InRectH;
float InDenoise;
} NVSDK_NGX_VK_DLISP_Eval_Params;
static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLSS_EXT1(
VkDevice InDevice,
VkCommandBuffer InCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssCreateParams->Feature.InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssCreateParams->Feature.InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssCreateParams->Feature.InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssCreateParams->Feature.InTargetHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssCreateParams->Feature.InPerfQualityValue);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssCreateParams->InFeatureCreateFlags);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssCreateParams->InEnableOutputSubrects ? 1 : 0);
if (InDevice) return NVSDK_NGX_VULKAN_CreateFeature1(InDevice, InCmdList, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
else return NVSDK_NGX_VULKAN_CreateFeature(InCmdList, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLSS_EXT(
VkCommandBuffer InCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
{
return NGX_VULKAN_CREATE_DLSS_EXT1(NULL, InCmdList, InCreationNodeMask, InVisibilityNodeMask, ppOutHandle, pInParams, pInDlssCreateParams);
}
static inline NVSDK_NGX_Result NGX_VULKAN_EVALUATE_DLSS_EXT(
VkCommandBuffer InCmdList,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_VK_DLSS_Eval_Params *pInDlssEvalParams)
{
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->Feature.pInColor);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInMotionVectors);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->Feature.pInOutput);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInDepth);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInTransparencyMask);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInExposureTexture);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInBiasCurrentColorMask);
for (size_t i = 0; i <= 15; i++)
{
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->GBufferSurface.pInAttrib[i]);
}
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInMotionVectors3D);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInIsParticleMask);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInAnimatedTextureMask);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInDepthHighRes);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInPositionViewSpace);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInRayTracingHitDistance);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInMotionVectorsReflections);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pInDlssEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pInDlssEvalParams->Feature.pInOutput);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssEvalParams->pInDepth);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssEvalParams->pInMotionVectors);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssEvalParams->InJitterOffsetX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssEvalParams->InJitterOffsetY);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlssEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssEvalParams->InReset);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleY);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssEvalParams->pInTransparencyMask);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssEvalParams->pInExposureTexture);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssEvalParams->pInBiasCurrentColorMask);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssEvalParams->GBufferSurface.pInAttrib[8]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssEvalParams->GBufferSurface.pInAttrib[9]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_10, pInDlssEvalParams->GBufferSurface.pInAttrib[10]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssEvalParams->GBufferSurface.pInAttrib[11]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssEvalParams->GBufferSurface.pInAttrib[12]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssEvalParams->GBufferSurface.pInAttrib[13]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssEvalParams->GBufferSurface.pInAttrib[14]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssEvalParams->GBufferSurface.pInAttrib[15]);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssEvalParams->InToneMapperType);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssEvalParams->pInMotionVectors3D);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssEvalParams->pInIsParticleMask);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssEvalParams->pInAnimatedTextureMask);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssEvalParams->pInDepthHighRes);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssEvalParams->pInPositionViewSpace);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssEvalParams->InFrameTimeDeltaInMsec);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssEvalParams->pInRayTracingHitDistance);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectorsReflection, pInDlssEvalParams->pInMotionVectorsReflections);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssEvalParams->InColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssEvalParams->InColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssEvalParams->InDepthSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssEvalParams->InDepthSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssEvalParams->InMVSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssEvalParams->InMVSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssEvalParams->InTranslucencySubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssEvalParams->InTranslucencySubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssEvalParams->InBiasCurrentColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssEvalParams->InBiasCurrentColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssEvalParams->InOutputSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssEvalParams->InOutputSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssEvalParams->InRenderSubrectDimensions.Width);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssEvalParams->InRenderSubrectDimensions.Height);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssEvalParams->InPreExposure);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssEvalParams->InIndicatorInvertXAxis);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssEvalParams->InIndicatorInvertYAxis);
return NVSDK_NGX_VULKAN_EvaluateFeature_C(InCmdList, pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLISP_EXT(
VkCommandBuffer InCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pInDlispCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlispCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlispCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlispCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlispCreateParams->InTargetHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlispCreateParams->InPerfQualityValue);
return NVSDK_NGX_VULKAN_CreateFeature(InCmdList, NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_VULKAN_EVALUATE_DLISP_EXT(
VkCommandBuffer InCmdList,
NVSDK_NGX_Handle *InHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_VK_DLISP_Eval_Params *pInDlispEvalParams)
{
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlispEvalParams->Feature.pInColor);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlispEvalParams->Feature.pInOutput);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pInDlispEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pInDlispEvalParams->Feature.pInOutput);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlispEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pInDlispEvalParams->InDenoise);
// If input is atlas - use RECT to upscale only the required area
if (pInDlispEvalParams->InRectW)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pInDlispEvalParams->InRectX);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pInDlispEvalParams->InRectY);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pInDlispEvalParams->InRectW);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pInDlispEvalParams->InRectH);
}
return NVSDK_NGX_VULKAN_EvaluateFeature_C(InCmdList, InHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLRESOLVE_EXT(
VkCommandBuffer InCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pInDlresolveCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlresolveCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlresolveCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlresolveCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlresolveCreateParams->InTargetHeight);
return NVSDK_NGX_VULKAN_CreateFeature(InCmdList, NVSDK_NGX_Feature_DeepResolve, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_VULKAN_EVALUATE_DLRESOLVE_EXT(
VkCommandBuffer InCmdList,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_VK_Feature_Eval_Params *pInDlresolveEvalParams)
{
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlresolveEvalParams->pInColor);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlresolveEvalParams->pInOutput);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pInDlresolveEvalParams->pInColor);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pInDlresolveEvalParams->pInOutput);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlresolveEvalParams->InSharpness);
return NVSDK_NGX_VULKAN_EvaluateFeature_C(InCmdList, pInHandle, pInParams, NULL);
}
#endif // NVSDK_NGX_HELPERS_VK_H
@@ -1,117 +0,0 @@
/*
* Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#ifndef NVSDK_NGX_PARAMS_H
#define NVSDK_NGX_PARAMS_H
#include "nvsdk_ngx_defs.h"
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct ID3D11Resource ID3D11Resource;
typedef struct ID3D12Resource ID3D12Resource;
typedef struct NVSDK_NGX_Feature_Create_Params
{
unsigned int InWidth;
unsigned int InHeight;
unsigned int InTargetWidth;
unsigned int InTargetHeight;
/*** OPTIONAL ***/
NVSDK_NGX_PerfQuality_Value InPerfQualityValue;
} NVSDK_NGX_Feature_Create_Params;
typedef struct NVSDK_NGX_DLSS_Create_Params
{
NVSDK_NGX_Feature_Create_Params Feature;
/*** OPTIONAL ***/
int InFeatureCreateFlags;
bool InEnableOutputSubrects;
} NVSDK_NGX_DLSS_Create_Params;
#ifdef __cplusplus
typedef struct NVSDK_NGX_Parameter
{
virtual void Set(const char * InName, unsigned long long InValue) = 0;
virtual void Set(const char * InName, float InValue) = 0;
virtual void Set(const char * InName, double InValue) = 0;
virtual void Set(const char * InName, unsigned int InValue) = 0;
virtual void Set(const char * InName, int InValue) = 0;
virtual void Set(const char * InName, ID3D11Resource *InValue) = 0;
virtual void Set(const char * InName, ID3D12Resource *InValue) = 0;
virtual void Set(const char * InName, void *InValue) = 0;
virtual NVSDK_NGX_Result Get(const char * InName, unsigned long long *OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, float *OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, double *OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, unsigned int *OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, int *OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, ID3D11Resource **OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, ID3D12Resource **OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, void **OutValue) const = 0;
virtual void Reset() = 0;
} NVSDK_NGX_Parameter;
#else
typedef struct NVSDK_NGX_Parameter NVSDK_NGX_Parameter;
#endif // _cplusplus
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetULL)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetULL(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetF)(NVSDK_NGX_Parameter *InParameter, const char * InName, float InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetF(NVSDK_NGX_Parameter *InParameter, const char * InName, float InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetD)(NVSDK_NGX_Parameter *InParameter, const char * InName, double InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetD(NVSDK_NGX_Parameter *InParameter, const char * InName, double InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetUI)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetUI(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetI)(NVSDK_NGX_Parameter *InParameter, const char * InName, int InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetI(NVSDK_NGX_Parameter *InParameter, const char * InName, int InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetD3d11Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource *InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetD3d11Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource *InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetD3d12Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource *InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetD3d12Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource *InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetVoidPointer)(NVSDK_NGX_Parameter *InParameter, const char * InName, void *InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetVoidPointer(NVSDK_NGX_Parameter *InParameter, const char * InName, void *InValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetULL)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long *OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetULL(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long *OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetF)(NVSDK_NGX_Parameter *InParameter, const char * InName, float *OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetF(NVSDK_NGX_Parameter *InParameter, const char * InName, float *OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetD)(NVSDK_NGX_Parameter *InParameter, const char * InName, double *OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetD(NVSDK_NGX_Parameter *InParameter, const char * InName, double *OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetUI)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int *OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetUI(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int *OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetI)(NVSDK_NGX_Parameter *InParameter, const char * InName, int *OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetI(NVSDK_NGX_Parameter *InParameter, const char * InName, int *OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetD3d11Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource **OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetD3d11Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource **OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetD3d12Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource **OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetD3d12Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource **OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetVoidPointer)(NVSDK_NGX_Parameter *InParameter, const char * InName, void **OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetVoidPointer(NVSDK_NGX_Parameter *InParameter, const char * InName, void **OutValue);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // #define NVSDK_NGX_PARAMS_H

Some files were not shown because too many files have changed in this diff Show More