├── .gitignore ├── Compute ├── Compute.cpp ├── Compute.hpp ├── Compute.vcxproj ├── Compute.vcxproj.filters ├── Shaders │ ├── compute.hlsl │ ├── displayPS.hlsl │ └── displayVS.hlsl └── packages.config ├── Core ├── BitonicSort.cpp ├── BitonicSort.h ├── BuddyAllocator.cpp ├── BuddyAllocator.h ├── BufferManager.cpp ├── BufferManager.h ├── Camera.cpp ├── Camera.h ├── CameraController.cpp ├── CameraController.h ├── Color.cpp ├── Color.h ├── ColorBuffer.cpp ├── ColorBuffer.h ├── CommandAllocatorPool.cpp ├── CommandAllocatorPool.h ├── CommandContext.cpp ├── CommandContext.h ├── CommandListManager.cpp ├── CommandListManager.h ├── CommandSignature.cpp ├── CommandSignature.h ├── Core_VS15.vcxproj ├── Core_VS15.vcxproj.filters ├── Core_VS16.vcxproj ├── Core_VS16.vcxproj.filters ├── DDSTextureLoader.cpp ├── DDSTextureLoader.h ├── DepthBuffer.cpp ├── DepthBuffer.h ├── DepthOfField.cpp ├── DepthOfField.h ├── DescriptorHeap.cpp ├── DescriptorHeap.h ├── DynamicDescriptorHeap.cpp ├── DynamicDescriptorHeap.h ├── DynamicUploadBuffer.cpp ├── DynamicUploadBuffer.h ├── EngineProfiling.cpp ├── EngineProfiling.h ├── EngineTuning.cpp ├── EngineTuning.h ├── EsramAllocator.h ├── FXAA.cpp ├── FXAA.h ├── FileUtility.cpp ├── FileUtility.h ├── Fonts │ └── consola24.h ├── GameCore.cpp ├── GameCore.h ├── GameInput.cpp ├── GameInput.h ├── GpuBuffer.cpp ├── GpuBuffer.h ├── GpuResource.h ├── GpuTimeManager.cpp ├── GpuTimeManager.h ├── GraphRenderer.cpp ├── GraphRenderer.h ├── GraphicsCommon.cpp ├── GraphicsCommon.h ├── GraphicsCore.cpp ├── GraphicsCore.h ├── Hash.h ├── LinearAllocator.cpp ├── LinearAllocator.h ├── Math │ ├── BoundingBox.hpp │ ├── BoundingPlane.h │ ├── BoundingSphere.h │ ├── Common.h │ ├── Frustum.cpp │ ├── Frustum.h │ ├── Functions.inl │ ├── Matrix3.h │ ├── Matrix4.h │ ├── Quaternion.h │ ├── Random.cpp │ ├── Random.h │ ├── Scalar.h │ ├── Transform.h │ └── Vector.h ├── MotionBlur.cpp ├── MotionBlur.h ├── PageInfo.cpp ├── PageInfo.h ├── ParticleEffect.cpp ├── ParticleEffect.h ├── ParticleEffectManager.cpp ├── ParticleEffectManager.h ├── ParticleEffectProperties.h ├── ParticleEmissionProperties.cpp ├── ParticleShaderStructs.h ├── PipelineState.cpp ├── PipelineState.h ├── PixelBuffer.cpp ├── PixelBuffer.h ├── PostEffects.cpp ├── PostEffects.h ├── ReadbackBuffer.cpp ├── ReadbackBuffer.h ├── RootSignature.cpp ├── RootSignature.h ├── SSAO.cpp ├── SSAO.h ├── SamplerManager.cpp ├── SamplerManager.h ├── Shaders │ ├── AdaptExposureCS.hlsl │ ├── AoBlurAndUpsampleCS.hlsli │ ├── AoBlurUpsampleBlendOutCS.hlsl │ ├── AoBlurUpsampleCS.hlsl │ ├── AoBlurUpsamplePreMinBlendOutCS.hlsl │ ├── AoBlurUpsamplePreMinCS.hlsl │ ├── AoPrepareDepthBuffers1CS.hlsl │ ├── AoPrepareDepthBuffers2CS.hlsl │ ├── AoRender1CS.hlsl │ ├── AoRender2CS.hlsl │ ├── AoRenderCS.hlsli │ ├── ApplyBloom2CS.hlsl │ ├── ApplyBloomCS.hlsl │ ├── AverageLumaCS.hlsl │ ├── BicubicHorizontalUpsamplePS.hlsl │ ├── BicubicUpsampleGammaPS.hlsl │ ├── BicubicUpsamplePS.hlsl │ ├── BicubicVerticalUpsamplePS.hlsl │ ├── BilinearUpsamplePS.hlsl │ ├── Bitonic32InnerSortCS.hlsl │ ├── Bitonic32OuterSortCS.hlsl │ ├── Bitonic32PreSortCS.hlsl │ ├── Bitonic64InnerSortCS.hlsl │ ├── Bitonic64OuterSortCS.hlsl │ ├── Bitonic64PreSortCS.hlsl │ ├── BitonicIndirectArgsCS.hlsl │ ├── BitonicSortCommon.hlsli │ ├── BloomExtractAndDownsampleHdrCS.hlsl │ ├── BloomExtractAndDownsampleLdrCS.hlsl │ ├── BlurCS.hlsl │ ├── BoundNeighborhoodCS.hlsl │ ├── BufferCopyPS.hlsl │ ├── Buffers.hlsli │ ├── CameraMotionBlurPrePassCS.hlsl │ ├── CameraMotionBlurPrePassLinearZCS.hlsl │ ├── CameraVelocityCS.hlsl │ ├── ColorSpaceUtility.hlsli │ ├── CopyBackPostBufferCS.hlsl │ ├── DebugDrawHistogramCS.hlsl │ ├── DebugLuminanceHdr2CS.hlsl │ ├── DebugLuminanceHdrCS.hlsl │ ├── DebugLuminanceLdr2CS.hlsl │ ├── DebugLuminanceLdrCS.hlsl │ ├── DebugSSAOCS.hlsl │ ├── DoFCombine2CS.hlsl │ ├── DoFCombineCS.hlsl │ ├── DoFCombineFast2CS.hlsl │ ├── DoFCombineFastCS.hlsl │ ├── DoFCommon.hlsli │ ├── DoFDebugBlueCS.hlsl │ ├── DoFDebugGreenCS.hlsl │ ├── DoFDebugRedCS.hlsl │ ├── DoFMedianFilterCS.hlsl │ ├── DoFMedianFilterFixupCS.hlsl │ ├── DoFMedianFilterSepAlphaCS.hlsl │ ├── DoFPass1CS.hlsl │ ├── DoFPass2CS.hlsl │ ├── DoFPass2DebugCS.hlsl │ ├── DoFPass2FastCS.hlsl │ ├── DoFPass2FixupCS.hlsl │ ├── DoFPreFilterCS.hlsl │ ├── DoFPreFilterFastCS.hlsl │ ├── DoFPreFilterFixupCS.hlsl │ ├── DoFRS.hlsli │ ├── DoFTilePassCS.hlsl │ ├── DoFTilePassFixupCS.hlsl │ ├── DownsampleBloomAllCS.hlsl │ ├── DownsampleBloomCS.hlsl │ ├── ExtractLumaCS.hlsl │ ├── FXAAPass1CS.hlsli │ ├── FXAAPass1_Luma2_CS.hlsl │ ├── FXAAPass1_Luma_CS.hlsl │ ├── FXAAPass1_RGB2_CS.hlsl │ ├── FXAAPass1_RGB_CS.hlsl │ ├── FXAAPass2CS.hlsli │ ├── FXAAPass2H2CS.hlsl │ ├── FXAAPass2HCS.hlsl │ ├── FXAAPass2HDebug2CS.hlsl │ ├── FXAAPass2HDebugCS.hlsl │ ├── FXAAPass2V2CS.hlsl │ ├── FXAAPass2VCS.hlsl │ ├── FXAAPass2VDebug2CS.hlsl │ ├── FXAAPass2VDebugCS.hlsl │ ├── FXAAResolveWorkQueueCS.hlsl │ ├── FXAARootSignature.hlsli │ ├── FillPage.hlsl │ ├── GenerateHistogramCS.hlsl │ ├── GenerateMipsCS.hlsli │ ├── GenerateMipsGammaCS.hlsl │ ├── GenerateMipsGammaOddCS.hlsl │ ├── GenerateMipsGammaOddXCS.hlsl │ ├── GenerateMipsGammaOddYCS.hlsl │ ├── GenerateMipsLinearCS.hlsl │ ├── GenerateMipsLinearOddCS.hlsl │ ├── GenerateMipsLinearOddXCS.hlsl │ ├── GenerateMipsLinearOddYCS.hlsl │ ├── LinearizeDepthCS.hlsl │ ├── MagnifyPixelsPS.hlsl │ ├── MotionBlurFinalPassCS.hlsl │ ├── MotionBlurFinalPassPS.hlsl │ ├── MotionBlurPrePassCS.hlsl │ ├── MotionBlurRS.hlsli │ ├── ParticleBinCullingCS.hlsl │ ├── ParticleDepthBoundsCS.hlsl │ ├── ParticleDispatchIndirectArgsCS.hlsl │ ├── ParticleFinalDispatchIndirectArgsCS.hlsl │ ├── ParticleLargeBinCullingCS.hlsl │ ├── ParticleNoSortVS.hlsl │ ├── ParticlePS.hlsl │ ├── ParticlePreSortCS.hlsl │ ├── ParticleRS.hlsli │ ├── ParticleSortIndirectArgsCS.hlsl │ ├── ParticleSpawnCS.hlsl │ ├── ParticleTileCullingCS.hlsl │ ├── ParticleTileRender2CS.hlsl │ ├── ParticleTileRenderCS.hlsl │ ├── ParticleTileRenderFast2CS.hlsl │ ├── ParticleTileRenderFastCS.hlsl │ ├── ParticleTileRenderFastDynamic2CS.hlsl │ ├── ParticleTileRenderFastDynamicCS.hlsl │ ├── ParticleTileRenderFastLowRes2CS.hlsl │ ├── ParticleTileRenderFastLowResCS.hlsl │ ├── ParticleTileRenderSlowDynamic2CS.hlsl │ ├── ParticleTileRenderSlowDynamicCS.hlsl │ ├── ParticleTileRenderSlowLowRes2CS.hlsl │ ├── ParticleTileRenderSlowLowResCS.hlsl │ ├── ParticleUpdateCS.hlsl │ ├── ParticleUpdateCommon.hlsli │ ├── ParticleUtility.hlsli │ ├── ParticleVS.hlsl │ ├── PerfGraphBackgroundVS.hlsl │ ├── PerfGraphPS.hlsl │ ├── PerfGraphRS.hlsli │ ├── PerfGraphVS.hlsl │ ├── PixelPacking.hlsli │ ├── PixelPacking_LUV.hlsli │ ├── PixelPacking_R11G11B10.hlsli │ ├── PixelPacking_RGBE.hlsli │ ├── PixelPacking_RGBM.hlsli │ ├── PixelPacking_Velocity.hlsli │ ├── PostEffectsRS.hlsli │ ├── PresentHDRPS.hlsl │ ├── PresentRS.hlsli │ ├── PresentSDRPS.hlsl │ ├── ResolveTAACS.hlsl │ ├── SSAORS.hlsli │ ├── ScreenQuadVS.hlsl │ ├── ScreenTriangleVS.hlsl │ ├── ShaderUtility.hlsli │ ├── SharpenTAACS.hlsl │ ├── SharpeningUpsampleGammaPS.hlsl │ ├── SharpeningUpsamplePS.hlsl │ ├── SkyPS.hlsl │ ├── SkyRS.hlsli │ ├── SkyVS.hlsl │ ├── TemporalBlendCS.hlsl │ ├── TemporalRS.hlsli │ ├── TextAntialiasPS.hlsl │ ├── TextRS.hlsli │ ├── TextShadowPS.hlsl │ ├── TextVS.hlsl │ ├── ToneMap2CS.hlsl │ ├── ToneMapCS.hlsl │ ├── ToneMapHDR2CS.hlsl │ ├── ToneMapHDRCS.hlsl │ ├── ToneMappingUtility.hlsli │ ├── UpsampleAndBlurCS.hlsl │ └── icosphere.hlsli ├── ShadowBuffer.cpp ├── ShadowBuffer.h ├── ShadowCamera.cpp ├── ShadowCamera.h ├── Sky.hpp ├── SkyPass.cpp ├── SkyPass.hpp ├── SystemTime.cpp ├── SystemTime.h ├── TemporalEffects.cpp ├── TemporalEffects.h ├── TextRenderer.cpp ├── TextRenderer.h ├── Texture3D.cpp ├── Texture3D.h ├── TextureManager.cpp ├── TextureManager.h ├── TiledTexture.cpp ├── TiledTexture.h ├── Utility.cpp ├── Utility.h ├── VectorMath.h ├── d3dx12.h ├── dds.h ├── hlsl.hpp ├── packages.config ├── pch.cpp └── pch.h ├── GSL ├── LICENSE.txt └── src │ └── gsl │ ├── gsl │ ├── gsl_algorithm │ ├── gsl_assert │ ├── gsl_byte │ ├── gsl_util │ ├── multi_span │ ├── pointers │ ├── span │ └── string_span ├── Images ├── IndirectDraw.gif └── compute.gif ├── IndirectDraw ├── IndirectDraw.cpp ├── IndirectDraw.hpp ├── IndirectDraw.vcxproj ├── IndirectDraw.vcxproj.filters ├── Shader │ ├── drawQuadPS.hlsl │ ├── drawQuadVS.hlsl │ └── fillCS.hlsl └── packages.config ├── License.txt ├── Model ├── IndexOptimizePostTransform.cpp ├── IndexOptimizePostTransform.h ├── Model.cpp ├── Model.h ├── ModelAssimp.cpp ├── ModelAssimp.h ├── ModelConvert.cpp ├── ModelH3D.cpp ├── ModelOptimize.cpp ├── Model_VS15.vcxproj ├── Model_VS15.vcxproj.filters ├── Model_VS16.vcxproj ├── Model_VS16.vcxproj.filters └── packages.config ├── ModelConverter ├── IndexOptimizePostTransform.cpp ├── IndexOptimizePostTransform.h ├── ModelAssimp.cpp ├── ModelAssimp.h ├── ModelConvert.cpp ├── ModelConverter_VS15.sln ├── ModelConverter_VS15.vcxproj ├── ModelConverter_VS15.vcxproj.filters ├── ModelOptimize.cpp ├── README.txt ├── packages.config └── readme.md ├── ModelViewer ├── CompileSM6Test.bat ├── Light.cpp ├── Light.hpp ├── Logo.png ├── Logo44.png ├── ModelViewer.cpp ├── ModelViewer_VS15.sln ├── ModelViewer_VS15.vcxproj ├── ModelViewer_VS15.vcxproj.filters ├── ModelViewer_VS16.sln ├── ModelViewer_VS16.vcxproj ├── ModelViewer_VS16.vcxproj.filters ├── Models │ ├── box.h3d │ ├── box.obj │ ├── capsule.h3d │ ├── capsule.obj │ ├── plane.mtl │ ├── plane.obj │ ├── sphere.h3d │ ├── sphere.obj │ ├── sponza.h3d │ ├── unityexport.obj │ ├── yuan.h3d │ ├── yuan.mtl │ └── yuan.obj ├── Shaders │ ├── DeferredShading.hlsl │ ├── DepthViewerPS.hlsl │ ├── DepthViewerVS.hlsl │ ├── FillLightGridCS.hlsli │ ├── FillLightGridCS_16.hlsl │ ├── FillLightGridCS_24.hlsl │ ├── FillLightGridCS_32.hlsl │ ├── FillLightGridCS_8.hlsl │ ├── ForwardPS.hlsl │ ├── GBufferPS.hlsl │ ├── LightGrid.hlsli │ ├── Lighting.hlsli │ ├── ModelViewerPS.hlsl │ ├── ModelViewerRS.hlsli │ ├── ModelViewerVS.hlsl │ ├── ScreenQuadVS.hlsl │ └── WaveTileCountPS.hlsl ├── SmallLogo.png ├── SplashScreen.png ├── StoreLogo.png ├── Textures │ ├── Models │ │ ├── background.DDS │ │ ├── background_normal.DDS │ │ ├── chain_texture.DDS │ │ ├── chain_texture_normal.DDS │ │ ├── gi_flag.DDS │ │ ├── lion.DDS │ │ ├── lion_normal.DDS │ │ ├── spnza_bricks_a.DDS │ │ ├── spnza_bricks_a_normal.DDS │ │ ├── spnza_bricks_a_specular.DDS │ │ ├── sponza_arch.DDS │ │ ├── sponza_arch_normal.DDS │ │ ├── sponza_arch_specular.DDS │ │ ├── sponza_ceiling_a.DDS │ │ ├── sponza_ceiling_a_specular.DDS │ │ ├── sponza_column_a.DDS │ │ ├── sponza_column_a_normal.DDS │ │ ├── sponza_column_a_specular.DDS │ │ ├── sponza_column_b.DDS │ │ ├── sponza_column_b_normal.DDS │ │ ├── sponza_column_b_specular.DDS │ │ ├── sponza_column_c.DDS │ │ ├── sponza_column_c_normal.DDS │ │ ├── sponza_column_c_specular.DDS │ │ ├── sponza_curtain.DDS │ │ ├── sponza_curtain_blue.DDS │ │ ├── sponza_curtain_green.DDS │ │ ├── sponza_details.DDS │ │ ├── sponza_details_specular.DDS │ │ ├── sponza_fabric.DDS │ │ ├── sponza_fabric_blue.DDS │ │ ├── sponza_fabric_green.DDS │ │ ├── sponza_fabric_specular.DDS │ │ ├── sponza_flagpole.DDS │ │ ├── sponza_flagpole_specular.DDS │ │ ├── sponza_floor_a.DDS │ │ ├── sponza_floor_a_specular.DDS │ │ ├── sponza_roof.DDS │ │ ├── sponza_thorn.DDS │ │ ├── sponza_thorn_normal.DDS │ │ ├── sponza_thorn_specular.DDS │ │ ├── vase.DDS │ │ ├── vase_hanging.DDS │ │ ├── vase_normal.DDS │ │ ├── vase_plant.DDS │ │ ├── vase_plant_specular.DDS │ │ ├── vase_round.DDS │ │ ├── vase_round_normal.DDS │ │ ├── vase_round_specular.DDS │ │ └── white.DDS │ ├── default.DDS │ ├── default_normal.DDS │ ├── default_specular.DDS │ ├── fire.dds │ ├── sky │ │ ├── sky.dds │ │ └── sky_night.dds │ ├── smoke.dds │ ├── sparkTex.dds │ └── white.DDS ├── UWP.appxmanifest ├── WideLogo.png ├── World.cpp ├── World.hpp ├── engineTuning.txt ├── packages.config └── stdout.txt ├── NuGet.Config ├── PropertySheets ├── Debug.props ├── OrganizedBuild.props ├── Profile.props ├── Release.props ├── UWP.props ├── VS14.props ├── VS15.props ├── VS16.props └── Win32.props ├── Tools ├── SDFFontCreator │ ├── .gitignore │ ├── NuGet.Config │ ├── SDFFontCreator.cpp │ ├── SDFFontCreator_VS15.sln │ ├── SDFFontCreator_VS15.vcxproj │ ├── SDFFontCreator_VS15.vcxproj.filters │ └── packages.config └── Scripts │ ├── BinaryFileToCHeader.py │ ├── CleanFiles.py │ ├── CreateNewProject.py │ ├── GenerateDoFSampleOffsets.py │ ├── ProjectTemplates │ ├── AppTemplate_VS15.sln │ ├── AppTemplate_VS15.vcxproj │ ├── AppTemplate_VS15.vcxproj.filters │ ├── LibTemplate_VS15.vcxproj │ ├── LibTemplate_VS15.vcxproj.filters │ ├── Logo.png │ ├── Logo44.png │ ├── Main.cpp │ ├── SmallLogo.png │ ├── SplashScreen.png │ ├── StoreLogo.png │ ├── WideLogo.png │ ├── packages.config │ ├── pch.cpp │ └── pch.h │ └── TargaToDDS.py ├── VCT ├── CompileSM6Test.bat ├── Light.cpp ├── Light.hpp ├── Logo.png ├── Logo44.png ├── Models │ ├── box.h3d │ ├── box.obj │ ├── capsule.h3d │ ├── capsule.obj │ ├── plane.mtl │ ├── plane.obj │ ├── sphere.h3d │ ├── sphere.obj │ ├── sponza.h3d │ ├── unityexport.obj │ ├── yuan.h3d │ ├── yuan.mtl │ └── yuan.obj ├── Shaders │ ├── ClearClipMapCS.hlsl │ ├── ConservertiveVoxelPassGS.hlsl │ ├── ConservertiveVoxelPassPS.hlsl │ ├── ConservertiveVoxelPassVS.hlsl │ ├── DeferredShading.hlsl │ ├── DepthViewerPS.hlsl │ ├── DepthViewerVS.hlsl │ ├── FillLightGridCS.hlsli │ ├── FillLightGridCS_16.hlsl │ ├── FillLightGridCS_24.hlsl │ ├── FillLightGridCS_32.hlsl │ ├── FillLightGridCS_8.hlsl │ ├── ForwardPS.hlsl │ ├── GBufferPS.hlsl │ ├── LightGrid.hlsli │ ├── Lighting.hlsli │ ├── ModelViewerPS.hlsl │ ├── ModelViewerRS.hlsli │ ├── ModelViewerVS.hlsl │ ├── ScreenQuadVS.hlsl │ ├── VoxelVisualizeGS.hlsl │ ├── VoxelVisualizePS.hlsl │ ├── VoxelVisualizeVS.hlsl │ └── WaveTileCountPS.hlsl ├── SmallLogo.png ├── SplashScreen.png ├── StoreLogo.png ├── Textures │ ├── Models │ │ ├── background.DDS │ │ ├── background_normal.DDS │ │ ├── chain_texture.DDS │ │ ├── chain_texture_normal.DDS │ │ ├── gi_flag.DDS │ │ ├── lion.DDS │ │ ├── lion_normal.DDS │ │ ├── spnza_bricks_a.DDS │ │ ├── spnza_bricks_a_normal.DDS │ │ ├── spnza_bricks_a_specular.DDS │ │ ├── sponza_arch.DDS │ │ ├── sponza_arch_normal.DDS │ │ ├── sponza_arch_specular.DDS │ │ ├── sponza_ceiling_a.DDS │ │ ├── sponza_ceiling_a_specular.DDS │ │ ├── sponza_column_a.DDS │ │ ├── sponza_column_a_normal.DDS │ │ ├── sponza_column_a_specular.DDS │ │ ├── sponza_column_b.DDS │ │ ├── sponza_column_b_normal.DDS │ │ ├── sponza_column_b_specular.DDS │ │ ├── sponza_column_c.DDS │ │ ├── sponza_column_c_normal.DDS │ │ ├── sponza_column_c_specular.DDS │ │ ├── sponza_curtain.DDS │ │ ├── sponza_curtain_blue.DDS │ │ ├── sponza_curtain_green.DDS │ │ ├── sponza_details.DDS │ │ ├── sponza_details_specular.DDS │ │ ├── sponza_fabric.DDS │ │ ├── sponza_fabric_blue.DDS │ │ ├── sponza_fabric_green.DDS │ │ ├── sponza_fabric_specular.DDS │ │ ├── sponza_flagpole.DDS │ │ ├── sponza_flagpole_specular.DDS │ │ ├── sponza_floor_a.DDS │ │ ├── sponza_floor_a_specular.DDS │ │ ├── sponza_roof.DDS │ │ ├── sponza_thorn.DDS │ │ ├── sponza_thorn_normal.DDS │ │ ├── sponza_thorn_specular.DDS │ │ ├── vase.DDS │ │ ├── vase_hanging.DDS │ │ ├── vase_normal.DDS │ │ ├── vase_plant.DDS │ │ ├── vase_plant_specular.DDS │ │ ├── vase_round.DDS │ │ ├── vase_round_normal.DDS │ │ ├── vase_round_specular.DDS │ │ └── white.DDS │ ├── default.DDS │ ├── default_normal.DDS │ ├── default_specular.DDS │ ├── fire.dds │ ├── sky │ │ ├── sky.dds │ │ └── sky_night.dds │ ├── smoke.dds │ ├── sparkTex.dds │ └── white.DDS ├── UWP.appxmanifest ├── VisualizeMesh.cpp ├── VisualizeMesh.hpp ├── VoxelConeTracing.cpp ├── VoxelConeTracing.vcxproj ├── VoxelConeTracing.vcxproj.filters ├── VoxelRegion.cpp ├── VoxelRegion.hpp ├── VoxelVisualizePass.cpp ├── VoxelVisualizePass.hpp ├── Voxelization.cpp ├── Voxelization.hpp ├── WideLogo.png ├── World.cpp ├── World.hpp ├── engineTuning.txt ├── packages.config ├── stdout.txt ├── voxelClear.cpp ├── voxelClear.hpp ├── voxelizationPass.cpp └── voxelizationPass.hpp ├── VirtualTexture ├── Light.cpp ├── Light.hpp ├── Models │ ├── box.obj │ ├── capsule.h3d │ ├── capsule.obj │ ├── plane.obj │ ├── sphere.h3d │ ├── sphere.obj │ └── unityexport.obj ├── Shader │ ├── drawQuadPS.hlsl │ ├── drawQuadVS.hlsl │ └── fillCS.hlsl ├── Shaders │ ├── DepthViewerPS.hlsl │ ├── DepthViewerVS.hlsl │ ├── FillLightGridCS.hlsli │ ├── FillLightGridCS_16.hlsl │ ├── FillLightGridCS_24.hlsl │ ├── FillLightGridCS_32.hlsl │ ├── FillLightGridCS_8.hlsl │ ├── LightGrid.hlsli │ ├── ModelViewerPS.hlsl │ ├── ModelViewerRS.hlsli │ └── ModelViewerVS.hlsl ├── Textures │ ├── default.DDS │ ├── default_normal.DDS │ ├── default_specular.DDS │ ├── fire.dds │ ├── smoke.dds │ ├── sparkTex.dds │ └── white.DDS ├── UWP.appxmanifest ├── VirtualTexture.cpp ├── VirtualTexture.vcxproj ├── VirtualTexture.vcxproj.filters ├── World.cpp ├── World.hpp ├── engineTuning.txt ├── image_generator.py ├── packages.config ├── stdout.txt └── tiles_generator.py ├── appveyor.yml ├── readme.md ├── stdout.txt └── todolist.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.user 2 | *.suo 3 | *.VC.db* 4 | *.shader_inc 5 | *.vspscc 6 | *.opensdf 7 | *.sdf 8 | *.ipch 9 | *.cache 10 | *.tlog 11 | *.lastbuildstate 12 | *.ilk 13 | *.log 14 | * - Copy*.* 15 | Build_VS11 16 | Build_VS12 17 | Build_VS14 18 | Build_VS15 19 | Packages 20 | /ModelConverter/assimp.dll 21 | Packages 22 | *.opendb 23 | *.pdb 24 | Build_VS16/ 25 | VirtualTexture/StreamingAssets/ 26 | VirtualTexture/image_generator.pyc 27 | VirtualTexture/cache/ 28 | VirtualTexture/images/ 29 | -------------------------------------------------------------------------------- /Compute/Compute.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "pch.h" 5 | 6 | 7 | #include "GameCore.h" 8 | #include "GraphicsCore.h" 9 | #include "hlsl.hpp" 10 | #include "CameraController.h" 11 | #include "BufferManager.h" 12 | #include "Camera.h" 13 | #include "GpuBuffer.h" 14 | #include "CommandContext.h" 15 | #include "SamplerManager.h" 16 | #include "TemporalEffects.h" 17 | #include "MotionBlur.h" 18 | #include "DepthOfField.h" 19 | #include "PostEffects.h" 20 | #include "SSAO.h" 21 | #include "FXAA.h" 22 | #include "SkyPass.hpp" 23 | #include "SystemTime.h" 24 | #include "TextRenderer.h" 25 | #include "ShadowCamera.h" 26 | #include "ParticleEffectManager.h" 27 | #include "GameInput.h" 28 | 29 | 30 | using namespace GameCore; 31 | using namespace Math; 32 | using namespace Graphics; 33 | 34 | 35 | 36 | class Compute : public GameCore::IGameApp 37 | { 38 | public: 39 | Compute(void) {} 40 | 41 | virtual void Startup(void) override; 42 | virtual void Cleanup(void) override; 43 | 44 | virtual void Update(float deltaT) override; 45 | virtual void RenderScene(void) override; 46 | }; 47 | 48 | 49 | -------------------------------------------------------------------------------- /Compute/Shaders/displayPS.hlsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Texture2D uTex0 : register(t0); 6 | float3 main(float4 position : SV_Position) : SV_Target0 7 | { 8 | uint2 pixelPos = position.xy; 9 | float3 diffuseAlbedo = uTex0[pixelPos].xyz; 10 | return diffuseAlbedo; 11 | } -------------------------------------------------------------------------------- /Compute/Shaders/displayVS.hlsl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | void main( 26 | in uint VertID : SV_VertexID, 27 | out float4 Pos : SV_Position, 28 | out float2 Tex : TexCoord0 29 | ) 30 | { 31 | // Texture coordinates range [0, 2], but only [0, 1] appears on screen. 32 | Tex = float2(uint2(VertID, VertID << 1) & 2); 33 | Pos = float4(lerp(float2(-1, 1), float2(1, -1), Tex), 0, 1); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Compute/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Core/CommandAllocatorPool.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #pragma once 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | class CommandAllocatorPool 22 | { 23 | public: 24 | CommandAllocatorPool(D3D12_COMMAND_LIST_TYPE Type); 25 | ~CommandAllocatorPool(); 26 | 27 | void Create(ID3D12Device* pDevice); 28 | void Shutdown(); 29 | 30 | ID3D12CommandAllocator* RequestAllocator(uint64_t CompletedFenceValue); 31 | void DiscardAllocator(uint64_t FenceValue, ID3D12CommandAllocator* Allocator); 32 | 33 | inline size_t Size() { return m_AllocatorPool.size(); } 34 | 35 | private: 36 | const D3D12_COMMAND_LIST_TYPE m_cCommandListType; 37 | 38 | ID3D12Device* m_Device; 39 | std::vector m_AllocatorPool; 40 | std::queue> m_ReadyAllocators; 41 | std::mutex m_AllocatorMutex; 42 | }; 43 | -------------------------------------------------------------------------------- /Core/DepthOfField.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #pragma once 15 | 16 | #include "EngineTuning.h" 17 | 18 | namespace DepthOfField 19 | { 20 | extern BoolVar Enable; 21 | 22 | void Initialize( void ); 23 | void Shutdown( void ); 24 | 25 | void Render( CommandContext& BaseContext, float NearClipDist, float FarClipDist ); 26 | } 27 | -------------------------------------------------------------------------------- /Core/EsramAllocator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #pragma once 15 | 16 | #include "pch.h" 17 | 18 | class EsramAllocator 19 | { 20 | public: 21 | EsramAllocator() {} 22 | 23 | void PushStack() {} 24 | void PopStack() {} 25 | 26 | D3D12_GPU_VIRTUAL_ADDRESS Alloc( size_t size, size_t align, const std::wstring& bufferName ) 27 | { 28 | (size); (align); (bufferName); 29 | return D3D12_GPU_VIRTUAL_ADDRESS_UNKNOWN; 30 | } 31 | 32 | intptr_t SizeOfFreeSpace( void ) const 33 | { 34 | return 0; 35 | } 36 | 37 | }; 38 | -------------------------------------------------------------------------------- /Core/FXAA.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #pragma once 15 | 16 | class ColorBuffer; 17 | class BoolVar; 18 | class NumVar; 19 | class ComputeContext; 20 | 21 | namespace FXAA 22 | { 23 | extern BoolVar Enable; 24 | extern NumVar ContrastThreshold; // Default = 0.20 25 | extern NumVar SubpixelRemoval; // Default = 0.75 26 | 27 | void Initialize( void ); 28 | void Shutdown( void ); 29 | void Render( ComputeContext& Context, bool bUsePreComputedLuma ); 30 | 31 | } // namespace FXAA 32 | -------------------------------------------------------------------------------- /Core/FileUtility.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #pragma once 15 | 16 | #include "pch.h" 17 | #include 18 | #include 19 | #include 20 | 21 | namespace Utility 22 | { 23 | using namespace std; 24 | using namespace concurrency; 25 | 26 | typedef shared_ptr > ByteArray; 27 | extern ByteArray NullFile; 28 | 29 | // Reads the entire contents of a binary file. If the file with the same name except with an additional 30 | // ".gz" suffix exists, it will be loaded and decompressed instead. 31 | // This operation blocks until the entire file is read. 32 | ByteArray ReadFileSync(const wstring& fileName); 33 | 34 | // fill in flat data in outData 35 | U32 FillFlatData(U32 beginIndex, ByteArray& image_data, vector<::byte>& outData); 36 | 37 | // Same as previous except that it does not block but instead returns a task. 38 | task ReadFileAsync(const wstring& fileName); 39 | 40 | } // namespace Utility 41 | -------------------------------------------------------------------------------- /Core/GpuTimeManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #pragma once 15 | 16 | #include "GameCore.h" 17 | 18 | class CommandContext; 19 | 20 | namespace GpuTimeManager 21 | { 22 | void Initialize( uint32_t MaxNumTimers = 4096 ); 23 | void Shutdown(); 24 | 25 | // Reserve a unique timer index 26 | uint32_t NewTimer(void); 27 | 28 | // Write start and stop time stamps on the GPU timeline 29 | void StartTimer(CommandContext& Context, uint32_t TimerIdx); 30 | void StopTimer(CommandContext& Context, uint32_t TimerIdx); 31 | 32 | // Bookend all calls to GetTime() with Begin/End which correspond to Map/Unmap. This 33 | // needs to happen either at the very start or very end of a frame. 34 | void BeginReadBack(void); 35 | void EndReadBack(void); 36 | 37 | // Returns the time in milliseconds between start and stop queries 38 | float GetTime(uint32_t TimerIdx); 39 | } 40 | -------------------------------------------------------------------------------- /Core/GraphRenderer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: Julia Careaga 12 | // 13 | 14 | #include "GraphicsCore.h" 15 | 16 | namespace GraphRenderer 17 | { 18 | void Initialize(); 19 | void Shutdown(); 20 | 21 | enum class GraphType { Global, Profile }; 22 | typedef uint32_t GraphHandle; 23 | 24 | bool ManageGraphs( GraphHandle graphID, GraphType Type ); 25 | GraphHandle InitGraph( GraphType Type ); 26 | Color GetGraphColor( GraphHandle GraphID, GraphType Type); 27 | XMFLOAT4 GetMaxAvg( GraphType Type ); 28 | void Update( XMFLOAT2 InputNode, GraphHandle GraphID, GraphType Type); 29 | void RenderGraphs( GraphicsContext& Context, GraphType Type ); 30 | 31 | void SetSelectedIndex(uint32_t selectedIndex); 32 | 33 | } // namespace GraphRenderer 34 | -------------------------------------------------------------------------------- /Core/Math/BoundingBox.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "VectorMath.h" 3 | 4 | namespace Math 5 | { 6 | struct BoundingBox 7 | { 8 | Vector3 min; 9 | Vector3 max; 10 | 11 | BoundingBox(Vector3 p_min, Vector3 p_max) noexcept 12 | : min(p_min), 13 | max(p_max) {} 14 | 15 | BoundingBox() noexcept :max(-g_XMInfinity), min(g_XMInfinity) 16 | { 17 | } 18 | 19 | [[nodiscard]] 20 | Scalar Length() 21 | { 22 | return Scalar(XMVector3Length(max - min)); 23 | } 24 | 25 | [[nodiscard]] 26 | const Scalar Length() const 27 | { 28 | return Scalar(XMVector3Length(max - min)); 29 | } 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /Core/Math/Random.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "pch.h" 15 | #include "Random.h" 16 | 17 | namespace Math 18 | { 19 | RandomNumberGenerator g_RNG; 20 | } 21 | -------------------------------------------------------------------------------- /Core/PageInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "PageInfo.h" 3 | #include "CommandContext.h" 4 | 5 | 6 | PageInfo::PageInfo(const PageInfo & page) : 7 | start_corordinate(page.start_corordinate), 8 | regionSize(page.regionSize), 9 | mipLevel(page.mipLevel), 10 | m_mem(page.m_mem ? std::make_unique(*page.m_mem) : nullptr), 11 | is_packed(page.is_packed) 12 | {} 13 | 14 | void PageInfo::LoadData(std::vector data, PageAllocator& allocator) 15 | { 16 | CommandContext& InitContext = CommandContext::Begin(); 17 | const size_t NumBytes = data.size() * sizeof(UINT8); 18 | m_mem = std::make_unique(allocator.Allocate(NumBytes)); 19 | SIMDMemCopy(m_mem->DataPtr, data.data(), Math::DivideByMultiple(NumBytes, 16)); 20 | InitContext.Finish(true); 21 | } -------------------------------------------------------------------------------- /Core/PageInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #pragma region HEADER 4 | #include "pch.h" 5 | #include "GpuBuffer.h" 6 | #include "LinearAllocator.h" 7 | #pragma region 8 | 9 | 10 | struct PageInfo 11 | { 12 | public: 13 | PageInfo() :m_mem(nullptr) {} 14 | 15 | PageInfo(const PageInfo &); 16 | 17 | ~PageInfo() = default; 18 | 19 | void LoadData(std::vector data, PageAllocator& allocator); 20 | 21 | D3D12_TILED_RESOURCE_COORDINATE start_corordinate; 22 | 23 | D3D12_TILE_REGION_SIZE regionSize; 24 | 25 | U32 mipLevel; 26 | 27 | std::unique_ptr m_mem = nullptr; 28 | 29 | bool is_packed = false; 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /Core/ParticleEffect.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): Julia Careaga 12 | // James Stanard 13 | 14 | #pragma once 15 | #include "pch.h" 16 | #include "GpuBuffer.h" 17 | #include "ParticleEffectProperties.h" 18 | #include "ParticleShaderStructs.h" 19 | 20 | class ParticleEffect 21 | { 22 | public: 23 | ParticleEffect(ParticleEffectProperties& effectProperties); 24 | void LoadDeviceResources(ID3D12Device* device); 25 | void Update(ComputeContext& CompContext, float timeDelta); 26 | float GetLifetime(){ return m_EffectProperties.TotalActiveLifetime; } 27 | float GetElapsedTime(){ return m_ElapsedTime; } 28 | void Reset(); 29 | 30 | private: 31 | 32 | StructuredBuffer m_StateBuffers[2]; 33 | uint32_t m_CurrentStateBuffer; 34 | StructuredBuffer m_RandomStateBuffer; 35 | IndirectArgsBuffer m_DispatchIndirectArgs; 36 | IndirectArgsBuffer m_DrawIndirectArgs; 37 | 38 | ParticleEffectProperties m_EffectProperties; 39 | ParticleEffectProperties m_OriginalEffectProperties; 40 | float m_ElapsedTime; 41 | UINT m_effectID; 42 | 43 | 44 | }; 45 | -------------------------------------------------------------------------------- /Core/ParticleEmissionProperties.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: Julia Careaga 12 | 13 | #pragma once 14 | #include "pch.h" 15 | #include "ParticleShaderStructs.h" 16 | 17 | EmissionProperties* CreateEmissionProperties() 18 | { 19 | EmissionProperties* emitProps = new EmissionProperties; 20 | ZeroMemory(emitProps, sizeof(*emitProps)); 21 | emitProps->EmitPosW = emitProps->LastEmitPosW = XMFLOAT3(0.0,0.0,0.0); 22 | emitProps->EmitDirW = XMFLOAT3(0.0,0.0,1.0); 23 | emitProps->EmitRightW = XMFLOAT3(1.0,0.0,0.0); 24 | emitProps->EmitUpW = XMFLOAT3(0.0,1.0,0.0); 25 | emitProps->Restitution = 0.6; 26 | emitProps->FloorHeight = -0.7; 27 | emitProps->EmitSpeed = 1.0; 28 | emitProps->Gravity = XMFLOAT3(0, -5, 0); 29 | emitProps->MaxParticles = 500; 30 | return emitProps; 31 | }; 32 | -------------------------------------------------------------------------------- /Core/ReadbackBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #pragma once 15 | 16 | #include "GpuBuffer.h" 17 | 18 | class ReadbackBuffer : public GpuBuffer 19 | { 20 | public: 21 | virtual ~ReadbackBuffer() { Destroy(); } 22 | 23 | void Create( const std::wstring& name, uint32_t NumElements, uint32_t ElementSize ); 24 | 25 | void* Map(void); 26 | void Unmap(void); 27 | 28 | protected: 29 | 30 | void CreateDerivedViews(void) {} 31 | 32 | }; 33 | -------------------------------------------------------------------------------- /Core/SSAO.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #pragma once 15 | 16 | namespace Math { class Camera; } 17 | 18 | namespace SSAO 19 | { 20 | void Initialize( void ); 21 | void Shutdown( void ); 22 | void Render(GraphicsContext& Context, const float* ProjMat, float NearClipDist, float FarClipDist ); 23 | void Render(GraphicsContext& Context, const Math::Camera& camera ); 24 | 25 | extern BoolVar Enable; 26 | extern BoolVar DebugDraw; 27 | extern BoolVar AsyncCompute; 28 | extern BoolVar ComputeLinearZ; 29 | } 30 | -------------------------------------------------------------------------------- /Core/SamplerManager.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): James Stanard 12 | // Alex Nankervis 13 | // 14 | 15 | #include "pch.h" 16 | #include "SamplerManager.h" 17 | #include "GraphicsCore.h" 18 | #include "Hash.h" 19 | #include 20 | 21 | using namespace std; 22 | using namespace Graphics; 23 | 24 | namespace 25 | { 26 | map< size_t, D3D12_CPU_DESCRIPTOR_HANDLE > s_SamplerCache; 27 | } 28 | 29 | D3D12_CPU_DESCRIPTOR_HANDLE SamplerDesc::CreateDescriptor() 30 | { 31 | size_t hashValue = Utility::HashState(this); 32 | auto iter = s_SamplerCache.find(hashValue); 33 | if (iter != s_SamplerCache.end()) 34 | { 35 | return iter->second; 36 | } 37 | 38 | D3D12_CPU_DESCRIPTOR_HANDLE Handle = AllocateDescriptor(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER); 39 | g_Device->CreateSampler(this, Handle); 40 | return Handle; 41 | } 42 | 43 | void SamplerDesc::CreateDescriptor( D3D12_CPU_DESCRIPTOR_HANDLE& Handle ) 44 | { 45 | g_Device->CreateSampler(this, Handle); 46 | } 47 | -------------------------------------------------------------------------------- /Core/Shaders/AoBlurUpsampleBlendOutCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define BLEND_WITH_HIGHER_RESOLUTION 15 | 16 | #include "AoBlurAndUpsampleCS.hlsli" 17 | -------------------------------------------------------------------------------- /Core/Shaders/AoBlurUpsampleCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "AoBlurAndUpsampleCS.hlsli" 15 | -------------------------------------------------------------------------------- /Core/Shaders/AoBlurUpsamplePreMinBlendOutCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define COMBINE_LOWER_RESOLUTIONS 15 | #define BLEND_WITH_HIGHER_RESOLUTION 16 | 17 | #include "AoBlurAndUpsampleCS.hlsli" 18 | -------------------------------------------------------------------------------- /Core/Shaders/AoBlurUpsamplePreMinCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define COMBINE_LOWER_RESOLUTIONS 15 | 16 | #include "AoBlurAndUpsampleCS.hlsli" 17 | -------------------------------------------------------------------------------- /Core/Shaders/AoRender1CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define INTERLEAVE_RESULT 15 | #include "AoRenderCS.hlsli" 16 | -------------------------------------------------------------------------------- /Core/Shaders/AoRender2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | 15 | #include "AoRenderCS.hlsli" 16 | -------------------------------------------------------------------------------- /Core/Shaders/ApplyBloom2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | #include "ApplyBloomCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/BicubicUpsampleGammaPS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define GAMMA_SPACE 15 | #include "BicubicUpsamplePS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/BilinearUpsamplePS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #include "ShaderUtility.hlsli" 14 | #include "PresentRS.hlsli" 15 | 16 | Texture2D ColorTex : register(t0); 17 | 18 | SamplerState BilinearFilter : register(s0); 19 | 20 | [RootSignature(Present_RootSig)] 21 | float3 main( float4 position : SV_Position, float2 uv : TexCoord0 ) : SV_Target0 22 | { 23 | float3 LinearRGB = RemoveDisplayProfile(ColorTex.SampleLevel(BilinearFilter, uv, 0), LDR_COLOR_FORMAT); 24 | return ApplyDisplayProfile(LinearRGB, DISPLAY_PLANE_FORMAT); 25 | } 26 | -------------------------------------------------------------------------------- /Core/Shaders/Bitonic64InnerSortCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define BITONICSORT_64BIT 15 | #include "Bitonic32InnerSortCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/Bitonic64OuterSortCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define BITONICSORT_64BIT 15 | #include "Bitonic32OuterSortCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/Bitonic64PreSortCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define BITONICSORT_64BIT 15 | #include "Bitonic32PreSortCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/BufferCopyPS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "PresentRS.hlsli" 15 | 16 | Texture2D ColorTex : register(t0); 17 | SamplerState BilinearSampler : register(s0); 18 | 19 | cbuffer Constants : register(b0) 20 | { 21 | float2 RcpDestDim; 22 | } 23 | 24 | [RootSignature(Present_RootSig)] 25 | float4 main( float4 position : SV_Position ) : SV_Target0 26 | { 27 | //float2 UV = saturate(RcpDestDim * position.xy); 28 | //return ColorTex.SampleLevel(BilinearSampler, UV, 0); 29 | return ColorTex[(int2)position.xy]; 30 | } 31 | -------------------------------------------------------------------------------- /Core/Shaders/Buffers.hlsli: -------------------------------------------------------------------------------- 1 | #ifndef BUFFERS_HLSL 2 | #define BUFFERS_HLSL 3 | #include "../hlsl.hpp" 4 | 5 | CBUFFER(CameraConstant, SLOT_CBUFFER_CAMERA) 6 | { 7 | float4x4 modelToProjection; 8 | }; 9 | 10 | CBUFFER(WorldConstant, SLOT_CBUFFER_WORLD) 11 | { 12 | float4x4 g_projection_to_camera : packoffset(c0); 13 | float4x4 g_camera_to_world : packoffset(c4); 14 | float4x4 g_projection_to_world : packoffset(c8); 15 | float4x4 g_model_to_shadow : packoffset(c12); 16 | float4 g_inv_viewport : packoffset(c16); 17 | float3 g_viewer_pos : packoffset(c17); 18 | float g_scene_lengh : packoffset(c17.w); 19 | }; 20 | 21 | CBUFFER(LightConstant, SLOT_CBUFFER_LIGHT) 22 | { 23 | float3 SunDirection; 24 | float3 SunColor; 25 | float3 AmbientColor; 26 | float4 ShadowTexelSize; 27 | 28 | float4 InvTileDim; 29 | uint4 TileCount; 30 | uint4 FirstLightIndex; 31 | } 32 | 33 | 34 | 35 | #endif -------------------------------------------------------------------------------- /Core/Shaders/CameraMotionBlurPrePassLinearZCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define USE_LINEAR_Z 14 | #include "CameraMotionBlurPrePassCS.hlsl" 15 | -------------------------------------------------------------------------------- /Core/Shaders/CopyBackPostBufferCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "PostEffectsRS.hlsli" 15 | #include "PixelPacking.hlsli" 16 | 17 | RWTexture2D SceneColor : register( u0 ); 18 | Texture2D PostBuffer : register( t0 ); 19 | 20 | [RootSignature(PostEffects_RootSig)] 21 | [numthreads( 8, 8, 1 )] 22 | void main( uint3 DTid : SV_DispatchThreadID ) 23 | { 24 | SceneColor[DTid.xy] = Unpack_R11G11B10_FLOAT(PostBuffer[DTid.xy]); 25 | } 26 | -------------------------------------------------------------------------------- /Core/Shaders/DebugLuminanceHdr2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | #include "DebugLuminanceHdrCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/DebugLuminanceLdr2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | #include "DebugLuminanceLdrCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/DebugSSAOCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "SSAORS.hlsli" 15 | 16 | Texture2D SsaoBuffer : register( t0 ); 17 | RWTexture2D OutColor : register( u0 ); 18 | 19 | [RootSignature(SSAO_RootSig)] 20 | [numthreads( 8, 8, 1 )] 21 | void main( uint3 DTid : SV_DispatchThreadID ) 22 | { 23 | OutColor[DTid.xy] = SsaoBuffer[DTid.xy].xxx; 24 | } 25 | -------------------------------------------------------------------------------- /Core/Shaders/DoFCombine2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | #include "DoFCombineCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/DoFCombineFast2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | #include "DoFCombineFastCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/DoFDebugBlueCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "DoFCommon.hlsli" 15 | 16 | StructuredBuffer WorkQueue : register(t5); 17 | RWTexture2D DstColor : register(u0); 18 | 19 | [RootSignature(DoF_RootSig)] 20 | [numthreads( 16, 16, 1 )] 21 | void main( uint3 Gid : SV_GroupID, uint3 GTid : SV_GroupThreadID ) 22 | { 23 | uint TileCoord = WorkQueue[Gid.x]; 24 | uint2 Tile = uint2(TileCoord & 0xFFFF, TileCoord >> 16); 25 | uint2 st = Tile * 16 + GTid.xy; 26 | 27 | DstColor[st] = float3(0, 0, 1); 28 | } 29 | -------------------------------------------------------------------------------- /Core/Shaders/DoFDebugGreenCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "DoFCommon.hlsli" 15 | 16 | StructuredBuffer WorkQueue : register(t5); 17 | RWTexture2D DstColor : register(u0); 18 | 19 | [RootSignature(DoF_RootSig)] 20 | [numthreads( 16, 16, 1 )] 21 | void main( uint3 Gid : SV_GroupID, uint3 GTid : SV_GroupThreadID ) 22 | { 23 | uint TileCoord = WorkQueue[Gid.x]; 24 | uint2 Tile = uint2(TileCoord & 0xFFFF, TileCoord >> 16); 25 | uint2 st = Tile * 16 + GTid.xy; 26 | 27 | DstColor[st] = float3(0, 1, 0); 28 | } 29 | -------------------------------------------------------------------------------- /Core/Shaders/DoFDebugRedCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "DoFCommon.hlsli" 15 | 16 | StructuredBuffer WorkQueue : register(t5); 17 | RWTexture2D DstColor : register(u0); 18 | 19 | [RootSignature(DoF_RootSig)] 20 | [numthreads( 16, 16, 1 )] 21 | void main( uint3 Gid : SV_GroupID, uint3 GTid : SV_GroupThreadID ) 22 | { 23 | uint TileCoord = WorkQueue[Gid.x]; 24 | uint2 Tile = uint2(TileCoord & 0xFFFF, TileCoord >> 16); 25 | uint2 st = Tile * 16 + GTid.xy; 26 | 27 | DstColor[st] = float3(1, 0, 0); 28 | } 29 | -------------------------------------------------------------------------------- /Core/Shaders/DoFMedianFilterFixupCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "DoFCommon.hlsli" 15 | 16 | Texture2D InputColor : register(t0); 17 | Texture2D InputAlpha : register(t1); 18 | StructuredBuffer WorkQueue : register(t2); 19 | RWTexture2D OutputColor : register(u0); 20 | RWTexture2D OutputAlpha : register(u1); 21 | 22 | [RootSignature(DoF_RootSig)] 23 | [numthreads( 8, 8, 1 )] 24 | void main( uint3 Gid : SV_GroupID, uint3 GTid : SV_GroupThreadID ) 25 | { 26 | uint TileCoord = WorkQueue[Gid.x]; 27 | uint2 Tile = uint2(TileCoord & 0xFFFF, TileCoord >> 16); 28 | uint2 st = Tile * 8 + GTid.xy; 29 | 30 | OutputColor[st] = InputColor[st]; 31 | OutputAlpha[st] = InputAlpha[st]; 32 | } 33 | -------------------------------------------------------------------------------- /Core/Shaders/DoFMedianFilterSepAlphaCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SEPARATE_ALPHA_MEDIAN 15 | #include "DoFMedianFilterCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/DoFPass2DebugCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SUPPORT_DEBUGGING 15 | #include "DoFPass2CS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/DoFPass2FixupCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "DoFCommon.hlsli" 15 | 16 | Texture2D ColorBuffer : register(t0); 17 | Texture2D PresortBuffer : register(t1); 18 | StructuredBuffer WorkQueue : register(t3); 19 | RWTexture2D OutputColor : register(u0); 20 | RWTexture2D OutputAlpha : register(u1); 21 | 22 | [RootSignature(DoF_RootSig)] 23 | [numthreads( 8, 8, 1 )] 24 | void main( uint3 Gid : SV_GroupID, uint3 GTid : SV_GroupThreadID ) 25 | { 26 | uint TileCoord = WorkQueue[Gid.x]; 27 | uint2 Tile = uint2(TileCoord & 0xFFFF, TileCoord >> 16); 28 | 29 | uint2 st = Tile * 8 + GTid.xy; 30 | 31 | float Alpha = saturate(PresortBuffer[st].z); 32 | 33 | OutputColor[st] = ColorBuffer[st]; 34 | OutputAlpha[st] = 1.0;//lerp(Alpha, 1.0, 0.75); 35 | } 36 | -------------------------------------------------------------------------------- /Core/Shaders/DoFPreFilterFixupCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "DoFCommon.hlsli" 15 | 16 | Texture2D LNDepthBuffer : register(t0); 17 | Texture2D TileClass : register(t1); 18 | Texture2D ColorBuffer : register(t2); 19 | StructuredBuffer WorkQueue : register(t3); 20 | 21 | // Half res 22 | RWTexture2D PresortBuffer : register(u0); 23 | RWTexture2D OutputBuffer : register(u1); 24 | 25 | [RootSignature(DoF_RootSig)] 26 | [numthreads( 8, 8, 1 )] 27 | void main( uint3 Gid : SV_GroupID, uint GI : SV_GroupIndex, uint3 GTid : SV_GroupThreadID, uint3 DTid : SV_DispatchThreadID ) 28 | { 29 | uint TileCoord = WorkQueue[Gid.x]; 30 | uint2 Tile = uint2(TileCoord & 0xFFFF, TileCoord >> 16); 31 | uint2 st = Tile * 8 + GTid.xy; 32 | 33 | float2 uv = (2 * st + 1) * RcpBufferDim; 34 | 35 | OutputBuffer[st] = ColorBuffer.SampleLevel(BilinearSampler, uv, 0); 36 | float Depth = LNDepthBuffer.SampleLevel(PointSampler, uv, 0); 37 | PresortBuffer[st] = float3(0.0, 1.0, Depth); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Core/Shaders/DoFRS.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define DoF_RootSig \ 15 | "RootFlags(0), " \ 16 | "CBV(b0), " \ 17 | "DescriptorTable(SRV(t0, numDescriptors = 6))," \ 18 | "DescriptorTable(UAV(u0, numDescriptors = 3))," \ 19 | "RootConstants(b1, num32BitConstants = 1), " \ 20 | "StaticSampler(s0," \ 21 | "addressU = TEXTURE_ADDRESS_BORDER," \ 22 | "addressV = TEXTURE_ADDRESS_BORDER," \ 23 | "addressW = TEXTURE_ADDRESS_BORDER," \ 24 | "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK," \ 25 | "filter = FILTER_MIN_MAG_MIP_POINT)," \ 26 | "StaticSampler(s1," \ 27 | "addressU = TEXTURE_ADDRESS_CLAMP," \ 28 | "addressV = TEXTURE_ADDRESS_CLAMP," \ 29 | "addressW = TEXTURE_ADDRESS_CLAMP," \ 30 | "filter = FILTER_MIN_MAG_MIP_POINT)," \ 31 | "StaticSampler(s2," \ 32 | "addressU = TEXTURE_ADDRESS_CLAMP," \ 33 | "addressV = TEXTURE_ADDRESS_CLAMP," \ 34 | "addressW = TEXTURE_ADDRESS_CLAMP," \ 35 | "filter = FILTER_MIN_MAG_MIP_LINEAR)" 36 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass1_Luma2_CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define USE_LUMA_INPUT_BUFFER 15 | #define SUPPORT_TYPED_UAV_LOADS 1 16 | #include "FXAAPass1CS.hlsli" 17 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass1_Luma_CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define USE_LUMA_INPUT_BUFFER 15 | #include "FXAAPass1CS.hlsli" 16 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass1_RGB2_CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define SUPPORT_TYPED_UAV_LOADS 1 14 | #include "FXAAPass1CS.hlsli" 15 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass1_RGB_CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #include "FXAAPass1CS.hlsli" 14 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass2H2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | 16 | #include "FXAAPass2CS.hlsli" 17 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass2HCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "FXAAPass2CS.hlsli" 15 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass2HDebug2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | #include "FXAAPass2HDebugCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass2HDebugCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define DEBUG_OUTPUT 15 | 16 | #include "FXAAPass2CS.hlsli" 17 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass2V2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define VERTICAL_ORIENTATION 15 | #define SUPPORT_TYPED_UAV_LOADS 1 16 | 17 | #include "FXAAPass2CS.hlsli" 18 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass2VCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define VERTICAL_ORIENTATION 15 | 16 | #include "FXAAPass2CS.hlsli" 17 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass2VDebug2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | #include "FXAAPass2VDebugCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/FXAAPass2VDebugCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define VERTICAL_ORIENTATION 15 | #define DEBUG_OUTPUT 16 | 17 | #include "FXAAPass2CS.hlsli" 18 | -------------------------------------------------------------------------------- /Core/Shaders/FXAARootSignature.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define FXAA_RootSig \ 15 | "RootFlags(0), " \ 16 | "RootConstants(b0, num32BitConstants=7), " \ 17 | "DescriptorTable(UAV(u0, numDescriptors = 5))," \ 18 | "DescriptorTable(SRV(t0, numDescriptors = 6))," \ 19 | "StaticSampler(s0," \ 20 | "addressU = TEXTURE_ADDRESS_CLAMP," \ 21 | "addressV = TEXTURE_ADDRESS_CLAMP," \ 22 | "addressW = TEXTURE_ADDRESS_CLAMP," \ 23 | "filter = FILTER_MIN_MAG_MIP_LINEAR)" 24 | 25 | cbuffer CB0 : register(b0) 26 | { 27 | float2 RcpTextureSize; 28 | float ContrastThreshold; // default = 0.2, lower is more expensive 29 | float SubpixelRemoval; // default = 0.75, lower blurs less 30 | uint LastQueueIndex; 31 | uint2 StartPixel; 32 | } 33 | -------------------------------------------------------------------------------- /Core/Shaders/GenerateMipsGammaCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define CONVERT_TO_SRGB 15 | #include "GenerateMipsCS.hlsli" 16 | -------------------------------------------------------------------------------- /Core/Shaders/GenerateMipsGammaOddCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define CONVERT_TO_SRGB 15 | #define NON_POWER_OF_TWO 3 16 | #include "GenerateMipsCS.hlsli" 17 | -------------------------------------------------------------------------------- /Core/Shaders/GenerateMipsGammaOddXCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define CONVERT_TO_SRGB 15 | #define NON_POWER_OF_TWO 1 16 | #include "GenerateMipsCS.hlsli" 17 | -------------------------------------------------------------------------------- /Core/Shaders/GenerateMipsGammaOddYCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define CONVERT_TO_SRGB 15 | #define NON_POWER_OF_TWO 2 16 | #include "GenerateMipsCS.hlsli" 17 | -------------------------------------------------------------------------------- /Core/Shaders/GenerateMipsLinearCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "GenerateMipsCS.hlsli" 15 | -------------------------------------------------------------------------------- /Core/Shaders/GenerateMipsLinearOddCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define NON_POWER_OF_TWO 3 15 | #include "GenerateMipsCS.hlsli" 16 | -------------------------------------------------------------------------------- /Core/Shaders/GenerateMipsLinearOddXCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define NON_POWER_OF_TWO 1 15 | #include "GenerateMipsCS.hlsli" 16 | -------------------------------------------------------------------------------- /Core/Shaders/GenerateMipsLinearOddYCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define NON_POWER_OF_TWO 2 15 | #include "GenerateMipsCS.hlsli" 16 | -------------------------------------------------------------------------------- /Core/Shaders/LinearizeDepthCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "SSAORS.hlsli" 15 | 16 | RWTexture2D LinearZ : register(u0); 17 | Texture2D Depth : register(t0); 18 | 19 | cbuffer CB0 : register(b0) 20 | { 21 | float ZMagic; // (zFar - zNear) / zNear 22 | } 23 | 24 | [RootSignature(SSAO_RootSig)] 25 | [numthreads( 16, 16, 1 )] 26 | void main( uint3 Gid : SV_GroupID, uint GI : SV_GroupIndex, uint3 GTid : SV_GroupThreadID, uint3 DTid : SV_DispatchThreadID ) 27 | { 28 | LinearZ[DTid.xy] = 1.0 / (ZMagic * Depth[DTid.xy] + 1.0); 29 | } 30 | -------------------------------------------------------------------------------- /Core/Shaders/MagnifyPixelsPS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "ShaderUtility.hlsli" 15 | #include "PresentRS.hlsli" 16 | 17 | Texture2D ColorTex : register(t0); 18 | SamplerState PointSampler : register(s1); 19 | 20 | cbuffer Constants : register(b0) 21 | { 22 | float ScaleFactor; 23 | } 24 | 25 | [RootSignature(Present_RootSig)] 26 | float3 main( float4 position : SV_Position, float2 uv : TexCoord0 ) : SV_Target0 27 | { 28 | float2 ScaledUV = ScaleFactor * (uv - 0.5) + 0.5; 29 | return ColorTex.SampleLevel(PointSampler, ScaledUV, 0); 30 | } 31 | -------------------------------------------------------------------------------- /Core/Shaders/MotionBlurRS.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define MotionBlur_RootSig \ 15 | "RootFlags(0), " \ 16 | "RootConstants(b0, num32BitConstants = 4), " \ 17 | "CBV(b1)," \ 18 | "DescriptorTable(UAV(u0, numDescriptors = 8))," \ 19 | "DescriptorTable(SRV(t0, numDescriptors = 8))," \ 20 | "StaticSampler(s0," \ 21 | "addressU = TEXTURE_ADDRESS_BORDER," \ 22 | "addressV = TEXTURE_ADDRESS_BORDER," \ 23 | "addressW = TEXTURE_ADDRESS_BORDER," \ 24 | "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK," \ 25 | "filter = FILTER_MIN_MAG_MIP_LINEAR)" 26 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleDispatchIndirectArgsCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: Julia Careaga 12 | // 13 | 14 | #include "ParticleRS.hlsli" 15 | 16 | ByteAddressBuffer g_ParticleInstance : register( t0 ); 17 | RWByteAddressBuffer g_NumThreadGroups : register( u1 ); 18 | 19 | [RootSignature(Particle_RootSig)] 20 | [numthreads(1, 1, 1)] 21 | void main( uint3 DTid : SV_DispatchThreadID ) 22 | { 23 | g_NumThreadGroups.Store(0, ( g_ParticleInstance.Load(0) + 63) / 64); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleFinalDispatchIndirectArgsCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: Julia Careaga 12 | // 13 | 14 | #include "ParticleUtility.hlsli" 15 | 16 | ByteAddressBuffer g_FinalInstanceCounter : register( t0 ); 17 | RWByteAddressBuffer g_NumThreadGroups : register( u0 ); 18 | RWByteAddressBuffer g_DrawIndirectArgs : register ( u1 ); 19 | 20 | [RootSignature(Particle_RootSig)] 21 | [numthreads(1, 1, 1)] 22 | void main( uint3 DTid : SV_DispatchThreadID ) 23 | { 24 | uint particleCount = g_FinalInstanceCounter.Load(0); 25 | g_NumThreadGroups.Store3(0, uint3((particleCount + 63) / 64, 1, 1)); 26 | g_DrawIndirectArgs.Store(4, particleCount); 27 | } 28 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleNoSortVS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): James Stanard 12 | 13 | #define DISABLE_PARTICLE_SORT 1 14 | #include "ParticleVS.hlsl" 15 | -------------------------------------------------------------------------------- /Core/Shaders/ParticlePS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // Julia Careaga 13 | // 14 | 15 | #include "ParticleUpdateCommon.hlsli" 16 | #include "ParticleUtility.hlsli" 17 | 18 | Texture2DArray ColorTex : register(t1); 19 | Texture2D LinearDepthTex : register(t2); 20 | 21 | [RootSignature(Particle_RootSig)] 22 | float4 main(ParticleVertexOutput input ) : SV_Target0 23 | { 24 | float3 uv = float3(input.TexCoord.xy, input.TexID); 25 | float4 TextureColor = ColorTex.Sample( gSampLinearBorder, uv ); 26 | TextureColor.a *= saturate(1000.0 * (LinearDepthTex[(uint2)input.Pos.xy] - input.LinearZ)); 27 | TextureColor.rgb *= TextureColor.a; 28 | return TextureColor * input.Color; 29 | } 30 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleSortIndirectArgsCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "ParticleUtility.hlsli" 15 | 16 | RWByteAddressBuffer g_DispatchIndirectArgs : register(u0); 17 | RWByteAddressBuffer g_DrawIndirectArgs : register(u1); 18 | 19 | [RootSignature(Particle_RootSig)] 20 | [numthreads(1, 1, 1)] 21 | void main( uint GI : SV_GroupIndex ) 22 | { 23 | uint InstanceCount = g_DrawIndirectArgs.Load(4); 24 | uint ThreadGroupCount = (InstanceCount + 2047) / 2048; 25 | 26 | g_DispatchIndirectArgs.Store3(0, uint3(ThreadGroupCount, 1, 1)); 27 | 28 | // Reset instance count so we can cull and determine how many we need to actually draw 29 | g_DrawIndirectArgs.Store(4, 0); 30 | } 31 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleTileRender2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define SUPPORT_TYPED_UAV_LOADS 1 14 | #include "ParticleTileRenderCS.hlsl" 15 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleTileRenderFast2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define DISABLE_DEPTH_TESTS 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | #include "ParticleTileRenderCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleTileRenderFastCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define DISABLE_DEPTH_TESTS 14 | #include "ParticleTileRenderCS.hlsl" 15 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleTileRenderFastDynamic2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define DYNAMIC_RESOLUTION 14 | #define DISABLE_DEPTH_TESTS 15 | #define SUPPORT_TYPED_UAV_LOADS 1 16 | #include "ParticleTileRenderCS.hlsl" 17 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleTileRenderFastDynamicCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define DYNAMIC_RESOLUTION 14 | #define DISABLE_DEPTH_TESTS 15 | #include "ParticleTileRenderCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleTileRenderFastLowRes2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define LOW_RESOLUTION 14 | #define DISABLE_DEPTH_TESTS 15 | #define SUPPORT_TYPED_UAV_LOADS 1 16 | #include "ParticleTileRenderCS.hlsl" 17 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleTileRenderFastLowResCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define LOW_RESOLUTION 14 | #define DISABLE_DEPTH_TESTS 15 | #include "ParticleTileRenderCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleTileRenderSlowDynamic2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define DYNAMIC_RESOLUTION 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | #include "ParticleTileRenderCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleTileRenderSlowDynamicCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define DYNAMIC_RESOLUTION 14 | #include "ParticleTileRenderCS.hlsl" 15 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleTileRenderSlowLowRes2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define LOW_RESOLUTION 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | #include "ParticleTileRenderCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/ParticleTileRenderSlowLowResCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #define LOW_RESOLUTION 14 | #include "ParticleTileRenderCS.hlsl" 15 | -------------------------------------------------------------------------------- /Core/Shaders/PerfGraphBackgroundVS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: Julia Careaga 12 | // 13 | 14 | #include "PerfGraphRS.hlsli" 15 | 16 | struct VSOutput 17 | { 18 | float4 pos : SV_POSITION; 19 | float3 col : COLOR; 20 | }; 21 | 22 | cbuffer CB1 : register(b1) 23 | { 24 | float RecSize; 25 | } 26 | 27 | [RootSignature(PerfGraph_RootSig)] 28 | VSOutput main( uint vertexID : SV_VertexID, uint instanceID : SV_InstanceID ) 29 | { 30 | //VSOutput Output; 31 | //float2 uv = float2( (vertexID >> 1) & 1, vertexID & 1 ); 32 | //float2 Corner = lerp( float2(-1.0f, 1.0f), float2(1.0f, RecSize), uv ); 33 | //Corner.y -= 0.45f * instanceID; 34 | //Output.pos = float4(Corner.xy, 1.0,1); 35 | //Output.col = float3(0.0, 0.0, 0.0); 36 | //return Output; 37 | 38 | VSOutput Output; 39 | float2 uv = float2( (vertexID >> 1) & 1, vertexID & 1 ); 40 | float2 Corner = lerp( float2(-1.0f, 1.0f), float2(1.0f, -1), uv ); 41 | Output.pos = float4(Corner.xy, 1.0,1); 42 | Output.col = float3(0.0, 0.0, 0.0); 43 | return Output; 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Core/Shaders/PerfGraphPS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: Julia Careaga 12 | // 13 | 14 | #include "PerfGraphRS.hlsli" 15 | 16 | struct VSOutput 17 | { 18 | float4 pos : SV_POSITION; 19 | float3 col : COLOR; 20 | }; 21 | 22 | [RootSignature(PerfGraph_RootSig)] 23 | float4 main( VSOutput input ) : SV_TARGET 24 | { 25 | return float4(input.col, 0.75); 26 | } 27 | -------------------------------------------------------------------------------- /Core/Shaders/PerfGraphRS.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define PerfGraph_RootSig \ 15 | "RootFlags(0), " \ 16 | "CBV(b0)," \ 17 | "DescriptorTable(UAV(u0, numDescriptors = 2))," \ 18 | "SRV(t0, visibility = SHADER_VISIBILITY_VERTEX)," \ 19 | "RootConstants(b1, num32BitConstants = 3)" 20 | -------------------------------------------------------------------------------- /Core/Shaders/PerfGraphVS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: Julia Careaga 12 | // 13 | 14 | #include "PerfGraphRS.hlsli" 15 | 16 | cbuffer CBGraphColor : register(b0) 17 | { 18 | float3 Color; 19 | float RcpXScale; 20 | uint NodeCount; 21 | uint FrameID; 22 | }; 23 | 24 | cbuffer constants : register(b1) 25 | { 26 | uint Instance; 27 | float RcpYScale; 28 | } 29 | 30 | struct VSOutput 31 | { 32 | float4 pos : SV_POSITION; 33 | float3 col : COLOR; 34 | }; 35 | 36 | StructuredBuffer PerfTimes : register(t0); 37 | 38 | [RootSignature(PerfGraph_RootSig)] 39 | VSOutput main( uint VertexID : SV_VertexID ) 40 | { 41 | // Assume NodeCount is a power of 2 42 | uint offset = (FrameID + VertexID) & (NodeCount - 1); 43 | 44 | // TODO: Stop interleaving data 45 | float perfTime = saturate(PerfTimes[offset] * RcpYScale) * 2.0 - 1.0; 46 | float frame = VertexID * RcpXScale - 1.0; 47 | 48 | VSOutput output; 49 | output.pos = float4(frame, perfTime, 1, 1); 50 | output.col = Color; 51 | return output; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Core/Shaders/PixelPacking.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #ifndef __PIXEL_PACKING_HLSLI__ 15 | #define __PIXEL_PACKING_HLSLI__ 16 | 17 | #include "ColorSpaceUtility.hlsli" 18 | #include "PixelPacking_RGBE.hlsli" 19 | #include "PixelPacking_RGBM.hlsli" 20 | #include "PixelPacking_R11G11B10.hlsli" 21 | 22 | #endif // __PIXEL_PACKING_HLSLI__ 23 | -------------------------------------------------------------------------------- /Core/Shaders/PostEffectsRS.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define PostEffects_RootSig \ 15 | "RootFlags(0), " \ 16 | "RootConstants(b0, num32BitConstants = 4), " \ 17 | "DescriptorTable(UAV(u0, numDescriptors = 4))," \ 18 | "DescriptorTable(SRV(t0, numDescriptors = 4))," \ 19 | "CBV(b1)," \ 20 | "StaticSampler(s0," \ 21 | "addressU = TEXTURE_ADDRESS_CLAMP," \ 22 | "addressV = TEXTURE_ADDRESS_CLAMP," \ 23 | "addressW = TEXTURE_ADDRESS_CLAMP," \ 24 | "filter = FILTER_MIN_MAG_MIP_LINEAR)," \ 25 | "StaticSampler(s1," \ 26 | "addressU = TEXTURE_ADDRESS_BORDER," \ 27 | "addressV = TEXTURE_ADDRESS_BORDER," \ 28 | "addressW = TEXTURE_ADDRESS_BORDER," \ 29 | "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK," \ 30 | "filter = FILTER_MIN_MAG_MIP_LINEAR)" 31 | -------------------------------------------------------------------------------- /Core/Shaders/PresentRS.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define Present_RootSig \ 15 | "RootFlags(0), " \ 16 | "DescriptorTable(SRV(t0, numDescriptors = 2))," \ 17 | "RootConstants(b0, num32BitConstants = 6), " \ 18 | "SRV(t2, visibility = SHADER_VISIBILITY_PIXEL)," \ 19 | "DescriptorTable(UAV(u0, numDescriptors = 1)), " \ 20 | "StaticSampler(s0," \ 21 | "addressU = TEXTURE_ADDRESS_CLAMP," \ 22 | "addressV = TEXTURE_ADDRESS_CLAMP," \ 23 | "addressW = TEXTURE_ADDRESS_CLAMP," \ 24 | "filter = FILTER_MIN_MAG_MIP_LINEAR)," \ 25 | "StaticSampler(s1," \ 26 | "addressU = TEXTURE_ADDRESS_CLAMP," \ 27 | "addressV = TEXTURE_ADDRESS_CLAMP," \ 28 | "addressW = TEXTURE_ADDRESS_CLAMP," \ 29 | "filter = FILTER_MIN_MAG_MIP_POINT)" 30 | 31 | -------------------------------------------------------------------------------- /Core/Shaders/PresentSDRPS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "ShaderUtility.hlsli" 15 | #include "PresentRS.hlsli" 16 | 17 | Texture2D ColorTex : register(t0); 18 | 19 | [RootSignature(Present_RootSig)] 20 | float3 main( float4 position : SV_Position ) : SV_Target0 21 | { 22 | float3 LinearRGB = RemoveDisplayProfile(ColorTex[(int2)position.xy], LDR_COLOR_FORMAT); 23 | return ApplyDisplayProfile(LinearRGB, DISPLAY_PLANE_FORMAT); 24 | } 25 | -------------------------------------------------------------------------------- /Core/Shaders/ResolveTAACS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | 13 | #include "ShaderUtility.hlsli" 14 | #include "TemporalRS.hlsli" 15 | 16 | Texture2D TemporalColor : register(t0); 17 | RWTexture2D OutColor : register(u0); 18 | 19 | [RootSignature(Temporal_RootSig)] 20 | [numthreads( 8, 8, 1 )] 21 | void main( uint3 DTid : SV_DispatchThreadID ) 22 | { 23 | float4 Color = TemporalColor[DTid.xy]; 24 | OutColor[DTid.xy] = Color.rgb / max(Color.w, 1e-6); 25 | } 26 | -------------------------------------------------------------------------------- /Core/Shaders/SSAORS.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SSAO_RootSig \ 15 | "RootFlags(0), " \ 16 | "RootConstants(b0, num32BitConstants = 4), " \ 17 | "CBV(b1), " \ 18 | "DescriptorTable(UAV(u0, numDescriptors = 5))," \ 19 | "DescriptorTable(SRV(t0, numDescriptors = 5))," \ 20 | "StaticSampler(s0," \ 21 | "addressU = TEXTURE_ADDRESS_CLAMP," \ 22 | "addressV = TEXTURE_ADDRESS_CLAMP," \ 23 | "addressW = TEXTURE_ADDRESS_CLAMP," \ 24 | "filter = FILTER_MIN_MAG_MIP_LINEAR)," \ 25 | "StaticSampler(s1," \ 26 | "addressU = TEXTURE_ADDRESS_BORDER," \ 27 | "addressV = TEXTURE_ADDRESS_BORDER," \ 28 | "addressW = TEXTURE_ADDRESS_BORDER," \ 29 | "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK," \ 30 | "filter = FILTER_MIN_MAG_MIP_LINEAR)" 31 | -------------------------------------------------------------------------------- /Core/Shaders/ScreenQuadVS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | // A vertex shader for full-screen effects without a vertex buffer. The 14 | // intent is to output an over-sized triangle that encompasses the entire 15 | // screen. By doing so, we avoid rasterization inefficiency that could 16 | // result from drawing two triangles with a shared edge. 17 | // 18 | // Use null input layout 19 | // Draw(3) 20 | 21 | #include "PresentRS.hlsli" 22 | 23 | [RootSignature(Present_RootSig)] 24 | void main( 25 | in uint VertID : SV_VertexID, 26 | out float4 Pos : SV_Position, 27 | out float2 Tex : TexCoord0 28 | ) 29 | { 30 | // Texture coordinates range [0, 2], but only [0, 1] appears on screen. 31 | Tex = float2(uint2(VertID, VertID << 1) & 2); 32 | Pos = float4(lerp(float2(-1, 1), float2(1, -1), Tex), 0, 1); 33 | } 34 | -------------------------------------------------------------------------------- /Core/Shaders/ScreenTriangleVS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | // A vertex shader for full-screen effects without a vertex buffer. The 14 | // intent is to output an over-sized triangle that encompasses the entire 15 | // screen. By doing so, we avoid rasterization inefficiency that could 16 | // result from drawing two triangles with a shared edge. 17 | // 18 | // Use null input layout 19 | // Draw(4) 20 | 21 | #include "PresentRS.hlsli" 22 | 23 | [RootSignature(Present_RootSig)] 24 | void main( 25 | in uint VertID : SV_VertexID, 26 | out float4 Pos : SV_Position, 27 | out float2 Tex : TexCoord0 28 | ) 29 | { 30 | // Texture coordinates range [0, 2], but only [0, 1] appears on screen. 31 | Tex = float2(uint2(VertID, VertID << 1) & 2); 32 | Pos = float4(lerp(float2(-1, 1), float2(1, -1), Tex), 0, 1); 33 | } 34 | -------------------------------------------------------------------------------- /Core/Shaders/SharpeningUpsampleGammaPS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define GAMMA_SPACE 15 | #include "SharpeningUpsamplePS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/SkyPS.hlsl: -------------------------------------------------------------------------------- 1 | #include "SkyRS.hlsli" 2 | TextureCube g_sky:register(t0); 3 | SamplerState sampler0 : register(s0); 4 | SamplerComparisonState shadowSampler : register(s1); 5 | 6 | struct PSInputWorldPosition { 7 | float4 p : SV_POSITION; 8 | float3 p_world : POSITION0; 9 | }; 10 | 11 | 12 | [RootSignature(Sky_RootSig)] 13 | float4 main(PSInputWorldPosition input) : SV_Target{ 14 | return float4(g_sky.Sample(sampler0, input.p_world), 1.0f); 15 | } -------------------------------------------------------------------------------- /Core/Shaders/SkyRS.hlsli: -------------------------------------------------------------------------------- 1 | #include "../hlsl.hpp" 2 | #define Sky_RootSig \ 3 | "RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |"\ 4 | "DENY_HULL_SHADER_ROOT_ACCESS|"\ 5 | "DENY_DOMAIN_SHADER_ROOT_ACCESS| "\ 6 | "DENY_GEOMETRY_SHADER_ROOT_ACCESS), " \ 7 | ADD_CBUFFER_VIEW_VISIBILITY(SLOT_CBUFFER_CAMERA, SHADER_VISIBILITY_VERTEX) ", " \ 8 | ADD_CBUFFER_VIEW_VISIBILITY(SLOT_CBUFFER_WORLD, SHADER_VISIBILITY_VERTEX) ", " \ 9 | "DescriptorTable(SRV(t0, numDescriptors = 1), visibility = SHADER_VISIBILITY_PIXEL)," \ 10 | "StaticSampler(s0," \ 11 | "addressU = TEXTURE_ADDRESS_CLAMP," \ 12 | "addressV = TEXTURE_ADDRESS_CLAMP," \ 13 | "addressW = TEXTURE_ADDRESS_CLAMP," \ 14 | "filter = FILTER_MIN_MAG_MIP_LINEAR)," \ 15 | "StaticSampler(s1," \ 16 | "addressU = TEXTURE_ADDRESS_BORDER," \ 17 | "addressV = TEXTURE_ADDRESS_BORDER," \ 18 | "addressW = TEXTURE_ADDRESS_BORDER," \ 19 | "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK," \ 20 | "filter = FILTER_MIN_MAG_MIP_LINEAR)" -------------------------------------------------------------------------------- /Core/Shaders/SkyVS.hlsl: -------------------------------------------------------------------------------- 1 | #include "icosphere.hlsli" 2 | #include "SkyRS.hlsli" 3 | #include "Buffers.hlsli" 4 | 5 | struct PSInputWorldPosition { 6 | float4 p : SV_POSITION; 7 | float3 p_world : POSITION0; 8 | }; 9 | 10 | 11 | [RootSignature(Sky_RootSig)] 12 | PSInputWorldPosition main(uint vertex_id : SV_VertexID) { 13 | PSInputWorldPosition output; 14 | output.p_world = g_icosphere[vertex_id]* g_scene_lengh*20.0f; 15 | float4 p_proj = mul(modelToProjection, float4(output.p_world, 1.0)); 16 | p_proj.z = 0.0f; 17 | output.p = p_proj;; 18 | return output; 19 | } -------------------------------------------------------------------------------- /Core/Shaders/TemporalRS.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define Temporal_RootSig \ 15 | "RootFlags(0), " \ 16 | "RootConstants(b0, num32BitConstants = 4)," \ 17 | "DescriptorTable(SRV(t0, numDescriptors = 10))," \ 18 | "DescriptorTable(UAV(u0, numDescriptors = 10))," \ 19 | "CBV(b1), " \ 20 | "StaticSampler(s0," \ 21 | "addressU = TEXTURE_ADDRESS_BORDER," \ 22 | "addressV = TEXTURE_ADDRESS_BORDER," \ 23 | "addressW = TEXTURE_ADDRESS_BORDER," \ 24 | "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK," \ 25 | "filter = FILTER_MIN_MAG_MIP_LINEAR)," \ 26 | "StaticSampler(s1," \ 27 | "addressU = TEXTURE_ADDRESS_BORDER," \ 28 | "addressV = TEXTURE_ADDRESS_BORDER," \ 29 | "addressW = TEXTURE_ADDRESS_BORDER," \ 30 | "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK," \ 31 | "filter = FILTER_MIN_MAG_MIP_POINT)" 32 | 33 | -------------------------------------------------------------------------------- /Core/Shaders/TextAntialiasPS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "TextRS.hlsli" 15 | 16 | cbuffer cbFontParams : register(b0) 17 | { 18 | float4 Color; 19 | float2 ShadowOffset; 20 | float ShadowHardness; 21 | float ShadowOpacity; 22 | float HeightRange; // The range of the signed distance field. 23 | } 24 | 25 | Texture2D SignedDistanceFieldTex : register( t0 ); 26 | SamplerState LinearSampler : register( s0 ); 27 | 28 | struct PS_INPUT 29 | { 30 | float4 pos : SV_POSITION; 31 | float2 uv : TEXCOORD0; 32 | }; 33 | 34 | float GetAlpha( float2 uv ) 35 | { 36 | return saturate(SignedDistanceFieldTex.Sample(LinearSampler, uv) * HeightRange + 0.5); 37 | } 38 | 39 | [RootSignature(Text_RootSig)] 40 | float4 main( PS_INPUT Input ) : SV_Target 41 | { 42 | return float4(Color.rgb, 1) * GetAlpha(Input.uv) * Color.a; 43 | } 44 | -------------------------------------------------------------------------------- /Core/Shaders/TextRS.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define Text_RootSig \ 15 | "RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT), " \ 16 | "CBV(b0, visibility = SHADER_VISIBILITY_VERTEX)," \ 17 | "CBV(b0, visibility = SHADER_VISIBILITY_PIXEL)," \ 18 | "DescriptorTable(SRV(t0, numDescriptors = 1), visibility = SHADER_VISIBILITY_PIXEL)," \ 19 | "StaticSampler(s0, visibility = SHADER_VISIBILITY_PIXEL," \ 20 | "addressU = TEXTURE_ADDRESS_CLAMP," \ 21 | "addressV = TEXTURE_ADDRESS_CLAMP," \ 22 | "addressW = TEXTURE_ADDRESS_CLAMP," \ 23 | "filter = FILTER_MIN_MAG_MIP_LINEAR)" 24 | -------------------------------------------------------------------------------- /Core/Shaders/TextShadowPS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "TextRS.hlsli" 15 | 16 | cbuffer cbFontParams : register(b0) 17 | { 18 | float4 Color; 19 | float2 ShadowOffset; 20 | float ShadowHardness; 21 | float ShadowOpacity; 22 | float HeightRange; // The range of the signed distance field. 23 | } 24 | 25 | Texture2D SignedDistanceFieldTex : register( t0 ); 26 | SamplerState LinearSampler : register( s0 ); 27 | 28 | struct PS_INPUT 29 | { 30 | float4 pos : SV_POSITION; 31 | float2 uv : TEXCOORD0; 32 | }; 33 | 34 | float GetAlpha( float2 uv, float range ) 35 | { 36 | return saturate(SignedDistanceFieldTex.Sample(LinearSampler, uv) * range + 0.5); 37 | } 38 | 39 | [RootSignature(Text_RootSig)] 40 | float4 main( PS_INPUT Input ) : SV_Target 41 | { 42 | float alpha1 = GetAlpha(Input.uv, HeightRange) * Color.a; 43 | float alpha2 = GetAlpha(Input.uv - ShadowOffset, HeightRange * ShadowHardness) * ShadowOpacity * Color.a; 44 | return float4( Color.rgb * alpha1, lerp(alpha2, 1, alpha1) ); 45 | } 46 | -------------------------------------------------------------------------------- /Core/Shaders/ToneMap2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define SUPPORT_TYPED_UAV_LOADS 1 15 | #include "ToneMapCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/Shaders/ToneMapHDR2CS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define ENABLE_HDR_DISPLAY_MAPPING 1 15 | #define SUPPORT_TYPED_UAV_LOADS 1 16 | #include "ToneMapCS.hlsl" 17 | -------------------------------------------------------------------------------- /Core/Shaders/ToneMapHDRCS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #define ENABLE_HDR_DISPLAY_MAPPING 1 15 | #include "ToneMapCS.hlsl" 16 | -------------------------------------------------------------------------------- /Core/ShadowBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #pragma once 15 | 16 | #include "DepthBuffer.h" 17 | 18 | class EsramAllocator; 19 | 20 | class GraphicsContext; 21 | 22 | class ShadowBuffer : public DepthBuffer 23 | { 24 | public: 25 | ShadowBuffer() {} 26 | 27 | void Create( const std::wstring& Name, uint32_t Width, uint32_t Height, 28 | D3D12_GPU_VIRTUAL_ADDRESS VidMemPtr = D3D12_GPU_VIRTUAL_ADDRESS_UNKNOWN ); 29 | void Create( const std::wstring& Name, uint32_t Width, uint32_t Height, EsramAllocator& Allocator ); 30 | 31 | D3D12_CPU_DESCRIPTOR_HANDLE GetSRV() const { return GetDepthSRV(); } 32 | 33 | void BeginRendering( GraphicsContext& context ); 34 | void EndRendering( GraphicsContext& context ); 35 | 36 | private: 37 | D3D12_VIEWPORT m_Viewport; 38 | D3D12_RECT m_Scissor; 39 | }; 40 | -------------------------------------------------------------------------------- /Core/Sky.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | 4 | class ManagedTexture; 5 | class Sky 6 | { 7 | public: 8 | Sky() :m_texture(), 9 | m_scale_z(1.5f) {}; 10 | 11 | Sky(const Sky& sky) = default; 12 | 13 | Sky(Sky&& sky) noexcept = default; 14 | 15 | ~Sky() = default; 16 | 17 | Sky& operator=(const Sky& sky) noexcept = default; 18 | 19 | Sky& operator=(Sky&& sky) noexcept = default; 20 | 21 | [[nodiscard]] 22 | inline float GetScaleZ() const noexcept { 23 | return m_scale_z; 24 | } 25 | 26 | void SetTexture(std::shared_ptr texture) { 27 | m_texture = std::move(texture); 28 | } 29 | 30 | [[nodiscard]] 31 | std::shared_ptr GetTexture() const noexcept 32 | { 33 | return m_texture; 34 | } 35 | 36 | private: 37 | float m_scale_z; 38 | std::shared_ptr m_texture; 39 | }; -------------------------------------------------------------------------------- /Core/SkyPass.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Math { class Camera; } 4 | 5 | 6 | namespace SkyPass 7 | { 8 | void Initialize(void); 9 | void Shutdown(void); 10 | void Render(GraphicsContext& Context, const Math::Camera& camera); 11 | } 12 | -------------------------------------------------------------------------------- /Core/SystemTime.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | 14 | #include "pch.h" 15 | #include "SystemTime.h" 16 | 17 | double SystemTime::sm_CpuTickDelta = 0.0; 18 | 19 | // Query the performance counter frequency 20 | void SystemTime::Initialize( void ) 21 | { 22 | LARGE_INTEGER frequency; 23 | ASSERT(TRUE == QueryPerformanceFrequency(&frequency), "Unable to query performance counter frequency"); 24 | sm_CpuTickDelta = 1.0 / static_cast(frequency.QuadPart); 25 | } 26 | 27 | // Query the current value of the performance counter 28 | int64_t SystemTime::GetCurrentTick( void ) 29 | { 30 | LARGE_INTEGER currentTick; 31 | ASSERT(TRUE == QueryPerformanceCounter(¤tTick), "Unable to query performance counter value"); 32 | return static_cast(currentTick.QuadPart); 33 | } 34 | 35 | void SystemTime::BusyLoopSleep( float SleepTime ) 36 | { 37 | int64_t finalTick = (int64_t)((double)SleepTime / sm_CpuTickDelta) + GetCurrentTick(); 38 | while (GetCurrentTick() < finalTick); 39 | } 40 | -------------------------------------------------------------------------------- /Core/hlsl.hpp: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_HLSL 2 | #define HEADER_HLSL 3 | 4 | #define STR_INDIR(x) #x 5 | #define STR(x) STR_INDIR(x) 6 | 7 | #define CONCAT_B(x) b##x 8 | #define CONCAT_T(x) t##x 9 | #define CONCAT_S(x) s##x 10 | 11 | #define CBUFFER(name, slot) \ 12 | cbuffer name : register(CONCAT_B(slot)) 13 | 14 | #define ADD_CBUFFER_VIEW(slot) \ 15 | "CBV(" STR(CONCAT_B(slot)) ")" 16 | 17 | #define ADD_CBUFFER_VIEW_VISIBILITY(slot, visibility) \ 18 | "CBV(" STR(CONCAT_B(slot)) ", visibility = " STR(visibility) ")" 19 | 20 | #define SLOT_CBUFFER_CAMERA 0 21 | #define SLOT_CBUFFER_LIGHT 1 22 | #define SLOT_CBUFFER_WORLD 2 23 | #define SLOT_CBUFFER_SHADOW_LIGHT 3 24 | 25 | #define SAMPLER_TEXTURE 0 26 | #define SAMPLER_SHADOWMAP 1 27 | #define SAMPLER_NUM 2 28 | 29 | #endif -------------------------------------------------------------------------------- /Core/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Core/pch.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pch.cpp 3 | // Include the standard header and generate the precompiled header. 4 | // 5 | 6 | #include "pch.h" 7 | -------------------------------------------------------------------------------- /GSL/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Microsoft Corporation. All rights reserved. 2 | 3 | This code is licensed under the MIT License (MIT). 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /GSL/src/gsl/gsl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2015 Microsoft Corporation. All rights reserved. 4 | // 5 | // This code is licensed under the MIT License (MIT). 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13 | // THE SOFTWARE. 14 | // 15 | /////////////////////////////////////////////////////////////////////////////// 16 | 17 | #ifndef GSL_GSL_H 18 | #define GSL_GSL_H 19 | 20 | #include // copy 21 | #include // Ensures/Expects 22 | #include // byte 23 | #include // finally()/narrow()/narrow_cast()... 24 | #include // multi_span, strided_span... 25 | #include // owner, not_null 26 | #include // span 27 | #include // zstring, string_span, zstring_builder... 28 | 29 | #endif // GSL_GSL_H 30 | -------------------------------------------------------------------------------- /Images/IndirectDraw.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/Images/IndirectDraw.gif -------------------------------------------------------------------------------- /Images/compute.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/Images/compute.gif -------------------------------------------------------------------------------- /IndirectDraw/IndirectDraw.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "pch.h" 5 | 6 | 7 | #include "GameCore.h" 8 | #include "GraphicsCore.h" 9 | #include "hlsl.hpp" 10 | #include "CameraController.h" 11 | #include "BufferManager.h" 12 | #include "Camera.h" 13 | #include "GpuBuffer.h" 14 | #include "CommandContext.h" 15 | #include "SamplerManager.h" 16 | #include "TemporalEffects.h" 17 | #include "MotionBlur.h" 18 | #include "DepthOfField.h" 19 | #include "PostEffects.h" 20 | #include "SSAO.h" 21 | #include "FXAA.h" 22 | #include "SkyPass.hpp" 23 | #include "SystemTime.h" 24 | #include "TextRenderer.h" 25 | #include "ShadowCamera.h" 26 | #include "ParticleEffectManager.h" 27 | #include "GameInput.h" 28 | 29 | 30 | using namespace GameCore; 31 | using namespace Math; 32 | using namespace Graphics; 33 | class IndirectDraw : public GameCore::IGameApp 34 | { 35 | public: 36 | IndirectDraw(void) {} 37 | 38 | virtual void Startup(void) override ; 39 | virtual void Cleanup(void) override ; 40 | 41 | virtual void Update(float deltaT) override ; 42 | virtual void RenderScene(void) override ; 43 | }; 44 | 45 | 46 | 47 | void RandomColor(float v[4]) 48 | { 49 | do 50 | { 51 | v[0] = 2.0f * rand() / (float)RAND_MAX - 1.0f; 52 | v[1] = 2.0f * rand() / (float)RAND_MAX - 1.0f; 53 | v[2] = 2.0f * rand() / (float)RAND_MAX - 1.0f; 54 | } while (v[0] < 0 && v[1] < 0 && v[2] < 0); // prevent black colors 55 | v[3] = 1.0f; 56 | } 57 | -------------------------------------------------------------------------------- /IndirectDraw/Shader/drawQuadPS.hlsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | float3 main(float4 position : SV_Position, 4 | float2 tc: TexCoord0, 5 | float3 color: TexCoord1) : SV_Target0 6 | { 7 | return color; 8 | } -------------------------------------------------------------------------------- /IndirectDraw/Shader/fillCS.hlsl: -------------------------------------------------------------------------------- 1 | #define QUAD_WIDTH 8 2 | #define QUAD_HEIGHT QUAD_WIDTH 3 | 4 | 5 | struct IndirectCommand 6 | { 7 | uint2 cbvAddress; 8 | uint4 drawArguments; 9 | }; 10 | AppendStructuredBuffer outputCommands : register(u0); 11 | StructuredBuffer inputCommands : register(t0); 12 | 13 | 14 | cbuffer uniformBlock : register(b0) 15 | { 16 | float2 screen_res : packoffset(c0); 17 | float time : packoffset(c0.z); 18 | float padding : packoffset(c0.w); 19 | uint2 tile_num :packoffset(c1); 20 | uint2 tile_res :packoffset(c1.z); 21 | } 22 | 23 | 24 | bool in_heart(float2 uv) 25 | { 26 | float tt = fmod(time, 1.5) / 1.5; 27 | float ss = pow(abs(tt), .2)*0.5 + 0.5; 28 | ss = 1.0 + ss * 0.5*sin(tt*6.2831*3.0 + uv.y*0.5)*exp(-tt * 4.0); 29 | uv *= float2(0.5, 1.5) + ss * float2(0.5, -0.5); 30 | 31 | uv *= 0.8; 32 | uv.y = -0.1 - uv.y*1.2 + abs(uv.x)*(1.0 - abs(uv.x)); 33 | float r = length(uv); 34 | float d = 0.5; 35 | return d-r> 0; 36 | } 37 | 38 | [numthreads(QUAD_WIDTH, QUAD_HEIGHT, 1)] 39 | void main(uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex) 40 | { 41 | int groupIdx = Gid.y * tile_num.x + Gid.x; 42 | float2 uv = (2.0 *DTid.xy - screen_res)/ min(screen_res.x, screen_res.y); 43 | if(GTid.x == 0 && GTid.y == 0 && in_heart(uv)) 44 | outputCommands.Append(inputCommands[groupIdx]); 45 | } -------------------------------------------------------------------------------- /IndirectDraw/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2015 Microsoft 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Model/ModelAssimp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | 12 | #pragma once 13 | 14 | #include "Model.h" 15 | 16 | class AssimpModel : public Model 17 | { 18 | public: 19 | 20 | enum 21 | { 22 | format_none = 0, 23 | format_h3d, // native format 24 | 25 | formats, 26 | }; 27 | static const char *s_FormatString[]; 28 | static int FormatFromFilename(const char *filename); 29 | 30 | virtual bool Load(const char* filename) override; 31 | bool Save(const char* filename) const; 32 | 33 | private: 34 | std::string model_name; 35 | bool LoadAssimp(const char *filename); 36 | void LoadAsDXModel(); 37 | void Optimize(); 38 | void OptimizeRemoveDuplicateVertices(bool depth); 39 | void OptimizePostTransform(bool depth); 40 | void OptimizePreTransform(bool depth); 41 | }; 42 | 43 | -------------------------------------------------------------------------------- /Model/Model_VS15.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Source Files 6 | 7 | 8 | Source Files 9 | 10 | 11 | Source Files 12 | 13 | 14 | Source Files 15 | 16 | 17 | Source Files 18 | 19 | 20 | Source Files 21 | 22 | 23 | 24 | 25 | {3e74f37f-1e1e-47ed-9c44-213389384278} 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Model/Model_VS16.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Source Files 6 | 7 | 8 | Source Files 9 | 10 | 11 | 12 | 13 | {3e74f37f-1e1e-47ed-9c44-213389384278} 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Model/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ModelConverter/ModelAssimp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | 12 | #pragma once 13 | 14 | #include "Model.h" 15 | 16 | class AssimpModel : public Model 17 | { 18 | public: 19 | 20 | enum 21 | { 22 | format_none = 0, 23 | format_h3d, // native format 24 | 25 | formats, 26 | }; 27 | static const char *s_FormatString[]; 28 | static int FormatFromFilename(const char *filename); 29 | 30 | virtual bool Load(const char* filename) override; 31 | bool Save(const char* filename) const; 32 | 33 | private: 34 | 35 | bool LoadAssimp(const char *filename); 36 | 37 | void Optimize(); 38 | void OptimizeRemoveDuplicateVertices(bool depth); 39 | void OptimizePostTransform(bool depth); 40 | void OptimizePreTransform(bool depth); 41 | }; 42 | 43 | -------------------------------------------------------------------------------- /ModelConverter/ModelConverter_VS15.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | Source Files 15 | 16 | 17 | Source Files 18 | 19 | 20 | Source Files 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | -------------------------------------------------------------------------------- /ModelConverter/README.txt: -------------------------------------------------------------------------------- 1 | The model converter leverages a 3rd party model importing library called "ASSIMP" (Asset Import Library). Due to an open source licensing concern, ASSIMP is not included in this GitHub repository. You will need to download ASSIMP and install it to the 3rdParty folder. The ModelConverter project file will look for ASSIMP in "../3rdParty/assimp-3.0" unless you change the additional include directories. You should also have "assimp.dll" in your path. We recommended copying this DLL to the ModelConverter folder. The most recent version of ASSIMP is 3.2, but we have only tested with 3.0. You are welcome to make the necessary (if any) changes to work with 3.2. Please notify us via pull request or forum post if you find some discrepencies. 2 | 3 | Regards, 4 | Team Minigraph -------------------------------------------------------------------------------- /ModelConverter/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ModelConverter/readme.md: -------------------------------------------------------------------------------- 1 | The model converter leverages a 3rd party model importing library called "ASSIMP" (Asset Import Library). Due to an open source licensing concern, ASSIMP is not included in this GitHub repository. You will need to download ASSIMP and install it to the 3rdParty folder. The ModelConverter project file will look for ASSIMP in "../3rdParty/assimp-3.0" unless you change the additional include directories. You may need to rename some files/folders to make the Visual Studio project compile. It references ASSIMP as follows: 2 | 3 | * Include Path: ../3rdParty/assimp-3.0/include 4 | * Library Path: ../3rdParty/assimp-3.0/lib/release 5 | * Post-build: ../3rdParty/assimp-3.0/bin/release/assimp.dll 6 | 7 | You should also have "assimp.dll" in your path. We recommended copying this DLL to the ModelConverter folder. The most recent version of ASSIMP is 3.2, but we have only tested with 3.0. You are welcome to make the necessary (if any) changes to work with 3.2. Please notify us via pull request or forum post if you find some discrepencies. 8 | 9 | Regards, 10 | Team Minigraph -------------------------------------------------------------------------------- /ModelViewer/CompileSM6Test.bat: -------------------------------------------------------------------------------- 1 | dxc.exe /D_WAVE_OP /Zi /E"main" /Vn"g_pModelViewerPS_SM6" /Tps_6_0 /Fh"ModelViewerPS_SM6.h" /nologo Shaders/ModelViewerPS.hlsl 2 | 3 | copy ModelViewerPS_SM6.h ..\Build_VS14\x64\Debug\Output\ModelViewer\CompiledShaders 4 | copy ModelViewerPS_SM6.h ..\Build_VS14\x64\Profile\Output\ModelViewer\CompiledShaders 5 | copy ModelViewerPS_SM6.h ..\Build_VS14\x64\Release\Output\ModelViewer\CompiledShaders 6 | 7 | dxc.exe /Zi /E"main" /Vn"g_pModelViewerVS_SM6" /Tvs_6_0 /Fh"ModelViewerVS_SM6.h" /nologo Shaders/ModelViewerVS.hlsl 8 | 9 | copy ModelViewerVS_SM6.h ..\Build_VS14\x64\Debug\Output\ModelViewer\CompiledShaders 10 | copy ModelViewerVS_SM6.h ..\Build_VS14\x64\Profile\Output\ModelViewer\CompiledShaders 11 | copy ModelViewerVS_SM6.h ..\Build_VS14\x64\Release\Output\ModelViewer\CompiledShaders 12 | 13 | dxc.exe /Zi /E"main" /Vn"g_pDepthViewerVS_SM6" /Tvs_6_0 /Fh"DepthViewerVS_SM6.h" /nologo Shaders/DepthViewerVS.hlsl 14 | 15 | copy DepthViewerVS_SM6.h ..\Build_VS14\x64\Debug\Output\ModelViewer\CompiledShaders 16 | copy DepthViewerVS_SM6.h ..\Build_VS14\x64\Profile\Output\ModelViewer\CompiledShaders 17 | copy DepthViewerVS_SM6.h ..\Build_VS14\x64\Release\Output\ModelViewer\CompiledShaders 18 | -------------------------------------------------------------------------------- /ModelViewer/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Logo.png -------------------------------------------------------------------------------- /ModelViewer/Logo44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Logo44.png -------------------------------------------------------------------------------- /ModelViewer/Models/box.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Models/box.h3d -------------------------------------------------------------------------------- /ModelViewer/Models/capsule.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Models/capsule.h3d -------------------------------------------------------------------------------- /ModelViewer/Models/plane.mtl: -------------------------------------------------------------------------------- 1 | newmtl Lit 2 | Kd 0.5 0.5 0.5 3 | Ks 0.1999999 0.1999999 0.1999999 4 | illum 2 5 | 6 | -------------------------------------------------------------------------------- /ModelViewer/Models/sphere.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Models/sphere.h3d -------------------------------------------------------------------------------- /ModelViewer/Models/sponza.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Models/sponza.h3d -------------------------------------------------------------------------------- /ModelViewer/Models/yuan.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Models/yuan.h3d -------------------------------------------------------------------------------- /ModelViewer/Models/yuan.mtl: -------------------------------------------------------------------------------- 1 | # 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware 2 | # File Created: 16.10.2019 16:57:46 3 | 4 | newmtl wire_008110135 5 | Ns 32 6 | d 1 7 | Tr 0 8 | Tf 1 1 1 9 | illum 2 10 | Ka 0.0314 0.4314 0.5294 11 | Kd 0.0314 0.4314 0.5294 12 | Ks 0.3500 0.3500 0.3500 13 | -------------------------------------------------------------------------------- /ModelViewer/Shaders/DeferredShading.hlsl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Shaders/DeferredShading.hlsl -------------------------------------------------------------------------------- /ModelViewer/Shaders/DepthViewerPS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): James Stanard 12 | // 13 | 14 | #include "ModelViewerRS.hlsli" 15 | 16 | struct VSOutput 17 | { 18 | float4 pos : SV_Position; 19 | float2 uv : TexCoord0; 20 | }; 21 | 22 | Texture2D texDiffuse : register(t0); 23 | SamplerState sampler0 : register(s0); 24 | 25 | [RootSignature(ModelViewer_RootSig)] 26 | void main(VSOutput vsOutput) 27 | { 28 | if (texDiffuse.Sample(sampler0, vsOutput.uv).a < 0.5) 29 | discard; 30 | } 31 | -------------------------------------------------------------------------------- /ModelViewer/Shaders/DepthViewerVS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): James Stanard 12 | // Alex Nankervis 13 | // 14 | #include "../../Core/Shaders/Buffers.hlsli" 15 | #include "ModelViewerRS.hlsli" 16 | 17 | 18 | struct VSInput 19 | { 20 | float3 position : POSITION; 21 | float2 texcoord0 : TEXCOORD; 22 | float3 normal : NORMAL; 23 | float3 tangent : TANGENT; 24 | float3 bitangent : BITANGENT; 25 | }; 26 | 27 | struct VSOutput 28 | { 29 | float4 pos : SV_Position; 30 | float2 uv : TexCoord0; 31 | }; 32 | 33 | [RootSignature(ModelViewer_RootSig)] 34 | VSOutput main(VSInput vsInput) 35 | { 36 | VSOutput vsOutput; 37 | vsOutput.pos = mul(modelToProjection, float4(vsInput.position, 1.0)); 38 | vsOutput.uv = vsInput.texcoord0; 39 | return vsOutput; 40 | } 41 | -------------------------------------------------------------------------------- /ModelViewer/Shaders/FillLightGridCS_16.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 16 2 | #define WORK_GROUP_SIZE_Y 16 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /ModelViewer/Shaders/FillLightGridCS_24.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 24 2 | #define WORK_GROUP_SIZE_Y 24 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /ModelViewer/Shaders/FillLightGridCS_32.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 32 2 | #define WORK_GROUP_SIZE_Y 32 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /ModelViewer/Shaders/FillLightGridCS_8.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 8 2 | #define WORK_GROUP_SIZE_Y 8 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /ModelViewer/Shaders/LightGrid.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): Alex Nankervis 12 | // 13 | 14 | // keep in sync with C code 15 | #define MAX_LIGHTS 256 16 | #define TILE_SIZE (4 + MAX_LIGHTS * 4) 17 | 18 | struct LightData 19 | { 20 | float3 pos; 21 | float radiusSq; 22 | 23 | float3 color; 24 | uint type; 25 | 26 | float3 coneDir; 27 | float2 coneAngles; // x = 1.0f / (cos(coneInner) - cos(coneOuter)), y = cos(coneOuter) 28 | 29 | float4x4 shadowTextureMatrix; 30 | }; 31 | 32 | uint2 GetTilePos(float2 pos, float2 invTileDim) 33 | { 34 | return pos * invTileDim; 35 | } 36 | uint GetTileIndex(uint2 tilePos, uint tileCountX) 37 | { 38 | return tilePos.y * tileCountX + tilePos.x; 39 | } 40 | uint GetTileOffset(uint tileIndex) 41 | { 42 | return tileIndex * TILE_SIZE; 43 | } 44 | -------------------------------------------------------------------------------- /ModelViewer/Shaders/ScreenQuadVS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | // A vertex shader for full-screen effects without a vertex buffer. The 14 | // intent is to output an over-sized triangle that encompasses the entire 15 | // screen. By doing so, we avoid rasterization inefficiency that could 16 | // result from drawing two triangles with a shared edge. 17 | // 18 | // Use null input layout 19 | // Draw(3) 20 | 21 | #include "ModelViewerRS.hlsli" 22 | 23 | [RootSignature(ModelViewer_RootSig)] 24 | void main( 25 | in uint VertID : SV_VertexID, 26 | out float4 Pos : SV_Position, 27 | out float2 Tex : TexCoord0 28 | ) 29 | { 30 | // Texture coordinates range [0, 2], but only [0, 1] appears on screen. 31 | Tex = float2(uint2(VertID, VertID << 1) & 2); 32 | Pos = float4(lerp(float2(-1, 1), float2(1, -1), Tex), 0, 1); 33 | } 34 | -------------------------------------------------------------------------------- /ModelViewer/SmallLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/SmallLogo.png -------------------------------------------------------------------------------- /ModelViewer/SplashScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/SplashScreen.png -------------------------------------------------------------------------------- /ModelViewer/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/StoreLogo.png -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/background.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/background.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/background_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/background_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/chain_texture.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/chain_texture.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/chain_texture_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/chain_texture_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/gi_flag.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/gi_flag.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/lion.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/lion.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/lion_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/lion_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/spnza_bricks_a.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/spnza_bricks_a.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/spnza_bricks_a_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/spnza_bricks_a_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/spnza_bricks_a_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/spnza_bricks_a_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_arch.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_arch.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_arch_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_arch_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_arch_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_arch_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_ceiling_a.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_ceiling_a.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_ceiling_a_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_ceiling_a_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_column_a.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_column_a.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_column_a_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_column_a_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_column_a_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_column_a_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_column_b.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_column_b.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_column_b_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_column_b_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_column_b_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_column_b_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_column_c.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_column_c.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_column_c_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_column_c_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_column_c_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_column_c_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_curtain.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_curtain.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_curtain_blue.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_curtain_blue.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_curtain_green.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_curtain_green.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_details.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_details.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_details_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_details_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_fabric.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_fabric.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_fabric_blue.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_fabric_blue.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_fabric_green.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_fabric_green.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_fabric_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_fabric_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_flagpole.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_flagpole.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_flagpole_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_flagpole_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_floor_a.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_floor_a.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_floor_a_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_floor_a_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_roof.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_roof.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_thorn.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_thorn.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_thorn_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_thorn_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/sponza_thorn_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/sponza_thorn_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/vase.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/vase.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/vase_hanging.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/vase_hanging.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/vase_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/vase_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/vase_plant.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/vase_plant.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/vase_plant_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/vase_plant_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/vase_round.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/vase_round.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/vase_round_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/vase_round_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/vase_round_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/vase_round_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/Models/white.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/Models/white.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/default.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/default.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/default_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/default_normal.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/default_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/default_specular.DDS -------------------------------------------------------------------------------- /ModelViewer/Textures/fire.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/fire.dds -------------------------------------------------------------------------------- /ModelViewer/Textures/sky/sky.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/sky/sky.dds -------------------------------------------------------------------------------- /ModelViewer/Textures/sky/sky_night.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/sky/sky_night.dds -------------------------------------------------------------------------------- /ModelViewer/Textures/smoke.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/smoke.dds -------------------------------------------------------------------------------- /ModelViewer/Textures/sparkTex.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/sparkTex.dds -------------------------------------------------------------------------------- /ModelViewer/Textures/white.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/Textures/white.DDS -------------------------------------------------------------------------------- /ModelViewer/UWP.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ModelViewer 7 | Microsoft 8 | StoreLogo.png 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ModelViewer/WideLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/ModelViewer/WideLogo.png -------------------------------------------------------------------------------- /ModelViewer/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /PropertySheets/Debug.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | false 7 | 8 | 9 | 10 | _DEBUG;%(PreprocessorDefinitions) 11 | false 12 | Disabled 13 | true 14 | EnableFastChecks 15 | MultiThreadedDebugDLL 16 | 17 | 18 | true 19 | false 20 | AsInvoker 21 | 22 | 23 | true 24 | false 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PropertySheets/OrganizedBuild.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PropertySheets/Profile.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | false 7 | 8 | 9 | 10 | NDEBUG;PROFILE;%(PreprocessorDefinitions) 11 | true 12 | AnySuitable 13 | MaxSpeed 14 | MultiThreadedDLL 15 | Default 16 | 17 | 18 | true 19 | false 20 | AsInvoker 21 | 22 | 23 | true 24 | false 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PropertySheets/Release.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | false 7 | true 8 | 9 | 10 | 11 | NDEBUG;RELEASE;%(PreprocessorDefinitions) 12 | true 13 | AnySuitable 14 | MaxSpeed 15 | MultiThreadedDLL 16 | Default 17 | 18 | 19 | false 20 | true 21 | 22 | 23 | false 24 | false 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PropertySheets/Win32.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | true 7 | 8 | 9 | 10 | _WIN32;%(PreprocessorDefinitions) 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Tools/SDFFontCreator/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /Release 3 | /*.bmp 4 | /*.fnt 5 | /*.ttf 6 | /x64 -------------------------------------------------------------------------------- /Tools/SDFFontCreator/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Tools/SDFFontCreator/SDFFontCreator_VS15.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26403.7 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDFFontCreator", "SDFFontCreator_VS15.vcxproj", "{263D800B-80DF-45FB-B6FF-49EBBD6016FA}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Windows = Debug|Windows 11 | Release|Windows = Release|Windows 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {263D800B-80DF-45FB-B6FF-49EBBD6016FA}.Debug|Windows.ActiveCfg = Debug|x64 15 | {263D800B-80DF-45FB-B6FF-49EBBD6016FA}.Debug|Windows.Build.0 = Debug|x64 16 | {263D800B-80DF-45FB-B6FF-49EBBD6016FA}.Profile|Windows.ActiveCfg = Profile|x64 17 | {263D800B-80DF-45FB-B6FF-49EBBD6016FA}.Profile|Windows.Build.0 = Profile|x64 18 | {263D800B-80DF-45FB-B6FF-49EBBD6016FA}.Release|Windows.ActiveCfg = Release|x64 19 | {263D800B-80DF-45FB-B6FF-49EBBD6016FA}.Release|Windows.Build.0 = Release|x64 20 | EndGlobalSection 21 | GlobalSection(SolutionProperties) = preSolution 22 | HideSolutionNode = FALSE 23 | EndGlobalSection 24 | EndGlobal 25 | -------------------------------------------------------------------------------- /Tools/SDFFontCreator/SDFFontCreator_VS15.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 10 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Tools/SDFFontCreator/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Tools/Scripts/ProjectTemplates/LibTemplate_VS15.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {3e74f37f-1e1e-47ed-9c44-213389384278} 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Tools/Scripts/ProjectTemplates/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/Tools/Scripts/ProjectTemplates/Logo.png -------------------------------------------------------------------------------- /Tools/Scripts/ProjectTemplates/Logo44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/Tools/Scripts/ProjectTemplates/Logo44.png -------------------------------------------------------------------------------- /Tools/Scripts/ProjectTemplates/SmallLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/Tools/Scripts/ProjectTemplates/SmallLogo.png -------------------------------------------------------------------------------- /Tools/Scripts/ProjectTemplates/SplashScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/Tools/Scripts/ProjectTemplates/SplashScreen.png -------------------------------------------------------------------------------- /Tools/Scripts/ProjectTemplates/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/Tools/Scripts/ProjectTemplates/StoreLogo.png -------------------------------------------------------------------------------- /Tools/Scripts/ProjectTemplates/WideLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/Tools/Scripts/ProjectTemplates/WideLogo.png -------------------------------------------------------------------------------- /Tools/Scripts/ProjectTemplates/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Tools/Scripts/ProjectTemplates/pch.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // pch.cpp 3 | // Include the standard header and generate the precompiled header. 4 | // 5 | 6 | #include "pch.h" 7 | -------------------------------------------------------------------------------- /Tools/Scripts/TargaToDDS.py: -------------------------------------------------------------------------------- 1 | def CompileTGA( filename, normalMap=False ): 2 | import subprocess 3 | 4 | args = 'texconv.exe ' + filename + ' -nologo -vflip' 5 | if normalMap: 6 | args += ' -f BC1_UNORM' 7 | else: 8 | args += ' -srgbi -f BC1_UNORM_SRGB' 9 | 10 | print('Calling "{0}"'.format(args)) 11 | subprocess.call(args.split()) 12 | 13 | if __name__ == "__main__": 14 | import os 15 | files = os.listdir() 16 | for file in files: 17 | if file.lower().endswith('.tga'): 18 | CompileTGA(file, file.find('normal') != -1) 19 | -------------------------------------------------------------------------------- /VCT/CompileSM6Test.bat: -------------------------------------------------------------------------------- 1 | dxc.exe /D_WAVE_OP /Zi /E"main" /Vn"g_pModelViewerPS_SM6" /Tps_6_0 /Fh"ModelViewerPS_SM6.h" /nologo Shaders/ModelViewerPS.hlsl 2 | 3 | copy ModelViewerPS_SM6.h ..\Build_VS14\x64\Debug\Output\ModelViewer\CompiledShaders 4 | copy ModelViewerPS_SM6.h ..\Build_VS14\x64\Profile\Output\ModelViewer\CompiledShaders 5 | copy ModelViewerPS_SM6.h ..\Build_VS14\x64\Release\Output\ModelViewer\CompiledShaders 6 | 7 | dxc.exe /Zi /E"main" /Vn"g_pModelViewerVS_SM6" /Tvs_6_0 /Fh"ModelViewerVS_SM6.h" /nologo Shaders/ModelViewerVS.hlsl 8 | 9 | copy ModelViewerVS_SM6.h ..\Build_VS14\x64\Debug\Output\ModelViewer\CompiledShaders 10 | copy ModelViewerVS_SM6.h ..\Build_VS14\x64\Profile\Output\ModelViewer\CompiledShaders 11 | copy ModelViewerVS_SM6.h ..\Build_VS14\x64\Release\Output\ModelViewer\CompiledShaders 12 | 13 | dxc.exe /Zi /E"main" /Vn"g_pDepthViewerVS_SM6" /Tvs_6_0 /Fh"DepthViewerVS_SM6.h" /nologo Shaders/DepthViewerVS.hlsl 14 | 15 | copy DepthViewerVS_SM6.h ..\Build_VS14\x64\Debug\Output\ModelViewer\CompiledShaders 16 | copy DepthViewerVS_SM6.h ..\Build_VS14\x64\Profile\Output\ModelViewer\CompiledShaders 17 | copy DepthViewerVS_SM6.h ..\Build_VS14\x64\Release\Output\ModelViewer\CompiledShaders 18 | -------------------------------------------------------------------------------- /VCT/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Logo.png -------------------------------------------------------------------------------- /VCT/Logo44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Logo44.png -------------------------------------------------------------------------------- /VCT/Models/box.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Models/box.h3d -------------------------------------------------------------------------------- /VCT/Models/capsule.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Models/capsule.h3d -------------------------------------------------------------------------------- /VCT/Models/plane.mtl: -------------------------------------------------------------------------------- 1 | newmtl Lit 2 | Kd 0.5 0.5 0.5 3 | Ks 0.1999999 0.1999999 0.1999999 4 | illum 2 5 | 6 | -------------------------------------------------------------------------------- /VCT/Models/sphere.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Models/sphere.h3d -------------------------------------------------------------------------------- /VCT/Models/sponza.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Models/sponza.h3d -------------------------------------------------------------------------------- /VCT/Models/yuan.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Models/yuan.h3d -------------------------------------------------------------------------------- /VCT/Models/yuan.mtl: -------------------------------------------------------------------------------- 1 | # 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware 2 | # File Created: 16.10.2019 16:57:46 3 | 4 | newmtl wire_008110135 5 | Ns 32 6 | d 1 7 | Tr 0 8 | Tf 1 1 1 9 | illum 2 10 | Ka 0.0314 0.4314 0.5294 11 | Kd 0.0314 0.4314 0.5294 12 | Ks 0.3500 0.3500 0.3500 13 | -------------------------------------------------------------------------------- /VCT/Shaders/ClearClipMapCS.hlsl: -------------------------------------------------------------------------------- 1 | cbuffer CB1 : register(b0) 2 | { 3 | int3 u_min; 4 | int u_resolution; 5 | int u_clipmapLevel; 6 | int3 u_extent; 7 | int u_borderWidth = 1; 8 | } 9 | 10 | RWTexture3D voxel_texture : register(u0); 11 | [numthreads(8, 8, 8)] 12 | void main( uint3 DTid : SV_DispatchThreadID ) 13 | { 14 | if (DTid.x >= u_extent.x || 15 | DTid.y >= u_extent.y || 16 | DTid.z >= u_extent.z) return; 17 | int3 pos = (int3(DTid) + u_min) & (u_resolution - 1); 18 | 19 | int resolution = u_resolution + 2 * u_borderWidth; 20 | pos += int3(u_borderWidth, u_borderWidth, u_borderWidth); 21 | 22 | // Target correct clipmap level 23 | pos.y += u_clipmapLevel * resolution; 24 | 25 | const float4 clearColor = (0.0).xxxx; 26 | voxel_texture[pos] = clearColor; 27 | voxel_texture[pos + int3(resolution, 0, 0)] = clearColor; 28 | voxel_texture[pos + int3(2 * resolution, 0, 0)] = clearColor; 29 | voxel_texture[pos + int3(3 * resolution, 0, 0)] = clearColor; 30 | voxel_texture[pos + int3(4 * resolution, 0, 0)] = clearColor; 31 | voxel_texture[pos + int3(5 * resolution, 0, 0)] = clearColor; 32 | 33 | } -------------------------------------------------------------------------------- /VCT/Shaders/ConservertiveVoxelPassVS.hlsl: -------------------------------------------------------------------------------- 1 | 2 | struct VSInput 3 | { 4 | float3 position : POSITION; 5 | float2 texcoord0 : TEXCOORD; 6 | float3 normal : NORMAL; 7 | float3 tangent : TANGENT; 8 | float3 bitangent : BITANGENT; 9 | }; 10 | 11 | struct VSOutput 12 | { 13 | float4 position : SV_Position; 14 | float2 texCoord : TexCoord0; 15 | float3 normal : Normal; 16 | float3 posW : TexCoord1; 17 | }; 18 | 19 | VSOutput main(VSInput vsInput) 20 | { 21 | VSOutput vsOutput; 22 | 23 | vsOutput.position = float4(vsInput.position, 1.0); 24 | vsOutput.texCoord = vsInput.texcoord0; 25 | vsOutput.normal = vsInput.normal; 26 | vsOutput.posW = vsInput.position.xyz; 27 | return vsOutput; 28 | } 29 | -------------------------------------------------------------------------------- /VCT/Shaders/DeferredShading.hlsl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Shaders/DeferredShading.hlsl -------------------------------------------------------------------------------- /VCT/Shaders/DepthViewerPS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): James Stanard 12 | // 13 | 14 | #include "ModelViewerRS.hlsli" 15 | 16 | struct VSOutput 17 | { 18 | float4 pos : SV_Position; 19 | float2 uv : TexCoord0; 20 | }; 21 | 22 | Texture2D texDiffuse : register(t0); 23 | SamplerState sampler0 : register(s0); 24 | 25 | [RootSignature(ModelViewer_RootSig)] 26 | void main(VSOutput vsOutput) 27 | { 28 | if (texDiffuse.Sample(sampler0, vsOutput.uv).a < 0.5) 29 | discard; 30 | } 31 | -------------------------------------------------------------------------------- /VCT/Shaders/DepthViewerVS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): James Stanard 12 | // Alex Nankervis 13 | // 14 | #include "../../Core/Shaders/Buffers.hlsli" 15 | #include "ModelViewerRS.hlsli" 16 | 17 | 18 | struct VSInput 19 | { 20 | float3 position : POSITION; 21 | float2 texcoord0 : TEXCOORD; 22 | float3 normal : NORMAL; 23 | float3 tangent : TANGENT; 24 | float3 bitangent : BITANGENT; 25 | }; 26 | 27 | struct VSOutput 28 | { 29 | float4 pos : SV_Position; 30 | float2 uv : TexCoord0; 31 | }; 32 | 33 | [RootSignature(ModelViewer_RootSig)] 34 | VSOutput main(VSInput vsInput) 35 | { 36 | VSOutput vsOutput; 37 | vsOutput.pos = mul(modelToProjection, float4(vsInput.position, 1.0)); 38 | vsOutput.uv = vsInput.texcoord0; 39 | return vsOutput; 40 | } 41 | -------------------------------------------------------------------------------- /VCT/Shaders/FillLightGridCS_16.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 16 2 | #define WORK_GROUP_SIZE_Y 16 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /VCT/Shaders/FillLightGridCS_24.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 24 2 | #define WORK_GROUP_SIZE_Y 24 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /VCT/Shaders/FillLightGridCS_32.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 32 2 | #define WORK_GROUP_SIZE_Y 32 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /VCT/Shaders/FillLightGridCS_8.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 8 2 | #define WORK_GROUP_SIZE_Y 8 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /VCT/Shaders/LightGrid.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): Alex Nankervis 12 | // 13 | 14 | // keep in sync with C code 15 | #define MAX_LIGHTS 256 16 | #define TILE_SIZE (4 + MAX_LIGHTS * 4) 17 | 18 | struct LightData 19 | { 20 | float3 pos; 21 | float radiusSq; 22 | 23 | float3 color; 24 | uint type; 25 | 26 | float3 coneDir; 27 | float2 coneAngles; // x = 1.0f / (cos(coneInner) - cos(coneOuter)), y = cos(coneOuter) 28 | 29 | float4x4 shadowTextureMatrix; 30 | }; 31 | 32 | uint2 GetTilePos(float2 pos, float2 invTileDim) 33 | { 34 | return pos * invTileDim; 35 | } 36 | uint GetTileIndex(uint2 tilePos, uint tileCountX) 37 | { 38 | return tilePos.y * tileCountX + tilePos.x; 39 | } 40 | uint GetTileOffset(uint tileIndex) 41 | { 42 | return tileIndex * TILE_SIZE; 43 | } 44 | -------------------------------------------------------------------------------- /VCT/Shaders/ScreenQuadVS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author: James Stanard 12 | // 13 | // A vertex shader for full-screen effects without a vertex buffer. The 14 | // intent is to output an over-sized triangle that encompasses the entire 15 | // screen. By doing so, we avoid rasterization inefficiency that could 16 | // result from drawing two triangles with a shared edge. 17 | // 18 | // Use null input layout 19 | // Draw(3) 20 | 21 | #include "ModelViewerRS.hlsli" 22 | 23 | [RootSignature(ModelViewer_RootSig)] 24 | void main( 25 | in uint VertID : SV_VertexID, 26 | out float4 Pos : SV_Position, 27 | out float2 Tex : TexCoord0 28 | ) 29 | { 30 | // Texture coordinates range [0, 2], but only [0, 1] appears on screen. 31 | Tex = float2(uint2(VertID, VertID << 1) & 2); 32 | Pos = float4(lerp(float2(-1, 1), float2(1, -1), Tex), 0, 1); 33 | } 34 | -------------------------------------------------------------------------------- /VCT/Shaders/VoxelVisualizePS.hlsl: -------------------------------------------------------------------------------- 1 | cbuffer CB1 : register(b1) 2 | { 3 | float4 u_borderColor : packoffset(c0); 4 | float u_borderWidth : packoffset(c1.x); 5 | float u_alpha : packoffset(c1.y); 6 | } 7 | 8 | struct GSOutput 9 | { 10 | float4 position : SV_Position; 11 | float2 uv : TexCoord0; 12 | float4 color : TexCoord1; 13 | float3 normal:TexCoord2; 14 | }; 15 | 16 | 17 | static const float EPSILON = 0.00001; 18 | 19 | 20 | struct OMInputDeferred { 21 | float4 base_color : SV_Target0; 22 | float4 n : SV_Target1; 23 | float2 material : SV_Target2; 24 | }; 25 | 26 | float2 EncodeUnitVector_CryEngine(float3 u) 27 | { 28 | //https://aras-p.info/texts/CompactNormalStorage.html 29 | return normalize(u.xy) * sqrt(u.z * 0.5f + 0.5f); 30 | } 31 | 32 | OMInputDeferred main(GSOutput In) 33 | { 34 | OMInputDeferred output; 35 | float4 out_color = In.color; 36 | if (u_borderWidth > EPSILON) 37 | out_color = lerp(u_borderColor, In.color, min(min(In.uv.x, min(In.uv.y, min((1.0 - In.uv.x), (1.0 - In.uv.y)))) / u_borderWidth, 1.0)); 38 | out_color.a = u_alpha; 39 | output.base_color = out_color; 40 | output.n.xy = EncodeUnitVector_CryEngine(In.normal); 41 | output.material.x = 0.0f; 42 | output.material.y = 0.0f; 43 | return output; 44 | } -------------------------------------------------------------------------------- /VCT/Shaders/VoxelVisualizeVS.hlsl: -------------------------------------------------------------------------------- 1 | float4 main( float4 pos : POSITION ) : SV_POSITION 2 | { 3 | return float4(pos.xyz,1.0f); 4 | } -------------------------------------------------------------------------------- /VCT/SmallLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/SmallLogo.png -------------------------------------------------------------------------------- /VCT/SplashScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/SplashScreen.png -------------------------------------------------------------------------------- /VCT/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/StoreLogo.png -------------------------------------------------------------------------------- /VCT/Textures/Models/background.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/background.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/background_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/background_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/chain_texture.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/chain_texture.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/chain_texture_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/chain_texture_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/gi_flag.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/gi_flag.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/lion.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/lion.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/lion_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/lion_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/spnza_bricks_a.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/spnza_bricks_a.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/spnza_bricks_a_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/spnza_bricks_a_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/spnza_bricks_a_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/spnza_bricks_a_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_arch.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_arch.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_arch_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_arch_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_arch_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_arch_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_ceiling_a.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_ceiling_a.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_ceiling_a_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_ceiling_a_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_column_a.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_column_a.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_column_a_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_column_a_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_column_a_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_column_a_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_column_b.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_column_b.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_column_b_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_column_b_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_column_b_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_column_b_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_column_c.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_column_c.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_column_c_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_column_c_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_column_c_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_column_c_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_curtain.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_curtain.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_curtain_blue.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_curtain_blue.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_curtain_green.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_curtain_green.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_details.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_details.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_details_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_details_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_fabric.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_fabric.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_fabric_blue.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_fabric_blue.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_fabric_green.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_fabric_green.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_fabric_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_fabric_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_flagpole.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_flagpole.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_flagpole_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_flagpole_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_floor_a.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_floor_a.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_floor_a_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_floor_a_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_roof.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_roof.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_thorn.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_thorn.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_thorn_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_thorn_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/sponza_thorn_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/sponza_thorn_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/vase.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/vase.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/vase_hanging.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/vase_hanging.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/vase_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/vase_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/vase_plant.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/vase_plant.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/vase_plant_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/vase_plant_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/vase_round.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/vase_round.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/vase_round_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/vase_round_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/vase_round_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/vase_round_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/Models/white.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/Models/white.DDS -------------------------------------------------------------------------------- /VCT/Textures/default.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/default.DDS -------------------------------------------------------------------------------- /VCT/Textures/default_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/default_normal.DDS -------------------------------------------------------------------------------- /VCT/Textures/default_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/default_specular.DDS -------------------------------------------------------------------------------- /VCT/Textures/fire.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/fire.dds -------------------------------------------------------------------------------- /VCT/Textures/sky/sky.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/sky/sky.dds -------------------------------------------------------------------------------- /VCT/Textures/sky/sky_night.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/sky/sky_night.dds -------------------------------------------------------------------------------- /VCT/Textures/smoke.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/smoke.dds -------------------------------------------------------------------------------- /VCT/Textures/sparkTex.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/sparkTex.dds -------------------------------------------------------------------------------- /VCT/Textures/white.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/Textures/white.DDS -------------------------------------------------------------------------------- /VCT/UWP.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ModelViewer 7 | Microsoft 8 | StoreLogo.png 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /VCT/VisualizeMesh.cpp: -------------------------------------------------------------------------------- 1 | #include "VisualizeMesh.hpp" 2 | 3 | namespace Voxel 4 | { 5 | VisualMesh::VisualMesh(): 6 | m_vertexCount(0) 7 | { } 8 | 9 | void VisualMesh::Create(const size_t resolution) 10 | { 11 | m_vertexCount = size_t(resolution * resolution * resolution ); 12 | std::vector vertices; 13 | vertices.reserve(m_vertexCount); 14 | for(size_t x =0;x 0); 29 | context.SetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_POINTLIST); 30 | context.SetVertexBuffer(0, m_VertexBuffer.VertexBufferView()); 31 | context.Draw((UINT)m_vertexCount,0); 32 | } 33 | } -------------------------------------------------------------------------------- /VCT/VisualizeMesh.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameCore.h" 3 | #include "GraphicsCore.h" 4 | #include "CommandContext.h" 5 | 6 | namespace Voxel 7 | { 8 | class VisualMesh 9 | { 10 | public: 11 | VisualMesh(); 12 | 13 | VisualMesh(const VisualMesh& _) = delete; 14 | 15 | VisualMesh& operator = (const VisualMesh& _) = delete; 16 | 17 | 18 | ~VisualMesh(); 19 | 20 | void Create(const size_t count); 21 | 22 | void Draw(GraphicsContext& context); 23 | 24 | private: 25 | 26 | StructuredBuffer m_VertexBuffer; 27 | 28 | size_t m_vertexCount; 29 | }; 30 | } -------------------------------------------------------------------------------- /VCT/VoxelRegion.cpp: -------------------------------------------------------------------------------- 1 | #pragma region 2 | #include "VoxelRegion.hpp" 3 | #pragma endregion 4 | -------------------------------------------------------------------------------- /VCT/WideLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VCT/WideLogo.png -------------------------------------------------------------------------------- /VCT/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /VCT/voxelClear.hpp: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include "GameCore.h" 4 | #include "GraphicsCore.h" 5 | #include "CommandContext.h" 6 | #include "Texture3D.h" 7 | 8 | using namespace Math; 9 | using namespace GameCore; 10 | 11 | namespace VoxelClear 12 | { 13 | void Initialize(void); 14 | 15 | void Apply(ComputeContext& context); 16 | 17 | __declspec(align(16)) struct ConstantBuffer 18 | { 19 | glm::ivec3 u_min; 20 | int u_resolution; 21 | int u_clipmapLevel; 22 | glm::ivec3 u_extent; 23 | int u_borderWidth = 1; 24 | }; 25 | 26 | void SetConstantBuffer(ConstantBuffer buffer); 27 | 28 | void SetUAV(D3D12_CPU_DESCRIPTOR_HANDLE _handle); 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /VCT/voxelizationPass.hpp: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include "Math/Vector.h" 4 | #include "Math/Matrix4.h" 5 | #include "GameCore.h" 6 | #include "GraphicsCore.h" 7 | #include "CommandContext.h" 8 | #include "VoxelRegion.hpp" 9 | 10 | using namespace Math; 11 | using namespace GameCore; 12 | using namespace Voxel; 13 | 14 | namespace VoxelizationPass 15 | { 16 | void Initialize(void); 17 | 18 | void Render(GraphicsContext& context, const VoxelRegion& region, const int clip_level); 19 | 20 | __declspec(align(16)) struct voxelizationGSCBuffer 21 | { 22 | Matrix4 u_viewProj[3]; 23 | Matrix4 u_viewProjInv[3]; 24 | F32x2 u_viewportSizes[3]; 25 | }; 26 | 27 | __declspec(align(16)) struct voxelizationPSCBuffer 28 | { 29 | int u_clipmapLevel; 30 | int u_clipmapResolution; 31 | int u_clipmapResolutionWithBorder; 32 | int _; 33 | F32x3 u_regionMin; 34 | float __; 35 | F32x3 u_regionMax; 36 | float ___; 37 | F32x3 u_prevRegionMin; 38 | float ____; 39 | F32x3 u_prevRegionMax; 40 | float _____; 41 | float u_downsampleTransitionRegionSize; 42 | float u_maxExtent; 43 | float u_voxelSize; 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /VirtualTexture/Models/capsule.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VirtualTexture/Models/capsule.h3d -------------------------------------------------------------------------------- /VirtualTexture/Models/sphere.h3d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VirtualTexture/Models/sphere.h3d -------------------------------------------------------------------------------- /VirtualTexture/Shader/drawQuadPS.hlsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | float3 main(float4 position : SV_Position, 4 | float2 tc: TexCoord0, 5 | float3 color: TexCoord1) : SV_Target0 6 | { 7 | return color; 8 | } -------------------------------------------------------------------------------- /VirtualTexture/Shader/fillCS.hlsl: -------------------------------------------------------------------------------- 1 | #define QUAD_WIDTH 8 2 | #define QUAD_HEIGHT QUAD_WIDTH 3 | 4 | 5 | struct IndirectCommand 6 | { 7 | uint2 cbvAddress; 8 | uint4 drawArguments; 9 | }; 10 | AppendStructuredBuffer outputCommands : register(u0); 11 | StructuredBuffer inputCommands : register(t0); 12 | 13 | 14 | cbuffer uniformBlock : register(b0) 15 | { 16 | float2 screen_res : packoffset(c0); 17 | float time : packoffset(c0.z); 18 | float padding : packoffset(c0.w); 19 | uint2 tile_num :packoffset(c1); 20 | uint2 tile_res :packoffset(c1.z); 21 | } 22 | 23 | 24 | bool in_heart(float2 uv) 25 | { 26 | float tt = fmod(time, 1.5) / 1.5; 27 | float ss = pow(abs(tt), .2)*0.5 + 0.5; 28 | ss = 1.0 + ss * 0.5*sin(tt*6.2831*3.0 + uv.y*0.5)*exp(-tt * 4.0); 29 | uv *= float2(0.5, 1.5) + ss * float2(0.5, -0.5); 30 | 31 | uv *= 0.8; 32 | uv.y = -0.1 - uv.y*1.2 + abs(uv.x)*(1.0 - abs(uv.x)); 33 | float r = length(uv); 34 | float d = 0.5; 35 | return d-r> 0; 36 | } 37 | 38 | [numthreads(QUAD_WIDTH, QUAD_HEIGHT, 1)] 39 | void main(uint3 Gid : SV_GroupID, uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint GI : SV_GroupIndex) 40 | { 41 | int groupIdx = Gid.y * tile_num.x + Gid.x; 42 | float2 uv = (2.0 *DTid.xy - screen_res)/ min(screen_res.x, screen_res.y); 43 | if(GTid.x == 0 && GTid.y == 0 && in_heart(uv)) 44 | outputCommands.Append(inputCommands[groupIdx]); 45 | } -------------------------------------------------------------------------------- /VirtualTexture/Shaders/DepthViewerPS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): James Stanard 12 | // 13 | 14 | #include "ModelViewerRS.hlsli" 15 | 16 | struct VSOutput 17 | { 18 | float4 pos : SV_Position; 19 | float2 uv : TexCoord0; 20 | }; 21 | 22 | Texture2D texDiffuse : register(t0); 23 | SamplerState sampler0 : register(s0); 24 | 25 | [RootSignature(ModelViewer_RootSig)] 26 | void main(VSOutput vsOutput) 27 | { 28 | if (texDiffuse.Sample(sampler0, vsOutput.uv).a < 0.5) 29 | discard; 30 | } 31 | -------------------------------------------------------------------------------- /VirtualTexture/Shaders/DepthViewerVS.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): James Stanard 12 | // Alex Nankervis 13 | // 14 | #include "../../Core/Shaders/Buffers.hlsli" 15 | #include "ModelViewerRS.hlsli" 16 | 17 | 18 | struct VSInput 19 | { 20 | float3 position : POSITION; 21 | float2 texcoord0 : TEXCOORD; 22 | float3 normal : NORMAL; 23 | float3 tangent : TANGENT; 24 | float3 bitangent : BITANGENT; 25 | }; 26 | 27 | struct VSOutput 28 | { 29 | float4 pos : SV_Position; 30 | float2 uv : TexCoord0; 31 | }; 32 | 33 | [RootSignature(ModelViewer_RootSig)] 34 | VSOutput main(VSInput vsInput) 35 | { 36 | VSOutput vsOutput; 37 | vsOutput.pos = mul(modelToProjection, float4(vsInput.position, 1.0)); 38 | vsOutput.uv = vsInput.texcoord0; 39 | return vsOutput; 40 | } 41 | -------------------------------------------------------------------------------- /VirtualTexture/Shaders/FillLightGridCS_16.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 16 2 | #define WORK_GROUP_SIZE_Y 16 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /VirtualTexture/Shaders/FillLightGridCS_24.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 24 2 | #define WORK_GROUP_SIZE_Y 24 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /VirtualTexture/Shaders/FillLightGridCS_32.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 32 2 | #define WORK_GROUP_SIZE_Y 32 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /VirtualTexture/Shaders/FillLightGridCS_8.hlsl: -------------------------------------------------------------------------------- 1 | #define WORK_GROUP_SIZE_X 8 2 | #define WORK_GROUP_SIZE_Y 8 3 | #define WORK_GROUP_SIZE_Z 1 4 | 5 | #include "FillLightGridCS.hlsli" 6 | -------------------------------------------------------------------------------- /VirtualTexture/Shaders/LightGrid.hlsli: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft. All rights reserved. 3 | // This code is licensed under the MIT License (MIT). 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | // Developed by Minigraph 10 | // 11 | // Author(s): Alex Nankervis 12 | // 13 | 14 | // keep in sync with C code 15 | #define MAX_LIGHTS 256 16 | #define TILE_SIZE (4 + MAX_LIGHTS * 4) 17 | 18 | struct LightData 19 | { 20 | float3 pos; 21 | float radiusSq; 22 | 23 | float3 color; 24 | uint type; 25 | 26 | float3 coneDir; 27 | float2 coneAngles; // x = 1.0f / (cos(coneInner) - cos(coneOuter)), y = cos(coneOuter) 28 | 29 | float4x4 shadowTextureMatrix; 30 | }; 31 | 32 | uint2 GetTilePos(float2 pos, float2 invTileDim) 33 | { 34 | return pos * invTileDim; 35 | } 36 | uint GetTileIndex(uint2 tilePos, uint tileCountX) 37 | { 38 | return tilePos.y * tileCountX + tilePos.x; 39 | } 40 | uint GetTileOffset(uint tileIndex) 41 | { 42 | return tileIndex * TILE_SIZE; 43 | } 44 | -------------------------------------------------------------------------------- /VirtualTexture/Textures/default.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VirtualTexture/Textures/default.DDS -------------------------------------------------------------------------------- /VirtualTexture/Textures/default_normal.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VirtualTexture/Textures/default_normal.DDS -------------------------------------------------------------------------------- /VirtualTexture/Textures/default_specular.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VirtualTexture/Textures/default_specular.DDS -------------------------------------------------------------------------------- /VirtualTexture/Textures/fire.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VirtualTexture/Textures/fire.dds -------------------------------------------------------------------------------- /VirtualTexture/Textures/smoke.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VirtualTexture/Textures/smoke.dds -------------------------------------------------------------------------------- /VirtualTexture/Textures/sparkTex.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VirtualTexture/Textures/sparkTex.dds -------------------------------------------------------------------------------- /VirtualTexture/Textures/white.DDS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/VirtualTexture/Textures/white.DDS -------------------------------------------------------------------------------- /VirtualTexture/UWP.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | ModelViewer 7 | Microsoft 8 | StoreLogo.png 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /VirtualTexture/image_generator.py: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | from PIL import ImageDraw 3 | from PIL import ImageFont 4 | import os 5 | image_dir_name = "images" 6 | texture_scale = 0.25 7 | image_name_prefix = "image_" 8 | 9 | 10 | def to_scale_size(input): 11 | return (int)(input*texture_scale) 12 | 13 | texture_size = to_scale_size(512) 14 | 15 | 16 | def image_char(char, image_size, font_size, outline_lenght, number_str): 17 | img = Image.new("RGB", (image_size, image_size), (0,0,0)) 18 | draw = ImageDraw.Draw(img) 19 | draw.rectangle([(outline_lenght, outline_lenght), (image_size-outline_lenght, image_size-outline_lenght)], fill =(255,255,255) ) 20 | font_path = "C:\Windows\Fonts\Arial.ttf" 21 | font = ImageFont.truetype(font_path, font_size) 22 | draw.text((to_scale_size(5), to_scale_size(135)), char, (255,0,0),font=font) 23 | save_location = os.getcwd() 24 | dir_name = save_location + os.path.sep + image_dir_name 25 | if not os.path.isdir(dir_name): 26 | os.mkdir(dir_name) 27 | img.save(dir_name + os.path.sep + number_str + '.png') 28 | 29 | 30 | if __name__ == "__main__": 31 | for i in xrange(1024): 32 | number_str = '{:3d}'.format(i) 33 | file_str = '{:03d}'.format(i) 34 | image_char(number_str, image_size = texture_size, font_size = to_scale_size(300), outline_lenght =0, number_str = image_name_prefix+file_str) 35 | 36 | -------------------------------------------------------------------------------- /VirtualTexture/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # General Configuration 3 | ############################################################################### 4 | version: 1.0.{build} 5 | 6 | ############################################################################### 7 | # Environment Configuration 8 | ############################################################################### 9 | image: Visual Studio 2017 10 | 11 | configuration: 12 | - Release 13 | - Debug 14 | platform: 15 | - x64 16 | 17 | ############################################################################### 18 | # Build Configuration 19 | ############################################################################### 20 | build: 21 | project: ModelViewer\ModelViewer_VS15.sln 22 | verbosity: normal 23 | 24 | # Execute script before build 25 | before_build: 26 | - nuget restore ModelViewer\ModelViewer_VS15.sln -------------------------------------------------------------------------------- /stdout.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sienaiwun/Dx12Practice/3c75fc8e6367816882955888a0e9ea7021d46a62/stdout.txt -------------------------------------------------------------------------------- /todolist.txt: -------------------------------------------------------------------------------- 1 | Draw frequency --------------------------------------------------------------------------------